File manager - Edit - /home/kunzqhe/photostocker/wp-includes/images/media/dist.tar
Back
core-data.js 0000644 00000661310 15151622574 0006760 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 287: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ fL: () => (/* binding */ pascalCase), /* harmony export */ l3: () => (/* binding */ pascalCaseTransform) /* harmony export */ }); /* unused harmony export pascalCaseTransformMerge */ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1635); /* harmony import */ var no_case__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2226); function pascalCaseTransform(input, index) { var firstChar = input.charAt(0); var lowerChars = input.substr(1).toLowerCase(); if (index > 0 && firstChar >= "0" && firstChar <= "9") { return "_" + firstChar + lowerChars; } return "" + firstChar.toUpperCase() + lowerChars; } function pascalCaseTransformMerge(input) { return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase(); } function pascalCase(input, options) { if (options === void 0) { options = {}; } return (0,no_case__WEBPACK_IMPORTED_MODULE_0__/* .noCase */ .W)(input, (0,tslib__WEBPACK_IMPORTED_MODULE_1__/* .__assign */ .Cl)({ delimiter: "", transform: pascalCaseTransform }, options)); } /***/ }), /***/ 533: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ get_normalized_comma_separable_default) /* harmony export */ }); function getNormalizedCommaSeparable(value) { if (typeof value === "string") { return value.split(","); } else if (Array.isArray(value)) { return value; } return null; } var get_normalized_comma_separable_default = getNormalizedCommaSeparable; /***/ }), /***/ 1455: /***/ ((module) => { "use strict"; module.exports = window["wp"]["apiFetch"]; /***/ }), /***/ 1635: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Cl: () => (/* binding */ __assign) /* harmony export */ }); /* unused harmony exports __extends, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension */ /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { 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); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { 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; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 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]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 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; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; 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); 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); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 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"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 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"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); /***/ }), /***/ 2226: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ W: () => (/* binding */ noCase) /* harmony export */ }); /* harmony import */ var lower_case__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7314); // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; /** * Normalize the string into something other libraries can manipulate easier. */ function noCase(input, options) { if (options === void 0) { options = {}; } 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 ? lower_case__WEBPACK_IMPORTED_MODULE_0__/* .lowerCase */ .g : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; // Trim the delimiter from around the output string. while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; // Transform each token independently. return result.slice(start, end).split("\0").map(transform).join(delimiter); } /** * Replace `re` in the input string with the replacement value. */ function replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } /***/ }), /***/ 2239: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: () => (/* binding */ createLocksActions) }); ;// ./node_modules/@wordpress/core-data/build-module/locks/utils.js function deepCopyLocksTreePath(tree, path) { const newTree = { ...tree }; let currentNode = newTree; for (const branchName of path) { currentNode.children = { ...currentNode.children, [branchName]: { locks: [], children: {}, ...currentNode.children[branchName] } }; currentNode = currentNode.children[branchName]; } return newTree; } function getNode(tree, path) { let currentNode = tree; for (const branchName of path) { const nextNode = currentNode.children[branchName]; if (!nextNode) { return null; } currentNode = nextNode; } return currentNode; } function* iteratePath(tree, path) { let currentNode = tree; yield currentNode; for (const branchName of path) { const nextNode = currentNode.children[branchName]; if (!nextNode) { break; } yield nextNode; currentNode = nextNode; } } function* iterateDescendants(node) { const stack = Object.values(node.children); while (stack.length) { const childNode = stack.pop(); yield childNode; stack.push(...Object.values(childNode.children)); } } function hasConflictingLock({ exclusive }, locks) { if (exclusive && locks.length) { return true; } if (!exclusive && locks.filter((lock) => lock.exclusive).length) { return true; } return false; } ;// ./node_modules/@wordpress/core-data/build-module/locks/reducer.js const DEFAULT_STATE = { requests: [], tree: { locks: [], children: {} } }; function locks(state = DEFAULT_STATE, action) { switch (action.type) { case "ENQUEUE_LOCK_REQUEST": { const { request } = action; return { ...state, requests: [request, ...state.requests] }; } case "GRANT_LOCK_REQUEST": { const { lock, request } = action; const { store, path } = request; const storePath = [store, ...path]; const newTree = deepCopyLocksTreePath(state.tree, storePath); const node = getNode(newTree, storePath); node.locks = [...node.locks, lock]; return { ...state, requests: state.requests.filter((r) => r !== request), tree: newTree }; } case "RELEASE_LOCK": { const { lock } = action; const storePath = [lock.store, ...lock.path]; const newTree = deepCopyLocksTreePath(state.tree, storePath); const node = getNode(newTree, storePath); node.locks = node.locks.filter((l) => l !== lock); return { ...state, tree: newTree }; } } return state; } ;// ./node_modules/@wordpress/core-data/build-module/locks/selectors.js function getPendingLockRequests(state) { return state.requests; } function isLockAvailable(state, store, path, { exclusive }) { const storePath = [store, ...path]; const locks = state.tree; for (const node2 of iteratePath(locks, storePath)) { if (hasConflictingLock({ exclusive }, node2.locks)) { return false; } } const node = getNode(locks, storePath); if (!node) { return true; } for (const descendant of iterateDescendants(node)) { if (hasConflictingLock({ exclusive }, descendant.locks)) { return false; } } return true; } ;// ./node_modules/@wordpress/core-data/build-module/locks/engine.js function createLocks() { let state = locks(void 0, { type: "@@INIT" }); function processPendingLockRequests() { for (const request of getPendingLockRequests(state)) { const { store, path, exclusive, notifyAcquired } = request; if (isLockAvailable(state, store, path, { exclusive })) { const lock = { store, path, exclusive }; state = locks(state, { type: "GRANT_LOCK_REQUEST", lock, request }); notifyAcquired(lock); } } } function acquire(store, path, exclusive) { return new Promise((resolve) => { state = locks(state, { type: "ENQUEUE_LOCK_REQUEST", request: { store, path, exclusive, notifyAcquired: resolve } }); processPendingLockRequests(); }); } function release(lock) { state = locks(state, { type: "RELEASE_LOCK", lock }); processPendingLockRequests(); } return { acquire, release }; } ;// ./node_modules/@wordpress/core-data/build-module/locks/actions.js function createLocksActions() { const locks = createLocks(); function __unstableAcquireStoreLock(store, path, { exclusive }) { return () => locks.acquire(store, path, exclusive); } function __unstableReleaseStoreLock(lock) { return () => locks.release(lock); } return { __unstableAcquireStoreLock, __unstableReleaseStoreLock }; } /***/ }), /***/ 2278: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ E: () => (/* binding */ STORE_NAME) /* harmony export */ }); const STORE_NAME = "core"; /***/ }), /***/ 2577: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CO: () => (/* binding */ ALLOWED_RESOURCE_ACTIONS), /* harmony export */ kC: () => (/* binding */ getUserPermissionCacheKey), /* harmony export */ qY: () => (/* binding */ getUserPermissionsFromAllowHeader) /* harmony export */ }); const ALLOWED_RESOURCE_ACTIONS = [ "create", "read", "update", "delete" ]; function getUserPermissionsFromAllowHeader(allowedMethods) { const permissions = {}; if (!allowedMethods) { return permissions; } const methods = { create: "POST", read: "GET", update: "PUT", delete: "DELETE" }; for (const [actionName, methodName] of Object.entries(methods)) { permissions[actionName] = allowedMethods.includes(methodName); } return permissions; } function getUserPermissionCacheKey(action, resource, id) { const key = (typeof resource === "object" ? [action, resource.kind, resource.name, resource.id] : [action, resource, id]).filter(Boolean).join("/"); return key; } /***/ }), /***/ 2859: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ n: () => (/* binding */ Status) /* harmony export */ }); var Status = /* @__PURE__ */ ((Status2) => { Status2["Idle"] = "IDLE"; Status2["Resolving"] = "RESOLVING"; Status2["Error"] = "ERROR"; Status2["Success"] = "SUCCESS"; return Status2; })(Status || {}); /***/ }), /***/ 3249: /***/ ((module) => { "use strict"; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } /** * Given an instance of EquivalentKeyMap, returns its internal value pair tuple * for a key, if one exists. The tuple members consist of the last reference * value for the key (used in efficient subsequent lookups) and the value * assigned for the key at the leaf node. * * @param {EquivalentKeyMap} instance EquivalentKeyMap instance. * @param {*} key The key for which to return value pair. * * @return {?Array} Value pair, if exists. */ function getValuePair(instance, key) { var _map = instance._map, _arrayTreeMap = instance._arrayTreeMap, _objectTreeMap = instance._objectTreeMap; // Map keeps a reference to the last object-like key used to set the // value, which can be used to shortcut immediately to the value. if (_map.has(key)) { return _map.get(key); } // Sort keys to ensure stable retrieval from tree. var properties = Object.keys(key).sort(); // Tree by type to avoid conflicts on numeric object keys, empty value. var map = Array.isArray(key) ? _arrayTreeMap : _objectTreeMap; for (var i = 0; i < properties.length; i++) { var property = properties[i]; map = map.get(property); if (map === undefined) { return; } var propertyValue = key[property]; map = map.get(propertyValue); if (map === undefined) { return; } } var valuePair = map.get('_ekm_value'); if (!valuePair) { return; } // If reached, it implies that an object-like key was set with another // reference, so delete the reference and replace with the current. _map.delete(valuePair[0]); valuePair[0] = key; map.set('_ekm_value', valuePair); _map.set(key, valuePair); return valuePair; } /** * Variant of a Map object which enables lookup by equivalent (deeply equal) * object and array keys. */ var EquivalentKeyMap = /*#__PURE__*/ function () { /** * Constructs a new instance of EquivalentKeyMap. * * @param {Iterable.<*>} iterable Initial pair of key, value for map. */ function EquivalentKeyMap(iterable) { _classCallCheck(this, EquivalentKeyMap); this.clear(); if (iterable instanceof EquivalentKeyMap) { // Map#forEach is only means of iterating with support for IE11. var iterablePairs = []; iterable.forEach(function (value, key) { iterablePairs.push([key, value]); }); iterable = iterablePairs; } if (iterable != null) { for (var i = 0; i < iterable.length; i++) { this.set(iterable[i][0], iterable[i][1]); } } } /** * Accessor property returning the number of elements. * * @return {number} Number of elements. */ _createClass(EquivalentKeyMap, [{ key: "set", /** * Add or update an element with a specified key and value. * * @param {*} key The key of the element to add. * @param {*} value The value of the element to add. * * @return {EquivalentKeyMap} Map instance. */ value: function set(key, value) { // Shortcut non-object-like to set on internal Map. if (key === null || _typeof(key) !== 'object') { this._map.set(key, value); return this; } // Sort keys to ensure stable assignment into tree. var properties = Object.keys(key).sort(); var valuePair = [key, value]; // Tree by type to avoid conflicts on numeric object keys, empty value. var map = Array.isArray(key) ? this._arrayTreeMap : this._objectTreeMap; for (var i = 0; i < properties.length; i++) { var property = properties[i]; if (!map.has(property)) { map.set(property, new EquivalentKeyMap()); } map = map.get(property); var propertyValue = key[property]; if (!map.has(propertyValue)) { map.set(propertyValue, new EquivalentKeyMap()); } map = map.get(propertyValue); } // If an _ekm_value exists, there was already an equivalent key. Before // overriding, ensure that the old key reference is removed from map to // avoid memory leak of accumulating equivalent keys. This is, in a // sense, a poor man's WeakMap, while still enabling iterability. var previousValuePair = map.get('_ekm_value'); if (previousValuePair) { this._map.delete(previousValuePair[0]); } map.set('_ekm_value', valuePair); this._map.set(key, valuePair); return this; } /** * Returns a specified element. * * @param {*} key The key of the element to return. * * @return {?*} The element associated with the specified key or undefined * if the key can't be found. */ }, { key: "get", value: function get(key) { // Shortcut non-object-like to get from internal Map. if (key === null || _typeof(key) !== 'object') { return this._map.get(key); } var valuePair = getValuePair(this, key); if (valuePair) { return valuePair[1]; } } /** * Returns a boolean indicating whether an element with the specified key * exists or not. * * @param {*} key The key of the element to test for presence. * * @return {boolean} Whether an element with the specified key exists. */ }, { key: "has", value: function has(key) { if (key === null || _typeof(key) !== 'object') { return this._map.has(key); } // Test on the _presence_ of the pair, not its value, as even undefined // can be a valid member value for a key. return getValuePair(this, key) !== undefined; } /** * Removes the specified element. * * @param {*} key The key of the element to remove. * * @return {boolean} Returns true if an element existed and has been * removed, or false if the element does not exist. */ }, { key: "delete", value: function _delete(key) { if (!this.has(key)) { return false; } // This naive implementation will leave orphaned child trees. A better // implementation should traverse and remove orphans. this.set(key, undefined); return true; } /** * Executes a provided function once per each key/value pair, in insertion * order. * * @param {Function} callback Function to execute for each element. * @param {*} thisArg Value to use as `this` when executing * `callback`. */ }, { key: "forEach", value: function forEach(callback) { var _this = this; var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this; this._map.forEach(function (value, key) { // Unwrap value from object-like value pair. if (key !== null && _typeof(key) === 'object') { value = value[1]; } callback.call(thisArg, value, key, _this); }); } /** * Removes all elements. */ }, { key: "clear", value: function clear() { this._map = new Map(); this._arrayTreeMap = new Map(); this._objectTreeMap = new Map(); } }, { key: "size", get: function get() { return this._map.size; } }]); return EquivalentKeyMap; }(); module.exports = EquivalentKeyMap; /***/ }), /***/ 3377: /***/ (() => { /***/ }), /***/ 3440: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { __experimentalBatch: () => (/* binding */ __experimentalBatch), __experimentalReceiveCurrentGlobalStylesId: () => (/* binding */ __experimentalReceiveCurrentGlobalStylesId), __experimentalReceiveThemeBaseGlobalStyles: () => (/* binding */ __experimentalReceiveThemeBaseGlobalStyles), __experimentalReceiveThemeGlobalStyleVariations: () => (/* binding */ __experimentalReceiveThemeGlobalStyleVariations), __experimentalSaveSpecifiedEntityEdits: () => (/* binding */ __experimentalSaveSpecifiedEntityEdits), __unstableCreateUndoLevel: () => (/* binding */ __unstableCreateUndoLevel), addEntities: () => (/* binding */ addEntities), deleteEntityRecord: () => (/* binding */ deleteEntityRecord), editEntityRecord: () => (/* binding */ editEntityRecord), receiveAutosaves: () => (/* binding */ receiveAutosaves), receiveCurrentTheme: () => (/* binding */ receiveCurrentTheme), receiveCurrentUser: () => (/* binding */ receiveCurrentUser), receiveDefaultTemplateId: () => (/* binding */ receiveDefaultTemplateId), receiveEmbedPreview: () => (/* binding */ receiveEmbedPreview), receiveEntityRecords: () => (/* binding */ receiveEntityRecords), receiveNavigationFallbackId: () => (/* binding */ receiveNavigationFallbackId), receiveRevisions: () => (/* binding */ receiveRevisions), receiveThemeGlobalStyleRevisions: () => (/* binding */ receiveThemeGlobalStyleRevisions), receiveThemeSupports: () => (/* binding */ receiveThemeSupports), receiveUploadPermissions: () => (/* binding */ receiveUploadPermissions), receiveUserPermission: () => (/* binding */ receiveUserPermission), receiveUserPermissions: () => (/* binding */ receiveUserPermissions), receiveUserQuery: () => (/* binding */ receiveUserQuery), redo: () => (/* binding */ redo), saveEditedEntityRecord: () => (/* binding */ saveEditedEntityRecord), saveEntityRecord: () => (/* binding */ saveEntityRecord), undo: () => (/* binding */ undo) }); // EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js var es6 = __webpack_require__(7734); var es6_default = /*#__PURE__*/__webpack_require__.n(es6); ;// ./node_modules/@wordpress/core-data/node_modules/uuid/dist/esm-browser/native.js const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); /* harmony default export */ const esm_browser_native = ({ randomUUID }); ;// ./node_modules/@wordpress/core-data/node_modules/uuid/dist/esm-browser/rng.js // Unique ID creation requires a high quality random # generator. In the browser we therefore // require the crypto API and do not support built-in fallback to lower quality random number // generators (like Math.random()). let getRandomValues; const rnds8 = new Uint8Array(16); function rng() { // lazy load so that environments that need to polyfill have a chance to do so if (!getRandomValues) { // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); if (!getRandomValues) { throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); } } return getRandomValues(rnds8); } ;// ./node_modules/@wordpress/core-data/node_modules/uuid/dist/esm-browser/stringify.js /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ const byteToHex = []; for (let i = 0; i < 256; ++i) { byteToHex.push((i + 0x100).toString(16).slice(1)); } function unsafeStringify(arr, offset = 0) { // Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; } function stringify(arr, offset = 0) { const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one // of the following: // - One or more input array values don't map to a hex octet (leading to // "undefined" in the uuid) // - Invalid input values for the RFC `version` or `variant` fields if (!validate(uuid)) { throw TypeError('Stringified UUID is invalid'); } return uuid; } /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify))); ;// ./node_modules/@wordpress/core-data/node_modules/uuid/dist/esm-browser/v4.js function v4(options, buf, offset) { if (esm_browser_native.randomUUID && !buf && !options) { return esm_browser_native.randomUUID(); } options = options || {}; const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = rnds[6] & 0x0f | 0x40; rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided if (buf) { offset = offset || 0; for (let i = 0; i < 16; ++i) { buf[offset + i] = rnds[i]; } return buf; } return unsafeStringify(rnds); } /* harmony default export */ const esm_browser_v4 = (v4); // EXTERNAL MODULE: external ["wp","apiFetch"] var external_wp_apiFetch_ = __webpack_require__(1455); var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_); // EXTERNAL MODULE: external ["wp","url"] var external_wp_url_ = __webpack_require__(3832); // EXTERNAL MODULE: external ["wp","deprecated"] var external_wp_deprecated_ = __webpack_require__(4040); var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/utils/set-nested-value.js var set_nested_value = __webpack_require__(5003); ;// ./node_modules/@wordpress/core-data/build-module/utils/get-nested-value.js function getNestedValue(object, path, defaultValue) { if (!object || typeof object !== "object" || typeof path !== "string" && !Array.isArray(path)) { return object; } const normalizedPath = Array.isArray(path) ? path : path.split("."); let value = object; normalizedPath.forEach((fieldName) => { value = value?.[fieldName]; }); return value !== void 0 ? value : defaultValue; } ;// ./node_modules/@wordpress/core-data/build-module/queried-data/actions.js function receiveItems(items, edits, meta) { return { type: "RECEIVE_ITEMS", items: Array.isArray(items) ? items : [items], persistedEdits: edits, meta }; } function removeItems(kind, name, records, invalidateCache = false) { return { type: "REMOVE_ITEMS", itemIds: Array.isArray(records) ? records : [records], kind, name, invalidateCache }; } function receiveQueriedItems(items, query = {}, edits, meta) { return { ...receiveItems(items, edits, meta), query }; } // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/entities.js + 2 modules var entities = __webpack_require__(5914); ;// ./node_modules/@wordpress/core-data/build-module/batch/default-processor.js let maxItems = null; function chunk(arr, chunkSize) { const tmp = [...arr]; const cache = []; while (tmp.length) { cache.push(tmp.splice(0, chunkSize)); } return cache; } async function defaultProcessor(requests) { if (maxItems === null) { const preflightResponse = await external_wp_apiFetch_default()({ path: "/batch/v1", method: "OPTIONS" }); maxItems = preflightResponse.endpoints[0].args.requests.maxItems; } const results = []; for (const batchRequests of chunk(requests, maxItems)) { const batchResponse = await external_wp_apiFetch_default()({ path: "/batch/v1", method: "POST", data: { validation: "require-all-validate", requests: batchRequests.map((request) => ({ path: request.path, body: request.data, // Rename 'data' to 'body'. method: request.method, headers: request.headers })) } }); let batchResults; if (batchResponse.failed) { batchResults = batchResponse.responses.map((response) => ({ error: response?.body })); } else { batchResults = batchResponse.responses.map((response) => { const result = {}; if (response.status >= 200 && response.status < 300) { result.output = response.body; } else { result.error = response.body; } return result; }); } results.push(...batchResults); } return results; } ;// ./node_modules/@wordpress/core-data/build-module/batch/create-batch.js function createBatch(processor = defaultProcessor) { let lastId = 0; let queue = []; const pending = new ObservableSet(); return { /** * Adds an input to the batch and returns a promise that is resolved or * rejected when the input is processed by `batch.run()`. * * You may also pass a thunk which allows inputs to be added * asynchronously. * * ``` * // Both are allowed: * batch.add( { path: '/v1/books', ... } ); * batch.add( ( add ) => add( { path: '/v1/books', ... } ) ); * ``` * * If a thunk is passed, `batch.run()` will pause until either: * * - The thunk calls its `add` argument, or; * - The thunk returns a promise and that promise resolves, or; * - The thunk returns a non-promise. * * @param {any|Function} inputOrThunk Input to add or thunk to execute. * * @return {Promise|any} If given an input, returns a promise that * is resolved or rejected when the batch is * processed. If given a thunk, returns the return * value of that thunk. */ add(inputOrThunk) { const id = ++lastId; pending.add(id); const add = (input) => new Promise((resolve, reject) => { queue.push({ input, resolve, reject }); pending.delete(id); }); if (typeof inputOrThunk === "function") { return Promise.resolve(inputOrThunk(add)).finally(() => { pending.delete(id); }); } return add(inputOrThunk); }, /** * Runs the batch. This calls `batchProcessor` and resolves or rejects * all promises returned by `add()`. * * @return {Promise<boolean>} A promise that resolves to a boolean that is true * if the processor returned no errors. */ async run() { if (pending.size) { await new Promise((resolve) => { const unsubscribe = pending.subscribe(() => { if (!pending.size) { unsubscribe(); resolve(void 0); } }); }); } let results; try { results = await processor( queue.map(({ input }) => input) ); if (results.length !== queue.length) { throw new Error( "run: Array returned by processor must be same size as input array." ); } } catch (error) { for (const { reject } of queue) { reject(error); } throw error; } let isSuccess = true; results.forEach((result, key) => { const queueItem = queue[key]; if (result?.error) { queueItem?.reject(result.error); isSuccess = false; } else { queueItem?.resolve(result?.output ?? result); } }); queue = []; return isSuccess; } }; } class ObservableSet { constructor(...args) { this.set = new Set(...args); this.subscribers = /* @__PURE__ */ new Set(); } get size() { return this.set.size; } add(value) { this.set.add(value); this.subscribers.forEach((subscriber) => subscriber()); return this; } delete(value) { const isSuccess = this.set.delete(value); this.subscribers.forEach((subscriber) => subscriber()); return isSuccess; } subscribe(subscriber) { this.subscribers.add(subscriber); return () => { this.subscribers.delete(subscriber); }; } } // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/name.js var build_module_name = __webpack_require__(2278); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/utils/log-entity-deprecation.js var log_entity_deprecation = __webpack_require__(9410); ;// ./node_modules/@wordpress/core-data/build-module/actions.js function receiveUserQuery(queryID, users) { return { type: "RECEIVE_USER_QUERY", users: Array.isArray(users) ? users : [users], queryID }; } function receiveCurrentUser(currentUser) { return { type: "RECEIVE_CURRENT_USER", currentUser }; } function addEntities(entities) { return { type: "ADD_ENTITIES", entities }; } function receiveEntityRecords(kind, name, records, query, invalidateCache = false, edits, meta) { if (kind === "postType") { records = (Array.isArray(records) ? records : [records]).map( (record) => record.status === "auto-draft" ? { ...record, title: "" } : record ); } let action; if (query) { action = receiveQueriedItems(records, query, edits, meta); } else { action = receiveItems(records, edits, meta); } return { ...action, kind, name, invalidateCache }; } function receiveCurrentTheme(currentTheme) { return { type: "RECEIVE_CURRENT_THEME", currentTheme }; } function __experimentalReceiveCurrentGlobalStylesId(currentGlobalStylesId) { return { type: "RECEIVE_CURRENT_GLOBAL_STYLES_ID", id: currentGlobalStylesId }; } function __experimentalReceiveThemeBaseGlobalStyles(stylesheet, globalStyles) { return { type: "RECEIVE_THEME_GLOBAL_STYLES", stylesheet, globalStyles }; } function __experimentalReceiveThemeGlobalStyleVariations(stylesheet, variations) { return { type: "RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS", stylesheet, variations }; } function receiveThemeSupports() { external_wp_deprecated_default()("wp.data.dispatch( 'core' ).receiveThemeSupports", { since: "5.9" }); return { type: "DO_NOTHING" }; } function receiveThemeGlobalStyleRevisions(currentId, revisions) { external_wp_deprecated_default()( "wp.data.dispatch( 'core' ).receiveThemeGlobalStyleRevisions()", { since: "6.5.0", alternative: "wp.data.dispatch( 'core' ).receiveRevisions" } ); return { type: "RECEIVE_THEME_GLOBAL_STYLE_REVISIONS", currentId, revisions }; } function receiveEmbedPreview(url, preview) { return { type: "RECEIVE_EMBED_PREVIEW", url, preview }; } const deleteEntityRecord = (kind, name, recordId, query, { __unstableFetch = (external_wp_apiFetch_default()), throwOnError = false } = {}) => async ({ dispatch, resolveSelect }) => { (0,log_entity_deprecation/* default */.A)(kind, name, "deleteEntityRecord"); const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find( (config) => config.kind === kind && config.name === name ); let error; let deletedRecord = false; if (!entityConfig) { return; } const lock = await dispatch.__unstableAcquireStoreLock( build_module_name/* STORE_NAME */.E, ["entities", "records", kind, name, recordId], { exclusive: true } ); try { dispatch({ type: "DELETE_ENTITY_RECORD_START", kind, name, recordId }); let hasError = false; try { let path = `${entityConfig.baseURL}/${recordId}`; if (query) { path = (0,external_wp_url_.addQueryArgs)(path, query); } deletedRecord = await __unstableFetch({ path, method: "DELETE" }); await dispatch(removeItems(kind, name, recordId, true)); } catch (_error) { hasError = true; error = _error; } dispatch({ type: "DELETE_ENTITY_RECORD_FINISH", kind, name, recordId, error }); if (hasError && throwOnError) { throw error; } return deletedRecord; } finally { dispatch.__unstableReleaseStoreLock(lock); } }; const editEntityRecord = (kind, name, recordId, edits, options = {}) => ({ select, dispatch }) => { (0,log_entity_deprecation/* default */.A)(kind, name, "editEntityRecord"); const entityConfig = select.getEntityConfig(kind, name); if (!entityConfig) { throw new Error( `The entity being edited (${kind}, ${name}) does not have a loaded config.` ); } const { mergedEdits = {} } = entityConfig; const record = select.getRawEntityRecord(kind, name, recordId); const editedRecord = select.getEditedEntityRecord( kind, name, recordId ); const edit = { kind, name, recordId, // Clear edits when they are equal to their persisted counterparts // so that the property is not considered dirty. edits: Object.keys(edits).reduce((acc, key) => { const recordValue = record[key]; const editedRecordValue = editedRecord[key]; const value = mergedEdits[key] ? { ...editedRecordValue, ...edits[key] } : edits[key]; acc[key] = es6_default()(recordValue, value) ? void 0 : value; return acc; }, {}) }; if (window.__experimentalEnableSync && entityConfig.syncConfig) { if (false) {} } if (!options.undoIgnore) { select.getUndoManager().addRecord( [ { id: { kind, name, recordId }, changes: Object.keys(edits).reduce((acc, key) => { acc[key] = { from: editedRecord[key], to: edits[key] }; return acc; }, {}) } ], options.isCached ); } dispatch({ type: "EDIT_ENTITY_RECORD", ...edit }); }; const undo = () => ({ select, dispatch }) => { const undoRecord = select.getUndoManager().undo(); if (!undoRecord) { return; } dispatch({ type: "UNDO", record: undoRecord }); }; const redo = () => ({ select, dispatch }) => { const redoRecord = select.getUndoManager().redo(); if (!redoRecord) { return; } dispatch({ type: "REDO", record: redoRecord }); }; const __unstableCreateUndoLevel = () => ({ select }) => { select.getUndoManager().addRecord(); }; const saveEntityRecord = (kind, name, record, { isAutosave = false, __unstableFetch = (external_wp_apiFetch_default()), throwOnError = false } = {}) => async ({ select, resolveSelect, dispatch }) => { (0,log_entity_deprecation/* default */.A)(kind, name, "saveEntityRecord"); const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find( (config) => config.kind === kind && config.name === name ); if (!entityConfig) { return; } const entityIdKey = entityConfig.key ?? entities/* DEFAULT_ENTITY_KEY */.C_; const recordId = record[entityIdKey]; const isNewRecord = !!entityIdKey && !recordId; const lock = await dispatch.__unstableAcquireStoreLock( build_module_name/* STORE_NAME */.E, ["entities", "records", kind, name, recordId || esm_browser_v4()], { exclusive: true } ); try { for (const [key, value] of Object.entries(record)) { if (typeof value === "function") { const evaluatedValue = value( select.getEditedEntityRecord(kind, name, recordId) ); dispatch.editEntityRecord( kind, name, recordId, { [key]: evaluatedValue }, { undoIgnore: true } ); record[key] = evaluatedValue; } } dispatch({ type: "SAVE_ENTITY_RECORD_START", kind, name, recordId, isAutosave }); let updatedRecord; let error; let hasError = false; try { const path = `${entityConfig.baseURL}${recordId ? "/" + recordId : ""}`; const persistedRecord = !isNewRecord ? select.getRawEntityRecord(kind, name, recordId) : {}; if (isAutosave) { const currentUser = select.getCurrentUser(); const currentUserId = currentUser ? currentUser.id : void 0; const autosavePost = await resolveSelect.getAutosave( persistedRecord.type, persistedRecord.id, currentUserId ); let data = { ...persistedRecord, ...autosavePost, ...record }; data = Object.keys(data).reduce( (acc, key) => { if ([ "title", "excerpt", "content", "meta" ].includes(key)) { acc[key] = data[key]; } return acc; }, { // Do not update the `status` if we have edited it when auto saving. // It's very important to let the user explicitly save this change, // because it can lead to unexpected results. An example would be to // have a draft post and change the status to publish. status: data.status === "auto-draft" ? "draft" : void 0 } ); updatedRecord = await __unstableFetch({ path: `${path}/autosaves`, method: "POST", data }); if (persistedRecord.id === updatedRecord.id) { let newRecord = { ...persistedRecord, ...data, ...updatedRecord }; newRecord = Object.keys(newRecord).reduce( (acc, key) => { if (["title", "excerpt", "content"].includes( key )) { acc[key] = newRecord[key]; } else if (key === "status") { acc[key] = persistedRecord.status === "auto-draft" && newRecord.status === "draft" ? newRecord.status : persistedRecord.status; } else { acc[key] = persistedRecord[key]; } return acc; }, {} ); dispatch.receiveEntityRecords( kind, name, newRecord, void 0, true ); } else { dispatch.receiveAutosaves( persistedRecord.id, updatedRecord ); } } else { let edits = record; if (entityConfig.__unstablePrePersist) { edits = { ...edits, ...entityConfig.__unstablePrePersist( persistedRecord, edits ) }; } updatedRecord = await __unstableFetch({ path, method: recordId ? "PUT" : "POST", data: edits }); dispatch.receiveEntityRecords( kind, name, updatedRecord, void 0, true, edits ); } } catch (_error) { hasError = true; error = _error; } dispatch({ type: "SAVE_ENTITY_RECORD_FINISH", kind, name, recordId, error, isAutosave }); if (hasError && throwOnError) { throw error; } return updatedRecord; } finally { dispatch.__unstableReleaseStoreLock(lock); } }; const __experimentalBatch = (requests) => async ({ dispatch }) => { const batch = createBatch(); const api = { saveEntityRecord(kind, name, record, options) { return batch.add( (add) => dispatch.saveEntityRecord(kind, name, record, { ...options, __unstableFetch: add }) ); }, saveEditedEntityRecord(kind, name, recordId, options) { return batch.add( (add) => dispatch.saveEditedEntityRecord(kind, name, recordId, { ...options, __unstableFetch: add }) ); }, deleteEntityRecord(kind, name, recordId, query, options) { return batch.add( (add) => dispatch.deleteEntityRecord(kind, name, recordId, query, { ...options, __unstableFetch: add }) ); } }; const resultPromises = requests.map((request) => request(api)); const [, ...results] = await Promise.all([ batch.run(), ...resultPromises ]); return results; }; const saveEditedEntityRecord = (kind, name, recordId, options) => async ({ select, dispatch, resolveSelect }) => { (0,log_entity_deprecation/* default */.A)(kind, name, "saveEditedEntityRecord"); if (!select.hasEditsForEntityRecord(kind, name, recordId)) { return; } const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find( (config) => config.kind === kind && config.name === name ); if (!entityConfig) { return; } const entityIdKey = entityConfig.key || entities/* DEFAULT_ENTITY_KEY */.C_; const edits = select.getEntityRecordNonTransientEdits( kind, name, recordId ); const record = { [entityIdKey]: recordId, ...edits }; return await dispatch.saveEntityRecord(kind, name, record, options); }; const __experimentalSaveSpecifiedEntityEdits = (kind, name, recordId, itemsToSave, options) => async ({ select, dispatch, resolveSelect }) => { (0,log_entity_deprecation/* default */.A)( kind, name, "__experimentalSaveSpecifiedEntityEdits" ); if (!select.hasEditsForEntityRecord(kind, name, recordId)) { return; } const edits = select.getEntityRecordNonTransientEdits( kind, name, recordId ); const editsToSave = {}; for (const item of itemsToSave) { (0,set_nested_value/* default */.A)(editsToSave, item, getNestedValue(edits, item)); } const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find( (config) => config.kind === kind && config.name === name ); const entityIdKey = entityConfig?.key || entities/* DEFAULT_ENTITY_KEY */.C_; if (recordId) { editsToSave[entityIdKey] = recordId; } return await dispatch.saveEntityRecord( kind, name, editsToSave, options ); }; function receiveUploadPermissions(hasUploadPermissions) { external_wp_deprecated_default()("wp.data.dispatch( 'core' ).receiveUploadPermissions", { since: "5.9", alternative: "receiveUserPermission" }); return receiveUserPermission("create/media", hasUploadPermissions); } function receiveUserPermission(key, isAllowed) { return { type: "RECEIVE_USER_PERMISSION", key, isAllowed }; } function receiveUserPermissions(permissions) { return { type: "RECEIVE_USER_PERMISSIONS", permissions }; } function receiveAutosaves(postId, autosaves) { return { type: "RECEIVE_AUTOSAVES", postId, autosaves: Array.isArray(autosaves) ? autosaves : [autosaves] }; } function receiveNavigationFallbackId(fallbackId) { return { type: "RECEIVE_NAVIGATION_FALLBACK_ID", fallbackId }; } function receiveDefaultTemplateId(query, templateId) { return { type: "RECEIVE_DEFAULT_TEMPLATE", query, templateId }; } const receiveRevisions = (kind, name, recordKey, records, query, invalidateCache = false, meta) => async ({ dispatch, resolveSelect }) => { (0,log_entity_deprecation/* default */.A)(kind, name, "receiveRevisions"); const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find( (config) => config.kind === kind && config.name === name ); const key = entityConfig && entityConfig?.revisionKey ? entityConfig.revisionKey : entities/* DEFAULT_ENTITY_KEY */.C_; dispatch({ type: "RECEIVE_ITEM_REVISIONS", key, items: Array.isArray(records) ? records : [records], recordKey, meta, query, kind, name, invalidateCache }); }; /***/ }), /***/ 3832: /***/ ((module) => { "use strict"; module.exports = window["wp"]["url"]; /***/ }), /***/ 4027: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: () => (/* binding */ get_query_parts_default) }); // UNUSED EXPORTS: getQueryParts // EXTERNAL MODULE: external ["wp","url"] var external_wp_url_ = __webpack_require__(3832); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/utils/get-normalized-comma-separable.js var get_normalized_comma_separable = __webpack_require__(533); ;// ./node_modules/@wordpress/core-data/build-module/utils/with-weak-map-cache.js function withWeakMapCache(fn) { const cache = /* @__PURE__ */ new WeakMap(); return (key) => { let value; if (cache.has(key)) { value = cache.get(key); } else { value = fn(key); if (key !== null && typeof key === "object") { cache.set(key, value); } } return value; }; } var with_weak_map_cache_default = withWeakMapCache; ;// ./node_modules/@wordpress/core-data/build-module/queried-data/get-query-parts.js function getQueryParts(query) { const parts = { stableKey: "", page: 1, perPage: 10, fields: null, include: null, context: "default" }; const keys = Object.keys(query).sort(); for (let i = 0; i < keys.length; i++) { const key = keys[i]; let value = query[key]; switch (key) { case "page": parts[key] = Number(value); break; case "per_page": parts.perPage = Number(value); break; case "context": parts.context = value; break; default: if (key === "_fields") { parts.fields = (0,get_normalized_comma_separable/* default */.A)(value) ?? []; value = parts.fields.join(); } if (key === "include") { if (typeof value === "number") { value = value.toString(); } parts.include = ((0,get_normalized_comma_separable/* default */.A)(value) ?? []).map(Number); value = parts.include.join(); } parts.stableKey += (parts.stableKey ? "&" : "") + (0,external_wp_url_.addQueryArgs)("", { [key]: value }).slice(1); } } return parts; } var get_query_parts_default = with_weak_map_cache_default(getQueryParts); /***/ }), /***/ 4040: /***/ ((module) => { "use strict"; module.exports = window["wp"]["deprecated"]; /***/ }), /***/ 4460: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: () => (/* binding */ EntityProvider) }); ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; // EXTERNAL MODULE: external ["wp","element"] var external_wp_element_ = __webpack_require__(6087); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/entity-context.js var entity_context = __webpack_require__(8843); ;// ./node_modules/@wordpress/core-data/build-module/entity-provider.js function EntityProvider({ kind, type: name, id, children }) { const parent = (0,external_wp_element_.useContext)(entity_context/* EntityContext */.D); const childContext = (0,external_wp_element_.useMemo)( () => ({ ...parent, [kind]: { ...parent?.[kind], [name]: id } }), [parent, kind, name, id] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(entity_context/* EntityContext */.D.Provider, { value: childContext, children }); } /***/ }), /***/ 4565: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ EntityProvider: () => (/* reexport safe */ _entity_provider__WEBPACK_IMPORTED_MODULE_17__.A), /* harmony export */ __experimentalFetchLinkSuggestions: () => (/* reexport safe */ _fetch__WEBPACK_IMPORTED_MODULE_14__.Y3), /* harmony export */ __experimentalFetchUrlData: () => (/* reexport safe */ _fetch__WEBPACK_IMPORTED_MODULE_14__.gr), /* harmony export */ __experimentalUseEntityRecord: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_15__.qh), /* harmony export */ __experimentalUseEntityRecords: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_15__.bM), /* harmony export */ __experimentalUseResourcePermissions: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_15__._), /* harmony export */ fetchBlockPatterns: () => (/* reexport safe */ _fetch__WEBPACK_IMPORTED_MODULE_14__.l$), /* harmony export */ privateApis: () => (/* reexport safe */ _private_apis__WEBPACK_IMPORTED_MODULE_16__.j), /* harmony export */ store: () => (/* binding */ store), /* harmony export */ useEntityBlockEditor: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_15__.hg), /* harmony export */ useEntityId: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_15__.mV), /* harmony export */ useEntityProp: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_15__.S$), /* harmony export */ useEntityRecord: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_15__.MA), /* harmony export */ useEntityRecords: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_15__.$u), /* harmony export */ useResourcePermissions: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_15__.qs) /* harmony export */ }); /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7143); /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _reducer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5469); /* harmony import */ var _selectors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8368); /* harmony import */ var _private_selectors__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(8741); /* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3440); /* harmony import */ var _private_actions__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(9424); /* harmony import */ var _resolvers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6384); /* harmony import */ var _locks_actions__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2239); /* harmony import */ var _entities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5914); /* harmony import */ var _name__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(2278); /* harmony import */ var _lock_unlock__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(6378); /* harmony import */ var _dynamic_entities__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(8582); /* harmony import */ var _utils_log_entity_deprecation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9410); /* harmony import */ var _entity_provider__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(4460); /* harmony import */ var _entity_types__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(3377); /* harmony import */ var _entity_types__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_entity_types__WEBPACK_IMPORTED_MODULE_13__); /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _entity_types__WEBPACK_IMPORTED_MODULE_13__) if(["default","EntityProvider","store"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _entity_types__WEBPACK_IMPORTED_MODULE_13__[__WEBPACK_IMPORT_KEY__] /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); /* harmony import */ var _fetch__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(7006); /* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(5891); /* harmony import */ var _private_apis__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(7826); const entitiesConfig = [ ..._entities__WEBPACK_IMPORTED_MODULE_1__/* .rootEntitiesConfig */ .Mr, ..._entities__WEBPACK_IMPORTED_MODULE_1__/* .additionalEntityConfigLoaders */ .L2.filter((config) => !!config.name) ]; const entitySelectors = entitiesConfig.reduce((result, entity) => { const { kind, name, plural } = entity; const getEntityRecordMethodName = (0,_entities__WEBPACK_IMPORTED_MODULE_1__/* .getMethodName */ .zD)(kind, name); result[getEntityRecordMethodName] = (state, key, query) => { (0,_utils_log_entity_deprecation__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)(kind, name, getEntityRecordMethodName, { isShorthandSelector: true, alternativeFunctionName: "getEntityRecord" }); return _selectors__WEBPACK_IMPORTED_MODULE_3__.getEntityRecord(state, kind, name, key, query); }; if (plural) { const getEntityRecordsMethodName = (0,_entities__WEBPACK_IMPORTED_MODULE_1__/* .getMethodName */ .zD)(kind, plural, "get"); result[getEntityRecordsMethodName] = (state, query) => { (0,_utils_log_entity_deprecation__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)(kind, name, getEntityRecordsMethodName, { isShorthandSelector: true, alternativeFunctionName: "getEntityRecords" }); return _selectors__WEBPACK_IMPORTED_MODULE_3__.getEntityRecords(state, kind, name, query); }; } return result; }, {}); const entityResolvers = entitiesConfig.reduce((result, entity) => { const { kind, name, plural } = entity; const getEntityRecordMethodName = (0,_entities__WEBPACK_IMPORTED_MODULE_1__/* .getMethodName */ .zD)(kind, name); result[getEntityRecordMethodName] = (key, query) => { (0,_utils_log_entity_deprecation__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)(kind, name, getEntityRecordMethodName, { isShorthandSelector: true, alternativeFunctionName: "getEntityRecord" }); return _resolvers__WEBPACK_IMPORTED_MODULE_4__.getEntityRecord(kind, name, key, query); }; if (plural) { const getEntityRecordsMethodName = (0,_entities__WEBPACK_IMPORTED_MODULE_1__/* .getMethodName */ .zD)(kind, plural, "get"); result[getEntityRecordsMethodName] = (...args) => { (0,_utils_log_entity_deprecation__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)(kind, plural, getEntityRecordsMethodName, { isShorthandSelector: true, alternativeFunctionName: "getEntityRecords" }); return _resolvers__WEBPACK_IMPORTED_MODULE_4__.getEntityRecords(kind, name, ...args); }; result[getEntityRecordsMethodName].shouldInvalidate = (action) => _resolvers__WEBPACK_IMPORTED_MODULE_4__.getEntityRecords.shouldInvalidate(action, kind, name); } return result; }, {}); const entityActions = entitiesConfig.reduce((result, entity) => { const { kind, name } = entity; const saveEntityRecordMethodName = (0,_entities__WEBPACK_IMPORTED_MODULE_1__/* .getMethodName */ .zD)(kind, name, "save"); result[saveEntityRecordMethodName] = (record, options) => { (0,_utils_log_entity_deprecation__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)(kind, name, saveEntityRecordMethodName, { isShorthandSelector: true, alternativeFunctionName: "saveEntityRecord" }); return _actions__WEBPACK_IMPORTED_MODULE_5__.saveEntityRecord(kind, name, record, options); }; const deleteEntityRecordMethodName = (0,_entities__WEBPACK_IMPORTED_MODULE_1__/* .getMethodName */ .zD)(kind, name, "delete"); result[deleteEntityRecordMethodName] = (key, query, options) => { (0,_utils_log_entity_deprecation__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)(kind, name, deleteEntityRecordMethodName, { isShorthandSelector: true, alternativeFunctionName: "deleteEntityRecord" }); return _actions__WEBPACK_IMPORTED_MODULE_5__.deleteEntityRecord(kind, name, key, query, options); }; return result; }, {}); const storeConfig = () => ({ reducer: _reducer__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Ay, actions: { ..._dynamic_entities__WEBPACK_IMPORTED_MODULE_7__/* .dynamicActions */ .B, ..._actions__WEBPACK_IMPORTED_MODULE_5__, ...entityActions, ...(0,_locks_actions__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .A)() }, selectors: { ..._dynamic_entities__WEBPACK_IMPORTED_MODULE_7__/* .dynamicSelectors */ .A, ..._selectors__WEBPACK_IMPORTED_MODULE_3__, ...entitySelectors }, resolvers: { ..._resolvers__WEBPACK_IMPORTED_MODULE_4__, ...entityResolvers } }); const store = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.createReduxStore)(_name__WEBPACK_IMPORTED_MODULE_9__/* .STORE_NAME */ .E, storeConfig()); (0,_lock_unlock__WEBPACK_IMPORTED_MODULE_10__/* .unlock */ .T)(store).registerPrivateSelectors(_private_selectors__WEBPACK_IMPORTED_MODULE_11__); (0,_lock_unlock__WEBPACK_IMPORTED_MODULE_10__/* .unlock */ .T)(store).registerPrivateActions(_private_actions__WEBPACK_IMPORTED_MODULE_12__); (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.register)(store); /***/ }), /***/ 4997: /***/ ((module) => { "use strict"; module.exports = window["wp"]["blocks"]; /***/ }), /***/ 5003: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ setNestedValue) /* harmony export */ }); function setNestedValue(object, path, value) { if (!object || typeof object !== "object") { return object; } const normalizedPath = Array.isArray(path) ? path : path.split("."); normalizedPath.reduce((acc, key, idx) => { if (acc[key] === void 0) { if (Number.isInteger(normalizedPath[idx + 1])) { acc[key] = []; } else { acc[key] = {}; } } if (idx === normalizedPath.length - 1) { acc[key] = value; } return acc[key]; }, object); return object; } /***/ }), /***/ 5101: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Z: () => (/* binding */ RECEIVE_INTERMEDIATE_RESULTS) /* harmony export */ }); const RECEIVE_INTERMEDIATE_RESULTS = Symbol( "RECEIVE_INTERMEDIATE_RESULTS" ); /***/ }), /***/ 5469: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { Ay: () => (/* binding */ reducer_reducer_default) }); // UNUSED EXPORTS: autosaves, blockPatternCategories, blockPatterns, currentGlobalStylesId, currentTheme, currentUser, defaultTemplates, editsReference, embedPreviews, entities, entitiesConfig, navigationFallbackId, registeredPostMeta, themeBaseGlobalStyles, themeGlobalStyleRevisions, themeGlobalStyleVariations, undoManager, userPatternCategories, userPermissions, users // EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js var es6 = __webpack_require__(7734); var es6_default = /*#__PURE__*/__webpack_require__.n(es6); ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; // EXTERNAL MODULE: external ["wp","data"] var external_wp_data_ = __webpack_require__(7143); ;// external ["wp","isShallowEqual"] const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); ;// ./node_modules/@wordpress/undo-manager/build-module/index.js function mergeHistoryChanges(changes1, changes2) { const newChanges = { ...changes1 }; Object.entries(changes2).forEach(([key, value]) => { if (newChanges[key]) { newChanges[key] = { ...newChanges[key], to: value.to }; } else { newChanges[key] = value; } }); return newChanges; } const addHistoryChangesIntoRecord = (record, changes) => { const existingChangesIndex = record?.findIndex( ({ id: recordIdentifier }) => { return typeof recordIdentifier === "string" ? recordIdentifier === changes.id : external_wp_isShallowEqual_default()(recordIdentifier, changes.id); } ); const nextRecord = [...record]; if (existingChangesIndex !== -1) { nextRecord[existingChangesIndex] = { id: changes.id, changes: mergeHistoryChanges( nextRecord[existingChangesIndex].changes, changes.changes ) }; } else { nextRecord.push(changes); } return nextRecord; }; function createUndoManager() { let history = []; let stagedRecord = []; let offset = 0; const dropPendingRedos = () => { history = history.slice(0, offset || void 0); offset = 0; }; const appendStagedRecordToLatestHistoryRecord = () => { const index = history.length === 0 ? 0 : history.length - 1; let latestRecord = history[index] ?? []; stagedRecord.forEach((changes) => { latestRecord = addHistoryChangesIntoRecord(latestRecord, changes); }); stagedRecord = []; history[index] = latestRecord; }; const isRecordEmpty = (record) => { const filteredRecord = record.filter(({ changes }) => { return Object.values(changes).some( ({ from, to }) => typeof from !== "function" && typeof to !== "function" && !external_wp_isShallowEqual_default()(from, to) ); }); return !filteredRecord.length; }; return { addRecord(record, isStaged = false) { const isEmpty = !record || isRecordEmpty(record); if (isStaged) { if (isEmpty) { return; } record.forEach((changes) => { stagedRecord = addHistoryChangesIntoRecord( stagedRecord, changes ); }); } else { dropPendingRedos(); if (stagedRecord.length) { appendStagedRecordToLatestHistoryRecord(); } if (isEmpty) { return; } history.push(record); } }, undo() { if (stagedRecord.length) { dropPendingRedos(); appendStagedRecordToLatestHistoryRecord(); } const undoRecord = history[history.length - 1 + offset]; if (!undoRecord) { return; } offset -= 1; return undoRecord; }, redo() { const redoRecord = history[history.length + offset]; if (!redoRecord) { return; } offset += 1; return redoRecord; }, hasUndo() { return !!history[history.length - 1 + offset]; }, hasRedo() { return !!history[history.length + offset]; } }; } ;// ./node_modules/@wordpress/core-data/build-module/utils/if-matching-action.js const ifMatchingAction = (isMatch) => (reducer) => (state, action) => { if (state === void 0 || isMatch(action)) { return reducer(state, action); } return state; }; var if_matching_action_default = ifMatchingAction; ;// ./node_modules/@wordpress/core-data/build-module/utils/replace-action.js const replaceAction = (replacer) => (reducer) => (state, action) => { return reducer(state, replacer(action)); }; var replace_action_default = replaceAction; ;// ./node_modules/@wordpress/core-data/build-module/utils/conservative-map-item.js function conservativeMapItem(item, nextItem) { if (!item) { return nextItem; } let hasChanges = false; const result = {}; for (const key in nextItem) { if (es6_default()(item[key], nextItem[key])) { result[key] = item[key]; } else { hasChanges = true; result[key] = nextItem[key]; } } if (!hasChanges) { return item; } for (const key in item) { if (!result.hasOwnProperty(key)) { result[key] = item[key]; } } return result; } ;// ./node_modules/@wordpress/core-data/build-module/utils/on-sub-key.js const onSubKey = (actionProperty) => (reducer) => (state = {}, action) => { const key = action[actionProperty]; if (key === void 0) { return state; } const nextKeyState = reducer(state[key], action); if (nextKeyState === state[key]) { return state; } return { ...state, [key]: nextKeyState }; }; var on_sub_key_default = onSubKey; // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/entities.js + 2 modules var entities = __webpack_require__(5914); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/get-query-parts.js + 1 modules var get_query_parts = __webpack_require__(4027); ;// ./node_modules/@wordpress/core-data/build-module/queried-data/reducer.js function getContextFromAction(action) { const { query } = action; if (!query) { return "default"; } const queryParts = (0,get_query_parts/* default */.A)(query); return queryParts.context; } function getMergedItemIds(itemIds, nextItemIds, page, perPage) { const receivedAllIds = page === 1 && perPage === -1; if (receivedAllIds) { return nextItemIds; } const nextItemIdsStartIndex = (page - 1) * perPage; const size = Math.max( itemIds?.length ?? 0, nextItemIdsStartIndex + nextItemIds.length ); const mergedItemIds = new Array(size); for (let i = 0; i < size; i++) { const isInNextItemsRange = i >= nextItemIdsStartIndex && i < nextItemIdsStartIndex + perPage; mergedItemIds[i] = isInNextItemsRange ? nextItemIds[i - nextItemIdsStartIndex] : itemIds?.[i]; } return mergedItemIds; } function removeEntitiesById(entities, ids) { return Object.fromEntries( Object.entries(entities).filter( ([id]) => !ids.some((itemId) => { if (Number.isInteger(itemId)) { return itemId === +id; } return itemId === id; }) ) ); } function items(state = {}, action) { switch (action.type) { case "RECEIVE_ITEMS": { const context = getContextFromAction(action); const key = action.key || entities/* DEFAULT_ENTITY_KEY */.C_; return { ...state, [context]: { ...state[context], ...action.items.reduce((accumulator, value) => { const itemId = value?.[key]; accumulator[itemId] = conservativeMapItem( state?.[context]?.[itemId], value ); return accumulator; }, {}) } }; } case "REMOVE_ITEMS": return Object.fromEntries( Object.entries(state).map(([itemId, contextState]) => [ itemId, removeEntitiesById(contextState, action.itemIds) ]) ); } return state; } function itemIsComplete(state = {}, action) { switch (action.type) { case "RECEIVE_ITEMS": { const context = getContextFromAction(action); const { query, key = entities/* DEFAULT_ENTITY_KEY */.C_ } = action; const queryParts = query ? (0,get_query_parts/* default */.A)(query) : {}; const isCompleteQuery = !query || !Array.isArray(queryParts.fields); return { ...state, [context]: { ...state[context], ...action.items.reduce((result, item) => { const itemId = item?.[key]; result[itemId] = state?.[context]?.[itemId] || isCompleteQuery; return result; }, {}) } }; } case "REMOVE_ITEMS": return Object.fromEntries( Object.entries(state).map(([itemId, contextState]) => [ itemId, removeEntitiesById(contextState, action.itemIds) ]) ); } return state; } const receiveQueries = (0,external_wp_compose_namespaceObject.compose)([ // Limit to matching action type so we don't attempt to replace action on // an unhandled action. if_matching_action_default((action) => "query" in action), // Inject query parts into action for use both in `onSubKey` and reducer. replace_action_default((action) => { if (action.query) { return { ...action, ...(0,get_query_parts/* default */.A)(action.query) }; } return action; }), on_sub_key_default("context"), // Queries shape is shared, but keyed by query `stableKey` part. Original // reducer tracks only a single query object. on_sub_key_default("stableKey") ])((state = {}, action) => { const { type, page, perPage, key = entities/* DEFAULT_ENTITY_KEY */.C_ } = action; if (type !== "RECEIVE_ITEMS") { return state; } return { itemIds: getMergedItemIds( state?.itemIds || [], action.items.map((item) => item?.[key]).filter(Boolean), page, perPage ), meta: action.meta }; }); const queries = (state = {}, action) => { switch (action.type) { case "RECEIVE_ITEMS": return receiveQueries(state, action); case "REMOVE_ITEMS": const removedItems = action.itemIds.reduce((result, itemId) => { result[itemId] = true; return result; }, {}); return Object.fromEntries( Object.entries(state).map( ([queryGroup, contextQueries]) => [ queryGroup, Object.fromEntries( Object.entries(contextQueries).map( ([query, queryItems]) => [ query, { ...queryItems, itemIds: queryItems.itemIds.filter( (queryId) => !removedItems[queryId] ) } ] ) ) ] ) ); default: return state; } }; var reducer_default = (0,external_wp_data_.combineReducers)({ items, itemIsComplete, queries }); ;// ./node_modules/@wordpress/core-data/build-module/reducer.js function users(state = { byId: {}, queries: {} }, action) { switch (action.type) { case "RECEIVE_USER_QUERY": return { byId: { ...state.byId, // Key users by their ID. ...action.users.reduce( (newUsers, user) => ({ ...newUsers, [user.id]: user }), {} ) }, queries: { ...state.queries, [action.queryID]: action.users.map((user) => user.id) } }; } return state; } function currentUser(state = {}, action) { switch (action.type) { case "RECEIVE_CURRENT_USER": return action.currentUser; } return state; } function currentTheme(state = void 0, action) { switch (action.type) { case "RECEIVE_CURRENT_THEME": return action.currentTheme.stylesheet; } return state; } function currentGlobalStylesId(state = void 0, action) { switch (action.type) { case "RECEIVE_CURRENT_GLOBAL_STYLES_ID": return action.id; } return state; } function themeBaseGlobalStyles(state = {}, action) { switch (action.type) { case "RECEIVE_THEME_GLOBAL_STYLES": return { ...state, [action.stylesheet]: action.globalStyles }; } return state; } function themeGlobalStyleVariations(state = {}, action) { switch (action.type) { case "RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS": return { ...state, [action.stylesheet]: action.variations }; } return state; } const withMultiEntityRecordEdits = (reducer) => (state, action) => { if (action.type === "UNDO" || action.type === "REDO") { const { record } = action; let newState = state; record.forEach(({ id: { kind, name, recordId }, changes }) => { newState = reducer(newState, { type: "EDIT_ENTITY_RECORD", kind, name, recordId, edits: Object.entries(changes).reduce( (acc, [key, value]) => { acc[key] = action.type === "UNDO" ? value.from : value.to; return acc; }, {} ) }); }); return newState; } return reducer(state, action); }; function entity(entityConfig) { return (0,external_wp_compose_namespaceObject.compose)([ withMultiEntityRecordEdits, // Limit to matching action type so we don't attempt to replace action on // an unhandled action. if_matching_action_default( (action) => action.name && action.kind && action.name === entityConfig.name && action.kind === entityConfig.kind ), // Inject the entity config into the action. replace_action_default((action) => { return { key: entityConfig.key || entities/* DEFAULT_ENTITY_KEY */.C_, ...action }; }) ])( (0,external_wp_data_.combineReducers)({ queriedData: reducer_default, edits: (state = {}, action) => { switch (action.type) { case "RECEIVE_ITEMS": const context = action?.query?.context ?? "default"; if (context !== "default") { return state; } const nextState = { ...state }; for (const record of action.items) { const recordId = record?.[action.key]; const edits = nextState[recordId]; if (!edits) { continue; } const nextEdits2 = Object.keys(edits).reduce( (acc, key) => { if ( // Edits are the "raw" attribute values, but records may have // objects with more properties, so we use `get` here for the // comparison. !es6_default()( edits[key], record[key]?.raw ?? record[key] ) && // Sometimes the server alters the sent value which means // we need to also remove the edits before the api request. (!action.persistedEdits || !es6_default()( edits[key], action.persistedEdits[key] )) ) { acc[key] = edits[key]; } return acc; }, {} ); if (Object.keys(nextEdits2).length) { nextState[recordId] = nextEdits2; } else { delete nextState[recordId]; } } return nextState; case "EDIT_ENTITY_RECORD": const nextEdits = { ...state[action.recordId], ...action.edits }; Object.keys(nextEdits).forEach((key) => { if (nextEdits[key] === void 0) { delete nextEdits[key]; } }); return { ...state, [action.recordId]: nextEdits }; } return state; }, saving: (state = {}, action) => { switch (action.type) { case "SAVE_ENTITY_RECORD_START": case "SAVE_ENTITY_RECORD_FINISH": return { ...state, [action.recordId]: { pending: action.type === "SAVE_ENTITY_RECORD_START", error: action.error, isAutosave: action.isAutosave } }; } return state; }, deleting: (state = {}, action) => { switch (action.type) { case "DELETE_ENTITY_RECORD_START": case "DELETE_ENTITY_RECORD_FINISH": return { ...state, [action.recordId]: { pending: action.type === "DELETE_ENTITY_RECORD_START", error: action.error } }; } return state; }, revisions: (state = {}, action) => { if (action.type === "RECEIVE_ITEM_REVISIONS") { const recordKey = action.recordKey; delete action.recordKey; const newState = reducer_default(state[recordKey], { ...action, type: "RECEIVE_ITEMS" }); return { ...state, [recordKey]: newState }; } if (action.type === "REMOVE_ITEMS") { return Object.fromEntries( Object.entries(state).filter( ([id]) => !action.itemIds.some((itemId) => { if (Number.isInteger(itemId)) { return itemId === +id; } return itemId === id; }) ) ); } return state; } }) ); } function entitiesConfig(state = entities/* rootEntitiesConfig */.Mr, action) { switch (action.type) { case "ADD_ENTITIES": return [...state, ...action.entities]; } return state; } const reducer_entities = (state = {}, action) => { const newConfig = entitiesConfig(state.config, action); let entitiesDataReducer = state.reducer; if (!entitiesDataReducer || newConfig !== state.config) { const entitiesByKind = newConfig.reduce((acc, record) => { const { kind } = record; if (!acc[kind]) { acc[kind] = []; } acc[kind].push(record); return acc; }, {}); entitiesDataReducer = (0,external_wp_data_.combineReducers)( Object.fromEntries( Object.entries(entitiesByKind).map( ([kind, subEntities]) => { const kindReducer = (0,external_wp_data_.combineReducers)( Object.fromEntries( subEntities.map((entityConfig) => [ entityConfig.name, entity(entityConfig) ]) ) ); return [kind, kindReducer]; } ) ) ); } const newData = entitiesDataReducer(state.records, action); if (newData === state.records && newConfig === state.config && entitiesDataReducer === state.reducer) { return state; } return { reducer: entitiesDataReducer, records: newData, config: newConfig }; }; function undoManager(state = createUndoManager()) { return state; } function editsReference(state = {}, action) { switch (action.type) { case "EDIT_ENTITY_RECORD": case "UNDO": case "REDO": return {}; } return state; } function embedPreviews(state = {}, action) { switch (action.type) { case "RECEIVE_EMBED_PREVIEW": const { url, preview } = action; return { ...state, [url]: preview }; } return state; } function userPermissions(state = {}, action) { switch (action.type) { case "RECEIVE_USER_PERMISSION": return { ...state, [action.key]: action.isAllowed }; case "RECEIVE_USER_PERMISSIONS": return { ...state, ...action.permissions }; } return state; } function autosaves(state = {}, action) { switch (action.type) { case "RECEIVE_AUTOSAVES": const { postId, autosaves: autosavesData } = action; return { ...state, [postId]: autosavesData }; } return state; } function blockPatterns(state = [], action) { switch (action.type) { case "RECEIVE_BLOCK_PATTERNS": return action.patterns; } return state; } function blockPatternCategories(state = [], action) { switch (action.type) { case "RECEIVE_BLOCK_PATTERN_CATEGORIES": return action.categories; } return state; } function userPatternCategories(state = [], action) { switch (action.type) { case "RECEIVE_USER_PATTERN_CATEGORIES": return action.patternCategories; } return state; } function navigationFallbackId(state = null, action) { switch (action.type) { case "RECEIVE_NAVIGATION_FALLBACK_ID": return action.fallbackId; } return state; } function themeGlobalStyleRevisions(state = {}, action) { switch (action.type) { case "RECEIVE_THEME_GLOBAL_STYLE_REVISIONS": return { ...state, [action.currentId]: action.revisions }; } return state; } function defaultTemplates(state = {}, action) { switch (action.type) { case "RECEIVE_DEFAULT_TEMPLATE": return { ...state, [JSON.stringify(action.query)]: action.templateId }; } return state; } function registeredPostMeta(state = {}, action) { switch (action.type) { case "RECEIVE_REGISTERED_POST_META": return { ...state, [action.postType]: action.registeredPostMeta }; } return state; } var reducer_reducer_default = (0,external_wp_data_.combineReducers)({ users, currentTheme, currentGlobalStylesId, currentUser, themeGlobalStyleVariations, themeBaseGlobalStyles, themeGlobalStyleRevisions, entities: reducer_entities, editsReference, undoManager, embedPreviews, userPermissions, autosaves, blockPatterns, blockPatternCategories, userPatternCategories, navigationFallbackId, defaultTemplates, registeredPostMeta }); /***/ }), /***/ 5663: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ xQ: () => (/* binding */ camelCase) /* harmony export */ }); /* unused harmony exports camelCaseTransform, camelCaseTransformMerge */ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1635); /* harmony import */ var pascal_case__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(287); function camelCaseTransform(input, index) { if (index === 0) return input.toLowerCase(); return (0,pascal_case__WEBPACK_IMPORTED_MODULE_0__/* .pascalCaseTransform */ .l3)(input, index); } function camelCaseTransformMerge(input, index) { if (index === 0) return input.toLowerCase(); return pascalCaseTransformMerge(input); } function camelCase(input, options) { if (options === void 0) { options = {}; } return (0,pascal_case__WEBPACK_IMPORTED_MODULE_0__/* .pascalCase */ .fL)(input, (0,tslib__WEBPACK_IMPORTED_MODULE_1__/* .__assign */ .Cl)({ transform: camelCaseTransform }, options)); } /***/ }), /***/ 5891: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { qh: () => (/* reexport */ __experimentalUseEntityRecord), bM: () => (/* reexport */ use_entity_records/* __experimentalUseEntityRecords */.bM), _: () => (/* reexport */ __experimentalUseResourcePermissions), hg: () => (/* reexport */ useEntityBlockEditor), mV: () => (/* reexport */ useEntityId), S$: () => (/* reexport */ useEntityProp), MA: () => (/* reexport */ useEntityRecord), $u: () => (/* reexport */ use_entity_records/* default */.Ay), qs: () => (/* reexport */ use_resource_permissions_default) }); // EXTERNAL MODULE: external ["wp","data"] var external_wp_data_ = __webpack_require__(7143); // EXTERNAL MODULE: external ["wp","deprecated"] var external_wp_deprecated_ = __webpack_require__(4040); var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_); // EXTERNAL MODULE: external ["wp","element"] var external_wp_element_ = __webpack_require__(6087); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-query-select.js + 2 modules var use_query_select = __webpack_require__(7541); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/index.js var build_module = __webpack_require__(4565); ;// ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-record.js const EMPTY_OBJECT = {}; function useEntityRecord(kind, name, recordId, options = { enabled: true }) { const { editEntityRecord, saveEditedEntityRecord } = (0,external_wp_data_.useDispatch)(build_module.store); const mutations = (0,external_wp_element_.useMemo)( () => ({ edit: (record2, editOptions = {}) => editEntityRecord(kind, name, recordId, record2, editOptions), save: (saveOptions = {}) => saveEditedEntityRecord(kind, name, recordId, { throwOnError: true, ...saveOptions }) }), [editEntityRecord, kind, name, recordId, saveEditedEntityRecord] ); const { editedRecord, hasEdits, edits } = (0,external_wp_data_.useSelect)( (select) => { if (!options.enabled) { return { editedRecord: EMPTY_OBJECT, hasEdits: false, edits: EMPTY_OBJECT }; } return { editedRecord: select(build_module.store).getEditedEntityRecord( kind, name, recordId ), hasEdits: select(build_module.store).hasEditsForEntityRecord( kind, name, recordId ), edits: select(build_module.store).getEntityRecordNonTransientEdits( kind, name, recordId ) }; }, [kind, name, recordId, options.enabled] ); const { data: record, ...querySelectRest } = (0,use_query_select/* default */.A)( (query) => { if (!options.enabled) { return { data: null }; } return query(build_module.store).getEntityRecord(kind, name, recordId); }, [kind, name, recordId, options.enabled] ); return { record, editedRecord, hasEdits, edits, ...querySelectRest, ...mutations }; } function __experimentalUseEntityRecord(kind, name, recordId, options) { external_wp_deprecated_default()(`wp.data.__experimentalUseEntityRecord`, { alternative: "wp.data.useEntityRecord", since: "6.1" }); return useEntityRecord(kind, name, recordId, options); } // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-records.js var use_entity_records = __webpack_require__(7078); ;// external ["wp","warning"] const external_wp_warning_namespaceObject = window["wp"]["warning"]; var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/constants.js var constants = __webpack_require__(2859); ;// ./node_modules/@wordpress/core-data/build-module/hooks/use-resource-permissions.js function useResourcePermissions(resource, id) { const isEntity = typeof resource === "object"; const resourceAsString = isEntity ? JSON.stringify(resource) : resource; if (isEntity && typeof id !== "undefined") { external_wp_warning_default()( `When 'resource' is an entity object, passing 'id' as a separate argument isn't supported.` ); } return (0,use_query_select/* default */.A)( (resolve) => { const hasId = isEntity ? !!resource.id : !!id; const { canUser } = resolve(build_module.store); const create = canUser( "create", isEntity ? { kind: resource.kind, name: resource.name } : resource ); if (!hasId) { const read2 = canUser("read", resource); const isResolving2 = create.isResolving || read2.isResolving; const hasResolved2 = create.hasResolved && read2.hasResolved; let status2 = constants/* Status */.n.Idle; if (isResolving2) { status2 = constants/* Status */.n.Resolving; } else if (hasResolved2) { status2 = constants/* Status */.n.Success; } return { status: status2, isResolving: isResolving2, hasResolved: hasResolved2, canCreate: create.hasResolved && create.data, canRead: read2.hasResolved && read2.data }; } const read = canUser("read", resource, id); const update = canUser("update", resource, id); const _delete = canUser("delete", resource, id); const isResolving = read.isResolving || create.isResolving || update.isResolving || _delete.isResolving; const hasResolved = read.hasResolved && create.hasResolved && update.hasResolved && _delete.hasResolved; let status = constants/* Status */.n.Idle; if (isResolving) { status = constants/* Status */.n.Resolving; } else if (hasResolved) { status = constants/* Status */.n.Success; } return { status, isResolving, hasResolved, canRead: hasResolved && read.data, canCreate: hasResolved && create.data, canUpdate: hasResolved && update.data, canDelete: hasResolved && _delete.data }; }, [resourceAsString, id] ); } var use_resource_permissions_default = useResourcePermissions; function __experimentalUseResourcePermissions(resource, id) { external_wp_deprecated_default()(`wp.data.__experimentalUseResourcePermissions`, { alternative: "wp.data.useResourcePermissions", since: "6.1" }); return useResourcePermissions(resource, id); } // EXTERNAL MODULE: external ["wp","blocks"] var external_wp_blocks_ = __webpack_require__(4997); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/name.js var build_module_name = __webpack_require__(2278); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/entity-context.js var entity_context = __webpack_require__(8843); ;// ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-id.js function useEntityId(kind, name) { const context = (0,external_wp_element_.useContext)(entity_context/* EntityContext */.D); return context?.[kind]?.[name]; } ;// external ["wp","richText"] const external_wp_richText_namespaceObject = window["wp"]["richText"]; ;// external ["wp","blockEditor"] const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/lock-unlock.js + 1 modules var lock_unlock = __webpack_require__(6378); ;// ./node_modules/@wordpress/core-data/build-module/footnotes/get-rich-text-values-cached.js let unlockedApis; const cache = /* @__PURE__ */ new WeakMap(); function getRichTextValuesCached(block) { if (!unlockedApis) { unlockedApis = (0,lock_unlock/* unlock */.T)(external_wp_blockEditor_namespaceObject.privateApis); } if (!cache.has(block)) { const values = unlockedApis.getRichTextValues([block]); cache.set(block, values); } return cache.get(block); } ;// ./node_modules/@wordpress/core-data/build-module/footnotes/get-footnotes-order.js const get_footnotes_order_cache = /* @__PURE__ */ new WeakMap(); function getBlockFootnotesOrder(block) { if (!get_footnotes_order_cache.has(block)) { const order = []; for (const value of getRichTextValuesCached(block)) { if (!value) { continue; } value.replacements.forEach(({ type, attributes }) => { if (type === "core/footnote") { order.push(attributes["data-fn"]); } }); } get_footnotes_order_cache.set(block, order); } return get_footnotes_order_cache.get(block); } function getFootnotesOrder(blocks) { return blocks.flatMap(getBlockFootnotesOrder); } ;// ./node_modules/@wordpress/core-data/build-module/footnotes/index.js let oldFootnotes = {}; function updateFootnotesFromMeta(blocks, meta) { const output = { blocks }; if (!meta) { return output; } if (meta.footnotes === void 0) { return output; } const newOrder = getFootnotesOrder(blocks); const footnotes = meta.footnotes ? JSON.parse(meta.footnotes) : []; const currentOrder = footnotes.map((fn) => fn.id); if (currentOrder.join("") === newOrder.join("")) { return output; } const newFootnotes = newOrder.map( (fnId) => footnotes.find((fn) => fn.id === fnId) || oldFootnotes[fnId] || { id: fnId, content: "" } ); function updateAttributes(attributes) { if (!attributes || Array.isArray(attributes) || typeof attributes !== "object") { return attributes; } attributes = { ...attributes }; for (const key in attributes) { const value = attributes[key]; if (Array.isArray(value)) { attributes[key] = value.map(updateAttributes); continue; } if (typeof value !== "string" && !(value instanceof external_wp_richText_namespaceObject.RichTextData)) { continue; } const richTextValue = typeof value === "string" ? external_wp_richText_namespaceObject.RichTextData.fromHTMLString(value) : new external_wp_richText_namespaceObject.RichTextData(value); let hasFootnotes = false; richTextValue.replacements.forEach((replacement) => { if (replacement.type === "core/footnote") { const id = replacement.attributes["data-fn"]; const index = newOrder.indexOf(id); const countValue = (0,external_wp_richText_namespaceObject.create)({ html: replacement.innerHTML }); countValue.text = String(index + 1); countValue.formats = Array.from( { length: countValue.text.length }, () => countValue.formats[0] ); countValue.replacements = Array.from( { length: countValue.text.length }, () => countValue.replacements[0] ); replacement.innerHTML = (0,external_wp_richText_namespaceObject.toHTMLString)({ value: countValue }); hasFootnotes = true; } }); if (hasFootnotes) { attributes[key] = typeof value === "string" ? richTextValue.toHTMLString() : richTextValue; } } return attributes; } function updateBlocksAttributes(__blocks) { return __blocks.map((block) => { return { ...block, attributes: updateAttributes(block.attributes), innerBlocks: updateBlocksAttributes(block.innerBlocks) }; }); } const newBlocks = updateBlocksAttributes(blocks); oldFootnotes = { ...oldFootnotes, ...footnotes.reduce((acc, fn) => { if (!newOrder.includes(fn.id)) { acc[fn.id] = fn; } return acc; }, {}) }; return { meta: { ...meta, footnotes: JSON.stringify(newFootnotes) }, blocks: newBlocks }; } ;// ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-block-editor.js const EMPTY_ARRAY = []; const parsedBlocksCache = /* @__PURE__ */ new WeakMap(); function useEntityBlockEditor(kind, name, { id: _id } = {}) { const providerId = useEntityId(kind, name); const id = _id ?? providerId; const { getEntityRecord, getEntityRecordEdits } = (0,external_wp_data_.useSelect)(build_module_name/* STORE_NAME */.E); const { content, editedBlocks, meta } = (0,external_wp_data_.useSelect)( (select) => { if (!id) { return {}; } const { getEditedEntityRecord } = select(build_module_name/* STORE_NAME */.E); const editedRecord = getEditedEntityRecord(kind, name, id); return { editedBlocks: editedRecord.blocks, content: editedRecord.content, meta: editedRecord.meta }; }, [kind, name, id] ); const { __unstableCreateUndoLevel, editEntityRecord } = (0,external_wp_data_.useDispatch)(build_module_name/* STORE_NAME */.E); const blocks = (0,external_wp_element_.useMemo)(() => { if (!id) { return void 0; } if (editedBlocks) { return editedBlocks; } if (!content || typeof content !== "string") { return EMPTY_ARRAY; } const edits = getEntityRecordEdits(kind, name, id); const isUnedited = !edits || !Object.keys(edits).length; const cackeKey = isUnedited ? getEntityRecord(kind, name, id) : edits; let _blocks = parsedBlocksCache.get(cackeKey); if (!_blocks) { _blocks = (0,external_wp_blocks_.parse)(content); parsedBlocksCache.set(cackeKey, _blocks); } return _blocks; }, [ kind, name, id, editedBlocks, content, getEntityRecord, getEntityRecordEdits ]); const onChange = (0,external_wp_element_.useCallback)( (newBlocks, options) => { const noChange = blocks === newBlocks; if (noChange) { return __unstableCreateUndoLevel(kind, name, id); } const { selection, ...rest } = options; const edits = { selection, content: ({ blocks: blocksForSerialization = [] }) => (0,external_wp_blocks_.__unstableSerializeAndClean)(blocksForSerialization), ...updateFootnotesFromMeta(newBlocks, meta) }; editEntityRecord(kind, name, id, edits, { isCached: false, ...rest }); }, [ kind, name, id, blocks, meta, __unstableCreateUndoLevel, editEntityRecord ] ); const onInput = (0,external_wp_element_.useCallback)( (newBlocks, options) => { const { selection, ...rest } = options; const footnotesChanges = updateFootnotesFromMeta(newBlocks, meta); const edits = { selection, ...footnotesChanges }; editEntityRecord(kind, name, id, edits, { isCached: true, ...rest }); }, [kind, name, id, meta, editEntityRecord] ); return [blocks, onInput, onChange]; } ;// ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-prop.js function useEntityProp(kind, name, prop, _id) { const providerId = useEntityId(kind, name); const id = _id ?? providerId; const { value, fullValue } = (0,external_wp_data_.useSelect)( (select) => { const { getEntityRecord, getEditedEntityRecord } = select(build_module_name/* STORE_NAME */.E); const record = getEntityRecord(kind, name, id); const editedRecord = getEditedEntityRecord(kind, name, id); return record && editedRecord ? { value: editedRecord[prop], fullValue: record[prop] } : {}; }, [kind, name, id, prop] ); const { editEntityRecord } = (0,external_wp_data_.useDispatch)(build_module_name/* STORE_NAME */.E); const setValue = (0,external_wp_element_.useCallback)( (newValue) => { editEntityRecord(kind, name, id, { [prop]: newValue }); }, [editEntityRecord, kind, name, id, prop] ); return [value, setValue, fullValue]; } ;// ./node_modules/@wordpress/core-data/build-module/hooks/index.js /***/ }), /***/ 5914: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { C_: () => (/* binding */ DEFAULT_ENTITY_KEY), L2: () => (/* binding */ additionalEntityConfigLoaders), TK: () => (/* binding */ deprecatedEntities), zD: () => (/* binding */ getMethodName), Mr: () => (/* binding */ rootEntitiesConfig) }); // UNUSED EXPORTS: prePersistPostType // EXTERNAL MODULE: ./node_modules/tslib/tslib.es6.mjs var tslib_es6 = __webpack_require__(1635); // EXTERNAL MODULE: ./node_modules/no-case/dist.es2015/index.js var dist_es2015 = __webpack_require__(2226); ;// ./node_modules/upper-case-first/dist.es2015/index.js /** * Upper case the first character of an input string. */ function upperCaseFirst(input) { return input.charAt(0).toUpperCase() + input.substr(1); } ;// ./node_modules/capital-case/dist.es2015/index.js function capitalCaseTransform(input) { return upperCaseFirst(input.toLowerCase()); } function capitalCase(input, options) { if (options === void 0) { options = {}; } return (0,dist_es2015/* noCase */.W)(input, (0,tslib_es6/* __assign */.Cl)({ delimiter: " ", transform: capitalCaseTransform }, options)); } // EXTERNAL MODULE: ./node_modules/pascal-case/dist.es2015/index.js var pascal_case_dist_es2015 = __webpack_require__(287); // EXTERNAL MODULE: external ["wp","apiFetch"] var external_wp_apiFetch_ = __webpack_require__(1455); var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_); // EXTERNAL MODULE: external ["wp","blocks"] var external_wp_blocks_ = __webpack_require__(4997); // EXTERNAL MODULE: external ["wp","i18n"] var external_wp_i18n_ = __webpack_require__(7723); ;// ./node_modules/@wordpress/core-data/build-module/entities.js const DEFAULT_ENTITY_KEY = "id"; const POST_RAW_ATTRIBUTES = ["title", "excerpt", "content"]; const blocksTransientEdits = { blocks: { read: (record) => (0,external_wp_blocks_.parse)(record.content?.raw ?? ""), write: (record) => ({ content: (0,external_wp_blocks_.__unstableSerializeAndClean)(record.blocks) }) } }; const rootEntitiesConfig = [ { label: (0,external_wp_i18n_.__)("Base"), kind: "root", key: false, name: "__unstableBase", baseURL: "/", baseURLParams: { // Please also change the preload path when changing this. // @see lib/compat/wordpress-6.8/preload.php _fields: [ "description", "gmt_offset", "home", "name", "site_icon", "site_icon_url", "site_logo", "timezone_string", "url", "page_for_posts", "page_on_front", "show_on_front" ].join(",") }, // The entity doesn't support selecting multiple records. // The property is maintained for backward compatibility. plural: "__unstableBases" }, { label: (0,external_wp_i18n_.__)("Post Type"), name: "postType", kind: "root", key: "slug", baseURL: "/wp/v2/types", baseURLParams: { context: "edit" }, plural: "postTypes" }, { name: "media", kind: "root", baseURL: "/wp/v2/media", baseURLParams: { context: "edit" }, plural: "mediaItems", label: (0,external_wp_i18n_.__)("Media"), rawAttributes: ["caption", "title", "description"], supportsPagination: true }, { name: "taxonomy", kind: "root", key: "slug", baseURL: "/wp/v2/taxonomies", baseURLParams: { context: "edit" }, plural: "taxonomies", label: (0,external_wp_i18n_.__)("Taxonomy") }, { name: "sidebar", kind: "root", baseURL: "/wp/v2/sidebars", baseURLParams: { context: "edit" }, plural: "sidebars", transientEdits: { blocks: true }, label: (0,external_wp_i18n_.__)("Widget areas") }, { name: "widget", kind: "root", baseURL: "/wp/v2/widgets", baseURLParams: { context: "edit" }, plural: "widgets", transientEdits: { blocks: true }, label: (0,external_wp_i18n_.__)("Widgets") }, { name: "widgetType", kind: "root", baseURL: "/wp/v2/widget-types", baseURLParams: { context: "edit" }, plural: "widgetTypes", label: (0,external_wp_i18n_.__)("Widget types") }, { label: (0,external_wp_i18n_.__)("User"), name: "user", kind: "root", baseURL: "/wp/v2/users", getTitle: (record) => record?.name || record?.slug, baseURLParams: { context: "edit" }, plural: "users", supportsPagination: true }, { name: "comment", kind: "root", baseURL: "/wp/v2/comments", baseURLParams: { context: "edit" }, plural: "comments", label: (0,external_wp_i18n_.__)("Comment"), supportsPagination: true }, { name: "menu", kind: "root", baseURL: "/wp/v2/menus", baseURLParams: { context: "edit" }, plural: "menus", label: (0,external_wp_i18n_.__)("Menu"), supportsPagination: true }, { name: "menuItem", kind: "root", baseURL: "/wp/v2/menu-items", baseURLParams: { context: "edit" }, plural: "menuItems", label: (0,external_wp_i18n_.__)("Menu Item"), rawAttributes: ["title"], supportsPagination: true }, { name: "menuLocation", kind: "root", baseURL: "/wp/v2/menu-locations", baseURLParams: { context: "edit" }, plural: "menuLocations", label: (0,external_wp_i18n_.__)("Menu Location"), key: "name" }, { label: (0,external_wp_i18n_.__)("Global Styles"), name: "globalStyles", kind: "root", baseURL: "/wp/v2/global-styles", baseURLParams: { context: "edit" }, plural: "globalStylesVariations", // Should be different from name. getTitle: () => (0,external_wp_i18n_.__)("Custom Styles"), getRevisionsUrl: (parentId, revisionId) => `/wp/v2/global-styles/${parentId}/revisions${revisionId ? "/" + revisionId : ""}`, supportsPagination: true }, { label: (0,external_wp_i18n_.__)("Themes"), name: "theme", kind: "root", baseURL: "/wp/v2/themes", baseURLParams: { context: "edit" }, plural: "themes", key: "stylesheet" }, { label: (0,external_wp_i18n_.__)("Plugins"), name: "plugin", kind: "root", baseURL: "/wp/v2/plugins", baseURLParams: { context: "edit" }, plural: "plugins", key: "plugin" }, { label: (0,external_wp_i18n_.__)("Status"), name: "status", kind: "root", baseURL: "/wp/v2/statuses", baseURLParams: { context: "edit" }, plural: "statuses", key: "slug" } ]; const deprecatedEntities = { root: { media: { since: "6.9", alternative: { kind: "postType", name: "attachment" } } } }; const additionalEntityConfigLoaders = [ { kind: "postType", loadEntities: loadPostTypeEntities }, { kind: "taxonomy", loadEntities: loadTaxonomyEntities }, { kind: "root", name: "site", plural: "sites", loadEntities: loadSiteEntity } ]; const prePersistPostType = (persistedRecord, edits) => { const newEdits = {}; if (persistedRecord?.status === "auto-draft") { if (!edits.status && !newEdits.status) { newEdits.status = "draft"; } if ((!edits.title || edits.title === "Auto Draft") && !newEdits.title && (!persistedRecord?.title || persistedRecord?.title === "Auto Draft")) { newEdits.title = ""; } } return newEdits; }; async function loadPostTypeEntities() { const postTypes = await external_wp_apiFetch_default()({ path: "/wp/v2/types?context=view" }); return Object.entries(postTypes ?? {}).map(([name, postType]) => { const isTemplate = ["wp_template", "wp_template_part"].includes( name ); const namespace = postType?.rest_namespace ?? "wp/v2"; const entity = { kind: "postType", baseURL: `/${namespace}/${postType.rest_base}`, baseURLParams: { context: "edit" }, name, label: postType.name, transientEdits: { ...blocksTransientEdits, selection: true }, mergedEdits: { meta: true }, rawAttributes: POST_RAW_ATTRIBUTES, getTitle: (record) => record?.title?.rendered || record?.title || (isTemplate ? capitalCase(record.slug ?? "") : String(record.id)), __unstablePrePersist: isTemplate ? void 0 : prePersistPostType, __unstable_rest_base: postType.rest_base, supportsPagination: true, getRevisionsUrl: (parentId, revisionId) => `/${namespace}/${postType.rest_base}/${parentId}/revisions${revisionId ? "/" + revisionId : ""}`, revisionKey: isTemplate ? "wp_id" : DEFAULT_ENTITY_KEY }; if (window.__experimentalEnableSync) { if (false) {} } return entity; }); } async function loadTaxonomyEntities() { const taxonomies = await external_wp_apiFetch_default()({ path: "/wp/v2/taxonomies?context=view" }); return Object.entries(taxonomies ?? {}).map(([name, taxonomy]) => { const namespace = taxonomy?.rest_namespace ?? "wp/v2"; return { kind: "taxonomy", baseURL: `/${namespace}/${taxonomy.rest_base}`, baseURLParams: { context: "edit" }, name, label: taxonomy.name, getTitle: (record) => record?.name, supportsPagination: true }; }); } async function loadSiteEntity() { const entity = { label: (0,external_wp_i18n_.__)("Site"), name: "site", kind: "root", key: false, baseURL: "/wp/v2/settings", meta: {} }; if (window.__experimentalEnableSync) { if (false) {} } const site = await external_wp_apiFetch_default()({ path: entity.baseURL, method: "OPTIONS" }); const labels = {}; Object.entries(site?.schema?.properties ?? {}).forEach( ([key, value]) => { if (typeof value === "object" && value.title) { labels[key] = value.title; } } ); return [{ ...entity, meta: { labels } }]; } const getMethodName = (kind, name, prefix = "get") => { const kindPrefix = kind === "root" ? "" : (0,pascal_case_dist_es2015/* pascalCase */.fL)(kind); const suffix = (0,pascal_case_dist_es2015/* pascalCase */.fL)(name); return `${prefix}${kindPrefix}${suffix}`; }; /***/ }), /***/ 6087: /***/ ((module) => { "use strict"; module.exports = window["wp"]["element"]; /***/ }), /***/ 6378: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { s: () => (/* binding */ lock), T: () => (/* binding */ unlock) }); ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/core-data/build-module/lock-unlock.js const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/core-data" ); /***/ }), /***/ 6384: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { __experimentalGetCurrentGlobalStylesId: () => (/* binding */ __experimentalGetCurrentGlobalStylesId), __experimentalGetCurrentThemeBaseGlobalStyles: () => (/* binding */ __experimentalGetCurrentThemeBaseGlobalStyles), __experimentalGetCurrentThemeGlobalStylesVariations: () => (/* binding */ __experimentalGetCurrentThemeGlobalStylesVariations), canUser: () => (/* binding */ canUser), canUserEditEntityRecord: () => (/* binding */ canUserEditEntityRecord), getAuthors: () => (/* binding */ getAuthors), getAutosave: () => (/* binding */ getAutosave), getAutosaves: () => (/* binding */ getAutosaves), getBlockPatternCategories: () => (/* binding */ getBlockPatternCategories), getBlockPatterns: () => (/* binding */ getBlockPatterns), getCurrentTheme: () => (/* binding */ getCurrentTheme), getCurrentThemeGlobalStylesRevisions: () => (/* binding */ getCurrentThemeGlobalStylesRevisions), getCurrentUser: () => (/* binding */ getCurrentUser), getDefaultTemplateId: () => (/* binding */ getDefaultTemplateId), getEditedEntityRecord: () => (/* binding */ getEditedEntityRecord), getEmbedPreview: () => (/* binding */ getEmbedPreview), getEntitiesConfig: () => (/* binding */ getEntitiesConfig), getEntityRecord: () => (/* binding */ getEntityRecord), getEntityRecords: () => (/* binding */ getEntityRecords), getEntityRecordsTotalItems: () => (/* binding */ getEntityRecordsTotalItems), getEntityRecordsTotalPages: () => (/* binding */ getEntityRecordsTotalPages), getNavigationFallbackId: () => (/* binding */ getNavigationFallbackId), getRawEntityRecord: () => (/* binding */ getRawEntityRecord), getRegisteredPostMeta: () => (/* binding */ getRegisteredPostMeta), getRevision: () => (/* binding */ getRevision), getRevisions: () => (/* binding */ getRevisions), getThemeSupports: () => (/* binding */ getThemeSupports), getUserPatternCategories: () => (/* binding */ getUserPatternCategories) }); // EXTERNAL MODULE: ./node_modules/camel-case/dist.es2015/index.js var dist_es2015 = __webpack_require__(5663); // EXTERNAL MODULE: external ["wp","url"] var external_wp_url_ = __webpack_require__(3832); // EXTERNAL MODULE: external ["wp","htmlEntities"] var external_wp_htmlEntities_ = __webpack_require__(8537); // EXTERNAL MODULE: external ["wp","apiFetch"] var external_wp_apiFetch_ = __webpack_require__(1455); var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/name.js var build_module_name = __webpack_require__(2278); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/entities.js + 2 modules var entities = __webpack_require__(5914); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/utils/get-normalized-comma-separable.js var get_normalized_comma_separable = __webpack_require__(533); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/utils/user-permissions.js var user_permissions = __webpack_require__(2577); ;// ./node_modules/@wordpress/core-data/build-module/utils/forward-resolver.js const forwardResolver = (resolverName) => (...args) => async ({ resolveSelect }) => { await resolveSelect[resolverName](...args); }; var forward_resolver_default = forwardResolver; // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/utils/receive-intermediate-results.js var receive_intermediate_results = __webpack_require__(5101); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/fetch/index.js + 2 modules var fetch = __webpack_require__(7006); ;// ./node_modules/@wordpress/core-data/build-module/resolvers.js const getAuthors = (query) => async ({ dispatch }) => { const path = (0,external_wp_url_.addQueryArgs)( "/wp/v2/users/?who=authors&per_page=100", query ); const users = await external_wp_apiFetch_default()({ path }); dispatch.receiveUserQuery(path, users); }; const getCurrentUser = () => async ({ dispatch }) => { const currentUser = await external_wp_apiFetch_default()({ path: "/wp/v2/users/me" }); dispatch.receiveCurrentUser(currentUser); }; const getEntityRecord = (kind, name, key = "", query) => async ({ select, dispatch, registry, resolveSelect }) => { const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find( (config) => config.name === name && config.kind === kind ); if (!entityConfig) { return; } const lock = await dispatch.__unstableAcquireStoreLock( build_module_name/* STORE_NAME */.E, ["entities", "records", kind, name, key], { exclusive: false } ); try { if (query !== void 0 && query._fields) { query = { ...query, _fields: [ .../* @__PURE__ */ new Set([ ...(0,get_normalized_comma_separable/* default */.A)(query._fields) || [], entityConfig.key || entities/* DEFAULT_ENTITY_KEY */.C_ ]) ].join() }; } if (query !== void 0 && query._fields) { const hasRecord = select.hasEntityRecord( kind, name, key, query ); if (hasRecord) { return; } } const path = (0,external_wp_url_.addQueryArgs)( entityConfig.baseURL + (key ? "/" + key : ""), { ...entityConfig.baseURLParams, ...query } ); const response = await external_wp_apiFetch_default()({ path, parse: false }); const record = await response.json(); const permissions = (0,user_permissions/* getUserPermissionsFromAllowHeader */.qY)( response.headers?.get("allow") ); const canUserResolutionsArgs = []; const receiveUserPermissionArgs = {}; for (const action of user_permissions/* ALLOWED_RESOURCE_ACTIONS */.CO) { receiveUserPermissionArgs[(0,user_permissions/* getUserPermissionCacheKey */.kC)(action, { kind, name, id: key })] = permissions[action]; canUserResolutionsArgs.push([ action, { kind, name, id: key } ]); } if (window.__experimentalEnableSync && entityConfig.syncConfig && !query) { if (false) {} } registry.batch(() => { dispatch.receiveEntityRecords(kind, name, record, query); dispatch.receiveUserPermissions(receiveUserPermissionArgs); dispatch.finishResolutions("canUser", canUserResolutionsArgs); }); } finally { dispatch.__unstableReleaseStoreLock(lock); } }; const getRawEntityRecord = forward_resolver_default("getEntityRecord"); const getEditedEntityRecord = forward_resolver_default("getEntityRecord"); const getEntityRecords = (kind, name, query = {}) => async ({ dispatch, registry, resolveSelect }) => { const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find( (config) => config.name === name && config.kind === kind ); if (!entityConfig) { return; } const lock = await dispatch.__unstableAcquireStoreLock( build_module_name/* STORE_NAME */.E, ["entities", "records", kind, name], { exclusive: false } ); const rawQuery = { ...query }; const key = entityConfig.key || entities/* DEFAULT_ENTITY_KEY */.C_; function getResolutionsArgs(records, recordsQuery) { const queryArgs = Object.fromEntries( Object.entries(recordsQuery).filter(([k, v]) => { return ["context", "_fields"].includes(k) && !!v; }) ); return records.filter((record) => record?.[key]).map((record) => [ kind, name, record[key], Object.keys(queryArgs).length > 0 ? queryArgs : void 0 ]); } try { if (query._fields) { query = { ...query, _fields: [ .../* @__PURE__ */ new Set([ ...(0,get_normalized_comma_separable/* default */.A)(query._fields) || [], key ]) ].join() }; } const path = (0,external_wp_url_.addQueryArgs)(entityConfig.baseURL, { ...entityConfig.baseURLParams, ...query }); let records = [], meta; if (entityConfig.supportsPagination && query.per_page !== -1) { const response = await external_wp_apiFetch_default()({ path, parse: false }); records = Object.values(await response.json()); meta = { totalItems: parseInt( response.headers.get("X-WP-Total") ), totalPages: parseInt( response.headers.get("X-WP-TotalPages") ) }; } else if (query.per_page === -1 && query[receive_intermediate_results/* RECEIVE_INTERMEDIATE_RESULTS */.Z] === true) { let page = 1; let totalPages; do { const response = await external_wp_apiFetch_default()({ path: (0,external_wp_url_.addQueryArgs)(path, { page, per_page: 100 }), parse: false }); const pageRecords = Object.values(await response.json()); totalPages = parseInt( response.headers.get("X-WP-TotalPages") ); if (!meta) { meta = { totalItems: parseInt( response.headers.get("X-WP-Total") ), totalPages: 1 }; } records.push(...pageRecords); registry.batch(() => { dispatch.receiveEntityRecords( kind, name, records, query, false, void 0, meta ); dispatch.finishResolutions( "getEntityRecord", getResolutionsArgs(pageRecords, rawQuery) ); }); page++; } while (page <= totalPages); } else { records = Object.values(await external_wp_apiFetch_default()({ path })); meta = { totalItems: records.length, totalPages: 1 }; } if (query._fields) { records = records.map((record) => { query._fields.split(",").forEach((field) => { if (!record.hasOwnProperty(field)) { record[field] = void 0; } }); return record; }); } registry.batch(() => { dispatch.receiveEntityRecords( kind, name, records, query, false, void 0, meta ); const targetHints = records.filter( (record) => !!record?.[key] && !!record?._links?.self?.[0]?.targetHints?.allow ).map((record) => ({ id: record[key], permissions: (0,user_permissions/* getUserPermissionsFromAllowHeader */.qY)( record._links.self[0].targetHints.allow ) })); const canUserResolutionsArgs = []; const receiveUserPermissionArgs = {}; for (const targetHint of targetHints) { for (const action of user_permissions/* ALLOWED_RESOURCE_ACTIONS */.CO) { canUserResolutionsArgs.push([ action, { kind, name, id: targetHint.id } ]); receiveUserPermissionArgs[(0,user_permissions/* getUserPermissionCacheKey */.kC)(action, { kind, name, id: targetHint.id })] = targetHint.permissions[action]; } } if (targetHints.length > 0) { dispatch.receiveUserPermissions( receiveUserPermissionArgs ); dispatch.finishResolutions( "canUser", canUserResolutionsArgs ); } dispatch.finishResolutions( "getEntityRecord", getResolutionsArgs(records, rawQuery) ); dispatch.__unstableReleaseStoreLock(lock); }); } catch (e) { dispatch.__unstableReleaseStoreLock(lock); } }; getEntityRecords.shouldInvalidate = (action, kind, name) => { return (action.type === "RECEIVE_ITEMS" || action.type === "REMOVE_ITEMS") && action.invalidateCache && kind === action.kind && name === action.name; }; const getEntityRecordsTotalItems = forward_resolver_default("getEntityRecords"); const getEntityRecordsTotalPages = forward_resolver_default("getEntityRecords"); const getCurrentTheme = () => async ({ dispatch, resolveSelect }) => { const activeThemes = await resolveSelect.getEntityRecords( "root", "theme", { status: "active" } ); dispatch.receiveCurrentTheme(activeThemes[0]); }; const getThemeSupports = forward_resolver_default("getCurrentTheme"); const getEmbedPreview = (url) => async ({ dispatch }) => { try { const embedProxyResponse = await external_wp_apiFetch_default()({ path: (0,external_wp_url_.addQueryArgs)("/oembed/1.0/proxy", { url }) }); dispatch.receiveEmbedPreview(url, embedProxyResponse); } catch (error) { dispatch.receiveEmbedPreview(url, false); } }; const canUser = (requestedAction, resource, id) => async ({ dispatch, registry, resolveSelect }) => { if (!user_permissions/* ALLOWED_RESOURCE_ACTIONS */.CO.includes(requestedAction)) { throw new Error(`'${requestedAction}' is not a valid action.`); } const { hasStartedResolution } = registry.select(build_module_name/* STORE_NAME */.E); for (const relatedAction of user_permissions/* ALLOWED_RESOURCE_ACTIONS */.CO) { if (relatedAction === requestedAction) { continue; } const isAlreadyResolving = hasStartedResolution("canUser", [ relatedAction, resource, id ]); if (isAlreadyResolving) { return; } } let resourcePath = null; if (typeof resource === "object") { if (!resource.kind || !resource.name) { throw new Error("The entity resource object is not valid."); } const configs = await resolveSelect.getEntitiesConfig( resource.kind ); const entityConfig = configs.find( (config) => config.name === resource.name && config.kind === resource.kind ); if (!entityConfig) { return; } resourcePath = entityConfig.baseURL + (resource.id ? "/" + resource.id : ""); } else { resourcePath = `/wp/v2/${resource}` + (id ? "/" + id : ""); } let response; try { response = await external_wp_apiFetch_default()({ path: resourcePath, method: "OPTIONS", parse: false }); } catch (error) { return; } const permissions = (0,user_permissions/* getUserPermissionsFromAllowHeader */.qY)( response.headers?.get("allow") ); registry.batch(() => { for (const action of user_permissions/* ALLOWED_RESOURCE_ACTIONS */.CO) { const key = (0,user_permissions/* getUserPermissionCacheKey */.kC)(action, resource, id); dispatch.receiveUserPermission(key, permissions[action]); if (action !== requestedAction) { dispatch.finishResolution("canUser", [ action, resource, id ]); } } }); }; const canUserEditEntityRecord = (kind, name, recordId) => async ({ dispatch }) => { await dispatch(canUser("update", { kind, name, id: recordId })); }; const getAutosaves = (postType, postId) => async ({ dispatch, resolveSelect }) => { const { rest_base: restBase, rest_namespace: restNamespace = "wp/v2", supports } = await resolveSelect.getPostType(postType); if (!supports?.autosave) { return; } const autosaves = await external_wp_apiFetch_default()({ path: `/${restNamespace}/${restBase}/${postId}/autosaves?context=edit` }); if (autosaves && autosaves.length) { dispatch.receiveAutosaves(postId, autosaves); } }; const getAutosave = (postType, postId) => async ({ resolveSelect }) => { await resolveSelect.getAutosaves(postType, postId); }; const __experimentalGetCurrentGlobalStylesId = () => async ({ dispatch, resolveSelect }) => { const activeThemes = await resolveSelect.getEntityRecords( "root", "theme", { status: "active" } ); const globalStylesURL = activeThemes?.[0]?._links?.["wp:user-global-styles"]?.[0]?.href; if (!globalStylesURL) { return; } const matches = globalStylesURL.match(/\/(\d+)(?:\?|$)/); const id = matches ? Number(matches[1]) : null; if (id) { dispatch.__experimentalReceiveCurrentGlobalStylesId(id); } }; const __experimentalGetCurrentThemeBaseGlobalStyles = () => async ({ resolveSelect, dispatch }) => { const currentTheme = await resolveSelect.getCurrentTheme(); const themeGlobalStyles = await external_wp_apiFetch_default()({ path: `/wp/v2/global-styles/themes/${currentTheme.stylesheet}?context=view` }); dispatch.__experimentalReceiveThemeBaseGlobalStyles( currentTheme.stylesheet, themeGlobalStyles ); }; const __experimentalGetCurrentThemeGlobalStylesVariations = () => async ({ resolveSelect, dispatch }) => { const currentTheme = await resolveSelect.getCurrentTheme(); const variations = await external_wp_apiFetch_default()({ path: `/wp/v2/global-styles/themes/${currentTheme.stylesheet}/variations?context=view` }); dispatch.__experimentalReceiveThemeGlobalStyleVariations( currentTheme.stylesheet, variations ); }; const getCurrentThemeGlobalStylesRevisions = () => async ({ resolveSelect, dispatch }) => { const globalStylesId = await resolveSelect.__experimentalGetCurrentGlobalStylesId(); const record = globalStylesId ? await resolveSelect.getEntityRecord( "root", "globalStyles", globalStylesId ) : void 0; const revisionsURL = record?._links?.["version-history"]?.[0]?.href; if (revisionsURL) { const resetRevisions = await external_wp_apiFetch_default()({ url: revisionsURL }); const revisions = resetRevisions?.map( (revision) => Object.fromEntries( Object.entries(revision).map(([key, value]) => [ (0,dist_es2015/* camelCase */.xQ)(key), value ]) ) ); dispatch.receiveThemeGlobalStyleRevisions( globalStylesId, revisions ); } }; getCurrentThemeGlobalStylesRevisions.shouldInvalidate = (action) => { return action.type === "SAVE_ENTITY_RECORD_FINISH" && action.kind === "root" && !action.error && action.name === "globalStyles"; }; const getBlockPatterns = () => async ({ dispatch }) => { const patterns = await (0,fetch/* fetchBlockPatterns */.l$)(); dispatch({ type: "RECEIVE_BLOCK_PATTERNS", patterns }); }; const getBlockPatternCategories = () => async ({ dispatch }) => { const categories = await external_wp_apiFetch_default()({ path: "/wp/v2/block-patterns/categories" }); dispatch({ type: "RECEIVE_BLOCK_PATTERN_CATEGORIES", categories }); }; const getUserPatternCategories = () => async ({ dispatch, resolveSelect }) => { const patternCategories = await resolveSelect.getEntityRecords( "taxonomy", "wp_pattern_category", { per_page: -1, _fields: "id,name,description,slug", context: "view" } ); const mappedPatternCategories = patternCategories?.map((userCategory) => ({ ...userCategory, label: (0,external_wp_htmlEntities_.decodeEntities)(userCategory.name), name: userCategory.slug })) || []; dispatch({ type: "RECEIVE_USER_PATTERN_CATEGORIES", patternCategories: mappedPatternCategories }); }; const getNavigationFallbackId = () => async ({ dispatch, select, registry }) => { const fallback = await external_wp_apiFetch_default()({ path: (0,external_wp_url_.addQueryArgs)("/wp-block-editor/v1/navigation-fallback", { _embed: true }) }); const record = fallback?._embedded?.self; registry.batch(() => { dispatch.receiveNavigationFallbackId(fallback?.id); if (!record) { return; } const existingFallbackEntityRecord = select.getEntityRecord( "postType", "wp_navigation", fallback.id ); const invalidateNavigationQueries = !existingFallbackEntityRecord; dispatch.receiveEntityRecords( "postType", "wp_navigation", record, void 0, invalidateNavigationQueries ); dispatch.finishResolution("getEntityRecord", [ "postType", "wp_navigation", fallback.id ]); }); }; const getDefaultTemplateId = (query) => async ({ dispatch, registry, resolveSelect }) => { const template = await external_wp_apiFetch_default()({ path: (0,external_wp_url_.addQueryArgs)("/wp/v2/templates/lookup", query) }); await resolveSelect.getEntitiesConfig("postType"); if (template?.id) { registry.batch(() => { dispatch.receiveDefaultTemplateId(query, template.id); dispatch.receiveEntityRecords("postType", "wp_template", [ template ]); dispatch.finishResolution("getEntityRecord", [ "postType", "wp_template", template.id ]); }); } }; const getRevisions = (kind, name, recordKey, query = {}) => async ({ dispatch, registry, resolveSelect }) => { const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find( (config) => config.name === name && config.kind === kind ); if (!entityConfig) { return; } if (query._fields) { query = { ...query, _fields: [ .../* @__PURE__ */ new Set([ ...(0,get_normalized_comma_separable/* default */.A)(query._fields) || [], entityConfig.revisionKey || entities/* DEFAULT_ENTITY_KEY */.C_ ]) ].join() }; } const path = (0,external_wp_url_.addQueryArgs)( entityConfig.getRevisionsUrl(recordKey), query ); let records, response; const meta = {}; const isPaginated = entityConfig.supportsPagination && query.per_page !== -1; try { response = await external_wp_apiFetch_default()({ path, parse: !isPaginated }); } catch (error) { return; } if (response) { if (isPaginated) { records = Object.values(await response.json()); meta.totalItems = parseInt( response.headers.get("X-WP-Total") ); } else { records = Object.values(response); } if (query._fields) { records = records.map((record) => { query._fields.split(",").forEach((field) => { if (!record.hasOwnProperty(field)) { record[field] = void 0; } }); return record; }); } registry.batch(() => { dispatch.receiveRevisions( kind, name, recordKey, records, query, false, meta ); if (!query?._fields && !query.context) { const key = entityConfig.key || entities/* DEFAULT_ENTITY_KEY */.C_; const resolutionsArgs = records.filter((record) => record[key]).map((record) => [ kind, name, recordKey, record[key] ]); dispatch.finishResolutions( "getRevision", resolutionsArgs ); } }); } }; getRevisions.shouldInvalidate = (action, kind, name, recordKey) => action.type === "SAVE_ENTITY_RECORD_FINISH" && name === action.name && kind === action.kind && !action.error && recordKey === action.recordId; const getRevision = (kind, name, recordKey, revisionKey, query) => async ({ dispatch, resolveSelect }) => { const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find( (config) => config.name === name && config.kind === kind ); if (!entityConfig) { return; } if (query !== void 0 && query._fields) { query = { ...query, _fields: [ .../* @__PURE__ */ new Set([ ...(0,get_normalized_comma_separable/* default */.A)(query._fields) || [], entityConfig.revisionKey || entities/* DEFAULT_ENTITY_KEY */.C_ ]) ].join() }; } const path = (0,external_wp_url_.addQueryArgs)( entityConfig.getRevisionsUrl(recordKey, revisionKey), query ); let record; try { record = await external_wp_apiFetch_default()({ path }); } catch (error) { return; } if (record) { dispatch.receiveRevisions(kind, name, recordKey, record, query); } }; const getRegisteredPostMeta = (postType) => async ({ dispatch, resolveSelect }) => { let options; try { const { rest_namespace: restNamespace = "wp/v2", rest_base: restBase } = await resolveSelect.getPostType(postType) || {}; options = await external_wp_apiFetch_default()({ path: `${restNamespace}/${restBase}/?context=edit`, method: "OPTIONS" }); } catch (error) { return; } if (options) { dispatch.receiveRegisteredPostMeta( postType, options?.schema?.properties?.meta?.properties ); } }; const getEntitiesConfig = (kind) => async ({ dispatch }) => { const loader = entities/* additionalEntityConfigLoaders */.L2.find( (l) => l.kind === kind ); if (!loader) { return; } try { const configs = await loader.loadEntities(); if (!configs.length) { return; } dispatch.addEntities(configs); } catch { } }; /***/ }), /***/ 7006: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { Y3: () => (/* reexport */ fetchLinkSuggestions), gr: () => (/* reexport */ experimental_fetch_url_data_default), l$: () => (/* binding */ fetchBlockPatterns) }); // EXTERNAL MODULE: ./node_modules/camel-case/dist.es2015/index.js var dist_es2015 = __webpack_require__(5663); // EXTERNAL MODULE: external ["wp","apiFetch"] var external_wp_apiFetch_ = __webpack_require__(1455); var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_); // EXTERNAL MODULE: external ["wp","url"] var external_wp_url_ = __webpack_require__(3832); // EXTERNAL MODULE: external ["wp","htmlEntities"] var external_wp_htmlEntities_ = __webpack_require__(8537); // EXTERNAL MODULE: external ["wp","i18n"] var external_wp_i18n_ = __webpack_require__(7723); ;// ./node_modules/@wordpress/core-data/build-module/fetch/__experimental-fetch-link-suggestions.js async function fetchLinkSuggestions(search, searchOptions = {}, editorSettings = {}) { const searchOptionsToUse = searchOptions.isInitialSuggestions && searchOptions.initialSuggestionsSearchOptions ? { ...searchOptions, ...searchOptions.initialSuggestionsSearchOptions } : searchOptions; const { type, subtype, page, perPage = searchOptions.isInitialSuggestions ? 3 : 20 } = searchOptionsToUse; const { disablePostFormats = false } = editorSettings; const queries = []; if (!type || type === "post") { queries.push( external_wp_apiFetch_default()({ path: (0,external_wp_url_.addQueryArgs)("/wp/v2/search", { search, page, per_page: perPage, type: "post", subtype }) }).then((results2) => { return results2.map((result) => { return { id: result.id, url: result.url, title: (0,external_wp_htmlEntities_.decodeEntities)(result.title || "") || (0,external_wp_i18n_.__)("(no title)"), type: result.subtype || result.type, kind: "post-type" }; }); }).catch(() => []) // Fail by returning no results. ); } if (!type || type === "term") { queries.push( external_wp_apiFetch_default()({ path: (0,external_wp_url_.addQueryArgs)("/wp/v2/search", { search, page, per_page: perPage, type: "term", subtype }) }).then((results2) => { return results2.map((result) => { return { id: result.id, url: result.url, title: (0,external_wp_htmlEntities_.decodeEntities)(result.title || "") || (0,external_wp_i18n_.__)("(no title)"), type: result.subtype || result.type, kind: "taxonomy" }; }); }).catch(() => []) // Fail by returning no results. ); } if (!disablePostFormats && (!type || type === "post-format")) { queries.push( external_wp_apiFetch_default()({ path: (0,external_wp_url_.addQueryArgs)("/wp/v2/search", { search, page, per_page: perPage, type: "post-format", subtype }) }).then((results2) => { return results2.map((result) => { return { id: result.id, url: result.url, title: (0,external_wp_htmlEntities_.decodeEntities)(result.title || "") || (0,external_wp_i18n_.__)("(no title)"), type: result.subtype || result.type, kind: "taxonomy" }; }); }).catch(() => []) // Fail by returning no results. ); } if (!type || type === "attachment") { queries.push( external_wp_apiFetch_default()({ path: (0,external_wp_url_.addQueryArgs)("/wp/v2/media", { search, page, per_page: perPage }) }).then((results2) => { return results2.map((result) => { return { id: result.id, url: result.source_url, title: (0,external_wp_htmlEntities_.decodeEntities)(result.title.rendered || "") || (0,external_wp_i18n_.__)("(no title)"), type: result.type, kind: "media" }; }); }).catch(() => []) // Fail by returning no results. ); } const responses = await Promise.all(queries); let results = responses.flat(); results = results.filter((result) => !!result.id); results = sortResults(results, search); results = results.slice(0, perPage); return results; } function sortResults(results, search) { const searchTokens = tokenize(search); const scores = {}; for (const result of results) { if (result.title) { const titleTokens = tokenize(result.title); const exactMatchingTokens = titleTokens.filter( (titleToken) => searchTokens.some( (searchToken) => titleToken === searchToken ) ); const subMatchingTokens = titleTokens.filter( (titleToken) => searchTokens.some( (searchToken) => titleToken !== searchToken && titleToken.includes(searchToken) ) ); const exactMatchScore = exactMatchingTokens.length / titleTokens.length * 10; const subMatchScore = subMatchingTokens.length / titleTokens.length; scores[result.id] = exactMatchScore + subMatchScore; } else { scores[result.id] = 0; } } return results.sort((a, b) => scores[b.id] - scores[a.id]); } function tokenize(text) { return text.toLowerCase().match(/[\p{L}\p{N}]+/gu) || []; } ;// ./node_modules/@wordpress/core-data/build-module/fetch/__experimental-fetch-url-data.js const CACHE = /* @__PURE__ */ new Map(); const fetchUrlData = async (url, options = {}) => { const endpoint = "/wp-block-editor/v1/url-details"; const args = { url: (0,external_wp_url_.prependHTTP)(url) }; if (!(0,external_wp_url_.isURL)(url)) { return Promise.reject(`${url} is not a valid URL.`); } const protocol = (0,external_wp_url_.getProtocol)(url); if (!protocol || !(0,external_wp_url_.isValidProtocol)(protocol) || !protocol.startsWith("http") || !/^https?:\/\/[^\/\s]/i.test(url)) { return Promise.reject( `${url} does not have a valid protocol. URLs must be "http" based` ); } if (CACHE.has(url)) { return CACHE.get(url); } return external_wp_apiFetch_default()({ path: (0,external_wp_url_.addQueryArgs)(endpoint, args), ...options }).then((res) => { CACHE.set(url, res); return res; }); }; var experimental_fetch_url_data_default = fetchUrlData; ;// ./node_modules/@wordpress/core-data/build-module/fetch/index.js async function fetchBlockPatterns() { const restPatterns = await external_wp_apiFetch_default()({ path: "/wp/v2/block-patterns/patterns" }); if (!restPatterns) { return []; } return restPatterns.map( (pattern) => Object.fromEntries( Object.entries(pattern).map(([key, value]) => [ (0,dist_es2015/* camelCase */.xQ)(key), value ]) ) ); } /***/ }), /***/ 7078: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Ay: () => (/* binding */ useEntityRecords), /* harmony export */ bM: () => (/* binding */ __experimentalUseEntityRecords), /* harmony export */ pU: () => (/* binding */ useEntityRecordsWithPermissions) /* harmony export */ }); /* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3832); /* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4040); /* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7143); /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6087); /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _use_query_select__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7541); /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4565); /* harmony import */ var _lock_unlock__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6378); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(533); const EMPTY_ARRAY = []; function useEntityRecords(kind, name, queryArgs = {}, options = { enabled: true }) { const queryAsString = (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)("", queryArgs); const { data: records, ...rest } = (0,_use_query_select__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A)( (query) => { if (!options.enabled) { return { // Avoiding returning a new reference on every execution. data: EMPTY_ARRAY }; } return query(___WEBPACK_IMPORTED_MODULE_4__.store).getEntityRecords(kind, name, queryArgs); }, [kind, name, queryAsString, options.enabled] ); const { totalItems, totalPages } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_2__.useSelect)( (select) => { if (!options.enabled) { return { totalItems: null, totalPages: null }; } return { totalItems: select(___WEBPACK_IMPORTED_MODULE_4__.store).getEntityRecordsTotalItems( kind, name, queryArgs ), totalPages: select(___WEBPACK_IMPORTED_MODULE_4__.store).getEntityRecordsTotalPages( kind, name, queryArgs ) }; }, [kind, name, queryAsString, options.enabled] ); return { records, totalItems, totalPages, ...rest }; } function __experimentalUseEntityRecords(kind, name, queryArgs, options) { _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_1___default()(`wp.data.__experimentalUseEntityRecords`, { alternative: "wp.data.useEntityRecords", since: "6.1" }); return useEntityRecords(kind, name, queryArgs, options); } function useEntityRecordsWithPermissions(kind, name, queryArgs = {}, options = { enabled: true }) { const entityConfig = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_2__.useSelect)( (select) => select(___WEBPACK_IMPORTED_MODULE_4__.store).getEntityConfig(kind, name), [kind, name] ); const { records: data, ...ret } = useEntityRecords( kind, name, { ...queryArgs, // If _fields is provided, we need to include _links in the request for permission caching to work. ...queryArgs._fields ? { _fields: [ .../* @__PURE__ */ new Set([ ...(0,_utils__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .A)( queryArgs._fields ) || [], "_links" ]) ].join() } : {} }, options ); const ids = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useMemo)( () => data?.map( // @ts-ignore (record) => record[entityConfig?.key ?? "id"] ) ?? [], [data, entityConfig?.key] ); const permissions = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_2__.useSelect)( (select) => { const { getEntityRecordsPermissions } = (0,_lock_unlock__WEBPACK_IMPORTED_MODULE_7__/* .unlock */ .T)( select(___WEBPACK_IMPORTED_MODULE_4__.store) ); return getEntityRecordsPermissions(kind, name, ids); }, [ids, kind, name] ); const dataWithPermissions = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useMemo)( () => data?.map((record, index) => ({ // @ts-ignore ...record, permissions: permissions[index] })) ?? [], [data, permissions] ); return { records: dataWithPermissions, ...ret }; } /***/ }), /***/ 7143: /***/ ((module) => { "use strict"; module.exports = window["wp"]["data"]; /***/ }), /***/ 7314: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ g: () => (/* binding */ lowerCase) /* harmony export */ }); /* unused harmony export localeLowerCase */ /** * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt */ var SUPPORTED_LOCALE = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, az: { regexp: /\u0130/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, lt: { regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, map: { I: "\u0069\u0307", J: "\u006A\u0307", Į: "\u012F\u0307", Ì: "\u0069\u0307\u0300", Í: "\u0069\u0307\u0301", Ĩ: "\u0069\u0307\u0303", }, }, }; /** * Localized lower case. */ function localeLowerCase(str, locale) { var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; if (lang) return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); return lowerCase(str); } /** * Lower case as a function. */ function lowerCase(str) { return str.toLowerCase(); } /***/ }), /***/ 7541: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: () => (/* binding */ useQuerySelect) }); // UNUSED EXPORTS: META_SELECTORS // EXTERNAL MODULE: external ["wp","data"] var external_wp_data_ = __webpack_require__(7143); ;// ./node_modules/memize/dist/index.js /** * Memize options object. * * @typedef MemizeOptions * * @property {number} [maxSize] Maximum size of the cache. */ /** * Internal cache entry. * * @typedef MemizeCacheNode * * @property {?MemizeCacheNode|undefined} [prev] Previous node. * @property {?MemizeCacheNode|undefined} [next] Next node. * @property {Array<*>} args Function arguments for cache * entry. * @property {*} val Function result. */ /** * Properties of the enhanced function for controlling cache. * * @typedef MemizeMemoizedFunction * * @property {()=>void} clear Clear the cache. */ /** * Accepts a function to be memoized, and returns a new memoized function, with * optional options. * * @template {(...args: any[]) => any} F * * @param {F} fn Function to memoize. * @param {MemizeOptions} [options] Options object. * * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function. */ function memize(fn, options) { var size = 0; /** @type {?MemizeCacheNode|undefined} */ var head; /** @type {?MemizeCacheNode|undefined} */ var tail; options = options || {}; function memoized(/* ...args */) { var node = head, len = arguments.length, args, i; searchCache: while (node) { // Perform a shallow equality test to confirm that whether the node // under test is a candidate for the arguments passed. Two arrays // are shallowly equal if their length matches and each entry is // strictly equal between the two sets. Avoid abstracting to a // function which could incur an arguments leaking deoptimization. // Check whether node arguments match arguments length if (node.args.length !== arguments.length) { node = node.next; continue; } // Check whether node arguments match arguments values for (i = 0; i < len; i++) { if (node.args[i] !== arguments[i]) { node = node.next; continue searchCache; } } // At this point we can assume we've found a match // Surface matched node to head if not already if (node !== head) { // As tail, shift to previous. Must only shift if not also // head, since if both head and tail, there is no previous. if (node === tail) { tail = node.prev; } // Adjust siblings to point to each other. If node was tail, // this also handles new tail's empty `next` assignment. /** @type {MemizeCacheNode} */ (node.prev).next = node.next; if (node.next) { node.next.prev = node.prev; } node.next = head; node.prev = null; /** @type {MemizeCacheNode} */ (head).prev = node; head = node; } // Return immediately return node.val; } // No cached value found. Continue to insertion phase: // Create a copy of arguments (avoid leaking deoptimization) args = new Array(len); for (i = 0; i < len; i++) { args[i] = arguments[i]; } node = { args: args, // Generate the result from original function val: fn.apply(null, args), }; // Don't need to check whether node is already head, since it would // have been returned above already if it was // Shift existing head down list if (head) { head.prev = node; node.next = head; } else { // If no head, follows that there's no tail (at initial or reset) tail = node; } // Trim tail if we're reached max size and are pending cache insertion if (size === /** @type {MemizeOptions} */ (options).maxSize) { tail = /** @type {MemizeCacheNode} */ (tail).prev; /** @type {MemizeCacheNode} */ (tail).next = null; } else { size++; } head = node; return node.val; } memoized.clear = function () { head = null; tail = null; size = 0; }; // Ignore reason: There's not a clear solution to create an intersection of // the function with additional properties, where the goal is to retain the // function signature of the incoming argument and add control properties // on the return value. // @ts-ignore return memoized; } ;// ./node_modules/@wordpress/core-data/build-module/hooks/memoize.js var memoize_default = memize; // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/constants.js var constants = __webpack_require__(2859); ;// ./node_modules/@wordpress/core-data/build-module/hooks/use-query-select.js const META_SELECTORS = [ "getIsResolving", "hasStartedResolution", "hasFinishedResolution", "isResolving", "getCachedResolvers" ]; function useQuerySelect(mapQuerySelect, deps) { return (0,external_wp_data_.useSelect)((select, registry) => { const resolve = (store) => enrichSelectors(select(store)); return mapQuerySelect(resolve, registry); }, deps); } const enrichSelectors = memoize_default(((selectors) => { const resolvers = {}; for (const selectorName in selectors) { if (META_SELECTORS.includes(selectorName)) { continue; } Object.defineProperty(resolvers, selectorName, { get: () => (...args) => { const data = selectors[selectorName](...args); const resolutionStatus = selectors.getResolutionState( selectorName, args )?.status; let status; switch (resolutionStatus) { case "resolving": status = constants/* Status */.n.Resolving; break; case "finished": status = constants/* Status */.n.Success; break; case "error": status = constants/* Status */.n.Error; break; case void 0: status = constants/* Status */.n.Idle; break; } return { data, status, isResolving: status === constants/* Status */.n.Resolving, hasStarted: status !== constants/* Status */.n.Idle, hasResolved: status === constants/* Status */.n.Success || status === constants/* Status */.n.Error }; } }); } return resolvers; })); /***/ }), /***/ 7723: /***/ ((module) => { "use strict"; module.exports = window["wp"]["i18n"]; /***/ }), /***/ 7734: /***/ ((module) => { "use strict"; // do not edit .js files directly - edit src/index.jst var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; module.exports = function equal(a, b) { if (a === b) return true; if (a && b && typeof a == 'object' && typeof b == 'object') { if (a.constructor !== b.constructor) return false; var length, i, keys; if (Array.isArray(a)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false; return true; } if ((a instanceof Map) && (b instanceof Map)) { if (a.size !== b.size) return false; for (i of a.entries()) if (!b.has(i[0])) return false; for (i of a.entries()) if (!equal(i[1], b.get(i[0]))) return false; return true; } if ((a instanceof Set) && (b instanceof Set)) { if (a.size !== b.size) return false; for (i of a.entries()) if (!b.has(i[0])) return false; return true; } if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false; return true; } if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; for (i = length; i-- !== 0;) { var key = keys[i]; if (!equal(a[key], b[key])) return false; } return true; } // true if both NaN, false otherwise return a!==a && b!==b; }; /***/ }), /***/ 7826: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ j: () => (/* binding */ privateApis) /* harmony export */ }); /* harmony import */ var _hooks_use_entity_records__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7078); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5101); /* harmony import */ var _lock_unlock__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6378); const privateApis = {}; (0,_lock_unlock__WEBPACK_IMPORTED_MODULE_0__/* .lock */ .s)(privateApis, { useEntityRecordsWithPermissions: _hooks_use_entity_records__WEBPACK_IMPORTED_MODULE_1__/* .useEntityRecordsWithPermissions */ .pU, RECEIVE_INTERMEDIATE_RESULTS: _utils__WEBPACK_IMPORTED_MODULE_2__/* .RECEIVE_INTERMEDIATE_RESULTS */ .Z }); /***/ }), /***/ 8368: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { __experimentalGetCurrentGlobalStylesId: () => (/* binding */ __experimentalGetCurrentGlobalStylesId), __experimentalGetCurrentThemeBaseGlobalStyles: () => (/* binding */ __experimentalGetCurrentThemeBaseGlobalStyles), __experimentalGetCurrentThemeGlobalStylesVariations: () => (/* binding */ __experimentalGetCurrentThemeGlobalStylesVariations), __experimentalGetDirtyEntityRecords: () => (/* binding */ __experimentalGetDirtyEntityRecords), __experimentalGetEntitiesBeingSaved: () => (/* binding */ __experimentalGetEntitiesBeingSaved), __experimentalGetEntityRecordNoResolver: () => (/* binding */ __experimentalGetEntityRecordNoResolver), canUser: () => (/* binding */ canUser), canUserEditEntityRecord: () => (/* binding */ canUserEditEntityRecord), getAuthors: () => (/* binding */ getAuthors), getAutosave: () => (/* binding */ getAutosave), getAutosaves: () => (/* binding */ getAutosaves), getBlockPatternCategories: () => (/* binding */ getBlockPatternCategories), getBlockPatterns: () => (/* binding */ getBlockPatterns), getCurrentTheme: () => (/* binding */ getCurrentTheme), getCurrentThemeGlobalStylesRevisions: () => (/* binding */ getCurrentThemeGlobalStylesRevisions), getCurrentUser: () => (/* binding */ getCurrentUser), getDefaultTemplateId: () => (/* binding */ getDefaultTemplateId), getEditedEntityRecord: () => (/* binding */ getEditedEntityRecord), getEmbedPreview: () => (/* binding */ getEmbedPreview), getEntitiesByKind: () => (/* binding */ getEntitiesByKind), getEntitiesConfig: () => (/* binding */ getEntitiesConfig), getEntity: () => (/* binding */ getEntity), getEntityConfig: () => (/* binding */ getEntityConfig), getEntityRecord: () => (/* binding */ getEntityRecord), getEntityRecordEdits: () => (/* binding */ getEntityRecordEdits), getEntityRecordNonTransientEdits: () => (/* binding */ getEntityRecordNonTransientEdits), getEntityRecords: () => (/* binding */ getEntityRecords), getEntityRecordsTotalItems: () => (/* binding */ getEntityRecordsTotalItems), getEntityRecordsTotalPages: () => (/* binding */ getEntityRecordsTotalPages), getLastEntityDeleteError: () => (/* binding */ getLastEntityDeleteError), getLastEntitySaveError: () => (/* binding */ getLastEntitySaveError), getRawEntityRecord: () => (/* binding */ getRawEntityRecord), getRedoEdit: () => (/* binding */ getRedoEdit), getReferenceByDistinctEdits: () => (/* binding */ getReferenceByDistinctEdits), getRevision: () => (/* binding */ getRevision), getRevisions: () => (/* binding */ getRevisions), getThemeSupports: () => (/* binding */ getThemeSupports), getUndoEdit: () => (/* binding */ getUndoEdit), getUserPatternCategories: () => (/* binding */ getUserPatternCategories), getUserQueryResults: () => (/* binding */ getUserQueryResults), hasEditsForEntityRecord: () => (/* binding */ hasEditsForEntityRecord), hasEntityRecord: () => (/* binding */ hasEntityRecord), hasEntityRecords: () => (/* binding */ hasEntityRecords), hasFetchedAutosaves: () => (/* binding */ hasFetchedAutosaves), hasRedo: () => (/* binding */ hasRedo), hasUndo: () => (/* binding */ hasUndo), isAutosavingEntityRecord: () => (/* binding */ isAutosavingEntityRecord), isDeletingEntityRecord: () => (/* binding */ isDeletingEntityRecord), isPreviewEmbedFallback: () => (/* binding */ isPreviewEmbedFallback), isRequestingEmbedPreview: () => (/* binding */ isRequestingEmbedPreview), isSavingEntityRecord: () => (/* binding */ isSavingEntityRecord) }); // EXTERNAL MODULE: external ["wp","data"] var external_wp_data_ = __webpack_require__(7143); // EXTERNAL MODULE: external ["wp","url"] var external_wp_url_ = __webpack_require__(3832); // EXTERNAL MODULE: external ["wp","deprecated"] var external_wp_deprecated_ = __webpack_require__(4040); var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/name.js var build_module_name = __webpack_require__(2278); // EXTERNAL MODULE: ./node_modules/equivalent-key-map/equivalent-key-map.js var equivalent_key_map = __webpack_require__(3249); var equivalent_key_map_default = /*#__PURE__*/__webpack_require__.n(equivalent_key_map); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/get-query-parts.js + 1 modules var get_query_parts = __webpack_require__(4027); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/utils/set-nested-value.js var set_nested_value = __webpack_require__(5003); ;// ./node_modules/@wordpress/core-data/build-module/queried-data/selectors.js const queriedItemsCacheByState = /* @__PURE__ */ new WeakMap(); function getQueriedItemsUncached(state, query) { const { stableKey, page, perPage, include, fields, context } = (0,get_query_parts/* default */.A)(query); let itemIds; if (state.queries?.[context]?.[stableKey]) { itemIds = state.queries[context][stableKey].itemIds; } if (!itemIds) { return null; } const startOffset = perPage === -1 ? 0 : (page - 1) * perPage; const endOffset = perPage === -1 ? itemIds.length : Math.min(startOffset + perPage, itemIds.length); const items = []; for (let i = startOffset; i < endOffset; i++) { const itemId = itemIds[i]; if (Array.isArray(include) && !include.includes(itemId)) { continue; } if (itemId === void 0) { continue; } if (!state.items[context]?.hasOwnProperty(itemId)) { return null; } const item = state.items[context][itemId]; let filteredItem; if (Array.isArray(fields)) { filteredItem = {}; for (let f = 0; f < fields.length; f++) { const field = fields[f].split("."); let value = item; field.forEach((fieldName) => { value = value?.[fieldName]; }); (0,set_nested_value/* default */.A)(filteredItem, field, value); } } else { if (!state.itemIsComplete[context]?.[itemId]) { return null; } filteredItem = item; } items.push(filteredItem); } return items; } const getQueriedItems = (0,external_wp_data_.createSelector)((state, query = {}) => { let queriedItemsCache = queriedItemsCacheByState.get(state); if (queriedItemsCache) { const queriedItems = queriedItemsCache.get(query); if (queriedItems !== void 0) { return queriedItems; } } else { queriedItemsCache = new (equivalent_key_map_default())(); queriedItemsCacheByState.set(state, queriedItemsCache); } const items = getQueriedItemsUncached(state, query); queriedItemsCache.set(query, items); return items; }); function getQueriedTotalItems(state, query = {}) { const { stableKey, context } = (0,get_query_parts/* default */.A)(query); return state.queries?.[context]?.[stableKey]?.meta?.totalItems ?? null; } function getQueriedTotalPages(state, query = {}) { const { stableKey, context } = (0,get_query_parts/* default */.A)(query); return state.queries?.[context]?.[stableKey]?.meta?.totalPages ?? null; } // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/entities.js + 2 modules var entities = __webpack_require__(5914); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/utils/get-normalized-comma-separable.js var get_normalized_comma_separable = __webpack_require__(533); ;// ./node_modules/@wordpress/core-data/build-module/utils/is-numeric-id.js function isNumericID(id) { return /^\s*\d+\s*$/.test(id); } ;// ./node_modules/@wordpress/core-data/build-module/utils/is-raw-attribute.js function isRawAttribute(entity, attribute) { return (entity.rawAttributes || []).includes(attribute); } // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/utils/user-permissions.js var user_permissions = __webpack_require__(2577); // EXTERNAL MODULE: ./node_modules/@wordpress/core-data/build-module/utils/log-entity-deprecation.js var log_entity_deprecation = __webpack_require__(9410); ;// ./node_modules/@wordpress/core-data/build-module/selectors.js const EMPTY_OBJECT = {}; const isRequestingEmbedPreview = (0,external_wp_data_.createRegistrySelector)( (select) => (state, url) => { return select(build_module_name/* STORE_NAME */.E).isResolving("getEmbedPreview", [ url ]); } ); function getAuthors(state, query) { external_wp_deprecated_default()("select( 'core' ).getAuthors()", { since: "5.9", alternative: "select( 'core' ).getUsers({ who: 'authors' })" }); const path = (0,external_wp_url_.addQueryArgs)( "/wp/v2/users/?who=authors&per_page=100", query ); return getUserQueryResults(state, path); } function getCurrentUser(state) { return state.currentUser; } const getUserQueryResults = (0,external_wp_data_.createSelector)( (state, queryID) => { const queryResults = state.users.queries[queryID] ?? []; return queryResults.map((id) => state.users.byId[id]); }, (state, queryID) => [ state.users.queries[queryID], state.users.byId ] ); function getEntitiesByKind(state, kind) { external_wp_deprecated_default()("wp.data.select( 'core' ).getEntitiesByKind()", { since: "6.0", alternative: "wp.data.select( 'core' ).getEntitiesConfig()" }); return getEntitiesConfig(state, kind); } const getEntitiesConfig = (0,external_wp_data_.createSelector)( (state, kind) => state.entities.config.filter((entity) => entity.kind === kind), /* eslint-disable @typescript-eslint/no-unused-vars */ (state, kind) => state.entities.config /* eslint-enable @typescript-eslint/no-unused-vars */ ); function getEntity(state, kind, name) { external_wp_deprecated_default()("wp.data.select( 'core' ).getEntity()", { since: "6.0", alternative: "wp.data.select( 'core' ).getEntityConfig()" }); return getEntityConfig(state, kind, name); } function getEntityConfig(state, kind, name) { (0,log_entity_deprecation/* default */.A)(kind, name, "getEntityConfig"); return state.entities.config?.find( (config) => config.kind === kind && config.name === name ); } const getEntityRecord = (0,external_wp_data_.createSelector)( ((state, kind, name, key, query) => { (0,log_entity_deprecation/* default */.A)(kind, name, "getEntityRecord"); const queriedState = state.entities.records?.[kind]?.[name]?.queriedData; if (!queriedState) { return void 0; } const context = query?.context ?? "default"; if (!query || !query._fields) { if (!queriedState.itemIsComplete[context]?.[key]) { return void 0; } return queriedState.items[context][key]; } const item = queriedState.items[context]?.[key]; if (!item) { return item; } const filteredItem = {}; const fields = (0,get_normalized_comma_separable/* default */.A)(query._fields) ?? []; for (let f = 0; f < fields.length; f++) { const field = fields[f].split("."); let value = item; field.forEach((fieldName) => { value = value?.[fieldName]; }); (0,set_nested_value/* default */.A)(filteredItem, field, value); } return filteredItem; }), (state, kind, name, recordId, query) => { const context = query?.context ?? "default"; const queriedState = state.entities.records?.[kind]?.[name]?.queriedData; return [ queriedState?.items[context]?.[recordId], queriedState?.itemIsComplete[context]?.[recordId] ]; } ); getEntityRecord.__unstableNormalizeArgs = (args) => { const newArgs = [...args]; const recordKey = newArgs?.[2]; newArgs[2] = isNumericID(recordKey) ? Number(recordKey) : recordKey; return newArgs; }; function hasEntityRecord(state, kind, name, key, query) { const queriedState = state.entities.records?.[kind]?.[name]?.queriedData; if (!queriedState) { return false; } const context = query?.context ?? "default"; if (!query || !query._fields) { return !!queriedState.itemIsComplete[context]?.[key]; } const item = queriedState.items[context]?.[key]; if (!item) { return false; } const fields = (0,get_normalized_comma_separable/* default */.A)(query._fields) ?? []; for (let i = 0; i < fields.length; i++) { const path = fields[i].split("."); let value = item; for (let p = 0; p < path.length; p++) { const part = path[p]; if (!value || !Object.hasOwn(value, part)) { return false; } value = value[part]; } } return true; } function __experimentalGetEntityRecordNoResolver(state, kind, name, key) { return getEntityRecord(state, kind, name, key); } const getRawEntityRecord = (0,external_wp_data_.createSelector)( (state, kind, name, key) => { (0,log_entity_deprecation/* default */.A)(kind, name, "getRawEntityRecord"); const record = getEntityRecord( state, kind, name, key ); return record && Object.keys(record).reduce((accumulator, _key) => { if (isRawAttribute(getEntityConfig(state, kind, name), _key)) { accumulator[_key] = record[_key]?.raw !== void 0 ? record[_key]?.raw : record[_key]; } else { accumulator[_key] = record[_key]; } return accumulator; }, {}); }, (state, kind, name, recordId, query) => { const context = query?.context ?? "default"; return [ state.entities.config, state.entities.records?.[kind]?.[name]?.queriedData?.items[context]?.[recordId], state.entities.records?.[kind]?.[name]?.queriedData?.itemIsComplete[context]?.[recordId] ]; } ); function hasEntityRecords(state, kind, name, query) { (0,log_entity_deprecation/* default */.A)(kind, name, "hasEntityRecords"); return Array.isArray(getEntityRecords(state, kind, name, query)); } const getEntityRecords = ((state, kind, name, query) => { (0,log_entity_deprecation/* default */.A)(kind, name, "getEntityRecords"); const queriedState = state.entities.records?.[kind]?.[name]?.queriedData; if (!queriedState) { return null; } return getQueriedItems(queriedState, query); }); const getEntityRecordsTotalItems = (state, kind, name, query) => { (0,log_entity_deprecation/* default */.A)(kind, name, "getEntityRecordsTotalItems"); const queriedState = state.entities.records?.[kind]?.[name]?.queriedData; if (!queriedState) { return null; } return getQueriedTotalItems(queriedState, query); }; const getEntityRecordsTotalPages = (state, kind, name, query) => { (0,log_entity_deprecation/* default */.A)(kind, name, "getEntityRecordsTotalPages"); const queriedState = state.entities.records?.[kind]?.[name]?.queriedData; if (!queriedState) { return null; } if (query?.per_page === -1) { return 1; } const totalItems = getQueriedTotalItems(queriedState, query); if (!totalItems) { return totalItems; } if (!query?.per_page) { return getQueriedTotalPages(queriedState, query); } return Math.ceil(totalItems / query.per_page); }; const __experimentalGetDirtyEntityRecords = (0,external_wp_data_.createSelector)( (state) => { const { entities: { records } } = state; const dirtyRecords = []; Object.keys(records).forEach((kind) => { Object.keys(records[kind]).forEach((name) => { const primaryKeys = Object.keys(records[kind][name].edits).filter( (primaryKey) => ( // The entity record must exist (not be deleted), // and it must have edits. getEntityRecord(state, kind, name, primaryKey) && hasEditsForEntityRecord(state, kind, name, primaryKey) ) ); if (primaryKeys.length) { const entityConfig = getEntityConfig(state, kind, name); primaryKeys.forEach((primaryKey) => { const entityRecord = getEditedEntityRecord( state, kind, name, primaryKey ); dirtyRecords.push({ // We avoid using primaryKey because it's transformed into a string // when it's used as an object key. key: entityRecord ? entityRecord[entityConfig.key || entities/* DEFAULT_ENTITY_KEY */.C_] : void 0, title: entityConfig?.getTitle?.(entityRecord) || "", name, kind }); }); } }); }); return dirtyRecords; }, (state) => [state.entities.records] ); const __experimentalGetEntitiesBeingSaved = (0,external_wp_data_.createSelector)( (state) => { const { entities: { records } } = state; const recordsBeingSaved = []; Object.keys(records).forEach((kind) => { Object.keys(records[kind]).forEach((name) => { const primaryKeys = Object.keys(records[kind][name].saving).filter( (primaryKey) => isSavingEntityRecord(state, kind, name, primaryKey) ); if (primaryKeys.length) { const entityConfig = getEntityConfig(state, kind, name); primaryKeys.forEach((primaryKey) => { const entityRecord = getEditedEntityRecord( state, kind, name, primaryKey ); recordsBeingSaved.push({ // We avoid using primaryKey because it's transformed into a string // when it's used as an object key. key: entityRecord ? entityRecord[entityConfig.key || entities/* DEFAULT_ENTITY_KEY */.C_] : void 0, title: entityConfig?.getTitle?.(entityRecord) || "", name, kind }); }); } }); }); return recordsBeingSaved; }, (state) => [state.entities.records] ); function getEntityRecordEdits(state, kind, name, recordId) { (0,log_entity_deprecation/* default */.A)(kind, name, "getEntityRecordEdits"); return state.entities.records?.[kind]?.[name]?.edits?.[recordId]; } const getEntityRecordNonTransientEdits = (0,external_wp_data_.createSelector)( (state, kind, name, recordId) => { (0,log_entity_deprecation/* default */.A)(kind, name, "getEntityRecordNonTransientEdits"); const { transientEdits } = getEntityConfig(state, kind, name) || {}; const edits = getEntityRecordEdits(state, kind, name, recordId) || {}; if (!transientEdits) { return edits; } return Object.keys(edits).reduce((acc, key) => { if (!transientEdits[key]) { acc[key] = edits[key]; } return acc; }, {}); }, (state, kind, name, recordId) => [ state.entities.config, state.entities.records?.[kind]?.[name]?.edits?.[recordId] ] ); function hasEditsForEntityRecord(state, kind, name, recordId) { (0,log_entity_deprecation/* default */.A)(kind, name, "hasEditsForEntityRecord"); return isSavingEntityRecord(state, kind, name, recordId) || Object.keys( getEntityRecordNonTransientEdits(state, kind, name, recordId) ).length > 0; } const getEditedEntityRecord = (0,external_wp_data_.createSelector)( (state, kind, name, recordId) => { (0,log_entity_deprecation/* default */.A)(kind, name, "getEditedEntityRecord"); const raw = getRawEntityRecord(state, kind, name, recordId); const edited = getEntityRecordEdits(state, kind, name, recordId); if (!raw && !edited) { return false; } return { ...raw, ...edited }; }, (state, kind, name, recordId, query) => { const context = query?.context ?? "default"; return [ state.entities.config, state.entities.records?.[kind]?.[name]?.queriedData.items[context]?.[recordId], state.entities.records?.[kind]?.[name]?.queriedData.itemIsComplete[context]?.[recordId], state.entities.records?.[kind]?.[name]?.edits?.[recordId] ]; } ); function isAutosavingEntityRecord(state, kind, name, recordId) { (0,log_entity_deprecation/* default */.A)(kind, name, "isAutosavingEntityRecord"); const { pending, isAutosave } = state.entities.records?.[kind]?.[name]?.saving?.[recordId] ?? {}; return Boolean(pending && isAutosave); } function isSavingEntityRecord(state, kind, name, recordId) { (0,log_entity_deprecation/* default */.A)(kind, name, "isSavingEntityRecord"); return state.entities.records?.[kind]?.[name]?.saving?.[recordId]?.pending ?? false; } function isDeletingEntityRecord(state, kind, name, recordId) { (0,log_entity_deprecation/* default */.A)(kind, name, "isDeletingEntityRecord"); return state.entities.records?.[kind]?.[name]?.deleting?.[recordId]?.pending ?? false; } function getLastEntitySaveError(state, kind, name, recordId) { (0,log_entity_deprecation/* default */.A)(kind, name, "getLastEntitySaveError"); return state.entities.records?.[kind]?.[name]?.saving?.[recordId]?.error; } function getLastEntityDeleteError(state, kind, name, recordId) { (0,log_entity_deprecation/* default */.A)(kind, name, "getLastEntityDeleteError"); return state.entities.records?.[kind]?.[name]?.deleting?.[recordId]?.error; } function getUndoEdit(state) { external_wp_deprecated_default()("select( 'core' ).getUndoEdit()", { since: "6.3" }); return void 0; } function getRedoEdit(state) { external_wp_deprecated_default()("select( 'core' ).getRedoEdit()", { since: "6.3" }); return void 0; } function hasUndo(state) { return state.undoManager.hasUndo(); } function hasRedo(state) { return state.undoManager.hasRedo(); } function getCurrentTheme(state) { if (!state.currentTheme) { return null; } return getEntityRecord(state, "root", "theme", state.currentTheme); } function __experimentalGetCurrentGlobalStylesId(state) { return state.currentGlobalStylesId; } function getThemeSupports(state) { return getCurrentTheme(state)?.theme_supports ?? EMPTY_OBJECT; } function getEmbedPreview(state, url) { return state.embedPreviews[url]; } function isPreviewEmbedFallback(state, url) { const preview = state.embedPreviews[url]; const oEmbedLinkCheck = '<a href="' + url + '">' + url + "</a>"; if (!preview) { return false; } return preview.html === oEmbedLinkCheck; } function canUser(state, action, resource, id) { const isEntity = typeof resource === "object"; if (isEntity && (!resource.kind || !resource.name)) { return false; } if (isEntity) { (0,log_entity_deprecation/* default */.A)(resource.kind, resource.name, "canUser"); } const key = (0,user_permissions/* getUserPermissionCacheKey */.kC)(action, resource, id); return state.userPermissions[key]; } function canUserEditEntityRecord(state, kind, name, recordId) { external_wp_deprecated_default()(`wp.data.select( 'core' ).canUserEditEntityRecord()`, { since: "6.7", alternative: `wp.data.select( 'core' ).canUser( 'update', { kind, name, id } )` }); return canUser(state, "update", { kind, name, id: recordId }); } function getAutosaves(state, postType, postId) { return state.autosaves[postId]; } function getAutosave(state, postType, postId, authorId) { if (authorId === void 0) { return; } const autosaves = state.autosaves[postId]; return autosaves?.find( (autosave) => autosave.author === authorId ); } const hasFetchedAutosaves = (0,external_wp_data_.createRegistrySelector)( (select) => (state, postType, postId) => { return select(build_module_name/* STORE_NAME */.E).hasFinishedResolution("getAutosaves", [ postType, postId ]); } ); function getReferenceByDistinctEdits(state) { return state.editsReference; } function __experimentalGetCurrentThemeBaseGlobalStyles(state) { const currentTheme = getCurrentTheme(state); if (!currentTheme) { return null; } return state.themeBaseGlobalStyles[currentTheme.stylesheet]; } function __experimentalGetCurrentThemeGlobalStylesVariations(state) { const currentTheme = getCurrentTheme(state); if (!currentTheme) { return null; } return state.themeGlobalStyleVariations[currentTheme.stylesheet]; } function getBlockPatterns(state) { return state.blockPatterns; } function getBlockPatternCategories(state) { return state.blockPatternCategories; } function getUserPatternCategories(state) { return state.userPatternCategories; } function getCurrentThemeGlobalStylesRevisions(state) { external_wp_deprecated_default()("select( 'core' ).getCurrentThemeGlobalStylesRevisions()", { since: "6.5.0", alternative: "select( 'core' ).getRevisions( 'root', 'globalStyles', ${ recordKey } )" }); const currentGlobalStylesId = __experimentalGetCurrentGlobalStylesId(state); if (!currentGlobalStylesId) { return null; } return state.themeGlobalStyleRevisions[currentGlobalStylesId]; } function getDefaultTemplateId(state, query) { return state.defaultTemplates[JSON.stringify(query)]; } const getRevisions = (state, kind, name, recordKey, query) => { (0,log_entity_deprecation/* default */.A)(kind, name, "getRevisions"); const queriedStateRevisions = state.entities.records?.[kind]?.[name]?.revisions?.[recordKey]; if (!queriedStateRevisions) { return null; } return getQueriedItems(queriedStateRevisions, query); }; const getRevision = (0,external_wp_data_.createSelector)( (state, kind, name, recordKey, revisionKey, query) => { (0,log_entity_deprecation/* default */.A)(kind, name, "getRevision"); const queriedState = state.entities.records?.[kind]?.[name]?.revisions?.[recordKey]; if (!queriedState) { return void 0; } const context = query?.context ?? "default"; if (!query || !query._fields) { if (!queriedState.itemIsComplete[context]?.[revisionKey]) { return void 0; } return queriedState.items[context][revisionKey]; } const item = queriedState.items[context]?.[revisionKey]; if (!item) { return item; } const filteredItem = {}; const fields = (0,get_normalized_comma_separable/* default */.A)(query._fields) ?? []; for (let f = 0; f < fields.length; f++) { const field = fields[f].split("."); let value = item; field.forEach((fieldName) => { value = value?.[fieldName]; }); (0,set_nested_value/* default */.A)(filteredItem, field, value); } return filteredItem; }, (state, kind, name, recordKey, revisionKey, query) => { const context = query?.context ?? "default"; const queriedState = state.entities.records?.[kind]?.[name]?.revisions?.[recordKey]; return [ queriedState?.items?.[context]?.[revisionKey], queriedState?.itemIsComplete?.[context]?.[revisionKey] ]; } ); /***/ }), /***/ 8537: /***/ ((module) => { "use strict"; module.exports = window["wp"]["htmlEntities"]; /***/ }), /***/ 8582: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ dynamicSelectors), /* harmony export */ B: () => (/* binding */ dynamicActions) /* harmony export */ }); let dynamicActions; let dynamicSelectors; /***/ }), /***/ 8741: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ getBlockPatternsForPostType: () => (/* binding */ getBlockPatternsForPostType), /* harmony export */ getEntityRecordPermissions: () => (/* binding */ getEntityRecordPermissions), /* harmony export */ getEntityRecordsPermissions: () => (/* binding */ getEntityRecordsPermissions), /* harmony export */ getHomePage: () => (/* binding */ getHomePage), /* harmony export */ getNavigationFallbackId: () => (/* binding */ getNavigationFallbackId), /* harmony export */ getPostsPageId: () => (/* binding */ getPostsPageId), /* harmony export */ getRegisteredPostMeta: () => (/* binding */ getRegisteredPostMeta), /* harmony export */ getTemplateId: () => (/* binding */ getTemplateId), /* harmony export */ getUndoManager: () => (/* binding */ getUndoManager) /* harmony export */ }); /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7143); /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _selectors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8368); /* harmony import */ var _name__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2278); /* harmony import */ var _lock_unlock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6378); /* harmony import */ var _utils_log_entity_deprecation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9410); function getUndoManager(state) { return state.undoManager; } function getNavigationFallbackId(state) { return state.navigationFallbackId; } const getBlockPatternsForPostType = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.createRegistrySelector)( (select) => (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.createSelector)( (state, postType) => select(_name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E).getBlockPatterns().filter( ({ postTypes }) => !postTypes || Array.isArray(postTypes) && postTypes.includes(postType) ), () => [select(_name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E).getBlockPatterns()] ) ); const getEntityRecordsPermissions = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.createRegistrySelector)( (select) => (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.createSelector)( (state, kind, name, ids) => { const normalizedIds = Array.isArray(ids) ? ids : [ids]; return normalizedIds.map((id) => ({ delete: select(_name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E).canUser("delete", { kind, name, id }), update: select(_name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E).canUser("update", { kind, name, id }) })); }, (state) => [state.userPermissions] ) ); function getEntityRecordPermissions(state, kind, name, id) { (0,_utils_log_entity_deprecation__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)(kind, name, "getEntityRecordPermissions"); return getEntityRecordsPermissions(state, kind, name, id)[0]; } function getRegisteredPostMeta(state, postType) { return state.registeredPostMeta?.[postType] ?? {}; } function normalizePageId(value) { if (!value || !["number", "string"].includes(typeof value)) { return null; } if (Number(value) === 0) { return null; } return value.toString(); } const getHomePage = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.createRegistrySelector)( (select) => (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.createSelector)( () => { const siteData = select(_name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E).getEntityRecord( "root", "__unstableBase" ); if (!siteData) { return null; } const homepageId = siteData?.show_on_front === "page" ? normalizePageId(siteData.page_on_front) : null; if (homepageId) { return { postType: "page", postId: homepageId }; } const frontPageTemplateId = select( _name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E ).getDefaultTemplateId({ slug: "front-page" }); if (!frontPageTemplateId) { return null; } return { postType: "wp_template", postId: frontPageTemplateId }; }, (state) => [ (0,_selectors__WEBPACK_IMPORTED_MODULE_3__.getEntityRecord)(state, "root", "__unstableBase"), (0,_selectors__WEBPACK_IMPORTED_MODULE_3__.getDefaultTemplateId)(state, { slug: "front-page" }) ] ) ); const getPostsPageId = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.createRegistrySelector)((select) => () => { const siteData = select(_name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E).getEntityRecord( "root", "__unstableBase" ); return siteData?.show_on_front === "page" ? normalizePageId(siteData.page_for_posts) : null; }); const getTemplateId = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.createRegistrySelector)( (select) => (state, postType, postId) => { const homepage = (0,_lock_unlock__WEBPACK_IMPORTED_MODULE_4__/* .unlock */ .T)(select(_name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E)).getHomePage(); if (!homepage) { return; } if (postType === "page" && postType === homepage?.postType && postId.toString() === homepage?.postId) { const templates = select(_name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E).getEntityRecords( "postType", "wp_template", { per_page: -1 } ); if (!templates) { return; } const id = templates.find(({ slug }) => slug === "front-page")?.id; if (id) { return id; } } const editedEntity = select(_name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E).getEditedEntityRecord( "postType", postType, postId ); if (!editedEntity) { return; } const postsPageId = (0,_lock_unlock__WEBPACK_IMPORTED_MODULE_4__/* .unlock */ .T)(select(_name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E)).getPostsPageId(); if (postType === "page" && postsPageId === postId.toString()) { return select(_name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E).getDefaultTemplateId({ slug: "home" }); } const currentTemplateSlug = editedEntity.template; if (currentTemplateSlug) { const currentTemplate = select(_name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E).getEntityRecords("postType", "wp_template", { per_page: -1 })?.find(({ slug }) => slug === currentTemplateSlug); if (currentTemplate) { return currentTemplate.id; } } let slugToCheck; if (editedEntity.slug) { slugToCheck = postType === "page" ? `${postType}-${editedEntity.slug}` : `single-${postType}-${editedEntity.slug}`; } else { slugToCheck = postType === "page" ? "page" : `single-${postType}`; } return select(_name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E).getDefaultTemplateId({ slug: slugToCheck }); } ); /***/ }), /***/ 8843: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ D: () => (/* binding */ EntityContext) /* harmony export */ }); /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6087); /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); const EntityContext = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createContext)({}); EntityContext.displayName = "EntityContext"; /***/ }), /***/ 9410: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ logEntityDeprecation) /* harmony export */ }); /* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4040); /* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _entities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5914); let loggedAlready = false; function logEntityDeprecation(kind, name, functionName, { alternativeFunctionName, isShorthandSelector = false } = {}) { const deprecation = _entities__WEBPACK_IMPORTED_MODULE_1__/* .deprecatedEntities */ .TK[kind]?.[name]; if (!deprecation) { return; } if (!loggedAlready) { const { alternative } = deprecation; const message = isShorthandSelector ? `'${functionName}'` : `The '${kind}', '${name}' entity (used via '${functionName}')`; let alternativeMessage = `the '${alternative.kind}', '${alternative.name}' entity`; if (alternativeFunctionName) { alternativeMessage += ` via the '${alternativeFunctionName}' function`; } _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_0___default()(message, { ...deprecation, alternative: alternativeMessage }); } loggedAlready = true; setTimeout(() => { loggedAlready = false; }, 0); } /***/ }), /***/ 9424: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ editMediaEntity: () => (/* binding */ editMediaEntity), /* harmony export */ receiveRegisteredPostMeta: () => (/* binding */ receiveRegisteredPostMeta) /* harmony export */ }); /* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1455); /* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _name__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2278); function receiveRegisteredPostMeta(postType, registeredPostMeta) { return { type: "RECEIVE_REGISTERED_POST_META", postType, registeredPostMeta }; } const editMediaEntity = (recordId, edits = {}, { __unstableFetch = (_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default()), throwOnError = false } = {}) => async ({ dispatch, resolveSelect }) => { if (!recordId) { return; } const kind = "postType"; const name = "attachment"; const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find( (config) => config.kind === kind && config.name === name ); if (!entityConfig) { return; } const lock = await dispatch.__unstableAcquireStoreLock( _name__WEBPACK_IMPORTED_MODULE_1__/* .STORE_NAME */ .E, ["entities", "records", kind, name, recordId], { exclusive: true } ); let updatedRecord; let error; let hasError = false; try { dispatch({ type: "SAVE_ENTITY_RECORD_START", kind, name, recordId }); try { const path = `${entityConfig.baseURL}/${recordId}/edit`; const newRecord = await __unstableFetch({ path, method: "POST", data: { ...edits } }); if (newRecord) { dispatch.receiveEntityRecords( kind, name, [newRecord], void 0, true, void 0, void 0 ); updatedRecord = newRecord; } } catch (e) { error = e; hasError = true; } dispatch({ type: "SAVE_ENTITY_RECORD_FINISH", kind, name, recordId, error }); if (hasError && throwOnError) { throw error; } return updatedRecord; } finally { dispatch.__unstableReleaseStoreLock(lock); } }; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ /******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module is referenced by other modules so it can't be inlined /******/ var __webpack_exports__ = __webpack_require__(4565); /******/ (window.wp = window.wp || {}).coreData = __webpack_exports__; /******/ /******/ })() ; token-list.min.js 0000644 00000002423 15151622574 0007766 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={d:(r,t)=>{for(var s in t)e.o(t,s)&&!e.o(r,s)&&Object.defineProperty(r,s,{enumerable:!0,get:t[s]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r)},r={};e.d(r,{default:()=>t});class t{_currentValue;_valueAsArray;constructor(e=""){this._currentValue="",this._valueAsArray=[],this.value=e}entries(...e){return this._valueAsArray.entries(...e)}forEach(...e){return this._valueAsArray.forEach(...e)}keys(...e){return this._valueAsArray.keys(...e)}values(...e){return this._valueAsArray.values(...e)}get value(){return this._currentValue}set value(e){e=String(e),this._valueAsArray=[...new Set(e.split(/\s+/g).filter(Boolean))],this._currentValue=this._valueAsArray.join(" ")}get length(){return this._valueAsArray.length}toString(){return this.value}*[Symbol.iterator](){return yield*this._valueAsArray}item(e){return this._valueAsArray[e]}contains(e){return-1!==this._valueAsArray.indexOf(e)}add(...e){this.value+=" "+e.join(" ")}remove(...e){this.value=this._valueAsArray.filter((r=>!e.includes(r))).join(" ")}toggle(e,r){return void 0===r&&(r=!this.contains(e)),r?this.add(e):this.remove(e),r}replace(e,r){return!!this.contains(e)&&(this.remove(e),this.add(r),!0)}supports(e){return!0}}(window.wp=window.wp||{}).tokenList=r.default})(); keyboard-shortcuts.js 0000644 00000022350 15151622574 0010750 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { ShortcutProvider: () => (/* reexport */ ShortcutProvider), __unstableUseShortcutEventMatch: () => (/* reexport */ useShortcutEventMatch), store: () => (/* reexport */ store), useShortcut: () => (/* reexport */ useShortcut) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { registerShortcut: () => (registerShortcut), unregisterShortcut: () => (unregisterShortcut) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { getAllShortcutKeyCombinations: () => (getAllShortcutKeyCombinations), getAllShortcutRawKeyCombinations: () => (getAllShortcutRawKeyCombinations), getCategoryShortcuts: () => (getCategoryShortcuts), getShortcutAliases: () => (getShortcutAliases), getShortcutDescription: () => (getShortcutDescription), getShortcutKeyCombination: () => (getShortcutKeyCombination), getShortcutRepresentation: () => (getShortcutRepresentation) }); ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/reducer.js function reducer(state = {}, action) { switch (action.type) { case "REGISTER_SHORTCUT": return { ...state, [action.name]: { category: action.category, keyCombination: action.keyCombination, aliases: action.aliases, description: action.description } }; case "UNREGISTER_SHORTCUT": const { [action.name]: actionName, ...remainingState } = state; return remainingState; } return state; } var reducer_default = reducer; ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js function registerShortcut({ name, category, description, keyCombination, aliases }) { return { type: "REGISTER_SHORTCUT", name, category, keyCombination, aliases, description }; } function unregisterShortcut(name) { return { type: "UNREGISTER_SHORTCUT", name }; } ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js const EMPTY_ARRAY = []; const FORMATTING_METHODS = { display: external_wp_keycodes_namespaceObject.displayShortcut, raw: external_wp_keycodes_namespaceObject.rawShortcut, ariaLabel: external_wp_keycodes_namespaceObject.shortcutAriaLabel }; function getKeyCombinationRepresentation(shortcut, representation) { if (!shortcut) { return null; } return shortcut.modifier ? FORMATTING_METHODS[representation][shortcut.modifier]( shortcut.character ) : shortcut.character; } function getShortcutKeyCombination(state, name) { return state[name] ? state[name].keyCombination : null; } function getShortcutRepresentation(state, name, representation = "display") { const shortcut = getShortcutKeyCombination(state, name); return getKeyCombinationRepresentation(shortcut, representation); } function getShortcutDescription(state, name) { return state[name] ? state[name].description : null; } function getShortcutAliases(state, name) { return state[name] && state[name].aliases ? state[name].aliases : EMPTY_ARRAY; } const getAllShortcutKeyCombinations = (0,external_wp_data_namespaceObject.createSelector)( (state, name) => { return [ getShortcutKeyCombination(state, name), ...getShortcutAliases(state, name) ].filter(Boolean); }, (state, name) => [state[name]] ); const getAllShortcutRawKeyCombinations = (0,external_wp_data_namespaceObject.createSelector)( (state, name) => { return getAllShortcutKeyCombinations(state, name).map( (combination) => getKeyCombinationRepresentation(combination, "raw") ); }, (state, name) => [state[name]] ); const getCategoryShortcuts = (0,external_wp_data_namespaceObject.createSelector)( (state, categoryName) => { return Object.entries(state).filter(([, shortcut]) => shortcut.category === categoryName).map(([name]) => name); }, (state) => [state] ); ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/index.js const STORE_NAME = "core/keyboard-shortcuts"; const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { reducer: reducer_default, actions: actions_namespaceObject, selectors: selectors_namespaceObject }); (0,external_wp_data_namespaceObject.register)(store); ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut-event-match.js function useShortcutEventMatch() { const { getAllShortcutKeyCombinations } = (0,external_wp_data_namespaceObject.useSelect)( store ); function isMatch(name, event) { return getAllShortcutKeyCombinations(name).some( ({ modifier, character }) => { return external_wp_keycodes_namespaceObject.isKeyboardEvent[modifier](event, character); } ); } return isMatch; } ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/context.js const globalShortcuts = /* @__PURE__ */ new Set(); const globalListener = (event) => { for (const keyboardShortcut of globalShortcuts) { keyboardShortcut(event); } }; const context = (0,external_wp_element_namespaceObject.createContext)({ add: (shortcut) => { if (globalShortcuts.size === 0) { document.addEventListener("keydown", globalListener); } globalShortcuts.add(shortcut); }, delete: (shortcut) => { globalShortcuts.delete(shortcut); if (globalShortcuts.size === 0) { document.removeEventListener("keydown", globalListener); } } }); context.displayName = "KeyboardShortcutsContext"; ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut.js function useShortcut(name, callback, { isDisabled = false } = {}) { const shortcuts = (0,external_wp_element_namespaceObject.useContext)(context); const isMatch = useShortcutEventMatch(); const callbackRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { callbackRef.current = callback; }, [callback]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isDisabled) { return; } function _callback(event) { if (isMatch(name, event)) { callbackRef.current(event); } } shortcuts.add(_callback); return () => { shortcuts.delete(_callback); }; }, [name, isDisabled, shortcuts]); } ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/components/shortcut-provider.js const { Provider } = context; function ShortcutProvider(props) { const [keyboardShortcuts] = (0,external_wp_element_namespaceObject.useState)(() => /* @__PURE__ */ new Set()); function onKeyDown(event) { if (props.onKeyDown) { props.onKeyDown(event); } for (const keyboardShortcut of keyboardShortcuts) { keyboardShortcut(event); } } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { value: keyboardShortcuts, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props, onKeyDown }) }); } ;// ./node_modules/@wordpress/keyboard-shortcuts/build-module/index.js (window.wp = window.wp || {}).keyboardShortcuts = __webpack_exports__; /******/ })() ; vendor/wp-polyfill-url.min.js 0000604 00000133743 15151622574 0012256 0 ustar 00 !function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[o]={exports:{}};t[o][0].call(u.exports,(function(e){return i(t[o][1][e]||e)}),u,u.exports,e,t,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){t.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},{}],2:[function(e,t,n){var r=e("../internals/is-object");t.exports=function(e){if(!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},{"../internals/is-object":37}],3:[function(e,t,n){var r=e("../internals/well-known-symbol"),i=e("../internals/object-create"),a=e("../internals/object-define-property"),o=r("unscopables"),s=Array.prototype;null==s[o]&&a.f(s,o,{configurable:!0,value:i(null)}),t.exports=function(e){s[o][e]=!0}},{"../internals/object-create":45,"../internals/object-define-property":47,"../internals/well-known-symbol":77}],4:[function(e,t,n){t.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},{}],5:[function(e,t,n){var r=e("../internals/is-object");t.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},{"../internals/is-object":37}],6:[function(e,t,n){"use strict";var r=e("../internals/function-bind-context"),i=e("../internals/to-object"),a=e("../internals/call-with-safe-iteration-closing"),o=e("../internals/is-array-iterator-method"),s=e("../internals/to-length"),l=e("../internals/create-property"),c=e("../internals/get-iterator-method");t.exports=function(e){var t,n,u,f,p,h,b=i(e),d="function"==typeof this?this:Array,y=arguments.length,g=y>1?arguments[1]:void 0,v=void 0!==g,m=c(b),w=0;if(v&&(g=r(g,y>2?arguments[2]:void 0,2)),null==m||d==Array&&o(m))for(n=new d(t=s(b.length));t>w;w++)h=v?g(b[w],w):b[w],l(n,w,h);else for(p=(f=m.call(b)).next,n=new d;!(u=p.call(f)).done;w++)h=v?a(f,g,[u.value,w],!0):u.value,l(n,w,h);return n.length=w,n}},{"../internals/call-with-safe-iteration-closing":8,"../internals/create-property":16,"../internals/function-bind-context":23,"../internals/get-iterator-method":25,"../internals/is-array-iterator-method":35,"../internals/to-length":71,"../internals/to-object":72}],7:[function(e,t,n){var r=e("../internals/to-indexed-object"),i=e("../internals/to-length"),a=e("../internals/to-absolute-index"),o=function(e){return function(t,n,o){var s,l=r(t),c=i(l.length),u=a(o,c);if(e&&n!=n){for(;c>u;)if((s=l[u++])!=s)return!0}else for(;c>u;u++)if((e||u in l)&&l[u]===n)return e||u||0;return!e&&-1}};t.exports={includes:o(!0),indexOf:o(!1)}},{"../internals/to-absolute-index":68,"../internals/to-indexed-object":69,"../internals/to-length":71}],8:[function(e,t,n){var r=e("../internals/an-object");t.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(t){var a=e.return;throw void 0!==a&&r(a.call(e)),t}}},{"../internals/an-object":5}],9:[function(e,t,n){var r={}.toString;t.exports=function(e){return r.call(e).slice(8,-1)}},{}],10:[function(e,t,n){var r=e("../internals/to-string-tag-support"),i=e("../internals/classof-raw"),a=e("../internals/well-known-symbol")("toStringTag"),o="Arguments"==i(function(){return arguments}());t.exports=r?i:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),a))?n:o?i(t):"Object"==(r=i(t))&&"function"==typeof t.callee?"Arguments":r}},{"../internals/classof-raw":9,"../internals/to-string-tag-support":74,"../internals/well-known-symbol":77}],11:[function(e,t,n){var r=e("../internals/has"),i=e("../internals/own-keys"),a=e("../internals/object-get-own-property-descriptor"),o=e("../internals/object-define-property");t.exports=function(e,t){for(var n=i(t),s=o.f,l=a.f,c=0;c<n.length;c++){var u=n[c];r(e,u)||s(e,u,l(t,u))}}},{"../internals/has":28,"../internals/object-define-property":47,"../internals/object-get-own-property-descriptor":48,"../internals/own-keys":56}],12:[function(e,t,n){var r=e("../internals/fails");t.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},{"../internals/fails":22}],13:[function(e,t,n){"use strict";var r=e("../internals/iterators-core").IteratorPrototype,i=e("../internals/object-create"),a=e("../internals/create-property-descriptor"),o=e("../internals/set-to-string-tag"),s=e("../internals/iterators"),l=function(){return this};t.exports=function(e,t,n){var c=t+" Iterator";return e.prototype=i(r,{next:a(1,n)}),o(e,c,!1,!0),s[c]=l,e}},{"../internals/create-property-descriptor":15,"../internals/iterators":40,"../internals/iterators-core":39,"../internals/object-create":45,"../internals/set-to-string-tag":62}],14:[function(e,t,n){var r=e("../internals/descriptors"),i=e("../internals/object-define-property"),a=e("../internals/create-property-descriptor");t.exports=r?function(e,t,n){return i.f(e,t,a(1,n))}:function(e,t,n){return e[t]=n,e}},{"../internals/create-property-descriptor":15,"../internals/descriptors":18,"../internals/object-define-property":47}],15:[function(e,t,n){t.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},{}],16:[function(e,t,n){"use strict";var r=e("../internals/to-primitive"),i=e("../internals/object-define-property"),a=e("../internals/create-property-descriptor");t.exports=function(e,t,n){var o=r(t);o in e?i.f(e,o,a(0,n)):e[o]=n}},{"../internals/create-property-descriptor":15,"../internals/object-define-property":47,"../internals/to-primitive":73}],17:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/create-iterator-constructor"),a=e("../internals/object-get-prototype-of"),o=e("../internals/object-set-prototype-of"),s=e("../internals/set-to-string-tag"),l=e("../internals/create-non-enumerable-property"),c=e("../internals/redefine"),u=e("../internals/well-known-symbol"),f=e("../internals/is-pure"),p=e("../internals/iterators"),h=e("../internals/iterators-core"),b=h.IteratorPrototype,d=h.BUGGY_SAFARI_ITERATORS,y=u("iterator"),g=function(){return this};t.exports=function(e,t,n,u,h,v,m){i(n,t,u);var w,j,x,k=function(e){if(e===h&&L)return L;if(!d&&e in O)return O[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},S=t+" Iterator",A=!1,O=e.prototype,R=O[y]||O["@@iterator"]||h&&O[h],L=!d&&R||k(h),U="Array"==t&&O.entries||R;if(U&&(w=a(U.call(new e)),b!==Object.prototype&&w.next&&(f||a(w)===b||(o?o(w,b):"function"!=typeof w[y]&&l(w,y,g)),s(w,S,!0,!0),f&&(p[S]=g))),"values"==h&&R&&"values"!==R.name&&(A=!0,L=function(){return R.call(this)}),f&&!m||O[y]===L||l(O,y,L),p[t]=L,h)if(j={values:k("values"),keys:v?L:k("keys"),entries:k("entries")},m)for(x in j)!d&&!A&&x in O||c(O,x,j[x]);else r({target:t,proto:!0,forced:d||A},j);return j}},{"../internals/create-iterator-constructor":13,"../internals/create-non-enumerable-property":14,"../internals/export":21,"../internals/is-pure":38,"../internals/iterators":40,"../internals/iterators-core":39,"../internals/object-get-prototype-of":51,"../internals/object-set-prototype-of":55,"../internals/redefine":59,"../internals/set-to-string-tag":62,"../internals/well-known-symbol":77}],18:[function(e,t,n){var r=e("../internals/fails");t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},{"../internals/fails":22}],19:[function(e,t,n){var r=e("../internals/global"),i=e("../internals/is-object"),a=r.document,o=i(a)&&i(a.createElement);t.exports=function(e){return o?a.createElement(e):{}}},{"../internals/global":27,"../internals/is-object":37}],20:[function(e,t,n){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},{}],21:[function(e,t,n){var r=e("../internals/global"),i=e("../internals/object-get-own-property-descriptor").f,a=e("../internals/create-non-enumerable-property"),o=e("../internals/redefine"),s=e("../internals/set-global"),l=e("../internals/copy-constructor-properties"),c=e("../internals/is-forced");t.exports=function(e,t){var n,u,f,p,h,b=e.target,d=e.global,y=e.stat;if(n=d?r:y?r[b]||s(b,{}):(r[b]||{}).prototype)for(u in t){if(p=t[u],f=e.noTargetGet?(h=i(n,u))&&h.value:n[u],!c(d?u:b+(y?".":"#")+u,e.forced)&&void 0!==f){if(typeof p==typeof f)continue;l(p,f)}(e.sham||f&&f.sham)&&a(p,"sham",!0),o(n,u,p,e)}}},{"../internals/copy-constructor-properties":11,"../internals/create-non-enumerable-property":14,"../internals/global":27,"../internals/is-forced":36,"../internals/object-get-own-property-descriptor":48,"../internals/redefine":59,"../internals/set-global":61}],22:[function(e,t,n){t.exports=function(e){try{return!!e()}catch(e){return!0}}},{}],23:[function(e,t,n){var r=e("../internals/a-function");t.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},{"../internals/a-function":1}],24:[function(e,t,n){var r=e("../internals/path"),i=e("../internals/global"),a=function(e){return"function"==typeof e?e:void 0};t.exports=function(e,t){return arguments.length<2?a(r[e])||a(i[e]):r[e]&&r[e][t]||i[e]&&i[e][t]}},{"../internals/global":27,"../internals/path":57}],25:[function(e,t,n){var r=e("../internals/classof"),i=e("../internals/iterators"),a=e("../internals/well-known-symbol")("iterator");t.exports=function(e){if(null!=e)return e[a]||e["@@iterator"]||i[r(e)]}},{"../internals/classof":10,"../internals/iterators":40,"../internals/well-known-symbol":77}],26:[function(e,t,n){var r=e("../internals/an-object"),i=e("../internals/get-iterator-method");t.exports=function(e){var t=i(e);if("function"!=typeof t)throw TypeError(String(e)+" is not iterable");return r(t.call(e))}},{"../internals/an-object":5,"../internals/get-iterator-method":25}],27:[function(e,t,n){(function(e){var n=function(e){return e&&e.Math==Math&&e};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||Function("return this")()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],28:[function(e,t,n){var r={}.hasOwnProperty;t.exports=function(e,t){return r.call(e,t)}},{}],29:[function(e,t,n){t.exports={}},{}],30:[function(e,t,n){var r=e("../internals/get-built-in");t.exports=r("document","documentElement")},{"../internals/get-built-in":24}],31:[function(e,t,n){var r=e("../internals/descriptors"),i=e("../internals/fails"),a=e("../internals/document-create-element");t.exports=!r&&!i((function(){return 7!=Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}))},{"../internals/descriptors":18,"../internals/document-create-element":19,"../internals/fails":22}],32:[function(e,t,n){var r=e("../internals/fails"),i=e("../internals/classof-raw"),a="".split;t.exports=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==i(e)?a.call(e,""):Object(e)}:Object},{"../internals/classof-raw":9,"../internals/fails":22}],33:[function(e,t,n){var r=e("../internals/shared-store"),i=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(e){return i.call(e)}),t.exports=r.inspectSource},{"../internals/shared-store":64}],34:[function(e,t,n){var r,i,a,o=e("../internals/native-weak-map"),s=e("../internals/global"),l=e("../internals/is-object"),c=e("../internals/create-non-enumerable-property"),u=e("../internals/has"),f=e("../internals/shared-key"),p=e("../internals/hidden-keys"),h=s.WeakMap;if(o){var b=new h,d=b.get,y=b.has,g=b.set;r=function(e,t){return g.call(b,e,t),t},i=function(e){return d.call(b,e)||{}},a=function(e){return y.call(b,e)}}else{var v=f("state");p[v]=!0,r=function(e,t){return c(e,v,t),t},i=function(e){return u(e,v)?e[v]:{}},a=function(e){return u(e,v)}}t.exports={set:r,get:i,has:a,enforce:function(e){return a(e)?i(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!l(t)||(n=i(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}}},{"../internals/create-non-enumerable-property":14,"../internals/global":27,"../internals/has":28,"../internals/hidden-keys":29,"../internals/is-object":37,"../internals/native-weak-map":43,"../internals/shared-key":63}],35:[function(e,t,n){var r=e("../internals/well-known-symbol"),i=e("../internals/iterators"),a=r("iterator"),o=Array.prototype;t.exports=function(e){return void 0!==e&&(i.Array===e||o[a]===e)}},{"../internals/iterators":40,"../internals/well-known-symbol":77}],36:[function(e,t,n){var r=e("../internals/fails"),i=/#|\.prototype\./,a=function(e,t){var n=s[o(e)];return n==c||n!=l&&("function"==typeof t?r(t):!!t)},o=a.normalize=function(e){return String(e).replace(i,".").toLowerCase()},s=a.data={},l=a.NATIVE="N",c=a.POLYFILL="P";t.exports=a},{"../internals/fails":22}],37:[function(e,t,n){t.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},{}],38:[function(e,t,n){t.exports=!1},{}],39:[function(e,t,n){"use strict";var r,i,a,o=e("../internals/object-get-prototype-of"),s=e("../internals/create-non-enumerable-property"),l=e("../internals/has"),c=e("../internals/well-known-symbol"),u=e("../internals/is-pure"),f=c("iterator"),p=!1;[].keys&&("next"in(a=[].keys())?(i=o(o(a)))!==Object.prototype&&(r=i):p=!0),null==r&&(r={}),u||l(r,f)||s(r,f,(function(){return this})),t.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},{"../internals/create-non-enumerable-property":14,"../internals/has":28,"../internals/is-pure":38,"../internals/object-get-prototype-of":51,"../internals/well-known-symbol":77}],40:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{dup:29}],41:[function(e,t,n){var r=e("../internals/fails");t.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},{"../internals/fails":22}],42:[function(e,t,n){var r=e("../internals/fails"),i=e("../internals/well-known-symbol"),a=e("../internals/is-pure"),o=i("iterator");t.exports=!r((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),a&&!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[o]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host}))},{"../internals/fails":22,"../internals/is-pure":38,"../internals/well-known-symbol":77}],43:[function(e,t,n){var r=e("../internals/global"),i=e("../internals/inspect-source"),a=r.WeakMap;t.exports="function"==typeof a&&/native code/.test(i(a))},{"../internals/global":27,"../internals/inspect-source":33}],44:[function(e,t,n){"use strict";var r=e("../internals/descriptors"),i=e("../internals/fails"),a=e("../internals/object-keys"),o=e("../internals/object-get-own-property-symbols"),s=e("../internals/object-property-is-enumerable"),l=e("../internals/to-object"),c=e("../internals/indexed-object"),u=Object.assign,f=Object.defineProperty;t.exports=!u||i((function(){if(r&&1!==u({b:1},u(f({},"a",{enumerable:!0,get:function(){f(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=u({},e)[n]||"abcdefghijklmnopqrst"!=a(u({},t)).join("")}))?function(e,t){for(var n=l(e),i=arguments.length,u=1,f=o.f,p=s.f;i>u;)for(var h,b=c(arguments[u++]),d=f?a(b).concat(f(b)):a(b),y=d.length,g=0;y>g;)h=d[g++],r&&!p.call(b,h)||(n[h]=b[h]);return n}:u},{"../internals/descriptors":18,"../internals/fails":22,"../internals/indexed-object":32,"../internals/object-get-own-property-symbols":50,"../internals/object-keys":53,"../internals/object-property-is-enumerable":54,"../internals/to-object":72}],45:[function(e,t,n){var r,i=e("../internals/an-object"),a=e("../internals/object-define-properties"),o=e("../internals/enum-bug-keys"),s=e("../internals/hidden-keys"),l=e("../internals/html"),c=e("../internals/document-create-element"),u=e("../internals/shared-key")("IE_PROTO"),f=function(){},p=function(e){return"<script>"+e+"<\/script>"},h=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;h=r?function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t}(r):((t=c("iframe")).style.display="none",l.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F);for(var n=o.length;n--;)delete h.prototype[o[n]];return h()};s[u]=!0,t.exports=Object.create||function(e,t){var n;return null!==e?(f.prototype=i(e),n=new f,f.prototype=null,n[u]=e):n=h(),void 0===t?n:a(n,t)}},{"../internals/an-object":5,"../internals/document-create-element":19,"../internals/enum-bug-keys":20,"../internals/hidden-keys":29,"../internals/html":30,"../internals/object-define-properties":46,"../internals/shared-key":63}],46:[function(e,t,n){var r=e("../internals/descriptors"),i=e("../internals/object-define-property"),a=e("../internals/an-object"),o=e("../internals/object-keys");t.exports=r?Object.defineProperties:function(e,t){a(e);for(var n,r=o(t),s=r.length,l=0;s>l;)i.f(e,n=r[l++],t[n]);return e}},{"../internals/an-object":5,"../internals/descriptors":18,"../internals/object-define-property":47,"../internals/object-keys":53}],47:[function(e,t,n){var r=e("../internals/descriptors"),i=e("../internals/ie8-dom-define"),a=e("../internals/an-object"),o=e("../internals/to-primitive"),s=Object.defineProperty;n.f=r?s:function(e,t,n){if(a(e),t=o(t,!0),a(n),i)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},{"../internals/an-object":5,"../internals/descriptors":18,"../internals/ie8-dom-define":31,"../internals/to-primitive":73}],48:[function(e,t,n){var r=e("../internals/descriptors"),i=e("../internals/object-property-is-enumerable"),a=e("../internals/create-property-descriptor"),o=e("../internals/to-indexed-object"),s=e("../internals/to-primitive"),l=e("../internals/has"),c=e("../internals/ie8-dom-define"),u=Object.getOwnPropertyDescriptor;n.f=r?u:function(e,t){if(e=o(e),t=s(t,!0),c)try{return u(e,t)}catch(e){}if(l(e,t))return a(!i.f.call(e,t),e[t])}},{"../internals/create-property-descriptor":15,"../internals/descriptors":18,"../internals/has":28,"../internals/ie8-dom-define":31,"../internals/object-property-is-enumerable":54,"../internals/to-indexed-object":69,"../internals/to-primitive":73}],49:[function(e,t,n){var r=e("../internals/object-keys-internal"),i=e("../internals/enum-bug-keys").concat("length","prototype");n.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},{"../internals/enum-bug-keys":20,"../internals/object-keys-internal":52}],50:[function(e,t,n){n.f=Object.getOwnPropertySymbols},{}],51:[function(e,t,n){var r=e("../internals/has"),i=e("../internals/to-object"),a=e("../internals/shared-key"),o=e("../internals/correct-prototype-getter"),s=a("IE_PROTO"),l=Object.prototype;t.exports=o?Object.getPrototypeOf:function(e){return e=i(e),r(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?l:null}},{"../internals/correct-prototype-getter":12,"../internals/has":28,"../internals/shared-key":63,"../internals/to-object":72}],52:[function(e,t,n){var r=e("../internals/has"),i=e("../internals/to-indexed-object"),a=e("../internals/array-includes").indexOf,o=e("../internals/hidden-keys");t.exports=function(e,t){var n,s=i(e),l=0,c=[];for(n in s)!r(o,n)&&r(s,n)&&c.push(n);for(;t.length>l;)r(s,n=t[l++])&&(~a(c,n)||c.push(n));return c}},{"../internals/array-includes":7,"../internals/has":28,"../internals/hidden-keys":29,"../internals/to-indexed-object":69}],53:[function(e,t,n){var r=e("../internals/object-keys-internal"),i=e("../internals/enum-bug-keys");t.exports=Object.keys||function(e){return r(e,i)}},{"../internals/enum-bug-keys":20,"../internals/object-keys-internal":52}],54:[function(e,t,n){"use strict";var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,a=i&&!r.call({1:2},1);n.f=a?function(e){var t=i(this,e);return!!t&&t.enumerable}:r},{}],55:[function(e,t,n){var r=e("../internals/an-object"),i=e("../internals/a-possible-prototype");t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,a){return r(n),i(a),t?e.call(n,a):n.__proto__=a,n}}():void 0)},{"../internals/a-possible-prototype":2,"../internals/an-object":5}],56:[function(e,t,n){var r=e("../internals/get-built-in"),i=e("../internals/object-get-own-property-names"),a=e("../internals/object-get-own-property-symbols"),o=e("../internals/an-object");t.exports=r("Reflect","ownKeys")||function(e){var t=i.f(o(e)),n=a.f;return n?t.concat(n(e)):t}},{"../internals/an-object":5,"../internals/get-built-in":24,"../internals/object-get-own-property-names":49,"../internals/object-get-own-property-symbols":50}],57:[function(e,t,n){var r=e("../internals/global");t.exports=r},{"../internals/global":27}],58:[function(e,t,n){var r=e("../internals/redefine");t.exports=function(e,t,n){for(var i in t)r(e,i,t[i],n);return e}},{"../internals/redefine":59}],59:[function(e,t,n){var r=e("../internals/global"),i=e("../internals/create-non-enumerable-property"),a=e("../internals/has"),o=e("../internals/set-global"),s=e("../internals/inspect-source"),l=e("../internals/internal-state"),c=l.get,u=l.enforce,f=String(String).split("String");(t.exports=function(e,t,n,s){var l=!!s&&!!s.unsafe,c=!!s&&!!s.enumerable,p=!!s&&!!s.noTargetGet;"function"==typeof n&&("string"!=typeof t||a(n,"name")||i(n,"name",t),u(n).source=f.join("string"==typeof t?t:"")),e!==r?(l?!p&&e[t]&&(c=!0):delete e[t],c?e[t]=n:i(e,t,n)):c?e[t]=n:o(t,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&c(this).source||s(this)}))},{"../internals/create-non-enumerable-property":14,"../internals/global":27,"../internals/has":28,"../internals/inspect-source":33,"../internals/internal-state":34,"../internals/set-global":61}],60:[function(e,t,n){t.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},{}],61:[function(e,t,n){var r=e("../internals/global"),i=e("../internals/create-non-enumerable-property");t.exports=function(e,t){try{i(r,e,t)}catch(n){r[e]=t}return t}},{"../internals/create-non-enumerable-property":14,"../internals/global":27}],62:[function(e,t,n){var r=e("../internals/object-define-property").f,i=e("../internals/has"),a=e("../internals/well-known-symbol")("toStringTag");t.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,a)&&r(e,a,{configurable:!0,value:t})}},{"../internals/has":28,"../internals/object-define-property":47,"../internals/well-known-symbol":77}],63:[function(e,t,n){var r=e("../internals/shared"),i=e("../internals/uid"),a=r("keys");t.exports=function(e){return a[e]||(a[e]=i(e))}},{"../internals/shared":65,"../internals/uid":75}],64:[function(e,t,n){var r=e("../internals/global"),i=e("../internals/set-global"),a=r["__core-js_shared__"]||i("__core-js_shared__",{});t.exports=a},{"../internals/global":27,"../internals/set-global":61}],65:[function(e,t,n){var r=e("../internals/is-pure"),i=e("../internals/shared-store");(t.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.4",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},{"../internals/is-pure":38,"../internals/shared-store":64}],66:[function(e,t,n){var r=e("../internals/to-integer"),i=e("../internals/require-object-coercible"),a=function(e){return function(t,n){var a,o,s=String(i(t)),l=r(n),c=s.length;return l<0||l>=c?e?"":void 0:(a=s.charCodeAt(l))<55296||a>56319||l+1===c||(o=s.charCodeAt(l+1))<56320||o>57343?e?s.charAt(l):a:e?s.slice(l,l+2):o-56320+(a-55296<<10)+65536}};t.exports={codeAt:a(!1),charAt:a(!0)}},{"../internals/require-object-coercible":60,"../internals/to-integer":70}],67:[function(e,t,n){"use strict";var r=/[^\0-\u007E]/,i=/[.\u3002\uFF0E\uFF61]/g,a="Overflow: input needs wider integers to process",o=Math.floor,s=String.fromCharCode,l=function(e){return e+22+75*(e<26)},c=function(e,t,n){var r=0;for(e=n?o(e/700):e>>1,e+=o(e/t);e>455;r+=36)e=o(e/35);return o(r+36*e/(e+38))},u=function(e){var t,n,r=[],i=(e=function(e){for(var t=[],n=0,r=e.length;n<r;){var i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){var a=e.charCodeAt(n++);56320==(64512&a)?t.push(((1023&i)<<10)+(1023&a)+65536):(t.push(i),n--)}else t.push(i)}return t}(e)).length,u=128,f=0,p=72;for(t=0;t<e.length;t++)(n=e[t])<128&&r.push(s(n));var h=r.length,b=h;for(h&&r.push("-");b<i;){var d=2147483647;for(t=0;t<e.length;t++)(n=e[t])>=u&&n<d&&(d=n);var y=b+1;if(d-u>o((2147483647-f)/y))throw RangeError(a);for(f+=(d-u)*y,u=d,t=0;t<e.length;t++){if((n=e[t])<u&&++f>2147483647)throw RangeError(a);if(n==u){for(var g=f,v=36;;v+=36){var m=v<=p?1:v>=p+26?26:v-p;if(g<m)break;var w=g-m,j=36-m;r.push(s(l(m+w%j))),g=o(w/j)}r.push(s(l(g))),p=c(f,y,b==h),f=0,++b}}++f,++u}return r.join("")};t.exports=function(e){var t,n,a=[],o=e.toLowerCase().replace(i,".").split(".");for(t=0;t<o.length;t++)n=o[t],a.push(r.test(n)?"xn--"+u(n):n);return a.join(".")}},{}],68:[function(e,t,n){var r=e("../internals/to-integer"),i=Math.max,a=Math.min;t.exports=function(e,t){var n=r(e);return n<0?i(n+t,0):a(n,t)}},{"../internals/to-integer":70}],69:[function(e,t,n){var r=e("../internals/indexed-object"),i=e("../internals/require-object-coercible");t.exports=function(e){return r(i(e))}},{"../internals/indexed-object":32,"../internals/require-object-coercible":60}],70:[function(e,t,n){var r=Math.ceil,i=Math.floor;t.exports=function(e){return isNaN(e=+e)?0:(e>0?i:r)(e)}},{}],71:[function(e,t,n){var r=e("../internals/to-integer"),i=Math.min;t.exports=function(e){return e>0?i(r(e),9007199254740991):0}},{"../internals/to-integer":70}],72:[function(e,t,n){var r=e("../internals/require-object-coercible");t.exports=function(e){return Object(r(e))}},{"../internals/require-object-coercible":60}],73:[function(e,t,n){var r=e("../internals/is-object");t.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},{"../internals/is-object":37}],74:[function(e,t,n){var r={};r[e("../internals/well-known-symbol")("toStringTag")]="z",t.exports="[object z]"===String(r)},{"../internals/well-known-symbol":77}],75:[function(e,t,n){var r=0,i=Math.random();t.exports=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++r+i).toString(36)}},{}],76:[function(e,t,n){var r=e("../internals/native-symbol");t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},{"../internals/native-symbol":41}],77:[function(e,t,n){var r=e("../internals/global"),i=e("../internals/shared"),a=e("../internals/has"),o=e("../internals/uid"),s=e("../internals/native-symbol"),l=e("../internals/use-symbol-as-uid"),c=i("wks"),u=r.Symbol,f=l?u:u&&u.withoutSetter||o;t.exports=function(e){return a(c,e)||(s&&a(u,e)?c[e]=u[e]:c[e]=f("Symbol."+e)),c[e]}},{"../internals/global":27,"../internals/has":28,"../internals/native-symbol":41,"../internals/shared":65,"../internals/uid":75,"../internals/use-symbol-as-uid":76}],78:[function(e,t,n){"use strict";var r=e("../internals/to-indexed-object"),i=e("../internals/add-to-unscopables"),a=e("../internals/iterators"),o=e("../internals/internal-state"),s=e("../internals/define-iterator"),l=o.set,c=o.getterFor("Array Iterator");t.exports=s(Array,"Array",(function(e,t){l(this,{type:"Array Iterator",target:r(e),index:0,kind:t})}),(function(){var e=c(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),a.Arguments=a.Array,i("keys"),i("values"),i("entries")},{"../internals/add-to-unscopables":3,"../internals/define-iterator":17,"../internals/internal-state":34,"../internals/iterators":40,"../internals/to-indexed-object":69}],79:[function(e,t,n){"use strict";var r=e("../internals/string-multibyte").charAt,i=e("../internals/internal-state"),a=e("../internals/define-iterator"),o=i.set,s=i.getterFor("String Iterator");a(String,"String",(function(e){o(this,{type:"String Iterator",string:String(e),index:0})}),(function(){var e,t=s(this),n=t.string,i=t.index;return i>=n.length?{value:void 0,done:!0}:(e=r(n,i),t.index+=e.length,{value:e,done:!1})}))},{"../internals/define-iterator":17,"../internals/internal-state":34,"../internals/string-multibyte":66}],80:[function(e,t,n){"use strict";e("../modules/es.array.iterator");var r=e("../internals/export"),i=e("../internals/get-built-in"),a=e("../internals/native-url"),o=e("../internals/redefine"),s=e("../internals/redefine-all"),l=e("../internals/set-to-string-tag"),c=e("../internals/create-iterator-constructor"),u=e("../internals/internal-state"),f=e("../internals/an-instance"),p=e("../internals/has"),h=e("../internals/function-bind-context"),b=e("../internals/classof"),d=e("../internals/an-object"),y=e("../internals/is-object"),g=e("../internals/object-create"),v=e("../internals/create-property-descriptor"),m=e("../internals/get-iterator"),w=e("../internals/get-iterator-method"),j=e("../internals/well-known-symbol"),x=i("fetch"),k=i("Headers"),S=j("iterator"),A=u.set,O=u.getterFor("URLSearchParams"),R=u.getterFor("URLSearchParamsIterator"),L=/\+/g,U=Array(4),P=function(e){return U[e-1]||(U[e-1]=RegExp("((?:%[\\da-f]{2}){"+e+"})","gi"))},I=function(e){try{return decodeURIComponent(e)}catch(t){return e}},q=function(e){var t=e.replace(L," "),n=4;try{return decodeURIComponent(t)}catch(e){for(;n;)t=t.replace(P(n--),I);return t}},E=/[!'()~]|%20/g,_={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},T=function(e){return _[e]},B=function(e){return encodeURIComponent(e).replace(E,T)},F=function(e,t){if(t)for(var n,r,i=t.split("&"),a=0;a<i.length;)(n=i[a++]).length&&(r=n.split("="),e.push({key:q(r.shift()),value:q(r.join("="))}))},C=function(e){this.entries.length=0,F(this.entries,e)},M=function(e,t){if(e<t)throw TypeError("Not enough arguments")},N=c((function(e,t){A(this,{type:"URLSearchParamsIterator",iterator:m(O(e).entries),kind:t})}),"Iterator",(function(){var e=R(this),t=e.kind,n=e.iterator.next(),r=n.value;return n.done||(n.value="keys"===t?r.key:"values"===t?r.value:[r.key,r.value]),n})),D=function(){f(this,D,"URLSearchParams");var e,t,n,r,i,a,o,s,l,c=arguments.length>0?arguments[0]:void 0,u=[];if(A(this,{type:"URLSearchParams",entries:u,updateURL:function(){},updateSearchParams:C}),void 0!==c)if(y(c))if("function"==typeof(e=w(c)))for(n=(t=e.call(c)).next;!(r=n.call(t)).done;){if((o=(a=(i=m(d(r.value))).next).call(i)).done||(s=a.call(i)).done||!a.call(i).done)throw TypeError("Expected sequence with length 2");u.push({key:o.value+"",value:s.value+""})}else for(l in c)p(c,l)&&u.push({key:l,value:c[l]+""});else F(u,"string"==typeof c?"?"===c.charAt(0)?c.slice(1):c:c+"")},z=D.prototype;s(z,{append:function(e,t){M(arguments.length,2);var n=O(this);n.entries.push({key:e+"",value:t+""}),n.updateURL()},delete:function(e){M(arguments.length,1);for(var t=O(this),n=t.entries,r=e+"",i=0;i<n.length;)n[i].key===r?n.splice(i,1):i++;t.updateURL()},get:function(e){M(arguments.length,1);for(var t=O(this).entries,n=e+"",r=0;r<t.length;r++)if(t[r].key===n)return t[r].value;return null},getAll:function(e){M(arguments.length,1);for(var t=O(this).entries,n=e+"",r=[],i=0;i<t.length;i++)t[i].key===n&&r.push(t[i].value);return r},has:function(e){M(arguments.length,1);for(var t=O(this).entries,n=e+"",r=0;r<t.length;)if(t[r++].key===n)return!0;return!1},set:function(e,t){M(arguments.length,1);for(var n,r=O(this),i=r.entries,a=!1,o=e+"",s=t+"",l=0;l<i.length;l++)(n=i[l]).key===o&&(a?i.splice(l--,1):(a=!0,n.value=s));a||i.push({key:o,value:s}),r.updateURL()},sort:function(){var e,t,n,r=O(this),i=r.entries,a=i.slice();for(i.length=0,n=0;n<a.length;n++){for(e=a[n],t=0;t<n;t++)if(i[t].key>e.key){i.splice(t,0,e);break}t===n&&i.push(e)}r.updateURL()},forEach:function(e){for(var t,n=O(this).entries,r=h(e,arguments.length>1?arguments[1]:void 0,3),i=0;i<n.length;)r((t=n[i++]).value,t.key,this)},keys:function(){return new N(this,"keys")},values:function(){return new N(this,"values")},entries:function(){return new N(this,"entries")}},{enumerable:!0}),o(z,S,z.entries),o(z,"toString",(function(){for(var e,t=O(this).entries,n=[],r=0;r<t.length;)e=t[r++],n.push(B(e.key)+"="+B(e.value));return n.join("&")}),{enumerable:!0}),l(D,"URLSearchParams"),r({global:!0,forced:!a},{URLSearchParams:D}),a||"function"!=typeof x||"function"!=typeof k||r({global:!0,enumerable:!0,forced:!0},{fetch:function(e){var t,n,r,i=[e];return arguments.length>1&&(y(t=arguments[1])&&(n=t.body,"URLSearchParams"===b(n)&&((r=t.headers?new k(t.headers):new k).has("content-type")||r.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),t=g(t,{body:v(0,String(n)),headers:v(0,r)}))),i.push(t)),x.apply(this,i)}}),t.exports={URLSearchParams:D,getState:O}},{"../internals/an-instance":4,"../internals/an-object":5,"../internals/classof":10,"../internals/create-iterator-constructor":13,"../internals/create-property-descriptor":15,"../internals/export":21,"../internals/function-bind-context":23,"../internals/get-built-in":24,"../internals/get-iterator":26,"../internals/get-iterator-method":25,"../internals/has":28,"../internals/internal-state":34,"../internals/is-object":37,"../internals/native-url":42,"../internals/object-create":45,"../internals/redefine":59,"../internals/redefine-all":58,"../internals/set-to-string-tag":62,"../internals/well-known-symbol":77,"../modules/es.array.iterator":78}],81:[function(e,t,n){"use strict";e("../modules/es.string.iterator");var r,i=e("../internals/export"),a=e("../internals/descriptors"),o=e("../internals/native-url"),s=e("../internals/global"),l=e("../internals/object-define-properties"),c=e("../internals/redefine"),u=e("../internals/an-instance"),f=e("../internals/has"),p=e("../internals/object-assign"),h=e("../internals/array-from"),b=e("../internals/string-multibyte").codeAt,d=e("../internals/string-punycode-to-ascii"),y=e("../internals/set-to-string-tag"),g=e("../modules/web.url-search-params"),v=e("../internals/internal-state"),m=s.URL,w=g.URLSearchParams,j=g.getState,x=v.set,k=v.getterFor("URL"),S=Math.floor,A=Math.pow,O=/[A-Za-z]/,R=/[\d+\-.A-Za-z]/,L=/\d/,U=/^(0x|0X)/,P=/^[0-7]+$/,I=/^\d+$/,q=/^[\dA-Fa-f]+$/,E=/[\u0000\u0009\u000A\u000D #%/:?@[\\]]/,_=/[\u0000\u0009\u000A\u000D #/:?@[\\]]/,T=/^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g,B=/[\u0009\u000A\u000D]/g,F=function(e,t){var n,r,i;if("["==t.charAt(0)){if("]"!=t.charAt(t.length-1))return"Invalid host";if(!(n=M(t.slice(1,-1))))return"Invalid host";e.host=n}else if(Y(e)){if(t=d(t),E.test(t))return"Invalid host";if(null===(n=C(t)))return"Invalid host";e.host=n}else{if(_.test(t))return"Invalid host";for(n="",r=h(t),i=0;i<r.length;i++)n+=$(r[i],D);e.host=n}},C=function(e){var t,n,r,i,a,o,s,l=e.split(".");if(l.length&&""==l[l.length-1]&&l.pop(),(t=l.length)>4)return e;for(n=[],r=0;r<t;r++){if(""==(i=l[r]))return e;if(a=10,i.length>1&&"0"==i.charAt(0)&&(a=U.test(i)?16:8,i=i.slice(8==a?1:2)),""===i)o=0;else{if(!(10==a?I:8==a?P:q).test(i))return e;o=parseInt(i,a)}n.push(o)}for(r=0;r<t;r++)if(o=n[r],r==t-1){if(o>=A(256,5-t))return null}else if(o>255)return null;for(s=n.pop(),r=0;r<n.length;r++)s+=n[r]*A(256,3-r);return s},M=function(e){var t,n,r,i,a,o,s,l=[0,0,0,0,0,0,0,0],c=0,u=null,f=0,p=function(){return e.charAt(f)};if(":"==p()){if(":"!=e.charAt(1))return;f+=2,u=++c}for(;p();){if(8==c)return;if(":"!=p()){for(t=n=0;n<4&&q.test(p());)t=16*t+parseInt(p(),16),f++,n++;if("."==p()){if(0==n)return;if(f-=n,c>6)return;for(r=0;p();){if(i=null,r>0){if(!("."==p()&&r<4))return;f++}if(!L.test(p()))return;for(;L.test(p());){if(a=parseInt(p(),10),null===i)i=a;else{if(0==i)return;i=10*i+a}if(i>255)return;f++}l[c]=256*l[c]+i,2!=++r&&4!=r||c++}if(4!=r)return;break}if(":"==p()){if(f++,!p())return}else if(p())return;l[c++]=t}else{if(null!==u)return;f++,u=++c}}if(null!==u)for(o=c-u,c=7;0!=c&&o>0;)s=l[c],l[c--]=l[u+o-1],l[u+--o]=s;else if(8!=c)return;return l},N=function(e){var t,n,r,i;if("number"==typeof e){for(t=[],n=0;n<4;n++)t.unshift(e%256),e=S(e/256);return t.join(".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,n=1,r=null,i=0,a=0;a<8;a++)0!==e[a]?(i>n&&(t=r,n=i),r=null,i=0):(null===r&&(r=a),++i);return i>n&&(t=r,n=i),t}(e),n=0;n<8;n++)i&&0===e[n]||(i&&(i=!1),r===n?(t+=n?":":"::",i=!0):(t+=e[n].toString(16),n<7&&(t+=":")));return"["+t+"]"}return e},D={},z=p({},D,{" ":1,'"':1,"<":1,">":1,"`":1}),G=p({},z,{"#":1,"?":1,"{":1,"}":1}),W=p({},G,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),$=function(e,t){var n=b(e,0);return n>32&&n<127&&!f(t,e)?e:encodeURIComponent(e)},J={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Y=function(e){return f(J,e.scheme)},X=function(e){return""!=e.username||""!=e.password},Z=function(e){return!e.host||e.cannotBeABaseURL||"file"==e.scheme},H=function(e,t){var n;return 2==e.length&&O.test(e.charAt(0))&&(":"==(n=e.charAt(1))||!t&&"|"==n)},K=function(e){var t;return e.length>1&&H(e.slice(0,2))&&(2==e.length||"/"===(t=e.charAt(2))||"\\"===t||"?"===t||"#"===t)},V=function(e){var t=e.path,n=t.length;!n||"file"==e.scheme&&1==n&&H(t[0],!0)||t.pop()},Q=function(e){return"."===e||"%2e"===e.toLowerCase()},ee={},te={},ne={},re={},ie={},ae={},oe={},se={},le={},ce={},ue={},fe={},pe={},he={},be={},de={},ye={},ge={},ve={},me={},we={},je=function(e,t,n,i){var a,o,s,l,c,u=n||ee,p=0,b="",d=!1,y=!1,g=!1;for(n||(e.scheme="",e.username="",e.password="",e.host=null,e.port=null,e.path=[],e.query=null,e.fragment=null,e.cannotBeABaseURL=!1,t=t.replace(T,"")),t=t.replace(B,""),a=h(t);p<=a.length;){switch(o=a[p],u){case ee:if(!o||!O.test(o)){if(n)return"Invalid scheme";u=ne;continue}b+=o.toLowerCase(),u=te;break;case te:if(o&&(R.test(o)||"+"==o||"-"==o||"."==o))b+=o.toLowerCase();else{if(":"!=o){if(n)return"Invalid scheme";b="",u=ne,p=0;continue}if(n&&(Y(e)!=f(J,b)||"file"==b&&(X(e)||null!==e.port)||"file"==e.scheme&&!e.host))return;if(e.scheme=b,n)return void(Y(e)&&J[e.scheme]==e.port&&(e.port=null));b="","file"==e.scheme?u=he:Y(e)&&i&&i.scheme==e.scheme?u=re:Y(e)?u=se:"/"==a[p+1]?(u=ie,p++):(e.cannotBeABaseURL=!0,e.path.push(""),u=ve)}break;case ne:if(!i||i.cannotBeABaseURL&&"#"!=o)return"Invalid scheme";if(i.cannotBeABaseURL&&"#"==o){e.scheme=i.scheme,e.path=i.path.slice(),e.query=i.query,e.fragment="",e.cannotBeABaseURL=!0,u=we;break}u="file"==i.scheme?he:ae;continue;case re:if("/"!=o||"/"!=a[p+1]){u=ae;continue}u=le,p++;break;case ie:if("/"==o){u=ce;break}u=ge;continue;case ae:if(e.scheme=i.scheme,o==r)e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,e.path=i.path.slice(),e.query=i.query;else if("/"==o||"\\"==o&&Y(e))u=oe;else if("?"==o)e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,e.path=i.path.slice(),e.query="",u=me;else{if("#"!=o){e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,e.path=i.path.slice(),e.path.pop(),u=ge;continue}e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,e.path=i.path.slice(),e.query=i.query,e.fragment="",u=we}break;case oe:if(!Y(e)||"/"!=o&&"\\"!=o){if("/"!=o){e.username=i.username,e.password=i.password,e.host=i.host,e.port=i.port,u=ge;continue}u=ce}else u=le;break;case se:if(u=le,"/"!=o||"/"!=b.charAt(p+1))continue;p++;break;case le:if("/"!=o&&"\\"!=o){u=ce;continue}break;case ce:if("@"==o){d&&(b="%40"+b),d=!0,s=h(b);for(var v=0;v<s.length;v++){var m=s[v];if(":"!=m||g){var w=$(m,W);g?e.password+=w:e.username+=w}else g=!0}b=""}else if(o==r||"/"==o||"?"==o||"#"==o||"\\"==o&&Y(e)){if(d&&""==b)return"Invalid authority";p-=h(b).length+1,b="",u=ue}else b+=o;break;case ue:case fe:if(n&&"file"==e.scheme){u=de;continue}if(":"!=o||y){if(o==r||"/"==o||"?"==o||"#"==o||"\\"==o&&Y(e)){if(Y(e)&&""==b)return"Invalid host";if(n&&""==b&&(X(e)||null!==e.port))return;if(l=F(e,b))return l;if(b="",u=ye,n)return;continue}"["==o?y=!0:"]"==o&&(y=!1),b+=o}else{if(""==b)return"Invalid host";if(l=F(e,b))return l;if(b="",u=pe,n==fe)return}break;case pe:if(!L.test(o)){if(o==r||"/"==o||"?"==o||"#"==o||"\\"==o&&Y(e)||n){if(""!=b){var j=parseInt(b,10);if(j>65535)return"Invalid port";e.port=Y(e)&&j===J[e.scheme]?null:j,b=""}if(n)return;u=ye;continue}return"Invalid port"}b+=o;break;case he:if(e.scheme="file","/"==o||"\\"==o)u=be;else{if(!i||"file"!=i.scheme){u=ge;continue}if(o==r)e.host=i.host,e.path=i.path.slice(),e.query=i.query;else if("?"==o)e.host=i.host,e.path=i.path.slice(),e.query="",u=me;else{if("#"!=o){K(a.slice(p).join(""))||(e.host=i.host,e.path=i.path.slice(),V(e)),u=ge;continue}e.host=i.host,e.path=i.path.slice(),e.query=i.query,e.fragment="",u=we}}break;case be:if("/"==o||"\\"==o){u=de;break}i&&"file"==i.scheme&&!K(a.slice(p).join(""))&&(H(i.path[0],!0)?e.path.push(i.path[0]):e.host=i.host),u=ge;continue;case de:if(o==r||"/"==o||"\\"==o||"?"==o||"#"==o){if(!n&&H(b))u=ge;else if(""==b){if(e.host="",n)return;u=ye}else{if(l=F(e,b))return l;if("localhost"==e.host&&(e.host=""),n)return;b="",u=ye}continue}b+=o;break;case ye:if(Y(e)){if(u=ge,"/"!=o&&"\\"!=o)continue}else if(n||"?"!=o)if(n||"#"!=o){if(o!=r&&(u=ge,"/"!=o))continue}else e.fragment="",u=we;else e.query="",u=me;break;case ge:if(o==r||"/"==o||"\\"==o&&Y(e)||!n&&("?"==o||"#"==o)){if(".."===(c=(c=b).toLowerCase())||"%2e."===c||".%2e"===c||"%2e%2e"===c?(V(e),"/"==o||"\\"==o&&Y(e)||e.path.push("")):Q(b)?"/"==o||"\\"==o&&Y(e)||e.path.push(""):("file"==e.scheme&&!e.path.length&&H(b)&&(e.host&&(e.host=""),b=b.charAt(0)+":"),e.path.push(b)),b="","file"==e.scheme&&(o==r||"?"==o||"#"==o))for(;e.path.length>1&&""===e.path[0];)e.path.shift();"?"==o?(e.query="",u=me):"#"==o&&(e.fragment="",u=we)}else b+=$(o,G);break;case ve:"?"==o?(e.query="",u=me):"#"==o?(e.fragment="",u=we):o!=r&&(e.path[0]+=$(o,D));break;case me:n||"#"!=o?o!=r&&("'"==o&&Y(e)?e.query+="%27":e.query+="#"==o?"%23":$(o,D)):(e.fragment="",u=we);break;case we:o!=r&&(e.fragment+=$(o,z))}p++}},xe=function(e){var t,n,r=u(this,xe,"URL"),i=arguments.length>1?arguments[1]:void 0,o=String(e),s=x(r,{type:"URL"});if(void 0!==i)if(i instanceof xe)t=k(i);else if(n=je(t={},String(i)))throw TypeError(n);if(n=je(s,o,null,t))throw TypeError(n);var l=s.searchParams=new w,c=j(l);c.updateSearchParams(s.query),c.updateURL=function(){s.query=String(l)||null},a||(r.href=Se.call(r),r.origin=Ae.call(r),r.protocol=Oe.call(r),r.username=Re.call(r),r.password=Le.call(r),r.host=Ue.call(r),r.hostname=Pe.call(r),r.port=Ie.call(r),r.pathname=qe.call(r),r.search=Ee.call(r),r.searchParams=_e.call(r),r.hash=Te.call(r))},ke=xe.prototype,Se=function(){var e=k(this),t=e.scheme,n=e.username,r=e.password,i=e.host,a=e.port,o=e.path,s=e.query,l=e.fragment,c=t+":";return null!==i?(c+="//",X(e)&&(c+=n+(r?":"+r:"")+"@"),c+=N(i),null!==a&&(c+=":"+a)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?o[0]:o.length?"/"+o.join("/"):"",null!==s&&(c+="?"+s),null!==l&&(c+="#"+l),c},Ae=function(){var e=k(this),t=e.scheme,n=e.port;if("blob"==t)try{return new URL(t.path[0]).origin}catch(e){return"null"}return"file"!=t&&Y(e)?t+"://"+N(e.host)+(null!==n?":"+n:""):"null"},Oe=function(){return k(this).scheme+":"},Re=function(){return k(this).username},Le=function(){return k(this).password},Ue=function(){var e=k(this),t=e.host,n=e.port;return null===t?"":null===n?N(t):N(t)+":"+n},Pe=function(){var e=k(this).host;return null===e?"":N(e)},Ie=function(){var e=k(this).port;return null===e?"":String(e)},qe=function(){var e=k(this),t=e.path;return e.cannotBeABaseURL?t[0]:t.length?"/"+t.join("/"):""},Ee=function(){var e=k(this).query;return e?"?"+e:""},_e=function(){return k(this).searchParams},Te=function(){var e=k(this).fragment;return e?"#"+e:""},Be=function(e,t){return{get:e,set:t,configurable:!0,enumerable:!0}};if(a&&l(ke,{href:Be(Se,(function(e){var t=k(this),n=String(e),r=je(t,n);if(r)throw TypeError(r);j(t.searchParams).updateSearchParams(t.query)})),origin:Be(Ae),protocol:Be(Oe,(function(e){var t=k(this);je(t,String(e)+":",ee)})),username:Be(Re,(function(e){var t=k(this),n=h(String(e));if(!Z(t)){t.username="";for(var r=0;r<n.length;r++)t.username+=$(n[r],W)}})),password:Be(Le,(function(e){var t=k(this),n=h(String(e));if(!Z(t)){t.password="";for(var r=0;r<n.length;r++)t.password+=$(n[r],W)}})),host:Be(Ue,(function(e){var t=k(this);t.cannotBeABaseURL||je(t,String(e),ue)})),hostname:Be(Pe,(function(e){var t=k(this);t.cannotBeABaseURL||je(t,String(e),fe)})),port:Be(Ie,(function(e){var t=k(this);Z(t)||(""==(e=String(e))?t.port=null:je(t,e,pe))})),pathname:Be(qe,(function(e){var t=k(this);t.cannotBeABaseURL||(t.path=[],je(t,e+"",ye))})),search:Be(Ee,(function(e){var t=k(this);""==(e=String(e))?t.query=null:("?"==e.charAt(0)&&(e=e.slice(1)),t.query="",je(t,e,me)),j(t.searchParams).updateSearchParams(t.query)})),searchParams:Be(_e),hash:Be(Te,(function(e){var t=k(this);""!=(e=String(e))?("#"==e.charAt(0)&&(e=e.slice(1)),t.fragment="",je(t,e,we)):t.fragment=null}))}),c(ke,"toJSON",(function(){return Se.call(this)}),{enumerable:!0}),c(ke,"toString",(function(){return Se.call(this)}),{enumerable:!0}),m){var Fe=m.createObjectURL,Ce=m.revokeObjectURL;Fe&&c(xe,"createObjectURL",(function(e){return Fe.apply(m,arguments)})),Ce&&c(xe,"revokeObjectURL",(function(e){return Ce.apply(m,arguments)}))}y(xe,"URL"),i({global:!0,forced:!o,sham:!a},{URL:xe})},{"../internals/an-instance":4,"../internals/array-from":6,"../internals/descriptors":18,"../internals/export":21,"../internals/global":27,"../internals/has":28,"../internals/internal-state":34,"../internals/native-url":42,"../internals/object-assign":44,"../internals/object-define-properties":46,"../internals/redefine":59,"../internals/set-to-string-tag":62,"../internals/string-multibyte":66,"../internals/string-punycode-to-ascii":67,"../modules/es.string.iterator":79,"../modules/web.url-search-params":80}],82:[function(e,t,n){"use strict";e("../internals/export")({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return URL.prototype.toString.call(this)}})},{"../internals/export":21}],83:[function(e,t,n){e("../modules/web.url"),e("../modules/web.url.to-json"),e("../modules/web.url-search-params");var r=e("../internals/path");t.exports=r.URL},{"../internals/path":57,"../modules/web.url":81,"../modules/web.url-search-params":80,"../modules/web.url.to-json":82}]},{},[83]); vendor/react.js 0000644 00000326553 15151622574 0007523 0 ustar 00 /** * @license React * react.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.React = {})); }(this, (function (exports) { 'use strict'; var ReactVersion = '18.3.1'; // ATTENTION // When adding new symbols to this file, // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' // The Symbol used to tag the ReactElement-like types. var REACT_ELEMENT_TYPE = Symbol.for('react.element'); var REACT_PORTAL_TYPE = Symbol.for('react.portal'); var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); var REACT_CONTEXT_TYPE = Symbol.for('react.context'); var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); var REACT_MEMO_TYPE = Symbol.for('react.memo'); var REACT_LAZY_TYPE = Symbol.for('react.lazy'); var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; var FAUX_ITERATOR_SYMBOL = '@@iterator'; function getIteratorFn(maybeIterable) { if (maybeIterable === null || typeof maybeIterable !== 'object') { return null; } var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; if (typeof maybeIterator === 'function') { return maybeIterator; } return null; } /** * Keeps track of the current dispatcher. */ var ReactCurrentDispatcher = { /** * @internal * @type {ReactComponent} */ current: null }; /** * Keeps track of the current batch's configuration such as how long an update * should suspend for if it needs to. */ var ReactCurrentBatchConfig = { transition: null }; var ReactCurrentActQueue = { current: null, // Used to reproduce behavior of `batchedUpdates` in legacy mode. isBatchingLegacy: false, didScheduleLegacyUpdate: false }; /** * Keeps track of the current owner. * * The current owner is the component who should own any components that are * currently being constructed. */ var ReactCurrentOwner = { /** * @internal * @type {ReactComponent} */ current: null }; var ReactDebugCurrentFrame = {}; var currentExtraStackFrame = null; function setExtraStackFrame(stack) { { currentExtraStackFrame = stack; } } { ReactDebugCurrentFrame.setExtraStackFrame = function (stack) { { currentExtraStackFrame = stack; } }; // Stack implementation injected by the current renderer. ReactDebugCurrentFrame.getCurrentStack = null; ReactDebugCurrentFrame.getStackAddendum = function () { var stack = ''; // Add an extra top frame while an element is being validated if (currentExtraStackFrame) { stack += currentExtraStackFrame; } // Delegate to the injected renderer-specific implementation var impl = ReactDebugCurrentFrame.getCurrentStack; if (impl) { stack += impl() || ''; } return stack; }; } // ----------------------------------------------------------------------------- var enableScopeAPI = false; // Experimental Create Event Handle API. var enableCacheElement = false; var enableTransitionTracing = false; // No known bugs, but needs performance testing var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber // stuff. Intended to enable React core members to more easily debug scheduling // issues in DEV builds. var enableDebugTracing = false; // Track which Fiber(s) schedule render work. var ReactSharedInternals = { ReactCurrentDispatcher: ReactCurrentDispatcher, ReactCurrentBatchConfig: ReactCurrentBatchConfig, ReactCurrentOwner: ReactCurrentOwner }; { ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame; ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue; } // by calls to these methods by a Babel plugin. // // In PROD (or in packages without access to React internals), // they are left as they are instead. function warn(format) { { { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } printWarning('warn', format, args); } } } function error(format) { { { for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } printWarning('error', format, args); } } } function printWarning(level, format, args) { // When changing this logic, you might want to also // update consoleWithStackDev.www.js as well. { var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; var stack = ReactDebugCurrentFrame.getStackAddendum(); if (stack !== '') { format += '%s'; args = args.concat([stack]); } // eslint-disable-next-line react-internal/safe-string-coercion var argsWithFormat = args.map(function (item) { return String(item); }); // Careful: RN currently depends on this prefix argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it // breaks IE9: https://github.com/facebook/react/issues/13610 // eslint-disable-next-line react-internal/no-production-logging Function.prototype.apply.call(console[level], console, argsWithFormat); } } var didWarnStateUpdateForUnmountedComponent = {}; function warnNoop(publicInstance, callerName) { { var _constructor = publicInstance.constructor; var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass'; var warningKey = componentName + "." + callerName; if (didWarnStateUpdateForUnmountedComponent[warningKey]) { return; } error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName); didWarnStateUpdateForUnmountedComponent[warningKey] = true; } } /** * This is the abstract API for an update queue. */ var ReactNoopUpdateQueue = { /** * Checks whether or not this composite component is mounted. * @param {ReactClass} publicInstance The instance we want to test. * @return {boolean} True if mounted, false otherwise. * @protected * @final */ isMounted: function (publicInstance) { return false; }, /** * Forces an update. This should only be invoked when it is known with * certainty that we are **not** in a DOM transaction. * * You may want to call this when you know that some deeper aspect of the * component's state has changed but `setState` was not called. * * This will not invoke `shouldComponentUpdate`, but it will invoke * `componentWillUpdate` and `componentDidUpdate`. * * @param {ReactClass} publicInstance The instance that should rerender. * @param {?function} callback Called after component is updated. * @param {?string} callerName name of the calling function in the public API. * @internal */ enqueueForceUpdate: function (publicInstance, callback, callerName) { warnNoop(publicInstance, 'forceUpdate'); }, /** * Replaces all of the state. Always use this or `setState` to mutate state. * You should treat `this.state` as immutable. * * There is no guarantee that `this.state` will be immediately updated, so * accessing `this.state` after calling this method may return the old value. * * @param {ReactClass} publicInstance The instance that should rerender. * @param {object} completeState Next state. * @param {?function} callback Called after component is updated. * @param {?string} callerName name of the calling function in the public API. * @internal */ enqueueReplaceState: function (publicInstance, completeState, callback, callerName) { warnNoop(publicInstance, 'replaceState'); }, /** * Sets a subset of the state. This only exists because _pendingState is * internal. This provides a merging strategy that is not available to deep * properties which is confusing. TODO: Expose pendingState or don't use it * during the merge. * * @param {ReactClass} publicInstance The instance that should rerender. * @param {object} partialState Next partial state to be merged with state. * @param {?function} callback Called after component is updated. * @param {?string} Name of the calling function in the public API. * @internal */ enqueueSetState: function (publicInstance, partialState, callback, callerName) { warnNoop(publicInstance, 'setState'); } }; var assign = Object.assign; var emptyObject = {}; { Object.freeze(emptyObject); } /** * Base class helpers for the updating state of a component. */ function Component(props, context, updater) { this.props = props; this.context = context; // If a component has string refs, we will assign a different object later. this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue; } Component.prototype.isReactComponent = {}; /** * Sets a subset of the state. Always use this to mutate * state. You should treat `this.state` as immutable. * * There is no guarantee that `this.state` will be immediately updated, so * accessing `this.state` after calling this method may return the old value. * * There is no guarantee that calls to `setState` will run synchronously, * as they may eventually be batched together. You can provide an optional * callback that will be executed when the call to setState is actually * completed. * * When a function is provided to setState, it will be called at some point in * the future (not synchronously). It will be called with the up to date * component arguments (state, props, context). These values can be different * from this.* because your function may be called after receiveProps but before * shouldComponentUpdate, and this new state, props, and context will not yet be * assigned to this. * * @param {object|function} partialState Next partial state or function to * produce next partial state to be merged with current state. * @param {?function} callback Called after state is updated. * @final * @protected */ Component.prototype.setState = function (partialState, callback) { if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) { throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.'); } this.updater.enqueueSetState(this, partialState, callback, 'setState'); }; /** * Forces an update. This should only be invoked when it is known with * certainty that we are **not** in a DOM transaction. * * You may want to call this when you know that some deeper aspect of the * component's state has changed but `setState` was not called. * * This will not invoke `shouldComponentUpdate`, but it will invoke * `componentWillUpdate` and `componentDidUpdate`. * * @param {?function} callback Called after update is complete. * @final * @protected */ Component.prototype.forceUpdate = function (callback) { this.updater.enqueueForceUpdate(this, callback, 'forceUpdate'); }; /** * Deprecated APIs. These APIs used to exist on classic React classes but since * we would like to deprecate them, we're not going to move them over to this * modern base class. Instead, we define a getter that warns if it's accessed. */ { var deprecatedAPIs = { isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] }; var defineDeprecationWarning = function (methodName, info) { Object.defineProperty(Component.prototype, methodName, { get: function () { warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); return undefined; } }); }; for (var fnName in deprecatedAPIs) { if (deprecatedAPIs.hasOwnProperty(fnName)) { defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); } } } function ComponentDummy() {} ComponentDummy.prototype = Component.prototype; /** * Convenience component with default shallow equality check for sCU. */ function PureComponent(props, context, updater) { this.props = props; this.context = context; // If a component has string refs, we will assign a different object later. this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; } var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods. assign(pureComponentPrototype, Component.prototype); pureComponentPrototype.isPureReactComponent = true; // an immutable object with a single mutable value function createRef() { var refObject = { current: null }; { Object.seal(refObject); } return refObject; } var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare function isArray(a) { return isArrayImpl(a); } /* * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol * and Temporal.* types. See https://github.com/facebook/react/pull/22064. * * The functions in this module will throw an easier-to-understand, * easier-to-debug exception with a clear errors message message explaining the * problem. (Instead of a confusing exception thrown inside the implementation * of the `value` object). */ // $FlowFixMe only called in DEV, so void return is not possible. function typeName(value) { { // toStringTag is needed for namespaced types like Temporal.Instant var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag; var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; return type; } } // $FlowFixMe only called in DEV, so void return is not possible. function willCoercionThrow(value) { { try { testStringCoercion(value); return false; } catch (e) { return true; } } } function testStringCoercion(value) { // If you ended up here by following an exception call stack, here's what's // happened: you supplied an object or symbol value to React (as a prop, key, // DOM attribute, CSS property, string ref, etc.) and when React tried to // coerce it to a string using `'' + value`, an exception was thrown. // // The most common types that will cause this exception are `Symbol` instances // and Temporal objects like `Temporal.Instant`. But any object that has a // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this // exception. (Library authors do this to prevent users from using built-in // numeric operators like `+` or comparison operators like `>=` because custom // methods are needed to perform accurate arithmetic or comparison.) // // To fix the problem, coerce this object or symbol value to a string before // passing it to React. The most reliable way is usually `String(value)`. // // To find which value is throwing, check the browser or debugger console. // Before this exception was thrown, there should be `console.error` output // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the // problem and how that type was used: key, atrribute, input value prop, etc. // In most cases, this console output also shows the component and its // ancestor components where the exception happened. // // eslint-disable-next-line react-internal/safe-string-coercion return '' + value; } function checkKeyStringCoercion(value) { { if (willCoercionThrow(value)) { error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); return testStringCoercion(value); // throw (to help callers find troubleshooting comments) } } } function getWrappedName(outerType, innerType, wrapperName) { var displayName = outerType.displayName; if (displayName) { return displayName; } var functionName = innerType.displayName || innerType.name || ''; return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName; } // Keep in sync with react-reconciler/getComponentNameFromFiber function getContextName(type) { return type.displayName || 'Context'; } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead. function getComponentNameFromType(type) { if (type == null) { // Host root, text node or just invalid type. return null; } { if (typeof type.tag === 'number') { error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.'); } } if (typeof type === 'function') { return type.displayName || type.name || null; } if (typeof type === 'string') { return type; } switch (type) { case REACT_FRAGMENT_TYPE: return 'Fragment'; case REACT_PORTAL_TYPE: return 'Portal'; case REACT_PROFILER_TYPE: return 'Profiler'; case REACT_STRICT_MODE_TYPE: return 'StrictMode'; case REACT_SUSPENSE_TYPE: return 'Suspense'; case REACT_SUSPENSE_LIST_TYPE: return 'SuspenseList'; } if (typeof type === 'object') { switch (type.$$typeof) { case REACT_CONTEXT_TYPE: var context = type; return getContextName(context) + '.Consumer'; case REACT_PROVIDER_TYPE: var provider = type; return getContextName(provider._context) + '.Provider'; case REACT_FORWARD_REF_TYPE: return getWrappedName(type, type.render, 'ForwardRef'); case REACT_MEMO_TYPE: var outerName = type.displayName || null; if (outerName !== null) { return outerName; } return getComponentNameFromType(type.type) || 'Memo'; case REACT_LAZY_TYPE: { var lazyComponent = type; var payload = lazyComponent._payload; var init = lazyComponent._init; try { return getComponentNameFromType(init(payload)); } catch (x) { return null; } } // eslint-disable-next-line no-fallthrough } } return null; } var hasOwnProperty = Object.prototype.hasOwnProperty; var RESERVED_PROPS = { key: true, ref: true, __self: true, __source: true }; var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs; { didWarnAboutStringRefs = {}; } function hasValidRef(config) { { if (hasOwnProperty.call(config, 'ref')) { var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; if (getter && getter.isReactWarning) { return false; } } } return config.ref !== undefined; } function hasValidKey(config) { { if (hasOwnProperty.call(config, 'key')) { var getter = Object.getOwnPropertyDescriptor(config, 'key').get; if (getter && getter.isReactWarning) { return false; } } } return config.key !== undefined; } function defineKeyPropWarningGetter(props, displayName) { var warnAboutAccessingKey = function () { { if (!specialPropKeyWarningShown) { specialPropKeyWarningShown = true; error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); } } }; warnAboutAccessingKey.isReactWarning = true; Object.defineProperty(props, 'key', { get: warnAboutAccessingKey, configurable: true }); } function defineRefPropWarningGetter(props, displayName) { var warnAboutAccessingRef = function () { { if (!specialPropRefWarningShown) { specialPropRefWarningShown = true; error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); } } }; warnAboutAccessingRef.isReactWarning = true; Object.defineProperty(props, 'ref', { get: warnAboutAccessingRef, configurable: true }); } function warnIfStringRefCannotBeAutoConverted(config) { { if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) { var componentName = getComponentNameFromType(ReactCurrentOwner.current.type); if (!didWarnAboutStringRefs[componentName]) { error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref); didWarnAboutStringRefs[componentName] = true; } } } } /** * Factory method to create a new React element. This no longer adheres to * the class pattern, so do not use new to call it. Also, instanceof check * will not work. Instead test $$typeof field against Symbol.for('react.element') to check * if something is a React Element. * * @param {*} type * @param {*} props * @param {*} key * @param {string|object} ref * @param {*} owner * @param {*} self A *temporary* helper to detect places where `this` is * different from the `owner` when React.createElement is called, so that we * can warn. We want to get rid of owner and replace string `ref`s with arrow * functions, and as long as `this` and owner are the same, there will be no * change in behavior. * @param {*} source An annotation object (added by a transpiler or otherwise) * indicating filename, line number, and/or other information. * @internal */ var ReactElement = function (type, key, ref, self, source, owner, props) { var element = { // This tag allows us to uniquely identify this as a React Element $$typeof: REACT_ELEMENT_TYPE, // Built-in properties that belong on the element type: type, key: key, ref: ref, props: props, // Record the component responsible for creating this element. _owner: owner }; { // The validation flag is currently mutative. We put it on // an external backing store so that we can freeze the whole object. // This can be replaced with a WeakMap once they are implemented in // commonly used development environments. element._store = {}; // To make comparing ReactElements easier for testing purposes, we make // the validation flag non-enumerable (where possible, which should // include every environment we run tests in), so the test framework // ignores it. Object.defineProperty(element._store, 'validated', { configurable: false, enumerable: false, writable: true, value: false }); // self and source are DEV only properties. Object.defineProperty(element, '_self', { configurable: false, enumerable: false, writable: false, value: self }); // Two elements created in two different places should be considered // equal for testing purposes and therefore we hide it from enumeration. Object.defineProperty(element, '_source', { configurable: false, enumerable: false, writable: false, value: source }); if (Object.freeze) { Object.freeze(element.props); Object.freeze(element); } } return element; }; /** * Create and return a new ReactElement of the given type. * See https://reactjs.org/docs/react-api.html#createelement */ function createElement(type, config, children) { var propName; // Reserved names are extracted var props = {}; var key = null; var ref = null; var self = null; var source = null; if (config != null) { if (hasValidRef(config)) { ref = config.ref; { warnIfStringRefCannotBeAutoConverted(config); } } if (hasValidKey(config)) { { checkKeyStringCoercion(config.key); } key = '' + config.key; } self = config.__self === undefined ? null : config.__self; source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object for (propName in config) { if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { props[propName] = config[propName]; } } } // Children can be more than one argument, and those are transferred onto // the newly allocated props object. var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 2]; } { if (Object.freeze) { Object.freeze(childArray); } } props.children = childArray; } // Resolve default props if (type && type.defaultProps) { var defaultProps = type.defaultProps; for (propName in defaultProps) { if (props[propName] === undefined) { props[propName] = defaultProps[propName]; } } } { if (key || ref) { var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; if (key) { defineKeyPropWarningGetter(props, displayName); } if (ref) { defineRefPropWarningGetter(props, displayName); } } } return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); } function cloneAndReplaceKey(oldElement, newKey) { var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); return newElement; } /** * Clone and return a new ReactElement using element as the starting point. * See https://reactjs.org/docs/react-api.html#cloneelement */ function cloneElement(element, config, children) { if (element === null || element === undefined) { throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + "."); } var propName; // Original props are copied var props = assign({}, element.props); // Reserved names are extracted var key = element.key; var ref = element.ref; // Self is preserved since the owner is preserved. var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a // transpiler, and the original source is probably a better indicator of the // true owner. var source = element._source; // Owner will be preserved, unless ref is overridden var owner = element._owner; if (config != null) { if (hasValidRef(config)) { // Silently steal the ref from the parent. ref = config.ref; owner = ReactCurrentOwner.current; } if (hasValidKey(config)) { { checkKeyStringCoercion(config.key); } key = '' + config.key; } // Remaining properties override existing props var defaultProps; if (element.type && element.type.defaultProps) { defaultProps = element.type.defaultProps; } for (propName in config) { if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { if (config[propName] === undefined && defaultProps !== undefined) { // Resolve default props props[propName] = defaultProps[propName]; } else { props[propName] = config[propName]; } } } } // Children can be more than one argument, and those are transferred onto // the newly allocated props object. var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 2]; } props.children = childArray; } return ReactElement(element.type, key, ref, self, source, owner, props); } /** * Verifies the object is a ReactElement. * See https://reactjs.org/docs/react-api.html#isvalidelement * @param {?object} object * @return {boolean} True if `object` is a ReactElement. * @final */ function isValidElement(object) { return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; } var SEPARATOR = '.'; var SUBSEPARATOR = ':'; /** * Escape and wrap key so it is safe to use as a reactid * * @param {string} key to be escaped. * @return {string} the escaped key. */ function escape(key) { var escapeRegex = /[=:]/g; var escaperLookup = { '=': '=0', ':': '=2' }; var escapedString = key.replace(escapeRegex, function (match) { return escaperLookup[match]; }); return '$' + escapedString; } /** * TODO: Test that a single child and an array with one item have the same key * pattern. */ var didWarnAboutMaps = false; var userProvidedKeyEscapeRegex = /\/+/g; function escapeUserProvidedKey(text) { return text.replace(userProvidedKeyEscapeRegex, '$&/'); } /** * Generate a key string that identifies a element within a set. * * @param {*} element A element that could contain a manual key. * @param {number} index Index that is used if a manual key is not provided. * @return {string} */ function getElementKey(element, index) { // Do some typechecking here since we call this blindly. We want to ensure // that we don't block potential future ES APIs. if (typeof element === 'object' && element !== null && element.key != null) { // Explicit key { checkKeyStringCoercion(element.key); } return escape('' + element.key); } // Implicit key determined by the index in the set return index.toString(36); } function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { var type = typeof children; if (type === 'undefined' || type === 'boolean') { // All of the above are perceived as null. children = null; } var invokeCallback = false; if (children === null) { invokeCallback = true; } else { switch (type) { case 'string': case 'number': invokeCallback = true; break; case 'object': switch (children.$$typeof) { case REACT_ELEMENT_TYPE: case REACT_PORTAL_TYPE: invokeCallback = true; } } } if (invokeCallback) { var _child = children; var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array // so that it's consistent if the number of children grows: var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar; if (isArray(mappedChild)) { var escapedChildKey = ''; if (childKey != null) { escapedChildKey = escapeUserProvidedKey(childKey) + '/'; } mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) { return c; }); } else if (mappedChild != null) { if (isValidElement(mappedChild)) { { // The `if` statement here prevents auto-disabling of the safe // coercion ESLint rule, so we must manually disable it below. // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) { checkKeyStringCoercion(mappedChild.key); } } mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as // traverseAllChildren used to do for objects as children escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number // eslint-disable-next-line react-internal/safe-string-coercion escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey); } array.push(mappedChild); } return 1; } var child; var nextName; var subtreeCount = 0; // Count of children found in the current subtree. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; if (isArray(children)) { for (var i = 0; i < children.length; i++) { child = children[i]; nextName = nextNamePrefix + getElementKey(child, i); subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); } } else { var iteratorFn = getIteratorFn(children); if (typeof iteratorFn === 'function') { var iterableChildren = children; { // Warn about using Maps as children if (iteratorFn === iterableChildren.entries) { if (!didWarnAboutMaps) { warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.'); } didWarnAboutMaps = true; } } var iterator = iteratorFn.call(iterableChildren); var step; var ii = 0; while (!(step = iterator.next()).done) { child = step.value; nextName = nextNamePrefix + getElementKey(child, ii++); subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); } } else if (type === 'object') { // eslint-disable-next-line react-internal/safe-string-coercion var childrenString = String(children); throw new Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.'); } } return subtreeCount; } /** * Maps children that are typically specified as `props.children`. * * See https://reactjs.org/docs/react-api.html#reactchildrenmap * * The provided mapFunction(child, index) will be called for each * leaf child. * * @param {?*} children Children tree container. * @param {function(*, int)} func The map function. * @param {*} context Context for mapFunction. * @return {object} Object containing the ordered map of results. */ function mapChildren(children, func, context) { if (children == null) { return children; } var result = []; var count = 0; mapIntoArray(children, result, '', '', function (child) { return func.call(context, child, count++); }); return result; } /** * Count the number of children that are typically specified as * `props.children`. * * See https://reactjs.org/docs/react-api.html#reactchildrencount * * @param {?*} children Children tree container. * @return {number} The number of children. */ function countChildren(children) { var n = 0; mapChildren(children, function () { n++; // Don't return anything }); return n; } /** * Iterates through children that are typically specified as `props.children`. * * See https://reactjs.org/docs/react-api.html#reactchildrenforeach * * The provided forEachFunc(child, index) will be called for each * leaf child. * * @param {?*} children Children tree container. * @param {function(*, int)} forEachFunc * @param {*} forEachContext Context for forEachContext. */ function forEachChildren(children, forEachFunc, forEachContext) { mapChildren(children, function () { forEachFunc.apply(this, arguments); // Don't return anything. }, forEachContext); } /** * Flatten a children object (typically specified as `props.children`) and * return an array with appropriately re-keyed children. * * See https://reactjs.org/docs/react-api.html#reactchildrentoarray */ function toArray(children) { return mapChildren(children, function (child) { return child; }) || []; } /** * Returns the first child in a collection of children and verifies that there * is only one child in the collection. * * See https://reactjs.org/docs/react-api.html#reactchildrenonly * * The current implementation of this function assumes that a single child gets * passed without a wrapper, but the purpose of this helper function is to * abstract away the particular structure of children. * * @param {?object} children Child collection structure. * @return {ReactElement} The first and only `ReactElement` contained in the * structure. */ function onlyChild(children) { if (!isValidElement(children)) { throw new Error('React.Children.only expected to receive a single React element child.'); } return children; } function createContext(defaultValue) { // TODO: Second argument used to be an optional `calculateChangedBits` // function. Warn to reserve for future use? var context = { $$typeof: REACT_CONTEXT_TYPE, // As a workaround to support multiple concurrent renderers, we categorize // some renderers as primary and others as secondary. We only expect // there to be two concurrent renderers at most: React Native (primary) and // Fabric (secondary); React DOM (primary) and React ART (secondary). // Secondary renderers store their context values on separate fields. _currentValue: defaultValue, _currentValue2: defaultValue, // Used to track how many concurrent renderers this context currently // supports within in a single renderer. Such as parallel server rendering. _threadCount: 0, // These are circular Provider: null, Consumer: null, // Add these to use same hidden class in VM as ServerContext _defaultValue: null, _globalName: null }; context.Provider = { $$typeof: REACT_PROVIDER_TYPE, _context: context }; var hasWarnedAboutUsingNestedContextConsumers = false; var hasWarnedAboutUsingConsumerProvider = false; var hasWarnedAboutDisplayNameOnConsumer = false; { // A separate object, but proxies back to the original context object for // backwards compatibility. It has a different $$typeof, so we can properly // warn for the incorrect usage of Context as a Consumer. var Consumer = { $$typeof: REACT_CONTEXT_TYPE, _context: context }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here Object.defineProperties(Consumer, { Provider: { get: function () { if (!hasWarnedAboutUsingConsumerProvider) { hasWarnedAboutUsingConsumerProvider = true; error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?'); } return context.Provider; }, set: function (_Provider) { context.Provider = _Provider; } }, _currentValue: { get: function () { return context._currentValue; }, set: function (_currentValue) { context._currentValue = _currentValue; } }, _currentValue2: { get: function () { return context._currentValue2; }, set: function (_currentValue2) { context._currentValue2 = _currentValue2; } }, _threadCount: { get: function () { return context._threadCount; }, set: function (_threadCount) { context._threadCount = _threadCount; } }, Consumer: { get: function () { if (!hasWarnedAboutUsingNestedContextConsumers) { hasWarnedAboutUsingNestedContextConsumers = true; error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?'); } return context.Consumer; } }, displayName: { get: function () { return context.displayName; }, set: function (displayName) { if (!hasWarnedAboutDisplayNameOnConsumer) { warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName); hasWarnedAboutDisplayNameOnConsumer = true; } } } }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty context.Consumer = Consumer; } { context._currentRenderer = null; context._currentRenderer2 = null; } return context; } var Uninitialized = -1; var Pending = 0; var Resolved = 1; var Rejected = 2; function lazyInitializer(payload) { if (payload._status === Uninitialized) { var ctor = payload._result; var thenable = ctor(); // Transition to the next state. // This might throw either because it's missing or throws. If so, we treat it // as still uninitialized and try again next time. Which is the same as what // happens if the ctor or any wrappers processing the ctor throws. This might // end up fixing it if the resolution was a concurrency bug. thenable.then(function (moduleObject) { if (payload._status === Pending || payload._status === Uninitialized) { // Transition to the next state. var resolved = payload; resolved._status = Resolved; resolved._result = moduleObject; } }, function (error) { if (payload._status === Pending || payload._status === Uninitialized) { // Transition to the next state. var rejected = payload; rejected._status = Rejected; rejected._result = error; } }); if (payload._status === Uninitialized) { // In case, we're still uninitialized, then we're waiting for the thenable // to resolve. Set it as pending in the meantime. var pending = payload; pending._status = Pending; pending._result = thenable; } } if (payload._status === Resolved) { var moduleObject = payload._result; { if (moduleObject === undefined) { error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies. 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject); } } { if (!('default' in moduleObject)) { error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies. 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject); } } return moduleObject.default; } else { throw payload._result; } } function lazy(ctor) { var payload = { // We use these fields to store the result. _status: Uninitialized, _result: ctor }; var lazyType = { $$typeof: REACT_LAZY_TYPE, _payload: payload, _init: lazyInitializer }; { // In production, this would just set it on the object. var defaultProps; var propTypes; // $FlowFixMe Object.defineProperties(lazyType, { defaultProps: { configurable: true, get: function () { return defaultProps; }, set: function (newDefaultProps) { error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); defaultProps = newDefaultProps; // Match production behavior more closely: // $FlowFixMe Object.defineProperty(lazyType, 'defaultProps', { enumerable: true }); } }, propTypes: { configurable: true, get: function () { return propTypes; }, set: function (newPropTypes) { error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); propTypes = newPropTypes; // Match production behavior more closely: // $FlowFixMe Object.defineProperty(lazyType, 'propTypes', { enumerable: true }); } } }); } return lazyType; } function forwardRef(render) { { if (render != null && render.$$typeof === REACT_MEMO_TYPE) { error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).'); } else if (typeof render !== 'function') { error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render); } else { if (render.length !== 0 && render.length !== 2) { error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.'); } } if (render != null) { if (render.defaultProps != null || render.propTypes != null) { error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?'); } } } var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render: render }; { var ownName; Object.defineProperty(elementType, 'displayName', { enumerable: false, configurable: true, get: function () { return ownName; }, set: function (name) { ownName = name; // The inner component shouldn't inherit this display name in most cases, // because the component may be used elsewhere. // But it's nice for anonymous functions to inherit the name, // so that our component-stack generation logic will display their frames. // An anonymous function generally suggests a pattern like: // React.forwardRef((props, ref) => {...}); // This kind of inner function is not used elsewhere so the side effect is okay. if (!render.name && !render.displayName) { render.displayName = name; } } }); } return elementType; } var REACT_MODULE_REFERENCE; { REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); } function isValidElementType(type) { if (typeof type === 'string' || typeof type === 'function') { return true; } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { return true; } if (typeof type === 'object' && type !== null) { if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { return true; } } return false; } function memo(type, compare) { { if (!isValidElementType(type)) { error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type); } } var elementType = { $$typeof: REACT_MEMO_TYPE, type: type, compare: compare === undefined ? null : compare }; { var ownName; Object.defineProperty(elementType, 'displayName', { enumerable: false, configurable: true, get: function () { return ownName; }, set: function (name) { ownName = name; // The inner component shouldn't inherit this display name in most cases, // because the component may be used elsewhere. // But it's nice for anonymous functions to inherit the name, // so that our component-stack generation logic will display their frames. // An anonymous function generally suggests a pattern like: // React.memo((props) => {...}); // This kind of inner function is not used elsewhere so the side effect is okay. if (!type.name && !type.displayName) { type.displayName = name; } } }); } return elementType; } function resolveDispatcher() { var dispatcher = ReactCurrentDispatcher.current; { if (dispatcher === null) { error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.'); } } // Will result in a null access error if accessed outside render phase. We // intentionally don't throw our own error because this is in a hot path. // Also helps ensure this is inlined. return dispatcher; } function useContext(Context) { var dispatcher = resolveDispatcher(); { // TODO: add a more generic warning for invalid values. if (Context._context !== undefined) { var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs // and nobody should be using this in existing code. if (realContext.Consumer === Context) { error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?'); } else if (realContext.Provider === Context) { error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?'); } } } return dispatcher.useContext(Context); } function useState(initialState) { var dispatcher = resolveDispatcher(); return dispatcher.useState(initialState); } function useReducer(reducer, initialArg, init) { var dispatcher = resolveDispatcher(); return dispatcher.useReducer(reducer, initialArg, init); } function useRef(initialValue) { var dispatcher = resolveDispatcher(); return dispatcher.useRef(initialValue); } function useEffect(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useEffect(create, deps); } function useInsertionEffect(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useInsertionEffect(create, deps); } function useLayoutEffect(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useLayoutEffect(create, deps); } function useCallback(callback, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useCallback(callback, deps); } function useMemo(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useMemo(create, deps); } function useImperativeHandle(ref, create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useImperativeHandle(ref, create, deps); } function useDebugValue(value, formatterFn) { { var dispatcher = resolveDispatcher(); return dispatcher.useDebugValue(value, formatterFn); } } function useTransition() { var dispatcher = resolveDispatcher(); return dispatcher.useTransition(); } function useDeferredValue(value) { var dispatcher = resolveDispatcher(); return dispatcher.useDeferredValue(value); } function useId() { var dispatcher = resolveDispatcher(); return dispatcher.useId(); } function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { var dispatcher = resolveDispatcher(); return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); } // Helpers to patch console.logs to avoid logging during side-effect free // replaying on render function. This currently only patches the object // lazily which won't cover if the log function was extracted eagerly. // We could also eagerly patch the method. var disabledDepth = 0; var prevLog; var prevInfo; var prevWarn; var prevError; var prevGroup; var prevGroupCollapsed; var prevGroupEnd; function disabledLog() {} disabledLog.__reactDisabledLog = true; function disableLogs() { { if (disabledDepth === 0) { /* eslint-disable react-internal/no-production-logging */ prevLog = console.log; prevInfo = console.info; prevWarn = console.warn; prevError = console.error; prevGroup = console.group; prevGroupCollapsed = console.groupCollapsed; prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 var props = { configurable: true, enumerable: true, value: disabledLog, writable: true }; // $FlowFixMe Flow thinks console is immutable. Object.defineProperties(console, { info: props, log: props, warn: props, error: props, group: props, groupCollapsed: props, groupEnd: props }); /* eslint-enable react-internal/no-production-logging */ } disabledDepth++; } } function reenableLogs() { { disabledDepth--; if (disabledDepth === 0) { /* eslint-disable react-internal/no-production-logging */ var props = { configurable: true, enumerable: true, writable: true }; // $FlowFixMe Flow thinks console is immutable. Object.defineProperties(console, { log: assign({}, props, { value: prevLog }), info: assign({}, props, { value: prevInfo }), warn: assign({}, props, { value: prevWarn }), error: assign({}, props, { value: prevError }), group: assign({}, props, { value: prevGroup }), groupCollapsed: assign({}, props, { value: prevGroupCollapsed }), groupEnd: assign({}, props, { value: prevGroupEnd }) }); /* eslint-enable react-internal/no-production-logging */ } if (disabledDepth < 0) { error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); } } } var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher; var prefix; function describeBuiltInComponentFrame(name, source, ownerFn) { { if (prefix === undefined) { // Extract the VM specific prefix used by each line. try { throw Error(); } catch (x) { var match = x.stack.trim().match(/\n( *(at )?)/); prefix = match && match[1] || ''; } } // We use the prefix to ensure our stacks line up with native stack frames. return '\n' + prefix + name; } } var reentry = false; var componentFrameCache; { var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; componentFrameCache = new PossiblyWeakMap(); } function describeNativeComponentFrame(fn, construct) { // If something asked for a stack inside a fake render, it should get ignored. if ( !fn || reentry) { return ''; } { var frame = componentFrameCache.get(fn); if (frame !== undefined) { return frame; } } var control; reentry = true; var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. Error.prepareStackTrace = undefined; var previousDispatcher; { previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function // for warnings. ReactCurrentDispatcher$1.current = null; disableLogs(); } try { // This should throw. if (construct) { // Something should be setting the props in the constructor. var Fake = function () { throw Error(); }; // $FlowFixMe Object.defineProperty(Fake.prototype, 'props', { set: function () { // We use a throwing setter instead of frozen or non-writable props // because that won't throw in a non-strict mode function. throw Error(); } }); if (typeof Reflect === 'object' && Reflect.construct) { // We construct a different control for this case to include any extra // frames added by the construct call. try { Reflect.construct(Fake, []); } catch (x) { control = x; } Reflect.construct(fn, [], Fake); } else { try { Fake.call(); } catch (x) { control = x; } fn.call(Fake.prototype); } } else { try { throw Error(); } catch (x) { control = x; } fn(); } } catch (sample) { // This is inlined manually because closure doesn't do it for us. if (sample && control && typeof sample.stack === 'string') { // This extracts the first frame from the sample that isn't also in the control. // Skipping one frame that we assume is the frame that calls the two. var sampleLines = sample.stack.split('\n'); var controlLines = control.stack.split('\n'); var s = sampleLines.length - 1; var c = controlLines.length - 1; while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { // We expect at least one stack frame to be shared. // Typically this will be the root most one. However, stack frames may be // cut off due to maximum stack limits. In this case, one maybe cut off // earlier than the other. We assume that the sample is longer or the same // and there for cut off earlier. So we should find the root most frame in // the sample somewhere in the control. c--; } for (; s >= 1 && c >= 0; s--, c--) { // Next we find the first one that isn't the same which should be the // frame that called our sample function and the control. if (sampleLines[s] !== controlLines[c]) { // In V8, the first line is describing the message but other VMs don't. // If we're about to return the first line, and the control is also on the same // line, that's a pretty good indicator that our sample threw at same line as // the control. I.e. before we entered the sample frame. So we ignore this result. // This can happen if you passed a class to function component, or non-function. if (s !== 1 || c !== 1) { do { s--; c--; // We may still have similar intermediate frames from the construct call. // The next one that isn't the same should be our match though. if (c < 0 || sampleLines[s] !== controlLines[c]) { // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>" // but we have a user-provided "displayName" // splice it in to make the stack more readable. if (fn.displayName && _frame.includes('<anonymous>')) { _frame = _frame.replace('<anonymous>', fn.displayName); } { if (typeof fn === 'function') { componentFrameCache.set(fn, _frame); } } // Return the line we found. return _frame; } } while (s >= 1 && c >= 0); } break; } } } } finally { reentry = false; { ReactCurrentDispatcher$1.current = previousDispatcher; reenableLogs(); } Error.prepareStackTrace = previousPrepareStackTrace; } // Fallback to just using the name if we couldn't make it throw. var name = fn ? fn.displayName || fn.name : ''; var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; { if (typeof fn === 'function') { componentFrameCache.set(fn, syntheticFrame); } } return syntheticFrame; } function describeFunctionComponentFrame(fn, source, ownerFn) { { return describeNativeComponentFrame(fn, false); } } function shouldConstruct(Component) { var prototype = Component.prototype; return !!(prototype && prototype.isReactComponent); } function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { if (type == null) { return ''; } if (typeof type === 'function') { { return describeNativeComponentFrame(type, shouldConstruct(type)); } } if (typeof type === 'string') { return describeBuiltInComponentFrame(type); } switch (type) { case REACT_SUSPENSE_TYPE: return describeBuiltInComponentFrame('Suspense'); case REACT_SUSPENSE_LIST_TYPE: return describeBuiltInComponentFrame('SuspenseList'); } if (typeof type === 'object') { switch (type.$$typeof) { case REACT_FORWARD_REF_TYPE: return describeFunctionComponentFrame(type.render); case REACT_MEMO_TYPE: // Memo may contain any component type so we recursively resolve it. return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); case REACT_LAZY_TYPE: { var lazyComponent = type; var payload = lazyComponent._payload; var init = lazyComponent._init; try { // Lazy may contain any component type so we recursively resolve it. return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); } catch (x) {} } } } return ''; } var loggedTypeFailures = {}; var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; function setCurrentlyValidatingElement(element) { { if (element) { var owner = element._owner; var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); ReactDebugCurrentFrame$1.setExtraStackFrame(stack); } else { ReactDebugCurrentFrame$1.setExtraStackFrame(null); } } } function checkPropTypes(typeSpecs, values, location, componentName, element) { { // $FlowFixMe This is okay but Flow doesn't know it. var has = Function.call.bind(hasOwnProperty); for (var typeSpecName in typeSpecs) { if (has(typeSpecs, typeSpecName)) { var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to // fail the render phase where it didn't fail before. So we log it. // After these have been cleaned up, we'll let them throw. try { // This is intentionally an invariant that gets caught. It's the same // behavior as without this statement except with a better message. if (typeof typeSpecs[typeSpecName] !== 'function') { // eslint-disable-next-line react-internal/prod-error-codes var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); err.name = 'Invariant Violation'; throw err; } error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); } catch (ex) { error$1 = ex; } if (error$1 && !(error$1 instanceof Error)) { setCurrentlyValidatingElement(element); error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); setCurrentlyValidatingElement(null); } if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { // Only monitor this failure once because there tends to be a lot of the // same error. loggedTypeFailures[error$1.message] = true; setCurrentlyValidatingElement(element); error('Failed %s type: %s', location, error$1.message); setCurrentlyValidatingElement(null); } } } } } function setCurrentlyValidatingElement$1(element) { { if (element) { var owner = element._owner; var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); setExtraStackFrame(stack); } else { setExtraStackFrame(null); } } } var propTypesMisspellWarningShown; { propTypesMisspellWarningShown = false; } function getDeclarationErrorAddendum() { if (ReactCurrentOwner.current) { var name = getComponentNameFromType(ReactCurrentOwner.current.type); if (name) { return '\n\nCheck the render method of `' + name + '`.'; } } return ''; } function getSourceInfoErrorAddendum(source) { if (source !== undefined) { var fileName = source.fileName.replace(/^.*[\\\/]/, ''); var lineNumber = source.lineNumber; return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; } return ''; } function getSourceInfoErrorAddendumForProps(elementProps) { if (elementProps !== null && elementProps !== undefined) { return getSourceInfoErrorAddendum(elementProps.__source); } return ''; } /** * Warn if there's no key explicitly set on dynamic arrays of children or * object keys are not valid. This allows us to keep track of children between * updates. */ var ownerHasKeyUseWarning = {}; function getCurrentComponentErrorInfo(parentType) { var info = getDeclarationErrorAddendum(); if (!info) { var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; if (parentName) { info = "\n\nCheck the top-level render call using <" + parentName + ">."; } } return info; } /** * Warn if the element doesn't have an explicit key assigned to it. * This element is in an array. The array could grow and shrink or be * reordered. All children that haven't already been validated are required to * have a "key" property assigned to it. Error statuses are cached so a warning * will only be shown once. * * @internal * @param {ReactElement} element Element that requires a key. * @param {*} parentType element's parent's type. */ function validateExplicitKey(element, parentType) { if (!element._store || element._store.validated || element.key != null) { return; } element._store.validated = true; var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { return; } ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a // property, it may be the creator of the child that's responsible for // assigning it a key. var childOwner = ''; if (element && element._owner && element._owner !== ReactCurrentOwner.current) { // Give the component that originally created this child. childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + "."; } { setCurrentlyValidatingElement$1(element); error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); setCurrentlyValidatingElement$1(null); } } /** * Ensure that every element either is passed in a static location, in an * array with an explicit keys property defined, or in an object literal * with valid key property. * * @internal * @param {ReactNode} node Statically passed child of any type. * @param {*} parentType node's parent's type. */ function validateChildKeys(node, parentType) { if (typeof node !== 'object') { return; } if (isArray(node)) { for (var i = 0; i < node.length; i++) { var child = node[i]; if (isValidElement(child)) { validateExplicitKey(child, parentType); } } } else if (isValidElement(node)) { // This element was passed in a valid location. if (node._store) { node._store.validated = true; } } else if (node) { var iteratorFn = getIteratorFn(node); if (typeof iteratorFn === 'function') { // Entry iterators used to provide implicit keys, // but now we print a separate warning for them later. if (iteratorFn !== node.entries) { var iterator = iteratorFn.call(node); var step; while (!(step = iterator.next()).done) { if (isValidElement(step.value)) { validateExplicitKey(step.value, parentType); } } } } } } /** * Given an element, validate that its props follow the propTypes definition, * provided by the type. * * @param {ReactElement} element */ function validatePropTypes(element) { { var type = element.type; if (type === null || type === undefined || typeof type === 'string') { return; } var propTypes; if (typeof type === 'function') { propTypes = type.propTypes; } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. type.$$typeof === REACT_MEMO_TYPE)) { propTypes = type.propTypes; } else { return; } if (propTypes) { // Intentionally inside to avoid triggering lazy initializers: var name = getComponentNameFromType(type); checkPropTypes(propTypes, element.props, 'prop', name, element); } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers: var _name = getComponentNameFromType(type); error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); } if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); } } } /** * Given a fragment, validate that it can only be provided with fragment props * @param {ReactElement} fragment */ function validateFragmentProps(fragment) { { var keys = Object.keys(fragment.props); for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (key !== 'children' && key !== 'key') { setCurrentlyValidatingElement$1(fragment); error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); setCurrentlyValidatingElement$1(null); break; } } if (fragment.ref !== null) { setCurrentlyValidatingElement$1(fragment); error('Invalid attribute `ref` supplied to `React.Fragment`.'); setCurrentlyValidatingElement$1(null); } } } function createElementWithValidation(type, props, children) { var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to // succeed and there will likely be errors in render. if (!validType) { var info = ''; if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; } var sourceInfo = getSourceInfoErrorAddendumForProps(props); if (sourceInfo) { info += sourceInfo; } else { info += getDeclarationErrorAddendum(); } var typeString; if (type === null) { typeString = 'null'; } else if (isArray(type)) { typeString = 'array'; } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; info = ' Did you accidentally export a JSX literal instead of a component?'; } else { typeString = typeof type; } { error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); } } var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used. // TODO: Drop this when these are no longer allowed as the type argument. if (element == null) { return element; } // Skip key warning if the type isn't valid since our key validation logic // doesn't expect a non-string/function type and can throw confusing errors. // We don't want exception behavior to differ between dev and prod. // (Rendering will throw with a helpful message and as soon as the type is // fixed, the key warnings will appear.) if (validType) { for (var i = 2; i < arguments.length; i++) { validateChildKeys(arguments[i], type); } } if (type === REACT_FRAGMENT_TYPE) { validateFragmentProps(element); } else { validatePropTypes(element); } return element; } var didWarnAboutDeprecatedCreateFactory = false; function createFactoryWithValidation(type) { var validatedFactory = createElementWithValidation.bind(null, type); validatedFactory.type = type; { if (!didWarnAboutDeprecatedCreateFactory) { didWarnAboutDeprecatedCreateFactory = true; warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.'); } // Legacy hook: remove it Object.defineProperty(validatedFactory, 'type', { enumerable: false, get: function () { warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); Object.defineProperty(this, 'type', { value: type }); return type; } }); } return validatedFactory; } function cloneElementWithValidation(element, props, children) { var newElement = cloneElement.apply(this, arguments); for (var i = 2; i < arguments.length; i++) { validateChildKeys(arguments[i], newElement.type); } validatePropTypes(newElement); return newElement; } var enableSchedulerDebugging = false; var enableProfiling = false; var frameYieldMs = 5; function push(heap, node) { var index = heap.length; heap.push(node); siftUp(heap, node, index); } function peek(heap) { return heap.length === 0 ? null : heap[0]; } function pop(heap) { if (heap.length === 0) { return null; } var first = heap[0]; var last = heap.pop(); if (last !== first) { heap[0] = last; siftDown(heap, last, 0); } return first; } function siftUp(heap, node, i) { var index = i; while (index > 0) { var parentIndex = index - 1 >>> 1; var parent = heap[parentIndex]; if (compare(parent, node) > 0) { // The parent is larger. Swap positions. heap[parentIndex] = node; heap[index] = parent; index = parentIndex; } else { // The parent is smaller. Exit. return; } } } function siftDown(heap, node, i) { var index = i; var length = heap.length; var halfLength = length >>> 1; while (index < halfLength) { var leftIndex = (index + 1) * 2 - 1; var left = heap[leftIndex]; var rightIndex = leftIndex + 1; var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those. if (compare(left, node) < 0) { if (rightIndex < length && compare(right, left) < 0) { heap[index] = right; heap[rightIndex] = node; index = rightIndex; } else { heap[index] = left; heap[leftIndex] = node; index = leftIndex; } } else if (rightIndex < length && compare(right, node) < 0) { heap[index] = right; heap[rightIndex] = node; index = rightIndex; } else { // Neither child is smaller. Exit. return; } } } function compare(a, b) { // Compare sort index first, then task id. var diff = a.sortIndex - b.sortIndex; return diff !== 0 ? diff : a.id - b.id; } // TODO: Use symbols? var ImmediatePriority = 1; var UserBlockingPriority = 2; var NormalPriority = 3; var LowPriority = 4; var IdlePriority = 5; function markTaskErrored(task, ms) { } /* eslint-disable no-var */ var getCurrentTime; var hasPerformanceNow = typeof performance === 'object' && typeof performance.now === 'function'; if (hasPerformanceNow) { var localPerformance = performance; getCurrentTime = function () { return localPerformance.now(); }; } else { var localDate = Date; var initialTime = localDate.now(); getCurrentTime = function () { return localDate.now() - initialTime; }; } // Max 31 bit integer. The max integer size in V8 for 32-bit systems. // Math.pow(2, 30) - 1 // 0b111111111111111111111111111111 var maxSigned31BitInt = 1073741823; // Times out immediately var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out var USER_BLOCKING_PRIORITY_TIMEOUT = 250; var NORMAL_PRIORITY_TIMEOUT = 5000; var LOW_PRIORITY_TIMEOUT = 10000; // Never times out var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap var taskQueue = []; var timerQueue = []; // Incrementing id counter. Used to maintain insertion order. var taskIdCounter = 1; // Pausing the scheduler is useful for debugging. var currentTask = null; var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance. var isPerformingWork = false; var isHostCallbackScheduled = false; var isHostTimeoutScheduled = false; // Capture local references to native APIs, in case a polyfill overrides them. var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null; var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : null; var localSetImmediate = typeof setImmediate !== 'undefined' ? setImmediate : null; // IE and Node.js + jsdom var isInputPending = typeof navigator !== 'undefined' && navigator.scheduling !== undefined && navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null; function advanceTimers(currentTime) { // Check for tasks that are no longer delayed and add them to the queue. var timer = peek(timerQueue); while (timer !== null) { if (timer.callback === null) { // Timer was cancelled. pop(timerQueue); } else if (timer.startTime <= currentTime) { // Timer fired. Transfer to the task queue. pop(timerQueue); timer.sortIndex = timer.expirationTime; push(taskQueue, timer); } else { // Remaining timers are pending. return; } timer = peek(timerQueue); } } function handleTimeout(currentTime) { isHostTimeoutScheduled = false; advanceTimers(currentTime); if (!isHostCallbackScheduled) { if (peek(taskQueue) !== null) { isHostCallbackScheduled = true; requestHostCallback(flushWork); } else { var firstTimer = peek(timerQueue); if (firstTimer !== null) { requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); } } } } function flushWork(hasTimeRemaining, initialTime) { isHostCallbackScheduled = false; if (isHostTimeoutScheduled) { // We scheduled a timeout but it's no longer needed. Cancel it. isHostTimeoutScheduled = false; cancelHostTimeout(); } isPerformingWork = true; var previousPriorityLevel = currentPriorityLevel; try { if (enableProfiling) { try { return workLoop(hasTimeRemaining, initialTime); } catch (error) { if (currentTask !== null) { var currentTime = getCurrentTime(); markTaskErrored(currentTask, currentTime); currentTask.isQueued = false; } throw error; } } else { // No catch in prod code path. return workLoop(hasTimeRemaining, initialTime); } } finally { currentTask = null; currentPriorityLevel = previousPriorityLevel; isPerformingWork = false; } } function workLoop(hasTimeRemaining, initialTime) { var currentTime = initialTime; advanceTimers(currentTime); currentTask = peek(taskQueue); while (currentTask !== null && !(enableSchedulerDebugging )) { if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) { // This currentTask hasn't expired, and we've reached the deadline. break; } var callback = currentTask.callback; if (typeof callback === 'function') { currentTask.callback = null; currentPriorityLevel = currentTask.priorityLevel; var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; var continuationCallback = callback(didUserCallbackTimeout); currentTime = getCurrentTime(); if (typeof continuationCallback === 'function') { currentTask.callback = continuationCallback; } else { if (currentTask === peek(taskQueue)) { pop(taskQueue); } } advanceTimers(currentTime); } else { pop(taskQueue); } currentTask = peek(taskQueue); } // Return whether there's additional work if (currentTask !== null) { return true; } else { var firstTimer = peek(timerQueue); if (firstTimer !== null) { requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); } return false; } } function unstable_runWithPriority(priorityLevel, eventHandler) { switch (priorityLevel) { case ImmediatePriority: case UserBlockingPriority: case NormalPriority: case LowPriority: case IdlePriority: break; default: priorityLevel = NormalPriority; } var previousPriorityLevel = currentPriorityLevel; currentPriorityLevel = priorityLevel; try { return eventHandler(); } finally { currentPriorityLevel = previousPriorityLevel; } } function unstable_next(eventHandler) { var priorityLevel; switch (currentPriorityLevel) { case ImmediatePriority: case UserBlockingPriority: case NormalPriority: // Shift down to normal priority priorityLevel = NormalPriority; break; default: // Anything lower than normal priority should remain at the current level. priorityLevel = currentPriorityLevel; break; } var previousPriorityLevel = currentPriorityLevel; currentPriorityLevel = priorityLevel; try { return eventHandler(); } finally { currentPriorityLevel = previousPriorityLevel; } } function unstable_wrapCallback(callback) { var parentPriorityLevel = currentPriorityLevel; return function () { // This is a fork of runWithPriority, inlined for performance. var previousPriorityLevel = currentPriorityLevel; currentPriorityLevel = parentPriorityLevel; try { return callback.apply(this, arguments); } finally { currentPriorityLevel = previousPriorityLevel; } }; } function unstable_scheduleCallback(priorityLevel, callback, options) { var currentTime = getCurrentTime(); var startTime; if (typeof options === 'object' && options !== null) { var delay = options.delay; if (typeof delay === 'number' && delay > 0) { startTime = currentTime + delay; } else { startTime = currentTime; } } else { startTime = currentTime; } var timeout; switch (priorityLevel) { case ImmediatePriority: timeout = IMMEDIATE_PRIORITY_TIMEOUT; break; case UserBlockingPriority: timeout = USER_BLOCKING_PRIORITY_TIMEOUT; break; case IdlePriority: timeout = IDLE_PRIORITY_TIMEOUT; break; case LowPriority: timeout = LOW_PRIORITY_TIMEOUT; break; case NormalPriority: default: timeout = NORMAL_PRIORITY_TIMEOUT; break; } var expirationTime = startTime + timeout; var newTask = { id: taskIdCounter++, callback: callback, priorityLevel: priorityLevel, startTime: startTime, expirationTime: expirationTime, sortIndex: -1 }; if (startTime > currentTime) { // This is a delayed task. newTask.sortIndex = startTime; push(timerQueue, newTask); if (peek(taskQueue) === null && newTask === peek(timerQueue)) { // All tasks are delayed, and this is the task with the earliest delay. if (isHostTimeoutScheduled) { // Cancel an existing timeout. cancelHostTimeout(); } else { isHostTimeoutScheduled = true; } // Schedule a timeout. requestHostTimeout(handleTimeout, startTime - currentTime); } } else { newTask.sortIndex = expirationTime; push(taskQueue, newTask); // wait until the next time we yield. if (!isHostCallbackScheduled && !isPerformingWork) { isHostCallbackScheduled = true; requestHostCallback(flushWork); } } return newTask; } function unstable_pauseExecution() { } function unstable_continueExecution() { if (!isHostCallbackScheduled && !isPerformingWork) { isHostCallbackScheduled = true; requestHostCallback(flushWork); } } function unstable_getFirstCallbackNode() { return peek(taskQueue); } function unstable_cancelCallback(task) { // remove from the queue because you can't remove arbitrary nodes from an // array based heap, only the first one.) task.callback = null; } function unstable_getCurrentPriorityLevel() { return currentPriorityLevel; } var isMessageLoopRunning = false; var scheduledHostCallback = null; var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main // thread, like user events. By default, it yields multiple times per frame. // It does not attempt to align with frame boundaries, since most tasks don't // need to be frame aligned; for those that do, use requestAnimationFrame. var frameInterval = frameYieldMs; var startTime = -1; function shouldYieldToHost() { var timeElapsed = getCurrentTime() - startTime; if (timeElapsed < frameInterval) { // The main thread has only been blocked for a really short amount of time; // smaller than a single frame. Don't yield yet. return false; } // The main thread has been blocked for a non-negligible amount of time. We return true; } function requestPaint() { } function forceFrameRate(fps) { if (fps < 0 || fps > 125) { // Using console['error'] to evade Babel and ESLint console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing frame rates higher than 125 fps is not supported'); return; } if (fps > 0) { frameInterval = Math.floor(1000 / fps); } else { // reset the framerate frameInterval = frameYieldMs; } } var performWorkUntilDeadline = function () { if (scheduledHostCallback !== null) { var currentTime = getCurrentTime(); // Keep track of the start time so we can measure how long the main thread // has been blocked. startTime = currentTime; var hasTimeRemaining = true; // If a scheduler task throws, exit the current browser task so the // error can be observed. // // Intentionally not using a try-catch, since that makes some debugging // techniques harder. Instead, if `scheduledHostCallback` errors, then // `hasMoreWork` will remain true, and we'll continue the work loop. var hasMoreWork = true; try { hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime); } finally { if (hasMoreWork) { // If there's more work, schedule the next message event at the end // of the preceding one. schedulePerformWorkUntilDeadline(); } else { isMessageLoopRunning = false; scheduledHostCallback = null; } } } else { isMessageLoopRunning = false; } // Yielding to the browser will give it a chance to paint, so we can }; var schedulePerformWorkUntilDeadline; if (typeof localSetImmediate === 'function') { // Node.js and old IE. // There's a few reasons for why we prefer setImmediate. // // Unlike MessageChannel, it doesn't prevent a Node.js process from exiting. // (Even though this is a DOM fork of the Scheduler, you could get here // with a mix of Node.js 15+, which has a MessageChannel, and jsdom.) // https://github.com/facebook/react/issues/20756 // // But also, it runs earlier which is the semantic we want. // If other browsers ever implement it, it's better to use it. // Although both of these would be inferior to native scheduling. schedulePerformWorkUntilDeadline = function () { localSetImmediate(performWorkUntilDeadline); }; } else if (typeof MessageChannel !== 'undefined') { // DOM and Worker environments. // We prefer MessageChannel because of the 4ms setTimeout clamping. var channel = new MessageChannel(); var port = channel.port2; channel.port1.onmessage = performWorkUntilDeadline; schedulePerformWorkUntilDeadline = function () { port.postMessage(null); }; } else { // We should only fallback here in non-browser environments. schedulePerformWorkUntilDeadline = function () { localSetTimeout(performWorkUntilDeadline, 0); }; } function requestHostCallback(callback) { scheduledHostCallback = callback; if (!isMessageLoopRunning) { isMessageLoopRunning = true; schedulePerformWorkUntilDeadline(); } } function requestHostTimeout(callback, ms) { taskTimeoutID = localSetTimeout(function () { callback(getCurrentTime()); }, ms); } function cancelHostTimeout() { localClearTimeout(taskTimeoutID); taskTimeoutID = -1; } var unstable_requestPaint = requestPaint; var unstable_Profiling = null; var Scheduler = /*#__PURE__*/Object.freeze({ __proto__: null, unstable_ImmediatePriority: ImmediatePriority, unstable_UserBlockingPriority: UserBlockingPriority, unstable_NormalPriority: NormalPriority, unstable_IdlePriority: IdlePriority, unstable_LowPriority: LowPriority, unstable_runWithPriority: unstable_runWithPriority, unstable_next: unstable_next, unstable_scheduleCallback: unstable_scheduleCallback, unstable_cancelCallback: unstable_cancelCallback, unstable_wrapCallback: unstable_wrapCallback, unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel, unstable_shouldYield: shouldYieldToHost, unstable_requestPaint: unstable_requestPaint, unstable_continueExecution: unstable_continueExecution, unstable_pauseExecution: unstable_pauseExecution, unstable_getFirstCallbackNode: unstable_getFirstCallbackNode, get unstable_now () { return getCurrentTime; }, unstable_forceFrameRate: forceFrameRate, unstable_Profiling: unstable_Profiling }); var ReactSharedInternals$1 = { ReactCurrentDispatcher: ReactCurrentDispatcher, ReactCurrentOwner: ReactCurrentOwner, ReactCurrentBatchConfig: ReactCurrentBatchConfig, // Re-export the schedule API(s) for UMD bundles. // This avoids introducing a dependency on a new UMD global in a minor update, // Since that would be a breaking change (e.g. for all existing CodeSandboxes). // This re-export is only required for UMD bundles; // CJS bundles use the shared NPM package. Scheduler: Scheduler }; { ReactSharedInternals$1.ReactCurrentActQueue = ReactCurrentActQueue; ReactSharedInternals$1.ReactDebugCurrentFrame = ReactDebugCurrentFrame; } function startTransition(scope, options) { var prevTransition = ReactCurrentBatchConfig.transition; ReactCurrentBatchConfig.transition = {}; var currentTransition = ReactCurrentBatchConfig.transition; { ReactCurrentBatchConfig.transition._updatedFibers = new Set(); } try { scope(); } finally { ReactCurrentBatchConfig.transition = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { var updatedFibersCount = currentTransition._updatedFibers.size; if (updatedFibersCount > 10) { warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.'); } currentTransition._updatedFibers.clear(); } } } } var didWarnAboutMessageChannel = false; var enqueueTaskImpl = null; function enqueueTask(task) { if (enqueueTaskImpl === null) { try { // read require off the module object to get around the bundlers. // we don't want them to detect a require and bundle a Node polyfill. var requireString = ('require' + Math.random()).slice(0, 7); var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's // version of setImmediate, bypassing fake timers if any. enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate; } catch (_err) { // we're in a browser // we can't use regular timers because they may still be faked // so we try MessageChannel+postMessage instead enqueueTaskImpl = function (callback) { { if (didWarnAboutMessageChannel === false) { didWarnAboutMessageChannel = true; if (typeof MessageChannel === 'undefined') { error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'); } } } var channel = new MessageChannel(); channel.port1.onmessage = callback; channel.port2.postMessage(undefined); }; } } return enqueueTaskImpl(task); } var actScopeDepth = 0; var didWarnNoAwaitAct = false; function act(callback) { { // `act` calls can be nested, so we track the depth. This represents the // number of `act` scopes on the stack. var prevActScopeDepth = actScopeDepth; actScopeDepth++; if (ReactCurrentActQueue.current === null) { // This is the outermost `act` scope. Initialize the queue. The reconciler // will detect the queue and use it instead of Scheduler. ReactCurrentActQueue.current = []; } var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy; var result; try { // Used to reproduce behavior of `batchedUpdates` in legacy mode. Only // set to `true` while the given callback is executed, not for updates // triggered during an async event, because this is how the legacy // implementation of `act` behaved. ReactCurrentActQueue.isBatchingLegacy = true; result = callback(); // Replicate behavior of original `act` implementation in legacy mode, // which flushed updates immediately after the scope function exits, even // if it's an async function. if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) { var queue = ReactCurrentActQueue.current; if (queue !== null) { ReactCurrentActQueue.didScheduleLegacyUpdate = false; flushActQueue(queue); } } } catch (error) { popActScope(prevActScopeDepth); throw error; } finally { ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy; } if (result !== null && typeof result === 'object' && typeof result.then === 'function') { var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait // for it to resolve before exiting the current scope. var wasAwaited = false; var thenable = { then: function (resolve, reject) { wasAwaited = true; thenableResult.then(function (returnValue) { popActScope(prevActScopeDepth); if (actScopeDepth === 0) { // We've exited the outermost act scope. Recursively flush the // queue until there's no remaining work. recursivelyFlushAsyncActWork(returnValue, resolve, reject); } else { resolve(returnValue); } }, function (error) { // The callback threw an error. popActScope(prevActScopeDepth); reject(error); }); } }; { if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') { // eslint-disable-next-line no-undef Promise.resolve().then(function () {}).then(function () { if (!wasAwaited) { didWarnNoAwaitAct = true; error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);'); } }); } } return thenable; } else { var returnValue = result; // The callback is not an async function. Exit the current scope // immediately, without awaiting. popActScope(prevActScopeDepth); if (actScopeDepth === 0) { // Exiting the outermost act scope. Flush the queue. var _queue = ReactCurrentActQueue.current; if (_queue !== null) { flushActQueue(_queue); ReactCurrentActQueue.current = null; } // Return a thenable. If the user awaits it, we'll flush again in // case additional work was scheduled by a microtask. var _thenable = { then: function (resolve, reject) { // Confirm we haven't re-entered another `act` scope, in case // the user does something weird like await the thenable // multiple times. if (ReactCurrentActQueue.current === null) { // Recursively flush the queue until there's no remaining work. ReactCurrentActQueue.current = []; recursivelyFlushAsyncActWork(returnValue, resolve, reject); } else { resolve(returnValue); } } }; return _thenable; } else { // Since we're inside a nested `act` scope, the returned thenable // immediately resolves. The outer scope will flush the queue. var _thenable2 = { then: function (resolve, reject) { resolve(returnValue); } }; return _thenable2; } } } } function popActScope(prevActScopeDepth) { { if (prevActScopeDepth !== actScopeDepth - 1) { error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. '); } actScopeDepth = prevActScopeDepth; } } function recursivelyFlushAsyncActWork(returnValue, resolve, reject) { { var queue = ReactCurrentActQueue.current; if (queue !== null) { try { flushActQueue(queue); enqueueTask(function () { if (queue.length === 0) { // No additional work was scheduled. Finish. ReactCurrentActQueue.current = null; resolve(returnValue); } else { // Keep flushing work until there's none left. recursivelyFlushAsyncActWork(returnValue, resolve, reject); } }); } catch (error) { reject(error); } } else { resolve(returnValue); } } } var isFlushing = false; function flushActQueue(queue) { { if (!isFlushing) { // Prevent re-entrance. isFlushing = true; var i = 0; try { for (; i < queue.length; i++) { var callback = queue[i]; do { callback = callback(true); } while (callback !== null); } queue.length = 0; } catch (error) { // If something throws, leave the remaining callbacks on the queue. queue = queue.slice(i + 1); throw error; } finally { isFlushing = false; } } } } var createElement$1 = createElementWithValidation ; var cloneElement$1 = cloneElementWithValidation ; var createFactory = createFactoryWithValidation ; var Children = { map: mapChildren, forEach: forEachChildren, count: countChildren, toArray: toArray, only: onlyChild }; exports.Children = Children; exports.Component = Component; exports.Fragment = REACT_FRAGMENT_TYPE; exports.Profiler = REACT_PROFILER_TYPE; exports.PureComponent = PureComponent; exports.StrictMode = REACT_STRICT_MODE_TYPE; exports.Suspense = REACT_SUSPENSE_TYPE; exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals$1; exports.act = act; exports.cloneElement = cloneElement$1; exports.createContext = createContext; exports.createElement = createElement$1; exports.createFactory = createFactory; exports.createRef = createRef; exports.forwardRef = forwardRef; exports.isValidElement = isValidElement; exports.lazy = lazy; exports.memo = memo; exports.startTransition = startTransition; exports.unstable_act = act; exports.useCallback = useCallback; exports.useContext = useContext; exports.useDebugValue = useDebugValue; exports.useDeferredValue = useDeferredValue; exports.useEffect = useEffect; exports.useId = useId; exports.useImperativeHandle = useImperativeHandle; exports.useInsertionEffect = useInsertionEffect; exports.useLayoutEffect = useLayoutEffect; exports.useMemo = useMemo; exports.useReducer = useReducer; exports.useRef = useRef; exports.useState = useState; exports.useSyncExternalStore = useSyncExternalStore; exports.useTransition = useTransition; exports.version = ReactVersion; }))); vendor/react-jsx-runtime.js 0000644 00000134254 15151622574 0012001 0 ustar 00 /* * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). * This devtool is neither made for production nor for readable output files. * It uses "eval()" calls to create a separate source file in the browser devtools. * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ "./node_modules/react/cjs/react-jsx-runtime.development.js": /*!*****************************************************************!*\ !*** ./node_modules/react/cjs/react-jsx-runtime.development.js ***! \*****************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { eval("/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\nif (true) {\n (function() {\n'use strict';\n\nvar React = __webpack_require__(/*! react */ \"react\");\n\n// ATTENTION\n// When adding new symbols to this file,\n// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'\n// The Symbol used to tag the ReactElement-like types.\nvar REACT_ELEMENT_TYPE = Symbol.for('react.element');\nvar REACT_PORTAL_TYPE = Symbol.for('react.portal');\nvar REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');\nvar REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');\nvar REACT_PROFILER_TYPE = Symbol.for('react.profiler');\nvar REACT_PROVIDER_TYPE = Symbol.for('react.provider');\nvar REACT_CONTEXT_TYPE = Symbol.for('react.context');\nvar REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');\nvar REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');\nvar REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');\nvar REACT_MEMO_TYPE = Symbol.for('react.memo');\nvar REACT_LAZY_TYPE = Symbol.for('react.lazy');\nvar REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');\nvar MAYBE_ITERATOR_SYMBOL = Symbol.iterator;\nvar FAUX_ITERATOR_SYMBOL = '@@iterator';\nfunction getIteratorFn(maybeIterable) {\n if (maybeIterable === null || typeof maybeIterable !== 'object') {\n return null;\n }\n\n var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];\n\n if (typeof maybeIterator === 'function') {\n return maybeIterator;\n }\n\n return null;\n}\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n// -----------------------------------------------------------------------------\n\nvar enableScopeAPI = false; // Experimental Create Event Handle API.\nvar enableCacheElement = false;\nvar enableTransitionTracing = false; // No known bugs, but needs performance testing\n\nvar enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber\n// stuff. Intended to enable React core members to more easily debug scheduling\n// issues in DEV builds.\n\nvar enableDebugTracing = false; // Track which Fiber(s) schedule render work.\n\nvar REACT_MODULE_REFERENCE;\n\n{\n REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');\n}\n\nfunction isValidElementType(type) {\n if (typeof type === 'string' || typeof type === 'function') {\n return true;\n } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).\n\n\n if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {\n return true;\n }\n\n if (typeof type === 'object' && type !== null) {\n if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object\n // types supported by any Flight configuration anywhere since\n // we don't know which Flight build this will end up being used\n // with.\n type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction getWrappedName(outerType, innerType, wrapperName) {\n var displayName = outerType.displayName;\n\n if (displayName) {\n return displayName;\n }\n\n var functionName = innerType.displayName || innerType.name || '';\n return functionName !== '' ? wrapperName + \"(\" + functionName + \")\" : wrapperName;\n} // Keep in sync with react-reconciler/getComponentNameFromFiber\n\n\nfunction getContextName(type) {\n return type.displayName || 'Context';\n} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.\n\n\nfunction getComponentNameFromType(type) {\n if (type == null) {\n // Host root, text node or just invalid type.\n return null;\n }\n\n {\n if (typeof type.tag === 'number') {\n error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');\n }\n }\n\n if (typeof type === 'function') {\n return type.displayName || type.name || null;\n }\n\n if (typeof type === 'string') {\n return type;\n }\n\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return 'Fragment';\n\n case REACT_PORTAL_TYPE:\n return 'Portal';\n\n case REACT_PROFILER_TYPE:\n return 'Profiler';\n\n case REACT_STRICT_MODE_TYPE:\n return 'StrictMode';\n\n case REACT_SUSPENSE_TYPE:\n return 'Suspense';\n\n case REACT_SUSPENSE_LIST_TYPE:\n return 'SuspenseList';\n\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_CONTEXT_TYPE:\n var context = type;\n return getContextName(context) + '.Consumer';\n\n case REACT_PROVIDER_TYPE:\n var provider = type;\n return getContextName(provider._context) + '.Provider';\n\n case REACT_FORWARD_REF_TYPE:\n return getWrappedName(type, type.render, 'ForwardRef');\n\n case REACT_MEMO_TYPE:\n var outerName = type.displayName || null;\n\n if (outerName !== null) {\n return outerName;\n }\n\n return getComponentNameFromType(type.type) || 'Memo';\n\n case REACT_LAZY_TYPE:\n {\n var lazyComponent = type;\n var payload = lazyComponent._payload;\n var init = lazyComponent._init;\n\n try {\n return getComponentNameFromType(init(payload));\n } catch (x) {\n return null;\n }\n }\n\n // eslint-disable-next-line no-fallthrough\n }\n }\n\n return null;\n}\n\nvar assign = Object.assign;\n\n// Helpers to patch console.logs to avoid logging during side-effect free\n// replaying on render function. This currently only patches the object\n// lazily which won't cover if the log function was extracted eagerly.\n// We could also eagerly patch the method.\nvar disabledDepth = 0;\nvar prevLog;\nvar prevInfo;\nvar prevWarn;\nvar prevError;\nvar prevGroup;\nvar prevGroupCollapsed;\nvar prevGroupEnd;\n\nfunction disabledLog() {}\n\ndisabledLog.__reactDisabledLog = true;\nfunction disableLogs() {\n {\n if (disabledDepth === 0) {\n /* eslint-disable react-internal/no-production-logging */\n prevLog = console.log;\n prevInfo = console.info;\n prevWarn = console.warn;\n prevError = console.error;\n prevGroup = console.group;\n prevGroupCollapsed = console.groupCollapsed;\n prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099\n\n var props = {\n configurable: true,\n enumerable: true,\n value: disabledLog,\n writable: true\n }; // $FlowFixMe Flow thinks console is immutable.\n\n Object.defineProperties(console, {\n info: props,\n log: props,\n warn: props,\n error: props,\n group: props,\n groupCollapsed: props,\n groupEnd: props\n });\n /* eslint-enable react-internal/no-production-logging */\n }\n\n disabledDepth++;\n }\n}\nfunction reenableLogs() {\n {\n disabledDepth--;\n\n if (disabledDepth === 0) {\n /* eslint-disable react-internal/no-production-logging */\n var props = {\n configurable: true,\n enumerable: true,\n writable: true\n }; // $FlowFixMe Flow thinks console is immutable.\n\n Object.defineProperties(console, {\n log: assign({}, props, {\n value: prevLog\n }),\n info: assign({}, props, {\n value: prevInfo\n }),\n warn: assign({}, props, {\n value: prevWarn\n }),\n error: assign({}, props, {\n value: prevError\n }),\n group: assign({}, props, {\n value: prevGroup\n }),\n groupCollapsed: assign({}, props, {\n value: prevGroupCollapsed\n }),\n groupEnd: assign({}, props, {\n value: prevGroupEnd\n })\n });\n /* eslint-enable react-internal/no-production-logging */\n }\n\n if (disabledDepth < 0) {\n error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');\n }\n }\n}\n\nvar ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;\nvar prefix;\nfunction describeBuiltInComponentFrame(name, source, ownerFn) {\n {\n if (prefix === undefined) {\n // Extract the VM specific prefix used by each line.\n try {\n throw Error();\n } catch (x) {\n var match = x.stack.trim().match(/\\n( *(at )?)/);\n prefix = match && match[1] || '';\n }\n } // We use the prefix to ensure our stacks line up with native stack frames.\n\n\n return '\\n' + prefix + name;\n }\n}\nvar reentry = false;\nvar componentFrameCache;\n\n{\n var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;\n componentFrameCache = new PossiblyWeakMap();\n}\n\nfunction describeNativeComponentFrame(fn, construct) {\n // If something asked for a stack inside a fake render, it should get ignored.\n if ( !fn || reentry) {\n return '';\n }\n\n {\n var frame = componentFrameCache.get(fn);\n\n if (frame !== undefined) {\n return frame;\n }\n }\n\n var control;\n reentry = true;\n var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.\n\n Error.prepareStackTrace = undefined;\n var previousDispatcher;\n\n {\n previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function\n // for warnings.\n\n ReactCurrentDispatcher.current = null;\n disableLogs();\n }\n\n try {\n // This should throw.\n if (construct) {\n // Something should be setting the props in the constructor.\n var Fake = function () {\n throw Error();\n }; // $FlowFixMe\n\n\n Object.defineProperty(Fake.prototype, 'props', {\n set: function () {\n // We use a throwing setter instead of frozen or non-writable props\n // because that won't throw in a non-strict mode function.\n throw Error();\n }\n });\n\n if (typeof Reflect === 'object' && Reflect.construct) {\n // We construct a different control for this case to include any extra\n // frames added by the construct call.\n try {\n Reflect.construct(Fake, []);\n } catch (x) {\n control = x;\n }\n\n Reflect.construct(fn, [], Fake);\n } else {\n try {\n Fake.call();\n } catch (x) {\n control = x;\n }\n\n fn.call(Fake.prototype);\n }\n } else {\n try {\n throw Error();\n } catch (x) {\n control = x;\n }\n\n fn();\n }\n } catch (sample) {\n // This is inlined manually because closure doesn't do it for us.\n if (sample && control && typeof sample.stack === 'string') {\n // This extracts the first frame from the sample that isn't also in the control.\n // Skipping one frame that we assume is the frame that calls the two.\n var sampleLines = sample.stack.split('\\n');\n var controlLines = control.stack.split('\\n');\n var s = sampleLines.length - 1;\n var c = controlLines.length - 1;\n\n while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {\n // We expect at least one stack frame to be shared.\n // Typically this will be the root most one. However, stack frames may be\n // cut off due to maximum stack limits. In this case, one maybe cut off\n // earlier than the other. We assume that the sample is longer or the same\n // and there for cut off earlier. So we should find the root most frame in\n // the sample somewhere in the control.\n c--;\n }\n\n for (; s >= 1 && c >= 0; s--, c--) {\n // Next we find the first one that isn't the same which should be the\n // frame that called our sample function and the control.\n if (sampleLines[s] !== controlLines[c]) {\n // In V8, the first line is describing the message but other VMs don't.\n // If we're about to return the first line, and the control is also on the same\n // line, that's a pretty good indicator that our sample threw at same line as\n // the control. I.e. before we entered the sample frame. So we ignore this result.\n // This can happen if you passed a class to function component, or non-function.\n if (s !== 1 || c !== 1) {\n do {\n s--;\n c--; // We may still have similar intermediate frames from the construct call.\n // The next one that isn't the same should be our match though.\n\n if (c < 0 || sampleLines[s] !== controlLines[c]) {\n // V8 adds a \"new\" prefix for native classes. Let's remove it to make it prettier.\n var _frame = '\\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled \"<anonymous>\"\n // but we have a user-provided \"displayName\"\n // splice it in to make the stack more readable.\n\n\n if (fn.displayName && _frame.includes('<anonymous>')) {\n _frame = _frame.replace('<anonymous>', fn.displayName);\n }\n\n {\n if (typeof fn === 'function') {\n componentFrameCache.set(fn, _frame);\n }\n } // Return the line we found.\n\n\n return _frame;\n }\n } while (s >= 1 && c >= 0);\n }\n\n break;\n }\n }\n }\n } finally {\n reentry = false;\n\n {\n ReactCurrentDispatcher.current = previousDispatcher;\n reenableLogs();\n }\n\n Error.prepareStackTrace = previousPrepareStackTrace;\n } // Fallback to just using the name if we couldn't make it throw.\n\n\n var name = fn ? fn.displayName || fn.name : '';\n var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';\n\n {\n if (typeof fn === 'function') {\n componentFrameCache.set(fn, syntheticFrame);\n }\n }\n\n return syntheticFrame;\n}\nfunction describeFunctionComponentFrame(fn, source, ownerFn) {\n {\n return describeNativeComponentFrame(fn, false);\n }\n}\n\nfunction shouldConstruct(Component) {\n var prototype = Component.prototype;\n return !!(prototype && prototype.isReactComponent);\n}\n\nfunction describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {\n\n if (type == null) {\n return '';\n }\n\n if (typeof type === 'function') {\n {\n return describeNativeComponentFrame(type, shouldConstruct(type));\n }\n }\n\n if (typeof type === 'string') {\n return describeBuiltInComponentFrame(type);\n }\n\n switch (type) {\n case REACT_SUSPENSE_TYPE:\n return describeBuiltInComponentFrame('Suspense');\n\n case REACT_SUSPENSE_LIST_TYPE:\n return describeBuiltInComponentFrame('SuspenseList');\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_FORWARD_REF_TYPE:\n return describeFunctionComponentFrame(type.render);\n\n case REACT_MEMO_TYPE:\n // Memo may contain any component type so we recursively resolve it.\n return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);\n\n case REACT_LAZY_TYPE:\n {\n var lazyComponent = type;\n var payload = lazyComponent._payload;\n var init = lazyComponent._init;\n\n try {\n // Lazy may contain any component type so we recursively resolve it.\n return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);\n } catch (x) {}\n }\n }\n }\n\n return '';\n}\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar loggedTypeFailures = {};\nvar ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n\nfunction setCurrentlyValidatingElement(element) {\n {\n if (element) {\n var owner = element._owner;\n var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);\n ReactDebugCurrentFrame.setExtraStackFrame(stack);\n } else {\n ReactDebugCurrentFrame.setExtraStackFrame(null);\n }\n }\n}\n\nfunction checkPropTypes(typeSpecs, values, location, componentName, element) {\n {\n // $FlowFixMe This is okay but Flow doesn't know it.\n var has = Function.call.bind(hasOwnProperty);\n\n for (var typeSpecName in typeSpecs) {\n if (has(typeSpecs, typeSpecName)) {\n var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to\n // fail the render phase where it didn't fail before. So we log it.\n // After these have been cleaned up, we'll let them throw.\n\n try {\n // This is intentionally an invariant that gets caught. It's the same\n // behavior as without this statement except with a better message.\n if (typeof typeSpecs[typeSpecName] !== 'function') {\n // eslint-disable-next-line react-internal/prod-error-codes\n var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');\n err.name = 'Invariant Violation';\n throw err;\n }\n\n error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');\n } catch (ex) {\n error$1 = ex;\n }\n\n if (error$1 && !(error$1 instanceof Error)) {\n setCurrentlyValidatingElement(element);\n\n error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);\n\n setCurrentlyValidatingElement(null);\n }\n\n if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {\n // Only monitor this failure once because there tends to be a lot of the\n // same error.\n loggedTypeFailures[error$1.message] = true;\n setCurrentlyValidatingElement(element);\n\n error('Failed %s type: %s', location, error$1.message);\n\n setCurrentlyValidatingElement(null);\n }\n }\n }\n }\n}\n\nvar isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare\n\nfunction isArray(a) {\n return isArrayImpl(a);\n}\n\n/*\n * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol\n * and Temporal.* types. See https://github.com/facebook/react/pull/22064.\n *\n * The functions in this module will throw an easier-to-understand,\n * easier-to-debug exception with a clear errors message message explaining the\n * problem. (Instead of a confusing exception thrown inside the implementation\n * of the `value` object).\n */\n// $FlowFixMe only called in DEV, so void return is not possible.\nfunction typeName(value) {\n {\n // toStringTag is needed for namespaced types like Temporal.Instant\n var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;\n var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';\n return type;\n }\n} // $FlowFixMe only called in DEV, so void return is not possible.\n\n\nfunction willCoercionThrow(value) {\n {\n try {\n testStringCoercion(value);\n return false;\n } catch (e) {\n return true;\n }\n }\n}\n\nfunction testStringCoercion(value) {\n // If you ended up here by following an exception call stack, here's what's\n // happened: you supplied an object or symbol value to React (as a prop, key,\n // DOM attribute, CSS property, string ref, etc.) and when React tried to\n // coerce it to a string using `'' + value`, an exception was thrown.\n //\n // The most common types that will cause this exception are `Symbol` instances\n // and Temporal objects like `Temporal.Instant`. But any object that has a\n // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this\n // exception. (Library authors do this to prevent users from using built-in\n // numeric operators like `+` or comparison operators like `>=` because custom\n // methods are needed to perform accurate arithmetic or comparison.)\n //\n // To fix the problem, coerce this object or symbol value to a string before\n // passing it to React. The most reliable way is usually `String(value)`.\n //\n // To find which value is throwing, check the browser or debugger console.\n // Before this exception was thrown, there should be `console.error` output\n // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the\n // problem and how that type was used: key, atrribute, input value prop, etc.\n // In most cases, this console output also shows the component and its\n // ancestor components where the exception happened.\n //\n // eslint-disable-next-line react-internal/safe-string-coercion\n return '' + value;\n}\nfunction checkKeyStringCoercion(value) {\n {\n if (willCoercionThrow(value)) {\n error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));\n\n return testStringCoercion(value); // throw (to help callers find troubleshooting comments)\n }\n }\n}\n\nvar ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;\nvar RESERVED_PROPS = {\n key: true,\n ref: true,\n __self: true,\n __source: true\n};\nvar specialPropKeyWarningShown;\nvar specialPropRefWarningShown;\nvar didWarnAboutStringRefs;\n\n{\n didWarnAboutStringRefs = {};\n}\n\nfunction hasValidRef(config) {\n {\n if (hasOwnProperty.call(config, 'ref')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.ref !== undefined;\n}\n\nfunction hasValidKey(config) {\n {\n if (hasOwnProperty.call(config, 'key')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'key').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.key !== undefined;\n}\n\nfunction warnIfStringRefCannotBeAutoConverted(config, self) {\n {\n if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {\n var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);\n\n if (!didWarnAboutStringRefs[componentName]) {\n error('Component \"%s\" contains the string ref \"%s\". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);\n\n didWarnAboutStringRefs[componentName] = true;\n }\n }\n }\n}\n\nfunction defineKeyPropWarningGetter(props, displayName) {\n {\n var warnAboutAccessingKey = function () {\n if (!specialPropKeyWarningShown) {\n specialPropKeyWarningShown = true;\n\n error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n };\n\n warnAboutAccessingKey.isReactWarning = true;\n Object.defineProperty(props, 'key', {\n get: warnAboutAccessingKey,\n configurable: true\n });\n }\n}\n\nfunction defineRefPropWarningGetter(props, displayName) {\n {\n var warnAboutAccessingRef = function () {\n if (!specialPropRefWarningShown) {\n specialPropRefWarningShown = true;\n\n error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n };\n\n warnAboutAccessingRef.isReactWarning = true;\n Object.defineProperty(props, 'ref', {\n get: warnAboutAccessingRef,\n configurable: true\n });\n }\n}\n/**\n * Factory method to create a new React element. This no longer adheres to\n * the class pattern, so do not use new to call it. Also, instanceof check\n * will not work. Instead test $$typeof field against Symbol.for('react.element') to check\n * if something is a React Element.\n *\n * @param {*} type\n * @param {*} props\n * @param {*} key\n * @param {string|object} ref\n * @param {*} owner\n * @param {*} self A *temporary* helper to detect places where `this` is\n * different from the `owner` when React.createElement is called, so that we\n * can warn. We want to get rid of owner and replace string `ref`s with arrow\n * functions, and as long as `this` and owner are the same, there will be no\n * change in behavior.\n * @param {*} source An annotation object (added by a transpiler or otherwise)\n * indicating filename, line number, and/or other information.\n * @internal\n */\n\n\nvar ReactElement = function (type, key, ref, self, source, owner, props) {\n var element = {\n // This tag allows us to uniquely identify this as a React Element\n $$typeof: REACT_ELEMENT_TYPE,\n // Built-in properties that belong on the element\n type: type,\n key: key,\n ref: ref,\n props: props,\n // Record the component responsible for creating this element.\n _owner: owner\n };\n\n {\n // The validation flag is currently mutative. We put it on\n // an external backing store so that we can freeze the whole object.\n // This can be replaced with a WeakMap once they are implemented in\n // commonly used development environments.\n element._store = {}; // To make comparing ReactElements easier for testing purposes, we make\n // the validation flag non-enumerable (where possible, which should\n // include every environment we run tests in), so the test framework\n // ignores it.\n\n Object.defineProperty(element._store, 'validated', {\n configurable: false,\n enumerable: false,\n writable: true,\n value: false\n }); // self and source are DEV only properties.\n\n Object.defineProperty(element, '_self', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: self\n }); // Two elements created in two different places should be considered\n // equal for testing purposes and therefore we hide it from enumeration.\n\n Object.defineProperty(element, '_source', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: source\n });\n\n if (Object.freeze) {\n Object.freeze(element.props);\n Object.freeze(element);\n }\n }\n\n return element;\n};\n/**\n * https://github.com/reactjs/rfcs/pull/107\n * @param {*} type\n * @param {object} props\n * @param {string} key\n */\n\nfunction jsxDEV(type, config, maybeKey, source, self) {\n {\n var propName; // Reserved names are extracted\n\n var props = {};\n var key = null;\n var ref = null; // Currently, key can be spread in as a prop. This causes a potential\n // issue if key is also explicitly declared (ie. <div {...props} key=\"Hi\" />\n // or <div key=\"Hi\" {...props} /> ). We want to deprecate key spread,\n // but as an intermediary step, we will use jsxDEV for everything except\n // <div {...props} key=\"Hi\" />, because we aren't currently able to tell if\n // key is explicitly declared to be undefined or not.\n\n if (maybeKey !== undefined) {\n {\n checkKeyStringCoercion(maybeKey);\n }\n\n key = '' + maybeKey;\n }\n\n if (hasValidKey(config)) {\n {\n checkKeyStringCoercion(config.key);\n }\n\n key = '' + config.key;\n }\n\n if (hasValidRef(config)) {\n ref = config.ref;\n warnIfStringRefCannotBeAutoConverted(config, self);\n } // Remaining properties are added to a new props object\n\n\n for (propName in config) {\n if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {\n props[propName] = config[propName];\n }\n } // Resolve default props\n\n\n if (type && type.defaultProps) {\n var defaultProps = type.defaultProps;\n\n for (propName in defaultProps) {\n if (props[propName] === undefined) {\n props[propName] = defaultProps[propName];\n }\n }\n }\n\n if (key || ref) {\n var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;\n\n if (key) {\n defineKeyPropWarningGetter(props, displayName);\n }\n\n if (ref) {\n defineRefPropWarningGetter(props, displayName);\n }\n }\n\n return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);\n }\n}\n\nvar ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;\nvar ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;\n\nfunction setCurrentlyValidatingElement$1(element) {\n {\n if (element) {\n var owner = element._owner;\n var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);\n ReactDebugCurrentFrame$1.setExtraStackFrame(stack);\n } else {\n ReactDebugCurrentFrame$1.setExtraStackFrame(null);\n }\n }\n}\n\nvar propTypesMisspellWarningShown;\n\n{\n propTypesMisspellWarningShown = false;\n}\n/**\n * Verifies the object is a ReactElement.\n * See https://reactjs.org/docs/react-api.html#isvalidelement\n * @param {?object} object\n * @return {boolean} True if `object` is a ReactElement.\n * @final\n */\n\n\nfunction isValidElement(object) {\n {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n }\n}\n\nfunction getDeclarationErrorAddendum() {\n {\n if (ReactCurrentOwner$1.current) {\n var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);\n\n if (name) {\n return '\\n\\nCheck the render method of `' + name + '`.';\n }\n }\n\n return '';\n }\n}\n\nfunction getSourceInfoErrorAddendum(source) {\n {\n if (source !== undefined) {\n var fileName = source.fileName.replace(/^.*[\\\\\\/]/, '');\n var lineNumber = source.lineNumber;\n return '\\n\\nCheck your code at ' + fileName + ':' + lineNumber + '.';\n }\n\n return '';\n }\n}\n/**\n * Warn if there's no key explicitly set on dynamic arrays of children or\n * object keys are not valid. This allows us to keep track of children between\n * updates.\n */\n\n\nvar ownerHasKeyUseWarning = {};\n\nfunction getCurrentComponentErrorInfo(parentType) {\n {\n var info = getDeclarationErrorAddendum();\n\n if (!info) {\n var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;\n\n if (parentName) {\n info = \"\\n\\nCheck the top-level render call using <\" + parentName + \">.\";\n }\n }\n\n return info;\n }\n}\n/**\n * Warn if the element doesn't have an explicit key assigned to it.\n * This element is in an array. The array could grow and shrink or be\n * reordered. All children that haven't already been validated are required to\n * have a \"key\" property assigned to it. Error statuses are cached so a warning\n * will only be shown once.\n *\n * @internal\n * @param {ReactElement} element Element that requires a key.\n * @param {*} parentType element's parent's type.\n */\n\n\nfunction validateExplicitKey(element, parentType) {\n {\n if (!element._store || element._store.validated || element.key != null) {\n return;\n }\n\n element._store.validated = true;\n var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);\n\n if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {\n return;\n }\n\n ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a\n // property, it may be the creator of the child that's responsible for\n // assigning it a key.\n\n var childOwner = '';\n\n if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {\n // Give the component that originally created this child.\n childOwner = \" It was passed a child from \" + getComponentNameFromType(element._owner.type) + \".\";\n }\n\n setCurrentlyValidatingElement$1(element);\n\n error('Each child in a list should have a unique \"key\" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);\n\n setCurrentlyValidatingElement$1(null);\n }\n}\n/**\n * Ensure that every element either is passed in a static location, in an\n * array with an explicit keys property defined, or in an object literal\n * with valid key property.\n *\n * @internal\n * @param {ReactNode} node Statically passed child of any type.\n * @param {*} parentType node's parent's type.\n */\n\n\nfunction validateChildKeys(node, parentType) {\n {\n if (typeof node !== 'object') {\n return;\n }\n\n if (isArray(node)) {\n for (var i = 0; i < node.length; i++) {\n var child = node[i];\n\n if (isValidElement(child)) {\n validateExplicitKey(child, parentType);\n }\n }\n } else if (isValidElement(node)) {\n // This element was passed in a valid location.\n if (node._store) {\n node._store.validated = true;\n }\n } else if (node) {\n var iteratorFn = getIteratorFn(node);\n\n if (typeof iteratorFn === 'function') {\n // Entry iterators used to provide implicit keys,\n // but now we print a separate warning for them later.\n if (iteratorFn !== node.entries) {\n var iterator = iteratorFn.call(node);\n var step;\n\n while (!(step = iterator.next()).done) {\n if (isValidElement(step.value)) {\n validateExplicitKey(step.value, parentType);\n }\n }\n }\n }\n }\n }\n}\n/**\n * Given an element, validate that its props follow the propTypes definition,\n * provided by the type.\n *\n * @param {ReactElement} element\n */\n\n\nfunction validatePropTypes(element) {\n {\n var type = element.type;\n\n if (type === null || type === undefined || typeof type === 'string') {\n return;\n }\n\n var propTypes;\n\n if (typeof type === 'function') {\n propTypes = type.propTypes;\n } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.\n // Inner props are checked in the reconciler.\n type.$$typeof === REACT_MEMO_TYPE)) {\n propTypes = type.propTypes;\n } else {\n return;\n }\n\n if (propTypes) {\n // Intentionally inside to avoid triggering lazy initializers:\n var name = getComponentNameFromType(type);\n checkPropTypes(propTypes, element.props, 'prop', name, element);\n } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {\n propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:\n\n var _name = getComponentNameFromType(type);\n\n error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');\n }\n\n if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {\n error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');\n }\n }\n}\n/**\n * Given a fragment, validate that it can only be provided with fragment props\n * @param {ReactElement} fragment\n */\n\n\nfunction validateFragmentProps(fragment) {\n {\n var keys = Object.keys(fragment.props);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n if (key !== 'children' && key !== 'key') {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);\n\n setCurrentlyValidatingElement$1(null);\n break;\n }\n }\n\n if (fragment.ref !== null) {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid attribute `ref` supplied to `React.Fragment`.');\n\n setCurrentlyValidatingElement$1(null);\n }\n }\n}\n\nvar didWarnAboutKeySpread = {};\nfunction jsxWithValidation(type, props, key, isStaticChildren, source, self) {\n {\n var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to\n // succeed and there will likely be errors in render.\n\n if (!validType) {\n var info = '';\n\n if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {\n info += ' You likely forgot to export your component from the file ' + \"it's defined in, or you might have mixed up default and named imports.\";\n }\n\n var sourceInfo = getSourceInfoErrorAddendum(source);\n\n if (sourceInfo) {\n info += sourceInfo;\n } else {\n info += getDeclarationErrorAddendum();\n }\n\n var typeString;\n\n if (type === null) {\n typeString = 'null';\n } else if (isArray(type)) {\n typeString = 'array';\n } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {\n typeString = \"<\" + (getComponentNameFromType(type.type) || 'Unknown') + \" />\";\n info = ' Did you accidentally export a JSX literal instead of a component?';\n } else {\n typeString = typeof type;\n }\n\n error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);\n }\n\n var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.\n // TODO: Drop this when these are no longer allowed as the type argument.\n\n if (element == null) {\n return element;\n } // Skip key warning if the type isn't valid since our key validation logic\n // doesn't expect a non-string/function type and can throw confusing errors.\n // We don't want exception behavior to differ between dev and prod.\n // (Rendering will throw with a helpful message and as soon as the type is\n // fixed, the key warnings will appear.)\n\n\n if (validType) {\n var children = props.children;\n\n if (children !== undefined) {\n if (isStaticChildren) {\n if (isArray(children)) {\n for (var i = 0; i < children.length; i++) {\n validateChildKeys(children[i], type);\n }\n\n if (Object.freeze) {\n Object.freeze(children);\n }\n } else {\n error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');\n }\n } else {\n validateChildKeys(children, type);\n }\n }\n }\n\n {\n if (hasOwnProperty.call(props, 'key')) {\n var componentName = getComponentNameFromType(type);\n var keys = Object.keys(props).filter(function (k) {\n return k !== 'key';\n });\n var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';\n\n if (!didWarnAboutKeySpread[componentName + beforeExample]) {\n var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';\n\n error('A props object containing a \"key\" prop is being spread into JSX:\\n' + ' let props = %s;\\n' + ' <%s {...props} />\\n' + 'React keys must be passed directly to JSX without using spread:\\n' + ' let props = %s;\\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);\n\n didWarnAboutKeySpread[componentName + beforeExample] = true;\n }\n }\n }\n\n if (type === REACT_FRAGMENT_TYPE) {\n validateFragmentProps(element);\n } else {\n validatePropTypes(element);\n }\n\n return element;\n }\n} // These two functions exist to still get child warnings in dev\n// even with the prod transform. This means that jsxDEV is purely\n// opt-in behavior for better messages but that we won't stop\n// giving you warnings if you use production apis.\n\nfunction jsxWithValidationStatic(type, props, key) {\n {\n return jsxWithValidation(type, props, key, true);\n }\n}\nfunction jsxWithValidationDynamic(type, props, key) {\n {\n return jsxWithValidation(type, props, key, false);\n }\n}\n\nvar jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.\n// for now we can ship identical prod functions\n\nvar jsxs = jsxWithValidationStatic ;\n\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsx;\nexports.jsxs = jsxs;\n })();\n}\n\n\n//# sourceURL=webpack://WordPress/./node_modules/react/cjs/react-jsx-runtime.development.js?"); /***/ }), /***/ "./node_modules/react/jsx-runtime.js": /*!*******************************************!*\ !*** ./node_modules/react/jsx-runtime.js ***! \*******************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { eval("\n\nif (false) {} else {\n module.exports = __webpack_require__(/*! ./cjs/react-jsx-runtime.development.js */ \"./node_modules/react/cjs/react-jsx-runtime.development.js\");\n}\n\n\n//# sourceURL=webpack://WordPress/./node_modules/react/jsx-runtime.js?"); /***/ }), /***/ "react": /*!************************!*\ !*** external "React" ***! \************************/ /***/ ((module) => { module.exports = React; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module can't be inlined because the eval devtool is used. /******/ var __webpack_exports__ = __webpack_require__("./node_modules/react/jsx-runtime.js"); /******/ window.ReactJSXRuntime = __webpack_exports__; /******/ /******/ })() ; vendor/react-jsx-runtime.min.js 0000644 00000001604 15151622574 0012553 0 ustar 00 /*! For license information please see react-jsx-runtime.min.js.LICENSE.txt */ (()=>{"use strict";var r={20:(r,e,t)=>{var o=t(594),n=Symbol.for("react.element"),s=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,f=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function _(r,e,t){var o,s={},_=null,i=null;for(o in void 0!==t&&(_=""+t),void 0!==e.key&&(_=""+e.key),void 0!==e.ref&&(i=e.ref),e)a.call(e,o)&&!p.hasOwnProperty(o)&&(s[o]=e[o]);if(r&&r.defaultProps)for(o in e=r.defaultProps)void 0===s[o]&&(s[o]=e[o]);return{$$typeof:n,type:r,key:_,ref:i,props:s,_owner:f.current}}e.Fragment=s,e.jsx=_,e.jsxs=_},594:r=>{r.exports=React},848:(r,e,t)=>{r.exports=t(20)}},e={},t=function t(o){var n=e[o];if(void 0!==n)return n.exports;var s=e[o]={exports:{}};return r[o](s,s.exports,t),s.exports}(848);window.ReactJSXRuntime=t})(); vendor/wp-polyfill-formdata.min.js 0000604 00000021106 15151622574 0013236 0 ustar 00 /*! formdata-polyfill. MIT License. Jimmy W?rting <https://jimmy.warting.se/opensource> */ !function(){var t;function e(t){var e=0;return function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}}}var n="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){return t==Array.prototype||t==Object.prototype||(t[e]=n.value),t};var r,o=function(t){t=["object"==typeof globalThis&&globalThis,t,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var e=0;e<t.length;++e){var n=t[e];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function i(t,e){if(e)t:{var r=o;t=t.split(".");for(var i=0;i<t.length-1;i++){var a=t[i];if(!(a in r))break t;r=r[a]}(e=e(i=r[t=t[t.length-1]]))!=i&&null!=e&&n(r,t,{configurable:!0,writable:!0,value:e})}}function a(t){return(t={next:t})[Symbol.iterator]=function(){return this},t}function u(t){var n="undefined"!=typeof Symbol&&Symbol.iterator&&t[Symbol.iterator];return n?n.call(t):{next:e(t)}}if(i("Symbol",(function(t){function e(t,e){this.A=t,n(this,"description",{configurable:!0,writable:!0,value:e})}if(t)return t;e.prototype.toString=function(){return this.A};var r="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",o=0;return function t(n){if(this instanceof t)throw new TypeError("Symbol is not a constructor");return new e(r+(n||"")+"_"+o++,n)}})),i("Symbol.iterator",(function(t){if(t)return t;t=Symbol("Symbol.iterator");for(var r="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),i=0;i<r.length;i++){var u=o[r[i]];"function"==typeof u&&"function"!=typeof u.prototype[t]&&n(u.prototype,t,{configurable:!0,writable:!0,value:function(){return a(e(this))}})}return t})),"function"==typeof Object.setPrototypeOf)r=Object.setPrototypeOf;else{var l;t:{var s={};try{s.__proto__={a:!0},l=s.a;break t}catch(t){}l=!1}r=l?function(t,e){if(t.__proto__=e,t.__proto__!==e)throw new TypeError(t+" is not extensible");return t}:null}var f=r;function c(){this.m=!1,this.j=null,this.v=void 0,this.h=1,this.u=this.C=0,this.l=null}function h(t){if(t.m)throw new TypeError("Generator is already running");t.m=!0}function p(t,e){return t.h=3,{value:e}}function y(t){this.g=new c,this.G=t}function v(t,e,n,r){try{var o=e.call(t.g.j,n);if(!(o instanceof Object))throw new TypeError("Iterator result "+o+" is not an object");if(!o.done)return t.g.m=!1,o;var i=o.value}catch(e){return t.g.j=null,t.g.s(e),g(t)}return t.g.j=null,r.call(t.g,i),g(t)}function g(t){for(;t.g.h;)try{var e=t.G(t.g);if(e)return t.g.m=!1,{value:e.value,done:!1}}catch(e){t.g.v=void 0,t.g.s(e)}if(t.g.m=!1,t.g.l){if(e=t.g.l,t.g.l=null,e.F)throw e.D;return{value:e.return,done:!0}}return{value:void 0,done:!0}}function d(t){this.next=function(e){return t.o(e)},this.throw=function(e){return t.s(e)},this.return=function(e){return function(t,e){h(t.g);var n=t.g.j;return n?v(t,"return"in n?n.return:function(t){return{value:t,done:!0}},e,t.g.return):(t.g.return(e),g(t))}(t,e)},this[Symbol.iterator]=function(){return this}}function b(t,e){return e=new d(new y(e)),f&&t.prototype&&f(e,t.prototype),e}if(c.prototype.o=function(t){this.v=t},c.prototype.s=function(t){this.l={D:t,F:!0},this.h=this.C||this.u},c.prototype.return=function(t){this.l={return:t},this.h=this.u},y.prototype.o=function(t){return h(this.g),this.g.j?v(this,this.g.j.next,t,this.g.o):(this.g.o(t),g(this))},y.prototype.s=function(t){return h(this.g),this.g.j?v(this,this.g.j.throw,t,this.g.o):(this.g.s(t),g(this))},i("Array.prototype.entries",(function(t){return t||function(){return function(t,e){t instanceof String&&(t+="");var n=0,r=!1,o={next:function(){if(!r&&n<t.length){var o=n++;return{value:e(o,t[o]),done:!1}}return r=!0,{done:!0,value:void 0}}};return o[Symbol.iterator]=function(){return o},o}(this,(function(t,e){return[t,e]}))}})),"undefined"!=typeof Blob&&("undefined"==typeof FormData||!FormData.prototype.keys)){var m=function(t,e){for(var n=0;n<t.length;n++)e(t[n])},w=function(t){return t.replace(/\r?\n|\r/g,"\r\n")},S=function(t,e,n){return e instanceof Blob?(n=void 0!==n?String(n+""):"string"==typeof e.name?e.name:"blob",e.name===n&&"[object Blob]"!==Object.prototype.toString.call(e)||(e=new File([e],n)),[String(t),e]):[String(t),String(e)]},j=function(t,e){if(t.length<e)throw new TypeError(e+" argument required, but only "+t.length+" present.")},x="object"==typeof globalThis?globalThis:"object"==typeof window?window:"object"==typeof self?self:this,_=x.FormData,F=x.XMLHttpRequest&&x.XMLHttpRequest.prototype.send,A=x.Request&&x.fetch,M=x.navigator&&x.navigator.sendBeacon,D=x.Element&&x.Element.prototype,B=x.Symbol&&Symbol.toStringTag;B&&(Blob.prototype[B]||(Blob.prototype[B]="Blob"),"File"in x&&!File.prototype[B]&&(File.prototype[B]="File"));try{new File([],"")}catch(t){x.File=function(t,e,n){return t=new Blob(t,n||{}),Object.defineProperties(t,{name:{value:e},lastModified:{value:+(n&&void 0!==n.lastModified?new Date(n.lastModified):new Date)},toString:{value:function(){return"[object File]"}}}),B&&Object.defineProperty(t,B,{value:"File"}),t}}var T=function(t){return t.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22")},q=function(t){this.i=[];var e=this;t&&m(t.elements,(function(t){if(t.name&&!t.disabled&&"submit"!==t.type&&"button"!==t.type&&!t.matches("form fieldset[disabled] *"))if("file"===t.type){var n=t.files&&t.files.length?t.files:[new File([],"",{type:"application/octet-stream"})];m(n,(function(n){e.append(t.name,n)}))}else"select-multiple"===t.type||"select-one"===t.type?m(t.options,(function(n){!n.disabled&&n.selected&&e.append(t.name,n.value)})):"checkbox"===t.type||"radio"===t.type?t.checked&&e.append(t.name,t.value):(n="textarea"===t.type?w(t.value):t.value,e.append(t.name,n))}))};if((t=q.prototype).append=function(t,e,n){j(arguments,2),this.i.push(S(t,e,n))},t.delete=function(t){j(arguments,1);var e=[];t=String(t),m(this.i,(function(n){n[0]!==t&&e.push(n)})),this.i=e},t.entries=function t(){var e,n=this;return b(t,(function(t){if(1==t.h&&(e=0),3!=t.h)return e<n.i.length?t=p(t,n.i[e]):(t.h=0,t=void 0),t;e++,t.h=2}))},t.forEach=function(t,e){j(arguments,1);for(var n=u(this),r=n.next();!r.done;r=n.next()){var o=u(r.value);r=o.next().value,o=o.next().value,t.call(e,o,r,this)}},t.get=function(t){j(arguments,1);var e=this.i;t=String(t);for(var n=0;n<e.length;n++)if(e[n][0]===t)return e[n][1];return null},t.getAll=function(t){j(arguments,1);var e=[];return t=String(t),m(this.i,(function(n){n[0]===t&&e.push(n[1])})),e},t.has=function(t){j(arguments,1),t=String(t);for(var e=0;e<this.i.length;e++)if(this.i[e][0]===t)return!0;return!1},t.keys=function t(){var e,n,r,o,i=this;return b(t,(function(t){if(1==t.h&&(e=u(i),n=e.next()),3!=t.h)return n.done?void(t.h=0):(r=n.value,o=u(r),p(t,o.next().value));n=e.next(),t.h=2}))},t.set=function(t,e,n){j(arguments,2),t=String(t);var r=[],o=S(t,e,n),i=!0;m(this.i,(function(e){e[0]===t?i&&(i=!r.push(o)):r.push(e)})),i&&r.push(o),this.i=r},t.values=function t(){var e,n,r,o,i=this;return b(t,(function(t){if(1==t.h&&(e=u(i),n=e.next()),3!=t.h)return n.done?void(t.h=0):(r=n.value,(o=u(r)).next(),p(t,o.next().value));n=e.next(),t.h=2}))},q.prototype._asNative=function(){for(var t=new _,e=u(this),n=e.next();!n.done;n=e.next()){var r=u(n.value);n=r.next().value,r=r.next().value,t.append(n,r)}return t},q.prototype._blob=function(){var t="----formdata-polyfill-"+Math.random(),e=[],n="--"+t+'\r\nContent-Disposition: form-data; name="';return this.forEach((function(t,r){return"string"==typeof t?e.push(n+T(w(r))+'"\r\n\r\n'+w(t)+"\r\n"):e.push(n+T(w(r))+'"; filename="'+T(t.name)+'"\r\nContent-Type: '+(t.type||"application/octet-stream")+"\r\n\r\n",t,"\r\n")})),e.push("--"+t+"--"),new Blob(e,{type:"multipart/form-data; boundary="+t})},q.prototype[Symbol.iterator]=function(){return this.entries()},q.prototype.toString=function(){return"[object FormData]"},D&&!D.matches&&(D.matches=D.matchesSelector||D.mozMatchesSelector||D.msMatchesSelector||D.oMatchesSelector||D.webkitMatchesSelector||function(t){for(var e=(t=(this.document||this.ownerDocument).querySelectorAll(t)).length;0<=--e&&t.item(e)!==this;);return-1<e}),B&&(q.prototype[B]="FormData"),F){var O=x.XMLHttpRequest.prototype.setRequestHeader;x.XMLHttpRequest.prototype.setRequestHeader=function(t,e){O.call(this,t,e),"content-type"===t.toLowerCase()&&(this.B=!0)},x.XMLHttpRequest.prototype.send=function(t){t instanceof q?(t=t._blob(),this.B||this.setRequestHeader("Content-Type",t.type),F.call(this,t)):F.call(this,t)}}A&&(x.fetch=function(t,e){return e&&e.body&&e.body instanceof q&&(e.body=e.body._blob()),A.call(this,t,e)}),M&&(x.navigator.sendBeacon=function(t,e){return e instanceof q&&(e=e._asNative()),M.call(this,t,e)}),x.FormData=q}}(); vendor/wp-polyfill-element-closest.js 0000604 00000000654 15151622574 0013767 0 ustar 00 !function(e){var t=e.Element.prototype;"function"!=typeof t.matches&&(t.matches=t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),o=0;t[o]&&t[o]!==this;)++o;return Boolean(t[o])}),"function"!=typeof t.closest&&(t.closest=function(e){for(var t=this;t&&1===t.nodeType;){if(t.matches(e))return t;t=t.parentNode}return null})}(window); vendor/wp-polyfill-object-fit.js 0000604 00000021741 15151622574 0012712 0 ustar 00 /*---------------------------------------- * objectFitPolyfill 2.3.5 * * Made by Constance Chen * Released under the ISC license * * https://github.com/constancecchen/object-fit-polyfill *--------------------------------------*/ (function() { 'use strict'; // if the page is being rendered on the server, don't continue if (typeof window === 'undefined') return; // Workaround for Edge 16-18, which only implemented object-fit for <img> tags var edgeMatch = window.navigator.userAgent.match(/Edge\/(\d{2})\./); var edgeVersion = edgeMatch ? parseInt(edgeMatch[1], 10) : null; var edgePartialSupport = edgeVersion ? edgeVersion >= 16 && edgeVersion <= 18 : false; // If the browser does support object-fit, we don't need to continue var hasSupport = 'objectFit' in document.documentElement.style !== false; if (hasSupport && !edgePartialSupport) { window.objectFitPolyfill = function() { return false; }; return; } /** * Check the container's parent element to make sure it will * correctly handle and clip absolutely positioned children * * @param {node} $container - parent element */ var checkParentContainer = function($container) { var styles = window.getComputedStyle($container, null); var position = styles.getPropertyValue('position'); var overflow = styles.getPropertyValue('overflow'); var display = styles.getPropertyValue('display'); if (!position || position === 'static') { $container.style.position = 'relative'; } if (overflow !== 'hidden') { $container.style.overflow = 'hidden'; } // Guesstimating that people want the parent to act like full width/height wrapper here. // Mostly attempts to target <picture> elements, which default to inline. if (!display || display === 'inline') { $container.style.display = 'block'; } if ($container.clientHeight === 0) { $container.style.height = '100%'; } // Add a CSS class hook, in case people need to override styles for any reason. if ($container.className.indexOf('object-fit-polyfill') === -1) { $container.className = $container.className + ' object-fit-polyfill'; } }; /** * Check for pre-set max-width/height, min-width/height, * positioning, or margins, which can mess up image calculations * * @param {node} $media - img/video element */ var checkMediaProperties = function($media) { var styles = window.getComputedStyle($media, null); var constraints = { 'max-width': 'none', 'max-height': 'none', 'min-width': '0px', 'min-height': '0px', top: 'auto', right: 'auto', bottom: 'auto', left: 'auto', 'margin-top': '0px', 'margin-right': '0px', 'margin-bottom': '0px', 'margin-left': '0px', }; for (var property in constraints) { var constraint = styles.getPropertyValue(property); if (constraint !== constraints[property]) { $media.style[property] = constraints[property]; } } }; /** * Calculate & set object-position * * @param {string} axis - either "x" or "y" * @param {node} $media - img or video element * @param {string} objectPosition - e.g. "50% 50%", "top left" */ var setPosition = function(axis, $media, objectPosition) { var position, other, start, end, side; objectPosition = objectPosition.split(' '); if (objectPosition.length < 2) { objectPosition[1] = objectPosition[0]; } /* istanbul ignore else */ if (axis === 'x') { position = objectPosition[0]; other = objectPosition[1]; start = 'left'; end = 'right'; side = $media.clientWidth; } else if (axis === 'y') { position = objectPosition[1]; other = objectPosition[0]; start = 'top'; end = 'bottom'; side = $media.clientHeight; } else { return; // Neither x or y axis specified } if (position === start || other === start) { $media.style[start] = '0'; return; } if (position === end || other === end) { $media.style[end] = '0'; return; } if (position === 'center' || position === '50%') { $media.style[start] = '50%'; $media.style['margin-' + start] = side / -2 + 'px'; return; } // Percentage values (e.g., 30% 10%) if (position.indexOf('%') >= 0) { position = parseInt(position, 10); if (position < 50) { $media.style[start] = position + '%'; $media.style['margin-' + start] = side * (position / -100) + 'px'; } else { position = 100 - position; $media.style[end] = position + '%'; $media.style['margin-' + end] = side * (position / -100) + 'px'; } return; } // Length-based values (e.g. 10px / 10em) else { $media.style[start] = position; } }; /** * Calculate & set object-fit * * @param {node} $media - img/video/picture element */ var objectFit = function($media) { // IE 10- data polyfill var fit = $media.dataset ? $media.dataset.objectFit : $media.getAttribute('data-object-fit'); var position = $media.dataset ? $media.dataset.objectPosition : $media.getAttribute('data-object-position'); // Default fallbacks fit = fit || 'cover'; position = position || '50% 50%'; // If necessary, make the parent container work with absolutely positioned elements var $container = $media.parentNode; checkParentContainer($container); // Check for any pre-set CSS which could mess up image calculations checkMediaProperties($media); // Reset any pre-set width/height CSS and handle fit positioning $media.style.position = 'absolute'; $media.style.width = 'auto'; $media.style.height = 'auto'; // `scale-down` chooses either `none` or `contain`, whichever is smaller if (fit === 'scale-down') { if ( $media.clientWidth < $container.clientWidth && $media.clientHeight < $container.clientHeight ) { fit = 'none'; } else { fit = 'contain'; } } // `none` (width/height auto) and `fill` (100%) and are straightforward if (fit === 'none') { setPosition('x', $media, position); setPosition('y', $media, position); return; } if (fit === 'fill') { $media.style.width = '100%'; $media.style.height = '100%'; setPosition('x', $media, position); setPosition('y', $media, position); return; } // `cover` and `contain` must figure out which side needs covering, and add CSS positioning & centering $media.style.height = '100%'; if ( (fit === 'cover' && $media.clientWidth > $container.clientWidth) || (fit === 'contain' && $media.clientWidth < $container.clientWidth) ) { $media.style.top = '0'; $media.style.marginTop = '0'; setPosition('x', $media, position); } else { $media.style.width = '100%'; $media.style.height = 'auto'; $media.style.left = '0'; $media.style.marginLeft = '0'; setPosition('y', $media, position); } }; /** * Initialize plugin * * @param {node} media - Optional specific DOM node(s) to be polyfilled */ var objectFitPolyfill = function(media) { if (typeof media === 'undefined' || media instanceof Event) { // If left blank, or a default event, all media on the page will be polyfilled. media = document.querySelectorAll('[data-object-fit]'); } else if (media && media.nodeName) { // If it's a single node, wrap it in an array so it works. media = [media]; } else if (typeof media === 'object' && media.length && media[0].nodeName) { // If it's an array of DOM nodes (e.g. a jQuery selector), it's fine as-is. media = media; } else { // Otherwise, if it's invalid or an incorrect type, return false to let people know. return false; } for (var i = 0; i < media.length; i++) { if (!media[i].nodeName) continue; var mediaType = media[i].nodeName.toLowerCase(); if (mediaType === 'img') { if (edgePartialSupport) continue; // Edge supports object-fit for images (but nothing else), so no need to polyfill if (media[i].complete) { objectFit(media[i]); } else { media[i].addEventListener('load', function() { objectFit(this); }); } } else if (mediaType === 'video') { if (media[i].readyState > 0) { objectFit(media[i]); } else { media[i].addEventListener('loadedmetadata', function() { objectFit(this); }); } } else { objectFit(media[i]); } } return true; }; if (document.readyState === 'loading') { // Loading hasn't finished yet document.addEventListener('DOMContentLoaded', objectFitPolyfill); } else { // `DOMContentLoaded` has already fired objectFitPolyfill(); } window.addEventListener('resize', objectFitPolyfill); window.objectFitPolyfill = objectFitPolyfill; })(); vendor/wp-polyfill-fetch.js 0000644 00000046547 15151622574 0011774 0 ustar 00 (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.WHATWGFetch = {}))); }(this, (function (exports) { 'use strict'; /* eslint-disable no-prototype-builtins */ var g = (typeof globalThis !== 'undefined' && globalThis) || (typeof self !== 'undefined' && self) || // eslint-disable-next-line no-undef (typeof global !== 'undefined' && global) || {}; var support = { searchParams: 'URLSearchParams' in g, iterable: 'Symbol' in g && 'iterator' in Symbol, blob: 'FileReader' in g && 'Blob' in g && (function() { try { new Blob(); return true } catch (e) { return false } })(), formData: 'FormData' in g, arrayBuffer: 'ArrayBuffer' in g }; function isDataView(obj) { return obj && DataView.prototype.isPrototypeOf(obj) } if (support.arrayBuffer) { var viewClasses = [ '[object Int8Array]', '[object Uint8Array]', '[object Uint8ClampedArray]', '[object Int16Array]', '[object Uint16Array]', '[object Int32Array]', '[object Uint32Array]', '[object Float32Array]', '[object Float64Array]' ]; var isArrayBufferView = ArrayBuffer.isView || function(obj) { return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 }; } function normalizeName(name) { if (typeof name !== 'string') { name = String(name); } if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === '') { throw new TypeError('Invalid character in header field name: "' + name + '"') } return name.toLowerCase() } function normalizeValue(value) { if (typeof value !== 'string') { value = String(value); } return value } // Build a destructive iterator for the value list function iteratorFor(items) { var iterator = { next: function() { var value = items.shift(); return {done: value === undefined, value: value} } }; if (support.iterable) { iterator[Symbol.iterator] = function() { return iterator }; } return iterator } function Headers(headers) { this.map = {}; if (headers instanceof Headers) { headers.forEach(function(value, name) { this.append(name, value); }, this); } else if (Array.isArray(headers)) { headers.forEach(function(header) { if (header.length != 2) { throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length) } this.append(header[0], header[1]); }, this); } else if (headers) { Object.getOwnPropertyNames(headers).forEach(function(name) { this.append(name, headers[name]); }, this); } } Headers.prototype.append = function(name, value) { name = normalizeName(name); value = normalizeValue(value); var oldValue = this.map[name]; this.map[name] = oldValue ? oldValue + ', ' + value : value; }; Headers.prototype['delete'] = function(name) { delete this.map[normalizeName(name)]; }; Headers.prototype.get = function(name) { name = normalizeName(name); return this.has(name) ? this.map[name] : null }; Headers.prototype.has = function(name) { return this.map.hasOwnProperty(normalizeName(name)) }; Headers.prototype.set = function(name, value) { this.map[normalizeName(name)] = normalizeValue(value); }; Headers.prototype.forEach = function(callback, thisArg) { for (var name in this.map) { if (this.map.hasOwnProperty(name)) { callback.call(thisArg, this.map[name], name, this); } } }; Headers.prototype.keys = function() { var items = []; this.forEach(function(value, name) { items.push(name); }); return iteratorFor(items) }; Headers.prototype.values = function() { var items = []; this.forEach(function(value) { items.push(value); }); return iteratorFor(items) }; Headers.prototype.entries = function() { var items = []; this.forEach(function(value, name) { items.push([name, value]); }); return iteratorFor(items) }; if (support.iterable) { Headers.prototype[Symbol.iterator] = Headers.prototype.entries; } function consumed(body) { if (body._noBody) return if (body.bodyUsed) { return Promise.reject(new TypeError('Already read')) } body.bodyUsed = true; } function fileReaderReady(reader) { return new Promise(function(resolve, reject) { reader.onload = function() { resolve(reader.result); }; reader.onerror = function() { reject(reader.error); }; }) } function readBlobAsArrayBuffer(blob) { var reader = new FileReader(); var promise = fileReaderReady(reader); reader.readAsArrayBuffer(blob); return promise } function readBlobAsText(blob) { var reader = new FileReader(); var promise = fileReaderReady(reader); var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type); var encoding = match ? match[1] : 'utf-8'; reader.readAsText(blob, encoding); return promise } function readArrayBufferAsText(buf) { var view = new Uint8Array(buf); var chars = new Array(view.length); for (var i = 0; i < view.length; i++) { chars[i] = String.fromCharCode(view[i]); } return chars.join('') } function bufferClone(buf) { if (buf.slice) { return buf.slice(0) } else { var view = new Uint8Array(buf.byteLength); view.set(new Uint8Array(buf)); return view.buffer } } function Body() { this.bodyUsed = false; this._initBody = function(body) { /* fetch-mock wraps the Response object in an ES6 Proxy to provide useful test harness features such as flush. However, on ES5 browsers without fetch or Proxy support pollyfills must be used; the proxy-pollyfill is unable to proxy an attribute unless it exists on the object before the Proxy is created. This change ensures Response.bodyUsed exists on the instance, while maintaining the semantic of setting Request.bodyUsed in the constructor before _initBody is called. */ // eslint-disable-next-line no-self-assign this.bodyUsed = this.bodyUsed; this._bodyInit = body; if (!body) { this._noBody = true; this._bodyText = ''; } else if (typeof body === 'string') { this._bodyText = body; } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { this._bodyBlob = body; } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { this._bodyFormData = body; } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { this._bodyText = body.toString(); } else if (support.arrayBuffer && support.blob && isDataView(body)) { this._bodyArrayBuffer = bufferClone(body.buffer); // IE 10-11 can't handle a DataView body. this._bodyInit = new Blob([this._bodyArrayBuffer]); } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { this._bodyArrayBuffer = bufferClone(body); } else { this._bodyText = body = Object.prototype.toString.call(body); } if (!this.headers.get('content-type')) { if (typeof body === 'string') { this.headers.set('content-type', 'text/plain;charset=UTF-8'); } else if (this._bodyBlob && this._bodyBlob.type) { this.headers.set('content-type', this._bodyBlob.type); } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); } } }; if (support.blob) { this.blob = function() { var rejected = consumed(this); if (rejected) { return rejected } if (this._bodyBlob) { return Promise.resolve(this._bodyBlob) } else if (this._bodyArrayBuffer) { return Promise.resolve(new Blob([this._bodyArrayBuffer])) } else if (this._bodyFormData) { throw new Error('could not read FormData body as blob') } else { return Promise.resolve(new Blob([this._bodyText])) } }; } this.arrayBuffer = function() { if (this._bodyArrayBuffer) { var isConsumed = consumed(this); if (isConsumed) { return isConsumed } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) { return Promise.resolve( this._bodyArrayBuffer.buffer.slice( this._bodyArrayBuffer.byteOffset, this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength ) ) } else { return Promise.resolve(this._bodyArrayBuffer) } } else if (support.blob) { return this.blob().then(readBlobAsArrayBuffer) } else { throw new Error('could not read as ArrayBuffer') } }; this.text = function() { var rejected = consumed(this); if (rejected) { return rejected } if (this._bodyBlob) { return readBlobAsText(this._bodyBlob) } else if (this._bodyArrayBuffer) { return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) } else if (this._bodyFormData) { throw new Error('could not read FormData body as text') } else { return Promise.resolve(this._bodyText) } }; if (support.formData) { this.formData = function() { return this.text().then(decode) }; } this.json = function() { return this.text().then(JSON.parse) }; return this } // HTTP methods whose capitalization should be normalized var methods = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE']; function normalizeMethod(method) { var upcased = method.toUpperCase(); return methods.indexOf(upcased) > -1 ? upcased : method } function Request(input, options) { if (!(this instanceof Request)) { throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.') } options = options || {}; var body = options.body; if (input instanceof Request) { if (input.bodyUsed) { throw new TypeError('Already read') } this.url = input.url; this.credentials = input.credentials; if (!options.headers) { this.headers = new Headers(input.headers); } this.method = input.method; this.mode = input.mode; this.signal = input.signal; if (!body && input._bodyInit != null) { body = input._bodyInit; input.bodyUsed = true; } } else { this.url = String(input); } this.credentials = options.credentials || this.credentials || 'same-origin'; if (options.headers || !this.headers) { this.headers = new Headers(options.headers); } this.method = normalizeMethod(options.method || this.method || 'GET'); this.mode = options.mode || this.mode || null; this.signal = options.signal || this.signal || (function () { if ('AbortController' in g) { var ctrl = new AbortController(); return ctrl.signal; } }()); this.referrer = null; if ((this.method === 'GET' || this.method === 'HEAD') && body) { throw new TypeError('Body not allowed for GET or HEAD requests') } this._initBody(body); if (this.method === 'GET' || this.method === 'HEAD') { if (options.cache === 'no-store' || options.cache === 'no-cache') { // Search for a '_' parameter in the query string var reParamSearch = /([?&])_=[^&]*/; if (reParamSearch.test(this.url)) { // If it already exists then set the value with the current time this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime()); } else { // Otherwise add a new '_' parameter to the end with the current time var reQueryString = /\?/; this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime(); } } } } Request.prototype.clone = function() { return new Request(this, {body: this._bodyInit}) }; function decode(body) { var form = new FormData(); body .trim() .split('&') .forEach(function(bytes) { if (bytes) { var split = bytes.split('='); var name = split.shift().replace(/\+/g, ' '); var value = split.join('=').replace(/\+/g, ' '); form.append(decodeURIComponent(name), decodeURIComponent(value)); } }); return form } function parseHeaders(rawHeaders) { var headers = new Headers(); // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space // https://tools.ietf.org/html/rfc7230#section-3.2 var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' '); // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill // https://github.com/github/fetch/issues/748 // https://github.com/zloirock/core-js/issues/751 preProcessedHeaders .split('\r') .map(function(header) { return header.indexOf('\n') === 0 ? header.substr(1, header.length) : header }) .forEach(function(line) { var parts = line.split(':'); var key = parts.shift().trim(); if (key) { var value = parts.join(':').trim(); try { headers.append(key, value); } catch (error) { console.warn('Response ' + error.message); } } }); return headers } Body.call(Request.prototype); function Response(bodyInit, options) { if (!(this instanceof Response)) { throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.') } if (!options) { options = {}; } this.type = 'default'; this.status = options.status === undefined ? 200 : options.status; if (this.status < 200 || this.status > 599) { throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].") } this.ok = this.status >= 200 && this.status < 300; this.statusText = options.statusText === undefined ? '' : '' + options.statusText; this.headers = new Headers(options.headers); this.url = options.url || ''; this._initBody(bodyInit); } Body.call(Response.prototype); Response.prototype.clone = function() { return new Response(this._bodyInit, { status: this.status, statusText: this.statusText, headers: new Headers(this.headers), url: this.url }) }; Response.error = function() { var response = new Response(null, {status: 200, statusText: ''}); response.ok = false; response.status = 0; response.type = 'error'; return response }; var redirectStatuses = [301, 302, 303, 307, 308]; Response.redirect = function(url, status) { if (redirectStatuses.indexOf(status) === -1) { throw new RangeError('Invalid status code') } return new Response(null, {status: status, headers: {location: url}}) }; exports.DOMException = g.DOMException; try { new exports.DOMException(); } catch (err) { exports.DOMException = function(message, name) { this.message = message; this.name = name; var error = Error(message); this.stack = error.stack; }; exports.DOMException.prototype = Object.create(Error.prototype); exports.DOMException.prototype.constructor = exports.DOMException; } function fetch(input, init) { return new Promise(function(resolve, reject) { var request = new Request(input, init); if (request.signal && request.signal.aborted) { return reject(new exports.DOMException('Aborted', 'AbortError')) } var xhr = new XMLHttpRequest(); function abortXhr() { xhr.abort(); } xhr.onload = function() { var options = { statusText: xhr.statusText, headers: parseHeaders(xhr.getAllResponseHeaders() || '') }; // This check if specifically for when a user fetches a file locally from the file system // Only if the status is out of a normal range if (request.url.indexOf('file://') === 0 && (xhr.status < 200 || xhr.status > 599)) { options.status = 200; } else { options.status = xhr.status; } options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); var body = 'response' in xhr ? xhr.response : xhr.responseText; setTimeout(function() { resolve(new Response(body, options)); }, 0); }; xhr.onerror = function() { setTimeout(function() { reject(new TypeError('Network request failed')); }, 0); }; xhr.ontimeout = function() { setTimeout(function() { reject(new TypeError('Network request timed out')); }, 0); }; xhr.onabort = function() { setTimeout(function() { reject(new exports.DOMException('Aborted', 'AbortError')); }, 0); }; function fixUrl(url) { try { return url === '' && g.location.href ? g.location.href : url } catch (e) { return url } } xhr.open(request.method, fixUrl(request.url), true); if (request.credentials === 'include') { xhr.withCredentials = true; } else if (request.credentials === 'omit') { xhr.withCredentials = false; } if ('responseType' in xhr) { if (support.blob) { xhr.responseType = 'blob'; } else if ( support.arrayBuffer ) { xhr.responseType = 'arraybuffer'; } } if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) { var names = []; Object.getOwnPropertyNames(init.headers).forEach(function(name) { names.push(normalizeName(name)); xhr.setRequestHeader(name, normalizeValue(init.headers[name])); }); request.headers.forEach(function(value, name) { if (names.indexOf(name) === -1) { xhr.setRequestHeader(name, value); } }); } else { request.headers.forEach(function(value, name) { xhr.setRequestHeader(name, value); }); } if (request.signal) { request.signal.addEventListener('abort', abortXhr); xhr.onreadystatechange = function() { // DONE (success or failure) if (xhr.readyState === 4) { request.signal.removeEventListener('abort', abortXhr); } }; } xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit); }) } fetch.polyfill = true; if (!g.fetch) { g.fetch = fetch; g.Headers = Headers; g.Request = Request; g.Response = Response; } exports.Headers = Headers; exports.Request = Request; exports.Response = Response; exports.fetch = fetch; Object.defineProperty(exports, '__esModule', { value: true }); }))); vendor/react-dom.min.js 0000644 00000373662 15151622574 0011065 0 ustar 00 /** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ !function(){"use strict";var e,n;e=this,n=function(e,n){function t(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t<arguments.length;t++)n+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(e,n){l(e,n),l(e+"Capture",n)}function l(e,n){for(ra[e]=n,e=0;e<n.length;e++)ta.add(n[e])}function a(e,n,t,r,l,a,u){this.acceptsBooleans=2===n||3===n||4===n,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=t,this.propertyName=e,this.type=n,this.sanitizeURL=a,this.removeEmptyString=u}function u(e,n,t,r){var l=sa.hasOwnProperty(n)?sa[n]:null;(null!==l?0!==l.type:r||!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])&&(function(e,n,t,r){if(null==n||function(e,n,t,r){if(null!==t&&0===t.type)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==t?!t.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,n,t,r))return!0;if(r)return!1;if(null!==t)switch(t.type){case 3:return!n;case 4:return!1===n;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}(n,t,l,r)&&(t=null),r||null===l?function(e){return!!aa.call(ia,e)||!aa.call(oa,e)&&(ua.test(e)?ia[e]=!0:(oa[e]=!0,!1))}(n)&&(null===t?e.removeAttribute(n):e.setAttribute(n,""+t)):l.mustUseProperty?e[l.propertyName]=null===t?3!==l.type&&"":t:(n=l.attributeName,r=l.attributeNamespace,null===t?e.removeAttribute(n):(t=3===(l=l.type)||4===l&&!0===t?"":""+t,r?e.setAttributeNS(r,n,t):e.setAttribute(n,t))))}function o(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=_a&&e[_a]||e["@@iterator"])?e:null}function i(e,n,t){if(void 0===za)try{throw Error()}catch(e){za=(n=e.stack.trim().match(/\n( *(at )?)/))&&n[1]||""}return"\n"+za+e}function s(e,n){if(!e||Ta)return"";Ta=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(n){if(n&&r&&"string"==typeof n.stack){for(var l=n.stack.split("\n"),a=r.stack.split("\n"),u=l.length-1,o=a.length-1;1<=u&&0<=o&&l[u]!==a[o];)o--;for(;1<=u&&0<=o;u--,o--)if(l[u]!==a[o]){if(1!==u||1!==o)do{if(u--,0>--o||l[u]!==a[o]){var s="\n"+l[u].replace(" at new "," at ");return e.displayName&&s.includes("<anonymous>")&&(s=s.replace("<anonymous>",e.displayName)),s}}while(1<=u&&0<=o);break}}}finally{Ta=!1,Error.prepareStackTrace=t}return(e=e?e.displayName||e.name:"")?i(e):""}function c(e){switch(e.tag){case 5:return i(e.type);case 16:return i("Lazy");case 13:return i("Suspense");case 19:return i("SuspenseList");case 0:case 2:case 15:return e=s(e.type,!1);case 11:return e=s(e.type.render,!1);case 1:return e=s(e.type,!0);default:return""}}function f(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case ha:return"Fragment";case ma:return"Portal";case va:return"Profiler";case ga:return"StrictMode";case wa:return"Suspense";case Sa:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case ba:return(e.displayName||"Context")+".Consumer";case ya:return(e._context.displayName||"Context")+".Provider";case ka:var n=e.render;return(e=e.displayName)||(e=""!==(e=n.displayName||n.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case xa:return null!==(n=e.displayName||null)?n:f(e.type)||"Memo";case Ea:n=e._payload,e=e._init;try{return f(e(n))}catch(e){}}return null}function d(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=n.render).displayName||e.name||"",n.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return f(n);case 8:return n===ga?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof n)return n.displayName||n.name||null;if("string"==typeof n)return n}return null}function p(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function m(e){var n=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===n||"radio"===n)}function h(e){e._valueTracker||(e._valueTracker=function(e){var n=m(e)?"checked":"value",t=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),r=""+e[n];if(!e.hasOwnProperty(n)&&void 0!==t&&"function"==typeof t.get&&"function"==typeof t.set){var l=t.get,a=t.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return l.call(this)},set:function(e){r=""+e,a.call(this,e)}}),Object.defineProperty(e,n,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}(e))}function g(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var t=n.getValue(),r="";return e&&(r=m(e)?e.checked?"true":"false":e.value),(e=r)!==t&&(n.setValue(e),!0)}function v(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(n){return e.body}}function y(e,n){var t=n.checked;return La({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=t?t:e._wrapperState.initialChecked})}function b(e,n){var t=null==n.defaultValue?"":n.defaultValue,r=null!=n.checked?n.checked:n.defaultChecked;t=p(null!=n.value?n.value:t),e._wrapperState={initialChecked:r,initialValue:t,controlled:"checkbox"===n.type||"radio"===n.type?null!=n.checked:null!=n.value}}function k(e,n){null!=(n=n.checked)&&u(e,"checked",n,!1)}function w(e,n){k(e,n);var t=p(n.value),r=n.type;if(null!=t)"number"===r?(0===t&&""===e.value||e.value!=t)&&(e.value=""+t):e.value!==""+t&&(e.value=""+t);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");n.hasOwnProperty("value")?x(e,n.type,t):n.hasOwnProperty("defaultValue")&&x(e,n.type,p(n.defaultValue)),null==n.checked&&null!=n.defaultChecked&&(e.defaultChecked=!!n.defaultChecked)}function S(e,n,t){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var r=n.type;if(!("submit"!==r&&"reset"!==r||void 0!==n.value&&null!==n.value))return;n=""+e._wrapperState.initialValue,t||n===e.value||(e.value=n),e.defaultValue=n}""!==(t=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==t&&(e.name=t)}function x(e,n,t){"number"===n&&v(e.ownerDocument)===e||(null==t?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+t&&(e.defaultValue=""+t))}function E(e,n,t,r){if(e=e.options,n){n={};for(var l=0;l<t.length;l++)n["$"+t[l]]=!0;for(t=0;t<e.length;t++)l=n.hasOwnProperty("$"+e[t].value),e[t].selected!==l&&(e[t].selected=l),l&&r&&(e[t].defaultSelected=!0)}else{for(t=""+p(t),n=null,l=0;l<e.length;l++){if(e[l].value===t)return e[l].selected=!0,void(r&&(e[l].defaultSelected=!0));null!==n||e[l].disabled||(n=e[l])}null!==n&&(n.selected=!0)}}function C(e,n){if(null!=n.dangerouslySetInnerHTML)throw Error(t(91));return La({},n,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function z(e,n){var r=n.value;if(null==r){if(r=n.children,n=n.defaultValue,null!=r){if(null!=n)throw Error(t(92));if(Ma(r)){if(1<r.length)throw Error(t(93));r=r[0]}n=r}null==n&&(n=""),r=n}e._wrapperState={initialValue:p(r)}}function N(e,n){var t=p(n.value),r=p(n.defaultValue);null!=t&&((t=""+t)!==e.value&&(e.value=t),null==n.defaultValue&&e.defaultValue!==t&&(e.defaultValue=t)),null!=r&&(e.defaultValue=""+r)}function P(e,n){(n=e.textContent)===e._wrapperState.initialValue&&""!==n&&null!==n&&(e.value=n)}function _(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function L(e,n){return null==e||"http://www.w3.org/1999/xhtml"===e?_(n):"http://www.w3.org/2000/svg"===e&&"foreignObject"===n?"http://www.w3.org/1999/xhtml":e}function T(e,n,t){return null==n||"boolean"==typeof n||""===n?"":t||"number"!=typeof n||0===n||Da.hasOwnProperty(e)&&Da[e]?(""+n).trim():n+"px"}function M(e,n){for(var t in e=e.style,n)if(n.hasOwnProperty(t)){var r=0===t.indexOf("--"),l=T(t,n[t],r);"float"===t&&(t="cssFloat"),r?e.setProperty(t,l):e[t]=l}}function F(e,n){if(n){if(Ia[e]&&(null!=n.children||null!=n.dangerouslySetInnerHTML))throw Error(t(137,e));if(null!=n.dangerouslySetInnerHTML){if(null!=n.children)throw Error(t(60));if("object"!=typeof n.dangerouslySetInnerHTML||!("__html"in n.dangerouslySetInnerHTML))throw Error(t(61))}if(null!=n.style&&"object"!=typeof n.style)throw Error(t(62))}}function R(e,n){if(-1===e.indexOf("-"))return"string"==typeof n.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function D(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}function O(e){if(e=mn(e)){if("function"!=typeof Va)throw Error(t(280));var n=e.stateNode;n&&(n=gn(n),Va(e.stateNode,e.type,n))}}function I(e){Aa?Ba?Ba.push(e):Ba=[e]:Aa=e}function U(){if(Aa){var e=Aa,n=Ba;if(Ba=Aa=null,O(e),n)for(e=0;e<n.length;e++)O(n[e])}}function V(e,n,t){if(Qa)return e(n,t);Qa=!0;try{return Wa(e,n,t)}finally{Qa=!1,(null!==Aa||null!==Ba)&&(Ha(),U())}}function A(e,n){var r=e.stateNode;if(null===r)return null;var l=gn(r);if(null===l)return null;r=l[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(l=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!l;break e;default:e=!1}if(e)return null;if(r&&"function"!=typeof r)throw Error(t(231,n,typeof r));return r}function B(e,n,t,r,l,a,u,o,i){Ga=!1,Za=null,Xa.apply(nu,arguments)}function W(e,n,r,l,a,u,o,i,s){if(B.apply(this,arguments),Ga){if(!Ga)throw Error(t(198));var c=Za;Ga=!1,Za=null,Ja||(Ja=!0,eu=c)}}function H(e){var n=e,t=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do{!!(4098&(n=e).flags)&&(t=n.return),e=n.return}while(e)}return 3===n.tag?t:null}function Q(e){if(13===e.tag){var n=e.memoizedState;if(null===n&&null!==(e=e.alternate)&&(n=e.memoizedState),null!==n)return n.dehydrated}return null}function j(e){if(H(e)!==e)throw Error(t(188))}function $(e){return null!==(e=function(e){var n=e.alternate;if(!n){if(null===(n=H(e)))throw Error(t(188));return n!==e?null:e}for(var r=e,l=n;;){var a=r.return;if(null===a)break;var u=a.alternate;if(null===u){if(null!==(l=a.return)){r=l;continue}break}if(a.child===u.child){for(u=a.child;u;){if(u===r)return j(a),e;if(u===l)return j(a),n;u=u.sibling}throw Error(t(188))}if(r.return!==l.return)r=a,l=u;else{for(var o=!1,i=a.child;i;){if(i===r){o=!0,r=a,l=u;break}if(i===l){o=!0,l=a,r=u;break}i=i.sibling}if(!o){for(i=u.child;i;){if(i===r){o=!0,r=u,l=a;break}if(i===l){o=!0,l=u,r=a;break}i=i.sibling}if(!o)throw Error(t(189))}}if(r.alternate!==l)throw Error(t(190))}if(3!==r.tag)throw Error(t(188));return r.stateNode.current===r?e:n}(e))?q(e):null}function q(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var n=q(e);if(null!==n)return n;e=e.sibling}return null}function K(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Y(e,n){var t=e.pendingLanes;if(0===t)return 0;var r=0,l=e.suspendedLanes,a=e.pingedLanes,u=268435455&t;if(0!==u){var o=u&~l;0!==o?r=K(o):0!=(a&=u)&&(r=K(a))}else 0!=(u=t&~l)?r=K(u):0!==a&&(r=K(a));if(0===r)return 0;if(0!==n&&n!==r&&!(n&l)&&((l=r&-r)>=(a=n&-n)||16===l&&4194240&a))return n;if(4&r&&(r|=16&t),0!==(n=e.entangledLanes))for(e=e.entanglements,n&=r;0<n;)l=1<<(t=31-yu(n)),r|=e[t],n&=~l;return r}function X(e,n){switch(e){case 1:case 2:case 4:return n+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;default:return-1}}function G(e){return 0!=(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function Z(){var e=wu;return!(4194240&(wu<<=1))&&(wu=64),e}function J(e){for(var n=[],t=0;31>t;t++)n.push(e);return n}function ee(e,n,t){e.pendingLanes|=n,536870912!==n&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[n=31-yu(n)]=t}function ne(e,n){var t=e.entangledLanes|=n;for(e=e.entanglements;t;){var r=31-yu(t),l=1<<r;l&n|e[r]&n&&(e[r]|=n),t&=~l}}function te(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}function re(e,n){switch(e){case"focusin":case"focusout":zu=null;break;case"dragenter":case"dragleave":Nu=null;break;case"mouseover":case"mouseout":Pu=null;break;case"pointerover":case"pointerout":_u.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lu.delete(n.pointerId)}}function le(e,n,t,r,l,a){return null===e||e.nativeEvent!==a?(e={blockedOn:n,domEventName:t,eventSystemFlags:r,nativeEvent:a,targetContainers:[l]},null!==n&&null!==(n=mn(n))&&Ks(n),e):(e.eventSystemFlags|=r,n=e.targetContainers,null!==l&&-1===n.indexOf(l)&&n.push(l),e)}function ae(e){var n=pn(e.target);if(null!==n){var t=H(n);if(null!==t)if(13===(n=t.tag)){if(null!==(n=Q(t)))return e.blockedOn=n,void Gs(e.priority,(function(){Ys(t)}))}else if(3===n&&t.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===t.tag?t.stateNode.containerInfo:null)}e.blockedOn=null}function ue(e){if(null!==e.blockedOn)return!1;for(var n=e.targetContainers;0<n.length;){var t=me(e.domEventName,e.eventSystemFlags,n[0],e.nativeEvent);if(null!==t)return null!==(n=mn(t))&&Ks(n),e.blockedOn=t,!1;var r=new(t=e.nativeEvent).constructor(t.type,t);Ua=r,t.target.dispatchEvent(r),Ua=null,n.shift()}return!0}function oe(e,n,t){ue(e)&&t.delete(n)}function ie(){Eu=!1,null!==zu&&ue(zu)&&(zu=null),null!==Nu&&ue(Nu)&&(Nu=null),null!==Pu&&ue(Pu)&&(Pu=null),_u.forEach(oe),Lu.forEach(oe)}function se(e,n){e.blockedOn===n&&(e.blockedOn=null,Eu||(Eu=!0,ru(lu,ie)))}function ce(e){if(0<Cu.length){se(Cu[0],e);for(var n=1;n<Cu.length;n++){var t=Cu[n];t.blockedOn===e&&(t.blockedOn=null)}}for(null!==zu&&se(zu,e),null!==Nu&&se(Nu,e),null!==Pu&&se(Pu,e),n=function(n){return se(n,e)},_u.forEach(n),Lu.forEach(n),n=0;n<Tu.length;n++)(t=Tu[n]).blockedOn===e&&(t.blockedOn=null);for(;0<Tu.length&&null===(n=Tu[0]).blockedOn;)ae(n),null===n.blockedOn&&Tu.shift()}function fe(e,n,t,r){var l=xu,a=Fu.transition;Fu.transition=null;try{xu=1,pe(e,n,t,r)}finally{xu=l,Fu.transition=a}}function de(e,n,t,r){var l=xu,a=Fu.transition;Fu.transition=null;try{xu=4,pe(e,n,t,r)}finally{xu=l,Fu.transition=a}}function pe(e,n,t,r){if(Ru){var l=me(e,n,t,r);if(null===l)Je(e,n,r,Du,t),re(e,r);else if(function(e,n,t,r,l){switch(n){case"focusin":return zu=le(zu,e,n,t,r,l),!0;case"dragenter":return Nu=le(Nu,e,n,t,r,l),!0;case"mouseover":return Pu=le(Pu,e,n,t,r,l),!0;case"pointerover":var a=l.pointerId;return _u.set(a,le(_u.get(a)||null,e,n,t,r,l)),!0;case"gotpointercapture":return a=l.pointerId,Lu.set(a,le(Lu.get(a)||null,e,n,t,r,l)),!0}return!1}(l,e,n,t,r))r.stopPropagation();else if(re(e,r),4&n&&-1<Mu.indexOf(e)){for(;null!==l;){var a=mn(l);if(null!==a&&qs(a),null===(a=me(e,n,t,r))&&Je(e,n,r,Du,t),a===l)break;l=a}null!==l&&r.stopPropagation()}else Je(e,n,r,null,t)}}function me(e,n,t,r){if(Du=null,null!==(e=pn(e=D(r))))if(null===(n=H(e)))e=null;else if(13===(t=n.tag)){if(null!==(e=Q(n)))return e;e=null}else if(3===t){if(n.stateNode.current.memoizedState.isDehydrated)return 3===n.tag?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null);return Du=e,null}function he(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(cu()){case fu:return 1;case du:return 4;case pu:case mu:return 16;case hu:return 536870912;default:return 16}default:return 16}}function ge(){if(Uu)return Uu;var e,n,t=Iu,r=t.length,l="value"in Ou?Ou.value:Ou.textContent,a=l.length;for(e=0;e<r&&t[e]===l[e];e++);var u=r-e;for(n=1;n<=u&&t[r-n]===l[a-n];n++);return Uu=l.slice(e,1<n?1-n:void 0)}function ve(e){var n=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===n&&(e=13):e=n,10===e&&(e=13),32<=e||13===e?e:0}function ye(){return!0}function be(){return!1}function ke(e){function n(n,t,r,l,a){for(var u in this._reactName=n,this._targetInst=r,this.type=t,this.nativeEvent=l,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(u)&&(n=e[u],this[u]=n?n(l):l[u]);return this.isDefaultPrevented=(null!=l.defaultPrevented?l.defaultPrevented:!1===l.returnValue)?ye:be,this.isPropagationStopped=be,this}return La(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=ye)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=ye)},persist:function(){},isPersistent:ye}),n}function we(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):!!(e=eo[e])&&!!n[e]}function Se(e){return we}function xe(e,n){switch(e){case"keyup":return-1!==io.indexOf(n.keyCode);case"keydown":return 229!==n.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ee(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}function Ce(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===n?!!vo[e.type]:"textarea"===n}function ze(e,n,t,r){I(r),0<(n=nn(n,"onChange")).length&&(t=new Au("onChange","change",null,t,r),e.push({event:t,listeners:n}))}function Ne(e){Ke(e,0)}function Pe(e){if(g(hn(e)))return e}function _e(e,n){if("change"===e)return n}function Le(){yo&&(yo.detachEvent("onpropertychange",Te),bo=yo=null)}function Te(e){if("value"===e.propertyName&&Pe(bo)){var n=[];ze(n,bo,e,D(e)),V(Ne,n)}}function Me(e,n,t){"focusin"===e?(Le(),bo=t,(yo=n).attachEvent("onpropertychange",Te)):"focusout"===e&&Le()}function Fe(e,n){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Pe(bo)}function Re(e,n){if("click"===e)return Pe(n)}function De(e,n){if("input"===e||"change"===e)return Pe(n)}function Oe(e,n){if(wo(e,n))return!0;if("object"!=typeof e||null===e||"object"!=typeof n||null===n)return!1;var t=Object.keys(e),r=Object.keys(n);if(t.length!==r.length)return!1;for(r=0;r<t.length;r++){var l=t[r];if(!aa.call(n,l)||!wo(e[l],n[l]))return!1}return!0}function Ie(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ue(e,n){var t,r=Ie(e);for(e=0;r;){if(3===r.nodeType){if(t=e+r.textContent.length,e<=n&&t>=n)return{node:r,offset:n-e};e=t}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Ie(r)}}function Ve(e,n){return!(!e||!n)&&(e===n||(!e||3!==e.nodeType)&&(n&&3===n.nodeType?Ve(e,n.parentNode):"contains"in e?e.contains(n):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(n))))}function Ae(){for(var e=window,n=v();n instanceof e.HTMLIFrameElement;){try{var t="string"==typeof n.contentWindow.location.href}catch(e){t=!1}if(!t)break;n=v((e=n.contentWindow).document)}return n}function Be(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&("input"===n&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===n||"true"===e.contentEditable)}function We(e){var n=Ae(),t=e.focusedElem,r=e.selectionRange;if(n!==t&&t&&t.ownerDocument&&Ve(t.ownerDocument.documentElement,t)){if(null!==r&&Be(t))if(n=r.start,void 0===(e=r.end)&&(e=n),"selectionStart"in t)t.selectionStart=n,t.selectionEnd=Math.min(e,t.value.length);else if((e=(n=t.ownerDocument||document)&&n.defaultView||window).getSelection){e=e.getSelection();var l=t.textContent.length,a=Math.min(r.start,l);r=void 0===r.end?a:Math.min(r.end,l),!e.extend&&a>r&&(l=r,r=a,a=l),l=Ue(t,a);var u=Ue(t,r);l&&u&&(1!==e.rangeCount||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==u.node||e.focusOffset!==u.offset)&&((n=n.createRange()).setStart(l.node,l.offset),e.removeAllRanges(),a>r?(e.addRange(n),e.extend(u.node,u.offset)):(n.setEnd(u.node,u.offset),e.addRange(n)))}for(n=[],e=t;e=e.parentNode;)1===e.nodeType&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof t.focus&&t.focus(),t=0;t<n.length;t++)(e=n[t]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}function He(e,n,t){var r=t.window===t?t.document:9===t.nodeType?t:t.ownerDocument;zo||null==xo||xo!==v(r)||(r="selectionStart"in(r=xo)&&Be(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},Co&&Oe(Co,r)||(Co=r,0<(r=nn(Eo,"onSelect")).length&&(n=new Au("onSelect","select",null,n,t),e.push({event:n,listeners:r}),n.target=xo)))}function Qe(e,n){var t={};return t[e.toLowerCase()]=n.toLowerCase(),t["Webkit"+e]="webkit"+n,t["Moz"+e]="moz"+n,t}function je(e){if(Po[e])return Po[e];if(!No[e])return e;var n,t=No[e];for(n in t)if(t.hasOwnProperty(n)&&n in _o)return Po[e]=t[n];return e}function $e(e,n){Ro.set(e,n),r(n,[e])}function qe(e,n,t){var r=e.type||"unknown-event";e.currentTarget=t,W(r,n,void 0,e),e.currentTarget=null}function Ke(e,n){n=!!(4&n);for(var t=0;t<e.length;t++){var r=e[t],l=r.event;r=r.listeners;e:{var a=void 0;if(n)for(var u=r.length-1;0<=u;u--){var o=r[u],i=o.instance,s=o.currentTarget;if(o=o.listener,i!==a&&l.isPropagationStopped())break e;qe(l,o,s),a=i}else for(u=0;u<r.length;u++){if(i=(o=r[u]).instance,s=o.currentTarget,o=o.listener,i!==a&&l.isPropagationStopped())break e;qe(l,o,s),a=i}}}if(Ja)throw e=eu,Ja=!1,eu=null,e}function Ye(e,n){var t=n[Go];void 0===t&&(t=n[Go]=new Set);var r=e+"__bubble";t.has(r)||(Ze(n,e,2,!1),t.add(r))}function Xe(e,n,t){var r=0;n&&(r|=4),Ze(t,e,r,n)}function Ge(e){if(!e[Uo]){e[Uo]=!0,ta.forEach((function(n){"selectionchange"!==n&&(Io.has(n)||Xe(n,!1,e),Xe(n,!0,e))}));var n=9===e.nodeType?e:e.ownerDocument;null===n||n[Uo]||(n[Uo]=!0,Xe("selectionchange",!1,n))}}function Ze(e,n,t,r,l){switch(he(n)){case 1:l=fe;break;case 4:l=de;break;default:l=pe}t=l.bind(null,n,t,e),l=void 0,!ja||"touchstart"!==n&&"touchmove"!==n&&"wheel"!==n||(l=!0),r?void 0!==l?e.addEventListener(n,t,{capture:!0,passive:l}):e.addEventListener(n,t,!0):void 0!==l?e.addEventListener(n,t,{passive:l}):e.addEventListener(n,t,!1)}function Je(e,n,t,r,l){var a=r;if(!(1&n||2&n||null===r))e:for(;;){if(null===r)return;var u=r.tag;if(3===u||4===u){var o=r.stateNode.containerInfo;if(o===l||8===o.nodeType&&o.parentNode===l)break;if(4===u)for(u=r.return;null!==u;){var i=u.tag;if((3===i||4===i)&&((i=u.stateNode.containerInfo)===l||8===i.nodeType&&i.parentNode===l))return;u=u.return}for(;null!==o;){if(null===(u=pn(o)))return;if(5===(i=u.tag)||6===i){r=a=u;continue e}o=o.parentNode}}r=r.return}V((function(){var r=a,l=D(t),u=[];e:{var o=Ro.get(e);if(void 0!==o){var i=Au,s=e;switch(e){case"keypress":if(0===ve(t))break e;case"keydown":case"keyup":i=to;break;case"focusin":s="focus",i=$u;break;case"focusout":s="blur",i=$u;break;case"beforeblur":case"afterblur":i=$u;break;case"click":if(2===t.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":i=Qu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":i=ju;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":i=lo;break;case Lo:case To:case Mo:i=qu;break;case Fo:i=ao;break;case"scroll":i=Wu;break;case"wheel":i=oo;break;case"copy":case"cut":case"paste":i=Yu;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":i=ro}var c=!!(4&n),f=!c&&"scroll"===e,d=c?null!==o?o+"Capture":null:o;c=[];for(var p,m=r;null!==m;){var h=(p=m).stateNode;if(5===p.tag&&null!==h&&(p=h,null!==d&&null!=(h=A(m,d))&&c.push(en(m,h,p))),f)break;m=m.return}0<c.length&&(o=new i(o,s,null,t,l),u.push({event:o,listeners:c}))}}if(!(7&n)){if(i="mouseout"===e||"pointerout"===e,(!(o="mouseover"===e||"pointerover"===e)||t===Ua||!(s=t.relatedTarget||t.fromElement)||!pn(s)&&!s[Xo])&&(i||o)&&(o=l.window===l?l:(o=l.ownerDocument)?o.defaultView||o.parentWindow:window,i?(i=r,null!==(s=(s=t.relatedTarget||t.toElement)?pn(s):null)&&(s!==(f=H(s))||5!==s.tag&&6!==s.tag)&&(s=null)):(i=null,s=r),i!==s)){if(c=Qu,h="onMouseLeave",d="onMouseEnter",m="mouse","pointerout"!==e&&"pointerover"!==e||(c=ro,h="onPointerLeave",d="onPointerEnter",m="pointer"),f=null==i?o:hn(i),p=null==s?o:hn(s),(o=new c(h,m+"leave",i,t,l)).target=f,o.relatedTarget=p,h=null,pn(l)===r&&((c=new c(d,m+"enter",s,t,l)).target=p,c.relatedTarget=f,h=c),f=h,i&&s)e:{for(d=s,m=0,p=c=i;p;p=tn(p))m++;for(p=0,h=d;h;h=tn(h))p++;for(;0<m-p;)c=tn(c),m--;for(;0<p-m;)d=tn(d),p--;for(;m--;){if(c===d||null!==d&&c===d.alternate)break e;c=tn(c),d=tn(d)}c=null}else c=null;null!==i&&rn(u,o,i,c,!1),null!==s&&null!==f&&rn(u,f,s,c,!0)}if("select"===(i=(o=r?hn(r):window).nodeName&&o.nodeName.toLowerCase())||"input"===i&&"file"===o.type)var g=_e;else if(Ce(o))if(ko)g=De;else{g=Fe;var v=Me}else(i=o.nodeName)&&"input"===i.toLowerCase()&&("checkbox"===o.type||"radio"===o.type)&&(g=Re);switch(g&&(g=g(e,r))?ze(u,g,t,l):(v&&v(e,o,r),"focusout"===e&&(v=o._wrapperState)&&v.controlled&&"number"===o.type&&x(o,"number",o.value)),v=r?hn(r):window,e){case"focusin":(Ce(v)||"true"===v.contentEditable)&&(xo=v,Eo=r,Co=null);break;case"focusout":Co=Eo=xo=null;break;case"mousedown":zo=!0;break;case"contextmenu":case"mouseup":case"dragend":zo=!1,He(u,t,l);break;case"selectionchange":if(So)break;case"keydown":case"keyup":He(u,t,l)}var y;if(so)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else go?xe(e,t)&&(b="onCompositionEnd"):"keydown"===e&&229===t.keyCode&&(b="onCompositionStart");b&&(po&&"ko"!==t.locale&&(go||"onCompositionStart"!==b?"onCompositionEnd"===b&&go&&(y=ge()):(Iu="value"in(Ou=l)?Ou.value:Ou.textContent,go=!0)),0<(v=nn(r,b)).length&&(b=new Xu(b,e,null,t,l),u.push({event:b,listeners:v}),(y||null!==(y=Ee(t)))&&(b.data=y))),(y=fo?function(e,n){switch(e){case"compositionend":return Ee(n);case"keypress":return 32!==n.which?null:(ho=!0,mo);case"textInput":return(e=n.data)===mo&&ho?null:e;default:return null}}(e,t):function(e,n){if(go)return"compositionend"===e||!so&&xe(e,n)?(e=ge(),Uu=Iu=Ou=null,go=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return po&&"ko"!==n.locale?null:n.data}}(e,t))&&0<(r=nn(r,"onBeforeInput")).length&&(l=new Gu("onBeforeInput","beforeinput",null,t,l),u.push({event:l,listeners:r}),l.data=y)}Ke(u,n)}))}function en(e,n,t){return{instance:e,listener:n,currentTarget:t}}function nn(e,n){for(var t=n+"Capture",r=[];null!==e;){var l=e,a=l.stateNode;5===l.tag&&null!==a&&(l=a,null!=(a=A(e,t))&&r.unshift(en(e,a,l)),null!=(a=A(e,n))&&r.push(en(e,a,l))),e=e.return}return r}function tn(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function rn(e,n,t,r,l){for(var a=n._reactName,u=[];null!==t&&t!==r;){var o=t,i=o.alternate,s=o.stateNode;if(null!==i&&i===r)break;5===o.tag&&null!==s&&(o=s,l?null!=(i=A(t,a))&&u.unshift(en(t,i,o)):l||null!=(i=A(t,a))&&u.push(en(t,i,o))),t=t.return}0!==u.length&&e.push({event:n,listeners:u})}function ln(e){return("string"==typeof e?e:""+e).replace(Vo,"\n").replace(Ao,"")}function an(e,n,r,l){if(n=ln(n),ln(e)!==n&&r)throw Error(t(425))}function un(){}function on(e,n){return"textarea"===e||"noscript"===e||"string"==typeof n.children||"number"==typeof n.children||"object"==typeof n.dangerouslySetInnerHTML&&null!==n.dangerouslySetInnerHTML&&null!=n.dangerouslySetInnerHTML.__html}function sn(e){setTimeout((function(){throw e}))}function cn(e,n){var t=n,r=0;do{var l=t.nextSibling;if(e.removeChild(t),l&&8===l.nodeType)if("/$"===(t=l.data)){if(0===r)return e.removeChild(l),void ce(n);r--}else"$"!==t&&"$?"!==t&&"$!"!==t||r++;t=l}while(t);ce(n)}function fn(e){for(;null!=e;e=e.nextSibling){var n=e.nodeType;if(1===n||3===n)break;if(8===n){if("$"===(n=e.data)||"$!"===n||"$?"===n)break;if("/$"===n)return null}}return e}function dn(e){e=e.previousSibling;for(var n=0;e;){if(8===e.nodeType){var t=e.data;if("$"===t||"$!"===t||"$?"===t){if(0===n)return e;n--}else"/$"===t&&n++}e=e.previousSibling}return null}function pn(e){var n=e[Ko];if(n)return n;for(var t=e.parentNode;t;){if(n=t[Xo]||t[Ko]){if(t=n.alternate,null!==n.child||null!==t&&null!==t.child)for(e=dn(e);null!==e;){if(t=e[Ko])return t;e=dn(e)}return n}t=(e=t).parentNode}return null}function mn(e){return!(e=e[Ko]||e[Xo])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function hn(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(t(33))}function gn(e){return e[Yo]||null}function vn(e){return{current:e}}function yn(e,n){0>ni||(e.current=ei[ni],ei[ni]=null,ni--)}function bn(e,n,t){ni++,ei[ni]=e.current,e.current=n}function kn(e,n){var t=e.type.contextTypes;if(!t)return ti;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===n)return r.__reactInternalMemoizedMaskedChildContext;var l,a={};for(l in t)a[l]=n[l];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=a),a}function wn(e){return null!=(e=e.childContextTypes)}function Sn(e,n,r){if(ri.current!==ti)throw Error(t(168));bn(ri,n),bn(li,r)}function xn(e,n,r){var l=e.stateNode;if(n=n.childContextTypes,"function"!=typeof l.getChildContext)return r;for(var a in l=l.getChildContext())if(!(a in n))throw Error(t(108,d(e)||"Unknown",a));return La({},r,l)}function En(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ti,ai=ri.current,bn(ri,e),bn(li,li.current),!0}function Cn(e,n,r){var l=e.stateNode;if(!l)throw Error(t(169));r?(e=xn(e,n,ai),l.__reactInternalMemoizedMergedChildContext=e,yn(li),yn(ri),bn(ri,e)):yn(li),bn(li,r)}function zn(e){null===ui?ui=[e]:ui.push(e)}function Nn(){if(!ii&&null!==ui){ii=!0;var e=0,n=xu;try{var t=ui;for(xu=1;e<t.length;e++){var r=t[e];do{r=r(!0)}while(null!==r)}ui=null,oi=!1}catch(n){throw null!==ui&&(ui=ui.slice(e+1)),au(fu,Nn),n}finally{xu=n,ii=!1}}return null}function Pn(e,n){si[ci++]=di,si[ci++]=fi,fi=e,di=n}function _n(e,n,t){pi[mi++]=gi,pi[mi++]=vi,pi[mi++]=hi,hi=e;var r=gi;e=vi;var l=32-yu(r)-1;r&=~(1<<l),t+=1;var a=32-yu(n)+l;if(30<a){var u=l-l%5;a=(r&(1<<u)-1).toString(32),r>>=u,l-=u,gi=1<<32-yu(n)+l|t<<l|r,vi=a+e}else gi=1<<a|t<<l|r,vi=e}function Ln(e){null!==e.return&&(Pn(e,1),_n(e,1,0))}function Tn(e){for(;e===fi;)fi=si[--ci],si[ci]=null,di=si[--ci],si[ci]=null;for(;e===hi;)hi=pi[--mi],pi[mi]=null,vi=pi[--mi],pi[mi]=null,gi=pi[--mi],pi[mi]=null}function Mn(e,n){var t=js(5,null,null,0);t.elementType="DELETED",t.stateNode=n,t.return=e,null===(n=e.deletions)?(e.deletions=[t],e.flags|=16):n.push(t)}function Fn(e,n){switch(e.tag){case 5:var t=e.type;return null!==(n=1!==n.nodeType||t.toLowerCase()!==n.nodeName.toLowerCase()?null:n)&&(e.stateNode=n,yi=e,bi=fn(n.firstChild),!0);case 6:return null!==(n=""===e.pendingProps||3!==n.nodeType?null:n)&&(e.stateNode=n,yi=e,bi=null,!0);case 13:return null!==(n=8!==n.nodeType?null:n)&&(t=null!==hi?{id:gi,overflow:vi}:null,e.memoizedState={dehydrated:n,treeContext:t,retryLane:1073741824},(t=js(18,null,null,0)).stateNode=n,t.return=e,e.child=t,yi=e,bi=null,!0);default:return!1}}function Rn(e){return!(!(1&e.mode)||128&e.flags)}function Dn(e){if(ki){var n=bi;if(n){var r=n;if(!Fn(e,n)){if(Rn(e))throw Error(t(418));n=fn(r.nextSibling);var l=yi;n&&Fn(e,n)?Mn(l,r):(e.flags=-4097&e.flags|2,ki=!1,yi=e)}}else{if(Rn(e))throw Error(t(418));e.flags=-4097&e.flags|2,ki=!1,yi=e}}}function On(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;yi=e}function In(e){if(e!==yi)return!1;if(!ki)return On(e),ki=!0,!1;var n;if((n=3!==e.tag)&&!(n=5!==e.tag)&&(n="head"!==(n=e.type)&&"body"!==n&&!on(e.type,e.memoizedProps)),n&&(n=bi)){if(Rn(e)){for(e=bi;e;)e=fn(e.nextSibling);throw Error(t(418))}for(;n;)Mn(e,n),n=fn(n.nextSibling)}if(On(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(t(317));e:{for(e=e.nextSibling,n=0;e;){if(8===e.nodeType){var r=e.data;if("/$"===r){if(0===n){bi=fn(e.nextSibling);break e}n--}else"$"!==r&&"$!"!==r&&"$?"!==r||n++}e=e.nextSibling}bi=null}}else bi=yi?fn(e.stateNode.nextSibling):null;return!0}function Un(){bi=yi=null,ki=!1}function Vn(e){null===wi?wi=[e]:wi.push(e)}function An(e,n,r){if(null!==(e=r.ref)&&"function"!=typeof e&&"object"!=typeof e){if(r._owner){if(r=r._owner){if(1!==r.tag)throw Error(t(309));var l=r.stateNode}if(!l)throw Error(t(147,e));var a=l,u=""+e;return null!==n&&null!==n.ref&&"function"==typeof n.ref&&n.ref._stringRef===u?n.ref:(n=function(e){var n=a.refs;null===e?delete n[u]:n[u]=e},n._stringRef=u,n)}if("string"!=typeof e)throw Error(t(284));if(!r._owner)throw Error(t(290,e))}return e}function Bn(e,n){throw e=Object.prototype.toString.call(n),Error(t(31,"[object Object]"===e?"object with keys {"+Object.keys(n).join(", ")+"}":e))}function Wn(e){return(0,e._init)(e._payload)}function Hn(e){function n(n,t){if(e){var r=n.deletions;null===r?(n.deletions=[t],n.flags|=16):r.push(t)}}function r(t,r){if(!e)return null;for(;null!==r;)n(t,r),r=r.sibling;return null}function l(e,n){for(e=new Map;null!==n;)null!==n.key?e.set(n.key,n):e.set(n.index,n),n=n.sibling;return e}function a(e,n){return(e=Rl(e,n)).index=0,e.sibling=null,e}function u(n,t,r){return n.index=r,e?null!==(r=n.alternate)?(r=r.index)<t?(n.flags|=2,t):r:(n.flags|=2,t):(n.flags|=1048576,t)}function i(n){return e&&null===n.alternate&&(n.flags|=2),n}function s(e,n,t,r){return null===n||6!==n.tag?((n=Ul(t,e.mode,r)).return=e,n):((n=a(n,t)).return=e,n)}function c(e,n,t,r){var l=t.type;return l===ha?d(e,n,t.props.children,r,t.key):null!==n&&(n.elementType===l||"object"==typeof l&&null!==l&&l.$$typeof===Ea&&Wn(l)===n.type)?((r=a(n,t.props)).ref=An(e,n,t),r.return=e,r):((r=Dl(t.type,t.key,t.props,null,e.mode,r)).ref=An(e,n,t),r.return=e,r)}function f(e,n,t,r){return null===n||4!==n.tag||n.stateNode.containerInfo!==t.containerInfo||n.stateNode.implementation!==t.implementation?((n=Vl(t,e.mode,r)).return=e,n):((n=a(n,t.children||[])).return=e,n)}function d(e,n,t,r,l){return null===n||7!==n.tag?((n=Ol(t,e.mode,r,l)).return=e,n):((n=a(n,t)).return=e,n)}function p(e,n,t){if("string"==typeof n&&""!==n||"number"==typeof n)return(n=Ul(""+n,e.mode,t)).return=e,n;if("object"==typeof n&&null!==n){switch(n.$$typeof){case pa:return(t=Dl(n.type,n.key,n.props,null,e.mode,t)).ref=An(e,null,n),t.return=e,t;case ma:return(n=Vl(n,e.mode,t)).return=e,n;case Ea:return p(e,(0,n._init)(n._payload),t)}if(Ma(n)||o(n))return(n=Ol(n,e.mode,t,null)).return=e,n;Bn(e,n)}return null}function m(e,n,t,r){var l=null!==n?n.key:null;if("string"==typeof t&&""!==t||"number"==typeof t)return null!==l?null:s(e,n,""+t,r);if("object"==typeof t&&null!==t){switch(t.$$typeof){case pa:return t.key===l?c(e,n,t,r):null;case ma:return t.key===l?f(e,n,t,r):null;case Ea:return m(e,n,(l=t._init)(t._payload),r)}if(Ma(t)||o(t))return null!==l?null:d(e,n,t,r,null);Bn(e,t)}return null}function h(e,n,t,r,l){if("string"==typeof r&&""!==r||"number"==typeof r)return s(n,e=e.get(t)||null,""+r,l);if("object"==typeof r&&null!==r){switch(r.$$typeof){case pa:return c(n,e=e.get(null===r.key?t:r.key)||null,r,l);case ma:return f(n,e=e.get(null===r.key?t:r.key)||null,r,l);case Ea:return h(e,n,t,(0,r._init)(r._payload),l)}if(Ma(r)||o(r))return d(n,e=e.get(t)||null,r,l,null);Bn(n,r)}return null}function g(t,a,o,i){for(var s=null,c=null,f=a,d=a=0,g=null;null!==f&&d<o.length;d++){f.index>d?(g=f,f=null):g=f.sibling;var v=m(t,f,o[d],i);if(null===v){null===f&&(f=g);break}e&&f&&null===v.alternate&&n(t,f),a=u(v,a,d),null===c?s=v:c.sibling=v,c=v,f=g}if(d===o.length)return r(t,f),ki&&Pn(t,d),s;if(null===f){for(;d<o.length;d++)null!==(f=p(t,o[d],i))&&(a=u(f,a,d),null===c?s=f:c.sibling=f,c=f);return ki&&Pn(t,d),s}for(f=l(t,f);d<o.length;d++)null!==(g=h(f,t,d,o[d],i))&&(e&&null!==g.alternate&&f.delete(null===g.key?d:g.key),a=u(g,a,d),null===c?s=g:c.sibling=g,c=g);return e&&f.forEach((function(e){return n(t,e)})),ki&&Pn(t,d),s}function v(a,i,s,c){var f=o(s);if("function"!=typeof f)throw Error(t(150));if(null==(s=f.call(s)))throw Error(t(151));for(var d=f=null,g=i,v=i=0,y=null,b=s.next();null!==g&&!b.done;v++,b=s.next()){g.index>v?(y=g,g=null):y=g.sibling;var k=m(a,g,b.value,c);if(null===k){null===g&&(g=y);break}e&&g&&null===k.alternate&&n(a,g),i=u(k,i,v),null===d?f=k:d.sibling=k,d=k,g=y}if(b.done)return r(a,g),ki&&Pn(a,v),f;if(null===g){for(;!b.done;v++,b=s.next())null!==(b=p(a,b.value,c))&&(i=u(b,i,v),null===d?f=b:d.sibling=b,d=b);return ki&&Pn(a,v),f}for(g=l(a,g);!b.done;v++,b=s.next())null!==(b=h(g,a,v,b.value,c))&&(e&&null!==b.alternate&&g.delete(null===b.key?v:b.key),i=u(b,i,v),null===d?f=b:d.sibling=b,d=b);return e&&g.forEach((function(e){return n(a,e)})),ki&&Pn(a,v),f}return function e(t,l,u,s){if("object"==typeof u&&null!==u&&u.type===ha&&null===u.key&&(u=u.props.children),"object"==typeof u&&null!==u){switch(u.$$typeof){case pa:e:{for(var c=u.key,f=l;null!==f;){if(f.key===c){if((c=u.type)===ha){if(7===f.tag){r(t,f.sibling),(l=a(f,u.props.children)).return=t,t=l;break e}}else if(f.elementType===c||"object"==typeof c&&null!==c&&c.$$typeof===Ea&&Wn(c)===f.type){r(t,f.sibling),(l=a(f,u.props)).ref=An(t,f,u),l.return=t,t=l;break e}r(t,f);break}n(t,f),f=f.sibling}u.type===ha?((l=Ol(u.props.children,t.mode,s,u.key)).return=t,t=l):((s=Dl(u.type,u.key,u.props,null,t.mode,s)).ref=An(t,l,u),s.return=t,t=s)}return i(t);case ma:e:{for(f=u.key;null!==l;){if(l.key===f){if(4===l.tag&&l.stateNode.containerInfo===u.containerInfo&&l.stateNode.implementation===u.implementation){r(t,l.sibling),(l=a(l,u.children||[])).return=t,t=l;break e}r(t,l);break}n(t,l),l=l.sibling}(l=Vl(u,t.mode,s)).return=t,t=l}return i(t);case Ea:return e(t,l,(f=u._init)(u._payload),s)}if(Ma(u))return g(t,l,u,s);if(o(u))return v(t,l,u,s);Bn(t,u)}return"string"==typeof u&&""!==u||"number"==typeof u?(u=""+u,null!==l&&6===l.tag?(r(t,l.sibling),(l=a(l,u)).return=t,t=l):(r(t,l),(l=Ul(u,t.mode,s)).return=t,t=l),i(t)):r(t,l)}}function Qn(){Pi=Ni=zi=null}function jn(e,n){n=Ci.current,yn(Ci),e._currentValue=n}function $n(e,n,t){for(;null!==e;){var r=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,null!==r&&(r.childLanes|=n)):null!==r&&(r.childLanes&n)!==n&&(r.childLanes|=n),e===t)break;e=e.return}}function qn(e,n){zi=e,Pi=Ni=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(!!(e.lanes&n)&&(ns=!0),e.firstContext=null)}function Kn(e){var n=e._currentValue;if(Pi!==e)if(e={context:e,memoizedValue:n,next:null},null===Ni){if(null===zi)throw Error(t(308));Ni=e,zi.dependencies={lanes:0,firstContext:e}}else Ni=Ni.next=e;return n}function Yn(e){null===_i?_i=[e]:_i.push(e)}function Xn(e,n,t,r){var l=n.interleaved;return null===l?(t.next=t,Yn(n)):(t.next=l.next,l.next=t),n.interleaved=t,Gn(e,r)}function Gn(e,n){e.lanes|=n;var t=e.alternate;for(null!==t&&(t.lanes|=n),t=e,e=e.return;null!==e;)e.childLanes|=n,null!==(t=e.alternate)&&(t.childLanes|=n),t=e,e=e.return;return 3===t.tag?t.stateNode:null}function Zn(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Jn(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function et(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function nt(e,n,t){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&ys){var l=r.pending;return null===l?n.next=n:(n.next=l.next,l.next=n),r.pending=n,Li(e,t)}return null===(l=r.interleaved)?(n.next=n,Yn(r)):(n.next=l.next,l.next=n),r.interleaved=n,Gn(e,t)}function tt(e,n,t){if(null!==(n=n.updateQueue)&&(n=n.shared,4194240&t)){var r=n.lanes;t|=r&=e.pendingLanes,n.lanes=t,ne(e,t)}}function rt(e,n){var t=e.updateQueue,r=e.alternate;if(null!==r&&t===(r=r.updateQueue)){var l=null,a=null;if(null!==(t=t.firstBaseUpdate)){do{var u={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};null===a?l=a=u:a=a.next=u,t=t.next}while(null!==t);null===a?l=a=n:a=a.next=n}else l=a=n;return t={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:a,shared:r.shared,effects:r.effects},void(e.updateQueue=t)}null===(e=t.lastBaseUpdate)?t.firstBaseUpdate=n:e.next=n,t.lastBaseUpdate=n}function lt(e,n,t,r){var l=e.updateQueue;Ti=!1;var a=l.firstBaseUpdate,u=l.lastBaseUpdate,o=l.shared.pending;if(null!==o){l.shared.pending=null;var i=o,s=i.next;i.next=null,null===u?a=s:u.next=s,u=i;var c=e.alternate;null!==c&&(o=(c=c.updateQueue).lastBaseUpdate)!==u&&(null===o?c.firstBaseUpdate=s:o.next=s,c.lastBaseUpdate=i)}if(null!==a){var f=l.baseState;for(u=0,c=s=i=null,o=a;;){var d=o.lane,p=o.eventTime;if((r&d)===d){null!==c&&(c=c.next={eventTime:p,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var m=e,h=o;switch(d=n,p=t,h.tag){case 1:if("function"==typeof(m=h.payload)){f=m.call(p,f,d);break e}f=m;break e;case 3:m.flags=-65537&m.flags|128;case 0:if(null==(d="function"==typeof(m=h.payload)?m.call(p,f,d):m))break e;f=La({},f,d);break e;case 2:Ti=!0}}null!==o.callback&&0!==o.lane&&(e.flags|=64,null===(d=l.effects)?l.effects=[o]:d.push(o))}else p={eventTime:p,lane:d,tag:o.tag,payload:o.payload,callback:o.callback,next:null},null===c?(s=c=p,i=f):c=c.next=p,u|=d;if(null===(o=o.next)){if(null===(o=l.shared.pending))break;o=(d=o).next,d.next=null,l.lastBaseUpdate=d,l.shared.pending=null}}if(null===c&&(i=f),l.baseState=i,l.firstBaseUpdate=s,l.lastBaseUpdate=c,null!==(n=l.shared.interleaved)){l=n;do{u|=l.lane,l=l.next}while(l!==n)}else null===a&&(l.shared.lanes=0);zs|=u,e.lanes=u,e.memoizedState=f}}function at(e,n,r){if(e=n.effects,n.effects=null,null!==e)for(n=0;n<e.length;n++){var l=e[n],a=l.callback;if(null!==a){if(l.callback=null,l=r,"function"!=typeof a)throw Error(t(191,a));a.call(l)}}}function ut(e){if(e===Mi)throw Error(t(174));return e}function ot(e,n){switch(bn(Di,n),bn(Ri,e),bn(Fi,Mi),e=n.nodeType){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:L(null,"");break;default:n=L(n=(e=8===e?n.parentNode:n).namespaceURI||null,e=e.tagName)}yn(Fi),bn(Fi,n)}function it(e){yn(Fi),yn(Ri),yn(Di)}function st(e){ut(Di.current);var n=ut(Fi.current),t=L(n,e.type);n!==t&&(bn(Ri,e),bn(Fi,t))}function ct(e){Ri.current===e&&(yn(Fi),yn(Ri))}function ft(e){for(var n=e;null!==n;){if(13===n.tag){var t=n.memoizedState;if(null!==t&&(null===(t=t.dehydrated)||"$?"===t.data||"$!"===t.data))return n}else if(19===n.tag&&void 0!==n.memoizedProps.revealOrder){if(128&n.flags)return n}else if(null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}function dt(){for(var e=0;e<Ii.length;e++)Ii[e]._workInProgressVersionPrimary=null;Ii.length=0}function pt(){throw Error(t(321))}function mt(e,n){if(null===n)return!1;for(var t=0;t<n.length&&t<e.length;t++)if(!wo(e[t],n[t]))return!1;return!0}function ht(e,n,r,l,a,u){if(Ai=u,Bi=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Ui.current=null===e||null===e.memoizedState?Yi:Xi,e=r(l,a),ji){u=0;do{if(ji=!1,$i=0,25<=u)throw Error(t(301));u+=1,Hi=Wi=null,n.updateQueue=null,Ui.current=Gi,e=r(l,a)}while(ji)}if(Ui.current=Ki,n=null!==Wi&&null!==Wi.next,Ai=0,Hi=Wi=Bi=null,Qi=!1,n)throw Error(t(300));return e}function gt(){var e=0!==$i;return $i=0,e}function vt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Hi?Bi.memoizedState=Hi=e:Hi=Hi.next=e,Hi}function yt(){if(null===Wi){var e=Bi.alternate;e=null!==e?e.memoizedState:null}else e=Wi.next;var n=null===Hi?Bi.memoizedState:Hi.next;if(null!==n)Hi=n,Wi=e;else{if(null===e)throw Error(t(310));e={memoizedState:(Wi=e).memoizedState,baseState:Wi.baseState,baseQueue:Wi.baseQueue,queue:Wi.queue,next:null},null===Hi?Bi.memoizedState=Hi=e:Hi=Hi.next=e}return Hi}function bt(e,n){return"function"==typeof n?n(e):n}function kt(e,n,r){if(null===(r=(n=yt()).queue))throw Error(t(311));r.lastRenderedReducer=e;var l=Wi,a=l.baseQueue,u=r.pending;if(null!==u){if(null!==a){var o=a.next;a.next=u.next,u.next=o}l.baseQueue=a=u,r.pending=null}if(null!==a){u=a.next,l=l.baseState;var i=o=null,s=null,c=u;do{var f=c.lane;if((Ai&f)===f)null!==s&&(s=s.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),l=c.hasEagerState?c.eagerState:e(l,c.action);else{var d={lane:f,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};null===s?(i=s=d,o=l):s=s.next=d,Bi.lanes|=f,zs|=f}c=c.next}while(null!==c&&c!==u);null===s?o=l:s.next=i,wo(l,n.memoizedState)||(ns=!0),n.memoizedState=l,n.baseState=o,n.baseQueue=s,r.lastRenderedState=l}if(null!==(e=r.interleaved)){a=e;do{u=a.lane,Bi.lanes|=u,zs|=u,a=a.next}while(a!==e)}else null===a&&(r.lanes=0);return[n.memoizedState,r.dispatch]}function wt(e,n,r){if(null===(r=(n=yt()).queue))throw Error(t(311));r.lastRenderedReducer=e;var l=r.dispatch,a=r.pending,u=n.memoizedState;if(null!==a){r.pending=null;var o=a=a.next;do{u=e(u,o.action),o=o.next}while(o!==a);wo(u,n.memoizedState)||(ns=!0),n.memoizedState=u,null===n.baseQueue&&(n.baseState=u),r.lastRenderedState=u}return[u,l]}function St(e,n,t){}function xt(e,n,r){r=Bi;var l=yt(),a=n(),u=!wo(l.memoizedState,a);if(u&&(l.memoizedState=a,ns=!0),l=l.queue,Dt(zt.bind(null,r,l,e),[e]),l.getSnapshot!==n||u||null!==Hi&&1&Hi.memoizedState.tag){if(r.flags|=2048,Lt(9,Ct.bind(null,r,l,a,n),void 0,null),null===bs)throw Error(t(349));30&Ai||Et(r,n,a)}return a}function Et(e,n,t){e.flags|=16384,e={getSnapshot:n,value:t},null===(n=Bi.updateQueue)?(n={lastEffect:null,stores:null},Bi.updateQueue=n,n.stores=[e]):null===(t=n.stores)?n.stores=[e]:t.push(e)}function Ct(e,n,t,r){n.value=t,n.getSnapshot=r,Nt(n)&&Pt(e)}function zt(e,n,t){return t((function(){Nt(n)&&Pt(e)}))}function Nt(e){var n=e.getSnapshot;e=e.value;try{var t=n();return!wo(e,t)}catch(e){return!0}}function Pt(e){var n=Gn(e,1);null!==n&&al(n,e,1,-1)}function _t(e){var n=vt();return"function"==typeof e&&(e=e()),n.memoizedState=n.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:bt,lastRenderedState:e},n.queue=e,e=e.dispatch=qt.bind(null,Bi,e),[n.memoizedState,e]}function Lt(e,n,t,r){return e={tag:e,create:n,destroy:t,deps:r,next:null},null===(n=Bi.updateQueue)?(n={lastEffect:null,stores:null},Bi.updateQueue=n,n.lastEffect=e.next=e):null===(t=n.lastEffect)?n.lastEffect=e.next=e:(r=t.next,t.next=e,e.next=r,n.lastEffect=e),e}function Tt(e){return yt().memoizedState}function Mt(e,n,t,r){var l=vt();Bi.flags|=e,l.memoizedState=Lt(1|n,t,void 0,void 0===r?null:r)}function Ft(e,n,t,r){var l=yt();r=void 0===r?null:r;var a=void 0;if(null!==Wi){var u=Wi.memoizedState;if(a=u.destroy,null!==r&&mt(r,u.deps))return void(l.memoizedState=Lt(n,t,a,r))}Bi.flags|=e,l.memoizedState=Lt(1|n,t,a,r)}function Rt(e,n){return Mt(8390656,8,e,n)}function Dt(e,n){return Ft(2048,8,e,n)}function Ot(e,n){return Ft(4,2,e,n)}function It(e,n){return Ft(4,4,e,n)}function Ut(e,n){return"function"==typeof n?(e=e(),n(e),function(){n(null)}):null!=n?(e=e(),n.current=e,function(){n.current=null}):void 0}function Vt(e,n,t){return t=null!=t?t.concat([e]):null,Ft(4,4,Ut.bind(null,n,e),t)}function At(e,n){}function Bt(e,n){var t=yt();n=void 0===n?null:n;var r=t.memoizedState;return null!==r&&null!==n&&mt(n,r[1])?r[0]:(t.memoizedState=[e,n],e)}function Wt(e,n){var t=yt();n=void 0===n?null:n;var r=t.memoizedState;return null!==r&&null!==n&&mt(n,r[1])?r[0]:(e=e(),t.memoizedState=[e,n],e)}function Ht(e,n,t){return 21&Ai?(wo(t,n)||(t=Z(),Bi.lanes|=t,zs|=t,e.baseState=!0),n):(e.baseState&&(e.baseState=!1,ns=!0),e.memoizedState=t)}function Qt(e,n,t){xu=0!==(t=xu)&&4>t?t:4,e(!0);var r=Vi.transition;Vi.transition={};try{e(!1),n()}finally{xu=t,Vi.transition=r}}function jt(){return yt().memoizedState}function $t(e,n,t){var r=ll(e);t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},Kt(e)?Yt(n,t):null!==(t=Xn(e,n,t,r))&&(al(t,e,r,rl()),Xt(t,n,r))}function qt(e,n,t){var r=ll(e),l={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(Kt(e))Yt(n,l);else{var a=e.alternate;if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=n.lastRenderedReducer))try{var u=n.lastRenderedState,o=a(u,t);if(l.hasEagerState=!0,l.eagerState=o,wo(o,u)){var i=n.interleaved;return null===i?(l.next=l,Yn(n)):(l.next=i.next,i.next=l),void(n.interleaved=l)}}catch(e){}null!==(t=Xn(e,n,l,r))&&(al(t,e,r,l=rl()),Xt(t,n,r))}}function Kt(e){var n=e.alternate;return e===Bi||null!==n&&n===Bi}function Yt(e,n){ji=Qi=!0;var t=e.pending;null===t?n.next=n:(n.next=t.next,t.next=n),e.pending=n}function Xt(e,n,t){if(4194240&t){var r=n.lanes;t|=r&=e.pendingLanes,n.lanes=t,ne(e,t)}}function Gt(e,n){if(e&&e.defaultProps){for(var t in n=La({},n),e=e.defaultProps)void 0===n[t]&&(n[t]=e[t]);return n}return n}function Zt(e,n,t,r){t=null==(t=t(r,n=e.memoizedState))?n:La({},n,t),e.memoizedState=t,0===e.lanes&&(e.updateQueue.baseState=t)}function Jt(e,n,t,r,l,a,u){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,a,u):!(n.prototype&&n.prototype.isPureReactComponent&&Oe(t,r)&&Oe(l,a))}function er(e,n,t){var r=!1,l=ti,a=n.contextType;return"object"==typeof a&&null!==a?a=Kn(a):(l=wn(n)?ai:ri.current,a=(r=null!=(r=n.contextTypes))?kn(e,l):ti),n=new n(t,a),e.memoizedState=null!==n.state&&void 0!==n.state?n.state:null,n.updater=Zi,e.stateNode=n,n._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=l,e.__reactInternalMemoizedMaskedChildContext=a),n}function nr(e,n,t,r){e=n.state,"function"==typeof n.componentWillReceiveProps&&n.componentWillReceiveProps(t,r),"function"==typeof n.UNSAFE_componentWillReceiveProps&&n.UNSAFE_componentWillReceiveProps(t,r),n.state!==e&&Zi.enqueueReplaceState(n,n.state,null)}function tr(e,n,t,r){var l=e.stateNode;l.props=t,l.state=e.memoizedState,l.refs={},Zn(e);var a=n.contextType;"object"==typeof a&&null!==a?l.context=Kn(a):(a=wn(n)?ai:ri.current,l.context=kn(e,a)),l.state=e.memoizedState,"function"==typeof(a=n.getDerivedStateFromProps)&&(Zt(e,n,a,t),l.state=e.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof l.getSnapshotBeforeUpdate||"function"!=typeof l.UNSAFE_componentWillMount&&"function"!=typeof l.componentWillMount||(n=l.state,"function"==typeof l.componentWillMount&&l.componentWillMount(),"function"==typeof l.UNSAFE_componentWillMount&&l.UNSAFE_componentWillMount(),n!==l.state&&Zi.enqueueReplaceState(l,l.state,null),lt(e,t,l,r),l.state=e.memoizedState),"function"==typeof l.componentDidMount&&(e.flags|=4194308)}function rr(e,n){try{var t="",r=n;do{t+=c(r),r=r.return}while(r);var l=t}catch(e){l="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:n,stack:l,digest:null}}function lr(e,n,t){return{value:e,source:null,stack:null!=t?t:null,digest:null!=n?n:null}}function ar(e,n){try{console.error(n.value)}catch(e){setTimeout((function(){throw e}))}}function ur(e,n,t){(t=et(-1,t)).tag=3,t.payload={element:null};var r=n.value;return t.callback=function(){Rs||(Rs=!0,Ds=r),ar(0,n)},t}function or(e,n,t){(t=et(-1,t)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var l=n.value;t.payload=function(){return r(l)},t.callback=function(){ar(0,n)}}var a=e.stateNode;return null!==a&&"function"==typeof a.componentDidCatch&&(t.callback=function(){ar(0,n),"function"!=typeof r&&(null===Os?Os=new Set([this]):Os.add(this));var e=n.stack;this.componentDidCatch(n.value,{componentStack:null!==e?e:""})}),t}function ir(e,n,t){var r=e.pingCache;if(null===r){r=e.pingCache=new Ji;var l=new Set;r.set(n,l)}else void 0===(l=r.get(n))&&(l=new Set,r.set(n,l));l.has(t)||(l.add(t),e=Nl.bind(null,e,n,t),n.then(e,e))}function sr(e){do{var n;if((n=13===e.tag)&&(n=null===(n=e.memoizedState)||null!==n.dehydrated),n)return e;e=e.return}while(null!==e);return null}function cr(e,n,t,r,l){return 1&e.mode?(e.flags|=65536,e.lanes=l,e):(e===n?e.flags|=65536:(e.flags|=128,t.flags|=131072,t.flags&=-52805,1===t.tag&&(null===t.alternate?t.tag=17:((n=et(-1,1)).tag=2,nt(t,n,1))),t.lanes|=1),e)}function fr(e,n,t,r){n.child=null===e?Ei(n,null,t,r):xi(n,e.child,t,r)}function dr(e,n,t,r,l){t=t.render;var a=n.ref;return qn(n,l),r=ht(e,n,t,r,a,l),t=gt(),null===e||ns?(ki&&t&&Ln(n),n.flags|=1,fr(e,n,r,l),n.child):(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~l,Lr(e,n,l))}function pr(e,n,t,r,l){if(null===e){var a=t.type;return"function"!=typeof a||Fl(a)||void 0!==a.defaultProps||null!==t.compare||void 0!==t.defaultProps?((e=Dl(t.type,null,r,n,n.mode,l)).ref=n.ref,e.return=n,n.child=e):(n.tag=15,n.type=a,mr(e,n,a,r,l))}if(a=e.child,!(e.lanes&l)){var u=a.memoizedProps;if((t=null!==(t=t.compare)?t:Oe)(u,r)&&e.ref===n.ref)return Lr(e,n,l)}return n.flags|=1,(e=Rl(a,r)).ref=n.ref,e.return=n,n.child=e}function mr(e,n,t,r,l){if(null!==e){var a=e.memoizedProps;if(Oe(a,r)&&e.ref===n.ref){if(ns=!1,n.pendingProps=r=a,!(e.lanes&l))return n.lanes=e.lanes,Lr(e,n,l);131072&e.flags&&(ns=!0)}}return vr(e,n,t,r,l)}function hr(e,n,t){var r=n.pendingProps,l=r.children,a=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(1&n.mode){if(!(1073741824&t))return e=null!==a?a.baseLanes|t:t,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,bn(xs,Ss),Ss|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==a?a.baseLanes:t,bn(xs,Ss),Ss|=r}else n.memoizedState={baseLanes:0,cachePool:null,transitions:null},bn(xs,Ss),Ss|=t;else null!==a?(r=a.baseLanes|t,n.memoizedState=null):r=t,bn(xs,Ss),Ss|=r;return fr(e,n,l,t),n.child}function gr(e,n){var t=n.ref;(null===e&&null!==t||null!==e&&e.ref!==t)&&(n.flags|=512,n.flags|=2097152)}function vr(e,n,t,r,l){var a=wn(t)?ai:ri.current;return a=kn(n,a),qn(n,l),t=ht(e,n,t,r,a,l),r=gt(),null===e||ns?(ki&&r&&Ln(n),n.flags|=1,fr(e,n,t,l),n.child):(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~l,Lr(e,n,l))}function yr(e,n,t,r,l){if(wn(t)){var a=!0;En(n)}else a=!1;if(qn(n,l),null===n.stateNode)_r(e,n),er(n,t,r),tr(n,t,r,l),r=!0;else if(null===e){var u=n.stateNode,o=n.memoizedProps;u.props=o;var i=u.context,s=t.contextType;s="object"==typeof s&&null!==s?Kn(s):kn(n,s=wn(t)?ai:ri.current);var c=t.getDerivedStateFromProps,f="function"==typeof c||"function"==typeof u.getSnapshotBeforeUpdate;f||"function"!=typeof u.UNSAFE_componentWillReceiveProps&&"function"!=typeof u.componentWillReceiveProps||(o!==r||i!==s)&&nr(n,u,r,s),Ti=!1;var d=n.memoizedState;u.state=d,lt(n,r,u,l),i=n.memoizedState,o!==r||d!==i||li.current||Ti?("function"==typeof c&&(Zt(n,t,c,r),i=n.memoizedState),(o=Ti||Jt(n,t,o,r,d,i,s))?(f||"function"!=typeof u.UNSAFE_componentWillMount&&"function"!=typeof u.componentWillMount||("function"==typeof u.componentWillMount&&u.componentWillMount(),"function"==typeof u.UNSAFE_componentWillMount&&u.UNSAFE_componentWillMount()),"function"==typeof u.componentDidMount&&(n.flags|=4194308)):("function"==typeof u.componentDidMount&&(n.flags|=4194308),n.memoizedProps=r,n.memoizedState=i),u.props=r,u.state=i,u.context=s,r=o):("function"==typeof u.componentDidMount&&(n.flags|=4194308),r=!1)}else{u=n.stateNode,Jn(e,n),o=n.memoizedProps,s=n.type===n.elementType?o:Gt(n.type,o),u.props=s,f=n.pendingProps,d=u.context,i="object"==typeof(i=t.contextType)&&null!==i?Kn(i):kn(n,i=wn(t)?ai:ri.current);var p=t.getDerivedStateFromProps;(c="function"==typeof p||"function"==typeof u.getSnapshotBeforeUpdate)||"function"!=typeof u.UNSAFE_componentWillReceiveProps&&"function"!=typeof u.componentWillReceiveProps||(o!==f||d!==i)&&nr(n,u,r,i),Ti=!1,d=n.memoizedState,u.state=d,lt(n,r,u,l);var m=n.memoizedState;o!==f||d!==m||li.current||Ti?("function"==typeof p&&(Zt(n,t,p,r),m=n.memoizedState),(s=Ti||Jt(n,t,s,r,d,m,i)||!1)?(c||"function"!=typeof u.UNSAFE_componentWillUpdate&&"function"!=typeof u.componentWillUpdate||("function"==typeof u.componentWillUpdate&&u.componentWillUpdate(r,m,i),"function"==typeof u.UNSAFE_componentWillUpdate&&u.UNSAFE_componentWillUpdate(r,m,i)),"function"==typeof u.componentDidUpdate&&(n.flags|=4),"function"==typeof u.getSnapshotBeforeUpdate&&(n.flags|=1024)):("function"!=typeof u.componentDidUpdate||o===e.memoizedProps&&d===e.memoizedState||(n.flags|=4),"function"!=typeof u.getSnapshotBeforeUpdate||o===e.memoizedProps&&d===e.memoizedState||(n.flags|=1024),n.memoizedProps=r,n.memoizedState=m),u.props=r,u.state=m,u.context=i,r=s):("function"!=typeof u.componentDidUpdate||o===e.memoizedProps&&d===e.memoizedState||(n.flags|=4),"function"!=typeof u.getSnapshotBeforeUpdate||o===e.memoizedProps&&d===e.memoizedState||(n.flags|=1024),r=!1)}return br(e,n,t,r,a,l)}function br(e,n,t,r,l,a){gr(e,n);var u=!!(128&n.flags);if(!r&&!u)return l&&Cn(n,t,!1),Lr(e,n,a);r=n.stateNode,es.current=n;var o=u&&"function"!=typeof t.getDerivedStateFromError?null:r.render();return n.flags|=1,null!==e&&u?(n.child=xi(n,e.child,null,a),n.child=xi(n,null,o,a)):fr(e,n,o,a),n.memoizedState=r.state,l&&Cn(n,t,!0),n.child}function kr(e){var n=e.stateNode;n.pendingContext?Sn(0,n.pendingContext,n.pendingContext!==n.context):n.context&&Sn(0,n.context,!1),ot(e,n.containerInfo)}function wr(e,n,t,r,l){return Un(),Vn(l),n.flags|=256,fr(e,n,t,r),n.child}function Sr(e){return{baseLanes:e,cachePool:null,transitions:null}}function xr(e,n,r){var l,a=n.pendingProps,u=Oi.current,o=!1,i=!!(128&n.flags);if((l=i)||(l=(null===e||null!==e.memoizedState)&&!!(2&u)),l?(o=!0,n.flags&=-129):null!==e&&null===e.memoizedState||(u|=1),bn(Oi,1&u),null===e)return Dn(n),null!==(e=n.memoizedState)&&null!==(e=e.dehydrated)?(1&n.mode?"$!"===e.data?n.lanes=8:n.lanes=1073741824:n.lanes=1,null):(i=a.children,e=a.fallback,o?(a=n.mode,o=n.child,i={mode:"hidden",children:i},1&a||null===o?o=Il(i,a,0,null):(o.childLanes=0,o.pendingProps=i),e=Ol(e,a,r,null),o.return=n,e.return=n,o.sibling=e,n.child=o,n.child.memoizedState=Sr(r),n.memoizedState=ts,e):Er(n,i));if(null!==(u=e.memoizedState)&&null!==(l=u.dehydrated))return function(e,n,r,l,a,u,o){if(r)return 256&n.flags?(n.flags&=-257,Cr(e,n,o,l=lr(Error(t(422))))):null!==n.memoizedState?(n.child=e.child,n.flags|=128,null):(u=l.fallback,a=n.mode,l=Il({mode:"visible",children:l.children},a,0,null),(u=Ol(u,a,o,null)).flags|=2,l.return=n,u.return=n,l.sibling=u,n.child=l,1&n.mode&&xi(n,e.child,null,o),n.child.memoizedState=Sr(o),n.memoizedState=ts,u);if(!(1&n.mode))return Cr(e,n,o,null);if("$!"===a.data){if(l=a.nextSibling&&a.nextSibling.dataset)var i=l.dgst;return l=i,Cr(e,n,o,l=lr(u=Error(t(419)),l,void 0))}if(i=!!(o&e.childLanes),ns||i){if(null!==(l=bs)){switch(o&-o){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}0!==(a=a&(l.suspendedLanes|o)?0:a)&&a!==u.retryLane&&(u.retryLane=a,Gn(e,a),al(l,e,a,-1))}return vl(),Cr(e,n,o,l=lr(Error(t(421))))}return"$?"===a.data?(n.flags|=128,n.child=e.child,n=_l.bind(null,e),a._reactRetry=n,null):(e=u.treeContext,bi=fn(a.nextSibling),yi=n,ki=!0,wi=null,null!==e&&(pi[mi++]=gi,pi[mi++]=vi,pi[mi++]=hi,gi=e.id,vi=e.overflow,hi=n),(n=Er(n,l.children)).flags|=4096,n)}(e,n,i,a,l,u,r);if(o){o=a.fallback,i=n.mode,l=(u=e.child).sibling;var s={mode:"hidden",children:a.children};return 1&i||n.child===u?(a=Rl(u,s)).subtreeFlags=14680064&u.subtreeFlags:((a=n.child).childLanes=0,a.pendingProps=s,n.deletions=null),null!==l?o=Rl(l,o):(o=Ol(o,i,r,null)).flags|=2,o.return=n,a.return=n,a.sibling=o,n.child=a,a=o,o=n.child,i=null===(i=e.child.memoizedState)?Sr(r):{baseLanes:i.baseLanes|r,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~r,n.memoizedState=ts,a}return e=(o=e.child).sibling,a=Rl(o,{mode:"visible",children:a.children}),!(1&n.mode)&&(a.lanes=r),a.return=n,a.sibling=null,null!==e&&(null===(r=n.deletions)?(n.deletions=[e],n.flags|=16):r.push(e)),n.child=a,n.memoizedState=null,a}function Er(e,n,t){return(n=Il({mode:"visible",children:n},e.mode,0,null)).return=e,e.child=n}function Cr(e,n,t,r){return null!==r&&Vn(r),xi(n,e.child,null,t),(e=Er(n,n.pendingProps.children)).flags|=2,n.memoizedState=null,e}function zr(e,n,t){e.lanes|=n;var r=e.alternate;null!==r&&(r.lanes|=n),$n(e.return,n,t)}function Nr(e,n,t,r,l){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:r,tail:t,tailMode:l}:(a.isBackwards=n,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=t,a.tailMode=l)}function Pr(e,n,t){var r=n.pendingProps,l=r.revealOrder,a=r.tail;if(fr(e,n,r.children,t),2&(r=Oi.current))r=1&r|2,n.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=n.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&zr(e,t,n);else if(19===e.tag)zr(e,t,n);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;null===e.sibling;){if(null===e.return||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(bn(Oi,r),1&n.mode)switch(l){case"forwards":for(t=n.child,l=null;null!==t;)null!==(e=t.alternate)&&null===ft(e)&&(l=t),t=t.sibling;null===(t=l)?(l=n.child,n.child=null):(l=t.sibling,t.sibling=null),Nr(n,!1,l,t,a);break;case"backwards":for(t=null,l=n.child,n.child=null;null!==l;){if(null!==(e=l.alternate)&&null===ft(e)){n.child=l;break}e=l.sibling,l.sibling=t,t=l,l=e}Nr(n,!0,t,null,a);break;case"together":Nr(n,!1,null,null,void 0);break;default:n.memoizedState=null}else n.memoizedState=null;return n.child}function _r(e,n){!(1&n.mode)&&null!==e&&(e.alternate=null,n.alternate=null,n.flags|=2)}function Lr(e,n,r){if(null!==e&&(n.dependencies=e.dependencies),zs|=n.lanes,!(r&n.childLanes))return null;if(null!==e&&n.child!==e.child)throw Error(t(153));if(null!==n.child){for(r=Rl(e=n.child,e.pendingProps),n.child=r,r.return=n;null!==e.sibling;)e=e.sibling,(r=r.sibling=Rl(e,e.pendingProps)).return=n;r.sibling=null}return n.child}function Tr(e,n){if(!ki)switch(e.tailMode){case"hidden":n=e.tail;for(var t=null;null!==n;)null!==n.alternate&&(t=n),n=n.sibling;null===t?e.tail=null:t.sibling=null;break;case"collapsed":t=e.tail;for(var r=null;null!==t;)null!==t.alternate&&(r=t),t=t.sibling;null===r?n||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Mr(e){var n=null!==e.alternate&&e.alternate.child===e.child,t=0,r=0;if(n)for(var l=e.child;null!==l;)t|=l.lanes|l.childLanes,r|=14680064&l.subtreeFlags,r|=14680064&l.flags,l.return=e,l=l.sibling;else for(l=e.child;null!==l;)t|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=t,n}function Fr(e,n,r){var l=n.pendingProps;switch(Tn(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mr(n),null;case 1:case 17:return wn(n.type)&&(yn(li),yn(ri)),Mr(n),null;case 3:return l=n.stateNode,it(),yn(li),yn(ri),dt(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),null!==e&&null!==e.child||(In(n)?n.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&n.flags)||(n.flags|=1024,null!==wi&&(sl(wi),wi=null))),ls(e,n),Mr(n),null;case 5:ct(n);var a=ut(Di.current);if(r=n.type,null!==e&&null!=n.stateNode)as(e,n,r,l,a),e.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!l){if(null===n.stateNode)throw Error(t(166));return Mr(n),null}if(e=ut(Fi.current),In(n)){l=n.stateNode,r=n.type;var o=n.memoizedProps;switch(l[Ko]=n,l[Yo]=o,e=!!(1&n.mode),r){case"dialog":Ye("cancel",l),Ye("close",l);break;case"iframe":case"object":case"embed":Ye("load",l);break;case"video":case"audio":for(a=0;a<Oo.length;a++)Ye(Oo[a],l);break;case"source":Ye("error",l);break;case"img":case"image":case"link":Ye("error",l),Ye("load",l);break;case"details":Ye("toggle",l);break;case"input":b(l,o),Ye("invalid",l);break;case"select":l._wrapperState={wasMultiple:!!o.multiple},Ye("invalid",l);break;case"textarea":z(l,o),Ye("invalid",l)}for(var i in F(r,o),a=null,o)if(o.hasOwnProperty(i)){var s=o[i];"children"===i?"string"==typeof s?l.textContent!==s&&(!0!==o.suppressHydrationWarning&&an(l.textContent,s,e),a=["children",s]):"number"==typeof s&&l.textContent!==""+s&&(!0!==o.suppressHydrationWarning&&an(l.textContent,s,e),a=["children",""+s]):ra.hasOwnProperty(i)&&null!=s&&"onScroll"===i&&Ye("scroll",l)}switch(r){case"input":h(l),S(l,o,!0);break;case"textarea":h(l),P(l);break;case"select":case"option":break;default:"function"==typeof o.onClick&&(l.onclick=un)}l=a,n.updateQueue=l,null!==l&&(n.flags|=4)}else{i=9===a.nodeType?a:a.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=_(r)),"http://www.w3.org/1999/xhtml"===e?"script"===r?((e=i.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof l.is?e=i.createElement(r,{is:l.is}):(e=i.createElement(r),"select"===r&&(i=e,l.multiple?i.multiple=!0:l.size&&(i.size=l.size))):e=i.createElementNS(e,r),e[Ko]=n,e[Yo]=l,rs(e,n,!1,!1),n.stateNode=e;e:{switch(i=R(r,l),r){case"dialog":Ye("cancel",e),Ye("close",e),a=l;break;case"iframe":case"object":case"embed":Ye("load",e),a=l;break;case"video":case"audio":for(a=0;a<Oo.length;a++)Ye(Oo[a],e);a=l;break;case"source":Ye("error",e),a=l;break;case"img":case"image":case"link":Ye("error",e),Ye("load",e),a=l;break;case"details":Ye("toggle",e),a=l;break;case"input":b(e,l),a=y(e,l),Ye("invalid",e);break;case"option":default:a=l;break;case"select":e._wrapperState={wasMultiple:!!l.multiple},a=La({},l,{value:void 0}),Ye("invalid",e);break;case"textarea":z(e,l),a=C(e,l),Ye("invalid",e)}for(o in F(r,a),s=a)if(s.hasOwnProperty(o)){var c=s[o];"style"===o?M(e,c):"dangerouslySetInnerHTML"===o?null!=(c=c?c.__html:void 0)&&Fa(e,c):"children"===o?"string"==typeof c?("textarea"!==r||""!==c)&&Ra(e,c):"number"==typeof c&&Ra(e,""+c):"suppressContentEditableWarning"!==o&&"suppressHydrationWarning"!==o&&"autoFocus"!==o&&(ra.hasOwnProperty(o)?null!=c&&"onScroll"===o&&Ye("scroll",e):null!=c&&u(e,o,c,i))}switch(r){case"input":h(e),S(e,l,!1);break;case"textarea":h(e),P(e);break;case"option":null!=l.value&&e.setAttribute("value",""+p(l.value));break;case"select":e.multiple=!!l.multiple,null!=(o=l.value)?E(e,!!l.multiple,o,!1):null!=l.defaultValue&&E(e,!!l.multiple,l.defaultValue,!0);break;default:"function"==typeof a.onClick&&(e.onclick=un)}switch(r){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}}l&&(n.flags|=4)}null!==n.ref&&(n.flags|=512,n.flags|=2097152)}return Mr(n),null;case 6:if(e&&null!=n.stateNode)us(e,n,e.memoizedProps,l);else{if("string"!=typeof l&&null===n.stateNode)throw Error(t(166));if(r=ut(Di.current),ut(Fi.current),In(n)){if(l=n.stateNode,r=n.memoizedProps,l[Ko]=n,(o=l.nodeValue!==r)&&null!==(e=yi))switch(e.tag){case 3:an(l.nodeValue,r,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&an(l.nodeValue,r,!!(1&e.mode))}o&&(n.flags|=4)}else(l=(9===r.nodeType?r:r.ownerDocument).createTextNode(l))[Ko]=n,n.stateNode=l}return Mr(n),null;case 13:if(yn(Oi),l=n.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(ki&&null!==bi&&1&n.mode&&!(128&n.flags)){for(o=bi;o;)o=fn(o.nextSibling);Un(),n.flags|=98560,o=!1}else if(o=In(n),null!==l&&null!==l.dehydrated){if(null===e){if(!o)throw Error(t(318));if(!(o=null!==(o=n.memoizedState)?o.dehydrated:null))throw Error(t(317));o[Ko]=n}else Un(),!(128&n.flags)&&(n.memoizedState=null),n.flags|=4;Mr(n),o=!1}else null!==wi&&(sl(wi),wi=null),o=!0;if(!o)return 65536&n.flags?n:null}return 128&n.flags?(n.lanes=r,n):((l=null!==l)!=(null!==e&&null!==e.memoizedState)&&l&&(n.child.flags|=8192,1&n.mode&&(null===e||1&Oi.current?0===Es&&(Es=3):vl())),null!==n.updateQueue&&(n.flags|=4),Mr(n),null);case 4:return it(),ls(e,n),null===e&&Ge(n.stateNode.containerInfo),Mr(n),null;case 10:return jn(n.type._context),Mr(n),null;case 19:if(yn(Oi),null===(o=n.memoizedState))return Mr(n),null;if(l=!!(128&n.flags),null===(i=o.rendering))if(l)Tr(o,!1);else{if(0!==Es||null!==e&&128&e.flags)for(e=n.child;null!==e;){if(null!==(i=ft(e))){for(n.flags|=128,Tr(o,!1),null!==(l=i.updateQueue)&&(n.updateQueue=l,n.flags|=4),n.subtreeFlags=0,l=r,r=n.child;null!==r;)e=l,(o=r).flags&=14680066,null===(i=o.alternate)?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return bn(Oi,1&Oi.current|2),n.child}e=e.sibling}null!==o.tail&&su()>Ms&&(n.flags|=128,l=!0,Tr(o,!1),n.lanes=4194304)}else{if(!l)if(null!==(e=ft(i))){if(n.flags|=128,l=!0,null!==(r=e.updateQueue)&&(n.updateQueue=r,n.flags|=4),Tr(o,!0),null===o.tail&&"hidden"===o.tailMode&&!i.alternate&&!ki)return Mr(n),null}else 2*su()-o.renderingStartTime>Ms&&1073741824!==r&&(n.flags|=128,l=!0,Tr(o,!1),n.lanes=4194304);o.isBackwards?(i.sibling=n.child,n.child=i):(null!==(r=o.last)?r.sibling=i:n.child=i,o.last=i)}return null!==o.tail?(n=o.tail,o.rendering=n,o.tail=n.sibling,o.renderingStartTime=su(),n.sibling=null,r=Oi.current,bn(Oi,l?1&r|2:1&r),n):(Mr(n),null);case 22:case 23:return Ss=xs.current,yn(xs),l=null!==n.memoizedState,null!==e&&null!==e.memoizedState!==l&&(n.flags|=8192),l&&1&n.mode?!!(1073741824&Ss)&&(Mr(n),6&n.subtreeFlags&&(n.flags|=8192)):Mr(n),null;case 24:case 25:return null}throw Error(t(156,n.tag))}function Rr(e,n,r){switch(Tn(n),n.tag){case 1:return wn(n.type)&&(yn(li),yn(ri)),65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 3:return it(),yn(li),yn(ri),dt(),65536&(e=n.flags)&&!(128&e)?(n.flags=-65537&e|128,n):null;case 5:return ct(n),null;case 13:if(yn(Oi),null!==(e=n.memoizedState)&&null!==e.dehydrated){if(null===n.alternate)throw Error(t(340));Un()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 19:return yn(Oi),null;case 4:return it(),null;case 10:return jn(n.type._context),null;case 22:case 23:return Ss=xs.current,yn(xs),null;default:return null}}function Dr(e,n){var t=e.ref;if(null!==t)if("function"==typeof t)try{t(null)}catch(t){zl(e,n,t)}else t.current=null}function Or(e,n,t){try{t()}catch(t){zl(e,n,t)}}function Ir(e,n,t){var r=n.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var l=r=r.next;do{if((l.tag&e)===e){var a=l.destroy;l.destroy=void 0,void 0!==a&&Or(n,t,a)}l=l.next}while(l!==r)}}function Ur(e,n){if(null!==(n=null!==(n=n.updateQueue)?n.lastEffect:null)){var t=n=n.next;do{if((t.tag&e)===e){var r=t.create;t.destroy=r()}t=t.next}while(t!==n)}}function Vr(e){var n=e.ref;if(null!==n){var t=e.stateNode;e.tag,e=t,"function"==typeof n?n(e):n.current=e}}function Ar(e){var n=e.alternate;null!==n&&(e.alternate=null,Ar(n)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&null!==(n=e.stateNode)&&(delete n[Ko],delete n[Yo],delete n[Go],delete n[Zo],delete n[Jo]),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Br(e){return 5===e.tag||3===e.tag||4===e.tag}function Wr(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Br(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function Hr(e,n,t){var r=e.tag;if(5===r||6===r)e=e.stateNode,n?8===t.nodeType?t.parentNode.insertBefore(e,n):t.insertBefore(e,n):(8===t.nodeType?(n=t.parentNode).insertBefore(e,t):(n=t).appendChild(e),null!=(t=t._reactRootContainer)||null!==n.onclick||(n.onclick=un));else if(4!==r&&null!==(e=e.child))for(Hr(e,n,t),e=e.sibling;null!==e;)Hr(e,n,t),e=e.sibling}function Qr(e,n,t){var r=e.tag;if(5===r||6===r)e=e.stateNode,n?t.insertBefore(e,n):t.appendChild(e);else if(4!==r&&null!==(e=e.child))for(Qr(e,n,t),e=e.sibling;null!==e;)Qr(e,n,t),e=e.sibling}function jr(e,n,t){for(t=t.child;null!==t;)$r(e,n,t),t=t.sibling}function $r(e,n,t){if(vu&&"function"==typeof vu.onCommitFiberUnmount)try{vu.onCommitFiberUnmount(gu,t)}catch(e){}switch(t.tag){case 5:is||Dr(t,n);case 6:var r=ds,l=ps;ds=null,jr(e,n,t),ps=l,null!==(ds=r)&&(ps?(e=ds,t=t.stateNode,8===e.nodeType?e.parentNode.removeChild(t):e.removeChild(t)):ds.removeChild(t.stateNode));break;case 18:null!==ds&&(ps?(e=ds,t=t.stateNode,8===e.nodeType?cn(e.parentNode,t):1===e.nodeType&&cn(e,t),ce(e)):cn(ds,t.stateNode));break;case 4:r=ds,l=ps,ds=t.stateNode.containerInfo,ps=!0,jr(e,n,t),ds=r,ps=l;break;case 0:case 11:case 14:case 15:if(!is&&null!==(r=t.updateQueue)&&null!==(r=r.lastEffect)){l=r=r.next;do{var a=l,u=a.destroy;a=a.tag,void 0!==u&&(2&a||4&a)&&Or(t,n,u),l=l.next}while(l!==r)}jr(e,n,t);break;case 1:if(!is&&(Dr(t,n),"function"==typeof(r=t.stateNode).componentWillUnmount))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(e){zl(t,n,e)}jr(e,n,t);break;case 21:jr(e,n,t);break;case 22:1&t.mode?(is=(r=is)||null!==t.memoizedState,jr(e,n,t),is=r):jr(e,n,t);break;default:jr(e,n,t)}}function qr(e){var n=e.updateQueue;if(null!==n){e.updateQueue=null;var t=e.stateNode;null===t&&(t=e.stateNode=new ss),n.forEach((function(n){var r=Ll.bind(null,e,n);t.has(n)||(t.add(n),n.then(r,r))}))}}function Kr(e,n,r){if(null!==(r=n.deletions))for(var l=0;l<r.length;l++){var a=r[l];try{var u=e,o=n,i=o;e:for(;null!==i;){switch(i.tag){case 5:ds=i.stateNode,ps=!1;break e;case 3:case 4:ds=i.stateNode.containerInfo,ps=!0;break e}i=i.return}if(null===ds)throw Error(t(160));$r(u,o,a),ds=null,ps=!1;var s=a.alternate;null!==s&&(s.return=null),a.return=null}catch(e){zl(a,n,e)}}if(12854&n.subtreeFlags)for(n=n.child;null!==n;)Yr(n,e),n=n.sibling}function Yr(e,n,r){var l=e.alternate;switch(r=e.flags,e.tag){case 0:case 11:case 14:case 15:if(Kr(n,e),Xr(e),4&r){try{Ir(3,e,e.return),Ur(3,e)}catch(n){zl(e,e.return,n)}try{Ir(5,e,e.return)}catch(n){zl(e,e.return,n)}}break;case 1:Kr(n,e),Xr(e),512&r&&null!==l&&Dr(l,l.return);break;case 5:if(Kr(n,e),Xr(e),512&r&&null!==l&&Dr(l,l.return),32&e.flags){var a=e.stateNode;try{Ra(a,"")}catch(n){zl(e,e.return,n)}}if(4&r&&null!=(a=e.stateNode)){var o=e.memoizedProps,i=null!==l?l.memoizedProps:o,s=e.type,c=e.updateQueue;if(e.updateQueue=null,null!==c)try{"input"===s&&"radio"===o.type&&null!=o.name&&k(a,o),R(s,i);var f=R(s,o);for(i=0;i<c.length;i+=2){var d=c[i],p=c[i+1];"style"===d?M(a,p):"dangerouslySetInnerHTML"===d?Fa(a,p):"children"===d?Ra(a,p):u(a,d,p,f)}switch(s){case"input":w(a,o);break;case"textarea":N(a,o);break;case"select":var m=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var h=o.value;null!=h?E(a,!!o.multiple,h,!1):m!==!!o.multiple&&(null!=o.defaultValue?E(a,!!o.multiple,o.defaultValue,!0):E(a,!!o.multiple,o.multiple?[]:"",!1))}a[Yo]=o}catch(n){zl(e,e.return,n)}}break;case 6:if(Kr(n,e),Xr(e),4&r){if(null===e.stateNode)throw Error(t(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(n){zl(e,e.return,n)}}break;case 3:if(Kr(n,e),Xr(e),4&r&&null!==l&&l.memoizedState.isDehydrated)try{ce(n.containerInfo)}catch(n){zl(e,e.return,n)}break;case 4:default:Kr(n,e),Xr(e);break;case 13:Kr(n,e),Xr(e),8192&(a=e.child).flags&&(o=null!==a.memoizedState,a.stateNode.isHidden=o,!o||null!==a.alternate&&null!==a.alternate.memoizedState||(Ts=su())),4&r&&qr(e);break;case 22:if(d=null!==l&&null!==l.memoizedState,1&e.mode?(is=(f=is)||d,Kr(n,e),is=f):Kr(n,e),Xr(e),8192&r){if(f=null!==e.memoizedState,(e.stateNode.isHidden=f)&&!d&&1&e.mode)for(cs=e,d=e.child;null!==d;){for(p=cs=d;null!==cs;){switch(h=(m=cs).child,m.tag){case 0:case 11:case 14:case 15:Ir(4,m,m.return);break;case 1:Dr(m,m.return);var g=m.stateNode;if("function"==typeof g.componentWillUnmount){r=m,n=m.return;try{l=r,g.props=l.memoizedProps,g.state=l.memoizedState,g.componentWillUnmount()}catch(e){zl(r,n,e)}}break;case 5:Dr(m,m.return);break;case 22:if(null!==m.memoizedState){el(p);continue}}null!==h?(h.return=m,cs=h):el(p)}d=d.sibling}e:for(d=null,p=e;;){if(5===p.tag){if(null===d){d=p;try{a=p.stateNode,f?"function"==typeof(o=a.style).setProperty?o.setProperty("display","none","important"):o.display="none":(s=p.stateNode,i=null!=(c=p.memoizedProps.style)&&c.hasOwnProperty("display")?c.display:null,s.style.display=T("display",i))}catch(n){zl(e,e.return,n)}}}else if(6===p.tag){if(null===d)try{p.stateNode.nodeValue=f?"":p.memoizedProps}catch(n){zl(e,e.return,n)}}else if((22!==p.tag&&23!==p.tag||null===p.memoizedState||p===e)&&null!==p.child){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;null===p.sibling;){if(null===p.return||p.return===e)break e;d===p&&(d=null),p=p.return}d===p&&(d=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:Kr(n,e),Xr(e),4&r&&qr(e);case 21:}}function Xr(e){var n=e.flags;if(2&n){try{e:{for(var r=e.return;null!==r;){if(Br(r)){var l=r;break e}r=r.return}throw Error(t(160))}switch(l.tag){case 5:var a=l.stateNode;32&l.flags&&(Ra(a,""),l.flags&=-33),Qr(e,Wr(e),a);break;case 3:case 4:var u=l.stateNode.containerInfo;Hr(e,Wr(e),u);break;default:throw Error(t(161))}}catch(n){zl(e,e.return,n)}e.flags&=-3}4096&n&&(e.flags&=-4097)}function Gr(e,n,t){cs=e,Zr(e,n,t)}function Zr(e,n,t){for(var r=!!(1&e.mode);null!==cs;){var l=cs,a=l.child;if(22===l.tag&&r){var u=null!==l.memoizedState||os;if(!u){var o=l.alternate,i=null!==o&&null!==o.memoizedState||is;o=os;var s=is;if(os=u,(is=i)&&!s)for(cs=l;null!==cs;)i=(u=cs).child,22===u.tag&&null!==u.memoizedState?nl(l):null!==i?(i.return=u,cs=i):nl(l);for(;null!==a;)cs=a,Zr(a,n,t),a=a.sibling;cs=l,os=o,is=s}Jr(e,n,t)}else 8772&l.subtreeFlags&&null!==a?(a.return=l,cs=a):Jr(e,n,t)}}function Jr(e,n,r){for(;null!==cs;){if(8772&(n=cs).flags){r=n.alternate;try{if(8772&n.flags)switch(n.tag){case 0:case 11:case 15:is||Ur(5,n);break;case 1:var l=n.stateNode;if(4&n.flags&&!is)if(null===r)l.componentDidMount();else{var a=n.elementType===n.type?r.memoizedProps:Gt(n.type,r.memoizedProps);l.componentDidUpdate(a,r.memoizedState,l.__reactInternalSnapshotBeforeUpdate)}var u=n.updateQueue;null!==u&&at(n,u,l);break;case 3:var o=n.updateQueue;if(null!==o){if(r=null,null!==n.child)switch(n.child.tag){case 5:case 1:r=n.child.stateNode}at(n,o,r)}break;case 5:var i=n.stateNode;if(null===r&&4&n.flags){r=i;var s=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":s.autoFocus&&r.focus();break;case"img":s.src&&(r.src=s.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===n.memoizedState){var c=n.alternate;if(null!==c){var f=c.memoizedState;if(null!==f){var d=f.dehydrated;null!==d&&ce(d)}}}break;default:throw Error(t(163))}is||512&n.flags&&Vr(n)}catch(e){zl(n,n.return,e)}}if(n===e){cs=null;break}if(null!==(r=n.sibling)){r.return=n.return,cs=r;break}cs=n.return}}function el(e){for(;null!==cs;){var n=cs;if(n===e){cs=null;break}var t=n.sibling;if(null!==t){t.return=n.return,cs=t;break}cs=n.return}}function nl(e){for(;null!==cs;){var n=cs;try{switch(n.tag){case 0:case 11:case 15:var t=n.return;try{Ur(4,n)}catch(e){zl(n,t,e)}break;case 1:var r=n.stateNode;if("function"==typeof r.componentDidMount){var l=n.return;try{r.componentDidMount()}catch(e){zl(n,l,e)}}var a=n.return;try{Vr(n)}catch(e){zl(n,a,e)}break;case 5:var u=n.return;try{Vr(n)}catch(e){zl(n,u,e)}}}catch(e){zl(n,n.return,e)}if(n===e){cs=null;break}var o=n.sibling;if(null!==o){o.return=n.return,cs=o;break}cs=n.return}}function tl(){Ms=su()+500}function rl(){return 6&ys?su():-1!==Ws?Ws:Ws=su()}function ll(e){return 1&e.mode?2&ys&&0!==ws?ws&-ws:null!==Si.transition?(0===Hs&&(Hs=Z()),Hs):0!==(e=xu)?e:e=void 0===(e=window.event)?16:he(e.type):1}function al(e,n,r,l){if(50<As)throw As=0,Bs=null,Error(t(185));ee(e,r,l),2&ys&&e===bs||(e===bs&&(!(2&ys)&&(Ns|=r),4===Es&&cl(e,ws)),ul(e,l),1===r&&0===ys&&!(1&n.mode)&&(tl(),oi&&Nn()))}function ul(e,n){var t=e.callbackNode;!function(e,n){for(var t=e.suspendedLanes,r=e.pingedLanes,l=e.expirationTimes,a=e.pendingLanes;0<a;){var u=31-yu(a),o=1<<u,i=l[u];-1===i?o&t&&!(o&r)||(l[u]=X(o,n)):i<=n&&(e.expiredLanes|=o),a&=~o}}(e,n);var r=Y(e,e===bs?ws:0);if(0===r)null!==t&&uu(t),e.callbackNode=null,e.callbackPriority=0;else if(n=r&-r,e.callbackPriority!==n){if(null!=t&&uu(t),1===n)0===e.tag?function(e){oi=!0,zn(e)}(fl.bind(null,e)):zn(fl.bind(null,e)),$o((function(){!(6&ys)&&Nn()})),t=null;else{switch(te(r)){case 1:t=fu;break;case 4:t=du;break;case 16:default:t=pu;break;case 536870912:t=hu}t=Tl(t,ol.bind(null,e))}e.callbackPriority=n,e.callbackNode=t}}function ol(e,n){if(Ws=-1,Hs=0,6&ys)throw Error(t(327));var r=e.callbackNode;if(El()&&e.callbackNode!==r)return null;var l=Y(e,e===bs?ws:0);if(0===l)return null;if(30&l||l&e.expiredLanes||n)n=yl(e,l);else{n=l;var a=ys;ys|=2;var u=gl();for(bs===e&&ws===n||(Fs=null,tl(),ml(e,n));;)try{kl();break}catch(n){hl(e,n)}Qn(),hs.current=u,ys=a,null!==ks?n=0:(bs=null,ws=0,n=Es)}if(0!==n){if(2===n&&0!==(a=G(e))&&(l=a,n=il(e,a)),1===n)throw r=Cs,ml(e,0),cl(e,l),ul(e,su()),r;if(6===n)cl(e,l);else{if(a=e.current.alternate,!(30&l||function(e){for(var n=e;;){if(16384&n.flags){var t=n.updateQueue;if(null!==t&&null!==(t=t.stores))for(var r=0;r<t.length;r++){var l=t[r],a=l.getSnapshot;l=l.value;try{if(!wo(a(),l))return!1}catch(e){return!1}}}if(t=n.child,16384&n.subtreeFlags&&null!==t)t.return=n,n=t;else{if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}(a)||(n=yl(e,l),2===n&&(u=G(e),0!==u&&(l=u,n=il(e,u))),1!==n)))throw r=Cs,ml(e,0),cl(e,l),ul(e,su()),r;switch(e.finishedWork=a,e.finishedLanes=l,n){case 0:case 1:throw Error(t(345));case 2:case 5:xl(e,Ls,Fs);break;case 3:if(cl(e,l),(130023424&l)===l&&10<(n=Ts+500-su())){if(0!==Y(e,0))break;if(((a=e.suspendedLanes)&l)!==l){rl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Ho(xl.bind(null,e,Ls,Fs),n);break}xl(e,Ls,Fs);break;case 4:if(cl(e,l),(4194240&l)===l)break;for(n=e.eventTimes,a=-1;0<l;){var o=31-yu(l);u=1<<o,(o=n[o])>a&&(a=o),l&=~u}if(l=a,10<(l=(120>(l=su()-l)?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*ms(l/1960))-l)){e.timeoutHandle=Ho(xl.bind(null,e,Ls,Fs),l);break}xl(e,Ls,Fs);break;default:throw Error(t(329))}}}return ul(e,su()),e.callbackNode===r?ol.bind(null,e):null}function il(e,n){var t=_s;return e.current.memoizedState.isDehydrated&&(ml(e,n).flags|=256),2!==(e=yl(e,n))&&(n=Ls,Ls=t,null!==n&&sl(n)),e}function sl(e){null===Ls?Ls=e:Ls.push.apply(Ls,e)}function cl(e,n){for(n&=~Ps,n&=~Ns,e.suspendedLanes|=n,e.pingedLanes&=~n,e=e.expirationTimes;0<n;){var t=31-yu(n),r=1<<t;e[t]=-1,n&=~r}}function fl(e){if(6&ys)throw Error(t(327));El();var n=Y(e,0);if(!(1&n))return ul(e,su()),null;var r=yl(e,n);if(0!==e.tag&&2===r){var l=G(e);0!==l&&(n=l,r=il(e,l))}if(1===r)throw r=Cs,ml(e,0),cl(e,n),ul(e,su()),r;if(6===r)throw Error(t(345));return e.finishedWork=e.current.alternate,e.finishedLanes=n,xl(e,Ls,Fs),ul(e,su()),null}function dl(e,n){var t=ys;ys|=1;try{return e(n)}finally{0===(ys=t)&&(tl(),oi&&Nn())}}function pl(e){null!==Us&&0===Us.tag&&!(6&ys)&&El();var n=ys;ys|=1;var t=vs.transition,r=xu;try{if(vs.transition=null,xu=1,e)return e()}finally{xu=r,vs.transition=t,!(6&(ys=n))&&Nn()}}function ml(e,n){e.finishedWork=null,e.finishedLanes=0;var t=e.timeoutHandle;if(-1!==t&&(e.timeoutHandle=-1,Qo(t)),null!==ks)for(t=ks.return;null!==t;){var r=t;switch(Tn(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&(yn(li),yn(ri));break;case 3:it(),yn(li),yn(ri),dt();break;case 5:ct(r);break;case 4:it();break;case 13:case 19:yn(Oi);break;case 10:jn(r.type._context);break;case 22:case 23:Ss=xs.current,yn(xs)}t=t.return}if(bs=e,ks=e=Rl(e.current,null),ws=Ss=n,Es=0,Cs=null,Ps=Ns=zs=0,Ls=_s=null,null!==_i){for(n=0;n<_i.length;n++)if(null!==(r=(t=_i[n]).interleaved)){t.interleaved=null;var l=r.next,a=t.pending;if(null!==a){var u=a.next;a.next=l,r.next=u}t.pending=r}_i=null}return e}function hl(e,n){for(;;){var r=ks;try{if(Qn(),Ui.current=Ki,Qi){for(var l=Bi.memoizedState;null!==l;){var a=l.queue;null!==a&&(a.pending=null),l=l.next}Qi=!1}if(Ai=0,Hi=Wi=Bi=null,ji=!1,$i=0,gs.current=null,null===r||null===r.return){Es=1,Cs=n,ks=null;break}e:{var u=e,o=r.return,i=r,s=n;if(n=ws,i.flags|=32768,null!==s&&"object"==typeof s&&"function"==typeof s.then){var c=s,f=i,d=f.tag;if(!(1&f.mode||0!==d&&11!==d&&15!==d)){var p=f.alternate;p?(f.updateQueue=p.updateQueue,f.memoizedState=p.memoizedState,f.lanes=p.lanes):(f.updateQueue=null,f.memoizedState=null)}var m=sr(o);if(null!==m){m.flags&=-257,cr(m,o,i,0,n),1&m.mode&&ir(u,c,n),s=c;var h=(n=m).updateQueue;if(null===h){var g=new Set;g.add(s),n.updateQueue=g}else h.add(s);break e}if(!(1&n)){ir(u,c,n),vl();break e}s=Error(t(426))}else if(ki&&1&i.mode){var v=sr(o);if(null!==v){!(65536&v.flags)&&(v.flags|=256),cr(v,o,i,0,n),Vn(rr(s,i));break e}}u=s=rr(s,i),4!==Es&&(Es=2),null===_s?_s=[u]:_s.push(u),u=o;do{switch(u.tag){case 3:u.flags|=65536,n&=-n,u.lanes|=n,rt(u,ur(0,s,n));break e;case 1:i=s;var y=u.type,b=u.stateNode;if(!(128&u.flags||"function"!=typeof y.getDerivedStateFromError&&(null===b||"function"!=typeof b.componentDidCatch||null!==Os&&Os.has(b)))){u.flags|=65536,n&=-n,u.lanes|=n,rt(u,or(u,i,n));break e}}u=u.return}while(null!==u)}Sl(r)}catch(e){n=e,ks===r&&null!==r&&(ks=r=r.return);continue}break}}function gl(){var e=hs.current;return hs.current=Ki,null===e?Ki:e}function vl(){0!==Es&&3!==Es&&2!==Es||(Es=4),null===bs||!(268435455&zs)&&!(268435455&Ns)||cl(bs,ws)}function yl(e,n){var r=ys;ys|=2;var l=gl();for(bs===e&&ws===n||(Fs=null,ml(e,n));;)try{bl();break}catch(n){hl(e,n)}if(Qn(),ys=r,hs.current=l,null!==ks)throw Error(t(261));return bs=null,ws=0,Es}function bl(){for(;null!==ks;)wl(ks)}function kl(){for(;null!==ks&&!ou();)wl(ks)}function wl(e){var n=Qs(e.alternate,e,Ss);e.memoizedProps=e.pendingProps,null===n?Sl(e):ks=n,gs.current=null}function Sl(e){var n=e;do{var t=n.alternate;if(e=n.return,32768&n.flags){if(null!==(t=Rr(t,n)))return t.flags&=32767,void(ks=t);if(null===e)return Es=6,void(ks=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(t=Fr(t,n,Ss)))return void(ks=t);if(null!==(n=n.sibling))return void(ks=n);ks=n=e}while(null!==n);0===Es&&(Es=5)}function xl(e,n,r){var l=xu,a=vs.transition;try{vs.transition=null,xu=1,function(e,n,r,l){do{El()}while(null!==Us);if(6&ys)throw Error(t(327));r=e.finishedWork;var a=e.finishedLanes;if(null===r)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(t(177));e.callbackNode=null,e.callbackPriority=0;var u=r.lanes|r.childLanes;if(function(e,n){var t=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<t;){var l=31-yu(t),a=1<<l;n[l]=0,r[l]=-1,e[l]=-1,t&=~a}}(e,u),e===bs&&(ks=bs=null,ws=0),!(2064&r.subtreeFlags)&&!(2064&r.flags)||Is||(Is=!0,Tl(pu,(function(){return El(),null}))),u=!!(15990&r.flags),15990&r.subtreeFlags||u){u=vs.transition,vs.transition=null;var o=xu;xu=1;var i=ys;ys|=4,gs.current=null,function(e,n){if(Bo=Ru,Be(e=Ae())){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{var l=(r=(r=e.ownerDocument)&&r.defaultView||window).getSelection&&r.getSelection();if(l&&0!==l.rangeCount){r=l.anchorNode;var a=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{r.nodeType,u.nodeType}catch(e){r=null;break e}var o=0,i=-1,s=-1,c=0,f=0,d=e,p=null;n:for(;;){for(var m;d!==r||0!==a&&3!==d.nodeType||(i=o+a),d!==u||0!==l&&3!==d.nodeType||(s=o+l),3===d.nodeType&&(o+=d.nodeValue.length),null!==(m=d.firstChild);)p=d,d=m;for(;;){if(d===e)break n;if(p===r&&++c===a&&(i=o),p===u&&++f===l&&(s=o),null!==(m=d.nextSibling))break;p=(d=p).parentNode}d=m}r=-1===i||-1===s?null:{start:i,end:s}}else r=null}r=r||{start:0,end:0}}else r=null;for(Wo={focusedElem:e,selectionRange:r},Ru=!1,cs=n;null!==cs;)if(e=(n=cs).child,1028&n.subtreeFlags&&null!==e)e.return=n,cs=e;else for(;null!==cs;){n=cs;try{var h=n.alternate;if(1024&n.flags)switch(n.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==h){var g=h.memoizedProps,v=h.memoizedState,y=n.stateNode,b=y.getSnapshotBeforeUpdate(n.elementType===n.type?g:Gt(n.type,g),v);y.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var k=n.stateNode.containerInfo;1===k.nodeType?k.textContent="":9===k.nodeType&&k.documentElement&&k.removeChild(k.documentElement);break;default:throw Error(t(163))}}catch(e){zl(n,n.return,e)}if(null!==(e=n.sibling)){e.return=n.return,cs=e;break}cs=n.return}h=fs,fs=!1}(e,r),Yr(r,e),We(Wo),Ru=!!Bo,Wo=Bo=null,e.current=r,Gr(r,e,a),iu(),ys=i,xu=o,vs.transition=u}else e.current=r;if(Is&&(Is=!1,Us=e,Vs=a),0===(u=e.pendingLanes)&&(Os=null),function(e){if(vu&&"function"==typeof vu.onCommitFiberRoot)try{vu.onCommitFiberRoot(gu,e,void 0,!(128&~e.current.flags))}catch(e){}}(r.stateNode),ul(e,su()),null!==n)for(l=e.onRecoverableError,r=0;r<n.length;r++)a=n[r],l(a.value,{componentStack:a.stack,digest:a.digest});if(Rs)throw Rs=!1,e=Ds,Ds=null,e;!!(1&Vs)&&0!==e.tag&&El(),1&(u=e.pendingLanes)?e===Bs?As++:(As=0,Bs=e):As=0,Nn()}(e,n,r,l)}finally{vs.transition=a,xu=l}return null}function El(){if(null!==Us){var e=te(Vs),n=vs.transition,r=xu;try{if(vs.transition=null,xu=16>e?16:e,null===Us)var l=!1;else{if(e=Us,Us=null,Vs=0,6&ys)throw Error(t(331));var a=ys;for(ys|=4,cs=e.current;null!==cs;){var u=cs,o=u.child;if(16&cs.flags){var i=u.deletions;if(null!==i){for(var s=0;s<i.length;s++){var c=i[s];for(cs=c;null!==cs;){var f=cs;switch(f.tag){case 0:case 11:case 15:Ir(8,f,u)}var d=f.child;if(null!==d)d.return=f,cs=d;else for(;null!==cs;){var p=(f=cs).sibling,m=f.return;if(Ar(f),f===c){cs=null;break}if(null!==p){p.return=m,cs=p;break}cs=m}}}var h=u.alternate;if(null!==h){var g=h.child;if(null!==g){h.child=null;do{var v=g.sibling;g.sibling=null,g=v}while(null!==g)}}cs=u}}if(2064&u.subtreeFlags&&null!==o)o.return=u,cs=o;else e:for(;null!==cs;){if(2048&(u=cs).flags)switch(u.tag){case 0:case 11:case 15:Ir(9,u,u.return)}var y=u.sibling;if(null!==y){y.return=u.return,cs=y;break e}cs=u.return}}var b=e.current;for(cs=b;null!==cs;){var k=(o=cs).child;if(2064&o.subtreeFlags&&null!==k)k.return=o,cs=k;else e:for(o=b;null!==cs;){if(2048&(i=cs).flags)try{switch(i.tag){case 0:case 11:case 15:Ur(9,i)}}catch(e){zl(i,i.return,e)}if(i===o){cs=null;break e}var w=i.sibling;if(null!==w){w.return=i.return,cs=w;break e}cs=i.return}}if(ys=a,Nn(),vu&&"function"==typeof vu.onPostCommitFiberRoot)try{vu.onPostCommitFiberRoot(gu,e)}catch(e){}l=!0}return l}finally{xu=r,vs.transition=n}}return!1}function Cl(e,n,t){e=nt(e,n=ur(0,n=rr(t,n),1),1),n=rl(),null!==e&&(ee(e,1,n),ul(e,n))}function zl(e,n,t){if(3===e.tag)Cl(e,e,t);else for(;null!==n;){if(3===n.tag){Cl(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Os||!Os.has(r))){n=nt(n,e=or(n,e=rr(t,e),1),1),e=rl(),null!==n&&(ee(n,1,e),ul(n,e));break}}n=n.return}}function Nl(e,n,t){var r=e.pingCache;null!==r&&r.delete(n),n=rl(),e.pingedLanes|=e.suspendedLanes&t,bs===e&&(ws&t)===t&&(4===Es||3===Es&&(130023424&ws)===ws&&500>su()-Ts?ml(e,0):Ps|=t),ul(e,n)}function Pl(e,n){0===n&&(1&e.mode?(n=Su,!(130023424&(Su<<=1))&&(Su=4194304)):n=1);var t=rl();null!==(e=Gn(e,n))&&(ee(e,n,t),ul(e,t))}function _l(e){var n=e.memoizedState,t=0;null!==n&&(t=n.retryLane),Pl(e,t)}function Ll(e,n){var r=0;switch(e.tag){case 13:var l=e.stateNode,a=e.memoizedState;null!==a&&(r=a.retryLane);break;case 19:l=e.stateNode;break;default:throw Error(t(314))}null!==l&&l.delete(n),Pl(e,r)}function Tl(e,n){return au(e,n)}function Ml(e,n,t,r){this.tag=e,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fl(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Rl(e,n){var t=e.alternate;return null===t?((t=js(e.tag,n,e.key,e.mode)).elementType=e.elementType,t.type=e.type,t.stateNode=e.stateNode,t.alternate=e,e.alternate=t):(t.pendingProps=n,t.type=e.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=14680064&e.flags,t.childLanes=e.childLanes,t.lanes=e.lanes,t.child=e.child,t.memoizedProps=e.memoizedProps,t.memoizedState=e.memoizedState,t.updateQueue=e.updateQueue,n=e.dependencies,t.dependencies=null===n?null:{lanes:n.lanes,firstContext:n.firstContext},t.sibling=e.sibling,t.index=e.index,t.ref=e.ref,t}function Dl(e,n,r,l,a,u){var o=2;if(l=e,"function"==typeof e)Fl(e)&&(o=1);else if("string"==typeof e)o=5;else e:switch(e){case ha:return Ol(r.children,a,u,n);case ga:o=8,a|=8;break;case va:return(e=js(12,r,n,2|a)).elementType=va,e.lanes=u,e;case wa:return(e=js(13,r,n,a)).elementType=wa,e.lanes=u,e;case Sa:return(e=js(19,r,n,a)).elementType=Sa,e.lanes=u,e;case Ca:return Il(r,a,u,n);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case ya:o=10;break e;case ba:o=9;break e;case ka:o=11;break e;case xa:o=14;break e;case Ea:o=16,l=null;break e}throw Error(t(130,null==e?e:typeof e,""))}return(n=js(o,r,n,a)).elementType=e,n.type=l,n.lanes=u,n}function Ol(e,n,t,r){return(e=js(7,e,r,n)).lanes=t,e}function Il(e,n,t,r){return(e=js(22,e,r,n)).elementType=Ca,e.lanes=t,e.stateNode={isHidden:!1},e}function Ul(e,n,t){return(e=js(6,e,null,n)).lanes=t,e}function Vl(e,n,t){return(n=js(4,null!==e.children?e.children:[],e.key,n)).lanes=t,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Al(e,n,t,r,l){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=J(0),this.expirationTimes=J(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=J(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Bl(e,n,t,r,l,a,u,o,i,s){return e=new Al(e,n,t,o,i),1===n?(n=1,!0===a&&(n|=8)):n=0,a=js(3,null,null,n),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zn(a),e}function Wl(e){if(!e)return ti;e:{if(H(e=e._reactInternals)!==e||1!==e.tag)throw Error(t(170));var n=e;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(wn(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(null!==n);throw Error(t(171))}if(1===e.tag){var r=e.type;if(wn(r))return xn(e,r,n)}return n}function Hl(e,n,t,r,l,a,u,o,i,s){return(e=Bl(t,r,!0,e,0,a,0,o,i)).context=Wl(null),t=e.current,(a=et(r=rl(),l=ll(t))).callback=null!=n?n:null,nt(t,a,l),e.current.lanes=l,ee(e,l,r),ul(e,r),e}function Ql(e,n,t,r){var l=n.current,a=rl(),u=ll(l);return t=Wl(t),null===n.context?n.context=t:n.pendingContext=t,(n=et(a,u)).payload={element:e},null!==(r=void 0===r?null:r)&&(n.callback=r),null!==(e=nt(l,n,u))&&(al(e,l,u,a),tt(e,l,u)),u}function jl(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function $l(e,n){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var t=e.retryLane;e.retryLane=0!==t&&t<n?t:n}}function ql(e,n){$l(e,n),(e=e.alternate)&&$l(e,n)}function Kl(e){return null===(e=$(e))?null:e.stateNode}function Yl(e){return null}function Xl(e){this._internalRoot=e}function Gl(e){this._internalRoot=e}function Zl(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Jl(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function ea(){}function na(e,n,t,r,l){var a=t._reactRootContainer;if(a){var u=a;if("function"==typeof l){var o=l;l=function(){var e=jl(u);o.call(e)}}Ql(n,u,e,l)}else u=function(e,n,t,r,l){if(l){if("function"==typeof r){var a=r;r=function(){var e=jl(u);a.call(e)}}var u=Hl(n,r,e,0,null,!1,0,"",ea);return e._reactRootContainer=u,e[Xo]=u.current,Ge(8===e.nodeType?e.parentNode:e),pl(),u}for(;l=e.lastChild;)e.removeChild(l);if("function"==typeof r){var o=r;r=function(){var e=jl(i);o.call(e)}}var i=Bl(e,0,!1,null,0,!1,0,"",ea);return e._reactRootContainer=i,e[Xo]=i.current,Ge(8===e.nodeType?e.parentNode:e),pl((function(){Ql(n,i,t,r)})),i}(t,n,e,l,r);return jl(u)}var ta=new Set,ra={},la=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),aa=Object.prototype.hasOwnProperty,ua=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,oa={},ia={},sa={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){sa[e]=new a(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var n=e[0];sa[n]=new a(n,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){sa[e]=new a(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){sa[e]=new a(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){sa[e]=new a(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){sa[e]=new a(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){sa[e]=new a(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){sa[e]=new a(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){sa[e]=new a(e,5,!1,e.toLowerCase(),null,!1,!1)}));var ca=/[\-:]([a-z])/g,fa=function(e){return e[1].toUpperCase()};"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var n=e.replace(ca,fa);sa[n]=new a(n,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var n=e.replace(ca,fa);sa[n]=new a(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var n=e.replace(ca,fa);sa[n]=new a(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){sa[e]=new a(e,1,!1,e.toLowerCase(),null,!1,!1)})),sa.xlinkHref=new a("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){sa[e]=new a(e,1,!1,e.toLowerCase(),null,!0,!0)}));var da=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,pa=Symbol.for("react.element"),ma=Symbol.for("react.portal"),ha=Symbol.for("react.fragment"),ga=Symbol.for("react.strict_mode"),va=Symbol.for("react.profiler"),ya=Symbol.for("react.provider"),ba=Symbol.for("react.context"),ka=Symbol.for("react.forward_ref"),wa=Symbol.for("react.suspense"),Sa=Symbol.for("react.suspense_list"),xa=Symbol.for("react.memo"),Ea=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var Ca=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var za,Na,Pa,_a=Symbol.iterator,La=Object.assign,Ta=!1,Ma=Array.isArray,Fa=(Pa=function(e,n){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=n;else{for((Na=Na||document.createElement("div")).innerHTML="<svg>"+n.valueOf().toString()+"</svg>",n=Na.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,n,t,r){MSApp.execUnsafeLocalFunction((function(){return Pa(e,n)}))}:Pa),Ra=function(e,n){if(n){var t=e.firstChild;if(t&&t===e.lastChild&&3===t.nodeType)return void(t.nodeValue=n)}e.textContent=n},Da={animationIterationCount:!0,aspectRatio:!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,gridArea:!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},Oa=["Webkit","ms","Moz","O"];Object.keys(Da).forEach((function(e){Oa.forEach((function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Da[n]=Da[e]}))}));var Ia=La({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),Ua=null,Va=null,Aa=null,Ba=null,Wa=function(e,n){return e(n)},Ha=function(){},Qa=!1,ja=!1;if(la)try{var $a={};Object.defineProperty($a,"passive",{get:function(){ja=!0}}),window.addEventListener("test",$a,$a),window.removeEventListener("test",$a,$a)}catch(Pa){ja=!1}var qa,Ka,Ya,Xa=function(e,n,t,r,l,a,u,o,i){var s=Array.prototype.slice.call(arguments,3);try{n.apply(t,s)}catch(e){this.onError(e)}},Ga=!1,Za=null,Ja=!1,eu=null,nu={onError:function(e){Ga=!0,Za=e}},tu=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler,ru=tu.unstable_scheduleCallback,lu=tu.unstable_NormalPriority,au=ru,uu=tu.unstable_cancelCallback,ou=tu.unstable_shouldYield,iu=tu.unstable_requestPaint,su=tu.unstable_now,cu=tu.unstable_getCurrentPriorityLevel,fu=tu.unstable_ImmediatePriority,du=tu.unstable_UserBlockingPriority,pu=lu,mu=tu.unstable_LowPriority,hu=tu.unstable_IdlePriority,gu=null,vu=null,yu=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(bu(e)/ku|0)|0},bu=Math.log,ku=Math.LN2,wu=64,Su=4194304,xu=0,Eu=!1,Cu=[],zu=null,Nu=null,Pu=null,_u=new Map,Lu=new Map,Tu=[],Mu="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" "),Fu=da.ReactCurrentBatchConfig,Ru=!0,Du=null,Ou=null,Iu=null,Uu=null,Vu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Au=ke(Vu),Bu=La({},Vu,{view:0,detail:0}),Wu=ke(Bu),Hu=La({},Bu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Se,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ya&&(Ya&&"mousemove"===e.type?(qa=e.screenX-Ya.screenX,Ka=e.screenY-Ya.screenY):Ka=qa=0,Ya=e),qa)},movementY:function(e){return"movementY"in e?e.movementY:Ka}}),Qu=ke(Hu),ju=ke(La({},Hu,{dataTransfer:0})),$u=ke(La({},Bu,{relatedTarget:0})),qu=ke(La({},Vu,{animationName:0,elapsedTime:0,pseudoElement:0})),Ku=La({},Vu,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Yu=ke(Ku),Xu=ke(La({},Vu,{data:0})),Gu=Xu,Zu={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ju={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},eo={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"},no=La({},Bu,{key:function(e){if(e.key){var n=Zu[e.key]||e.key;if("Unidentified"!==n)return n}return"keypress"===e.type?13===(e=ve(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?Ju[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Se,charCode:function(e){return"keypress"===e.type?ve(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?ve(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),to=ke(no),ro=ke(La({},Hu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),lo=ke(La({},Bu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Se})),ao=ke(La({},Vu,{propertyName:0,elapsedTime:0,pseudoElement:0})),uo=La({},Hu,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),oo=ke(uo),io=[9,13,27,32],so=la&&"CompositionEvent"in window,co=null;la&&"documentMode"in document&&(co=document.documentMode);var fo=la&&"TextEvent"in window&&!co,po=la&&(!so||co&&8<co&&11>=co),mo=String.fromCharCode(32),ho=!1,go=!1,vo={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0},yo=null,bo=null,ko=!1;la&&(ko=function(e){if(!la)return!1;var n=(e="on"+e)in document;return n||((n=document.createElement("div")).setAttribute(e,"return;"),n="function"==typeof n[e]),n}("input")&&(!document.documentMode||9<document.documentMode));var wo="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},So=la&&"documentMode"in document&&11>=document.documentMode,xo=null,Eo=null,Co=null,zo=!1,No={animationend:Qe("Animation","AnimationEnd"),animationiteration:Qe("Animation","AnimationIteration"),animationstart:Qe("Animation","AnimationStart"),transitionend:Qe("Transition","TransitionEnd")},Po={},_o={};la&&(_o=document.createElement("div").style,"AnimationEvent"in window||(delete No.animationend.animation,delete No.animationiteration.animation,delete No.animationstart.animation),"TransitionEvent"in window||delete No.transitionend.transition);var Lo=je("animationend"),To=je("animationiteration"),Mo=je("animationstart"),Fo=je("transitionend"),Ro=new Map,Do="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");!function(){for(var e=0;e<Do.length;e++){var n=Do[e];$e(n.toLowerCase(),"on"+(n=n[0].toUpperCase()+n.slice(1)))}$e(Lo,"onAnimationEnd"),$e(To,"onAnimationIteration"),$e(Mo,"onAnimationStart"),$e("dblclick","onDoubleClick"),$e("focusin","onFocus"),$e("focusout","onBlur"),$e(Fo,"onTransitionEnd")}(),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),r("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),r("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),r("onBeforeInput",["compositionend","keypress","textInput","paste"]),r("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),r("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),r("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Io=new Set("cancel close invalid load scroll toggle".split(" ").concat(Oo)),Uo="_reactListening"+Math.random().toString(36).slice(2),Vo=/\r\n?/g,Ao=/\u0000|\uFFFD/g,Bo=null,Wo=null,Ho="function"==typeof setTimeout?setTimeout:void 0,Qo="function"==typeof clearTimeout?clearTimeout:void 0,jo="function"==typeof Promise?Promise:void 0,$o="function"==typeof queueMicrotask?queueMicrotask:void 0!==jo?function(e){return jo.resolve(null).then(e).catch(sn)}:Ho,qo=Math.random().toString(36).slice(2),Ko="__reactFiber$"+qo,Yo="__reactProps$"+qo,Xo="__reactContainer$"+qo,Go="__reactEvents$"+qo,Zo="__reactListeners$"+qo,Jo="__reactHandles$"+qo,ei=[],ni=-1,ti={},ri=vn(ti),li=vn(!1),ai=ti,ui=null,oi=!1,ii=!1,si=[],ci=0,fi=null,di=0,pi=[],mi=0,hi=null,gi=1,vi="",yi=null,bi=null,ki=!1,wi=null,Si=da.ReactCurrentBatchConfig,xi=Hn(!0),Ei=Hn(!1),Ci=vn(null),zi=null,Ni=null,Pi=null,_i=null,Li=Gn,Ti=!1,Mi={},Fi=vn(Mi),Ri=vn(Mi),Di=vn(Mi),Oi=vn(0),Ii=[],Ui=da.ReactCurrentDispatcher,Vi=da.ReactCurrentBatchConfig,Ai=0,Bi=null,Wi=null,Hi=null,Qi=!1,ji=!1,$i=0,qi=0,Ki={readContext:Kn,useCallback:pt,useContext:pt,useEffect:pt,useImperativeHandle:pt,useInsertionEffect:pt,useLayoutEffect:pt,useMemo:pt,useReducer:pt,useRef:pt,useState:pt,useDebugValue:pt,useDeferredValue:pt,useTransition:pt,useMutableSource:pt,useSyncExternalStore:pt,useId:pt,unstable_isNewReconciler:!1},Yi={readContext:Kn,useCallback:function(e,n){return vt().memoizedState=[e,void 0===n?null:n],e},useContext:Kn,useEffect:Rt,useImperativeHandle:function(e,n,t){return t=null!=t?t.concat([e]):null,Mt(4194308,4,Ut.bind(null,n,e),t)},useLayoutEffect:function(e,n){return Mt(4194308,4,e,n)},useInsertionEffect:function(e,n){return Mt(4,2,e,n)},useMemo:function(e,n){var t=vt();return n=void 0===n?null:n,e=e(),t.memoizedState=[e,n],e},useReducer:function(e,n,t){var r=vt();return n=void 0!==t?t(n):n,r.memoizedState=r.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},r.queue=e,e=e.dispatch=$t.bind(null,Bi,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},vt().memoizedState=e},useState:_t,useDebugValue:At,useDeferredValue:function(e){return vt().memoizedState=e},useTransition:function(){var e=_t(!1),n=e[0];return e=Qt.bind(null,e[1]),vt().memoizedState=e,[n,e]},useMutableSource:function(e,n,t){},useSyncExternalStore:function(e,n,r){var l=Bi,a=vt();if(ki){if(void 0===r)throw Error(t(407));r=r()}else{if(r=n(),null===bs)throw Error(t(349));30&Ai||Et(l,n,r)}a.memoizedState=r;var u={value:r,getSnapshot:n};return a.queue=u,Rt(zt.bind(null,l,u,e),[e]),l.flags|=2048,Lt(9,Ct.bind(null,l,u,r,n),void 0,null),r},useId:function(){var e=vt(),n=bs.identifierPrefix;if(ki){var t=vi;n=":"+n+"R"+(t=(gi&~(1<<32-yu(gi)-1)).toString(32)+t),0<(t=$i++)&&(n+="H"+t.toString(32)),n+=":"}else n=":"+n+"r"+(t=qi++).toString(32)+":";return e.memoizedState=n},unstable_isNewReconciler:!1},Xi={readContext:Kn,useCallback:Bt,useContext:Kn,useEffect:Dt,useImperativeHandle:Vt,useInsertionEffect:Ot,useLayoutEffect:It,useMemo:Wt,useReducer:kt,useRef:Tt,useState:function(e){return kt(bt)},useDebugValue:At,useDeferredValue:function(e){return Ht(yt(),Wi.memoizedState,e)},useTransition:function(){return[kt(bt)[0],yt().memoizedState]},useMutableSource:St,useSyncExternalStore:xt,useId:jt,unstable_isNewReconciler:!1},Gi={readContext:Kn,useCallback:Bt,useContext:Kn,useEffect:Dt,useImperativeHandle:Vt,useInsertionEffect:Ot,useLayoutEffect:It,useMemo:Wt,useReducer:wt,useRef:Tt,useState:function(e){return wt(bt)},useDebugValue:At,useDeferredValue:function(e){var n=yt();return null===Wi?n.memoizedState=e:Ht(n,Wi.memoizedState,e)},useTransition:function(){return[wt(bt)[0],yt().memoizedState]},useMutableSource:St,useSyncExternalStore:xt,useId:jt,unstable_isNewReconciler:!1},Zi={isMounted:function(e){return!!(e=e._reactInternals)&&H(e)===e},enqueueSetState:function(e,n,t){e=e._reactInternals;var r=rl(),l=ll(e),a=et(r,l);a.payload=n,null!=t&&(a.callback=t),null!==(n=nt(e,a,l))&&(al(n,e,l,r),tt(n,e,l))},enqueueReplaceState:function(e,n,t){e=e._reactInternals;var r=rl(),l=ll(e),a=et(r,l);a.tag=1,a.payload=n,null!=t&&(a.callback=t),null!==(n=nt(e,a,l))&&(al(n,e,l,r),tt(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var t=rl(),r=ll(e),l=et(t,r);l.tag=2,null!=n&&(l.callback=n),null!==(n=nt(e,l,r))&&(al(n,e,r,t),tt(n,e,r))}},Ji="function"==typeof WeakMap?WeakMap:Map,es=da.ReactCurrentOwner,ns=!1,ts={dehydrated:null,treeContext:null,retryLane:0},rs=function(e,n,t,r){for(t=n.child;null!==t;){if(5===t.tag||6===t.tag)e.appendChild(t.stateNode);else if(4!==t.tag&&null!==t.child){t.child.return=t,t=t.child;continue}if(t===n)break;for(;null===t.sibling;){if(null===t.return||t.return===n)return;t=t.return}t.sibling.return=t.return,t=t.sibling}},ls=function(e,n){},as=function(e,n,t,r,l){var a=e.memoizedProps;if(a!==r){switch(e=n.stateNode,ut(Fi.current),l=null,t){case"input":a=y(e,a),r=y(e,r),l=[];break;case"select":a=La({},a,{value:void 0}),r=La({},r,{value:void 0}),l=[];break;case"textarea":a=C(e,a),r=C(e,r),l=[];break;default:"function"!=typeof a.onClick&&"function"==typeof r.onClick&&(e.onclick=un)}var u;for(s in F(t,r),t=null,a)if(!r.hasOwnProperty(s)&&a.hasOwnProperty(s)&&null!=a[s])if("style"===s){var o=a[s];for(u in o)o.hasOwnProperty(u)&&(t||(t={}),t[u]="")}else"dangerouslySetInnerHTML"!==s&&"children"!==s&&"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&"autoFocus"!==s&&(ra.hasOwnProperty(s)?l||(l=[]):(l=l||[]).push(s,null));for(s in r){var i=r[s];if(o=null!=a?a[s]:void 0,r.hasOwnProperty(s)&&i!==o&&(null!=i||null!=o))if("style"===s)if(o){for(u in o)!o.hasOwnProperty(u)||i&&i.hasOwnProperty(u)||(t||(t={}),t[u]="");for(u in i)i.hasOwnProperty(u)&&o[u]!==i[u]&&(t||(t={}),t[u]=i[u])}else t||(l||(l=[]),l.push(s,t)),t=i;else"dangerouslySetInnerHTML"===s?(i=i?i.__html:void 0,o=o?o.__html:void 0,null!=i&&o!==i&&(l=l||[]).push(s,i)):"children"===s?"string"!=typeof i&&"number"!=typeof i||(l=l||[]).push(s,""+i):"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&(ra.hasOwnProperty(s)?(null!=i&&"onScroll"===s&&Ye("scroll",e),l||o===i||(l=[])):(l=l||[]).push(s,i))}t&&(l=l||[]).push("style",t);var s=l;(n.updateQueue=s)&&(n.flags|=4)}},us=function(e,n,t,r){t!==r&&(n.flags|=4)},os=!1,is=!1,ss="function"==typeof WeakSet?WeakSet:Set,cs=null,fs=!1,ds=null,ps=!1,ms=Math.ceil,hs=da.ReactCurrentDispatcher,gs=da.ReactCurrentOwner,vs=da.ReactCurrentBatchConfig,ys=0,bs=null,ks=null,ws=0,Ss=0,xs=vn(0),Es=0,Cs=null,zs=0,Ns=0,Ps=0,_s=null,Ls=null,Ts=0,Ms=1/0,Fs=null,Rs=!1,Ds=null,Os=null,Is=!1,Us=null,Vs=0,As=0,Bs=null,Ws=-1,Hs=0,Qs=function(e,n,r){if(null!==e)if(e.memoizedProps!==n.pendingProps||li.current)ns=!0;else{if(!(e.lanes&r||128&n.flags))return ns=!1,function(e,n,t){switch(n.tag){case 3:kr(n),Un();break;case 5:st(n);break;case 1:wn(n.type)&&En(n);break;case 4:ot(n,n.stateNode.containerInfo);break;case 10:var r=n.type._context,l=n.memoizedProps.value;bn(Ci,r._currentValue),r._currentValue=l;break;case 13:if(null!==(r=n.memoizedState))return null!==r.dehydrated?(bn(Oi,1&Oi.current),n.flags|=128,null):t&n.child.childLanes?xr(e,n,t):(bn(Oi,1&Oi.current),null!==(e=Lr(e,n,t))?e.sibling:null);bn(Oi,1&Oi.current);break;case 19:if(r=!!(t&n.childLanes),128&e.flags){if(r)return Pr(e,n,t);n.flags|=128}if(null!==(l=n.memoizedState)&&(l.rendering=null,l.tail=null,l.lastEffect=null),bn(Oi,Oi.current),r)break;return null;case 22:case 23:return n.lanes=0,hr(e,n,t)}return Lr(e,n,t)}(e,n,r);ns=!!(131072&e.flags)}else ns=!1,ki&&1048576&n.flags&&_n(n,di,n.index);switch(n.lanes=0,n.tag){case 2:var l=n.type;_r(e,n),e=n.pendingProps;var a=kn(n,ri.current);qn(n,r),a=ht(null,n,l,e,a,r);var u=gt();return n.flags|=1,"object"==typeof a&&null!==a&&"function"==typeof a.render&&void 0===a.$$typeof?(n.tag=1,n.memoizedState=null,n.updateQueue=null,wn(l)?(u=!0,En(n)):u=!1,n.memoizedState=null!==a.state&&void 0!==a.state?a.state:null,Zn(n),a.updater=Zi,n.stateNode=a,a._reactInternals=n,tr(n,l,e,r),n=br(null,n,l,!0,u,r)):(n.tag=0,ki&&u&&Ln(n),fr(null,n,a,r),n=n.child),n;case 16:l=n.elementType;e:{switch(_r(e,n),e=n.pendingProps,l=(a=l._init)(l._payload),n.type=l,a=n.tag=function(e){if("function"==typeof e)return Fl(e)?1:0;if(null!=e){if((e=e.$$typeof)===ka)return 11;if(e===xa)return 14}return 2}(l),e=Gt(l,e),a){case 0:n=vr(null,n,l,e,r);break e;case 1:n=yr(null,n,l,e,r);break e;case 11:n=dr(null,n,l,e,r);break e;case 14:n=pr(null,n,l,Gt(l.type,e),r);break e}throw Error(t(306,l,""))}return n;case 0:return l=n.type,a=n.pendingProps,vr(e,n,l,a=n.elementType===l?a:Gt(l,a),r);case 1:return l=n.type,a=n.pendingProps,yr(e,n,l,a=n.elementType===l?a:Gt(l,a),r);case 3:e:{if(kr(n),null===e)throw Error(t(387));l=n.pendingProps,a=(u=n.memoizedState).element,Jn(e,n),lt(n,l,null,r);var o=n.memoizedState;if(l=o.element,u.isDehydrated){if(u={element:l,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},n.updateQueue.baseState=u,n.memoizedState=u,256&n.flags){n=wr(e,n,l,r,a=rr(Error(t(423)),n));break e}if(l!==a){n=wr(e,n,l,r,a=rr(Error(t(424)),n));break e}for(bi=fn(n.stateNode.containerInfo.firstChild),yi=n,ki=!0,wi=null,r=Ei(n,null,l,r),n.child=r;r;)r.flags=-3&r.flags|4096,r=r.sibling}else{if(Un(),l===a){n=Lr(e,n,r);break e}fr(e,n,l,r)}n=n.child}return n;case 5:return st(n),null===e&&Dn(n),l=n.type,a=n.pendingProps,u=null!==e?e.memoizedProps:null,o=a.children,on(l,a)?o=null:null!==u&&on(l,u)&&(n.flags|=32),gr(e,n),fr(e,n,o,r),n.child;case 6:return null===e&&Dn(n),null;case 13:return xr(e,n,r);case 4:return ot(n,n.stateNode.containerInfo),l=n.pendingProps,null===e?n.child=xi(n,null,l,r):fr(e,n,l,r),n.child;case 11:return l=n.type,a=n.pendingProps,dr(e,n,l,a=n.elementType===l?a:Gt(l,a),r);case 7:return fr(e,n,n.pendingProps,r),n.child;case 8:case 12:return fr(e,n,n.pendingProps.children,r),n.child;case 10:e:{if(l=n.type._context,a=n.pendingProps,u=n.memoizedProps,o=a.value,bn(Ci,l._currentValue),l._currentValue=o,null!==u)if(wo(u.value,o)){if(u.children===a.children&&!li.current){n=Lr(e,n,r);break e}}else for(null!==(u=n.child)&&(u.return=n);null!==u;){var i=u.dependencies;if(null!==i){o=u.child;for(var s=i.firstContext;null!==s;){if(s.context===l){if(1===u.tag){(s=et(-1,r&-r)).tag=2;var c=u.updateQueue;if(null!==c){var f=(c=c.shared).pending;null===f?s.next=s:(s.next=f.next,f.next=s),c.pending=s}}u.lanes|=r,null!==(s=u.alternate)&&(s.lanes|=r),$n(u.return,r,n),i.lanes|=r;break}s=s.next}}else if(10===u.tag)o=u.type===n.type?null:u.child;else if(18===u.tag){if(null===(o=u.return))throw Error(t(341));o.lanes|=r,null!==(i=o.alternate)&&(i.lanes|=r),$n(o,r,n),o=u.sibling}else o=u.child;if(null!==o)o.return=u;else for(o=u;null!==o;){if(o===n){o=null;break}if(null!==(u=o.sibling)){u.return=o.return,o=u;break}o=o.return}u=o}fr(e,n,a.children,r),n=n.child}return n;case 9:return a=n.type,l=n.pendingProps.children,qn(n,r),l=l(a=Kn(a)),n.flags|=1,fr(e,n,l,r),n.child;case 14:return a=Gt(l=n.type,n.pendingProps),pr(e,n,l,a=Gt(l.type,a),r);case 15:return mr(e,n,n.type,n.pendingProps,r);case 17:return l=n.type,a=n.pendingProps,a=n.elementType===l?a:Gt(l,a),_r(e,n),n.tag=1,wn(l)?(e=!0,En(n)):e=!1,qn(n,r),er(n,l,a),tr(n,l,a,r),br(null,n,l,!0,e,r);case 19:return Pr(e,n,r);case 22:return hr(e,n,r)}throw Error(t(156,n.tag))},js=function(e,n,t,r){return new Ml(e,n,t,r)},$s="function"==typeof reportError?reportError:function(e){console.error(e)};Gl.prototype.render=Xl.prototype.render=function(e){var n=this._internalRoot;if(null===n)throw Error(t(409));Ql(e,n,null,null)},Gl.prototype.unmount=Xl.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var n=e.containerInfo;pl((function(){Ql(null,e,null,null)})),n[Xo]=null}},Gl.prototype.unstable_scheduleHydration=function(e){if(e){var n=Xs();e={blockedOn:null,target:e,priority:n};for(var t=0;t<Tu.length&&0!==n&&n<Tu[t].priority;t++);Tu.splice(t,0,e),0===t&&ae(e)}};var qs=function(e){switch(e.tag){case 3:var n=e.stateNode;if(n.current.memoizedState.isDehydrated){var t=K(n.pendingLanes);0!==t&&(ne(n,1|t),ul(n,su()),!(6&ys)&&(tl(),Nn()))}break;case 13:pl((function(){var n=Gn(e,1);if(null!==n){var t=rl();al(n,e,1,t)}})),ql(e,1)}},Ks=function(e){if(13===e.tag){var n=Gn(e,134217728);null!==n&&al(n,e,134217728,rl()),ql(e,134217728)}},Ys=function(e){if(13===e.tag){var n=ll(e),t=Gn(e,n);null!==t&&al(t,e,n,rl()),ql(e,n)}},Xs=function(){return xu},Gs=function(e,n){var t=xu;try{return xu=e,n()}finally{xu=t}};Va=function(e,n,r){switch(n){case"input":if(w(e,r),n=r.name,"radio"===r.type&&null!=n){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<r.length;n++){var l=r[n];if(l!==e&&l.form===e.form){var a=gn(l);if(!a)throw Error(t(90));g(l),w(l,a)}}}break;case"textarea":N(e,r);break;case"select":null!=(n=r.value)&&E(e,!!r.multiple,n,!1)}},function(e,n,t){Wa=e,Ha=t}(dl,0,pl);var Zs={usingClientEntryPoint:!1,Events:[mn,hn,gn,I,U,dl]};!function(e){if(e={bundleType:e.bundleType,version:e.version,rendererPackageName:e.rendererPackageName,rendererConfig:e.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:da.ReactCurrentDispatcher,findHostInstanceByFiber:Kl,findFiberByHostInstance:e.findFiberByHostInstance||Yl,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1"},"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var n=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n.isDisabled||!n.supportsFiber)e=!0;else{try{gu=n.inject(e),vu=n}catch(e){}e=!!n.checkDCE}}}({findFiberByHostInstance:pn,bundleType:0,version:"18.3.1-next-f1338f8080-20240426",rendererPackageName:"react-dom"}),e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Zs,e.createPortal=function(e,n){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Zl(n))throw Error(t(200));return function(e,n,t){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:ma,key:null==r?null:""+r,children:e,containerInfo:n,implementation:t}}(e,n,null,r)},e.createRoot=function(e,n){if(!Zl(e))throw Error(t(299));var r=!1,l="",a=$s;return null!=n&&(!0===n.unstable_strictMode&&(r=!0),void 0!==n.identifierPrefix&&(l=n.identifierPrefix),void 0!==n.onRecoverableError&&(a=n.onRecoverableError)),n=Bl(e,1,!1,null,0,r,0,l,a),e[Xo]=n.current,Ge(8===e.nodeType?e.parentNode:e),new Xl(n)},e.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var n=e._reactInternals;if(void 0===n){if("function"==typeof e.render)throw Error(t(188));throw e=Object.keys(e).join(","),Error(t(268,e))}return e=null===(e=$(n))?null:e.stateNode},e.flushSync=function(e){return pl(e)},e.hydrate=function(e,n,r){if(!Jl(n))throw Error(t(200));return na(null,e,n,!0,r)},e.hydrateRoot=function(e,n,r){if(!Zl(e))throw Error(t(405));var l=null!=r&&r.hydratedSources||null,a=!1,u="",o=$s;if(null!=r&&(!0===r.unstable_strictMode&&(a=!0),void 0!==r.identifierPrefix&&(u=r.identifierPrefix),void 0!==r.onRecoverableError&&(o=r.onRecoverableError)),n=Hl(n,null,e,1,null!=r?r:null,a,0,u,o),e[Xo]=n.current,Ge(e),l)for(e=0;e<l.length;e++)a=(a=(r=l[e])._getVersion)(r._source),null==n.mutableSourceEagerHydrationData?n.mutableSourceEagerHydrationData=[r,a]:n.mutableSourceEagerHydrationData.push(r,a);return new Gl(n)},e.render=function(e,n,r){if(!Jl(n))throw Error(t(200));return na(null,e,n,!1,r)},e.unmountComponentAtNode=function(e){if(!Jl(e))throw Error(t(40));return!!e._reactRootContainer&&(pl((function(){na(null,null,e,!1,(function(){e._reactRootContainer=null,e[Xo]=null}))})),!0)},e.unstable_batchedUpdates=dl,e.unstable_renderSubtreeIntoContainer=function(e,n,r,l){if(!Jl(r))throw Error(t(200));if(null==e||void 0===e._reactInternals)throw Error(t(38));return na(e,n,r,!1,l)},e.version="18.3.1-next-f1338f8080-20240426"},"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e=e||self).ReactDOM={},e.React)}(); vendor/wp-polyfill.min.js 0000644 00000101414 15151622574 0011450 0 ustar 00 !function(r){"use strict";var t,e,n;t=[function(r,t,e){e(1),e(53),e(81),e(82),e(93),e(94),e(99),e(100),e(110),e(120),e(122),e(123),e(124),r.exports=e(125)},function(r,t,e){var n=e(2),o=e(4),a=e(48),c=ArrayBuffer.prototype;n&&!("detached"in c)&&o(c,"detached",{configurable:!0,get:function(){return a(this)}})},function(r,t,e){var n=e(3);r.exports=!n((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(r,t,e){r.exports=function(r){try{return!!r()}catch(r){return!0}}},function(r,t,e){var n=e(5),o=e(23);r.exports=function(r,t,e){return e.get&&n(e.get,t,{getter:!0}),e.set&&n(e.set,t,{setter:!0}),o.f(r,t,e)}},function(t,e,n){var o=n(6),a=n(3),c=n(8),i=n(9),u=n(2),s=n(13).CONFIGURABLE,f=n(14),p=n(19),l=p.enforce,y=p.get,v=String,h=Object.defineProperty,g=o("".slice),b=o("".replace),m=o([].join),d=u&&!a((function(){return 8!==h((function(){}),"length",{value:8}).length})),w=String(String).split("String"),E=t.exports=function(t,e,n){"Symbol("===g(v(e),0,7)&&(e="["+b(v(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!i(t,"name")||s&&t.name!==e)&&(u?h(t,"name",{value:e,configurable:!0}):t.name=e),d&&n&&i(n,"arity")&&t.length!==n.arity&&h(t,"length",{value:n.arity});try{n&&i(n,"constructor")&&n.constructor?u&&h(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=r)}catch(r){}var o=l(t);return i(o,"source")||(o.source=m(w,"string"==typeof e?e:"")),t};Function.prototype.toString=E((function(){return c(this)&&y(this).source||f(this)}),"toString")},function(r,t,e){var n=e(7),o=Function.prototype,a=o.call,c=n&&o.bind.bind(a,a);r.exports=n?c:function(r){return function(){return a.apply(r,arguments)}}},function(r,t,e){var n=e(3);r.exports=!n((function(){var r=function(){}.bind();return"function"!=typeof r||r.hasOwnProperty("prototype")}))},function(t,e,n){var o="object"==typeof document&&document.all;t.exports=void 0===o&&o!==r?function(r){return"function"==typeof r||r===o}:function(r){return"function"==typeof r}},function(r,t,e){var n=e(6),o=e(10),a=n({}.hasOwnProperty);r.exports=Object.hasOwn||function(r,t){return a(o(r),t)}},function(r,t,e){var n=e(11),o=Object;r.exports=function(r){return o(n(r))}},function(r,t,e){var n=e(12),o=TypeError;r.exports=function(r){if(n(r))throw new o("Can't call method on "+r);return r}},function(t,e,n){t.exports=function(t){return null===t||t===r}},function(r,t,e){var n=e(2),o=e(9),a=Function.prototype,c=n&&Object.getOwnPropertyDescriptor,i=o(a,"name"),u=i&&"something"===function(){}.name,s=i&&(!n||n&&c(a,"name").configurable);r.exports={EXISTS:i,PROPER:u,CONFIGURABLE:s}},function(r,t,e){var n=e(6),o=e(8),a=e(15),c=n(Function.toString);o(a.inspectSource)||(a.inspectSource=function(r){return c(r)}),r.exports=a.inspectSource},function(r,t,e){var n=e(16),o=e(17),a=e(18),c="__core-js_shared__",i=r.exports=o[c]||a(c,{});(i.versions||(i.versions=[])).push({version:"3.39.0",mode:n?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})},function(r,t,e){r.exports=!1},function(r,t,e){var n=function(r){return r&&r.Math===Math&&r};r.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof global&&global)||n("object"==typeof this&&this)||function(){return this}()||Function("return this")()},function(r,t,e){var n=e(17),o=Object.defineProperty;r.exports=function(r,t){try{o(n,r,{value:t,configurable:!0,writable:!0})}catch(e){n[r]=t}return t}},function(r,t,e){var n,o,a,c=e(20),i=e(17),u=e(21),s=e(22),f=e(9),p=e(15),l=e(46),y=e(47),v="Object already initialized",h=i.TypeError,g=i.WeakMap;if(c||p.state){var b=p.state||(p.state=new g);b.get=b.get,b.has=b.has,b.set=b.set,n=function(r,t){if(b.has(r))throw new h(v);return t.facade=r,b.set(r,t),t},o=function(r){return b.get(r)||{}},a=function(r){return b.has(r)}}else{var m=l("state");y[m]=!0,n=function(r,t){if(f(r,m))throw new h(v);return t.facade=r,s(r,m,t),t},o=function(r){return f(r,m)?r[m]:{}},a=function(r){return f(r,m)}}r.exports={set:n,get:o,has:a,enforce:function(r){return a(r)?o(r):n(r,{})},getterFor:function(r){return function(t){var e;if(!u(t)||(e=o(t)).type!==r)throw new h("Incompatible receiver, "+r+" required");return e}}}},function(r,t,e){var n=e(17),o=e(8),a=n.WeakMap;r.exports=o(a)&&/native code/.test(String(a))},function(r,t,e){var n=e(8);r.exports=function(r){return"object"==typeof r?null!==r:n(r)}},function(r,t,e){var n=e(2),o=e(23),a=e(45);r.exports=n?function(r,t,e){return o.f(r,t,a(1,e))}:function(r,t,e){return r[t]=e,r}},function(r,t,e){var n=e(2),o=e(24),a=e(26),c=e(27),i=e(28),u=TypeError,s=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p="enumerable",l="configurable",y="writable";t.f=n?a?function(r,t,e){if(c(r),t=i(t),c(e),"function"==typeof r&&"prototype"===t&&"value"in e&&y in e&&!e[y]){var n=f(r,t);n&&n[y]&&(r[t]=e.value,e={configurable:l in e?e[l]:n[l],enumerable:p in e?e[p]:n[p],writable:!1})}return s(r,t,e)}:s:function(r,t,e){if(c(r),t=i(t),c(e),o)try{return s(r,t,e)}catch(r){}if("get"in e||"set"in e)throw new u("Accessors not supported");return"value"in e&&(r[t]=e.value),r}},function(r,t,e){var n=e(2),o=e(3),a=e(25);r.exports=!n&&!o((function(){return 7!==Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}))},function(r,t,e){var n=e(17),o=e(21),a=n.document,c=o(a)&&o(a.createElement);r.exports=function(r){return c?a.createElement(r):{}}},function(r,t,e){var n=e(2),o=e(3);r.exports=n&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},function(r,t,e){var n=e(21),o=String,a=TypeError;r.exports=function(r){if(n(r))return r;throw new a(o(r)+" is not an object")}},function(r,t,e){var n=e(29),o=e(31);r.exports=function(r){var t=n(r,"string");return o(t)?t:t+""}},function(t,e,n){var o=n(30),a=n(21),c=n(31),i=n(38),u=n(41),s=n(42),f=TypeError,p=s("toPrimitive");t.exports=function(t,e){if(!a(t)||c(t))return t;var n,s=i(t,p);if(s){if(e===r&&(e="default"),n=o(s,t,e),!a(n)||c(n))return n;throw new f("Can't convert object to primitive value")}return e===r&&(e="number"),u(t,e)}},function(r,t,e){var n=e(7),o=Function.prototype.call;r.exports=n?o.bind(o):function(){return o.apply(o,arguments)}},function(r,t,e){var n=e(32),o=e(8),a=e(33),c=e(34),i=Object;r.exports=c?function(r){return"symbol"==typeof r}:function(r){var t=n("Symbol");return o(t)&&a(t.prototype,i(r))}},function(t,e,n){var o=n(17),a=n(8);t.exports=function(t,e){return arguments.length<2?(n=o[t],a(n)?n:r):o[t]&&o[t][e];var n}},function(r,t,e){var n=e(6);r.exports=n({}.isPrototypeOf)},function(r,t,e){var n=e(35);r.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(r,t,e){var n=e(36),o=e(3),a=e(17).String;r.exports=!!Object.getOwnPropertySymbols&&!o((function(){var r=Symbol("symbol detection");return!a(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},function(r,t,e){var n,o,a=e(17),c=e(37),i=a.process,u=a.Deno,s=i&&i.versions||u&&u.version,f=s&&s.v8;f&&(o=(n=f.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!o&&c&&(!(n=c.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=c.match(/Chrome\/(\d+)/))&&(o=+n[1]),r.exports=o},function(r,t,e){var n=e(17).navigator,o=n&&n.userAgent;r.exports=o?String(o):""},function(t,e,n){var o=n(39),a=n(12);t.exports=function(t,e){var n=t[e];return a(n)?r:o(n)}},function(r,t,e){var n=e(8),o=e(40),a=TypeError;r.exports=function(r){if(n(r))return r;throw new a(o(r)+" is not a function")}},function(r,t,e){var n=String;r.exports=function(r){try{return n(r)}catch(r){return"Object"}}},function(r,t,e){var n=e(30),o=e(8),a=e(21),c=TypeError;r.exports=function(r,t){var e,i;if("string"===t&&o(e=r.toString)&&!a(i=n(e,r)))return i;if(o(e=r.valueOf)&&!a(i=n(e,r)))return i;if("string"!==t&&o(e=r.toString)&&!a(i=n(e,r)))return i;throw new c("Can't convert object to primitive value")}},function(r,t,e){var n=e(17),o=e(43),a=e(9),c=e(44),i=e(35),u=e(34),s=n.Symbol,f=o("wks"),p=u?s.for||s:s&&s.withoutSetter||c;r.exports=function(r){return a(f,r)||(f[r]=i&&a(s,r)?s[r]:p("Symbol."+r)),f[r]}},function(r,t,e){var n=e(15);r.exports=function(r,t){return n[r]||(n[r]=t||{})}},function(t,e,n){var o=n(6),a=0,c=Math.random(),i=o(1..toString);t.exports=function(t){return"Symbol("+(t===r?"":t)+")_"+i(++a+c,36)}},function(r,t,e){r.exports=function(r,t){return{enumerable:!(1&r),configurable:!(2&r),writable:!(4&r),value:t}}},function(r,t,e){var n=e(43),o=e(44),a=n("keys");r.exports=function(r){return a[r]||(a[r]=o(r))}},function(r,t,e){r.exports={}},function(r,t,e){var n=e(17),o=e(49),a=e(51),c=n.ArrayBuffer,i=c&&c.prototype,u=i&&o(i.slice);r.exports=function(r){if(0!==a(r))return!1;if(!u)return!1;try{return u(r,0,0),!1}catch(r){return!0}}},function(r,t,e){var n=e(50),o=e(6);r.exports=function(r){if("Function"===n(r))return o(r)}},function(r,t,e){var n=e(6),o=n({}.toString),a=n("".slice);r.exports=function(r){return a(o(r),8,-1)}},function(r,t,e){var n=e(17),o=e(52),a=e(50),c=n.ArrayBuffer,i=n.TypeError;r.exports=c&&o(c.prototype,"byteLength","get")||function(r){if("ArrayBuffer"!==a(r))throw new i("ArrayBuffer expected");return r.byteLength}},function(r,t,e){var n=e(6),o=e(39);r.exports=function(r,t,e){try{return n(o(Object.getOwnPropertyDescriptor(r,t)[e]))}catch(r){}}},function(t,e,n){var o=n(54),a=n(73);a&&o({target:"ArrayBuffer",proto:!0},{transfer:function(){return a(this,arguments.length?arguments[0]:r,!0)}})},function(t,e,n){var o=n(17),a=n(55).f,c=n(22),i=n(59),u=n(18),s=n(60),f=n(72);t.exports=function(t,e){var n,p,l,y,v,h=t.target,g=t.global,b=t.stat;if(n=g?o:b?o[h]||u(h,{}):o[h]&&o[h].prototype)for(p in e){if(y=e[p],l=t.dontCallGetSet?(v=a(n,p))&&v.value:n[p],!f(g?p:h+(b?".":"#")+p,t.forced)&&l!==r){if(typeof y==typeof l)continue;s(y,l)}(t.sham||l&&l.sham)&&c(y,"sham",!0),i(n,p,y,t)}}},function(r,t,e){var n=e(2),o=e(30),a=e(56),c=e(45),i=e(57),u=e(28),s=e(9),f=e(24),p=Object.getOwnPropertyDescriptor;t.f=n?p:function(r,t){if(r=i(r),t=u(t),f)try{return p(r,t)}catch(r){}if(s(r,t))return c(!o(a.f,r,t),r[t])}},function(r,t,e){var n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,a=o&&!n.call({1:2},1);t.f=a?function(r){var t=o(this,r);return!!t&&t.enumerable}:n},function(r,t,e){var n=e(58),o=e(11);r.exports=function(r){return n(o(r))}},function(r,t,e){var n=e(6),o=e(3),a=e(50),c=Object,i=n("".split);r.exports=o((function(){return!c("z").propertyIsEnumerable(0)}))?function(r){return"String"===a(r)?i(r,""):c(r)}:c},function(t,e,n){var o=n(8),a=n(23),c=n(5),i=n(18);t.exports=function(t,e,n,u){u||(u={});var s=u.enumerable,f=u.name!==r?u.name:e;if(o(n)&&c(n,f,u),u.global)s?t[e]=n:i(e,n);else{try{u.unsafe?t[e]&&(s=!0):delete t[e]}catch(r){}s?t[e]=n:a.f(t,e,{value:n,enumerable:!1,configurable:!u.nonConfigurable,writable:!u.nonWritable})}return t}},function(r,t,e){var n=e(9),o=e(61),a=e(55),c=e(23);r.exports=function(r,t,e){for(var i=o(t),u=c.f,s=a.f,f=0;f<i.length;f++){var p=i[f];n(r,p)||e&&n(e,p)||u(r,p,s(t,p))}}},function(r,t,e){var n=e(32),o=e(6),a=e(62),c=e(71),i=e(27),u=o([].concat);r.exports=n("Reflect","ownKeys")||function(r){var t=a.f(i(r)),e=c.f;return e?u(t,e(r)):t}},function(r,t,e){var n=e(63),o=e(70).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(r){return n(r,o)}},function(r,t,e){var n=e(6),o=e(9),a=e(57),c=e(64).indexOf,i=e(47),u=n([].push);r.exports=function(r,t){var e,n=a(r),s=0,f=[];for(e in n)!o(i,e)&&o(n,e)&&u(f,e);for(;t.length>s;)o(n,e=t[s++])&&(~c(f,e)||u(f,e));return f}},function(r,t,e){var n=e(57),o=e(65),a=e(68),c=function(r){return function(t,e,c){var i=n(t),u=a(i);if(0===u)return!r&&-1;var s,f=o(c,u);if(r&&e!=e){for(;u>f;)if((s=i[f++])!=s)return!0}else for(;u>f;f++)if((r||f in i)&&i[f]===e)return r||f||0;return!r&&-1}};r.exports={includes:c(!0),indexOf:c(!1)}},function(r,t,e){var n=e(66),o=Math.max,a=Math.min;r.exports=function(r,t){var e=n(r);return e<0?o(e+t,0):a(e,t)}},function(r,t,e){var n=e(67);r.exports=function(r){var t=+r;return t!=t||0===t?0:n(t)}},function(r,t,e){var n=Math.ceil,o=Math.floor;r.exports=Math.trunc||function(r){var t=+r;return(t>0?o:n)(t)}},function(r,t,e){var n=e(69);r.exports=function(r){return n(r.length)}},function(r,t,e){var n=e(66),o=Math.min;r.exports=function(r){var t=n(r);return t>0?o(t,9007199254740991):0}},function(r,t,e){r.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(r,t,e){t.f=Object.getOwnPropertySymbols},function(r,t,e){var n=e(3),o=e(8),a=/#|\.prototype\./,c=function(r,t){var e=u[i(r)];return e===f||e!==s&&(o(t)?n(t):!!t)},i=c.normalize=function(r){return String(r).replace(a,".").toLowerCase()},u=c.data={},s=c.NATIVE="N",f=c.POLYFILL="P";r.exports=c},function(t,e,n){var o=n(17),a=n(6),c=n(52),i=n(74),u=n(75),s=n(51),f=n(76),p=n(80),l=o.structuredClone,y=o.ArrayBuffer,v=o.DataView,h=Math.min,g=y.prototype,b=v.prototype,m=a(g.slice),d=c(g,"resizable","get"),w=c(g,"maxByteLength","get"),E=a(b.getInt8),x=a(b.setInt8);t.exports=(p||f)&&function(t,e,n){var o,a=s(t),c=e===r?a:i(e),g=!d||!d(t);if(u(t),p&&(t=l(t,{transfer:[t]}),a===c&&(n||g)))return t;if(a>=c&&(!n||g))o=m(t,0,c);else{var b=n&&!g&&w?{maxByteLength:w(t)}:r;o=new y(c,b);for(var O=new v(t),R=new v(o),S=h(c,a),A=0;A<S;A++)x(R,A,E(O,A))}return p||f(t),o}},function(t,e,n){var o=n(66),a=n(69),c=RangeError;t.exports=function(t){if(t===r)return 0;var e=o(t),n=a(e);if(e!==n)throw new c("Wrong length or index");return n}},function(r,t,e){var n=e(48),o=TypeError;r.exports=function(r){if(n(r))throw new o("ArrayBuffer is detached");return r}},function(r,t,e){var n,o,a,c,i=e(17),u=e(77),s=e(80),f=i.structuredClone,p=i.ArrayBuffer,l=i.MessageChannel,y=!1;if(s)y=function(r){f(r,{transfer:[r]})};else if(p)try{l||(n=u("worker_threads"))&&(l=n.MessageChannel),l&&(o=new l,a=new p(2),c=function(r){o.port1.postMessage(null,[r])},2===a.byteLength&&(c(a),0===a.byteLength&&(y=c)))}catch(r){}r.exports=y},function(r,t,e){var n=e(17),o=e(78);r.exports=function(r){if(o){try{return n.process.getBuiltinModule(r)}catch(r){}try{return Function('return require("'+r+'")')()}catch(r){}}}},function(r,t,e){var n=e(79);r.exports="NODE"===n},function(r,t,e){var n=e(17),o=e(37),a=e(50),c=function(r){return o.slice(0,r.length)===r};r.exports=c("Bun/")?"BUN":c("Cloudflare-Workers")?"CLOUDFLARE":c("Deno/")?"DENO":c("Node.js/")?"NODE":n.Bun&&"string"==typeof Bun.version?"BUN":n.Deno&&"object"==typeof Deno.version?"DENO":"process"===a(n.process)?"NODE":n.window&&n.document?"BROWSER":"REST"},function(r,t,e){var n=e(17),o=e(3),a=e(36),c=e(79),i=n.structuredClone;r.exports=!!i&&!o((function(){if("DENO"===c&&a>92||"NODE"===c&&a>94||"BROWSER"===c&&a>97)return!1;var r=new ArrayBuffer(8),t=i(r,{transfer:[r]});return 0!==r.byteLength||8!==t.byteLength}))},function(t,e,n){var o=n(54),a=n(73);a&&o({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return a(this,arguments.length?arguments[0]:r,!1)}})},function(r,t,e){var n=e(54),o=e(6),a=e(39),c=e(11),i=e(83),u=e(92),s=e(16),f=e(3),p=u.Map,l=u.has,y=u.get,v=u.set,h=o([].push),g=s||f((function(){return 1!==p.groupBy("ab",(function(r){return r})).get("a").length}));n({target:"Map",stat:!0,forced:s||g},{groupBy:function(r,t){c(r),a(t);var e=new p,n=0;return i(r,(function(r){var o=t(r,n++);l(e,o)?h(y(e,o),r):v(e,o,[r])})),e}})},function(r,t,e){var n=e(84),o=e(30),a=e(27),c=e(40),i=e(85),u=e(68),s=e(33),f=e(87),p=e(88),l=e(91),y=TypeError,v=function(r,t){this.stopped=r,this.result=t},h=v.prototype;r.exports=function(r,t,e){var g,b,m,d,w,E,x,O=e&&e.that,R=!(!e||!e.AS_ENTRIES),S=!(!e||!e.IS_RECORD),A=!(!e||!e.IS_ITERATOR),T=!(!e||!e.INTERRUPTED),D=n(t,O),_=function(r){return g&&l(g,"normal",r),new v(!0,r)},I=function(r){return R?(a(r),T?D(r[0],r[1],_):D(r[0],r[1])):T?D(r,_):D(r)};if(S)g=r.iterator;else if(A)g=r;else{if(!(b=p(r)))throw new y(c(r)+" is not iterable");if(i(b)){for(m=0,d=u(r);d>m;m++)if((w=I(r[m]))&&s(h,w))return w;return new v(!1)}g=f(r,b)}for(E=S?r.next:g.next;!(x=o(E,g)).done;){try{w=I(x.value)}catch(r){l(g,"throw",r)}if("object"==typeof w&&w&&s(h,w))return w}return new v(!1)}},function(t,e,n){var o=n(49),a=n(39),c=n(7),i=o(o.bind);t.exports=function(t,e){return a(t),e===r?t:c?i(t,e):function(){return t.apply(e,arguments)}}},function(t,e,n){var o=n(42),a=n(86),c=o("iterator"),i=Array.prototype;t.exports=function(t){return t!==r&&(a.Array===t||i[c]===t)}},function(r,t,e){r.exports={}},function(r,t,e){var n=e(30),o=e(39),a=e(27),c=e(40),i=e(88),u=TypeError;r.exports=function(r,t){var e=arguments.length<2?i(r):t;if(o(e))return a(n(e,r));throw new u(c(r)+" is not iterable")}},function(r,t,e){var n=e(89),o=e(38),a=e(12),c=e(86),i=e(42)("iterator");r.exports=function(r){if(!a(r))return o(r,i)||o(r,"@@iterator")||c[n(r)]}},function(t,e,n){var o=n(90),a=n(8),c=n(50),i=n(42)("toStringTag"),u=Object,s="Arguments"===c(function(){return arguments}());t.exports=o?c:function(t){var e,n,o;return t===r?"Undefined":null===t?"Null":"string"==typeof(n=function(r,t){try{return r[t]}catch(r){}}(e=u(t),i))?n:s?c(e):"Object"===(o=c(e))&&a(e.callee)?"Arguments":o}},function(r,t,e){var n={};n[e(42)("toStringTag")]="z",r.exports="[object z]"===String(n)},function(r,t,e){var n=e(30),o=e(27),a=e(38);r.exports=function(r,t,e){var c,i;o(r);try{if(!(c=a(r,"return"))){if("throw"===t)throw e;return e}c=n(c,r)}catch(r){i=!0,c=r}if("throw"===t)throw e;if(i)throw c;return o(c),e}},function(r,t,e){var n=e(6),o=Map.prototype;r.exports={Map,set:n(o.set),get:n(o.get),has:n(o.has),remove:n(o.delete),proto:o}},function(r,t,e){var n=e(54),o=e(32),a=e(6),c=e(39),i=e(11),u=e(28),s=e(83),f=e(3),p=Object.groupBy,l=o("Object","create"),y=a([].push);n({target:"Object",stat:!0,forced:!p||f((function(){return 1!==p("ab",(function(r){return r})).a.length}))},{groupBy:function(r,t){i(r),c(t);var e=l(null),n=0;return s(r,(function(r){var o=u(t(r,n++));o in e?y(e[o],r):e[o]=[r]})),e}})},function(t,e,n){var o=n(54),a=n(17),c=n(95),i=n(96),u=n(97),s=n(39),f=n(98),p=a.Promise,l=!1;o({target:"Promise",stat:!0,forced:!p||!p.try||f((function(){p.try((function(r){l=8===r}),8)})).error||!l},{try:function(t){var e=arguments.length>1?i(arguments,1):[],n=u.f(this),o=f((function(){return c(s(t),r,e)}));return(o.error?n.reject:n.resolve)(o.value),n.promise}})},function(r,t,e){var n=e(7),o=Function.prototype,a=o.apply,c=o.call;r.exports="object"==typeof Reflect&&Reflect.apply||(n?c.bind(a):function(){return c.apply(a,arguments)})},function(r,t,e){var n=e(6);r.exports=n([].slice)},function(t,e,n){var o=n(39),a=TypeError,c=function(t){var e,n;this.promise=new t((function(t,o){if(e!==r||n!==r)throw new a("Bad Promise constructor");e=t,n=o})),this.resolve=o(e),this.reject=o(n)};t.exports.f=function(r){return new c(r)}},function(r,t,e){r.exports=function(r){try{return{error:!1,value:r()}}catch(r){return{error:!0,value:r}}}},function(r,t,e){var n=e(54),o=e(97);n({target:"Promise",stat:!0},{withResolvers:function(){var r=o.f(this);return{promise:r.promise,resolve:r.resolve,reject:r.reject}}})},function(t,e,n){var o=n(54),a=n(17),c=n(32),i=n(45),u=n(23).f,s=n(9),f=n(101),p=n(102),l=n(106),y=n(108),v=n(109),h=n(2),g=n(16),b="DOMException",m=c("Error"),d=c(b),w=function(){f(this,E);var t=arguments.length,e=l(t<1?r:arguments[0]),n=l(t<2?r:arguments[1],"Error"),o=new d(e,n),a=new m(e);return a.name=b,u(o,"stack",i(1,v(a.stack,1))),p(o,this,w),o},E=w.prototype=d.prototype,x="stack"in new m(b),O="stack"in new d(1,2),R=d&&h&&Object.getOwnPropertyDescriptor(a,b),S=!(!R||R.writable&&R.configurable),A=x&&!S&&!O;o({global:!0,constructor:!0,forced:g||A},{DOMException:A?w:d});var T=c(b),D=T.prototype;if(D.constructor!==T)for(var _ in g||u(D,"constructor",i(1,T)),y)if(s(y,_)){var I=y[_],j=I.s;s(T,j)||u(T,j,i(6,I.c))}},function(r,t,e){var n=e(33),o=TypeError;r.exports=function(r,t){if(n(t,r))return r;throw new o("Incorrect invocation")}},function(r,t,e){var n=e(8),o=e(21),a=e(103);r.exports=function(r,t,e){var c,i;return a&&n(c=t.constructor)&&c!==e&&o(i=c.prototype)&&i!==e.prototype&&a(r,i),r}},function(t,e,n){var o=n(52),a=n(21),c=n(11),i=n(104);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r,t=!1,e={};try{(r=o(Object.prototype,"__proto__","set"))(e,[]),t=e instanceof Array}catch(r){}return function(e,n){return c(e),i(n),a(e)?(t?r(e,n):e.__proto__=n,e):e}}():r)},function(r,t,e){var n=e(105),o=String,a=TypeError;r.exports=function(r){if(n(r))return r;throw new a("Can't set "+o(r)+" as a prototype")}},function(r,t,e){var n=e(21);r.exports=function(r){return n(r)||null===r}},function(t,e,n){var o=n(107);t.exports=function(t,e){return t===r?arguments.length<2?"":e:o(t)}},function(r,t,e){var n=e(89),o=String;r.exports=function(r){if("Symbol"===n(r))throw new TypeError("Cannot convert a Symbol value to a string");return o(r)}},function(r,t,e){r.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},function(r,t,e){var n=e(6),o=Error,a=n("".replace),c=String(new o("zxcasd").stack),i=/\n\s*at [^:]*:[^\n]*/,u=i.test(c);r.exports=function(r,t){if(u&&"string"==typeof r&&!o.prepareStackTrace)for(;t--;)r=a(r,i,"");return r}},function(t,e,n){var o,a=n(16),c=n(54),i=n(17),u=n(32),s=n(6),f=n(3),p=n(44),l=n(8),y=n(111),v=n(12),h=n(21),g=n(31),b=n(83),m=n(27),d=n(89),w=n(9),E=n(112),x=n(22),O=n(68),R=n(113),S=n(114),A=n(92),T=n(116),D=n(117),_=n(76),I=n(119),j=n(80),M=i.Object,k=i.Array,P=i.Date,C=i.Error,L=i.TypeError,B=i.PerformanceMark,N=u("DOMException"),U=A.Map,F=A.has,z=A.get,W=A.set,V=T.Set,H=T.add,G=T.has,Y=u("Object","keys"),Q=s([].push),q=s((!0).valueOf),X=s(1..valueOf),K=s("".valueOf),Z=s(P.prototype.getTime),$=p("structuredClone"),J="DataCloneError",rr="Transferring",tr=function(r){return!f((function(){var t=new i.Set([7]),e=r(t),n=r(M(7));return e===t||!e.has(7)||!h(n)||7!=+n}))&&r},er=function(r,t){return!f((function(){var e=new t,n=r({a:e,b:e});return!(n&&n.a===n.b&&n.a instanceof t&&n.a.stack===e.stack)}))},nr=i.structuredClone,or=a||!er(nr,C)||!er(nr,N)||(o=nr,!!f((function(){var r=o(new i.AggregateError([1],$,{cause:3}));return"AggregateError"!==r.name||1!==r.errors[0]||r.message!==$||3!==r.cause}))),ar=!nr&&tr((function(r){return new B($,{detail:r}).detail})),cr=tr(nr)||ar,ir=function(r){throw new N("Uncloneable type: "+r,J)},ur=function(r,t){throw new N((t||"Cloning")+" of "+r+" cannot be properly polyfilled in this engine",J)},sr=function(r,t){return cr||ur(t),cr(r)},fr=function(t,e,n){if(F(e,t))return z(e,t);var o,a,c,u,s,f;if("SharedArrayBuffer"===(n||d(t)))o=cr?cr(t):t;else{var p=i.DataView;p||l(t.slice)||ur("ArrayBuffer");try{if(l(t.slice)&&!t.resizable)o=t.slice(0);else{a=t.byteLength,c="maxByteLength"in t?{maxByteLength:t.maxByteLength}:r,o=new ArrayBuffer(a,c),u=new p(t),s=new p(o);for(f=0;f<a;f++)s.setUint8(f,u.getUint8(f))}}catch(r){throw new N("ArrayBuffer is detached",J)}}return W(e,t,o),o},pr=function(t,e){if(g(t)&&ir("Symbol"),!h(t))return t;if(e){if(F(e,t))return z(e,t)}else e=new U;var n,o,a,c,s,f,p,y,v=d(t);switch(v){case"Array":a=k(O(t));break;case"Object":a={};break;case"Map":a=new U;break;case"Set":a=new V;break;case"RegExp":a=new RegExp(t.source,S(t));break;case"Error":switch(o=t.name){case"AggregateError":a=new(u(o))([]);break;case"EvalError":case"RangeError":case"ReferenceError":case"SuppressedError":case"SyntaxError":case"TypeError":case"URIError":a=new(u(o));break;case"CompileError":case"LinkError":case"RuntimeError":a=new(u("WebAssembly",o));break;default:a=new C}break;case"DOMException":a=new N(t.message,t.name);break;case"ArrayBuffer":case"SharedArrayBuffer":a=fr(t,e,v);break;case"DataView":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float16Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":f="DataView"===v?t.byteLength:t.length,a=function(r,t,e,n,o){var a=i[t];return h(a)||ur(t),new a(fr(r.buffer,o),e,n)}(t,v,t.byteOffset,f,e);break;case"DOMQuad":try{a=new DOMQuad(pr(t.p1,e),pr(t.p2,e),pr(t.p3,e),pr(t.p4,e))}catch(r){a=sr(t,v)}break;case"File":if(cr)try{a=cr(t),d(a)!==v&&(a=r)}catch(r){}if(!a)try{a=new File([t],t.name,t)}catch(r){}a||ur(v);break;case"FileList":if(c=function(){var r;try{r=new i.DataTransfer}catch(t){try{r=new i.ClipboardEvent("").clipboardData}catch(r){}}return r&&r.items&&r.files?r:null}()){for(s=0,f=O(t);s<f;s++)c.items.add(pr(t[s],e));a=c.files}else a=sr(t,v);break;case"ImageData":try{a=new ImageData(pr(t.data,e),t.width,t.height,{colorSpace:t.colorSpace})}catch(r){a=sr(t,v)}break;default:if(cr)a=cr(t);else switch(v){case"BigInt":a=M(t.valueOf());break;case"Boolean":a=M(q(t));break;case"Number":a=M(X(t));break;case"String":a=M(K(t));break;case"Date":a=new P(Z(t));break;case"Blob":try{a=t.slice(0,t.size,t.type)}catch(r){ur(v)}break;case"DOMPoint":case"DOMPointReadOnly":n=i[v];try{a=n.fromPoint?n.fromPoint(t):new n(t.x,t.y,t.z,t.w)}catch(r){ur(v)}break;case"DOMRect":case"DOMRectReadOnly":n=i[v];try{a=n.fromRect?n.fromRect(t):new n(t.x,t.y,t.width,t.height)}catch(r){ur(v)}break;case"DOMMatrix":case"DOMMatrixReadOnly":n=i[v];try{a=n.fromMatrix?n.fromMatrix(t):new n(t)}catch(r){ur(v)}break;case"AudioData":case"VideoFrame":l(t.clone)||ur(v);try{a=t.clone()}catch(r){ir(v)}break;case"CropTarget":case"CryptoKey":case"FileSystemDirectoryHandle":case"FileSystemFileHandle":case"FileSystemHandle":case"GPUCompilationInfo":case"GPUCompilationMessage":case"ImageBitmap":case"RTCCertificate":case"WebAssembly.Module":ur(v);default:ir(v)}}switch(W(e,t,a),v){case"Array":case"Object":for(p=Y(t),s=0,f=O(p);s<f;s++)y=p[s],E(a,y,pr(t[y],e));break;case"Map":t.forEach((function(r,t){W(a,pr(t,e),pr(r,e))}));break;case"Set":t.forEach((function(r){H(a,pr(r,e))}));break;case"Error":x(a,"message",pr(t.message,e)),w(t,"cause")&&x(a,"cause",pr(t.cause,e)),"AggregateError"===o?a.errors=pr(t.errors,e):"SuppressedError"===o&&(a.error=pr(t.error,e),a.suppressed=pr(t.suppressed,e));case"DOMException":I&&x(a,"stack",pr(t.stack,e))}return a};c({global:!0,enumerable:!0,sham:!j,forced:or},{structuredClone:function(t){var e,n,o=R(arguments.length,1)>1&&!v(arguments[1])?m(arguments[1]):r,a=o?o.transfer:r;a!==r&&(n=function(t,e){if(!h(t))throw new L("Transfer option cannot be converted to a sequence");var n=[];b(t,(function(r){Q(n,m(r))}));for(var o,a,c,u,s,f=0,p=O(n),v=new V;f<p;){if(o=n[f++],"ArrayBuffer"===(a=d(o))?G(v,o):F(e,o))throw new N("Duplicate transferable",J);if("ArrayBuffer"!==a){if(j)u=nr(o,{transfer:[o]});else switch(a){case"ImageBitmap":c=i.OffscreenCanvas,y(c)||ur(a,rr);try{(s=new c(o.width,o.height)).getContext("bitmaprenderer").transferFromImageBitmap(o),u=s.transferToImageBitmap()}catch(r){}break;case"AudioData":case"VideoFrame":l(o.clone)&&l(o.close)||ur(a,rr);try{u=o.clone(),o.close()}catch(r){}break;case"MediaSourceHandle":case"MessagePort":case"MIDIAccess":case"OffscreenCanvas":case"ReadableStream":case"RTCDataChannel":case"TransformStream":case"WebTransportReceiveStream":case"WebTransportSendStream":case"WritableStream":ur(a,rr)}if(u===r)throw new N("This object cannot be transferred: "+a,J);W(e,o,u)}else H(v,o)}return v}(a,e=new U));var c=pr(t,e);return n&&function(r){D(r,(function(r){j?cr(r,{transfer:[r]}):l(r.transfer)?r.transfer():_?_(r):ur("ArrayBuffer",rr)}))}(n),c}})},function(r,t,e){var n=e(6),o=e(3),a=e(8),c=e(89),i=e(32),u=e(14),s=function(){},f=i("Reflect","construct"),p=/^\s*(?:class|function)\b/,l=n(p.exec),y=!p.test(s),v=function(r){if(!a(r))return!1;try{return f(s,[],r),!0}catch(r){return!1}},h=function(r){if(!a(r))return!1;switch(c(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return y||!!l(p,u(r))}catch(r){return!0}};h.sham=!0,r.exports=!f||o((function(){var r;return v(v.call)||!v(Object)||!v((function(){r=!0}))||r}))?h:v},function(r,t,e){var n=e(2),o=e(23),a=e(45);r.exports=function(r,t,e){n?o.f(r,t,a(0,e)):r[t]=e}},function(r,t,e){var n=TypeError;r.exports=function(r,t){if(r<t)throw new n("Not enough arguments");return r}},function(t,e,n){var o=n(30),a=n(9),c=n(33),i=n(115),u=RegExp.prototype;t.exports=function(t){var e=t.flags;return e!==r||"flags"in u||a(t,"flags")||!c(u,t)?e:o(i,t)}},function(r,t,e){var n=e(27);r.exports=function(){var r=n(this),t="";return r.hasIndices&&(t+="d"),r.global&&(t+="g"),r.ignoreCase&&(t+="i"),r.multiline&&(t+="m"),r.dotAll&&(t+="s"),r.unicode&&(t+="u"),r.unicodeSets&&(t+="v"),r.sticky&&(t+="y"),t}},function(r,t,e){var n=e(6),o=Set.prototype;r.exports={Set,add:n(o.add),has:n(o.has),remove:n(o.delete),proto:o}},function(r,t,e){var n=e(6),o=e(118),a=e(116),c=a.Set,i=a.proto,u=n(i.forEach),s=n(i.keys),f=s(new c).next;r.exports=function(r,t,e){return e?o({iterator:s(r),next:f},t):u(r,t)}},function(t,e,n){var o=n(30);t.exports=function(t,e,n){for(var a,c,i=n?t:t.iterator,u=t.next;!(a=o(u,i)).done;)if((c=e(a.value))!==r)return c}},function(r,t,e){var n=e(3),o=e(45);r.exports=!n((function(){var r=new Error("a");return!("stack"in r)||(Object.defineProperty(r,"stack",o(1,7)),7!==r.stack)}))},function(t,e,n){var o=n(54),a=n(32),c=n(3),i=n(113),u=n(107),s=n(121),f=a("URL"),p=s&&c((function(){f.canParse()})),l=c((function(){return 1!==f.canParse.length}));o({target:"URL",stat:!0,forced:!p||l},{canParse:function(t){var e=i(arguments.length,1),n=u(t),o=e<2||arguments[1]===r?r:u(arguments[1]);try{return!!new f(n,o)}catch(r){return!1}}})},function(t,e,n){var o=n(3),a=n(42),c=n(2),i=n(16),u=a("iterator");t.exports=!o((function(){var t=new URL("b?a=1&b=2&c=3","https://a"),e=t.searchParams,n=new URLSearchParams("a=1&a=2&b=3"),o="";return t.pathname="c%20d",e.forEach((function(r,t){e.delete("b"),o+=t+r})),n.delete("a",2),n.delete("b",r),i&&(!t.toJSON||!n.has("a",1)||n.has("a",2)||!n.has("a",r)||n.has("b"))||!e.size&&(i||!c)||!e.sort||"https://a/c%20d?a=1&c=3"!==t.href||"3"!==e.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!e[u]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==o||"x"!==new URL("https://x",r).host}))},function(t,e,n){var o=n(54),a=n(32),c=n(113),i=n(107),u=n(121),s=a("URL");o({target:"URL",stat:!0,forced:!u},{parse:function(t){var e=c(arguments.length,1),n=i(t),o=e<2||arguments[1]===r?r:i(arguments[1]);try{return new s(n,o)}catch(r){return null}}})},function(t,e,n){var o=n(59),a=n(6),c=n(107),i=n(113),u=URLSearchParams,s=u.prototype,f=a(s.append),p=a(s.delete),l=a(s.forEach),y=a([].push),v=new u("a=1&a=2&b=3");v.delete("a",1),v.delete("b",r),v+""!="a=2"&&o(s,"delete",(function(t){var e=arguments.length,n=e<2?r:arguments[1];if(e&&n===r)return p(this,t);var o=[];l(this,(function(r,t){y(o,{key:t,value:r})})),i(e,1);for(var a,u=c(t),s=c(n),v=0,h=0,g=!1,b=o.length;v<b;)a=o[v++],g||a.key===u?(g=!0,p(this,a.key)):h++;for(;h<b;)(a=o[h++]).key===u&&a.value===s||f(this,a.key,a.value)}),{enumerable:!0,unsafe:!0})},function(t,e,n){var o=n(59),a=n(6),c=n(107),i=n(113),u=URLSearchParams,s=u.prototype,f=a(s.getAll),p=a(s.has),l=new u("a=1");!l.has("a",2)&&l.has("a",r)||o(s,"has",(function(t){var e=arguments.length,n=e<2?r:arguments[1];if(e&&n===r)return p(this,t);var o=f(this,t);i(e,1);for(var a=c(n),u=0;u<o.length;)if(o[u++]===a)return!0;return!1}),{enumerable:!0,unsafe:!0})},function(r,t,e){var n=e(2),o=e(6),a=e(4),c=URLSearchParams.prototype,i=o(c.forEach);n&&!("size"in c)&&a(c,"size",{get:function(){var r=0;return i(this,(function(){r++})),r},configurable:!0,enumerable:!0})}],e={},(n=function(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}).m=t,n.c=e,n.d=function(r,t,e){n.o(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:e})},n.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,t){if(1&t&&(r=n(r)),8&t)return r;if(4&t&&"object"==typeof r&&r&&r.__esModule)return r;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:r}),2&t&&"string"!=typeof r)for(var o in r)n.d(e,o,function(t){return r[t]}.bind(null,o));return e},n.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(t,"a",t),t},n.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},n.p="",n(n.s=0)}(); vendor/wp-polyfill-fetch.min.js 0000644 00000023430 15151622574 0012540 0 ustar 00 ((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.WHATWGFetch={})})(this,(function(t){var e,r,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||"undefined"!=typeof global&&global||{},n="URLSearchParams"in o,s="Symbol"in o&&"iterator"in Symbol,i="FileReader"in o&&"Blob"in o&&(()=>{try{return new Blob,!0}catch(t){return!1}})(),a="FormData"in o,h="ArrayBuffer"in o;function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function f(t){return"string"!=typeof t?String(t):t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return s&&(e[Symbol.iterator]=function(){return e}),e}function c(t){this.map={},t instanceof c?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function y(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function l(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function p(t){var e=new FileReader,r=l(e);return e.readAsArrayBuffer(t),r}function b(t){var e;return t.slice?t.slice(0):((e=new Uint8Array(t.byteLength)).set(new Uint8Array(t)),e.buffer)}function m(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,(this._bodyInit=t)?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:a&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():h&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=b(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):h&&(ArrayBuffer.prototype.isPrototypeOf(t)||r(t))?this._bodyArrayBuffer=b(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=y(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer)return y(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer));if(i)return this.blob().then(p);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,e,r,o=y(this);if(o)return o;if(this._bodyBlob)return o=this._bodyBlob,e=l(t=new FileReader),r=(r=/charset=([A-Za-z0-9_-]+)/.exec(o.type))?r[1]:"utf-8",t.readAsText(o,r),e;if(this._bodyArrayBuffer)return Promise.resolve((t=>{for(var e=new Uint8Array(t),r=new Array(e.length),o=0;o<e.length;o++)r[o]=String.fromCharCode(e[o]);return r.join("")})(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(A)}),this.json=function(){return this.text().then(JSON.parse)},this}h&&(e=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],r=ArrayBuffer.isView||function(t){return t&&-1<e.indexOf(Object.prototype.toString.call(t))}),c.prototype.append=function(t,e){t=u(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},c.prototype.delete=function(t){delete this.map[u(t)]},c.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},c.prototype.set=function(t,e){this.map[u(t)]=f(e)},c.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},c.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),d(t)},c.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},c.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),d(t)},s&&(c.prototype[Symbol.iterator]=c.prototype.entries);var w=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function E(t,e){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,n=(e=e||{}).body;if(t instanceof E){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new c(e.headers)),this.method=(r=(t=e.method||this.method||"GET").toUpperCase(),-1<w.indexOf(r)?r:t),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||(()=>{if("AbortController"in o)return(new AbortController).signal})(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n),"GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache||((r=/([?&])_=[^&]*/).test(this.url)?this.url=this.url.replace(r,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime())}function A(t){var e=new FormData;return t.trim().split("&").forEach((function(t){var r;t&&(r=(t=t.split("=")).shift().replace(/\+/g," "),t=t.join("=").replace(/\+/g," "),e.append(decodeURIComponent(r),decodeURIComponent(t)))})),e}function g(t,e){if(!(this instanceof g))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e=e||{},this.type="default",this.status=void 0===e.status?200:e.status,this.status<200||599<this.status)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=200<=this.status&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new c(e.headers),this.url=e.url||"",this._initBody(t)}E.prototype.clone=function(){return new E(this,{body:this._bodyInit})},m.call(E.prototype),m.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var T=[301,302,303,307,308];g.redirect=function(t,e){if(-1===T.indexOf(e))throw new RangeError("Invalid status code");return new g(null,{status:e,headers:{location:t}})},t.DOMException=o.DOMException;try{new t.DOMException}catch(d){t.DOMException=function(t,e){this.message=t,this.name=e,e=Error(t),this.stack=e.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function _(e,r){return new Promise((function(n,s){var a=new E(e,r);if(a.signal&&a.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var d,y=new XMLHttpRequest;function l(){y.abort()}y.onload=function(){var t,e,r={statusText:y.statusText,headers:(t=y.getAllResponseHeaders()||"",e=new c,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var r=(t=t.split(":")).shift().trim();if(r){t=t.join(":").trim();try{e.append(r,t)}catch(t){console.warn("Response "+t.message)}}})),e)},o=(0===a.url.indexOf("file://")&&(y.status<200||599<y.status)?r.status=200:r.status=y.status,r.url="responseURL"in y?y.responseURL:r.headers.get("X-Request-URL"),"response"in y?y.response:y.responseText);setTimeout((function(){n(new g(o,r))}),0)},y.onerror=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},y.ontimeout=function(){setTimeout((function(){s(new TypeError("Network request timed out"))}),0)},y.onabort=function(){setTimeout((function(){s(new t.DOMException("Aborted","AbortError"))}),0)},y.open(a.method,(t=>{try{return""===t&&o.location.href?o.location.href:t}catch(e){return t}})(a.url),!0),"include"===a.credentials?y.withCredentials=!0:"omit"===a.credentials&&(y.withCredentials=!1),"responseType"in y&&(i?y.responseType="blob":h&&(y.responseType="arraybuffer")),r&&"object"==typeof r.headers&&!(r.headers instanceof c||o.Headers&&r.headers instanceof o.Headers)?(d=[],Object.getOwnPropertyNames(r.headers).forEach((function(t){d.push(u(t)),y.setRequestHeader(t,f(r.headers[t]))})),a.headers.forEach((function(t,e){-1===d.indexOf(e)&&y.setRequestHeader(e,t)}))):a.headers.forEach((function(t,e){y.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",l),y.onreadystatechange=function(){4===y.readyState&&a.signal.removeEventListener("abort",l)}),y.send(void 0===a._bodyInit?null:a._bodyInit)}))}_.polyfill=!0,o.fetch||(o.fetch=_,o.Headers=c,o.Request=E,o.Response=g),t.Headers=c,t.Request=E,t.Response=g,t.fetch=_,Object.defineProperty(t,"__esModule",{value:!0})})); vendor/regenerator-runtime.min.js 0000644 00000014706 15151622574 0013177 0 ustar 00 var runtime=(t=>{var e,r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function h(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(r){h=function(t,e,r){return t[e]=r}}function l(t,r,n,i){var a,c,u,h;r=r&&r.prototype instanceof d?r:d,r=Object.create(r.prototype),i=new O(i||[]);return o(r,"_invoke",{value:(a=t,c=n,u=i,h=s,function(t,r){if(h===y)throw new Error("Generator is already running");if(h===g){if("throw"===t)throw r;return{value:e,done:!0}}for(u.method=t,u.arg=r;;){var n=u.delegate;if(n&&(n=function t(r,n){var o=n.method,i=r.iterator[o];return i===e?(n.delegate=null,"throw"===o&&r.iterator.return&&(n.method="return",n.arg=e,t(r,n),"throw"===n.method)||"return"!==o&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+o+"' method")),v):"throw"===(o=f(i,r.iterator,n.arg)).type?(n.method="throw",n.arg=o.arg,n.delegate=null,v):(i=o.arg)?i.done?(n[r.resultName]=i.value,n.next=r.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}(n,u),n)){if(n===v)continue;return n}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if(h===s)throw h=g,u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);if(h=y,"normal"===(n=f(a,c,u)).type){if(h=u.done?g:p,n.arg!==v)return{value:n.arg,done:u.done}}else"throw"===n.type&&(h=g,u.method="throw",u.arg=n.arg)}})}),r}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var s="suspendedStart",p="suspendedYield",y="executing",g="completed",v={};function d(){}function m(){}function w(){}h(i={},a,(function(){return this}));var b=Object.getPrototypeOf,L=((b=b&&b(b(k([]))))&&b!==r&&n.call(b,a)&&(i=b),w.prototype=d.prototype=Object.create(i));function x(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){var r;o(this,"_invoke",{value:function(o,i){function a(){return new e((function(r,a){!function r(o,i,a,c){var u;if("throw"!==(o=f(t[o],t,i)).type)return(i=(u=o.arg).value)&&"object"==typeof i&&n.call(i,"__await")?e.resolve(i.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(i).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}));c(o.arg)}(o,i,r,a)}))}return r=r?r.then(a,a):a()}})}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function k(t){if(null!=t){var r,o=t[a];if(o)return o.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return r=-1,(o=function o(){for(;++r<t.length;)if(n.call(t,r))return o.value=t[r],o.done=!1,o;return o.value=e,o.done=!0,o}).next=o}throw new TypeError(typeof t+" is not iterable")}return o(L,"constructor",{value:m.prototype=w,configurable:!0}),o(w,"constructor",{value:m,configurable:!0}),m.displayName=h(w,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){return!!(t="function"==typeof t&&t.constructor)&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,h(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},t.awrap=function(t){return{__await:t}},x(E.prototype),h(E.prototype,c,(function(){return this})),t.AsyncIterator=E,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new E(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(L),h(L,u,"Generator"),h(L,a,(function(){return this})),h(L,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},t.values=k,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(_),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}var a=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,_(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:k(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t})("object"==typeof module?module.exports:{});try{regeneratorRuntime=runtime}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=runtime:Function("r","regeneratorRuntime = r")(runtime)} vendor/react-jsx-runtime.min.js.LICENSE.txt 0000644 00000000371 15151622574 0014452 0 ustar 00 /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ vendor/wp-polyfill.js 0000644 00000324200 15151622574 0010666 0 ustar 00 /** * core-js 3.39.0 * © 2014-2024 Denis Pushkarev (zloirock.ru) * license: https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE * source: https://github.com/zloirock/core-js */ !function (undefined) { 'use strict'; /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ var __webpack_require__ = function (moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(1); __webpack_require__(53); __webpack_require__(81); __webpack_require__(82); __webpack_require__(93); __webpack_require__(94); __webpack_require__(99); __webpack_require__(100); __webpack_require__(110); __webpack_require__(120); __webpack_require__(122); __webpack_require__(123); __webpack_require__(124); module.exports = __webpack_require__(125); /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(2); var defineBuiltInAccessor = __webpack_require__(4); var isDetached = __webpack_require__(48); var ArrayBufferPrototype = ArrayBuffer.prototype; // `ArrayBuffer.prototype.detached` getter // https://tc39.es/ecma262/#sec-get-arraybuffer.prototype.detached if (DESCRIPTORS && !('detached' in ArrayBufferPrototype)) { defineBuiltInAccessor(ArrayBufferPrototype, 'detached', { configurable: true, get: function detached() { return isDetached(this); } }); } /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(3); // Detect IE8's incomplete defineProperty implementation module.exports = !fails(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7; }); /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function (exec) { try { return !!exec(); } catch (error) { return true; } }; /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var makeBuiltIn = __webpack_require__(5); var defineProperty = __webpack_require__(23); module.exports = function (target, name, descriptor) { if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true }); if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true }); return defineProperty.f(target, name, descriptor); }; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); var fails = __webpack_require__(3); var isCallable = __webpack_require__(8); var hasOwn = __webpack_require__(9); var DESCRIPTORS = __webpack_require__(2); var CONFIGURABLE_FUNCTION_NAME = __webpack_require__(13).CONFIGURABLE; var inspectSource = __webpack_require__(14); var InternalStateModule = __webpack_require__(19); var enforceInternalState = InternalStateModule.enforce; var getInternalState = InternalStateModule.get; var $String = String; // eslint-disable-next-line es/no-object-defineproperty -- safe var defineProperty = Object.defineProperty; var stringSlice = uncurryThis(''.slice); var replace = uncurryThis(''.replace); var join = uncurryThis([].join); var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () { return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8; }); var TEMPLATE = String(String).split('String'); var makeBuiltIn = module.exports = function (value, name, options) { if (stringSlice($String(name), 0, 7) === 'Symbol(') { name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']'; } if (options && options.getter) name = 'get ' + name; if (options && options.setter) name = 'set ' + name; if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) { if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true }); else value.name = name; } if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) { defineProperty(value, 'length', { value: options.arity }); } try { if (options && hasOwn(options, 'constructor') && options.constructor) { if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false }); // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable } else if (value.prototype) value.prototype = undefined; } catch (error) { /* empty */ } var state = enforceInternalState(value); if (!hasOwn(state, 'source')) { state.source = join(TEMPLATE, typeof name == 'string' ? name : ''); } return value; }; // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative // eslint-disable-next-line no-extend-native -- required Function.prototype.toString = makeBuiltIn(function toString() { return isCallable(this) && getInternalState(this).source || inspectSource(this); }, 'toString'); /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var NATIVE_BIND = __webpack_require__(7); var FunctionPrototype = Function.prototype; var call = FunctionPrototype.call; var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call); module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) { return function () { return call.apply(fn, arguments); }; }; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(3); module.exports = !fails(function () { // eslint-disable-next-line es/no-function-prototype-bind -- safe var test = (function () { /* empty */ }).bind(); // eslint-disable-next-line no-prototype-builtins -- safe return typeof test != 'function' || test.hasOwnProperty('prototype'); }); /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot var documentAll = typeof document == 'object' && document.all; // `IsCallable` abstract operation // https://tc39.es/ecma262/#sec-iscallable // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing module.exports = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) { return typeof argument == 'function' || argument === documentAll; } : function (argument) { return typeof argument == 'function'; }; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); var toObject = __webpack_require__(10); var hasOwnProperty = uncurryThis({}.hasOwnProperty); // `HasOwnProperty` abstract operation // https://tc39.es/ecma262/#sec-hasownproperty // eslint-disable-next-line es/no-object-hasown -- safe module.exports = Object.hasOwn || function hasOwn(it, key) { return hasOwnProperty(toObject(it), key); }; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var requireObjectCoercible = __webpack_require__(11); var $Object = Object; // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject module.exports = function (argument) { return $Object(requireObjectCoercible(argument)); }; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isNullOrUndefined = __webpack_require__(12); var $TypeError = TypeError; // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible module.exports = function (it) { if (isNullOrUndefined(it)) throw new $TypeError("Can't call method on " + it); return it; }; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // we can't use just `it == null` since of `document.all` special case // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec module.exports = function (it) { return it === null || it === undefined; }; /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(2); var hasOwn = __webpack_require__(9); var FunctionPrototype = Function.prototype; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor; var EXISTS = hasOwn(FunctionPrototype, 'name'); // additional protection from minified / mangled / dropped function names var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something'; var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable)); module.exports = { EXISTS: EXISTS, PROPER: PROPER, CONFIGURABLE: CONFIGURABLE }; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); var isCallable = __webpack_require__(8); var store = __webpack_require__(15); var functionToString = uncurryThis(Function.toString); // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper if (!isCallable(store.inspectSource)) { store.inspectSource = function (it) { return functionToString(it); }; } module.exports = store.inspectSource; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var IS_PURE = __webpack_require__(16); var globalThis = __webpack_require__(17); var defineGlobalProperty = __webpack_require__(18); var SHARED = '__core-js_shared__'; var store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {}); (store.versions || (store.versions = [])).push({ version: '3.39.0', mode: IS_PURE ? 'pure' : 'global', copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)', license: 'https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE', source: 'https://github.com/zloirock/core-js' }); /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = false; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var check = function (it) { return it && it.Math === Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 module.exports = // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || check(typeof this == 'object' && this) || // eslint-disable-next-line no-new-func -- fallback (function () { return this; })() || Function('return this')(); /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(17); // eslint-disable-next-line es/no-object-defineproperty -- safe var defineProperty = Object.defineProperty; module.exports = function (key, value) { try { defineProperty(globalThis, key, { value: value, configurable: true, writable: true }); } catch (error) { globalThis[key] = value; } return value; }; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var NATIVE_WEAK_MAP = __webpack_require__(20); var globalThis = __webpack_require__(17); var isObject = __webpack_require__(21); var createNonEnumerableProperty = __webpack_require__(22); var hasOwn = __webpack_require__(9); var shared = __webpack_require__(15); var sharedKey = __webpack_require__(46); var hiddenKeys = __webpack_require__(47); var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; var TypeError = globalThis.TypeError; var WeakMap = globalThis.WeakMap; var set, get, has; var enforce = function (it) { return has(it) ? get(it) : set(it, {}); }; var getterFor = function (TYPE) { return function (it) { var state; if (!isObject(it) || (state = get(it)).type !== TYPE) { throw new TypeError('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; if (NATIVE_WEAK_MAP || shared.state) { var store = shared.state || (shared.state = new WeakMap()); /* eslint-disable no-self-assign -- prototype methods protection */ store.get = store.get; store.has = store.has; store.set = store.set; /* eslint-enable no-self-assign -- prototype methods protection */ set = function (it, metadata) { if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; store.set(it, metadata); return metadata; }; get = function (it) { return store.get(it) || {}; }; has = function (it) { return store.has(it); }; } else { var STATE = sharedKey('state'); hiddenKeys[STATE] = true; set = function (it, metadata) { if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; createNonEnumerableProperty(it, STATE, metadata); return metadata; }; get = function (it) { return hasOwn(it, STATE) ? it[STATE] : {}; }; has = function (it) { return hasOwn(it, STATE); }; } module.exports = { set: set, get: get, has: has, enforce: enforce, getterFor: getterFor }; /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(17); var isCallable = __webpack_require__(8); var WeakMap = globalThis.WeakMap; module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap)); /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isCallable = __webpack_require__(8); module.exports = function (it) { return typeof it == 'object' ? it !== null : isCallable(it); }; /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(2); var definePropertyModule = __webpack_require__(23); var createPropertyDescriptor = __webpack_require__(45); module.exports = DESCRIPTORS ? function (object, key, value) { return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); } : function (object, key, value) { object[key] = value; return object; }; /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(2); var IE8_DOM_DEFINE = __webpack_require__(24); var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(26); var anObject = __webpack_require__(27); var toPropertyKey = __webpack_require__(28); var $TypeError = TypeError; // eslint-disable-next-line es/no-object-defineproperty -- safe var $defineProperty = Object.defineProperty; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var ENUMERABLE = 'enumerable'; var CONFIGURABLE = 'configurable'; var WRITABLE = 'writable'; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) { anObject(O); P = toPropertyKey(P); anObject(Attributes); if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { var current = $getOwnPropertyDescriptor(O, P); if (current && current[WRITABLE]) { O[P] = Attributes.value; Attributes = { configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE], enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], writable: false }; } } return $defineProperty(O, P, Attributes); } : $defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPropertyKey(P); anObject(Attributes); if (IE8_DOM_DEFINE) try { return $defineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(2); var fails = __webpack_require__(3); var createElement = __webpack_require__(25); // Thanks to IE8 for its funny defineProperty module.exports = !DESCRIPTORS && !fails(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty(createElement('div'), 'a', { get: function () { return 7; } }).a !== 7; }); /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(17); var isObject = __webpack_require__(21); var document = globalThis.document; // typeof document.createElement is 'object' in old IE var EXISTS = isObject(document) && isObject(document.createElement); module.exports = function (it) { return EXISTS ? document.createElement(it) : {}; }; /***/ }), /* 26 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(2); var fails = __webpack_require__(3); // V8 ~ Chrome 36- // https://bugs.chromium.org/p/v8/issues/detail?id=3334 module.exports = DESCRIPTORS && fails(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty(function () { /* empty */ }, 'prototype', { value: 42, writable: false }).prototype !== 42; }); /***/ }), /* 27 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isObject = __webpack_require__(21); var $String = String; var $TypeError = TypeError; // `Assert: Type(argument) is Object` module.exports = function (argument) { if (isObject(argument)) return argument; throw new $TypeError($String(argument) + ' is not an object'); }; /***/ }), /* 28 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toPrimitive = __webpack_require__(29); var isSymbol = __webpack_require__(31); // `ToPropertyKey` abstract operation // https://tc39.es/ecma262/#sec-topropertykey module.exports = function (argument) { var key = toPrimitive(argument, 'string'); return isSymbol(key) ? key : key + ''; }; /***/ }), /* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(30); var isObject = __webpack_require__(21); var isSymbol = __webpack_require__(31); var getMethod = __webpack_require__(38); var ordinaryToPrimitive = __webpack_require__(41); var wellKnownSymbol = __webpack_require__(42); var $TypeError = TypeError; var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); // `ToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-toprimitive module.exports = function (input, pref) { if (!isObject(input) || isSymbol(input)) return input; var exoticToPrim = getMethod(input, TO_PRIMITIVE); var result; if (exoticToPrim) { if (pref === undefined) pref = 'default'; result = call(exoticToPrim, input, pref); if (!isObject(result) || isSymbol(result)) return result; throw new $TypeError("Can't convert object to primitive value"); } if (pref === undefined) pref = 'number'; return ordinaryToPrimitive(input, pref); }; /***/ }), /* 30 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var NATIVE_BIND = __webpack_require__(7); var call = Function.prototype.call; module.exports = NATIVE_BIND ? call.bind(call) : function () { return call.apply(call, arguments); }; /***/ }), /* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(32); var isCallable = __webpack_require__(8); var isPrototypeOf = __webpack_require__(33); var USE_SYMBOL_AS_UID = __webpack_require__(34); var $Object = Object; module.exports = USE_SYMBOL_AS_UID ? function (it) { return typeof it == 'symbol'; } : function (it) { var $Symbol = getBuiltIn('Symbol'); return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it)); }; /***/ }), /* 32 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(17); var isCallable = __webpack_require__(8); var aFunction = function (argument) { return isCallable(argument) ? argument : undefined; }; module.exports = function (namespace, method) { return arguments.length < 2 ? aFunction(globalThis[namespace]) : globalThis[namespace] && globalThis[namespace][method]; }; /***/ }), /* 33 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); module.exports = uncurryThis({}.isPrototypeOf); /***/ }), /* 34 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable es/no-symbol -- required for testing */ var NATIVE_SYMBOL = __webpack_require__(35); module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol'; /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable es/no-symbol -- required for testing */ var V8_VERSION = __webpack_require__(36); var fails = __webpack_require__(3); var globalThis = __webpack_require__(17); var $String = globalThis.String; // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing module.exports = !!Object.getOwnPropertySymbols && !fails(function () { var symbol = Symbol('symbol detection'); // Chrome 38 Symbol has incorrect toString conversion // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will, // of course, fail. return !$String(symbol) || !(Object(symbol) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances !Symbol.sham && V8_VERSION && V8_VERSION < 41; }); /***/ }), /* 36 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(17); var userAgent = __webpack_require__(37); var process = globalThis.process; var Deno = globalThis.Deno; var versions = process && process.versions || Deno && Deno.version; var v8 = versions && versions.v8; var match, version; if (v8) { match = v8.split('.'); // in old Chrome, versions of V8 isn't V8 = Chrome / 10 // but their correct versions are not interesting for us version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); } // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` // so check `userAgent` even if `.v8` exists, but 0 if (!version && userAgent) { match = userAgent.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { match = userAgent.match(/Chrome\/(\d+)/); if (match) version = +match[1]; } } module.exports = version; /***/ }), /* 37 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(17); var navigator = globalThis.navigator; var userAgent = navigator && navigator.userAgent; module.exports = userAgent ? String(userAgent) : ''; /***/ }), /* 38 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aCallable = __webpack_require__(39); var isNullOrUndefined = __webpack_require__(12); // `GetMethod` abstract operation // https://tc39.es/ecma262/#sec-getmethod module.exports = function (V, P) { var func = V[P]; return isNullOrUndefined(func) ? undefined : aCallable(func); }; /***/ }), /* 39 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isCallable = __webpack_require__(8); var tryToString = __webpack_require__(40); var $TypeError = TypeError; // `Assert: IsCallable(argument) is true` module.exports = function (argument) { if (isCallable(argument)) return argument; throw new $TypeError(tryToString(argument) + ' is not a function'); }; /***/ }), /* 40 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $String = String; module.exports = function (argument) { try { return $String(argument); } catch (error) { return 'Object'; } }; /***/ }), /* 41 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(30); var isCallable = __webpack_require__(8); var isObject = __webpack_require__(21); var $TypeError = TypeError; // `OrdinaryToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-ordinarytoprimitive module.exports = function (input, pref) { var fn, val; if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val; if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; throw new $TypeError("Can't convert object to primitive value"); }; /***/ }), /* 42 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(17); var shared = __webpack_require__(43); var hasOwn = __webpack_require__(9); var uid = __webpack_require__(44); var NATIVE_SYMBOL = __webpack_require__(35); var USE_SYMBOL_AS_UID = __webpack_require__(34); var Symbol = globalThis.Symbol; var WellKnownSymbolsStore = shared('wks'); var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid; module.exports = function (name) { if (!hasOwn(WellKnownSymbolsStore, name)) { WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name) ? Symbol[name] : createWellKnownSymbol('Symbol.' + name); } return WellKnownSymbolsStore[name]; }; /***/ }), /* 43 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var store = __webpack_require__(15); module.exports = function (key, value) { return store[key] || (store[key] = value || {}); }; /***/ }), /* 44 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); var id = 0; var postfix = Math.random(); var toString = uncurryThis(1.0.toString); module.exports = function (key) { return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36); }; /***/ }), /* 45 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; /***/ }), /* 46 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var shared = __webpack_require__(43); var uid = __webpack_require__(44); var keys = shared('keys'); module.exports = function (key) { return keys[key] || (keys[key] = uid(key)); }; /***/ }), /* 47 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = {}; /***/ }), /* 48 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(17); var uncurryThis = __webpack_require__(49); var arrayBufferByteLength = __webpack_require__(51); var ArrayBuffer = globalThis.ArrayBuffer; var ArrayBufferPrototype = ArrayBuffer && ArrayBuffer.prototype; var slice = ArrayBufferPrototype && uncurryThis(ArrayBufferPrototype.slice); module.exports = function (O) { if (arrayBufferByteLength(O) !== 0) return false; if (!slice) return false; try { slice(O, 0, 0); return false; } catch (error) { return true; } }; /***/ }), /* 49 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var classofRaw = __webpack_require__(50); var uncurryThis = __webpack_require__(6); module.exports = function (fn) { // Nashorn bug: // https://github.com/zloirock/core-js/issues/1128 // https://github.com/zloirock/core-js/issues/1130 if (classofRaw(fn) === 'Function') return uncurryThis(fn); }; /***/ }), /* 50 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); var toString = uncurryThis({}.toString); var stringSlice = uncurryThis(''.slice); module.exports = function (it) { return stringSlice(toString(it), 8, -1); }; /***/ }), /* 51 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(17); var uncurryThisAccessor = __webpack_require__(52); var classof = __webpack_require__(50); var ArrayBuffer = globalThis.ArrayBuffer; var TypeError = globalThis.TypeError; // Includes // - Perform ? RequireInternalSlot(O, [[ArrayBufferData]]). // - If IsSharedArrayBuffer(O) is true, throw a TypeError exception. module.exports = ArrayBuffer && uncurryThisAccessor(ArrayBuffer.prototype, 'byteLength', 'get') || function (O) { if (classof(O) !== 'ArrayBuffer') throw new TypeError('ArrayBuffer expected'); return O.byteLength; }; /***/ }), /* 52 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); var aCallable = __webpack_require__(39); module.exports = function (object, key, method) { try { // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method])); } catch (error) { /* empty */ } }; /***/ }), /* 53 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(54); var $transfer = __webpack_require__(73); // `ArrayBuffer.prototype.transfer` method // https://tc39.es/proposal-arraybuffer-transfer/#sec-arraybuffer.prototype.transfer if ($transfer) $({ target: 'ArrayBuffer', proto: true }, { transfer: function transfer() { return $transfer(this, arguments.length ? arguments[0] : undefined, true); } }); /***/ }), /* 54 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(17); var getOwnPropertyDescriptor = __webpack_require__(55).f; var createNonEnumerableProperty = __webpack_require__(22); var defineBuiltIn = __webpack_require__(59); var defineGlobalProperty = __webpack_require__(18); var copyConstructorProperties = __webpack_require__(60); var isForced = __webpack_require__(72); /* options.target - name of the target object options.global - target is the global object options.stat - export as static methods of target options.proto - export as prototype methods of target options.real - real prototype method for the `pure` version options.forced - export even if the native feature is available options.bind - bind methods to the target, required for the `pure` version options.wrap - wrap constructors to preventing global pollution, required for the `pure` version options.unsafe - use the simple assignment of property instead of delete + defineProperty options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.dontCallGetSet - prevent calling a getter on target options.name - the .name of the function if it does not match the key */ module.exports = function (options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var FORCED, target, key, targetProperty, sourceProperty, descriptor; if (GLOBAL) { target = globalThis; } else if (STATIC) { target = globalThis[TARGET] || defineGlobalProperty(TARGET, {}); } else { target = globalThis[TARGET] && globalThis[TARGET].prototype; } if (target) for (key in source) { sourceProperty = source[key]; if (options.dontCallGetSet) { descriptor = getOwnPropertyDescriptor(target, key); targetProperty = descriptor && descriptor.value; } else targetProperty = target[key]; FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contained in target if (!FORCED && targetProperty !== undefined) { if (typeof sourceProperty == typeof targetProperty) continue; copyConstructorProperties(sourceProperty, targetProperty); } // add a flag to not completely full polyfills if (options.sham || (targetProperty && targetProperty.sham)) { createNonEnumerableProperty(sourceProperty, 'sham', true); } defineBuiltIn(target, key, sourceProperty, options); } }; /***/ }), /* 55 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(2); var call = __webpack_require__(30); var propertyIsEnumerableModule = __webpack_require__(56); var createPropertyDescriptor = __webpack_require__(45); var toIndexedObject = __webpack_require__(57); var toPropertyKey = __webpack_require__(28); var hasOwn = __webpack_require__(9); var IE8_DOM_DEFINE = __webpack_require__(24); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPropertyKey(P); if (IE8_DOM_DEFINE) try { return $getOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]); }; /***/ }), /* 56 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $propertyIsEnumerable = {}.propertyIsEnumerable; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor(this, V); return !!descriptor && descriptor.enumerable; } : $propertyIsEnumerable; /***/ }), /* 57 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // toObject with fallback for non-array-like ES3 strings var IndexedObject = __webpack_require__(58); var requireObjectCoercible = __webpack_require__(11); module.exports = function (it) { return IndexedObject(requireObjectCoercible(it)); }; /***/ }), /* 58 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); var fails = __webpack_require__(3); var classof = __webpack_require__(50); var $Object = Object; var split = uncurryThis(''.split); // fallback for non-array-like ES3 and non-enumerable old V8 strings module.exports = fails(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe return !$Object('z').propertyIsEnumerable(0); }) ? function (it) { return classof(it) === 'String' ? split(it, '') : $Object(it); } : $Object; /***/ }), /* 59 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isCallable = __webpack_require__(8); var definePropertyModule = __webpack_require__(23); var makeBuiltIn = __webpack_require__(5); var defineGlobalProperty = __webpack_require__(18); module.exports = function (O, key, value, options) { if (!options) options = {}; var simple = options.enumerable; var name = options.name !== undefined ? options.name : key; if (isCallable(value)) makeBuiltIn(value, name, options); if (options.global) { if (simple) O[key] = value; else defineGlobalProperty(key, value); } else { try { if (!options.unsafe) delete O[key]; else if (O[key]) simple = true; } catch (error) { /* empty */ } if (simple) O[key] = value; else definePropertyModule.f(O, key, { value: value, enumerable: false, configurable: !options.nonConfigurable, writable: !options.nonWritable }); } return O; }; /***/ }), /* 60 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var hasOwn = __webpack_require__(9); var ownKeys = __webpack_require__(61); var getOwnPropertyDescriptorModule = __webpack_require__(55); var definePropertyModule = __webpack_require__(23); module.exports = function (target, source, exceptions) { var keys = ownKeys(source); var defineProperty = definePropertyModule.f; var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) { defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } } }; /***/ }), /* 61 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(32); var uncurryThis = __webpack_require__(6); var getOwnPropertyNamesModule = __webpack_require__(62); var getOwnPropertySymbolsModule = __webpack_require__(71); var anObject = __webpack_require__(27); var concat = uncurryThis([].concat); // all object keys, includes non-enumerable and symbols module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { var keys = getOwnPropertyNamesModule.f(anObject(it)); var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys; }; /***/ }), /* 62 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var internalObjectKeys = __webpack_require__(63); var enumBugKeys = __webpack_require__(70); var hiddenKeys = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames // eslint-disable-next-line es/no-object-getownpropertynames -- safe exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return internalObjectKeys(O, hiddenKeys); }; /***/ }), /* 63 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); var hasOwn = __webpack_require__(9); var toIndexedObject = __webpack_require__(57); var indexOf = __webpack_require__(64).indexOf; var hiddenKeys = __webpack_require__(47); var push = uncurryThis([].push); module.exports = function (object, names) { var O = toIndexedObject(object); var i = 0; var result = []; var key; for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key); // Don't enum bug & hidden keys while (names.length > i) if (hasOwn(O, key = names[i++])) { ~indexOf(result, key) || push(result, key); } return result; }; /***/ }), /* 64 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toIndexedObject = __webpack_require__(57); var toAbsoluteIndex = __webpack_require__(65); var lengthOfArrayLike = __webpack_require__(68); // `Array.prototype.{ indexOf, includes }` methods implementation var createMethod = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIndexedObject($this); var length = lengthOfArrayLike(O); if (length === 0) return !IS_INCLUDES && -1; var index = toAbsoluteIndex(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare -- NaN check if (IS_INCLUDES && el !== el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare -- NaN check if (value !== value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) { if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; module.exports = { // `Array.prototype.includes` method // https://tc39.es/ecma262/#sec-array.prototype.includes includes: createMethod(true), // `Array.prototype.indexOf` method // https://tc39.es/ecma262/#sec-array.prototype.indexof indexOf: createMethod(false) }; /***/ }), /* 65 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toIntegerOrInfinity = __webpack_require__(66); var max = Math.max; var min = Math.min; // Helper for a popular repeating case of the spec: // Let integer be ? ToInteger(index). // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). module.exports = function (index, length) { var integer = toIntegerOrInfinity(index); return integer < 0 ? max(integer + length, 0) : min(integer, length); }; /***/ }), /* 66 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var trunc = __webpack_require__(67); // `ToIntegerOrInfinity` abstract operation // https://tc39.es/ecma262/#sec-tointegerorinfinity module.exports = function (argument) { var number = +argument; // eslint-disable-next-line no-self-compare -- NaN check return number !== number || number === 0 ? 0 : trunc(number); }; /***/ }), /* 67 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var ceil = Math.ceil; var floor = Math.floor; // `Math.trunc` method // https://tc39.es/ecma262/#sec-math.trunc // eslint-disable-next-line es/no-math-trunc -- safe module.exports = Math.trunc || function trunc(x) { var n = +x; return (n > 0 ? floor : ceil)(n); }; /***/ }), /* 68 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toLength = __webpack_require__(69); // `LengthOfArrayLike` abstract operation // https://tc39.es/ecma262/#sec-lengthofarraylike module.exports = function (obj) { return toLength(obj.length); }; /***/ }), /* 69 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toIntegerOrInfinity = __webpack_require__(66); var min = Math.min; // `ToLength` abstract operation // https://tc39.es/ecma262/#sec-tolength module.exports = function (argument) { var len = toIntegerOrInfinity(argument); return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; /***/ }), /* 70 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // IE8- don't enum bug keys module.exports = [ 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf' ]; /***/ }), /* 71 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe exports.f = Object.getOwnPropertySymbols; /***/ }), /* 72 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(3); var isCallable = __webpack_require__(8); var replacement = /#|\.prototype\./; var isForced = function (feature, detection) { var value = data[normalize(feature)]; return value === POLYFILL ? true : value === NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection; }; var normalize = isForced.normalize = function (string) { return String(string).replace(replacement, '.').toLowerCase(); }; var data = isForced.data = {}; var NATIVE = isForced.NATIVE = 'N'; var POLYFILL = isForced.POLYFILL = 'P'; module.exports = isForced; /***/ }), /* 73 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(17); var uncurryThis = __webpack_require__(6); var uncurryThisAccessor = __webpack_require__(52); var toIndex = __webpack_require__(74); var notDetached = __webpack_require__(75); var arrayBufferByteLength = __webpack_require__(51); var detachTransferable = __webpack_require__(76); var PROPER_STRUCTURED_CLONE_TRANSFER = __webpack_require__(80); var structuredClone = globalThis.structuredClone; var ArrayBuffer = globalThis.ArrayBuffer; var DataView = globalThis.DataView; var min = Math.min; var ArrayBufferPrototype = ArrayBuffer.prototype; var DataViewPrototype = DataView.prototype; var slice = uncurryThis(ArrayBufferPrototype.slice); var isResizable = uncurryThisAccessor(ArrayBufferPrototype, 'resizable', 'get'); var maxByteLength = uncurryThisAccessor(ArrayBufferPrototype, 'maxByteLength', 'get'); var getInt8 = uncurryThis(DataViewPrototype.getInt8); var setInt8 = uncurryThis(DataViewPrototype.setInt8); module.exports = (PROPER_STRUCTURED_CLONE_TRANSFER || detachTransferable) && function (arrayBuffer, newLength, preserveResizability) { var byteLength = arrayBufferByteLength(arrayBuffer); var newByteLength = newLength === undefined ? byteLength : toIndex(newLength); var fixedLength = !isResizable || !isResizable(arrayBuffer); var newBuffer; notDetached(arrayBuffer); if (PROPER_STRUCTURED_CLONE_TRANSFER) { arrayBuffer = structuredClone(arrayBuffer, { transfer: [arrayBuffer] }); if (byteLength === newByteLength && (preserveResizability || fixedLength)) return arrayBuffer; } if (byteLength >= newByteLength && (!preserveResizability || fixedLength)) { newBuffer = slice(arrayBuffer, 0, newByteLength); } else { var options = preserveResizability && !fixedLength && maxByteLength ? { maxByteLength: maxByteLength(arrayBuffer) } : undefined; newBuffer = new ArrayBuffer(newByteLength, options); var a = new DataView(arrayBuffer); var b = new DataView(newBuffer); var copyLength = min(newByteLength, byteLength); for (var i = 0; i < copyLength; i++) setInt8(b, i, getInt8(a, i)); } if (!PROPER_STRUCTURED_CLONE_TRANSFER) detachTransferable(arrayBuffer); return newBuffer; }; /***/ }), /* 74 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toIntegerOrInfinity = __webpack_require__(66); var toLength = __webpack_require__(69); var $RangeError = RangeError; // `ToIndex` abstract operation // https://tc39.es/ecma262/#sec-toindex module.exports = function (it) { if (it === undefined) return 0; var number = toIntegerOrInfinity(it); var length = toLength(number); if (number !== length) throw new $RangeError('Wrong length or index'); return length; }; /***/ }), /* 75 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isDetached = __webpack_require__(48); var $TypeError = TypeError; module.exports = function (it) { if (isDetached(it)) throw new $TypeError('ArrayBuffer is detached'); return it; }; /***/ }), /* 76 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(17); var getBuiltInNodeModule = __webpack_require__(77); var PROPER_STRUCTURED_CLONE_TRANSFER = __webpack_require__(80); var structuredClone = globalThis.structuredClone; var $ArrayBuffer = globalThis.ArrayBuffer; var $MessageChannel = globalThis.MessageChannel; var detach = false; var WorkerThreads, channel, buffer, $detach; if (PROPER_STRUCTURED_CLONE_TRANSFER) { detach = function (transferable) { structuredClone(transferable, { transfer: [transferable] }); }; } else if ($ArrayBuffer) try { if (!$MessageChannel) { WorkerThreads = getBuiltInNodeModule('worker_threads'); if (WorkerThreads) $MessageChannel = WorkerThreads.MessageChannel; } if ($MessageChannel) { channel = new $MessageChannel(); buffer = new $ArrayBuffer(2); $detach = function (transferable) { channel.port1.postMessage(null, [transferable]); }; if (buffer.byteLength === 2) { $detach(buffer); if (buffer.byteLength === 0) detach = $detach; } } } catch (error) { /* empty */ } module.exports = detach; /***/ }), /* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(17); var IS_NODE = __webpack_require__(78); module.exports = function (name) { if (IS_NODE) { try { return globalThis.process.getBuiltinModule(name); } catch (error) { /* empty */ } try { // eslint-disable-next-line no-new-func -- safe return Function('return require("' + name + '")')(); } catch (error) { /* empty */ } } }; /***/ }), /* 78 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var ENVIRONMENT = __webpack_require__(79); module.exports = ENVIRONMENT === 'NODE'; /***/ }), /* 79 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* global Bun, Deno -- detection */ var globalThis = __webpack_require__(17); var userAgent = __webpack_require__(37); var classof = __webpack_require__(50); var userAgentStartsWith = function (string) { return userAgent.slice(0, string.length) === string; }; module.exports = (function () { if (userAgentStartsWith('Bun/')) return 'BUN'; if (userAgentStartsWith('Cloudflare-Workers')) return 'CLOUDFLARE'; if (userAgentStartsWith('Deno/')) return 'DENO'; if (userAgentStartsWith('Node.js/')) return 'NODE'; if (globalThis.Bun && typeof Bun.version == 'string') return 'BUN'; if (globalThis.Deno && typeof Deno.version == 'object') return 'DENO'; if (classof(globalThis.process) === 'process') return 'NODE'; if (globalThis.window && globalThis.document) return 'BROWSER'; return 'REST'; })(); /***/ }), /* 80 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(17); var fails = __webpack_require__(3); var V8 = __webpack_require__(36); var ENVIRONMENT = __webpack_require__(79); var structuredClone = globalThis.structuredClone; module.exports = !!structuredClone && !fails(function () { // prevent V8 ArrayBufferDetaching protector cell invalidation and performance degradation // https://github.com/zloirock/core-js/issues/679 if ((ENVIRONMENT === 'DENO' && V8 > 92) || (ENVIRONMENT === 'NODE' && V8 > 94) || (ENVIRONMENT === 'BROWSER' && V8 > 97)) return false; var buffer = new ArrayBuffer(8); var clone = structuredClone(buffer, { transfer: [buffer] }); return buffer.byteLength !== 0 || clone.byteLength !== 8; }); /***/ }), /* 81 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(54); var $transfer = __webpack_require__(73); // `ArrayBuffer.prototype.transferToFixedLength` method // https://tc39.es/proposal-arraybuffer-transfer/#sec-arraybuffer.prototype.transfertofixedlength if ($transfer) $({ target: 'ArrayBuffer', proto: true }, { transferToFixedLength: function transferToFixedLength() { return $transfer(this, arguments.length ? arguments[0] : undefined, false); } }); /***/ }), /* 82 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(54); var uncurryThis = __webpack_require__(6); var aCallable = __webpack_require__(39); var requireObjectCoercible = __webpack_require__(11); var iterate = __webpack_require__(83); var MapHelpers = __webpack_require__(92); var IS_PURE = __webpack_require__(16); var fails = __webpack_require__(3); var Map = MapHelpers.Map; var has = MapHelpers.has; var get = MapHelpers.get; var set = MapHelpers.set; var push = uncurryThis([].push); var DOES_NOT_WORK_WITH_PRIMITIVES = IS_PURE || fails(function () { return Map.groupBy('ab', function (it) { return it; }).get('a').length !== 1; }); // `Map.groupBy` method // https://tc39.es/ecma262/#sec-map.groupby $({ target: 'Map', stat: true, forced: IS_PURE || DOES_NOT_WORK_WITH_PRIMITIVES }, { groupBy: function groupBy(items, callbackfn) { requireObjectCoercible(items); aCallable(callbackfn); var map = new Map(); var k = 0; iterate(items, function (value) { var key = callbackfn(value, k++); if (!has(map, key)) set(map, key, [value]); else push(get(map, key), value); }); return map; } }); /***/ }), /* 83 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var bind = __webpack_require__(84); var call = __webpack_require__(30); var anObject = __webpack_require__(27); var tryToString = __webpack_require__(40); var isArrayIteratorMethod = __webpack_require__(85); var lengthOfArrayLike = __webpack_require__(68); var isPrototypeOf = __webpack_require__(33); var getIterator = __webpack_require__(87); var getIteratorMethod = __webpack_require__(88); var iteratorClose = __webpack_require__(91); var $TypeError = TypeError; var Result = function (stopped, result) { this.stopped = stopped; this.result = result; }; var ResultPrototype = Result.prototype; module.exports = function (iterable, unboundFunction, options) { var that = options && options.that; var AS_ENTRIES = !!(options && options.AS_ENTRIES); var IS_RECORD = !!(options && options.IS_RECORD); var IS_ITERATOR = !!(options && options.IS_ITERATOR); var INTERRUPTED = !!(options && options.INTERRUPTED); var fn = bind(unboundFunction, that); var iterator, iterFn, index, length, result, next, step; var stop = function (condition) { if (iterator) iteratorClose(iterator, 'normal', condition); return new Result(true, condition); }; var callFn = function (value) { if (AS_ENTRIES) { anObject(value); return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); } return INTERRUPTED ? fn(value, stop) : fn(value); }; if (IS_RECORD) { iterator = iterable.iterator; } else if (IS_ITERATOR) { iterator = iterable; } else { iterFn = getIteratorMethod(iterable); if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable'); // optimisation for array iterators if (isArrayIteratorMethod(iterFn)) { for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) { result = callFn(iterable[index]); if (result && isPrototypeOf(ResultPrototype, result)) return result; } return new Result(false); } iterator = getIterator(iterable, iterFn); } next = IS_RECORD ? iterable.next : iterator.next; while (!(step = call(next, iterator)).done) { try { result = callFn(step.value); } catch (error) { iteratorClose(iterator, 'throw', error); } if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result; } return new Result(false); }; /***/ }), /* 84 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(49); var aCallable = __webpack_require__(39); var NATIVE_BIND = __webpack_require__(7); var bind = uncurryThis(uncurryThis.bind); // optional / simple context binding module.exports = function (fn, that) { aCallable(fn); return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) { return fn.apply(that, arguments); }; }; /***/ }), /* 85 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var wellKnownSymbol = __webpack_require__(42); var Iterators = __webpack_require__(86); var ITERATOR = wellKnownSymbol('iterator'); var ArrayPrototype = Array.prototype; // check on default Array iterator module.exports = function (it) { return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it); }; /***/ }), /* 86 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = {}; /***/ }), /* 87 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(30); var aCallable = __webpack_require__(39); var anObject = __webpack_require__(27); var tryToString = __webpack_require__(40); var getIteratorMethod = __webpack_require__(88); var $TypeError = TypeError; module.exports = function (argument, usingIterator) { var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument)); throw new $TypeError(tryToString(argument) + ' is not iterable'); }; /***/ }), /* 88 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var classof = __webpack_require__(89); var getMethod = __webpack_require__(38); var isNullOrUndefined = __webpack_require__(12); var Iterators = __webpack_require__(86); var wellKnownSymbol = __webpack_require__(42); var ITERATOR = wellKnownSymbol('iterator'); module.exports = function (it) { if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR) || getMethod(it, '@@iterator') || Iterators[classof(it)]; }; /***/ }), /* 89 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var TO_STRING_TAG_SUPPORT = __webpack_require__(90); var isCallable = __webpack_require__(8); var classofRaw = __webpack_require__(50); var wellKnownSymbol = __webpack_require__(42); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var $Object = Object; // ES3 wrong here var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function (it, key) { try { return it[key]; } catch (error) { /* empty */ } }; // getting tag from ES6+ `Object.prototype.toString` module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) { var O, tag, result; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag // builtinTag case : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback : (result = classofRaw(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result; }; /***/ }), /* 90 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var wellKnownSymbol = __webpack_require__(42); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var test = {}; test[TO_STRING_TAG] = 'z'; module.exports = String(test) === '[object z]'; /***/ }), /* 91 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(30); var anObject = __webpack_require__(27); var getMethod = __webpack_require__(38); module.exports = function (iterator, kind, value) { var innerResult, innerError; anObject(iterator); try { innerResult = getMethod(iterator, 'return'); if (!innerResult) { if (kind === 'throw') throw value; return value; } innerResult = call(innerResult, iterator); } catch (error) { innerError = true; innerResult = error; } if (kind === 'throw') throw value; if (innerError) throw innerResult; anObject(innerResult); return value; }; /***/ }), /* 92 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); // eslint-disable-next-line es/no-map -- safe var MapPrototype = Map.prototype; module.exports = { // eslint-disable-next-line es/no-map -- safe Map: Map, set: uncurryThis(MapPrototype.set), get: uncurryThis(MapPrototype.get), has: uncurryThis(MapPrototype.has), remove: uncurryThis(MapPrototype['delete']), proto: MapPrototype }; /***/ }), /* 93 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(54); var getBuiltIn = __webpack_require__(32); var uncurryThis = __webpack_require__(6); var aCallable = __webpack_require__(39); var requireObjectCoercible = __webpack_require__(11); var toPropertyKey = __webpack_require__(28); var iterate = __webpack_require__(83); var fails = __webpack_require__(3); // eslint-disable-next-line es/no-object-groupby -- testing var nativeGroupBy = Object.groupBy; var create = getBuiltIn('Object', 'create'); var push = uncurryThis([].push); var DOES_NOT_WORK_WITH_PRIMITIVES = !nativeGroupBy || fails(function () { return nativeGroupBy('ab', function (it) { return it; }).a.length !== 1; }); // `Object.groupBy` method // https://tc39.es/ecma262/#sec-object.groupby $({ target: 'Object', stat: true, forced: DOES_NOT_WORK_WITH_PRIMITIVES }, { groupBy: function groupBy(items, callbackfn) { requireObjectCoercible(items); aCallable(callbackfn); var obj = create(null); var k = 0; iterate(items, function (value) { var key = toPropertyKey(callbackfn(value, k++)); // in some IE versions, `hasOwnProperty` returns incorrect result on integer keys // but since it's a `null` prototype object, we can safely use `in` if (key in obj) push(obj[key], value); else obj[key] = [value]; }); return obj; } }); /***/ }), /* 94 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(54); var globalThis = __webpack_require__(17); var apply = __webpack_require__(95); var slice = __webpack_require__(96); var newPromiseCapabilityModule = __webpack_require__(97); var aCallable = __webpack_require__(39); var perform = __webpack_require__(98); var Promise = globalThis.Promise; var ACCEPT_ARGUMENTS = false; // Avoiding the use of polyfills of the previous iteration of this proposal // that does not accept arguments of the callback var FORCED = !Promise || !Promise['try'] || perform(function () { Promise['try'](function (argument) { ACCEPT_ARGUMENTS = argument === 8; }, 8); }).error || !ACCEPT_ARGUMENTS; // `Promise.try` method // https://tc39.es/ecma262/#sec-promise.try $({ target: 'Promise', stat: true, forced: FORCED }, { 'try': function (callbackfn /* , ...args */) { var args = arguments.length > 1 ? slice(arguments, 1) : []; var promiseCapability = newPromiseCapabilityModule.f(this); var result = perform(function () { return apply(aCallable(callbackfn), undefined, args); }); (result.error ? promiseCapability.reject : promiseCapability.resolve)(result.value); return promiseCapability.promise; } }); /***/ }), /* 95 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var NATIVE_BIND = __webpack_require__(7); var FunctionPrototype = Function.prototype; var apply = FunctionPrototype.apply; var call = FunctionPrototype.call; // eslint-disable-next-line es/no-reflect -- safe module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () { return call.apply(apply, arguments); }); /***/ }), /* 96 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); module.exports = uncurryThis([].slice); /***/ }), /* 97 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aCallable = __webpack_require__(39); var $TypeError = TypeError; var PromiseCapability = function (C) { var resolve, reject; this.promise = new C(function ($$resolve, $$reject) { if (resolve !== undefined || reject !== undefined) throw new $TypeError('Bad Promise constructor'); resolve = $$resolve; reject = $$reject; }); this.resolve = aCallable(resolve); this.reject = aCallable(reject); }; // `NewPromiseCapability` abstract operation // https://tc39.es/ecma262/#sec-newpromisecapability module.exports.f = function (C) { return new PromiseCapability(C); }; /***/ }), /* 98 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function (exec) { try { return { error: false, value: exec() }; } catch (error) { return { error: true, value: error }; } }; /***/ }), /* 99 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(54); var newPromiseCapabilityModule = __webpack_require__(97); // `Promise.withResolvers` method // https://tc39.es/ecma262/#sec-promise.withResolvers $({ target: 'Promise', stat: true }, { withResolvers: function withResolvers() { var promiseCapability = newPromiseCapabilityModule.f(this); return { promise: promiseCapability.promise, resolve: promiseCapability.resolve, reject: promiseCapability.reject }; } }); /***/ }), /* 100 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(54); var globalThis = __webpack_require__(17); var getBuiltIn = __webpack_require__(32); var createPropertyDescriptor = __webpack_require__(45); var defineProperty = __webpack_require__(23).f; var hasOwn = __webpack_require__(9); var anInstance = __webpack_require__(101); var inheritIfRequired = __webpack_require__(102); var normalizeStringArgument = __webpack_require__(106); var DOMExceptionConstants = __webpack_require__(108); var clearErrorStack = __webpack_require__(109); var DESCRIPTORS = __webpack_require__(2); var IS_PURE = __webpack_require__(16); var DOM_EXCEPTION = 'DOMException'; var Error = getBuiltIn('Error'); var NativeDOMException = getBuiltIn(DOM_EXCEPTION); var $DOMException = function DOMException() { anInstance(this, DOMExceptionPrototype); var argumentsLength = arguments.length; var message = normalizeStringArgument(argumentsLength < 1 ? undefined : arguments[0]); var name = normalizeStringArgument(argumentsLength < 2 ? undefined : arguments[1], 'Error'); var that = new NativeDOMException(message, name); var error = new Error(message); error.name = DOM_EXCEPTION; defineProperty(that, 'stack', createPropertyDescriptor(1, clearErrorStack(error.stack, 1))); inheritIfRequired(that, this, $DOMException); return that; }; var DOMExceptionPrototype = $DOMException.prototype = NativeDOMException.prototype; var ERROR_HAS_STACK = 'stack' in new Error(DOM_EXCEPTION); var DOM_EXCEPTION_HAS_STACK = 'stack' in new NativeDOMException(1, 2); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var descriptor = NativeDOMException && DESCRIPTORS && Object.getOwnPropertyDescriptor(globalThis, DOM_EXCEPTION); // Bun ~ 0.1.1 DOMException have incorrect descriptor and we can't redefine it // https://github.com/Jarred-Sumner/bun/issues/399 var BUGGY_DESCRIPTOR = !!descriptor && !(descriptor.writable && descriptor.configurable); var FORCED_CONSTRUCTOR = ERROR_HAS_STACK && !BUGGY_DESCRIPTOR && !DOM_EXCEPTION_HAS_STACK; // `DOMException` constructor patch for `.stack` where it's required // https://webidl.spec.whatwg.org/#es-DOMException-specialness $({ global: true, constructor: true, forced: IS_PURE || FORCED_CONSTRUCTOR }, { // TODO: fix export logic DOMException: FORCED_CONSTRUCTOR ? $DOMException : NativeDOMException }); var PolyfilledDOMException = getBuiltIn(DOM_EXCEPTION); var PolyfilledDOMExceptionPrototype = PolyfilledDOMException.prototype; if (PolyfilledDOMExceptionPrototype.constructor !== PolyfilledDOMException) { if (!IS_PURE) { defineProperty(PolyfilledDOMExceptionPrototype, 'constructor', createPropertyDescriptor(1, PolyfilledDOMException)); } for (var key in DOMExceptionConstants) if (hasOwn(DOMExceptionConstants, key)) { var constant = DOMExceptionConstants[key]; var constantName = constant.s; if (!hasOwn(PolyfilledDOMException, constantName)) { defineProperty(PolyfilledDOMException, constantName, createPropertyDescriptor(6, constant.c)); } } } /***/ }), /* 101 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isPrototypeOf = __webpack_require__(33); var $TypeError = TypeError; module.exports = function (it, Prototype) { if (isPrototypeOf(Prototype, it)) return it; throw new $TypeError('Incorrect invocation'); }; /***/ }), /* 102 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isCallable = __webpack_require__(8); var isObject = __webpack_require__(21); var setPrototypeOf = __webpack_require__(103); // makes subclassing work correct for wrapped built-ins module.exports = function ($this, dummy, Wrapper) { var NewTarget, NewTargetPrototype; if ( // it can work only with native `setPrototypeOf` setPrototypeOf && // we haven't completely correct pre-ES6 way for getting `new.target`, so use this isCallable(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype ) setPrototypeOf($this, NewTargetPrototype); return $this; }; /***/ }), /* 103 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable no-proto -- safe */ var uncurryThisAccessor = __webpack_require__(52); var isObject = __webpack_require__(21); var requireObjectCoercible = __webpack_require__(11); var aPossiblePrototype = __webpack_require__(104); // `Object.setPrototypeOf` method // https://tc39.es/ecma262/#sec-object.setprototypeof // Works with __proto__ only. Old v8 can't work with null proto objects. // eslint-disable-next-line es/no-object-setprototypeof -- safe module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { var CORRECT_SETTER = false; var test = {}; var setter; try { setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set'); setter(test, []); CORRECT_SETTER = test instanceof Array; } catch (error) { /* empty */ } return function setPrototypeOf(O, proto) { requireObjectCoercible(O); aPossiblePrototype(proto); if (!isObject(O)) return O; if (CORRECT_SETTER) setter(O, proto); else O.__proto__ = proto; return O; }; }() : undefined); /***/ }), /* 104 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isPossiblePrototype = __webpack_require__(105); var $String = String; var $TypeError = TypeError; module.exports = function (argument) { if (isPossiblePrototype(argument)) return argument; throw new $TypeError("Can't set " + $String(argument) + ' as a prototype'); }; /***/ }), /* 105 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isObject = __webpack_require__(21); module.exports = function (argument) { return isObject(argument) || argument === null; }; /***/ }), /* 106 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toString = __webpack_require__(107); module.exports = function (argument, $default) { return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument); }; /***/ }), /* 107 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var classof = __webpack_require__(89); var $String = String; module.exports = function (argument) { if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string'); return $String(argument); }; /***/ }), /* 108 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = { IndexSizeError: { s: 'INDEX_SIZE_ERR', c: 1, m: 1 }, DOMStringSizeError: { s: 'DOMSTRING_SIZE_ERR', c: 2, m: 0 }, HierarchyRequestError: { s: 'HIERARCHY_REQUEST_ERR', c: 3, m: 1 }, WrongDocumentError: { s: 'WRONG_DOCUMENT_ERR', c: 4, m: 1 }, InvalidCharacterError: { s: 'INVALID_CHARACTER_ERR', c: 5, m: 1 }, NoDataAllowedError: { s: 'NO_DATA_ALLOWED_ERR', c: 6, m: 0 }, NoModificationAllowedError: { s: 'NO_MODIFICATION_ALLOWED_ERR', c: 7, m: 1 }, NotFoundError: { s: 'NOT_FOUND_ERR', c: 8, m: 1 }, NotSupportedError: { s: 'NOT_SUPPORTED_ERR', c: 9, m: 1 }, InUseAttributeError: { s: 'INUSE_ATTRIBUTE_ERR', c: 10, m: 1 }, InvalidStateError: { s: 'INVALID_STATE_ERR', c: 11, m: 1 }, SyntaxError: { s: 'SYNTAX_ERR', c: 12, m: 1 }, InvalidModificationError: { s: 'INVALID_MODIFICATION_ERR', c: 13, m: 1 }, NamespaceError: { s: 'NAMESPACE_ERR', c: 14, m: 1 }, InvalidAccessError: { s: 'INVALID_ACCESS_ERR', c: 15, m: 1 }, ValidationError: { s: 'VALIDATION_ERR', c: 16, m: 0 }, TypeMismatchError: { s: 'TYPE_MISMATCH_ERR', c: 17, m: 1 }, SecurityError: { s: 'SECURITY_ERR', c: 18, m: 1 }, NetworkError: { s: 'NETWORK_ERR', c: 19, m: 1 }, AbortError: { s: 'ABORT_ERR', c: 20, m: 1 }, URLMismatchError: { s: 'URL_MISMATCH_ERR', c: 21, m: 1 }, QuotaExceededError: { s: 'QUOTA_EXCEEDED_ERR', c: 22, m: 1 }, TimeoutError: { s: 'TIMEOUT_ERR', c: 23, m: 1 }, InvalidNodeTypeError: { s: 'INVALID_NODE_TYPE_ERR', c: 24, m: 1 }, DataCloneError: { s: 'DATA_CLONE_ERR', c: 25, m: 1 } }; /***/ }), /* 109 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); var $Error = Error; var replace = uncurryThis(''.replace); var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd'); // eslint-disable-next-line redos/no-vulnerable, sonarjs/slow-regex -- safe var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/; var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST); module.exports = function (stack, dropEntries) { if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) { while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, ''); } return stack; }; /***/ }), /* 110 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var IS_PURE = __webpack_require__(16); var $ = __webpack_require__(54); var globalThis = __webpack_require__(17); var getBuiltIn = __webpack_require__(32); var uncurryThis = __webpack_require__(6); var fails = __webpack_require__(3); var uid = __webpack_require__(44); var isCallable = __webpack_require__(8); var isConstructor = __webpack_require__(111); var isNullOrUndefined = __webpack_require__(12); var isObject = __webpack_require__(21); var isSymbol = __webpack_require__(31); var iterate = __webpack_require__(83); var anObject = __webpack_require__(27); var classof = __webpack_require__(89); var hasOwn = __webpack_require__(9); var createProperty = __webpack_require__(112); var createNonEnumerableProperty = __webpack_require__(22); var lengthOfArrayLike = __webpack_require__(68); var validateArgumentsLength = __webpack_require__(113); var getRegExpFlags = __webpack_require__(114); var MapHelpers = __webpack_require__(92); var SetHelpers = __webpack_require__(116); var setIterate = __webpack_require__(117); var detachTransferable = __webpack_require__(76); var ERROR_STACK_INSTALLABLE = __webpack_require__(119); var PROPER_STRUCTURED_CLONE_TRANSFER = __webpack_require__(80); var Object = globalThis.Object; var Array = globalThis.Array; var Date = globalThis.Date; var Error = globalThis.Error; var TypeError = globalThis.TypeError; var PerformanceMark = globalThis.PerformanceMark; var DOMException = getBuiltIn('DOMException'); var Map = MapHelpers.Map; var mapHas = MapHelpers.has; var mapGet = MapHelpers.get; var mapSet = MapHelpers.set; var Set = SetHelpers.Set; var setAdd = SetHelpers.add; var setHas = SetHelpers.has; var objectKeys = getBuiltIn('Object', 'keys'); var push = uncurryThis([].push); var thisBooleanValue = uncurryThis(true.valueOf); var thisNumberValue = uncurryThis(1.0.valueOf); var thisStringValue = uncurryThis(''.valueOf); var thisTimeValue = uncurryThis(Date.prototype.getTime); var PERFORMANCE_MARK = uid('structuredClone'); var DATA_CLONE_ERROR = 'DataCloneError'; var TRANSFERRING = 'Transferring'; var checkBasicSemantic = function (structuredCloneImplementation) { return !fails(function () { var set1 = new globalThis.Set([7]); var set2 = structuredCloneImplementation(set1); var number = structuredCloneImplementation(Object(7)); return set2 === set1 || !set2.has(7) || !isObject(number) || +number !== 7; }) && structuredCloneImplementation; }; var checkErrorsCloning = function (structuredCloneImplementation, $Error) { return !fails(function () { var error = new $Error(); var test = structuredCloneImplementation({ a: error, b: error }); return !(test && test.a === test.b && test.a instanceof $Error && test.a.stack === error.stack); }); }; // https://github.com/whatwg/html/pull/5749 var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) { return !fails(function () { var test = structuredCloneImplementation(new globalThis.AggregateError([1], PERFORMANCE_MARK, { cause: 3 })); return test.name !== 'AggregateError' || test.errors[0] !== 1 || test.message !== PERFORMANCE_MARK || test.cause !== 3; }); }; // FF94+, Safari 15.4+, Chrome 98+, NodeJS 17.0+, Deno 1.13+ // FF<103 and Safari implementations can't clone errors // https://bugzilla.mozilla.org/show_bug.cgi?id=1556604 // FF103 can clone errors, but `.stack` of clone is an empty string // https://bugzilla.mozilla.org/show_bug.cgi?id=1778762 // FF104+ fixed it on usual errors, but not on DOMExceptions // https://bugzilla.mozilla.org/show_bug.cgi?id=1777321 // Chrome <102 returns `null` if cloned object contains multiple references to one error // https://bugs.chromium.org/p/v8/issues/detail?id=12542 // NodeJS implementation can't clone DOMExceptions // https://github.com/nodejs/node/issues/41038 // only FF103+ supports new (html/5749) error cloning semantic var nativeStructuredClone = globalThis.structuredClone; var FORCED_REPLACEMENT = IS_PURE || !checkErrorsCloning(nativeStructuredClone, Error) || !checkErrorsCloning(nativeStructuredClone, DOMException) || !checkNewErrorsCloningSemantic(nativeStructuredClone); // Chrome 82+, Safari 14.1+, Deno 1.11+ // Chrome 78-81 implementation swaps `.name` and `.message` of cloned `DOMException` // Chrome returns `null` if cloned object contains multiple references to one error // Safari 14.1 implementation doesn't clone some `RegExp` flags, so requires a workaround // Safari implementation can't clone errors // Deno 1.2-1.10 implementations too naive // NodeJS 16.0+ does not have `PerformanceMark` constructor // NodeJS <17.2 structured cloning implementation from `performance.mark` is too naive // and can't clone, for example, `RegExp` or some boxed primitives // https://github.com/nodejs/node/issues/40840 // no one of those implementations supports new (html/5749) error cloning semantic var structuredCloneFromMark = !nativeStructuredClone && checkBasicSemantic(function (value) { return new PerformanceMark(PERFORMANCE_MARK, { detail: value }).detail; }); var nativeRestrictedStructuredClone = checkBasicSemantic(nativeStructuredClone) || structuredCloneFromMark; var throwUncloneable = function (type) { throw new DOMException('Uncloneable type: ' + type, DATA_CLONE_ERROR); }; var throwUnpolyfillable = function (type, action) { throw new DOMException((action || 'Cloning') + ' of ' + type + ' cannot be properly polyfilled in this engine', DATA_CLONE_ERROR); }; var tryNativeRestrictedStructuredClone = function (value, type) { if (!nativeRestrictedStructuredClone) throwUnpolyfillable(type); return nativeRestrictedStructuredClone(value); }; var createDataTransfer = function () { var dataTransfer; try { dataTransfer = new globalThis.DataTransfer(); } catch (error) { try { dataTransfer = new globalThis.ClipboardEvent('').clipboardData; } catch (error2) { /* empty */ } } return dataTransfer && dataTransfer.items && dataTransfer.files ? dataTransfer : null; }; var cloneBuffer = function (value, map, $type) { if (mapHas(map, value)) return mapGet(map, value); var type = $type || classof(value); var clone, length, options, source, target, i; if (type === 'SharedArrayBuffer') { if (nativeRestrictedStructuredClone) clone = nativeRestrictedStructuredClone(value); // SharedArrayBuffer should use shared memory, we can't polyfill it, so return the original else clone = value; } else { var DataView = globalThis.DataView; // `ArrayBuffer#slice` is not available in IE10 // `ArrayBuffer#slice` and `DataView` are not available in old FF if (!DataView && !isCallable(value.slice)) throwUnpolyfillable('ArrayBuffer'); // detached buffers throws in `DataView` and `.slice` try { if (isCallable(value.slice) && !value.resizable) { clone = value.slice(0); } else { length = value.byteLength; options = 'maxByteLength' in value ? { maxByteLength: value.maxByteLength } : undefined; // eslint-disable-next-line es/no-resizable-and-growable-arraybuffers -- safe clone = new ArrayBuffer(length, options); source = new DataView(value); target = new DataView(clone); for (i = 0; i < length; i++) { target.setUint8(i, source.getUint8(i)); } } } catch (error) { throw new DOMException('ArrayBuffer is detached', DATA_CLONE_ERROR); } } mapSet(map, value, clone); return clone; }; var cloneView = function (value, type, offset, length, map) { var C = globalThis[type]; // in some old engines like Safari 9, typeof C is 'object' // on Uint8ClampedArray or some other constructors if (!isObject(C)) throwUnpolyfillable(type); return new C(cloneBuffer(value.buffer, map), offset, length); }; var structuredCloneInternal = function (value, map) { if (isSymbol(value)) throwUncloneable('Symbol'); if (!isObject(value)) return value; // effectively preserves circular references if (map) { if (mapHas(map, value)) return mapGet(map, value); } else map = new Map(); var type = classof(value); var C, name, cloned, dataTransfer, i, length, keys, key; switch (type) { case 'Array': cloned = Array(lengthOfArrayLike(value)); break; case 'Object': cloned = {}; break; case 'Map': cloned = new Map(); break; case 'Set': cloned = new Set(); break; case 'RegExp': // in this block because of a Safari 14.1 bug // old FF does not clone regexes passed to the constructor, so get the source and flags directly cloned = new RegExp(value.source, getRegExpFlags(value)); break; case 'Error': name = value.name; switch (name) { case 'AggregateError': cloned = new (getBuiltIn(name))([]); break; case 'EvalError': case 'RangeError': case 'ReferenceError': case 'SuppressedError': case 'SyntaxError': case 'TypeError': case 'URIError': cloned = new (getBuiltIn(name))(); break; case 'CompileError': case 'LinkError': case 'RuntimeError': cloned = new (getBuiltIn('WebAssembly', name))(); break; default: cloned = new Error(); } break; case 'DOMException': cloned = new DOMException(value.message, value.name); break; case 'ArrayBuffer': case 'SharedArrayBuffer': cloned = cloneBuffer(value, map, type); break; case 'DataView': case 'Int8Array': case 'Uint8Array': case 'Uint8ClampedArray': case 'Int16Array': case 'Uint16Array': case 'Int32Array': case 'Uint32Array': case 'Float16Array': case 'Float32Array': case 'Float64Array': case 'BigInt64Array': case 'BigUint64Array': length = type === 'DataView' ? value.byteLength : value.length; cloned = cloneView(value, type, value.byteOffset, length, map); break; case 'DOMQuad': try { cloned = new DOMQuad( structuredCloneInternal(value.p1, map), structuredCloneInternal(value.p2, map), structuredCloneInternal(value.p3, map), structuredCloneInternal(value.p4, map) ); } catch (error) { cloned = tryNativeRestrictedStructuredClone(value, type); } break; case 'File': if (nativeRestrictedStructuredClone) try { cloned = nativeRestrictedStructuredClone(value); // NodeJS 20.0.0 bug, https://github.com/nodejs/node/issues/47612 if (classof(cloned) !== type) cloned = undefined; } catch (error) { /* empty */ } if (!cloned) try { cloned = new File([value], value.name, value); } catch (error) { /* empty */ } if (!cloned) throwUnpolyfillable(type); break; case 'FileList': dataTransfer = createDataTransfer(); if (dataTransfer) { for (i = 0, length = lengthOfArrayLike(value); i < length; i++) { dataTransfer.items.add(structuredCloneInternal(value[i], map)); } cloned = dataTransfer.files; } else cloned = tryNativeRestrictedStructuredClone(value, type); break; case 'ImageData': // Safari 9 ImageData is a constructor, but typeof ImageData is 'object' try { cloned = new ImageData( structuredCloneInternal(value.data, map), value.width, value.height, { colorSpace: value.colorSpace } ); } catch (error) { cloned = tryNativeRestrictedStructuredClone(value, type); } break; default: if (nativeRestrictedStructuredClone) { cloned = nativeRestrictedStructuredClone(value); } else switch (type) { case 'BigInt': // can be a 3rd party polyfill cloned = Object(value.valueOf()); break; case 'Boolean': cloned = Object(thisBooleanValue(value)); break; case 'Number': cloned = Object(thisNumberValue(value)); break; case 'String': cloned = Object(thisStringValue(value)); break; case 'Date': cloned = new Date(thisTimeValue(value)); break; case 'Blob': try { cloned = value.slice(0, value.size, value.type); } catch (error) { throwUnpolyfillable(type); } break; case 'DOMPoint': case 'DOMPointReadOnly': C = globalThis[type]; try { cloned = C.fromPoint ? C.fromPoint(value) : new C(value.x, value.y, value.z, value.w); } catch (error) { throwUnpolyfillable(type); } break; case 'DOMRect': case 'DOMRectReadOnly': C = globalThis[type]; try { cloned = C.fromRect ? C.fromRect(value) : new C(value.x, value.y, value.width, value.height); } catch (error) { throwUnpolyfillable(type); } break; case 'DOMMatrix': case 'DOMMatrixReadOnly': C = globalThis[type]; try { cloned = C.fromMatrix ? C.fromMatrix(value) : new C(value); } catch (error) { throwUnpolyfillable(type); } break; case 'AudioData': case 'VideoFrame': if (!isCallable(value.clone)) throwUnpolyfillable(type); try { cloned = value.clone(); } catch (error) { throwUncloneable(type); } break; case 'CropTarget': case 'CryptoKey': case 'FileSystemDirectoryHandle': case 'FileSystemFileHandle': case 'FileSystemHandle': case 'GPUCompilationInfo': case 'GPUCompilationMessage': case 'ImageBitmap': case 'RTCCertificate': case 'WebAssembly.Module': throwUnpolyfillable(type); // break omitted default: throwUncloneable(type); } } mapSet(map, value, cloned); switch (type) { case 'Array': case 'Object': keys = objectKeys(value); for (i = 0, length = lengthOfArrayLike(keys); i < length; i++) { key = keys[i]; createProperty(cloned, key, structuredCloneInternal(value[key], map)); } break; case 'Map': value.forEach(function (v, k) { mapSet(cloned, structuredCloneInternal(k, map), structuredCloneInternal(v, map)); }); break; case 'Set': value.forEach(function (v) { setAdd(cloned, structuredCloneInternal(v, map)); }); break; case 'Error': createNonEnumerableProperty(cloned, 'message', structuredCloneInternal(value.message, map)); if (hasOwn(value, 'cause')) { createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map)); } if (name === 'AggregateError') { cloned.errors = structuredCloneInternal(value.errors, map); } else if (name === 'SuppressedError') { cloned.error = structuredCloneInternal(value.error, map); cloned.suppressed = structuredCloneInternal(value.suppressed, map); } // break omitted case 'DOMException': if (ERROR_STACK_INSTALLABLE) { createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map)); } } return cloned; }; var tryToTransfer = function (rawTransfer, map) { if (!isObject(rawTransfer)) throw new TypeError('Transfer option cannot be converted to a sequence'); var transfer = []; iterate(rawTransfer, function (value) { push(transfer, anObject(value)); }); var i = 0; var length = lengthOfArrayLike(transfer); var buffers = new Set(); var value, type, C, transferred, canvas, context; while (i < length) { value = transfer[i++]; type = classof(value); if (type === 'ArrayBuffer' ? setHas(buffers, value) : mapHas(map, value)) { throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR); } if (type === 'ArrayBuffer') { setAdd(buffers, value); continue; } if (PROPER_STRUCTURED_CLONE_TRANSFER) { transferred = nativeStructuredClone(value, { transfer: [value] }); } else switch (type) { case 'ImageBitmap': C = globalThis.OffscreenCanvas; if (!isConstructor(C)) throwUnpolyfillable(type, TRANSFERRING); try { canvas = new C(value.width, value.height); context = canvas.getContext('bitmaprenderer'); context.transferFromImageBitmap(value); transferred = canvas.transferToImageBitmap(); } catch (error) { /* empty */ } break; case 'AudioData': case 'VideoFrame': if (!isCallable(value.clone) || !isCallable(value.close)) throwUnpolyfillable(type, TRANSFERRING); try { transferred = value.clone(); value.close(); } catch (error) { /* empty */ } break; case 'MediaSourceHandle': case 'MessagePort': case 'MIDIAccess': case 'OffscreenCanvas': case 'ReadableStream': case 'RTCDataChannel': case 'TransformStream': case 'WebTransportReceiveStream': case 'WebTransportSendStream': case 'WritableStream': throwUnpolyfillable(type, TRANSFERRING); } if (transferred === undefined) throw new DOMException('This object cannot be transferred: ' + type, DATA_CLONE_ERROR); mapSet(map, value, transferred); } return buffers; }; var detachBuffers = function (buffers) { setIterate(buffers, function (buffer) { if (PROPER_STRUCTURED_CLONE_TRANSFER) { nativeRestrictedStructuredClone(buffer, { transfer: [buffer] }); } else if (isCallable(buffer.transfer)) { buffer.transfer(); } else if (detachTransferable) { detachTransferable(buffer); } else { throwUnpolyfillable('ArrayBuffer', TRANSFERRING); } }); }; // `structuredClone` method // https://html.spec.whatwg.org/multipage/structured-data.html#dom-structuredclone $({ global: true, enumerable: true, sham: !PROPER_STRUCTURED_CLONE_TRANSFER, forced: FORCED_REPLACEMENT }, { structuredClone: function structuredClone(value /* , { transfer } */) { var options = validateArgumentsLength(arguments.length, 1) > 1 && !isNullOrUndefined(arguments[1]) ? anObject(arguments[1]) : undefined; var transfer = options ? options.transfer : undefined; var map, buffers; if (transfer !== undefined) { map = new Map(); buffers = tryToTransfer(transfer, map); } var clone = structuredCloneInternal(value, map); // since of an issue with cloning views of transferred buffers, we a forced to detach them later // https://github.com/zloirock/core-js/issues/1265 if (buffers) detachBuffers(buffers); return clone; } }); /***/ }), /* 111 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); var fails = __webpack_require__(3); var isCallable = __webpack_require__(8); var classof = __webpack_require__(89); var getBuiltIn = __webpack_require__(32); var inspectSource = __webpack_require__(14); var noop = function () { /* empty */ }; var construct = getBuiltIn('Reflect', 'construct'); var constructorRegExp = /^\s*(?:class|function)\b/; var exec = uncurryThis(constructorRegExp.exec); var INCORRECT_TO_STRING = !constructorRegExp.test(noop); var isConstructorModern = function isConstructor(argument) { if (!isCallable(argument)) return false; try { construct(noop, [], argument); return true; } catch (error) { return false; } }; var isConstructorLegacy = function isConstructor(argument) { if (!isCallable(argument)) return false; switch (classof(argument)) { case 'AsyncFunction': case 'GeneratorFunction': case 'AsyncGeneratorFunction': return false; } try { // we can't check .prototype since constructors produced by .bind haven't it // `Function#toString` throws on some built-it function in some legacy engines // (for example, `DOMQuad` and similar in FF41-) return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument)); } catch (error) { return true; } }; isConstructorLegacy.sham = true; // `IsConstructor` abstract operation // https://tc39.es/ecma262/#sec-isconstructor module.exports = !construct || fails(function () { var called; return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function () { called = true; }) || called; }) ? isConstructorLegacy : isConstructorModern; /***/ }), /* 112 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(2); var definePropertyModule = __webpack_require__(23); var createPropertyDescriptor = __webpack_require__(45); module.exports = function (object, key, value) { if (DESCRIPTORS) definePropertyModule.f(object, key, createPropertyDescriptor(0, value)); else object[key] = value; }; /***/ }), /* 113 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $TypeError = TypeError; module.exports = function (passed, required) { if (passed < required) throw new $TypeError('Not enough arguments'); return passed; }; /***/ }), /* 114 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(30); var hasOwn = __webpack_require__(9); var isPrototypeOf = __webpack_require__(33); var regExpFlags = __webpack_require__(115); var RegExpPrototype = RegExp.prototype; module.exports = function (R) { var flags = R.flags; return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R) ? call(regExpFlags, R) : flags; }; /***/ }), /* 115 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var anObject = __webpack_require__(27); // `RegExp.prototype.flags` getter implementation // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags module.exports = function () { var that = anObject(this); var result = ''; if (that.hasIndices) result += 'd'; if (that.global) result += 'g'; if (that.ignoreCase) result += 'i'; if (that.multiline) result += 'm'; if (that.dotAll) result += 's'; if (that.unicode) result += 'u'; if (that.unicodeSets) result += 'v'; if (that.sticky) result += 'y'; return result; }; /***/ }), /* 116 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); // eslint-disable-next-line es/no-set -- safe var SetPrototype = Set.prototype; module.exports = { // eslint-disable-next-line es/no-set -- safe Set: Set, add: uncurryThis(SetPrototype.add), has: uncurryThis(SetPrototype.has), remove: uncurryThis(SetPrototype['delete']), proto: SetPrototype }; /***/ }), /* 117 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(6); var iterateSimple = __webpack_require__(118); var SetHelpers = __webpack_require__(116); var Set = SetHelpers.Set; var SetPrototype = SetHelpers.proto; var forEach = uncurryThis(SetPrototype.forEach); var keys = uncurryThis(SetPrototype.keys); var next = keys(new Set()).next; module.exports = function (set, fn, interruptible) { return interruptible ? iterateSimple({ iterator: keys(set), next: next }, fn) : forEach(set, fn); }; /***/ }), /* 118 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var call = __webpack_require__(30); module.exports = function (record, fn, ITERATOR_INSTEAD_OF_RECORD) { var iterator = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator; var next = record.next; var step, result; while (!(step = call(next, iterator)).done) { result = fn(step.value); if (result !== undefined) return result; } }; /***/ }), /* 119 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(3); var createPropertyDescriptor = __webpack_require__(45); module.exports = !fails(function () { var error = new Error('a'); if (!('stack' in error)) return true; // eslint-disable-next-line es/no-object-defineproperty -- safe Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7)); return error.stack !== 7; }); /***/ }), /* 120 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(54); var getBuiltIn = __webpack_require__(32); var fails = __webpack_require__(3); var validateArgumentsLength = __webpack_require__(113); var toString = __webpack_require__(107); var USE_NATIVE_URL = __webpack_require__(121); var URL = getBuiltIn('URL'); // https://github.com/nodejs/node/issues/47505 // https://github.com/denoland/deno/issues/18893 var THROWS_WITHOUT_ARGUMENTS = USE_NATIVE_URL && fails(function () { URL.canParse(); }); // Bun ~ 1.0.30 bug // https://github.com/oven-sh/bun/issues/9250 var WRONG_ARITY = fails(function () { return URL.canParse.length !== 1; }); // `URL.canParse` method // https://url.spec.whatwg.org/#dom-url-canparse $({ target: 'URL', stat: true, forced: !THROWS_WITHOUT_ARGUMENTS || WRONG_ARITY }, { canParse: function canParse(url) { var length = validateArgumentsLength(arguments.length, 1); var urlString = toString(url); var base = length < 2 || arguments[1] === undefined ? undefined : toString(arguments[1]); try { return !!new URL(urlString, base); } catch (error) { return false; } } }); /***/ }), /* 121 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(3); var wellKnownSymbol = __webpack_require__(42); var DESCRIPTORS = __webpack_require__(2); var IS_PURE = __webpack_require__(16); var ITERATOR = wellKnownSymbol('iterator'); module.exports = !fails(function () { // eslint-disable-next-line unicorn/relative-url-style -- required for testing var url = new URL('b?a=1&b=2&c=3', 'https://a'); var params = url.searchParams; var params2 = new URLSearchParams('a=1&a=2&b=3'); var result = ''; url.pathname = 'c%20d'; params.forEach(function (value, key) { params['delete']('b'); result += key + value; }); params2['delete']('a', 2); // `undefined` case is a Chromium 117 bug // https://bugs.chromium.org/p/v8/issues/detail?id=14222 params2['delete']('b', undefined); return (IS_PURE && (!url.toJSON || !params2.has('a', 1) || params2.has('a', 2) || !params2.has('a', undefined) || params2.has('b'))) || (!params.size && (IS_PURE || !DESCRIPTORS)) || !params.sort || url.href !== 'https://a/c%20d?a=1&c=3' || params.get('c') !== '3' || String(new URLSearchParams('?a=1')) !== 'a=1' || !params[ITERATOR] // throws in Edge || new URL('https://a@b').username !== 'a' || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' // not punycoded in Edge || new URL('https://тест').host !== 'xn--e1aybc' // not escaped in Chrome 62- || new URL('https://a#б').hash !== '#%D0%B1' // fails in Chrome 66- || result !== 'a1c3' // throws in Safari || new URL('https://x', undefined).host !== 'x'; }); /***/ }), /* 122 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(54); var getBuiltIn = __webpack_require__(32); var validateArgumentsLength = __webpack_require__(113); var toString = __webpack_require__(107); var USE_NATIVE_URL = __webpack_require__(121); var URL = getBuiltIn('URL'); // `URL.parse` method // https://url.spec.whatwg.org/#dom-url-canparse $({ target: 'URL', stat: true, forced: !USE_NATIVE_URL }, { parse: function parse(url) { var length = validateArgumentsLength(arguments.length, 1); var urlString = toString(url); var base = length < 2 || arguments[1] === undefined ? undefined : toString(arguments[1]); try { return new URL(urlString, base); } catch (error) { return null; } } }); /***/ }), /* 123 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var defineBuiltIn = __webpack_require__(59); var uncurryThis = __webpack_require__(6); var toString = __webpack_require__(107); var validateArgumentsLength = __webpack_require__(113); var $URLSearchParams = URLSearchParams; var URLSearchParamsPrototype = $URLSearchParams.prototype; var append = uncurryThis(URLSearchParamsPrototype.append); var $delete = uncurryThis(URLSearchParamsPrototype['delete']); var forEach = uncurryThis(URLSearchParamsPrototype.forEach); var push = uncurryThis([].push); var params = new $URLSearchParams('a=1&a=2&b=3'); params['delete']('a', 1); // `undefined` case is a Chromium 117 bug // https://bugs.chromium.org/p/v8/issues/detail?id=14222 params['delete']('b', undefined); if (params + '' !== 'a=2') { defineBuiltIn(URLSearchParamsPrototype, 'delete', function (name /* , value */) { var length = arguments.length; var $value = length < 2 ? undefined : arguments[1]; if (length && $value === undefined) return $delete(this, name); var entries = []; forEach(this, function (v, k) { // also validates `this` push(entries, { key: k, value: v }); }); validateArgumentsLength(length, 1); var key = toString(name); var value = toString($value); var index = 0; var dindex = 0; var found = false; var entriesLength = entries.length; var entry; while (index < entriesLength) { entry = entries[index++]; if (found || entry.key === key) { found = true; $delete(this, entry.key); } else dindex++; } while (dindex < entriesLength) { entry = entries[dindex++]; if (!(entry.key === key && entry.value === value)) append(this, entry.key, entry.value); } }, { enumerable: true, unsafe: true }); } /***/ }), /* 124 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var defineBuiltIn = __webpack_require__(59); var uncurryThis = __webpack_require__(6); var toString = __webpack_require__(107); var validateArgumentsLength = __webpack_require__(113); var $URLSearchParams = URLSearchParams; var URLSearchParamsPrototype = $URLSearchParams.prototype; var getAll = uncurryThis(URLSearchParamsPrototype.getAll); var $has = uncurryThis(URLSearchParamsPrototype.has); var params = new $URLSearchParams('a=1'); // `undefined` case is a Chromium 117 bug // https://bugs.chromium.org/p/v8/issues/detail?id=14222 if (params.has('a', 2) || !params.has('a', undefined)) { defineBuiltIn(URLSearchParamsPrototype, 'has', function has(name /* , value */) { var length = arguments.length; var $value = length < 2 ? undefined : arguments[1]; if (length && $value === undefined) return $has(this, name); var values = getAll(this, name); // also validates `this` validateArgumentsLength(length, 1); var value = toString($value); var index = 0; while (index < values.length) { if (values[index++] === value) return true; } return false; }, { enumerable: true, unsafe: true }); } /***/ }), /* 125 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(2); var uncurryThis = __webpack_require__(6); var defineBuiltInAccessor = __webpack_require__(4); var URLSearchParamsPrototype = URLSearchParams.prototype; var forEach = uncurryThis(URLSearchParamsPrototype.forEach); // `URLSearchParams.prototype.size` getter // https://github.com/whatwg/url/pull/734 if (DESCRIPTORS && !('size' in URLSearchParamsPrototype)) { defineBuiltInAccessor(URLSearchParamsPrototype, 'size', { get: function size() { var count = 0; forEach(this, function () { count++; }); return count; }, configurable: true, enumerable: true }); } /***/ }) /******/ ]); }(); vendor/wp-polyfill-url.js 0000604 00000327374 15151622574 0011501 0 ustar 00 (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(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="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ module.exports = function (it) { if (typeof it != 'function') { throw TypeError(String(it) + ' is not a function'); } return it; }; },{}],2:[function(require,module,exports){ var isObject = require('../internals/is-object'); module.exports = function (it) { if (!isObject(it) && it !== null) { throw TypeError("Can't set " + String(it) + ' as a prototype'); } return it; }; },{"../internals/is-object":37}],3:[function(require,module,exports){ var wellKnownSymbol = require('../internals/well-known-symbol'); var create = require('../internals/object-create'); var definePropertyModule = require('../internals/object-define-property'); var UNSCOPABLES = wellKnownSymbol('unscopables'); var ArrayPrototype = Array.prototype; // Array.prototype[@@unscopables] // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables if (ArrayPrototype[UNSCOPABLES] == undefined) { definePropertyModule.f(ArrayPrototype, UNSCOPABLES, { configurable: true, value: create(null) }); } // add a key to Array.prototype[@@unscopables] module.exports = function (key) { ArrayPrototype[UNSCOPABLES][key] = true; }; },{"../internals/object-create":45,"../internals/object-define-property":47,"../internals/well-known-symbol":77}],4:[function(require,module,exports){ module.exports = function (it, Constructor, name) { if (!(it instanceof Constructor)) { throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation'); } return it; }; },{}],5:[function(require,module,exports){ var isObject = require('../internals/is-object'); module.exports = function (it) { if (!isObject(it)) { throw TypeError(String(it) + ' is not an object'); } return it; }; },{"../internals/is-object":37}],6:[function(require,module,exports){ 'use strict'; var bind = require('../internals/function-bind-context'); var toObject = require('../internals/to-object'); var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing'); var isArrayIteratorMethod = require('../internals/is-array-iterator-method'); var toLength = require('../internals/to-length'); var createProperty = require('../internals/create-property'); var getIteratorMethod = require('../internals/get-iterator-method'); // `Array.from` method implementation // https://tc39.github.io/ecma262/#sec-array.from module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { var O = toObject(arrayLike); var C = typeof this == 'function' ? this : Array; var argumentsLength = arguments.length; var mapfn = argumentsLength > 1 ? arguments[1] : undefined; var mapping = mapfn !== undefined; var iteratorMethod = getIteratorMethod(O); var index = 0; var length, result, step, iterator, next, value; if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); // if the target is not iterable or it's an array with the default iterator - use a simple case if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) { iterator = iteratorMethod.call(O); next = iterator.next; result = new C(); for (;!(step = next.call(iterator)).done; index++) { value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; createProperty(result, index, value); } } else { length = toLength(O.length); result = new C(length); for (;length > index; index++) { value = mapping ? mapfn(O[index], index) : O[index]; createProperty(result, index, value); } } result.length = index; return result; }; },{"../internals/call-with-safe-iteration-closing":8,"../internals/create-property":16,"../internals/function-bind-context":23,"../internals/get-iterator-method":25,"../internals/is-array-iterator-method":35,"../internals/to-length":71,"../internals/to-object":72}],7:[function(require,module,exports){ var toIndexedObject = require('../internals/to-indexed-object'); var toLength = require('../internals/to-length'); var toAbsoluteIndex = require('../internals/to-absolute-index'); // `Array.prototype.{ indexOf, includes }` methods implementation var createMethod = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIndexedObject($this); var length = toLength(O.length); var index = toAbsoluteIndex(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) { if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; module.exports = { // `Array.prototype.includes` method // https://tc39.github.io/ecma262/#sec-array.prototype.includes includes: createMethod(true), // `Array.prototype.indexOf` method // https://tc39.github.io/ecma262/#sec-array.prototype.indexof indexOf: createMethod(false) }; },{"../internals/to-absolute-index":68,"../internals/to-indexed-object":69,"../internals/to-length":71}],8:[function(require,module,exports){ var anObject = require('../internals/an-object'); // call something on iterator step with safe closing on error module.exports = function (iterator, fn, value, ENTRIES) { try { return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion) } catch (error) { var returnMethod = iterator['return']; if (returnMethod !== undefined) anObject(returnMethod.call(iterator)); throw error; } }; },{"../internals/an-object":5}],9:[function(require,module,exports){ var toString = {}.toString; module.exports = function (it) { return toString.call(it).slice(8, -1); }; },{}],10:[function(require,module,exports){ var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support'); var classofRaw = require('../internals/classof-raw'); var wellKnownSymbol = require('../internals/well-known-symbol'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); // ES3 wrong here var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function (it, key) { try { return it[key]; } catch (error) { /* empty */ } }; // getting tag from ES6+ `Object.prototype.toString` module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) { var O, tag, result; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag // builtinTag case : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result; }; },{"../internals/classof-raw":9,"../internals/to-string-tag-support":74,"../internals/well-known-symbol":77}],11:[function(require,module,exports){ var has = require('../internals/has'); var ownKeys = require('../internals/own-keys'); var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); var definePropertyModule = require('../internals/object-define-property'); module.exports = function (target, source) { var keys = ownKeys(source); var defineProperty = definePropertyModule.f; var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } }; },{"../internals/has":28,"../internals/object-define-property":47,"../internals/object-get-own-property-descriptor":48,"../internals/own-keys":56}],12:[function(require,module,exports){ var fails = require('../internals/fails'); module.exports = !fails(function () { function F() { /* empty */ } F.prototype.constructor = null; return Object.getPrototypeOf(new F()) !== F.prototype; }); },{"../internals/fails":22}],13:[function(require,module,exports){ 'use strict'; var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype; var create = require('../internals/object-create'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); var setToStringTag = require('../internals/set-to-string-tag'); var Iterators = require('../internals/iterators'); var returnThis = function () { return this; }; module.exports = function (IteratorConstructor, NAME, next) { var TO_STRING_TAG = NAME + ' Iterator'; IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) }); setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true); Iterators[TO_STRING_TAG] = returnThis; return IteratorConstructor; }; },{"../internals/create-property-descriptor":15,"../internals/iterators":40,"../internals/iterators-core":39,"../internals/object-create":45,"../internals/set-to-string-tag":62}],14:[function(require,module,exports){ var DESCRIPTORS = require('../internals/descriptors'); var definePropertyModule = require('../internals/object-define-property'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); module.exports = DESCRIPTORS ? function (object, key, value) { return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); } : function (object, key, value) { object[key] = value; return object; }; },{"../internals/create-property-descriptor":15,"../internals/descriptors":18,"../internals/object-define-property":47}],15:[function(require,module,exports){ module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; },{}],16:[function(require,module,exports){ 'use strict'; var toPrimitive = require('../internals/to-primitive'); var definePropertyModule = require('../internals/object-define-property'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); module.exports = function (object, key, value) { var propertyKey = toPrimitive(key); if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value)); else object[propertyKey] = value; }; },{"../internals/create-property-descriptor":15,"../internals/object-define-property":47,"../internals/to-primitive":73}],17:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); var createIteratorConstructor = require('../internals/create-iterator-constructor'); var getPrototypeOf = require('../internals/object-get-prototype-of'); var setPrototypeOf = require('../internals/object-set-prototype-of'); var setToStringTag = require('../internals/set-to-string-tag'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var redefine = require('../internals/redefine'); var wellKnownSymbol = require('../internals/well-known-symbol'); var IS_PURE = require('../internals/is-pure'); var Iterators = require('../internals/iterators'); var IteratorsCore = require('../internals/iterators-core'); var IteratorPrototype = IteratorsCore.IteratorPrototype; var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; var ITERATOR = wellKnownSymbol('iterator'); var KEYS = 'keys'; var VALUES = 'values'; var ENTRIES = 'entries'; var returnThis = function () { return this; }; module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { createIteratorConstructor(IteratorConstructor, NAME, next); var getIterationMethod = function (KIND) { if (KIND === DEFAULT && defaultIterator) return defaultIterator; if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND]; switch (KIND) { case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; } return function () { return new IteratorConstructor(this); }; }; var TO_STRING_TAG = NAME + ' Iterator'; var INCORRECT_VALUES_NAME = false; var IterablePrototype = Iterable.prototype; var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT]; var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; var CurrentIteratorPrototype, methods, KEY; // fix native if (anyNativeIterator) { CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable())); if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { if (setPrototypeOf) { setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype); } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') { createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis); } } // Set @@toStringTag to native iterators setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true); if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis; } } // fix Array#{values, @@iterator}.name in V8 / FF if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { INCORRECT_VALUES_NAME = true; defaultIterator = function values() { return nativeIterator.call(this); }; } // define iterator if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) { createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator); } Iterators[NAME] = defaultIterator; // export additional methods if (DEFAULT) { methods = { values: getIterationMethod(VALUES), keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), entries: getIterationMethod(ENTRIES) }; if (FORCED) for (KEY in methods) { if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { redefine(IterablePrototype, KEY, methods[KEY]); } } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); } return methods; }; },{"../internals/create-iterator-constructor":13,"../internals/create-non-enumerable-property":14,"../internals/export":21,"../internals/is-pure":38,"../internals/iterators":40,"../internals/iterators-core":39,"../internals/object-get-prototype-of":51,"../internals/object-set-prototype-of":55,"../internals/redefine":59,"../internals/set-to-string-tag":62,"../internals/well-known-symbol":77}],18:[function(require,module,exports){ var fails = require('../internals/fails'); // Thank's IE8 for his funny defineProperty module.exports = !fails(function () { return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); },{"../internals/fails":22}],19:[function(require,module,exports){ var global = require('../internals/global'); var isObject = require('../internals/is-object'); var document = global.document; // typeof document.createElement is 'object' in old IE var EXISTS = isObject(document) && isObject(document.createElement); module.exports = function (it) { return EXISTS ? document.createElement(it) : {}; }; },{"../internals/global":27,"../internals/is-object":37}],20:[function(require,module,exports){ // IE8- don't enum bug keys module.exports = [ 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf' ]; },{}],21:[function(require,module,exports){ var global = require('../internals/global'); var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var redefine = require('../internals/redefine'); var setGlobal = require('../internals/set-global'); var copyConstructorProperties = require('../internals/copy-constructor-properties'); var isForced = require('../internals/is-forced'); /* options.target - name of the target object options.global - target is the global object options.stat - export as static methods of target options.proto - export as prototype methods of target options.real - real prototype method for the `pure` version options.forced - export even if the native feature is available options.bind - bind methods to the target, required for the `pure` version options.wrap - wrap constructors to preventing global pollution, required for the `pure` version options.unsafe - use the simple assignment of property instead of delete + defineProperty options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.noTargetGet - prevent calling a getter on target */ module.exports = function (options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var FORCED, target, key, targetProperty, sourceProperty, descriptor; if (GLOBAL) { target = global; } else if (STATIC) { target = global[TARGET] || setGlobal(TARGET, {}); } else { target = (global[TARGET] || {}).prototype; } if (target) for (key in source) { sourceProperty = source[key]; if (options.noTargetGet) { descriptor = getOwnPropertyDescriptor(target, key); targetProperty = descriptor && descriptor.value; } else targetProperty = target[key]; FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contained in target if (!FORCED && targetProperty !== undefined) { if (typeof sourceProperty === typeof targetProperty) continue; copyConstructorProperties(sourceProperty, targetProperty); } // add a flag to not completely full polyfills if (options.sham || (targetProperty && targetProperty.sham)) { createNonEnumerableProperty(sourceProperty, 'sham', true); } // extend global redefine(target, key, sourceProperty, options); } }; },{"../internals/copy-constructor-properties":11,"../internals/create-non-enumerable-property":14,"../internals/global":27,"../internals/is-forced":36,"../internals/object-get-own-property-descriptor":48,"../internals/redefine":59,"../internals/set-global":61}],22:[function(require,module,exports){ module.exports = function (exec) { try { return !!exec(); } catch (error) { return true; } }; },{}],23:[function(require,module,exports){ var aFunction = require('../internals/a-function'); // optional / simple context binding module.exports = function (fn, that, length) { aFunction(fn); if (that === undefined) return fn; switch (length) { case 0: return function () { return fn.call(that); }; case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; },{"../internals/a-function":1}],24:[function(require,module,exports){ var path = require('../internals/path'); var global = require('../internals/global'); var aFunction = function (variable) { return typeof variable == 'function' ? variable : undefined; }; module.exports = function (namespace, method) { return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace]) : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method]; }; },{"../internals/global":27,"../internals/path":57}],25:[function(require,module,exports){ var classof = require('../internals/classof'); var Iterators = require('../internals/iterators'); var wellKnownSymbol = require('../internals/well-known-symbol'); var ITERATOR = wellKnownSymbol('iterator'); module.exports = function (it) { if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; },{"../internals/classof":10,"../internals/iterators":40,"../internals/well-known-symbol":77}],26:[function(require,module,exports){ var anObject = require('../internals/an-object'); var getIteratorMethod = require('../internals/get-iterator-method'); module.exports = function (it) { var iteratorMethod = getIteratorMethod(it); if (typeof iteratorMethod != 'function') { throw TypeError(String(it) + ' is not iterable'); } return anObject(iteratorMethod.call(it)); }; },{"../internals/an-object":5,"../internals/get-iterator-method":25}],27:[function(require,module,exports){ (function (global){ var check = function (it) { return it && it.Math == Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 module.exports = // eslint-disable-next-line no-undef check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || // eslint-disable-next-line no-new-func Function('return this')(); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],28:[function(require,module,exports){ var hasOwnProperty = {}.hasOwnProperty; module.exports = function (it, key) { return hasOwnProperty.call(it, key); }; },{}],29:[function(require,module,exports){ module.exports = {}; },{}],30:[function(require,module,exports){ var getBuiltIn = require('../internals/get-built-in'); module.exports = getBuiltIn('document', 'documentElement'); },{"../internals/get-built-in":24}],31:[function(require,module,exports){ var DESCRIPTORS = require('../internals/descriptors'); var fails = require('../internals/fails'); var createElement = require('../internals/document-create-element'); // Thank's IE8 for his funny defineProperty module.exports = !DESCRIPTORS && !fails(function () { return Object.defineProperty(createElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); },{"../internals/descriptors":18,"../internals/document-create-element":19,"../internals/fails":22}],32:[function(require,module,exports){ var fails = require('../internals/fails'); var classof = require('../internals/classof-raw'); var split = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings module.exports = fails(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins return !Object('z').propertyIsEnumerable(0); }) ? function (it) { return classof(it) == 'String' ? split.call(it, '') : Object(it); } : Object; },{"../internals/classof-raw":9,"../internals/fails":22}],33:[function(require,module,exports){ var store = require('../internals/shared-store'); var functionToString = Function.toString; // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper if (typeof store.inspectSource != 'function') { store.inspectSource = function (it) { return functionToString.call(it); }; } module.exports = store.inspectSource; },{"../internals/shared-store":64}],34:[function(require,module,exports){ var NATIVE_WEAK_MAP = require('../internals/native-weak-map'); var global = require('../internals/global'); var isObject = require('../internals/is-object'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var objectHas = require('../internals/has'); var sharedKey = require('../internals/shared-key'); var hiddenKeys = require('../internals/hidden-keys'); var WeakMap = global.WeakMap; var set, get, has; var enforce = function (it) { return has(it) ? get(it) : set(it, {}); }; var getterFor = function (TYPE) { return function (it) { var state; if (!isObject(it) || (state = get(it)).type !== TYPE) { throw TypeError('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; if (NATIVE_WEAK_MAP) { var store = new WeakMap(); var wmget = store.get; var wmhas = store.has; var wmset = store.set; set = function (it, metadata) { wmset.call(store, it, metadata); return metadata; }; get = function (it) { return wmget.call(store, it) || {}; }; has = function (it) { return wmhas.call(store, it); }; } else { var STATE = sharedKey('state'); hiddenKeys[STATE] = true; set = function (it, metadata) { createNonEnumerableProperty(it, STATE, metadata); return metadata; }; get = function (it) { return objectHas(it, STATE) ? it[STATE] : {}; }; has = function (it) { return objectHas(it, STATE); }; } module.exports = { set: set, get: get, has: has, enforce: enforce, getterFor: getterFor }; },{"../internals/create-non-enumerable-property":14,"../internals/global":27,"../internals/has":28,"../internals/hidden-keys":29,"../internals/is-object":37,"../internals/native-weak-map":43,"../internals/shared-key":63}],35:[function(require,module,exports){ var wellKnownSymbol = require('../internals/well-known-symbol'); var Iterators = require('../internals/iterators'); var ITERATOR = wellKnownSymbol('iterator'); var ArrayPrototype = Array.prototype; // check on default Array iterator module.exports = function (it) { return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it); }; },{"../internals/iterators":40,"../internals/well-known-symbol":77}],36:[function(require,module,exports){ var fails = require('../internals/fails'); var replacement = /#|\.prototype\./; var isForced = function (feature, detection) { var value = data[normalize(feature)]; return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection; }; var normalize = isForced.normalize = function (string) { return String(string).replace(replacement, '.').toLowerCase(); }; var data = isForced.data = {}; var NATIVE = isForced.NATIVE = 'N'; var POLYFILL = isForced.POLYFILL = 'P'; module.exports = isForced; },{"../internals/fails":22}],37:[function(require,module,exports){ module.exports = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; },{}],38:[function(require,module,exports){ module.exports = false; },{}],39:[function(require,module,exports){ 'use strict'; var getPrototypeOf = require('../internals/object-get-prototype-of'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var has = require('../internals/has'); var wellKnownSymbol = require('../internals/well-known-symbol'); var IS_PURE = require('../internals/is-pure'); var ITERATOR = wellKnownSymbol('iterator'); var BUGGY_SAFARI_ITERATORS = false; var returnThis = function () { return this; }; // `%IteratorPrototype%` object // https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; if ([].keys) { arrayIterator = [].keys(); // Safari 8 has buggy iterators w/o `next` if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; else { PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator)); if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype; } } if (IteratorPrototype == undefined) IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) { createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis); } module.exports = { IteratorPrototype: IteratorPrototype, BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS }; },{"../internals/create-non-enumerable-property":14,"../internals/has":28,"../internals/is-pure":38,"../internals/object-get-prototype-of":51,"../internals/well-known-symbol":77}],40:[function(require,module,exports){ arguments[4][29][0].apply(exports,arguments) },{"dup":29}],41:[function(require,module,exports){ var fails = require('../internals/fails'); module.exports = !!Object.getOwnPropertySymbols && !fails(function () { // Chrome 38 Symbol has incorrect toString conversion // eslint-disable-next-line no-undef return !String(Symbol()); }); },{"../internals/fails":22}],42:[function(require,module,exports){ var fails = require('../internals/fails'); var wellKnownSymbol = require('../internals/well-known-symbol'); var IS_PURE = require('../internals/is-pure'); var ITERATOR = wellKnownSymbol('iterator'); module.exports = !fails(function () { var url = new URL('b?a=1&b=2&c=3', 'http://a'); var searchParams = url.searchParams; var result = ''; url.pathname = 'c%20d'; searchParams.forEach(function (value, key) { searchParams['delete']('b'); result += key + value; }); return (IS_PURE && !url.toJSON) || !searchParams.sort || url.href !== 'http://a/c%20d?a=1&c=3' || searchParams.get('c') !== '3' || String(new URLSearchParams('?a=1')) !== 'a=1' || !searchParams[ITERATOR] // throws in Edge || new URL('https://a@b').username !== 'a' || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' // not punycoded in Edge || new URL('http://тест').host !== 'xn--e1aybc' // not escaped in Chrome 62- || new URL('http://a#б').hash !== '#%D0%B1' // fails in Chrome 66- || result !== 'a1c3' // throws in Safari || new URL('http://x', undefined).host !== 'x'; }); },{"../internals/fails":22,"../internals/is-pure":38,"../internals/well-known-symbol":77}],43:[function(require,module,exports){ var global = require('../internals/global'); var inspectSource = require('../internals/inspect-source'); var WeakMap = global.WeakMap; module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap)); },{"../internals/global":27,"../internals/inspect-source":33}],44:[function(require,module,exports){ 'use strict'; var DESCRIPTORS = require('../internals/descriptors'); var fails = require('../internals/fails'); var objectKeys = require('../internals/object-keys'); var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols'); var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable'); var toObject = require('../internals/to-object'); var IndexedObject = require('../internals/indexed-object'); var nativeAssign = Object.assign; var defineProperty = Object.defineProperty; // `Object.assign` method // https://tc39.github.io/ecma262/#sec-object.assign module.exports = !nativeAssign || fails(function () { // should have correct order of operations (Edge bug) if (DESCRIPTORS && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', { enumerable: true, get: function () { defineProperty(this, 'b', { value: 3, enumerable: false }); } }), { b: 2 })).b !== 1) return true; // should work with symbols and should have deterministic property order (V8 bug) var A = {}; var B = {}; // eslint-disable-next-line no-undef var symbol = Symbol(); var alphabet = 'abcdefghijklmnopqrst'; A[symbol] = 7; alphabet.split('').forEach(function (chr) { B[chr] = chr; }); return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet; }) ? function assign(target, source) { // eslint-disable-line no-unused-vars var T = toObject(target); var argumentsLength = arguments.length; var index = 1; var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; var propertyIsEnumerable = propertyIsEnumerableModule.f; while (argumentsLength > index) { var S = IndexedObject(arguments[index++]); var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S); var length = keys.length; var j = 0; var key; while (length > j) { key = keys[j++]; if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key]; } } return T; } : nativeAssign; },{"../internals/descriptors":18,"../internals/fails":22,"../internals/indexed-object":32,"../internals/object-get-own-property-symbols":50,"../internals/object-keys":53,"../internals/object-property-is-enumerable":54,"../internals/to-object":72}],45:[function(require,module,exports){ var anObject = require('../internals/an-object'); var defineProperties = require('../internals/object-define-properties'); var enumBugKeys = require('../internals/enum-bug-keys'); var hiddenKeys = require('../internals/hidden-keys'); var html = require('../internals/html'); var documentCreateElement = require('../internals/document-create-element'); var sharedKey = require('../internals/shared-key'); var GT = '>'; var LT = '<'; var PROTOTYPE = 'prototype'; var SCRIPT = 'script'; var IE_PROTO = sharedKey('IE_PROTO'); var EmptyConstructor = function () { /* empty */ }; var scriptTag = function (content) { return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; }; // Create object with fake `null` prototype: use ActiveX Object with cleared prototype var NullProtoObjectViaActiveX = function (activeXDocument) { activeXDocument.write(scriptTag('')); activeXDocument.close(); var temp = activeXDocument.parentWindow.Object; activeXDocument = null; // avoid memory leak return temp; }; // Create object with fake `null` prototype: use iframe Object with cleared prototype var NullProtoObjectViaIFrame = function () { // Thrash, waste and sodomy: IE GC bug var iframe = documentCreateElement('iframe'); var JS = 'java' + SCRIPT + ':'; var iframeDocument; iframe.style.display = 'none'; html.appendChild(iframe); // https://github.com/zloirock/core-js/issues/475 iframe.src = String(JS); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(scriptTag('document.F=Object')); iframeDocument.close(); return iframeDocument.F; }; // Check for document.domain and active x support // No need to use active x approach when document.domain is not set // see https://github.com/es-shims/es5-shim/issues/150 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 // avoid IE GC bug var activeXDocument; var NullProtoObject = function () { try { /* global ActiveXObject */ activeXDocument = document.domain && new ActiveXObject('htmlfile'); } catch (error) { /* ignore */ } NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame(); var length = enumBugKeys.length; while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; return NullProtoObject(); }; hiddenKeys[IE_PROTO] = true; // `Object.create` method // https://tc39.github.io/ecma262/#sec-object.create module.exports = Object.create || function create(O, Properties) { var result; if (O !== null) { EmptyConstructor[PROTOTYPE] = anObject(O); result = new EmptyConstructor(); EmptyConstructor[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = NullProtoObject(); return Properties === undefined ? result : defineProperties(result, Properties); }; },{"../internals/an-object":5,"../internals/document-create-element":19,"../internals/enum-bug-keys":20,"../internals/hidden-keys":29,"../internals/html":30,"../internals/object-define-properties":46,"../internals/shared-key":63}],46:[function(require,module,exports){ var DESCRIPTORS = require('../internals/descriptors'); var definePropertyModule = require('../internals/object-define-property'); var anObject = require('../internals/an-object'); var objectKeys = require('../internals/object-keys'); // `Object.defineProperties` method // https://tc39.github.io/ecma262/#sec-object.defineproperties module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = objectKeys(Properties); var length = keys.length; var index = 0; var key; while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]); return O; }; },{"../internals/an-object":5,"../internals/descriptors":18,"../internals/object-define-property":47,"../internals/object-keys":53}],47:[function(require,module,exports){ var DESCRIPTORS = require('../internals/descriptors'); var IE8_DOM_DEFINE = require('../internals/ie8-dom-define'); var anObject = require('../internals/an-object'); var toPrimitive = require('../internals/to-primitive'); var nativeDefineProperty = Object.defineProperty; // `Object.defineProperty` method // https://tc39.github.io/ecma262/#sec-object.defineproperty exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (IE8_DOM_DEFINE) try { return nativeDefineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; },{"../internals/an-object":5,"../internals/descriptors":18,"../internals/ie8-dom-define":31,"../internals/to-primitive":73}],48:[function(require,module,exports){ var DESCRIPTORS = require('../internals/descriptors'); var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); var toIndexedObject = require('../internals/to-indexed-object'); var toPrimitive = require('../internals/to-primitive'); var has = require('../internals/has'); var IE8_DOM_DEFINE = require('../internals/ie8-dom-define'); var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPrimitive(P, true); if (IE8_DOM_DEFINE) try { return nativeGetOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]); }; },{"../internals/create-property-descriptor":15,"../internals/descriptors":18,"../internals/has":28,"../internals/ie8-dom-define":31,"../internals/object-property-is-enumerable":54,"../internals/to-indexed-object":69,"../internals/to-primitive":73}],49:[function(require,module,exports){ var internalObjectKeys = require('../internals/object-keys-internal'); var enumBugKeys = require('../internals/enum-bug-keys'); var hiddenKeys = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method // https://tc39.github.io/ecma262/#sec-object.getownpropertynames exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return internalObjectKeys(O, hiddenKeys); }; },{"../internals/enum-bug-keys":20,"../internals/object-keys-internal":52}],50:[function(require,module,exports){ exports.f = Object.getOwnPropertySymbols; },{}],51:[function(require,module,exports){ var has = require('../internals/has'); var toObject = require('../internals/to-object'); var sharedKey = require('../internals/shared-key'); var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter'); var IE_PROTO = sharedKey('IE_PROTO'); var ObjectPrototype = Object.prototype; // `Object.getPrototypeOf` method // https://tc39.github.io/ecma262/#sec-object.getprototypeof module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) { O = toObject(O); if (has(O, IE_PROTO)) return O[IE_PROTO]; if (typeof O.constructor == 'function' && O instanceof O.constructor) { return O.constructor.prototype; } return O instanceof Object ? ObjectPrototype : null; }; },{"../internals/correct-prototype-getter":12,"../internals/has":28,"../internals/shared-key":63,"../internals/to-object":72}],52:[function(require,module,exports){ var has = require('../internals/has'); var toIndexedObject = require('../internals/to-indexed-object'); var indexOf = require('../internals/array-includes').indexOf; var hiddenKeys = require('../internals/hidden-keys'); module.exports = function (object, names) { var O = toIndexedObject(object); var i = 0; var result = []; var key; for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); // Don't enum bug & hidden keys while (names.length > i) if (has(O, key = names[i++])) { ~indexOf(result, key) || result.push(key); } return result; }; },{"../internals/array-includes":7,"../internals/has":28,"../internals/hidden-keys":29,"../internals/to-indexed-object":69}],53:[function(require,module,exports){ var internalObjectKeys = require('../internals/object-keys-internal'); var enumBugKeys = require('../internals/enum-bug-keys'); // `Object.keys` method // https://tc39.github.io/ecma262/#sec-object.keys module.exports = Object.keys || function keys(O) { return internalObjectKeys(O, enumBugKeys); }; },{"../internals/enum-bug-keys":20,"../internals/object-keys-internal":52}],54:[function(require,module,exports){ 'use strict'; var nativePropertyIsEnumerable = {}.propertyIsEnumerable; var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor(this, V); return !!descriptor && descriptor.enumerable; } : nativePropertyIsEnumerable; },{}],55:[function(require,module,exports){ var anObject = require('../internals/an-object'); var aPossiblePrototype = require('../internals/a-possible-prototype'); // `Object.setPrototypeOf` method // https://tc39.github.io/ecma262/#sec-object.setprototypeof // Works with __proto__ only. Old v8 can't work with null proto objects. /* eslint-disable no-proto */ module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { var CORRECT_SETTER = false; var test = {}; var setter; try { setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; setter.call(test, []); CORRECT_SETTER = test instanceof Array; } catch (error) { /* empty */ } return function setPrototypeOf(O, proto) { anObject(O); aPossiblePrototype(proto); if (CORRECT_SETTER) setter.call(O, proto); else O.__proto__ = proto; return O; }; }() : undefined); },{"../internals/a-possible-prototype":2,"../internals/an-object":5}],56:[function(require,module,exports){ var getBuiltIn = require('../internals/get-built-in'); var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names'); var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols'); var anObject = require('../internals/an-object'); // all object keys, includes non-enumerable and symbols module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { var keys = getOwnPropertyNamesModule.f(anObject(it)); var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; }; },{"../internals/an-object":5,"../internals/get-built-in":24,"../internals/object-get-own-property-names":49,"../internals/object-get-own-property-symbols":50}],57:[function(require,module,exports){ var global = require('../internals/global'); module.exports = global; },{"../internals/global":27}],58:[function(require,module,exports){ var redefine = require('../internals/redefine'); module.exports = function (target, src, options) { for (var key in src) redefine(target, key, src[key], options); return target; }; },{"../internals/redefine":59}],59:[function(require,module,exports){ var global = require('../internals/global'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var has = require('../internals/has'); var setGlobal = require('../internals/set-global'); var inspectSource = require('../internals/inspect-source'); var InternalStateModule = require('../internals/internal-state'); var getInternalState = InternalStateModule.get; var enforceInternalState = InternalStateModule.enforce; var TEMPLATE = String(String).split('String'); (module.exports = function (O, key, value, options) { var unsafe = options ? !!options.unsafe : false; var simple = options ? !!options.enumerable : false; var noTargetGet = options ? !!options.noTargetGet : false; if (typeof value == 'function') { if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key); enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : ''); } if (O === global) { if (simple) O[key] = value; else setGlobal(key, value); return; } else if (!unsafe) { delete O[key]; } else if (!noTargetGet && O[key]) { simple = true; } if (simple) O[key] = value; else createNonEnumerableProperty(O, key, value); // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, 'toString', function toString() { return typeof this == 'function' && getInternalState(this).source || inspectSource(this); }); },{"../internals/create-non-enumerable-property":14,"../internals/global":27,"../internals/has":28,"../internals/inspect-source":33,"../internals/internal-state":34,"../internals/set-global":61}],60:[function(require,module,exports){ // `RequireObjectCoercible` abstract operation // https://tc39.github.io/ecma262/#sec-requireobjectcoercible module.exports = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; },{}],61:[function(require,module,exports){ var global = require('../internals/global'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); module.exports = function (key, value) { try { createNonEnumerableProperty(global, key, value); } catch (error) { global[key] = value; } return value; }; },{"../internals/create-non-enumerable-property":14,"../internals/global":27}],62:[function(require,module,exports){ var defineProperty = require('../internals/object-define-property').f; var has = require('../internals/has'); var wellKnownSymbol = require('../internals/well-known-symbol'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); module.exports = function (it, TAG, STATIC) { if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) { defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG }); } }; },{"../internals/has":28,"../internals/object-define-property":47,"../internals/well-known-symbol":77}],63:[function(require,module,exports){ var shared = require('../internals/shared'); var uid = require('../internals/uid'); var keys = shared('keys'); module.exports = function (key) { return keys[key] || (keys[key] = uid(key)); }; },{"../internals/shared":65,"../internals/uid":75}],64:[function(require,module,exports){ var global = require('../internals/global'); var setGlobal = require('../internals/set-global'); var SHARED = '__core-js_shared__'; var store = global[SHARED] || setGlobal(SHARED, {}); module.exports = store; },{"../internals/global":27,"../internals/set-global":61}],65:[function(require,module,exports){ var IS_PURE = require('../internals/is-pure'); var store = require('../internals/shared-store'); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ version: '3.6.4', mode: IS_PURE ? 'pure' : 'global', copyright: '© 2020 Denis Pushkarev (zloirock.ru)' }); },{"../internals/is-pure":38,"../internals/shared-store":64}],66:[function(require,module,exports){ var toInteger = require('../internals/to-integer'); var requireObjectCoercible = require('../internals/require-object-coercible'); // `String.prototype.{ codePointAt, at }` methods implementation var createMethod = function (CONVERT_TO_STRING) { return function ($this, pos) { var S = String(requireObjectCoercible($this)); var position = toInteger(pos); var size = S.length; var first, second; if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; first = S.charCodeAt(position); return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? S.charAt(position) : first : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; }; }; module.exports = { // `String.prototype.codePointAt` method // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat codeAt: createMethod(false), // `String.prototype.at` method // https://github.com/mathiasbynens/String.prototype.at charAt: createMethod(true) }; },{"../internals/require-object-coercible":60,"../internals/to-integer":70}],67:[function(require,module,exports){ 'use strict'; // based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 var base = 36; var tMin = 1; var tMax = 26; var skew = 38; var damp = 700; var initialBias = 72; var initialN = 128; // 0x80 var delimiter = '-'; // '\x2D' var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process'; var baseMinusTMin = base - tMin; var floor = Math.floor; var stringFromCharCode = String.fromCharCode; /** * Creates an array containing the numeric code points of each Unicode * character in the string. While JavaScript uses UCS-2 internally, * this function will convert a pair of surrogate halves (each of which * UCS-2 exposes as separate characters) into a single code point, * matching UTF-16. */ var ucs2decode = function (string) { var output = []; var counter = 0; var length = string.length; while (counter < length) { var value = string.charCodeAt(counter++); if (value >= 0xD800 && value <= 0xDBFF && counter < length) { // It's a high surrogate, and there is a next character. var extra = string.charCodeAt(counter++); if ((extra & 0xFC00) == 0xDC00) { // Low surrogate. output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); } else { // It's an unmatched surrogate; only append this code unit, in case the // next code unit is the high surrogate of a surrogate pair. output.push(value); counter--; } } else { output.push(value); } } return output; }; /** * Converts a digit/integer into a basic code point. */ var digitToBasic = function (digit) { // 0..25 map to ASCII a..z or A..Z // 26..35 map to ASCII 0..9 return digit + 22 + 75 * (digit < 26); }; /** * Bias adaptation function as per section 3.4 of RFC 3492. * https://tools.ietf.org/html/rfc3492#section-3.4 */ var adapt = function (delta, numPoints, firstTime) { var k = 0; delta = firstTime ? floor(delta / damp) : delta >> 1; delta += floor(delta / numPoints); for (; delta > baseMinusTMin * tMax >> 1; k += base) { delta = floor(delta / baseMinusTMin); } return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); }; /** * Converts a string of Unicode symbols (e.g. a domain name label) to a * Punycode string of ASCII-only symbols. */ // eslint-disable-next-line max-statements var encode = function (input) { var output = []; // Convert the input in UCS-2 to an array of Unicode code points. input = ucs2decode(input); // Cache the length. var inputLength = input.length; // Initialize the state. var n = initialN; var delta = 0; var bias = initialBias; var i, currentValue; // Handle the basic code points. for (i = 0; i < input.length; i++) { currentValue = input[i]; if (currentValue < 0x80) { output.push(stringFromCharCode(currentValue)); } } var basicLength = output.length; // number of basic code points. var handledCPCount = basicLength; // number of code points that have been handled; // Finish the basic string with a delimiter unless it's empty. if (basicLength) { output.push(delimiter); } // Main encoding loop: while (handledCPCount < inputLength) { // All non-basic code points < n have been handled already. Find the next larger one: var m = maxInt; for (i = 0; i < input.length; i++) { currentValue = input[i]; if (currentValue >= n && currentValue < m) { m = currentValue; } } // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, but guard against overflow. var handledCPCountPlusOne = handledCPCount + 1; if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { throw RangeError(OVERFLOW_ERROR); } delta += (m - n) * handledCPCountPlusOne; n = m; for (i = 0; i < input.length; i++) { currentValue = input[i]; if (currentValue < n && ++delta > maxInt) { throw RangeError(OVERFLOW_ERROR); } if (currentValue == n) { // Represent delta as a generalized variable-length integer. var q = delta; for (var k = base; /* no condition */; k += base) { var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); if (q < t) break; var qMinusT = q - t; var baseMinusT = base - t; output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT))); q = floor(qMinusT / baseMinusT); } output.push(stringFromCharCode(digitToBasic(q))); bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); delta = 0; ++handledCPCount; } } ++delta; ++n; } return output.join(''); }; module.exports = function (input) { var encoded = []; var labels = input.toLowerCase().replace(regexSeparators, '\u002E').split('.'); var i, label; for (i = 0; i < labels.length; i++) { label = labels[i]; encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label); } return encoded.join('.'); }; },{}],68:[function(require,module,exports){ var toInteger = require('../internals/to-integer'); var max = Math.max; var min = Math.min; // Helper for a popular repeating case of the spec: // Let integer be ? ToInteger(index). // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). module.exports = function (index, length) { var integer = toInteger(index); return integer < 0 ? max(integer + length, 0) : min(integer, length); }; },{"../internals/to-integer":70}],69:[function(require,module,exports){ // toObject with fallback for non-array-like ES3 strings var IndexedObject = require('../internals/indexed-object'); var requireObjectCoercible = require('../internals/require-object-coercible'); module.exports = function (it) { return IndexedObject(requireObjectCoercible(it)); }; },{"../internals/indexed-object":32,"../internals/require-object-coercible":60}],70:[function(require,module,exports){ var ceil = Math.ceil; var floor = Math.floor; // `ToInteger` abstract operation // https://tc39.github.io/ecma262/#sec-tointeger module.exports = function (argument) { return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); }; },{}],71:[function(require,module,exports){ var toInteger = require('../internals/to-integer'); var min = Math.min; // `ToLength` abstract operation // https://tc39.github.io/ecma262/#sec-tolength module.exports = function (argument) { return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; },{"../internals/to-integer":70}],72:[function(require,module,exports){ var requireObjectCoercible = require('../internals/require-object-coercible'); // `ToObject` abstract operation // https://tc39.github.io/ecma262/#sec-toobject module.exports = function (argument) { return Object(requireObjectCoercible(argument)); }; },{"../internals/require-object-coercible":60}],73:[function(require,module,exports){ var isObject = require('../internals/is-object'); // `ToPrimitive` abstract operation // https://tc39.github.io/ecma262/#sec-toprimitive // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function (input, PREFERRED_STRING) { if (!isObject(input)) return input; var fn, val; if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; throw TypeError("Can't convert object to primitive value"); }; },{"../internals/is-object":37}],74:[function(require,module,exports){ var wellKnownSymbol = require('../internals/well-known-symbol'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var test = {}; test[TO_STRING_TAG] = 'z'; module.exports = String(test) === '[object z]'; },{"../internals/well-known-symbol":77}],75:[function(require,module,exports){ var id = 0; var postfix = Math.random(); module.exports = function (key) { return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); }; },{}],76:[function(require,module,exports){ var NATIVE_SYMBOL = require('../internals/native-symbol'); module.exports = NATIVE_SYMBOL // eslint-disable-next-line no-undef && !Symbol.sham // eslint-disable-next-line no-undef && typeof Symbol.iterator == 'symbol'; },{"../internals/native-symbol":41}],77:[function(require,module,exports){ var global = require('../internals/global'); var shared = require('../internals/shared'); var has = require('../internals/has'); var uid = require('../internals/uid'); var NATIVE_SYMBOL = require('../internals/native-symbol'); var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid'); var WellKnownSymbolsStore = shared('wks'); var Symbol = global.Symbol; var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid; module.exports = function (name) { if (!has(WellKnownSymbolsStore, name)) { if (NATIVE_SYMBOL && has(Symbol, name)) WellKnownSymbolsStore[name] = Symbol[name]; else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); } return WellKnownSymbolsStore[name]; }; },{"../internals/global":27,"../internals/has":28,"../internals/native-symbol":41,"../internals/shared":65,"../internals/uid":75,"../internals/use-symbol-as-uid":76}],78:[function(require,module,exports){ 'use strict'; var toIndexedObject = require('../internals/to-indexed-object'); var addToUnscopables = require('../internals/add-to-unscopables'); var Iterators = require('../internals/iterators'); var InternalStateModule = require('../internals/internal-state'); var defineIterator = require('../internals/define-iterator'); var ARRAY_ITERATOR = 'Array Iterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR); // `Array.prototype.entries` method // https://tc39.github.io/ecma262/#sec-array.prototype.entries // `Array.prototype.keys` method // https://tc39.github.io/ecma262/#sec-array.prototype.keys // `Array.prototype.values` method // https://tc39.github.io/ecma262/#sec-array.prototype.values // `Array.prototype[@@iterator]` method // https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator // `CreateArrayIterator` internal method // https://tc39.github.io/ecma262/#sec-createarrayiterator module.exports = defineIterator(Array, 'Array', function (iterated, kind) { setInternalState(this, { type: ARRAY_ITERATOR, target: toIndexedObject(iterated), // target index: 0, // next index kind: kind // kind }); // `%ArrayIteratorPrototype%.next` method // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next }, function () { var state = getInternalState(this); var target = state.target; var kind = state.kind; var index = state.index++; if (!target || index >= target.length) { state.target = undefined; return { value: undefined, done: true }; } if (kind == 'keys') return { value: index, done: false }; if (kind == 'values') return { value: target[index], done: false }; return { value: [index, target[index]], done: false }; }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% // https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject // https://tc39.github.io/ecma262/#sec-createmappedargumentsobject Iterators.Arguments = Iterators.Array; // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); },{"../internals/add-to-unscopables":3,"../internals/define-iterator":17,"../internals/internal-state":34,"../internals/iterators":40,"../internals/to-indexed-object":69}],79:[function(require,module,exports){ 'use strict'; var charAt = require('../internals/string-multibyte').charAt; var InternalStateModule = require('../internals/internal-state'); var defineIterator = require('../internals/define-iterator'); var STRING_ITERATOR = 'String Iterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR); // `String.prototype[@@iterator]` method // https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator defineIterator(String, 'String', function (iterated) { setInternalState(this, { type: STRING_ITERATOR, string: String(iterated), index: 0 }); // `%StringIteratorPrototype%.next` method // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next }, function next() { var state = getInternalState(this); var string = state.string; var index = state.index; var point; if (index >= string.length) return { value: undefined, done: true }; point = charAt(string, index); state.index += point.length; return { value: point, done: false }; }); },{"../internals/define-iterator":17,"../internals/internal-state":34,"../internals/string-multibyte":66}],80:[function(require,module,exports){ 'use strict'; // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` require('../modules/es.array.iterator'); var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); var USE_NATIVE_URL = require('../internals/native-url'); var redefine = require('../internals/redefine'); var redefineAll = require('../internals/redefine-all'); var setToStringTag = require('../internals/set-to-string-tag'); var createIteratorConstructor = require('../internals/create-iterator-constructor'); var InternalStateModule = require('../internals/internal-state'); var anInstance = require('../internals/an-instance'); var hasOwn = require('../internals/has'); var bind = require('../internals/function-bind-context'); var classof = require('../internals/classof'); var anObject = require('../internals/an-object'); var isObject = require('../internals/is-object'); var create = require('../internals/object-create'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); var getIterator = require('../internals/get-iterator'); var getIteratorMethod = require('../internals/get-iterator-method'); var wellKnownSymbol = require('../internals/well-known-symbol'); var $fetch = getBuiltIn('fetch'); var Headers = getBuiltIn('Headers'); var ITERATOR = wellKnownSymbol('iterator'); var URL_SEARCH_PARAMS = 'URLSearchParams'; var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator'; var setInternalState = InternalStateModule.set; var getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS); var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR); var plus = /\+/g; var sequences = Array(4); var percentSequence = function (bytes) { return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\da-f]{2}){' + bytes + '})', 'gi')); }; var percentDecode = function (sequence) { try { return decodeURIComponent(sequence); } catch (error) { return sequence; } }; var deserialize = function (it) { var result = it.replace(plus, ' '); var bytes = 4; try { return decodeURIComponent(result); } catch (error) { while (bytes) { result = result.replace(percentSequence(bytes--), percentDecode); } return result; } }; var find = /[!'()~]|%20/g; var replace = { '!': '%21', "'": '%27', '(': '%28', ')': '%29', '~': '%7E', '%20': '+' }; var replacer = function (match) { return replace[match]; }; var serialize = function (it) { return encodeURIComponent(it).replace(find, replacer); }; var parseSearchParams = function (result, query) { if (query) { var attributes = query.split('&'); var index = 0; var attribute, entry; while (index < attributes.length) { attribute = attributes[index++]; if (attribute.length) { entry = attribute.split('='); result.push({ key: deserialize(entry.shift()), value: deserialize(entry.join('=')) }); } } } }; var updateSearchParams = function (query) { this.entries.length = 0; parseSearchParams(this.entries, query); }; var validateArgumentsLength = function (passed, required) { if (passed < required) throw TypeError('Not enough arguments'); }; var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) { setInternalState(this, { type: URL_SEARCH_PARAMS_ITERATOR, iterator: getIterator(getInternalParamsState(params).entries), kind: kind }); }, 'Iterator', function next() { var state = getInternalIteratorState(this); var kind = state.kind; var step = state.iterator.next(); var entry = step.value; if (!step.done) { step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value]; } return step; }); // `URLSearchParams` constructor // https://url.spec.whatwg.org/#interface-urlsearchparams var URLSearchParamsConstructor = function URLSearchParams(/* init */) { anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS); var init = arguments.length > 0 ? arguments[0] : undefined; var that = this; var entries = []; var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key; setInternalState(that, { type: URL_SEARCH_PARAMS, entries: entries, updateURL: function () { /* empty */ }, updateSearchParams: updateSearchParams }); if (init !== undefined) { if (isObject(init)) { iteratorMethod = getIteratorMethod(init); if (typeof iteratorMethod === 'function') { iterator = iteratorMethod.call(init); next = iterator.next; while (!(step = next.call(iterator)).done) { entryIterator = getIterator(anObject(step.value)); entryNext = entryIterator.next; if ( (first = entryNext.call(entryIterator)).done || (second = entryNext.call(entryIterator)).done || !entryNext.call(entryIterator).done ) throw TypeError('Expected sequence with length 2'); entries.push({ key: first.value + '', value: second.value + '' }); } } else for (key in init) if (hasOwn(init, key)) entries.push({ key: key, value: init[key] + '' }); } else { parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + ''); } } }; var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype; redefineAll(URLSearchParamsPrototype, { // `URLSearchParams.prototype.appent` method // https://url.spec.whatwg.org/#dom-urlsearchparams-append append: function append(name, value) { validateArgumentsLength(arguments.length, 2); var state = getInternalParamsState(this); state.entries.push({ key: name + '', value: value + '' }); state.updateURL(); }, // `URLSearchParams.prototype.delete` method // https://url.spec.whatwg.org/#dom-urlsearchparams-delete 'delete': function (name) { validateArgumentsLength(arguments.length, 1); var state = getInternalParamsState(this); var entries = state.entries; var key = name + ''; var index = 0; while (index < entries.length) { if (entries[index].key === key) entries.splice(index, 1); else index++; } state.updateURL(); }, // `URLSearchParams.prototype.get` method // https://url.spec.whatwg.org/#dom-urlsearchparams-get get: function get(name) { validateArgumentsLength(arguments.length, 1); var entries = getInternalParamsState(this).entries; var key = name + ''; var index = 0; for (; index < entries.length; index++) { if (entries[index].key === key) return entries[index].value; } return null; }, // `URLSearchParams.prototype.getAll` method // https://url.spec.whatwg.org/#dom-urlsearchparams-getall getAll: function getAll(name) { validateArgumentsLength(arguments.length, 1); var entries = getInternalParamsState(this).entries; var key = name + ''; var result = []; var index = 0; for (; index < entries.length; index++) { if (entries[index].key === key) result.push(entries[index].value); } return result; }, // `URLSearchParams.prototype.has` method // https://url.spec.whatwg.org/#dom-urlsearchparams-has has: function has(name) { validateArgumentsLength(arguments.length, 1); var entries = getInternalParamsState(this).entries; var key = name + ''; var index = 0; while (index < entries.length) { if (entries[index++].key === key) return true; } return false; }, // `URLSearchParams.prototype.set` method // https://url.spec.whatwg.org/#dom-urlsearchparams-set set: function set(name, value) { validateArgumentsLength(arguments.length, 1); var state = getInternalParamsState(this); var entries = state.entries; var found = false; var key = name + ''; var val = value + ''; var index = 0; var entry; for (; index < entries.length; index++) { entry = entries[index]; if (entry.key === key) { if (found) entries.splice(index--, 1); else { found = true; entry.value = val; } } } if (!found) entries.push({ key: key, value: val }); state.updateURL(); }, // `URLSearchParams.prototype.sort` method // https://url.spec.whatwg.org/#dom-urlsearchparams-sort sort: function sort() { var state = getInternalParamsState(this); var entries = state.entries; // Array#sort is not stable in some engines var slice = entries.slice(); var entry, entriesIndex, sliceIndex; entries.length = 0; for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) { entry = slice[sliceIndex]; for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) { if (entries[entriesIndex].key > entry.key) { entries.splice(entriesIndex, 0, entry); break; } } if (entriesIndex === sliceIndex) entries.push(entry); } state.updateURL(); }, // `URLSearchParams.prototype.forEach` method forEach: function forEach(callback /* , thisArg */) { var entries = getInternalParamsState(this).entries; var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined, 3); var index = 0; var entry; while (index < entries.length) { entry = entries[index++]; boundFunction(entry.value, entry.key, this); } }, // `URLSearchParams.prototype.keys` method keys: function keys() { return new URLSearchParamsIterator(this, 'keys'); }, // `URLSearchParams.prototype.values` method values: function values() { return new URLSearchParamsIterator(this, 'values'); }, // `URLSearchParams.prototype.entries` method entries: function entries() { return new URLSearchParamsIterator(this, 'entries'); } }, { enumerable: true }); // `URLSearchParams.prototype[@@iterator]` method redefine(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries); // `URLSearchParams.prototype.toString` method // https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior redefine(URLSearchParamsPrototype, 'toString', function toString() { var entries = getInternalParamsState(this).entries; var result = []; var index = 0; var entry; while (index < entries.length) { entry = entries[index++]; result.push(serialize(entry.key) + '=' + serialize(entry.value)); } return result.join('&'); }, { enumerable: true }); setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS); $({ global: true, forced: !USE_NATIVE_URL }, { URLSearchParams: URLSearchParamsConstructor }); // Wrap `fetch` for correct work with polyfilled `URLSearchParams` // https://github.com/zloirock/core-js/issues/674 if (!USE_NATIVE_URL && typeof $fetch == 'function' && typeof Headers == 'function') { $({ global: true, enumerable: true, forced: true }, { fetch: function fetch(input /* , init */) { var args = [input]; var init, body, headers; if (arguments.length > 1) { init = arguments[1]; if (isObject(init)) { body = init.body; if (classof(body) === URL_SEARCH_PARAMS) { headers = init.headers ? new Headers(init.headers) : new Headers(); if (!headers.has('content-type')) { headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); } init = create(init, { body: createPropertyDescriptor(0, String(body)), headers: createPropertyDescriptor(0, headers) }); } } args.push(init); } return $fetch.apply(this, args); } }); } module.exports = { URLSearchParams: URLSearchParamsConstructor, getState: getInternalParamsState }; },{"../internals/an-instance":4,"../internals/an-object":5,"../internals/classof":10,"../internals/create-iterator-constructor":13,"../internals/create-property-descriptor":15,"../internals/export":21,"../internals/function-bind-context":23,"../internals/get-built-in":24,"../internals/get-iterator":26,"../internals/get-iterator-method":25,"../internals/has":28,"../internals/internal-state":34,"../internals/is-object":37,"../internals/native-url":42,"../internals/object-create":45,"../internals/redefine":59,"../internals/redefine-all":58,"../internals/set-to-string-tag":62,"../internals/well-known-symbol":77,"../modules/es.array.iterator":78}],81:[function(require,module,exports){ 'use strict'; // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` require('../modules/es.string.iterator'); var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var USE_NATIVE_URL = require('../internals/native-url'); var global = require('../internals/global'); var defineProperties = require('../internals/object-define-properties'); var redefine = require('../internals/redefine'); var anInstance = require('../internals/an-instance'); var has = require('../internals/has'); var assign = require('../internals/object-assign'); var arrayFrom = require('../internals/array-from'); var codeAt = require('../internals/string-multibyte').codeAt; var toASCII = require('../internals/string-punycode-to-ascii'); var setToStringTag = require('../internals/set-to-string-tag'); var URLSearchParamsModule = require('../modules/web.url-search-params'); var InternalStateModule = require('../internals/internal-state'); var NativeURL = global.URL; var URLSearchParams = URLSearchParamsModule.URLSearchParams; var getInternalSearchParamsState = URLSearchParamsModule.getState; var setInternalState = InternalStateModule.set; var getInternalURLState = InternalStateModule.getterFor('URL'); var floor = Math.floor; var pow = Math.pow; var INVALID_AUTHORITY = 'Invalid authority'; var INVALID_SCHEME = 'Invalid scheme'; var INVALID_HOST = 'Invalid host'; var INVALID_PORT = 'Invalid port'; var ALPHA = /[A-Za-z]/; var ALPHANUMERIC = /[\d+\-.A-Za-z]/; var DIGIT = /\d/; var HEX_START = /^(0x|0X)/; var OCT = /^[0-7]+$/; var DEC = /^\d+$/; var HEX = /^[\dA-Fa-f]+$/; // eslint-disable-next-line no-control-regex var FORBIDDEN_HOST_CODE_POINT = /[\u0000\u0009\u000A\u000D #%/:?@[\\]]/; // eslint-disable-next-line no-control-regex var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\u0000\u0009\u000A\u000D #/:?@[\\]]/; // eslint-disable-next-line no-control-regex var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g; // eslint-disable-next-line no-control-regex var TAB_AND_NEW_LINE = /[\u0009\u000A\u000D]/g; var EOF; var parseHost = function (url, input) { var result, codePoints, index; if (input.charAt(0) == '[') { if (input.charAt(input.length - 1) != ']') return INVALID_HOST; result = parseIPv6(input.slice(1, -1)); if (!result) return INVALID_HOST; url.host = result; // opaque host } else if (!isSpecial(url)) { if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST; result = ''; codePoints = arrayFrom(input); for (index = 0; index < codePoints.length; index++) { result += percentEncode(codePoints[index], C0ControlPercentEncodeSet); } url.host = result; } else { input = toASCII(input); if (FORBIDDEN_HOST_CODE_POINT.test(input)) return INVALID_HOST; result = parseIPv4(input); if (result === null) return INVALID_HOST; url.host = result; } }; var parseIPv4 = function (input) { var parts = input.split('.'); var partsLength, numbers, index, part, radix, number, ipv4; if (parts.length && parts[parts.length - 1] == '') { parts.pop(); } partsLength = parts.length; if (partsLength > 4) return input; numbers = []; for (index = 0; index < partsLength; index++) { part = parts[index]; if (part == '') return input; radix = 10; if (part.length > 1 && part.charAt(0) == '0') { radix = HEX_START.test(part) ? 16 : 8; part = part.slice(radix == 8 ? 1 : 2); } if (part === '') { number = 0; } else { if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) return input; number = parseInt(part, radix); } numbers.push(number); } for (index = 0; index < partsLength; index++) { number = numbers[index]; if (index == partsLength - 1) { if (number >= pow(256, 5 - partsLength)) return null; } else if (number > 255) return null; } ipv4 = numbers.pop(); for (index = 0; index < numbers.length; index++) { ipv4 += numbers[index] * pow(256, 3 - index); } return ipv4; }; // eslint-disable-next-line max-statements var parseIPv6 = function (input) { var address = [0, 0, 0, 0, 0, 0, 0, 0]; var pieceIndex = 0; var compress = null; var pointer = 0; var value, length, numbersSeen, ipv4Piece, number, swaps, swap; var char = function () { return input.charAt(pointer); }; if (char() == ':') { if (input.charAt(1) != ':') return; pointer += 2; pieceIndex++; compress = pieceIndex; } while (char()) { if (pieceIndex == 8) return; if (char() == ':') { if (compress !== null) return; pointer++; pieceIndex++; compress = pieceIndex; continue; } value = length = 0; while (length < 4 && HEX.test(char())) { value = value * 16 + parseInt(char(), 16); pointer++; length++; } if (char() == '.') { if (length == 0) return; pointer -= length; if (pieceIndex > 6) return; numbersSeen = 0; while (char()) { ipv4Piece = null; if (numbersSeen > 0) { if (char() == '.' && numbersSeen < 4) pointer++; else return; } if (!DIGIT.test(char())) return; while (DIGIT.test(char())) { number = parseInt(char(), 10); if (ipv4Piece === null) ipv4Piece = number; else if (ipv4Piece == 0) return; else ipv4Piece = ipv4Piece * 10 + number; if (ipv4Piece > 255) return; pointer++; } address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece; numbersSeen++; if (numbersSeen == 2 || numbersSeen == 4) pieceIndex++; } if (numbersSeen != 4) return; break; } else if (char() == ':') { pointer++; if (!char()) return; } else if (char()) return; address[pieceIndex++] = value; } if (compress !== null) { swaps = pieceIndex - compress; pieceIndex = 7; while (pieceIndex != 0 && swaps > 0) { swap = address[pieceIndex]; address[pieceIndex--] = address[compress + swaps - 1]; address[compress + --swaps] = swap; } } else if (pieceIndex != 8) return; return address; }; var findLongestZeroSequence = function (ipv6) { var maxIndex = null; var maxLength = 1; var currStart = null; var currLength = 0; var index = 0; for (; index < 8; index++) { if (ipv6[index] !== 0) { if (currLength > maxLength) { maxIndex = currStart; maxLength = currLength; } currStart = null; currLength = 0; } else { if (currStart === null) currStart = index; ++currLength; } } if (currLength > maxLength) { maxIndex = currStart; maxLength = currLength; } return maxIndex; }; var serializeHost = function (host) { var result, index, compress, ignore0; // ipv4 if (typeof host == 'number') { result = []; for (index = 0; index < 4; index++) { result.unshift(host % 256); host = floor(host / 256); } return result.join('.'); // ipv6 } else if (typeof host == 'object') { result = ''; compress = findLongestZeroSequence(host); for (index = 0; index < 8; index++) { if (ignore0 && host[index] === 0) continue; if (ignore0) ignore0 = false; if (compress === index) { result += index ? ':' : '::'; ignore0 = true; } else { result += host[index].toString(16); if (index < 7) result += ':'; } } return '[' + result + ']'; } return host; }; var C0ControlPercentEncodeSet = {}; var fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, { ' ': 1, '"': 1, '<': 1, '>': 1, '`': 1 }); var pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, { '#': 1, '?': 1, '{': 1, '}': 1 }); var userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, { '/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\': 1, ']': 1, '^': 1, '|': 1 }); var percentEncode = function (char, set) { var code = codeAt(char, 0); return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char); }; var specialSchemes = { ftp: 21, file: null, http: 80, https: 443, ws: 80, wss: 443 }; var isSpecial = function (url) { return has(specialSchemes, url.scheme); }; var includesCredentials = function (url) { return url.username != '' || url.password != ''; }; var cannotHaveUsernamePasswordPort = function (url) { return !url.host || url.cannotBeABaseURL || url.scheme == 'file'; }; var isWindowsDriveLetter = function (string, normalized) { var second; return string.length == 2 && ALPHA.test(string.charAt(0)) && ((second = string.charAt(1)) == ':' || (!normalized && second == '|')); }; var startsWithWindowsDriveLetter = function (string) { var third; return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && ( string.length == 2 || ((third = string.charAt(2)) === '/' || third === '\\' || third === '?' || third === '#') ); }; var shortenURLsPath = function (url) { var path = url.path; var pathSize = path.length; if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) { path.pop(); } }; var isSingleDot = function (segment) { return segment === '.' || segment.toLowerCase() === '%2e'; }; var isDoubleDot = function (segment) { segment = segment.toLowerCase(); return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e'; }; // States: var SCHEME_START = {}; var SCHEME = {}; var NO_SCHEME = {}; var SPECIAL_RELATIVE_OR_AUTHORITY = {}; var PATH_OR_AUTHORITY = {}; var RELATIVE = {}; var RELATIVE_SLASH = {}; var SPECIAL_AUTHORITY_SLASHES = {}; var SPECIAL_AUTHORITY_IGNORE_SLASHES = {}; var AUTHORITY = {}; var HOST = {}; var HOSTNAME = {}; var PORT = {}; var FILE = {}; var FILE_SLASH = {}; var FILE_HOST = {}; var PATH_START = {}; var PATH = {}; var CANNOT_BE_A_BASE_URL_PATH = {}; var QUERY = {}; var FRAGMENT = {}; // eslint-disable-next-line max-statements var parseURL = function (url, input, stateOverride, base) { var state = stateOverride || SCHEME_START; var pointer = 0; var buffer = ''; var seenAt = false; var seenBracket = false; var seenPasswordToken = false; var codePoints, char, bufferCodePoints, failure; if (!stateOverride) { url.scheme = ''; url.username = ''; url.password = ''; url.host = null; url.port = null; url.path = []; url.query = null; url.fragment = null; url.cannotBeABaseURL = false; input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, ''); } input = input.replace(TAB_AND_NEW_LINE, ''); codePoints = arrayFrom(input); while (pointer <= codePoints.length) { char = codePoints[pointer]; switch (state) { case SCHEME_START: if (char && ALPHA.test(char)) { buffer += char.toLowerCase(); state = SCHEME; } else if (!stateOverride) { state = NO_SCHEME; continue; } else return INVALID_SCHEME; break; case SCHEME: if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) { buffer += char.toLowerCase(); } else if (char == ':') { if (stateOverride && ( (isSpecial(url) != has(specialSchemes, buffer)) || (buffer == 'file' && (includesCredentials(url) || url.port !== null)) || (url.scheme == 'file' && !url.host) )) return; url.scheme = buffer; if (stateOverride) { if (isSpecial(url) && specialSchemes[url.scheme] == url.port) url.port = null; return; } buffer = ''; if (url.scheme == 'file') { state = FILE; } else if (isSpecial(url) && base && base.scheme == url.scheme) { state = SPECIAL_RELATIVE_OR_AUTHORITY; } else if (isSpecial(url)) { state = SPECIAL_AUTHORITY_SLASHES; } else if (codePoints[pointer + 1] == '/') { state = PATH_OR_AUTHORITY; pointer++; } else { url.cannotBeABaseURL = true; url.path.push(''); state = CANNOT_BE_A_BASE_URL_PATH; } } else if (!stateOverride) { buffer = ''; state = NO_SCHEME; pointer = 0; continue; } else return INVALID_SCHEME; break; case NO_SCHEME: if (!base || (base.cannotBeABaseURL && char != '#')) return INVALID_SCHEME; if (base.cannotBeABaseURL && char == '#') { url.scheme = base.scheme; url.path = base.path.slice(); url.query = base.query; url.fragment = ''; url.cannotBeABaseURL = true; state = FRAGMENT; break; } state = base.scheme == 'file' ? FILE : RELATIVE; continue; case SPECIAL_RELATIVE_OR_AUTHORITY: if (char == '/' && codePoints[pointer + 1] == '/') { state = SPECIAL_AUTHORITY_IGNORE_SLASHES; pointer++; } else { state = RELATIVE; continue; } break; case PATH_OR_AUTHORITY: if (char == '/') { state = AUTHORITY; break; } else { state = PATH; continue; } case RELATIVE: url.scheme = base.scheme; if (char == EOF) { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; url.path = base.path.slice(); url.query = base.query; } else if (char == '/' || (char == '\\' && isSpecial(url))) { state = RELATIVE_SLASH; } else if (char == '?') { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; url.path = base.path.slice(); url.query = ''; state = QUERY; } else if (char == '#') { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; url.path = base.path.slice(); url.query = base.query; url.fragment = ''; state = FRAGMENT; } else { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; url.path = base.path.slice(); url.path.pop(); state = PATH; continue; } break; case RELATIVE_SLASH: if (isSpecial(url) && (char == '/' || char == '\\')) { state = SPECIAL_AUTHORITY_IGNORE_SLASHES; } else if (char == '/') { state = AUTHORITY; } else { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; state = PATH; continue; } break; case SPECIAL_AUTHORITY_SLASHES: state = SPECIAL_AUTHORITY_IGNORE_SLASHES; if (char != '/' || buffer.charAt(pointer + 1) != '/') continue; pointer++; break; case SPECIAL_AUTHORITY_IGNORE_SLASHES: if (char != '/' && char != '\\') { state = AUTHORITY; continue; } break; case AUTHORITY: if (char == '@') { if (seenAt) buffer = '%40' + buffer; seenAt = true; bufferCodePoints = arrayFrom(buffer); for (var i = 0; i < bufferCodePoints.length; i++) { var codePoint = bufferCodePoints[i]; if (codePoint == ':' && !seenPasswordToken) { seenPasswordToken = true; continue; } var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet); if (seenPasswordToken) url.password += encodedCodePoints; else url.username += encodedCodePoints; } buffer = ''; } else if ( char == EOF || char == '/' || char == '?' || char == '#' || (char == '\\' && isSpecial(url)) ) { if (seenAt && buffer == '') return INVALID_AUTHORITY; pointer -= arrayFrom(buffer).length + 1; buffer = ''; state = HOST; } else buffer += char; break; case HOST: case HOSTNAME: if (stateOverride && url.scheme == 'file') { state = FILE_HOST; continue; } else if (char == ':' && !seenBracket) { if (buffer == '') return INVALID_HOST; failure = parseHost(url, buffer); if (failure) return failure; buffer = ''; state = PORT; if (stateOverride == HOSTNAME) return; } else if ( char == EOF || char == '/' || char == '?' || char == '#' || (char == '\\' && isSpecial(url)) ) { if (isSpecial(url) && buffer == '') return INVALID_HOST; if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) return; failure = parseHost(url, buffer); if (failure) return failure; buffer = ''; state = PATH_START; if (stateOverride) return; continue; } else { if (char == '[') seenBracket = true; else if (char == ']') seenBracket = false; buffer += char; } break; case PORT: if (DIGIT.test(char)) { buffer += char; } else if ( char == EOF || char == '/' || char == '?' || char == '#' || (char == '\\' && isSpecial(url)) || stateOverride ) { if (buffer != '') { var port = parseInt(buffer, 10); if (port > 0xFFFF) return INVALID_PORT; url.port = (isSpecial(url) && port === specialSchemes[url.scheme]) ? null : port; buffer = ''; } if (stateOverride) return; state = PATH_START; continue; } else return INVALID_PORT; break; case FILE: url.scheme = 'file'; if (char == '/' || char == '\\') state = FILE_SLASH; else if (base && base.scheme == 'file') { if (char == EOF) { url.host = base.host; url.path = base.path.slice(); url.query = base.query; } else if (char == '?') { url.host = base.host; url.path = base.path.slice(); url.query = ''; state = QUERY; } else if (char == '#') { url.host = base.host; url.path = base.path.slice(); url.query = base.query; url.fragment = ''; state = FRAGMENT; } else { if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) { url.host = base.host; url.path = base.path.slice(); shortenURLsPath(url); } state = PATH; continue; } } else { state = PATH; continue; } break; case FILE_SLASH: if (char == '/' || char == '\\') { state = FILE_HOST; break; } if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) { if (isWindowsDriveLetter(base.path[0], true)) url.path.push(base.path[0]); else url.host = base.host; } state = PATH; continue; case FILE_HOST: if (char == EOF || char == '/' || char == '\\' || char == '?' || char == '#') { if (!stateOverride && isWindowsDriveLetter(buffer)) { state = PATH; } else if (buffer == '') { url.host = ''; if (stateOverride) return; state = PATH_START; } else { failure = parseHost(url, buffer); if (failure) return failure; if (url.host == 'localhost') url.host = ''; if (stateOverride) return; buffer = ''; state = PATH_START; } continue; } else buffer += char; break; case PATH_START: if (isSpecial(url)) { state = PATH; if (char != '/' && char != '\\') continue; } else if (!stateOverride && char == '?') { url.query = ''; state = QUERY; } else if (!stateOverride && char == '#') { url.fragment = ''; state = FRAGMENT; } else if (char != EOF) { state = PATH; if (char != '/') continue; } break; case PATH: if ( char == EOF || char == '/' || (char == '\\' && isSpecial(url)) || (!stateOverride && (char == '?' || char == '#')) ) { if (isDoubleDot(buffer)) { shortenURLsPath(url); if (char != '/' && !(char == '\\' && isSpecial(url))) { url.path.push(''); } } else if (isSingleDot(buffer)) { if (char != '/' && !(char == '\\' && isSpecial(url))) { url.path.push(''); } } else { if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) { if (url.host) url.host = ''; buffer = buffer.charAt(0) + ':'; // normalize windows drive letter } url.path.push(buffer); } buffer = ''; if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) { while (url.path.length > 1 && url.path[0] === '') { url.path.shift(); } } if (char == '?') { url.query = ''; state = QUERY; } else if (char == '#') { url.fragment = ''; state = FRAGMENT; } } else { buffer += percentEncode(char, pathPercentEncodeSet); } break; case CANNOT_BE_A_BASE_URL_PATH: if (char == '?') { url.query = ''; state = QUERY; } else if (char == '#') { url.fragment = ''; state = FRAGMENT; } else if (char != EOF) { url.path[0] += percentEncode(char, C0ControlPercentEncodeSet); } break; case QUERY: if (!stateOverride && char == '#') { url.fragment = ''; state = FRAGMENT; } else if (char != EOF) { if (char == "'" && isSpecial(url)) url.query += '%27'; else if (char == '#') url.query += '%23'; else url.query += percentEncode(char, C0ControlPercentEncodeSet); } break; case FRAGMENT: if (char != EOF) url.fragment += percentEncode(char, fragmentPercentEncodeSet); break; } pointer++; } }; // `URL` constructor // https://url.spec.whatwg.org/#url-class var URLConstructor = function URL(url /* , base */) { var that = anInstance(this, URLConstructor, 'URL'); var base = arguments.length > 1 ? arguments[1] : undefined; var urlString = String(url); var state = setInternalState(that, { type: 'URL' }); var baseState, failure; if (base !== undefined) { if (base instanceof URLConstructor) baseState = getInternalURLState(base); else { failure = parseURL(baseState = {}, String(base)); if (failure) throw TypeError(failure); } } failure = parseURL(state, urlString, null, baseState); if (failure) throw TypeError(failure); var searchParams = state.searchParams = new URLSearchParams(); var searchParamsState = getInternalSearchParamsState(searchParams); searchParamsState.updateSearchParams(state.query); searchParamsState.updateURL = function () { state.query = String(searchParams) || null; }; if (!DESCRIPTORS) { that.href = serializeURL.call(that); that.origin = getOrigin.call(that); that.protocol = getProtocol.call(that); that.username = getUsername.call(that); that.password = getPassword.call(that); that.host = getHost.call(that); that.hostname = getHostname.call(that); that.port = getPort.call(that); that.pathname = getPathname.call(that); that.search = getSearch.call(that); that.searchParams = getSearchParams.call(that); that.hash = getHash.call(that); } }; var URLPrototype = URLConstructor.prototype; var serializeURL = function () { var url = getInternalURLState(this); var scheme = url.scheme; var username = url.username; var password = url.password; var host = url.host; var port = url.port; var path = url.path; var query = url.query; var fragment = url.fragment; var output = scheme + ':'; if (host !== null) { output += '//'; if (includesCredentials(url)) { output += username + (password ? ':' + password : '') + '@'; } output += serializeHost(host); if (port !== null) output += ':' + port; } else if (scheme == 'file') output += '//'; output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : ''; if (query !== null) output += '?' + query; if (fragment !== null) output += '#' + fragment; return output; }; var getOrigin = function () { var url = getInternalURLState(this); var scheme = url.scheme; var port = url.port; if (scheme == 'blob') try { return new URL(scheme.path[0]).origin; } catch (error) { return 'null'; } if (scheme == 'file' || !isSpecial(url)) return 'null'; return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : ''); }; var getProtocol = function () { return getInternalURLState(this).scheme + ':'; }; var getUsername = function () { return getInternalURLState(this).username; }; var getPassword = function () { return getInternalURLState(this).password; }; var getHost = function () { var url = getInternalURLState(this); var host = url.host; var port = url.port; return host === null ? '' : port === null ? serializeHost(host) : serializeHost(host) + ':' + port; }; var getHostname = function () { var host = getInternalURLState(this).host; return host === null ? '' : serializeHost(host); }; var getPort = function () { var port = getInternalURLState(this).port; return port === null ? '' : String(port); }; var getPathname = function () { var url = getInternalURLState(this); var path = url.path; return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : ''; }; var getSearch = function () { var query = getInternalURLState(this).query; return query ? '?' + query : ''; }; var getSearchParams = function () { return getInternalURLState(this).searchParams; }; var getHash = function () { var fragment = getInternalURLState(this).fragment; return fragment ? '#' + fragment : ''; }; var accessorDescriptor = function (getter, setter) { return { get: getter, set: setter, configurable: true, enumerable: true }; }; if (DESCRIPTORS) { defineProperties(URLPrototype, { // `URL.prototype.href` accessors pair // https://url.spec.whatwg.org/#dom-url-href href: accessorDescriptor(serializeURL, function (href) { var url = getInternalURLState(this); var urlString = String(href); var failure = parseURL(url, urlString); if (failure) throw TypeError(failure); getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query); }), // `URL.prototype.origin` getter // https://url.spec.whatwg.org/#dom-url-origin origin: accessorDescriptor(getOrigin), // `URL.prototype.protocol` accessors pair // https://url.spec.whatwg.org/#dom-url-protocol protocol: accessorDescriptor(getProtocol, function (protocol) { var url = getInternalURLState(this); parseURL(url, String(protocol) + ':', SCHEME_START); }), // `URL.prototype.username` accessors pair // https://url.spec.whatwg.org/#dom-url-username username: accessorDescriptor(getUsername, function (username) { var url = getInternalURLState(this); var codePoints = arrayFrom(String(username)); if (cannotHaveUsernamePasswordPort(url)) return; url.username = ''; for (var i = 0; i < codePoints.length; i++) { url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet); } }), // `URL.prototype.password` accessors pair // https://url.spec.whatwg.org/#dom-url-password password: accessorDescriptor(getPassword, function (password) { var url = getInternalURLState(this); var codePoints = arrayFrom(String(password)); if (cannotHaveUsernamePasswordPort(url)) return; url.password = ''; for (var i = 0; i < codePoints.length; i++) { url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet); } }), // `URL.prototype.host` accessors pair // https://url.spec.whatwg.org/#dom-url-host host: accessorDescriptor(getHost, function (host) { var url = getInternalURLState(this); if (url.cannotBeABaseURL) return; parseURL(url, String(host), HOST); }), // `URL.prototype.hostname` accessors pair // https://url.spec.whatwg.org/#dom-url-hostname hostname: accessorDescriptor(getHostname, function (hostname) { var url = getInternalURLState(this); if (url.cannotBeABaseURL) return; parseURL(url, String(hostname), HOSTNAME); }), // `URL.prototype.port` accessors pair // https://url.spec.whatwg.org/#dom-url-port port: accessorDescriptor(getPort, function (port) { var url = getInternalURLState(this); if (cannotHaveUsernamePasswordPort(url)) return; port = String(port); if (port == '') url.port = null; else parseURL(url, port, PORT); }), // `URL.prototype.pathname` accessors pair // https://url.spec.whatwg.org/#dom-url-pathname pathname: accessorDescriptor(getPathname, function (pathname) { var url = getInternalURLState(this); if (url.cannotBeABaseURL) return; url.path = []; parseURL(url, pathname + '', PATH_START); }), // `URL.prototype.search` accessors pair // https://url.spec.whatwg.org/#dom-url-search search: accessorDescriptor(getSearch, function (search) { var url = getInternalURLState(this); search = String(search); if (search == '') { url.query = null; } else { if ('?' == search.charAt(0)) search = search.slice(1); url.query = ''; parseURL(url, search, QUERY); } getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query); }), // `URL.prototype.searchParams` getter // https://url.spec.whatwg.org/#dom-url-searchparams searchParams: accessorDescriptor(getSearchParams), // `URL.prototype.hash` accessors pair // https://url.spec.whatwg.org/#dom-url-hash hash: accessorDescriptor(getHash, function (hash) { var url = getInternalURLState(this); hash = String(hash); if (hash == '') { url.fragment = null; return; } if ('#' == hash.charAt(0)) hash = hash.slice(1); url.fragment = ''; parseURL(url, hash, FRAGMENT); }) }); } // `URL.prototype.toJSON` method // https://url.spec.whatwg.org/#dom-url-tojson redefine(URLPrototype, 'toJSON', function toJSON() { return serializeURL.call(this); }, { enumerable: true }); // `URL.prototype.toString` method // https://url.spec.whatwg.org/#URL-stringification-behavior redefine(URLPrototype, 'toString', function toString() { return serializeURL.call(this); }, { enumerable: true }); if (NativeURL) { var nativeCreateObjectURL = NativeURL.createObjectURL; var nativeRevokeObjectURL = NativeURL.revokeObjectURL; // `URL.createObjectURL` method // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL // eslint-disable-next-line no-unused-vars if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) { return nativeCreateObjectURL.apply(NativeURL, arguments); }); // `URL.revokeObjectURL` method // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL // eslint-disable-next-line no-unused-vars if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) { return nativeRevokeObjectURL.apply(NativeURL, arguments); }); } setToStringTag(URLConstructor, 'URL'); $({ global: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS }, { URL: URLConstructor }); },{"../internals/an-instance":4,"../internals/array-from":6,"../internals/descriptors":18,"../internals/export":21,"../internals/global":27,"../internals/has":28,"../internals/internal-state":34,"../internals/native-url":42,"../internals/object-assign":44,"../internals/object-define-properties":46,"../internals/redefine":59,"../internals/set-to-string-tag":62,"../internals/string-multibyte":66,"../internals/string-punycode-to-ascii":67,"../modules/es.string.iterator":79,"../modules/web.url-search-params":80}],82:[function(require,module,exports){ 'use strict'; var $ = require('../internals/export'); // `URL.prototype.toJSON` method // https://url.spec.whatwg.org/#dom-url-tojson $({ target: 'URL', proto: true, enumerable: true }, { toJSON: function toJSON() { return URL.prototype.toString.call(this); } }); },{"../internals/export":21}],83:[function(require,module,exports){ require('../modules/web.url'); require('../modules/web.url.to-json'); require('../modules/web.url-search-params'); var path = require('../internals/path'); module.exports = path.URL; },{"../internals/path":57,"../modules/web.url":81,"../modules/web.url-search-params":80,"../modules/web.url.to-json":82}]},{},[83]); vendor/wp-polyfill-element-closest.min.js 0000644 00000000651 15151622574 0014552 0 ustar 00 !function(){var e=window.Element.prototype;"function"!=typeof e.matches&&(e.matches=e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),o=0;t[o]&&t[o]!==this;)++o;return Boolean(t[o])}),"function"!=typeof e.closest&&(e.closest=function(e){for(var t=this;t&&1===t.nodeType;){if(t.matches(e))return t;t=t.parentNode}return null})}(); vendor/wp-polyfill-inert.js 0000644 00000073016 15151622574 0012013 0 ustar 00 (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory() : typeof define === 'function' && define.amd ? define('inert', factory) : (factory()); }(this, (function () { 'use strict'; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * This work is licensed under the W3C Software and Document License * (http://www.w3.org/Consortium/Legal/2015/copyright-software-and-document). */ (function () { // Return early if we're not running inside of the browser. if (typeof window === 'undefined' || typeof Element === 'undefined') { return; } // Convenience function for converting NodeLists. /** @type {typeof Array.prototype.slice} */ var slice = Array.prototype.slice; /** * IE has a non-standard name for "matches". * @type {typeof Element.prototype.matches} */ var matches = Element.prototype.matches || Element.prototype.msMatchesSelector; /** @type {string} */ var _focusableElementsString = ['a[href]', 'area[href]', 'input:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'details', 'summary', 'iframe', 'object', 'embed', 'video', '[contenteditable]'].join(','); /** * `InertRoot` manages a single inert subtree, i.e. a DOM subtree whose root element has an `inert` * attribute. * * Its main functions are: * * - to create and maintain a set of managed `InertNode`s, including when mutations occur in the * subtree. The `makeSubtreeUnfocusable()` method handles collecting `InertNode`s via registering * each focusable node in the subtree with the singleton `InertManager` which manages all known * focusable nodes within inert subtrees. `InertManager` ensures that a single `InertNode` * instance exists for each focusable node which has at least one inert root as an ancestor. * * - to notify all managed `InertNode`s when this subtree stops being inert (i.e. when the `inert` * attribute is removed from the root node). This is handled in the destructor, which calls the * `deregister` method on `InertManager` for each managed inert node. */ var InertRoot = function () { /** * @param {!HTMLElement} rootElement The HTMLElement at the root of the inert subtree. * @param {!InertManager} inertManager The global singleton InertManager object. */ function InertRoot(rootElement, inertManager) { _classCallCheck(this, InertRoot); /** @type {!InertManager} */ this._inertManager = inertManager; /** @type {!HTMLElement} */ this._rootElement = rootElement; /** * @type {!Set<!InertNode>} * All managed focusable nodes in this InertRoot's subtree. */ this._managedNodes = new Set(); // Make the subtree hidden from assistive technology if (this._rootElement.hasAttribute('aria-hidden')) { /** @type {?string} */ this._savedAriaHidden = this._rootElement.getAttribute('aria-hidden'); } else { this._savedAriaHidden = null; } this._rootElement.setAttribute('aria-hidden', 'true'); // Make all focusable elements in the subtree unfocusable and add them to _managedNodes this._makeSubtreeUnfocusable(this._rootElement); // Watch for: // - any additions in the subtree: make them unfocusable too // - any removals from the subtree: remove them from this inert root's managed nodes // - attribute changes: if `tabindex` is added, or removed from an intrinsically focusable // element, make that node a managed node. this._observer = new MutationObserver(this._onMutation.bind(this)); this._observer.observe(this._rootElement, { attributes: true, childList: true, subtree: true }); } /** * Call this whenever this object is about to become obsolete. This unwinds all of the state * stored in this object and updates the state of all of the managed nodes. */ _createClass(InertRoot, [{ key: 'destructor', value: function destructor() { this._observer.disconnect(); if (this._rootElement) { if (this._savedAriaHidden !== null) { this._rootElement.setAttribute('aria-hidden', this._savedAriaHidden); } else { this._rootElement.removeAttribute('aria-hidden'); } } this._managedNodes.forEach(function (inertNode) { this._unmanageNode(inertNode.node); }, this); // Note we cast the nulls to the ANY type here because: // 1) We want the class properties to be declared as non-null, or else we // need even more casts throughout this code. All bets are off if an // instance has been destroyed and a method is called. // 2) We don't want to cast "this", because we want type-aware optimizations // to know which properties we're setting. this._observer = /** @type {?} */null; this._rootElement = /** @type {?} */null; this._managedNodes = /** @type {?} */null; this._inertManager = /** @type {?} */null; } /** * @return {!Set<!InertNode>} A copy of this InertRoot's managed nodes set. */ }, { key: '_makeSubtreeUnfocusable', /** * @param {!Node} startNode */ value: function _makeSubtreeUnfocusable(startNode) { var _this2 = this; composedTreeWalk(startNode, function (node) { return _this2._visitNode(node); }); var activeElement = document.activeElement; if (!document.body.contains(startNode)) { // startNode may be in shadow DOM, so find its nearest shadowRoot to get the activeElement. var node = startNode; /** @type {!ShadowRoot|undefined} */ var root = undefined; while (node) { if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { root = /** @type {!ShadowRoot} */node; break; } node = node.parentNode; } if (root) { activeElement = root.activeElement; } } if (startNode.contains(activeElement)) { activeElement.blur(); // In IE11, if an element is already focused, and then set to tabindex=-1 // calling blur() will not actually move the focus. // To work around this we call focus() on the body instead. if (activeElement === document.activeElement) { document.body.focus(); } } } /** * @param {!Node} node */ }, { key: '_visitNode', value: function _visitNode(node) { if (node.nodeType !== Node.ELEMENT_NODE) { return; } var element = /** @type {!HTMLElement} */node; // If a descendant inert root becomes un-inert, its descendants will still be inert because of // this inert root, so all of its managed nodes need to be adopted by this InertRoot. if (element !== this._rootElement && element.hasAttribute('inert')) { this._adoptInertRoot(element); } if (matches.call(element, _focusableElementsString) || element.hasAttribute('tabindex')) { this._manageNode(element); } } /** * Register the given node with this InertRoot and with InertManager. * @param {!Node} node */ }, { key: '_manageNode', value: function _manageNode(node) { var inertNode = this._inertManager.register(node, this); this._managedNodes.add(inertNode); } /** * Unregister the given node with this InertRoot and with InertManager. * @param {!Node} node */ }, { key: '_unmanageNode', value: function _unmanageNode(node) { var inertNode = this._inertManager.deregister(node, this); if (inertNode) { this._managedNodes['delete'](inertNode); } } /** * Unregister the entire subtree starting at `startNode`. * @param {!Node} startNode */ }, { key: '_unmanageSubtree', value: function _unmanageSubtree(startNode) { var _this3 = this; composedTreeWalk(startNode, function (node) { return _this3._unmanageNode(node); }); } /** * If a descendant node is found with an `inert` attribute, adopt its managed nodes. * @param {!HTMLElement} node */ }, { key: '_adoptInertRoot', value: function _adoptInertRoot(node) { var inertSubroot = this._inertManager.getInertRoot(node); // During initialisation this inert root may not have been registered yet, // so register it now if need be. if (!inertSubroot) { this._inertManager.setInert(node, true); inertSubroot = this._inertManager.getInertRoot(node); } inertSubroot.managedNodes.forEach(function (savedInertNode) { this._manageNode(savedInertNode.node); }, this); } /** * Callback used when mutation observer detects subtree additions, removals, or attribute changes. * @param {!Array<!MutationRecord>} records * @param {!MutationObserver} self */ }, { key: '_onMutation', value: function _onMutation(records, self) { records.forEach(function (record) { var target = /** @type {!HTMLElement} */record.target; if (record.type === 'childList') { // Manage added nodes slice.call(record.addedNodes).forEach(function (node) { this._makeSubtreeUnfocusable(node); }, this); // Un-manage removed nodes slice.call(record.removedNodes).forEach(function (node) { this._unmanageSubtree(node); }, this); } else if (record.type === 'attributes') { if (record.attributeName === 'tabindex') { // Re-initialise inert node if tabindex changes this._manageNode(target); } else if (target !== this._rootElement && record.attributeName === 'inert' && target.hasAttribute('inert')) { // If a new inert root is added, adopt its managed nodes and make sure it knows about the // already managed nodes from this inert subroot. this._adoptInertRoot(target); var inertSubroot = this._inertManager.getInertRoot(target); this._managedNodes.forEach(function (managedNode) { if (target.contains(managedNode.node)) { inertSubroot._manageNode(managedNode.node); } }); } } }, this); } }, { key: 'managedNodes', get: function get() { return new Set(this._managedNodes); } /** @return {boolean} */ }, { key: 'hasSavedAriaHidden', get: function get() { return this._savedAriaHidden !== null; } /** @param {?string} ariaHidden */ }, { key: 'savedAriaHidden', set: function set(ariaHidden) { this._savedAriaHidden = ariaHidden; } /** @return {?string} */ , get: function get() { return this._savedAriaHidden; } }]); return InertRoot; }(); /** * `InertNode` initialises and manages a single inert node. * A node is inert if it is a descendant of one or more inert root elements. * * On construction, `InertNode` saves the existing `tabindex` value for the node, if any, and * either removes the `tabindex` attribute or sets it to `-1`, depending on whether the element * is intrinsically focusable or not. * * `InertNode` maintains a set of `InertRoot`s which are descendants of this `InertNode`. When an * `InertRoot` is destroyed, and calls `InertManager.deregister()`, the `InertManager` notifies the * `InertNode` via `removeInertRoot()`, which in turn destroys the `InertNode` if no `InertRoot`s * remain in the set. On destruction, `InertNode` reinstates the stored `tabindex` if one exists, * or removes the `tabindex` attribute if the element is intrinsically focusable. */ var InertNode = function () { /** * @param {!Node} node A focusable element to be made inert. * @param {!InertRoot} inertRoot The inert root element associated with this inert node. */ function InertNode(node, inertRoot) { _classCallCheck(this, InertNode); /** @type {!Node} */ this._node = node; /** @type {boolean} */ this._overrodeFocusMethod = false; /** * @type {!Set<!InertRoot>} The set of descendant inert roots. * If and only if this set becomes empty, this node is no longer inert. */ this._inertRoots = new Set([inertRoot]); /** @type {?number} */ this._savedTabIndex = null; /** @type {boolean} */ this._destroyed = false; // Save any prior tabindex info and make this node untabbable this.ensureUntabbable(); } /** * Call this whenever this object is about to become obsolete. * This makes the managed node focusable again and deletes all of the previously stored state. */ _createClass(InertNode, [{ key: 'destructor', value: function destructor() { this._throwIfDestroyed(); if (this._node && this._node.nodeType === Node.ELEMENT_NODE) { var element = /** @type {!HTMLElement} */this._node; if (this._savedTabIndex !== null) { element.setAttribute('tabindex', this._savedTabIndex); } else { element.removeAttribute('tabindex'); } // Use `delete` to restore native focus method. if (this._overrodeFocusMethod) { delete element.focus; } } // See note in InertRoot.destructor for why we cast these nulls to ANY. this._node = /** @type {?} */null; this._inertRoots = /** @type {?} */null; this._destroyed = true; } /** * @type {boolean} Whether this object is obsolete because the managed node is no longer inert. * If the object has been destroyed, any attempt to access it will cause an exception. */ }, { key: '_throwIfDestroyed', /** * Throw if user tries to access destroyed InertNode. */ value: function _throwIfDestroyed() { if (this.destroyed) { throw new Error('Trying to access destroyed InertNode'); } } /** @return {boolean} */ }, { key: 'ensureUntabbable', /** Save the existing tabindex value and make the node untabbable and unfocusable */ value: function ensureUntabbable() { if (this.node.nodeType !== Node.ELEMENT_NODE) { return; } var element = /** @type {!HTMLElement} */this.node; if (matches.call(element, _focusableElementsString)) { if ( /** @type {!HTMLElement} */element.tabIndex === -1 && this.hasSavedTabIndex) { return; } if (element.hasAttribute('tabindex')) { this._savedTabIndex = /** @type {!HTMLElement} */element.tabIndex; } element.setAttribute('tabindex', '-1'); if (element.nodeType === Node.ELEMENT_NODE) { element.focus = function () {}; this._overrodeFocusMethod = true; } } else if (element.hasAttribute('tabindex')) { this._savedTabIndex = /** @type {!HTMLElement} */element.tabIndex; element.removeAttribute('tabindex'); } } /** * Add another inert root to this inert node's set of managing inert roots. * @param {!InertRoot} inertRoot */ }, { key: 'addInertRoot', value: function addInertRoot(inertRoot) { this._throwIfDestroyed(); this._inertRoots.add(inertRoot); } /** * Remove the given inert root from this inert node's set of managing inert roots. * If the set of managing inert roots becomes empty, this node is no longer inert, * so the object should be destroyed. * @param {!InertRoot} inertRoot */ }, { key: 'removeInertRoot', value: function removeInertRoot(inertRoot) { this._throwIfDestroyed(); this._inertRoots['delete'](inertRoot); if (this._inertRoots.size === 0) { this.destructor(); } } }, { key: 'destroyed', get: function get() { return (/** @type {!InertNode} */this._destroyed ); } }, { key: 'hasSavedTabIndex', get: function get() { return this._savedTabIndex !== null; } /** @return {!Node} */ }, { key: 'node', get: function get() { this._throwIfDestroyed(); return this._node; } /** @param {?number} tabIndex */ }, { key: 'savedTabIndex', set: function set(tabIndex) { this._throwIfDestroyed(); this._savedTabIndex = tabIndex; } /** @return {?number} */ , get: function get() { this._throwIfDestroyed(); return this._savedTabIndex; } }]); return InertNode; }(); /** * InertManager is a per-document singleton object which manages all inert roots and nodes. * * When an element becomes an inert root by having an `inert` attribute set and/or its `inert` * property set to `true`, the `setInert` method creates an `InertRoot` object for the element. * The `InertRoot` in turn registers itself as managing all of the element's focusable descendant * nodes via the `register()` method. The `InertManager` ensures that a single `InertNode` instance * is created for each such node, via the `_managedNodes` map. */ var InertManager = function () { /** * @param {!Document} document */ function InertManager(document) { _classCallCheck(this, InertManager); if (!document) { throw new Error('Missing required argument; InertManager needs to wrap a document.'); } /** @type {!Document} */ this._document = document; /** * All managed nodes known to this InertManager. In a map to allow looking up by Node. * @type {!Map<!Node, !InertNode>} */ this._managedNodes = new Map(); /** * All inert roots known to this InertManager. In a map to allow looking up by Node. * @type {!Map<!Node, !InertRoot>} */ this._inertRoots = new Map(); /** * Observer for mutations on `document.body`. * @type {!MutationObserver} */ this._observer = new MutationObserver(this._watchForInert.bind(this)); // Add inert style. addInertStyle(document.head || document.body || document.documentElement); // Wait for document to be loaded. if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', this._onDocumentLoaded.bind(this)); } else { this._onDocumentLoaded(); } } /** * Set whether the given element should be an inert root or not. * @param {!HTMLElement} root * @param {boolean} inert */ _createClass(InertManager, [{ key: 'setInert', value: function setInert(root, inert) { if (inert) { if (this._inertRoots.has(root)) { // element is already inert return; } var inertRoot = new InertRoot(root, this); root.setAttribute('inert', ''); this._inertRoots.set(root, inertRoot); // If not contained in the document, it must be in a shadowRoot. // Ensure inert styles are added there. if (!this._document.body.contains(root)) { var parent = root.parentNode; while (parent) { if (parent.nodeType === 11) { addInertStyle(parent); } parent = parent.parentNode; } } } else { if (!this._inertRoots.has(root)) { // element is already non-inert return; } var _inertRoot = this._inertRoots.get(root); _inertRoot.destructor(); this._inertRoots['delete'](root); root.removeAttribute('inert'); } } /** * Get the InertRoot object corresponding to the given inert root element, if any. * @param {!Node} element * @return {!InertRoot|undefined} */ }, { key: 'getInertRoot', value: function getInertRoot(element) { return this._inertRoots.get(element); } /** * Register the given InertRoot as managing the given node. * In the case where the node has a previously existing inert root, this inert root will * be added to its set of inert roots. * @param {!Node} node * @param {!InertRoot} inertRoot * @return {!InertNode} inertNode */ }, { key: 'register', value: function register(node, inertRoot) { var inertNode = this._managedNodes.get(node); if (inertNode !== undefined) { // node was already in an inert subtree inertNode.addInertRoot(inertRoot); } else { inertNode = new InertNode(node, inertRoot); } this._managedNodes.set(node, inertNode); return inertNode; } /** * De-register the given InertRoot as managing the given inert node. * Removes the inert root from the InertNode's set of managing inert roots, and remove the inert * node from the InertManager's set of managed nodes if it is destroyed. * If the node is not currently managed, this is essentially a no-op. * @param {!Node} node * @param {!InertRoot} inertRoot * @return {?InertNode} The potentially destroyed InertNode associated with this node, if any. */ }, { key: 'deregister', value: function deregister(node, inertRoot) { var inertNode = this._managedNodes.get(node); if (!inertNode) { return null; } inertNode.removeInertRoot(inertRoot); if (inertNode.destroyed) { this._managedNodes['delete'](node); } return inertNode; } /** * Callback used when document has finished loading. */ }, { key: '_onDocumentLoaded', value: function _onDocumentLoaded() { // Find all inert roots in document and make them actually inert. var inertElements = slice.call(this._document.querySelectorAll('[inert]')); inertElements.forEach(function (inertElement) { this.setInert(inertElement, true); }, this); // Comment this out to use programmatic API only. this._observer.observe(this._document.body || this._document.documentElement, { attributes: true, subtree: true, childList: true }); } /** * Callback used when mutation observer detects attribute changes. * @param {!Array<!MutationRecord>} records * @param {!MutationObserver} self */ }, { key: '_watchForInert', value: function _watchForInert(records, self) { var _this = this; records.forEach(function (record) { switch (record.type) { case 'childList': slice.call(record.addedNodes).forEach(function (node) { if (node.nodeType !== Node.ELEMENT_NODE) { return; } var inertElements = slice.call(node.querySelectorAll('[inert]')); if (matches.call(node, '[inert]')) { inertElements.unshift(node); } inertElements.forEach(function (inertElement) { this.setInert(inertElement, true); }, _this); }, _this); break; case 'attributes': if (record.attributeName !== 'inert') { return; } var target = /** @type {!HTMLElement} */record.target; var inert = target.hasAttribute('inert'); _this.setInert(target, inert); break; } }, this); } }]); return InertManager; }(); /** * Recursively walk the composed tree from |node|. * @param {!Node} node * @param {(function (!HTMLElement))=} callback Callback to be called for each element traversed, * before descending into child nodes. * @param {?ShadowRoot=} shadowRootAncestor The nearest ShadowRoot ancestor, if any. */ function composedTreeWalk(node, callback, shadowRootAncestor) { if (node.nodeType == Node.ELEMENT_NODE) { var element = /** @type {!HTMLElement} */node; if (callback) { callback(element); } // Descend into node: // If it has a ShadowRoot, ignore all child elements - these will be picked // up by the <content> or <shadow> elements. Descend straight into the // ShadowRoot. var shadowRoot = /** @type {!HTMLElement} */element.shadowRoot; if (shadowRoot) { composedTreeWalk(shadowRoot, callback, shadowRoot); return; } // If it is a <content> element, descend into distributed elements - these // are elements from outside the shadow root which are rendered inside the // shadow DOM. if (element.localName == 'content') { var content = /** @type {!HTMLContentElement} */element; // Verifies if ShadowDom v0 is supported. var distributedNodes = content.getDistributedNodes ? content.getDistributedNodes() : []; for (var i = 0; i < distributedNodes.length; i++) { composedTreeWalk(distributedNodes[i], callback, shadowRootAncestor); } return; } // If it is a <slot> element, descend into assigned nodes - these // are elements from outside the shadow root which are rendered inside the // shadow DOM. if (element.localName == 'slot') { var slot = /** @type {!HTMLSlotElement} */element; // Verify if ShadowDom v1 is supported. var _distributedNodes = slot.assignedNodes ? slot.assignedNodes({ flatten: true }) : []; for (var _i = 0; _i < _distributedNodes.length; _i++) { composedTreeWalk(_distributedNodes[_i], callback, shadowRootAncestor); } return; } } // If it is neither the parent of a ShadowRoot, a <content> element, a <slot> // element, nor a <shadow> element recurse normally. var child = node.firstChild; while (child != null) { composedTreeWalk(child, callback, shadowRootAncestor); child = child.nextSibling; } } /** * Adds a style element to the node containing the inert specific styles * @param {!Node} node */ function addInertStyle(node) { if (node.querySelector('style#inert-style, link#inert-style')) { return; } var style = document.createElement('style'); style.setAttribute('id', 'inert-style'); style.textContent = '\n' + '[inert] {\n' + ' pointer-events: none;\n' + ' cursor: default;\n' + '}\n' + '\n' + '[inert], [inert] * {\n' + ' -webkit-user-select: none;\n' + ' -moz-user-select: none;\n' + ' -ms-user-select: none;\n' + ' user-select: none;\n' + '}\n'; node.appendChild(style); } if (!HTMLElement.prototype.hasOwnProperty('inert')) { /** @type {!InertManager} */ var inertManager = new InertManager(document); Object.defineProperty(HTMLElement.prototype, 'inert', { enumerable: true, /** @this {!HTMLElement} */ get: function get() { return this.hasAttribute('inert'); }, /** @this {!HTMLElement} */ set: function set(inert) { inertManager.setInert(this, inert); } }); } })(); }))); vendor/react.min.js 0000644 00000024604 15151622574 0010275 0 ustar 00 /** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ !function(){"use strict";var e,t;e=this,t=function(e){function t(e,t,n){this.props=e,this.context=t,this.refs=F,this.updater=n||O}function n(){}function r(e,t,n){this.props=e,this.context=t,this.refs=F,this.updater=n||O}function o(e,t,n){var r,o={},u=null,a=null;if(null!=t)for(r in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(u=""+t.key),t)U.call(t,r)&&!q.hasOwnProperty(r)&&(o[r]=t[r]);var i=arguments.length-2;if(1===i)o.children=n;else if(1<i){for(var l=Array(i),c=0;c<i;c++)l[c]=arguments[c+2];o.children=l}if(e&&e.defaultProps)for(r in i=e.defaultProps)void 0===o[r]&&(o[r]=i[r]);return{$$typeof:k,type:e,key:u,ref:a,props:o,_owner:V.current}}function u(e){return"object"==typeof e&&null!==e&&e.$$typeof===k}function a(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function i(e,t,n,r,o){var l=typeof e;"undefined"!==l&&"boolean"!==l||(e=null);var c=!1;if(null===e)c=!0;else switch(l){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case k:case w:c=!0}}if(c)return o=o(c=e),e=""===r?"."+a(c,0):r,D(o)?(n="",null!=e&&(n=e.replace(A,"$&/")+"/"),i(o,t,n,"",(function(e){return e}))):null!=o&&(u(o)&&(o=function(e,t){return{$$typeof:k,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(o,n+(!o.key||c&&c.key===o.key?"":(""+o.key).replace(A,"$&/")+"/")+e)),t.push(o)),1;if(c=0,r=""===r?".":r+":",D(e))for(var f=0;f<e.length;f++){var s=r+a(l=e[f],f);c+=i(l,t,n,s,o)}else if(s=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=T&&e[T]||e["@@iterator"])?e:null}(e),"function"==typeof s)for(e=s.call(e),f=0;!(l=e.next()).done;)c+=i(l=l.value,t,n,s=r+a(l,f++),o);else if("object"===l)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return c}function l(e,t,n){if(null==e)return e;var r=[],o=0;return i(e,r,"","",(function(e){return t.call(n,e,o++)})),r}function c(e){if(-1===e._status){var t=e._result;(t=t()).then((function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)}),(function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)})),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}function f(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<y(o,t)))break e;e[r]=t,e[n]=o,n=r}}function s(e){return 0===e.length?null:e[0]}function p(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,u=o>>>1;r<u;){var a=2*(r+1)-1,i=e[a],l=a+1,c=e[l];if(0>y(i,n))l<o&&0>y(c,i)?(e[r]=c,e[l]=n,r=l):(e[r]=i,e[a]=n,r=a);else{if(!(l<o&&0>y(c,n)))break e;e[r]=c,e[l]=n,r=l}}}return t}function y(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}function d(e){for(var t=s(J);null!==t;){if(null===t.callback)p(J);else{if(!(t.startTime<=e))break;p(J),t.sortIndex=t.expirationTime,f(G,t)}t=s(J)}}function b(e){if(te=!1,d(e),!ee)if(null!==s(G))ee=!0,_(v);else{var t=s(J);null!==t&&h(b,t.startTime-e)}}function v(e,t){ee=!1,te&&(te=!1,re(ie),ie=-1),Z=!0;var n=X;try{for(d(t),Q=s(G);null!==Q&&(!(Q.expirationTime>t)||e&&!m());){var r=Q.callback;if("function"==typeof r){Q.callback=null,X=Q.priorityLevel;var o=r(Q.expirationTime<=t);t=H(),"function"==typeof o?Q.callback=o:Q===s(G)&&p(G),d(t)}else p(G);Q=s(G)}if(null!==Q)var u=!0;else{var a=s(J);null!==a&&h(b,a.startTime-t),u=!1}return u}finally{Q=null,X=n,Z=!1}}function m(){return!(H()-ce<le)}function _(e){ae=e,ue||(ue=!0,se())}function h(e,t){ie=ne((function(){e(H())}),t)}function g(e){throw Error("act(...) is not supported in production builds of React.")}var k=Symbol.for("react.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),E=Symbol.for("react.provider"),R=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),I=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),T=Symbol.iterator,O={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,n){},enqueueReplaceState:function(e,t,n,r){},enqueueSetState:function(e,t,n,r){}},L=Object.assign,F={};t.prototype.isReactComponent={},t.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},t.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},n.prototype=t.prototype;var M=r.prototype=new n;M.constructor=r,L(M,t.prototype),M.isPureReactComponent=!0;var D=Array.isArray,U=Object.prototype.hasOwnProperty,V={current:null},q={key:!0,ref:!0,__self:!0,__source:!0},A=/\/+/g,N={current:null},B={transition:null};if("object"==typeof performance&&"function"==typeof performance.now)var z=performance,H=function(){return z.now()};else{var W=Date,Y=W.now();H=function(){return W.now()-Y}}var G=[],J=[],K=1,Q=null,X=3,Z=!1,ee=!1,te=!1,ne="function"==typeof setTimeout?setTimeout:null,re="function"==typeof clearTimeout?clearTimeout:null,oe="undefined"!=typeof setImmediate?setImmediate:null;"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var ue=!1,ae=null,ie=-1,le=5,ce=-1,fe=function(){if(null!==ae){var e=H();ce=e;var t=!0;try{t=ae(!0,e)}finally{t?se():(ue=!1,ae=null)}}else ue=!1};if("function"==typeof oe)var se=function(){oe(fe)};else if("undefined"!=typeof MessageChannel){var pe=(M=new MessageChannel).port2;M.port1.onmessage=fe,se=function(){pe.postMessage(null)}}else se=function(){ne(fe,0)};M={ReactCurrentDispatcher:N,ReactCurrentOwner:V,ReactCurrentBatchConfig:B,Scheduler:{__proto__:null,unstable_ImmediatePriority:1,unstable_UserBlockingPriority:2,unstable_NormalPriority:3,unstable_IdlePriority:5,unstable_LowPriority:4,unstable_runWithPriority:function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=X;X=e;try{return t()}finally{X=n}},unstable_next:function(e){switch(X){case 1:case 2:case 3:var t=3;break;default:t=X}var n=X;X=t;try{return e()}finally{X=n}},unstable_scheduleCallback:function(e,t,n){var r=H();switch(n="object"==typeof n&&null!==n&&"number"==typeof(n=n.delay)&&0<n?r+n:r,e){case 1:var o=-1;break;case 2:o=250;break;case 5:o=1073741823;break;case 4:o=1e4;break;default:o=5e3}return e={id:K++,callback:t,priorityLevel:e,startTime:n,expirationTime:o=n+o,sortIndex:-1},n>r?(e.sortIndex=n,f(J,e),null===s(G)&&e===s(J)&&(te?(re(ie),ie=-1):te=!0,h(b,n-r))):(e.sortIndex=o,f(G,e),ee||Z||(ee=!0,_(v))),e},unstable_cancelCallback:function(e){e.callback=null},unstable_wrapCallback:function(e){var t=X;return function(){var n=X;X=t;try{return e.apply(this,arguments)}finally{X=n}}},unstable_getCurrentPriorityLevel:function(){return X},unstable_shouldYield:m,unstable_requestPaint:function(){},unstable_continueExecution:function(){ee||Z||(ee=!0,_(v))},unstable_pauseExecution:function(){},unstable_getFirstCallbackNode:function(){return s(G)},get unstable_now(){return H},unstable_forceFrameRate:function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):le=0<e?Math.floor(1e3/e):5},unstable_Profiling:null}},e.Children={map:l,forEach:function(e,t,n){l(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return l(e,(function(){t++})),t},toArray:function(e){return l(e,(function(e){return e}))||[]},only:function(e){if(!u(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},e.Component=t,e.Fragment=S,e.Profiler=C,e.PureComponent=r,e.StrictMode=x,e.Suspense=$,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=M,e.act=g,e.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=L({},e.props),o=e.key,u=e.ref,a=e._owner;if(null!=t){if(void 0!==t.ref&&(u=t.ref,a=V.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var i=e.type.defaultProps;for(l in t)U.call(t,l)&&!q.hasOwnProperty(l)&&(r[l]=void 0===t[l]&&void 0!==i?i[l]:t[l])}var l=arguments.length-2;if(1===l)r.children=n;else if(1<l){i=Array(l);for(var c=0;c<l;c++)i[c]=arguments[c+2];r.children=i}return{$$typeof:k,type:e.type,key:o,ref:u,props:r,_owner:a}},e.createContext=function(e){return(e={$$typeof:R,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:E,_context:e},e.Consumer=e},e.createElement=o,e.createFactory=function(e){var t=o.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:P,render:e}},e.isValidElement=u,e.lazy=function(e){return{$$typeof:j,_payload:{_status:-1,_result:e},_init:c}},e.memo=function(e,t){return{$$typeof:I,type:e,compare:void 0===t?null:t}},e.startTransition=function(e,t){t=B.transition,B.transition={};try{e()}finally{B.transition=t}},e.unstable_act=g,e.useCallback=function(e,t){return N.current.useCallback(e,t)},e.useContext=function(e){return N.current.useContext(e)},e.useDebugValue=function(e,t){},e.useDeferredValue=function(e){return N.current.useDeferredValue(e)},e.useEffect=function(e,t){return N.current.useEffect(e,t)},e.useId=function(){return N.current.useId()},e.useImperativeHandle=function(e,t,n){return N.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return N.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return N.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return N.current.useMemo(e,t)},e.useReducer=function(e,t,n){return N.current.useReducer(e,t,n)},e.useRef=function(e){return N.current.useRef(e)},e.useState=function(e){return N.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return N.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return N.current.useTransition()},e.version="18.3.1"},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).React={})}(); vendor/wp-polyfill-inert.min.js 0000644 00000020020 15151622574 0012560 0 ustar 00 !function(e){"object"==typeof exports&&"undefined"!=typeof module||"function"!=typeof define||!define.amd?e():define("inert",e)}((function(){"use strict";var e,t,n,i,o,r,s=function(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e};function a(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){d(this,u),this._inertManager=t,this._rootElement=e,this._managedNodes=new Set,this._rootElement.hasAttribute("aria-hidden")?this._savedAriaHidden=this._rootElement.getAttribute("aria-hidden"):this._savedAriaHidden=null,this._rootElement.setAttribute("aria-hidden","true"),this._makeSubtreeUnfocusable(this._rootElement),this._observer=new MutationObserver(this._onMutation.bind(this)),this._observer.observe(this._rootElement,{attributes:!0,childList:!0,subtree:!0})}function h(e,t){d(this,h),this._node=e,this._overrodeFocusMethod=!1,this._inertRoots=new Set([t]),this._savedTabIndex=null,this._destroyed=!1,this.ensureUntabbable()}function l(e){if(d(this,l),!e)throw new Error("Missing required argument; InertManager needs to wrap a document.");this._document=e,this._managedNodes=new Map,this._inertRoots=new Map,this._observer=new MutationObserver(this._watchForInert.bind(this)),_(e.head||e.body||e.documentElement),"loading"===e.readyState?e.addEventListener("DOMContentLoaded",this._onDocumentLoaded.bind(this)):this._onDocumentLoaded()}function c(e,t,n){if(e.nodeType==Node.ELEMENT_NODE){var i=e;if(s=(t&&t(i),i.shadowRoot))return void c(s,t,s);if("content"==i.localName){for(var o=(s=i).getDistributedNodes?s.getDistributedNodes():[],r=0;r<o.length;r++)c(o[r],t,n);return}if("slot"==i.localName){for(var s,a=(s=i).assignedNodes?s.assignedNodes({flatten:!0}):[],d=0;d<a.length;d++)c(a[d],t,n);return}}for(var u=e.firstChild;null!=u;)c(u,t,n),u=u.nextSibling}function _(e){var t;e.querySelector("style#inert-style, link#inert-style")||((t=document.createElement("style")).setAttribute("id","inert-style"),t.textContent="\n[inert] {\n pointer-events: none;\n cursor: default;\n}\n\n[inert], [inert] * {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n",e.appendChild(t))}"undefined"!=typeof window&&"undefined"!=typeof Element&&(e=Array.prototype.slice,t=Element.prototype.matches||Element.prototype.msMatchesSelector,n=["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","details","summary","iframe","object","embed","video","[contenteditable]"].join(","),s(u,[{key:"destructor",value:function(){this._observer.disconnect(),this._rootElement&&(null!==this._savedAriaHidden?this._rootElement.setAttribute("aria-hidden",this._savedAriaHidden):this._rootElement.removeAttribute("aria-hidden")),this._managedNodes.forEach((function(e){this._unmanageNode(e.node)}),this),this._observer=null,this._rootElement=null,this._managedNodes=null,this._inertManager=null}},{key:"_makeSubtreeUnfocusable",value:function(e){var t=this,n=(c(e,(function(e){return t._visitNode(e)})),document.activeElement);if(!document.body.contains(e)){for(var i=e,o=void 0;i;){if(i.nodeType===Node.DOCUMENT_FRAGMENT_NODE){o=i;break}i=i.parentNode}o&&(n=o.activeElement)}e.contains(n)&&(n.blur(),n===document.activeElement&&document.body.focus())}},{key:"_visitNode",value:function(e){e.nodeType===Node.ELEMENT_NODE&&(e!==this._rootElement&&e.hasAttribute("inert")&&this._adoptInertRoot(e),(t.call(e,n)||e.hasAttribute("tabindex"))&&this._manageNode(e))}},{key:"_manageNode",value:function(e){e=this._inertManager.register(e,this),this._managedNodes.add(e)}},{key:"_unmanageNode",value:function(e){(e=this._inertManager.deregister(e,this))&&this._managedNodes.delete(e)}},{key:"_unmanageSubtree",value:function(e){var t=this;c(e,(function(e){return t._unmanageNode(e)}))}},{key:"_adoptInertRoot",value:function(e){var t=this._inertManager.getInertRoot(e);t||(this._inertManager.setInert(e,!0),t=this._inertManager.getInertRoot(e)),t.managedNodes.forEach((function(e){this._manageNode(e.node)}),this)}},{key:"_onMutation",value:function(t,n){t.forEach((function(t){var n,i=t.target;"childList"===t.type?(e.call(t.addedNodes).forEach((function(e){this._makeSubtreeUnfocusable(e)}),this),e.call(t.removedNodes).forEach((function(e){this._unmanageSubtree(e)}),this)):"attributes"===t.type&&("tabindex"===t.attributeName?this._manageNode(i):i!==this._rootElement&&"inert"===t.attributeName&&i.hasAttribute("inert")&&(this._adoptInertRoot(i),n=this._inertManager.getInertRoot(i),this._managedNodes.forEach((function(e){i.contains(e.node)&&n._manageNode(e.node)}))))}),this)}},{key:"managedNodes",get:function(){return new Set(this._managedNodes)}},{key:"hasSavedAriaHidden",get:function(){return null!==this._savedAriaHidden}},{key:"savedAriaHidden",set:function(e){this._savedAriaHidden=e},get:function(){return this._savedAriaHidden}}]),i=u,s(h,[{key:"destructor",value:function(){var e;this._throwIfDestroyed(),this._node&&this._node.nodeType===Node.ELEMENT_NODE&&(e=this._node,null!==this._savedTabIndex?e.setAttribute("tabindex",this._savedTabIndex):e.removeAttribute("tabindex"),this._overrodeFocusMethod&&delete e.focus),this._node=null,this._inertRoots=null,this._destroyed=!0}},{key:"_throwIfDestroyed",value:function(){if(this.destroyed)throw new Error("Trying to access destroyed InertNode")}},{key:"ensureUntabbable",value:function(){var e;this.node.nodeType===Node.ELEMENT_NODE&&(e=this.node,t.call(e,n)?-1===e.tabIndex&&this.hasSavedTabIndex||(e.hasAttribute("tabindex")&&(this._savedTabIndex=e.tabIndex),e.setAttribute("tabindex","-1"),e.nodeType===Node.ELEMENT_NODE&&(e.focus=function(){},this._overrodeFocusMethod=!0)):e.hasAttribute("tabindex")&&(this._savedTabIndex=e.tabIndex,e.removeAttribute("tabindex")))}},{key:"addInertRoot",value:function(e){this._throwIfDestroyed(),this._inertRoots.add(e)}},{key:"removeInertRoot",value:function(e){this._throwIfDestroyed(),this._inertRoots.delete(e),0===this._inertRoots.size&&this.destructor()}},{key:"destroyed",get:function(){return this._destroyed}},{key:"hasSavedTabIndex",get:function(){return null!==this._savedTabIndex}},{key:"node",get:function(){return this._throwIfDestroyed(),this._node}},{key:"savedTabIndex",set:function(e){this._throwIfDestroyed(),this._savedTabIndex=e},get:function(){return this._throwIfDestroyed(),this._savedTabIndex}}]),o=h,s(l,[{key:"setInert",value:function(e,t){if(t){if(!this._inertRoots.has(e)&&(t=new i(e,this),e.setAttribute("inert",""),this._inertRoots.set(e,t),!this._document.body.contains(e)))for(var n=e.parentNode;n;)11===n.nodeType&&_(n),n=n.parentNode}else this._inertRoots.has(e)&&(this._inertRoots.get(e).destructor(),this._inertRoots.delete(e),e.removeAttribute("inert"))}},{key:"getInertRoot",value:function(e){return this._inertRoots.get(e)}},{key:"register",value:function(e,t){var n=this._managedNodes.get(e);return void 0!==n?n.addInertRoot(t):n=new o(e,t),this._managedNodes.set(e,n),n}},{key:"deregister",value:function(e,t){var n=this._managedNodes.get(e);return n?(n.removeInertRoot(t),n.destroyed&&this._managedNodes.delete(e),n):null}},{key:"_onDocumentLoaded",value:function(){e.call(this._document.querySelectorAll("[inert]")).forEach((function(e){this.setInert(e,!0)}),this),this._observer.observe(this._document.body||this._document.documentElement,{attributes:!0,subtree:!0,childList:!0})}},{key:"_watchForInert",value:function(n,i){var o=this;n.forEach((function(n){switch(n.type){case"childList":e.call(n.addedNodes).forEach((function(n){var i;n.nodeType===Node.ELEMENT_NODE&&(i=e.call(n.querySelectorAll("[inert]")),t.call(n,"[inert]")&&i.unshift(n),i.forEach((function(e){this.setInert(e,!0)}),o))}),o);break;case"attributes":if("inert"!==n.attributeName)return;var i=n.target,r=i.hasAttribute("inert");o.setInert(i,r)}}),this)}}]),s=l,HTMLElement.prototype.hasOwnProperty("inert")||(r=new s(document),Object.defineProperty(HTMLElement.prototype,"inert",{enumerable:!0,get:function(){return this.hasAttribute("inert")},set:function(e){r.setInert(this,e)}})))})); vendor/wp-polyfill-node-contains.js 0000604 00000001203 15151622574 0013414 0 ustar 00 // Node.prototype.contains (function() { function contains(node) { if (!(0 in arguments)) { throw new TypeError('1 argument is required'); } do { if (this === node) { return true; } // eslint-disable-next-line no-cond-assign } while (node = node && node.parentNode); return false; } // IE if ('HTMLElement' in self && 'contains' in HTMLElement.prototype) { try { delete HTMLElement.prototype.contains; // eslint-disable-next-line no-empty } catch (e) {} } if ('Node' in self) { Node.prototype.contains = contains; } else { document.contains = Element.prototype.contains = contains; } }()); vendor/moment.min.js 0000644 00000162674 15151622574 0010510 0 ustar 00 !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var H;function _(){return H.apply(null,arguments)}function y(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function F(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function L(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(var t in e)if(c(e,t))return;return 1}function g(e){return void 0===e}function w(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function V(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function G(e,t){for(var n=[],s=e.length,i=0;i<s;++i)n.push(t(e[i],i));return n}function E(e,t){for(var n in t)c(t,n)&&(e[n]=t[n]);return c(t,"toString")&&(e.toString=t.toString),c(t,"valueOf")&&(e.valueOf=t.valueOf),e}function l(e,t,n,s){return Wt(e,t,n,s,!0).utc()}function p(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function A(e){var t,n,s=e._d&&!isNaN(e._d.getTime());return s&&(t=p(e),n=j.call(t.parsedDateParts,function(e){return null!=e}),s=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||(t.meridiem,n)),e._strict)&&(s=s&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e)?s:(e._isValid=s,e._isValid)}function I(e){var t=l(NaN);return null!=e?E(p(t),e):p(t).userInvalidated=!0,t}var j=Array.prototype.some||function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1},Z=_.momentProperties=[],z=!1;function q(e,t){var n,s,i,r=Z.length;if(g(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),g(t._i)||(e._i=t._i),g(t._f)||(e._f=t._f),g(t._l)||(e._l=t._l),g(t._strict)||(e._strict=t._strict),g(t._tzm)||(e._tzm=t._tzm),g(t._isUTC)||(e._isUTC=t._isUTC),g(t._offset)||(e._offset=t._offset),g(t._pf)||(e._pf=p(t)),g(t._locale)||(e._locale=t._locale),0<r)for(n=0;n<r;n++)g(i=t[s=Z[n]])||(e[s]=i);return e}function $(e){q(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===z&&(z=!0,_.updateOffset(this),z=!1)}function k(e){return e instanceof $||null!=e&&null!=e._isAMomentObject}function B(e){!1===_.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function e(r,a){var o=!0;return E(function(){if(null!=_.deprecationHandler&&_.deprecationHandler(null,r),o){for(var e,t,n=[],s=arguments.length,i=0;i<s;i++){if(e="","object"==typeof arguments[i]){for(t in e+="\n["+i+"] ",arguments[0])c(arguments[0],t)&&(e+=t+": "+arguments[0][t]+", ");e=e.slice(0,-2)}else e=arguments[i];n.push(e)}B(r+"\nArguments: "+Array.prototype.slice.call(n).join("")+"\n"+(new Error).stack),o=!1}return a.apply(this,arguments)},a)}var J={};function Q(e,t){null!=_.deprecationHandler&&_.deprecationHandler(e,t),J[e]||(B(t),J[e]=!0)}function a(e){return"undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function X(e,t){var n,s=E({},e);for(n in t)c(t,n)&&(F(e[n])&&F(t[n])?(s[n]={},E(s[n],e[n]),E(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)c(e,n)&&!c(t,n)&&F(e[n])&&(s[n]=E({},s[n]));return s}function K(e){null!=e&&this.set(e)}_.suppressDeprecationWarnings=!1,_.deprecationHandler=null;var ee=Object.keys||function(e){var t,n=[];for(t in e)c(e,t)&&n.push(t);return n};function r(e,t,n){var s=""+Math.abs(e);return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,t-s.length)).toString().substr(1)+s}var te=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ne=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,se={},ie={};function s(e,t,n,s){var i="string"==typeof s?function(){return this[s]()}:s;e&&(ie[e]=i),t&&(ie[t[0]]=function(){return r(i.apply(this,arguments),t[1],t[2])}),n&&(ie[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function re(e,t){return e.isValid()?(t=ae(t,e.localeData()),se[t]=se[t]||function(s){for(var e,i=s.match(te),t=0,r=i.length;t<r;t++)ie[i[t]]?i[t]=ie[i[t]]:i[t]=(e=i[t]).match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"");return function(e){for(var t="",n=0;n<r;n++)t+=a(i[n])?i[n].call(e,s):i[n];return t}}(t),se[t](e)):e.localeData().invalidDate()}function ae(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(ne.lastIndex=0;0<=n&&ne.test(e);)e=e.replace(ne,s),ne.lastIndex=0,--n;return e}var oe={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function o(e){return"string"==typeof e?oe[e]||oe[e.toLowerCase()]:void 0}function ue(e){var t,n,s={};for(n in e)c(e,n)&&(t=o(n))&&(s[t]=e[n]);return s}var le={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};var de=/\d/,t=/\d\d/,he=/\d{3}/,ce=/\d{4}/,fe=/[+-]?\d{6}/,n=/\d\d?/,me=/\d\d\d\d?/,_e=/\d\d\d\d\d\d?/,ye=/\d{1,3}/,ge=/\d{1,4}/,we=/[+-]?\d{1,6}/,pe=/\d+/,ke=/[+-]?\d+/,Me=/Z|[+-]\d\d:?\d\d/gi,ve=/Z|[+-]\d\d(?::?\d\d)?/gi,i=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,u=/^[1-9]\d?/,d=/^([1-9]\d|\d)/;function h(e,n,s){Ye[e]=a(n)?n:function(e,t){return e&&s?s:n}}function De(e,t){return c(Ye,e)?Ye[e](t._strict,t._locale):new RegExp(f(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function f(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function m(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function M(e){var e=+e,t=0;return t=0!=e&&isFinite(e)?m(e):t}var Ye={},Se={};function v(e,n){var t,s,i=n;for("string"==typeof e&&(e=[e]),w(n)&&(i=function(e,t){t[n]=M(e)}),s=e.length,t=0;t<s;t++)Se[e[t]]=i}function Oe(e,i){v(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}function be(e){return e%4==0&&e%100!=0||e%400==0}var D=0,Y=1,S=2,O=3,b=4,T=5,Te=6,xe=7,Ne=8;function We(e){return be(e)?366:365}s("Y",0,0,function(){var e=this.year();return e<=9999?r(e,4):"+"+e}),s(0,["YY",2],0,function(){return this.year()%100}),s(0,["YYYY",4],0,"year"),s(0,["YYYYY",5],0,"year"),s(0,["YYYYYY",6,!0],0,"year"),h("Y",ke),h("YY",n,t),h("YYYY",ge,ce),h("YYYYY",we,fe),h("YYYYYY",we,fe),v(["YYYYY","YYYYYY"],D),v("YYYY",function(e,t){t[D]=2===e.length?_.parseTwoDigitYear(e):M(e)}),v("YY",function(e,t){t[D]=_.parseTwoDigitYear(e)}),v("Y",function(e,t){t[D]=parseInt(e,10)}),_.parseTwoDigitYear=function(e){return M(e)+(68<M(e)?1900:2e3)};var x,Pe=Re("FullYear",!0);function Re(t,n){return function(e){return null!=e?(Ue(this,t,e),_.updateOffset(this,n),this):Ce(this,t)}}function Ce(e,t){if(!e.isValid())return NaN;var n=e._d,s=e._isUTC;switch(t){case"Milliseconds":return s?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return s?n.getUTCSeconds():n.getSeconds();case"Minutes":return s?n.getUTCMinutes():n.getMinutes();case"Hours":return s?n.getUTCHours():n.getHours();case"Date":return s?n.getUTCDate():n.getDate();case"Day":return s?n.getUTCDay():n.getDay();case"Month":return s?n.getUTCMonth():n.getMonth();case"FullYear":return s?n.getUTCFullYear():n.getFullYear();default:return NaN}}function Ue(e,t,n){var s,i,r;if(e.isValid()&&!isNaN(n)){switch(s=e._d,i=e._isUTC,t){case"Milliseconds":return i?s.setUTCMilliseconds(n):s.setMilliseconds(n);case"Seconds":return i?s.setUTCSeconds(n):s.setSeconds(n);case"Minutes":return i?s.setUTCMinutes(n):s.setMinutes(n);case"Hours":return i?s.setUTCHours(n):s.setHours(n);case"Date":return i?s.setUTCDate(n):s.setDate(n);case"FullYear":break;default:return}t=n,r=e.month(),e=29!==(e=e.date())||1!==r||be(t)?e:28,i?s.setUTCFullYear(t,r,e):s.setFullYear(t,r,e)}}function He(e,t){var n;return isNaN(e)||isNaN(t)?NaN:(n=(t%(n=12)+n)%n,e+=(t-n)/12,1==n?be(e)?29:28:31-n%7%2)}x=Array.prototype.indexOf||function(e){for(var t=0;t<this.length;++t)if(this[t]===e)return t;return-1},s("M",["MM",2],"Mo",function(){return this.month()+1}),s("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),s("MMMM",0,0,function(e){return this.localeData().months(this,e)}),h("M",n,u),h("MM",n,t),h("MMM",function(e,t){return t.monthsShortRegex(e)}),h("MMMM",function(e,t){return t.monthsRegex(e)}),v(["M","MM"],function(e,t){t[Y]=M(e)-1}),v(["MMM","MMMM"],function(e,t,n,s){s=n._locale.monthsParse(e,s,n._strict);null!=s?t[Y]=s:p(n).invalidMonth=e});var Fe="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Le="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Ve=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ge=i,Ee=i;function Ae(e,t){if(e.isValid()){if("string"==typeof t)if(/^\d+$/.test(t))t=M(t);else if(!w(t=e.localeData().monthsParse(t)))return;var n=(n=e.date())<29?n:Math.min(n,He(e.year(),t));e._isUTC?e._d.setUTCMonth(t,n):e._d.setMonth(t,n)}}function Ie(e){return null!=e?(Ae(this,e),_.updateOffset(this,!0),this):Ce(this,"Month")}function je(){function e(e,t){return t.length-e.length}for(var t,n,s=[],i=[],r=[],a=0;a<12;a++)n=l([2e3,a]),t=f(this.monthsShort(n,"")),n=f(this.months(n,"")),s.push(t),i.push(n),r.push(n),r.push(t);s.sort(e),i.sort(e),r.sort(e),this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Ze(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}function ze(e){var t;return e<100&&0<=e?((t=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,t)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function qe(e,t,n){n=7+t-n;return n-(7+ze(e,0,n).getUTCDay()-t)%7-1}function $e(e,t,n,s,i){var r,t=1+7*(t-1)+(7+n-s)%7+qe(e,s,i),n=t<=0?We(r=e-1)+t:t>We(e)?(r=e+1,t-We(e)):(r=e,t);return{year:r,dayOfYear:n}}function Be(e,t,n){var s,i,r=qe(e.year(),t,n),r=Math.floor((e.dayOfYear()-r-1)/7)+1;return r<1?s=r+N(i=e.year()-1,t,n):r>N(e.year(),t,n)?(s=r-N(e.year(),t,n),i=e.year()+1):(i=e.year(),s=r),{week:s,year:i}}function N(e,t,n){var s=qe(e,t,n),t=qe(e+1,t,n);return(We(e)-s+t)/7}s("w",["ww",2],"wo","week"),s("W",["WW",2],"Wo","isoWeek"),h("w",n,u),h("ww",n,t),h("W",n,u),h("WW",n,t),Oe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=M(e)});function Je(e,t){return e.slice(t,7).concat(e.slice(0,t))}s("d",0,"do","day"),s("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),s("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),s("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),s("e",0,0,"weekday"),s("E",0,0,"isoWeekday"),h("d",n),h("e",n),h("E",n),h("dd",function(e,t){return t.weekdaysMinRegex(e)}),h("ddd",function(e,t){return t.weekdaysShortRegex(e)}),h("dddd",function(e,t){return t.weekdaysRegex(e)}),Oe(["dd","ddd","dddd"],function(e,t,n,s){s=n._locale.weekdaysParse(e,s,n._strict);null!=s?t.d=s:p(n).invalidWeekday=e}),Oe(["d","e","E"],function(e,t,n,s){t[s]=M(e)});var Qe="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Xe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Ke="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),et=i,tt=i,nt=i;function st(){function e(e,t){return t.length-e.length}for(var t,n,s,i=[],r=[],a=[],o=[],u=0;u<7;u++)s=l([2e3,1]).day(u),t=f(this.weekdaysMin(s,"")),n=f(this.weekdaysShort(s,"")),s=f(this.weekdays(s,"")),i.push(t),r.push(n),a.push(s),o.push(t),o.push(n),o.push(s);i.sort(e),r.sort(e),a.sort(e),o.sort(e),this._weekdaysRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+i.join("|")+")","i")}function it(){return this.hours()%12||12}function rt(e,t){s(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function at(e,t){return t._meridiemParse}s("H",["HH",2],0,"hour"),s("h",["hh",2],0,it),s("k",["kk",2],0,function(){return this.hours()||24}),s("hmm",0,0,function(){return""+it.apply(this)+r(this.minutes(),2)}),s("hmmss",0,0,function(){return""+it.apply(this)+r(this.minutes(),2)+r(this.seconds(),2)}),s("Hmm",0,0,function(){return""+this.hours()+r(this.minutes(),2)}),s("Hmmss",0,0,function(){return""+this.hours()+r(this.minutes(),2)+r(this.seconds(),2)}),rt("a",!0),rt("A",!1),h("a",at),h("A",at),h("H",n,d),h("h",n,u),h("k",n,u),h("HH",n,t),h("hh",n,t),h("kk",n,t),h("hmm",me),h("hmmss",_e),h("Hmm",me),h("Hmmss",_e),v(["H","HH"],O),v(["k","kk"],function(e,t,n){e=M(e);t[O]=24===e?0:e}),v(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),v(["h","hh"],function(e,t,n){t[O]=M(e),p(n).bigHour=!0}),v("hmm",function(e,t,n){var s=e.length-2;t[O]=M(e.substr(0,s)),t[b]=M(e.substr(s)),p(n).bigHour=!0}),v("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[O]=M(e.substr(0,s)),t[b]=M(e.substr(s,2)),t[T]=M(e.substr(i)),p(n).bigHour=!0}),v("Hmm",function(e,t,n){var s=e.length-2;t[O]=M(e.substr(0,s)),t[b]=M(e.substr(s))}),v("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[O]=M(e.substr(0,s)),t[b]=M(e.substr(s,2)),t[T]=M(e.substr(i))});i=Re("Hours",!0);var ot,ut={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Fe,monthsShort:Le,week:{dow:0,doy:6},weekdays:Qe,weekdaysMin:Ke,weekdaysShort:Xe,meridiemParse:/[ap]\.?m?\.?/i},W={},lt={};function dt(e){return e&&e.toLowerCase().replace("_","-")}function ht(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=dt(e[r]).split("-")).length,n=(n=dt(e[r+1]))?n.split("-"):null;0<t;){if(s=ct(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&function(e,t){for(var n=Math.min(e.length,t.length),s=0;s<n;s+=1)if(e[s]!==t[s])return s;return n}(i,n)>=t-1)break;t--}r++}return ot}function ct(t){var e,n;if(void 0===W[t]&&"undefined"!=typeof module&&module&&module.exports&&(n=t)&&n.match("^[^/\\\\]*$"))try{e=ot._abbr,require("./locale/"+t),ft(e)}catch(e){W[t]=null}return W[t]}function ft(e,t){return e&&((t=g(t)?P(e):mt(e,t))?ot=t:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ot._abbr}function mt(e,t){if(null===t)return delete W[e],null;var n,s=ut;if(t.abbr=e,null!=W[e])Q("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=W[e]._config;else if(null!=t.parentLocale)if(null!=W[t.parentLocale])s=W[t.parentLocale]._config;else{if(null==(n=ct(t.parentLocale)))return lt[t.parentLocale]||(lt[t.parentLocale]=[]),lt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return W[e]=new K(X(s,t)),lt[e]&<[e].forEach(function(e){mt(e.name,e.config)}),ft(e),W[e]}function P(e){var t;if(!(e=e&&e._locale&&e._locale._abbr?e._locale._abbr:e))return ot;if(!y(e)){if(t=ct(e))return t;e=[e]}return ht(e)}function _t(e){var t=e._a;return t&&-2===p(e).overflow&&(t=t[Y]<0||11<t[Y]?Y:t[S]<1||t[S]>He(t[D],t[Y])?S:t[O]<0||24<t[O]||24===t[O]&&(0!==t[b]||0!==t[T]||0!==t[Te])?O:t[b]<0||59<t[b]?b:t[T]<0||59<t[T]?T:t[Te]<0||999<t[Te]?Te:-1,p(e)._overflowDayOfYear&&(t<D||S<t)&&(t=S),p(e)._overflowWeeks&&-1===t&&(t=xe),p(e)._overflowWeekday&&-1===t&&(t=Ne),p(e).overflow=t),e}var yt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,gt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,wt=/Z|[+-]\d\d(?::?\d\d)?/,pt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],kt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Mt=/^\/?Date\((-?\d+)/i,vt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Dt={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Yt(e){var t,n,s,i,r,a,o=e._i,u=yt.exec(o)||gt.exec(o),o=pt.length,l=kt.length;if(u){for(p(e).iso=!0,t=0,n=o;t<n;t++)if(pt[t][1].exec(u[1])){i=pt[t][0],s=!1!==pt[t][2];break}if(null==i)e._isValid=!1;else{if(u[3]){for(t=0,n=l;t<n;t++)if(kt[t][1].exec(u[3])){r=(u[2]||" ")+kt[t][0];break}if(null==r)return void(e._isValid=!1)}if(s||null==r){if(u[4]){if(!wt.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),xt(e)}else e._isValid=!1}}else e._isValid=!1}function St(e,t,n,s,i,r){e=[function(e){e=parseInt(e,10);{if(e<=49)return 2e3+e;if(e<=999)return 1900+e}return e}(e),Le.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&e.push(parseInt(r,10)),e}function Ot(e){var t,n,s=vt.exec(e._i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));s?(t=St(s[4],s[3],s[2],s[5],s[6],s[7]),function(e,t,n){if(!e||Xe.indexOf(e)===new Date(t[0],t[1],t[2]).getDay())return 1;p(n).weekdayMismatch=!0,n._isValid=!1}(s[1],t,e)&&(e._a=t,e._tzm=(t=s[8],n=s[9],s=s[10],t?Dt[t]:n?0:60*(((t=parseInt(s,10))-(n=t%100))/100)+n),e._d=ze.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),p(e).rfc2822=!0)):e._isValid=!1}function bt(e,t,n){return null!=e?e:null!=t?t:n}function Tt(e){var t,n,s,i,r,a,o,u,l,d,h,c=[];if(!e._d){for(s=e,i=new Date(_.now()),n=s._useUTC?[i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()]:[i.getFullYear(),i.getMonth(),i.getDate()],e._w&&null==e._a[S]&&null==e._a[Y]&&(null!=(i=(s=e)._w).GG||null!=i.W||null!=i.E?(u=1,l=4,r=bt(i.GG,s._a[D],Be(R(),1,4).year),a=bt(i.W,1),((o=bt(i.E,1))<1||7<o)&&(d=!0)):(u=s._locale._week.dow,l=s._locale._week.doy,h=Be(R(),u,l),r=bt(i.gg,s._a[D],h.year),a=bt(i.w,h.week),null!=i.d?((o=i.d)<0||6<o)&&(d=!0):null!=i.e?(o=i.e+u,(i.e<0||6<i.e)&&(d=!0)):o=u),a<1||a>N(r,u,l)?p(s)._overflowWeeks=!0:null!=d?p(s)._overflowWeekday=!0:(h=$e(r,a,o,u,l),s._a[D]=h.year,s._dayOfYear=h.dayOfYear)),null!=e._dayOfYear&&(i=bt(e._a[D],n[D]),(e._dayOfYear>We(i)||0===e._dayOfYear)&&(p(e)._overflowDayOfYear=!0),d=ze(i,0,e._dayOfYear),e._a[Y]=d.getUTCMonth(),e._a[S]=d.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=c[t]=n[t];for(;t<7;t++)e._a[t]=c[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[O]&&0===e._a[b]&&0===e._a[T]&&0===e._a[Te]&&(e._nextDay=!0,e._a[O]=0),e._d=(e._useUTC?ze:Ze).apply(null,c),r=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[O]=24),e._w&&void 0!==e._w.d&&e._w.d!==r&&(p(e).weekdayMismatch=!0)}}function xt(e){if(e._f===_.ISO_8601)Yt(e);else if(e._f===_.RFC_2822)Ot(e);else{e._a=[],p(e).empty=!0;for(var t,n,s,i,r,a=""+e._i,o=a.length,u=0,l=ae(e._f,e._locale).match(te)||[],d=l.length,h=0;h<d;h++)n=l[h],(t=(a.match(De(n,e))||[])[0])&&(0<(s=a.substr(0,a.indexOf(t))).length&&p(e).unusedInput.push(s),a=a.slice(a.indexOf(t)+t.length),u+=t.length),ie[n]?(t?p(e).empty=!1:p(e).unusedTokens.push(n),s=n,r=e,null!=(i=t)&&c(Se,s)&&Se[s](i,r._a,r,s)):e._strict&&!t&&p(e).unusedTokens.push(n);p(e).charsLeftOver=o-u,0<a.length&&p(e).unusedInput.push(a),e._a[O]<=12&&!0===p(e).bigHour&&0<e._a[O]&&(p(e).bigHour=void 0),p(e).parsedDateParts=e._a.slice(0),p(e).meridiem=e._meridiem,e._a[O]=function(e,t,n){if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((e=e.isPM(n))&&t<12&&(t+=12),t=e||12!==t?t:0):t}(e._locale,e._a[O],e._meridiem),null!==(o=p(e).era)&&(e._a[D]=e._locale.erasConvertYear(o,e._a[D])),Tt(e),_t(e)}}function Nt(e){var t,n,s,i=e._i,r=e._f;if(e._locale=e._locale||P(e._l),null===i||void 0===r&&""===i)return I({nullInput:!0});if("string"==typeof i&&(e._i=i=e._locale.preparse(i)),k(i))return new $(_t(i));if(V(i))e._d=i;else if(y(r)){var a,o,u,l,d,h,c=e,f=!1,m=c._f.length;if(0===m)p(c).invalidFormat=!0,c._d=new Date(NaN);else{for(l=0;l<m;l++)d=0,h=!1,a=q({},c),null!=c._useUTC&&(a._useUTC=c._useUTC),a._f=c._f[l],xt(a),A(a)&&(h=!0),d=(d+=p(a).charsLeftOver)+10*p(a).unusedTokens.length,p(a).score=d,f?d<u&&(u=d,o=a):(null==u||d<u||h)&&(u=d,o=a,h)&&(f=!0);E(c,o||a)}}else if(r)xt(e);else if(g(r=(i=e)._i))i._d=new Date(_.now());else V(r)?i._d=new Date(r.valueOf()):"string"==typeof r?(n=i,null!==(t=Mt.exec(n._i))?n._d=new Date(+t[1]):(Yt(n),!1===n._isValid&&(delete n._isValid,Ot(n),!1===n._isValid)&&(delete n._isValid,n._strict?n._isValid=!1:_.createFromInputFallback(n)))):y(r)?(i._a=G(r.slice(0),function(e){return parseInt(e,10)}),Tt(i)):F(r)?(t=i)._d||(s=void 0===(n=ue(t._i)).day?n.date:n.day,t._a=G([n.year,n.month,s,n.hour,n.minute,n.second,n.millisecond],function(e){return e&&parseInt(e,10)}),Tt(t)):w(r)?i._d=new Date(r):_.createFromInputFallback(i);return A(e)||(e._d=null),e}function Wt(e,t,n,s,i){var r={};return!0!==t&&!1!==t||(s=t,t=void 0),!0!==n&&!1!==n||(s=n,n=void 0),(F(e)&&L(e)||y(e)&&0===e.length)&&(e=void 0),r._isAMomentObject=!0,r._useUTC=r._isUTC=i,r._l=n,r._i=e,r._f=t,r._strict=s,(i=new $(_t(Nt(i=r))))._nextDay&&(i.add(1,"d"),i._nextDay=void 0),i}function R(e,t,n,s){return Wt(e,t,n,s,!1)}_.createFromInputFallback=e("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),_.ISO_8601=function(){},_.RFC_2822=function(){};me=e("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=R.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:I()}),_e=e("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=R.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:I()});function Pt(e,t){var n,s;if(!(t=1===t.length&&y(t[0])?t[0]:t).length)return R();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Rt=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ct(e){var e=ue(e),t=e.year||0,n=e.quarter||0,s=e.month||0,i=e.week||e.isoWeek||0,r=e.day||0,a=e.hour||0,o=e.minute||0,u=e.second||0,l=e.millisecond||0;this._isValid=function(e){var t,n,s=!1,i=Rt.length;for(t in e)if(c(e,t)&&(-1===x.call(Rt,t)||null!=e[t]&&isNaN(e[t])))return!1;for(n=0;n<i;++n)if(e[Rt[n]]){if(s)return!1;parseFloat(e[Rt[n]])!==M(e[Rt[n]])&&(s=!0)}return!0}(e),this._milliseconds=+l+1e3*u+6e4*o+1e3*a*60*60,this._days=+r+7*i,this._months=+s+3*n+12*t,this._data={},this._locale=P(),this._bubble()}function Ut(e){return e instanceof Ct}function Ht(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){s(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+r(~~(e/60),2)+n+r(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),h("Z",ve),h("ZZ",ve),v(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Vt(ve,e)});var Lt=/([\+\-]|\d\d)/gi;function Vt(e,t){var t=(t||"").match(e);return null===t?null:0===(t=60*(e=((t[t.length-1]||[])+"").match(Lt)||["-",0,0])[1]+M(e[2]))?0:"+"===e[0]?t:-t}function Gt(e,t){var n;return t._isUTC?(t=t.clone(),n=(k(e)||V(e)?e:R(e)).valueOf()-t.valueOf(),t._d.setTime(t._d.valueOf()+n),_.updateOffset(t,!1),t):R(e).local()}function Et(e){return-Math.round(e._d.getTimezoneOffset())}function At(){return!!this.isValid()&&this._isUTC&&0===this._offset}_.updateOffset=function(){};var It=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,jt=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function C(e,t){var n,s=e;return Ut(e)?s={ms:e._milliseconds,d:e._days,M:e._months}:w(e)||!isNaN(+e)?(s={},t?s[t]=+e:s.milliseconds=+e):(t=It.exec(e))?(n="-"===t[1]?-1:1,s={y:0,d:M(t[S])*n,h:M(t[O])*n,m:M(t[b])*n,s:M(t[T])*n,ms:M(Ht(1e3*t[Te]))*n}):(t=jt.exec(e))?(n="-"===t[1]?-1:1,s={y:Zt(t[2],n),M:Zt(t[3],n),w:Zt(t[4],n),d:Zt(t[5],n),h:Zt(t[6],n),m:Zt(t[7],n),s:Zt(t[8],n)}):null==s?s={}:"object"==typeof s&&("from"in s||"to"in s)&&(t=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Gt(t,e),e.isBefore(t)?n=zt(e,t):((n=zt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(R(s.from),R(s.to)),(s={}).ms=t.milliseconds,s.M=t.months),n=new Ct(s),Ut(e)&&c(e,"_locale")&&(n._locale=e._locale),Ut(e)&&c(e,"_isValid")&&(n._isValid=e._isValid),n}function Zt(e,t){e=e&&parseFloat(e.replace(",","."));return(isNaN(e)?0:e)*t}function zt(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function qt(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(Q(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),$t(this,C(e,t),s),this}}function $t(e,t,n,s){var i=t._milliseconds,r=Ht(t._days),t=Ht(t._months);e.isValid()&&(s=null==s||s,t&&Ae(e,Ce(e,"Month")+t*n),r&&Ue(e,"Date",Ce(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s)&&_.updateOffset(e,r||t)}C.fn=Ct.prototype,C.invalid=function(){return C(NaN)};Fe=qt(1,"add"),Qe=qt(-1,"subtract");function Bt(e){return"string"==typeof e||e instanceof String}function Jt(e){return k(e)||V(e)||Bt(e)||w(e)||function(t){var e=y(t),n=!1;e&&(n=0===t.filter(function(e){return!w(e)&&Bt(t)}).length);return e&&n}(e)||function(e){var t,n,s=F(e)&&!L(e),i=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],a=r.length;for(t=0;t<a;t+=1)n=r[t],i=i||c(e,n);return s&&i}(e)||null==e}function Qt(e,t){var n,s;return e.date()<t.date()?-Qt(t,e):-((n=12*(t.year()-e.year())+(t.month()-e.month()))+(t-(s=e.clone().add(n,"months"))<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(1+n,"months")-s)))||0}function Xt(e){return void 0===e?this._locale._abbr:(null!=(e=P(e))&&(this._locale=e),this)}_.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",_.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";Ke=e("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function Kt(){return this._locale}var en=126227808e5;function tn(e,t){return(e%t+t)%t}function nn(e,t,n){return e<100&&0<=e?new Date(e+400,t,n)-en:new Date(e,t,n).valueOf()}function sn(e,t,n){return e<100&&0<=e?Date.UTC(e+400,t,n)-en:Date.UTC(e,t,n)}function rn(e,t){return t.erasAbbrRegex(e)}function an(){for(var e,t,n,s=[],i=[],r=[],a=[],o=this.eras(),u=0,l=o.length;u<l;++u)e=f(o[u].name),t=f(o[u].abbr),n=f(o[u].narrow),i.push(e),s.push(t),r.push(n),a.push(e),a.push(t),a.push(n);this._erasRegex=new RegExp("^("+a.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+i.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+r.join("|")+")","i")}function on(e,t){s(0,[e,e.length],0,t)}function un(e,t,n,s,i){var r;return null==e?Be(this,s,i).year:(r=N(e,s,i),function(e,t,n,s,i){e=$e(e,t,n,s,i),t=ze(e.year,0,e.dayOfYear);return this.year(t.getUTCFullYear()),this.month(t.getUTCMonth()),this.date(t.getUTCDate()),this}.call(this,e,t=r<t?r:t,n,s,i))}s("N",0,0,"eraAbbr"),s("NN",0,0,"eraAbbr"),s("NNN",0,0,"eraAbbr"),s("NNNN",0,0,"eraName"),s("NNNNN",0,0,"eraNarrow"),s("y",["y",1],"yo","eraYear"),s("y",["yy",2],0,"eraYear"),s("y",["yyy",3],0,"eraYear"),s("y",["yyyy",4],0,"eraYear"),h("N",rn),h("NN",rn),h("NNN",rn),h("NNNN",function(e,t){return t.erasNameRegex(e)}),h("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),v(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,s){s=n._locale.erasParse(e,s,n._strict);s?p(n).era=s:p(n).invalidEra=e}),h("y",pe),h("yy",pe),h("yyy",pe),h("yyyy",pe),h("yo",function(e,t){return t._eraYearOrdinalRegex||pe}),v(["y","yy","yyy","yyyy"],D),v(["yo"],function(e,t,n,s){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[D]=n._locale.eraYearOrdinalParse(e,i):t[D]=parseInt(e,10)}),s(0,["gg",2],0,function(){return this.weekYear()%100}),s(0,["GG",2],0,function(){return this.isoWeekYear()%100}),on("gggg","weekYear"),on("ggggg","weekYear"),on("GGGG","isoWeekYear"),on("GGGGG","isoWeekYear"),h("G",ke),h("g",ke),h("GG",n,t),h("gg",n,t),h("GGGG",ge,ce),h("gggg",ge,ce),h("GGGGG",we,fe),h("ggggg",we,fe),Oe(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=M(e)}),Oe(["gg","GG"],function(e,t,n,s){t[s]=_.parseTwoDigitYear(e)}),s("Q",0,"Qo","quarter"),h("Q",de),v("Q",function(e,t){t[Y]=3*(M(e)-1)}),s("D",["DD",2],"Do","date"),h("D",n,u),h("DD",n,t),h("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),v(["D","DD"],S),v("Do",function(e,t){t[S]=M(e.match(n)[0])});ge=Re("Date",!0);s("DDD",["DDDD",3],"DDDo","dayOfYear"),h("DDD",ye),h("DDDD",he),v(["DDD","DDDD"],function(e,t,n){n._dayOfYear=M(e)}),s("m",["mm",2],0,"minute"),h("m",n,d),h("mm",n,t),v(["m","mm"],b);var ln,ce=Re("Minutes",!1),we=(s("s",["ss",2],0,"second"),h("s",n,d),h("ss",n,t),v(["s","ss"],T),Re("Seconds",!1));for(s("S",0,0,function(){return~~(this.millisecond()/100)}),s(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),s(0,["SSS",3],0,"millisecond"),s(0,["SSSS",4],0,function(){return 10*this.millisecond()}),s(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),s(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),s(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),s(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),s(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),h("S",ye,de),h("SS",ye,t),h("SSS",ye,he),ln="SSSS";ln.length<=9;ln+="S")h(ln,pe);function dn(e,t){t[Te]=M(1e3*("0."+e))}for(ln="S";ln.length<=9;ln+="S")v(ln,dn);fe=Re("Milliseconds",!1),s("z",0,0,"zoneAbbr"),s("zz",0,0,"zoneName");u=$.prototype;function hn(e){return e}u.add=Fe,u.calendar=function(e,t){1===arguments.length&&(arguments[0]?Jt(arguments[0])?(e=arguments[0],t=void 0):function(e){for(var t=F(e)&&!L(e),n=!1,s=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i=0;i<s.length;i+=1)n=n||c(e,s[i]);return t&&n}(arguments[0])&&(t=arguments[0],e=void 0):t=e=void 0);var e=e||R(),n=Gt(e,this).startOf("day"),n=_.calendarFormat(this,n)||"sameElse",t=t&&(a(t[n])?t[n].call(this,e):t[n]);return this.format(t||this.localeData().calendar(n,this,R(e)))},u.clone=function(){return new $(this)},u.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Gt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=o(t)){case"year":r=Qt(this,s)/12;break;case"month":r=Qt(this,s);break;case"quarter":r=Qt(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:m(r)},u.endOf=function(e){var t,n;if(void 0!==(e=o(e))&&"millisecond"!==e&&this.isValid()){switch(n=this._isUTC?sn:nn,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=36e5-tn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":t=this._d.valueOf(),t+=6e4-tn(t,6e4)-1;break;case"second":t=this._d.valueOf(),t+=1e3-tn(t,1e3)-1}this._d.setTime(t),_.updateOffset(this,!0)}return this},u.format=function(e){return e=e||(this.isUtc()?_.defaultFormatUtc:_.defaultFormat),e=re(this,e),this.localeData().postformat(e)},u.from=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||R(e).isValid())?C({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},u.fromNow=function(e){return this.from(R(),e)},u.to=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||R(e).isValid())?C({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},u.toNow=function(e){return this.to(R(),e)},u.get=function(e){return a(this[e=o(e)])?this[e]():this},u.invalidAt=function(){return p(this).overflow},u.isAfter=function(e,t){return e=k(e)?e:R(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=o(t)||"millisecond")?this.valueOf()>e.valueOf():e.valueOf()<this.clone().startOf(t).valueOf())},u.isBefore=function(e,t){return e=k(e)?e:R(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=o(t)||"millisecond")?this.valueOf()<e.valueOf():this.clone().endOf(t).valueOf()<e.valueOf())},u.isBetween=function(e,t,n,s){return e=k(e)?e:R(e),t=k(t)?t:R(t),!!(this.isValid()&&e.isValid()&&t.isValid())&&("("===(s=s||"()")[0]?this.isAfter(e,n):!this.isBefore(e,n))&&(")"===s[1]?this.isBefore(t,n):!this.isAfter(t,n))},u.isSame=function(e,t){var e=k(e)?e:R(e);return!(!this.isValid()||!e.isValid())&&("millisecond"===(t=o(t)||"millisecond")?this.valueOf()===e.valueOf():(e=e.valueOf(),this.clone().startOf(t).valueOf()<=e&&e<=this.clone().endOf(t).valueOf()))},u.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},u.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},u.isValid=function(){return A(this)},u.lang=Ke,u.locale=Xt,u.localeData=Kt,u.max=_e,u.min=me,u.parsingFlags=function(){return E({},p(this))},u.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t,n=[];for(t in e)c(e,t)&&n.push({unit:t,priority:le[t]});return n.sort(function(e,t){return e.priority-t.priority}),n}(e=ue(e)),s=n.length,i=0;i<s;i++)this[n[i].unit](e[n[i].unit]);else if(a(this[e=o(e)]))return this[e](t);return this},u.startOf=function(e){var t,n;if(void 0!==(e=o(e))&&"millisecond"!==e&&this.isValid()){switch(n=this._isUTC?sn:nn,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=tn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5);break;case"minute":t=this._d.valueOf(),t-=tn(t,6e4);break;case"second":t=this._d.valueOf(),t-=tn(t,1e3)}this._d.setTime(t),_.updateOffset(this,!0)}return this},u.subtract=Qe,u.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},u.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},u.toDate=function(){return new Date(this.valueOf())},u.toISOString=function(e){var t;return this.isValid()?(t=(e=!0!==e)?this.clone().utc():this).year()<0||9999<t.year()?re(t,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):a(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",re(t,"Z")):re(t,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ"):null},u.inspect=function(){var e,t,n;return this.isValid()?(t="moment",e="",this.isLocal()||(t=0===this.utcOffset()?"moment.utc":"moment.parseZone",e="Z"),t="["+t+'("]',n=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",this.format(t+n+"-MM-DD[T]HH:mm:ss.SSS"+(e+'[")]'))):"moment.invalid(/* "+this._i+" */)"},"undefined"!=typeof Symbol&&null!=Symbol.for&&(u[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),u.toJSON=function(){return this.isValid()?this.toISOString():null},u.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},u.unix=function(){return Math.floor(this.valueOf()/1e3)},u.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},u.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},u.eraName=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].name;if(t[n].until<=e&&e<=t[n].since)return t[n].name}return""},u.eraNarrow=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].narrow;if(t[n].until<=e&&e<=t[n].since)return t[n].narrow}return""},u.eraAbbr=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].abbr;if(t[n].until<=e&&e<=t[n].since)return t[n].abbr}return""},u.eraYear=function(){for(var e,t,n=this.localeData().eras(),s=0,i=n.length;s<i;++s)if(e=n[s].since<=n[s].until?1:-1,t=this.clone().startOf("day").valueOf(),n[s].since<=t&&t<=n[s].until||n[s].until<=t&&t<=n[s].since)return(this.year()-_(n[s].since).year())*e+n[s].offset;return this.year()},u.year=Pe,u.isLeapYear=function(){return be(this.year())},u.weekYear=function(e){return un.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)},u.isoWeekYear=function(e){return un.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},u.quarter=u.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},u.month=Ie,u.daysInMonth=function(){return He(this.year(),this.month())},u.week=u.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},u.isoWeek=u.isoWeeks=function(e){var t=Be(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},u.weeksInYear=function(){var e=this.localeData()._week;return N(this.year(),e.dow,e.doy)},u.weeksInWeekYear=function(){var e=this.localeData()._week;return N(this.weekYear(),e.dow,e.doy)},u.isoWeeksInYear=function(){return N(this.year(),1,4)},u.isoWeeksInISOWeekYear=function(){return N(this.isoWeekYear(),1,4)},u.date=ge,u.day=u.days=function(e){var t,n,s;return this.isValid()?(t=Ce(this,"Day"),null!=e?(n=e,s=this.localeData(),e="string"!=typeof n?n:isNaN(n)?"number"==typeof(n=s.weekdaysParse(n))?n:null:parseInt(n,10),this.add(e-t,"d")):t):null!=e?this:NaN},u.weekday=function(e){var t;return this.isValid()?(t=(this.day()+7-this.localeData()._week.dow)%7,null==e?t:this.add(e-t,"d")):null!=e?this:NaN},u.isoWeekday=function(e){var t,n;return this.isValid()?null!=e?(t=e,n=this.localeData(),n="string"==typeof t?n.weekdaysParse(t)%7||7:isNaN(t)?null:t,this.day(this.day()%7?n:n-7)):this.day()||7:null!=e?this:NaN},u.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},u.hour=u.hours=i,u.minute=u.minutes=ce,u.second=u.seconds=we,u.millisecond=u.milliseconds=fe,u.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?i:Et(this);if("string"==typeof e){if(null===(e=Vt(ve,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Et(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?$t(this,C(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,_.updateOffset(this,!0),this._changeInProgress=null)),this},u.utc=function(e){return this.utcOffset(0,e)},u.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e)&&this.subtract(Et(this),"m"),this},u.parseZone=function(){var e;return null!=this._tzm?this.utcOffset(this._tzm,!1,!0):"string"==typeof this._i&&(null!=(e=Vt(Me,this._i))?this.utcOffset(e):this.utcOffset(0,!0)),this},u.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?R(e).utcOffset():0,(this.utcOffset()-e)%60==0)},u.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},u.isLocal=function(){return!!this.isValid()&&!this._isUTC},u.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},u.isUtc=At,u.isUTC=At,u.zoneAbbr=function(){return this._isUTC?"UTC":""},u.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},u.dates=e("dates accessor is deprecated. Use date instead.",ge),u.months=e("months accessor is deprecated. Use month instead",Ie),u.years=e("years accessor is deprecated. Use year instead",Pe),u.zone=e("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?(this.utcOffset(e="string"!=typeof e?-e:e,t),this):-this.utcOffset()}),u.isDSTShifted=e("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){var e,t;return g(this._isDSTShifted)&&(q(e={},this),(e=Nt(e))._a?(t=(e._isUTC?l:R)(e._a),this._isDSTShifted=this.isValid()&&0<function(e,t,n){for(var s=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),r=0,a=0;a<s;a++)(n&&e[a]!==t[a]||!n&&M(e[a])!==M(t[a]))&&r++;return r+i}(e._a,t.toArray())):this._isDSTShifted=!1),this._isDSTShifted});d=K.prototype;function cn(e,t,n,s){var i=P(),s=l().set(s,t);return i[n](s,e)}function fn(e,t,n){if(w(e)&&(t=e,e=void 0),e=e||"",null!=t)return cn(e,t,n,"month");for(var s=[],i=0;i<12;i++)s[i]=cn(e,i,n,"month");return s}function mn(e,t,n,s){t=("boolean"==typeof e?w(t)&&(n=t,t=void 0):(t=e,e=!1,w(n=t)&&(n=t,t=void 0)),t||"");var i,r=P(),a=e?r._week.dow:0,o=[];if(null!=n)return cn(t,(n+a)%7,s,"day");for(i=0;i<7;i++)o[i]=cn(t,(i+a)%7,s,"day");return o}d.calendar=function(e,t,n){return a(e=this._calendar[e]||this._calendar.sameElse)?e.call(t,n):e},d.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(te).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},d.invalidDate=function(){return this._invalidDate},d.ordinal=function(e){return this._ordinal.replace("%d",e)},d.preparse=hn,d.postformat=hn,d.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return a(i)?i(e,t,n,s):i.replace(/%d/i,e)},d.pastFuture=function(e,t){return a(e=this._relativeTime[0<e?"future":"past"])?e(t):e.replace(/%s/i,t)},d.set=function(e){var t,n;for(n in e)c(e,n)&&(a(t=e[n])?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},d.eras=function(e,t){for(var n,s=this._eras||P("en")._eras,i=0,r=s.length;i<r;++i)switch("string"==typeof s[i].since&&(n=_(s[i].since).startOf("day"),s[i].since=n.valueOf()),typeof s[i].until){case"undefined":s[i].until=1/0;break;case"string":n=_(s[i].until).startOf("day").valueOf(),s[i].until=n.valueOf()}return s},d.erasParse=function(e,t,n){var s,i,r,a,o,u=this.eras();for(e=e.toUpperCase(),s=0,i=u.length;s<i;++s)if(r=u[s].name.toUpperCase(),a=u[s].abbr.toUpperCase(),o=u[s].narrow.toUpperCase(),n)switch(t){case"N":case"NN":case"NNN":if(a===e)return u[s];break;case"NNNN":if(r===e)return u[s];break;case"NNNNN":if(o===e)return u[s]}else if(0<=[r,a,o].indexOf(e))return u[s]},d.erasConvertYear=function(e,t){var n=e.since<=e.until?1:-1;return void 0===t?_(e.since).year():_(e.since).year()+(t-e.offset)*n},d.erasAbbrRegex=function(e){return c(this,"_erasAbbrRegex")||an.call(this),e?this._erasAbbrRegex:this._erasRegex},d.erasNameRegex=function(e){return c(this,"_erasNameRegex")||an.call(this),e?this._erasNameRegex:this._erasRegex},d.erasNarrowRegex=function(e){return c(this,"_erasNarrowRegex")||an.call(this),e?this._erasNarrowRegex:this._erasRegex},d.months=function(e,t){return e?(y(this._months)?this._months:this._months[(this._months.isFormat||Ve).test(t)?"format":"standalone"])[e.month()]:y(this._months)?this._months:this._months.standalone},d.monthsShort=function(e,t){return e?(y(this._monthsShort)?this._monthsShort:this._monthsShort[Ve.test(t)?"format":"standalone"])[e.month()]:y(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},d.monthsParse=function(e,t,n){var s,i;if(this._monthsParseExact)return function(e,t,n){var s,i,r,e=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=l([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=x.call(this._shortMonthsParse,e))?i:null:-1!==(i=x.call(this._longMonthsParse,e))?i:null:"MMM"===t?-1!==(i=x.call(this._shortMonthsParse,e))||-1!==(i=x.call(this._longMonthsParse,e))?i:null:-1!==(i=x.call(this._longMonthsParse,e))||-1!==(i=x.call(this._shortMonthsParse,e))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=l([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(i="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(i.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},d.monthsRegex=function(e){return this._monthsParseExact?(c(this,"_monthsRegex")||je.call(this),e?this._monthsStrictRegex:this._monthsRegex):(c(this,"_monthsRegex")||(this._monthsRegex=Ee),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},d.monthsShortRegex=function(e){return this._monthsParseExact?(c(this,"_monthsRegex")||je.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(c(this,"_monthsShortRegex")||(this._monthsShortRegex=Ge),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},d.week=function(e){return Be(e,this._week.dow,this._week.doy).week},d.firstDayOfYear=function(){return this._week.doy},d.firstDayOfWeek=function(){return this._week.dow},d.weekdays=function(e,t){return t=y(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"],!0===e?Je(t,this._week.dow):e?t[e.day()]:t},d.weekdaysMin=function(e){return!0===e?Je(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},d.weekdaysShort=function(e){return!0===e?Je(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},d.weekdaysParse=function(e,t,n){var s,i;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,e=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=l([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=x.call(this._weekdaysParse,e))?i:null:"ddd"===t?-1!==(i=x.call(this._shortWeekdaysParse,e))?i:null:-1!==(i=x.call(this._minWeekdaysParse,e))?i:null:"dddd"===t?-1!==(i=x.call(this._weekdaysParse,e))||-1!==(i=x.call(this._shortWeekdaysParse,e))||-1!==(i=x.call(this._minWeekdaysParse,e))?i:null:"ddd"===t?-1!==(i=x.call(this._shortWeekdaysParse,e))||-1!==(i=x.call(this._weekdaysParse,e))||-1!==(i=x.call(this._minWeekdaysParse,e))?i:null:-1!==(i=x.call(this._minWeekdaysParse,e))||-1!==(i=x.call(this._weekdaysParse,e))||-1!==(i=x.call(this._shortWeekdaysParse,e))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=l([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(i="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(i.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},d.weekdaysRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||st.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(c(this,"_weekdaysRegex")||(this._weekdaysRegex=et),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},d.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||st.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(c(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=tt),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},d.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||st.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(c(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=nt),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},d.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},d.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},ft("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===M(e%100/10)?"th":1==t?"st":2==t?"nd":3==t?"rd":"th")}}),_.lang=e("moment.lang is deprecated. Use moment.locale instead.",ft),_.langData=e("moment.langData is deprecated. Use moment.localeData instead.",P);var _n=Math.abs;function yn(e,t,n,s){t=C(t,n);return e._milliseconds+=s*t._milliseconds,e._days+=s*t._days,e._months+=s*t._months,e._bubble()}function gn(e){return e<0?Math.floor(e):Math.ceil(e)}function wn(e){return 4800*e/146097}function pn(e){return 146097*e/4800}function kn(e){return function(){return this.as(e)}}de=kn("ms"),t=kn("s"),ye=kn("m"),he=kn("h"),Fe=kn("d"),_e=kn("w"),me=kn("M"),Qe=kn("Q"),i=kn("y"),ce=de;function Mn(e){return function(){return this.isValid()?this._data[e]:NaN}}var we=Mn("milliseconds"),fe=Mn("seconds"),ge=Mn("minutes"),Pe=Mn("hours"),d=Mn("days"),vn=Mn("months"),Dn=Mn("years");var Yn=Math.round,Sn={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function On(e,t,n,s){var i=C(e).abs(),r=Yn(i.as("s")),a=Yn(i.as("m")),o=Yn(i.as("h")),u=Yn(i.as("d")),l=Yn(i.as("M")),d=Yn(i.as("w")),i=Yn(i.as("y")),r=(r<=n.ss?["s",r]:r<n.s&&["ss",r])||(a<=1?["m"]:a<n.m&&["mm",a])||(o<=1?["h"]:o<n.h&&["hh",o])||(u<=1?["d"]:u<n.d&&["dd",u]);return(r=(r=null!=n.w?r||(d<=1?["w"]:d<n.w&&["ww",d]):r)||(l<=1?["M"]:l<n.M&&["MM",l])||(i<=1?["y"]:["yy",i]))[2]=t,r[3]=0<+e,r[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,r)}var bn=Math.abs;function Tn(e){return(0<e)-(e<0)||+e}function xn(){var e,t,n,s,i,r,a,o,u,l,d;return this.isValid()?(e=bn(this._milliseconds)/1e3,t=bn(this._days),n=bn(this._months),(o=this.asSeconds())?(s=m(e/60),i=m(s/60),e%=60,s%=60,r=m(n/12),n%=12,a=e?e.toFixed(3).replace(/\.?0+$/,""):"",u=Tn(this._months)!==Tn(o)?"-":"",l=Tn(this._days)!==Tn(o)?"-":"",d=Tn(this._milliseconds)!==Tn(o)?"-":"",(o<0?"-":"")+"P"+(r?u+r+"Y":"")+(n?u+n+"M":"")+(t?l+t+"D":"")+(i||s||e?"T":"")+(i?d+i+"H":"")+(s?d+s+"M":"")+(e?d+a+"S":"")):"P0D"):this.localeData().invalidDate()}var U=Ct.prototype;return U.isValid=function(){return this._isValid},U.abs=function(){var e=this._data;return this._milliseconds=_n(this._milliseconds),this._days=_n(this._days),this._months=_n(this._months),e.milliseconds=_n(e.milliseconds),e.seconds=_n(e.seconds),e.minutes=_n(e.minutes),e.hours=_n(e.hours),e.months=_n(e.months),e.years=_n(e.years),this},U.add=function(e,t){return yn(this,e,t,1)},U.subtract=function(e,t){return yn(this,e,t,-1)},U.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=o(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+wn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(pn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},U.asMilliseconds=de,U.asSeconds=t,U.asMinutes=ye,U.asHours=he,U.asDays=Fe,U.asWeeks=_e,U.asMonths=me,U.asQuarters=Qe,U.asYears=i,U.valueOf=ce,U._bubble=function(){var e=this._milliseconds,t=this._days,n=this._months,s=this._data;return 0<=e&&0<=t&&0<=n||e<=0&&t<=0&&n<=0||(e+=864e5*gn(pn(n)+t),n=t=0),s.milliseconds=e%1e3,e=m(e/1e3),s.seconds=e%60,e=m(e/60),s.minutes=e%60,e=m(e/60),s.hours=e%24,t+=m(e/24),n+=e=m(wn(t)),t-=gn(pn(e)),e=m(n/12),n%=12,s.days=t,s.months=n,s.years=e,this},U.clone=function(){return C(this)},U.get=function(e){return e=o(e),this.isValid()?this[e+"s"]():NaN},U.milliseconds=we,U.seconds=fe,U.minutes=ge,U.hours=Pe,U.days=d,U.weeks=function(){return m(this.days()/7)},U.months=vn,U.years=Dn,U.humanize=function(e,t){var n,s;return this.isValid()?(n=!1,s=Sn,"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(n=e),"object"==typeof t&&(s=Object.assign({},Sn,t),null!=t.s)&&null==t.ss&&(s.ss=t.s-1),e=this.localeData(),t=On(this,!n,s,e),n&&(t=e.pastFuture(+this,t)),e.postformat(t)):this.localeData().invalidDate()},U.toISOString=xn,U.toString=xn,U.toJSON=xn,U.locale=Xt,U.localeData=Kt,U.toIsoString=e("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",xn),U.lang=Ke,s("X",0,0,"unix"),s("x",0,0,"valueOf"),h("x",ke),h("X",/[+-]?\d+(\.\d{1,3})?/),v("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e))}),v("x",function(e,t,n){n._d=new Date(M(e))}),_.version="2.30.1",H=R,_.fn=u,_.min=function(){return Pt("isBefore",[].slice.call(arguments,0))},_.max=function(){return Pt("isAfter",[].slice.call(arguments,0))},_.now=function(){return Date.now?Date.now():+new Date},_.utc=l,_.unix=function(e){return R(1e3*e)},_.months=function(e,t){return fn(e,t,"months")},_.isDate=V,_.locale=ft,_.invalid=I,_.duration=C,_.isMoment=k,_.weekdays=function(e,t,n){return mn(e,t,n,"weekdays")},_.parseZone=function(){return R.apply(null,arguments).parseZone()},_.localeData=P,_.isDuration=Ut,_.monthsShort=function(e,t){return fn(e,t,"monthsShort")},_.weekdaysMin=function(e,t,n){return mn(e,t,n,"weekdaysMin")},_.defineLocale=mt,_.updateLocale=function(e,t){var n,s;return null!=t?(s=ut,null!=W[e]&&null!=W[e].parentLocale?W[e].set(X(W[e]._config,t)):(t=X(s=null!=(n=ct(e))?n._config:s,t),null==n&&(t.abbr=e),(s=new K(t)).parentLocale=W[e],W[e]=s),ft(e)):null!=W[e]&&(null!=W[e].parentLocale?(W[e]=W[e].parentLocale,e===ft()&&ft(e)):null!=W[e]&&delete W[e]),W[e]},_.locales=function(){return ee(W)},_.weekdaysShort=function(e,t,n){return mn(e,t,n,"weekdaysShort")},_.normalizeUnits=o,_.relativeTimeRounding=function(e){return void 0===e?Yn:"function"==typeof e&&(Yn=e,!0)},_.relativeTimeThreshold=function(e,t){return void 0!==Sn[e]&&(void 0===t?Sn[e]:(Sn[e]=t,"s"===e&&(Sn.ss=t-1),!0))},_.calendarFormat=function(e,t){return(e=e.diff(t,"days",!0))<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse"},_.prototype=u,_.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},_}); vendor/wp-polyfill-dom-rect.js 0000604 00000003607 15151622574 0012377 0 ustar 00 // DOMRect (function (global) { function number(v) { return v === undefined ? 0 : Number(v); } function different(u, v) { return u !== v && !(isNaN(u) && isNaN(v)); } function DOMRect(xArg, yArg, wArg, hArg) { var x, y, width, height, left, right, top, bottom; x = number(xArg); y = number(yArg); width = number(wArg); height = number(hArg); Object.defineProperties(this, { x: { get: function () { return x; }, set: function (newX) { if (different(x, newX)) { x = newX; left = right = undefined; } }, enumerable: true }, y: { get: function () { return y; }, set: function (newY) { if (different(y, newY)) { y = newY; top = bottom = undefined; } }, enumerable: true }, width: { get: function () { return width; }, set: function (newWidth) { if (different(width, newWidth)) { width = newWidth; left = right = undefined; } }, enumerable: true }, height: { get: function () { return height; }, set: function (newHeight) { if (different(height, newHeight)) { height = newHeight; top = bottom = undefined; } }, enumerable: true }, left: { get: function () { if (left === undefined) { left = x + Math.min(0, width); } return left; }, enumerable: true }, right: { get: function () { if (right === undefined) { right = x + Math.max(0, width); } return right; }, enumerable: true }, top: { get: function () { if (top === undefined) { top = y + Math.min(0, height); } return top; }, enumerable: true }, bottom: { get: function () { if (bottom === undefined) { bottom = y + Math.max(0, height); } return bottom; }, enumerable: true } }); } global.DOMRect = DOMRect; }(self)); vendor/wp-polyfill-object-fit.min.js 0000604 00000005637 15151622574 0013502 0 ustar 00 !function(){"use strict";if("undefined"!=typeof window){var t=window.navigator.userAgent.match(/Edge\/(\d{2})\./),e=t?parseInt(t[1],10):null,i=!!e&&16<=e&&e<=18;if("objectFit"in document.documentElement.style==0||i){var n=function(t,e,i){var n,o,l,a,d;if((i=i.split(" ")).length<2&&(i[1]=i[0]),"x"===t)n=i[0],o=i[1],l="left",a="right",d=e.clientWidth;else{if("y"!==t)return;n=i[1],o=i[0],l="top",a="bottom",d=e.clientHeight}if(n!==l&&o!==l){if(n!==a&&o!==a)return"center"===n||"50%"===n?(e.style[l]="50%",void(e.style["margin-"+l]=d/-2+"px")):void(0<=n.indexOf("%")?(n=parseInt(n,10))<50?(e.style[l]=n+"%",e.style["margin-"+l]=d*(n/-100)+"px"):(n=100-n,e.style[a]=n+"%",e.style["margin-"+a]=d*(n/-100)+"px"):e.style[l]=n);e.style[a]="0"}else e.style[l]="0"},o=function(t){var e=t.dataset?t.dataset.objectFit:t.getAttribute("data-object-fit"),i=t.dataset?t.dataset.objectPosition:t.getAttribute("data-object-position");e=e||"cover",i=i||"50% 50%";var o=t.parentNode;return function(t){var e=window.getComputedStyle(t,null),i=e.getPropertyValue("position"),n=e.getPropertyValue("overflow"),o=e.getPropertyValue("display");i&&"static"!==i||(t.style.position="relative"),"hidden"!==n&&(t.style.overflow="hidden"),o&&"inline"!==o||(t.style.display="block"),0===t.clientHeight&&(t.style.height="100%"),-1===t.className.indexOf("object-fit-polyfill")&&(t.className=t.className+" object-fit-polyfill")}(o),function(t){var e=window.getComputedStyle(t,null),i={"max-width":"none","max-height":"none","min-width":"0px","min-height":"0px",top:"auto",right:"auto",bottom:"auto",left:"auto","margin-top":"0px","margin-right":"0px","margin-bottom":"0px","margin-left":"0px"};for(var n in i)e.getPropertyValue(n)!==i[n]&&(t.style[n]=i[n])}(t),t.style.position="absolute",t.style.width="auto",t.style.height="auto","scale-down"===e&&(e=t.clientWidth<o.clientWidth&&t.clientHeight<o.clientHeight?"none":"contain"),"none"===e?(n("x",t,i),void n("y",t,i)):"fill"===e?(t.style.width="100%",t.style.height="100%",n("x",t,i),void n("y",t,i)):(t.style.height="100%",void("cover"===e&&t.clientWidth>o.clientWidth||"contain"===e&&t.clientWidth<o.clientWidth?(t.style.top="0",t.style.marginTop="0",n("x",t,i)):(t.style.width="100%",t.style.height="auto",t.style.left="0",t.style.marginLeft="0",n("y",t,i))))},l=function(t){if(void 0===t||t instanceof Event)t=document.querySelectorAll("[data-object-fit]");else if(t&&t.nodeName)t=[t];else if("object"!=typeof t||!t.length||!t[0].nodeName)return!1;for(var e=0;e<t.length;e++)if(t[e].nodeName){var n=t[e].nodeName.toLowerCase();if("img"===n){if(i)continue;t[e].complete?o(t[e]):t[e].addEventListener("load",(function(){o(this)}))}else"video"===n?0<t[e].readyState?o(t[e]):t[e].addEventListener("loadedmetadata",(function(){o(this)})):o(t[e])}return!0};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",l):l(),window.addEventListener("resize",l),window.objectFitPolyfill=l}else window.objectFitPolyfill=function(){return!1}}}(); vendor/moment.js 0000644 00000530463 15151622574 0007721 0 ustar 00 //! moment.js //! version : 2.30.1 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com ;(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.moment = factory() }(this, (function () { 'use strict'; var hookCallback; function hooks() { return hookCallback.apply(null, arguments); } // This is done to register the method called with moment() // without creating circular dependencies. function setHookCallback(callback) { hookCallback = callback; } function isArray(input) { return ( input instanceof Array || Object.prototype.toString.call(input) === '[object Array]' ); } function isObject(input) { // IE8 will treat undefined and null as object if it wasn't for // input != null return ( input != null && Object.prototype.toString.call(input) === '[object Object]' ); } function hasOwnProp(a, b) { return Object.prototype.hasOwnProperty.call(a, b); } function isObjectEmpty(obj) { if (Object.getOwnPropertyNames) { return Object.getOwnPropertyNames(obj).length === 0; } else { var k; for (k in obj) { if (hasOwnProp(obj, k)) { return false; } } return true; } } function isUndefined(input) { return input === void 0; } function isNumber(input) { return ( typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]' ); } function isDate(input) { return ( input instanceof Date || Object.prototype.toString.call(input) === '[object Date]' ); } function map(arr, fn) { var res = [], i, arrLen = arr.length; for (i = 0; i < arrLen; ++i) { res.push(fn(arr[i], i)); } return res; } function extend(a, b) { for (var i in b) { if (hasOwnProp(b, i)) { a[i] = b[i]; } } if (hasOwnProp(b, 'toString')) { a.toString = b.toString; } if (hasOwnProp(b, 'valueOf')) { a.valueOf = b.valueOf; } return a; } function createUTC(input, format, locale, strict) { return createLocalOrUTC(input, format, locale, strict, true).utc(); } function defaultParsingFlags() { // We need to deep clone this object. return { empty: false, unusedTokens: [], unusedInput: [], overflow: -2, charsLeftOver: 0, nullInput: false, invalidEra: null, invalidMonth: null, invalidFormat: false, userInvalidated: false, iso: false, parsedDateParts: [], era: null, meridiem: null, rfc2822: false, weekdayMismatch: false, }; } function getParsingFlags(m) { if (m._pf == null) { m._pf = defaultParsingFlags(); } return m._pf; } var some; if (Array.prototype.some) { some = Array.prototype.some; } else { some = function (fun) { var t = Object(this), len = t.length >>> 0, i; for (i = 0; i < len; i++) { if (i in t && fun.call(this, t[i], i, t)) { return true; } } return false; }; } function isValid(m) { var flags = null, parsedParts = false, isNowValid = m._d && !isNaN(m._d.getTime()); if (isNowValid) { flags = getParsingFlags(m); parsedParts = some.call(flags.parsedDateParts, function (i) { return i != null; }); isNowValid = flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || (flags.meridiem && parsedParts)); if (m._strict) { isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === undefined; } } if (Object.isFrozen == null || !Object.isFrozen(m)) { m._isValid = isNowValid; } else { return isNowValid; } return m._isValid; } function createInvalid(flags) { var m = createUTC(NaN); if (flags != null) { extend(getParsingFlags(m), flags); } else { getParsingFlags(m).userInvalidated = true; } return m; } // Plugins that add properties should also add the key here (null value), // so we can properly clone ourselves. var momentProperties = (hooks.momentProperties = []), updateInProgress = false; function copyConfig(to, from) { var i, prop, val, momentPropertiesLen = momentProperties.length; if (!isUndefined(from._isAMomentObject)) { to._isAMomentObject = from._isAMomentObject; } if (!isUndefined(from._i)) { to._i = from._i; } if (!isUndefined(from._f)) { to._f = from._f; } if (!isUndefined(from._l)) { to._l = from._l; } if (!isUndefined(from._strict)) { to._strict = from._strict; } if (!isUndefined(from._tzm)) { to._tzm = from._tzm; } if (!isUndefined(from._isUTC)) { to._isUTC = from._isUTC; } if (!isUndefined(from._offset)) { to._offset = from._offset; } if (!isUndefined(from._pf)) { to._pf = getParsingFlags(from); } if (!isUndefined(from._locale)) { to._locale = from._locale; } if (momentPropertiesLen > 0) { for (i = 0; i < momentPropertiesLen; i++) { prop = momentProperties[i]; val = from[prop]; if (!isUndefined(val)) { to[prop] = val; } } } return to; } // Moment prototype object function Moment(config) { copyConfig(this, config); this._d = new Date(config._d != null ? config._d.getTime() : NaN); if (!this.isValid()) { this._d = new Date(NaN); } // Prevent infinite loop in case updateOffset creates new moment // objects. if (updateInProgress === false) { updateInProgress = true; hooks.updateOffset(this); updateInProgress = false; } } function isMoment(obj) { return ( obj instanceof Moment || (obj != null && obj._isAMomentObject != null) ); } function warn(msg) { if ( hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn ) { console.warn('Deprecation warning: ' + msg); } } function deprecate(msg, fn) { var firstTime = true; return extend(function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = [], arg, i, key, argLen = arguments.length; for (i = 0; i < argLen; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (key in arguments[0]) { if (hasOwnProp(arguments[0], key)) { arg += key + ': ' + arguments[0][key] + ', '; } } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn( msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + new Error().stack ); firstTime = false; } return fn.apply(this, arguments); }, fn); } var deprecations = {}; function deprecateSimple(name, msg) { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(name, msg); } if (!deprecations[name]) { warn(msg); deprecations[name] = true; } } hooks.suppressDeprecationWarnings = false; hooks.deprecationHandler = null; function isFunction(input) { return ( (typeof Function !== 'undefined' && input instanceof Function) || Object.prototype.toString.call(input) === '[object Function]' ); } function set(config) { var prop, i; for (i in config) { if (hasOwnProp(config, i)) { prop = config[i]; if (isFunction(prop)) { this[i] = prop; } else { this['_' + i] = prop; } } } this._config = config; // Lenient ordinal parsing accepts just a number in addition to // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. // TODO: Remove "ordinalParse" fallback in next major release. this._dayOfMonthOrdinalParseLenient = new RegExp( (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + /\d{1,2}/.source ); } function mergeConfigs(parentConfig, childConfig) { var res = extend({}, parentConfig), prop; for (prop in childConfig) { if (hasOwnProp(childConfig, prop)) { if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { res[prop] = {}; extend(res[prop], parentConfig[prop]); extend(res[prop], childConfig[prop]); } else if (childConfig[prop] != null) { res[prop] = childConfig[prop]; } else { delete res[prop]; } } } for (prop in parentConfig) { if ( hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop]) ) { // make sure changes to properties don't modify parent config res[prop] = extend({}, res[prop]); } } return res; } function Locale(config) { if (config != null) { this.set(config); } } var keys; if (Object.keys) { keys = Object.keys; } else { keys = function (obj) { var i, res = []; for (i in obj) { if (hasOwnProp(obj, i)) { res.push(i); } } return res; }; } var defaultCalendar = { sameDay: '[Today at] LT', nextDay: '[Tomorrow at] LT', nextWeek: 'dddd [at] LT', lastDay: '[Yesterday at] LT', lastWeek: '[Last] dddd [at] LT', sameElse: 'L', }; function calendar(key, mom, now) { var output = this._calendar[key] || this._calendar['sameElse']; return isFunction(output) ? output.call(mom, now) : output; } function zeroFill(number, targetLength, forceSign) { var absNumber = '' + Math.abs(number), zerosToFill = targetLength - absNumber.length, sign = number >= 0; return ( (sign ? (forceSign ? '+' : '') : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber ); } var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {}; // token: 'M' // padded: ['MM', 2] // ordinal: 'Mo' // callback: function () { this.month() + 1 } function addFormatToken(token, padded, ordinal, callback) { var func = callback; if (typeof callback === 'string') { func = function () { return this[callback](); }; } if (token) { formatTokenFunctions[token] = func; } if (padded) { formatTokenFunctions[padded[0]] = function () { return zeroFill(func.apply(this, arguments), padded[1], padded[2]); }; } if (ordinal) { formatTokenFunctions[ordinal] = function () { return this.localeData().ordinal( func.apply(this, arguments), token ); }; } } function removeFormattingTokens(input) { if (input.match(/\[[\s\S]/)) { return input.replace(/^\[|\]$/g, ''); } return input.replace(/\\/g, ''); } function makeFormatFunction(format) { var array = format.match(formattingTokens), i, length; for (i = 0, length = array.length; i < length; i++) { if (formatTokenFunctions[array[i]]) { array[i] = formatTokenFunctions[array[i]]; } else { array[i] = removeFormattingTokens(array[i]); } } return function (mom) { var output = '', i; for (i = 0; i < length; i++) { output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; } return output; }; } // format date using native date object function formatMoment(m, format) { if (!m.isValid()) { return m.localeData().invalidDate(); } format = expandFormat(format, m.localeData()); formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); return formatFunctions[format](m); } function expandFormat(format, locale) { var i = 5; function replaceLongDateFormatTokens(input) { return locale.longDateFormat(input) || input; } localFormattingTokens.lastIndex = 0; while (i >= 0 && localFormattingTokens.test(format)) { format = format.replace( localFormattingTokens, replaceLongDateFormatTokens ); localFormattingTokens.lastIndex = 0; i -= 1; } return format; } var defaultLongDateFormat = { LTS: 'h:mm:ss A', LT: 'h:mm A', L: 'MM/DD/YYYY', LL: 'MMMM D, YYYY', LLL: 'MMMM D, YYYY h:mm A', LLLL: 'dddd, MMMM D, YYYY h:mm A', }; function longDateFormat(key) { var format = this._longDateFormat[key], formatUpper = this._longDateFormat[key.toUpperCase()]; if (format || !formatUpper) { return format; } this._longDateFormat[key] = formatUpper .match(formattingTokens) .map(function (tok) { if ( tok === 'MMMM' || tok === 'MM' || tok === 'DD' || tok === 'dddd' ) { return tok.slice(1); } return tok; }) .join(''); return this._longDateFormat[key]; } var defaultInvalidDate = 'Invalid date'; function invalidDate() { return this._invalidDate; } var defaultOrdinal = '%d', defaultDayOfMonthOrdinalParse = /\d{1,2}/; function ordinal(number) { return this._ordinal.replace('%d', number); } var defaultRelativeTime = { future: 'in %s', past: '%s ago', s: 'a few seconds', ss: '%d seconds', m: 'a minute', mm: '%d minutes', h: 'an hour', hh: '%d hours', d: 'a day', dd: '%d days', w: 'a week', ww: '%d weeks', M: 'a month', MM: '%d months', y: 'a year', yy: '%d years', }; function relativeTime(number, withoutSuffix, string, isFuture) { var output = this._relativeTime[string]; return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number); } function pastFuture(diff, output) { var format = this._relativeTime[diff > 0 ? 'future' : 'past']; return isFunction(format) ? format(output) : format.replace(/%s/i, output); } var aliases = { D: 'date', dates: 'date', date: 'date', d: 'day', days: 'day', day: 'day', e: 'weekday', weekdays: 'weekday', weekday: 'weekday', E: 'isoWeekday', isoweekdays: 'isoWeekday', isoweekday: 'isoWeekday', DDD: 'dayOfYear', dayofyears: 'dayOfYear', dayofyear: 'dayOfYear', h: 'hour', hours: 'hour', hour: 'hour', ms: 'millisecond', milliseconds: 'millisecond', millisecond: 'millisecond', m: 'minute', minutes: 'minute', minute: 'minute', M: 'month', months: 'month', month: 'month', Q: 'quarter', quarters: 'quarter', quarter: 'quarter', s: 'second', seconds: 'second', second: 'second', gg: 'weekYear', weekyears: 'weekYear', weekyear: 'weekYear', GG: 'isoWeekYear', isoweekyears: 'isoWeekYear', isoweekyear: 'isoWeekYear', w: 'week', weeks: 'week', week: 'week', W: 'isoWeek', isoweeks: 'isoWeek', isoweek: 'isoWeek', y: 'year', years: 'year', year: 'year', }; function normalizeUnits(units) { return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; } function normalizeObjectUnits(inputObject) { var normalizedInput = {}, normalizedProp, prop; for (prop in inputObject) { if (hasOwnProp(inputObject, prop)) { normalizedProp = normalizeUnits(prop); if (normalizedProp) { normalizedInput[normalizedProp] = inputObject[prop]; } } } return normalizedInput; } var priorities = { date: 9, day: 11, weekday: 11, isoWeekday: 11, dayOfYear: 4, hour: 13, millisecond: 16, minute: 14, month: 8, quarter: 7, second: 15, weekYear: 1, isoWeekYear: 1, week: 5, isoWeek: 5, year: 1, }; function getPrioritizedUnits(unitsObj) { var units = [], u; for (u in unitsObj) { if (hasOwnProp(unitsObj, u)) { units.push({ unit: u, priority: priorities[u] }); } } units.sort(function (a, b) { return a.priority - b.priority; }); return units; } var match1 = /\d/, // 0 - 9 match2 = /\d\d/, // 00 - 99 match3 = /\d{3}/, // 000 - 999 match4 = /\d{4}/, // 0000 - 9999 match6 = /[+-]?\d{6}/, // -999999 - 999999 match1to2 = /\d\d?/, // 0 - 99 match3to4 = /\d\d\d\d?/, // 999 - 9999 match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999 match1to3 = /\d{1,3}/, // 0 - 999 match1to4 = /\d{1,4}/, // 0 - 9999 match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999 matchUnsigned = /\d+/, // 0 - inf matchSigned = /[+-]?\d+/, // -inf - inf matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123 // any word (or two) characters or numbers including two/three word month in arabic. // includes scottish gaelic two word and hyphenated months matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, match1to2NoLeadingZero = /^[1-9]\d?/, // 1-99 match1to2HasZero = /^([1-9]\d|\d)/, // 0-99 regexes; regexes = {}; function addRegexToken(token, regex, strictRegex) { regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { return isStrict && strictRegex ? strictRegex : regex; }; } function getParseRegexForToken(token, config) { if (!hasOwnProp(regexes, token)) { return new RegExp(unescapeFormat(token)); } return regexes[token](config._strict, config._locale); } // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript function unescapeFormat(s) { return regexEscape( s .replace('\\', '') .replace( /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { return p1 || p2 || p3 || p4; } ) ); } function regexEscape(s) { return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); } function absFloor(number) { if (number < 0) { // -0 -> 0 return Math.ceil(number) || 0; } else { return Math.floor(number); } } function toInt(argumentForCoercion) { var coercedNumber = +argumentForCoercion, value = 0; if (coercedNumber !== 0 && isFinite(coercedNumber)) { value = absFloor(coercedNumber); } return value; } var tokens = {}; function addParseToken(token, callback) { var i, func = callback, tokenLen; if (typeof token === 'string') { token = [token]; } if (isNumber(callback)) { func = function (input, array) { array[callback] = toInt(input); }; } tokenLen = token.length; for (i = 0; i < tokenLen; i++) { tokens[token[i]] = func; } } function addWeekParseToken(token, callback) { addParseToken(token, function (input, array, config, token) { config._w = config._w || {}; callback(input, config._w, config, token); }); } function addTimeToArrayFromToken(token, input, config) { if (input != null && hasOwnProp(tokens, token)) { tokens[token](input, config._a, config, token); } } function isLeapYear(year) { return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; } var YEAR = 0, MONTH = 1, DATE = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8; // FORMATTING addFormatToken('Y', 0, 0, function () { var y = this.year(); return y <= 9999 ? zeroFill(y, 4) : '+' + y; }); addFormatToken(0, ['YY', 2], 0, function () { return this.year() % 100; }); addFormatToken(0, ['YYYY', 4], 0, 'year'); addFormatToken(0, ['YYYYY', 5], 0, 'year'); addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); // PARSING addRegexToken('Y', matchSigned); addRegexToken('YY', match1to2, match2); addRegexToken('YYYY', match1to4, match4); addRegexToken('YYYYY', match1to6, match6); addRegexToken('YYYYYY', match1to6, match6); addParseToken(['YYYYY', 'YYYYYY'], YEAR); addParseToken('YYYY', function (input, array) { array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); }); addParseToken('YY', function (input, array) { array[YEAR] = hooks.parseTwoDigitYear(input); }); addParseToken('Y', function (input, array) { array[YEAR] = parseInt(input, 10); }); // HELPERS function daysInYear(year) { return isLeapYear(year) ? 366 : 365; } // HOOKS hooks.parseTwoDigitYear = function (input) { return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); }; // MOMENTS var getSetYear = makeGetSet('FullYear', true); function getIsLeapYear() { return isLeapYear(this.year()); } function makeGetSet(unit, keepTime) { return function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }; } function get(mom, unit) { if (!mom.isValid()) { return NaN; } var d = mom._d, isUTC = mom._isUTC; switch (unit) { case 'Milliseconds': return isUTC ? d.getUTCMilliseconds() : d.getMilliseconds(); case 'Seconds': return isUTC ? d.getUTCSeconds() : d.getSeconds(); case 'Minutes': return isUTC ? d.getUTCMinutes() : d.getMinutes(); case 'Hours': return isUTC ? d.getUTCHours() : d.getHours(); case 'Date': return isUTC ? d.getUTCDate() : d.getDate(); case 'Day': return isUTC ? d.getUTCDay() : d.getDay(); case 'Month': return isUTC ? d.getUTCMonth() : d.getMonth(); case 'FullYear': return isUTC ? d.getUTCFullYear() : d.getFullYear(); default: return NaN; // Just in case } } function set$1(mom, unit, value) { var d, isUTC, year, month, date; if (!mom.isValid() || isNaN(value)) { return; } d = mom._d; isUTC = mom._isUTC; switch (unit) { case 'Milliseconds': return void (isUTC ? d.setUTCMilliseconds(value) : d.setMilliseconds(value)); case 'Seconds': return void (isUTC ? d.setUTCSeconds(value) : d.setSeconds(value)); case 'Minutes': return void (isUTC ? d.setUTCMinutes(value) : d.setMinutes(value)); case 'Hours': return void (isUTC ? d.setUTCHours(value) : d.setHours(value)); case 'Date': return void (isUTC ? d.setUTCDate(value) : d.setDate(value)); // case 'Day': // Not real // return void (isUTC ? d.setUTCDay(value) : d.setDay(value)); // case 'Month': // Not used because we need to pass two variables // return void (isUTC ? d.setUTCMonth(value) : d.setMonth(value)); case 'FullYear': break; // See below ... default: return; // Just in case } year = value; month = mom.month(); date = mom.date(); date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date; void (isUTC ? d.setUTCFullYear(year, month, date) : d.setFullYear(year, month, date)); } // MOMENTS function stringGet(units) { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](); } return this; } function stringSet(units, value) { if (typeof units === 'object') { units = normalizeObjectUnits(units); var prioritized = getPrioritizedUnits(units), i, prioritizedLen = prioritized.length; for (i = 0; i < prioritizedLen; i++) { this[prioritized[i].unit](units[prioritized[i].unit]); } } else { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](value); } } return this; } function mod(n, x) { return ((n % x) + x) % x; } var indexOf; if (Array.prototype.indexOf) { indexOf = Array.prototype.indexOf; } else { indexOf = function (o) { // I know var i; for (i = 0; i < this.length; ++i) { if (this[i] === o) { return i; } } return -1; }; } function daysInMonth(year, month) { if (isNaN(year) || isNaN(month)) { return NaN; } var modMonth = mod(month, 12); year += (month - modMonth) / 12; return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - ((modMonth % 7) % 2); } // FORMATTING addFormatToken('M', ['MM', 2], 'Mo', function () { return this.month() + 1; }); addFormatToken('MMM', 0, 0, function (format) { return this.localeData().monthsShort(this, format); }); addFormatToken('MMMM', 0, 0, function (format) { return this.localeData().months(this, format); }); // PARSING addRegexToken('M', match1to2, match1to2NoLeadingZero); addRegexToken('MM', match1to2, match2); addRegexToken('MMM', function (isStrict, locale) { return locale.monthsShortRegex(isStrict); }); addRegexToken('MMMM', function (isStrict, locale) { return locale.monthsRegex(isStrict); }); addParseToken(['M', 'MM'], function (input, array) { array[MONTH] = toInt(input) - 1; }); addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { var month = config._locale.monthsParse(input, token, config._strict); // if we didn't find a month name, mark the date as invalid. if (month != null) { array[MONTH] = month; } else { getParsingFlags(config).invalidMonth = input; } }); // LOCALES var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split( '_' ), defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, defaultMonthsShortRegex = matchWord, defaultMonthsRegex = matchWord; function localeMonths(m, format) { if (!m) { return isArray(this._months) ? this._months : this._months['standalone']; } return isArray(this._months) ? this._months[m.month()] : this._months[ (this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone' ][m.month()]; } function localeMonthsShort(m, format) { if (!m) { return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort['standalone']; } return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[ MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone' ][m.month()]; } function handleStrictParse(monthName, format, strict) { var i, ii, mom, llc = monthName.toLocaleLowerCase(); if (!this._monthsParse) { // this is not used this._monthsParse = []; this._longMonthsParse = []; this._shortMonthsParse = []; for (i = 0; i < 12; ++i) { mom = createUTC([2000, i]); this._shortMonthsParse[i] = this.monthsShort( mom, '' ).toLocaleLowerCase(); this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); } } if (strict) { if (format === 'MMM') { ii = indexOf.call(this._shortMonthsParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._longMonthsParse, llc); return ii !== -1 ? ii : null; } } else { if (format === 'MMM') { ii = indexOf.call(this._shortMonthsParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._longMonthsParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._longMonthsParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortMonthsParse, llc); return ii !== -1 ? ii : null; } } } function localeMonthsParse(monthName, format, strict) { var i, mom, regex; if (this._monthsParseExact) { return handleStrictParse.call(this, monthName, format, strict); } if (!this._monthsParse) { this._monthsParse = []; this._longMonthsParse = []; this._shortMonthsParse = []; } // TODO: add sorting // Sorting makes sure if one month (or abbr) is a prefix of another // see sorting in computeMonthsParse for (i = 0; i < 12; i++) { // make the regex if we don't have it already mom = createUTC([2000, i]); if (strict && !this._longMonthsParse[i]) { this._longMonthsParse[i] = new RegExp( '^' + this.months(mom, '').replace('.', '') + '$', 'i' ); this._shortMonthsParse[i] = new RegExp( '^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i' ); } if (!strict && !this._monthsParse[i]) { regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); } // test the regex if ( strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName) ) { return i; } else if ( strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName) ) { return i; } else if (!strict && this._monthsParse[i].test(monthName)) { return i; } } } // MOMENTS function setMonth(mom, value) { if (!mom.isValid()) { // No op return mom; } if (typeof value === 'string') { if (/^\d+$/.test(value)) { value = toInt(value); } else { value = mom.localeData().monthsParse(value); // TODO: Another silent failure? if (!isNumber(value)) { return mom; } } } var month = value, date = mom.date(); date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month)); void (mom._isUTC ? mom._d.setUTCMonth(month, date) : mom._d.setMonth(month, date)); return mom; } function getSetMonth(value) { if (value != null) { setMonth(this, value); hooks.updateOffset(this, true); return this; } else { return get(this, 'Month'); } } function getDaysInMonth() { return daysInMonth(this.year(), this.month()); } function monthsShortRegex(isStrict) { if (this._monthsParseExact) { if (!hasOwnProp(this, '_monthsRegex')) { computeMonthsParse.call(this); } if (isStrict) { return this._monthsShortStrictRegex; } else { return this._monthsShortRegex; } } else { if (!hasOwnProp(this, '_monthsShortRegex')) { this._monthsShortRegex = defaultMonthsShortRegex; } return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex; } } function monthsRegex(isStrict) { if (this._monthsParseExact) { if (!hasOwnProp(this, '_monthsRegex')) { computeMonthsParse.call(this); } if (isStrict) { return this._monthsStrictRegex; } else { return this._monthsRegex; } } else { if (!hasOwnProp(this, '_monthsRegex')) { this._monthsRegex = defaultMonthsRegex; } return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex; } } function computeMonthsParse() { function cmpLenRev(a, b) { return b.length - a.length; } var shortPieces = [], longPieces = [], mixedPieces = [], i, mom, shortP, longP; for (i = 0; i < 12; i++) { // make the regex if we don't have it already mom = createUTC([2000, i]); shortP = regexEscape(this.monthsShort(mom, '')); longP = regexEscape(this.months(mom, '')); shortPieces.push(shortP); longPieces.push(longP); mixedPieces.push(longP); mixedPieces.push(shortP); } // Sorting makes sure if one month (or abbr) is a prefix of another it // will match the longer piece. shortPieces.sort(cmpLenRev); longPieces.sort(cmpLenRev); mixedPieces.sort(cmpLenRev); this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); this._monthsShortRegex = this._monthsRegex; this._monthsStrictRegex = new RegExp( '^(' + longPieces.join('|') + ')', 'i' ); this._monthsShortStrictRegex = new RegExp( '^(' + shortPieces.join('|') + ')', 'i' ); } function createDate(y, m, d, h, M, s, ms) { // can't just apply() to create a date: // https://stackoverflow.com/q/181348 var date; // the date constructor remaps years 0-99 to 1900-1999 if (y < 100 && y >= 0) { // preserve leap years using a full 400 year cycle, then reset date = new Date(y + 400, m, d, h, M, s, ms); if (isFinite(date.getFullYear())) { date.setFullYear(y); } } else { date = new Date(y, m, d, h, M, s, ms); } return date; } function createUTCDate(y) { var date, args; // the Date.UTC function remaps years 0-99 to 1900-1999 if (y < 100 && y >= 0) { args = Array.prototype.slice.call(arguments); // preserve leap years using a full 400 year cycle, then reset args[0] = y + 400; date = new Date(Date.UTC.apply(null, args)); if (isFinite(date.getUTCFullYear())) { date.setUTCFullYear(y); } } else { date = new Date(Date.UTC.apply(null, arguments)); } return date; } // start-of-first-week - start-of-year function firstWeekOffset(year, dow, doy) { var // first-week day -- which january is always in the first week (4 for iso, 1 for other) fwd = 7 + dow - doy, // first-week day local weekday -- which local weekday is fwd fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; return -fwdlw + fwd - 1; } // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday function dayOfYearFromWeeks(year, week, weekday, dow, doy) { var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear; if (dayOfYear <= 0) { resYear = year - 1; resDayOfYear = daysInYear(resYear) + dayOfYear; } else if (dayOfYear > daysInYear(year)) { resYear = year + 1; resDayOfYear = dayOfYear - daysInYear(year); } else { resYear = year; resDayOfYear = dayOfYear; } return { year: resYear, dayOfYear: resDayOfYear, }; } function weekOfYear(mom, dow, doy) { var weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, resWeek, resYear; if (week < 1) { resYear = mom.year() - 1; resWeek = week + weeksInYear(resYear, dow, doy); } else if (week > weeksInYear(mom.year(), dow, doy)) { resWeek = week - weeksInYear(mom.year(), dow, doy); resYear = mom.year() + 1; } else { resYear = mom.year(); resWeek = week; } return { week: resWeek, year: resYear, }; } function weeksInYear(year, dow, doy) { var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy); return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; } // FORMATTING addFormatToken('w', ['ww', 2], 'wo', 'week'); addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); // PARSING addRegexToken('w', match1to2, match1to2NoLeadingZero); addRegexToken('ww', match1to2, match2); addRegexToken('W', match1to2, match1to2NoLeadingZero); addRegexToken('WW', match1to2, match2); addWeekParseToken( ['w', 'ww', 'W', 'WW'], function (input, week, config, token) { week[token.substr(0, 1)] = toInt(input); } ); // HELPERS // LOCALES function localeWeek(mom) { return weekOfYear(mom, this._week.dow, this._week.doy).week; } var defaultLocaleWeek = { dow: 0, // Sunday is the first day of the week. doy: 6, // The week that contains Jan 6th is the first week of the year. }; function localeFirstDayOfWeek() { return this._week.dow; } function localeFirstDayOfYear() { return this._week.doy; } // MOMENTS function getSetWeek(input) { var week = this.localeData().week(this); return input == null ? week : this.add((input - week) * 7, 'd'); } function getSetISOWeek(input) { var week = weekOfYear(this, 1, 4).week; return input == null ? week : this.add((input - week) * 7, 'd'); } // FORMATTING addFormatToken('d', 0, 'do', 'day'); addFormatToken('dd', 0, 0, function (format) { return this.localeData().weekdaysMin(this, format); }); addFormatToken('ddd', 0, 0, function (format) { return this.localeData().weekdaysShort(this, format); }); addFormatToken('dddd', 0, 0, function (format) { return this.localeData().weekdays(this, format); }); addFormatToken('e', 0, 0, 'weekday'); addFormatToken('E', 0, 0, 'isoWeekday'); // PARSING addRegexToken('d', match1to2); addRegexToken('e', match1to2); addRegexToken('E', match1to2); addRegexToken('dd', function (isStrict, locale) { return locale.weekdaysMinRegex(isStrict); }); addRegexToken('ddd', function (isStrict, locale) { return locale.weekdaysShortRegex(isStrict); }); addRegexToken('dddd', function (isStrict, locale) { return locale.weekdaysRegex(isStrict); }); addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { var weekday = config._locale.weekdaysParse(input, token, config._strict); // if we didn't get a weekday name, mark the date as invalid if (weekday != null) { week.d = weekday; } else { getParsingFlags(config).invalidWeekday = input; } }); addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { week[token] = toInt(input); }); // HELPERS function parseWeekday(input, locale) { if (typeof input !== 'string') { return input; } if (!isNaN(input)) { return parseInt(input, 10); } input = locale.weekdaysParse(input); if (typeof input === 'number') { return input; } return null; } function parseIsoWeekday(input, locale) { if (typeof input === 'string') { return locale.weekdaysParse(input) % 7 || 7; } return isNaN(input) ? null : input; } // LOCALES function shiftWeekdays(ws, n) { return ws.slice(n, 7).concat(ws.slice(0, n)); } var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), defaultWeekdaysRegex = matchWord, defaultWeekdaysShortRegex = matchWord, defaultWeekdaysMinRegex = matchWord; function localeWeekdays(m, format) { var weekdays = isArray(this._weekdays) ? this._weekdays : this._weekdays[ m && m !== true && this._weekdays.isFormat.test(format) ? 'format' : 'standalone' ]; return m === true ? shiftWeekdays(weekdays, this._week.dow) : m ? weekdays[m.day()] : weekdays; } function localeWeekdaysShort(m) { return m === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m ? this._weekdaysShort[m.day()] : this._weekdaysShort; } function localeWeekdaysMin(m) { return m === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m ? this._weekdaysMin[m.day()] : this._weekdaysMin; } function handleStrictParse$1(weekdayName, format, strict) { var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); if (!this._weekdaysParse) { this._weekdaysParse = []; this._shortWeekdaysParse = []; this._minWeekdaysParse = []; for (i = 0; i < 7; ++i) { mom = createUTC([2000, 1]).day(i); this._minWeekdaysParse[i] = this.weekdaysMin( mom, '' ).toLocaleLowerCase(); this._shortWeekdaysParse[i] = this.weekdaysShort( mom, '' ).toLocaleLowerCase(); this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); } } if (strict) { if (format === 'dddd') { ii = indexOf.call(this._weekdaysParse, llc); return ii !== -1 ? ii : null; } else if (format === 'ddd') { ii = indexOf.call(this._shortWeekdaysParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } } else { if (format === 'dddd') { ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } else if (format === 'ddd') { ii = indexOf.call(this._shortWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._minWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortWeekdaysParse, llc); return ii !== -1 ? ii : null; } } } function localeWeekdaysParse(weekdayName, format, strict) { var i, mom, regex; if (this._weekdaysParseExact) { return handleStrictParse$1.call(this, weekdayName, format, strict); } if (!this._weekdaysParse) { this._weekdaysParse = []; this._minWeekdaysParse = []; this._shortWeekdaysParse = []; this._fullWeekdaysParse = []; } for (i = 0; i < 7; i++) { // make the regex if we don't have it already mom = createUTC([2000, 1]).day(i); if (strict && !this._fullWeekdaysParse[i]) { this._fullWeekdaysParse[i] = new RegExp( '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i' ); this._shortWeekdaysParse[i] = new RegExp( '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i' ); this._minWeekdaysParse[i] = new RegExp( '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i' ); } if (!this._weekdaysParse[i]) { regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); } // test the regex if ( strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName) ) { return i; } else if ( strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName) ) { return i; } else if ( strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName) ) { return i; } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { return i; } } } // MOMENTS function getSetDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var day = get(this, 'Day'); if (input != null) { input = parseWeekday(input, this.localeData()); return this.add(input - day, 'd'); } else { return day; } } function getSetLocaleDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; return input == null ? weekday : this.add(input - weekday, 'd'); } function getSetISODayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } // behaves the same as moment#day except // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) // as a setter, sunday should belong to the previous week. if (input != null) { var weekday = parseIsoWeekday(input, this.localeData()); return this.day(this.day() % 7 ? weekday : weekday - 7); } else { return this.day() || 7; } } function weekdaysRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, '_weekdaysRegex')) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysStrictRegex; } else { return this._weekdaysRegex; } } else { if (!hasOwnProp(this, '_weekdaysRegex')) { this._weekdaysRegex = defaultWeekdaysRegex; } return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex; } } function weekdaysShortRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, '_weekdaysRegex')) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysShortStrictRegex; } else { return this._weekdaysShortRegex; } } else { if (!hasOwnProp(this, '_weekdaysShortRegex')) { this._weekdaysShortRegex = defaultWeekdaysShortRegex; } return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex; } } function weekdaysMinRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, '_weekdaysRegex')) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysMinStrictRegex; } else { return this._weekdaysMinRegex; } } else { if (!hasOwnProp(this, '_weekdaysMinRegex')) { this._weekdaysMinRegex = defaultWeekdaysMinRegex; } return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex; } } function computeWeekdaysParse() { function cmpLenRev(a, b) { return b.length - a.length; } var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], i, mom, minp, shortp, longp; for (i = 0; i < 7; i++) { // make the regex if we don't have it already mom = createUTC([2000, 1]).day(i); minp = regexEscape(this.weekdaysMin(mom, '')); shortp = regexEscape(this.weekdaysShort(mom, '')); longp = regexEscape(this.weekdays(mom, '')); minPieces.push(minp); shortPieces.push(shortp); longPieces.push(longp); mixedPieces.push(minp); mixedPieces.push(shortp); mixedPieces.push(longp); } // Sorting makes sure if one weekday (or abbr) is a prefix of another it // will match the longer piece. minPieces.sort(cmpLenRev); shortPieces.sort(cmpLenRev); longPieces.sort(cmpLenRev); mixedPieces.sort(cmpLenRev); this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); this._weekdaysShortRegex = this._weekdaysRegex; this._weekdaysMinRegex = this._weekdaysRegex; this._weekdaysStrictRegex = new RegExp( '^(' + longPieces.join('|') + ')', 'i' ); this._weekdaysShortStrictRegex = new RegExp( '^(' + shortPieces.join('|') + ')', 'i' ); this._weekdaysMinStrictRegex = new RegExp( '^(' + minPieces.join('|') + ')', 'i' ); } // FORMATTING function hFormat() { return this.hours() % 12 || 12; } function kFormat() { return this.hours() || 24; } addFormatToken('H', ['HH', 2], 0, 'hour'); addFormatToken('h', ['hh', 2], 0, hFormat); addFormatToken('k', ['kk', 2], 0, kFormat); addFormatToken('hmm', 0, 0, function () { return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); }); addFormatToken('hmmss', 0, 0, function () { return ( '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2) ); }); addFormatToken('Hmm', 0, 0, function () { return '' + this.hours() + zeroFill(this.minutes(), 2); }); addFormatToken('Hmmss', 0, 0, function () { return ( '' + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2) ); }); function meridiem(token, lowercase) { addFormatToken(token, 0, 0, function () { return this.localeData().meridiem( this.hours(), this.minutes(), lowercase ); }); } meridiem('a', true); meridiem('A', false); // PARSING function matchMeridiem(isStrict, locale) { return locale._meridiemParse; } addRegexToken('a', matchMeridiem); addRegexToken('A', matchMeridiem); addRegexToken('H', match1to2, match1to2HasZero); addRegexToken('h', match1to2, match1to2NoLeadingZero); addRegexToken('k', match1to2, match1to2NoLeadingZero); addRegexToken('HH', match1to2, match2); addRegexToken('hh', match1to2, match2); addRegexToken('kk', match1to2, match2); addRegexToken('hmm', match3to4); addRegexToken('hmmss', match5to6); addRegexToken('Hmm', match3to4); addRegexToken('Hmmss', match5to6); addParseToken(['H', 'HH'], HOUR); addParseToken(['k', 'kk'], function (input, array, config) { var kInput = toInt(input); array[HOUR] = kInput === 24 ? 0 : kInput; }); addParseToken(['a', 'A'], function (input, array, config) { config._isPm = config._locale.isPM(input); config._meridiem = input; }); addParseToken(['h', 'hh'], function (input, array, config) { array[HOUR] = toInt(input); getParsingFlags(config).bigHour = true; }); addParseToken('hmm', function (input, array, config) { var pos = input.length - 2; array[HOUR] = toInt(input.substr(0, pos)); array[MINUTE] = toInt(input.substr(pos)); getParsingFlags(config).bigHour = true; }); addParseToken('hmmss', function (input, array, config) { var pos1 = input.length - 4, pos2 = input.length - 2; array[HOUR] = toInt(input.substr(0, pos1)); array[MINUTE] = toInt(input.substr(pos1, 2)); array[SECOND] = toInt(input.substr(pos2)); getParsingFlags(config).bigHour = true; }); addParseToken('Hmm', function (input, array, config) { var pos = input.length - 2; array[HOUR] = toInt(input.substr(0, pos)); array[MINUTE] = toInt(input.substr(pos)); }); addParseToken('Hmmss', function (input, array, config) { var pos1 = input.length - 4, pos2 = input.length - 2; array[HOUR] = toInt(input.substr(0, pos1)); array[MINUTE] = toInt(input.substr(pos1, 2)); array[SECOND] = toInt(input.substr(pos2)); }); // LOCALES function localeIsPM(input) { // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays // Using charAt should be more compatible. return (input + '').toLowerCase().charAt(0) === 'p'; } var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, // Setting the hour should keep the time, because the user explicitly // specified which hour they want. So trying to maintain the same hour (in // a new timezone) makes sense. Adding/subtracting hours does not follow // this rule. getSetHour = makeGetSet('Hours', true); function localeMeridiem(hours, minutes, isLower) { if (hours > 11) { return isLower ? 'pm' : 'PM'; } else { return isLower ? 'am' : 'AM'; } } var baseConfig = { calendar: defaultCalendar, longDateFormat: defaultLongDateFormat, invalidDate: defaultInvalidDate, ordinal: defaultOrdinal, dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, relativeTime: defaultRelativeTime, months: defaultLocaleMonths, monthsShort: defaultLocaleMonthsShort, week: defaultLocaleWeek, weekdays: defaultLocaleWeekdays, weekdaysMin: defaultLocaleWeekdaysMin, weekdaysShort: defaultLocaleWeekdaysShort, meridiemParse: defaultLocaleMeridiemParse, }; // internal storage for locale config files var locales = {}, localeFamilies = {}, globalLocale; function commonPrefix(arr1, arr2) { var i, minl = Math.min(arr1.length, arr2.length); for (i = 0; i < minl; i += 1) { if (arr1[i] !== arr2[i]) { return i; } } return minl; } function normalizeLocale(key) { return key ? key.toLowerCase().replace('_', '-') : key; } // pick the locale from the array // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root function chooseLocale(names) { var i = 0, j, next, locale, split; while (i < names.length) { split = normalizeLocale(names[i]).split('-'); j = split.length; next = normalizeLocale(names[i + 1]); next = next ? next.split('-') : null; while (j > 0) { locale = loadLocale(split.slice(0, j).join('-')); if (locale) { return locale; } if ( next && next.length >= j && commonPrefix(split, next) >= j - 1 ) { //the next array item is better than a shallower substring of this one break; } j--; } i++; } return globalLocale; } function isLocaleNameSane(name) { // Prevent names that look like filesystem paths, i.e contain '/' or '\' // Ensure name is available and function returns boolean return !!(name && name.match('^[^/\\\\]*$')); } function loadLocale(name) { var oldLocale = null, aliasedRequire; // TODO: Find a better way to register and load all the locales in Node if ( locales[name] === undefined && typeof module !== 'undefined' && module && module.exports && isLocaleNameSane(name) ) { try { oldLocale = globalLocale._abbr; aliasedRequire = require; aliasedRequire('./locale/' + name); getSetGlobalLocale(oldLocale); } catch (e) { // mark as not found to avoid repeating expensive file require call causing high CPU // when trying to find en-US, en_US, en-us for every format call locales[name] = null; // null means not found } } return locales[name]; } // This function will load locale and then set the global locale. If // no arguments are passed in, it will simply return the current global // locale key. function getSetGlobalLocale(key, values) { var data; if (key) { if (isUndefined(values)) { data = getLocale(key); } else { data = defineLocale(key, values); } if (data) { // moment.duration._locale = moment._locale = data; globalLocale = data; } else { if (typeof console !== 'undefined' && console.warn) { //warn user if arguments are passed but the locale could not be set console.warn( 'Locale ' + key + ' not found. Did you forget to load it?' ); } } } return globalLocale._abbr; } function defineLocale(name, config) { if (config !== null) { var locale, parentConfig = baseConfig; config.abbr = name; if (locales[name] != null) { deprecateSimple( 'defineLocaleOverride', 'use moment.updateLocale(localeName, config) to change ' + 'an existing locale. moment.defineLocale(localeName, ' + 'config) should only be used for creating a new locale ' + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.' ); parentConfig = locales[name]._config; } else if (config.parentLocale != null) { if (locales[config.parentLocale] != null) { parentConfig = locales[config.parentLocale]._config; } else { locale = loadLocale(config.parentLocale); if (locale != null) { parentConfig = locale._config; } else { if (!localeFamilies[config.parentLocale]) { localeFamilies[config.parentLocale] = []; } localeFamilies[config.parentLocale].push({ name: name, config: config, }); return null; } } } locales[name] = new Locale(mergeConfigs(parentConfig, config)); if (localeFamilies[name]) { localeFamilies[name].forEach(function (x) { defineLocale(x.name, x.config); }); } // backwards compat for now: also set the locale // make sure we set the locale AFTER all child locales have been // created, so we won't end up with the child locale set. getSetGlobalLocale(name); return locales[name]; } else { // useful for testing delete locales[name]; return null; } } function updateLocale(name, config) { if (config != null) { var locale, tmpLocale, parentConfig = baseConfig; if (locales[name] != null && locales[name].parentLocale != null) { // Update existing child locale in-place to avoid memory-leaks locales[name].set(mergeConfigs(locales[name]._config, config)); } else { // MERGE tmpLocale = loadLocale(name); if (tmpLocale != null) { parentConfig = tmpLocale._config; } config = mergeConfigs(parentConfig, config); if (tmpLocale == null) { // updateLocale is called for creating a new locale // Set abbr so it will have a name (getters return // undefined otherwise). config.abbr = name; } locale = new Locale(config); locale.parentLocale = locales[name]; locales[name] = locale; } // backwards compat for now: also set the locale getSetGlobalLocale(name); } else { // pass null for config to unupdate, useful for tests if (locales[name] != null) { if (locales[name].parentLocale != null) { locales[name] = locales[name].parentLocale; if (name === getSetGlobalLocale()) { getSetGlobalLocale(name); } } else if (locales[name] != null) { delete locales[name]; } } } return locales[name]; } // returns locale data function getLocale(key) { var locale; if (key && key._locale && key._locale._abbr) { key = key._locale._abbr; } if (!key) { return globalLocale; } if (!isArray(key)) { //short-circuit everything else locale = loadLocale(key); if (locale) { return locale; } key = [key]; } return chooseLocale(key); } function listLocales() { return keys(locales); } function checkOverflow(m) { var overflow, a = m._a; if (a && getParsingFlags(m).overflow === -2) { overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1; if ( getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE) ) { overflow = DATE; } if (getParsingFlags(m)._overflowWeeks && overflow === -1) { overflow = WEEK; } if (getParsingFlags(m)._overflowWeekday && overflow === -1) { overflow = WEEKDAY; } getParsingFlags(m).overflow = overflow; } return m; } // iso 8601 regex // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, isoDates = [ ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], ['GGGG-[W]WW', /\d{4}-W\d\d/, false], ['YYYY-DDD', /\d{4}-\d{3}/], ['YYYY-MM', /\d{4}-\d\d/, false], ['YYYYYYMMDD', /[+-]\d{10}/], ['YYYYMMDD', /\d{8}/], ['GGGG[W]WWE', /\d{4}W\d{3}/], ['GGGG[W]WW', /\d{4}W\d{2}/, false], ['YYYYDDD', /\d{7}/], ['YYYYMM', /\d{6}/, false], ['YYYY', /\d{4}/, false], ], // iso time formats and regexes isoTimes = [ ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], ['HH:mm:ss', /\d\d:\d\d:\d\d/], ['HH:mm', /\d\d:\d\d/], ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], ['HHmmss', /\d\d\d\d\d\d/], ['HHmm', /\d\d\d\d/], ['HH', /\d\d/], ], aspNetJsonRegex = /^\/?Date\((-?\d+)/i, // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, obsOffsets = { UT: 0, GMT: 0, EDT: -4 * 60, EST: -5 * 60, CDT: -5 * 60, CST: -6 * 60, MDT: -6 * 60, MST: -7 * 60, PDT: -7 * 60, PST: -8 * 60, }; // date from iso format function configFromISO(config) { var i, l, string = config._i, match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), allowTime, dateFormat, timeFormat, tzFormat, isoDatesLen = isoDates.length, isoTimesLen = isoTimes.length; if (match) { getParsingFlags(config).iso = true; for (i = 0, l = isoDatesLen; i < l; i++) { if (isoDates[i][1].exec(match[1])) { dateFormat = isoDates[i][0]; allowTime = isoDates[i][2] !== false; break; } } if (dateFormat == null) { config._isValid = false; return; } if (match[3]) { for (i = 0, l = isoTimesLen; i < l; i++) { if (isoTimes[i][1].exec(match[3])) { // match[2] should be 'T' or space timeFormat = (match[2] || ' ') + isoTimes[i][0]; break; } } if (timeFormat == null) { config._isValid = false; return; } } if (!allowTime && timeFormat != null) { config._isValid = false; return; } if (match[4]) { if (tzRegex.exec(match[4])) { tzFormat = 'Z'; } else { config._isValid = false; return; } } config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); configFromStringAndFormat(config); } else { config._isValid = false; } } function extractFromRFC2822Strings( yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr ) { var result = [ untruncateYear(yearStr), defaultLocaleMonthsShort.indexOf(monthStr), parseInt(dayStr, 10), parseInt(hourStr, 10), parseInt(minuteStr, 10), ]; if (secondStr) { result.push(parseInt(secondStr, 10)); } return result; } function untruncateYear(yearStr) { var year = parseInt(yearStr, 10); if (year <= 49) { return 2000 + year; } else if (year <= 999) { return 1900 + year; } return year; } function preprocessRFC2822(s) { // Remove comments and folding whitespace and replace multiple-spaces with a single space return s .replace(/\([^()]*\)|[\n\t]/g, ' ') .replace(/(\s\s+)/g, ' ') .replace(/^\s\s*/, '') .replace(/\s\s*$/, ''); } function checkWeekday(weekdayStr, parsedInput, config) { if (weekdayStr) { // TODO: Replace the vanilla JS Date object with an independent day-of-week check. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), weekdayActual = new Date( parsedInput[0], parsedInput[1], parsedInput[2] ).getDay(); if (weekdayProvided !== weekdayActual) { getParsingFlags(config).weekdayMismatch = true; config._isValid = false; return false; } } return true; } function calculateOffset(obsOffset, militaryOffset, numOffset) { if (obsOffset) { return obsOffsets[obsOffset]; } else if (militaryOffset) { // the only allowed military tz is Z return 0; } else { var hm = parseInt(numOffset, 10), m = hm % 100, h = (hm - m) / 100; return h * 60 + m; } } // date and time from ref 2822 format function configFromRFC2822(config) { var match = rfc2822.exec(preprocessRFC2822(config._i)), parsedArray; if (match) { parsedArray = extractFromRFC2822Strings( match[4], match[3], match[2], match[5], match[6], match[7] ); if (!checkWeekday(match[1], parsedArray, config)) { return; } config._a = parsedArray; config._tzm = calculateOffset(match[8], match[9], match[10]); config._d = createUTCDate.apply(null, config._a); config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); getParsingFlags(config).rfc2822 = true; } else { config._isValid = false; } } // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict function configFromString(config) { var matched = aspNetJsonRegex.exec(config._i); if (matched !== null) { config._d = new Date(+matched[1]); return; } configFromISO(config); if (config._isValid === false) { delete config._isValid; } else { return; } configFromRFC2822(config); if (config._isValid === false) { delete config._isValid; } else { return; } if (config._strict) { config._isValid = false; } else { // Final attempt, use Input Fallback hooks.createFromInputFallback(config); } } hooks.createFromInputFallback = deprecate( 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.', function (config) { config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); } ); // Pick the first defined of two or three arguments. function defaults(a, b, c) { if (a != null) { return a; } if (b != null) { return b; } return c; } function currentDateArray(config) { // hooks is actually the exported moment object var nowValue = new Date(hooks.now()); if (config._useUTC) { return [ nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate(), ]; } return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; } // convert an array to a date. // the array should mirror the parameters below // note: all values past the year are optional and will default to the lowest possible value. // [year, month, day , hour, minute, second, millisecond] function configFromArray(config) { var i, date, input = [], currentDate, expectedWeekday, yearToUse; if (config._d) { return; } currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { dayOfYearFromWeekInfo(config); } //if the day of the year is set, figure out what it is if (config._dayOfYear != null) { yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); if ( config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0 ) { getParsingFlags(config)._overflowDayOfYear = true; } date = createUTCDate(yearToUse, 0, config._dayOfYear); config._a[MONTH] = date.getUTCMonth(); config._a[DATE] = date.getUTCDate(); } // Default to current date. // * if no year, month, day of month are given, default to today // * if day of month is given, default month and year // * if month is given, default only year // * if year is given, don't default anything for (i = 0; i < 3 && config._a[i] == null; ++i) { config._a[i] = input[i] = currentDate[i]; } // Zero out whatever was not defaulted, including time for (; i < 7; i++) { config._a[i] = input[i] = config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i]; } // Check for 24:00:00.000 if ( config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0 ) { config._nextDay = true; config._a[HOUR] = 0; } config._d = (config._useUTC ? createUTCDate : createDate).apply( null, input ); expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); // Apply timezone offset from input. The actual utcOffset can be changed // with parseZone. if (config._tzm != null) { config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); } if (config._nextDay) { config._a[HOUR] = 24; } // check for mismatching day of week if ( config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday ) { getParsingFlags(config).weekdayMismatch = true; } } function dayOfYearFromWeekInfo(config) { var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek; w = config._w; if (w.GG != null || w.W != null || w.E != null) { dow = 1; doy = 4; // TODO: We need to take the current isoWeekYear, but that depends on // how we interpret now (local, utc, fixed offset). So create // a now version of current config (take local/utc/offset flags, and // create now). weekYear = defaults( w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year ); week = defaults(w.W, 1); weekday = defaults(w.E, 1); if (weekday < 1 || weekday > 7) { weekdayOverflow = true; } } else { dow = config._locale._week.dow; doy = config._locale._week.doy; curWeek = weekOfYear(createLocal(), dow, doy); weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); // Default to current week. week = defaults(w.w, curWeek.week); if (w.d != null) { // weekday -- low day numbers are considered next week weekday = w.d; if (weekday < 0 || weekday > 6) { weekdayOverflow = true; } } else if (w.e != null) { // local weekday -- counting starts from beginning of week weekday = w.e + dow; if (w.e < 0 || w.e > 6) { weekdayOverflow = true; } } else { // default to beginning of week weekday = dow; } } if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { getParsingFlags(config)._overflowWeeks = true; } else if (weekdayOverflow != null) { getParsingFlags(config)._overflowWeekday = true; } else { temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); config._a[YEAR] = temp.year; config._dayOfYear = temp.dayOfYear; } } // constant that refers to the ISO standard hooks.ISO_8601 = function () {}; // constant that refers to the RFC 2822 form hooks.RFC_2822 = function () {}; // date from string and format string function configFromStringAndFormat(config) { // TODO: Move this to another part of the creation flow to prevent circular deps if (config._f === hooks.ISO_8601) { configFromISO(config); return; } if (config._f === hooks.RFC_2822) { configFromRFC2822(config); return; } config._a = []; getParsingFlags(config).empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC` var string = '' + config._i, i, parsedInput, tokens, token, skipped, stringLength = string.length, totalParsedInputLength = 0, era, tokenLen; tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; tokenLen = tokens.length; for (i = 0; i < tokenLen; i++) { token = tokens[i]; parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; if (parsedInput) { skipped = string.substr(0, string.indexOf(parsedInput)); if (skipped.length > 0) { getParsingFlags(config).unusedInput.push(skipped); } string = string.slice( string.indexOf(parsedInput) + parsedInput.length ); totalParsedInputLength += parsedInput.length; } // don't parse if it's not a known token if (formatTokenFunctions[token]) { if (parsedInput) { getParsingFlags(config).empty = false; } else { getParsingFlags(config).unusedTokens.push(token); } addTimeToArrayFromToken(token, parsedInput, config); } else if (config._strict && !parsedInput) { getParsingFlags(config).unusedTokens.push(token); } } // add remaining unparsed input length to the string getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; if (string.length > 0) { getParsingFlags(config).unusedInput.push(string); } // clear _12h flag if hour is <= 12 if ( config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0 ) { getParsingFlags(config).bigHour = undefined; } getParsingFlags(config).parsedDateParts = config._a.slice(0); getParsingFlags(config).meridiem = config._meridiem; // handle meridiem config._a[HOUR] = meridiemFixWrap( config._locale, config._a[HOUR], config._meridiem ); // handle era era = getParsingFlags(config).era; if (era !== null) { config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]); } configFromArray(config); checkOverflow(config); } function meridiemFixWrap(locale, hour, meridiem) { var isPm; if (meridiem == null) { // nothing to do return hour; } if (locale.meridiemHour != null) { return locale.meridiemHour(hour, meridiem); } else if (locale.isPM != null) { // Fallback isPm = locale.isPM(meridiem); if (isPm && hour < 12) { hour += 12; } if (!isPm && hour === 12) { hour = 0; } return hour; } else { // this is not supposed to happen return hour; } } // date from string and array of format strings function configFromStringAndArray(config) { var tempConfig, bestMoment, scoreToBeat, i, currentScore, validFormatFound, bestFormatIsValid = false, configfLen = config._f.length; if (configfLen === 0) { getParsingFlags(config).invalidFormat = true; config._d = new Date(NaN); return; } for (i = 0; i < configfLen; i++) { currentScore = 0; validFormatFound = false; tempConfig = copyConfig({}, config); if (config._useUTC != null) { tempConfig._useUTC = config._useUTC; } tempConfig._f = config._f[i]; configFromStringAndFormat(tempConfig); if (isValid(tempConfig)) { validFormatFound = true; } // if there is any input that was not parsed add a penalty for that format currentScore += getParsingFlags(tempConfig).charsLeftOver; //or tokens currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; getParsingFlags(tempConfig).score = currentScore; if (!bestFormatIsValid) { if ( scoreToBeat == null || currentScore < scoreToBeat || validFormatFound ) { scoreToBeat = currentScore; bestMoment = tempConfig; if (validFormatFound) { bestFormatIsValid = true; } } } else { if (currentScore < scoreToBeat) { scoreToBeat = currentScore; bestMoment = tempConfig; } } } extend(config, bestMoment || tempConfig); } function configFromObject(config) { if (config._d) { return; } var i = normalizeObjectUnits(config._i), dayOrDate = i.day === undefined ? i.date : i.day; config._a = map( [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond], function (obj) { return obj && parseInt(obj, 10); } ); configFromArray(config); } function createFromConfig(config) { var res = new Moment(checkOverflow(prepareConfig(config))); if (res._nextDay) { // Adding is smart enough around DST res.add(1, 'd'); res._nextDay = undefined; } return res; } function prepareConfig(config) { var input = config._i, format = config._f; config._locale = config._locale || getLocale(config._l); if (input === null || (format === undefined && input === '')) { return createInvalid({ nullInput: true }); } if (typeof input === 'string') { config._i = input = config._locale.preparse(input); } if (isMoment(input)) { return new Moment(checkOverflow(input)); } else if (isDate(input)) { config._d = input; } else if (isArray(format)) { configFromStringAndArray(config); } else if (format) { configFromStringAndFormat(config); } else { configFromInput(config); } if (!isValid(config)) { config._d = null; } return config; } function configFromInput(config) { var input = config._i; if (isUndefined(input)) { config._d = new Date(hooks.now()); } else if (isDate(input)) { config._d = new Date(input.valueOf()); } else if (typeof input === 'string') { configFromString(config); } else if (isArray(input)) { config._a = map(input.slice(0), function (obj) { return parseInt(obj, 10); }); configFromArray(config); } else if (isObject(input)) { configFromObject(config); } else if (isNumber(input)) { // from milliseconds config._d = new Date(input); } else { hooks.createFromInputFallback(config); } } function createLocalOrUTC(input, format, locale, strict, isUTC) { var c = {}; if (format === true || format === false) { strict = format; format = undefined; } if (locale === true || locale === false) { strict = locale; locale = undefined; } if ( (isObject(input) && isObjectEmpty(input)) || (isArray(input) && input.length === 0) ) { input = undefined; } // object construction must be done this way. // https://github.com/moment/moment/issues/1423 c._isAMomentObject = true; c._useUTC = c._isUTC = isUTC; c._l = locale; c._i = input; c._f = format; c._strict = strict; return createFromConfig(c); } function createLocal(input, format, locale, strict) { return createLocalOrUTC(input, format, locale, strict, false); } var prototypeMin = deprecate( 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', function () { var other = createLocal.apply(null, arguments); if (this.isValid() && other.isValid()) { return other < this ? this : other; } else { return createInvalid(); } } ), prototypeMax = deprecate( 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', function () { var other = createLocal.apply(null, arguments); if (this.isValid() && other.isValid()) { return other > this ? this : other; } else { return createInvalid(); } } ); // Pick a moment m from moments so that m[fn](other) is true for all // other. This relies on the function fn to be transitive. // // moments should either be an array of moment objects or an array, whose // first element is an array of moment objects. function pickBy(fn, moments) { var res, i; if (moments.length === 1 && isArray(moments[0])) { moments = moments[0]; } if (!moments.length) { return createLocal(); } res = moments[0]; for (i = 1; i < moments.length; ++i) { if (!moments[i].isValid() || moments[i][fn](res)) { res = moments[i]; } } return res; } // TODO: Use [].sort instead? function min() { var args = [].slice.call(arguments, 0); return pickBy('isBefore', args); } function max() { var args = [].slice.call(arguments, 0); return pickBy('isAfter', args); } var now = function () { return Date.now ? Date.now() : +new Date(); }; var ordering = [ 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond', ]; function isDurationValid(m) { var key, unitHasDecimal = false, i, orderLen = ordering.length; for (key in m) { if ( hasOwnProp(m, key) && !( indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])) ) ) { return false; } } for (i = 0; i < orderLen; ++i) { if (m[ordering[i]]) { if (unitHasDecimal) { return false; // only allow non-integers for smallest unit } if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { unitHasDecimal = true; } } } return true; } function isValid$1() { return this._isValid; } function createInvalid$1() { return createDuration(NaN); } function Duration(duration) { var normalizedInput = normalizeObjectUnits(duration), years = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months = normalizedInput.month || 0, weeks = normalizedInput.week || normalizedInput.isoWeek || 0, days = normalizedInput.day || 0, hours = normalizedInput.hour || 0, minutes = normalizedInput.minute || 0, seconds = normalizedInput.second || 0, milliseconds = normalizedInput.millisecond || 0; this._isValid = isDurationValid(normalizedInput); // representation for dateAddRemove this._milliseconds = +milliseconds + seconds * 1e3 + // 1000 minutes * 6e4 + // 1000 * 60 hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 // Because of dateAddRemove treats 24 hours as different from a // day when working around DST, we need to store them separately this._days = +days + weeks * 7; // It is impossible to translate months into days without knowing // which months you are are talking about, so we have to store // it separately. this._months = +months + quarters * 3 + years * 12; this._data = {}; this._locale = getLocale(); this._bubble(); } function isDuration(obj) { return obj instanceof Duration; } function absRound(number) { if (number < 0) { return Math.round(-1 * number) * -1; } else { return Math.round(number); } } // compare two arrays, return the number of differences function compareArrays(array1, array2, dontConvert) { var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i; for (i = 0; i < len; i++) { if ( (dontConvert && array1[i] !== array2[i]) || (!dontConvert && toInt(array1[i]) !== toInt(array2[i])) ) { diffs++; } } return diffs + lengthDiff; } // FORMATTING function offset(token, separator) { addFormatToken(token, 0, 0, function () { var offset = this.utcOffset(), sign = '+'; if (offset < 0) { offset = -offset; sign = '-'; } return ( sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~offset % 60, 2) ); }); } offset('Z', ':'); offset('ZZ', ''); // PARSING addRegexToken('Z', matchShortOffset); addRegexToken('ZZ', matchShortOffset); addParseToken(['Z', 'ZZ'], function (input, array, config) { config._useUTC = true; config._tzm = offsetFromString(matchShortOffset, input); }); // HELPERS // timezone chunker // '+10:00' > ['10', '00'] // '-1530' > ['-15', '30'] var chunkOffset = /([\+\-]|\d\d)/gi; function offsetFromString(matcher, string) { var matches = (string || '').match(matcher), chunk, parts, minutes; if (matches === null) { return null; } chunk = matches[matches.length - 1] || []; parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; minutes = +(parts[1] * 60) + toInt(parts[2]); return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes; } // Return a moment from input, that is local/utc/zone equivalent to model. function cloneWithOffset(input, model) { var res, diff; if (model._isUTC) { res = model.clone(); diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); // Use low-level api, because this fn is low-level api. res._d.setTime(res._d.valueOf() + diff); hooks.updateOffset(res, false); return res; } else { return createLocal(input).local(); } } function getDateOffset(m) { // On Firefox.24 Date#getTimezoneOffset returns a floating point. // https://github.com/moment/moment/pull/1871 return -Math.round(m._d.getTimezoneOffset()); } // HOOKS // This function will be called whenever a moment is mutated. // It is intended to keep the offset in sync with the timezone. hooks.updateOffset = function () {}; // MOMENTS // keepLocalTime = true means only change the timezone, without // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset // +0200, so we adjust the time as needed, to be valid. // // Keeping the time actually adds/subtracts (one hour) // from the actual represented time. That is why we call updateOffset // a second time. In case it wants us to change the offset again // _changeInProgress == true case, then we have to adjust, because // there is no such time in the given timezone. function getSetOffset(input, keepLocalTime, keepMinutes) { var offset = this._offset || 0, localAdjust; if (!this.isValid()) { return input != null ? this : NaN; } if (input != null) { if (typeof input === 'string') { input = offsetFromString(matchShortOffset, input); if (input === null) { return this; } } else if (Math.abs(input) < 16 && !keepMinutes) { input = input * 60; } if (!this._isUTC && keepLocalTime) { localAdjust = getDateOffset(this); } this._offset = input; this._isUTC = true; if (localAdjust != null) { this.add(localAdjust, 'm'); } if (offset !== input) { if (!keepLocalTime || this._changeInProgress) { addSubtract( this, createDuration(input - offset, 'm'), 1, false ); } else if (!this._changeInProgress) { this._changeInProgress = true; hooks.updateOffset(this, true); this._changeInProgress = null; } } return this; } else { return this._isUTC ? offset : getDateOffset(this); } } function getSetZone(input, keepLocalTime) { if (input != null) { if (typeof input !== 'string') { input = -input; } this.utcOffset(input, keepLocalTime); return this; } else { return -this.utcOffset(); } } function setOffsetToUTC(keepLocalTime) { return this.utcOffset(0, keepLocalTime); } function setOffsetToLocal(keepLocalTime) { if (this._isUTC) { this.utcOffset(0, keepLocalTime); this._isUTC = false; if (keepLocalTime) { this.subtract(getDateOffset(this), 'm'); } } return this; } function setOffsetToParsedOffset() { if (this._tzm != null) { this.utcOffset(this._tzm, false, true); } else if (typeof this._i === 'string') { var tZone = offsetFromString(matchOffset, this._i); if (tZone != null) { this.utcOffset(tZone); } else { this.utcOffset(0, true); } } return this; } function hasAlignedHourOffset(input) { if (!this.isValid()) { return false; } input = input ? createLocal(input).utcOffset() : 0; return (this.utcOffset() - input) % 60 === 0; } function isDaylightSavingTime() { return ( this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset() ); } function isDaylightSavingTimeShifted() { if (!isUndefined(this._isDSTShifted)) { return this._isDSTShifted; } var c = {}, other; copyConfig(c, this); c = prepareConfig(c); if (c._a) { other = c._isUTC ? createUTC(c._a) : createLocal(c._a); this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0; } else { this._isDSTShifted = false; } return this._isDSTShifted; } function isLocal() { return this.isValid() ? !this._isUTC : false; } function isUtcOffset() { return this.isValid() ? this._isUTC : false; } function isUtc() { return this.isValid() ? this._isUTC && this._offset === 0 : false; } // ASP.NET json date format regex var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere // and further modified to allow for strings containing both week and day isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; function createDuration(input, key) { var duration = input, // matching against regexp is expensive, do it on demand match = null, sign, ret, diffRes; if (isDuration(input)) { duration = { ms: input._milliseconds, d: input._days, M: input._months, }; } else if (isNumber(input) || !isNaN(+input)) { duration = {}; if (key) { duration[key] = +input; } else { duration.milliseconds = +input; } } else if ((match = aspNetRegex.exec(input))) { sign = match[1] === '-' ? -1 : 1; duration = { y: 0, d: toInt(match[DATE]) * sign, h: toInt(match[HOUR]) * sign, m: toInt(match[MINUTE]) * sign, s: toInt(match[SECOND]) * sign, ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match }; } else if ((match = isoRegex.exec(input))) { sign = match[1] === '-' ? -1 : 1; duration = { y: parseIso(match[2], sign), M: parseIso(match[3], sign), w: parseIso(match[4], sign), d: parseIso(match[5], sign), h: parseIso(match[6], sign), m: parseIso(match[7], sign), s: parseIso(match[8], sign), }; } else if (duration == null) { // checks for null or undefined duration = {}; } else if ( typeof duration === 'object' && ('from' in duration || 'to' in duration) ) { diffRes = momentsDifference( createLocal(duration.from), createLocal(duration.to) ); duration = {}; duration.ms = diffRes.milliseconds; duration.M = diffRes.months; } ret = new Duration(duration); if (isDuration(input) && hasOwnProp(input, '_locale')) { ret._locale = input._locale; } if (isDuration(input) && hasOwnProp(input, '_isValid')) { ret._isValid = input._isValid; } return ret; } createDuration.fn = Duration.prototype; createDuration.invalid = createInvalid$1; function parseIso(inp, sign) { // We'd normally use ~~inp for this, but unfortunately it also // converts floats to ints. // inp may be undefined, so careful calling replace on it. var res = inp && parseFloat(inp.replace(',', '.')); // apply sign while we're at it return (isNaN(res) ? 0 : res) * sign; } function positiveMomentsDifference(base, other) { var res = {}; res.months = other.month() - base.month() + (other.year() - base.year()) * 12; if (base.clone().add(res.months, 'M').isAfter(other)) { --res.months; } res.milliseconds = +other - +base.clone().add(res.months, 'M'); return res; } function momentsDifference(base, other) { var res; if (!(base.isValid() && other.isValid())) { return { milliseconds: 0, months: 0 }; } other = cloneWithOffset(other, base); if (base.isBefore(other)) { res = positiveMomentsDifference(base, other); } else { res = positiveMomentsDifference(other, base); res.milliseconds = -res.milliseconds; res.months = -res.months; } return res; } // TODO: remove 'name' arg after deprecation is removed function createAdder(direction, name) { return function (val, period) { var dur, tmp; //invert the arguments, but complain about it if (period !== null && !isNaN(+period)) { deprecateSimple( name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.' ); tmp = val; val = period; period = tmp; } dur = createDuration(val, period); addSubtract(this, dur, direction); return this; }; } function addSubtract(mom, duration, isAdding, updateOffset) { var milliseconds = duration._milliseconds, days = absRound(duration._days), months = absRound(duration._months); if (!mom.isValid()) { // No op return; } updateOffset = updateOffset == null ? true : updateOffset; if (months) { setMonth(mom, get(mom, 'Month') + months * isAdding); } if (days) { set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); } if (milliseconds) { mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); } if (updateOffset) { hooks.updateOffset(mom, days || months); } } var add = createAdder(1, 'add'), subtract = createAdder(-1, 'subtract'); function isString(input) { return typeof input === 'string' || input instanceof String; } // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined function isMomentInput(input) { return ( isMoment(input) || isDate(input) || isString(input) || isNumber(input) || isNumberOrStringArray(input) || isMomentInputObject(input) || input === null || input === undefined ); } function isMomentInputObject(input) { var objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = false, properties = [ 'years', 'year', 'y', 'months', 'month', 'M', 'days', 'day', 'd', 'dates', 'date', 'D', 'hours', 'hour', 'h', 'minutes', 'minute', 'm', 'seconds', 'second', 's', 'milliseconds', 'millisecond', 'ms', ], i, property, propertyLen = properties.length; for (i = 0; i < propertyLen; i += 1) { property = properties[i]; propertyTest = propertyTest || hasOwnProp(input, property); } return objectTest && propertyTest; } function isNumberOrStringArray(input) { var arrayTest = isArray(input), dataTypeTest = false; if (arrayTest) { dataTypeTest = input.filter(function (item) { return !isNumber(item) && isString(input); }).length === 0; } return arrayTest && dataTypeTest; } function isCalendarSpec(input) { var objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = false, properties = [ 'sameDay', 'nextDay', 'lastDay', 'nextWeek', 'lastWeek', 'sameElse', ], i, property; for (i = 0; i < properties.length; i += 1) { property = properties[i]; propertyTest = propertyTest || hasOwnProp(input, property); } return objectTest && propertyTest; } function getCalendarFormat(myMoment, now) { var diff = myMoment.diff(now, 'days', true); return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse'; } function calendar$1(time, formats) { // Support for single parameter, formats only overload to the calendar function if (arguments.length === 1) { if (!arguments[0]) { time = undefined; formats = undefined; } else if (isMomentInput(arguments[0])) { time = arguments[0]; formats = undefined; } else if (isCalendarSpec(arguments[0])) { formats = arguments[0]; time = undefined; } } // We want to compare the start of today, vs this. // Getting start-of-today depends on whether we're local/utc/offset or not. var now = time || createLocal(), sod = cloneWithOffset(now, this).startOf('day'), format = hooks.calendarFormat(this, sod) || 'sameElse', output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); return this.format( output || this.localeData().calendar(format, this, createLocal(now)) ); } function clone() { return new Moment(this); } function isAfter(input, units) { var localInput = isMoment(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || 'millisecond'; if (units === 'millisecond') { return this.valueOf() > localInput.valueOf(); } else { return localInput.valueOf() < this.clone().startOf(units).valueOf(); } } function isBefore(input, units) { var localInput = isMoment(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || 'millisecond'; if (units === 'millisecond') { return this.valueOf() < localInput.valueOf(); } else { return this.clone().endOf(units).valueOf() < localInput.valueOf(); } } function isBetween(from, to, units, inclusivity) { var localFrom = isMoment(from) ? from : createLocal(from), localTo = isMoment(to) ? to : createLocal(to); if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) { return false; } inclusivity = inclusivity || '()'; return ( (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units)) ); } function isSame(input, units) { var localInput = isMoment(input) ? input : createLocal(input), inputMs; if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || 'millisecond'; if (units === 'millisecond') { return this.valueOf() === localInput.valueOf(); } else { inputMs = localInput.valueOf(); return ( this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf() ); } } function isSameOrAfter(input, units) { return this.isSame(input, units) || this.isAfter(input, units); } function isSameOrBefore(input, units) { return this.isSame(input, units) || this.isBefore(input, units); } function diff(input, units, asFloat) { var that, zoneDelta, output; if (!this.isValid()) { return NaN; } that = cloneWithOffset(input, this); if (!that.isValid()) { return NaN; } zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; units = normalizeUnits(units); switch (units) { case 'year': output = monthDiff(this, that) / 12; break; case 'month': output = monthDiff(this, that); break; case 'quarter': output = monthDiff(this, that) / 3; break; case 'second': output = (this - that) / 1e3; break; // 1000 case 'minute': output = (this - that) / 6e4; break; // 1000 * 60 case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60 case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst default: output = this - that; } return asFloat ? output : absFloor(output); } function monthDiff(a, b) { if (a.date() < b.date()) { // end-of-month calculations work correct when the start month has more // days than the end month. return -monthDiff(b, a); } // difference in months var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), // b is in (anchor - 1 month, anchor + 1 month) anchor = a.clone().add(wholeMonthDiff, 'months'), anchor2, adjust; if (b - anchor < 0) { anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); // linear across the month adjust = (b - anchor) / (anchor - anchor2); } else { anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); // linear across the month adjust = (b - anchor) / (anchor2 - anchor); } //check for negative zero, return zero if negative zero return -(wholeMonthDiff + adjust) || 0; } hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; function toString() { return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); } function toISOString(keepOffset) { if (!this.isValid()) { return null; } var utc = keepOffset !== true, m = utc ? this.clone().utc() : this; if (m.year() < 0 || m.year() > 9999) { return formatMoment( m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ' ); } if (isFunction(Date.prototype.toISOString)) { // native implementation is ~50x faster, use it when we can if (utc) { return this.toDate().toISOString(); } else { return new Date(this.valueOf() + this.utcOffset() * 60 * 1000) .toISOString() .replace('Z', formatMoment(m, 'Z')); } } return formatMoment( m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ' ); } /** * Return a human readable representation of a moment that can * also be evaluated to get a new moment which is the same * * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects */ function inspect() { if (!this.isValid()) { return 'moment.invalid(/* ' + this._i + ' */)'; } var func = 'moment', zone = '', prefix, year, datetime, suffix; if (!this.isLocal()) { func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; zone = 'Z'; } prefix = '[' + func + '("]'; year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY'; datetime = '-MM-DD[T]HH:mm:ss.SSS'; suffix = zone + '[")]'; return this.format(prefix + year + datetime + suffix); } function format(inputString) { if (!inputString) { inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; } var output = formatMoment(this, inputString); return this.localeData().postformat(output); } function from(time, withoutSuffix) { if ( this.isValid() && ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) ) { return createDuration({ to: this, from: time }) .locale(this.locale()) .humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } } function fromNow(withoutSuffix) { return this.from(createLocal(), withoutSuffix); } function to(time, withoutSuffix) { if ( this.isValid() && ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) ) { return createDuration({ from: this, to: time }) .locale(this.locale()) .humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } } function toNow(withoutSuffix) { return this.to(createLocal(), withoutSuffix); } // If passed a locale key, it will set the locale for this // instance. Otherwise, it will return the locale configuration // variables for this instance. function locale(key) { var newLocaleData; if (key === undefined) { return this._locale._abbr; } else { newLocaleData = getLocale(key); if (newLocaleData != null) { this._locale = newLocaleData; } return this; } } var lang = deprecate( 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', function (key) { if (key === undefined) { return this.localeData(); } else { return this.locale(key); } } ); function localeData() { return this._locale; } var MS_PER_SECOND = 1000, MS_PER_MINUTE = 60 * MS_PER_SECOND, MS_PER_HOUR = 60 * MS_PER_MINUTE, MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; // actual modulo - handles negative numbers (for dates before 1970): function mod$1(dividend, divisor) { return ((dividend % divisor) + divisor) % divisor; } function localStartOfDate(y, m, d) { // the date constructor remaps years 0-99 to 1900-1999 if (y < 100 && y >= 0) { // preserve leap years using a full 400 year cycle, then reset return new Date(y + 400, m, d) - MS_PER_400_YEARS; } else { return new Date(y, m, d).valueOf(); } } function utcStartOfDate(y, m, d) { // Date.UTC remaps years 0-99 to 1900-1999 if (y < 100 && y >= 0) { // preserve leap years using a full 400 year cycle, then reset return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; } else { return Date.UTC(y, m, d); } } function startOf(units) { var time, startOfDate; units = normalizeUnits(units); if (units === undefined || units === 'millisecond' || !this.isValid()) { return this; } startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; switch (units) { case 'year': time = startOfDate(this.year(), 0, 1); break; case 'quarter': time = startOfDate( this.year(), this.month() - (this.month() % 3), 1 ); break; case 'month': time = startOfDate(this.year(), this.month(), 1); break; case 'week': time = startOfDate( this.year(), this.month(), this.date() - this.weekday() ); break; case 'isoWeek': time = startOfDate( this.year(), this.month(), this.date() - (this.isoWeekday() - 1) ); break; case 'day': case 'date': time = startOfDate(this.year(), this.month(), this.date()); break; case 'hour': time = this._d.valueOf(); time -= mod$1( time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR ); break; case 'minute': time = this._d.valueOf(); time -= mod$1(time, MS_PER_MINUTE); break; case 'second': time = this._d.valueOf(); time -= mod$1(time, MS_PER_SECOND); break; } this._d.setTime(time); hooks.updateOffset(this, true); return this; } function endOf(units) { var time, startOfDate; units = normalizeUnits(units); if (units === undefined || units === 'millisecond' || !this.isValid()) { return this; } startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; switch (units) { case 'year': time = startOfDate(this.year() + 1, 0, 1) - 1; break; case 'quarter': time = startOfDate( this.year(), this.month() - (this.month() % 3) + 3, 1 ) - 1; break; case 'month': time = startOfDate(this.year(), this.month() + 1, 1) - 1; break; case 'week': time = startOfDate( this.year(), this.month(), this.date() - this.weekday() + 7 ) - 1; break; case 'isoWeek': time = startOfDate( this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7 ) - 1; break; case 'day': case 'date': time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; break; case 'hour': time = this._d.valueOf(); time += MS_PER_HOUR - mod$1( time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR ) - 1; break; case 'minute': time = this._d.valueOf(); time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; break; case 'second': time = this._d.valueOf(); time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; break; } this._d.setTime(time); hooks.updateOffset(this, true); return this; } function valueOf() { return this._d.valueOf() - (this._offset || 0) * 60000; } function unix() { return Math.floor(this.valueOf() / 1000); } function toDate() { return new Date(this.valueOf()); } function toArray() { var m = this; return [ m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond(), ]; } function toObject() { var m = this; return { years: m.year(), months: m.month(), date: m.date(), hours: m.hours(), minutes: m.minutes(), seconds: m.seconds(), milliseconds: m.milliseconds(), }; } function toJSON() { // new Date(NaN).toJSON() === null return this.isValid() ? this.toISOString() : null; } function isValid$2() { return isValid(this); } function parsingFlags() { return extend({}, getParsingFlags(this)); } function invalidAt() { return getParsingFlags(this).overflow; } function creationData() { return { input: this._i, format: this._f, locale: this._locale, isUTC: this._isUTC, strict: this._strict, }; } addFormatToken('N', 0, 0, 'eraAbbr'); addFormatToken('NN', 0, 0, 'eraAbbr'); addFormatToken('NNN', 0, 0, 'eraAbbr'); addFormatToken('NNNN', 0, 0, 'eraName'); addFormatToken('NNNNN', 0, 0, 'eraNarrow'); addFormatToken('y', ['y', 1], 'yo', 'eraYear'); addFormatToken('y', ['yy', 2], 0, 'eraYear'); addFormatToken('y', ['yyy', 3], 0, 'eraYear'); addFormatToken('y', ['yyyy', 4], 0, 'eraYear'); addRegexToken('N', matchEraAbbr); addRegexToken('NN', matchEraAbbr); addRegexToken('NNN', matchEraAbbr); addRegexToken('NNNN', matchEraName); addRegexToken('NNNNN', matchEraNarrow); addParseToken( ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function (input, array, config, token) { var era = config._locale.erasParse(input, token, config._strict); if (era) { getParsingFlags(config).era = era; } else { getParsingFlags(config).invalidEra = input; } } ); addRegexToken('y', matchUnsigned); addRegexToken('yy', matchUnsigned); addRegexToken('yyy', matchUnsigned); addRegexToken('yyyy', matchUnsigned); addRegexToken('yo', matchEraYearOrdinal); addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR); addParseToken(['yo'], function (input, array, config, token) { var match; if (config._locale._eraYearOrdinalRegex) { match = input.match(config._locale._eraYearOrdinalRegex); } if (config._locale.eraYearOrdinalParse) { array[YEAR] = config._locale.eraYearOrdinalParse(input, match); } else { array[YEAR] = parseInt(input, 10); } }); function localeEras(m, format) { var i, l, date, eras = this._eras || getLocale('en')._eras; for (i = 0, l = eras.length; i < l; ++i) { switch (typeof eras[i].since) { case 'string': // truncate time date = hooks(eras[i].since).startOf('day'); eras[i].since = date.valueOf(); break; } switch (typeof eras[i].until) { case 'undefined': eras[i].until = +Infinity; break; case 'string': // truncate time date = hooks(eras[i].until).startOf('day').valueOf(); eras[i].until = date.valueOf(); break; } } return eras; } function localeErasParse(eraName, format, strict) { var i, l, eras = this.eras(), name, abbr, narrow; eraName = eraName.toUpperCase(); for (i = 0, l = eras.length; i < l; ++i) { name = eras[i].name.toUpperCase(); abbr = eras[i].abbr.toUpperCase(); narrow = eras[i].narrow.toUpperCase(); if (strict) { switch (format) { case 'N': case 'NN': case 'NNN': if (abbr === eraName) { return eras[i]; } break; case 'NNNN': if (name === eraName) { return eras[i]; } break; case 'NNNNN': if (narrow === eraName) { return eras[i]; } break; } } else if ([name, abbr, narrow].indexOf(eraName) >= 0) { return eras[i]; } } } function localeErasConvertYear(era, year) { var dir = era.since <= era.until ? +1 : -1; if (year === undefined) { return hooks(era.since).year(); } else { return hooks(era.since).year() + (year - era.offset) * dir; } } function getEraName() { var i, l, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { // truncate time val = this.clone().startOf('day').valueOf(); if (eras[i].since <= val && val <= eras[i].until) { return eras[i].name; } if (eras[i].until <= val && val <= eras[i].since) { return eras[i].name; } } return ''; } function getEraNarrow() { var i, l, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { // truncate time val = this.clone().startOf('day').valueOf(); if (eras[i].since <= val && val <= eras[i].until) { return eras[i].narrow; } if (eras[i].until <= val && val <= eras[i].since) { return eras[i].narrow; } } return ''; } function getEraAbbr() { var i, l, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { // truncate time val = this.clone().startOf('day').valueOf(); if (eras[i].since <= val && val <= eras[i].until) { return eras[i].abbr; } if (eras[i].until <= val && val <= eras[i].since) { return eras[i].abbr; } } return ''; } function getEraYear() { var i, l, dir, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { dir = eras[i].since <= eras[i].until ? +1 : -1; // truncate time val = this.clone().startOf('day').valueOf(); if ( (eras[i].since <= val && val <= eras[i].until) || (eras[i].until <= val && val <= eras[i].since) ) { return ( (this.year() - hooks(eras[i].since).year()) * dir + eras[i].offset ); } } return this.year(); } function erasNameRegex(isStrict) { if (!hasOwnProp(this, '_erasNameRegex')) { computeErasParse.call(this); } return isStrict ? this._erasNameRegex : this._erasRegex; } function erasAbbrRegex(isStrict) { if (!hasOwnProp(this, '_erasAbbrRegex')) { computeErasParse.call(this); } return isStrict ? this._erasAbbrRegex : this._erasRegex; } function erasNarrowRegex(isStrict) { if (!hasOwnProp(this, '_erasNarrowRegex')) { computeErasParse.call(this); } return isStrict ? this._erasNarrowRegex : this._erasRegex; } function matchEraAbbr(isStrict, locale) { return locale.erasAbbrRegex(isStrict); } function matchEraName(isStrict, locale) { return locale.erasNameRegex(isStrict); } function matchEraNarrow(isStrict, locale) { return locale.erasNarrowRegex(isStrict); } function matchEraYearOrdinal(isStrict, locale) { return locale._eraYearOrdinalRegex || matchUnsigned; } function computeErasParse() { var abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], i, l, erasName, erasAbbr, erasNarrow, eras = this.eras(); for (i = 0, l = eras.length; i < l; ++i) { erasName = regexEscape(eras[i].name); erasAbbr = regexEscape(eras[i].abbr); erasNarrow = regexEscape(eras[i].narrow); namePieces.push(erasName); abbrPieces.push(erasAbbr); narrowPieces.push(erasNarrow); mixedPieces.push(erasName); mixedPieces.push(erasAbbr); mixedPieces.push(erasNarrow); } this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i'); this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i'); this._erasNarrowRegex = new RegExp( '^(' + narrowPieces.join('|') + ')', 'i' ); } // FORMATTING addFormatToken(0, ['gg', 2], 0, function () { return this.weekYear() % 100; }); addFormatToken(0, ['GG', 2], 0, function () { return this.isoWeekYear() % 100; }); function addWeekYearFormatToken(token, getter) { addFormatToken(0, [token, token.length], 0, getter); } addWeekYearFormatToken('gggg', 'weekYear'); addWeekYearFormatToken('ggggg', 'weekYear'); addWeekYearFormatToken('GGGG', 'isoWeekYear'); addWeekYearFormatToken('GGGGG', 'isoWeekYear'); // ALIASES // PARSING addRegexToken('G', matchSigned); addRegexToken('g', matchSigned); addRegexToken('GG', match1to2, match2); addRegexToken('gg', match1to2, match2); addRegexToken('GGGG', match1to4, match4); addRegexToken('gggg', match1to4, match4); addRegexToken('GGGGG', match1to6, match6); addRegexToken('ggggg', match1to6, match6); addWeekParseToken( ['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { week[token.substr(0, 2)] = toInt(input); } ); addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { week[token] = hooks.parseTwoDigitYear(input); }); // MOMENTS function getSetWeekYear(input) { return getSetWeekYearHelper.call( this, input, this.week(), this.weekday() + this.localeData()._week.dow, this.localeData()._week.dow, this.localeData()._week.doy ); } function getSetISOWeekYear(input) { return getSetWeekYearHelper.call( this, input, this.isoWeek(), this.isoWeekday(), 1, 4 ); } function getISOWeeksInYear() { return weeksInYear(this.year(), 1, 4); } function getISOWeeksInISOWeekYear() { return weeksInYear(this.isoWeekYear(), 1, 4); } function getWeeksInYear() { var weekInfo = this.localeData()._week; return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); } function getWeeksInWeekYear() { var weekInfo = this.localeData()._week; return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy); } function getSetWeekYearHelper(input, week, weekday, dow, doy) { var weeksTarget; if (input == null) { return weekOfYear(this, dow, doy).year; } else { weeksTarget = weeksInYear(input, dow, doy); if (week > weeksTarget) { week = weeksTarget; } return setWeekAll.call(this, input, week, weekday, dow, doy); } } function setWeekAll(weekYear, week, weekday, dow, doy) { var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); this.year(date.getUTCFullYear()); this.month(date.getUTCMonth()); this.date(date.getUTCDate()); return this; } // FORMATTING addFormatToken('Q', 0, 'Qo', 'quarter'); // PARSING addRegexToken('Q', match1); addParseToken('Q', function (input, array) { array[MONTH] = (toInt(input) - 1) * 3; }); // MOMENTS function getSetQuarter(input) { return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + (this.month() % 3)); } // FORMATTING addFormatToken('D', ['DD', 2], 'Do', 'date'); // PARSING addRegexToken('D', match1to2, match1to2NoLeadingZero); addRegexToken('DD', match1to2, match2); addRegexToken('Do', function (isStrict, locale) { // TODO: Remove "ordinalParse" fallback in next major release. return isStrict ? locale._dayOfMonthOrdinalParse || locale._ordinalParse : locale._dayOfMonthOrdinalParseLenient; }); addParseToken(['D', 'DD'], DATE); addParseToken('Do', function (input, array) { array[DATE] = toInt(input.match(match1to2)[0]); }); // MOMENTS var getSetDayOfMonth = makeGetSet('Date', true); // FORMATTING addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); // PARSING addRegexToken('DDD', match1to3); addRegexToken('DDDD', match3); addParseToken(['DDD', 'DDDD'], function (input, array, config) { config._dayOfYear = toInt(input); }); // HELPERS // MOMENTS function getSetDayOfYear(input) { var dayOfYear = Math.round( (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5 ) + 1; return input == null ? dayOfYear : this.add(input - dayOfYear, 'd'); } // FORMATTING addFormatToken('m', ['mm', 2], 0, 'minute'); // PARSING addRegexToken('m', match1to2, match1to2HasZero); addRegexToken('mm', match1to2, match2); addParseToken(['m', 'mm'], MINUTE); // MOMENTS var getSetMinute = makeGetSet('Minutes', false); // FORMATTING addFormatToken('s', ['ss', 2], 0, 'second'); // PARSING addRegexToken('s', match1to2, match1to2HasZero); addRegexToken('ss', match1to2, match2); addParseToken(['s', 'ss'], SECOND); // MOMENTS var getSetSecond = makeGetSet('Seconds', false); // FORMATTING addFormatToken('S', 0, 0, function () { return ~~(this.millisecond() / 100); }); addFormatToken(0, ['SS', 2], 0, function () { return ~~(this.millisecond() / 10); }); addFormatToken(0, ['SSS', 3], 0, 'millisecond'); addFormatToken(0, ['SSSS', 4], 0, function () { return this.millisecond() * 10; }); addFormatToken(0, ['SSSSS', 5], 0, function () { return this.millisecond() * 100; }); addFormatToken(0, ['SSSSSS', 6], 0, function () { return this.millisecond() * 1000; }); addFormatToken(0, ['SSSSSSS', 7], 0, function () { return this.millisecond() * 10000; }); addFormatToken(0, ['SSSSSSSS', 8], 0, function () { return this.millisecond() * 100000; }); addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { return this.millisecond() * 1000000; }); // PARSING addRegexToken('S', match1to3, match1); addRegexToken('SS', match1to3, match2); addRegexToken('SSS', match1to3, match3); var token, getSetMillisecond; for (token = 'SSSS'; token.length <= 9; token += 'S') { addRegexToken(token, matchUnsigned); } function parseMs(input, array) { array[MILLISECOND] = toInt(('0.' + input) * 1000); } for (token = 'S'; token.length <= 9; token += 'S') { addParseToken(token, parseMs); } getSetMillisecond = makeGetSet('Milliseconds', false); // FORMATTING addFormatToken('z', 0, 0, 'zoneAbbr'); addFormatToken('zz', 0, 0, 'zoneName'); // MOMENTS function getZoneAbbr() { return this._isUTC ? 'UTC' : ''; } function getZoneName() { return this._isUTC ? 'Coordinated Universal Time' : ''; } var proto = Moment.prototype; proto.add = add; proto.calendar = calendar$1; proto.clone = clone; proto.diff = diff; proto.endOf = endOf; proto.format = format; proto.from = from; proto.fromNow = fromNow; proto.to = to; proto.toNow = toNow; proto.get = stringGet; proto.invalidAt = invalidAt; proto.isAfter = isAfter; proto.isBefore = isBefore; proto.isBetween = isBetween; proto.isSame = isSame; proto.isSameOrAfter = isSameOrAfter; proto.isSameOrBefore = isSameOrBefore; proto.isValid = isValid$2; proto.lang = lang; proto.locale = locale; proto.localeData = localeData; proto.max = prototypeMax; proto.min = prototypeMin; proto.parsingFlags = parsingFlags; proto.set = stringSet; proto.startOf = startOf; proto.subtract = subtract; proto.toArray = toArray; proto.toObject = toObject; proto.toDate = toDate; proto.toISOString = toISOString; proto.inspect = inspect; if (typeof Symbol !== 'undefined' && Symbol.for != null) { proto[Symbol.for('nodejs.util.inspect.custom')] = function () { return 'Moment<' + this.format() + '>'; }; } proto.toJSON = toJSON; proto.toString = toString; proto.unix = unix; proto.valueOf = valueOf; proto.creationData = creationData; proto.eraName = getEraName; proto.eraNarrow = getEraNarrow; proto.eraAbbr = getEraAbbr; proto.eraYear = getEraYear; proto.year = getSetYear; proto.isLeapYear = getIsLeapYear; proto.weekYear = getSetWeekYear; proto.isoWeekYear = getSetISOWeekYear; proto.quarter = proto.quarters = getSetQuarter; proto.month = getSetMonth; proto.daysInMonth = getDaysInMonth; proto.week = proto.weeks = getSetWeek; proto.isoWeek = proto.isoWeeks = getSetISOWeek; proto.weeksInYear = getWeeksInYear; proto.weeksInWeekYear = getWeeksInWeekYear; proto.isoWeeksInYear = getISOWeeksInYear; proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear; proto.date = getSetDayOfMonth; proto.day = proto.days = getSetDayOfWeek; proto.weekday = getSetLocaleDayOfWeek; proto.isoWeekday = getSetISODayOfWeek; proto.dayOfYear = getSetDayOfYear; proto.hour = proto.hours = getSetHour; proto.minute = proto.minutes = getSetMinute; proto.second = proto.seconds = getSetSecond; proto.millisecond = proto.milliseconds = getSetMillisecond; proto.utcOffset = getSetOffset; proto.utc = setOffsetToUTC; proto.local = setOffsetToLocal; proto.parseZone = setOffsetToParsedOffset; proto.hasAlignedHourOffset = hasAlignedHourOffset; proto.isDST = isDaylightSavingTime; proto.isLocal = isLocal; proto.isUtcOffset = isUtcOffset; proto.isUtc = isUtc; proto.isUTC = isUtc; proto.zoneAbbr = getZoneAbbr; proto.zoneName = getZoneName; proto.dates = deprecate( 'dates accessor is deprecated. Use date instead.', getSetDayOfMonth ); proto.months = deprecate( 'months accessor is deprecated. Use month instead', getSetMonth ); proto.years = deprecate( 'years accessor is deprecated. Use year instead', getSetYear ); proto.zone = deprecate( 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone ); proto.isDSTShifted = deprecate( 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted ); function createUnix(input) { return createLocal(input * 1000); } function createInZone() { return createLocal.apply(null, arguments).parseZone(); } function preParsePostFormat(string) { return string; } var proto$1 = Locale.prototype; proto$1.calendar = calendar; proto$1.longDateFormat = longDateFormat; proto$1.invalidDate = invalidDate; proto$1.ordinal = ordinal; proto$1.preparse = preParsePostFormat; proto$1.postformat = preParsePostFormat; proto$1.relativeTime = relativeTime; proto$1.pastFuture = pastFuture; proto$1.set = set; proto$1.eras = localeEras; proto$1.erasParse = localeErasParse; proto$1.erasConvertYear = localeErasConvertYear; proto$1.erasAbbrRegex = erasAbbrRegex; proto$1.erasNameRegex = erasNameRegex; proto$1.erasNarrowRegex = erasNarrowRegex; proto$1.months = localeMonths; proto$1.monthsShort = localeMonthsShort; proto$1.monthsParse = localeMonthsParse; proto$1.monthsRegex = monthsRegex; proto$1.monthsShortRegex = monthsShortRegex; proto$1.week = localeWeek; proto$1.firstDayOfYear = localeFirstDayOfYear; proto$1.firstDayOfWeek = localeFirstDayOfWeek; proto$1.weekdays = localeWeekdays; proto$1.weekdaysMin = localeWeekdaysMin; proto$1.weekdaysShort = localeWeekdaysShort; proto$1.weekdaysParse = localeWeekdaysParse; proto$1.weekdaysRegex = weekdaysRegex; proto$1.weekdaysShortRegex = weekdaysShortRegex; proto$1.weekdaysMinRegex = weekdaysMinRegex; proto$1.isPM = localeIsPM; proto$1.meridiem = localeMeridiem; function get$1(format, index, field, setter) { var locale = getLocale(), utc = createUTC().set(setter, index); return locale[field](utc, format); } function listMonthsImpl(format, index, field) { if (isNumber(format)) { index = format; format = undefined; } format = format || ''; if (index != null) { return get$1(format, index, field, 'month'); } var i, out = []; for (i = 0; i < 12; i++) { out[i] = get$1(format, i, field, 'month'); } return out; } // () // (5) // (fmt, 5) // (fmt) // (true) // (true, 5) // (true, fmt, 5) // (true, fmt) function listWeekdaysImpl(localeSorted, format, index, field) { if (typeof localeSorted === 'boolean') { if (isNumber(format)) { index = format; format = undefined; } format = format || ''; } else { format = localeSorted; index = format; localeSorted = false; if (isNumber(format)) { index = format; format = undefined; } format = format || ''; } var locale = getLocale(), shift = localeSorted ? locale._week.dow : 0, i, out = []; if (index != null) { return get$1(format, (index + shift) % 7, field, 'day'); } for (i = 0; i < 7; i++) { out[i] = get$1(format, (i + shift) % 7, field, 'day'); } return out; } function listMonths(format, index) { return listMonthsImpl(format, index, 'months'); } function listMonthsShort(format, index) { return listMonthsImpl(format, index, 'monthsShort'); } function listWeekdays(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); } function listWeekdaysShort(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); } function listWeekdaysMin(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); } getSetGlobalLocale('en', { eras: [ { since: '0001-01-01', until: +Infinity, offset: 1, name: 'Anno Domini', narrow: 'AD', abbr: 'AD', }, { since: '0000-12-31', until: -Infinity, offset: 1, name: 'Before Christ', narrow: 'BC', abbr: 'BC', }, ], dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, ordinal: function (number) { var b = number % 10, output = toInt((number % 100) / 10) === 1 ? 'th' : b === 1 ? 'st' : b === 2 ? 'nd' : b === 3 ? 'rd' : 'th'; return number + output; }, }); // Side effect imports hooks.lang = deprecate( 'moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale ); hooks.langData = deprecate( 'moment.langData is deprecated. Use moment.localeData instead.', getLocale ); var mathAbs = Math.abs; function abs() { var data = this._data; this._milliseconds = mathAbs(this._milliseconds); this._days = mathAbs(this._days); this._months = mathAbs(this._months); data.milliseconds = mathAbs(data.milliseconds); data.seconds = mathAbs(data.seconds); data.minutes = mathAbs(data.minutes); data.hours = mathAbs(data.hours); data.months = mathAbs(data.months); data.years = mathAbs(data.years); return this; } function addSubtract$1(duration, input, value, direction) { var other = createDuration(input, value); duration._milliseconds += direction * other._milliseconds; duration._days += direction * other._days; duration._months += direction * other._months; return duration._bubble(); } // supports only 2.0-style add(1, 's') or add(duration) function add$1(input, value) { return addSubtract$1(this, input, value, 1); } // supports only 2.0-style subtract(1, 's') or subtract(duration) function subtract$1(input, value) { return addSubtract$1(this, input, value, -1); } function absCeil(number) { if (number < 0) { return Math.floor(number); } else { return Math.ceil(number); } } function bubble() { var milliseconds = this._milliseconds, days = this._days, months = this._months, data = this._data, seconds, minutes, hours, years, monthsFromDays; // if we have a mix of positive and negative values, bubble down first // check: https://github.com/moment/moment/issues/2166 if ( !( (milliseconds >= 0 && days >= 0 && months >= 0) || (milliseconds <= 0 && days <= 0 && months <= 0) ) ) { milliseconds += absCeil(monthsToDays(months) + days) * 864e5; days = 0; months = 0; } // The following code bubbles up values, see the tests for // examples of what that means. data.milliseconds = milliseconds % 1000; seconds = absFloor(milliseconds / 1000); data.seconds = seconds % 60; minutes = absFloor(seconds / 60); data.minutes = minutes % 60; hours = absFloor(minutes / 60); data.hours = hours % 24; days += absFloor(hours / 24); // convert days to months monthsFromDays = absFloor(daysToMonths(days)); months += monthsFromDays; days -= absCeil(monthsToDays(monthsFromDays)); // 12 months -> 1 year years = absFloor(months / 12); months %= 12; data.days = days; data.months = months; data.years = years; return this; } function daysToMonths(days) { // 400 years have 146097 days (taking into account leap year rules) // 400 years have 12 months === 4800 return (days * 4800) / 146097; } function monthsToDays(months) { // the reverse of daysToMonths return (months * 146097) / 4800; } function as(units) { if (!this.isValid()) { return NaN; } var days, months, milliseconds = this._milliseconds; units = normalizeUnits(units); if (units === 'month' || units === 'quarter' || units === 'year') { days = this._days + milliseconds / 864e5; months = this._months + daysToMonths(days); switch (units) { case 'month': return months; case 'quarter': return months / 3; case 'year': return months / 12; } } else { // handle milliseconds separately because of floating point math errors (issue #1867) days = this._days + Math.round(monthsToDays(this._months)); switch (units) { case 'week': return days / 7 + milliseconds / 6048e5; case 'day': return days + milliseconds / 864e5; case 'hour': return days * 24 + milliseconds / 36e5; case 'minute': return days * 1440 + milliseconds / 6e4; case 'second': return days * 86400 + milliseconds / 1000; // Math.floor prevents floating point math errors here case 'millisecond': return Math.floor(days * 864e5) + milliseconds; default: throw new Error('Unknown unit ' + units); } } } function makeAs(alias) { return function () { return this.as(alias); }; } var asMilliseconds = makeAs('ms'), asSeconds = makeAs('s'), asMinutes = makeAs('m'), asHours = makeAs('h'), asDays = makeAs('d'), asWeeks = makeAs('w'), asMonths = makeAs('M'), asQuarters = makeAs('Q'), asYears = makeAs('y'), valueOf$1 = asMilliseconds; function clone$1() { return createDuration(this); } function get$2(units) { units = normalizeUnits(units); return this.isValid() ? this[units + 's']() : NaN; } function makeGetter(name) { return function () { return this.isValid() ? this._data[name] : NaN; }; } var milliseconds = makeGetter('milliseconds'), seconds = makeGetter('seconds'), minutes = makeGetter('minutes'), hours = makeGetter('hours'), days = makeGetter('days'), months = makeGetter('months'), years = makeGetter('years'); function weeks() { return absFloor(this.days() / 7); } var round = Math.round, thresholds = { ss: 44, // a few seconds to seconds s: 45, // seconds to minute m: 45, // minutes to hour h: 22, // hours to day d: 26, // days to month/week w: null, // weeks to month M: 11, // months to year }; // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); } function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) { var duration = createDuration(posNegDuration).abs(), seconds = round(duration.as('s')), minutes = round(duration.as('m')), hours = round(duration.as('h')), days = round(duration.as('d')), months = round(duration.as('M')), weeks = round(duration.as('w')), years = round(duration.as('y')), a = (seconds <= thresholds.ss && ['s', seconds]) || (seconds < thresholds.s && ['ss', seconds]) || (minutes <= 1 && ['m']) || (minutes < thresholds.m && ['mm', minutes]) || (hours <= 1 && ['h']) || (hours < thresholds.h && ['hh', hours]) || (days <= 1 && ['d']) || (days < thresholds.d && ['dd', days]); if (thresholds.w != null) { a = a || (weeks <= 1 && ['w']) || (weeks < thresholds.w && ['ww', weeks]); } a = a || (months <= 1 && ['M']) || (months < thresholds.M && ['MM', months]) || (years <= 1 && ['y']) || ['yy', years]; a[2] = withoutSuffix; a[3] = +posNegDuration > 0; a[4] = locale; return substituteTimeAgo.apply(null, a); } // This function allows you to set the rounding function for relative time strings function getSetRelativeTimeRounding(roundingFunction) { if (roundingFunction === undefined) { return round; } if (typeof roundingFunction === 'function') { round = roundingFunction; return true; } return false; } // This function allows you to set a threshold for relative time strings function getSetRelativeTimeThreshold(threshold, limit) { if (thresholds[threshold] === undefined) { return false; } if (limit === undefined) { return thresholds[threshold]; } thresholds[threshold] = limit; if (threshold === 's') { thresholds.ss = limit - 1; } return true; } function humanize(argWithSuffix, argThresholds) { if (!this.isValid()) { return this.localeData().invalidDate(); } var withSuffix = false, th = thresholds, locale, output; if (typeof argWithSuffix === 'object') { argThresholds = argWithSuffix; argWithSuffix = false; } if (typeof argWithSuffix === 'boolean') { withSuffix = argWithSuffix; } if (typeof argThresholds === 'object') { th = Object.assign({}, thresholds, argThresholds); if (argThresholds.s != null && argThresholds.ss == null) { th.ss = argThresholds.s - 1; } } locale = this.localeData(); output = relativeTime$1(this, !withSuffix, th, locale); if (withSuffix) { output = locale.pastFuture(+this, output); } return locale.postformat(output); } var abs$1 = Math.abs; function sign(x) { return (x > 0) - (x < 0) || +x; } function toISOString$1() { // for ISO strings we do not use the normal bubbling rules: // * milliseconds bubble up until they become hours // * days do not bubble at all // * months bubble up until they become years // This is because there is no context-free conversion between hours and days // (think of clock changes) // and also not between days and months (28-31 days per month) if (!this.isValid()) { return this.localeData().invalidDate(); } var seconds = abs$1(this._milliseconds) / 1000, days = abs$1(this._days), months = abs$1(this._months), minutes, hours, years, s, total = this.asSeconds(), totalSign, ymSign, daysSign, hmsSign; if (!total) { // this is the same as C#'s (Noda) and python (isodate)... // but not other JS (goog.date) return 'P0D'; } // 3600 seconds -> 60 minutes -> 1 hour minutes = absFloor(seconds / 60); hours = absFloor(minutes / 60); seconds %= 60; minutes %= 60; // 12 months -> 1 year years = absFloor(months / 12); months %= 12; // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; totalSign = total < 0 ? '-' : ''; ymSign = sign(this._months) !== sign(total) ? '-' : ''; daysSign = sign(this._days) !== sign(total) ? '-' : ''; hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; return ( totalSign + 'P' + (years ? ymSign + years + 'Y' : '') + (months ? ymSign + months + 'M' : '') + (days ? daysSign + days + 'D' : '') + (hours || minutes || seconds ? 'T' : '') + (hours ? hmsSign + hours + 'H' : '') + (minutes ? hmsSign + minutes + 'M' : '') + (seconds ? hmsSign + s + 'S' : '') ); } var proto$2 = Duration.prototype; proto$2.isValid = isValid$1; proto$2.abs = abs; proto$2.add = add$1; proto$2.subtract = subtract$1; proto$2.as = as; proto$2.asMilliseconds = asMilliseconds; proto$2.asSeconds = asSeconds; proto$2.asMinutes = asMinutes; proto$2.asHours = asHours; proto$2.asDays = asDays; proto$2.asWeeks = asWeeks; proto$2.asMonths = asMonths; proto$2.asQuarters = asQuarters; proto$2.asYears = asYears; proto$2.valueOf = valueOf$1; proto$2._bubble = bubble; proto$2.clone = clone$1; proto$2.get = get$2; proto$2.milliseconds = milliseconds; proto$2.seconds = seconds; proto$2.minutes = minutes; proto$2.hours = hours; proto$2.days = days; proto$2.weeks = weeks; proto$2.months = months; proto$2.years = years; proto$2.humanize = humanize; proto$2.toISOString = toISOString$1; proto$2.toString = toISOString$1; proto$2.toJSON = toISOString$1; proto$2.locale = locale; proto$2.localeData = localeData; proto$2.toIsoString = deprecate( 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1 ); proto$2.lang = lang; // FORMATTING addFormatToken('X', 0, 0, 'unix'); addFormatToken('x', 0, 0, 'valueOf'); // PARSING addRegexToken('x', matchSigned); addRegexToken('X', matchTimestamp); addParseToken('X', function (input, array, config) { config._d = new Date(parseFloat(input) * 1000); }); addParseToken('x', function (input, array, config) { config._d = new Date(toInt(input)); }); //! moment.js hooks.version = '2.30.1'; setHookCallback(createLocal); hooks.fn = proto; hooks.min = min; hooks.max = max; hooks.now = now; hooks.utc = createUTC; hooks.unix = createUnix; hooks.months = listMonths; hooks.isDate = isDate; hooks.locale = getSetGlobalLocale; hooks.invalid = createInvalid; hooks.duration = createDuration; hooks.isMoment = isMoment; hooks.weekdays = listWeekdays; hooks.parseZone = createInZone; hooks.localeData = getLocale; hooks.isDuration = isDuration; hooks.monthsShort = listMonthsShort; hooks.weekdaysMin = listWeekdaysMin; hooks.defineLocale = defineLocale; hooks.updateLocale = updateLocale; hooks.locales = listLocales; hooks.weekdaysShort = listWeekdaysShort; hooks.normalizeUnits = normalizeUnits; hooks.relativeTimeRounding = getSetRelativeTimeRounding; hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; hooks.calendarFormat = getCalendarFormat; hooks.prototype = proto; // currently HTML5 input type only supports 24-hour formats hooks.HTML5_FMT = { DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" /> DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" /> DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" /> DATE: 'YYYY-MM-DD', // <input type="date" /> TIME: 'HH:mm', // <input type="time" /> TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" /> TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" /> WEEK: 'GGGG-[W]WW', // <input type="week" /> MONTH: 'YYYY-MM', // <input type="month" /> }; return hooks; }))); vendor/react-dom.js 0000644 00004075643 15151622574 0010305 0 ustar 00 /** * @license React * react-dom.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) : typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) : (global = global || self, factory(global.ReactDOM = {}, global.React)); }(this, (function (exports, React) { 'use strict'; var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; var suppressWarning = false; function setSuppressWarning(newSuppressWarning) { { suppressWarning = newSuppressWarning; } } // In DEV, calls to console.warn and console.error get replaced // by calls to these methods by a Babel plugin. // // In PROD (or in packages without access to React internals), // they are left as they are instead. function warn(format) { { if (!suppressWarning) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } printWarning('warn', format, args); } } } function error(format) { { if (!suppressWarning) { for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } printWarning('error', format, args); } } } function printWarning(level, format, args) { // When changing this logic, you might want to also // update consoleWithStackDev.www.js as well. { var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; var stack = ReactDebugCurrentFrame.getStackAddendum(); if (stack !== '') { format += '%s'; args = args.concat([stack]); } // eslint-disable-next-line react-internal/safe-string-coercion var argsWithFormat = args.map(function (item) { return String(item); }); // Careful: RN currently depends on this prefix argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it // breaks IE9: https://github.com/facebook/react/issues/13610 // eslint-disable-next-line react-internal/no-production-logging Function.prototype.apply.call(console[level], console, argsWithFormat); } } var FunctionComponent = 0; var ClassComponent = 1; var IndeterminateComponent = 2; // Before we know whether it is function or class var HostRoot = 3; // Root of a host tree. Could be nested inside another node. var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. var HostComponent = 5; var HostText = 6; var Fragment = 7; var Mode = 8; var ContextConsumer = 9; var ContextProvider = 10; var ForwardRef = 11; var Profiler = 12; var SuspenseComponent = 13; var MemoComponent = 14; var SimpleMemoComponent = 15; var LazyComponent = 16; var IncompleteClassComponent = 17; var DehydratedFragment = 18; var SuspenseListComponent = 19; var ScopeComponent = 21; var OffscreenComponent = 22; var LegacyHiddenComponent = 23; var CacheComponent = 24; var TracingMarkerComponent = 25; // ----------------------------------------------------------------------------- var enableClientRenderFallbackOnTextMismatch = true; // TODO: Need to review this code one more time before landing // the react-reconciler package. var enableNewReconciler = false; // Support legacy Primer support on internal FB www var enableLazyContextPropagation = false; // FB-only usage. The new API has different semantics. var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber var enableSuspenseAvoidThisFallback = false; // Enables unstable_avoidThisFallback feature in Fizz // React DOM Chopping Block // // Similar to main Chopping Block but only flags related to React DOM. These are // grouped because we will likely batch all of them into a single major release. // ----------------------------------------------------------------------------- // Disable support for comment nodes as React DOM containers. Already disabled // in open source, but www codebase still relies on it. Need to remove. var disableCommentsAsDOMContainers = true; // Disable javascript: URL strings in href for XSS protection. // and client rendering, mostly to allow JSX attributes to apply to the custom // element's object properties instead of only HTML attributes. // https://github.com/facebook/react/issues/11347 var enableCustomElementPropertySupport = false; // Disables children for <textarea> elements var warnAboutStringRefs = true; // ----------------------------------------------------------------------------- // Debugging and DevTools // ----------------------------------------------------------------------------- // Adds user timing marks for e.g. state updates, suspense, and work loop stuff, // for an experimental timeline tool. var enableSchedulingProfiler = true; // Helps identify side effects in render-phase lifecycle hooks and setState var enableProfilerTimer = true; // Record durations for commit and passive effects phases. var enableProfilerCommitHooks = true; // Phase param passed to onRender callback differentiates between an "update" and a "cascading-update". var allNativeEvents = new Set(); /** * Mapping from registration name to event name */ var registrationNameDependencies = {}; /** * Mapping from lowercase registration names to the properly cased version, * used to warn in the case of missing event handlers. Available * only in true. * @type {Object} */ var possibleRegistrationNames = {} ; // Trust the developer to only use possibleRegistrationNames in true function registerTwoPhaseEvent(registrationName, dependencies) { registerDirectEvent(registrationName, dependencies); registerDirectEvent(registrationName + 'Capture', dependencies); } function registerDirectEvent(registrationName, dependencies) { { if (registrationNameDependencies[registrationName]) { error('EventRegistry: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName); } } registrationNameDependencies[registrationName] = dependencies; { var lowerCasedName = registrationName.toLowerCase(); possibleRegistrationNames[lowerCasedName] = registrationName; if (registrationName === 'onDoubleClick') { possibleRegistrationNames.ondblclick = registrationName; } } for (var i = 0; i < dependencies.length; i++) { allNativeEvents.add(dependencies[i]); } } var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'); var hasOwnProperty = Object.prototype.hasOwnProperty; /* * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol * and Temporal.* types. See https://github.com/facebook/react/pull/22064. * * The functions in this module will throw an easier-to-understand, * easier-to-debug exception with a clear errors message message explaining the * problem. (Instead of a confusing exception thrown inside the implementation * of the `value` object). */ // $FlowFixMe only called in DEV, so void return is not possible. function typeName(value) { { // toStringTag is needed for namespaced types like Temporal.Instant var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag; var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; return type; } } // $FlowFixMe only called in DEV, so void return is not possible. function willCoercionThrow(value) { { try { testStringCoercion(value); return false; } catch (e) { return true; } } } function testStringCoercion(value) { // If you ended up here by following an exception call stack, here's what's // happened: you supplied an object or symbol value to React (as a prop, key, // DOM attribute, CSS property, string ref, etc.) and when React tried to // coerce it to a string using `'' + value`, an exception was thrown. // // The most common types that will cause this exception are `Symbol` instances // and Temporal objects like `Temporal.Instant`. But any object that has a // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this // exception. (Library authors do this to prevent users from using built-in // numeric operators like `+` or comparison operators like `>=` because custom // methods are needed to perform accurate arithmetic or comparison.) // // To fix the problem, coerce this object or symbol value to a string before // passing it to React. The most reliable way is usually `String(value)`. // // To find which value is throwing, check the browser or debugger console. // Before this exception was thrown, there should be `console.error` output // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the // problem and how that type was used: key, atrribute, input value prop, etc. // In most cases, this console output also shows the component and its // ancestor components where the exception happened. // // eslint-disable-next-line react-internal/safe-string-coercion return '' + value; } function checkAttributeStringCoercion(value, attributeName) { { if (willCoercionThrow(value)) { error('The provided `%s` attribute is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', attributeName, typeName(value)); return testStringCoercion(value); // throw (to help callers find troubleshooting comments) } } } function checkKeyStringCoercion(value) { { if (willCoercionThrow(value)) { error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); return testStringCoercion(value); // throw (to help callers find troubleshooting comments) } } } function checkPropStringCoercion(value, propName) { { if (willCoercionThrow(value)) { error('The provided `%s` prop is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', propName, typeName(value)); return testStringCoercion(value); // throw (to help callers find troubleshooting comments) } } } function checkCSSPropertyStringCoercion(value, propName) { { if (willCoercionThrow(value)) { error('The provided `%s` CSS property is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', propName, typeName(value)); return testStringCoercion(value); // throw (to help callers find troubleshooting comments) } } } function checkHtmlStringCoercion(value) { { if (willCoercionThrow(value)) { error('The provided HTML markup uses a value of unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); return testStringCoercion(value); // throw (to help callers find troubleshooting comments) } } } function checkFormFieldValueStringCoercion(value) { { if (willCoercionThrow(value)) { error('Form field values (value, checked, defaultValue, or defaultChecked props)' + ' must be strings, not %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); return testStringCoercion(value); // throw (to help callers find troubleshooting comments) } } } // A reserved attribute. // It is handled by React separately and shouldn't be written to the DOM. var RESERVED = 0; // A simple string attribute. // Attributes that aren't in the filter are presumed to have this type. var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called // "enumerated" attributes with "true" and "false" as possible values. // When true, it should be set to a "true" string. // When false, it should be set to a "false" string. var BOOLEANISH_STRING = 2; // A real boolean attribute. // When true, it should be present (set either to an empty string or its name). // When false, it should be omitted. var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value. // When true, it should be present (set either to an empty string or its name). // When false, it should be omitted. // For any other value, should be present with that value. var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric. // When falsy, it should be removed. var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric. // When falsy, it should be removed. var POSITIVE_NUMERIC = 6; /* eslint-disable max-len */ var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; /* eslint-enable max-len */ var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$'); var illegalAttributeNameCache = {}; var validatedAttributeNameCache = {}; function isAttributeNameSafe(attributeName) { if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) { return true; } if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) { return false; } if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { validatedAttributeNameCache[attributeName] = true; return true; } illegalAttributeNameCache[attributeName] = true; { error('Invalid attribute name: `%s`', attributeName); } return false; } function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) { if (propertyInfo !== null) { return propertyInfo.type === RESERVED; } if (isCustomComponentTag) { return false; } if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) { return true; } return false; } function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) { if (propertyInfo !== null && propertyInfo.type === RESERVED) { return false; } switch (typeof value) { case 'function': // $FlowIssue symbol is perfectly valid here case 'symbol': // eslint-disable-line return true; case 'boolean': { if (isCustomComponentTag) { return false; } if (propertyInfo !== null) { return !propertyInfo.acceptsBooleans; } else { var prefix = name.toLowerCase().slice(0, 5); return prefix !== 'data-' && prefix !== 'aria-'; } } default: return false; } } function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) { if (value === null || typeof value === 'undefined') { return true; } if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) { return true; } if (isCustomComponentTag) { return false; } if (propertyInfo !== null) { switch (propertyInfo.type) { case BOOLEAN: return !value; case OVERLOADED_BOOLEAN: return value === false; case NUMERIC: return isNaN(value); case POSITIVE_NUMERIC: return isNaN(value) || value < 1; } } return false; } function getPropertyInfo(name) { return properties.hasOwnProperty(name) ? properties[name] : null; } function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL, removeEmptyString) { this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN; this.attributeName = attributeName; this.attributeNamespace = attributeNamespace; this.mustUseProperty = mustUseProperty; this.propertyName = name; this.type = type; this.sanitizeURL = sanitizeURL; this.removeEmptyString = removeEmptyString; } // When adding attributes to this list, be sure to also add them to // the `possibleStandardNames` module to ensure casing and incorrect // name warnings. var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM. var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular // elements (not just inputs). Now that ReactDOMInput assigns to the // defaultValue property -- do we need this? 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style']; reservedProps.forEach(function (name) { properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty name, // attributeName null, // attributeNamespace false, // sanitizeURL false); }); // A few React string attributes have a different name. // This is a mapping from React prop names to the attribute names. [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) { var name = _ref[0], attributeName = _ref[1]; properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty attributeName, // attributeName null, // attributeNamespace false, // sanitizeURL false); }); // These are "enumerated" HTML attributes that accept "true" and "false". // In React, we let users pass `true` and `false` even though technically // these aren't boolean attributes (they are coerced to strings). ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty name.toLowerCase(), // attributeName null, // attributeNamespace false, // sanitizeURL false); }); // These are "enumerated" SVG attributes that accept "true" and "false". // In React, we let users pass `true` and `false` even though technically // these aren't boolean attributes (they are coerced to strings). // Since these are SVG attributes, their attribute names are case-sensitive. ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty name, // attributeName null, // attributeNamespace false, // sanitizeURL false); }); // These are HTML boolean attributes. ['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM // on the client side because the browsers are inconsistent. Instead we call focus(). 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'disableRemotePlayback', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata 'itemScope'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty name.toLowerCase(), // attributeName null, // attributeNamespace false, // sanitizeURL false); }); // These are the few React props that we set as DOM properties // rather than attributes. These are all booleans. ['checked', // Note: `option.selected` is not updated if `select.multiple` is // disabled with `removeAttribute`. We have special logic for handling this. 'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list, // you'll need to set attributeName to name.toLowerCase() // instead in the assignment below. ].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty name, // attributeName null, // attributeNamespace false, // sanitizeURL false); }); // These are HTML attributes that are "overloaded booleans": they behave like // booleans, but can also accept a string value. ['capture', 'download' // NOTE: if you add a camelCased prop to this list, // you'll need to set attributeName to name.toLowerCase() // instead in the assignment below. ].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty name, // attributeName null, // attributeNamespace false, // sanitizeURL false); }); // These are HTML attributes that must be positive numbers. ['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list, // you'll need to set attributeName to name.toLowerCase() // instead in the assignment below. ].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty name, // attributeName null, // attributeNamespace false, // sanitizeURL false); }); // These are HTML attributes that must be numbers. ['rowSpan', 'start'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty name.toLowerCase(), // attributeName null, // attributeNamespace false, // sanitizeURL false); }); var CAMELIZE = /[\-\:]([a-z])/g; var capitalize = function (token) { return token[1].toUpperCase(); }; // This is a list of all SVG attributes that need special casing, namespacing, // or boolean value assignment. Regular attributes that just accept strings // and have the same names are omitted, just like in the HTML attribute filter. // Some of these attributes can be hard to find. This list was created by // scraping the MDN documentation. ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list, // you'll need to set attributeName to name.toLowerCase() // instead in the assignment below. ].forEach(function (attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty attributeName, null, // attributeNamespace false, // sanitizeURL false); }); // String SVG attributes with the xlink namespace. ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list, // you'll need to set attributeName to name.toLowerCase() // instead in the assignment below. ].forEach(function (attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty attributeName, 'http://www.w3.org/1999/xlink', false, // sanitizeURL false); }); // String SVG attributes with the xml namespace. ['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list, // you'll need to set attributeName to name.toLowerCase() // instead in the assignment below. ].forEach(function (attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty attributeName, 'http://www.w3.org/XML/1998/namespace', false, // sanitizeURL false); }); // These attribute exists both in HTML and SVG. // The attribute name is case-sensitive in SVG so we can't just use // the React name like we do for attributes that exist only in HTML. ['tabIndex', 'crossOrigin'].forEach(function (attributeName) { properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty attributeName.toLowerCase(), // attributeName null, // attributeNamespace false, // sanitizeURL false); }); // These attributes accept URLs. These must not allow javascript: URLS. // These will also need to accept Trusted Types object in the future. var xlinkHref = 'xlinkHref'; properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty 'xlink:href', 'http://www.w3.org/1999/xlink', true, // sanitizeURL false); ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) { properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty attributeName.toLowerCase(), // attributeName null, // attributeNamespace true, // sanitizeURL true); }); // and any newline or tab are filtered out as if they're not part of the URL. // https://url.spec.whatwg.org/#url-parsing // Tab or newline are defined as \r\n\t: // https://infra.spec.whatwg.org/#ascii-tab-or-newline // A C0 control is a code point in the range \u0000 NULL to \u001F // INFORMATION SEPARATOR ONE, inclusive: // https://infra.spec.whatwg.org/#c0-control-or-space /* eslint-disable max-len */ var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i; var didWarn = false; function sanitizeURL(url) { { if (!didWarn && isJavaScriptProtocol.test(url)) { didWarn = true; error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url)); } } } /** * Get the value for a property on a node. Only used in DEV for SSR validation. * The "expected" argument is used as a hint of what the expected value is. * Some properties have multiple equivalent values. */ function getValueForProperty(node, name, expected, propertyInfo) { { if (propertyInfo.mustUseProperty) { var propertyName = propertyInfo.propertyName; return node[propertyName]; } else { // This check protects multiple uses of `expected`, which is why the // react-internal/safe-string-coercion rule is disabled in several spots // below. { checkAttributeStringCoercion(expected, name); } if ( propertyInfo.sanitizeURL) { // If we haven't fully disabled javascript: URLs, and if // the hydration is successful of a javascript: URL, we // still want to warn on the client. // eslint-disable-next-line react-internal/safe-string-coercion sanitizeURL('' + expected); } var attributeName = propertyInfo.attributeName; var stringValue = null; if (propertyInfo.type === OVERLOADED_BOOLEAN) { if (node.hasAttribute(attributeName)) { var value = node.getAttribute(attributeName); if (value === '') { return true; } if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { return value; } // eslint-disable-next-line react-internal/safe-string-coercion if (value === '' + expected) { return expected; } return value; } } else if (node.hasAttribute(attributeName)) { if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { // We had an attribute but shouldn't have had one, so read it // for the error message. return node.getAttribute(attributeName); } if (propertyInfo.type === BOOLEAN) { // If this was a boolean, it doesn't matter what the value is // the fact that we have it is the same as the expected. return expected; } // Even if this property uses a namespace we use getAttribute // because we assume its namespaced name is the same as our config. // To use getAttributeNS we need the local name which we don't have // in our config atm. stringValue = node.getAttribute(attributeName); } if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { return stringValue === null ? expected : stringValue; // eslint-disable-next-line react-internal/safe-string-coercion } else if (stringValue === '' + expected) { return expected; } else { return stringValue; } } } } /** * Get the value for a attribute on a node. Only used in DEV for SSR validation. * The third argument is used as a hint of what the expected value is. Some * attributes have multiple equivalent values. */ function getValueForAttribute(node, name, expected, isCustomComponentTag) { { if (!isAttributeNameSafe(name)) { return; } if (!node.hasAttribute(name)) { return expected === undefined ? undefined : null; } var value = node.getAttribute(name); { checkAttributeStringCoercion(expected, name); } if (value === '' + expected) { return expected; } return value; } } /** * Sets the value for a property on a node. * * @param {DOMElement} node * @param {string} name * @param {*} value */ function setValueForProperty(node, name, value, isCustomComponentTag) { var propertyInfo = getPropertyInfo(name); if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) { return; } if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) { value = null; } if (isCustomComponentTag || propertyInfo === null) { if (isAttributeNameSafe(name)) { var _attributeName = name; if (value === null) { node.removeAttribute(_attributeName); } else { { checkAttributeStringCoercion(value, name); } node.setAttribute(_attributeName, '' + value); } } return; } var mustUseProperty = propertyInfo.mustUseProperty; if (mustUseProperty) { var propertyName = propertyInfo.propertyName; if (value === null) { var type = propertyInfo.type; node[propertyName] = type === BOOLEAN ? false : ''; } else { // Contrary to `setAttribute`, object properties are properly // `toString`ed by IE8/9. node[propertyName] = value; } return; } // The rest are treated as attributes with special cases. var attributeName = propertyInfo.attributeName, attributeNamespace = propertyInfo.attributeNamespace; if (value === null) { node.removeAttribute(attributeName); } else { var _type = propertyInfo.type; var attributeValue; if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) { // If attribute type is boolean, we know for sure it won't be an execution sink // and we won't require Trusted Type here. attributeValue = ''; } else { // `setAttribute` with objects becomes only `[object]` in IE8/9, // ('' + value) makes it output the correct toString()-value. { { checkAttributeStringCoercion(value, attributeName); } attributeValue = '' + value; } if (propertyInfo.sanitizeURL) { sanitizeURL(attributeValue.toString()); } } if (attributeNamespace) { node.setAttributeNS(attributeNamespace, attributeName, attributeValue); } else { node.setAttribute(attributeName, attributeValue); } } } // ATTENTION // When adding new symbols to this file, // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' // The Symbol used to tag the ReactElement-like types. var REACT_ELEMENT_TYPE = Symbol.for('react.element'); var REACT_PORTAL_TYPE = Symbol.for('react.portal'); var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); var REACT_CONTEXT_TYPE = Symbol.for('react.context'); var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); var REACT_MEMO_TYPE = Symbol.for('react.memo'); var REACT_LAZY_TYPE = Symbol.for('react.lazy'); var REACT_SCOPE_TYPE = Symbol.for('react.scope'); var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for('react.debug_trace_mode'); var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); var REACT_LEGACY_HIDDEN_TYPE = Symbol.for('react.legacy_hidden'); var REACT_CACHE_TYPE = Symbol.for('react.cache'); var REACT_TRACING_MARKER_TYPE = Symbol.for('react.tracing_marker'); var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; var FAUX_ITERATOR_SYMBOL = '@@iterator'; function getIteratorFn(maybeIterable) { if (maybeIterable === null || typeof maybeIterable !== 'object') { return null; } var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; if (typeof maybeIterator === 'function') { return maybeIterator; } return null; } var assign = Object.assign; // Helpers to patch console.logs to avoid logging during side-effect free // replaying on render function. This currently only patches the object // lazily which won't cover if the log function was extracted eagerly. // We could also eagerly patch the method. var disabledDepth = 0; var prevLog; var prevInfo; var prevWarn; var prevError; var prevGroup; var prevGroupCollapsed; var prevGroupEnd; function disabledLog() {} disabledLog.__reactDisabledLog = true; function disableLogs() { { if (disabledDepth === 0) { /* eslint-disable react-internal/no-production-logging */ prevLog = console.log; prevInfo = console.info; prevWarn = console.warn; prevError = console.error; prevGroup = console.group; prevGroupCollapsed = console.groupCollapsed; prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 var props = { configurable: true, enumerable: true, value: disabledLog, writable: true }; // $FlowFixMe Flow thinks console is immutable. Object.defineProperties(console, { info: props, log: props, warn: props, error: props, group: props, groupCollapsed: props, groupEnd: props }); /* eslint-enable react-internal/no-production-logging */ } disabledDepth++; } } function reenableLogs() { { disabledDepth--; if (disabledDepth === 0) { /* eslint-disable react-internal/no-production-logging */ var props = { configurable: true, enumerable: true, writable: true }; // $FlowFixMe Flow thinks console is immutable. Object.defineProperties(console, { log: assign({}, props, { value: prevLog }), info: assign({}, props, { value: prevInfo }), warn: assign({}, props, { value: prevWarn }), error: assign({}, props, { value: prevError }), group: assign({}, props, { value: prevGroup }), groupCollapsed: assign({}, props, { value: prevGroupCollapsed }), groupEnd: assign({}, props, { value: prevGroupEnd }) }); /* eslint-enable react-internal/no-production-logging */ } if (disabledDepth < 0) { error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); } } } var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; var prefix; function describeBuiltInComponentFrame(name, source, ownerFn) { { if (prefix === undefined) { // Extract the VM specific prefix used by each line. try { throw Error(); } catch (x) { var match = x.stack.trim().match(/\n( *(at )?)/); prefix = match && match[1] || ''; } } // We use the prefix to ensure our stacks line up with native stack frames. return '\n' + prefix + name; } } var reentry = false; var componentFrameCache; { var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; componentFrameCache = new PossiblyWeakMap(); } function describeNativeComponentFrame(fn, construct) { // If something asked for a stack inside a fake render, it should get ignored. if ( !fn || reentry) { return ''; } { var frame = componentFrameCache.get(fn); if (frame !== undefined) { return frame; } } var control; reentry = true; var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. Error.prepareStackTrace = undefined; var previousDispatcher; { previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function // for warnings. ReactCurrentDispatcher.current = null; disableLogs(); } try { // This should throw. if (construct) { // Something should be setting the props in the constructor. var Fake = function () { throw Error(); }; // $FlowFixMe Object.defineProperty(Fake.prototype, 'props', { set: function () { // We use a throwing setter instead of frozen or non-writable props // because that won't throw in a non-strict mode function. throw Error(); } }); if (typeof Reflect === 'object' && Reflect.construct) { // We construct a different control for this case to include any extra // frames added by the construct call. try { Reflect.construct(Fake, []); } catch (x) { control = x; } Reflect.construct(fn, [], Fake); } else { try { Fake.call(); } catch (x) { control = x; } fn.call(Fake.prototype); } } else { try { throw Error(); } catch (x) { control = x; } fn(); } } catch (sample) { // This is inlined manually because closure doesn't do it for us. if (sample && control && typeof sample.stack === 'string') { // This extracts the first frame from the sample that isn't also in the control. // Skipping one frame that we assume is the frame that calls the two. var sampleLines = sample.stack.split('\n'); var controlLines = control.stack.split('\n'); var s = sampleLines.length - 1; var c = controlLines.length - 1; while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { // We expect at least one stack frame to be shared. // Typically this will be the root most one. However, stack frames may be // cut off due to maximum stack limits. In this case, one maybe cut off // earlier than the other. We assume that the sample is longer or the same // and there for cut off earlier. So we should find the root most frame in // the sample somewhere in the control. c--; } for (; s >= 1 && c >= 0; s--, c--) { // Next we find the first one that isn't the same which should be the // frame that called our sample function and the control. if (sampleLines[s] !== controlLines[c]) { // In V8, the first line is describing the message but other VMs don't. // If we're about to return the first line, and the control is also on the same // line, that's a pretty good indicator that our sample threw at same line as // the control. I.e. before we entered the sample frame. So we ignore this result. // This can happen if you passed a class to function component, or non-function. if (s !== 1 || c !== 1) { do { s--; c--; // We may still have similar intermediate frames from the construct call. // The next one that isn't the same should be our match though. if (c < 0 || sampleLines[s] !== controlLines[c]) { // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>" // but we have a user-provided "displayName" // splice it in to make the stack more readable. if (fn.displayName && _frame.includes('<anonymous>')) { _frame = _frame.replace('<anonymous>', fn.displayName); } { if (typeof fn === 'function') { componentFrameCache.set(fn, _frame); } } // Return the line we found. return _frame; } } while (s >= 1 && c >= 0); } break; } } } } finally { reentry = false; { ReactCurrentDispatcher.current = previousDispatcher; reenableLogs(); } Error.prepareStackTrace = previousPrepareStackTrace; } // Fallback to just using the name if we couldn't make it throw. var name = fn ? fn.displayName || fn.name : ''; var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; { if (typeof fn === 'function') { componentFrameCache.set(fn, syntheticFrame); } } return syntheticFrame; } function describeClassComponentFrame(ctor, source, ownerFn) { { return describeNativeComponentFrame(ctor, true); } } function describeFunctionComponentFrame(fn, source, ownerFn) { { return describeNativeComponentFrame(fn, false); } } function shouldConstruct(Component) { var prototype = Component.prototype; return !!(prototype && prototype.isReactComponent); } function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { if (type == null) { return ''; } if (typeof type === 'function') { { return describeNativeComponentFrame(type, shouldConstruct(type)); } } if (typeof type === 'string') { return describeBuiltInComponentFrame(type); } switch (type) { case REACT_SUSPENSE_TYPE: return describeBuiltInComponentFrame('Suspense'); case REACT_SUSPENSE_LIST_TYPE: return describeBuiltInComponentFrame('SuspenseList'); } if (typeof type === 'object') { switch (type.$$typeof) { case REACT_FORWARD_REF_TYPE: return describeFunctionComponentFrame(type.render); case REACT_MEMO_TYPE: // Memo may contain any component type so we recursively resolve it. return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); case REACT_LAZY_TYPE: { var lazyComponent = type; var payload = lazyComponent._payload; var init = lazyComponent._init; try { // Lazy may contain any component type so we recursively resolve it. return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); } catch (x) {} } } } return ''; } function describeFiber(fiber) { var owner = fiber._debugOwner ? fiber._debugOwner.type : null ; var source = fiber._debugSource ; switch (fiber.tag) { case HostComponent: return describeBuiltInComponentFrame(fiber.type); case LazyComponent: return describeBuiltInComponentFrame('Lazy'); case SuspenseComponent: return describeBuiltInComponentFrame('Suspense'); case SuspenseListComponent: return describeBuiltInComponentFrame('SuspenseList'); case FunctionComponent: case IndeterminateComponent: case SimpleMemoComponent: return describeFunctionComponentFrame(fiber.type); case ForwardRef: return describeFunctionComponentFrame(fiber.type.render); case ClassComponent: return describeClassComponentFrame(fiber.type); default: return ''; } } function getStackByFiberInDevAndProd(workInProgress) { try { var info = ''; var node = workInProgress; do { info += describeFiber(node); node = node.return; } while (node); return info; } catch (x) { return '\nError generating stack: ' + x.message + '\n' + x.stack; } } function getWrappedName(outerType, innerType, wrapperName) { var displayName = outerType.displayName; if (displayName) { return displayName; } var functionName = innerType.displayName || innerType.name || ''; return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName; } // Keep in sync with react-reconciler/getComponentNameFromFiber function getContextName(type) { return type.displayName || 'Context'; } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead. function getComponentNameFromType(type) { if (type == null) { // Host root, text node or just invalid type. return null; } { if (typeof type.tag === 'number') { error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.'); } } if (typeof type === 'function') { return type.displayName || type.name || null; } if (typeof type === 'string') { return type; } switch (type) { case REACT_FRAGMENT_TYPE: return 'Fragment'; case REACT_PORTAL_TYPE: return 'Portal'; case REACT_PROFILER_TYPE: return 'Profiler'; case REACT_STRICT_MODE_TYPE: return 'StrictMode'; case REACT_SUSPENSE_TYPE: return 'Suspense'; case REACT_SUSPENSE_LIST_TYPE: return 'SuspenseList'; } if (typeof type === 'object') { switch (type.$$typeof) { case REACT_CONTEXT_TYPE: var context = type; return getContextName(context) + '.Consumer'; case REACT_PROVIDER_TYPE: var provider = type; return getContextName(provider._context) + '.Provider'; case REACT_FORWARD_REF_TYPE: return getWrappedName(type, type.render, 'ForwardRef'); case REACT_MEMO_TYPE: var outerName = type.displayName || null; if (outerName !== null) { return outerName; } return getComponentNameFromType(type.type) || 'Memo'; case REACT_LAZY_TYPE: { var lazyComponent = type; var payload = lazyComponent._payload; var init = lazyComponent._init; try { return getComponentNameFromType(init(payload)); } catch (x) { return null; } } // eslint-disable-next-line no-fallthrough } } return null; } function getWrappedName$1(outerType, innerType, wrapperName) { var functionName = innerType.displayName || innerType.name || ''; return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName); } // Keep in sync with shared/getComponentNameFromType function getContextName$1(type) { return type.displayName || 'Context'; } function getComponentNameFromFiber(fiber) { var tag = fiber.tag, type = fiber.type; switch (tag) { case CacheComponent: return 'Cache'; case ContextConsumer: var context = type; return getContextName$1(context) + '.Consumer'; case ContextProvider: var provider = type; return getContextName$1(provider._context) + '.Provider'; case DehydratedFragment: return 'DehydratedFragment'; case ForwardRef: return getWrappedName$1(type, type.render, 'ForwardRef'); case Fragment: return 'Fragment'; case HostComponent: // Host component type is the display name (e.g. "div", "View") return type; case HostPortal: return 'Portal'; case HostRoot: return 'Root'; case HostText: return 'Text'; case LazyComponent: // Name comes from the type in this case; we don't have a tag. return getComponentNameFromType(type); case Mode: if (type === REACT_STRICT_MODE_TYPE) { // Don't be less specific than shared/getComponentNameFromType return 'StrictMode'; } return 'Mode'; case OffscreenComponent: return 'Offscreen'; case Profiler: return 'Profiler'; case ScopeComponent: return 'Scope'; case SuspenseComponent: return 'Suspense'; case SuspenseListComponent: return 'SuspenseList'; case TracingMarkerComponent: return 'TracingMarker'; // The display name for this tags come from the user-provided type: case ClassComponent: case FunctionComponent: case IncompleteClassComponent: case IndeterminateComponent: case MemoComponent: case SimpleMemoComponent: if (typeof type === 'function') { return type.displayName || type.name || null; } if (typeof type === 'string') { return type; } break; } return null; } var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; var current = null; var isRendering = false; function getCurrentFiberOwnerNameInDevOrNull() { { if (current === null) { return null; } var owner = current._debugOwner; if (owner !== null && typeof owner !== 'undefined') { return getComponentNameFromFiber(owner); } } return null; } function getCurrentFiberStackInDev() { { if (current === null) { return ''; } // Safe because if current fiber exists, we are reconciling, // and it is guaranteed to be the work-in-progress version. return getStackByFiberInDevAndProd(current); } } function resetCurrentFiber() { { ReactDebugCurrentFrame.getCurrentStack = null; current = null; isRendering = false; } } function setCurrentFiber(fiber) { { ReactDebugCurrentFrame.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; current = fiber; isRendering = false; } } function getCurrentFiber() { { return current; } } function setIsRendering(rendering) { { isRendering = rendering; } } // Flow does not allow string concatenation of most non-string types. To work // around this limitation, we use an opaque type that can only be obtained by // passing the value through getToStringValue first. function toString(value) { // The coercion safety check is performed in getToStringValue(). // eslint-disable-next-line react-internal/safe-string-coercion return '' + value; } function getToStringValue(value) { switch (typeof value) { case 'boolean': case 'number': case 'string': case 'undefined': return value; case 'object': { checkFormFieldValueStringCoercion(value); } return value; default: // function, symbol are assigned as empty strings return ''; } } var hasReadOnlyValue = { button: true, checkbox: true, image: true, hidden: true, radio: true, reset: true, submit: true }; function checkControlledValueProps(tagName, props) { { if (!(hasReadOnlyValue[props.type] || props.onChange || props.onInput || props.readOnly || props.disabled || props.value == null)) { error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); } if (!(props.onChange || props.readOnly || props.disabled || props.checked == null)) { error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); } } } function isCheckable(elem) { var type = elem.type; var nodeName = elem.nodeName; return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio'); } function getTracker(node) { return node._valueTracker; } function detachTracker(node) { node._valueTracker = null; } function getValueFromNode(node) { var value = ''; if (!node) { return value; } if (isCheckable(node)) { value = node.checked ? 'true' : 'false'; } else { value = node.value; } return value; } function trackValueOnNode(node) { var valueField = isCheckable(node) ? 'checked' : 'value'; var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField); { checkFormFieldValueStringCoercion(node[valueField]); } var currentValue = '' + node[valueField]; // if someone has already defined a value or Safari, then bail // and don't track value will cause over reporting of changes, // but it's better then a hard failure // (needed for certain tests that spyOn input values and Safari) if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') { return; } var get = descriptor.get, set = descriptor.set; Object.defineProperty(node, valueField, { configurable: true, get: function () { return get.call(this); }, set: function (value) { { checkFormFieldValueStringCoercion(value); } currentValue = '' + value; set.call(this, value); } }); // We could've passed this the first time // but it triggers a bug in IE11 and Edge 14/15. // Calling defineProperty() again should be equivalent. // https://github.com/facebook/react/issues/11768 Object.defineProperty(node, valueField, { enumerable: descriptor.enumerable }); var tracker = { getValue: function () { return currentValue; }, setValue: function (value) { { checkFormFieldValueStringCoercion(value); } currentValue = '' + value; }, stopTracking: function () { detachTracker(node); delete node[valueField]; } }; return tracker; } function track(node) { if (getTracker(node)) { return; } // TODO: Once it's just Fiber we can move this to node._wrapperState node._valueTracker = trackValueOnNode(node); } function updateValueIfChanged(node) { if (!node) { return false; } var tracker = getTracker(node); // if there is no tracker at this point it's unlikely // that trying again will succeed if (!tracker) { return true; } var lastValue = tracker.getValue(); var nextValue = getValueFromNode(node); if (nextValue !== lastValue) { tracker.setValue(nextValue); return true; } return false; } function getActiveElement(doc) { doc = doc || (typeof document !== 'undefined' ? document : undefined); if (typeof doc === 'undefined') { return null; } try { return doc.activeElement || doc.body; } catch (e) { return doc.body; } } var didWarnValueDefaultValue = false; var didWarnCheckedDefaultChecked = false; var didWarnControlledToUncontrolled = false; var didWarnUncontrolledToControlled = false; function isControlled(props) { var usesChecked = props.type === 'checkbox' || props.type === 'radio'; return usesChecked ? props.checked != null : props.value != null; } /** * Implements an <input> host component that allows setting these optional * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. * * If `checked` or `value` are not supplied (or null/undefined), user actions * that affect the checked state or value will trigger updates to the element. * * If they are supplied (and not null/undefined), the rendered element will not * trigger updates to the element. Instead, the props must change in order for * the rendered element to be updated. * * The rendered element will be initialized as unchecked (or `defaultChecked`) * with an empty value (or `defaultValue`). * * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html */ function getHostProps(element, props) { var node = element; var checked = props.checked; var hostProps = assign({}, props, { defaultChecked: undefined, defaultValue: undefined, value: undefined, checked: checked != null ? checked : node._wrapperState.initialChecked }); return hostProps; } function initWrapperState(element, props) { { checkControlledValueProps('input', props); if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { error('%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); didWarnCheckedDefaultChecked = true; } if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { error('%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); didWarnValueDefaultValue = true; } } var node = element; var defaultValue = props.defaultValue == null ? '' : props.defaultValue; node._wrapperState = { initialChecked: props.checked != null ? props.checked : props.defaultChecked, initialValue: getToStringValue(props.value != null ? props.value : defaultValue), controlled: isControlled(props) }; } function updateChecked(element, props) { var node = element; var checked = props.checked; if (checked != null) { setValueForProperty(node, 'checked', checked, false); } } function updateWrapper(element, props) { var node = element; { var controlled = isControlled(props); if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) { error('A component is changing an uncontrolled input to be controlled. ' + 'This is likely caused by the value changing from undefined to ' + 'a defined value, which should not happen. ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components'); didWarnUncontrolledToControlled = true; } if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) { error('A component is changing a controlled input to be uncontrolled. ' + 'This is likely caused by the value changing from a defined to ' + 'undefined, which should not happen. ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components'); didWarnControlledToUncontrolled = true; } } updateChecked(element, props); var value = getToStringValue(props.value); var type = props.type; if (value != null) { if (type === 'number') { if (value === 0 && node.value === '' || // We explicitly want to coerce to number here if possible. // eslint-disable-next-line node.value != value) { node.value = toString(value); } } else if (node.value !== toString(value)) { node.value = toString(value); } } else if (type === 'submit' || type === 'reset') { // Submit/reset inputs need the attribute removed completely to avoid // blank-text buttons. node.removeAttribute('value'); return; } { // When syncing the value attribute, the value comes from a cascade of // properties: // 1. The value React property // 2. The defaultValue React property // 3. Otherwise there should be no change if (props.hasOwnProperty('value')) { setDefaultValue(node, props.type, value); } else if (props.hasOwnProperty('defaultValue')) { setDefaultValue(node, props.type, getToStringValue(props.defaultValue)); } } { // When syncing the checked attribute, it only changes when it needs // to be removed, such as transitioning from a checkbox into a text input if (props.checked == null && props.defaultChecked != null) { node.defaultChecked = !!props.defaultChecked; } } } function postMountWrapper(element, props, isHydrating) { var node = element; // Do not assign value if it is already set. This prevents user text input // from being lost during SSR hydration. if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) { var type = props.type; var isButton = type === 'submit' || type === 'reset'; // Avoid setting value attribute on submit/reset inputs as it overrides the // default value provided by the browser. See: #12872 if (isButton && (props.value === undefined || props.value === null)) { return; } var initialValue = toString(node._wrapperState.initialValue); // Do not assign value if it is already set. This prevents user text input // from being lost during SSR hydration. if (!isHydrating) { { // When syncing the value attribute, the value property should use // the wrapperState._initialValue property. This uses: // // 1. The value React property when present // 2. The defaultValue React property when present // 3. An empty string if (initialValue !== node.value) { node.value = initialValue; } } } { // Otherwise, the value attribute is synchronized to the property, // so we assign defaultValue to the same thing as the value property // assignment step above. node.defaultValue = initialValue; } } // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug // this is needed to work around a chrome bug where setting defaultChecked // will sometimes influence the value of checked (even after detachment). // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416 // We need to temporarily unset name to avoid disrupting radio button groups. var name = node.name; if (name !== '') { node.name = ''; } { // When syncing the checked attribute, both the checked property and // attribute are assigned at the same time using defaultChecked. This uses: // // 1. The checked React property when present // 2. The defaultChecked React property when present // 3. Otherwise, false node.defaultChecked = !node.defaultChecked; node.defaultChecked = !!node._wrapperState.initialChecked; } if (name !== '') { node.name = name; } } function restoreControlledState(element, props) { var node = element; updateWrapper(node, props); updateNamedCousins(node, props); } function updateNamedCousins(rootNode, props) { var name = props.name; if (props.type === 'radio' && name != null) { var queryRoot = rootNode; while (queryRoot.parentNode) { queryRoot = queryRoot.parentNode; } // If `rootNode.form` was non-null, then we could try `form.elements`, // but that sometimes behaves strangely in IE8. We could also try using // `form.getElementsByName`, but that will only return direct children // and won't include inputs that use the HTML5 `form=` attribute. Since // the input might not even be in a form. It might not even be in the // document. Let's just use the local `querySelectorAll` to ensure we don't // miss anything. { checkAttributeStringCoercion(name, 'name'); } var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); for (var i = 0; i < group.length; i++) { var otherNode = group[i]; if (otherNode === rootNode || otherNode.form !== rootNode.form) { continue; } // This will throw if radio buttons rendered by different copies of React // and the same name are rendered into the same form (same as #1939). // That's probably okay; we don't support it just as we don't support // mixing React radio buttons with non-React ones. var otherProps = getFiberCurrentPropsFromNode(otherNode); if (!otherProps) { throw new Error('ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.'); } // We need update the tracked value on the named cousin since the value // was changed but the input saw no event or value set updateValueIfChanged(otherNode); // If this is a controlled radio button group, forcing the input that // was previously checked to update will cause it to be come re-checked // as appropriate. updateWrapper(otherNode, otherProps); } } } // In Chrome, assigning defaultValue to certain input types triggers input validation. // For number inputs, the display value loses trailing decimal points. For email inputs, // Chrome raises "The specified value <x> is not a valid email address". // // Here we check to see if the defaultValue has actually changed, avoiding these problems // when the user is inputting text // // https://github.com/facebook/react/issues/7253 function setDefaultValue(node, type, value) { if ( // Focused number inputs synchronize on blur. See ChangeEventPlugin.js type !== 'number' || getActiveElement(node.ownerDocument) !== node) { if (value == null) { node.defaultValue = toString(node._wrapperState.initialValue); } else if (node.defaultValue !== toString(value)) { node.defaultValue = toString(value); } } } var didWarnSelectedSetOnOption = false; var didWarnInvalidChild = false; var didWarnInvalidInnerHTML = false; /** * Implements an <option> host component that warns when `selected` is set. */ function validateProps(element, props) { { // If a value is not provided, then the children must be simple. if (props.value == null) { if (typeof props.children === 'object' && props.children !== null) { React.Children.forEach(props.children, function (child) { if (child == null) { return; } if (typeof child === 'string' || typeof child === 'number') { return; } if (!didWarnInvalidChild) { didWarnInvalidChild = true; error('Cannot infer the option value of complex children. ' + 'Pass a `value` prop or use a plain string as children to <option>.'); } }); } else if (props.dangerouslySetInnerHTML != null) { if (!didWarnInvalidInnerHTML) { didWarnInvalidInnerHTML = true; error('Pass a `value` prop if you set dangerouslyInnerHTML so React knows ' + 'which value should be selected.'); } } } // TODO: Remove support for `selected` in <option>. if (props.selected != null && !didWarnSelectedSetOnOption) { error('Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.'); didWarnSelectedSetOnOption = true; } } } function postMountWrapper$1(element, props) { // value="" should make a value attribute (#6219) if (props.value != null) { element.setAttribute('value', toString(getToStringValue(props.value))); } } var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare function isArray(a) { return isArrayImpl(a); } var didWarnValueDefaultValue$1; { didWarnValueDefaultValue$1 = false; } function getDeclarationErrorAddendum() { var ownerName = getCurrentFiberOwnerNameInDevOrNull(); if (ownerName) { return '\n\nCheck the render method of `' + ownerName + '`.'; } return ''; } var valuePropNames = ['value', 'defaultValue']; /** * Validation function for `value` and `defaultValue`. */ function checkSelectPropTypes(props) { { checkControlledValueProps('select', props); for (var i = 0; i < valuePropNames.length; i++) { var propName = valuePropNames[i]; if (props[propName] == null) { continue; } var propNameIsArray = isArray(props[propName]); if (props.multiple && !propNameIsArray) { error('The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum()); } else if (!props.multiple && propNameIsArray) { error('The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum()); } } } } function updateOptions(node, multiple, propValue, setDefaultSelected) { var options = node.options; if (multiple) { var selectedValues = propValue; var selectedValue = {}; for (var i = 0; i < selectedValues.length; i++) { // Prefix to avoid chaos with special keys. selectedValue['$' + selectedValues[i]] = true; } for (var _i = 0; _i < options.length; _i++) { var selected = selectedValue.hasOwnProperty('$' + options[_i].value); if (options[_i].selected !== selected) { options[_i].selected = selected; } if (selected && setDefaultSelected) { options[_i].defaultSelected = true; } } } else { // Do not set `select.value` as exact behavior isn't consistent across all // browsers for all cases. var _selectedValue = toString(getToStringValue(propValue)); var defaultSelected = null; for (var _i2 = 0; _i2 < options.length; _i2++) { if (options[_i2].value === _selectedValue) { options[_i2].selected = true; if (setDefaultSelected) { options[_i2].defaultSelected = true; } return; } if (defaultSelected === null && !options[_i2].disabled) { defaultSelected = options[_i2]; } } if (defaultSelected !== null) { defaultSelected.selected = true; } } } /** * Implements a <select> host component that allows optionally setting the * props `value` and `defaultValue`. If `multiple` is false, the prop must be a * stringable. If `multiple` is true, the prop must be an array of stringables. * * If `value` is not supplied (or null/undefined), user actions that change the * selected option will trigger updates to the rendered options. * * If it is supplied (and not null/undefined), the rendered options will not * update in response to user actions. Instead, the `value` prop must change in * order for the rendered options to update. * * If `defaultValue` is provided, any options with the supplied values will be * selected. */ function getHostProps$1(element, props) { return assign({}, props, { value: undefined }); } function initWrapperState$1(element, props) { var node = element; { checkSelectPropTypes(props); } node._wrapperState = { wasMultiple: !!props.multiple }; { if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue$1) { error('Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components'); didWarnValueDefaultValue$1 = true; } } } function postMountWrapper$2(element, props) { var node = element; node.multiple = !!props.multiple; var value = props.value; if (value != null) { updateOptions(node, !!props.multiple, value, false); } else if (props.defaultValue != null) { updateOptions(node, !!props.multiple, props.defaultValue, true); } } function postUpdateWrapper(element, props) { var node = element; var wasMultiple = node._wrapperState.wasMultiple; node._wrapperState.wasMultiple = !!props.multiple; var value = props.value; if (value != null) { updateOptions(node, !!props.multiple, value, false); } else if (wasMultiple !== !!props.multiple) { // For simplicity, reapply `defaultValue` if `multiple` is toggled. if (props.defaultValue != null) { updateOptions(node, !!props.multiple, props.defaultValue, true); } else { // Revert the select back to its default unselected state. updateOptions(node, !!props.multiple, props.multiple ? [] : '', false); } } } function restoreControlledState$1(element, props) { var node = element; var value = props.value; if (value != null) { updateOptions(node, !!props.multiple, value, false); } } var didWarnValDefaultVal = false; /** * Implements a <textarea> host component that allows setting `value`, and * `defaultValue`. This differs from the traditional DOM API because value is * usually set as PCDATA children. * * If `value` is not supplied (or null/undefined), user actions that affect the * value will trigger updates to the element. * * If `value` is supplied (and not null/undefined), the rendered element will * not trigger updates to the element. Instead, the `value` prop must change in * order for the rendered element to be updated. * * The rendered element will be initialized with an empty value, the prop * `defaultValue` if specified, or the children content (deprecated). */ function getHostProps$2(element, props) { var node = element; if (props.dangerouslySetInnerHTML != null) { throw new Error('`dangerouslySetInnerHTML` does not make sense on <textarea>.'); } // Always set children to the same thing. In IE9, the selection range will // get reset if `textContent` is mutated. We could add a check in setTextContent // to only set the value if/when the value differs from the node value (which would // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this // solution. The value can be a boolean or object so that's why it's forced // to be a string. var hostProps = assign({}, props, { value: undefined, defaultValue: undefined, children: toString(node._wrapperState.initialValue) }); return hostProps; } function initWrapperState$2(element, props) { var node = element; { checkControlledValueProps('textarea', props); if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) { error('%s contains a textarea with both value and defaultValue props. ' + 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component'); didWarnValDefaultVal = true; } } var initialValue = props.value; // Only bother fetching default value if we're going to use it if (initialValue == null) { var children = props.children, defaultValue = props.defaultValue; if (children != null) { { error('Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.'); } { if (defaultValue != null) { throw new Error('If you supply `defaultValue` on a <textarea>, do not pass children.'); } if (isArray(children)) { if (children.length > 1) { throw new Error('<textarea> can only have at most one child.'); } children = children[0]; } defaultValue = children; } } if (defaultValue == null) { defaultValue = ''; } initialValue = defaultValue; } node._wrapperState = { initialValue: getToStringValue(initialValue) }; } function updateWrapper$1(element, props) { var node = element; var value = getToStringValue(props.value); var defaultValue = getToStringValue(props.defaultValue); if (value != null) { // Cast `value` to a string to ensure the value is set correctly. While // browsers typically do this as necessary, jsdom doesn't. var newValue = toString(value); // To avoid side effects (such as losing text selection), only set value if changed if (newValue !== node.value) { node.value = newValue; } if (props.defaultValue == null && node.defaultValue !== newValue) { node.defaultValue = newValue; } } if (defaultValue != null) { node.defaultValue = toString(defaultValue); } } function postMountWrapper$3(element, props) { var node = element; // This is in postMount because we need access to the DOM node, which is not // available until after the component has mounted. var textContent = node.textContent; // Only set node.value if textContent is equal to the expected // initial value. In IE10/IE11 there is a bug where the placeholder attribute // will populate textContent as well. // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/ if (textContent === node._wrapperState.initialValue) { if (textContent !== '' && textContent !== null) { node.value = textContent; } } } function restoreControlledState$2(element, props) { // DOM component is still mounted; update updateWrapper$1(element, props); } var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML'; var SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; // Assumes there is no parent namespace. function getIntrinsicNamespace(type) { switch (type) { case 'svg': return SVG_NAMESPACE; case 'math': return MATH_NAMESPACE; default: return HTML_NAMESPACE; } } function getChildNamespace(parentNamespace, type) { if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) { // No (or default) parent namespace: potential entry point. return getIntrinsicNamespace(type); } if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') { // We're leaving SVG. return HTML_NAMESPACE; } // By default, pass namespace below. return parentNamespace; } /* globals MSApp */ /** * Create a function which has 'unsafe' privileges (required by windows8 apps) */ var createMicrosoftUnsafeLocalFunction = function (func) { if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { return function (arg0, arg1, arg2, arg3) { MSApp.execUnsafeLocalFunction(function () { return func(arg0, arg1, arg2, arg3); }); }; } else { return func; } }; var reusableSVGContainer; /** * Set the innerHTML property of a node * * @param {DOMElement} node * @param {string} html * @internal */ var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) { if (node.namespaceURI === SVG_NAMESPACE) { if (!('innerHTML' in node)) { // IE does not have innerHTML for SVG nodes, so instead we inject the // new markup in a temp node and then move the child nodes across into // the target node reusableSVGContainer = reusableSVGContainer || document.createElement('div'); reusableSVGContainer.innerHTML = '<svg>' + html.valueOf().toString() + '</svg>'; var svgNode = reusableSVGContainer.firstChild; while (node.firstChild) { node.removeChild(node.firstChild); } while (svgNode.firstChild) { node.appendChild(svgNode.firstChild); } return; } } node.innerHTML = html; }); /** * HTML nodeType values that represent the type of the node */ var ELEMENT_NODE = 1; var TEXT_NODE = 3; var COMMENT_NODE = 8; var DOCUMENT_NODE = 9; var DOCUMENT_FRAGMENT_NODE = 11; /** * Set the textContent property of a node. For text updates, it's faster * to set the `nodeValue` of the Text node directly instead of using * `.textContent` which will remove the existing node and create a new one. * * @param {DOMElement} node * @param {string} text * @internal */ var setTextContent = function (node, text) { if (text) { var firstChild = node.firstChild; if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) { firstChild.nodeValue = text; return; } } node.textContent = text; }; // List derived from Gecko source code: // https://github.com/mozilla/gecko-dev/blob/4e638efc71/layout/style/test/property_database.js var shorthandToLonghand = { animation: ['animationDelay', 'animationDirection', 'animationDuration', 'animationFillMode', 'animationIterationCount', 'animationName', 'animationPlayState', 'animationTimingFunction'], background: ['backgroundAttachment', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat', 'backgroundSize'], backgroundPosition: ['backgroundPositionX', 'backgroundPositionY'], border: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth', 'borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderTopColor', 'borderTopStyle', 'borderTopWidth'], borderBlockEnd: ['borderBlockEndColor', 'borderBlockEndStyle', 'borderBlockEndWidth'], borderBlockStart: ['borderBlockStartColor', 'borderBlockStartStyle', 'borderBlockStartWidth'], borderBottom: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth'], borderColor: ['borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor'], borderImage: ['borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth'], borderInlineEnd: ['borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth'], borderInlineStart: ['borderInlineStartColor', 'borderInlineStartStyle', 'borderInlineStartWidth'], borderLeft: ['borderLeftColor', 'borderLeftStyle', 'borderLeftWidth'], borderRadius: ['borderBottomLeftRadius', 'borderBottomRightRadius', 'borderTopLeftRadius', 'borderTopRightRadius'], borderRight: ['borderRightColor', 'borderRightStyle', 'borderRightWidth'], borderStyle: ['borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle'], borderTop: ['borderTopColor', 'borderTopStyle', 'borderTopWidth'], borderWidth: ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth'], columnRule: ['columnRuleColor', 'columnRuleStyle', 'columnRuleWidth'], columns: ['columnCount', 'columnWidth'], flex: ['flexBasis', 'flexGrow', 'flexShrink'], flexFlow: ['flexDirection', 'flexWrap'], font: ['fontFamily', 'fontFeatureSettings', 'fontKerning', 'fontLanguageOverride', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition', 'fontWeight', 'lineHeight'], fontVariant: ['fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition'], gap: ['columnGap', 'rowGap'], grid: ['gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'], gridArea: ['gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart'], gridColumn: ['gridColumnEnd', 'gridColumnStart'], gridColumnGap: ['columnGap'], gridGap: ['columnGap', 'rowGap'], gridRow: ['gridRowEnd', 'gridRowStart'], gridRowGap: ['rowGap'], gridTemplate: ['gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'], listStyle: ['listStyleImage', 'listStylePosition', 'listStyleType'], margin: ['marginBottom', 'marginLeft', 'marginRight', 'marginTop'], marker: ['markerEnd', 'markerMid', 'markerStart'], mask: ['maskClip', 'maskComposite', 'maskImage', 'maskMode', 'maskOrigin', 'maskPositionX', 'maskPositionY', 'maskRepeat', 'maskSize'], maskPosition: ['maskPositionX', 'maskPositionY'], outline: ['outlineColor', 'outlineStyle', 'outlineWidth'], overflow: ['overflowX', 'overflowY'], padding: ['paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop'], placeContent: ['alignContent', 'justifyContent'], placeItems: ['alignItems', 'justifyItems'], placeSelf: ['alignSelf', 'justifySelf'], textDecoration: ['textDecorationColor', 'textDecorationLine', 'textDecorationStyle'], textEmphasis: ['textEmphasisColor', 'textEmphasisStyle'], transition: ['transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction'], wordWrap: ['overflowWrap'] }; /** * CSS properties which accept numbers but are not in units of "px". */ var isUnitlessNumber = { animationIterationCount: true, aspectRatio: true, borderImageOutset: true, borderImageSlice: true, borderImageWidth: true, boxFlex: true, boxFlexGroup: true, boxOrdinalGroup: true, columnCount: true, columns: true, flex: true, flexGrow: true, flexPositive: true, flexShrink: true, flexNegative: true, flexOrder: true, gridArea: true, gridRow: true, gridRowEnd: true, gridRowSpan: true, gridRowStart: true, gridColumn: true, gridColumnEnd: true, gridColumnSpan: true, gridColumnStart: true, fontWeight: true, lineClamp: true, lineHeight: true, opacity: true, order: true, orphans: true, tabSize: true, widows: true, zIndex: true, zoom: true, // SVG-related properties fillOpacity: true, floodOpacity: true, stopOpacity: true, strokeDasharray: true, strokeDashoffset: true, strokeMiterlimit: true, strokeOpacity: true, strokeWidth: true }; /** * @param {string} prefix vendor-specific prefix, eg: Webkit * @param {string} key style name, eg: transitionDuration * @return {string} style name prefixed with `prefix`, properly camelCased, eg: * WebkitTransitionDuration */ function prefixKey(prefix, key) { return prefix + key.charAt(0).toUpperCase() + key.substring(1); } /** * Support style names that may come passed in prefixed by adding permutations * of vendor prefixes. */ var prefixes = ['Webkit', 'ms', 'Moz', 'O']; // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an // infinite loop, because it iterates over the newly added props too. Object.keys(isUnitlessNumber).forEach(function (prop) { prefixes.forEach(function (prefix) { isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; }); }); /** * Convert a value into the proper css writable value. The style name `name` * should be logical (no hyphens), as specified * in `CSSProperty.isUnitlessNumber`. * * @param {string} name CSS property name such as `topMargin`. * @param {*} value CSS property value such as `10px`. * @return {string} Normalized style value with dimensions applied. */ function dangerousStyleValue(name, value, isCustomProperty) { // Note that we've removed escapeTextForBrowser() calls here since the // whole string will be escaped when the attribute is injected into // the markup. If you provide unsafe user data here they can inject // arbitrary CSS which may be problematic (I couldn't repro this): // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/ // This is not an XSS hole but instead a potential CSS injection issue // which has lead to a greater discussion about how we're going to // trust URLs moving forward. See #2115901 var isEmpty = value == null || typeof value === 'boolean' || value === ''; if (isEmpty) { return ''; } if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) { return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers } { checkCSSPropertyStringCoercion(value, name); } return ('' + value).trim(); } var uppercasePattern = /([A-Z])/g; var msPattern = /^ms-/; /** * Hyphenates a camelcased CSS property name, for example: * * > hyphenateStyleName('backgroundColor') * < "background-color" * > hyphenateStyleName('MozTransition') * < "-moz-transition" * > hyphenateStyleName('msTransition') * < "-ms-transition" * * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix * is converted to `-ms-`. */ function hyphenateStyleName(name) { return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-'); } var warnValidStyle = function () {}; { // 'msTransform' is correct, but the other prefixes should be capitalized var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/; var msPattern$1 = /^-ms-/; var hyphenPattern = /-(.)/g; // style values shouldn't contain a semicolon var badStyleValueWithSemicolonPattern = /;\s*$/; var warnedStyleNames = {}; var warnedStyleValues = {}; var warnedForNaNValue = false; var warnedForInfinityValue = false; var camelize = function (string) { return string.replace(hyphenPattern, function (_, character) { return character.toUpperCase(); }); }; var warnHyphenatedStyleName = function (name) { if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { return; } warnedStyleNames[name] = true; error('Unsupported style property %s. Did you mean %s?', name, // As Andi Smith suggests // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix // is converted to lowercase `ms`. camelize(name.replace(msPattern$1, 'ms-'))); }; var warnBadVendoredStyleName = function (name) { if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { return; } warnedStyleNames[name] = true; error('Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)); }; var warnStyleValueWithSemicolon = function (name, value) { if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) { return; } warnedStyleValues[value] = true; error("Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')); }; var warnStyleValueIsNaN = function (name, value) { if (warnedForNaNValue) { return; } warnedForNaNValue = true; error('`NaN` is an invalid value for the `%s` css style property.', name); }; var warnStyleValueIsInfinity = function (name, value) { if (warnedForInfinityValue) { return; } warnedForInfinityValue = true; error('`Infinity` is an invalid value for the `%s` css style property.', name); }; warnValidStyle = function (name, value) { if (name.indexOf('-') > -1) { warnHyphenatedStyleName(name); } else if (badVendoredStyleNamePattern.test(name)) { warnBadVendoredStyleName(name); } else if (badStyleValueWithSemicolonPattern.test(value)) { warnStyleValueWithSemicolon(name, value); } if (typeof value === 'number') { if (isNaN(value)) { warnStyleValueIsNaN(name, value); } else if (!isFinite(value)) { warnStyleValueIsInfinity(name, value); } } }; } var warnValidStyle$1 = warnValidStyle; /** * Operations for dealing with CSS properties. */ /** * This creates a string that is expected to be equivalent to the style * attribute generated by server-side rendering. It by-passes warnings and * security checks so it's not safe to use this value for anything other than * comparison. It is only used in DEV for SSR validation. */ function createDangerousStringForStyles(styles) { { var serialized = ''; var delimiter = ''; for (var styleName in styles) { if (!styles.hasOwnProperty(styleName)) { continue; } var styleValue = styles[styleName]; if (styleValue != null) { var isCustomProperty = styleName.indexOf('--') === 0; serialized += delimiter + (isCustomProperty ? styleName : hyphenateStyleName(styleName)) + ':'; serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty); delimiter = ';'; } } return serialized || null; } } /** * Sets the value for multiple styles on a node. If a value is specified as * '' (empty string), the corresponding style property will be unset. * * @param {DOMElement} node * @param {object} styles */ function setValueForStyles(node, styles) { var style = node.style; for (var styleName in styles) { if (!styles.hasOwnProperty(styleName)) { continue; } var isCustomProperty = styleName.indexOf('--') === 0; { if (!isCustomProperty) { warnValidStyle$1(styleName, styles[styleName]); } } var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty); if (styleName === 'float') { styleName = 'cssFloat'; } if (isCustomProperty) { style.setProperty(styleName, styleValue); } else { style[styleName] = styleValue; } } } function isValueEmpty(value) { return value == null || typeof value === 'boolean' || value === ''; } /** * Given {color: 'red', overflow: 'hidden'} returns { * color: 'color', * overflowX: 'overflow', * overflowY: 'overflow', * }. This can be read as "the overflowY property was set by the overflow * shorthand". That is, the values are the property that each was derived from. */ function expandShorthandMap(styles) { var expanded = {}; for (var key in styles) { var longhands = shorthandToLonghand[key] || [key]; for (var i = 0; i < longhands.length; i++) { expanded[longhands[i]] = key; } } return expanded; } /** * When mixing shorthand and longhand property names, we warn during updates if * we expect an incorrect result to occur. In particular, we warn for: * * Updating a shorthand property (longhand gets overwritten): * {font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'} * becomes .style.font = 'baz' * Removing a shorthand property (longhand gets lost too): * {font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'} * becomes .style.font = '' * Removing a longhand property (should revert to shorthand; doesn't): * {font: 'foo', fontVariant: 'bar'} -> {font: 'foo'} * becomes .style.fontVariant = '' */ function validateShorthandPropertyCollisionInDev(styleUpdates, nextStyles) { { if (!nextStyles) { return; } var expandedUpdates = expandShorthandMap(styleUpdates); var expandedStyles = expandShorthandMap(nextStyles); var warnedAbout = {}; for (var key in expandedUpdates) { var originalKey = expandedUpdates[key]; var correctOriginalKey = expandedStyles[key]; if (correctOriginalKey && originalKey !== correctOriginalKey) { var warningKey = originalKey + ',' + correctOriginalKey; if (warnedAbout[warningKey]) { continue; } warnedAbout[warningKey] = true; error('%s a style property during rerender (%s) when a ' + 'conflicting property is set (%s) can lead to styling bugs. To ' + "avoid this, don't mix shorthand and non-shorthand properties " + 'for the same value; instead, replace the shorthand with ' + 'separate values.', isValueEmpty(styleUpdates[originalKey]) ? 'Removing' : 'Updating', originalKey, correctOriginalKey); } } } } // For HTML, certain tags should omit their close tag. We keep a list for // those special-case tags. var omittedCloseTags = { area: true, base: true, br: true, col: true, embed: true, hr: true, img: true, input: true, keygen: true, link: true, meta: true, param: true, source: true, track: true, wbr: true // NOTE: menuitem's close tag should be omitted, but that causes problems. }; // `omittedCloseTags` except that `menuitem` should still have its closing tag. var voidElementTags = assign({ menuitem: true }, omittedCloseTags); var HTML = '__html'; function assertValidProps(tag, props) { if (!props) { return; } // Note the use of `==` which checks for null or undefined. if (voidElementTags[tag]) { if (props.children != null || props.dangerouslySetInnerHTML != null) { throw new Error(tag + " is a void element tag and must neither have `children` nor " + 'use `dangerouslySetInnerHTML`.'); } } if (props.dangerouslySetInnerHTML != null) { if (props.children != null) { throw new Error('Can only set one of `children` or `props.dangerouslySetInnerHTML`.'); } if (typeof props.dangerouslySetInnerHTML !== 'object' || !(HTML in props.dangerouslySetInnerHTML)) { throw new Error('`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://reactjs.org/link/dangerously-set-inner-html ' + 'for more information.'); } } { if (!props.suppressContentEditableWarning && props.contentEditable && props.children != null) { error('A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.'); } } if (props.style != null && typeof props.style !== 'object') { throw new Error('The `style` prop expects a mapping from style properties to values, ' + "not a string. For example, style={{marginRight: spacing + 'em'}} when " + 'using JSX.'); } } function isCustomComponent(tagName, props) { if (tagName.indexOf('-') === -1) { return typeof props.is === 'string'; } switch (tagName) { // These are reserved SVG and MathML elements. // We don't mind this list too much because we expect it to never grow. // The alternative is to track the namespace in a few places which is convoluted. // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts case 'annotation-xml': case 'color-profile': case 'font-face': case 'font-face-src': case 'font-face-uri': case 'font-face-format': case 'font-face-name': case 'missing-glyph': return false; default: return true; } } // When adding attributes to the HTML or SVG allowed attribute list, be sure to // also add them to this module to ensure casing and incorrect name // warnings. var possibleStandardNames = { // HTML accept: 'accept', acceptcharset: 'acceptCharset', 'accept-charset': 'acceptCharset', accesskey: 'accessKey', action: 'action', allowfullscreen: 'allowFullScreen', alt: 'alt', as: 'as', async: 'async', autocapitalize: 'autoCapitalize', autocomplete: 'autoComplete', autocorrect: 'autoCorrect', autofocus: 'autoFocus', autoplay: 'autoPlay', autosave: 'autoSave', capture: 'capture', cellpadding: 'cellPadding', cellspacing: 'cellSpacing', challenge: 'challenge', charset: 'charSet', checked: 'checked', children: 'children', cite: 'cite', class: 'className', classid: 'classID', classname: 'className', cols: 'cols', colspan: 'colSpan', content: 'content', contenteditable: 'contentEditable', contextmenu: 'contextMenu', controls: 'controls', controlslist: 'controlsList', coords: 'coords', crossorigin: 'crossOrigin', dangerouslysetinnerhtml: 'dangerouslySetInnerHTML', data: 'data', datetime: 'dateTime', default: 'default', defaultchecked: 'defaultChecked', defaultvalue: 'defaultValue', defer: 'defer', dir: 'dir', disabled: 'disabled', disablepictureinpicture: 'disablePictureInPicture', disableremoteplayback: 'disableRemotePlayback', download: 'download', draggable: 'draggable', enctype: 'encType', enterkeyhint: 'enterKeyHint', for: 'htmlFor', form: 'form', formmethod: 'formMethod', formaction: 'formAction', formenctype: 'formEncType', formnovalidate: 'formNoValidate', formtarget: 'formTarget', frameborder: 'frameBorder', headers: 'headers', height: 'height', hidden: 'hidden', high: 'high', href: 'href', hreflang: 'hrefLang', htmlfor: 'htmlFor', httpequiv: 'httpEquiv', 'http-equiv': 'httpEquiv', icon: 'icon', id: 'id', imagesizes: 'imageSizes', imagesrcset: 'imageSrcSet', innerhtml: 'innerHTML', inputmode: 'inputMode', integrity: 'integrity', is: 'is', itemid: 'itemID', itemprop: 'itemProp', itemref: 'itemRef', itemscope: 'itemScope', itemtype: 'itemType', keyparams: 'keyParams', keytype: 'keyType', kind: 'kind', label: 'label', lang: 'lang', list: 'list', loop: 'loop', low: 'low', manifest: 'manifest', marginwidth: 'marginWidth', marginheight: 'marginHeight', max: 'max', maxlength: 'maxLength', media: 'media', mediagroup: 'mediaGroup', method: 'method', min: 'min', minlength: 'minLength', multiple: 'multiple', muted: 'muted', name: 'name', nomodule: 'noModule', nonce: 'nonce', novalidate: 'noValidate', open: 'open', optimum: 'optimum', pattern: 'pattern', placeholder: 'placeholder', playsinline: 'playsInline', poster: 'poster', preload: 'preload', profile: 'profile', radiogroup: 'radioGroup', readonly: 'readOnly', referrerpolicy: 'referrerPolicy', rel: 'rel', required: 'required', reversed: 'reversed', role: 'role', rows: 'rows', rowspan: 'rowSpan', sandbox: 'sandbox', scope: 'scope', scoped: 'scoped', scrolling: 'scrolling', seamless: 'seamless', selected: 'selected', shape: 'shape', size: 'size', sizes: 'sizes', span: 'span', spellcheck: 'spellCheck', src: 'src', srcdoc: 'srcDoc', srclang: 'srcLang', srcset: 'srcSet', start: 'start', step: 'step', style: 'style', summary: 'summary', tabindex: 'tabIndex', target: 'target', title: 'title', type: 'type', usemap: 'useMap', value: 'value', width: 'width', wmode: 'wmode', wrap: 'wrap', // SVG about: 'about', accentheight: 'accentHeight', 'accent-height': 'accentHeight', accumulate: 'accumulate', additive: 'additive', alignmentbaseline: 'alignmentBaseline', 'alignment-baseline': 'alignmentBaseline', allowreorder: 'allowReorder', alphabetic: 'alphabetic', amplitude: 'amplitude', arabicform: 'arabicForm', 'arabic-form': 'arabicForm', ascent: 'ascent', attributename: 'attributeName', attributetype: 'attributeType', autoreverse: 'autoReverse', azimuth: 'azimuth', basefrequency: 'baseFrequency', baselineshift: 'baselineShift', 'baseline-shift': 'baselineShift', baseprofile: 'baseProfile', bbox: 'bbox', begin: 'begin', bias: 'bias', by: 'by', calcmode: 'calcMode', capheight: 'capHeight', 'cap-height': 'capHeight', clip: 'clip', clippath: 'clipPath', 'clip-path': 'clipPath', clippathunits: 'clipPathUnits', cliprule: 'clipRule', 'clip-rule': 'clipRule', color: 'color', colorinterpolation: 'colorInterpolation', 'color-interpolation': 'colorInterpolation', colorinterpolationfilters: 'colorInterpolationFilters', 'color-interpolation-filters': 'colorInterpolationFilters', colorprofile: 'colorProfile', 'color-profile': 'colorProfile', colorrendering: 'colorRendering', 'color-rendering': 'colorRendering', contentscripttype: 'contentScriptType', contentstyletype: 'contentStyleType', cursor: 'cursor', cx: 'cx', cy: 'cy', d: 'd', datatype: 'datatype', decelerate: 'decelerate', descent: 'descent', diffuseconstant: 'diffuseConstant', direction: 'direction', display: 'display', divisor: 'divisor', dominantbaseline: 'dominantBaseline', 'dominant-baseline': 'dominantBaseline', dur: 'dur', dx: 'dx', dy: 'dy', edgemode: 'edgeMode', elevation: 'elevation', enablebackground: 'enableBackground', 'enable-background': 'enableBackground', end: 'end', exponent: 'exponent', externalresourcesrequired: 'externalResourcesRequired', fill: 'fill', fillopacity: 'fillOpacity', 'fill-opacity': 'fillOpacity', fillrule: 'fillRule', 'fill-rule': 'fillRule', filter: 'filter', filterres: 'filterRes', filterunits: 'filterUnits', floodopacity: 'floodOpacity', 'flood-opacity': 'floodOpacity', floodcolor: 'floodColor', 'flood-color': 'floodColor', focusable: 'focusable', fontfamily: 'fontFamily', 'font-family': 'fontFamily', fontsize: 'fontSize', 'font-size': 'fontSize', fontsizeadjust: 'fontSizeAdjust', 'font-size-adjust': 'fontSizeAdjust', fontstretch: 'fontStretch', 'font-stretch': 'fontStretch', fontstyle: 'fontStyle', 'font-style': 'fontStyle', fontvariant: 'fontVariant', 'font-variant': 'fontVariant', fontweight: 'fontWeight', 'font-weight': 'fontWeight', format: 'format', from: 'from', fx: 'fx', fy: 'fy', g1: 'g1', g2: 'g2', glyphname: 'glyphName', 'glyph-name': 'glyphName', glyphorientationhorizontal: 'glyphOrientationHorizontal', 'glyph-orientation-horizontal': 'glyphOrientationHorizontal', glyphorientationvertical: 'glyphOrientationVertical', 'glyph-orientation-vertical': 'glyphOrientationVertical', glyphref: 'glyphRef', gradienttransform: 'gradientTransform', gradientunits: 'gradientUnits', hanging: 'hanging', horizadvx: 'horizAdvX', 'horiz-adv-x': 'horizAdvX', horizoriginx: 'horizOriginX', 'horiz-origin-x': 'horizOriginX', ideographic: 'ideographic', imagerendering: 'imageRendering', 'image-rendering': 'imageRendering', in2: 'in2', in: 'in', inlist: 'inlist', intercept: 'intercept', k1: 'k1', k2: 'k2', k3: 'k3', k4: 'k4', k: 'k', kernelmatrix: 'kernelMatrix', kernelunitlength: 'kernelUnitLength', kerning: 'kerning', keypoints: 'keyPoints', keysplines: 'keySplines', keytimes: 'keyTimes', lengthadjust: 'lengthAdjust', letterspacing: 'letterSpacing', 'letter-spacing': 'letterSpacing', lightingcolor: 'lightingColor', 'lighting-color': 'lightingColor', limitingconeangle: 'limitingConeAngle', local: 'local', markerend: 'markerEnd', 'marker-end': 'markerEnd', markerheight: 'markerHeight', markermid: 'markerMid', 'marker-mid': 'markerMid', markerstart: 'markerStart', 'marker-start': 'markerStart', markerunits: 'markerUnits', markerwidth: 'markerWidth', mask: 'mask', maskcontentunits: 'maskContentUnits', maskunits: 'maskUnits', mathematical: 'mathematical', mode: 'mode', numoctaves: 'numOctaves', offset: 'offset', opacity: 'opacity', operator: 'operator', order: 'order', orient: 'orient', orientation: 'orientation', origin: 'origin', overflow: 'overflow', overlineposition: 'overlinePosition', 'overline-position': 'overlinePosition', overlinethickness: 'overlineThickness', 'overline-thickness': 'overlineThickness', paintorder: 'paintOrder', 'paint-order': 'paintOrder', panose1: 'panose1', 'panose-1': 'panose1', pathlength: 'pathLength', patterncontentunits: 'patternContentUnits', patterntransform: 'patternTransform', patternunits: 'patternUnits', pointerevents: 'pointerEvents', 'pointer-events': 'pointerEvents', points: 'points', pointsatx: 'pointsAtX', pointsaty: 'pointsAtY', pointsatz: 'pointsAtZ', prefix: 'prefix', preservealpha: 'preserveAlpha', preserveaspectratio: 'preserveAspectRatio', primitiveunits: 'primitiveUnits', property: 'property', r: 'r', radius: 'radius', refx: 'refX', refy: 'refY', renderingintent: 'renderingIntent', 'rendering-intent': 'renderingIntent', repeatcount: 'repeatCount', repeatdur: 'repeatDur', requiredextensions: 'requiredExtensions', requiredfeatures: 'requiredFeatures', resource: 'resource', restart: 'restart', result: 'result', results: 'results', rotate: 'rotate', rx: 'rx', ry: 'ry', scale: 'scale', security: 'security', seed: 'seed', shaperendering: 'shapeRendering', 'shape-rendering': 'shapeRendering', slope: 'slope', spacing: 'spacing', specularconstant: 'specularConstant', specularexponent: 'specularExponent', speed: 'speed', spreadmethod: 'spreadMethod', startoffset: 'startOffset', stddeviation: 'stdDeviation', stemh: 'stemh', stemv: 'stemv', stitchtiles: 'stitchTiles', stopcolor: 'stopColor', 'stop-color': 'stopColor', stopopacity: 'stopOpacity', 'stop-opacity': 'stopOpacity', strikethroughposition: 'strikethroughPosition', 'strikethrough-position': 'strikethroughPosition', strikethroughthickness: 'strikethroughThickness', 'strikethrough-thickness': 'strikethroughThickness', string: 'string', stroke: 'stroke', strokedasharray: 'strokeDasharray', 'stroke-dasharray': 'strokeDasharray', strokedashoffset: 'strokeDashoffset', 'stroke-dashoffset': 'strokeDashoffset', strokelinecap: 'strokeLinecap', 'stroke-linecap': 'strokeLinecap', strokelinejoin: 'strokeLinejoin', 'stroke-linejoin': 'strokeLinejoin', strokemiterlimit: 'strokeMiterlimit', 'stroke-miterlimit': 'strokeMiterlimit', strokewidth: 'strokeWidth', 'stroke-width': 'strokeWidth', strokeopacity: 'strokeOpacity', 'stroke-opacity': 'strokeOpacity', suppresscontenteditablewarning: 'suppressContentEditableWarning', suppresshydrationwarning: 'suppressHydrationWarning', surfacescale: 'surfaceScale', systemlanguage: 'systemLanguage', tablevalues: 'tableValues', targetx: 'targetX', targety: 'targetY', textanchor: 'textAnchor', 'text-anchor': 'textAnchor', textdecoration: 'textDecoration', 'text-decoration': 'textDecoration', textlength: 'textLength', textrendering: 'textRendering', 'text-rendering': 'textRendering', to: 'to', transform: 'transform', typeof: 'typeof', u1: 'u1', u2: 'u2', underlineposition: 'underlinePosition', 'underline-position': 'underlinePosition', underlinethickness: 'underlineThickness', 'underline-thickness': 'underlineThickness', unicode: 'unicode', unicodebidi: 'unicodeBidi', 'unicode-bidi': 'unicodeBidi', unicoderange: 'unicodeRange', 'unicode-range': 'unicodeRange', unitsperem: 'unitsPerEm', 'units-per-em': 'unitsPerEm', unselectable: 'unselectable', valphabetic: 'vAlphabetic', 'v-alphabetic': 'vAlphabetic', values: 'values', vectoreffect: 'vectorEffect', 'vector-effect': 'vectorEffect', version: 'version', vertadvy: 'vertAdvY', 'vert-adv-y': 'vertAdvY', vertoriginx: 'vertOriginX', 'vert-origin-x': 'vertOriginX', vertoriginy: 'vertOriginY', 'vert-origin-y': 'vertOriginY', vhanging: 'vHanging', 'v-hanging': 'vHanging', videographic: 'vIdeographic', 'v-ideographic': 'vIdeographic', viewbox: 'viewBox', viewtarget: 'viewTarget', visibility: 'visibility', vmathematical: 'vMathematical', 'v-mathematical': 'vMathematical', vocab: 'vocab', widths: 'widths', wordspacing: 'wordSpacing', 'word-spacing': 'wordSpacing', writingmode: 'writingMode', 'writing-mode': 'writingMode', x1: 'x1', x2: 'x2', x: 'x', xchannelselector: 'xChannelSelector', xheight: 'xHeight', 'x-height': 'xHeight', xlinkactuate: 'xlinkActuate', 'xlink:actuate': 'xlinkActuate', xlinkarcrole: 'xlinkArcrole', 'xlink:arcrole': 'xlinkArcrole', xlinkhref: 'xlinkHref', 'xlink:href': 'xlinkHref', xlinkrole: 'xlinkRole', 'xlink:role': 'xlinkRole', xlinkshow: 'xlinkShow', 'xlink:show': 'xlinkShow', xlinktitle: 'xlinkTitle', 'xlink:title': 'xlinkTitle', xlinktype: 'xlinkType', 'xlink:type': 'xlinkType', xmlbase: 'xmlBase', 'xml:base': 'xmlBase', xmllang: 'xmlLang', 'xml:lang': 'xmlLang', xmlns: 'xmlns', 'xml:space': 'xmlSpace', xmlnsxlink: 'xmlnsXlink', 'xmlns:xlink': 'xmlnsXlink', xmlspace: 'xmlSpace', y1: 'y1', y2: 'y2', y: 'y', ychannelselector: 'yChannelSelector', z: 'z', zoomandpan: 'zoomAndPan' }; var ariaProperties = { 'aria-current': 0, // state 'aria-description': 0, 'aria-details': 0, 'aria-disabled': 0, // state 'aria-hidden': 0, // state 'aria-invalid': 0, // state 'aria-keyshortcuts': 0, 'aria-label': 0, 'aria-roledescription': 0, // Widget Attributes 'aria-autocomplete': 0, 'aria-checked': 0, 'aria-expanded': 0, 'aria-haspopup': 0, 'aria-level': 0, 'aria-modal': 0, 'aria-multiline': 0, 'aria-multiselectable': 0, 'aria-orientation': 0, 'aria-placeholder': 0, 'aria-pressed': 0, 'aria-readonly': 0, 'aria-required': 0, 'aria-selected': 0, 'aria-sort': 0, 'aria-valuemax': 0, 'aria-valuemin': 0, 'aria-valuenow': 0, 'aria-valuetext': 0, // Live Region Attributes 'aria-atomic': 0, 'aria-busy': 0, 'aria-live': 0, 'aria-relevant': 0, // Drag-and-Drop Attributes 'aria-dropeffect': 0, 'aria-grabbed': 0, // Relationship Attributes 'aria-activedescendant': 0, 'aria-colcount': 0, 'aria-colindex': 0, 'aria-colspan': 0, 'aria-controls': 0, 'aria-describedby': 0, 'aria-errormessage': 0, 'aria-flowto': 0, 'aria-labelledby': 0, 'aria-owns': 0, 'aria-posinset': 0, 'aria-rowcount': 0, 'aria-rowindex': 0, 'aria-rowspan': 0, 'aria-setsize': 0 }; var warnedProperties = {}; var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$'); var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$'); function validateProperty(tagName, name) { { if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) { return true; } if (rARIACamel.test(name)) { var ariaName = 'aria-' + name.slice(4).toLowerCase(); var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null; // If this is an aria-* attribute, but is not listed in the known DOM // DOM properties, then it is an invalid aria-* attribute. if (correctName == null) { error('Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name); warnedProperties[name] = true; return true; } // aria-* attributes should be lowercase; suggest the lowercase version. if (name !== correctName) { error('Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName); warnedProperties[name] = true; return true; } } if (rARIA.test(name)) { var lowerCasedName = name.toLowerCase(); var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null; // If this is an aria-* attribute, but is not listed in the known DOM // DOM properties, then it is an invalid aria-* attribute. if (standardName == null) { warnedProperties[name] = true; return false; } // aria-* attributes should be lowercase; suggest the lowercase version. if (name !== standardName) { error('Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName); warnedProperties[name] = true; return true; } } } return true; } function warnInvalidARIAProps(type, props) { { var invalidProps = []; for (var key in props) { var isValid = validateProperty(type, key); if (!isValid) { invalidProps.push(key); } } var unknownPropString = invalidProps.map(function (prop) { return '`' + prop + '`'; }).join(', '); if (invalidProps.length === 1) { error('Invalid aria prop %s on <%s> tag. ' + 'For details, see https://reactjs.org/link/invalid-aria-props', unknownPropString, type); } else if (invalidProps.length > 1) { error('Invalid aria props %s on <%s> tag. ' + 'For details, see https://reactjs.org/link/invalid-aria-props', unknownPropString, type); } } } function validateProperties(type, props) { if (isCustomComponent(type, props)) { return; } warnInvalidARIAProps(type, props); } var didWarnValueNull = false; function validateProperties$1(type, props) { { if (type !== 'input' && type !== 'textarea' && type !== 'select') { return; } if (props != null && props.value === null && !didWarnValueNull) { didWarnValueNull = true; if (type === 'select' && props.multiple) { error('`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type); } else { error('`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type); } } } } var validateProperty$1 = function () {}; { var warnedProperties$1 = {}; var EVENT_NAME_REGEX = /^on./; var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/; var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$'); var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$'); validateProperty$1 = function (tagName, name, value, eventRegistry) { if (hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) { return true; } var lowerCasedName = name.toLowerCase(); if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') { error('React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.'); warnedProperties$1[name] = true; return true; } // We can't rely on the event system being injected on the server. if (eventRegistry != null) { var registrationNameDependencies = eventRegistry.registrationNameDependencies, possibleRegistrationNames = eventRegistry.possibleRegistrationNames; if (registrationNameDependencies.hasOwnProperty(name)) { return true; } var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null; if (registrationName != null) { error('Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName); warnedProperties$1[name] = true; return true; } if (EVENT_NAME_REGEX.test(name)) { error('Unknown event handler property `%s`. It will be ignored.', name); warnedProperties$1[name] = true; return true; } } else if (EVENT_NAME_REGEX.test(name)) { // If no event plugins have been injected, we are in a server environment. // So we can't tell if the event name is correct for sure, but we can filter // out known bad ones like `onclick`. We can't suggest a specific replacement though. if (INVALID_EVENT_NAME_REGEX.test(name)) { error('Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name); } warnedProperties$1[name] = true; return true; } // Let the ARIA attribute hook validate ARIA attributes if (rARIA$1.test(name) || rARIACamel$1.test(name)) { return true; } if (lowerCasedName === 'innerhtml') { error('Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.'); warnedProperties$1[name] = true; return true; } if (lowerCasedName === 'aria') { error('The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.'); warnedProperties$1[name] = true; return true; } if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') { error('Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value); warnedProperties$1[name] = true; return true; } if (typeof value === 'number' && isNaN(value)) { error('Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name); warnedProperties$1[name] = true; return true; } var propertyInfo = getPropertyInfo(name); var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED; // Known attributes should match the casing specified in the property config. if (possibleStandardNames.hasOwnProperty(lowerCasedName)) { var standardName = possibleStandardNames[lowerCasedName]; if (standardName !== name) { error('Invalid DOM property `%s`. Did you mean `%s`?', name, standardName); warnedProperties$1[name] = true; return true; } } else if (!isReserved && name !== lowerCasedName) { // Unknown attributes should have lowercase casing since that's how they // will be cased anyway with server rendering. error('React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName); warnedProperties$1[name] = true; return true; } if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) { if (value) { error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name); } else { error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name); } warnedProperties$1[name] = true; return true; } // Now that we've validated casing, do not validate // data types for reserved props if (isReserved) { return true; } // Warn when a known attribute is a bad type if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) { warnedProperties$1[name] = true; return false; } // Warn when passing the strings 'false' or 'true' into a boolean prop if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) { error('Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value); warnedProperties$1[name] = true; return true; } return true; }; } var warnUnknownProperties = function (type, props, eventRegistry) { { var unknownProps = []; for (var key in props) { var isValid = validateProperty$1(type, key, props[key], eventRegistry); if (!isValid) { unknownProps.push(key); } } var unknownPropString = unknownProps.map(function (prop) { return '`' + prop + '`'; }).join(', '); if (unknownProps.length === 1) { error('Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://reactjs.org/link/attribute-behavior ', unknownPropString, type); } else if (unknownProps.length > 1) { error('Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://reactjs.org/link/attribute-behavior ', unknownPropString, type); } } }; function validateProperties$2(type, props, eventRegistry) { if (isCustomComponent(type, props)) { return; } warnUnknownProperties(type, props, eventRegistry); } var IS_EVENT_HANDLE_NON_MANAGED_NODE = 1; var IS_NON_DELEGATED = 1 << 1; var IS_CAPTURE_PHASE = 1 << 2; // set to LEGACY_FB_SUPPORT. LEGACY_FB_SUPPORT only gets set when // we call willDeferLaterForLegacyFBSupport, thus not bailing out // will result in endless cycles like an infinite loop. // We also don't want to defer during event replaying. var SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS = IS_EVENT_HANDLE_NON_MANAGED_NODE | IS_NON_DELEGATED | IS_CAPTURE_PHASE; // This exists to avoid circular dependency between ReactDOMEventReplaying // and DOMPluginEventSystem. var currentReplayingEvent = null; function setReplayingEvent(event) { { if (currentReplayingEvent !== null) { error('Expected currently replaying event to be null. This error ' + 'is likely caused by a bug in React. Please file an issue.'); } } currentReplayingEvent = event; } function resetReplayingEvent() { { if (currentReplayingEvent === null) { error('Expected currently replaying event to not be null. This error ' + 'is likely caused by a bug in React. Please file an issue.'); } } currentReplayingEvent = null; } function isReplayingEvent(event) { return event === currentReplayingEvent; } /** * Gets the target node from a native browser event by accounting for * inconsistencies in browser DOM APIs. * * @param {object} nativeEvent Native browser event. * @return {DOMEventTarget} Target node. */ function getEventTarget(nativeEvent) { // Fallback to nativeEvent.srcElement for IE9 // https://github.com/facebook/react/issues/12506 var target = nativeEvent.target || nativeEvent.srcElement || window; // Normalize SVG <use> element events #4963 if (target.correspondingUseElement) { target = target.correspondingUseElement; } // Safari may fire events on text nodes (Node.TEXT_NODE is 3). // @see http://www.quirksmode.org/js/events_properties.html return target.nodeType === TEXT_NODE ? target.parentNode : target; } var restoreImpl = null; var restoreTarget = null; var restoreQueue = null; function restoreStateOfTarget(target) { // We perform this translation at the end of the event loop so that we // always receive the correct fiber here var internalInstance = getInstanceFromNode(target); if (!internalInstance) { // Unmounted return; } if (typeof restoreImpl !== 'function') { throw new Error('setRestoreImplementation() needs to be called to handle a target for controlled ' + 'events. This error is likely caused by a bug in React. Please file an issue.'); } var stateNode = internalInstance.stateNode; // Guard against Fiber being unmounted. if (stateNode) { var _props = getFiberCurrentPropsFromNode(stateNode); restoreImpl(internalInstance.stateNode, internalInstance.type, _props); } } function setRestoreImplementation(impl) { restoreImpl = impl; } function enqueueStateRestore(target) { if (restoreTarget) { if (restoreQueue) { restoreQueue.push(target); } else { restoreQueue = [target]; } } else { restoreTarget = target; } } function needsStateRestore() { return restoreTarget !== null || restoreQueue !== null; } function restoreStateIfNeeded() { if (!restoreTarget) { return; } var target = restoreTarget; var queuedTargets = restoreQueue; restoreTarget = null; restoreQueue = null; restoreStateOfTarget(target); if (queuedTargets) { for (var i = 0; i < queuedTargets.length; i++) { restoreStateOfTarget(queuedTargets[i]); } } } // the renderer. Such as when we're dispatching events or if third party // libraries need to call batchedUpdates. Eventually, this API will go away when // everything is batched by default. We'll then have a similar API to opt-out of // scheduled work and instead do synchronous work. // Defaults var batchedUpdatesImpl = function (fn, bookkeeping) { return fn(bookkeeping); }; var flushSyncImpl = function () {}; var isInsideEventHandler = false; function finishEventHandler() { // Here we wait until all updates have propagated, which is important // when using controlled components within layers: // https://github.com/facebook/react/issues/1698 // Then we restore state of any controlled component. var controlledComponentsHavePendingUpdates = needsStateRestore(); if (controlledComponentsHavePendingUpdates) { // If a controlled event was fired, we may need to restore the state of // the DOM node back to the controlled value. This is necessary when React // bails out of the update without touching the DOM. // TODO: Restore state in the microtask, after the discrete updates flush, // instead of early flushing them here. flushSyncImpl(); restoreStateIfNeeded(); } } function batchedUpdates(fn, a, b) { if (isInsideEventHandler) { // If we are currently inside another batch, we need to wait until it // fully completes before restoring state. return fn(a, b); } isInsideEventHandler = true; try { return batchedUpdatesImpl(fn, a, b); } finally { isInsideEventHandler = false; finishEventHandler(); } } // TODO: Replace with flushSync function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushSyncImpl) { batchedUpdatesImpl = _batchedUpdatesImpl; flushSyncImpl = _flushSyncImpl; } function isInteractive(tag) { return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; } function shouldPreventMouseEvent(name, type, props) { switch (name) { case 'onClick': case 'onClickCapture': case 'onDoubleClick': case 'onDoubleClickCapture': case 'onMouseDown': case 'onMouseDownCapture': case 'onMouseMove': case 'onMouseMoveCapture': case 'onMouseUp': case 'onMouseUpCapture': case 'onMouseEnter': return !!(props.disabled && isInteractive(type)); default: return false; } } /** * @param {object} inst The instance, which is the source of events. * @param {string} registrationName Name of listener (e.g. `onClick`). * @return {?function} The stored callback. */ function getListener(inst, registrationName) { var stateNode = inst.stateNode; if (stateNode === null) { // Work in progress (ex: onload events in incremental mode). return null; } var props = getFiberCurrentPropsFromNode(stateNode); if (props === null) { // Work in progress. return null; } var listener = props[registrationName]; if (shouldPreventMouseEvent(registrationName, inst.type, props)) { return null; } if (listener && typeof listener !== 'function') { throw new Error("Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type."); } return listener; } var passiveBrowserEventsSupported = false; // Check if browser support events with passive listeners // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support if (canUseDOM) { try { var options = {}; // $FlowFixMe: Ignore Flow complaining about needing a value Object.defineProperty(options, 'passive', { get: function () { passiveBrowserEventsSupported = true; } }); window.addEventListener('test', options, options); window.removeEventListener('test', options, options); } catch (e) { passiveBrowserEventsSupported = false; } } function invokeGuardedCallbackProd(name, func, context, a, b, c, d, e, f) { var funcArgs = Array.prototype.slice.call(arguments, 3); try { func.apply(context, funcArgs); } catch (error) { this.onError(error); } } var invokeGuardedCallbackImpl = invokeGuardedCallbackProd; { // In DEV mode, we swap out invokeGuardedCallback for a special version // that plays more nicely with the browser's DevTools. The idea is to preserve // "Pause on exceptions" behavior. Because React wraps all user-provided // functions in invokeGuardedCallback, and the production version of // invokeGuardedCallback uses a try-catch, all user exceptions are treated // like caught exceptions, and the DevTools won't pause unless the developer // takes the extra step of enabling pause on caught exceptions. This is // unintuitive, though, because even though React has caught the error, from // the developer's perspective, the error is uncaught. // // To preserve the expected "Pause on exceptions" behavior, we don't use a // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake // DOM node, and call the user-provided callback from inside an event handler // for that fake event. If the callback throws, the error is "captured" using // a global event handler. But because the error happens in a different // event loop context, it does not interrupt the normal program flow. // Effectively, this gives us try-catch behavior without actually using // try-catch. Neat! // Check that the browser supports the APIs we need to implement our special // DEV version of invokeGuardedCallback if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { var fakeNode = document.createElement('react'); invokeGuardedCallbackImpl = function invokeGuardedCallbackDev(name, func, context, a, b, c, d, e, f) { // If document doesn't exist we know for sure we will crash in this method // when we call document.createEvent(). However this can cause confusing // errors: https://github.com/facebook/create-react-app/issues/3482 // So we preemptively throw with a better message instead. if (typeof document === 'undefined' || document === null) { throw new Error('The `document` global was defined when React was initialized, but is not ' + 'defined anymore. This can happen in a test environment if a component ' + 'schedules an update from an asynchronous callback, but the test has already ' + 'finished running. To solve this, you can either unmount the component at ' + 'the end of your test (and ensure that any asynchronous operations get ' + 'canceled in `componentWillUnmount`), or you can change the test itself ' + 'to be asynchronous.'); } var evt = document.createEvent('Event'); var didCall = false; // Keeps track of whether the user-provided callback threw an error. We // set this to true at the beginning, then set it to false right after // calling the function. If the function errors, `didError` will never be // set to false. This strategy works even if the browser is flaky and // fails to call our global error handler, because it doesn't rely on // the error event at all. var didError = true; // Keeps track of the value of window.event so that we can reset it // during the callback to let user code access window.event in the // browsers that support it. var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event // dispatching: https://github.com/facebook/react/issues/13688 var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event'); function restoreAfterDispatch() { // We immediately remove the callback from event listeners so that // nested `invokeGuardedCallback` calls do not clash. Otherwise, a // nested call would trigger the fake event handlers of any call higher // in the stack. fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the // window.event assignment in both IE <= 10 as they throw an error // "Member not found" in strict mode, and in Firefox which does not // support window.event. if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) { window.event = windowEvent; } } // Create an event handler for our fake event. We will synchronously // dispatch our fake event using `dispatchEvent`. Inside the handler, we // call the user-provided callback. var funcArgs = Array.prototype.slice.call(arguments, 3); function callCallback() { didCall = true; restoreAfterDispatch(); func.apply(context, funcArgs); didError = false; } // Create a global error event handler. We use this to capture the value // that was thrown. It's possible that this error handler will fire more // than once; for example, if non-React code also calls `dispatchEvent` // and a handler for that event throws. We should be resilient to most of // those cases. Even if our error event handler fires more than once, the // last error event is always used. If the callback actually does error, // we know that the last error event is the correct one, because it's not // possible for anything else to have happened in between our callback // erroring and the code that follows the `dispatchEvent` call below. If // the callback doesn't error, but the error event was fired, we know to // ignore it because `didError` will be false, as described above. var error; // Use this to track whether the error event is ever called. var didSetError = false; var isCrossOriginError = false; function handleWindowError(event) { error = event.error; didSetError = true; if (error === null && event.colno === 0 && event.lineno === 0) { isCrossOriginError = true; } if (event.defaultPrevented) { // Some other error handler has prevented default. // Browsers silence the error report if this happens. // We'll remember this to later decide whether to log it or not. if (error != null && typeof error === 'object') { try { error._suppressLogging = true; } catch (inner) {// Ignore. } } } } // Create a fake event type. var evtType = "react-" + (name ? name : 'invokeguardedcallback'); // Attach our event handlers window.addEventListener('error', handleWindowError); fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function // errors, it will trigger our global error handler. evt.initEvent(evtType, false, false); fakeNode.dispatchEvent(evt); if (windowEventDescriptor) { Object.defineProperty(window, 'event', windowEventDescriptor); } if (didCall && didError) { if (!didSetError) { // The callback errored, but the error event never fired. // eslint-disable-next-line react-internal/prod-error-codes error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.'); } else if (isCrossOriginError) { // eslint-disable-next-line react-internal/prod-error-codes error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://reactjs.org/link/crossorigin-error for more information.'); } this.onError(error); } // Remove our event listeners window.removeEventListener('error', handleWindowError); if (!didCall) { // Something went really wrong, and our event was not dispatched. // https://github.com/facebook/react/issues/16734 // https://github.com/facebook/react/issues/16585 // Fall back to the production implementation. restoreAfterDispatch(); return invokeGuardedCallbackProd.apply(this, arguments); } }; } } var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl; var hasError = false; var caughtError = null; // Used by event system to capture/rethrow the first error. var hasRethrowError = false; var rethrowError = null; var reporter = { onError: function (error) { hasError = true; caughtError = error; } }; /** * Call a function while guarding against errors that happens within it. * Returns an error if it throws, otherwise null. * * In production, this is implemented using a try-catch. The reason we don't * use a try-catch directly is so that we can swap out a different * implementation in DEV mode. * * @param {String} name of the guard to use for logging or debugging * @param {Function} func The function to invoke * @param {*} context The context to use when calling the function * @param {...*} args Arguments for function */ function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { hasError = false; caughtError = null; invokeGuardedCallbackImpl$1.apply(reporter, arguments); } /** * Same as invokeGuardedCallback, but instead of returning an error, it stores * it in a global so it can be rethrown by `rethrowCaughtError` later. * TODO: See if caughtError and rethrowError can be unified. * * @param {String} name of the guard to use for logging or debugging * @param {Function} func The function to invoke * @param {*} context The context to use when calling the function * @param {...*} args Arguments for function */ function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) { invokeGuardedCallback.apply(this, arguments); if (hasError) { var error = clearCaughtError(); if (!hasRethrowError) { hasRethrowError = true; rethrowError = error; } } } /** * During execution of guarded functions we will capture the first error which * we will rethrow to be handled by the top level error handler. */ function rethrowCaughtError() { if (hasRethrowError) { var error = rethrowError; hasRethrowError = false; rethrowError = null; throw error; } } function hasCaughtError() { return hasError; } function clearCaughtError() { if (hasError) { var error = caughtError; hasError = false; caughtError = null; return error; } else { throw new Error('clearCaughtError was called but no error was captured. This error ' + 'is likely caused by a bug in React. Please file an issue.'); } } var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; var _ReactInternals$Sched = ReactInternals.Scheduler, unstable_cancelCallback = _ReactInternals$Sched.unstable_cancelCallback, unstable_now = _ReactInternals$Sched.unstable_now, unstable_scheduleCallback = _ReactInternals$Sched.unstable_scheduleCallback, unstable_shouldYield = _ReactInternals$Sched.unstable_shouldYield, unstable_requestPaint = _ReactInternals$Sched.unstable_requestPaint, unstable_getFirstCallbackNode = _ReactInternals$Sched.unstable_getFirstCallbackNode, unstable_runWithPriority = _ReactInternals$Sched.unstable_runWithPriority, unstable_next = _ReactInternals$Sched.unstable_next, unstable_continueExecution = _ReactInternals$Sched.unstable_continueExecution, unstable_pauseExecution = _ReactInternals$Sched.unstable_pauseExecution, unstable_getCurrentPriorityLevel = _ReactInternals$Sched.unstable_getCurrentPriorityLevel, unstable_ImmediatePriority = _ReactInternals$Sched.unstable_ImmediatePriority, unstable_UserBlockingPriority = _ReactInternals$Sched.unstable_UserBlockingPriority, unstable_NormalPriority = _ReactInternals$Sched.unstable_NormalPriority, unstable_LowPriority = _ReactInternals$Sched.unstable_LowPriority, unstable_IdlePriority = _ReactInternals$Sched.unstable_IdlePriority, unstable_forceFrameRate = _ReactInternals$Sched.unstable_forceFrameRate, unstable_flushAllWithoutAsserting = _ReactInternals$Sched.unstable_flushAllWithoutAsserting, unstable_yieldValue = _ReactInternals$Sched.unstable_yieldValue, unstable_setDisableYieldValue = _ReactInternals$Sched.unstable_setDisableYieldValue; /** * `ReactInstanceMap` maintains a mapping from a public facing stateful * instance (key) and the internal representation (value). This allows public * methods to accept the user facing instance as an argument and map them back * to internal methods. * * Note that this module is currently shared and assumed to be stateless. * If this becomes an actual Map, that will break. */ function get(key) { return key._reactInternals; } function has(key) { return key._reactInternals !== undefined; } function set(key, value) { key._reactInternals = value; } // Don't change these two values. They're used by React Dev Tools. var NoFlags = /* */ 0; var PerformedWork = /* */ 1; // You can change the rest (and add more). var Placement = /* */ 2; var Update = /* */ 4; var ChildDeletion = /* */ 16; var ContentReset = /* */ 32; var Callback = /* */ 64; var DidCapture = /* */ 128; var ForceClientRender = /* */ 256; var Ref = /* */ 512; var Snapshot = /* */ 1024; var Passive = /* */ 2048; var Hydrating = /* */ 4096; var Visibility = /* */ 8192; var StoreConsistency = /* */ 16384; var LifecycleEffectMask = Passive | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) var HostEffectMask = /* */ 32767; // These are not really side effects, but we still reuse this field. var Incomplete = /* */ 32768; var ShouldCapture = /* */ 65536; var ForceUpdateForLegacySuspense = /* */ 131072; var Forked = /* */ 1048576; // Static tags describe aspects of a fiber that are not specific to a render, // e.g. a fiber uses a passive effect (even if there are no updates on this particular render). // This enables us to defer more work in the unmount case, // since we can defer traversing the tree during layout to look for Passive effects, // and instead rely on the static flag as a signal that there may be cleanup work. var RefStatic = /* */ 2097152; var LayoutStatic = /* */ 4194304; var PassiveStatic = /* */ 8388608; // These flags allow us to traverse to fibers that have effects on mount // without traversing the entire tree after every commit for // double invoking var MountLayoutDev = /* */ 16777216; var MountPassiveDev = /* */ 33554432; // Groups of flags that are used in the commit phase to skip over trees that // don't contain effects, by checking subtreeFlags. var BeforeMutationMask = // TODO: Remove Update flag from before mutation phase by re-landing Visibility // flag logic (see #20043) Update | Snapshot | ( 0); var MutationMask = Placement | Update | ChildDeletion | ContentReset | Ref | Hydrating | Visibility; var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask var PassiveMask = Passive | ChildDeletion; // Union of tags that don't get reset on clones. // This allows certain concepts to persist without recalculating them, // e.g. whether a subtree contains passive effects or portals. var StaticMask = LayoutStatic | PassiveStatic | RefStatic; var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; function getNearestMountedFiber(fiber) { var node = fiber; var nearestMounted = fiber; if (!fiber.alternate) { // If there is no alternate, this might be a new tree that isn't inserted // yet. If it is, then it will have a pending insertion effect on it. var nextNode = node; do { node = nextNode; if ((node.flags & (Placement | Hydrating)) !== NoFlags) { // This is an insertion or in-progress hydration. The nearest possible // mounted fiber is the parent but we need to continue to figure out // if that one is still mounted. nearestMounted = node.return; } nextNode = node.return; } while (nextNode); } else { while (node.return) { node = node.return; } } if (node.tag === HostRoot) { // TODO: Check if this was a nested HostRoot when used with // renderContainerIntoSubtree. return nearestMounted; } // If we didn't hit the root, that means that we're in an disconnected tree // that has been unmounted. return null; } function getSuspenseInstanceFromFiber(fiber) { if (fiber.tag === SuspenseComponent) { var suspenseState = fiber.memoizedState; if (suspenseState === null) { var current = fiber.alternate; if (current !== null) { suspenseState = current.memoizedState; } } if (suspenseState !== null) { return suspenseState.dehydrated; } } return null; } function getContainerFromFiber(fiber) { return fiber.tag === HostRoot ? fiber.stateNode.containerInfo : null; } function isFiberMounted(fiber) { return getNearestMountedFiber(fiber) === fiber; } function isMounted(component) { { var owner = ReactCurrentOwner.current; if (owner !== null && owner.tag === ClassComponent) { var ownerFiber = owner; var instance = ownerFiber.stateNode; if (!instance._warnedAboutRefsInRender) { error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component'); } instance._warnedAboutRefsInRender = true; } } var fiber = get(component); if (!fiber) { return false; } return getNearestMountedFiber(fiber) === fiber; } function assertIsMounted(fiber) { if (getNearestMountedFiber(fiber) !== fiber) { throw new Error('Unable to find node on an unmounted component.'); } } function findCurrentFiberUsingSlowPath(fiber) { var alternate = fiber.alternate; if (!alternate) { // If there is no alternate, then we only need to check if it is mounted. var nearestMounted = getNearestMountedFiber(fiber); if (nearestMounted === null) { throw new Error('Unable to find node on an unmounted component.'); } if (nearestMounted !== fiber) { return null; } return fiber; } // If we have two possible branches, we'll walk backwards up to the root // to see what path the root points to. On the way we may hit one of the // special cases and we'll deal with them. var a = fiber; var b = alternate; while (true) { var parentA = a.return; if (parentA === null) { // We're at the root. break; } var parentB = parentA.alternate; if (parentB === null) { // There is no alternate. This is an unusual case. Currently, it only // happens when a Suspense component is hidden. An extra fragment fiber // is inserted in between the Suspense fiber and its children. Skip // over this extra fragment fiber and proceed to the next parent. var nextParent = parentA.return; if (nextParent !== null) { a = b = nextParent; continue; } // If there's no parent, we're at the root. break; } // If both copies of the parent fiber point to the same child, we can // assume that the child is current. This happens when we bailout on low // priority: the bailed out fiber's child reuses the current child. if (parentA.child === parentB.child) { var child = parentA.child; while (child) { if (child === a) { // We've determined that A is the current branch. assertIsMounted(parentA); return fiber; } if (child === b) { // We've determined that B is the current branch. assertIsMounted(parentA); return alternate; } child = child.sibling; } // We should never have an alternate for any mounting node. So the only // way this could possibly happen is if this was unmounted, if at all. throw new Error('Unable to find node on an unmounted component.'); } if (a.return !== b.return) { // The return pointer of A and the return pointer of B point to different // fibers. We assume that return pointers never criss-cross, so A must // belong to the child set of A.return, and B must belong to the child // set of B.return. a = parentA; b = parentB; } else { // The return pointers point to the same fiber. We'll have to use the // default, slow path: scan the child sets of each parent alternate to see // which child belongs to which set. // // Search parent A's child set var didFindChild = false; var _child = parentA.child; while (_child) { if (_child === a) { didFindChild = true; a = parentA; b = parentB; break; } if (_child === b) { didFindChild = true; b = parentA; a = parentB; break; } _child = _child.sibling; } if (!didFindChild) { // Search parent B's child set _child = parentB.child; while (_child) { if (_child === a) { didFindChild = true; a = parentB; b = parentA; break; } if (_child === b) { didFindChild = true; b = parentB; a = parentA; break; } _child = _child.sibling; } if (!didFindChild) { throw new Error('Child was not found in either parent set. This indicates a bug ' + 'in React related to the return pointer. Please file an issue.'); } } } if (a.alternate !== b) { throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); } } // If the root is not a host container, we're in a disconnected tree. I.e. // unmounted. if (a.tag !== HostRoot) { throw new Error('Unable to find node on an unmounted component.'); } if (a.stateNode.current === a) { // We've determined that A is the current branch. return fiber; } // Otherwise B has to be current branch. return alternate; } function findCurrentHostFiber(parent) { var currentParent = findCurrentFiberUsingSlowPath(parent); return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null; } function findCurrentHostFiberImpl(node) { // Next we'll drill down this component to find the first HostComponent/Text. if (node.tag === HostComponent || node.tag === HostText) { return node; } var child = node.child; while (child !== null) { var match = findCurrentHostFiberImpl(child); if (match !== null) { return match; } child = child.sibling; } return null; } function findCurrentHostFiberWithNoPortals(parent) { var currentParent = findCurrentFiberUsingSlowPath(parent); return currentParent !== null ? findCurrentHostFiberWithNoPortalsImpl(currentParent) : null; } function findCurrentHostFiberWithNoPortalsImpl(node) { // Next we'll drill down this component to find the first HostComponent/Text. if (node.tag === HostComponent || node.tag === HostText) { return node; } var child = node.child; while (child !== null) { if (child.tag !== HostPortal) { var match = findCurrentHostFiberWithNoPortalsImpl(child); if (match !== null) { return match; } } child = child.sibling; } return null; } // This module only exists as an ESM wrapper around the external CommonJS var scheduleCallback = unstable_scheduleCallback; var cancelCallback = unstable_cancelCallback; var shouldYield = unstable_shouldYield; var requestPaint = unstable_requestPaint; var now = unstable_now; var getCurrentPriorityLevel = unstable_getCurrentPriorityLevel; var ImmediatePriority = unstable_ImmediatePriority; var UserBlockingPriority = unstable_UserBlockingPriority; var NormalPriority = unstable_NormalPriority; var LowPriority = unstable_LowPriority; var IdlePriority = unstable_IdlePriority; // this doesn't actually exist on the scheduler, but it *does* // on scheduler/unstable_mock, which we'll need for internal testing var unstable_yieldValue$1 = unstable_yieldValue; var unstable_setDisableYieldValue$1 = unstable_setDisableYieldValue; var rendererID = null; var injectedHook = null; var injectedProfilingHooks = null; var hasLoggedError = false; var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined'; function injectInternals(internals) { if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { // No DevTools return false; } var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; if (hook.isDisabled) { // This isn't a real property on the hook, but it can be set to opt out // of DevTools integration and associated warnings and logs. // https://github.com/facebook/react/issues/3877 return true; } if (!hook.supportsFiber) { { error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://reactjs.org/link/react-devtools'); } // DevTools exists, even though it doesn't support Fiber. return true; } try { if (enableSchedulingProfiler) { // Conditionally inject these hooks only if Timeline profiler is supported by this build. // This gives DevTools a way to feature detect that isn't tied to version number // (since profiling and timeline are controlled by different feature flags). internals = assign({}, internals, { getLaneLabelMap: getLaneLabelMap, injectProfilingHooks: injectProfilingHooks }); } rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. injectedHook = hook; } catch (err) { // Catch all errors because it is unsafe to throw during initialization. { error('React instrumentation encountered an error: %s.', err); } } if (hook.checkDCE) { // This is the real DevTools. return true; } else { // This is likely a hook installed by Fast Refresh runtime. return false; } } function onScheduleRoot(root, children) { { if (injectedHook && typeof injectedHook.onScheduleFiberRoot === 'function') { try { injectedHook.onScheduleFiberRoot(rendererID, root, children); } catch (err) { if ( !hasLoggedError) { hasLoggedError = true; error('React instrumentation encountered an error: %s', err); } } } } } function onCommitRoot(root, eventPriority) { if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') { try { var didError = (root.current.flags & DidCapture) === DidCapture; if (enableProfilerTimer) { var schedulerPriority; switch (eventPriority) { case DiscreteEventPriority: schedulerPriority = ImmediatePriority; break; case ContinuousEventPriority: schedulerPriority = UserBlockingPriority; break; case DefaultEventPriority: schedulerPriority = NormalPriority; break; case IdleEventPriority: schedulerPriority = IdlePriority; break; default: schedulerPriority = NormalPriority; break; } injectedHook.onCommitFiberRoot(rendererID, root, schedulerPriority, didError); } else { injectedHook.onCommitFiberRoot(rendererID, root, undefined, didError); } } catch (err) { { if (!hasLoggedError) { hasLoggedError = true; error('React instrumentation encountered an error: %s', err); } } } } } function onPostCommitRoot(root) { if (injectedHook && typeof injectedHook.onPostCommitFiberRoot === 'function') { try { injectedHook.onPostCommitFiberRoot(rendererID, root); } catch (err) { { if (!hasLoggedError) { hasLoggedError = true; error('React instrumentation encountered an error: %s', err); } } } } } function onCommitUnmount(fiber) { if (injectedHook && typeof injectedHook.onCommitFiberUnmount === 'function') { try { injectedHook.onCommitFiberUnmount(rendererID, fiber); } catch (err) { { if (!hasLoggedError) { hasLoggedError = true; error('React instrumentation encountered an error: %s', err); } } } } } function setIsStrictModeForDevtools(newIsStrictMode) { { if (typeof unstable_yieldValue$1 === 'function') { // We're in a test because Scheduler.unstable_yieldValue only exists // in SchedulerMock. To reduce the noise in strict mode tests, // suppress warnings and disable scheduler yielding during the double render unstable_setDisableYieldValue$1(newIsStrictMode); setSuppressWarning(newIsStrictMode); } if (injectedHook && typeof injectedHook.setStrictMode === 'function') { try { injectedHook.setStrictMode(rendererID, newIsStrictMode); } catch (err) { { if (!hasLoggedError) { hasLoggedError = true; error('React instrumentation encountered an error: %s', err); } } } } } } // Profiler API hooks function injectProfilingHooks(profilingHooks) { injectedProfilingHooks = profilingHooks; } function getLaneLabelMap() { { var map = new Map(); var lane = 1; for (var index = 0; index < TotalLanes; index++) { var label = getLabelForLane(lane); map.set(lane, label); lane *= 2; } return map; } } function markCommitStarted(lanes) { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStarted === 'function') { injectedProfilingHooks.markCommitStarted(lanes); } } } function markCommitStopped() { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStopped === 'function') { injectedProfilingHooks.markCommitStopped(); } } } function markComponentRenderStarted(fiber) { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStarted === 'function') { injectedProfilingHooks.markComponentRenderStarted(fiber); } } } function markComponentRenderStopped() { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStopped === 'function') { injectedProfilingHooks.markComponentRenderStopped(); } } } function markComponentPassiveEffectMountStarted(fiber) { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted === 'function') { injectedProfilingHooks.markComponentPassiveEffectMountStarted(fiber); } } } function markComponentPassiveEffectMountStopped() { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped === 'function') { injectedProfilingHooks.markComponentPassiveEffectMountStopped(); } } } function markComponentPassiveEffectUnmountStarted(fiber) { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted === 'function') { injectedProfilingHooks.markComponentPassiveEffectUnmountStarted(fiber); } } } function markComponentPassiveEffectUnmountStopped() { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped === 'function') { injectedProfilingHooks.markComponentPassiveEffectUnmountStopped(); } } } function markComponentLayoutEffectMountStarted(fiber) { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted === 'function') { injectedProfilingHooks.markComponentLayoutEffectMountStarted(fiber); } } } function markComponentLayoutEffectMountStopped() { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped === 'function') { injectedProfilingHooks.markComponentLayoutEffectMountStopped(); } } } function markComponentLayoutEffectUnmountStarted(fiber) { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted === 'function') { injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber); } } } function markComponentLayoutEffectUnmountStopped() { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped === 'function') { injectedProfilingHooks.markComponentLayoutEffectUnmountStopped(); } } } function markComponentErrored(fiber, thrownValue, lanes) { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentErrored === 'function') { injectedProfilingHooks.markComponentErrored(fiber, thrownValue, lanes); } } } function markComponentSuspended(fiber, wakeable, lanes) { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentSuspended === 'function') { injectedProfilingHooks.markComponentSuspended(fiber, wakeable, lanes); } } } function markLayoutEffectsStarted(lanes) { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStarted === 'function') { injectedProfilingHooks.markLayoutEffectsStarted(lanes); } } } function markLayoutEffectsStopped() { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStopped === 'function') { injectedProfilingHooks.markLayoutEffectsStopped(); } } } function markPassiveEffectsStarted(lanes) { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStarted === 'function') { injectedProfilingHooks.markPassiveEffectsStarted(lanes); } } } function markPassiveEffectsStopped() { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStopped === 'function') { injectedProfilingHooks.markPassiveEffectsStopped(); } } } function markRenderStarted(lanes) { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStarted === 'function') { injectedProfilingHooks.markRenderStarted(lanes); } } } function markRenderYielded() { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderYielded === 'function') { injectedProfilingHooks.markRenderYielded(); } } } function markRenderStopped() { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStopped === 'function') { injectedProfilingHooks.markRenderStopped(); } } } function markRenderScheduled(lane) { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderScheduled === 'function') { injectedProfilingHooks.markRenderScheduled(lane); } } } function markForceUpdateScheduled(fiber, lane) { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markForceUpdateScheduled === 'function') { injectedProfilingHooks.markForceUpdateScheduled(fiber, lane); } } } function markStateUpdateScheduled(fiber, lane) { { if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markStateUpdateScheduled === 'function') { injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); } } } var NoMode = /* */ 0; // TODO: Remove ConcurrentMode by reading from the root tag instead var ConcurrentMode = /* */ 1; var ProfileMode = /* */ 2; var StrictLegacyMode = /* */ 8; var StrictEffectsMode = /* */ 16; // TODO: This is pretty well supported by browsers. Maybe we can drop it. var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. // Based on: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 var log = Math.log; var LN2 = Math.LN2; function clz32Fallback(x) { var asUint = x >>> 0; if (asUint === 0) { return 32; } return 31 - (log(asUint) / LN2 | 0) | 0; } // If those values are changed that package should be rebuilt and redeployed. var TotalLanes = 31; var NoLanes = /* */ 0; var NoLane = /* */ 0; var SyncLane = /* */ 1; var InputContinuousHydrationLane = /* */ 2; var InputContinuousLane = /* */ 4; var DefaultHydrationLane = /* */ 8; var DefaultLane = /* */ 16; var TransitionHydrationLane = /* */ 32; var TransitionLanes = /* */ 4194240; var TransitionLane1 = /* */ 64; var TransitionLane2 = /* */ 128; var TransitionLane3 = /* */ 256; var TransitionLane4 = /* */ 512; var TransitionLane5 = /* */ 1024; var TransitionLane6 = /* */ 2048; var TransitionLane7 = /* */ 4096; var TransitionLane8 = /* */ 8192; var TransitionLane9 = /* */ 16384; var TransitionLane10 = /* */ 32768; var TransitionLane11 = /* */ 65536; var TransitionLane12 = /* */ 131072; var TransitionLane13 = /* */ 262144; var TransitionLane14 = /* */ 524288; var TransitionLane15 = /* */ 1048576; var TransitionLane16 = /* */ 2097152; var RetryLanes = /* */ 130023424; var RetryLane1 = /* */ 4194304; var RetryLane2 = /* */ 8388608; var RetryLane3 = /* */ 16777216; var RetryLane4 = /* */ 33554432; var RetryLane5 = /* */ 67108864; var SomeRetryLane = RetryLane1; var SelectiveHydrationLane = /* */ 134217728; var NonIdleLanes = /* */ 268435455; var IdleHydrationLane = /* */ 268435456; var IdleLane = /* */ 536870912; var OffscreenLane = /* */ 1073741824; // This function is used for the experimental timeline (react-devtools-timeline) // It should be kept in sync with the Lanes values above. function getLabelForLane(lane) { { if (lane & SyncLane) { return 'Sync'; } if (lane & InputContinuousHydrationLane) { return 'InputContinuousHydration'; } if (lane & InputContinuousLane) { return 'InputContinuous'; } if (lane & DefaultHydrationLane) { return 'DefaultHydration'; } if (lane & DefaultLane) { return 'Default'; } if (lane & TransitionHydrationLane) { return 'TransitionHydration'; } if (lane & TransitionLanes) { return 'Transition'; } if (lane & RetryLanes) { return 'Retry'; } if (lane & SelectiveHydrationLane) { return 'SelectiveHydration'; } if (lane & IdleHydrationLane) { return 'IdleHydration'; } if (lane & IdleLane) { return 'Idle'; } if (lane & OffscreenLane) { return 'Offscreen'; } } } var NoTimestamp = -1; var nextTransitionLane = TransitionLane1; var nextRetryLane = RetryLane1; function getHighestPriorityLanes(lanes) { switch (getHighestPriorityLane(lanes)) { case SyncLane: return SyncLane; case InputContinuousHydrationLane: return InputContinuousHydrationLane; case InputContinuousLane: return InputContinuousLane; case DefaultHydrationLane: return DefaultHydrationLane; case DefaultLane: return DefaultLane; case TransitionHydrationLane: return TransitionHydrationLane; case TransitionLane1: case TransitionLane2: case TransitionLane3: case TransitionLane4: case TransitionLane5: case TransitionLane6: case TransitionLane7: case TransitionLane8: case TransitionLane9: case TransitionLane10: case TransitionLane11: case TransitionLane12: case TransitionLane13: case TransitionLane14: case TransitionLane15: case TransitionLane16: return lanes & TransitionLanes; case RetryLane1: case RetryLane2: case RetryLane3: case RetryLane4: case RetryLane5: return lanes & RetryLanes; case SelectiveHydrationLane: return SelectiveHydrationLane; case IdleHydrationLane: return IdleHydrationLane; case IdleLane: return IdleLane; case OffscreenLane: return OffscreenLane; default: { error('Should have found matching lanes. This is a bug in React.'); } // This shouldn't be reachable, but as a fallback, return the entire bitmask. return lanes; } } function getNextLanes(root, wipLanes) { // Early bailout if there's no pending work left. var pendingLanes = root.pendingLanes; if (pendingLanes === NoLanes) { return NoLanes; } var nextLanes = NoLanes; var suspendedLanes = root.suspendedLanes; var pingedLanes = root.pingedLanes; // Do not work on any idle work until all the non-idle work has finished, // even if the work is suspended. var nonIdlePendingLanes = pendingLanes & NonIdleLanes; if (nonIdlePendingLanes !== NoLanes) { var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; if (nonIdleUnblockedLanes !== NoLanes) { nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); } else { var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; if (nonIdlePingedLanes !== NoLanes) { nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); } } } else { // The only remaining work is Idle. var unblockedLanes = pendingLanes & ~suspendedLanes; if (unblockedLanes !== NoLanes) { nextLanes = getHighestPriorityLanes(unblockedLanes); } else { if (pingedLanes !== NoLanes) { nextLanes = getHighestPriorityLanes(pingedLanes); } } } if (nextLanes === NoLanes) { // This should only be reachable if we're suspended // TODO: Consider warning in this path if a fallback timer is not scheduled. return NoLanes; } // If we're already in the middle of a render, switching lanes will interrupt // it and we'll lose our progress. We should only do this if the new lanes are // higher priority. if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't // bother waiting until the root is complete. (wipLanes & suspendedLanes) === NoLanes) { var nextLane = getHighestPriorityLane(nextLanes); var wipLane = getHighestPriorityLane(wipLanes); if ( // Tests whether the next lane is equal or lower priority than the wip // one. This works because the bits decrease in priority as you go left. nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The // only difference between default updates and transition updates is that // default updates do not support refresh transitions. nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) { // Keep working on the existing in-progress tree. Do not interrupt. return wipLanes; } } if ((nextLanes & InputContinuousLane) !== NoLanes) { // When updates are sync by default, we entangle continuous priority updates // and default updates, so they render in the same batch. The only reason // they use separate lanes is because continuous updates should interrupt // transitions, but default updates should not. nextLanes |= pendingLanes & DefaultLane; } // Check for entangled lanes and add them to the batch. // // A lane is said to be entangled with another when it's not allowed to render // in a batch that does not also include the other lane. Typically we do this // when multiple updates have the same source, and we only want to respond to // the most recent event from that source. // // Note that we apply entanglements *after* checking for partial work above. // This means that if a lane is entangled during an interleaved event while // it's already rendering, we won't interrupt it. This is intentional, since // entanglement is usually "best effort": we'll try our best to render the // lanes in the same batch, but it's not worth throwing out partially // completed work in order to do it. // TODO: Reconsider this. The counter-argument is that the partial work // represents an intermediate state, which we don't want to show to the user. // And by spending extra time finishing it, we're increasing the amount of // time it takes to show the final state, which is what they are actually // waiting for. // // For those exceptions where entanglement is semantically important, like // useMutableSource, we should ensure that there is no partial work at the // time we apply the entanglement. var entangledLanes = root.entangledLanes; if (entangledLanes !== NoLanes) { var entanglements = root.entanglements; var lanes = nextLanes & entangledLanes; while (lanes > 0) { var index = pickArbitraryLaneIndex(lanes); var lane = 1 << index; nextLanes |= entanglements[index]; lanes &= ~lane; } } return nextLanes; } function getMostRecentEventTime(root, lanes) { var eventTimes = root.eventTimes; var mostRecentEventTime = NoTimestamp; while (lanes > 0) { var index = pickArbitraryLaneIndex(lanes); var lane = 1 << index; var eventTime = eventTimes[index]; if (eventTime > mostRecentEventTime) { mostRecentEventTime = eventTime; } lanes &= ~lane; } return mostRecentEventTime; } function computeExpirationTime(lane, currentTime) { switch (lane) { case SyncLane: case InputContinuousHydrationLane: case InputContinuousLane: // User interactions should expire slightly more quickly. // // NOTE: This is set to the corresponding constant as in Scheduler.js. // When we made it larger, a product metric in www regressed, suggesting // there's a user interaction that's being starved by a series of // synchronous updates. If that theory is correct, the proper solution is // to fix the starvation. However, this scenario supports the idea that // expiration times are an important safeguard when starvation // does happen. return currentTime + 250; case DefaultHydrationLane: case DefaultLane: case TransitionHydrationLane: case TransitionLane1: case TransitionLane2: case TransitionLane3: case TransitionLane4: case TransitionLane5: case TransitionLane6: case TransitionLane7: case TransitionLane8: case TransitionLane9: case TransitionLane10: case TransitionLane11: case TransitionLane12: case TransitionLane13: case TransitionLane14: case TransitionLane15: case TransitionLane16: return currentTime + 5000; case RetryLane1: case RetryLane2: case RetryLane3: case RetryLane4: case RetryLane5: // TODO: Retries should be allowed to expire if they are CPU bound for // too long, but when I made this change it caused a spike in browser // crashes. There must be some other underlying bug; not super urgent but // ideally should figure out why and fix it. Unfortunately we don't have // a repro for the crashes, only detected via production metrics. return NoTimestamp; case SelectiveHydrationLane: case IdleHydrationLane: case IdleLane: case OffscreenLane: // Anything idle priority or lower should never expire. return NoTimestamp; default: { error('Should have found matching lanes. This is a bug in React.'); } return NoTimestamp; } } function markStarvedLanesAsExpired(root, currentTime) { // TODO: This gets called every time we yield. We can optimize by storing // the earliest expiration time on the root. Then use that to quickly bail out // of this function. var pendingLanes = root.pendingLanes; var suspendedLanes = root.suspendedLanes; var pingedLanes = root.pingedLanes; var expirationTimes = root.expirationTimes; // Iterate through the pending lanes and check if we've reached their // expiration time. If so, we'll assume the update is being starved and mark // it as expired to force it to finish. var lanes = pendingLanes; while (lanes > 0) { var index = pickArbitraryLaneIndex(lanes); var lane = 1 << index; var expirationTime = expirationTimes[index]; if (expirationTime === NoTimestamp) { // Found a pending lane with no expiration time. If it's not suspended, or // if it's pinged, assume it's CPU-bound. Compute a new expiration time // using the current time. if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) { // Assumes timestamps are monotonically increasing. expirationTimes[index] = computeExpirationTime(lane, currentTime); } } else if (expirationTime <= currentTime) { // This lane expired root.expiredLanes |= lane; } lanes &= ~lane; } } // This returns the highest priority pending lanes regardless of whether they // are suspended. function getHighestPriorityPendingLanes(root) { return getHighestPriorityLanes(root.pendingLanes); } function getLanesToRetrySynchronouslyOnError(root) { var everythingButOffscreen = root.pendingLanes & ~OffscreenLane; if (everythingButOffscreen !== NoLanes) { return everythingButOffscreen; } if (everythingButOffscreen & OffscreenLane) { return OffscreenLane; } return NoLanes; } function includesSyncLane(lanes) { return (lanes & SyncLane) !== NoLanes; } function includesNonIdleWork(lanes) { return (lanes & NonIdleLanes) !== NoLanes; } function includesOnlyRetries(lanes) { return (lanes & RetryLanes) === lanes; } function includesOnlyNonUrgentLanes(lanes) { var UrgentLanes = SyncLane | InputContinuousLane | DefaultLane; return (lanes & UrgentLanes) === NoLanes; } function includesOnlyTransitions(lanes) { return (lanes & TransitionLanes) === lanes; } function includesBlockingLane(root, lanes) { var SyncDefaultLanes = InputContinuousHydrationLane | InputContinuousLane | DefaultHydrationLane | DefaultLane; return (lanes & SyncDefaultLanes) !== NoLanes; } function includesExpiredLane(root, lanes) { // This is a separate check from includesBlockingLane because a lane can // expire after a render has already started. return (lanes & root.expiredLanes) !== NoLanes; } function isTransitionLane(lane) { return (lane & TransitionLanes) !== NoLanes; } function claimNextTransitionLane() { // Cycle through the lanes, assigning each new transition to the next lane. // In most cases, this means every transition gets its own lane, until we // run out of lanes and cycle back to the beginning. var lane = nextTransitionLane; nextTransitionLane <<= 1; if ((nextTransitionLane & TransitionLanes) === NoLanes) { nextTransitionLane = TransitionLane1; } return lane; } function claimNextRetryLane() { var lane = nextRetryLane; nextRetryLane <<= 1; if ((nextRetryLane & RetryLanes) === NoLanes) { nextRetryLane = RetryLane1; } return lane; } function getHighestPriorityLane(lanes) { return lanes & -lanes; } function pickArbitraryLane(lanes) { // This wrapper function gets inlined. Only exists so to communicate that it // doesn't matter which bit is selected; you can pick any bit without // affecting the algorithms where its used. Here I'm using // getHighestPriorityLane because it requires the fewest operations. return getHighestPriorityLane(lanes); } function pickArbitraryLaneIndex(lanes) { return 31 - clz32(lanes); } function laneToIndex(lane) { return pickArbitraryLaneIndex(lane); } function includesSomeLane(a, b) { return (a & b) !== NoLanes; } function isSubsetOfLanes(set, subset) { return (set & subset) === subset; } function mergeLanes(a, b) { return a | b; } function removeLanes(set, subset) { return set & ~subset; } function intersectLanes(a, b) { return a & b; } // Seems redundant, but it changes the type from a single lane (used for // updates) to a group of lanes (used for flushing work). function laneToLanes(lane) { return lane; } function higherPriorityLane(a, b) { // This works because the bit ranges decrease in priority as you go left. return a !== NoLane && a < b ? a : b; } function createLaneMap(initial) { // Intentionally pushing one by one. // https://v8.dev/blog/elements-kinds#avoid-creating-holes var laneMap = []; for (var i = 0; i < TotalLanes; i++) { laneMap.push(initial); } return laneMap; } function markRootUpdated(root, updateLane, eventTime) { root.pendingLanes |= updateLane; // If there are any suspended transitions, it's possible this new update // could unblock them. Clear the suspended lanes so that we can try rendering // them again. // // TODO: We really only need to unsuspend only lanes that are in the // `subtreeLanes` of the updated fiber, or the update lanes of the return // path. This would exclude suspended updates in an unrelated sibling tree, // since there's no way for this update to unblock it. // // We don't do this if the incoming update is idle, because we never process // idle updates until after all the regular updates have finished; there's no // way it could unblock a transition. if (updateLane !== IdleLane) { root.suspendedLanes = NoLanes; root.pingedLanes = NoLanes; } var eventTimes = root.eventTimes; var index = laneToIndex(updateLane); // We can always overwrite an existing timestamp because we prefer the most // recent event, and we assume time is monotonically increasing. eventTimes[index] = eventTime; } function markRootSuspended(root, suspendedLanes) { root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. var expirationTimes = root.expirationTimes; var lanes = suspendedLanes; while (lanes > 0) { var index = pickArbitraryLaneIndex(lanes); var lane = 1 << index; expirationTimes[index] = NoTimestamp; lanes &= ~lane; } } function markRootPinged(root, pingedLanes, eventTime) { root.pingedLanes |= root.suspendedLanes & pingedLanes; } function markRootFinished(root, remainingLanes) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; // Let's try everything again root.suspendedLanes = NoLanes; root.pingedLanes = NoLanes; root.expiredLanes &= remainingLanes; root.mutableReadLanes &= remainingLanes; root.entangledLanes &= remainingLanes; var entanglements = root.entanglements; var eventTimes = root.eventTimes; var expirationTimes = root.expirationTimes; // Clear the lanes that no longer have pending work var lanes = noLongerPendingLanes; while (lanes > 0) { var index = pickArbitraryLaneIndex(lanes); var lane = 1 << index; entanglements[index] = NoLanes; eventTimes[index] = NoTimestamp; expirationTimes[index] = NoTimestamp; lanes &= ~lane; } } function markRootEntangled(root, entangledLanes) { // In addition to entangling each of the given lanes with each other, we also // have to consider _transitive_ entanglements. For each lane that is already // entangled with *any* of the given lanes, that lane is now transitively // entangled with *all* the given lanes. // // Translated: If C is entangled with A, then entangling A with B also // entangles C with B. // // If this is hard to grasp, it might help to intentionally break this // function and look at the tests that fail in ReactTransition-test.js. Try // commenting out one of the conditions below. var rootEntangledLanes = root.entangledLanes |= entangledLanes; var entanglements = root.entanglements; var lanes = rootEntangledLanes; while (lanes) { var index = pickArbitraryLaneIndex(lanes); var lane = 1 << index; if ( // Is this one of the newly entangled lanes? lane & entangledLanes | // Is this lane transitively entangled with the newly entangled lanes? entanglements[index] & entangledLanes) { entanglements[index] |= entangledLanes; } lanes &= ~lane; } } function getBumpedLaneForHydration(root, renderLanes) { var renderLane = getHighestPriorityLane(renderLanes); var lane; switch (renderLane) { case InputContinuousLane: lane = InputContinuousHydrationLane; break; case DefaultLane: lane = DefaultHydrationLane; break; case TransitionLane1: case TransitionLane2: case TransitionLane3: case TransitionLane4: case TransitionLane5: case TransitionLane6: case TransitionLane7: case TransitionLane8: case TransitionLane9: case TransitionLane10: case TransitionLane11: case TransitionLane12: case TransitionLane13: case TransitionLane14: case TransitionLane15: case TransitionLane16: case RetryLane1: case RetryLane2: case RetryLane3: case RetryLane4: case RetryLane5: lane = TransitionHydrationLane; break; case IdleLane: lane = IdleHydrationLane; break; default: // Everything else is already either a hydration lane, or shouldn't // be retried at a hydration lane. lane = NoLane; break; } // Check if the lane we chose is suspended. If so, that indicates that we // already attempted and failed to hydrate at that level. Also check if we're // already rendering that lane, which is rare but could happen. if ((lane & (root.suspendedLanes | renderLanes)) !== NoLane) { // Give up trying to hydrate and fall back to client render. return NoLane; } return lane; } function addFiberToLanesMap(root, fiber, lanes) { if (!isDevToolsPresent) { return; } var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap; while (lanes > 0) { var index = laneToIndex(lanes); var lane = 1 << index; var updaters = pendingUpdatersLaneMap[index]; updaters.add(fiber); lanes &= ~lane; } } function movePendingFibersToMemoized(root, lanes) { if (!isDevToolsPresent) { return; } var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap; var memoizedUpdaters = root.memoizedUpdaters; while (lanes > 0) { var index = laneToIndex(lanes); var lane = 1 << index; var updaters = pendingUpdatersLaneMap[index]; if (updaters.size > 0) { updaters.forEach(function (fiber) { var alternate = fiber.alternate; if (alternate === null || !memoizedUpdaters.has(alternate)) { memoizedUpdaters.add(fiber); } }); updaters.clear(); } lanes &= ~lane; } } function getTransitionsForLanes(root, lanes) { { return null; } } var DiscreteEventPriority = SyncLane; var ContinuousEventPriority = InputContinuousLane; var DefaultEventPriority = DefaultLane; var IdleEventPriority = IdleLane; var currentUpdatePriority = NoLane; function getCurrentUpdatePriority() { return currentUpdatePriority; } function setCurrentUpdatePriority(newPriority) { currentUpdatePriority = newPriority; } function runWithPriority(priority, fn) { var previousPriority = currentUpdatePriority; try { currentUpdatePriority = priority; return fn(); } finally { currentUpdatePriority = previousPriority; } } function higherEventPriority(a, b) { return a !== 0 && a < b ? a : b; } function lowerEventPriority(a, b) { return a === 0 || a > b ? a : b; } function isHigherEventPriority(a, b) { return a !== 0 && a < b; } function lanesToEventPriority(lanes) { var lane = getHighestPriorityLane(lanes); if (!isHigherEventPriority(DiscreteEventPriority, lane)) { return DiscreteEventPriority; } if (!isHigherEventPriority(ContinuousEventPriority, lane)) { return ContinuousEventPriority; } if (includesNonIdleWork(lane)) { return DefaultEventPriority; } return IdleEventPriority; } // This is imported by the event replaying implementation in React DOM. It's // in a separate file to break a circular dependency between the renderer and // the reconciler. function isRootDehydrated(root) { var currentState = root.current.memoizedState; return currentState.isDehydrated; } var _attemptSynchronousHydration; function setAttemptSynchronousHydration(fn) { _attemptSynchronousHydration = fn; } function attemptSynchronousHydration(fiber) { _attemptSynchronousHydration(fiber); } var attemptContinuousHydration; function setAttemptContinuousHydration(fn) { attemptContinuousHydration = fn; } var attemptHydrationAtCurrentPriority; function setAttemptHydrationAtCurrentPriority(fn) { attemptHydrationAtCurrentPriority = fn; } var getCurrentUpdatePriority$1; function setGetCurrentUpdatePriority(fn) { getCurrentUpdatePriority$1 = fn; } var attemptHydrationAtPriority; function setAttemptHydrationAtPriority(fn) { attemptHydrationAtPriority = fn; } // TODO: Upgrade this definition once we're on a newer version of Flow that // has this definition built-in. var hasScheduledReplayAttempt = false; // The queue of discrete events to be replayed. var queuedDiscreteEvents = []; // Indicates if any continuous event targets are non-null for early bailout. // if the last target was dehydrated. var queuedFocus = null; var queuedDrag = null; var queuedMouse = null; // For pointer events there can be one latest event per pointerId. var queuedPointers = new Map(); var queuedPointerCaptures = new Map(); // We could consider replaying selectionchange and touchmoves too. var queuedExplicitHydrationTargets = []; var discreteReplayableEvents = ['mousedown', 'mouseup', 'touchcancel', 'touchend', 'touchstart', 'auxclick', 'dblclick', 'pointercancel', 'pointerdown', 'pointerup', 'dragend', 'dragstart', 'drop', 'compositionend', 'compositionstart', 'keydown', 'keypress', 'keyup', 'input', 'textInput', // Intentionally camelCase 'copy', 'cut', 'paste', 'click', 'change', 'contextmenu', 'reset', 'submit']; function isDiscreteEventThatRequiresHydration(eventType) { return discreteReplayableEvents.indexOf(eventType) > -1; } function createQueuedReplayableEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) { return { blockedOn: blockedOn, domEventName: domEventName, eventSystemFlags: eventSystemFlags, nativeEvent: nativeEvent, targetContainers: [targetContainer] }; } function clearIfContinuousEvent(domEventName, nativeEvent) { switch (domEventName) { case 'focusin': case 'focusout': queuedFocus = null; break; case 'dragenter': case 'dragleave': queuedDrag = null; break; case 'mouseover': case 'mouseout': queuedMouse = null; break; case 'pointerover': case 'pointerout': { var pointerId = nativeEvent.pointerId; queuedPointers.delete(pointerId); break; } case 'gotpointercapture': case 'lostpointercapture': { var _pointerId = nativeEvent.pointerId; queuedPointerCaptures.delete(_pointerId); break; } } } function accumulateOrCreateContinuousQueuedReplayableEvent(existingQueuedEvent, blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) { if (existingQueuedEvent === null || existingQueuedEvent.nativeEvent !== nativeEvent) { var queuedEvent = createQueuedReplayableEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent); if (blockedOn !== null) { var _fiber2 = getInstanceFromNode(blockedOn); if (_fiber2 !== null) { // Attempt to increase the priority of this target. attemptContinuousHydration(_fiber2); } } return queuedEvent; } // If we have already queued this exact event, then it's because // the different event systems have different DOM event listeners. // We can accumulate the flags, and the targetContainers, and // store a single event to be replayed. existingQueuedEvent.eventSystemFlags |= eventSystemFlags; var targetContainers = existingQueuedEvent.targetContainers; if (targetContainer !== null && targetContainers.indexOf(targetContainer) === -1) { targetContainers.push(targetContainer); } return existingQueuedEvent; } function queueIfContinuousEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) { // These set relatedTarget to null because the replayed event will be treated as if we // moved from outside the window (no target) onto the target once it hydrates. // Instead of mutating we could clone the event. switch (domEventName) { case 'focusin': { var focusEvent = nativeEvent; queuedFocus = accumulateOrCreateContinuousQueuedReplayableEvent(queuedFocus, blockedOn, domEventName, eventSystemFlags, targetContainer, focusEvent); return true; } case 'dragenter': { var dragEvent = nativeEvent; queuedDrag = accumulateOrCreateContinuousQueuedReplayableEvent(queuedDrag, blockedOn, domEventName, eventSystemFlags, targetContainer, dragEvent); return true; } case 'mouseover': { var mouseEvent = nativeEvent; queuedMouse = accumulateOrCreateContinuousQueuedReplayableEvent(queuedMouse, blockedOn, domEventName, eventSystemFlags, targetContainer, mouseEvent); return true; } case 'pointerover': { var pointerEvent = nativeEvent; var pointerId = pointerEvent.pointerId; queuedPointers.set(pointerId, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointers.get(pointerId) || null, blockedOn, domEventName, eventSystemFlags, targetContainer, pointerEvent)); return true; } case 'gotpointercapture': { var _pointerEvent = nativeEvent; var _pointerId2 = _pointerEvent.pointerId; queuedPointerCaptures.set(_pointerId2, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointerCaptures.get(_pointerId2) || null, blockedOn, domEventName, eventSystemFlags, targetContainer, _pointerEvent)); return true; } } return false; } // Check if this target is unblocked. Returns true if it's unblocked. function attemptExplicitHydrationTarget(queuedTarget) { // TODO: This function shares a lot of logic with findInstanceBlockingEvent. // Try to unify them. It's a bit tricky since it would require two return // values. var targetInst = getClosestInstanceFromNode(queuedTarget.target); if (targetInst !== null) { var nearestMounted = getNearestMountedFiber(targetInst); if (nearestMounted !== null) { var tag = nearestMounted.tag; if (tag === SuspenseComponent) { var instance = getSuspenseInstanceFromFiber(nearestMounted); if (instance !== null) { // We're blocked on hydrating this boundary. // Increase its priority. queuedTarget.blockedOn = instance; attemptHydrationAtPriority(queuedTarget.priority, function () { attemptHydrationAtCurrentPriority(nearestMounted); }); return; } } else if (tag === HostRoot) { var root = nearestMounted.stateNode; if (isRootDehydrated(root)) { queuedTarget.blockedOn = getContainerFromFiber(nearestMounted); // We don't currently have a way to increase the priority of // a root other than sync. return; } } } } queuedTarget.blockedOn = null; } function queueExplicitHydrationTarget(target) { // TODO: This will read the priority if it's dispatched by the React // event system but not native events. Should read window.event.type, like // we do for updates (getCurrentEventPriority). var updatePriority = getCurrentUpdatePriority$1(); var queuedTarget = { blockedOn: null, target: target, priority: updatePriority }; var i = 0; for (; i < queuedExplicitHydrationTargets.length; i++) { // Stop once we hit the first target with lower priority than if (!isHigherEventPriority(updatePriority, queuedExplicitHydrationTargets[i].priority)) { break; } } queuedExplicitHydrationTargets.splice(i, 0, queuedTarget); if (i === 0) { attemptExplicitHydrationTarget(queuedTarget); } } function attemptReplayContinuousQueuedEvent(queuedEvent) { if (queuedEvent.blockedOn !== null) { return false; } var targetContainers = queuedEvent.targetContainers; while (targetContainers.length > 0) { var targetContainer = targetContainers[0]; var nextBlockedOn = findInstanceBlockingEvent(queuedEvent.domEventName, queuedEvent.eventSystemFlags, targetContainer, queuedEvent.nativeEvent); if (nextBlockedOn === null) { { var nativeEvent = queuedEvent.nativeEvent; var nativeEventClone = new nativeEvent.constructor(nativeEvent.type, nativeEvent); setReplayingEvent(nativeEventClone); nativeEvent.target.dispatchEvent(nativeEventClone); resetReplayingEvent(); } } else { // We're still blocked. Try again later. var _fiber3 = getInstanceFromNode(nextBlockedOn); if (_fiber3 !== null) { attemptContinuousHydration(_fiber3); } queuedEvent.blockedOn = nextBlockedOn; return false; } // This target container was successfully dispatched. Try the next. targetContainers.shift(); } return true; } function attemptReplayContinuousQueuedEventInMap(queuedEvent, key, map) { if (attemptReplayContinuousQueuedEvent(queuedEvent)) { map.delete(key); } } function replayUnblockedEvents() { hasScheduledReplayAttempt = false; if (queuedFocus !== null && attemptReplayContinuousQueuedEvent(queuedFocus)) { queuedFocus = null; } if (queuedDrag !== null && attemptReplayContinuousQueuedEvent(queuedDrag)) { queuedDrag = null; } if (queuedMouse !== null && attemptReplayContinuousQueuedEvent(queuedMouse)) { queuedMouse = null; } queuedPointers.forEach(attemptReplayContinuousQueuedEventInMap); queuedPointerCaptures.forEach(attemptReplayContinuousQueuedEventInMap); } function scheduleCallbackIfUnblocked(queuedEvent, unblocked) { if (queuedEvent.blockedOn === unblocked) { queuedEvent.blockedOn = null; if (!hasScheduledReplayAttempt) { hasScheduledReplayAttempt = true; // Schedule a callback to attempt replaying as many events as are // now unblocked. This first might not actually be unblocked yet. // We could check it early to avoid scheduling an unnecessary callback. unstable_scheduleCallback(unstable_NormalPriority, replayUnblockedEvents); } } } function retryIfBlockedOn(unblocked) { // Mark anything that was blocked on this as no longer blocked // and eligible for a replay. if (queuedDiscreteEvents.length > 0) { scheduleCallbackIfUnblocked(queuedDiscreteEvents[0], unblocked); // This is a exponential search for each boundary that commits. I think it's // worth it because we expect very few discrete events to queue up and once // we are actually fully unblocked it will be fast to replay them. for (var i = 1; i < queuedDiscreteEvents.length; i++) { var queuedEvent = queuedDiscreteEvents[i]; if (queuedEvent.blockedOn === unblocked) { queuedEvent.blockedOn = null; } } } if (queuedFocus !== null) { scheduleCallbackIfUnblocked(queuedFocus, unblocked); } if (queuedDrag !== null) { scheduleCallbackIfUnblocked(queuedDrag, unblocked); } if (queuedMouse !== null) { scheduleCallbackIfUnblocked(queuedMouse, unblocked); } var unblock = function (queuedEvent) { return scheduleCallbackIfUnblocked(queuedEvent, unblocked); }; queuedPointers.forEach(unblock); queuedPointerCaptures.forEach(unblock); for (var _i = 0; _i < queuedExplicitHydrationTargets.length; _i++) { var queuedTarget = queuedExplicitHydrationTargets[_i]; if (queuedTarget.blockedOn === unblocked) { queuedTarget.blockedOn = null; } } while (queuedExplicitHydrationTargets.length > 0) { var nextExplicitTarget = queuedExplicitHydrationTargets[0]; if (nextExplicitTarget.blockedOn !== null) { // We're still blocked. break; } else { attemptExplicitHydrationTarget(nextExplicitTarget); if (nextExplicitTarget.blockedOn === null) { // We're unblocked. queuedExplicitHydrationTargets.shift(); } } } } var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; // TODO: can we stop exporting these? var _enabled = true; // This is exported in FB builds for use by legacy FB layer infra. // We'd like to remove this but it's not clear if this is safe. function setEnabled(enabled) { _enabled = !!enabled; } function isEnabled() { return _enabled; } function createEventListenerWrapperWithPriority(targetContainer, domEventName, eventSystemFlags) { var eventPriority = getEventPriority(domEventName); var listenerWrapper; switch (eventPriority) { case DiscreteEventPriority: listenerWrapper = dispatchDiscreteEvent; break; case ContinuousEventPriority: listenerWrapper = dispatchContinuousEvent; break; case DefaultEventPriority: default: listenerWrapper = dispatchEvent; break; } return listenerWrapper.bind(null, domEventName, eventSystemFlags, targetContainer); } function dispatchDiscreteEvent(domEventName, eventSystemFlags, container, nativeEvent) { var previousPriority = getCurrentUpdatePriority(); var prevTransition = ReactCurrentBatchConfig.transition; ReactCurrentBatchConfig.transition = null; try { setCurrentUpdatePriority(DiscreteEventPriority); dispatchEvent(domEventName, eventSystemFlags, container, nativeEvent); } finally { setCurrentUpdatePriority(previousPriority); ReactCurrentBatchConfig.transition = prevTransition; } } function dispatchContinuousEvent(domEventName, eventSystemFlags, container, nativeEvent) { var previousPriority = getCurrentUpdatePriority(); var prevTransition = ReactCurrentBatchConfig.transition; ReactCurrentBatchConfig.transition = null; try { setCurrentUpdatePriority(ContinuousEventPriority); dispatchEvent(domEventName, eventSystemFlags, container, nativeEvent); } finally { setCurrentUpdatePriority(previousPriority); ReactCurrentBatchConfig.transition = prevTransition; } } function dispatchEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent) { if (!_enabled) { return; } { dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay(domEventName, eventSystemFlags, targetContainer, nativeEvent); } } function dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay(domEventName, eventSystemFlags, targetContainer, nativeEvent) { var blockedOn = findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent); if (blockedOn === null) { dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, return_targetInst, targetContainer); clearIfContinuousEvent(domEventName, nativeEvent); return; } if (queueIfContinuousEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent)) { nativeEvent.stopPropagation(); return; } // We need to clear only if we didn't queue because // queueing is accumulative. clearIfContinuousEvent(domEventName, nativeEvent); if (eventSystemFlags & IS_CAPTURE_PHASE && isDiscreteEventThatRequiresHydration(domEventName)) { while (blockedOn !== null) { var fiber = getInstanceFromNode(blockedOn); if (fiber !== null) { attemptSynchronousHydration(fiber); } var nextBlockedOn = findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent); if (nextBlockedOn === null) { dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, return_targetInst, targetContainer); } if (nextBlockedOn === blockedOn) { break; } blockedOn = nextBlockedOn; } if (blockedOn !== null) { nativeEvent.stopPropagation(); } return; } // This is not replayable so we'll invoke it but without a target, // in case the event system needs to trace it. dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, null, targetContainer); } var return_targetInst = null; // Returns a SuspenseInstance or Container if it's blocked. // The return_targetInst field above is conceptually part of the return value. function findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent) { // TODO: Warn if _enabled is false. return_targetInst = null; var nativeEventTarget = getEventTarget(nativeEvent); var targetInst = getClosestInstanceFromNode(nativeEventTarget); if (targetInst !== null) { var nearestMounted = getNearestMountedFiber(targetInst); if (nearestMounted === null) { // This tree has been unmounted already. Dispatch without a target. targetInst = null; } else { var tag = nearestMounted.tag; if (tag === SuspenseComponent) { var instance = getSuspenseInstanceFromFiber(nearestMounted); if (instance !== null) { // Queue the event to be replayed later. Abort dispatching since we // don't want this event dispatched twice through the event system. // TODO: If this is the first discrete event in the queue. Schedule an increased // priority for this boundary. return instance; } // This shouldn't happen, something went wrong but to avoid blocking // the whole system, dispatch the event without a target. // TODO: Warn. targetInst = null; } else if (tag === HostRoot) { var root = nearestMounted.stateNode; if (isRootDehydrated(root)) { // If this happens during a replay something went wrong and it might block // the whole system. return getContainerFromFiber(nearestMounted); } targetInst = null; } else if (nearestMounted !== targetInst) { // If we get an event (ex: img onload) before committing that // component's mount, ignore it for now (that is, treat it as if it was an // event on a non-React tree). We might also consider queueing events and // dispatching them after the mount. targetInst = null; } } } return_targetInst = targetInst; // We're not blocked on anything. return null; } function getEventPriority(domEventName) { switch (domEventName) { // Used by SimpleEventPlugin: case 'cancel': case 'click': case 'close': case 'contextmenu': case 'copy': case 'cut': case 'auxclick': case 'dblclick': case 'dragend': case 'dragstart': case 'drop': case 'focusin': case 'focusout': case 'input': case 'invalid': case 'keydown': case 'keypress': case 'keyup': case 'mousedown': case 'mouseup': case 'paste': case 'pause': case 'play': case 'pointercancel': case 'pointerdown': case 'pointerup': case 'ratechange': case 'reset': case 'resize': case 'seeked': case 'submit': case 'touchcancel': case 'touchend': case 'touchstart': case 'volumechange': // Used by polyfills: // eslint-disable-next-line no-fallthrough case 'change': case 'selectionchange': case 'textInput': case 'compositionstart': case 'compositionend': case 'compositionupdate': // Only enableCreateEventHandleAPI: // eslint-disable-next-line no-fallthrough case 'beforeblur': case 'afterblur': // Not used by React but could be by user code: // eslint-disable-next-line no-fallthrough case 'beforeinput': case 'blur': case 'fullscreenchange': case 'focus': case 'hashchange': case 'popstate': case 'select': case 'selectstart': return DiscreteEventPriority; case 'drag': case 'dragenter': case 'dragexit': case 'dragleave': case 'dragover': case 'mousemove': case 'mouseout': case 'mouseover': case 'pointermove': case 'pointerout': case 'pointerover': case 'scroll': case 'toggle': case 'touchmove': case 'wheel': // Not used by React but could be by user code: // eslint-disable-next-line no-fallthrough case 'mouseenter': case 'mouseleave': case 'pointerenter': case 'pointerleave': return ContinuousEventPriority; case 'message': { // We might be in the Scheduler callback. // Eventually this mechanism will be replaced by a check // of the current priority on the native scheduler. var schedulerPriority = getCurrentPriorityLevel(); switch (schedulerPriority) { case ImmediatePriority: return DiscreteEventPriority; case UserBlockingPriority: return ContinuousEventPriority; case NormalPriority: case LowPriority: // TODO: Handle LowSchedulerPriority, somehow. Maybe the same lane as hydration. return DefaultEventPriority; case IdlePriority: return IdleEventPriority; default: return DefaultEventPriority; } } default: return DefaultEventPriority; } } function addEventBubbleListener(target, eventType, listener) { target.addEventListener(eventType, listener, false); return listener; } function addEventCaptureListener(target, eventType, listener) { target.addEventListener(eventType, listener, true); return listener; } function addEventCaptureListenerWithPassiveFlag(target, eventType, listener, passive) { target.addEventListener(eventType, listener, { capture: true, passive: passive }); return listener; } function addEventBubbleListenerWithPassiveFlag(target, eventType, listener, passive) { target.addEventListener(eventType, listener, { passive: passive }); return listener; } /** * These variables store information about text content of a target node, * allowing comparison of content before and after a given event. * * Identify the node where selection currently begins, then observe * both its text content and its current position in the DOM. Since the * browser may natively replace the target node during composition, we can * use its position to find its replacement. * * */ var root = null; var startText = null; var fallbackText = null; function initialize(nativeEventTarget) { root = nativeEventTarget; startText = getText(); return true; } function reset() { root = null; startText = null; fallbackText = null; } function getData() { if (fallbackText) { return fallbackText; } var start; var startValue = startText; var startLength = startValue.length; var end; var endValue = getText(); var endLength = endValue.length; for (start = 0; start < startLength; start++) { if (startValue[start] !== endValue[start]) { break; } } var minEnd = startLength - start; for (end = 1; end <= minEnd; end++) { if (startValue[startLength - end] !== endValue[endLength - end]) { break; } } var sliceTail = end > 1 ? 1 - end : undefined; fallbackText = endValue.slice(start, sliceTail); return fallbackText; } function getText() { if ('value' in root) { return root.value; } return root.textContent; } /** * `charCode` represents the actual "character code" and is safe to use with * `String.fromCharCode`. As such, only keys that correspond to printable * characters produce a valid `charCode`, the only exception to this is Enter. * The Tab-key is considered non-printable and does not have a `charCode`, * presumably because it does not produce a tab-character in browsers. * * @param {object} nativeEvent Native browser event. * @return {number} Normalized `charCode` property. */ function getEventCharCode(nativeEvent) { var charCode; var keyCode = nativeEvent.keyCode; if ('charCode' in nativeEvent) { charCode = nativeEvent.charCode; // FF does not set `charCode` for the Enter-key, check against `keyCode`. if (charCode === 0 && keyCode === 13) { charCode = 13; } } else { // IE8 does not implement `charCode`, but `keyCode` has the correct value. charCode = keyCode; } // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux) // report Enter as charCode 10 when ctrl is pressed. if (charCode === 10) { charCode = 13; } // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. // Must not discard the (non-)printable Enter-key. if (charCode >= 32 || charCode === 13) { return charCode; } return 0; } function functionThatReturnsTrue() { return true; } function functionThatReturnsFalse() { return false; } // This is intentionally a factory so that we have different returned constructors. // If we had a single constructor, it would be megamorphic and engines would deopt. function createSyntheticEvent(Interface) { /** * Synthetic events are dispatched by event plugins, typically in response to a * top-level event delegation handler. * * These systems should generally use pooling to reduce the frequency of garbage * collection. The system should check `isPersistent` to determine whether the * event should be released into the pool after being dispatched. Users that * need a persisted event should invoke `persist`. * * Synthetic events (and subclasses) implement the DOM Level 3 Events API by * normalizing browser quirks. Subclasses do not necessarily have to implement a * DOM interface; custom application-specific events can also subclass this. */ function SyntheticBaseEvent(reactName, reactEventType, targetInst, nativeEvent, nativeEventTarget) { this._reactName = reactName; this._targetInst = targetInst; this.type = reactEventType; this.nativeEvent = nativeEvent; this.target = nativeEventTarget; this.currentTarget = null; for (var _propName in Interface) { if (!Interface.hasOwnProperty(_propName)) { continue; } var normalize = Interface[_propName]; if (normalize) { this[_propName] = normalize(nativeEvent); } else { this[_propName] = nativeEvent[_propName]; } } var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; if (defaultPrevented) { this.isDefaultPrevented = functionThatReturnsTrue; } else { this.isDefaultPrevented = functionThatReturnsFalse; } this.isPropagationStopped = functionThatReturnsFalse; return this; } assign(SyntheticBaseEvent.prototype, { preventDefault: function () { this.defaultPrevented = true; var event = this.nativeEvent; if (!event) { return; } if (event.preventDefault) { event.preventDefault(); // $FlowFixMe - flow is not aware of `unknown` in IE } else if (typeof event.returnValue !== 'unknown') { event.returnValue = false; } this.isDefaultPrevented = functionThatReturnsTrue; }, stopPropagation: function () { var event = this.nativeEvent; if (!event) { return; } if (event.stopPropagation) { event.stopPropagation(); // $FlowFixMe - flow is not aware of `unknown` in IE } else if (typeof event.cancelBubble !== 'unknown') { // The ChangeEventPlugin registers a "propertychange" event for // IE. This event does not support bubbling or cancelling, and // any references to cancelBubble throw "Member not found". A // typeof check of "unknown" circumvents this issue (and is also // IE specific). event.cancelBubble = true; } this.isPropagationStopped = functionThatReturnsTrue; }, /** * We release all dispatched `SyntheticEvent`s after each event loop, adding * them back into the pool. This allows a way to hold onto a reference that * won't be added back into the pool. */ persist: function () {// Modern event system doesn't use pooling. }, /** * Checks if this event should be released back into the pool. * * @return {boolean} True if this should not be released, false otherwise. */ isPersistent: functionThatReturnsTrue }); return SyntheticBaseEvent; } /** * @interface Event * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var EventInterface = { eventPhase: 0, bubbles: 0, cancelable: 0, timeStamp: function (event) { return event.timeStamp || Date.now(); }, defaultPrevented: 0, isTrusted: 0 }; var SyntheticEvent = createSyntheticEvent(EventInterface); var UIEventInterface = assign({}, EventInterface, { view: 0, detail: 0 }); var SyntheticUIEvent = createSyntheticEvent(UIEventInterface); var lastMovementX; var lastMovementY; var lastMouseEvent; function updateMouseMovementPolyfillState(event) { if (event !== lastMouseEvent) { if (lastMouseEvent && event.type === 'mousemove') { lastMovementX = event.screenX - lastMouseEvent.screenX; lastMovementY = event.screenY - lastMouseEvent.screenY; } else { lastMovementX = 0; lastMovementY = 0; } lastMouseEvent = event; } } /** * @interface MouseEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var MouseEventInterface = assign({}, UIEventInterface, { screenX: 0, screenY: 0, clientX: 0, clientY: 0, pageX: 0, pageY: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, getModifierState: getEventModifierState, button: 0, buttons: 0, relatedTarget: function (event) { if (event.relatedTarget === undefined) return event.fromElement === event.srcElement ? event.toElement : event.fromElement; return event.relatedTarget; }, movementX: function (event) { if ('movementX' in event) { return event.movementX; } updateMouseMovementPolyfillState(event); return lastMovementX; }, movementY: function (event) { if ('movementY' in event) { return event.movementY; } // Don't need to call updateMouseMovementPolyfillState() here // because it's guaranteed to have already run when movementX // was copied. return lastMovementY; } }); var SyntheticMouseEvent = createSyntheticEvent(MouseEventInterface); /** * @interface DragEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var DragEventInterface = assign({}, MouseEventInterface, { dataTransfer: 0 }); var SyntheticDragEvent = createSyntheticEvent(DragEventInterface); /** * @interface FocusEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var FocusEventInterface = assign({}, UIEventInterface, { relatedTarget: 0 }); var SyntheticFocusEvent = createSyntheticEvent(FocusEventInterface); /** * @interface Event * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent */ var AnimationEventInterface = assign({}, EventInterface, { animationName: 0, elapsedTime: 0, pseudoElement: 0 }); var SyntheticAnimationEvent = createSyntheticEvent(AnimationEventInterface); /** * @interface Event * @see http://www.w3.org/TR/clipboard-apis/ */ var ClipboardEventInterface = assign({}, EventInterface, { clipboardData: function (event) { return 'clipboardData' in event ? event.clipboardData : window.clipboardData; } }); var SyntheticClipboardEvent = createSyntheticEvent(ClipboardEventInterface); /** * @interface Event * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents */ var CompositionEventInterface = assign({}, EventInterface, { data: 0 }); var SyntheticCompositionEvent = createSyntheticEvent(CompositionEventInterface); /** * @interface Event * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 * /#events-inputevents */ // Happens to share the same list for now. var SyntheticInputEvent = SyntheticCompositionEvent; /** * Normalization of deprecated HTML5 `key` values * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names */ var normalizeKey = { Esc: 'Escape', Spacebar: ' ', Left: 'ArrowLeft', Up: 'ArrowUp', Right: 'ArrowRight', Down: 'ArrowDown', Del: 'Delete', Win: 'OS', Menu: 'ContextMenu', Apps: 'ContextMenu', Scroll: 'ScrollLock', MozPrintableKey: 'Unidentified' }; /** * Translation from legacy `keyCode` to HTML5 `key` * Only special keys supported, all others depend on keyboard layout or browser * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names */ var translateToKey = { '8': 'Backspace', '9': 'Tab', '12': 'Clear', '13': 'Enter', '16': 'Shift', '17': 'Control', '18': 'Alt', '19': 'Pause', '20': 'CapsLock', '27': 'Escape', '32': ' ', '33': 'PageUp', '34': 'PageDown', '35': 'End', '36': 'Home', '37': 'ArrowLeft', '38': 'ArrowUp', '39': 'ArrowRight', '40': 'ArrowDown', '45': 'Insert', '46': 'Delete', '112': 'F1', '113': 'F2', '114': 'F3', '115': 'F4', '116': 'F5', '117': 'F6', '118': 'F7', '119': 'F8', '120': 'F9', '121': 'F10', '122': 'F11', '123': 'F12', '144': 'NumLock', '145': 'ScrollLock', '224': 'Meta' }; /** * @param {object} nativeEvent Native browser event. * @return {string} Normalized `key` property. */ function getEventKey(nativeEvent) { if (nativeEvent.key) { // Normalize inconsistent values reported by browsers due to // implementations of a working draft specification. // FireFox implements `key` but returns `MozPrintableKey` for all // printable characters (normalized to `Unidentified`), ignore it. var key = normalizeKey[nativeEvent.key] || nativeEvent.key; if (key !== 'Unidentified') { return key; } } // Browser does not implement `key`, polyfill as much of it as we can. if (nativeEvent.type === 'keypress') { var charCode = getEventCharCode(nativeEvent); // The enter-key is technically both printable and non-printable and can // thus be captured by `keypress`, no other non-printable key should. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); } if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { // While user keyboard layout determines the actual meaning of each // `keyCode` value, almost all function keys have a universal value. return translateToKey[nativeEvent.keyCode] || 'Unidentified'; } return ''; } /** * Translation from modifier key to the associated property in the event. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers */ var modifierKeyToProp = { Alt: 'altKey', Control: 'ctrlKey', Meta: 'metaKey', Shift: 'shiftKey' }; // Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support // getModifierState. If getModifierState is not supported, we map it to a set of // modifier keys exposed by the event. In this case, Lock-keys are not supported. function modifierStateGetter(keyArg) { var syntheticEvent = this; var nativeEvent = syntheticEvent.nativeEvent; if (nativeEvent.getModifierState) { return nativeEvent.getModifierState(keyArg); } var keyProp = modifierKeyToProp[keyArg]; return keyProp ? !!nativeEvent[keyProp] : false; } function getEventModifierState(nativeEvent) { return modifierStateGetter; } /** * @interface KeyboardEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var KeyboardEventInterface = assign({}, UIEventInterface, { key: getEventKey, code: 0, location: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, repeat: 0, locale: 0, getModifierState: getEventModifierState, // Legacy Interface charCode: function (event) { // `charCode` is the result of a KeyPress event and represents the value of // the actual printable character. // KeyPress is deprecated, but its replacement is not yet final and not // implemented in any major browser. Only KeyPress has charCode. if (event.type === 'keypress') { return getEventCharCode(event); } return 0; }, keyCode: function (event) { // `keyCode` is the result of a KeyDown/Up event and represents the value of // physical keyboard key. // The actual meaning of the value depends on the users' keyboard layout // which cannot be detected. Assuming that it is a US keyboard layout // provides a surprisingly accurate mapping for US and European users. // Due to this, it is left to the user to implement at this time. if (event.type === 'keydown' || event.type === 'keyup') { return event.keyCode; } return 0; }, which: function (event) { // `which` is an alias for either `keyCode` or `charCode` depending on the // type of the event. if (event.type === 'keypress') { return getEventCharCode(event); } if (event.type === 'keydown' || event.type === 'keyup') { return event.keyCode; } return 0; } }); var SyntheticKeyboardEvent = createSyntheticEvent(KeyboardEventInterface); /** * @interface PointerEvent * @see http://www.w3.org/TR/pointerevents/ */ var PointerEventInterface = assign({}, MouseEventInterface, { pointerId: 0, width: 0, height: 0, pressure: 0, tangentialPressure: 0, tiltX: 0, tiltY: 0, twist: 0, pointerType: 0, isPrimary: 0 }); var SyntheticPointerEvent = createSyntheticEvent(PointerEventInterface); /** * @interface TouchEvent * @see http://www.w3.org/TR/touch-events/ */ var TouchEventInterface = assign({}, UIEventInterface, { touches: 0, targetTouches: 0, changedTouches: 0, altKey: 0, metaKey: 0, ctrlKey: 0, shiftKey: 0, getModifierState: getEventModifierState }); var SyntheticTouchEvent = createSyntheticEvent(TouchEventInterface); /** * @interface Event * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events- * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent */ var TransitionEventInterface = assign({}, EventInterface, { propertyName: 0, elapsedTime: 0, pseudoElement: 0 }); var SyntheticTransitionEvent = createSyntheticEvent(TransitionEventInterface); /** * @interface WheelEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var WheelEventInterface = assign({}, MouseEventInterface, { deltaX: function (event) { return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). 'wheelDeltaX' in event ? -event.wheelDeltaX : 0; }, deltaY: function (event) { return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). 'wheelDelta' in event ? -event.wheelDelta : 0; }, deltaZ: 0, // Browsers without "deltaMode" is reporting in raw wheel delta where one // notch on the scroll is always +/- 120, roughly equivalent to pixels. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. deltaMode: 0 }); var SyntheticWheelEvent = createSyntheticEvent(WheelEventInterface); var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space var START_KEYCODE = 229; var canUseCompositionEvent = canUseDOM && 'CompositionEvent' in window; var documentMode = null; if (canUseDOM && 'documentMode' in document) { documentMode = document.documentMode; } // Webkit offers a very useful `textInput` event that can be used to // directly represent `beforeInput`. The IE `textinput` event is not as // useful, so we don't use it. var canUseTextInputEvent = canUseDOM && 'TextEvent' in window && !documentMode; // In IE9+, we have access to composition events, but the data supplied // by the native compositionend event may be incorrect. Japanese ideographic // spaces, for instance (\u3000) are not recorded correctly. var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); var SPACEBAR_CODE = 32; var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); function registerEvents() { registerTwoPhaseEvent('onBeforeInput', ['compositionend', 'keypress', 'textInput', 'paste']); registerTwoPhaseEvent('onCompositionEnd', ['compositionend', 'focusout', 'keydown', 'keypress', 'keyup', 'mousedown']); registerTwoPhaseEvent('onCompositionStart', ['compositionstart', 'focusout', 'keydown', 'keypress', 'keyup', 'mousedown']); registerTwoPhaseEvent('onCompositionUpdate', ['compositionupdate', 'focusout', 'keydown', 'keypress', 'keyup', 'mousedown']); } // Track whether we've ever handled a keypress on the space key. var hasSpaceKeypress = false; /** * Return whether a native keypress event is assumed to be a command. * This is required because Firefox fires `keypress` events for key commands * (cut, copy, select-all, etc.) even though no character is inserted. */ function isKeypressCommand(nativeEvent) { return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && // ctrlKey && altKey is equivalent to AltGr, and is not a command. !(nativeEvent.ctrlKey && nativeEvent.altKey); } /** * Translate native top level events into event types. */ function getCompositionEventType(domEventName) { switch (domEventName) { case 'compositionstart': return 'onCompositionStart'; case 'compositionend': return 'onCompositionEnd'; case 'compositionupdate': return 'onCompositionUpdate'; } } /** * Does our fallback best-guess model think this event signifies that * composition has begun? */ function isFallbackCompositionStart(domEventName, nativeEvent) { return domEventName === 'keydown' && nativeEvent.keyCode === START_KEYCODE; } /** * Does our fallback mode think that this event is the end of composition? */ function isFallbackCompositionEnd(domEventName, nativeEvent) { switch (domEventName) { case 'keyup': // Command keys insert or clear IME input. return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; case 'keydown': // Expect IME keyCode on each keydown. If we get any other // code we must have exited earlier. return nativeEvent.keyCode !== START_KEYCODE; case 'keypress': case 'mousedown': case 'focusout': // Events are not possible without cancelling IME. return true; default: return false; } } /** * Google Input Tools provides composition data via a CustomEvent, * with the `data` property populated in the `detail` object. If this * is available on the event object, use it. If not, this is a plain * composition event and we have nothing special to extract. * * @param {object} nativeEvent * @return {?string} */ function getDataFromCustomEvent(nativeEvent) { var detail = nativeEvent.detail; if (typeof detail === 'object' && 'data' in detail) { return detail.data; } return null; } /** * Check if a composition event was triggered by Korean IME. * Our fallback mode does not work well with IE's Korean IME, * so just use native composition events when Korean IME is used. * Although CompositionEvent.locale property is deprecated, * it is available in IE, where our fallback mode is enabled. * * @param {object} nativeEvent * @return {boolean} */ function isUsingKoreanIME(nativeEvent) { return nativeEvent.locale === 'ko'; } // Track the current IME composition status, if any. var isComposing = false; /** * @return {?object} A SyntheticCompositionEvent. */ function extractCompositionEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget) { var eventType; var fallbackData; if (canUseCompositionEvent) { eventType = getCompositionEventType(domEventName); } else if (!isComposing) { if (isFallbackCompositionStart(domEventName, nativeEvent)) { eventType = 'onCompositionStart'; } } else if (isFallbackCompositionEnd(domEventName, nativeEvent)) { eventType = 'onCompositionEnd'; } if (!eventType) { return null; } if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) { // The current composition is stored statically and must not be // overwritten while composition continues. if (!isComposing && eventType === 'onCompositionStart') { isComposing = initialize(nativeEventTarget); } else if (eventType === 'onCompositionEnd') { if (isComposing) { fallbackData = getData(); } } } var listeners = accumulateTwoPhaseListeners(targetInst, eventType); if (listeners.length > 0) { var event = new SyntheticCompositionEvent(eventType, domEventName, null, nativeEvent, nativeEventTarget); dispatchQueue.push({ event: event, listeners: listeners }); if (fallbackData) { // Inject data generated from fallback path into the synthetic event. // This matches the property of native CompositionEventInterface. event.data = fallbackData; } else { var customData = getDataFromCustomEvent(nativeEvent); if (customData !== null) { event.data = customData; } } } } function getNativeBeforeInputChars(domEventName, nativeEvent) { switch (domEventName) { case 'compositionend': return getDataFromCustomEvent(nativeEvent); case 'keypress': /** * If native `textInput` events are available, our goal is to make * use of them. However, there is a special case: the spacebar key. * In Webkit, preventing default on a spacebar `textInput` event * cancels character insertion, but it *also* causes the browser * to fall back to its default spacebar behavior of scrolling the * page. * * Tracking at: * https://code.google.com/p/chromium/issues/detail?id=355103 * * To avoid this issue, use the keypress event as if no `textInput` * event is available. */ var which = nativeEvent.which; if (which !== SPACEBAR_CODE) { return null; } hasSpaceKeypress = true; return SPACEBAR_CHAR; case 'textInput': // Record the characters to be added to the DOM. var chars = nativeEvent.data; // If it's a spacebar character, assume that we have already handled // it at the keypress level and bail immediately. Android Chrome // doesn't give us keycodes, so we need to ignore it. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { return null; } return chars; default: // For other native event types, do nothing. return null; } } /** * For browsers that do not provide the `textInput` event, extract the * appropriate string to use for SyntheticInputEvent. */ function getFallbackBeforeInputChars(domEventName, nativeEvent) { // If we are currently composing (IME) and using a fallback to do so, // try to extract the composed characters from the fallback object. // If composition event is available, we extract a string only at // compositionevent, otherwise extract it at fallback events. if (isComposing) { if (domEventName === 'compositionend' || !canUseCompositionEvent && isFallbackCompositionEnd(domEventName, nativeEvent)) { var chars = getData(); reset(); isComposing = false; return chars; } return null; } switch (domEventName) { case 'paste': // If a paste event occurs after a keypress, throw out the input // chars. Paste events should not lead to BeforeInput events. return null; case 'keypress': /** * As of v27, Firefox may fire keypress events even when no character * will be inserted. A few possibilities: * * - `which` is `0`. Arrow keys, Esc key, etc. * * - `which` is the pressed key code, but no char is available. * Ex: 'AltGr + d` in Polish. There is no modified character for * this key combination and no character is inserted into the * document, but FF fires the keypress for char code `100` anyway. * No `input` event will occur. * * - `which` is the pressed key code, but a command combination is * being used. Ex: `Cmd+C`. No character is inserted, and no * `input` event will occur. */ if (!isKeypressCommand(nativeEvent)) { // IE fires the `keypress` event when a user types an emoji via // Touch keyboard of Windows. In such a case, the `char` property // holds an emoji character like `\uD83D\uDE0A`. Because its length // is 2, the property `which` does not represent an emoji correctly. // In such a case, we directly return the `char` property instead of // using `which`. if (nativeEvent.char && nativeEvent.char.length > 1) { return nativeEvent.char; } else if (nativeEvent.which) { return String.fromCharCode(nativeEvent.which); } } return null; case 'compositionend': return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data; default: return null; } } /** * Extract a SyntheticInputEvent for `beforeInput`, based on either native * `textInput` or fallback behavior. * * @return {?object} A SyntheticInputEvent. */ function extractBeforeInputEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget) { var chars; if (canUseTextInputEvent) { chars = getNativeBeforeInputChars(domEventName, nativeEvent); } else { chars = getFallbackBeforeInputChars(domEventName, nativeEvent); } // If no characters are being inserted, no BeforeInput event should // be fired. if (!chars) { return null; } var listeners = accumulateTwoPhaseListeners(targetInst, 'onBeforeInput'); if (listeners.length > 0) { var event = new SyntheticInputEvent('onBeforeInput', 'beforeinput', null, nativeEvent, nativeEventTarget); dispatchQueue.push({ event: event, listeners: listeners }); event.data = chars; } } /** * Create an `onBeforeInput` event to match * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. * * This event plugin is based on the native `textInput` event * available in Chrome, Safari, Opera, and IE. This event fires after * `onKeyPress` and `onCompositionEnd`, but before `onInput`. * * `beforeInput` is spec'd but not implemented in any browsers, and * the `input` event does not provide any useful information about what has * actually been added, contrary to the spec. Thus, `textInput` is the best * available event to identify the characters that have actually been inserted * into the target node. * * This plugin is also responsible for emitting `composition` events, thus * allowing us to share composition fallback code for both `beforeInput` and * `composition` event types. */ function extractEvents(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) { extractCompositionEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget); extractBeforeInputEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget); } /** * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary */ var supportedInputTypes = { color: true, date: true, datetime: true, 'datetime-local': true, email: true, month: true, number: true, password: true, range: true, search: true, tel: true, text: true, time: true, url: true, week: true }; function isTextInputElement(elem) { var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); if (nodeName === 'input') { return !!supportedInputTypes[elem.type]; } if (nodeName === 'textarea') { return true; } return false; } /** * Checks if an event is supported in the current execution environment. * * NOTE: This will not work correctly for non-generic events such as `change`, * `reset`, `load`, `error`, and `select`. * * Borrows from Modernizr. * * @param {string} eventNameSuffix Event name, e.g. "click". * @return {boolean} True if the event is supported. * @internal * @license Modernizr 3.0.0pre (Custom Build) | MIT */ function isEventSupported(eventNameSuffix) { if (!canUseDOM) { return false; } var eventName = 'on' + eventNameSuffix; var isSupported = (eventName in document); if (!isSupported) { var element = document.createElement('div'); element.setAttribute(eventName, 'return;'); isSupported = typeof element[eventName] === 'function'; } return isSupported; } function registerEvents$1() { registerTwoPhaseEvent('onChange', ['change', 'click', 'focusin', 'focusout', 'input', 'keydown', 'keyup', 'selectionchange']); } function createAndAccumulateChangeEvent(dispatchQueue, inst, nativeEvent, target) { // Flag this event loop as needing state restore. enqueueStateRestore(target); var listeners = accumulateTwoPhaseListeners(inst, 'onChange'); if (listeners.length > 0) { var event = new SyntheticEvent('onChange', 'change', null, nativeEvent, target); dispatchQueue.push({ event: event, listeners: listeners }); } } /** * For IE shims */ var activeElement = null; var activeElementInst = null; /** * SECTION: handle `change` event */ function shouldUseChangeEvent(elem) { var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; } function manualDispatchChangeEvent(nativeEvent) { var dispatchQueue = []; createAndAccumulateChangeEvent(dispatchQueue, activeElementInst, nativeEvent, getEventTarget(nativeEvent)); // If change and propertychange bubbled, we'd just bind to it like all the // other events and have it go through ReactBrowserEventEmitter. Since it // doesn't, we manually listen for the events and so we have to enqueue and // process the abstract event manually. // // Batching is necessary here in order to ensure that all event handlers run // before the next rerender (including event handlers attached to ancestor // elements instead of directly on the input). Without this, controlled // components don't work properly in conjunction with event bubbling because // the component is rerendered and the value reverted before all the event // handlers can run. See https://github.com/facebook/react/issues/708. batchedUpdates(runEventInBatch, dispatchQueue); } function runEventInBatch(dispatchQueue) { processDispatchQueue(dispatchQueue, 0); } function getInstIfValueChanged(targetInst) { var targetNode = getNodeFromInstance(targetInst); if (updateValueIfChanged(targetNode)) { return targetInst; } } function getTargetInstForChangeEvent(domEventName, targetInst) { if (domEventName === 'change') { return targetInst; } } /** * SECTION: handle `input` event */ var isInputEventSupported = false; if (canUseDOM) { // IE9 claims to support the input event but fails to trigger it when // deleting text, so we ignore its input events. isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9); } /** * (For IE <=9) Starts tracking propertychange events on the passed-in element * and override the value property so that we can distinguish user events from * value changes in JS. */ function startWatchingForValueChange(target, targetInst) { activeElement = target; activeElementInst = targetInst; activeElement.attachEvent('onpropertychange', handlePropertyChange); } /** * (For IE <=9) Removes the event listeners from the currently-tracked element, * if any exists. */ function stopWatchingForValueChange() { if (!activeElement) { return; } activeElement.detachEvent('onpropertychange', handlePropertyChange); activeElement = null; activeElementInst = null; } /** * (For IE <=9) Handles a propertychange event, sending a `change` event if * the value of the active element has changed. */ function handlePropertyChange(nativeEvent) { if (nativeEvent.propertyName !== 'value') { return; } if (getInstIfValueChanged(activeElementInst)) { manualDispatchChangeEvent(nativeEvent); } } function handleEventsForInputEventPolyfill(domEventName, target, targetInst) { if (domEventName === 'focusin') { // In IE9, propertychange fires for most input events but is buggy and // doesn't fire when text is deleted, but conveniently, selectionchange // appears to fire in all of the remaining cases so we catch those and // forward the event if the value has changed // In either case, we don't want to call the event handler if the value // is changed from JS so we redefine a setter for `.value` that updates // our activeElementValue variable, allowing us to ignore those changes // // stopWatching() should be a noop here but we call it just in case we // missed a blur event somehow. stopWatchingForValueChange(); startWatchingForValueChange(target, targetInst); } else if (domEventName === 'focusout') { stopWatchingForValueChange(); } } // For IE8 and IE9. function getTargetInstForInputEventPolyfill(domEventName, targetInst) { if (domEventName === 'selectionchange' || domEventName === 'keyup' || domEventName === 'keydown') { // On the selectionchange event, the target is just document which isn't // helpful for us so just check activeElement instead. // // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire // propertychange on the first input event after setting `value` from a // script and fires only keydown, keypress, keyup. Catching keyup usually // gets it and catching keydown lets us fire an event for the first // keystroke if user does a key repeat (it'll be a little delayed: right // before the second keystroke). Other input methods (e.g., paste) seem to // fire selectionchange normally. return getInstIfValueChanged(activeElementInst); } } /** * SECTION: handle `click` event */ function shouldUseClickEvent(elem) { // Use the `click` event to detect changes to checkbox and radio inputs. // This approach works across all browsers, whereas `change` does not fire // until `blur` in IE8. var nodeName = elem.nodeName; return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); } function getTargetInstForClickEvent(domEventName, targetInst) { if (domEventName === 'click') { return getInstIfValueChanged(targetInst); } } function getTargetInstForInputOrChangeEvent(domEventName, targetInst) { if (domEventName === 'input' || domEventName === 'change') { return getInstIfValueChanged(targetInst); } } function handleControlledInputBlur(node) { var state = node._wrapperState; if (!state || !state.controlled || node.type !== 'number') { return; } { // If controlled, assign the value attribute to the current value on blur setDefaultValue(node, 'number', node.value); } } /** * This plugin creates an `onChange` event that normalizes change events * across form elements. This event fires at a time when it's possible to * change the element's value without seeing a flicker. * * Supported elements are: * - input (see `isTextInputElement`) * - textarea * - select */ function extractEvents$1(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) { var targetNode = targetInst ? getNodeFromInstance(targetInst) : window; var getTargetInstFunc, handleEventFunc; if (shouldUseChangeEvent(targetNode)) { getTargetInstFunc = getTargetInstForChangeEvent; } else if (isTextInputElement(targetNode)) { if (isInputEventSupported) { getTargetInstFunc = getTargetInstForInputOrChangeEvent; } else { getTargetInstFunc = getTargetInstForInputEventPolyfill; handleEventFunc = handleEventsForInputEventPolyfill; } } else if (shouldUseClickEvent(targetNode)) { getTargetInstFunc = getTargetInstForClickEvent; } if (getTargetInstFunc) { var inst = getTargetInstFunc(domEventName, targetInst); if (inst) { createAndAccumulateChangeEvent(dispatchQueue, inst, nativeEvent, nativeEventTarget); return; } } if (handleEventFunc) { handleEventFunc(domEventName, targetNode, targetInst); } // When blurring, set the value attribute for number inputs if (domEventName === 'focusout') { handleControlledInputBlur(targetNode); } } function registerEvents$2() { registerDirectEvent('onMouseEnter', ['mouseout', 'mouseover']); registerDirectEvent('onMouseLeave', ['mouseout', 'mouseover']); registerDirectEvent('onPointerEnter', ['pointerout', 'pointerover']); registerDirectEvent('onPointerLeave', ['pointerout', 'pointerover']); } /** * For almost every interaction we care about, there will be both a top-level * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that * we do not extract duplicate events. However, moving the mouse into the * browser from outside will not fire a `mouseout` event. In this case, we use * the `mouseover` top-level event. */ function extractEvents$2(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) { var isOverEvent = domEventName === 'mouseover' || domEventName === 'pointerover'; var isOutEvent = domEventName === 'mouseout' || domEventName === 'pointerout'; if (isOverEvent && !isReplayingEvent(nativeEvent)) { // If this is an over event with a target, we might have already dispatched // the event in the out event of the other target. If this is replayed, // then it's because we couldn't dispatch against this target previously // so we have to do it now instead. var related = nativeEvent.relatedTarget || nativeEvent.fromElement; if (related) { // If the related node is managed by React, we can assume that we have // already dispatched the corresponding events during its mouseout. if (getClosestInstanceFromNode(related) || isContainerMarkedAsRoot(related)) { return; } } } if (!isOutEvent && !isOverEvent) { // Must not be a mouse or pointer in or out - ignoring. return; } var win; // TODO: why is this nullable in the types but we read from it? if (nativeEventTarget.window === nativeEventTarget) { // `nativeEventTarget` is probably a window object. win = nativeEventTarget; } else { // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. var doc = nativeEventTarget.ownerDocument; if (doc) { win = doc.defaultView || doc.parentWindow; } else { win = window; } } var from; var to; if (isOutEvent) { var _related = nativeEvent.relatedTarget || nativeEvent.toElement; from = targetInst; to = _related ? getClosestInstanceFromNode(_related) : null; if (to !== null) { var nearestMounted = getNearestMountedFiber(to); if (to !== nearestMounted || to.tag !== HostComponent && to.tag !== HostText) { to = null; } } } else { // Moving to a node from outside the window. from = null; to = targetInst; } if (from === to) { // Nothing pertains to our managed components. return; } var SyntheticEventCtor = SyntheticMouseEvent; var leaveEventType = 'onMouseLeave'; var enterEventType = 'onMouseEnter'; var eventTypePrefix = 'mouse'; if (domEventName === 'pointerout' || domEventName === 'pointerover') { SyntheticEventCtor = SyntheticPointerEvent; leaveEventType = 'onPointerLeave'; enterEventType = 'onPointerEnter'; eventTypePrefix = 'pointer'; } var fromNode = from == null ? win : getNodeFromInstance(from); var toNode = to == null ? win : getNodeFromInstance(to); var leave = new SyntheticEventCtor(leaveEventType, eventTypePrefix + 'leave', from, nativeEvent, nativeEventTarget); leave.target = fromNode; leave.relatedTarget = toNode; var enter = null; // We should only process this nativeEvent if we are processing // the first ancestor. Next time, we will ignore the event. var nativeTargetInst = getClosestInstanceFromNode(nativeEventTarget); if (nativeTargetInst === targetInst) { var enterEvent = new SyntheticEventCtor(enterEventType, eventTypePrefix + 'enter', to, nativeEvent, nativeEventTarget); enterEvent.target = toNode; enterEvent.relatedTarget = fromNode; enter = enterEvent; } accumulateEnterLeaveTwoPhaseListeners(dispatchQueue, leave, enter, from, to); } /** * inlined Object.is polyfill to avoid requiring consumers ship their own * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is */ function is(x, y) { return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare ; } var objectIs = typeof Object.is === 'function' ? Object.is : is; /** * Performs equality by iterating through keys on an object and returning false * when any key has values which are not strictly equal between the arguments. * Returns true when the values of all keys are strictly equal. */ function shallowEqual(objA, objB) { if (objectIs(objA, objB)) { return true; } if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if (keysA.length !== keysB.length) { return false; } // Test for A's keys different from B. for (var i = 0; i < keysA.length; i++) { var currentKey = keysA[i]; if (!hasOwnProperty.call(objB, currentKey) || !objectIs(objA[currentKey], objB[currentKey])) { return false; } } return true; } /** * Given any node return the first leaf node without children. * * @param {DOMElement|DOMTextNode} node * @return {DOMElement|DOMTextNode} */ function getLeafNode(node) { while (node && node.firstChild) { node = node.firstChild; } return node; } /** * Get the next sibling within a container. This will walk up the * DOM if a node's siblings have been exhausted. * * @param {DOMElement|DOMTextNode} node * @return {?DOMElement|DOMTextNode} */ function getSiblingNode(node) { while (node) { if (node.nextSibling) { return node.nextSibling; } node = node.parentNode; } } /** * Get object describing the nodes which contain characters at offset. * * @param {DOMElement|DOMTextNode} root * @param {number} offset * @return {?object} */ function getNodeForCharacterOffset(root, offset) { var node = getLeafNode(root); var nodeStart = 0; var nodeEnd = 0; while (node) { if (node.nodeType === TEXT_NODE) { nodeEnd = nodeStart + node.textContent.length; if (nodeStart <= offset && nodeEnd >= offset) { return { node: node, offset: offset - nodeStart }; } nodeStart = nodeEnd; } node = getLeafNode(getSiblingNode(node)); } } /** * @param {DOMElement} outerNode * @return {?object} */ function getOffsets(outerNode) { var ownerDocument = outerNode.ownerDocument; var win = ownerDocument && ownerDocument.defaultView || window; var selection = win.getSelection && win.getSelection(); if (!selection || selection.rangeCount === 0) { return null; } var anchorNode = selection.anchorNode, anchorOffset = selection.anchorOffset, focusNode = selection.focusNode, focusOffset = selection.focusOffset; // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the // up/down buttons on an <input type="number">. Anonymous divs do not seem to // expose properties, triggering a "Permission denied error" if any of its // properties are accessed. The only seemingly possible way to avoid erroring // is to access a property that typically works for non-anonymous divs and // catch any error that may otherwise arise. See // https://bugzilla.mozilla.org/show_bug.cgi?id=208427 try { /* eslint-disable no-unused-expressions */ anchorNode.nodeType; focusNode.nodeType; /* eslint-enable no-unused-expressions */ } catch (e) { return null; } return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset); } /** * Returns {start, end} where `start` is the character/codepoint index of * (anchorNode, anchorOffset) within the textContent of `outerNode`, and * `end` is the index of (focusNode, focusOffset). * * Returns null if you pass in garbage input but we should probably just crash. * * Exported only for testing. */ function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) { var length = 0; var start = -1; var end = -1; var indexWithinAnchor = 0; var indexWithinFocus = 0; var node = outerNode; var parentNode = null; outer: while (true) { var next = null; while (true) { if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) { start = length + anchorOffset; } if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) { end = length + focusOffset; } if (node.nodeType === TEXT_NODE) { length += node.nodeValue.length; } if ((next = node.firstChild) === null) { break; } // Moving from `node` to its first child `next`. parentNode = node; node = next; } while (true) { if (node === outerNode) { // If `outerNode` has children, this is always the second time visiting // it. If it has no children, this is still the first loop, and the only // valid selection is anchorNode and focusNode both equal to this node // and both offsets 0, in which case we will have handled above. break outer; } if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) { start = length; } if (parentNode === focusNode && ++indexWithinFocus === focusOffset) { end = length; } if ((next = node.nextSibling) !== null) { break; } node = parentNode; parentNode = node.parentNode; } // Moving from `node` to its next sibling `next`. node = next; } if (start === -1 || end === -1) { // This should never happen. (Would happen if the anchor/focus nodes aren't // actually inside the passed-in node.) return null; } return { start: start, end: end }; } /** * In modern non-IE browsers, we can support both forward and backward * selections. * * Note: IE10+ supports the Selection object, but it does not support * the `extend` method, which means that even in modern IE, it's not possible * to programmatically create a backward selection. Thus, for all IE * versions, we use the old IE API to create our selections. * * @param {DOMElement|DOMTextNode} node * @param {object} offsets */ function setOffsets(node, offsets) { var doc = node.ownerDocument || document; var win = doc && doc.defaultView || window; // Edge fails with "Object expected" in some scenarios. // (For instance: TinyMCE editor used in a list component that supports pasting to add more, // fails when pasting 100+ items) if (!win.getSelection) { return; } var selection = win.getSelection(); var length = node.textContent.length; var start = Math.min(offsets.start, length); var end = offsets.end === undefined ? start : Math.min(offsets.end, length); // IE 11 uses modern selection, but doesn't support the extend method. // Flip backward selections, so we can set with a single range. if (!selection.extend && start > end) { var temp = end; end = start; start = temp; } var startMarker = getNodeForCharacterOffset(node, start); var endMarker = getNodeForCharacterOffset(node, end); if (startMarker && endMarker) { if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) { return; } var range = doc.createRange(); range.setStart(startMarker.node, startMarker.offset); selection.removeAllRanges(); if (start > end) { selection.addRange(range); selection.extend(endMarker.node, endMarker.offset); } else { range.setEnd(endMarker.node, endMarker.offset); selection.addRange(range); } } } function isTextNode(node) { return node && node.nodeType === TEXT_NODE; } function containsNode(outerNode, innerNode) { if (!outerNode || !innerNode) { return false; } else if (outerNode === innerNode) { return true; } else if (isTextNode(outerNode)) { return false; } else if (isTextNode(innerNode)) { return containsNode(outerNode, innerNode.parentNode); } else if ('contains' in outerNode) { return outerNode.contains(innerNode); } else if (outerNode.compareDocumentPosition) { return !!(outerNode.compareDocumentPosition(innerNode) & 16); } else { return false; } } function isInDocument(node) { return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node); } function isSameOriginFrame(iframe) { try { // Accessing the contentDocument of a HTMLIframeElement can cause the browser // to throw, e.g. if it has a cross-origin src attribute. // Safari will show an error in the console when the access results in "Blocked a frame with origin". e.g: // iframe.contentDocument.defaultView; // A safety way is to access one of the cross origin properties: Window or Location // Which might result in "SecurityError" DOM Exception and it is compatible to Safari. // https://html.spec.whatwg.org/multipage/browsers.html#integration-with-idl return typeof iframe.contentWindow.location.href === 'string'; } catch (err) { return false; } } function getActiveElementDeep() { var win = window; var element = getActiveElement(); while (element instanceof win.HTMLIFrameElement) { if (isSameOriginFrame(element)) { win = element.contentWindow; } else { return element; } element = getActiveElement(win.document); } return element; } /** * @ReactInputSelection: React input selection module. Based on Selection.js, * but modified to be suitable for react and has a couple of bug fixes (doesn't * assume buttons have range selections allowed). * Input selection module for React. */ /** * @hasSelectionCapabilities: we get the element types that support selection * from https://html.spec.whatwg.org/#do-not-apply, looking at `selectionStart` * and `selectionEnd` rows. */ function hasSelectionCapabilities(elem) { var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); return nodeName && (nodeName === 'input' && (elem.type === 'text' || elem.type === 'search' || elem.type === 'tel' || elem.type === 'url' || elem.type === 'password') || nodeName === 'textarea' || elem.contentEditable === 'true'); } function getSelectionInformation() { var focusedElem = getActiveElementDeep(); return { focusedElem: focusedElem, selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection(focusedElem) : null }; } /** * @restoreSelection: If any selection information was potentially lost, * restore it. This is useful when performing operations that could remove dom * nodes and place them back in, resulting in focus being lost. */ function restoreSelection(priorSelectionInformation) { var curFocusedElem = getActiveElementDeep(); var priorFocusedElem = priorSelectionInformation.focusedElem; var priorSelectionRange = priorSelectionInformation.selectionRange; if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) { setSelection(priorFocusedElem, priorSelectionRange); } // Focusing a node can change the scroll position, which is undesirable var ancestors = []; var ancestor = priorFocusedElem; while (ancestor = ancestor.parentNode) { if (ancestor.nodeType === ELEMENT_NODE) { ancestors.push({ element: ancestor, left: ancestor.scrollLeft, top: ancestor.scrollTop }); } } if (typeof priorFocusedElem.focus === 'function') { priorFocusedElem.focus(); } for (var i = 0; i < ancestors.length; i++) { var info = ancestors[i]; info.element.scrollLeft = info.left; info.element.scrollTop = info.top; } } } /** * @getSelection: Gets the selection bounds of a focused textarea, input or * contentEditable node. * -@input: Look up selection bounds of this input * -@return {start: selectionStart, end: selectionEnd} */ function getSelection(input) { var selection; if ('selectionStart' in input) { // Modern browser with input or textarea. selection = { start: input.selectionStart, end: input.selectionEnd }; } else { // Content editable or old IE textarea. selection = getOffsets(input); } return selection || { start: 0, end: 0 }; } /** * @setSelection: Sets the selection bounds of a textarea or input and focuses * the input. * -@input Set selection bounds of this input or textarea * -@offsets Object of same form that is returned from get* */ function setSelection(input, offsets) { var start = offsets.start; var end = offsets.end; if (end === undefined) { end = start; } if ('selectionStart' in input) { input.selectionStart = start; input.selectionEnd = Math.min(end, input.value.length); } else { setOffsets(input, offsets); } } var skipSelectionChangeEvent = canUseDOM && 'documentMode' in document && document.documentMode <= 11; function registerEvents$3() { registerTwoPhaseEvent('onSelect', ['focusout', 'contextmenu', 'dragend', 'focusin', 'keydown', 'keyup', 'mousedown', 'mouseup', 'selectionchange']); } var activeElement$1 = null; var activeElementInst$1 = null; var lastSelection = null; var mouseDown = false; /** * Get an object which is a unique representation of the current selection. * * The return value will not be consistent across nodes or browsers, but * two identical selections on the same node will return identical objects. */ function getSelection$1(node) { if ('selectionStart' in node && hasSelectionCapabilities(node)) { return { start: node.selectionStart, end: node.selectionEnd }; } else { var win = node.ownerDocument && node.ownerDocument.defaultView || window; var selection = win.getSelection(); return { anchorNode: selection.anchorNode, anchorOffset: selection.anchorOffset, focusNode: selection.focusNode, focusOffset: selection.focusOffset }; } } /** * Get document associated with the event target. */ function getEventTargetDocument(eventTarget) { return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument; } /** * Poll selection to see whether it's changed. * * @param {object} nativeEvent * @param {object} nativeEventTarget * @return {?SyntheticEvent} */ function constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget) { // Ensure we have the right element, and that the user is not dragging a // selection (this matches native `select` event behavior). In HTML5, select // fires only on input and textarea thus if there's no focused element we // won't dispatch. var doc = getEventTargetDocument(nativeEventTarget); if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) { return; } // Only fire when selection has actually changed. var currentSelection = getSelection$1(activeElement$1); if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { lastSelection = currentSelection; var listeners = accumulateTwoPhaseListeners(activeElementInst$1, 'onSelect'); if (listeners.length > 0) { var event = new SyntheticEvent('onSelect', 'select', null, nativeEvent, nativeEventTarget); dispatchQueue.push({ event: event, listeners: listeners }); event.target = activeElement$1; } } } /** * This plugin creates an `onSelect` event that normalizes select events * across form elements. * * Supported elements are: * - input (see `isTextInputElement`) * - textarea * - contentEditable * * This differs from native browser implementations in the following ways: * - Fires on contentEditable fields as well as inputs. * - Fires for collapsed selection. * - Fires after user input. */ function extractEvents$3(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) { var targetNode = targetInst ? getNodeFromInstance(targetInst) : window; switch (domEventName) { // Track the input node that has focus. case 'focusin': if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') { activeElement$1 = targetNode; activeElementInst$1 = targetInst; lastSelection = null; } break; case 'focusout': activeElement$1 = null; activeElementInst$1 = null; lastSelection = null; break; // Don't fire the event while the user is dragging. This matches the // semantics of the native select event. case 'mousedown': mouseDown = true; break; case 'contextmenu': case 'mouseup': case 'dragend': mouseDown = false; constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget); break; // Chrome and IE fire non-standard event when selection is changed (and // sometimes when it hasn't). IE's event fires out of order with respect // to key and input events on deletion, so we discard it. // // Firefox doesn't support selectionchange, so check selection status // after each key entry. The selection changes after keydown and before // keyup, but we check on keydown as well in the case of holding down a // key, when multiple keydown events are fired but only one keyup is. // This is also our approach for IE handling, for the reason above. case 'selectionchange': if (skipSelectionChangeEvent) { break; } // falls through case 'keydown': case 'keyup': constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget); } } /** * Generate a mapping of standard vendor prefixes using the defined style property and event name. * * @param {string} styleProp * @param {string} eventName * @returns {object} */ function makePrefixMap(styleProp, eventName) { var prefixes = {}; prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); prefixes['Webkit' + styleProp] = 'webkit' + eventName; prefixes['Moz' + styleProp] = 'moz' + eventName; return prefixes; } /** * A list of event names to a configurable list of vendor prefixes. */ var vendorPrefixes = { animationend: makePrefixMap('Animation', 'AnimationEnd'), animationiteration: makePrefixMap('Animation', 'AnimationIteration'), animationstart: makePrefixMap('Animation', 'AnimationStart'), transitionend: makePrefixMap('Transition', 'TransitionEnd') }; /** * Event names that have already been detected and prefixed (if applicable). */ var prefixedEventNames = {}; /** * Element to check for prefixes on. */ var style = {}; /** * Bootstrap if a DOM exists. */ if (canUseDOM) { style = document.createElement('div').style; // On some platforms, in particular some releases of Android 4.x, // the un-prefixed "animation" and "transition" properties are defined on the // style object but the events that fire will still be prefixed, so we need // to check if the un-prefixed events are usable, and if not remove them from the map. if (!('AnimationEvent' in window)) { delete vendorPrefixes.animationend.animation; delete vendorPrefixes.animationiteration.animation; delete vendorPrefixes.animationstart.animation; } // Same as above if (!('TransitionEvent' in window)) { delete vendorPrefixes.transitionend.transition; } } /** * Attempts to determine the correct vendor prefixed event name. * * @param {string} eventName * @returns {string} */ function getVendorPrefixedEventName(eventName) { if (prefixedEventNames[eventName]) { return prefixedEventNames[eventName]; } else if (!vendorPrefixes[eventName]) { return eventName; } var prefixMap = vendorPrefixes[eventName]; for (var styleProp in prefixMap) { if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) { return prefixedEventNames[eventName] = prefixMap[styleProp]; } } return eventName; } var ANIMATION_END = getVendorPrefixedEventName('animationend'); var ANIMATION_ITERATION = getVendorPrefixedEventName('animationiteration'); var ANIMATION_START = getVendorPrefixedEventName('animationstart'); var TRANSITION_END = getVendorPrefixedEventName('transitionend'); var topLevelEventsToReactNames = new Map(); // NOTE: Capitalization is important in this list! // // E.g. it needs "pointerDown", not "pointerdown". // This is because we derive both React name ("onPointerDown") // and DOM name ("pointerdown") from the same list. // // Exceptions that don't match this convention are listed separately. // // prettier-ignore var simpleEventPluginEvents = ['abort', 'auxClick', 'cancel', 'canPlay', 'canPlayThrough', 'click', 'close', 'contextMenu', 'copy', 'cut', 'drag', 'dragEnd', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'dragStart', 'drop', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'gotPointerCapture', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'lostPointerCapture', 'mouseDown', 'mouseMove', 'mouseOut', 'mouseOver', 'mouseUp', 'paste', 'pause', 'play', 'playing', 'pointerCancel', 'pointerDown', 'pointerMove', 'pointerOut', 'pointerOver', 'pointerUp', 'progress', 'rateChange', 'reset', 'resize', 'seeked', 'seeking', 'stalled', 'submit', 'suspend', 'timeUpdate', 'touchCancel', 'touchEnd', 'touchStart', 'volumeChange', 'scroll', 'toggle', 'touchMove', 'waiting', 'wheel']; function registerSimpleEvent(domEventName, reactName) { topLevelEventsToReactNames.set(domEventName, reactName); registerTwoPhaseEvent(reactName, [domEventName]); } function registerSimpleEvents() { for (var i = 0; i < simpleEventPluginEvents.length; i++) { var eventName = simpleEventPluginEvents[i]; var domEventName = eventName.toLowerCase(); var capitalizedEvent = eventName[0].toUpperCase() + eventName.slice(1); registerSimpleEvent(domEventName, 'on' + capitalizedEvent); } // Special cases where event names don't match. registerSimpleEvent(ANIMATION_END, 'onAnimationEnd'); registerSimpleEvent(ANIMATION_ITERATION, 'onAnimationIteration'); registerSimpleEvent(ANIMATION_START, 'onAnimationStart'); registerSimpleEvent('dblclick', 'onDoubleClick'); registerSimpleEvent('focusin', 'onFocus'); registerSimpleEvent('focusout', 'onBlur'); registerSimpleEvent(TRANSITION_END, 'onTransitionEnd'); } function extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) { var reactName = topLevelEventsToReactNames.get(domEventName); if (reactName === undefined) { return; } var SyntheticEventCtor = SyntheticEvent; var reactEventType = domEventName; switch (domEventName) { case 'keypress': // Firefox creates a keypress event for function keys too. This removes // the unwanted keypress events. Enter is however both printable and // non-printable. One would expect Tab to be as well (but it isn't). if (getEventCharCode(nativeEvent) === 0) { return; } /* falls through */ case 'keydown': case 'keyup': SyntheticEventCtor = SyntheticKeyboardEvent; break; case 'focusin': reactEventType = 'focus'; SyntheticEventCtor = SyntheticFocusEvent; break; case 'focusout': reactEventType = 'blur'; SyntheticEventCtor = SyntheticFocusEvent; break; case 'beforeblur': case 'afterblur': SyntheticEventCtor = SyntheticFocusEvent; break; case 'click': // Firefox creates a click event on right mouse clicks. This removes the // unwanted click events. if (nativeEvent.button === 2) { return; } /* falls through */ case 'auxclick': case 'dblclick': case 'mousedown': case 'mousemove': case 'mouseup': // TODO: Disabled elements should not respond to mouse events /* falls through */ case 'mouseout': case 'mouseover': case 'contextmenu': SyntheticEventCtor = SyntheticMouseEvent; break; case 'drag': case 'dragend': case 'dragenter': case 'dragexit': case 'dragleave': case 'dragover': case 'dragstart': case 'drop': SyntheticEventCtor = SyntheticDragEvent; break; case 'touchcancel': case 'touchend': case 'touchmove': case 'touchstart': SyntheticEventCtor = SyntheticTouchEvent; break; case ANIMATION_END: case ANIMATION_ITERATION: case ANIMATION_START: SyntheticEventCtor = SyntheticAnimationEvent; break; case TRANSITION_END: SyntheticEventCtor = SyntheticTransitionEvent; break; case 'scroll': SyntheticEventCtor = SyntheticUIEvent; break; case 'wheel': SyntheticEventCtor = SyntheticWheelEvent; break; case 'copy': case 'cut': case 'paste': SyntheticEventCtor = SyntheticClipboardEvent; break; case 'gotpointercapture': case 'lostpointercapture': case 'pointercancel': case 'pointerdown': case 'pointermove': case 'pointerout': case 'pointerover': case 'pointerup': SyntheticEventCtor = SyntheticPointerEvent; break; } var inCapturePhase = (eventSystemFlags & IS_CAPTURE_PHASE) !== 0; { // Some events don't bubble in the browser. // In the past, React has always bubbled them, but this can be surprising. // We're going to try aligning closer to the browser behavior by not bubbling // them in React either. We'll start by not bubbling onScroll, and then expand. var accumulateTargetOnly = !inCapturePhase && // TODO: ideally, we'd eventually add all events from // nonDelegatedEvents list in DOMPluginEventSystem. // Then we can remove this special list. // This is a breaking change that can wait until React 18. domEventName === 'scroll'; var _listeners = accumulateSinglePhaseListeners(targetInst, reactName, nativeEvent.type, inCapturePhase, accumulateTargetOnly); if (_listeners.length > 0) { // Intentionally create event lazily. var _event = new SyntheticEventCtor(reactName, reactEventType, null, nativeEvent, nativeEventTarget); dispatchQueue.push({ event: _event, listeners: _listeners }); } } } // TODO: remove top-level side effect. registerSimpleEvents(); registerEvents$2(); registerEvents$1(); registerEvents$3(); registerEvents(); function extractEvents$5(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) { // TODO: we should remove the concept of a "SimpleEventPlugin". // This is the basic functionality of the event system. All // the other plugins are essentially polyfills. So the plugin // should probably be inlined somewhere and have its logic // be core the to event system. This would potentially allow // us to ship builds of React without the polyfilled plugins below. extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags); var shouldProcessPolyfillPlugins = (eventSystemFlags & SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS) === 0; // We don't process these events unless we are in the // event's native "bubble" phase, which means that we're // not in the capture phase. That's because we emulate // the capture phase here still. This is a trade-off, // because in an ideal world we would not emulate and use // the phases properly, like we do with the SimpleEvent // plugin. However, the plugins below either expect // emulation (EnterLeave) or use state localized to that // plugin (BeforeInput, Change, Select). The state in // these modules complicates things, as you'll essentially // get the case where the capture phase event might change // state, only for the following bubble event to come in // later and not trigger anything as the state now // invalidates the heuristics of the event plugin. We // could alter all these plugins to work in such ways, but // that might cause other unknown side-effects that we // can't foresee right now. if (shouldProcessPolyfillPlugins) { extractEvents$2(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget); extractEvents$1(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget); extractEvents$3(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget); extractEvents(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget); } } // List of events that need to be individually attached to media elements. var mediaEventTypes = ['abort', 'canplay', 'canplaythrough', 'durationchange', 'emptied', 'encrypted', 'ended', 'error', 'loadeddata', 'loadedmetadata', 'loadstart', 'pause', 'play', 'playing', 'progress', 'ratechange', 'resize', 'seeked', 'seeking', 'stalled', 'suspend', 'timeupdate', 'volumechange', 'waiting']; // We should not delegate these events to the container, but rather // set them on the actual target element itself. This is primarily // because these events do not consistently bubble in the DOM. var nonDelegatedEvents = new Set(['cancel', 'close', 'invalid', 'load', 'scroll', 'toggle'].concat(mediaEventTypes)); function executeDispatch(event, listener, currentTarget) { var type = event.type || 'unknown-event'; event.currentTarget = currentTarget; invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); event.currentTarget = null; } function processDispatchQueueItemsInOrder(event, dispatchListeners, inCapturePhase) { var previousInstance; if (inCapturePhase) { for (var i = dispatchListeners.length - 1; i >= 0; i--) { var _dispatchListeners$i = dispatchListeners[i], instance = _dispatchListeners$i.instance, currentTarget = _dispatchListeners$i.currentTarget, listener = _dispatchListeners$i.listener; if (instance !== previousInstance && event.isPropagationStopped()) { return; } executeDispatch(event, listener, currentTarget); previousInstance = instance; } } else { for (var _i = 0; _i < dispatchListeners.length; _i++) { var _dispatchListeners$_i = dispatchListeners[_i], _instance = _dispatchListeners$_i.instance, _currentTarget = _dispatchListeners$_i.currentTarget, _listener = _dispatchListeners$_i.listener; if (_instance !== previousInstance && event.isPropagationStopped()) { return; } executeDispatch(event, _listener, _currentTarget); previousInstance = _instance; } } } function processDispatchQueue(dispatchQueue, eventSystemFlags) { var inCapturePhase = (eventSystemFlags & IS_CAPTURE_PHASE) !== 0; for (var i = 0; i < dispatchQueue.length; i++) { var _dispatchQueue$i = dispatchQueue[i], event = _dispatchQueue$i.event, listeners = _dispatchQueue$i.listeners; processDispatchQueueItemsInOrder(event, listeners, inCapturePhase); // event system doesn't use pooling. } // This would be a good time to rethrow if any of the event handlers threw. rethrowCaughtError(); } function dispatchEventsForPlugins(domEventName, eventSystemFlags, nativeEvent, targetInst, targetContainer) { var nativeEventTarget = getEventTarget(nativeEvent); var dispatchQueue = []; extractEvents$5(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags); processDispatchQueue(dispatchQueue, eventSystemFlags); } function listenToNonDelegatedEvent(domEventName, targetElement) { { if (!nonDelegatedEvents.has(domEventName)) { error('Did not expect a listenToNonDelegatedEvent() call for "%s". ' + 'This is a bug in React. Please file an issue.', domEventName); } } var isCapturePhaseListener = false; var listenerSet = getEventListenerSet(targetElement); var listenerSetKey = getListenerSetKey(domEventName, isCapturePhaseListener); if (!listenerSet.has(listenerSetKey)) { addTrappedEventListener(targetElement, domEventName, IS_NON_DELEGATED, isCapturePhaseListener); listenerSet.add(listenerSetKey); } } function listenToNativeEvent(domEventName, isCapturePhaseListener, target) { { if (nonDelegatedEvents.has(domEventName) && !isCapturePhaseListener) { error('Did not expect a listenToNativeEvent() call for "%s" in the bubble phase. ' + 'This is a bug in React. Please file an issue.', domEventName); } } var eventSystemFlags = 0; if (isCapturePhaseListener) { eventSystemFlags |= IS_CAPTURE_PHASE; } addTrappedEventListener(target, domEventName, eventSystemFlags, isCapturePhaseListener); } // This is only used by createEventHandle when the var listeningMarker = '_reactListening' + Math.random().toString(36).slice(2); function listenToAllSupportedEvents(rootContainerElement) { if (!rootContainerElement[listeningMarker]) { rootContainerElement[listeningMarker] = true; allNativeEvents.forEach(function (domEventName) { // We handle selectionchange separately because it // doesn't bubble and needs to be on the document. if (domEventName !== 'selectionchange') { if (!nonDelegatedEvents.has(domEventName)) { listenToNativeEvent(domEventName, false, rootContainerElement); } listenToNativeEvent(domEventName, true, rootContainerElement); } }); var ownerDocument = rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument; if (ownerDocument !== null) { // The selectionchange event also needs deduplication // but it is attached to the document. if (!ownerDocument[listeningMarker]) { ownerDocument[listeningMarker] = true; listenToNativeEvent('selectionchange', false, ownerDocument); } } } } function addTrappedEventListener(targetContainer, domEventName, eventSystemFlags, isCapturePhaseListener, isDeferredListenerForLegacyFBSupport) { var listener = createEventListenerWrapperWithPriority(targetContainer, domEventName, eventSystemFlags); // If passive option is not supported, then the event will be // active and not passive. var isPassiveListener = undefined; if (passiveBrowserEventsSupported) { // Browsers introduced an intervention, making these events // passive by default on document. React doesn't bind them // to document anymore, but changing this now would undo // the performance wins from the change. So we emulate // the existing behavior manually on the roots now. // https://github.com/facebook/react/issues/19651 if (domEventName === 'touchstart' || domEventName === 'touchmove' || domEventName === 'wheel') { isPassiveListener = true; } } targetContainer = targetContainer; var unsubscribeListener; // When legacyFBSupport is enabled, it's for when we if (isCapturePhaseListener) { if (isPassiveListener !== undefined) { unsubscribeListener = addEventCaptureListenerWithPassiveFlag(targetContainer, domEventName, listener, isPassiveListener); } else { unsubscribeListener = addEventCaptureListener(targetContainer, domEventName, listener); } } else { if (isPassiveListener !== undefined) { unsubscribeListener = addEventBubbleListenerWithPassiveFlag(targetContainer, domEventName, listener, isPassiveListener); } else { unsubscribeListener = addEventBubbleListener(targetContainer, domEventName, listener); } } } function isMatchingRootContainer(grandContainer, targetContainer) { return grandContainer === targetContainer || grandContainer.nodeType === COMMENT_NODE && grandContainer.parentNode === targetContainer; } function dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, targetInst, targetContainer) { var ancestorInst = targetInst; if ((eventSystemFlags & IS_EVENT_HANDLE_NON_MANAGED_NODE) === 0 && (eventSystemFlags & IS_NON_DELEGATED) === 0) { var targetContainerNode = targetContainer; // If we are using the legacy FB support flag, we if (targetInst !== null) { // The below logic attempts to work out if we need to change // the target fiber to a different ancestor. We had similar logic // in the legacy event system, except the big difference between // systems is that the modern event system now has an event listener // attached to each React Root and React Portal Root. Together, // the DOM nodes representing these roots are the "rootContainer". // To figure out which ancestor instance we should use, we traverse // up the fiber tree from the target instance and attempt to find // root boundaries that match that of our current "rootContainer". // If we find that "rootContainer", we find the parent fiber // sub-tree for that root and make that our ancestor instance. var node = targetInst; mainLoop: while (true) { if (node === null) { return; } var nodeTag = node.tag; if (nodeTag === HostRoot || nodeTag === HostPortal) { var container = node.stateNode.containerInfo; if (isMatchingRootContainer(container, targetContainerNode)) { break; } if (nodeTag === HostPortal) { // The target is a portal, but it's not the rootContainer we're looking for. // Normally portals handle their own events all the way down to the root. // So we should be able to stop now. However, we don't know if this portal // was part of *our* root. var grandNode = node.return; while (grandNode !== null) { var grandTag = grandNode.tag; if (grandTag === HostRoot || grandTag === HostPortal) { var grandContainer = grandNode.stateNode.containerInfo; if (isMatchingRootContainer(grandContainer, targetContainerNode)) { // This is the rootContainer we're looking for and we found it as // a parent of the Portal. That means we can ignore it because the // Portal will bubble through to us. return; } } grandNode = grandNode.return; } } // Now we need to find it's corresponding host fiber in the other // tree. To do this we can use getClosestInstanceFromNode, but we // need to validate that the fiber is a host instance, otherwise // we need to traverse up through the DOM till we find the correct // node that is from the other tree. while (container !== null) { var parentNode = getClosestInstanceFromNode(container); if (parentNode === null) { return; } var parentTag = parentNode.tag; if (parentTag === HostComponent || parentTag === HostText) { node = ancestorInst = parentNode; continue mainLoop; } container = container.parentNode; } } node = node.return; } } } batchedUpdates(function () { return dispatchEventsForPlugins(domEventName, eventSystemFlags, nativeEvent, ancestorInst); }); } function createDispatchListener(instance, listener, currentTarget) { return { instance: instance, listener: listener, currentTarget: currentTarget }; } function accumulateSinglePhaseListeners(targetFiber, reactName, nativeEventType, inCapturePhase, accumulateTargetOnly, nativeEvent) { var captureName = reactName !== null ? reactName + 'Capture' : null; var reactEventName = inCapturePhase ? captureName : reactName; var listeners = []; var instance = targetFiber; var lastHostComponent = null; // Accumulate all instances and listeners via the target -> root path. while (instance !== null) { var _instance2 = instance, stateNode = _instance2.stateNode, tag = _instance2.tag; // Handle listeners that are on HostComponents (i.e. <div>) if (tag === HostComponent && stateNode !== null) { lastHostComponent = stateNode; // createEventHandle listeners if (reactEventName !== null) { var listener = getListener(instance, reactEventName); if (listener != null) { listeners.push(createDispatchListener(instance, listener, lastHostComponent)); } } } // If we are only accumulating events for the target, then we don't // continue to propagate through the React fiber tree to find other // listeners. if (accumulateTargetOnly) { break; } // If we are processing the onBeforeBlur event, then we need to take instance = instance.return; } return listeners; } // We should only use this function for: // - BeforeInputEventPlugin // - ChangeEventPlugin // - SelectEventPlugin // This is because we only process these plugins // in the bubble phase, so we need to accumulate two // phase event listeners (via emulation). function accumulateTwoPhaseListeners(targetFiber, reactName) { var captureName = reactName + 'Capture'; var listeners = []; var instance = targetFiber; // Accumulate all instances and listeners via the target -> root path. while (instance !== null) { var _instance3 = instance, stateNode = _instance3.stateNode, tag = _instance3.tag; // Handle listeners that are on HostComponents (i.e. <div>) if (tag === HostComponent && stateNode !== null) { var currentTarget = stateNode; var captureListener = getListener(instance, captureName); if (captureListener != null) { listeners.unshift(createDispatchListener(instance, captureListener, currentTarget)); } var bubbleListener = getListener(instance, reactName); if (bubbleListener != null) { listeners.push(createDispatchListener(instance, bubbleListener, currentTarget)); } } instance = instance.return; } return listeners; } function getParent(inst) { if (inst === null) { return null; } do { inst = inst.return; // TODO: If this is a HostRoot we might want to bail out. // That is depending on if we want nested subtrees (layers) to bubble // events to their parent. We could also go through parentNode on the // host node but that wouldn't work for React Native and doesn't let us // do the portal feature. } while (inst && inst.tag !== HostComponent); if (inst) { return inst; } return null; } /** * Return the lowest common ancestor of A and B, or null if they are in * different trees. */ function getLowestCommonAncestor(instA, instB) { var nodeA = instA; var nodeB = instB; var depthA = 0; for (var tempA = nodeA; tempA; tempA = getParent(tempA)) { depthA++; } var depthB = 0; for (var tempB = nodeB; tempB; tempB = getParent(tempB)) { depthB++; } // If A is deeper, crawl up. while (depthA - depthB > 0) { nodeA = getParent(nodeA); depthA--; } // If B is deeper, crawl up. while (depthB - depthA > 0) { nodeB = getParent(nodeB); depthB--; } // Walk in lockstep until we find a match. var depth = depthA; while (depth--) { if (nodeA === nodeB || nodeB !== null && nodeA === nodeB.alternate) { return nodeA; } nodeA = getParent(nodeA); nodeB = getParent(nodeB); } return null; } function accumulateEnterLeaveListenersForEvent(dispatchQueue, event, target, common, inCapturePhase) { var registrationName = event._reactName; var listeners = []; var instance = target; while (instance !== null) { if (instance === common) { break; } var _instance4 = instance, alternate = _instance4.alternate, stateNode = _instance4.stateNode, tag = _instance4.tag; if (alternate !== null && alternate === common) { break; } if (tag === HostComponent && stateNode !== null) { var currentTarget = stateNode; if (inCapturePhase) { var captureListener = getListener(instance, registrationName); if (captureListener != null) { listeners.unshift(createDispatchListener(instance, captureListener, currentTarget)); } } else if (!inCapturePhase) { var bubbleListener = getListener(instance, registrationName); if (bubbleListener != null) { listeners.push(createDispatchListener(instance, bubbleListener, currentTarget)); } } } instance = instance.return; } if (listeners.length !== 0) { dispatchQueue.push({ event: event, listeners: listeners }); } } // We should only use this function for: // - EnterLeaveEventPlugin // This is because we only process this plugin // in the bubble phase, so we need to accumulate two // phase event listeners. function accumulateEnterLeaveTwoPhaseListeners(dispatchQueue, leaveEvent, enterEvent, from, to) { var common = from && to ? getLowestCommonAncestor(from, to) : null; if (from !== null) { accumulateEnterLeaveListenersForEvent(dispatchQueue, leaveEvent, from, common, false); } if (to !== null && enterEvent !== null) { accumulateEnterLeaveListenersForEvent(dispatchQueue, enterEvent, to, common, true); } } function getListenerSetKey(domEventName, capture) { return domEventName + "__" + (capture ? 'capture' : 'bubble'); } var didWarnInvalidHydration = false; var DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML'; var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning'; var SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning'; var AUTOFOCUS = 'autoFocus'; var CHILDREN = 'children'; var STYLE = 'style'; var HTML$1 = '__html'; var warnedUnknownTags; var validatePropertiesInDevelopment; var warnForPropDifference; var warnForExtraAttributes; var warnForInvalidEventListener; var canDiffStyleForHydrationWarning; var normalizeHTML; { warnedUnknownTags = { // There are working polyfills for <dialog>. Let people use it. dialog: true, // Electron ships a custom <webview> tag to display external web content in // an isolated frame and process. // This tag is not present in non Electron environments such as JSDom which // is often used for testing purposes. // @see https://electronjs.org/docs/api/webview-tag webview: true }; validatePropertiesInDevelopment = function (type, props) { validateProperties(type, props); validateProperties$1(type, props); validateProperties$2(type, props, { registrationNameDependencies: registrationNameDependencies, possibleRegistrationNames: possibleRegistrationNames }); }; // IE 11 parses & normalizes the style attribute as opposed to other // browsers. It adds spaces and sorts the properties in some // non-alphabetical order. Handling that would require sorting CSS // properties in the client & server versions or applying // `expectedStyle` to a temporary DOM node to read its `style` attribute // normalized. Since it only affects IE, we're skipping style warnings // in that browser completely in favor of doing all that work. // See https://github.com/facebook/react/issues/11807 canDiffStyleForHydrationWarning = canUseDOM && !document.documentMode; warnForPropDifference = function (propName, serverValue, clientValue) { if (didWarnInvalidHydration) { return; } var normalizedClientValue = normalizeMarkupForTextOrAttribute(clientValue); var normalizedServerValue = normalizeMarkupForTextOrAttribute(serverValue); if (normalizedServerValue === normalizedClientValue) { return; } didWarnInvalidHydration = true; error('Prop `%s` did not match. Server: %s Client: %s', propName, JSON.stringify(normalizedServerValue), JSON.stringify(normalizedClientValue)); }; warnForExtraAttributes = function (attributeNames) { if (didWarnInvalidHydration) { return; } didWarnInvalidHydration = true; var names = []; attributeNames.forEach(function (name) { names.push(name); }); error('Extra attributes from the server: %s', names); }; warnForInvalidEventListener = function (registrationName, listener) { if (listener === false) { error('Expected `%s` listener to be a function, instead got `false`.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', registrationName, registrationName, registrationName); } else { error('Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener); } }; // Parse the HTML and read it back to normalize the HTML string so that it // can be used for comparison. normalizeHTML = function (parent, html) { // We could have created a separate document here to avoid // re-initializing custom elements if they exist. But this breaks // how <noscript> is being handled. So we use the same document. // See the discussion in https://github.com/facebook/react/pull/11157. var testElement = parent.namespaceURI === HTML_NAMESPACE ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName); testElement.innerHTML = html; return testElement.innerHTML; }; } // HTML parsing normalizes CR and CRLF to LF. // It also can turn \u0000 into \uFFFD inside attributes. // https://www.w3.org/TR/html5/single-page.html#preprocessing-the-input-stream // If we have a mismatch, it might be caused by that. // We will still patch up in this case but not fire the warning. var NORMALIZE_NEWLINES_REGEX = /\r\n?/g; var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g; function normalizeMarkupForTextOrAttribute(markup) { { checkHtmlStringCoercion(markup); } var markupString = typeof markup === 'string' ? markup : '' + markup; return markupString.replace(NORMALIZE_NEWLINES_REGEX, '\n').replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, ''); } function checkForUnmatchedText(serverText, clientText, isConcurrentMode, shouldWarnDev) { var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText); var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText); if (normalizedServerText === normalizedClientText) { return; } if (shouldWarnDev) { { if (!didWarnInvalidHydration) { didWarnInvalidHydration = true; error('Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText); } } } if (isConcurrentMode && enableClientRenderFallbackOnTextMismatch) { // In concurrent roots, we throw when there's a text mismatch and revert to // client rendering, up to the nearest Suspense boundary. throw new Error('Text content does not match server-rendered HTML.'); } } function getOwnerDocumentFromRootContainer(rootContainerElement) { return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument; } function noop() {} function trapClickOnNonInteractiveElement(node) { // Mobile Safari does not fire properly bubble click events on // non-interactive elements, which means delegated click listeners do not // fire. The workaround for this bug involves attaching an empty click // listener on the target node. // https://www.quirksmode.org/blog/archives/2010/09/click_event_del.html // Just set it using the onclick property so that we don't have to manage any // bookkeeping for it. Not sure if we need to clear it when the listener is // removed. // TODO: Only do this for the relevant Safaris maybe? node.onclick = noop; } function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) { for (var propKey in nextProps) { if (!nextProps.hasOwnProperty(propKey)) { continue; } var nextProp = nextProps[propKey]; if (propKey === STYLE) { { if (nextProp) { // Freeze the next style object so that we can assume it won't be // mutated. We have already warned for this in the past. Object.freeze(nextProp); } } // Relies on `updateStylesByID` not mutating `styleUpdates`. setValueForStyles(domElement, nextProp); } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { var nextHtml = nextProp ? nextProp[HTML$1] : undefined; if (nextHtml != null) { setInnerHTML(domElement, nextHtml); } } else if (propKey === CHILDREN) { if (typeof nextProp === 'string') { // Avoid setting initial textContent when the text is empty. In IE11 setting // textContent on a <textarea> will cause the placeholder to not // show within the <textarea> until it has been focused and blurred again. // https://github.com/facebook/react/issues/6731#issuecomment-254874553 var canSetTextContent = tag !== 'textarea' || nextProp !== ''; if (canSetTextContent) { setTextContent(domElement, nextProp); } } else if (typeof nextProp === 'number') { setTextContent(domElement, '' + nextProp); } } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (propKey === AUTOFOCUS) ; else if (registrationNameDependencies.hasOwnProperty(propKey)) { if (nextProp != null) { if ( typeof nextProp !== 'function') { warnForInvalidEventListener(propKey, nextProp); } if (propKey === 'onScroll') { listenToNonDelegatedEvent('scroll', domElement); } } } else if (nextProp != null) { setValueForProperty(domElement, propKey, nextProp, isCustomComponentTag); } } } function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) { // TODO: Handle wasCustomComponentTag for (var i = 0; i < updatePayload.length; i += 2) { var propKey = updatePayload[i]; var propValue = updatePayload[i + 1]; if (propKey === STYLE) { setValueForStyles(domElement, propValue); } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { setInnerHTML(domElement, propValue); } else if (propKey === CHILDREN) { setTextContent(domElement, propValue); } else { setValueForProperty(domElement, propKey, propValue, isCustomComponentTag); } } } function createElement(type, props, rootContainerElement, parentNamespace) { var isCustomComponentTag; // We create tags in the namespace of their parent container, except HTML // tags get no namespace. var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement); var domElement; var namespaceURI = parentNamespace; if (namespaceURI === HTML_NAMESPACE) { namespaceURI = getIntrinsicNamespace(type); } if (namespaceURI === HTML_NAMESPACE) { { isCustomComponentTag = isCustomComponent(type, props); // Should this check be gated by parent namespace? Not sure we want to // allow <SVG> or <mATH>. if (!isCustomComponentTag && type !== type.toLowerCase()) { error('<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', type); } } if (type === 'script') { // Create the script via .innerHTML so its "parser-inserted" flag is // set to true and it does not execute var div = ownerDocument.createElement('div'); div.innerHTML = '<script><' + '/script>'; // eslint-disable-line // This is guaranteed to yield a script element. var firstChild = div.firstChild; domElement = div.removeChild(firstChild); } else if (typeof props.is === 'string') { // $FlowIssue `createElement` should be updated for Web Components domElement = ownerDocument.createElement(type, { is: props.is }); } else { // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug. // See discussion in https://github.com/facebook/react/pull/6896 // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240 domElement = ownerDocument.createElement(type); // Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple` and `size` // attributes on `select`s needs to be added before `option`s are inserted. // This prevents: // - a bug where the `select` does not scroll to the correct option because singular // `select` elements automatically pick the first item #13222 // - a bug where the `select` set the first item as selected despite the `size` attribute #14239 // See https://github.com/facebook/react/issues/13222 // and https://github.com/facebook/react/issues/14239 if (type === 'select') { var node = domElement; if (props.multiple) { node.multiple = true; } else if (props.size) { // Setting a size greater than 1 causes a select to behave like `multiple=true`, where // it is possible that no option is selected. // // This is only necessary when a select in "single selection mode". node.size = props.size; } } } } else { domElement = ownerDocument.createElementNS(namespaceURI, type); } { if (namespaceURI === HTML_NAMESPACE) { if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && !hasOwnProperty.call(warnedUnknownTags, type)) { warnedUnknownTags[type] = true; error('The tag <%s> is unrecognized in this browser. ' + 'If you meant to render a React component, start its name with ' + 'an uppercase letter.', type); } } } return domElement; } function createTextNode(text, rootContainerElement) { return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text); } function setInitialProperties(domElement, tag, rawProps, rootContainerElement) { var isCustomComponentTag = isCustomComponent(tag, rawProps); { validatePropertiesInDevelopment(tag, rawProps); } // TODO: Make sure that we check isMounted before firing any of these events. var props; switch (tag) { case 'dialog': listenToNonDelegatedEvent('cancel', domElement); listenToNonDelegatedEvent('close', domElement); props = rawProps; break; case 'iframe': case 'object': case 'embed': // We listen to this event in case to ensure emulated bubble // listeners still fire for the load event. listenToNonDelegatedEvent('load', domElement); props = rawProps; break; case 'video': case 'audio': // We listen to these events in case to ensure emulated bubble // listeners still fire for all the media events. for (var i = 0; i < mediaEventTypes.length; i++) { listenToNonDelegatedEvent(mediaEventTypes[i], domElement); } props = rawProps; break; case 'source': // We listen to this event in case to ensure emulated bubble // listeners still fire for the error event. listenToNonDelegatedEvent('error', domElement); props = rawProps; break; case 'img': case 'image': case 'link': // We listen to these events in case to ensure emulated bubble // listeners still fire for error and load events. listenToNonDelegatedEvent('error', domElement); listenToNonDelegatedEvent('load', domElement); props = rawProps; break; case 'details': // We listen to this event in case to ensure emulated bubble // listeners still fire for the toggle event. listenToNonDelegatedEvent('toggle', domElement); props = rawProps; break; case 'input': initWrapperState(domElement, rawProps); props = getHostProps(domElement, rawProps); // We listen to this event in case to ensure emulated bubble // listeners still fire for the invalid event. listenToNonDelegatedEvent('invalid', domElement); break; case 'option': validateProps(domElement, rawProps); props = rawProps; break; case 'select': initWrapperState$1(domElement, rawProps); props = getHostProps$1(domElement, rawProps); // We listen to this event in case to ensure emulated bubble // listeners still fire for the invalid event. listenToNonDelegatedEvent('invalid', domElement); break; case 'textarea': initWrapperState$2(domElement, rawProps); props = getHostProps$2(domElement, rawProps); // We listen to this event in case to ensure emulated bubble // listeners still fire for the invalid event. listenToNonDelegatedEvent('invalid', domElement); break; default: props = rawProps; } assertValidProps(tag, props); setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag); switch (tag) { case 'input': // TODO: Make sure we check if this is still unmounted or do any clean // up necessary since we never stop tracking anymore. track(domElement); postMountWrapper(domElement, rawProps, false); break; case 'textarea': // TODO: Make sure we check if this is still unmounted or do any clean // up necessary since we never stop tracking anymore. track(domElement); postMountWrapper$3(domElement); break; case 'option': postMountWrapper$1(domElement, rawProps); break; case 'select': postMountWrapper$2(domElement, rawProps); break; default: if (typeof props.onClick === 'function') { // TODO: This cast may not be sound for SVG, MathML or custom elements. trapClickOnNonInteractiveElement(domElement); } break; } } // Calculate the diff between the two objects. function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) { { validatePropertiesInDevelopment(tag, nextRawProps); } var updatePayload = null; var lastProps; var nextProps; switch (tag) { case 'input': lastProps = getHostProps(domElement, lastRawProps); nextProps = getHostProps(domElement, nextRawProps); updatePayload = []; break; case 'select': lastProps = getHostProps$1(domElement, lastRawProps); nextProps = getHostProps$1(domElement, nextRawProps); updatePayload = []; break; case 'textarea': lastProps = getHostProps$2(domElement, lastRawProps); nextProps = getHostProps$2(domElement, nextRawProps); updatePayload = []; break; default: lastProps = lastRawProps; nextProps = nextRawProps; if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') { // TODO: This cast may not be sound for SVG, MathML or custom elements. trapClickOnNonInteractiveElement(domElement); } break; } assertValidProps(tag, nextProps); var propKey; var styleName; var styleUpdates = null; for (propKey in lastProps) { if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) { continue; } if (propKey === STYLE) { var lastStyle = lastProps[propKey]; for (styleName in lastStyle) { if (lastStyle.hasOwnProperty(styleName)) { if (!styleUpdates) { styleUpdates = {}; } styleUpdates[styleName] = ''; } } } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) ; else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (propKey === AUTOFOCUS) ; else if (registrationNameDependencies.hasOwnProperty(propKey)) { // This is a special case. If any listener updates we need to ensure // that the "current" fiber pointer gets updated so we need a commit // to update this element. if (!updatePayload) { updatePayload = []; } } else { // For all other deleted properties we add it to the queue. We use // the allowed property list in the commit phase instead. (updatePayload = updatePayload || []).push(propKey, null); } } for (propKey in nextProps) { var nextProp = nextProps[propKey]; var lastProp = lastProps != null ? lastProps[propKey] : undefined; if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) { continue; } if (propKey === STYLE) { { if (nextProp) { // Freeze the next style object so that we can assume it won't be // mutated. We have already warned for this in the past. Object.freeze(nextProp); } } if (lastProp) { // Unset styles on `lastProp` but not on `nextProp`. for (styleName in lastProp) { if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) { if (!styleUpdates) { styleUpdates = {}; } styleUpdates[styleName] = ''; } } // Update styles that changed since `lastProp`. for (styleName in nextProp) { if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) { if (!styleUpdates) { styleUpdates = {}; } styleUpdates[styleName] = nextProp[styleName]; } } } else { // Relies on `updateStylesByID` not mutating `styleUpdates`. if (!styleUpdates) { if (!updatePayload) { updatePayload = []; } updatePayload.push(propKey, styleUpdates); } styleUpdates = nextProp; } } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { var nextHtml = nextProp ? nextProp[HTML$1] : undefined; var lastHtml = lastProp ? lastProp[HTML$1] : undefined; if (nextHtml != null) { if (lastHtml !== nextHtml) { (updatePayload = updatePayload || []).push(propKey, nextHtml); } } } else if (propKey === CHILDREN) { if (typeof nextProp === 'string' || typeof nextProp === 'number') { (updatePayload = updatePayload || []).push(propKey, '' + nextProp); } } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (registrationNameDependencies.hasOwnProperty(propKey)) { if (nextProp != null) { // We eagerly listen to this even though we haven't committed yet. if ( typeof nextProp !== 'function') { warnForInvalidEventListener(propKey, nextProp); } if (propKey === 'onScroll') { listenToNonDelegatedEvent('scroll', domElement); } } if (!updatePayload && lastProp !== nextProp) { // This is a special case. If any listener updates we need to ensure // that the "current" props pointer gets updated so we need a commit // to update this element. updatePayload = []; } } else { // For any other property we always add it to the queue and then we // filter it out using the allowed property list during the commit. (updatePayload = updatePayload || []).push(propKey, nextProp); } } if (styleUpdates) { { validateShorthandPropertyCollisionInDev(styleUpdates, nextProps[STYLE]); } (updatePayload = updatePayload || []).push(STYLE, styleUpdates); } return updatePayload; } // Apply the diff. function updateProperties(domElement, updatePayload, tag, lastRawProps, nextRawProps) { // Update checked *before* name. // In the middle of an update, it is possible to have multiple checked. // When a checked radio tries to change name, browser makes another radio's checked false. if (tag === 'input' && nextRawProps.type === 'radio' && nextRawProps.name != null) { updateChecked(domElement, nextRawProps); } var wasCustomComponentTag = isCustomComponent(tag, lastRawProps); var isCustomComponentTag = isCustomComponent(tag, nextRawProps); // Apply the diff. updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag); // TODO: Ensure that an update gets scheduled if any of the special props // changed. switch (tag) { case 'input': // Update the wrapper around inputs *after* updating props. This has to // happen after `updateDOMProperties`. Otherwise HTML5 input validations // raise warnings and prevent the new value from being assigned. updateWrapper(domElement, nextRawProps); break; case 'textarea': updateWrapper$1(domElement, nextRawProps); break; case 'select': // <select> value update needs to occur after <option> children // reconciliation postUpdateWrapper(domElement, nextRawProps); break; } } function getPossibleStandardName(propName) { { var lowerCasedName = propName.toLowerCase(); if (!possibleStandardNames.hasOwnProperty(lowerCasedName)) { return null; } return possibleStandardNames[lowerCasedName] || null; } } function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, rootContainerElement, isConcurrentMode, shouldWarnDev) { var isCustomComponentTag; var extraAttributeNames; { isCustomComponentTag = isCustomComponent(tag, rawProps); validatePropertiesInDevelopment(tag, rawProps); } // TODO: Make sure that we check isMounted before firing any of these events. switch (tag) { case 'dialog': listenToNonDelegatedEvent('cancel', domElement); listenToNonDelegatedEvent('close', domElement); break; case 'iframe': case 'object': case 'embed': // We listen to this event in case to ensure emulated bubble // listeners still fire for the load event. listenToNonDelegatedEvent('load', domElement); break; case 'video': case 'audio': // We listen to these events in case to ensure emulated bubble // listeners still fire for all the media events. for (var i = 0; i < mediaEventTypes.length; i++) { listenToNonDelegatedEvent(mediaEventTypes[i], domElement); } break; case 'source': // We listen to this event in case to ensure emulated bubble // listeners still fire for the error event. listenToNonDelegatedEvent('error', domElement); break; case 'img': case 'image': case 'link': // We listen to these events in case to ensure emulated bubble // listeners still fire for error and load events. listenToNonDelegatedEvent('error', domElement); listenToNonDelegatedEvent('load', domElement); break; case 'details': // We listen to this event in case to ensure emulated bubble // listeners still fire for the toggle event. listenToNonDelegatedEvent('toggle', domElement); break; case 'input': initWrapperState(domElement, rawProps); // We listen to this event in case to ensure emulated bubble // listeners still fire for the invalid event. listenToNonDelegatedEvent('invalid', domElement); break; case 'option': validateProps(domElement, rawProps); break; case 'select': initWrapperState$1(domElement, rawProps); // We listen to this event in case to ensure emulated bubble // listeners still fire for the invalid event. listenToNonDelegatedEvent('invalid', domElement); break; case 'textarea': initWrapperState$2(domElement, rawProps); // We listen to this event in case to ensure emulated bubble // listeners still fire for the invalid event. listenToNonDelegatedEvent('invalid', domElement); break; } assertValidProps(tag, rawProps); { extraAttributeNames = new Set(); var attributes = domElement.attributes; for (var _i = 0; _i < attributes.length; _i++) { var name = attributes[_i].name.toLowerCase(); switch (name) { // Controlled attributes are not validated // TODO: Only ignore them on controlled tags. case 'value': break; case 'checked': break; case 'selected': break; default: // Intentionally use the original name. // See discussion in https://github.com/facebook/react/pull/10676. extraAttributeNames.add(attributes[_i].name); } } } var updatePayload = null; for (var propKey in rawProps) { if (!rawProps.hasOwnProperty(propKey)) { continue; } var nextProp = rawProps[propKey]; if (propKey === CHILDREN) { // For text content children we compare against textContent. This // might match additional HTML that is hidden when we read it using // textContent. E.g. "foo" will match "f<span>oo</span>" but that still // satisfies our requirement. Our requirement is not to produce perfect // HTML and attributes. Ideally we should preserve structure but it's // ok not to if the visible content is still enough to indicate what // even listeners these nodes might be wired up to. // TODO: Warn if there is more than a single textNode as a child. // TODO: Should we use domElement.firstChild.nodeValue to compare? if (typeof nextProp === 'string') { if (domElement.textContent !== nextProp) { if (rawProps[SUPPRESS_HYDRATION_WARNING] !== true) { checkForUnmatchedText(domElement.textContent, nextProp, isConcurrentMode, shouldWarnDev); } updatePayload = [CHILDREN, nextProp]; } } else if (typeof nextProp === 'number') { if (domElement.textContent !== '' + nextProp) { if (rawProps[SUPPRESS_HYDRATION_WARNING] !== true) { checkForUnmatchedText(domElement.textContent, nextProp, isConcurrentMode, shouldWarnDev); } updatePayload = [CHILDREN, '' + nextProp]; } } } else if (registrationNameDependencies.hasOwnProperty(propKey)) { if (nextProp != null) { if ( typeof nextProp !== 'function') { warnForInvalidEventListener(propKey, nextProp); } if (propKey === 'onScroll') { listenToNonDelegatedEvent('scroll', domElement); } } } else if (shouldWarnDev && true && // Convince Flow we've calculated it (it's DEV-only in this method.) typeof isCustomComponentTag === 'boolean') { // Validate that the properties correspond to their expected values. var serverValue = void 0; var propertyInfo = isCustomComponentTag && enableCustomElementPropertySupport ? null : getPropertyInfo(propKey); if (rawProps[SUPPRESS_HYDRATION_WARNING] === true) ; else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING || // Controlled attributes are not validated // TODO: Only ignore them on controlled tags. propKey === 'value' || propKey === 'checked' || propKey === 'selected') ; else if (propKey === DANGEROUSLY_SET_INNER_HTML) { var serverHTML = domElement.innerHTML; var nextHtml = nextProp ? nextProp[HTML$1] : undefined; if (nextHtml != null) { var expectedHTML = normalizeHTML(domElement, nextHtml); if (expectedHTML !== serverHTML) { warnForPropDifference(propKey, serverHTML, expectedHTML); } } } else if (propKey === STYLE) { // $FlowFixMe - Should be inferred as not undefined. extraAttributeNames.delete(propKey); if (canDiffStyleForHydrationWarning) { var expectedStyle = createDangerousStringForStyles(nextProp); serverValue = domElement.getAttribute('style'); if (expectedStyle !== serverValue) { warnForPropDifference(propKey, serverValue, expectedStyle); } } } else if (isCustomComponentTag && !enableCustomElementPropertySupport) { // $FlowFixMe - Should be inferred as not undefined. extraAttributeNames.delete(propKey.toLowerCase()); serverValue = getValueForAttribute(domElement, propKey, nextProp); if (nextProp !== serverValue) { warnForPropDifference(propKey, serverValue, nextProp); } } else if (!shouldIgnoreAttribute(propKey, propertyInfo, isCustomComponentTag) && !shouldRemoveAttribute(propKey, nextProp, propertyInfo, isCustomComponentTag)) { var isMismatchDueToBadCasing = false; if (propertyInfo !== null) { // $FlowFixMe - Should be inferred as not undefined. extraAttributeNames.delete(propertyInfo.attributeName); serverValue = getValueForProperty(domElement, propKey, nextProp, propertyInfo); } else { var ownNamespace = parentNamespace; if (ownNamespace === HTML_NAMESPACE) { ownNamespace = getIntrinsicNamespace(tag); } if (ownNamespace === HTML_NAMESPACE) { // $FlowFixMe - Should be inferred as not undefined. extraAttributeNames.delete(propKey.toLowerCase()); } else { var standardName = getPossibleStandardName(propKey); if (standardName !== null && standardName !== propKey) { // If an SVG prop is supplied with bad casing, it will // be successfully parsed from HTML, but will produce a mismatch // (and would be incorrectly rendered on the client). // However, we already warn about bad casing elsewhere. // So we'll skip the misleading extra mismatch warning in this case. isMismatchDueToBadCasing = true; // $FlowFixMe - Should be inferred as not undefined. extraAttributeNames.delete(standardName); } // $FlowFixMe - Should be inferred as not undefined. extraAttributeNames.delete(propKey); } serverValue = getValueForAttribute(domElement, propKey, nextProp); } var dontWarnCustomElement = enableCustomElementPropertySupport ; if (!dontWarnCustomElement && nextProp !== serverValue && !isMismatchDueToBadCasing) { warnForPropDifference(propKey, serverValue, nextProp); } } } } { if (shouldWarnDev) { if ( // $FlowFixMe - Should be inferred as not undefined. extraAttributeNames.size > 0 && rawProps[SUPPRESS_HYDRATION_WARNING] !== true) { // $FlowFixMe - Should be inferred as not undefined. warnForExtraAttributes(extraAttributeNames); } } } switch (tag) { case 'input': // TODO: Make sure we check if this is still unmounted or do any clean // up necessary since we never stop tracking anymore. track(domElement); postMountWrapper(domElement, rawProps, true); break; case 'textarea': // TODO: Make sure we check if this is still unmounted or do any clean // up necessary since we never stop tracking anymore. track(domElement); postMountWrapper$3(domElement); break; case 'select': case 'option': // For input and textarea we current always set the value property at // post mount to force it to diverge from attributes. However, for // option and select we don't quite do the same thing and select // is not resilient to the DOM state changing so we don't do that here. // TODO: Consider not doing this for input and textarea. break; default: if (typeof rawProps.onClick === 'function') { // TODO: This cast may not be sound for SVG, MathML or custom elements. trapClickOnNonInteractiveElement(domElement); } break; } return updatePayload; } function diffHydratedText(textNode, text, isConcurrentMode) { var isDifferent = textNode.nodeValue !== text; return isDifferent; } function warnForDeletedHydratableElement(parentNode, child) { { if (didWarnInvalidHydration) { return; } didWarnInvalidHydration = true; error('Did not expect server HTML to contain a <%s> in <%s>.', child.nodeName.toLowerCase(), parentNode.nodeName.toLowerCase()); } } function warnForDeletedHydratableText(parentNode, child) { { if (didWarnInvalidHydration) { return; } didWarnInvalidHydration = true; error('Did not expect server HTML to contain the text node "%s" in <%s>.', child.nodeValue, parentNode.nodeName.toLowerCase()); } } function warnForInsertedHydratedElement(parentNode, tag, props) { { if (didWarnInvalidHydration) { return; } didWarnInvalidHydration = true; error('Expected server HTML to contain a matching <%s> in <%s>.', tag, parentNode.nodeName.toLowerCase()); } } function warnForInsertedHydratedText(parentNode, text) { { if (text === '') { // We expect to insert empty text nodes since they're not represented in // the HTML. // TODO: Remove this special case if we can just avoid inserting empty // text nodes. return; } if (didWarnInvalidHydration) { return; } didWarnInvalidHydration = true; error('Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase()); } } function restoreControlledState$3(domElement, tag, props) { switch (tag) { case 'input': restoreControlledState(domElement, props); return; case 'textarea': restoreControlledState$2(domElement, props); return; case 'select': restoreControlledState$1(domElement, props); return; } } var validateDOMNesting = function () {}; var updatedAncestorInfo = function () {}; { // This validation code was written based on the HTML5 parsing spec: // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope // // Note: this does not catch all invalid nesting, nor does it try to (as it's // not clear what practical benefit doing so provides); instead, we warn only // for cases where the parser will give a parse tree differing from what React // intended. For example, <b><div></div></b> is invalid but we don't warn // because it still parses correctly; we do warn for other cases like nested // <p> tags where the beginning of the second element implicitly closes the // first, causing a confusing mess. // https://html.spec.whatwg.org/multipage/syntax.html#special var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp']; // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point // TODO: Distinguish by namespace here -- for <title>, including it here // errs on the side of fewer warnings 'foreignObject', 'desc', 'title']; // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope var buttonScopeTags = inScopeTags.concat(['button']); // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt']; var emptyAncestorInfo = { current: null, formTag: null, aTagInScope: null, buttonTagInScope: null, nobrTagInScope: null, pTagInButtonScope: null, listItemTagAutoclosing: null, dlItemTagAutoclosing: null }; updatedAncestorInfo = function (oldInfo, tag) { var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo); var info = { tag: tag }; if (inScopeTags.indexOf(tag) !== -1) { ancestorInfo.aTagInScope = null; ancestorInfo.buttonTagInScope = null; ancestorInfo.nobrTagInScope = null; } if (buttonScopeTags.indexOf(tag) !== -1) { ancestorInfo.pTagInButtonScope = null; } // See rules for 'li', 'dd', 'dt' start tags in // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') { ancestorInfo.listItemTagAutoclosing = null; ancestorInfo.dlItemTagAutoclosing = null; } ancestorInfo.current = info; if (tag === 'form') { ancestorInfo.formTag = info; } if (tag === 'a') { ancestorInfo.aTagInScope = info; } if (tag === 'button') { ancestorInfo.buttonTagInScope = info; } if (tag === 'nobr') { ancestorInfo.nobrTagInScope = info; } if (tag === 'p') { ancestorInfo.pTagInButtonScope = info; } if (tag === 'li') { ancestorInfo.listItemTagAutoclosing = info; } if (tag === 'dd' || tag === 'dt') { ancestorInfo.dlItemTagAutoclosing = info; } return ancestorInfo; }; /** * Returns whether */ var isTagValidWithParent = function (tag, parentTag) { // First, let's check if we're in an unusual parsing mode... switch (parentTag) { // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect case 'select': return tag === 'option' || tag === 'optgroup' || tag === '#text'; case 'optgroup': return tag === 'option' || tag === '#text'; // Strictly speaking, seeing an <option> doesn't mean we're in a <select> // but case 'option': return tag === '#text'; // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption // No special behavior since these rules fall back to "in body" mode for // all except special table nodes which cause bad parsing behavior anyway. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr case 'tr': return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template'; // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody case 'tbody': case 'thead': case 'tfoot': return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template'; // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup case 'colgroup': return tag === 'col' || tag === 'template'; // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable case 'table': return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template'; // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead case 'head': return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template'; // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element case 'html': return tag === 'head' || tag === 'body' || tag === 'frameset'; case 'frameset': return tag === 'frame'; case '#document': return tag === 'html'; } // Probably in the "in body" parsing mode, so we outlaw only tag combos // where the parsing rules cause implicit opens or closes to be added. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody switch (tag) { case 'h1': case 'h2': case 'h3': case 'h4': case 'h5': case 'h6': return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6'; case 'rp': case 'rt': return impliedEndTags.indexOf(parentTag) === -1; case 'body': case 'caption': case 'col': case 'colgroup': case 'frameset': case 'frame': case 'head': case 'html': case 'tbody': case 'td': case 'tfoot': case 'th': case 'thead': case 'tr': // These tags are only valid with a few parents that have special child // parsing rules -- if we're down here, then none of those matched and // so we allow it only if we don't know what the parent is, as all other // cases are invalid. return parentTag == null; } return true; }; /** * Returns whether */ var findInvalidAncestorForTag = function (tag, ancestorInfo) { switch (tag) { case 'address': case 'article': case 'aside': case 'blockquote': case 'center': case 'details': case 'dialog': case 'dir': case 'div': case 'dl': case 'fieldset': case 'figcaption': case 'figure': case 'footer': case 'header': case 'hgroup': case 'main': case 'menu': case 'nav': case 'ol': case 'p': case 'section': case 'summary': case 'ul': case 'pre': case 'listing': case 'table': case 'hr': case 'xmp': case 'h1': case 'h2': case 'h3': case 'h4': case 'h5': case 'h6': return ancestorInfo.pTagInButtonScope; case 'form': return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope; case 'li': return ancestorInfo.listItemTagAutoclosing; case 'dd': case 'dt': return ancestorInfo.dlItemTagAutoclosing; case 'button': return ancestorInfo.buttonTagInScope; case 'a': // Spec says something about storing a list of markers, but it sounds // equivalent to this check. return ancestorInfo.aTagInScope; case 'nobr': return ancestorInfo.nobrTagInScope; } return null; }; var didWarn$1 = {}; validateDOMNesting = function (childTag, childText, ancestorInfo) { ancestorInfo = ancestorInfo || emptyAncestorInfo; var parentInfo = ancestorInfo.current; var parentTag = parentInfo && parentInfo.tag; if (childText != null) { if (childTag != null) { error('validateDOMNesting: when childText is passed, childTag should be null'); } childTag = '#text'; } var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo; var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo); var invalidParentOrAncestor = invalidParent || invalidAncestor; if (!invalidParentOrAncestor) { return; } var ancestorTag = invalidParentOrAncestor.tag; var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag; if (didWarn$1[warnKey]) { return; } didWarn$1[warnKey] = true; var tagDisplayName = childTag; var whitespaceInfo = ''; if (childTag === '#text') { if (/\S/.test(childText)) { tagDisplayName = 'Text nodes'; } else { tagDisplayName = 'Whitespace text nodes'; whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.'; } } else { tagDisplayName = '<' + childTag + '>'; } if (invalidParent) { var info = ''; if (ancestorTag === 'table' && childTag === 'tr') { info += ' Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated by ' + 'the browser.'; } error('validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s', tagDisplayName, ancestorTag, whitespaceInfo, info); } else { error('validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>.', tagDisplayName, ancestorTag); } }; } var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning'; var SUSPENSE_START_DATA = '$'; var SUSPENSE_END_DATA = '/$'; var SUSPENSE_PENDING_START_DATA = '$?'; var SUSPENSE_FALLBACK_START_DATA = '$!'; var STYLE$1 = 'style'; var eventsEnabled = null; var selectionInformation = null; function getRootHostContext(rootContainerInstance) { var type; var namespace; var nodeType = rootContainerInstance.nodeType; switch (nodeType) { case DOCUMENT_NODE: case DOCUMENT_FRAGMENT_NODE: { type = nodeType === DOCUMENT_NODE ? '#document' : '#fragment'; var root = rootContainerInstance.documentElement; namespace = root ? root.namespaceURI : getChildNamespace(null, ''); break; } default: { var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance; var ownNamespace = container.namespaceURI || null; type = container.tagName; namespace = getChildNamespace(ownNamespace, type); break; } } { var validatedTag = type.toLowerCase(); var ancestorInfo = updatedAncestorInfo(null, validatedTag); return { namespace: namespace, ancestorInfo: ancestorInfo }; } } function getChildHostContext(parentHostContext, type, rootContainerInstance) { { var parentHostContextDev = parentHostContext; var namespace = getChildNamespace(parentHostContextDev.namespace, type); var ancestorInfo = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type); return { namespace: namespace, ancestorInfo: ancestorInfo }; } } function getPublicInstance(instance) { return instance; } function prepareForCommit(containerInfo) { eventsEnabled = isEnabled(); selectionInformation = getSelectionInformation(); var activeInstance = null; setEnabled(false); return activeInstance; } function resetAfterCommit(containerInfo) { restoreSelection(selectionInformation); setEnabled(eventsEnabled); eventsEnabled = null; selectionInformation = null; } function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) { var parentNamespace; { // TODO: take namespace into account when validating. var hostContextDev = hostContext; validateDOMNesting(type, null, hostContextDev.ancestorInfo); if (typeof props.children === 'string' || typeof props.children === 'number') { var string = '' + props.children; var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type); validateDOMNesting(null, string, ownAncestorInfo); } parentNamespace = hostContextDev.namespace; } var domElement = createElement(type, props, rootContainerInstance, parentNamespace); precacheFiberNode(internalInstanceHandle, domElement); updateFiberProps(domElement, props); return domElement; } function appendInitialChild(parentInstance, child) { parentInstance.appendChild(child); } function finalizeInitialChildren(domElement, type, props, rootContainerInstance, hostContext) { setInitialProperties(domElement, type, props, rootContainerInstance); switch (type) { case 'button': case 'input': case 'select': case 'textarea': return !!props.autoFocus; case 'img': return true; default: return false; } } function prepareUpdate(domElement, type, oldProps, newProps, rootContainerInstance, hostContext) { { var hostContextDev = hostContext; if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === 'string' || typeof newProps.children === 'number')) { var string = '' + newProps.children; var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type); validateDOMNesting(null, string, ownAncestorInfo); } } return diffProperties(domElement, type, oldProps, newProps); } function shouldSetTextContent(type, props) { return type === 'textarea' || type === 'noscript' || typeof props.children === 'string' || typeof props.children === 'number' || typeof props.dangerouslySetInnerHTML === 'object' && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null; } function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) { { var hostContextDev = hostContext; validateDOMNesting(null, text, hostContextDev.ancestorInfo); } var textNode = createTextNode(text, rootContainerInstance); precacheFiberNode(internalInstanceHandle, textNode); return textNode; } function getCurrentEventPriority() { var currentEvent = window.event; if (currentEvent === undefined) { return DefaultEventPriority; } return getEventPriority(currentEvent.type); } // if a component just imports ReactDOM (e.g. for findDOMNode). // Some environments might not have setTimeout or clearTimeout. var scheduleTimeout = typeof setTimeout === 'function' ? setTimeout : undefined; var cancelTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined; var noTimeout = -1; var localPromise = typeof Promise === 'function' ? Promise : undefined; // ------------------- var scheduleMicrotask = typeof queueMicrotask === 'function' ? queueMicrotask : typeof localPromise !== 'undefined' ? function (callback) { return localPromise.resolve(null).then(callback).catch(handleErrorInNextTick); } : scheduleTimeout; // TODO: Determine the best fallback here. function handleErrorInNextTick(error) { setTimeout(function () { throw error; }); } // ------------------- function commitMount(domElement, type, newProps, internalInstanceHandle) { // Despite the naming that might imply otherwise, this method only // fires if there is an `Update` effect scheduled during mounting. // This happens if `finalizeInitialChildren` returns `true` (which it // does to implement the `autoFocus` attribute on the client). But // there are also other cases when this might happen (such as patching // up text content during hydration mismatch). So we'll check this again. switch (type) { case 'button': case 'input': case 'select': case 'textarea': if (newProps.autoFocus) { domElement.focus(); } return; case 'img': { if (newProps.src) { domElement.src = newProps.src; } return; } } } function commitUpdate(domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) { // Apply the diff to the DOM node. updateProperties(domElement, updatePayload, type, oldProps, newProps); // Update the props handle so that we know which props are the ones with // with current event handlers. updateFiberProps(domElement, newProps); } function resetTextContent(domElement) { setTextContent(domElement, ''); } function commitTextUpdate(textInstance, oldText, newText) { textInstance.nodeValue = newText; } function appendChild(parentInstance, child) { parentInstance.appendChild(child); } function appendChildToContainer(container, child) { var parentNode; if (container.nodeType === COMMENT_NODE) { parentNode = container.parentNode; parentNode.insertBefore(child, container); } else { parentNode = container; parentNode.appendChild(child); } // This container might be used for a portal. // If something inside a portal is clicked, that click should bubble // through the React tree. However, on Mobile Safari the click would // never bubble through the *DOM* tree unless an ancestor with onclick // event exists. So we wouldn't see it and dispatch it. // This is why we ensure that non React root containers have inline onclick // defined. // https://github.com/facebook/react/issues/11918 var reactRootContainer = container._reactRootContainer; if ((reactRootContainer === null || reactRootContainer === undefined) && parentNode.onclick === null) { // TODO: This cast may not be sound for SVG, MathML or custom elements. trapClickOnNonInteractiveElement(parentNode); } } function insertBefore(parentInstance, child, beforeChild) { parentInstance.insertBefore(child, beforeChild); } function insertInContainerBefore(container, child, beforeChild) { if (container.nodeType === COMMENT_NODE) { container.parentNode.insertBefore(child, beforeChild); } else { container.insertBefore(child, beforeChild); } } function removeChild(parentInstance, child) { parentInstance.removeChild(child); } function removeChildFromContainer(container, child) { if (container.nodeType === COMMENT_NODE) { container.parentNode.removeChild(child); } else { container.removeChild(child); } } function clearSuspenseBoundary(parentInstance, suspenseInstance) { var node = suspenseInstance; // Delete all nodes within this suspense boundary. // There might be nested nodes so we need to keep track of how // deep we are and only break out when we're back on top. var depth = 0; do { var nextNode = node.nextSibling; parentInstance.removeChild(node); if (nextNode && nextNode.nodeType === COMMENT_NODE) { var data = nextNode.data; if (data === SUSPENSE_END_DATA) { if (depth === 0) { parentInstance.removeChild(nextNode); // Retry if any event replaying was blocked on this. retryIfBlockedOn(suspenseInstance); return; } else { depth--; } } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_PENDING_START_DATA || data === SUSPENSE_FALLBACK_START_DATA) { depth++; } } node = nextNode; } while (node); // TODO: Warn, we didn't find the end comment boundary. // Retry if any event replaying was blocked on this. retryIfBlockedOn(suspenseInstance); } function clearSuspenseBoundaryFromContainer(container, suspenseInstance) { if (container.nodeType === COMMENT_NODE) { clearSuspenseBoundary(container.parentNode, suspenseInstance); } else if (container.nodeType === ELEMENT_NODE) { clearSuspenseBoundary(container, suspenseInstance); } // Retry if any event replaying was blocked on this. retryIfBlockedOn(container); } function hideInstance(instance) { // TODO: Does this work for all element types? What about MathML? Should we // pass host context to this method? instance = instance; var style = instance.style; if (typeof style.setProperty === 'function') { style.setProperty('display', 'none', 'important'); } else { style.display = 'none'; } } function hideTextInstance(textInstance) { textInstance.nodeValue = ''; } function unhideInstance(instance, props) { instance = instance; var styleProp = props[STYLE$1]; var display = styleProp !== undefined && styleProp !== null && styleProp.hasOwnProperty('display') ? styleProp.display : null; instance.style.display = dangerousStyleValue('display', display); } function unhideTextInstance(textInstance, text) { textInstance.nodeValue = text; } function clearContainer(container) { if (container.nodeType === ELEMENT_NODE) { container.textContent = ''; } else if (container.nodeType === DOCUMENT_NODE) { if (container.documentElement) { container.removeChild(container.documentElement); } } } // ------------------- function canHydrateInstance(instance, type, props) { if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) { return null; } // This has now been refined to an element node. return instance; } function canHydrateTextInstance(instance, text) { if (text === '' || instance.nodeType !== TEXT_NODE) { // Empty strings are not parsed by HTML so there won't be a correct match here. return null; } // This has now been refined to a text node. return instance; } function canHydrateSuspenseInstance(instance) { if (instance.nodeType !== COMMENT_NODE) { // Empty strings are not parsed by HTML so there won't be a correct match here. return null; } // This has now been refined to a suspense node. return instance; } function isSuspenseInstancePending(instance) { return instance.data === SUSPENSE_PENDING_START_DATA; } function isSuspenseInstanceFallback(instance) { return instance.data === SUSPENSE_FALLBACK_START_DATA; } function getSuspenseInstanceFallbackErrorDetails(instance) { var dataset = instance.nextSibling && instance.nextSibling.dataset; var digest, message, stack; if (dataset) { digest = dataset.dgst; { message = dataset.msg; stack = dataset.stck; } } { return { message: message, digest: digest, stack: stack }; } // let value = {message: undefined, hash: undefined}; // const nextSibling = instance.nextSibling; // if (nextSibling) { // const dataset = ((nextSibling: any): HTMLTemplateElement).dataset; // value.message = dataset.msg; // value.hash = dataset.hash; // if (true) { // value.stack = dataset.stack; // } // } // return value; } function registerSuspenseInstanceRetry(instance, callback) { instance._reactRetry = callback; } function getNextHydratable(node) { // Skip non-hydratable nodes. for (; node != null; node = node.nextSibling) { var nodeType = node.nodeType; if (nodeType === ELEMENT_NODE || nodeType === TEXT_NODE) { break; } if (nodeType === COMMENT_NODE) { var nodeData = node.data; if (nodeData === SUSPENSE_START_DATA || nodeData === SUSPENSE_FALLBACK_START_DATA || nodeData === SUSPENSE_PENDING_START_DATA) { break; } if (nodeData === SUSPENSE_END_DATA) { return null; } } } return node; } function getNextHydratableSibling(instance) { return getNextHydratable(instance.nextSibling); } function getFirstHydratableChild(parentInstance) { return getNextHydratable(parentInstance.firstChild); } function getFirstHydratableChildWithinContainer(parentContainer) { return getNextHydratable(parentContainer.firstChild); } function getFirstHydratableChildWithinSuspenseInstance(parentInstance) { return getNextHydratable(parentInstance.nextSibling); } function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle, shouldWarnDev) { precacheFiberNode(internalInstanceHandle, instance); // TODO: Possibly defer this until the commit phase where all the events // get attached. updateFiberProps(instance, props); var parentNamespace; { var hostContextDev = hostContext; parentNamespace = hostContextDev.namespace; } // TODO: Temporary hack to check if we're in a concurrent root. We can delete // when the legacy root API is removed. var isConcurrentMode = (internalInstanceHandle.mode & ConcurrentMode) !== NoMode; return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance, isConcurrentMode, shouldWarnDev); } function hydrateTextInstance(textInstance, text, internalInstanceHandle, shouldWarnDev) { precacheFiberNode(internalInstanceHandle, textInstance); // TODO: Temporary hack to check if we're in a concurrent root. We can delete // when the legacy root API is removed. var isConcurrentMode = (internalInstanceHandle.mode & ConcurrentMode) !== NoMode; return diffHydratedText(textInstance, text); } function hydrateSuspenseInstance(suspenseInstance, internalInstanceHandle) { precacheFiberNode(internalInstanceHandle, suspenseInstance); } function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) { var node = suspenseInstance.nextSibling; // Skip past all nodes within this suspense boundary. // There might be nested nodes so we need to keep track of how // deep we are and only break out when we're back on top. var depth = 0; while (node) { if (node.nodeType === COMMENT_NODE) { var data = node.data; if (data === SUSPENSE_END_DATA) { if (depth === 0) { return getNextHydratableSibling(node); } else { depth--; } } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) { depth++; } } node = node.nextSibling; } // TODO: Warn, we didn't find the end comment boundary. return null; } // Returns the SuspenseInstance if this node is a direct child of a // SuspenseInstance. I.e. if its previous sibling is a Comment with // SUSPENSE_x_START_DATA. Otherwise, null. function getParentSuspenseInstance(targetInstance) { var node = targetInstance.previousSibling; // Skip past all nodes within this suspense boundary. // There might be nested nodes so we need to keep track of how // deep we are and only break out when we're back on top. var depth = 0; while (node) { if (node.nodeType === COMMENT_NODE) { var data = node.data; if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) { if (depth === 0) { return node; } else { depth--; } } else if (data === SUSPENSE_END_DATA) { depth++; } } node = node.previousSibling; } return null; } function commitHydratedContainer(container) { // Retry if any event replaying was blocked on this. retryIfBlockedOn(container); } function commitHydratedSuspenseInstance(suspenseInstance) { // Retry if any event replaying was blocked on this. retryIfBlockedOn(suspenseInstance); } function shouldDeleteUnhydratedTailInstances(parentType) { return parentType !== 'head' && parentType !== 'body'; } function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text, isConcurrentMode) { var shouldWarnDev = true; checkForUnmatchedText(textInstance.nodeValue, text, isConcurrentMode, shouldWarnDev); } function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text, isConcurrentMode) { if (parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) { var shouldWarnDev = true; checkForUnmatchedText(textInstance.nodeValue, text, isConcurrentMode, shouldWarnDev); } } function didNotHydrateInstanceWithinContainer(parentContainer, instance) { { if (instance.nodeType === ELEMENT_NODE) { warnForDeletedHydratableElement(parentContainer, instance); } else if (instance.nodeType === COMMENT_NODE) ; else { warnForDeletedHydratableText(parentContainer, instance); } } } function didNotHydrateInstanceWithinSuspenseInstance(parentInstance, instance) { { // $FlowFixMe: Only Element or Document can be parent nodes. var parentNode = parentInstance.parentNode; if (parentNode !== null) { if (instance.nodeType === ELEMENT_NODE) { warnForDeletedHydratableElement(parentNode, instance); } else if (instance.nodeType === COMMENT_NODE) ; else { warnForDeletedHydratableText(parentNode, instance); } } } } function didNotHydrateInstance(parentType, parentProps, parentInstance, instance, isConcurrentMode) { { if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) { if (instance.nodeType === ELEMENT_NODE) { warnForDeletedHydratableElement(parentInstance, instance); } else if (instance.nodeType === COMMENT_NODE) ; else { warnForDeletedHydratableText(parentInstance, instance); } } } } function didNotFindHydratableInstanceWithinContainer(parentContainer, type, props) { { warnForInsertedHydratedElement(parentContainer, type); } } function didNotFindHydratableTextInstanceWithinContainer(parentContainer, text) { { warnForInsertedHydratedText(parentContainer, text); } } function didNotFindHydratableInstanceWithinSuspenseInstance(parentInstance, type, props) { { // $FlowFixMe: Only Element or Document can be parent nodes. var parentNode = parentInstance.parentNode; if (parentNode !== null) warnForInsertedHydratedElement(parentNode, type); } } function didNotFindHydratableTextInstanceWithinSuspenseInstance(parentInstance, text) { { // $FlowFixMe: Only Element or Document can be parent nodes. var parentNode = parentInstance.parentNode; if (parentNode !== null) warnForInsertedHydratedText(parentNode, text); } } function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props, isConcurrentMode) { { if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) { warnForInsertedHydratedElement(parentInstance, type); } } } function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text, isConcurrentMode) { { if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) { warnForInsertedHydratedText(parentInstance, text); } } } function errorHydratingContainer(parentContainer) { { // TODO: This gets logged by onRecoverableError, too, so we should be // able to remove it. error('An error occurred during hydration. The server HTML was replaced with client content in <%s>.', parentContainer.nodeName.toLowerCase()); } } function preparePortalMount(portalInstance) { listenToAllSupportedEvents(portalInstance); } var randomKey = Math.random().toString(36).slice(2); var internalInstanceKey = '__reactFiber$' + randomKey; var internalPropsKey = '__reactProps$' + randomKey; var internalContainerInstanceKey = '__reactContainer$' + randomKey; var internalEventHandlersKey = '__reactEvents$' + randomKey; var internalEventHandlerListenersKey = '__reactListeners$' + randomKey; var internalEventHandlesSetKey = '__reactHandles$' + randomKey; function detachDeletedInstance(node) { // TODO: This function is only called on host components. I don't think all of // these fields are relevant. delete node[internalInstanceKey]; delete node[internalPropsKey]; delete node[internalEventHandlersKey]; delete node[internalEventHandlerListenersKey]; delete node[internalEventHandlesSetKey]; } function precacheFiberNode(hostInst, node) { node[internalInstanceKey] = hostInst; } function markContainerAsRoot(hostRoot, node) { node[internalContainerInstanceKey] = hostRoot; } function unmarkContainerAsRoot(node) { node[internalContainerInstanceKey] = null; } function isContainerMarkedAsRoot(node) { return !!node[internalContainerInstanceKey]; } // Given a DOM node, return the closest HostComponent or HostText fiber ancestor. // If the target node is part of a hydrated or not yet rendered subtree, then // this may also return a SuspenseComponent or HostRoot to indicate that. // Conceptually the HostRoot fiber is a child of the Container node. So if you // pass the Container node as the targetNode, you will not actually get the // HostRoot back. To get to the HostRoot, you need to pass a child of it. // The same thing applies to Suspense boundaries. function getClosestInstanceFromNode(targetNode) { var targetInst = targetNode[internalInstanceKey]; if (targetInst) { // Don't return HostRoot or SuspenseComponent here. return targetInst; } // If the direct event target isn't a React owned DOM node, we need to look // to see if one of its parents is a React owned DOM node. var parentNode = targetNode.parentNode; while (parentNode) { // We'll check if this is a container root that could include // React nodes in the future. We need to check this first because // if we're a child of a dehydrated container, we need to first // find that inner container before moving on to finding the parent // instance. Note that we don't check this field on the targetNode // itself because the fibers are conceptually between the container // node and the first child. It isn't surrounding the container node. // If it's not a container, we check if it's an instance. targetInst = parentNode[internalContainerInstanceKey] || parentNode[internalInstanceKey]; if (targetInst) { // Since this wasn't the direct target of the event, we might have // stepped past dehydrated DOM nodes to get here. However they could // also have been non-React nodes. We need to answer which one. // If we the instance doesn't have any children, then there can't be // a nested suspense boundary within it. So we can use this as a fast // bailout. Most of the time, when people add non-React children to // the tree, it is using a ref to a child-less DOM node. // Normally we'd only need to check one of the fibers because if it // has ever gone from having children to deleting them or vice versa // it would have deleted the dehydrated boundary nested inside already. // However, since the HostRoot starts out with an alternate it might // have one on the alternate so we need to check in case this was a // root. var alternate = targetInst.alternate; if (targetInst.child !== null || alternate !== null && alternate.child !== null) { // Next we need to figure out if the node that skipped past is // nested within a dehydrated boundary and if so, which one. var suspenseInstance = getParentSuspenseInstance(targetNode); while (suspenseInstance !== null) { // We found a suspense instance. That means that we haven't // hydrated it yet. Even though we leave the comments in the // DOM after hydrating, and there are boundaries in the DOM // that could already be hydrated, we wouldn't have found them // through this pass since if the target is hydrated it would // have had an internalInstanceKey on it. // Let's get the fiber associated with the SuspenseComponent // as the deepest instance. var targetSuspenseInst = suspenseInstance[internalInstanceKey]; if (targetSuspenseInst) { return targetSuspenseInst; } // If we don't find a Fiber on the comment, it might be because // we haven't gotten to hydrate it yet. There might still be a // parent boundary that hasn't above this one so we need to find // the outer most that is known. suspenseInstance = getParentSuspenseInstance(suspenseInstance); // If we don't find one, then that should mean that the parent // host component also hasn't hydrated yet. We can return it // below since it will bail out on the isMounted check later. } } return targetInst; } targetNode = parentNode; parentNode = targetNode.parentNode; } return null; } /** * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent * instance, or null if the node was not rendered by this React. */ function getInstanceFromNode(node) { var inst = node[internalInstanceKey] || node[internalContainerInstanceKey]; if (inst) { if (inst.tag === HostComponent || inst.tag === HostText || inst.tag === SuspenseComponent || inst.tag === HostRoot) { return inst; } else { return null; } } return null; } /** * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding * DOM node. */ function getNodeFromInstance(inst) { if (inst.tag === HostComponent || inst.tag === HostText) { // In Fiber this, is just the state node right now. We assume it will be // a host component or host text. return inst.stateNode; } // Without this first invariant, passing a non-DOM-component triggers the next // invariant for a missing parent, which is super confusing. throw new Error('getNodeFromInstance: Invalid argument.'); } function getFiberCurrentPropsFromNode(node) { return node[internalPropsKey] || null; } function updateFiberProps(node, props) { node[internalPropsKey] = props; } function getEventListenerSet(node) { var elementListenerSet = node[internalEventHandlersKey]; if (elementListenerSet === undefined) { elementListenerSet = node[internalEventHandlersKey] = new Set(); } return elementListenerSet; } var loggedTypeFailures = {}; var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; function setCurrentlyValidatingElement(element) { { if (element) { var owner = element._owner; var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); ReactDebugCurrentFrame$1.setExtraStackFrame(stack); } else { ReactDebugCurrentFrame$1.setExtraStackFrame(null); } } } function checkPropTypes(typeSpecs, values, location, componentName, element) { { // $FlowFixMe This is okay but Flow doesn't know it. var has = Function.call.bind(hasOwnProperty); for (var typeSpecName in typeSpecs) { if (has(typeSpecs, typeSpecName)) { var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to // fail the render phase where it didn't fail before. So we log it. // After these have been cleaned up, we'll let them throw. try { // This is intentionally an invariant that gets caught. It's the same // behavior as without this statement except with a better message. if (typeof typeSpecs[typeSpecName] !== 'function') { // eslint-disable-next-line react-internal/prod-error-codes var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); err.name = 'Invariant Violation'; throw err; } error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); } catch (ex) { error$1 = ex; } if (error$1 && !(error$1 instanceof Error)) { setCurrentlyValidatingElement(element); error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); setCurrentlyValidatingElement(null); } if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { // Only monitor this failure once because there tends to be a lot of the // same error. loggedTypeFailures[error$1.message] = true; setCurrentlyValidatingElement(element); error('Failed %s type: %s', location, error$1.message); setCurrentlyValidatingElement(null); } } } } } var valueStack = []; var fiberStack; { fiberStack = []; } var index = -1; function createCursor(defaultValue) { return { current: defaultValue }; } function pop(cursor, fiber) { if (index < 0) { { error('Unexpected pop.'); } return; } { if (fiber !== fiberStack[index]) { error('Unexpected Fiber popped.'); } } cursor.current = valueStack[index]; valueStack[index] = null; { fiberStack[index] = null; } index--; } function push(cursor, value, fiber) { index++; valueStack[index] = cursor.current; { fiberStack[index] = fiber; } cursor.current = value; } var warnedAboutMissingGetChildContext; { warnedAboutMissingGetChildContext = {}; } var emptyContextObject = {}; { Object.freeze(emptyContextObject); } // A cursor to the current merged context object on the stack. var contextStackCursor = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed. var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack. // We use this to get access to the parent context after we have already // pushed the next context provider, and now need to merge their contexts. var previousContext = emptyContextObject; function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) { { if (didPushOwnContextIfProvider && isContextProvider(Component)) { // If the fiber is a context provider itself, when we read its context // we may have already pushed its own child context on the stack. A context // provider should not "see" its own child context. Therefore we read the // previous (parent) context instead for a context provider. return previousContext; } return contextStackCursor.current; } } function cacheContext(workInProgress, unmaskedContext, maskedContext) { { var instance = workInProgress.stateNode; instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; instance.__reactInternalMemoizedMaskedChildContext = maskedContext; } } function getMaskedContext(workInProgress, unmaskedContext) { { var type = workInProgress.type; var contextTypes = type.contextTypes; if (!contextTypes) { return emptyContextObject; } // Avoid recreating masked context unless unmasked context has changed. // Failing to do this will result in unnecessary calls to componentWillReceiveProps. // This may trigger infinite loops if componentWillReceiveProps calls setState. var instance = workInProgress.stateNode; if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) { return instance.__reactInternalMemoizedMaskedChildContext; } var context = {}; for (var key in contextTypes) { context[key] = unmaskedContext[key]; } { var name = getComponentNameFromFiber(workInProgress) || 'Unknown'; checkPropTypes(contextTypes, context, 'context', name); } // Cache unmasked context so we can avoid recreating masked context unless necessary. // Context is created before the class component is instantiated so check for instance. if (instance) { cacheContext(workInProgress, unmaskedContext, context); } return context; } } function hasContextChanged() { { return didPerformWorkStackCursor.current; } } function isContextProvider(type) { { var childContextTypes = type.childContextTypes; return childContextTypes !== null && childContextTypes !== undefined; } } function popContext(fiber) { { pop(didPerformWorkStackCursor, fiber); pop(contextStackCursor, fiber); } } function popTopLevelContextObject(fiber) { { pop(didPerformWorkStackCursor, fiber); pop(contextStackCursor, fiber); } } function pushTopLevelContextObject(fiber, context, didChange) { { if (contextStackCursor.current !== emptyContextObject) { throw new Error('Unexpected context found on stack. ' + 'This error is likely caused by a bug in React. Please file an issue.'); } push(contextStackCursor, context, fiber); push(didPerformWorkStackCursor, didChange, fiber); } } function processChildContext(fiber, type, parentContext) { { var instance = fiber.stateNode; var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future. // It has only been added in Fiber to match the (unintentional) behavior in Stack. if (typeof instance.getChildContext !== 'function') { { var componentName = getComponentNameFromFiber(fiber) || 'Unknown'; if (!warnedAboutMissingGetChildContext[componentName]) { warnedAboutMissingGetChildContext[componentName] = true; error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName); } } return parentContext; } var childContext = instance.getChildContext(); for (var contextKey in childContext) { if (!(contextKey in childContextTypes)) { throw new Error((getComponentNameFromFiber(fiber) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."); } } { var name = getComponentNameFromFiber(fiber) || 'Unknown'; checkPropTypes(childContextTypes, childContext, 'child context', name); } return assign({}, parentContext, childContext); } } function pushContextProvider(workInProgress) { { var instance = workInProgress.stateNode; // We push the context as early as possible to ensure stack integrity. // If the instance does not exist yet, we will push null at first, // and replace it on the stack later when invalidating the context. var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject; // Remember the parent context so we can merge with it later. // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. previousContext = contextStackCursor.current; push(contextStackCursor, memoizedMergedChildContext, workInProgress); push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress); return true; } } function invalidateContextProvider(workInProgress, type, didChange) { { var instance = workInProgress.stateNode; if (!instance) { throw new Error('Expected to have an instance by this point. ' + 'This error is likely caused by a bug in React. Please file an issue.'); } if (didChange) { // Merge parent and own context. // Skip this if we're not updating due to sCU. // This avoids unnecessarily recomputing memoized values. var mergedContext = processChildContext(workInProgress, type, previousContext); instance.__reactInternalMemoizedMergedChildContext = mergedContext; // Replace the old (or empty) context with the new one. // It is important to unwind the context in the reverse order. pop(didPerformWorkStackCursor, workInProgress); pop(contextStackCursor, workInProgress); // Now push the new context and mark that it has changed. push(contextStackCursor, mergedContext, workInProgress); push(didPerformWorkStackCursor, didChange, workInProgress); } else { pop(didPerformWorkStackCursor, workInProgress); push(didPerformWorkStackCursor, didChange, workInProgress); } } } function findCurrentUnmaskedContext(fiber) { { // Currently this is only used with renderSubtreeIntoContainer; not sure if it // makes sense elsewhere if (!isFiberMounted(fiber) || fiber.tag !== ClassComponent) { throw new Error('Expected subtree parent to be a mounted class component. ' + 'This error is likely caused by a bug in React. Please file an issue.'); } var node = fiber; do { switch (node.tag) { case HostRoot: return node.stateNode.context; case ClassComponent: { var Component = node.type; if (isContextProvider(Component)) { return node.stateNode.__reactInternalMemoizedMergedChildContext; } break; } } node = node.return; } while (node !== null); throw new Error('Found unexpected detached subtree parent. ' + 'This error is likely caused by a bug in React. Please file an issue.'); } } var LegacyRoot = 0; var ConcurrentRoot = 1; var syncQueue = null; var includesLegacySyncCallbacks = false; var isFlushingSyncQueue = false; function scheduleSyncCallback(callback) { // Push this callback into an internal queue. We'll flush these either in // the next tick, or earlier if something calls `flushSyncCallbackQueue`. if (syncQueue === null) { syncQueue = [callback]; } else { // Push onto existing queue. Don't need to schedule a callback because // we already scheduled one when we created the queue. syncQueue.push(callback); } } function scheduleLegacySyncCallback(callback) { includesLegacySyncCallbacks = true; scheduleSyncCallback(callback); } function flushSyncCallbacksOnlyInLegacyMode() { // Only flushes the queue if there's a legacy sync callback scheduled. // TODO: There's only a single type of callback: performSyncOnWorkOnRoot. So // it might make more sense for the queue to be a list of roots instead of a // list of generic callbacks. Then we can have two: one for legacy roots, one // for concurrent roots. And this method would only flush the legacy ones. if (includesLegacySyncCallbacks) { flushSyncCallbacks(); } } function flushSyncCallbacks() { if (!isFlushingSyncQueue && syncQueue !== null) { // Prevent re-entrance. isFlushingSyncQueue = true; var i = 0; var previousUpdatePriority = getCurrentUpdatePriority(); try { var isSync = true; var queue = syncQueue; // TODO: Is this necessary anymore? The only user code that runs in this // queue is in the render or commit phases. setCurrentUpdatePriority(DiscreteEventPriority); for (; i < queue.length; i++) { var callback = queue[i]; do { callback = callback(isSync); } while (callback !== null); } syncQueue = null; includesLegacySyncCallbacks = false; } catch (error) { // If something throws, leave the remaining callbacks on the queue. if (syncQueue !== null) { syncQueue = syncQueue.slice(i + 1); } // Resume flushing in the next tick scheduleCallback(ImmediatePriority, flushSyncCallbacks); throw error; } finally { setCurrentUpdatePriority(previousUpdatePriority); isFlushingSyncQueue = false; } } return null; } // TODO: Use the unified fiber stack module instead of this local one? // Intentionally not using it yet to derisk the initial implementation, because // the way we push/pop these values is a bit unusual. If there's a mistake, I'd // rather the ids be wrong than crash the whole reconciler. var forkStack = []; var forkStackIndex = 0; var treeForkProvider = null; var treeForkCount = 0; var idStack = []; var idStackIndex = 0; var treeContextProvider = null; var treeContextId = 1; var treeContextOverflow = ''; function isForkedChild(workInProgress) { warnIfNotHydrating(); return (workInProgress.flags & Forked) !== NoFlags; } function getForksAtLevel(workInProgress) { warnIfNotHydrating(); return treeForkCount; } function getTreeId() { var overflow = treeContextOverflow; var idWithLeadingBit = treeContextId; var id = idWithLeadingBit & ~getLeadingBit(idWithLeadingBit); return id.toString(32) + overflow; } function pushTreeFork(workInProgress, totalChildren) { // This is called right after we reconcile an array (or iterator) of child // fibers, because that's the only place where we know how many children in // the whole set without doing extra work later, or storing addtional // information on the fiber. // // That's why this function is separate from pushTreeId — it's called during // the render phase of the fork parent, not the child, which is where we push // the other context values. // // In the Fizz implementation this is much simpler because the child is // rendered in the same callstack as the parent. // // It might be better to just add a `forks` field to the Fiber type. It would // make this module simpler. warnIfNotHydrating(); forkStack[forkStackIndex++] = treeForkCount; forkStack[forkStackIndex++] = treeForkProvider; treeForkProvider = workInProgress; treeForkCount = totalChildren; } function pushTreeId(workInProgress, totalChildren, index) { warnIfNotHydrating(); idStack[idStackIndex++] = treeContextId; idStack[idStackIndex++] = treeContextOverflow; idStack[idStackIndex++] = treeContextProvider; treeContextProvider = workInProgress; var baseIdWithLeadingBit = treeContextId; var baseOverflow = treeContextOverflow; // The leftmost 1 marks the end of the sequence, non-inclusive. It's not part // of the id; we use it to account for leading 0s. var baseLength = getBitLength(baseIdWithLeadingBit) - 1; var baseId = baseIdWithLeadingBit & ~(1 << baseLength); var slot = index + 1; var length = getBitLength(totalChildren) + baseLength; // 30 is the max length we can store without overflowing, taking into // consideration the leading 1 we use to mark the end of the sequence. if (length > 30) { // We overflowed the bitwise-safe range. Fall back to slower algorithm. // This branch assumes the length of the base id is greater than 5; it won't // work for smaller ids, because you need 5 bits per character. // // We encode the id in multiple steps: first the base id, then the // remaining digits. // // Each 5 bit sequence corresponds to a single base 32 character. So for // example, if the current id is 23 bits long, we can convert 20 of those // bits into a string of 4 characters, with 3 bits left over. // // First calculate how many bits in the base id represent a complete // sequence of characters. var numberOfOverflowBits = baseLength - baseLength % 5; // Then create a bitmask that selects only those bits. var newOverflowBits = (1 << numberOfOverflowBits) - 1; // Select the bits, and convert them to a base 32 string. var newOverflow = (baseId & newOverflowBits).toString(32); // Now we can remove those bits from the base id. var restOfBaseId = baseId >> numberOfOverflowBits; var restOfBaseLength = baseLength - numberOfOverflowBits; // Finally, encode the rest of the bits using the normal algorithm. Because // we made more room, this time it won't overflow. var restOfLength = getBitLength(totalChildren) + restOfBaseLength; var restOfNewBits = slot << restOfBaseLength; var id = restOfNewBits | restOfBaseId; var overflow = newOverflow + baseOverflow; treeContextId = 1 << restOfLength | id; treeContextOverflow = overflow; } else { // Normal path var newBits = slot << baseLength; var _id = newBits | baseId; var _overflow = baseOverflow; treeContextId = 1 << length | _id; treeContextOverflow = _overflow; } } function pushMaterializedTreeId(workInProgress) { warnIfNotHydrating(); // This component materialized an id. This will affect any ids that appear // in its children. var returnFiber = workInProgress.return; if (returnFiber !== null) { var numberOfForks = 1; var slotIndex = 0; pushTreeFork(workInProgress, numberOfForks); pushTreeId(workInProgress, numberOfForks, slotIndex); } } function getBitLength(number) { return 32 - clz32(number); } function getLeadingBit(id) { return 1 << getBitLength(id) - 1; } function popTreeContext(workInProgress) { // Restore the previous values. // This is a bit more complicated than other context-like modules in Fiber // because the same Fiber may appear on the stack multiple times and for // different reasons. We have to keep popping until the work-in-progress is // no longer at the top of the stack. while (workInProgress === treeForkProvider) { treeForkProvider = forkStack[--forkStackIndex]; forkStack[forkStackIndex] = null; treeForkCount = forkStack[--forkStackIndex]; forkStack[forkStackIndex] = null; } while (workInProgress === treeContextProvider) { treeContextProvider = idStack[--idStackIndex]; idStack[idStackIndex] = null; treeContextOverflow = idStack[--idStackIndex]; idStack[idStackIndex] = null; treeContextId = idStack[--idStackIndex]; idStack[idStackIndex] = null; } } function getSuspendedTreeContext() { warnIfNotHydrating(); if (treeContextProvider !== null) { return { id: treeContextId, overflow: treeContextOverflow }; } else { return null; } } function restoreSuspendedTreeContext(workInProgress, suspendedContext) { warnIfNotHydrating(); idStack[idStackIndex++] = treeContextId; idStack[idStackIndex++] = treeContextOverflow; idStack[idStackIndex++] = treeContextProvider; treeContextId = suspendedContext.id; treeContextOverflow = suspendedContext.overflow; treeContextProvider = workInProgress; } function warnIfNotHydrating() { { if (!getIsHydrating()) { error('Expected to be hydrating. This is a bug in React. Please file ' + 'an issue.'); } } } // This may have been an insertion or a hydration. var hydrationParentFiber = null; var nextHydratableInstance = null; var isHydrating = false; // This flag allows for warning supression when we expect there to be mismatches // due to earlier mismatches or a suspended fiber. var didSuspendOrErrorDEV = false; // Hydration errors that were thrown inside this boundary var hydrationErrors = null; function warnIfHydrating() { { if (isHydrating) { error('We should not be hydrating here. This is a bug in React. Please file a bug.'); } } } function markDidThrowWhileHydratingDEV() { { didSuspendOrErrorDEV = true; } } function didSuspendOrErrorWhileHydratingDEV() { { return didSuspendOrErrorDEV; } } function enterHydrationState(fiber) { var parentInstance = fiber.stateNode.containerInfo; nextHydratableInstance = getFirstHydratableChildWithinContainer(parentInstance); hydrationParentFiber = fiber; isHydrating = true; hydrationErrors = null; didSuspendOrErrorDEV = false; return true; } function reenterHydrationStateFromDehydratedSuspenseInstance(fiber, suspenseInstance, treeContext) { nextHydratableInstance = getFirstHydratableChildWithinSuspenseInstance(suspenseInstance); hydrationParentFiber = fiber; isHydrating = true; hydrationErrors = null; didSuspendOrErrorDEV = false; if (treeContext !== null) { restoreSuspendedTreeContext(fiber, treeContext); } return true; } function warnUnhydratedInstance(returnFiber, instance) { { switch (returnFiber.tag) { case HostRoot: { didNotHydrateInstanceWithinContainer(returnFiber.stateNode.containerInfo, instance); break; } case HostComponent: { var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode; didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance, // TODO: Delete this argument when we remove the legacy root API. isConcurrentMode); break; } case SuspenseComponent: { var suspenseState = returnFiber.memoizedState; if (suspenseState.dehydrated !== null) didNotHydrateInstanceWithinSuspenseInstance(suspenseState.dehydrated, instance); break; } } } } function deleteHydratableInstance(returnFiber, instance) { warnUnhydratedInstance(returnFiber, instance); var childToDelete = createFiberFromHostInstanceForDeletion(); childToDelete.stateNode = instance; childToDelete.return = returnFiber; var deletions = returnFiber.deletions; if (deletions === null) { returnFiber.deletions = [childToDelete]; returnFiber.flags |= ChildDeletion; } else { deletions.push(childToDelete); } } function warnNonhydratedInstance(returnFiber, fiber) { { if (didSuspendOrErrorDEV) { // Inside a boundary that already suspended. We're currently rendering the // siblings of a suspended node. The mismatch may be due to the missing // data, so it's probably a false positive. return; } switch (returnFiber.tag) { case HostRoot: { var parentContainer = returnFiber.stateNode.containerInfo; switch (fiber.tag) { case HostComponent: var type = fiber.type; var props = fiber.pendingProps; didNotFindHydratableInstanceWithinContainer(parentContainer, type); break; case HostText: var text = fiber.pendingProps; didNotFindHydratableTextInstanceWithinContainer(parentContainer, text); break; } break; } case HostComponent: { var parentType = returnFiber.type; var parentProps = returnFiber.memoizedProps; var parentInstance = returnFiber.stateNode; switch (fiber.tag) { case HostComponent: { var _type = fiber.type; var _props = fiber.pendingProps; var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode; didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type, _props, // TODO: Delete this argument when we remove the legacy root API. isConcurrentMode); break; } case HostText: { var _text = fiber.pendingProps; var _isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode; didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text, // TODO: Delete this argument when we remove the legacy root API. _isConcurrentMode); break; } } break; } case SuspenseComponent: { var suspenseState = returnFiber.memoizedState; var _parentInstance = suspenseState.dehydrated; if (_parentInstance !== null) switch (fiber.tag) { case HostComponent: var _type2 = fiber.type; var _props2 = fiber.pendingProps; didNotFindHydratableInstanceWithinSuspenseInstance(_parentInstance, _type2); break; case HostText: var _text2 = fiber.pendingProps; didNotFindHydratableTextInstanceWithinSuspenseInstance(_parentInstance, _text2); break; } break; } default: return; } } } function insertNonHydratedInstance(returnFiber, fiber) { fiber.flags = fiber.flags & ~Hydrating | Placement; warnNonhydratedInstance(returnFiber, fiber); } function tryHydrate(fiber, nextInstance) { switch (fiber.tag) { case HostComponent: { var type = fiber.type; var props = fiber.pendingProps; var instance = canHydrateInstance(nextInstance, type); if (instance !== null) { fiber.stateNode = instance; hydrationParentFiber = fiber; nextHydratableInstance = getFirstHydratableChild(instance); return true; } return false; } case HostText: { var text = fiber.pendingProps; var textInstance = canHydrateTextInstance(nextInstance, text); if (textInstance !== null) { fiber.stateNode = textInstance; hydrationParentFiber = fiber; // Text Instances don't have children so there's nothing to hydrate. nextHydratableInstance = null; return true; } return false; } case SuspenseComponent: { var suspenseInstance = canHydrateSuspenseInstance(nextInstance); if (suspenseInstance !== null) { var suspenseState = { dehydrated: suspenseInstance, treeContext: getSuspendedTreeContext(), retryLane: OffscreenLane }; fiber.memoizedState = suspenseState; // Store the dehydrated fragment as a child fiber. // This simplifies the code for getHostSibling and deleting nodes, // since it doesn't have to consider all Suspense boundaries and // check if they're dehydrated ones or not. var dehydratedFragment = createFiberFromDehydratedFragment(suspenseInstance); dehydratedFragment.return = fiber; fiber.child = dehydratedFragment; hydrationParentFiber = fiber; // While a Suspense Instance does have children, we won't step into // it during the first pass. Instead, we'll reenter it later. nextHydratableInstance = null; return true; } return false; } default: return false; } } function shouldClientRenderOnMismatch(fiber) { return (fiber.mode & ConcurrentMode) !== NoMode && (fiber.flags & DidCapture) === NoFlags; } function throwOnHydrationMismatch(fiber) { throw new Error('Hydration failed because the initial UI does not match what was ' + 'rendered on the server.'); } function tryToClaimNextHydratableInstance(fiber) { if (!isHydrating) { return; } var nextInstance = nextHydratableInstance; if (!nextInstance) { if (shouldClientRenderOnMismatch(fiber)) { warnNonhydratedInstance(hydrationParentFiber, fiber); throwOnHydrationMismatch(); } // Nothing to hydrate. Make it an insertion. insertNonHydratedInstance(hydrationParentFiber, fiber); isHydrating = false; hydrationParentFiber = fiber; return; } var firstAttemptedInstance = nextInstance; if (!tryHydrate(fiber, nextInstance)) { if (shouldClientRenderOnMismatch(fiber)) { warnNonhydratedInstance(hydrationParentFiber, fiber); throwOnHydrationMismatch(); } // If we can't hydrate this instance let's try the next one. // We use this as a heuristic. It's based on intuition and not data so it // might be flawed or unnecessary. nextInstance = getNextHydratableSibling(firstAttemptedInstance); var prevHydrationParentFiber = hydrationParentFiber; if (!nextInstance || !tryHydrate(fiber, nextInstance)) { // Nothing to hydrate. Make it an insertion. insertNonHydratedInstance(hydrationParentFiber, fiber); isHydrating = false; hydrationParentFiber = fiber; return; } // We matched the next one, we'll now assume that the first one was // superfluous and we'll delete it. Since we can't eagerly delete it // we'll have to schedule a deletion. To do that, this node needs a dummy // fiber associated with it. deleteHydratableInstance(prevHydrationParentFiber, firstAttemptedInstance); } } function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) { var instance = fiber.stateNode; var shouldWarnIfMismatchDev = !didSuspendOrErrorDEV; var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber, shouldWarnIfMismatchDev); // TODO: Type this specific to this type of component. fiber.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there // is a new ref we mark this as an update. if (updatePayload !== null) { return true; } return false; } function prepareToHydrateHostTextInstance(fiber) { var textInstance = fiber.stateNode; var textContent = fiber.memoizedProps; var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber); if (shouldUpdate) { // We assume that prepareToHydrateHostTextInstance is called in a context where the // hydration parent is the parent host component of this host text. var returnFiber = hydrationParentFiber; if (returnFiber !== null) { switch (returnFiber.tag) { case HostRoot: { var parentContainer = returnFiber.stateNode.containerInfo; var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode; didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent, // TODO: Delete this argument when we remove the legacy root API. isConcurrentMode); break; } case HostComponent: { var parentType = returnFiber.type; var parentProps = returnFiber.memoizedProps; var parentInstance = returnFiber.stateNode; var _isConcurrentMode2 = (returnFiber.mode & ConcurrentMode) !== NoMode; didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent, // TODO: Delete this argument when we remove the legacy root API. _isConcurrentMode2); break; } } } } return shouldUpdate; } function prepareToHydrateHostSuspenseInstance(fiber) { var suspenseState = fiber.memoizedState; var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null; if (!suspenseInstance) { throw new Error('Expected to have a hydrated suspense instance. ' + 'This error is likely caused by a bug in React. Please file an issue.'); } hydrateSuspenseInstance(suspenseInstance, fiber); } function skipPastDehydratedSuspenseInstance(fiber) { var suspenseState = fiber.memoizedState; var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null; if (!suspenseInstance) { throw new Error('Expected to have a hydrated suspense instance. ' + 'This error is likely caused by a bug in React. Please file an issue.'); } return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance); } function popToNextHostParent(fiber) { var parent = fiber.return; while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== SuspenseComponent) { parent = parent.return; } hydrationParentFiber = parent; } function popHydrationState(fiber) { if (fiber !== hydrationParentFiber) { // We're deeper than the current hydration context, inside an inserted // tree. return false; } if (!isHydrating) { // If we're not currently hydrating but we're in a hydration context, then // we were an insertion and now need to pop up reenter hydration of our // siblings. popToNextHostParent(fiber); isHydrating = true; return false; } // If we have any remaining hydratable nodes, we need to delete them now. // We only do this deeper than head and body since they tend to have random // other nodes in them. We also ignore components with pure text content in // side of them. We also don't delete anything inside the root container. if (fiber.tag !== HostRoot && (fiber.tag !== HostComponent || shouldDeleteUnhydratedTailInstances(fiber.type) && !shouldSetTextContent(fiber.type, fiber.memoizedProps))) { var nextInstance = nextHydratableInstance; if (nextInstance) { if (shouldClientRenderOnMismatch(fiber)) { warnIfUnhydratedTailNodes(fiber); throwOnHydrationMismatch(); } else { while (nextInstance) { deleteHydratableInstance(fiber, nextInstance); nextInstance = getNextHydratableSibling(nextInstance); } } } } popToNextHostParent(fiber); if (fiber.tag === SuspenseComponent) { nextHydratableInstance = skipPastDehydratedSuspenseInstance(fiber); } else { nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null; } return true; } function hasUnhydratedTailNodes() { return isHydrating && nextHydratableInstance !== null; } function warnIfUnhydratedTailNodes(fiber) { var nextInstance = nextHydratableInstance; while (nextInstance) { warnUnhydratedInstance(fiber, nextInstance); nextInstance = getNextHydratableSibling(nextInstance); } } function resetHydrationState() { hydrationParentFiber = null; nextHydratableInstance = null; isHydrating = false; didSuspendOrErrorDEV = false; } function upgradeHydrationErrorsToRecoverable() { if (hydrationErrors !== null) { // Successfully completed a forced client render. The errors that occurred // during the hydration attempt are now recovered. We will log them in // commit phase, once the entire tree has finished. queueRecoverableErrors(hydrationErrors); hydrationErrors = null; } } function getIsHydrating() { return isHydrating; } function queueHydrationError(error) { if (hydrationErrors === null) { hydrationErrors = [error]; } else { hydrationErrors.push(error); } } var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; var NoTransition = null; function requestCurrentTransition() { return ReactCurrentBatchConfig$1.transition; } var ReactStrictModeWarnings = { recordUnsafeLifecycleWarnings: function (fiber, instance) {}, flushPendingUnsafeLifecycleWarnings: function () {}, recordLegacyContextWarning: function (fiber, instance) {}, flushLegacyContextWarning: function () {}, discardPendingWarnings: function () {} }; { var findStrictRoot = function (fiber) { var maybeStrictRoot = null; var node = fiber; while (node !== null) { if (node.mode & StrictLegacyMode) { maybeStrictRoot = node; } node = node.return; } return maybeStrictRoot; }; var setToSortedString = function (set) { var array = []; set.forEach(function (value) { array.push(value); }); return array.sort().join(', '); }; var pendingComponentWillMountWarnings = []; var pendingUNSAFE_ComponentWillMountWarnings = []; var pendingComponentWillReceivePropsWarnings = []; var pendingUNSAFE_ComponentWillReceivePropsWarnings = []; var pendingComponentWillUpdateWarnings = []; var pendingUNSAFE_ComponentWillUpdateWarnings = []; // Tracks components we have already warned about. var didWarnAboutUnsafeLifecycles = new Set(); ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) { // Dedupe strategy: Warn once per component. if (didWarnAboutUnsafeLifecycles.has(fiber.type)) { return; } if (typeof instance.componentWillMount === 'function' && // Don't warn about react-lifecycles-compat polyfilled components. instance.componentWillMount.__suppressDeprecationWarning !== true) { pendingComponentWillMountWarnings.push(fiber); } if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillMount === 'function') { pendingUNSAFE_ComponentWillMountWarnings.push(fiber); } if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) { pendingComponentWillReceivePropsWarnings.push(fiber); } if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillReceiveProps === 'function') { pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber); } if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) { pendingComponentWillUpdateWarnings.push(fiber); } if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillUpdate === 'function') { pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber); } }; ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () { // We do an initial pass to gather component names var componentWillMountUniqueNames = new Set(); if (pendingComponentWillMountWarnings.length > 0) { pendingComponentWillMountWarnings.forEach(function (fiber) { componentWillMountUniqueNames.add(getComponentNameFromFiber(fiber) || 'Component'); didWarnAboutUnsafeLifecycles.add(fiber.type); }); pendingComponentWillMountWarnings = []; } var UNSAFE_componentWillMountUniqueNames = new Set(); if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) { pendingUNSAFE_ComponentWillMountWarnings.forEach(function (fiber) { UNSAFE_componentWillMountUniqueNames.add(getComponentNameFromFiber(fiber) || 'Component'); didWarnAboutUnsafeLifecycles.add(fiber.type); }); pendingUNSAFE_ComponentWillMountWarnings = []; } var componentWillReceivePropsUniqueNames = new Set(); if (pendingComponentWillReceivePropsWarnings.length > 0) { pendingComponentWillReceivePropsWarnings.forEach(function (fiber) { componentWillReceivePropsUniqueNames.add(getComponentNameFromFiber(fiber) || 'Component'); didWarnAboutUnsafeLifecycles.add(fiber.type); }); pendingComponentWillReceivePropsWarnings = []; } var UNSAFE_componentWillReceivePropsUniqueNames = new Set(); if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) { pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function (fiber) { UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentNameFromFiber(fiber) || 'Component'); didWarnAboutUnsafeLifecycles.add(fiber.type); }); pendingUNSAFE_ComponentWillReceivePropsWarnings = []; } var componentWillUpdateUniqueNames = new Set(); if (pendingComponentWillUpdateWarnings.length > 0) { pendingComponentWillUpdateWarnings.forEach(function (fiber) { componentWillUpdateUniqueNames.add(getComponentNameFromFiber(fiber) || 'Component'); didWarnAboutUnsafeLifecycles.add(fiber.type); }); pendingComponentWillUpdateWarnings = []; } var UNSAFE_componentWillUpdateUniqueNames = new Set(); if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) { pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function (fiber) { UNSAFE_componentWillUpdateUniqueNames.add(getComponentNameFromFiber(fiber) || 'Component'); didWarnAboutUnsafeLifecycles.add(fiber.type); }); pendingUNSAFE_ComponentWillUpdateWarnings = []; } // Finally, we flush all the warnings // UNSAFE_ ones before the deprecated ones, since they'll be 'louder' if (UNSAFE_componentWillMountUniqueNames.size > 0) { var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames); error('Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '\nPlease update the following components: %s', sortedNames); } if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) { var _sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames); error('Using UNSAFE_componentWillReceiveProps in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, " + 'refactor your code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state\n' + '\nPlease update the following components: %s', _sortedNames); } if (UNSAFE_componentWillUpdateUniqueNames.size > 0) { var _sortedNames2 = setToSortedString(UNSAFE_componentWillUpdateUniqueNames); error('Using UNSAFE_componentWillUpdate in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '\nPlease update the following components: %s', _sortedNames2); } if (componentWillMountUniqueNames.size > 0) { var _sortedNames3 = setToSortedString(componentWillMountUniqueNames); warn('componentWillMount has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames3); } if (componentWillReceivePropsUniqueNames.size > 0) { var _sortedNames4 = setToSortedString(componentWillReceivePropsUniqueNames); warn('componentWillReceiveProps has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, refactor your " + 'code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state\n' + '* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames4); } if (componentWillUpdateUniqueNames.size > 0) { var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames); warn('componentWillUpdate has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames5); } }; var pendingLegacyContextWarning = new Map(); // Tracks components we have already warned about. var didWarnAboutLegacyContext = new Set(); ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) { var strictRoot = findStrictRoot(fiber); if (strictRoot === null) { error('Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.'); return; } // Dedup strategy: Warn once per component. if (didWarnAboutLegacyContext.has(fiber.type)) { return; } var warningsForRoot = pendingLegacyContextWarning.get(strictRoot); if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === 'function') { if (warningsForRoot === undefined) { warningsForRoot = []; pendingLegacyContextWarning.set(strictRoot, warningsForRoot); } warningsForRoot.push(fiber); } }; ReactStrictModeWarnings.flushLegacyContextWarning = function () { pendingLegacyContextWarning.forEach(function (fiberArray, strictRoot) { if (fiberArray.length === 0) { return; } var firstFiber = fiberArray[0]; var uniqueNames = new Set(); fiberArray.forEach(function (fiber) { uniqueNames.add(getComponentNameFromFiber(fiber) || 'Component'); didWarnAboutLegacyContext.add(fiber.type); }); var sortedNames = setToSortedString(uniqueNames); try { setCurrentFiber(firstFiber); error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://reactjs.org/link/legacy-context', sortedNames); } finally { resetCurrentFiber(); } }); }; ReactStrictModeWarnings.discardPendingWarnings = function () { pendingComponentWillMountWarnings = []; pendingUNSAFE_ComponentWillMountWarnings = []; pendingComponentWillReceivePropsWarnings = []; pendingUNSAFE_ComponentWillReceivePropsWarnings = []; pendingComponentWillUpdateWarnings = []; pendingUNSAFE_ComponentWillUpdateWarnings = []; pendingLegacyContextWarning = new Map(); }; } var didWarnAboutMaps; var didWarnAboutGenerators; var didWarnAboutStringRefs; var ownerHasKeyUseWarning; var ownerHasFunctionTypeWarning; var warnForMissingKey = function (child, returnFiber) {}; { didWarnAboutMaps = false; didWarnAboutGenerators = false; didWarnAboutStringRefs = {}; /** * Warn if there's no key explicitly set on dynamic arrays of children or * object keys are not valid. This allows us to keep track of children between * updates. */ ownerHasKeyUseWarning = {}; ownerHasFunctionTypeWarning = {}; warnForMissingKey = function (child, returnFiber) { if (child === null || typeof child !== 'object') { return; } if (!child._store || child._store.validated || child.key != null) { return; } if (typeof child._store !== 'object') { throw new Error('React Component in warnForMissingKey should have a _store. ' + 'This error is likely caused by a bug in React. Please file an issue.'); } child._store.validated = true; var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; if (ownerHasKeyUseWarning[componentName]) { return; } ownerHasKeyUseWarning[componentName] = true; error('Each child in a list should have a unique ' + '"key" prop. See https://reactjs.org/link/warning-keys for ' + 'more information.'); }; } function isReactClass(type) { return type.prototype && type.prototype.isReactComponent; } function coerceRef(returnFiber, current, element) { var mixedRef = element.ref; if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') { { // TODO: Clean this up once we turn on the string ref warning for // everyone, because the strict mode case will no longer be relevant if ((returnFiber.mode & StrictLegacyMode || warnAboutStringRefs) && // We warn in ReactElement.js if owner and self are equal for string refs // because these cannot be automatically converted to an arrow function // using a codemod. Therefore, we don't have to warn about string refs again. !(element._owner && element._self && element._owner.stateNode !== element._self) && // Will already throw with "Function components cannot have string refs" !(element._owner && element._owner.tag !== ClassComponent) && // Will already warn with "Function components cannot be given refs" !(typeof element.type === 'function' && !isReactClass(element.type)) && // Will already throw with "Element ref was specified as a string (someStringRef) but no owner was set" element._owner) { var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; if (!didWarnAboutStringRefs[componentName]) { { error('Component "%s" contains the string ref "%s". Support for string refs ' + 'will be removed in a future major release. We recommend using ' + 'useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, mixedRef); } didWarnAboutStringRefs[componentName] = true; } } } if (element._owner) { var owner = element._owner; var inst; if (owner) { var ownerFiber = owner; if (ownerFiber.tag !== ClassComponent) { throw new Error('Function components cannot have string refs. ' + 'We recommend using useRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref'); } inst = ownerFiber.stateNode; } if (!inst) { throw new Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a " + 'bug in React. Please file an issue.'); } // Assigning this to a const so Flow knows it won't change in the closure var resolvedInst = inst; { checkPropStringCoercion(mixedRef, 'ref'); } var stringRef = '' + mixedRef; // Check if previous string ref matches new string ref if (current !== null && current.ref !== null && typeof current.ref === 'function' && current.ref._stringRef === stringRef) { return current.ref; } var ref = function (value) { var refs = resolvedInst.refs; if (value === null) { delete refs[stringRef]; } else { refs[stringRef] = value; } }; ref._stringRef = stringRef; return ref; } else { if (typeof mixedRef !== 'string') { throw new Error('Expected ref to be a function, a string, an object returned by React.createRef(), or null.'); } if (!element._owner) { throw new Error("Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of" + ' the following reasons:\n' + '1. You may be adding a ref to a function component\n' + "2. You may be adding a ref to a component that was not created inside a component's render method\n" + '3. You have multiple copies of React loaded\n' + 'See https://reactjs.org/link/refs-must-have-owner for more information.'); } } } return mixedRef; } function throwOnInvalidObjectType(returnFiber, newChild) { var childString = Object.prototype.toString.call(newChild); throw new Error("Objects are not valid as a React child (found: " + (childString === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : childString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.'); } function warnOnFunctionType(returnFiber) { { var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; if (ownerHasFunctionTypeWarning[componentName]) { return; } ownerHasFunctionTypeWarning[componentName] = true; error('Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.'); } } function resolveLazy(lazyType) { var payload = lazyType._payload; var init = lazyType._init; return init(payload); } // This wrapper function exists because I expect to clone the code in each path // to be able to optimize each path individually by branching early. This needs // a compiler or we can do it manually. Helpers that don't need this branching // live outside of this function. function ChildReconciler(shouldTrackSideEffects) { function deleteChild(returnFiber, childToDelete) { if (!shouldTrackSideEffects) { // Noop. return; } var deletions = returnFiber.deletions; if (deletions === null) { returnFiber.deletions = [childToDelete]; returnFiber.flags |= ChildDeletion; } else { deletions.push(childToDelete); } } function deleteRemainingChildren(returnFiber, currentFirstChild) { if (!shouldTrackSideEffects) { // Noop. return null; } // TODO: For the shouldClone case, this could be micro-optimized a bit by // assuming that after the first child we've already added everything. var childToDelete = currentFirstChild; while (childToDelete !== null) { deleteChild(returnFiber, childToDelete); childToDelete = childToDelete.sibling; } return null; } function mapRemainingChildren(returnFiber, currentFirstChild) { // Add the remaining children to a temporary map so that we can find them by // keys quickly. Implicit (null) keys get added to this set with their index // instead. var existingChildren = new Map(); var existingChild = currentFirstChild; while (existingChild !== null) { if (existingChild.key !== null) { existingChildren.set(existingChild.key, existingChild); } else { existingChildren.set(existingChild.index, existingChild); } existingChild = existingChild.sibling; } return existingChildren; } function useFiber(fiber, pendingProps) { // We currently set sibling to null and index to 0 here because it is easy // to forget to do before returning it. E.g. for the single child case. var clone = createWorkInProgress(fiber, pendingProps); clone.index = 0; clone.sibling = null; return clone; } function placeChild(newFiber, lastPlacedIndex, newIndex) { newFiber.index = newIndex; if (!shouldTrackSideEffects) { // During hydration, the useId algorithm needs to know which fibers are // part of a list of children (arrays, iterators). newFiber.flags |= Forked; return lastPlacedIndex; } var current = newFiber.alternate; if (current !== null) { var oldIndex = current.index; if (oldIndex < lastPlacedIndex) { // This is a move. newFiber.flags |= Placement; return lastPlacedIndex; } else { // This item can stay in place. return oldIndex; } } else { // This is an insertion. newFiber.flags |= Placement; return lastPlacedIndex; } } function placeSingleChild(newFiber) { // This is simpler for the single child case. We only need to do a // placement for inserting new children. if (shouldTrackSideEffects && newFiber.alternate === null) { newFiber.flags |= Placement; } return newFiber; } function updateTextNode(returnFiber, current, textContent, lanes) { if (current === null || current.tag !== HostText) { // Insert var created = createFiberFromText(textContent, returnFiber.mode, lanes); created.return = returnFiber; return created; } else { // Update var existing = useFiber(current, textContent); existing.return = returnFiber; return existing; } } function updateElement(returnFiber, current, element, lanes) { var elementType = element.type; if (elementType === REACT_FRAGMENT_TYPE) { return updateFragment(returnFiber, current, element.props.children, lanes, element.key); } if (current !== null) { if (current.elementType === elementType || ( // Keep this check inline so it only runs on the false path: isCompatibleFamilyForHotReloading(current, element) ) || // Lazy types should reconcile their resolved type. // We need to do this after the Hot Reloading check above, // because hot reloading has different semantics than prod because // it doesn't resuspend. So we can't let the call below suspend. typeof elementType === 'object' && elementType !== null && elementType.$$typeof === REACT_LAZY_TYPE && resolveLazy(elementType) === current.type) { // Move based on index var existing = useFiber(current, element.props); existing.ref = coerceRef(returnFiber, current, element); existing.return = returnFiber; { existing._debugSource = element._source; existing._debugOwner = element._owner; } return existing; } } // Insert var created = createFiberFromElement(element, returnFiber.mode, lanes); created.ref = coerceRef(returnFiber, current, element); created.return = returnFiber; return created; } function updatePortal(returnFiber, current, portal, lanes) { if (current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) { // Insert var created = createFiberFromPortal(portal, returnFiber.mode, lanes); created.return = returnFiber; return created; } else { // Update var existing = useFiber(current, portal.children || []); existing.return = returnFiber; return existing; } } function updateFragment(returnFiber, current, fragment, lanes, key) { if (current === null || current.tag !== Fragment) { // Insert var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key); created.return = returnFiber; return created; } else { // Update var existing = useFiber(current, fragment); existing.return = returnFiber; return existing; } } function createChild(returnFiber, newChild, lanes) { if (typeof newChild === 'string' && newChild !== '' || typeof newChild === 'number') { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text // node. var created = createFiberFromText('' + newChild, returnFiber.mode, lanes); created.return = returnFiber; return created; } if (typeof newChild === 'object' && newChild !== null) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: { var _created = createFiberFromElement(newChild, returnFiber.mode, lanes); _created.ref = coerceRef(returnFiber, null, newChild); _created.return = returnFiber; return _created; } case REACT_PORTAL_TYPE: { var _created2 = createFiberFromPortal(newChild, returnFiber.mode, lanes); _created2.return = returnFiber; return _created2; } case REACT_LAZY_TYPE: { var payload = newChild._payload; var init = newChild._init; return createChild(returnFiber, init(payload), lanes); } } if (isArray(newChild) || getIteratorFn(newChild)) { var _created3 = createFiberFromFragment(newChild, returnFiber.mode, lanes, null); _created3.return = returnFiber; return _created3; } throwOnInvalidObjectType(returnFiber, newChild); } { if (typeof newChild === 'function') { warnOnFunctionType(returnFiber); } } return null; } function updateSlot(returnFiber, oldFiber, newChild, lanes) { // Update the fiber if the keys match, otherwise return null. var key = oldFiber !== null ? oldFiber.key : null; if (typeof newChild === 'string' && newChild !== '' || typeof newChild === 'number') { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text // node. if (key !== null) { return null; } return updateTextNode(returnFiber, oldFiber, '' + newChild, lanes); } if (typeof newChild === 'object' && newChild !== null) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: { if (newChild.key === key) { return updateElement(returnFiber, oldFiber, newChild, lanes); } else { return null; } } case REACT_PORTAL_TYPE: { if (newChild.key === key) { return updatePortal(returnFiber, oldFiber, newChild, lanes); } else { return null; } } case REACT_LAZY_TYPE: { var payload = newChild._payload; var init = newChild._init; return updateSlot(returnFiber, oldFiber, init(payload), lanes); } } if (isArray(newChild) || getIteratorFn(newChild)) { if (key !== null) { return null; } return updateFragment(returnFiber, oldFiber, newChild, lanes, null); } throwOnInvalidObjectType(returnFiber, newChild); } { if (typeof newChild === 'function') { warnOnFunctionType(returnFiber); } } return null; } function updateFromMap(existingChildren, returnFiber, newIdx, newChild, lanes) { if (typeof newChild === 'string' && newChild !== '' || typeof newChild === 'number') { // Text nodes don't have keys, so we neither have to check the old nor // new node for the key. If both are text nodes, they match. var matchedFiber = existingChildren.get(newIdx) || null; return updateTextNode(returnFiber, matchedFiber, '' + newChild, lanes); } if (typeof newChild === 'object' && newChild !== null) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: { var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; return updateElement(returnFiber, _matchedFiber, newChild, lanes); } case REACT_PORTAL_TYPE: { var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; return updatePortal(returnFiber, _matchedFiber2, newChild, lanes); } case REACT_LAZY_TYPE: var payload = newChild._payload; var init = newChild._init; return updateFromMap(existingChildren, returnFiber, newIdx, init(payload), lanes); } if (isArray(newChild) || getIteratorFn(newChild)) { var _matchedFiber3 = existingChildren.get(newIdx) || null; return updateFragment(returnFiber, _matchedFiber3, newChild, lanes, null); } throwOnInvalidObjectType(returnFiber, newChild); } { if (typeof newChild === 'function') { warnOnFunctionType(returnFiber); } } return null; } /** * Warns if there is a duplicate or missing key */ function warnOnInvalidKey(child, knownKeys, returnFiber) { { if (typeof child !== 'object' || child === null) { return knownKeys; } switch (child.$$typeof) { case REACT_ELEMENT_TYPE: case REACT_PORTAL_TYPE: warnForMissingKey(child, returnFiber); var key = child.key; if (typeof key !== 'string') { break; } if (knownKeys === null) { knownKeys = new Set(); knownKeys.add(key); break; } if (!knownKeys.has(key)) { knownKeys.add(key); break; } error('Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.', key); break; case REACT_LAZY_TYPE: var payload = child._payload; var init = child._init; warnOnInvalidKey(init(payload), knownKeys, returnFiber); break; } } return knownKeys; } function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, lanes) { // This algorithm can't optimize by searching from both ends since we // don't have backpointers on fibers. I'm trying to see how far we can get // with that model. If it ends up not being worth the tradeoffs, we can // add it later. // Even with a two ended optimization, we'd want to optimize for the case // where there are few changes and brute force the comparison instead of // going for the Map. It'd like to explore hitting that path first in // forward-only mode and only go for the Map once we notice that we need // lots of look ahead. This doesn't handle reversal as well as two ended // search but that's unusual. Besides, for the two ended optimization to // work on Iterables, we'd need to copy the whole set. // In this first iteration, we'll just live with hitting the bad case // (adding everything to a Map) in for every insert/move. // If you change this code, also update reconcileChildrenIterator() which // uses the same algorithm. { // First, validate keys. var knownKeys = null; for (var i = 0; i < newChildren.length; i++) { var child = newChildren[i]; knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber); } } var resultingFirstChild = null; var previousNewFiber = null; var oldFiber = currentFirstChild; var lastPlacedIndex = 0; var newIdx = 0; var nextOldFiber = null; for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) { if (oldFiber.index > newIdx) { nextOldFiber = oldFiber; oldFiber = null; } else { nextOldFiber = oldFiber.sibling; } var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], lanes); if (newFiber === null) { // TODO: This breaks on empty slots like null children. That's // unfortunate because it triggers the slow path all the time. We need // a better way to communicate whether this was a miss or null, // boolean, undefined, etc. if (oldFiber === null) { oldFiber = nextOldFiber; } break; } if (shouldTrackSideEffects) { if (oldFiber && newFiber.alternate === null) { // We matched the slot, but we didn't reuse the existing fiber, so we // need to delete the existing child. deleteChild(returnFiber, oldFiber); } } lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); if (previousNewFiber === null) { // TODO: Move out of the loop. This only happens for the first run. resultingFirstChild = newFiber; } else { // TODO: Defer siblings if we're not at the right index for this slot. // I.e. if we had null values before, then we want to defer this // for each null value. However, we also don't want to call updateSlot // with the previous one. previousNewFiber.sibling = newFiber; } previousNewFiber = newFiber; oldFiber = nextOldFiber; } if (newIdx === newChildren.length) { // We've reached the end of the new children. We can delete the rest. deleteRemainingChildren(returnFiber, oldFiber); if (getIsHydrating()) { var numberOfForks = newIdx; pushTreeFork(returnFiber, numberOfForks); } return resultingFirstChild; } if (oldFiber === null) { // If we don't have any more existing children we can choose a fast path // since the rest will all be insertions. for (; newIdx < newChildren.length; newIdx++) { var _newFiber = createChild(returnFiber, newChildren[newIdx], lanes); if (_newFiber === null) { continue; } lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx); if (previousNewFiber === null) { // TODO: Move out of the loop. This only happens for the first run. resultingFirstChild = _newFiber; } else { previousNewFiber.sibling = _newFiber; } previousNewFiber = _newFiber; } if (getIsHydrating()) { var _numberOfForks = newIdx; pushTreeFork(returnFiber, _numberOfForks); } return resultingFirstChild; } // Add all children to a key map for quick lookups. var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves. for (; newIdx < newChildren.length; newIdx++) { var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], lanes); if (_newFiber2 !== null) { if (shouldTrackSideEffects) { if (_newFiber2.alternate !== null) { // The new fiber is a work in progress, but if there exists a // current, that means that we reused the fiber. We need to delete // it from the child list so that we don't add it to the deletion // list. existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key); } } lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx); if (previousNewFiber === null) { resultingFirstChild = _newFiber2; } else { previousNewFiber.sibling = _newFiber2; } previousNewFiber = _newFiber2; } } if (shouldTrackSideEffects) { // Any existing children that weren't consumed above were deleted. We need // to add them to the deletion list. existingChildren.forEach(function (child) { return deleteChild(returnFiber, child); }); } if (getIsHydrating()) { var _numberOfForks2 = newIdx; pushTreeFork(returnFiber, _numberOfForks2); } return resultingFirstChild; } function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, lanes) { // This is the same implementation as reconcileChildrenArray(), // but using the iterator instead. var iteratorFn = getIteratorFn(newChildrenIterable); if (typeof iteratorFn !== 'function') { throw new Error('An object is not an iterable. This error is likely caused by a bug in ' + 'React. Please file an issue.'); } { // We don't support rendering Generators because it's a mutation. // See https://github.com/facebook/react/issues/12995 if (typeof Symbol === 'function' && // $FlowFixMe Flow doesn't know about toStringTag newChildrenIterable[Symbol.toStringTag] === 'Generator') { if (!didWarnAboutGenerators) { error('Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.'); } didWarnAboutGenerators = true; } // Warn about using Maps as children if (newChildrenIterable.entries === iteratorFn) { if (!didWarnAboutMaps) { error('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.'); } didWarnAboutMaps = true; } // First, validate keys. // We'll get a different iterator later for the main pass. var _newChildren = iteratorFn.call(newChildrenIterable); if (_newChildren) { var knownKeys = null; var _step = _newChildren.next(); for (; !_step.done; _step = _newChildren.next()) { var child = _step.value; knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber); } } } var newChildren = iteratorFn.call(newChildrenIterable); if (newChildren == null) { throw new Error('An iterable object provided no iterator.'); } var resultingFirstChild = null; var previousNewFiber = null; var oldFiber = currentFirstChild; var lastPlacedIndex = 0; var newIdx = 0; var nextOldFiber = null; var step = newChildren.next(); for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) { if (oldFiber.index > newIdx) { nextOldFiber = oldFiber; oldFiber = null; } else { nextOldFiber = oldFiber.sibling; } var newFiber = updateSlot(returnFiber, oldFiber, step.value, lanes); if (newFiber === null) { // TODO: This breaks on empty slots like null children. That's // unfortunate because it triggers the slow path all the time. We need // a better way to communicate whether this was a miss or null, // boolean, undefined, etc. if (oldFiber === null) { oldFiber = nextOldFiber; } break; } if (shouldTrackSideEffects) { if (oldFiber && newFiber.alternate === null) { // We matched the slot, but we didn't reuse the existing fiber, so we // need to delete the existing child. deleteChild(returnFiber, oldFiber); } } lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); if (previousNewFiber === null) { // TODO: Move out of the loop. This only happens for the first run. resultingFirstChild = newFiber; } else { // TODO: Defer siblings if we're not at the right index for this slot. // I.e. if we had null values before, then we want to defer this // for each null value. However, we also don't want to call updateSlot // with the previous one. previousNewFiber.sibling = newFiber; } previousNewFiber = newFiber; oldFiber = nextOldFiber; } if (step.done) { // We've reached the end of the new children. We can delete the rest. deleteRemainingChildren(returnFiber, oldFiber); if (getIsHydrating()) { var numberOfForks = newIdx; pushTreeFork(returnFiber, numberOfForks); } return resultingFirstChild; } if (oldFiber === null) { // If we don't have any more existing children we can choose a fast path // since the rest will all be insertions. for (; !step.done; newIdx++, step = newChildren.next()) { var _newFiber3 = createChild(returnFiber, step.value, lanes); if (_newFiber3 === null) { continue; } lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx); if (previousNewFiber === null) { // TODO: Move out of the loop. This only happens for the first run. resultingFirstChild = _newFiber3; } else { previousNewFiber.sibling = _newFiber3; } previousNewFiber = _newFiber3; } if (getIsHydrating()) { var _numberOfForks3 = newIdx; pushTreeFork(returnFiber, _numberOfForks3); } return resultingFirstChild; } // Add all children to a key map for quick lookups. var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves. for (; !step.done; newIdx++, step = newChildren.next()) { var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, lanes); if (_newFiber4 !== null) { if (shouldTrackSideEffects) { if (_newFiber4.alternate !== null) { // The new fiber is a work in progress, but if there exists a // current, that means that we reused the fiber. We need to delete // it from the child list so that we don't add it to the deletion // list. existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key); } } lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx); if (previousNewFiber === null) { resultingFirstChild = _newFiber4; } else { previousNewFiber.sibling = _newFiber4; } previousNewFiber = _newFiber4; } } if (shouldTrackSideEffects) { // Any existing children that weren't consumed above were deleted. We need // to add them to the deletion list. existingChildren.forEach(function (child) { return deleteChild(returnFiber, child); }); } if (getIsHydrating()) { var _numberOfForks4 = newIdx; pushTreeFork(returnFiber, _numberOfForks4); } return resultingFirstChild; } function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, lanes) { // There's no need to check for keys on text nodes since we don't have a // way to define them. if (currentFirstChild !== null && currentFirstChild.tag === HostText) { // We already have an existing node so let's just update it and delete // the rest. deleteRemainingChildren(returnFiber, currentFirstChild.sibling); var existing = useFiber(currentFirstChild, textContent); existing.return = returnFiber; return existing; } // The existing first child is not a text node so we need to create one // and delete the existing ones. deleteRemainingChildren(returnFiber, currentFirstChild); var created = createFiberFromText(textContent, returnFiber.mode, lanes); created.return = returnFiber; return created; } function reconcileSingleElement(returnFiber, currentFirstChild, element, lanes) { var key = element.key; var child = currentFirstChild; while (child !== null) { // TODO: If key === null and child.key === null, then this only applies to // the first item in the list. if (child.key === key) { var elementType = element.type; if (elementType === REACT_FRAGMENT_TYPE) { if (child.tag === Fragment) { deleteRemainingChildren(returnFiber, child.sibling); var existing = useFiber(child, element.props.children); existing.return = returnFiber; { existing._debugSource = element._source; existing._debugOwner = element._owner; } return existing; } } else { if (child.elementType === elementType || ( // Keep this check inline so it only runs on the false path: isCompatibleFamilyForHotReloading(child, element) ) || // Lazy types should reconcile their resolved type. // We need to do this after the Hot Reloading check above, // because hot reloading has different semantics than prod because // it doesn't resuspend. So we can't let the call below suspend. typeof elementType === 'object' && elementType !== null && elementType.$$typeof === REACT_LAZY_TYPE && resolveLazy(elementType) === child.type) { deleteRemainingChildren(returnFiber, child.sibling); var _existing = useFiber(child, element.props); _existing.ref = coerceRef(returnFiber, child, element); _existing.return = returnFiber; { _existing._debugSource = element._source; _existing._debugOwner = element._owner; } return _existing; } } // Didn't match. deleteRemainingChildren(returnFiber, child); break; } else { deleteChild(returnFiber, child); } child = child.sibling; } if (element.type === REACT_FRAGMENT_TYPE) { var created = createFiberFromFragment(element.props.children, returnFiber.mode, lanes, element.key); created.return = returnFiber; return created; } else { var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); _created4.ref = coerceRef(returnFiber, currentFirstChild, element); _created4.return = returnFiber; return _created4; } } function reconcileSinglePortal(returnFiber, currentFirstChild, portal, lanes) { var key = portal.key; var child = currentFirstChild; while (child !== null) { // TODO: If key === null and child.key === null, then this only applies to // the first item in the list. if (child.key === key) { if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) { deleteRemainingChildren(returnFiber, child.sibling); var existing = useFiber(child, portal.children || []); existing.return = returnFiber; return existing; } else { deleteRemainingChildren(returnFiber, child); break; } } else { deleteChild(returnFiber, child); } child = child.sibling; } var created = createFiberFromPortal(portal, returnFiber.mode, lanes); created.return = returnFiber; return created; } // This API will tag the children with the side-effect of the reconciliation // itself. They will be added to the side-effect list as we pass through the // children and the parent. function reconcileChildFibers(returnFiber, currentFirstChild, newChild, lanes) { // This function is not recursive. // If the top level item is an array, we treat it as a set of children, // not as a fragment. Nested arrays on the other hand will be treated as // fragment nodes. Recursion happens at the normal flow. // Handle top level unkeyed fragments as if they were arrays. // This leads to an ambiguity between <>{[...]}</> and <>...</>. // We treat the ambiguous cases above the same. var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; if (isUnkeyedTopLevelFragment) { newChild = newChild.props.children; } // Handle object types if (typeof newChild === 'object' && newChild !== null) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, lanes)); case REACT_PORTAL_TYPE: return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, lanes)); case REACT_LAZY_TYPE: var payload = newChild._payload; var init = newChild._init; // TODO: This function is supposed to be non-recursive. return reconcileChildFibers(returnFiber, currentFirstChild, init(payload), lanes); } if (isArray(newChild)) { return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, lanes); } if (getIteratorFn(newChild)) { return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, lanes); } throwOnInvalidObjectType(returnFiber, newChild); } if (typeof newChild === 'string' && newChild !== '' || typeof newChild === 'number') { return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, lanes)); } { if (typeof newChild === 'function') { warnOnFunctionType(returnFiber); } } // Remaining cases are all treated as empty. return deleteRemainingChildren(returnFiber, currentFirstChild); } return reconcileChildFibers; } var reconcileChildFibers = ChildReconciler(true); var mountChildFibers = ChildReconciler(false); function cloneChildFibers(current, workInProgress) { if (current !== null && workInProgress.child !== current.child) { throw new Error('Resuming work not yet implemented.'); } if (workInProgress.child === null) { return; } var currentChild = workInProgress.child; var newChild = createWorkInProgress(currentChild, currentChild.pendingProps); workInProgress.child = newChild; newChild.return = workInProgress; while (currentChild.sibling !== null) { currentChild = currentChild.sibling; newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps); newChild.return = workInProgress; } newChild.sibling = null; } // Reset a workInProgress child set to prepare it for a second pass. function resetChildFibers(workInProgress, lanes) { var child = workInProgress.child; while (child !== null) { resetWorkInProgress(child, lanes); child = child.sibling; } } var valueCursor = createCursor(null); var rendererSigil; { // Use this to detect multiple renderers using the same context rendererSigil = {}; } var currentlyRenderingFiber = null; var lastContextDependency = null; var lastFullyObservedContext = null; var isDisallowedContextReadInDEV = false; function resetContextDependencies() { // This is called right before React yields execution, to ensure `readContext` // cannot be called outside the render phase. currentlyRenderingFiber = null; lastContextDependency = null; lastFullyObservedContext = null; { isDisallowedContextReadInDEV = false; } } function enterDisallowedContextReadInDEV() { { isDisallowedContextReadInDEV = true; } } function exitDisallowedContextReadInDEV() { { isDisallowedContextReadInDEV = false; } } function pushProvider(providerFiber, context, nextValue) { { push(valueCursor, context._currentValue, providerFiber); context._currentValue = nextValue; { if (context._currentRenderer !== undefined && context._currentRenderer !== null && context._currentRenderer !== rendererSigil) { error('Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.'); } context._currentRenderer = rendererSigil; } } } function popProvider(context, providerFiber) { var currentValue = valueCursor.current; pop(valueCursor, providerFiber); { { context._currentValue = currentValue; } } } function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { // Update the child lanes of all the ancestors, including the alternates. var node = parent; while (node !== null) { var alternate = node.alternate; if (!isSubsetOfLanes(node.childLanes, renderLanes)) { node.childLanes = mergeLanes(node.childLanes, renderLanes); if (alternate !== null) { alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); } } else if (alternate !== null && !isSubsetOfLanes(alternate.childLanes, renderLanes)) { alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); } if (node === propagationRoot) { break; } node = node.return; } { if (node !== propagationRoot) { error('Expected to find the propagation root when scheduling context work. ' + 'This error is likely caused by a bug in React. Please file an issue.'); } } } function propagateContextChange(workInProgress, context, renderLanes) { { propagateContextChange_eager(workInProgress, context, renderLanes); } } function propagateContextChange_eager(workInProgress, context, renderLanes) { var fiber = workInProgress.child; if (fiber !== null) { // Set the return pointer of the child to the work-in-progress fiber. fiber.return = workInProgress; } while (fiber !== null) { var nextFiber = void 0; // Visit this fiber. var list = fiber.dependencies; if (list !== null) { nextFiber = fiber.child; var dependency = list.firstContext; while (dependency !== null) { // Check if the context matches. if (dependency.context === context) { // Match! Schedule an update on this fiber. if (fiber.tag === ClassComponent) { // Schedule a force update on the work-in-progress. var lane = pickArbitraryLane(renderLanes); var update = createUpdate(NoTimestamp, lane); update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the // update to the current fiber, too, which means it will persist even if // this render is thrown away. Since it's a race condition, not sure it's // worth fixing. // Inlined `enqueueUpdate` to remove interleaved update check var updateQueue = fiber.updateQueue; if (updateQueue === null) ; else { var sharedQueue = updateQueue.shared; var pending = sharedQueue.pending; if (pending === null) { // This is the first update. Create a circular list. update.next = update; } else { update.next = pending.next; pending.next = update; } sharedQueue.pending = update; } } fiber.lanes = mergeLanes(fiber.lanes, renderLanes); var alternate = fiber.alternate; if (alternate !== null) { alternate.lanes = mergeLanes(alternate.lanes, renderLanes); } scheduleContextWorkOnParentPath(fiber.return, renderLanes, workInProgress); // Mark the updated lanes on the list, too. list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the // dependency list. break; } dependency = dependency.next; } } else if (fiber.tag === ContextProvider) { // Don't scan deeper if this is a matching provider nextFiber = fiber.type === workInProgress.type ? null : fiber.child; } else if (fiber.tag === DehydratedFragment) { // If a dehydrated suspense boundary is in this subtree, we don't know // if it will have any context consumers in it. The best we can do is // mark it as having updates. var parentSuspense = fiber.return; if (parentSuspense === null) { throw new Error('We just came from a parent so we must have had a parent. This is a bug in React.'); } parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); var _alternate = parentSuspense.alternate; if (_alternate !== null) { _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); } // This is intentionally passing this fiber as the parent // because we want to schedule this fiber as having work // on its children. We'll use the childLanes on // this fiber to indicate that a context has changed. scheduleContextWorkOnParentPath(parentSuspense, renderLanes, workInProgress); nextFiber = fiber.sibling; } else { // Traverse down. nextFiber = fiber.child; } if (nextFiber !== null) { // Set the return pointer of the child to the work-in-progress fiber. nextFiber.return = fiber; } else { // No child. Traverse to next sibling. nextFiber = fiber; while (nextFiber !== null) { if (nextFiber === workInProgress) { // We're back to the root of this subtree. Exit. nextFiber = null; break; } var sibling = nextFiber.sibling; if (sibling !== null) { // Set the return pointer of the sibling to the work-in-progress fiber. sibling.return = nextFiber.return; nextFiber = sibling; break; } // No more siblings. Traverse up. nextFiber = nextFiber.return; } } fiber = nextFiber; } } function prepareToReadContext(workInProgress, renderLanes) { currentlyRenderingFiber = workInProgress; lastContextDependency = null; lastFullyObservedContext = null; var dependencies = workInProgress.dependencies; if (dependencies !== null) { { var firstContext = dependencies.firstContext; if (firstContext !== null) { if (includesSomeLane(dependencies.lanes, renderLanes)) { // Context list has a pending update. Mark that this fiber performed work. markWorkInProgressReceivedUpdate(); } // Reset the work-in-progress list dependencies.firstContext = null; } } } } function readContext(context) { { // This warning would fire if you read context inside a Hook like useMemo. // Unlike the class check below, it's not enforced in production for perf. if (isDisallowedContextReadInDEV) { error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().'); } } var value = context._currentValue ; if (lastFullyObservedContext === context) ; else { var contextItem = { context: context, memoizedValue: value, next: null }; if (lastContextDependency === null) { if (currentlyRenderingFiber === null) { throw new Error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().'); } // This is the first dependency for this component. Create a new list. lastContextDependency = contextItem; currentlyRenderingFiber.dependencies = { lanes: NoLanes, firstContext: contextItem }; } else { // Append a new context item. lastContextDependency = lastContextDependency.next = contextItem; } } return value; } // render. When this render exits, either because it finishes or because it is // interrupted, the interleaved updates will be transferred onto the main part // of the queue. var concurrentQueues = null; function pushConcurrentUpdateQueue(queue) { if (concurrentQueues === null) { concurrentQueues = [queue]; } else { concurrentQueues.push(queue); } } function finishQueueingConcurrentUpdates() { // Transfer the interleaved updates onto the main queue. Each queue has a // `pending` field and an `interleaved` field. When they are not null, they // point to the last node in a circular linked list. We need to append the // interleaved list to the end of the pending list by joining them into a // single, circular list. if (concurrentQueues !== null) { for (var i = 0; i < concurrentQueues.length; i++) { var queue = concurrentQueues[i]; var lastInterleavedUpdate = queue.interleaved; if (lastInterleavedUpdate !== null) { queue.interleaved = null; var firstInterleavedUpdate = lastInterleavedUpdate.next; var lastPendingUpdate = queue.pending; if (lastPendingUpdate !== null) { var firstPendingUpdate = lastPendingUpdate.next; lastPendingUpdate.next = firstInterleavedUpdate; lastInterleavedUpdate.next = firstPendingUpdate; } queue.pending = lastInterleavedUpdate; } } concurrentQueues = null; } } function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { var interleaved = queue.interleaved; if (interleaved === null) { // This is the first update. Create a circular list. update.next = update; // At the end of the current render, this queue's interleaved updates will // be transferred to the pending queue. pushConcurrentUpdateQueue(queue); } else { update.next = interleaved.next; interleaved.next = update; } queue.interleaved = update; return markUpdateLaneFromFiberToRoot(fiber, lane); } function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update, lane) { var interleaved = queue.interleaved; if (interleaved === null) { // This is the first update. Create a circular list. update.next = update; // At the end of the current render, this queue's interleaved updates will // be transferred to the pending queue. pushConcurrentUpdateQueue(queue); } else { update.next = interleaved.next; interleaved.next = update; } queue.interleaved = update; } function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { var interleaved = queue.interleaved; if (interleaved === null) { // This is the first update. Create a circular list. update.next = update; // At the end of the current render, this queue's interleaved updates will // be transferred to the pending queue. pushConcurrentUpdateQueue(queue); } else { update.next = interleaved.next; interleaved.next = update; } queue.interleaved = update; return markUpdateLaneFromFiberToRoot(fiber, lane); } function enqueueConcurrentRenderForLane(fiber, lane) { return markUpdateLaneFromFiberToRoot(fiber, lane); } // Calling this function outside this module should only be done for backwards // compatibility and should always be accompanied by a warning. var unsafe_markUpdateLaneFromFiberToRoot = markUpdateLaneFromFiberToRoot; function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { // Update the source fiber's lanes sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); var alternate = sourceFiber.alternate; if (alternate !== null) { alternate.lanes = mergeLanes(alternate.lanes, lane); } { if (alternate === null && (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags) { warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); } } // Walk the parent path to the root and update the child lanes. var node = sourceFiber; var parent = sourceFiber.return; while (parent !== null) { parent.childLanes = mergeLanes(parent.childLanes, lane); alternate = parent.alternate; if (alternate !== null) { alternate.childLanes = mergeLanes(alternate.childLanes, lane); } else { { if ((parent.flags & (Placement | Hydrating)) !== NoFlags) { warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); } } } node = parent; parent = parent.return; } if (node.tag === HostRoot) { var root = node.stateNode; return root; } else { return null; } } var UpdateState = 0; var ReplaceState = 1; var ForceUpdate = 2; var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. // It should only be read right after calling `processUpdateQueue`, via // `checkHasForceUpdateAfterProcessing`. var hasForceUpdate = false; var didWarnUpdateInsideUpdate; var currentlyProcessingQueue; { didWarnUpdateInsideUpdate = false; currentlyProcessingQueue = null; } function initializeUpdateQueue(fiber) { var queue = { baseState: fiber.memoizedState, firstBaseUpdate: null, lastBaseUpdate: null, shared: { pending: null, interleaved: null, lanes: NoLanes }, effects: null }; fiber.updateQueue = queue; } function cloneUpdateQueue(current, workInProgress) { // Clone the update queue from current. Unless it's already a clone. var queue = workInProgress.updateQueue; var currentQueue = current.updateQueue; if (queue === currentQueue) { var clone = { baseState: currentQueue.baseState, firstBaseUpdate: currentQueue.firstBaseUpdate, lastBaseUpdate: currentQueue.lastBaseUpdate, shared: currentQueue.shared, effects: currentQueue.effects }; workInProgress.updateQueue = clone; } } function createUpdate(eventTime, lane) { var update = { eventTime: eventTime, lane: lane, tag: UpdateState, payload: null, callback: null, next: null }; return update; } function enqueueUpdate(fiber, update, lane) { var updateQueue = fiber.updateQueue; if (updateQueue === null) { // Only occurs if the fiber has been unmounted. return null; } var sharedQueue = updateQueue.shared; { if (currentlyProcessingQueue === sharedQueue && !didWarnUpdateInsideUpdate) { error('An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.'); didWarnUpdateInsideUpdate = true; } } if (isUnsafeClassRenderPhaseUpdate()) { // This is an unsafe render phase update. Add directly to the update // queue so we can process it immediately during the current render. var pending = sharedQueue.pending; if (pending === null) { // This is the first update. Create a circular list. update.next = update; } else { update.next = pending.next; pending.next = update; } sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering // this fiber. This is for backwards compatibility in the case where you // update a different component during render phase than the one that is // currently renderings (a pattern that is accompanied by a warning). return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); } else { return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); } } function entangleTransitions(root, fiber, lane) { var updateQueue = fiber.updateQueue; if (updateQueue === null) { // Only occurs if the fiber has been unmounted. return; } var sharedQueue = updateQueue.shared; if (isTransitionLane(lane)) { var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must // have finished. We can remove them from the shared queue, which represents // a superset of the actually pending lanes. In some cases we may entangle // more than we need to, but that's OK. In fact it's worse if we *don't* // entangle when we should. queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. var newQueueLanes = mergeLanes(queueLanes, lane); sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if // the lane finished since the last time we entangled it. So we need to // entangle it again, just to be sure. markRootEntangled(root, newQueueLanes); } } function enqueueCapturedUpdate(workInProgress, capturedUpdate) { // Captured updates are updates that are thrown by a child during the render // phase. They should be discarded if the render is aborted. Therefore, // we should only put them on the work-in-progress queue, not the current one. var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. var current = workInProgress.alternate; if (current !== null) { var currentQueue = current.updateQueue; if (queue === currentQueue) { // The work-in-progress queue is the same as current. This happens when // we bail out on a parent fiber that then captures an error thrown by // a child. Since we want to append the update only to the work-in // -progress queue, we need to clone the updates. We usually clone during // processUpdateQueue, but that didn't happen in this case because we // skipped over the parent when we bailed out. var newFirst = null; var newLast = null; var firstBaseUpdate = queue.firstBaseUpdate; if (firstBaseUpdate !== null) { // Loop through the updates and clone them. var update = firstBaseUpdate; do { var clone = { eventTime: update.eventTime, lane: update.lane, tag: update.tag, payload: update.payload, callback: update.callback, next: null }; if (newLast === null) { newFirst = newLast = clone; } else { newLast.next = clone; newLast = clone; } update = update.next; } while (update !== null); // Append the captured update the end of the cloned list. if (newLast === null) { newFirst = newLast = capturedUpdate; } else { newLast.next = capturedUpdate; newLast = capturedUpdate; } } else { // There are no base updates. newFirst = newLast = capturedUpdate; } queue = { baseState: currentQueue.baseState, firstBaseUpdate: newFirst, lastBaseUpdate: newLast, shared: currentQueue.shared, effects: currentQueue.effects }; workInProgress.updateQueue = queue; return; } } // Append the update to the end of the list. var lastBaseUpdate = queue.lastBaseUpdate; if (lastBaseUpdate === null) { queue.firstBaseUpdate = capturedUpdate; } else { lastBaseUpdate.next = capturedUpdate; } queue.lastBaseUpdate = capturedUpdate; } function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps, instance) { switch (update.tag) { case ReplaceState: { var payload = update.payload; if (typeof payload === 'function') { // Updater function { enterDisallowedContextReadInDEV(); } var nextState = payload.call(instance, prevState, nextProps); { if ( workInProgress.mode & StrictLegacyMode) { setIsStrictModeForDevtools(true); try { payload.call(instance, prevState, nextProps); } finally { setIsStrictModeForDevtools(false); } } exitDisallowedContextReadInDEV(); } return nextState; } // State object return payload; } case CaptureUpdate: { workInProgress.flags = workInProgress.flags & ~ShouldCapture | DidCapture; } // Intentional fallthrough case UpdateState: { var _payload = update.payload; var partialState; if (typeof _payload === 'function') { // Updater function { enterDisallowedContextReadInDEV(); } partialState = _payload.call(instance, prevState, nextProps); { if ( workInProgress.mode & StrictLegacyMode) { setIsStrictModeForDevtools(true); try { _payload.call(instance, prevState, nextProps); } finally { setIsStrictModeForDevtools(false); } } exitDisallowedContextReadInDEV(); } } else { // Partial state object partialState = _payload; } if (partialState === null || partialState === undefined) { // Null and undefined are treated as no-ops. return prevState; } // Merge the partial state and the previous state. return assign({}, prevState, partialState); } case ForceUpdate: { hasForceUpdate = true; return prevState; } } return prevState; } function processUpdateQueue(workInProgress, props, instance, renderLanes) { // This is always non-null on a ClassComponent or HostRoot var queue = workInProgress.updateQueue; hasForceUpdate = false; { currentlyProcessingQueue = queue.shared; } var firstBaseUpdate = queue.firstBaseUpdate; var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. var pendingQueue = queue.shared.pending; if (pendingQueue !== null) { queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first // and last so that it's non-circular. var lastPendingUpdate = pendingQueue; var firstPendingUpdate = lastPendingUpdate.next; lastPendingUpdate.next = null; // Append pending updates to base queue if (lastBaseUpdate === null) { firstBaseUpdate = firstPendingUpdate; } else { lastBaseUpdate.next = firstPendingUpdate; } lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then // we need to transfer the updates to that queue, too. Because the base // queue is a singly-linked list with no cycles, we can append to both // lists and take advantage of structural sharing. // TODO: Pass `current` as argument var current = workInProgress.alternate; if (current !== null) { // This is always non-null on a ClassComponent or HostRoot var currentQueue = current.updateQueue; var currentLastBaseUpdate = currentQueue.lastBaseUpdate; if (currentLastBaseUpdate !== lastBaseUpdate) { if (currentLastBaseUpdate === null) { currentQueue.firstBaseUpdate = firstPendingUpdate; } else { currentLastBaseUpdate.next = firstPendingUpdate; } currentQueue.lastBaseUpdate = lastPendingUpdate; } } } // These values may change as we process the queue. if (firstBaseUpdate !== null) { // Iterate through the list of updates to compute the result. var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes // from the original lanes. var newLanes = NoLanes; var newBaseState = null; var newFirstBaseUpdate = null; var newLastBaseUpdate = null; var update = firstBaseUpdate; do { var updateLane = update.lane; var updateEventTime = update.eventTime; if (!isSubsetOfLanes(renderLanes, updateLane)) { // Priority is insufficient. Skip this update. If this is the first // skipped update, the previous update/state is the new base // update/state. var clone = { eventTime: updateEventTime, lane: updateLane, tag: update.tag, payload: update.payload, callback: update.callback, next: null }; if (newLastBaseUpdate === null) { newFirstBaseUpdate = newLastBaseUpdate = clone; newBaseState = newState; } else { newLastBaseUpdate = newLastBaseUpdate.next = clone; } // Update the remaining priority in the queue. newLanes = mergeLanes(newLanes, updateLane); } else { // This update does have sufficient priority. if (newLastBaseUpdate !== null) { var _clone = { eventTime: updateEventTime, // This update is going to be committed so we never want uncommit // it. Using NoLane works because 0 is a subset of all bitmasks, so // this will never be skipped by the check above. lane: NoLane, tag: update.tag, payload: update.payload, callback: update.callback, next: null }; newLastBaseUpdate = newLastBaseUpdate.next = _clone; } // Process this update. newState = getStateFromUpdate(workInProgress, queue, update, newState, props, instance); var callback = update.callback; if (callback !== null && // If the update was already committed, we should not queue its // callback again. update.lane !== NoLane) { workInProgress.flags |= Callback; var effects = queue.effects; if (effects === null) { queue.effects = [update]; } else { effects.push(update); } } } update = update.next; if (update === null) { pendingQueue = queue.shared.pending; if (pendingQueue === null) { break; } else { // An update was scheduled from inside a reducer. Add the new // pending updates to the end of the list and keep processing. var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we // unravel them when transferring them to the base queue. var _firstPendingUpdate = _lastPendingUpdate.next; _lastPendingUpdate.next = null; update = _firstPendingUpdate; queue.lastBaseUpdate = _lastPendingUpdate; queue.shared.pending = null; } } } while (true); if (newLastBaseUpdate === null) { newBaseState = newState; } queue.baseState = newBaseState; queue.firstBaseUpdate = newFirstBaseUpdate; queue.lastBaseUpdate = newLastBaseUpdate; // Interleaved updates are stored on a separate queue. We aren't going to // process them during this render, but we do need to track which lanes // are remaining. var lastInterleaved = queue.shared.interleaved; if (lastInterleaved !== null) { var interleaved = lastInterleaved; do { newLanes = mergeLanes(newLanes, interleaved.lane); interleaved = interleaved.next; } while (interleaved !== lastInterleaved); } else if (firstBaseUpdate === null) { // `queue.lanes` is used for entangling transitions. We can set it back to // zero once the queue is empty. queue.shared.lanes = NoLanes; } // Set the remaining expiration time to be whatever is remaining in the queue. // This should be fine because the only two other things that contribute to // expiration time are props and context. We're already in the middle of the // begin phase by the time we start processing the queue, so we've already // dealt with the props. Context in components that specify // shouldComponentUpdate is tricky; but we'll have to account for // that regardless. markSkippedUpdateLanes(newLanes); workInProgress.lanes = newLanes; workInProgress.memoizedState = newState; } { currentlyProcessingQueue = null; } } function callCallback(callback, context) { if (typeof callback !== 'function') { throw new Error('Invalid argument passed as callback. Expected a function. Instead ' + ("received: " + callback)); } callback.call(context); } function resetHasForceUpdateBeforeProcessing() { hasForceUpdate = false; } function checkHasForceUpdateAfterProcessing() { return hasForceUpdate; } function commitUpdateQueue(finishedWork, finishedQueue, instance) { // Commit the effects var effects = finishedQueue.effects; finishedQueue.effects = null; if (effects !== null) { for (var i = 0; i < effects.length; i++) { var effect = effects[i]; var callback = effect.callback; if (callback !== null) { effect.callback = null; callCallback(callback, instance); } } } } var NO_CONTEXT = {}; var contextStackCursor$1 = createCursor(NO_CONTEXT); var contextFiberStackCursor = createCursor(NO_CONTEXT); var rootInstanceStackCursor = createCursor(NO_CONTEXT); function requiredContext(c) { if (c === NO_CONTEXT) { throw new Error('Expected host context to exist. This error is likely caused by a bug ' + 'in React. Please file an issue.'); } return c; } function getRootHostContainer() { var rootInstance = requiredContext(rootInstanceStackCursor.current); return rootInstance; } function pushHostContainer(fiber, nextRootInstance) { // Push current root instance onto the stack; // This allows us to reset root when portals are popped. push(rootInstanceStackCursor, nextRootInstance, fiber); // Track the context and the Fiber that provided it. // This enables us to pop only Fibers that provide unique contexts. push(contextFiberStackCursor, fiber, fiber); // Finally, we need to push the host context to the stack. // However, we can't just call getRootHostContext() and push it because // we'd have a different number of entries on the stack depending on // whether getRootHostContext() throws somewhere in renderer code or not. // So we push an empty value first. This lets us safely unwind on errors. push(contextStackCursor$1, NO_CONTEXT, fiber); var nextRootContext = getRootHostContext(nextRootInstance); // Now that we know this function doesn't throw, replace it. pop(contextStackCursor$1, fiber); push(contextStackCursor$1, nextRootContext, fiber); } function popHostContainer(fiber) { pop(contextStackCursor$1, fiber); pop(contextFiberStackCursor, fiber); pop(rootInstanceStackCursor, fiber); } function getHostContext() { var context = requiredContext(contextStackCursor$1.current); return context; } function pushHostContext(fiber) { var rootInstance = requiredContext(rootInstanceStackCursor.current); var context = requiredContext(contextStackCursor$1.current); var nextContext = getChildHostContext(context, fiber.type); // Don't push this Fiber's context unless it's unique. if (context === nextContext) { return; } // Track the context and the Fiber that provided it. // This enables us to pop only Fibers that provide unique contexts. push(contextFiberStackCursor, fiber, fiber); push(contextStackCursor$1, nextContext, fiber); } function popHostContext(fiber) { // Do not pop unless this Fiber provided the current context. // pushHostContext() only pushes Fibers that provide unique contexts. if (contextFiberStackCursor.current !== fiber) { return; } pop(contextStackCursor$1, fiber); pop(contextFiberStackCursor, fiber); } var DefaultSuspenseContext = 0; // The Suspense Context is split into two parts. The lower bits is // inherited deeply down the subtree. The upper bits only affect // this immediate suspense boundary and gets reset each new // boundary or suspense list. var SubtreeSuspenseContextMask = 1; // Subtree Flags: // InvisibleParentSuspenseContext indicates that one of our parent Suspense // boundaries is not currently showing visible main content. // Either because it is already showing a fallback or is not mounted at all. // We can use this to determine if it is desirable to trigger a fallback at // the parent. If not, then we might need to trigger undesirable boundaries // and/or suspend the commit to avoid hiding the parent content. var InvisibleParentSuspenseContext = 1; // Shallow Flags: // ForceSuspenseFallback can be used by SuspenseList to force newly added // items into their fallback state during one of the render passes. var ForceSuspenseFallback = 2; var suspenseStackCursor = createCursor(DefaultSuspenseContext); function hasSuspenseContext(parentContext, flag) { return (parentContext & flag) !== 0; } function setDefaultShallowSuspenseContext(parentContext) { return parentContext & SubtreeSuspenseContextMask; } function setShallowSuspenseContext(parentContext, shallowContext) { return parentContext & SubtreeSuspenseContextMask | shallowContext; } function addSubtreeSuspenseContext(parentContext, subtreeContext) { return parentContext | subtreeContext; } function pushSuspenseContext(fiber, newContext) { push(suspenseStackCursor, newContext, fiber); } function popSuspenseContext(fiber) { pop(suspenseStackCursor, fiber); } function shouldCaptureSuspense(workInProgress, hasInvisibleParent) { // If it was the primary children that just suspended, capture and render the // fallback. Otherwise, don't capture and bubble to the next boundary. var nextState = workInProgress.memoizedState; if (nextState !== null) { if (nextState.dehydrated !== null) { // A dehydrated boundary always captures. return true; } return false; } var props = workInProgress.memoizedProps; // Regular boundaries always capture. { return true; } // If it's a boundary we should avoid, then we prefer to bubble up to the } function findFirstSuspended(row) { var node = row; while (node !== null) { if (node.tag === SuspenseComponent) { var state = node.memoizedState; if (state !== null) { var dehydrated = state.dehydrated; if (dehydrated === null || isSuspenseInstancePending(dehydrated) || isSuspenseInstanceFallback(dehydrated)) { return node; } } } else if (node.tag === SuspenseListComponent && // revealOrder undefined can't be trusted because it don't // keep track of whether it suspended or not. node.memoizedProps.revealOrder !== undefined) { var didSuspend = (node.flags & DidCapture) !== NoFlags; if (didSuspend) { return node; } } else if (node.child !== null) { node.child.return = node; node = node.child; continue; } if (node === row) { return null; } while (node.sibling === null) { if (node.return === null || node.return === row) { return null; } node = node.return; } node.sibling.return = node.return; node = node.sibling; } return null; } var NoFlags$1 = /* */ 0; // Represents whether effect should fire. var HasEffect = /* */ 1; // Represents the phase in which the effect (not the clean-up) fires. var Insertion = /* */ 2; var Layout = /* */ 4; var Passive$1 = /* */ 8; // and should be reset before starting a new render. // This tracks which mutable sources need to be reset after a render. var workInProgressSources = []; function resetWorkInProgressVersions() { for (var i = 0; i < workInProgressSources.length; i++) { var mutableSource = workInProgressSources[i]; { mutableSource._workInProgressVersionPrimary = null; } } workInProgressSources.length = 0; } // This ensures that the version used for server rendering matches the one // that is eventually read during hydration. // If they don't match there's a potential tear and a full deopt render is required. function registerMutableSourceForHydration(root, mutableSource) { var getVersion = mutableSource._getVersion; var version = getVersion(mutableSource._source); // TODO Clear this data once all pending hydration work is finished. // Retaining it forever may interfere with GC. if (root.mutableSourceEagerHydrationData == null) { root.mutableSourceEagerHydrationData = [mutableSource, version]; } else { root.mutableSourceEagerHydrationData.push(mutableSource, version); } } var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; { didWarnAboutMismatchedHooksForComponent = new Set(); } // These are set right before calling the component. var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from // the work-in-progress hook. var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The // current hook list is the list that belongs to the current fiber. The // work-in-progress hook list is a new list that will be added to the // work-in-progress fiber. var currentHook = null; var workInProgressHook = null; // Whether an update was scheduled at any point during the render phase. This // does not get reset if we do another render pass; only when we're completely // finished evaluating this component. This is an optimization so we know // whether we need to clear render phase updates after a throw. var didScheduleRenderPhaseUpdate = false; // Where an update was scheduled only during the current render pass. This // gets reset after each attempt. // TODO: Maybe there's some way to consolidate this with // `didScheduleRenderPhaseUpdate`. Or with `numberOfReRenders`. var didScheduleRenderPhaseUpdateDuringThisPass = false; // Counts the number of useId hooks in this component. var localIdCounter = 0; // Used for ids that are generated completely client-side (i.e. not during // hydration). This counter is global, so client ids are not stable across // render attempts. var globalClientIdCounter = 0; var RE_RENDER_LIMIT = 25; // In DEV, this is the name of the currently executing primitive hook var currentHookNameInDev = null; // In DEV, this list ensures that hooks are called in the same order between renders. // The list stores the order of hooks used during the initial render (mount). // Subsequent renders (updates) reference this list. var hookTypesDev = null; var hookTypesUpdateIndexDev = -1; // In DEV, this tracks whether currently rendering component needs to ignore // the dependencies for Hooks that need them (e.g. useEffect or useMemo). // When true, such Hooks will always be "remounted". Only used during hot reload. var ignorePreviousDependencies = false; function mountHookTypesDev() { { var hookName = currentHookNameInDev; if (hookTypesDev === null) { hookTypesDev = [hookName]; } else { hookTypesDev.push(hookName); } } } function updateHookTypesDev() { { var hookName = currentHookNameInDev; if (hookTypesDev !== null) { hookTypesUpdateIndexDev++; if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) { warnOnHookMismatchInDev(hookName); } } } } function checkDepsAreArrayDev(deps) { { if (deps !== undefined && deps !== null && !isArray(deps)) { // Verify deps, but only on mount to avoid extra checks. // It's unlikely their type would change as usually you define them inline. error('%s received a final argument that is not an array (instead, received `%s`). When ' + 'specified, the final argument must be an array.', currentHookNameInDev, typeof deps); } } } function warnOnHookMismatchInDev(currentHookName) { { var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { didWarnAboutMismatchedHooksForComponent.add(componentName); if (hookTypesDev !== null) { var table = ''; var secondColumnStart = 30; for (var i = 0; i <= hookTypesUpdateIndexDev; i++) { var oldHookName = hookTypesDev[i]; var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName; var row = i + 1 + ". " + oldHookName; // Extra space so second column lines up // lol @ IE not supporting String#repeat while (row.length < secondColumnStart) { row += ' '; } row += newHookName + '\n'; table += row; } error('React has detected a change in the order of Hooks called by %s. ' + 'This will lead to bugs and errors if not fixed. ' + 'For more information, read the Rules of Hooks: https://reactjs.org/link/rules-of-hooks\n\n' + ' Previous render Next render\n' + ' ------------------------------------------------------\n' + '%s' + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', componentName, table); } } } } function throwInvalidHookError() { throw new Error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.'); } function areHookInputsEqual(nextDeps, prevDeps) { { if (ignorePreviousDependencies) { // Only true when this component is being hot reloaded. return false; } } if (prevDeps === null) { { error('%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev); } return false; } { // Don't bother comparing lengths in prod because these arrays should be // passed inline. if (nextDeps.length !== prevDeps.length) { error('The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + prevDeps.join(', ') + "]", "[" + nextDeps.join(', ') + "]"); } } for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) { if (objectIs(nextDeps[i], prevDeps[i])) { continue; } return false; } return true; } function renderWithHooks(current, workInProgress, Component, props, secondArg, nextRenderLanes) { renderLanes = nextRenderLanes; currentlyRenderingFiber$1 = workInProgress; { hookTypesDev = current !== null ? current._debugHookTypes : null; hookTypesUpdateIndexDev = -1; // Used for hot reloading: ignorePreviousDependencies = current !== null && current.type !== workInProgress.type; } workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = NoLanes; // The following should have already been reset // currentHook = null; // workInProgressHook = null; // didScheduleRenderPhaseUpdate = false; // localIdCounter = 0; // TODO Warn if no hooks are used at all during mount, then some are used during update. // Currently we will identify the update render as a mount because memoizedState === null. // This is tricky because it's valid for certain types of components (e.g. React.lazy) // Using memoizedState to differentiate between mount/update only works if at least one stateful hook is used. // Non-stateful hooks (e.g. context) don't get added to memoizedState, // so memoizedState would be null during updates and mounts. { if (current !== null && current.memoizedState !== null) { ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV; } else if (hookTypesDev !== null) { // This dispatcher handles an edge case where a component is updating, // but no stateful hooks have been used. // We want to match the production code behavior (which will use HooksDispatcherOnMount), // but with the extra DEV validation to ensure hooks ordering hasn't changed. // This dispatcher does that. ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV; } else { ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; } } var children = Component(props, secondArg); // Check if there was a render phase update if (didScheduleRenderPhaseUpdateDuringThisPass) { // Keep rendering in a loop for as long as render phase updates continue to // be scheduled. Use a counter to prevent infinite loops. var numberOfReRenders = 0; do { didScheduleRenderPhaseUpdateDuringThisPass = false; localIdCounter = 0; if (numberOfReRenders >= RE_RENDER_LIMIT) { throw new Error('Too many re-renders. React limits the number of renders to prevent ' + 'an infinite loop.'); } numberOfReRenders += 1; { // Even when hot reloading, allow dependencies to stabilize // after first render to prevent infinite render phase updates. ignorePreviousDependencies = false; } // Start over from the beginning of the list currentHook = null; workInProgressHook = null; workInProgress.updateQueue = null; { // Also validate hook order for cascading updates. hookTypesUpdateIndexDev = -1; } ReactCurrentDispatcher$1.current = HooksDispatcherOnRerenderInDEV ; children = Component(props, secondArg); } while (didScheduleRenderPhaseUpdateDuringThisPass); } // We can assume the previous dispatcher is always this one, since we set it // at the beginning of the render phase and there's no re-entrance. ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; { workInProgress._debugHookTypes = hookTypesDev; } // This check uses currentHook so that it works the same in DEV and prod bundles. // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles. var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; renderLanes = NoLanes; currentlyRenderingFiber$1 = null; currentHook = null; workInProgressHook = null; { currentHookNameInDev = null; hookTypesDev = null; hookTypesUpdateIndexDev = -1; // Confirm that a static flag was not added or removed since the last // render. If this fires, it suggests that we incorrectly reset the static // flags in some other part of the codebase. This has happened before, for // example, in the SuspenseList implementation. if (current !== null && (current.flags & StaticMask) !== (workInProgress.flags & StaticMask) && // Disable this warning in legacy mode, because legacy Suspense is weird // and creates false positives. To make this work in legacy mode, we'd // need to mark fibers that commit in an incomplete state, somehow. For // now I'll disable the warning that most of the bugs that would trigger // it are either exclusive to concurrent mode or exist in both. (current.mode & ConcurrentMode) !== NoMode) { error('Internal React error: Expected static flag was missing. Please ' + 'notify the React team.'); } } didScheduleRenderPhaseUpdate = false; // This is reset by checkDidRenderIdHook // localIdCounter = 0; if (didRenderTooFewHooks) { throw new Error('Rendered fewer hooks than expected. This may be caused by an accidental ' + 'early return statement.'); } return children; } function checkDidRenderIdHook() { // This should be called immediately after every renderWithHooks call. // Conceptually, it's part of the return value of renderWithHooks; it's only a // separate function to avoid using an array tuple. var didRenderIdHook = localIdCounter !== 0; localIdCounter = 0; return didRenderIdHook; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; // TODO: Don't need to reset the flags here, because they're reset in the // complete phase (bubbleProperties). if ( (workInProgress.mode & StrictEffectsMode) !== NoMode) { workInProgress.flags &= ~(MountPassiveDev | MountLayoutDev | Passive | Update); } else { workInProgress.flags &= ~(Passive | Update); } current.lanes = removeLanes(current.lanes, lanes); } function resetHooksAfterThrow() { // We can assume the previous dispatcher is always this one, since we set it // at the beginning of the render phase and there's no re-entrance. ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; if (didScheduleRenderPhaseUpdate) { // There were render phase updates. These are only valid for this render // phase, which we are now aborting. Remove the updates from the queues so // they do not persist to the next render. Do not remove updates from hooks // that weren't processed. // // Only reset the updates from the queue if it has a clone. If it does // not have a clone, that means it wasn't processed, and the updates were // scheduled before we entered the render phase. var hook = currentlyRenderingFiber$1.memoizedState; while (hook !== null) { var queue = hook.queue; if (queue !== null) { queue.pending = null; } hook = hook.next; } didScheduleRenderPhaseUpdate = false; } renderLanes = NoLanes; currentlyRenderingFiber$1 = null; currentHook = null; workInProgressHook = null; { hookTypesDev = null; hookTypesUpdateIndexDev = -1; currentHookNameInDev = null; isUpdatingOpaqueValueInRenderPhase = false; } didScheduleRenderPhaseUpdateDuringThisPass = false; localIdCounter = 0; } function mountWorkInProgressHook() { var hook = { memoizedState: null, baseState: null, baseQueue: null, queue: null, next: null }; if (workInProgressHook === null) { // This is the first hook in the list currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; } else { // Append to the end of the list workInProgressHook = workInProgressHook.next = hook; } return workInProgressHook; } function updateWorkInProgressHook() { // This function is used both for updates and for re-renders triggered by a // render phase update. It assumes there is either a current hook we can // clone, or a work-in-progress hook from a previous render pass that we can // use as a base. When we reach the end of the base list, we must switch to // the dispatcher used for mounts. var nextCurrentHook; if (currentHook === null) { var current = currentlyRenderingFiber$1.alternate; if (current !== null) { nextCurrentHook = current.memoizedState; } else { nextCurrentHook = null; } } else { nextCurrentHook = currentHook.next; } var nextWorkInProgressHook; if (workInProgressHook === null) { nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; } else { nextWorkInProgressHook = workInProgressHook.next; } if (nextWorkInProgressHook !== null) { // There's already a work-in-progress. Reuse it. workInProgressHook = nextWorkInProgressHook; nextWorkInProgressHook = workInProgressHook.next; currentHook = nextCurrentHook; } else { // Clone from the current hook. if (nextCurrentHook === null) { throw new Error('Rendered more hooks than during the previous render.'); } currentHook = nextCurrentHook; var newHook = { memoizedState: currentHook.memoizedState, baseState: currentHook.baseState, baseQueue: currentHook.baseQueue, queue: currentHook.queue, next: null }; if (workInProgressHook === null) { // This is the first hook in the list. currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; } else { // Append to the end of the list. workInProgressHook = workInProgressHook.next = newHook; } } return workInProgressHook; } function createFunctionComponentUpdateQueue() { return { lastEffect: null, stores: null }; } function basicStateReducer(state, action) { // $FlowFixMe: Flow doesn't like mixed types return typeof action === 'function' ? action(state) : action; } function mountReducer(reducer, initialArg, init) { var hook = mountWorkInProgressHook(); var initialState; if (init !== undefined) { initialState = init(initialArg); } else { initialState = initialArg; } hook.memoizedState = hook.baseState = initialState; var queue = { pending: null, interleaved: null, lanes: NoLanes, dispatch: null, lastRenderedReducer: reducer, lastRenderedState: initialState }; hook.queue = queue; var dispatch = queue.dispatch = dispatchReducerAction.bind(null, currentlyRenderingFiber$1, queue); return [hook.memoizedState, dispatch]; } function updateReducer(reducer, initialArg, init) { var hook = updateWorkInProgressHook(); var queue = hook.queue; if (queue === null) { throw new Error('Should have a queue. This is likely a bug in React. Please file an issue.'); } queue.lastRenderedReducer = reducer; var current = currentHook; // The last rebase update that is NOT part of the base state. var baseQueue = current.baseQueue; // The last pending update that hasn't been processed yet. var pendingQueue = queue.pending; if (pendingQueue !== null) { // We have new updates that haven't been processed yet. // We'll add them to the base queue. if (baseQueue !== null) { // Merge the pending queue and the base queue. var baseFirst = baseQueue.next; var pendingFirst = pendingQueue.next; baseQueue.next = pendingFirst; pendingQueue.next = baseFirst; } { if (current.baseQueue !== baseQueue) { // Internal invariant that should never happen, but feasibly could in // the future if we implement resuming, or some form of that. error('Internal error: Expected work-in-progress queue to be a clone. ' + 'This is a bug in React.'); } } current.baseQueue = baseQueue = pendingQueue; queue.pending = null; } if (baseQueue !== null) { // We have a queue to process. var first = baseQueue.next; var newState = current.baseState; var newBaseState = null; var newBaseQueueFirst = null; var newBaseQueueLast = null; var update = first; do { var updateLane = update.lane; if (!isSubsetOfLanes(renderLanes, updateLane)) { // Priority is insufficient. Skip this update. If this is the first // skipped update, the previous update/state is the new base // update/state. var clone = { lane: updateLane, action: update.action, hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }; if (newBaseQueueLast === null) { newBaseQueueFirst = newBaseQueueLast = clone; newBaseState = newState; } else { newBaseQueueLast = newBaseQueueLast.next = clone; } // Update the remaining priority in the queue. // TODO: Don't need to accumulate this. Instead, we can remove // renderLanes from the original lanes. currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, updateLane); markSkippedUpdateLanes(updateLane); } else { // This update does have sufficient priority. if (newBaseQueueLast !== null) { var _clone = { // This update is going to be committed so we never want uncommit // it. Using NoLane works because 0 is a subset of all bitmasks, so // this will never be skipped by the check above. lane: NoLane, action: update.action, hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }; newBaseQueueLast = newBaseQueueLast.next = _clone; } // Process this update. if (update.hasEagerState) { // If this update is a state update (not a reducer) and was processed eagerly, // we can use the eagerly computed state newState = update.eagerState; } else { var action = update.action; newState = reducer(newState, action); } } update = update.next; } while (update !== null && update !== first); if (newBaseQueueLast === null) { newBaseState = newState; } else { newBaseQueueLast.next = newBaseQueueFirst; } // Mark that the fiber performed work, but only if the new state is // different from the current state. if (!objectIs(newState, hook.memoizedState)) { markWorkInProgressReceivedUpdate(); } hook.memoizedState = newState; hook.baseState = newBaseState; hook.baseQueue = newBaseQueueLast; queue.lastRenderedState = newState; } // Interleaved updates are stored on a separate queue. We aren't going to // process them during this render, but we do need to track which lanes // are remaining. var lastInterleaved = queue.interleaved; if (lastInterleaved !== null) { var interleaved = lastInterleaved; do { var interleavedLane = interleaved.lane; currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, interleavedLane); markSkippedUpdateLanes(interleavedLane); interleaved = interleaved.next; } while (interleaved !== lastInterleaved); } else if (baseQueue === null) { // `queue.lanes` is used for entangling transitions. We can set it back to // zero once the queue is empty. queue.lanes = NoLanes; } var dispatch = queue.dispatch; return [hook.memoizedState, dispatch]; } function rerenderReducer(reducer, initialArg, init) { var hook = updateWorkInProgressHook(); var queue = hook.queue; if (queue === null) { throw new Error('Should have a queue. This is likely a bug in React. Please file an issue.'); } queue.lastRenderedReducer = reducer; // This is a re-render. Apply the new render phase updates to the previous // work-in-progress hook. var dispatch = queue.dispatch; var lastRenderPhaseUpdate = queue.pending; var newState = hook.memoizedState; if (lastRenderPhaseUpdate !== null) { // The queue doesn't persist past this render pass. queue.pending = null; var firstRenderPhaseUpdate = lastRenderPhaseUpdate.next; var update = firstRenderPhaseUpdate; do { // Process this render phase update. We don't have to check the // priority because it will always be the same as the current // render's. var action = update.action; newState = reducer(newState, action); update = update.next; } while (update !== firstRenderPhaseUpdate); // Mark that the fiber performed work, but only if the new state is // different from the current state. if (!objectIs(newState, hook.memoizedState)) { markWorkInProgressReceivedUpdate(); } hook.memoizedState = newState; // Don't persist the state accumulated from the render phase updates to // the base state unless the queue is empty. // TODO: Not sure if this is the desired semantics, but it's what we // do for gDSFP. I can't remember why. if (hook.baseQueue === null) { hook.baseState = newState; } queue.lastRenderedState = newState; } return [newState, dispatch]; } function mountMutableSource(source, getSnapshot, subscribe) { { return undefined; } } function updateMutableSource(source, getSnapshot, subscribe) { { return undefined; } } function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { var fiber = currentlyRenderingFiber$1; var hook = mountWorkInProgressHook(); var nextSnapshot; var isHydrating = getIsHydrating(); if (isHydrating) { if (getServerSnapshot === undefined) { throw new Error('Missing getServerSnapshot, which is required for ' + 'server-rendered content. Will revert to client rendering.'); } nextSnapshot = getServerSnapshot(); { if (!didWarnUncachedGetSnapshot) { if (nextSnapshot !== getServerSnapshot()) { error('The result of getServerSnapshot should be cached to avoid an infinite loop'); didWarnUncachedGetSnapshot = true; } } } } else { nextSnapshot = getSnapshot(); { if (!didWarnUncachedGetSnapshot) { var cachedSnapshot = getSnapshot(); if (!objectIs(nextSnapshot, cachedSnapshot)) { error('The result of getSnapshot should be cached to avoid an infinite loop'); didWarnUncachedGetSnapshot = true; } } } // Unless we're rendering a blocking lane, schedule a consistency check. // Right before committing, we will walk the tree and check if any of the // stores were mutated. // // We won't do this if we're hydrating server-rendered content, because if // the content is stale, it's already visible anyway. Instead we'll patch // it up in a passive effect. var root = getWorkInProgressRoot(); if (root === null) { throw new Error('Expected a work-in-progress root. This is a bug in React. Please file an issue.'); } if (!includesBlockingLane(root, renderLanes)) { pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); } } // Read the current snapshot from the store on every render. This breaks the // normal rules of React, and only works because store updates are // always synchronous. hook.memoizedState = nextSnapshot; var inst = { value: nextSnapshot, getSnapshot: getSnapshot }; hook.queue = inst; // Schedule an effect to subscribe to the store. mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]); // Schedule an effect to update the mutable instance fields. We will update // this whenever subscribe, getSnapshot, or value changes. Because there's no // clean-up function, and we track the deps correctly, we can call pushEffect // directly, without storing any additional state. For the same reason, we // don't need to set a static flag, either. // TODO: We can move this to the passive phase once we add a pre-commit // consistency check. See the next comment. fiber.flags |= Passive; pushEffect(HasEffect | Passive$1, updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), undefined, null); return nextSnapshot; } function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { var fiber = currentlyRenderingFiber$1; var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the // normal rules of React, and only works because store updates are // always synchronous. var nextSnapshot = getSnapshot(); { if (!didWarnUncachedGetSnapshot) { var cachedSnapshot = getSnapshot(); if (!objectIs(nextSnapshot, cachedSnapshot)) { error('The result of getSnapshot should be cached to avoid an infinite loop'); didWarnUncachedGetSnapshot = true; } } } var prevSnapshot = hook.memoizedState; var snapshotChanged = !objectIs(prevSnapshot, nextSnapshot); if (snapshotChanged) { hook.memoizedState = nextSnapshot; markWorkInProgressReceivedUpdate(); } var inst = hook.queue; updateEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]); // Whenever getSnapshot or subscribe changes, we need to check in the // commit phase if there was an interleaved mutation. In concurrent mode // this can happen all the time, but even in synchronous mode, an earlier // effect may have mutated the store. if (inst.getSnapshot !== getSnapshot || snapshotChanged || // Check if the susbcribe function changed. We can save some memory by // checking whether we scheduled a subscription effect above. workInProgressHook !== null && workInProgressHook.memoizedState.tag & HasEffect) { fiber.flags |= Passive; pushEffect(HasEffect | Passive$1, updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), undefined, null); // Unless we're rendering a blocking lane, schedule a consistency check. // Right before committing, we will walk the tree and check if any of the // stores were mutated. var root = getWorkInProgressRoot(); if (root === null) { throw new Error('Expected a work-in-progress root. This is a bug in React. Please file an issue.'); } if (!includesBlockingLane(root, renderLanes)) { pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); } } return nextSnapshot; } function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { fiber.flags |= StoreConsistency; var check = { getSnapshot: getSnapshot, value: renderedSnapshot }; var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; componentUpdateQueue.stores = [check]; } else { var stores = componentUpdateQueue.stores; if (stores === null) { componentUpdateQueue.stores = [check]; } else { stores.push(check); } } } function updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) { // These are updated in the passive phase inst.value = nextSnapshot; inst.getSnapshot = getSnapshot; // Something may have been mutated in between render and commit. This could // have been in an event that fired before the passive effects, or it could // have been in a layout effect. In that case, we would have used the old // snapsho and getSnapshot values to bail out. We need to check one more time. if (checkIfSnapshotChanged(inst)) { // Force a re-render. forceStoreRerender(fiber); } } function subscribeToStore(fiber, inst, subscribe) { var handleStoreChange = function () { // The store changed. Check if the snapshot changed since the last time we // read from the store. if (checkIfSnapshotChanged(inst)) { // Force a re-render. forceStoreRerender(fiber); } }; // Subscribe to the store and return a clean-up function. return subscribe(handleStoreChange); } function checkIfSnapshotChanged(inst) { var latestGetSnapshot = inst.getSnapshot; var prevValue = inst.value; try { var nextValue = latestGetSnapshot(); return !objectIs(prevValue, nextValue); } catch (error) { return true; } } function forceStoreRerender(fiber) { var root = enqueueConcurrentRenderForLane(fiber, SyncLane); if (root !== null) { scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); } } function mountState(initialState) { var hook = mountWorkInProgressHook(); if (typeof initialState === 'function') { // $FlowFixMe: Flow doesn't like mixed types initialState = initialState(); } hook.memoizedState = hook.baseState = initialState; var queue = { pending: null, interleaved: null, lanes: NoLanes, dispatch: null, lastRenderedReducer: basicStateReducer, lastRenderedState: initialState }; hook.queue = queue; var dispatch = queue.dispatch = dispatchSetState.bind(null, currentlyRenderingFiber$1, queue); return [hook.memoizedState, dispatch]; } function updateState(initialState) { return updateReducer(basicStateReducer); } function rerenderState(initialState) { return rerenderReducer(basicStateReducer); } function pushEffect(tag, create, destroy, deps) { var effect = { tag: tag, create: create, destroy: destroy, deps: deps, // Circular next: null }; var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; if (componentUpdateQueue === null) { componentUpdateQueue = createFunctionComponentUpdateQueue(); currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; componentUpdateQueue.lastEffect = effect.next = effect; } else { var lastEffect = componentUpdateQueue.lastEffect; if (lastEffect === null) { componentUpdateQueue.lastEffect = effect.next = effect; } else { var firstEffect = lastEffect.next; lastEffect.next = effect; effect.next = firstEffect; componentUpdateQueue.lastEffect = effect; } } return effect; } function mountRef(initialValue) { var hook = mountWorkInProgressHook(); { var _ref2 = { current: initialValue }; hook.memoizedState = _ref2; return _ref2; } } function updateRef(initialValue) { var hook = updateWorkInProgressHook(); return hook.memoizedState; } function mountEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = mountWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; currentlyRenderingFiber$1.flags |= fiberFlags; hook.memoizedState = pushEffect(HasEffect | hookFlags, create, undefined, nextDeps); } function updateEffectImpl(fiberFlags, hookFlags, create, deps) { var hook = updateWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; var destroy = undefined; if (currentHook !== null) { var prevEffect = currentHook.memoizedState; destroy = prevEffect.destroy; if (nextDeps !== null) { var prevDeps = prevEffect.deps; if (areHookInputsEqual(nextDeps, prevDeps)) { hook.memoizedState = pushEffect(hookFlags, create, destroy, nextDeps); return; } } } currentlyRenderingFiber$1.flags |= fiberFlags; hook.memoizedState = pushEffect(HasEffect | hookFlags, create, destroy, nextDeps); } function mountEffect(create, deps) { if ( (currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { return mountEffectImpl(MountPassiveDev | Passive | PassiveStatic, Passive$1, create, deps); } else { return mountEffectImpl(Passive | PassiveStatic, Passive$1, create, deps); } } function updateEffect(create, deps) { return updateEffectImpl(Passive, Passive$1, create, deps); } function mountInsertionEffect(create, deps) { return mountEffectImpl(Update, Insertion, create, deps); } function updateInsertionEffect(create, deps) { return updateEffectImpl(Update, Insertion, create, deps); } function mountLayoutEffect(create, deps) { var fiberFlags = Update; { fiberFlags |= LayoutStatic; } if ( (currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } return mountEffectImpl(fiberFlags, Layout, create, deps); } function updateLayoutEffect(create, deps) { return updateEffectImpl(Update, Layout, create, deps); } function imperativeHandleEffect(create, ref) { if (typeof ref === 'function') { var refCallback = ref; var _inst = create(); refCallback(_inst); return function () { refCallback(null); }; } else if (ref !== null && ref !== undefined) { var refObject = ref; { if (!refObject.hasOwnProperty('current')) { error('Expected useImperativeHandle() first argument to either be a ' + 'ref callback or React.createRef() object. Instead received: %s.', 'an object with keys {' + Object.keys(refObject).join(', ') + '}'); } } var _inst2 = create(); refObject.current = _inst2; return function () { refObject.current = null; }; } } function mountImperativeHandle(ref, create, deps) { { if (typeof create !== 'function') { error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null'); } } // TODO: If deps are provided, should we skip comparing the ref itself? var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null; var fiberFlags = Update; { fiberFlags |= LayoutStatic; } if ( (currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } return mountEffectImpl(fiberFlags, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps); } function updateImperativeHandle(ref, create, deps) { { if (typeof create !== 'function') { error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null'); } } // TODO: If deps are provided, should we skip comparing the ref itself? var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null; return updateEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps); } function mountDebugValue(value, formatterFn) {// This hook is normally a no-op. // The react-debug-hooks package injects its own implementation // so that e.g. DevTools can display custom hook values. } var updateDebugValue = mountDebugValue; function mountCallback(callback, deps) { var hook = mountWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; hook.memoizedState = [callback, nextDeps]; return callback; } function updateCallback(callback, deps) { var hook = updateWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; var prevState = hook.memoizedState; if (prevState !== null) { if (nextDeps !== null) { var prevDeps = prevState[1]; if (areHookInputsEqual(nextDeps, prevDeps)) { return prevState[0]; } } } hook.memoizedState = [callback, nextDeps]; return callback; } function mountMemo(nextCreate, deps) { var hook = mountWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; var nextValue = nextCreate(); hook.memoizedState = [nextValue, nextDeps]; return nextValue; } function updateMemo(nextCreate, deps) { var hook = updateWorkInProgressHook(); var nextDeps = deps === undefined ? null : deps; var prevState = hook.memoizedState; if (prevState !== null) { // Assume these are defined. If they're not, areHookInputsEqual will warn. if (nextDeps !== null) { var prevDeps = prevState[1]; if (areHookInputsEqual(nextDeps, prevDeps)) { return prevState[0]; } } } var nextValue = nextCreate(); hook.memoizedState = [nextValue, nextDeps]; return nextValue; } function mountDeferredValue(value) { var hook = mountWorkInProgressHook(); hook.memoizedState = value; return value; } function updateDeferredValue(value) { var hook = updateWorkInProgressHook(); var resolvedCurrentHook = currentHook; var prevValue = resolvedCurrentHook.memoizedState; return updateDeferredValueImpl(hook, prevValue, value); } function rerenderDeferredValue(value) { var hook = updateWorkInProgressHook(); if (currentHook === null) { // This is a rerender during a mount. hook.memoizedState = value; return value; } else { // This is a rerender during an update. var prevValue = currentHook.memoizedState; return updateDeferredValueImpl(hook, prevValue, value); } } function updateDeferredValueImpl(hook, prevValue, value) { var shouldDeferValue = !includesOnlyNonUrgentLanes(renderLanes); if (shouldDeferValue) { // This is an urgent update. If the value has changed, keep using the // previous value and spawn a deferred render to update it later. if (!objectIs(value, prevValue)) { // Schedule a deferred render var deferredLane = claimNextTransitionLane(); currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, deferredLane); markSkippedUpdateLanes(deferredLane); // Set this to true to indicate that the rendered value is inconsistent // from the latest value. The name "baseState" doesn't really match how we // use it because we're reusing a state hook field instead of creating a // new one. hook.baseState = true; } // Reuse the previous value return prevValue; } else { // This is not an urgent update, so we can use the latest value regardless // of what it is. No need to defer it. // However, if we're currently inside a spawned render, then we need to mark // this as an update to prevent the fiber from bailing out. // // `baseState` is true when the current value is different from the rendered // value. The name doesn't really match how we use it because we're reusing // a state hook field instead of creating a new one. if (hook.baseState) { // Flip this back to false. hook.baseState = false; markWorkInProgressReceivedUpdate(); } hook.memoizedState = value; return value; } } function startTransition(setPending, callback, options) { var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(higherEventPriority(previousPriority, ContinuousEventPriority)); setPending(true); var prevTransition = ReactCurrentBatchConfig$2.transition; ReactCurrentBatchConfig$2.transition = {}; var currentTransition = ReactCurrentBatchConfig$2.transition; { ReactCurrentBatchConfig$2.transition._updatedFibers = new Set(); } try { setPending(false); callback(); } finally { setCurrentUpdatePriority(previousPriority); ReactCurrentBatchConfig$2.transition = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { var updatedFibersCount = currentTransition._updatedFibers.size; if (updatedFibersCount > 10) { warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.'); } currentTransition._updatedFibers.clear(); } } } } function mountTransition() { var _mountState = mountState(false), isPending = _mountState[0], setPending = _mountState[1]; // The `start` method never changes. var start = startTransition.bind(null, setPending); var hook = mountWorkInProgressHook(); hook.memoizedState = start; return [isPending, start]; } function updateTransition() { var _updateState = updateState(), isPending = _updateState[0]; var hook = updateWorkInProgressHook(); var start = hook.memoizedState; return [isPending, start]; } function rerenderTransition() { var _rerenderState = rerenderState(), isPending = _rerenderState[0]; var hook = updateWorkInProgressHook(); var start = hook.memoizedState; return [isPending, start]; } var isUpdatingOpaqueValueInRenderPhase = false; function getIsUpdatingOpaqueValueInRenderPhaseInDEV() { { return isUpdatingOpaqueValueInRenderPhase; } } function mountId() { var hook = mountWorkInProgressHook(); var root = getWorkInProgressRoot(); // TODO: In Fizz, id generation is specific to each server config. Maybe we // should do this in Fiber, too? Deferring this decision for now because // there's no other place to store the prefix except for an internal field on // the public createRoot object, which the fiber tree does not currently have // a reference to. var identifierPrefix = root.identifierPrefix; var id; if (getIsHydrating()) { var treeId = getTreeId(); // Use a captial R prefix for server-generated ids. id = ':' + identifierPrefix + 'R' + treeId; // Unless this is the first id at this level, append a number at the end // that represents the position of this useId hook among all the useId // hooks for this fiber. var localId = localIdCounter++; if (localId > 0) { id += 'H' + localId.toString(32); } id += ':'; } else { // Use a lowercase r prefix for client-generated ids. var globalClientId = globalClientIdCounter++; id = ':' + identifierPrefix + 'r' + globalClientId.toString(32) + ':'; } hook.memoizedState = id; return id; } function updateId() { var hook = updateWorkInProgressHook(); var id = hook.memoizedState; return id; } function dispatchReducerAction(fiber, queue, action) { { if (typeof arguments[3] === 'function') { error("State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().'); } } var lane = requestUpdateLane(fiber); var update = { lane: lane, action: action, hasEagerState: false, eagerState: null, next: null }; if (isRenderPhaseUpdate(fiber)) { enqueueRenderPhaseUpdate(queue, update); } else { var root = enqueueConcurrentHookUpdate(fiber, queue, update, lane); if (root !== null) { var eventTime = requestEventTime(); scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitionUpdate(root, queue, lane); } } markUpdateInDevTools(fiber, lane); } function dispatchSetState(fiber, queue, action) { { if (typeof arguments[3] === 'function') { error("State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().'); } } var lane = requestUpdateLane(fiber); var update = { lane: lane, action: action, hasEagerState: false, eagerState: null, next: null }; if (isRenderPhaseUpdate(fiber)) { enqueueRenderPhaseUpdate(queue, update); } else { var alternate = fiber.alternate; if (fiber.lanes === NoLanes && (alternate === null || alternate.lanes === NoLanes)) { // The queue is currently empty, which means we can eagerly compute the // next state before entering the render phase. If the new state is the // same as the current state, we may be able to bail out entirely. var lastRenderedReducer = queue.lastRenderedReducer; if (lastRenderedReducer !== null) { var prevDispatcher; { prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; } try { var currentState = queue.lastRenderedState; var eagerState = lastRenderedReducer(currentState, action); // Stash the eagerly computed state, and the reducer used to compute // it, on the update object. If the reducer hasn't changed by the // time we enter the render phase, then the eager state can be used // without calling the reducer again. update.hasEagerState = true; update.eagerState = eagerState; if (objectIs(eagerState, currentState)) { // Fast path. We can bail out without scheduling React to re-render. // It's still possible that we'll need to rebase this update later, // if the component re-renders for a different reason and by that // time the reducer has changed. // TODO: Do we still need to entangle transitions in this case? enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update, lane); return; } } catch (error) {// Suppress the error. It will throw again in the render phase. } finally { { ReactCurrentDispatcher$1.current = prevDispatcher; } } } } var root = enqueueConcurrentHookUpdate(fiber, queue, update, lane); if (root !== null) { var eventTime = requestEventTime(); scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitionUpdate(root, queue, lane); } } markUpdateInDevTools(fiber, lane); } function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1; } function enqueueRenderPhaseUpdate(queue, update) { // This is a render phase update. Stash it in a lazily-created map of // queue -> linked list of updates. After this render pass, we'll restart // and apply the stashed updates on top of the work-in-progress hook. didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true; var pending = queue.pending; if (pending === null) { // This is the first update. Create a circular list. update.next = update; } else { update.next = pending.next; pending.next = update; } queue.pending = update; } // TODO: Move to ReactFiberConcurrentUpdates? function entangleTransitionUpdate(root, queue, lane) { if (isTransitionLane(lane)) { var queueLanes = queue.lanes; // If any entangled lanes are no longer pending on the root, then they // must have finished. We can remove them from the shared queue, which // represents a superset of the actually pending lanes. In some cases we // may entangle more than we need to, but that's OK. In fact it's worse if // we *don't* entangle when we should. queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. var newQueueLanes = mergeLanes(queueLanes, lane); queue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if // the lane finished since the last time we entangled it. So we need to // entangle it again, just to be sure. markRootEntangled(root, newQueueLanes); } } function markUpdateInDevTools(fiber, lane, action) { { markStateUpdateScheduled(fiber, lane); } } var ContextOnlyDispatcher = { readContext: readContext, useCallback: throwInvalidHookError, useContext: throwInvalidHookError, useEffect: throwInvalidHookError, useImperativeHandle: throwInvalidHookError, useInsertionEffect: throwInvalidHookError, useLayoutEffect: throwInvalidHookError, useMemo: throwInvalidHookError, useReducer: throwInvalidHookError, useRef: throwInvalidHookError, useState: throwInvalidHookError, useDebugValue: throwInvalidHookError, useDeferredValue: throwInvalidHookError, useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, useId: throwInvalidHookError, unstable_isNewReconciler: enableNewReconciler }; var HooksDispatcherOnMountInDEV = null; var HooksDispatcherOnMountWithHookTypesInDEV = null; var HooksDispatcherOnUpdateInDEV = null; var HooksDispatcherOnRerenderInDEV = null; var InvalidNestedHooksDispatcherOnMountInDEV = null; var InvalidNestedHooksDispatcherOnUpdateInDEV = null; var InvalidNestedHooksDispatcherOnRerenderInDEV = null; { var warnInvalidContextAccess = function () { error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().'); }; var warnInvalidHookAccess = function () { error('Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://reactjs.org/link/rules-of-hooks'); }; HooksDispatcherOnMountInDEV = { readContext: function (context) { return readContext(context); }, useCallback: function (callback, deps) { currentHookNameInDev = 'useCallback'; mountHookTypesDev(); checkDepsAreArrayDev(deps); return mountCallback(callback, deps); }, useContext: function (context) { currentHookNameInDev = 'useContext'; mountHookTypesDev(); return readContext(context); }, useEffect: function (create, deps) { currentHookNameInDev = 'useEffect'; mountHookTypesDev(); checkDepsAreArrayDev(deps); return mountEffect(create, deps); }, useImperativeHandle: function (ref, create, deps) { currentHookNameInDev = 'useImperativeHandle'; mountHookTypesDev(); checkDepsAreArrayDev(deps); return mountImperativeHandle(ref, create, deps); }, useInsertionEffect: function (create, deps) { currentHookNameInDev = 'useInsertionEffect'; mountHookTypesDev(); checkDepsAreArrayDev(deps); return mountInsertionEffect(create, deps); }, useLayoutEffect: function (create, deps) { currentHookNameInDev = 'useLayoutEffect'; mountHookTypesDev(); checkDepsAreArrayDev(deps); return mountLayoutEffect(create, deps); }, useMemo: function (create, deps) { currentHookNameInDev = 'useMemo'; mountHookTypesDev(); checkDepsAreArrayDev(deps); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = 'useReducer'; mountHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useRef: function (initialValue) { currentHookNameInDev = 'useRef'; mountHookTypesDev(); return mountRef(initialValue); }, useState: function (initialState) { currentHookNameInDev = 'useState'; mountHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { currentHookNameInDev = 'useDebugValue'; mountHookTypesDev(); return mountDebugValue(); }, useDeferredValue: function (value) { currentHookNameInDev = 'useDeferredValue'; mountHookTypesDev(); return mountDeferredValue(value); }, useTransition: function () { currentHookNameInDev = 'useTransition'; mountHookTypesDev(); return mountTransition(); }, useMutableSource: function (source, getSnapshot, subscribe) { currentHookNameInDev = 'useMutableSource'; mountHookTypesDev(); return mountMutableSource(); }, useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = 'useSyncExternalStore'; mountHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); }, useId: function () { currentHookNameInDev = 'useId'; mountHookTypesDev(); return mountId(); }, unstable_isNewReconciler: enableNewReconciler }; HooksDispatcherOnMountWithHookTypesInDEV = { readContext: function (context) { return readContext(context); }, useCallback: function (callback, deps) { currentHookNameInDev = 'useCallback'; updateHookTypesDev(); return mountCallback(callback, deps); }, useContext: function (context) { currentHookNameInDev = 'useContext'; updateHookTypesDev(); return readContext(context); }, useEffect: function (create, deps) { currentHookNameInDev = 'useEffect'; updateHookTypesDev(); return mountEffect(create, deps); }, useImperativeHandle: function (ref, create, deps) { currentHookNameInDev = 'useImperativeHandle'; updateHookTypesDev(); return mountImperativeHandle(ref, create, deps); }, useInsertionEffect: function (create, deps) { currentHookNameInDev = 'useInsertionEffect'; updateHookTypesDev(); return mountInsertionEffect(create, deps); }, useLayoutEffect: function (create, deps) { currentHookNameInDev = 'useLayoutEffect'; updateHookTypesDev(); return mountLayoutEffect(create, deps); }, useMemo: function (create, deps) { currentHookNameInDev = 'useMemo'; updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = 'useReducer'; updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useRef: function (initialValue) { currentHookNameInDev = 'useRef'; updateHookTypesDev(); return mountRef(initialValue); }, useState: function (initialState) { currentHookNameInDev = 'useState'; updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { currentHookNameInDev = 'useDebugValue'; updateHookTypesDev(); return mountDebugValue(); }, useDeferredValue: function (value) { currentHookNameInDev = 'useDeferredValue'; updateHookTypesDev(); return mountDeferredValue(value); }, useTransition: function () { currentHookNameInDev = 'useTransition'; updateHookTypesDev(); return mountTransition(); }, useMutableSource: function (source, getSnapshot, subscribe) { currentHookNameInDev = 'useMutableSource'; updateHookTypesDev(); return mountMutableSource(); }, useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = 'useSyncExternalStore'; updateHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); }, useId: function () { currentHookNameInDev = 'useId'; updateHookTypesDev(); return mountId(); }, unstable_isNewReconciler: enableNewReconciler }; HooksDispatcherOnUpdateInDEV = { readContext: function (context) { return readContext(context); }, useCallback: function (callback, deps) { currentHookNameInDev = 'useCallback'; updateHookTypesDev(); return updateCallback(callback, deps); }, useContext: function (context) { currentHookNameInDev = 'useContext'; updateHookTypesDev(); return readContext(context); }, useEffect: function (create, deps) { currentHookNameInDev = 'useEffect'; updateHookTypesDev(); return updateEffect(create, deps); }, useImperativeHandle: function (ref, create, deps) { currentHookNameInDev = 'useImperativeHandle'; updateHookTypesDev(); return updateImperativeHandle(ref, create, deps); }, useInsertionEffect: function (create, deps) { currentHookNameInDev = 'useInsertionEffect'; updateHookTypesDev(); return updateInsertionEffect(create, deps); }, useLayoutEffect: function (create, deps) { currentHookNameInDev = 'useLayoutEffect'; updateHookTypesDev(); return updateLayoutEffect(create, deps); }, useMemo: function (create, deps) { currentHookNameInDev = 'useMemo'; updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = 'useReducer'; updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateReducer(reducer, initialArg, init); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useRef: function (initialValue) { currentHookNameInDev = 'useRef'; updateHookTypesDev(); return updateRef(); }, useState: function (initialState) { currentHookNameInDev = 'useState'; updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateState(initialState); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { currentHookNameInDev = 'useDebugValue'; updateHookTypesDev(); return updateDebugValue(); }, useDeferredValue: function (value) { currentHookNameInDev = 'useDeferredValue'; updateHookTypesDev(); return updateDeferredValue(value); }, useTransition: function () { currentHookNameInDev = 'useTransition'; updateHookTypesDev(); return updateTransition(); }, useMutableSource: function (source, getSnapshot, subscribe) { currentHookNameInDev = 'useMutableSource'; updateHookTypesDev(); return updateMutableSource(); }, useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = 'useSyncExternalStore'; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); }, useId: function () { currentHookNameInDev = 'useId'; updateHookTypesDev(); return updateId(); }, unstable_isNewReconciler: enableNewReconciler }; HooksDispatcherOnRerenderInDEV = { readContext: function (context) { return readContext(context); }, useCallback: function (callback, deps) { currentHookNameInDev = 'useCallback'; updateHookTypesDev(); return updateCallback(callback, deps); }, useContext: function (context) { currentHookNameInDev = 'useContext'; updateHookTypesDev(); return readContext(context); }, useEffect: function (create, deps) { currentHookNameInDev = 'useEffect'; updateHookTypesDev(); return updateEffect(create, deps); }, useImperativeHandle: function (ref, create, deps) { currentHookNameInDev = 'useImperativeHandle'; updateHookTypesDev(); return updateImperativeHandle(ref, create, deps); }, useInsertionEffect: function (create, deps) { currentHookNameInDev = 'useInsertionEffect'; updateHookTypesDev(); return updateInsertionEffect(create, deps); }, useLayoutEffect: function (create, deps) { currentHookNameInDev = 'useLayoutEffect'; updateHookTypesDev(); return updateLayoutEffect(create, deps); }, useMemo: function (create, deps) { currentHookNameInDev = 'useMemo'; updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return updateMemo(create, deps); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = 'useReducer'; updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return rerenderReducer(reducer, initialArg, init); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useRef: function (initialValue) { currentHookNameInDev = 'useRef'; updateHookTypesDev(); return updateRef(); }, useState: function (initialState) { currentHookNameInDev = 'useState'; updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return rerenderState(initialState); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { currentHookNameInDev = 'useDebugValue'; updateHookTypesDev(); return updateDebugValue(); }, useDeferredValue: function (value) { currentHookNameInDev = 'useDeferredValue'; updateHookTypesDev(); return rerenderDeferredValue(value); }, useTransition: function () { currentHookNameInDev = 'useTransition'; updateHookTypesDev(); return rerenderTransition(); }, useMutableSource: function (source, getSnapshot, subscribe) { currentHookNameInDev = 'useMutableSource'; updateHookTypesDev(); return updateMutableSource(); }, useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = 'useSyncExternalStore'; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); }, useId: function () { currentHookNameInDev = 'useId'; updateHookTypesDev(); return updateId(); }, unstable_isNewReconciler: enableNewReconciler }; InvalidNestedHooksDispatcherOnMountInDEV = { readContext: function (context) { warnInvalidContextAccess(); return readContext(context); }, useCallback: function (callback, deps) { currentHookNameInDev = 'useCallback'; warnInvalidHookAccess(); mountHookTypesDev(); return mountCallback(callback, deps); }, useContext: function (context) { currentHookNameInDev = 'useContext'; warnInvalidHookAccess(); mountHookTypesDev(); return readContext(context); }, useEffect: function (create, deps) { currentHookNameInDev = 'useEffect'; warnInvalidHookAccess(); mountHookTypesDev(); return mountEffect(create, deps); }, useImperativeHandle: function (ref, create, deps) { currentHookNameInDev = 'useImperativeHandle'; warnInvalidHookAccess(); mountHookTypesDev(); return mountImperativeHandle(ref, create, deps); }, useInsertionEffect: function (create, deps) { currentHookNameInDev = 'useInsertionEffect'; warnInvalidHookAccess(); mountHookTypesDev(); return mountInsertionEffect(create, deps); }, useLayoutEffect: function (create, deps) { currentHookNameInDev = 'useLayoutEffect'; warnInvalidHookAccess(); mountHookTypesDev(); return mountLayoutEffect(create, deps); }, useMemo: function (create, deps) { currentHookNameInDev = 'useMemo'; warnInvalidHookAccess(); mountHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = 'useReducer'; warnInvalidHookAccess(); mountHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useRef: function (initialValue) { currentHookNameInDev = 'useRef'; warnInvalidHookAccess(); mountHookTypesDev(); return mountRef(initialValue); }, useState: function (initialState) { currentHookNameInDev = 'useState'; warnInvalidHookAccess(); mountHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { currentHookNameInDev = 'useDebugValue'; warnInvalidHookAccess(); mountHookTypesDev(); return mountDebugValue(); }, useDeferredValue: function (value) { currentHookNameInDev = 'useDeferredValue'; warnInvalidHookAccess(); mountHookTypesDev(); return mountDeferredValue(value); }, useTransition: function () { currentHookNameInDev = 'useTransition'; warnInvalidHookAccess(); mountHookTypesDev(); return mountTransition(); }, useMutableSource: function (source, getSnapshot, subscribe) { currentHookNameInDev = 'useMutableSource'; warnInvalidHookAccess(); mountHookTypesDev(); return mountMutableSource(); }, useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = 'useSyncExternalStore'; warnInvalidHookAccess(); mountHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); }, useId: function () { currentHookNameInDev = 'useId'; warnInvalidHookAccess(); mountHookTypesDev(); return mountId(); }, unstable_isNewReconciler: enableNewReconciler }; InvalidNestedHooksDispatcherOnUpdateInDEV = { readContext: function (context) { warnInvalidContextAccess(); return readContext(context); }, useCallback: function (callback, deps) { currentHookNameInDev = 'useCallback'; warnInvalidHookAccess(); updateHookTypesDev(); return updateCallback(callback, deps); }, useContext: function (context) { currentHookNameInDev = 'useContext'; warnInvalidHookAccess(); updateHookTypesDev(); return readContext(context); }, useEffect: function (create, deps) { currentHookNameInDev = 'useEffect'; warnInvalidHookAccess(); updateHookTypesDev(); return updateEffect(create, deps); }, useImperativeHandle: function (ref, create, deps) { currentHookNameInDev = 'useImperativeHandle'; warnInvalidHookAccess(); updateHookTypesDev(); return updateImperativeHandle(ref, create, deps); }, useInsertionEffect: function (create, deps) { currentHookNameInDev = 'useInsertionEffect'; warnInvalidHookAccess(); updateHookTypesDev(); return updateInsertionEffect(create, deps); }, useLayoutEffect: function (create, deps) { currentHookNameInDev = 'useLayoutEffect'; warnInvalidHookAccess(); updateHookTypesDev(); return updateLayoutEffect(create, deps); }, useMemo: function (create, deps) { currentHookNameInDev = 'useMemo'; warnInvalidHookAccess(); updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = 'useReducer'; warnInvalidHookAccess(); updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateReducer(reducer, initialArg, init); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useRef: function (initialValue) { currentHookNameInDev = 'useRef'; warnInvalidHookAccess(); updateHookTypesDev(); return updateRef(); }, useState: function (initialState) { currentHookNameInDev = 'useState'; warnInvalidHookAccess(); updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateState(initialState); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { currentHookNameInDev = 'useDebugValue'; warnInvalidHookAccess(); updateHookTypesDev(); return updateDebugValue(); }, useDeferredValue: function (value) { currentHookNameInDev = 'useDeferredValue'; warnInvalidHookAccess(); updateHookTypesDev(); return updateDeferredValue(value); }, useTransition: function () { currentHookNameInDev = 'useTransition'; warnInvalidHookAccess(); updateHookTypesDev(); return updateTransition(); }, useMutableSource: function (source, getSnapshot, subscribe) { currentHookNameInDev = 'useMutableSource'; warnInvalidHookAccess(); updateHookTypesDev(); return updateMutableSource(); }, useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = 'useSyncExternalStore'; warnInvalidHookAccess(); updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); }, useId: function () { currentHookNameInDev = 'useId'; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); }, unstable_isNewReconciler: enableNewReconciler }; InvalidNestedHooksDispatcherOnRerenderInDEV = { readContext: function (context) { warnInvalidContextAccess(); return readContext(context); }, useCallback: function (callback, deps) { currentHookNameInDev = 'useCallback'; warnInvalidHookAccess(); updateHookTypesDev(); return updateCallback(callback, deps); }, useContext: function (context) { currentHookNameInDev = 'useContext'; warnInvalidHookAccess(); updateHookTypesDev(); return readContext(context); }, useEffect: function (create, deps) { currentHookNameInDev = 'useEffect'; warnInvalidHookAccess(); updateHookTypesDev(); return updateEffect(create, deps); }, useImperativeHandle: function (ref, create, deps) { currentHookNameInDev = 'useImperativeHandle'; warnInvalidHookAccess(); updateHookTypesDev(); return updateImperativeHandle(ref, create, deps); }, useInsertionEffect: function (create, deps) { currentHookNameInDev = 'useInsertionEffect'; warnInvalidHookAccess(); updateHookTypesDev(); return updateInsertionEffect(create, deps); }, useLayoutEffect: function (create, deps) { currentHookNameInDev = 'useLayoutEffect'; warnInvalidHookAccess(); updateHookTypesDev(); return updateLayoutEffect(create, deps); }, useMemo: function (create, deps) { currentHookNameInDev = 'useMemo'; warnInvalidHookAccess(); updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = 'useReducer'; warnInvalidHookAccess(); updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return rerenderReducer(reducer, initialArg, init); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useRef: function (initialValue) { currentHookNameInDev = 'useRef'; warnInvalidHookAccess(); updateHookTypesDev(); return updateRef(); }, useState: function (initialState) { currentHookNameInDev = 'useState'; warnInvalidHookAccess(); updateHookTypesDev(); var prevDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return rerenderState(initialState); } finally { ReactCurrentDispatcher$1.current = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { currentHookNameInDev = 'useDebugValue'; warnInvalidHookAccess(); updateHookTypesDev(); return updateDebugValue(); }, useDeferredValue: function (value) { currentHookNameInDev = 'useDeferredValue'; warnInvalidHookAccess(); updateHookTypesDev(); return rerenderDeferredValue(value); }, useTransition: function () { currentHookNameInDev = 'useTransition'; warnInvalidHookAccess(); updateHookTypesDev(); return rerenderTransition(); }, useMutableSource: function (source, getSnapshot, subscribe) { currentHookNameInDev = 'useMutableSource'; warnInvalidHookAccess(); updateHookTypesDev(); return updateMutableSource(); }, useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = 'useSyncExternalStore'; warnInvalidHookAccess(); updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); }, useId: function () { currentHookNameInDev = 'useId'; warnInvalidHookAccess(); updateHookTypesDev(); return updateId(); }, unstable_isNewReconciler: enableNewReconciler }; } var now$1 = unstable_now; var commitTime = 0; var layoutEffectStartTime = -1; var profilerStartTime = -1; var passiveEffectStartTime = -1; /** * Tracks whether the current update was a nested/cascading update (scheduled from a layout effect). * * The overall sequence is: * 1. render * 2. commit (and call `onRender`, `onCommit`) * 3. check for nested updates * 4. flush passive effects (and call `onPostCommit`) * * Nested updates are identified in step 3 above, * but step 4 still applies to the work that was just committed. * We use two flags to track nested updates then: * one tracks whether the upcoming update is a nested update, * and the other tracks whether the current update was a nested update. * The first value gets synced to the second at the start of the render phase. */ var currentUpdateIsNested = false; var nestedUpdateScheduled = false; function isCurrentUpdateNested() { return currentUpdateIsNested; } function markNestedUpdateScheduled() { { nestedUpdateScheduled = true; } } function resetNestedUpdateFlag() { { currentUpdateIsNested = false; nestedUpdateScheduled = false; } } function syncNestedUpdateFlag() { { currentUpdateIsNested = nestedUpdateScheduled; nestedUpdateScheduled = false; } } function getCommitTime() { return commitTime; } function recordCommitTime() { commitTime = now$1(); } function startProfilerTimer(fiber) { profilerStartTime = now$1(); if (fiber.actualStartTime < 0) { fiber.actualStartTime = now$1(); } } function stopProfilerTimerIfRunning(fiber) { profilerStartTime = -1; } function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) { if (profilerStartTime >= 0) { var elapsedTime = now$1() - profilerStartTime; fiber.actualDuration += elapsedTime; if (overrideBaseTime) { fiber.selfBaseDuration = elapsedTime; } profilerStartTime = -1; } } function recordLayoutEffectDuration(fiber) { if (layoutEffectStartTime >= 0) { var elapsedTime = now$1() - layoutEffectStartTime; layoutEffectStartTime = -1; // Store duration on the next nearest Profiler ancestor // Or the root (for the DevTools Profiler to read) var parentFiber = fiber.return; while (parentFiber !== null) { switch (parentFiber.tag) { case HostRoot: var root = parentFiber.stateNode; root.effectDuration += elapsedTime; return; case Profiler: var parentStateNode = parentFiber.stateNode; parentStateNode.effectDuration += elapsedTime; return; } parentFiber = parentFiber.return; } } } function recordPassiveEffectDuration(fiber) { if (passiveEffectStartTime >= 0) { var elapsedTime = now$1() - passiveEffectStartTime; passiveEffectStartTime = -1; // Store duration on the next nearest Profiler ancestor // Or the root (for the DevTools Profiler to read) var parentFiber = fiber.return; while (parentFiber !== null) { switch (parentFiber.tag) { case HostRoot: var root = parentFiber.stateNode; if (root !== null) { root.passiveEffectDuration += elapsedTime; } return; case Profiler: var parentStateNode = parentFiber.stateNode; if (parentStateNode !== null) { // Detached fibers have their state node cleared out. // In this case, the return pointer is also cleared out, // so we won't be able to report the time spent in this Profiler's subtree. parentStateNode.passiveEffectDuration += elapsedTime; } return; } parentFiber = parentFiber.return; } } } function startLayoutEffectTimer() { layoutEffectStartTime = now$1(); } function startPassiveEffectTimer() { passiveEffectStartTime = now$1(); } function transferActualDuration(fiber) { // Transfer time spent rendering these children so we don't lose it // after we rerender. This is used as a helper in special cases // where we should count the work of multiple passes. var child = fiber.child; while (child) { fiber.actualDuration += child.actualDuration; child = child.sibling; } } function resolveDefaultProps(Component, baseProps) { if (Component && Component.defaultProps) { // Resolve default props. Taken from ReactElement var props = assign({}, baseProps); var defaultProps = Component.defaultProps; for (var propName in defaultProps) { if (props[propName] === undefined) { props[propName] = defaultProps[propName]; } } return props; } return baseProps; } var fakeInternalInstance = {}; var didWarnAboutStateAssignmentForComponent; var didWarnAboutUninitializedState; var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate; var didWarnAboutLegacyLifecyclesAndDerivedState; var didWarnAboutUndefinedDerivedState; var warnOnUndefinedDerivedState; var warnOnInvalidCallback; var didWarnAboutDirectlyAssigningPropsToState; var didWarnAboutContextTypeAndContextTypes; var didWarnAboutInvalidateContextType; var didWarnAboutLegacyContext$1; { didWarnAboutStateAssignmentForComponent = new Set(); didWarnAboutUninitializedState = new Set(); didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set(); didWarnAboutLegacyLifecyclesAndDerivedState = new Set(); didWarnAboutDirectlyAssigningPropsToState = new Set(); didWarnAboutUndefinedDerivedState = new Set(); didWarnAboutContextTypeAndContextTypes = new Set(); didWarnAboutInvalidateContextType = new Set(); didWarnAboutLegacyContext$1 = new Set(); var didWarnOnInvalidCallback = new Set(); warnOnInvalidCallback = function (callback, callerName) { if (callback === null || typeof callback === 'function') { return; } var key = callerName + '_' + callback; if (!didWarnOnInvalidCallback.has(key)) { didWarnOnInvalidCallback.add(key); error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback); } }; warnOnUndefinedDerivedState = function (type, partialState) { if (partialState === undefined) { var componentName = getComponentNameFromType(type) || 'Component'; if (!didWarnAboutUndefinedDerivedState.has(componentName)) { didWarnAboutUndefinedDerivedState.add(componentName); error('%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName); } } }; // This is so gross but it's at least non-critical and can be removed if // it causes problems. This is meant to give a nicer error message for // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component, // ...)) which otherwise throws a "_processChildContext is not a function" // exception. Object.defineProperty(fakeInternalInstance, '_processChildContext', { enumerable: false, value: function () { throw new Error('_processChildContext is not available in React 16+. This likely ' + 'means you have multiple copies of React and are attempting to nest ' + 'a React 15 tree inside a React 16 tree using ' + "unstable_renderSubtreeIntoContainer, which isn't supported. Try " + 'to make sure you have only one copy of React (and ideally, switch ' + 'to ReactDOM.createPortal).'); } }); Object.freeze(fakeInternalInstance); } function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) { var prevState = workInProgress.memoizedState; var partialState = getDerivedStateFromProps(nextProps, prevState); { if ( workInProgress.mode & StrictLegacyMode) { setIsStrictModeForDevtools(true); try { // Invoke the function an extra time to help detect side-effects. partialState = getDerivedStateFromProps(nextProps, prevState); } finally { setIsStrictModeForDevtools(false); } } warnOnUndefinedDerivedState(ctor, partialState); } // Merge the partial state and the previous state. var memoizedState = partialState === null || partialState === undefined ? prevState : assign({}, prevState, partialState); workInProgress.memoizedState = memoizedState; // Once the update queue is empty, persist the derived state onto the // base state. if (workInProgress.lanes === NoLanes) { // Queue is always non-null for classes var updateQueue = workInProgress.updateQueue; updateQueue.baseState = memoizedState; } } var classComponentUpdater = { isMounted: isMounted, enqueueSetState: function (inst, payload, callback) { var fiber = get(inst); var eventTime = requestEventTime(); var lane = requestUpdateLane(fiber); var update = createUpdate(eventTime, lane); update.payload = payload; if (callback !== undefined && callback !== null) { { warnOnInvalidCallback(callback, 'setState'); } update.callback = callback; } var root = enqueueUpdate(fiber, update, lane); if (root !== null) { scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitions(root, fiber, lane); } { markStateUpdateScheduled(fiber, lane); } }, enqueueReplaceState: function (inst, payload, callback) { var fiber = get(inst); var eventTime = requestEventTime(); var lane = requestUpdateLane(fiber); var update = createUpdate(eventTime, lane); update.tag = ReplaceState; update.payload = payload; if (callback !== undefined && callback !== null) { { warnOnInvalidCallback(callback, 'replaceState'); } update.callback = callback; } var root = enqueueUpdate(fiber, update, lane); if (root !== null) { scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitions(root, fiber, lane); } { markStateUpdateScheduled(fiber, lane); } }, enqueueForceUpdate: function (inst, callback) { var fiber = get(inst); var eventTime = requestEventTime(); var lane = requestUpdateLane(fiber); var update = createUpdate(eventTime, lane); update.tag = ForceUpdate; if (callback !== undefined && callback !== null) { { warnOnInvalidCallback(callback, 'forceUpdate'); } update.callback = callback; } var root = enqueueUpdate(fiber, update, lane); if (root !== null) { scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitions(root, fiber, lane); } { markForceUpdateScheduled(fiber, lane); } } }; function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) { var instance = workInProgress.stateNode; if (typeof instance.shouldComponentUpdate === 'function') { var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext); { if ( workInProgress.mode & StrictLegacyMode) { setIsStrictModeForDevtools(true); try { // Invoke the function an extra time to help detect side-effects. shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext); } finally { setIsStrictModeForDevtools(false); } } if (shouldUpdate === undefined) { error('%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentNameFromType(ctor) || 'Component'); } } return shouldUpdate; } if (ctor.prototype && ctor.prototype.isPureReactComponent) { return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState); } return true; } function checkClassInstance(workInProgress, ctor, newProps) { var instance = workInProgress.stateNode; { var name = getComponentNameFromType(ctor) || 'Component'; var renderPresent = instance.render; if (!renderPresent) { if (ctor.prototype && typeof ctor.prototype.render === 'function') { error('%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name); } else { error('%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name); } } if (instance.getInitialState && !instance.getInitialState.isReactClassApproved && !instance.state) { error('getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name); } if (instance.getDefaultProps && !instance.getDefaultProps.isReactClassApproved) { error('getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name); } if (instance.propTypes) { error('propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name); } if (instance.contextType) { error('contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name); } { if (ctor.childContextTypes && !didWarnAboutLegacyContext$1.has(ctor) && // Strict Mode has its own warning for legacy context, so we can skip // this one. (workInProgress.mode & StrictLegacyMode) === NoMode) { didWarnAboutLegacyContext$1.add(ctor); error('%s uses the legacy childContextTypes API which is no longer ' + 'supported and will be removed in the next major release. Use ' + 'React.createContext() instead\n\n.' + 'Learn more about this warning here: https://reactjs.org/link/legacy-context', name); } if (ctor.contextTypes && !didWarnAboutLegacyContext$1.has(ctor) && // Strict Mode has its own warning for legacy context, so we can skip // this one. (workInProgress.mode & StrictLegacyMode) === NoMode) { didWarnAboutLegacyContext$1.add(ctor); error('%s uses the legacy contextTypes API which is no longer supported ' + 'and will be removed in the next major release. Use ' + 'React.createContext() with static contextType instead.\n\n' + 'Learn more about this warning here: https://reactjs.org/link/legacy-context', name); } if (instance.contextTypes) { error('contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name); } if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) { didWarnAboutContextTypeAndContextTypes.add(ctor); error('%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name); } } if (typeof instance.componentShouldUpdate === 'function') { error('%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name); } if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') { error('%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentNameFromType(ctor) || 'A pure component'); } if (typeof instance.componentDidUnmount === 'function') { error('%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name); } if (typeof instance.componentDidReceiveProps === 'function') { error('%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name); } if (typeof instance.componentWillRecieveProps === 'function') { error('%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name); } if (typeof instance.UNSAFE_componentWillRecieveProps === 'function') { error('%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name); } var hasMutatedProps = instance.props !== newProps; if (instance.props !== undefined && hasMutatedProps) { error('%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name); } if (instance.defaultProps) { error('Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name); } if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) { didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor); error('%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentNameFromType(ctor)); } if (typeof instance.getDerivedStateFromProps === 'function') { error('%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); } if (typeof instance.getDerivedStateFromError === 'function') { error('%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); } if (typeof ctor.getSnapshotBeforeUpdate === 'function') { error('%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name); } var _state = instance.state; if (_state && (typeof _state !== 'object' || isArray(_state))) { error('%s.state: must be set to an object or null', name); } if (typeof instance.getChildContext === 'function' && typeof ctor.childContextTypes !== 'object') { error('%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name); } } } function adoptClassInstance(workInProgress, instance) { instance.updater = classComponentUpdater; workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates set(instance, workInProgress); { instance._reactInternalInstance = fakeInternalInstance; } } function constructClassInstance(workInProgress, ctor, props) { var isLegacyContextConsumer = false; var unmaskedContext = emptyContextObject; var context = emptyContextObject; var contextType = ctor.contextType; { if ('contextType' in ctor) { var isValid = // Allow null for conditional declaration contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer> if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) { didWarnAboutInvalidateContextType.add(ctor); var addendum = ''; if (contextType === undefined) { addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.'; } else if (typeof contextType !== 'object') { addendum = ' However, it is set to a ' + typeof contextType + '.'; } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) { addendum = ' Did you accidentally pass the Context.Provider instead?'; } else if (contextType._context !== undefined) { // <Context.Consumer> addendum = ' Did you accidentally pass the Context.Consumer instead?'; } else { addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.'; } error('%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentNameFromType(ctor) || 'Component', addendum); } } } if (typeof contextType === 'object' && contextType !== null) { context = readContext(contextType); } else { unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); var contextTypes = ctor.contextTypes; isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined; context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject; } var instance = new ctor(props, context); // Instantiate twice to help detect side-effects. { if ( workInProgress.mode & StrictLegacyMode) { setIsStrictModeForDevtools(true); try { instance = new ctor(props, context); // eslint-disable-line no-new } finally { setIsStrictModeForDevtools(false); } } } var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null; adoptClassInstance(workInProgress, instance); { if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) { var componentName = getComponentNameFromType(ctor) || 'Component'; if (!didWarnAboutUninitializedState.has(componentName)) { didWarnAboutUninitializedState.add(componentName); error('`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName); } } // If new component APIs are defined, "unsafe" lifecycles won't be called. // Warn about these lifecycles if they are present. // Don't warn about react-lifecycles-compat polyfilled methods though. if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') { var foundWillMountName = null; var foundWillReceivePropsName = null; var foundWillUpdateName = null; if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) { foundWillMountName = 'componentWillMount'; } else if (typeof instance.UNSAFE_componentWillMount === 'function') { foundWillMountName = 'UNSAFE_componentWillMount'; } if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) { foundWillReceivePropsName = 'componentWillReceiveProps'; } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps'; } if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) { foundWillUpdateName = 'componentWillUpdate'; } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') { foundWillUpdateName = 'UNSAFE_componentWillUpdate'; } if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) { var _componentName = getComponentNameFromType(ctor) || 'Component'; var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()'; if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) { didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName); error('Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://reactjs.org/link/unsafe-component-lifecycles', _componentName, newApiName, foundWillMountName !== null ? "\n " + foundWillMountName : '', foundWillReceivePropsName !== null ? "\n " + foundWillReceivePropsName : '', foundWillUpdateName !== null ? "\n " + foundWillUpdateName : ''); } } } } // Cache unmasked context so we can avoid recreating masked context unless necessary. // ReactFiberContext usually updates this cache but can't for newly-created instances. if (isLegacyContextConsumer) { cacheContext(workInProgress, unmaskedContext, context); } return instance; } function callComponentWillMount(workInProgress, instance) { var oldState = instance.state; if (typeof instance.componentWillMount === 'function') { instance.componentWillMount(); } if (typeof instance.UNSAFE_componentWillMount === 'function') { instance.UNSAFE_componentWillMount(); } if (oldState !== instance.state) { { error('%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentNameFromFiber(workInProgress) || 'Component'); } classComponentUpdater.enqueueReplaceState(instance, instance.state, null); } } function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) { var oldState = instance.state; if (typeof instance.componentWillReceiveProps === 'function') { instance.componentWillReceiveProps(newProps, nextContext); } if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { instance.UNSAFE_componentWillReceiveProps(newProps, nextContext); } if (instance.state !== oldState) { { var componentName = getComponentNameFromFiber(workInProgress) || 'Component'; if (!didWarnAboutStateAssignmentForComponent.has(componentName)) { didWarnAboutStateAssignmentForComponent.add(componentName); error('%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName); } } classComponentUpdater.enqueueReplaceState(instance, instance.state, null); } } // Invokes the mount life-cycles on a previously never rendered instance. function mountClassInstance(workInProgress, ctor, newProps, renderLanes) { { checkClassInstance(workInProgress, ctor, newProps); } var instance = workInProgress.stateNode; instance.props = newProps; instance.state = workInProgress.memoizedState; instance.refs = {}; initializeUpdateQueue(workInProgress); var contextType = ctor.contextType; if (typeof contextType === 'object' && contextType !== null) { instance.context = readContext(contextType); } else { var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); instance.context = getMaskedContext(workInProgress, unmaskedContext); } { if (instance.state === newProps) { var componentName = getComponentNameFromType(ctor) || 'Component'; if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) { didWarnAboutDirectlyAssigningPropsToState.add(componentName); error('%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName); } } if (workInProgress.mode & StrictLegacyMode) { ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance); } { ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance); } } instance.state = workInProgress.memoizedState; var getDerivedStateFromProps = ctor.getDerivedStateFromProps; if (typeof getDerivedStateFromProps === 'function') { applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); instance.state = workInProgress.memoizedState; } // In order to support react-lifecycles-compat polyfilled components, // Unsafe lifecycles should not be invoked for components using the new APIs. if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { callComponentWillMount(workInProgress, instance); // If we had additional state updates during this life-cycle, let's // process them now. processUpdateQueue(workInProgress, newProps, instance, renderLanes); instance.state = workInProgress.memoizedState; } if (typeof instance.componentDidMount === 'function') { var fiberFlags = Update; { fiberFlags |= LayoutStatic; } if ( (workInProgress.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } workInProgress.flags |= fiberFlags; } } function resumeMountClassInstance(workInProgress, ctor, newProps, renderLanes) { var instance = workInProgress.stateNode; var oldProps = workInProgress.memoizedProps; instance.props = oldProps; var oldContext = instance.context; var contextType = ctor.contextType; var nextContext = emptyContextObject; if (typeof contextType === 'object' && contextType !== null) { nextContext = readContext(contextType); } else { var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext); } var getDerivedStateFromProps = ctor.getDerivedStateFromProps; var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what // ever the previously attempted to render - not the "current". However, // during componentDidUpdate we pass the "current" props. // In order to support react-lifecycles-compat polyfilled components, // Unsafe lifecycles should not be invoked for components using the new APIs. if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { if (oldProps !== newProps || oldContext !== nextContext) { callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext); } } resetHasForceUpdateBeforeProcessing(); var oldState = workInProgress.memoizedState; var newState = instance.state = oldState; processUpdateQueue(workInProgress, newProps, instance, renderLanes); newState = workInProgress.memoizedState; if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) { // If an update was already in progress, we should schedule an Update // effect even though we're bailing out, so that cWU/cDU are called. if (typeof instance.componentDidMount === 'function') { var fiberFlags = Update; { fiberFlags |= LayoutStatic; } if ( (workInProgress.mode & StrictEffectsMode) !== NoMode) { fiberFlags |= MountLayoutDev; } workInProgress.flags |= fiberFlags; } return false; } if (typeof getDerivedStateFromProps === 'function') { applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); newState = workInProgress.memoizedState; } var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext); if (shouldUpdate) { // In order to support react-lifecycles-compat polyfilled components, // Unsafe lifecycles should not be invoked for components using the new APIs. if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { if (typeof instance.componentWillMount === 'function') { instance.componentWillMount(); } if (typeof instance.UNSAFE_componentWillMount === 'function') { instance.UNSAFE_componentWillMount(); } } if (typeof instance.componentDidMount === 'function') { var _fiberFlags = Update; { _fiberFlags |= LayoutStatic; } if ( (workInProgress.mode & StrictEffectsMode) !== NoMode) { _fiberFlags |= MountLayoutDev; } workInProgress.flags |= _fiberFlags; } } else { // If an update was already in progress, we should schedule an Update // effect even though we're bailing out, so that cWU/cDU are called. if (typeof instance.componentDidMount === 'function') { var _fiberFlags2 = Update; { _fiberFlags2 |= LayoutStatic; } if ( (workInProgress.mode & StrictEffectsMode) !== NoMode) { _fiberFlags2 |= MountLayoutDev; } workInProgress.flags |= _fiberFlags2; } // If shouldComponentUpdate returned false, we should still update the // memoized state to indicate that this work can be reused. workInProgress.memoizedProps = newProps; workInProgress.memoizedState = newState; } // Update the existing instance's state, props, and context pointers even // if shouldComponentUpdate returns false. instance.props = newProps; instance.state = newState; instance.context = nextContext; return shouldUpdate; } // Invokes the update life-cycles and returns false if it shouldn't rerender. function updateClassInstance(current, workInProgress, ctor, newProps, renderLanes) { var instance = workInProgress.stateNode; cloneUpdateQueue(current, workInProgress); var unresolvedOldProps = workInProgress.memoizedProps; var oldProps = workInProgress.type === workInProgress.elementType ? unresolvedOldProps : resolveDefaultProps(workInProgress.type, unresolvedOldProps); instance.props = oldProps; var unresolvedNewProps = workInProgress.pendingProps; var oldContext = instance.context; var contextType = ctor.contextType; var nextContext = emptyContextObject; if (typeof contextType === 'object' && contextType !== null) { nextContext = readContext(contextType); } else { var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); nextContext = getMaskedContext(workInProgress, nextUnmaskedContext); } var getDerivedStateFromProps = ctor.getDerivedStateFromProps; var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what // ever the previously attempted to render - not the "current". However, // during componentDidUpdate we pass the "current" props. // In order to support react-lifecycles-compat polyfilled components, // Unsafe lifecycles should not be invoked for components using the new APIs. if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { if (unresolvedOldProps !== unresolvedNewProps || oldContext !== nextContext) { callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext); } } resetHasForceUpdateBeforeProcessing(); var oldState = workInProgress.memoizedState; var newState = instance.state = oldState; processUpdateQueue(workInProgress, newProps, instance, renderLanes); newState = workInProgress.memoizedState; if (unresolvedOldProps === unresolvedNewProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing() && !(enableLazyContextPropagation )) { // If an update was already in progress, we should schedule an Update // effect even though we're bailing out, so that cWU/cDU are called. if (typeof instance.componentDidUpdate === 'function') { if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { workInProgress.flags |= Update; } } if (typeof instance.getSnapshotBeforeUpdate === 'function') { if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { workInProgress.flags |= Snapshot; } } return false; } if (typeof getDerivedStateFromProps === 'function') { applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); newState = workInProgress.memoizedState; } var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) || // TODO: In some cases, we'll end up checking if context has changed twice, // both before and after `shouldComponentUpdate` has been called. Not ideal, // but I'm loath to refactor this function. This only happens for memoized // components so it's not that common. enableLazyContextPropagation ; if (shouldUpdate) { // In order to support react-lifecycles-compat polyfilled components, // Unsafe lifecycles should not be invoked for components using the new APIs. if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) { if (typeof instance.componentWillUpdate === 'function') { instance.componentWillUpdate(newProps, newState, nextContext); } if (typeof instance.UNSAFE_componentWillUpdate === 'function') { instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext); } } if (typeof instance.componentDidUpdate === 'function') { workInProgress.flags |= Update; } if (typeof instance.getSnapshotBeforeUpdate === 'function') { workInProgress.flags |= Snapshot; } } else { // If an update was already in progress, we should schedule an Update // effect even though we're bailing out, so that cWU/cDU are called. if (typeof instance.componentDidUpdate === 'function') { if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { workInProgress.flags |= Update; } } if (typeof instance.getSnapshotBeforeUpdate === 'function') { if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { workInProgress.flags |= Snapshot; } } // If shouldComponentUpdate returned false, we should still update the // memoized props/state to indicate that this work can be reused. workInProgress.memoizedProps = newProps; workInProgress.memoizedState = newState; } // Update the existing instance's state, props, and context pointers even // if shouldComponentUpdate returns false. instance.props = newProps; instance.state = newState; instance.context = nextContext; return shouldUpdate; } function createCapturedValueAtFiber(value, source) { // If the value is an error, call this function immediately after it is thrown // so the stack is accurate. return { value: value, source: source, stack: getStackByFiberInDevAndProd(source), digest: null }; } function createCapturedValue(value, digest, stack) { return { value: value, source: null, stack: stack != null ? stack : null, digest: digest != null ? digest : null }; } // This module is forked in different environments. // By default, return `true` to log errors to the console. // Forks can return `false` if this isn't desirable. function showErrorDialog(boundary, errorInfo) { return true; } function logCapturedError(boundary, errorInfo) { try { var logError = showErrorDialog(boundary, errorInfo); // Allow injected showErrorDialog() to prevent default console.error logging. // This enables renderers like ReactNative to better manage redbox behavior. if (logError === false) { return; } var error = errorInfo.value; if (true) { var source = errorInfo.source; var stack = errorInfo.stack; var componentStack = stack !== null ? stack : ''; // Browsers support silencing uncaught errors by calling // `preventDefault()` in window `error` handler. // We record this information as an expando on the error. if (error != null && error._suppressLogging) { if (boundary.tag === ClassComponent) { // The error is recoverable and was silenced. // Ignore it and don't print the stack addendum. // This is handy for testing error boundaries without noise. return; } // The error is fatal. Since the silencing might have // been accidental, we'll surface it anyway. // However, the browser would have silenced the original error // so we'll print it first, and then print the stack addendum. console['error'](error); // Don't transform to our wrapper // For a more detailed description of this block, see: // https://github.com/facebook/react/pull/13384 } var componentName = source ? getComponentNameFromFiber(source) : null; var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:'; var errorBoundaryMessage; if (boundary.tag === HostRoot) { errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.'; } else { var errorBoundaryName = getComponentNameFromFiber(boundary) || 'Anonymous'; errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + "."); } var combinedMessage = componentNameMessage + "\n" + componentStack + "\n\n" + ("" + errorBoundaryMessage); // In development, we provide our own message with just the component stack. // We don't include the original error message and JS stack because the browser // has already printed it. Even if the application swallows the error, it is still // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. console['error'](combinedMessage); // Don't transform to our wrapper } else { // In production, we print the error directly. // This will include the message, the JS stack, and anything the browser wants to show. // We pass the error object instead of custom message so that the browser displays the error natively. console['error'](error); // Don't transform to our wrapper } } catch (e) { // This method must not throw, or React internal state will get messed up. // If console.error is overridden, or logCapturedError() shows a dialog that throws, // we want to report this error outside of the normal stack as a last resort. // https://github.com/facebook/react/issues/13188 setTimeout(function () { throw e; }); } } var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; function createRootErrorUpdate(fiber, errorInfo, lane) { var update = createUpdate(NoTimestamp, lane); // Unmount the root by rendering null. update.tag = CaptureUpdate; // Caution: React DevTools currently depends on this property // being called "element". update.payload = { element: null }; var error = errorInfo.value; update.callback = function () { onUncaughtError(error); logCapturedError(fiber, errorInfo); }; return update; } function createClassErrorUpdate(fiber, errorInfo, lane) { var update = createUpdate(NoTimestamp, lane); update.tag = CaptureUpdate; var getDerivedStateFromError = fiber.type.getDerivedStateFromError; if (typeof getDerivedStateFromError === 'function') { var error$1 = errorInfo.value; update.payload = function () { return getDerivedStateFromError(error$1); }; update.callback = function () { { markFailedErrorBoundaryForHotReloading(fiber); } logCapturedError(fiber, errorInfo); }; } var inst = fiber.stateNode; if (inst !== null && typeof inst.componentDidCatch === 'function') { update.callback = function callback() { { markFailedErrorBoundaryForHotReloading(fiber); } logCapturedError(fiber, errorInfo); if (typeof getDerivedStateFromError !== 'function') { // To preserve the preexisting retry behavior of error boundaries, // we keep track of which ones already failed during this batch. // This gets reset before we yield back to the browser. // TODO: Warn in strict mode if getDerivedStateFromError is // not defined. markLegacyErrorBoundaryAsFailed(this); } var error$1 = errorInfo.value; var stack = errorInfo.stack; this.componentDidCatch(error$1, { componentStack: stack !== null ? stack : '' }); { if (typeof getDerivedStateFromError !== 'function') { // If componentDidCatch is the only error boundary method defined, // then it needs to call setState to recover from errors. // If no state update is scheduled then the boundary will swallow the error. if (!includesSomeLane(fiber.lanes, SyncLane)) { error('%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentNameFromFiber(fiber) || 'Unknown'); } } } }; } return update; } function attachPingListener(root, wakeable, lanes) { // Attach a ping listener // // The data might resolve before we have a chance to commit the fallback. Or, // in the case of a refresh, we'll never commit a fallback. So we need to // attach a listener now. When it resolves ("pings"), we can decide whether to // try rendering the tree again. // // Only attach a listener if one does not already exist for the lanes // we're currently rendering (which acts like a "thread ID" here). // // We only need to do this in concurrent mode. Legacy Suspense always // commits fallbacks synchronously, so there are no pings. var pingCache = root.pingCache; var threadIDs; if (pingCache === null) { pingCache = root.pingCache = new PossiblyWeakMap$1(); threadIDs = new Set(); pingCache.set(wakeable, threadIDs); } else { threadIDs = pingCache.get(wakeable); if (threadIDs === undefined) { threadIDs = new Set(); pingCache.set(wakeable, threadIDs); } } if (!threadIDs.has(lanes)) { // Memoize using the thread ID to prevent redundant listeners. threadIDs.add(lanes); var ping = pingSuspendedRoot.bind(null, root, wakeable, lanes); { if (isDevToolsPresent) { // If we have pending work still, restore the original updaters restorePendingUpdaters(root, lanes); } } wakeable.then(ping, ping); } } function attachRetryListener(suspenseBoundary, root, wakeable, lanes) { // Retry listener // // If the fallback does commit, we need to attach a different type of // listener. This one schedules an update on the Suspense boundary to turn // the fallback state off. // // Stash the wakeable on the boundary fiber so we can access it in the // commit phase. // // When the wakeable resolves, we'll attempt to render the boundary // again ("retry"). var wakeables = suspenseBoundary.updateQueue; if (wakeables === null) { var updateQueue = new Set(); updateQueue.add(wakeable); suspenseBoundary.updateQueue = updateQueue; } else { wakeables.add(wakeable); } } function resetSuspendedComponent(sourceFiber, rootRenderLanes) { // A legacy mode Suspense quirk, only relevant to hook components. var tag = sourceFiber.tag; if ((sourceFiber.mode & ConcurrentMode) === NoMode && (tag === FunctionComponent || tag === ForwardRef || tag === SimpleMemoComponent)) { var currentSource = sourceFiber.alternate; if (currentSource) { sourceFiber.updateQueue = currentSource.updateQueue; sourceFiber.memoizedState = currentSource.memoizedState; sourceFiber.lanes = currentSource.lanes; } else { sourceFiber.updateQueue = null; sourceFiber.memoizedState = null; } } } function getNearestSuspenseBoundaryToCapture(returnFiber) { var node = returnFiber; do { if (node.tag === SuspenseComponent && shouldCaptureSuspense(node)) { return node; } // This boundary already captured during this render. Continue to the next // boundary. node = node.return; } while (node !== null); return null; } function markSuspenseBoundaryShouldCapture(suspenseBoundary, returnFiber, sourceFiber, root, rootRenderLanes) { // This marks a Suspense boundary so that when we're unwinding the stack, // it captures the suspended "exception" and does a second (fallback) pass. if ((suspenseBoundary.mode & ConcurrentMode) === NoMode) { // Legacy Mode Suspense // // If the boundary is in legacy mode, we should *not* // suspend the commit. Pretend as if the suspended component rendered // null and keep rendering. When the Suspense boundary completes, // we'll do a second pass to render the fallback. if (suspenseBoundary === returnFiber) { // Special case where we suspended while reconciling the children of // a Suspense boundary's inner Offscreen wrapper fiber. This happens // when a React.lazy component is a direct child of a // Suspense boundary. // // Suspense boundaries are implemented as multiple fibers, but they // are a single conceptual unit. The legacy mode behavior where we // pretend the suspended fiber committed as `null` won't work, // because in this case the "suspended" fiber is the inner // Offscreen wrapper. // // Because the contents of the boundary haven't started rendering // yet (i.e. nothing in the tree has partially rendered) we can // switch to the regular, concurrent mode behavior: mark the // boundary with ShouldCapture and enter the unwind phase. suspenseBoundary.flags |= ShouldCapture; } else { suspenseBoundary.flags |= DidCapture; sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete. // But we shouldn't call any lifecycle methods or callbacks. Remove // all lifecycle effect tags. sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete); if (sourceFiber.tag === ClassComponent) { var currentSourceFiber = sourceFiber.alternate; if (currentSourceFiber === null) { // This is a new mount. Change the tag so it's not mistaken for a // completed class component. For example, we should not call // componentWillUnmount if it is deleted. sourceFiber.tag = IncompleteClassComponent; } else { // When we try rendering again, we should not reuse the current fiber, // since it's known to be in an inconsistent state. Use a force update to // prevent a bail out. var update = createUpdate(NoTimestamp, SyncLane); update.tag = ForceUpdate; enqueueUpdate(sourceFiber, update, SyncLane); } } // The source fiber did not complete. Mark it with Sync priority to // indicate that it still has pending work. sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); } return suspenseBoundary; } // Confirmed that the boundary is in a concurrent mode tree. Continue // with the normal suspend path. // // After this we'll use a set of heuristics to determine whether this // render pass will run to completion or restart or "suspend" the commit. // The actual logic for this is spread out in different places. // // This first principle is that if we're going to suspend when we complete // a root, then we should also restart if we get an update or ping that // might unsuspend it, and vice versa. The only reason to suspend is // because you think you might want to restart before committing. However, // it doesn't make sense to restart only while in the period we're suspended. // // Restarting too aggressively is also not good because it starves out any // intermediate loading state. So we use heuristics to determine when. // Suspense Heuristics // // If nothing threw a Promise or all the same fallbacks are already showing, // then don't suspend/restart. // // If this is an initial render of a new tree of Suspense boundaries and // those trigger a fallback, then don't suspend/restart. We want to ensure // that we can show the initial loading state as quickly as possible. // // If we hit a "Delayed" case, such as when we'd switch from content back into // a fallback, then we should always suspend/restart. Transitions apply // to this case. If none is defined, JND is used instead. // // If we're already showing a fallback and it gets "retried", allowing us to show // another level, but there's still an inner boundary that would show a fallback, // then we suspend/restart for 500ms since the last time we showed a fallback // anywhere in the tree. This effectively throttles progressive loading into a // consistent train of commits. This also gives us an opportunity to restart to // get to the completed state slightly earlier. // // If there's ambiguity due to batching it's resolved in preference of: // 1) "delayed", 2) "initial render", 3) "retry". // // We want to ensure that a "busy" state doesn't get force committed. We want to // ensure that new initial loading states can commit as soon as possible. suspenseBoundary.flags |= ShouldCapture; // TODO: I think we can remove this, since we now use `DidCapture` in // the begin phase to prevent an early bailout. suspenseBoundary.lanes = rootRenderLanes; return suspenseBoundary; } function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes) { // The source fiber did not complete. sourceFiber.flags |= Incomplete; { if (isDevToolsPresent) { // If we have pending work still, restore the original updaters restorePendingUpdaters(root, rootRenderLanes); } } if (value !== null && typeof value === 'object' && typeof value.then === 'function') { // This is a wakeable. The component suspended. var wakeable = value; resetSuspendedComponent(sourceFiber); { if (getIsHydrating() && sourceFiber.mode & ConcurrentMode) { markDidThrowWhileHydratingDEV(); } } var suspenseBoundary = getNearestSuspenseBoundaryToCapture(returnFiber); if (suspenseBoundary !== null) { suspenseBoundary.flags &= ~ForceClientRender; markSuspenseBoundaryShouldCapture(suspenseBoundary, returnFiber, sourceFiber, root, rootRenderLanes); // We only attach ping listeners in concurrent mode. Legacy Suspense always // commits fallbacks synchronously, so there are no pings. if (suspenseBoundary.mode & ConcurrentMode) { attachPingListener(root, wakeable, rootRenderLanes); } attachRetryListener(suspenseBoundary, root, wakeable); return; } else { // No boundary was found. Unless this is a sync update, this is OK. // We can suspend and wait for more data to arrive. if (!includesSyncLane(rootRenderLanes)) { // This is not a sync update. Suspend. Since we're not activating a // Suspense boundary, this will unwind all the way to the root without // performing a second pass to render a fallback. (This is arguably how // refresh transitions should work, too, since we're not going to commit // the fallbacks anyway.) // // This case also applies to initial hydration. attachPingListener(root, wakeable, rootRenderLanes); renderDidSuspendDelayIfPossible(); return; } // This is a sync/discrete update. We treat this case like an error // because discrete renders are expected to produce a complete tree // synchronously to maintain consistency with external state. var uncaughtSuspenseError = new Error('A component suspended while responding to synchronous input. This ' + 'will cause the UI to be replaced with a loading indicator. To ' + 'fix, updates that suspend should be wrapped ' + 'with startTransition.'); // If we're outside a transition, fall through to the regular error path. // The error will be caught by the nearest suspense boundary. value = uncaughtSuspenseError; } } else { // This is a regular error, not a Suspense wakeable. if (getIsHydrating() && sourceFiber.mode & ConcurrentMode) { markDidThrowWhileHydratingDEV(); var _suspenseBoundary = getNearestSuspenseBoundaryToCapture(returnFiber); // If the error was thrown during hydration, we may be able to recover by // discarding the dehydrated content and switching to a client render. // Instead of surfacing the error, find the nearest Suspense boundary // and render it again without hydration. if (_suspenseBoundary !== null) { if ((_suspenseBoundary.flags & ShouldCapture) === NoFlags) { // Set a flag to indicate that we should try rendering the normal // children again, not the fallback. _suspenseBoundary.flags |= ForceClientRender; } markSuspenseBoundaryShouldCapture(_suspenseBoundary, returnFiber, sourceFiber, root, rootRenderLanes); // Even though the user may not be affected by this error, we should // still log it so it can be fixed. queueHydrationError(createCapturedValueAtFiber(value, sourceFiber)); return; } } } value = createCapturedValueAtFiber(value, sourceFiber); renderDidError(value); // We didn't find a boundary that could handle this type of exception. Start // over and traverse parent path again, this time treating the exception // as an error. var workInProgress = returnFiber; do { switch (workInProgress.tag) { case HostRoot: { var _errorInfo = value; workInProgress.flags |= ShouldCapture; var lane = pickArbitraryLane(rootRenderLanes); workInProgress.lanes = mergeLanes(workInProgress.lanes, lane); var update = createRootErrorUpdate(workInProgress, _errorInfo, lane); enqueueCapturedUpdate(workInProgress, update); return; } case ClassComponent: // Capture and retry var errorInfo = value; var ctor = workInProgress.type; var instance = workInProgress.stateNode; if ((workInProgress.flags & DidCapture) === NoFlags && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) { workInProgress.flags |= ShouldCapture; var _lane = pickArbitraryLane(rootRenderLanes); workInProgress.lanes = mergeLanes(workInProgress.lanes, _lane); // Schedule the error boundary to re-render using updated state var _update = createClassErrorUpdate(workInProgress, errorInfo, _lane); enqueueCapturedUpdate(workInProgress, _update); return; } break; } workInProgress = workInProgress.return; } while (workInProgress !== null); } function getSuspendedCache() { { return null; } // This function is called when a Suspense boundary suspends. It returns the } var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; var didReceiveUpdate = false; var didWarnAboutBadClass; var didWarnAboutModulePatternComponent; var didWarnAboutContextTypeOnFunctionComponent; var didWarnAboutGetDerivedStateOnFunctionComponent; var didWarnAboutFunctionRefs; var didWarnAboutReassigningProps; var didWarnAboutRevealOrder; var didWarnAboutTailOptions; var didWarnAboutDefaultPropsOnFunctionComponent; { didWarnAboutBadClass = {}; didWarnAboutModulePatternComponent = {}; didWarnAboutContextTypeOnFunctionComponent = {}; didWarnAboutGetDerivedStateOnFunctionComponent = {}; didWarnAboutFunctionRefs = {}; didWarnAboutReassigningProps = false; didWarnAboutRevealOrder = {}; didWarnAboutTailOptions = {}; didWarnAboutDefaultPropsOnFunctionComponent = {}; } function reconcileChildren(current, workInProgress, nextChildren, renderLanes) { if (current === null) { // If this is a fresh new component that hasn't been rendered yet, we // won't update its child set by applying minimal side-effects. Instead, // we will add them all to the child before it gets rendered. That means // we can optimize this reconciliation pass by not tracking side-effects. workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderLanes); } else { // If the current child is the same as the work in progress, it means that // we haven't yet started any work on these children. Therefore, we use // the clone algorithm to create a copy of all the current children. // If we had any progressed work already, that is invalid at this point so // let's throw it out. workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderLanes); } } function forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderLanes) { // This function is fork of reconcileChildren. It's used in cases where we // want to reconcile without matching against the existing set. This has the // effect of all current children being unmounted; even if the type and key // are the same, the old child is unmounted and a new child is created. // // To do this, we're going to go through the reconcile algorithm twice. In // the first pass, we schedule a deletion for all the current children by // passing null. workInProgress.child = reconcileChildFibers(workInProgress, current.child, null, renderLanes); // In the second pass, we mount the new children. The trick here is that we // pass null in place of where we usually pass the current child set. This has // the effect of remounting all children regardless of whether their // identities match. workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderLanes); } function updateForwardRef(current, workInProgress, Component, nextProps, renderLanes) { // TODO: current can be non-null here even if the component // hasn't yet mounted. This happens after the first render suspends. // We'll need to figure out if this is fine or can cause issues. { if (workInProgress.type !== workInProgress.elementType) { // Lazy component props can't be validated in createElement // because they're only guaranteed to be resolved here. var innerPropTypes = Component.propTypes; if (innerPropTypes) { checkPropTypes(innerPropTypes, nextProps, // Resolved props 'prop', getComponentNameFromType(Component)); } } } var render = Component.render; var ref = workInProgress.ref; // The rest is a fork of updateFunctionComponent var nextChildren; var hasId; prepareToReadContext(workInProgress, renderLanes); { markComponentRenderStarted(workInProgress); } { ReactCurrentOwner$1.current = workInProgress; setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderLanes); hasId = checkDidRenderIdHook(); if ( workInProgress.mode & StrictLegacyMode) { setIsStrictModeForDevtools(true); try { nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderLanes); hasId = checkDidRenderIdHook(); } finally { setIsStrictModeForDevtools(false); } } setIsRendering(false); } { markComponentRenderStopped(); } if (current !== null && !didReceiveUpdate) { bailoutHooks(current, workInProgress, renderLanes); return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } if (getIsHydrating() && hasId) { pushMaterializedTreeId(workInProgress); } // React DevTools reads this flag. workInProgress.flags |= PerformedWork; reconcileChildren(current, workInProgress, nextChildren, renderLanes); return workInProgress.child; } function updateMemoComponent(current, workInProgress, Component, nextProps, renderLanes) { if (current === null) { var type = Component.type; if (isSimpleFunctionComponent(type) && Component.compare === null && // SimpleMemoComponent codepath doesn't resolve outer props either. Component.defaultProps === undefined) { var resolvedType = type; { resolvedType = resolveFunctionForHotReloading(type); } // If this is a plain function component without default props, // and with only the default shallow comparison, we upgrade it // to a SimpleMemoComponent to allow fast path updates. workInProgress.tag = SimpleMemoComponent; workInProgress.type = resolvedType; { validateFunctionComponentInDev(workInProgress, type); } return updateSimpleMemoComponent(current, workInProgress, resolvedType, nextProps, renderLanes); } { var innerPropTypes = type.propTypes; if (innerPropTypes) { // Inner memo component props aren't currently validated in createElement. // We could move it there, but we'd still need this for lazy code path. checkPropTypes(innerPropTypes, nextProps, // Resolved props 'prop', getComponentNameFromType(type)); } if ( Component.defaultProps !== undefined) { var componentName = getComponentNameFromType(type) || 'Unknown'; if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) { error('%s: Support for defaultProps will be removed from memo components ' + 'in a future major release. Use JavaScript default parameters instead.', componentName); didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true; } } } var child = createFiberFromTypeAndProps(Component.type, null, nextProps, workInProgress, workInProgress.mode, renderLanes); child.ref = workInProgress.ref; child.return = workInProgress; workInProgress.child = child; return child; } { var _type = Component.type; var _innerPropTypes = _type.propTypes; if (_innerPropTypes) { // Inner memo component props aren't currently validated in createElement. // We could move it there, but we'd still need this for lazy code path. checkPropTypes(_innerPropTypes, nextProps, // Resolved props 'prop', getComponentNameFromType(_type)); } } var currentChild = current.child; // This is always exactly one child var hasScheduledUpdateOrContext = checkScheduledUpdateOrContext(current, renderLanes); if (!hasScheduledUpdateOrContext) { // This will be the props with resolved defaultProps, // unlike current.memoizedProps which will be the unresolved ones. var prevProps = currentChild.memoizedProps; // Default to shallow comparison var compare = Component.compare; compare = compare !== null ? compare : shallowEqual; if (compare(prevProps, nextProps) && current.ref === workInProgress.ref) { return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } } // React DevTools reads this flag. workInProgress.flags |= PerformedWork; var newChild = createWorkInProgress(currentChild, nextProps); newChild.ref = workInProgress.ref; newChild.return = workInProgress; workInProgress.child = newChild; return newChild; } function updateSimpleMemoComponent(current, workInProgress, Component, nextProps, renderLanes) { // TODO: current can be non-null here even if the component // hasn't yet mounted. This happens when the inner render suspends. // We'll need to figure out if this is fine or can cause issues. { if (workInProgress.type !== workInProgress.elementType) { // Lazy component props can't be validated in createElement // because they're only guaranteed to be resolved here. var outerMemoType = workInProgress.elementType; if (outerMemoType.$$typeof === REACT_LAZY_TYPE) { // We warn when you define propTypes on lazy() // so let's just skip over it to find memo() outer wrapper. // Inner props for memo are validated later. var lazyComponent = outerMemoType; var payload = lazyComponent._payload; var init = lazyComponent._init; try { outerMemoType = init(payload); } catch (x) { outerMemoType = null; } // Inner propTypes will be validated in the function component path. var outerPropTypes = outerMemoType && outerMemoType.propTypes; if (outerPropTypes) { checkPropTypes(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps) 'prop', getComponentNameFromType(outerMemoType)); } } } } if (current !== null) { var prevProps = current.memoizedProps; if (shallowEqual(prevProps, nextProps) && current.ref === workInProgress.ref && ( // Prevent bailout if the implementation changed due to hot reload. workInProgress.type === current.type )) { didReceiveUpdate = false; // The props are shallowly equal. Reuse the previous props object, like we // would during a normal fiber bailout. // // We don't have strong guarantees that the props object is referentially // equal during updates where we can't bail out anyway — like if the props // are shallowly equal, but there's a local state or context update in the // same batch. // // However, as a principle, we should aim to make the behavior consistent // across different ways of memoizing a component. For example, React.memo // has a different internal Fiber layout if you pass a normal function // component (SimpleMemoComponent) versus if you pass a different type // like forwardRef (MemoComponent). But this is an implementation detail. // Wrapping a component in forwardRef (or React.lazy, etc) shouldn't // affect whether the props object is reused during a bailout. workInProgress.pendingProps = nextProps = prevProps; if (!checkScheduledUpdateOrContext(current, renderLanes)) { // The pending lanes were cleared at the beginning of beginWork. We're // about to bail out, but there might be other lanes that weren't // included in the current render. Usually, the priority level of the // remaining updates is accumulated during the evaluation of the // component (i.e. when processing the update queue). But since since // we're bailing out early *without* evaluating the component, we need // to account for it here, too. Reset to the value of the current fiber. // NOTE: This only applies to SimpleMemoComponent, not MemoComponent, // because a MemoComponent fiber does not have hooks or an update queue; // rather, it wraps around an inner component, which may or may not // contains hooks. // TODO: Move the reset at in beginWork out of the common path so that // this is no longer necessary. workInProgress.lanes = current.lanes; return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } else if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) { // This is a special case that only exists for legacy mode. // See https://github.com/facebook/react/pull/19216. didReceiveUpdate = true; } } } return updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes); } function updateOffscreenComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps; var nextChildren = nextProps.children; var prevState = current !== null ? current.memoizedState : null; if (nextProps.mode === 'hidden' || enableLegacyHidden ) { // Rendering a hidden tree. if ((workInProgress.mode & ConcurrentMode) === NoMode) { // In legacy sync mode, don't defer the subtree. Render it now. // TODO: Consider how Offscreen should work with transitions in the future var nextState = { baseLanes: NoLanes, cachePool: null, transitions: null }; workInProgress.memoizedState = nextState; pushRenderLanes(workInProgress, renderLanes); } else if (!includesSomeLane(renderLanes, OffscreenLane)) { var spawnedCachePool = null; // We're hidden, and we're not rendering at Offscreen. We will bail out // and resume this tree later. var nextBaseLanes; if (prevState !== null) { var prevBaseLanes = prevState.baseLanes; nextBaseLanes = mergeLanes(prevBaseLanes, renderLanes); } else { nextBaseLanes = renderLanes; } // Schedule this fiber to re-render at offscreen priority. Then bailout. workInProgress.lanes = workInProgress.childLanes = laneToLanes(OffscreenLane); var _nextState = { baseLanes: nextBaseLanes, cachePool: spawnedCachePool, transitions: null }; workInProgress.memoizedState = _nextState; workInProgress.updateQueue = null; // to avoid a push/pop misalignment. pushRenderLanes(workInProgress, nextBaseLanes); return null; } else { // This is the second render. The surrounding visible content has already // committed. Now we resume rendering the hidden tree. // Rendering at offscreen, so we can clear the base lanes. var _nextState2 = { baseLanes: NoLanes, cachePool: null, transitions: null }; workInProgress.memoizedState = _nextState2; // Push the lanes that were skipped when we bailed out. var subtreeRenderLanes = prevState !== null ? prevState.baseLanes : renderLanes; pushRenderLanes(workInProgress, subtreeRenderLanes); } } else { // Rendering a visible tree. var _subtreeRenderLanes; if (prevState !== null) { // We're going from hidden -> visible. _subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes); workInProgress.memoizedState = null; } else { // We weren't previously hidden, and we still aren't, so there's nothing // special to do. Need to push to the stack regardless, though, to avoid // a push/pop misalignment. _subtreeRenderLanes = renderLanes; } pushRenderLanes(workInProgress, _subtreeRenderLanes); } reconcileChildren(current, workInProgress, nextChildren, renderLanes); return workInProgress.child; } // Note: These happen to have identical begin phases, for now. We shouldn't hold function updateFragment(current, workInProgress, renderLanes) { var nextChildren = workInProgress.pendingProps; reconcileChildren(current, workInProgress, nextChildren, renderLanes); return workInProgress.child; } function updateMode(current, workInProgress, renderLanes) { var nextChildren = workInProgress.pendingProps.children; reconcileChildren(current, workInProgress, nextChildren, renderLanes); return workInProgress.child; } function updateProfiler(current, workInProgress, renderLanes) { { workInProgress.flags |= Update; { // Reset effect durations for the next eventual effect phase. // These are reset during render to allow the DevTools commit hook a chance to read them, var stateNode = workInProgress.stateNode; stateNode.effectDuration = 0; stateNode.passiveEffectDuration = 0; } } var nextProps = workInProgress.pendingProps; var nextChildren = nextProps.children; reconcileChildren(current, workInProgress, nextChildren, renderLanes); return workInProgress.child; } function markRef(current, workInProgress) { var ref = workInProgress.ref; if (current === null && ref !== null || current !== null && current.ref !== ref) { // Schedule a Ref effect workInProgress.flags |= Ref; { workInProgress.flags |= RefStatic; } } } function updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes) { { if (workInProgress.type !== workInProgress.elementType) { // Lazy component props can't be validated in createElement // because they're only guaranteed to be resolved here. var innerPropTypes = Component.propTypes; if (innerPropTypes) { checkPropTypes(innerPropTypes, nextProps, // Resolved props 'prop', getComponentNameFromType(Component)); } } } var context; { var unmaskedContext = getUnmaskedContext(workInProgress, Component, true); context = getMaskedContext(workInProgress, unmaskedContext); } var nextChildren; var hasId; prepareToReadContext(workInProgress, renderLanes); { markComponentRenderStarted(workInProgress); } { ReactCurrentOwner$1.current = workInProgress; setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); hasId = checkDidRenderIdHook(); if ( workInProgress.mode & StrictLegacyMode) { setIsStrictModeForDevtools(true); try { nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); hasId = checkDidRenderIdHook(); } finally { setIsStrictModeForDevtools(false); } } setIsRendering(false); } { markComponentRenderStopped(); } if (current !== null && !didReceiveUpdate) { bailoutHooks(current, workInProgress, renderLanes); return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } if (getIsHydrating() && hasId) { pushMaterializedTreeId(workInProgress); } // React DevTools reads this flag. workInProgress.flags |= PerformedWork; reconcileChildren(current, workInProgress, nextChildren, renderLanes); return workInProgress.child; } function updateClassComponent(current, workInProgress, Component, nextProps, renderLanes) { { // This is used by DevTools to force a boundary to error. switch (shouldError(workInProgress)) { case false: { var _instance = workInProgress.stateNode; var ctor = workInProgress.type; // TODO This way of resetting the error boundary state is a hack. // Is there a better way to do this? var tempInstance = new ctor(workInProgress.memoizedProps, _instance.context); var state = tempInstance.state; _instance.updater.enqueueSetState(_instance, state, null); break; } case true: { workInProgress.flags |= DidCapture; workInProgress.flags |= ShouldCapture; // eslint-disable-next-line react-internal/prod-error-codes var error$1 = new Error('Simulated error coming from DevTools'); var lane = pickArbitraryLane(renderLanes); workInProgress.lanes = mergeLanes(workInProgress.lanes, lane); // Schedule the error boundary to re-render using updated state var update = createClassErrorUpdate(workInProgress, createCapturedValueAtFiber(error$1, workInProgress), lane); enqueueCapturedUpdate(workInProgress, update); break; } } if (workInProgress.type !== workInProgress.elementType) { // Lazy component props can't be validated in createElement // because they're only guaranteed to be resolved here. var innerPropTypes = Component.propTypes; if (innerPropTypes) { checkPropTypes(innerPropTypes, nextProps, // Resolved props 'prop', getComponentNameFromType(Component)); } } } // Push context providers early to prevent context stack mismatches. // During mounting we don't know the child context yet as the instance doesn't exist. // We will invalidate the child context in finishClassComponent() right after rendering. var hasContext; if (isContextProvider(Component)) { hasContext = true; pushContextProvider(workInProgress); } else { hasContext = false; } prepareToReadContext(workInProgress, renderLanes); var instance = workInProgress.stateNode; var shouldUpdate; if (instance === null) { resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); // In the initial pass we might need to construct the instance. constructClassInstance(workInProgress, Component, nextProps); mountClassInstance(workInProgress, Component, nextProps, renderLanes); shouldUpdate = true; } else if (current === null) { // In a resume, we'll already have an instance we can reuse. shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderLanes); } else { shouldUpdate = updateClassInstance(current, workInProgress, Component, nextProps, renderLanes); } var nextUnitOfWork = finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes); { var inst = workInProgress.stateNode; if (shouldUpdate && inst.props !== nextProps) { if (!didWarnAboutReassigningProps) { error('It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentNameFromFiber(workInProgress) || 'a component'); } didWarnAboutReassigningProps = true; } } return nextUnitOfWork; } function finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes) { // Refs should update even if shouldComponentUpdate returns false markRef(current, workInProgress); var didCaptureError = (workInProgress.flags & DidCapture) !== NoFlags; if (!shouldUpdate && !didCaptureError) { // Context providers should defer to sCU for rendering if (hasContext) { invalidateContextProvider(workInProgress, Component, false); } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } var instance = workInProgress.stateNode; // Rerender ReactCurrentOwner$1.current = workInProgress; var nextChildren; if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') { // If we captured an error, but getDerivedStateFromError is not defined, // unmount all the children. componentDidCatch will schedule an update to // re-render a fallback. This is temporary until we migrate everyone to // the new API. // TODO: Warn in a future release. nextChildren = null; { stopProfilerTimerIfRunning(); } } else { { markComponentRenderStarted(workInProgress); } { setIsRendering(true); nextChildren = instance.render(); if ( workInProgress.mode & StrictLegacyMode) { setIsStrictModeForDevtools(true); try { instance.render(); } finally { setIsStrictModeForDevtools(false); } } setIsRendering(false); } { markComponentRenderStopped(); } } // React DevTools reads this flag. workInProgress.flags |= PerformedWork; if (current !== null && didCaptureError) { // If we're recovering from an error, reconcile without reusing any of // the existing children. Conceptually, the normal children and the children // that are shown on error are two different sets, so we shouldn't reuse // normal children even if their identities match. forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderLanes); } else { reconcileChildren(current, workInProgress, nextChildren, renderLanes); } // Memoize state using the values we just used to render. // TODO: Restructure so we never read values from the instance. workInProgress.memoizedState = instance.state; // The context might have changed so we need to recalculate it. if (hasContext) { invalidateContextProvider(workInProgress, Component, true); } return workInProgress.child; } function pushHostRootContext(workInProgress) { var root = workInProgress.stateNode; if (root.pendingContext) { pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context); } else if (root.context) { // Should always be set pushTopLevelContextObject(workInProgress, root.context, false); } pushHostContainer(workInProgress, root.containerInfo); } function updateHostRoot(current, workInProgress, renderLanes) { pushHostRootContext(workInProgress); if (current === null) { throw new Error('Should have a current fiber. This is a bug in React.'); } var nextProps = workInProgress.pendingProps; var prevState = workInProgress.memoizedState; var prevChildren = prevState.element; cloneUpdateQueue(current, workInProgress); processUpdateQueue(workInProgress, nextProps, null, renderLanes); var nextState = workInProgress.memoizedState; var root = workInProgress.stateNode; // being called "element". var nextChildren = nextState.element; if ( prevState.isDehydrated) { // This is a hydration root whose shell has not yet hydrated. We should // attempt to hydrate. // Flip isDehydrated to false to indicate that when this render // finishes, the root will no longer be dehydrated. var overrideState = { element: nextChildren, isDehydrated: false, cache: nextState.cache, pendingSuspenseBoundaries: nextState.pendingSuspenseBoundaries, transitions: nextState.transitions }; var updateQueue = workInProgress.updateQueue; // `baseState` can always be the last state because the root doesn't // have reducer functions so it doesn't need rebasing. updateQueue.baseState = overrideState; workInProgress.memoizedState = overrideState; if (workInProgress.flags & ForceClientRender) { // Something errored during a previous attempt to hydrate the shell, so we // forced a client render. var recoverableError = createCapturedValueAtFiber(new Error('There was an error while hydrating. Because the error happened outside ' + 'of a Suspense boundary, the entire root will switch to ' + 'client rendering.'), workInProgress); return mountHostRootWithoutHydrating(current, workInProgress, nextChildren, renderLanes, recoverableError); } else if (nextChildren !== prevChildren) { var _recoverableError = createCapturedValueAtFiber(new Error('This root received an early update, before anything was able ' + 'hydrate. Switched the entire root to client rendering.'), workInProgress); return mountHostRootWithoutHydrating(current, workInProgress, nextChildren, renderLanes, _recoverableError); } else { // The outermost shell has not hydrated yet. Start hydrating. enterHydrationState(workInProgress); var child = mountChildFibers(workInProgress, null, nextChildren, renderLanes); workInProgress.child = child; var node = child; while (node) { // Mark each child as hydrating. This is a fast path to know whether this // tree is part of a hydrating tree. This is used to determine if a child // node has fully mounted yet, and for scheduling event replaying. // Conceptually this is similar to Placement in that a new subtree is // inserted into the React tree here. It just happens to not need DOM // mutations because it already exists. node.flags = node.flags & ~Placement | Hydrating; node = node.sibling; } } } else { // Root is not dehydrated. Either this is a client-only root, or it // already hydrated. resetHydrationState(); if (nextChildren === prevChildren) { return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } reconcileChildren(current, workInProgress, nextChildren, renderLanes); } return workInProgress.child; } function mountHostRootWithoutHydrating(current, workInProgress, nextChildren, renderLanes, recoverableError) { // Revert to client rendering. resetHydrationState(); queueHydrationError(recoverableError); workInProgress.flags |= ForceClientRender; reconcileChildren(current, workInProgress, nextChildren, renderLanes); return workInProgress.child; } function updateHostComponent(current, workInProgress, renderLanes) { pushHostContext(workInProgress); if (current === null) { tryToClaimNextHydratableInstance(workInProgress); } var type = workInProgress.type; var nextProps = workInProgress.pendingProps; var prevProps = current !== null ? current.memoizedProps : null; var nextChildren = nextProps.children; var isDirectTextChild = shouldSetTextContent(type, nextProps); if (isDirectTextChild) { // We special case a direct text child of a host node. This is a common // case. We won't handle it as a reified child. We will instead handle // this in the host environment that also has access to this prop. That // avoids allocating another HostText fiber and traversing it. nextChildren = null; } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) { // If we're switching from a direct text child to a normal child, or to // empty, we need to schedule the text content to be reset. workInProgress.flags |= ContentReset; } markRef(current, workInProgress); reconcileChildren(current, workInProgress, nextChildren, renderLanes); return workInProgress.child; } function updateHostText(current, workInProgress) { if (current === null) { tryToClaimNextHydratableInstance(workInProgress); } // Nothing to do here. This is terminal. We'll do the completion step // immediately after. return null; } function mountLazyComponent(_current, workInProgress, elementType, renderLanes) { resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress); var props = workInProgress.pendingProps; var lazyComponent = elementType; var payload = lazyComponent._payload; var init = lazyComponent._init; var Component = init(payload); // Store the unwrapped component in the type. workInProgress.type = Component; var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component); var resolvedProps = resolveDefaultProps(Component, props); var child; switch (resolvedTag) { case FunctionComponent: { { validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = resolveFunctionForHotReloading(Component); } child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderLanes); return child; } case ClassComponent: { { workInProgress.type = Component = resolveClassForHotReloading(Component); } child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderLanes); return child; } case ForwardRef: { { workInProgress.type = Component = resolveForwardRefForHotReloading(Component); } child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderLanes); return child; } case MemoComponent: { { if (workInProgress.type !== workInProgress.elementType) { var outerPropTypes = Component.propTypes; if (outerPropTypes) { checkPropTypes(outerPropTypes, resolvedProps, // Resolved for outer only 'prop', getComponentNameFromType(Component)); } } } child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too renderLanes); return child; } } var hint = ''; { if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) { hint = ' Did you wrap a component in React.lazy() more than once?'; } } // This message intentionally doesn't mention ForwardRef or MemoComponent // because the fact that it's a separate type of work is an // implementation detail. throw new Error("Element type is invalid. Received a promise that resolves to: " + Component + ". " + ("Lazy element type must resolve to a class or function." + hint)); } function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderLanes) { resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress); // Promote the fiber to a class and try rendering again. workInProgress.tag = ClassComponent; // The rest of this function is a fork of `updateClassComponent` // Push context providers early to prevent context stack mismatches. // During mounting we don't know the child context yet as the instance doesn't exist. // We will invalidate the child context in finishClassComponent() right after rendering. var hasContext; if (isContextProvider(Component)) { hasContext = true; pushContextProvider(workInProgress); } else { hasContext = false; } prepareToReadContext(workInProgress, renderLanes); constructClassInstance(workInProgress, Component, nextProps); mountClassInstance(workInProgress, Component, nextProps, renderLanes); return finishClassComponent(null, workInProgress, Component, true, hasContext, renderLanes); } function mountIndeterminateComponent(_current, workInProgress, Component, renderLanes) { resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress); var props = workInProgress.pendingProps; var context; { var unmaskedContext = getUnmaskedContext(workInProgress, Component, false); context = getMaskedContext(workInProgress, unmaskedContext); } prepareToReadContext(workInProgress, renderLanes); var value; var hasId; { markComponentRenderStarted(workInProgress); } { if (Component.prototype && typeof Component.prototype.render === 'function') { var componentName = getComponentNameFromType(Component) || 'Unknown'; if (!didWarnAboutBadClass[componentName]) { error("The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName); didWarnAboutBadClass[componentName] = true; } } if (workInProgress.mode & StrictLegacyMode) { ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null); } setIsRendering(true); ReactCurrentOwner$1.current = workInProgress; value = renderWithHooks(null, workInProgress, Component, props, context, renderLanes); hasId = checkDidRenderIdHook(); setIsRendering(false); } { markComponentRenderStopped(); } // React DevTools reads this flag. workInProgress.flags |= PerformedWork; { // Support for module components is deprecated and is removed behind a flag. // Whether or not it would crash later, we want to show a good message in DEV first. if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) { var _componentName = getComponentNameFromType(Component) || 'Unknown'; if (!didWarnAboutModulePatternComponent[_componentName]) { error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName, _componentName, _componentName); didWarnAboutModulePatternComponent[_componentName] = true; } } } if ( // Run these checks in production only if the flag is off. // Eventually we'll delete this branch altogether. typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) { { var _componentName2 = getComponentNameFromType(Component) || 'Unknown'; if (!didWarnAboutModulePatternComponent[_componentName2]) { error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName2, _componentName2, _componentName2); didWarnAboutModulePatternComponent[_componentName2] = true; } } // Proceed under the assumption that this is a class instance workInProgress.tag = ClassComponent; // Throw out any hooks that were used. workInProgress.memoizedState = null; workInProgress.updateQueue = null; // Push context providers early to prevent context stack mismatches. // During mounting we don't know the child context yet as the instance doesn't exist. // We will invalidate the child context in finishClassComponent() right after rendering. var hasContext = false; if (isContextProvider(Component)) { hasContext = true; pushContextProvider(workInProgress); } else { hasContext = false; } workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null; initializeUpdateQueue(workInProgress); adoptClassInstance(workInProgress, value); mountClassInstance(workInProgress, Component, props, renderLanes); return finishClassComponent(null, workInProgress, Component, true, hasContext, renderLanes); } else { // Proceed under the assumption that this is a function component workInProgress.tag = FunctionComponent; { if ( workInProgress.mode & StrictLegacyMode) { setIsStrictModeForDevtools(true); try { value = renderWithHooks(null, workInProgress, Component, props, context, renderLanes); hasId = checkDidRenderIdHook(); } finally { setIsStrictModeForDevtools(false); } } } if (getIsHydrating() && hasId) { pushMaterializedTreeId(workInProgress); } reconcileChildren(null, workInProgress, value, renderLanes); { validateFunctionComponentInDev(workInProgress, Component); } return workInProgress.child; } } function validateFunctionComponentInDev(workInProgress, Component) { { if (Component) { if (Component.childContextTypes) { error('%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component'); } } if (workInProgress.ref !== null) { var info = ''; var ownerName = getCurrentFiberOwnerNameInDevOrNull(); if (ownerName) { info += '\n\nCheck the render method of `' + ownerName + '`.'; } var warningKey = ownerName || ''; var debugSource = workInProgress._debugSource; if (debugSource) { warningKey = debugSource.fileName + ':' + debugSource.lineNumber; } if (!didWarnAboutFunctionRefs[warningKey]) { didWarnAboutFunctionRefs[warningKey] = true; error('Function components cannot be given refs. ' + 'Attempts to access this ref will fail. ' + 'Did you mean to use React.forwardRef()?%s', info); } } if ( Component.defaultProps !== undefined) { var componentName = getComponentNameFromType(Component) || 'Unknown'; if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) { error('%s: Support for defaultProps will be removed from function components ' + 'in a future major release. Use JavaScript default parameters instead.', componentName); didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true; } } if (typeof Component.getDerivedStateFromProps === 'function') { var _componentName3 = getComponentNameFromType(Component) || 'Unknown'; if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3]) { error('%s: Function components do not support getDerivedStateFromProps.', _componentName3); didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] = true; } } if (typeof Component.contextType === 'object' && Component.contextType !== null) { var _componentName4 = getComponentNameFromType(Component) || 'Unknown'; if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) { error('%s: Function components do not support contextType.', _componentName4); didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true; } } } } var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: NoLane }; function mountSuspenseOffscreenState(renderLanes) { return { baseLanes: renderLanes, cachePool: getSuspendedCache(), transitions: null }; } function updateSuspenseOffscreenState(prevOffscreenState, renderLanes) { var cachePool = null; return { baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes), cachePool: cachePool, transitions: prevOffscreenState.transitions }; } // TODO: Probably should inline this back function shouldRemainOnFallback(suspenseContext, current, workInProgress, renderLanes) { // If we're already showing a fallback, there are cases where we need to // remain on that fallback regardless of whether the content has resolved. // For example, SuspenseList coordinates when nested content appears. if (current !== null) { var suspenseState = current.memoizedState; if (suspenseState === null) { // Currently showing content. Don't hide it, even if ForceSuspenseFallback // is true. More precise name might be "ForceRemainSuspenseFallback". // Note: This is a factoring smell. Can't remain on a fallback if there's // no fallback to remain on. return false; } } // Not currently showing content. Consult the Suspense context. return hasSuspenseContext(suspenseContext, ForceSuspenseFallback); } function getRemainingWorkInPrimaryTree(current, renderLanes) { // TODO: Should not remove render lanes that were pinged during this render return removeLanes(current.childLanes, renderLanes); } function updateSuspenseComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps; // This is used by DevTools to force a boundary to suspend. { if (shouldSuspend(workInProgress)) { workInProgress.flags |= DidCapture; } } var suspenseContext = suspenseStackCursor.current; var showFallback = false; var didSuspend = (workInProgress.flags & DidCapture) !== NoFlags; if (didSuspend || shouldRemainOnFallback(suspenseContext, current)) { // Something in this boundary's subtree already suspended. Switch to // rendering the fallback children. showFallback = true; workInProgress.flags &= ~DidCapture; } else { // Attempting the main content if (current === null || current.memoizedState !== null) { // This is a new mount or this boundary is already showing a fallback state. // Mark this subtree context as having at least one invisible parent that could // handle the fallback state. // Avoided boundaries are not considered since they cannot handle preferred fallback states. { suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext); } } } suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); pushSuspenseContext(workInProgress, suspenseContext); // OK, the next part is confusing. We're about to reconcile the Suspense // boundary's children. This involves some custom reconciliation logic. Two // main reasons this is so complicated. // // First, Legacy Mode has different semantics for backwards compatibility. The // primary tree will commit in an inconsistent state, so when we do the // second pass to render the fallback, we do some exceedingly, uh, clever // hacks to make that not totally break. Like transferring effects and // deletions from hidden tree. In Concurrent Mode, it's much simpler, // because we bailout on the primary tree completely and leave it in its old // state, no effects. Same as what we do for Offscreen (except that // Offscreen doesn't have the first render pass). // // Second is hydration. During hydration, the Suspense fiber has a slightly // different layout, where the child points to a dehydrated fragment, which // contains the DOM rendered by the server. // // Third, even if you set all that aside, Suspense is like error boundaries in // that we first we try to render one tree, and if that fails, we render again // and switch to a different tree. Like a try/catch block. So we have to track // which branch we're currently rendering. Ideally we would model this using // a stack. if (current === null) { // Initial mount // Special path for hydration // If we're currently hydrating, try to hydrate this boundary. tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component. var suspenseState = workInProgress.memoizedState; if (suspenseState !== null) { var dehydrated = suspenseState.dehydrated; if (dehydrated !== null) { return mountDehydratedSuspenseComponent(workInProgress, dehydrated); } } var nextPrimaryChildren = nextProps.children; var nextFallbackChildren = nextProps.fallback; if (showFallback) { var fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes); var primaryChildFragment = workInProgress.child; primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); workInProgress.memoizedState = SUSPENDED_MARKER; return fallbackFragment; } else { return mountSuspensePrimaryChildren(workInProgress, nextPrimaryChildren); } } else { // This is an update. // Special path for hydration var prevState = current.memoizedState; if (prevState !== null) { var _dehydrated = prevState.dehydrated; if (_dehydrated !== null) { return updateDehydratedSuspenseComponent(current, workInProgress, didSuspend, nextProps, _dehydrated, prevState, renderLanes); } } if (showFallback) { var _nextFallbackChildren = nextProps.fallback; var _nextPrimaryChildren = nextProps.children; var fallbackChildFragment = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren, _nextFallbackChildren, renderLanes); var _primaryChildFragment2 = workInProgress.child; var prevOffscreenState = current.child.memoizedState; _primaryChildFragment2.memoizedState = prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(prevOffscreenState, renderLanes); _primaryChildFragment2.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes); workInProgress.memoizedState = SUSPENDED_MARKER; return fallbackChildFragment; } else { var _nextPrimaryChildren2 = nextProps.children; var _primaryChildFragment3 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren2, renderLanes); workInProgress.memoizedState = null; return _primaryChildFragment3; } } } function mountSuspensePrimaryChildren(workInProgress, primaryChildren, renderLanes) { var mode = workInProgress.mode; var primaryChildProps = { mode: 'visible', children: primaryChildren }; var primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, mode); primaryChildFragment.return = workInProgress; workInProgress.child = primaryChildFragment; return primaryChildFragment; } function mountSuspenseFallbackChildren(workInProgress, primaryChildren, fallbackChildren, renderLanes) { var mode = workInProgress.mode; var progressedPrimaryFragment = workInProgress.child; var primaryChildProps = { mode: 'hidden', children: primaryChildren }; var primaryChildFragment; var fallbackChildFragment; if ((mode & ConcurrentMode) === NoMode && progressedPrimaryFragment !== null) { // In legacy mode, we commit the primary tree as if it successfully // completed, even though it's in an inconsistent state. primaryChildFragment = progressedPrimaryFragment; primaryChildFragment.childLanes = NoLanes; primaryChildFragment.pendingProps = primaryChildProps; if ( workInProgress.mode & ProfileMode) { // Reset the durations from the first pass so they aren't included in the // final amounts. This seems counterintuitive, since we're intentionally // not measuring part of the render phase, but this makes it match what we // do in Concurrent Mode. primaryChildFragment.actualDuration = 0; primaryChildFragment.actualStartTime = -1; primaryChildFragment.selfBaseDuration = 0; primaryChildFragment.treeBaseDuration = 0; } fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); } else { primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, mode); fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); } primaryChildFragment.return = workInProgress; fallbackChildFragment.return = workInProgress; primaryChildFragment.sibling = fallbackChildFragment; workInProgress.child = primaryChildFragment; return fallbackChildFragment; } function mountWorkInProgressOffscreenFiber(offscreenProps, mode, renderLanes) { // The props argument to `createFiberFromOffscreen` is `any` typed, so we use // this wrapper function to constrain it. return createFiberFromOffscreen(offscreenProps, mode, NoLanes, null); } function updateWorkInProgressOffscreenFiber(current, offscreenProps) { // The props argument to `createWorkInProgress` is `any` typed, so we use this // wrapper function to constrain it. return createWorkInProgress(current, offscreenProps); } function updateSuspensePrimaryChildren(current, workInProgress, primaryChildren, renderLanes) { var currentPrimaryChildFragment = current.child; var currentFallbackChildFragment = currentPrimaryChildFragment.sibling; var primaryChildFragment = updateWorkInProgressOffscreenFiber(currentPrimaryChildFragment, { mode: 'visible', children: primaryChildren }); if ((workInProgress.mode & ConcurrentMode) === NoMode) { primaryChildFragment.lanes = renderLanes; } primaryChildFragment.return = workInProgress; primaryChildFragment.sibling = null; if (currentFallbackChildFragment !== null) { // Delete the fallback child fragment var deletions = workInProgress.deletions; if (deletions === null) { workInProgress.deletions = [currentFallbackChildFragment]; workInProgress.flags |= ChildDeletion; } else { deletions.push(currentFallbackChildFragment); } } workInProgress.child = primaryChildFragment; return primaryChildFragment; } function updateSuspenseFallbackChildren(current, workInProgress, primaryChildren, fallbackChildren, renderLanes) { var mode = workInProgress.mode; var currentPrimaryChildFragment = current.child; var currentFallbackChildFragment = currentPrimaryChildFragment.sibling; var primaryChildProps = { mode: 'hidden', children: primaryChildren }; var primaryChildFragment; if ( // In legacy mode, we commit the primary tree as if it successfully // completed, even though it's in an inconsistent state. (mode & ConcurrentMode) === NoMode && // Make sure we're on the second pass, i.e. the primary child fragment was // already cloned. In legacy mode, the only case where this isn't true is // when DevTools forces us to display a fallback; we skip the first render // pass entirely and go straight to rendering the fallback. (In Concurrent // Mode, SuspenseList can also trigger this scenario, but this is a legacy- // only codepath.) workInProgress.child !== currentPrimaryChildFragment) { var progressedPrimaryFragment = workInProgress.child; primaryChildFragment = progressedPrimaryFragment; primaryChildFragment.childLanes = NoLanes; primaryChildFragment.pendingProps = primaryChildProps; if ( workInProgress.mode & ProfileMode) { // Reset the durations from the first pass so they aren't included in the // final amounts. This seems counterintuitive, since we're intentionally // not measuring part of the render phase, but this makes it match what we // do in Concurrent Mode. primaryChildFragment.actualDuration = 0; primaryChildFragment.actualStartTime = -1; primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration; primaryChildFragment.treeBaseDuration = currentPrimaryChildFragment.treeBaseDuration; } // The fallback fiber was added as a deletion during the first pass. // However, since we're going to remain on the fallback, we no longer want // to delete it. workInProgress.deletions = null; } else { primaryChildFragment = updateWorkInProgressOffscreenFiber(currentPrimaryChildFragment, primaryChildProps); // Since we're reusing a current tree, we need to reuse the flags, too. // (We don't do this in legacy mode, because in legacy mode we don't re-use // the current tree; see previous branch.) primaryChildFragment.subtreeFlags = currentPrimaryChildFragment.subtreeFlags & StaticMask; } var fallbackChildFragment; if (currentFallbackChildFragment !== null) { fallbackChildFragment = createWorkInProgress(currentFallbackChildFragment, fallbackChildren); } else { fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); // Needs a placement effect because the parent (the Suspense boundary) already // mounted but this is a new fiber. fallbackChildFragment.flags |= Placement; } fallbackChildFragment.return = workInProgress; primaryChildFragment.return = workInProgress; primaryChildFragment.sibling = fallbackChildFragment; workInProgress.child = primaryChildFragment; return fallbackChildFragment; } function retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes, recoverableError) { // Falling back to client rendering. Because this has performance // implications, it's considered a recoverable error, even though the user // likely won't observe anything wrong with the UI. // // The error is passed in as an argument to enforce that every caller provide // a custom message, or explicitly opt out (currently the only path that opts // out is legacy mode; every concurrent path provides an error). if (recoverableError !== null) { queueHydrationError(recoverableError); } // This will add the old fiber to the deletion list reconcileChildFibers(workInProgress, current.child, null, renderLanes); // We're now not suspended nor dehydrated. var nextProps = workInProgress.pendingProps; var primaryChildren = nextProps.children; var primaryChildFragment = mountSuspensePrimaryChildren(workInProgress, primaryChildren); // Needs a placement effect because the parent (the Suspense boundary) already // mounted but this is a new fiber. primaryChildFragment.flags |= Placement; workInProgress.memoizedState = null; return primaryChildFragment; } function mountSuspenseFallbackAfterRetryWithoutHydrating(current, workInProgress, primaryChildren, fallbackChildren, renderLanes) { var fiberMode = workInProgress.mode; var primaryChildProps = { mode: 'visible', children: primaryChildren }; var primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, fiberMode); var fallbackChildFragment = createFiberFromFragment(fallbackChildren, fiberMode, renderLanes, null); // Needs a placement effect because the parent (the Suspense // boundary) already mounted but this is a new fiber. fallbackChildFragment.flags |= Placement; primaryChildFragment.return = workInProgress; fallbackChildFragment.return = workInProgress; primaryChildFragment.sibling = fallbackChildFragment; workInProgress.child = primaryChildFragment; if ((workInProgress.mode & ConcurrentMode) !== NoMode) { // We will have dropped the effect list which contains the // deletion. We need to reconcile to delete the current child. reconcileChildFibers(workInProgress, current.child, null, renderLanes); } return fallbackChildFragment; } function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, renderLanes) { // During the first pass, we'll bail out and not drill into the children. // Instead, we'll leave the content in place and try to hydrate it later. if ((workInProgress.mode & ConcurrentMode) === NoMode) { { error('Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOMClient.hydrateRoot(container, <App />)' + '.render(element) or remove the Suspense components from ' + 'the server rendered components.'); } workInProgress.lanes = laneToLanes(SyncLane); } else if (isSuspenseInstanceFallback(suspenseInstance)) { // This is a client-only boundary. Since we won't get any content from the server // for this, we need to schedule that at a higher priority based on when it would // have timed out. In theory we could render it in this pass but it would have the // wrong priority associated with it and will prevent hydration of parent path. // Instead, we'll leave work left on it to render it in a separate commit. // TODO This time should be the time at which the server rendered response that is // a parent to this boundary was displayed. However, since we currently don't have // a protocol to transfer that time, we'll just estimate it by using the current // time. This will mean that Suspense timeouts are slightly shifted to later than // they should be. // Schedule a normal pri update to render this content. workInProgress.lanes = laneToLanes(DefaultHydrationLane); } else { // We'll continue hydrating the rest at offscreen priority since we'll already // be showing the right content coming from the server, it is no rush. workInProgress.lanes = laneToLanes(OffscreenLane); } return null; } function updateDehydratedSuspenseComponent(current, workInProgress, didSuspend, nextProps, suspenseInstance, suspenseState, renderLanes) { if (!didSuspend) { // This is the first render pass. Attempt to hydrate. // We should never be hydrating at this point because it is the first pass, // but after we've already committed once. warnIfHydrating(); if ((workInProgress.mode & ConcurrentMode) === NoMode) { return retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes, // TODO: When we delete legacy mode, we should make this error argument // required — every concurrent mode path that causes hydration to // de-opt to client rendering should have an error message. null); } if (isSuspenseInstanceFallback(suspenseInstance)) { // This boundary is in a permanent fallback state. In this case, we'll never // get an update and we'll never be able to hydrate the final content. Let's just try the // client side render instead. var digest, message, stack; { var _getSuspenseInstanceF = getSuspenseInstanceFallbackErrorDetails(suspenseInstance); digest = _getSuspenseInstanceF.digest; message = _getSuspenseInstanceF.message; stack = _getSuspenseInstanceF.stack; } var error; if (message) { // eslint-disable-next-line react-internal/prod-error-codes error = new Error(message); } else { error = new Error('The server could not finish this Suspense boundary, likely ' + 'due to an error during server rendering. Switched to ' + 'client rendering.'); } var capturedValue = createCapturedValue(error, digest, stack); return retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes, capturedValue); } // any context has changed, we need to treat is as if the input might have changed. var hasContextChanged = includesSomeLane(renderLanes, current.childLanes); if (didReceiveUpdate || hasContextChanged) { // This boundary has changed since the first render. This means that we are now unable to // hydrate it. We might still be able to hydrate it using a higher priority lane. var root = getWorkInProgressRoot(); if (root !== null) { var attemptHydrationAtLane = getBumpedLaneForHydration(root, renderLanes); if (attemptHydrationAtLane !== NoLane && attemptHydrationAtLane !== suspenseState.retryLane) { // Intentionally mutating since this render will get interrupted. This // is one of the very rare times where we mutate the current tree // during the render phase. suspenseState.retryLane = attemptHydrationAtLane; // TODO: Ideally this would inherit the event time of the current render var eventTime = NoTimestamp; enqueueConcurrentRenderForLane(current, attemptHydrationAtLane); scheduleUpdateOnFiber(root, current, attemptHydrationAtLane, eventTime); } } // If we have scheduled higher pri work above, this will probably just abort the render // since we now have higher priority work, but in case it doesn't, we need to prepare to // render something, if we time out. Even if that requires us to delete everything and // skip hydration. // Delay having to do this as long as the suspense timeout allows us. renderDidSuspendDelayIfPossible(); var _capturedValue = createCapturedValue(new Error('This Suspense boundary received an update before it finished ' + 'hydrating. This caused the boundary to switch to client rendering. ' + 'The usual way to fix this is to wrap the original update ' + 'in startTransition.')); return retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes, _capturedValue); } else if (isSuspenseInstancePending(suspenseInstance)) { // This component is still pending more data from the server, so we can't hydrate its // content. We treat it as if this component suspended itself. It might seem as if // we could just try to render it client-side instead. However, this will perform a // lot of unnecessary work and is unlikely to complete since it often will suspend // on missing data anyway. Additionally, the server might be able to render more // than we can on the client yet. In that case we'd end up with more fallback states // on the client than if we just leave it alone. If the server times out or errors // these should update this boundary to the permanent Fallback state instead. // Mark it as having captured (i.e. suspended). workInProgress.flags |= DidCapture; // Leave the child in place. I.e. the dehydrated fragment. workInProgress.child = current.child; // Register a callback to retry this boundary once the server has sent the result. var retry = retryDehydratedSuspenseBoundary.bind(null, current); registerSuspenseInstanceRetry(suspenseInstance, retry); return null; } else { // This is the first attempt. reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress, suspenseInstance, suspenseState.treeContext); var primaryChildren = nextProps.children; var primaryChildFragment = mountSuspensePrimaryChildren(workInProgress, primaryChildren); // Mark the children as hydrating. This is a fast path to know whether this // tree is part of a hydrating tree. This is used to determine if a child // node has fully mounted yet, and for scheduling event replaying. // Conceptually this is similar to Placement in that a new subtree is // inserted into the React tree here. It just happens to not need DOM // mutations because it already exists. primaryChildFragment.flags |= Hydrating; return primaryChildFragment; } } else { // This is the second render pass. We already attempted to hydrated, but // something either suspended or errored. if (workInProgress.flags & ForceClientRender) { // Something errored during hydration. Try again without hydrating. workInProgress.flags &= ~ForceClientRender; var _capturedValue2 = createCapturedValue(new Error('There was an error while hydrating this Suspense boundary. ' + 'Switched to client rendering.')); return retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes, _capturedValue2); } else if (workInProgress.memoizedState !== null) { // Something suspended and we should still be in dehydrated mode. // Leave the existing child in place. workInProgress.child = current.child; // The dehydrated completion pass expects this flag to be there // but the normal suspense pass doesn't. workInProgress.flags |= DidCapture; return null; } else { // Suspended but we should no longer be in dehydrated mode. // Therefore we now have to render the fallback. var nextPrimaryChildren = nextProps.children; var nextFallbackChildren = nextProps.fallback; var fallbackChildFragment = mountSuspenseFallbackAfterRetryWithoutHydrating(current, workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes); var _primaryChildFragment4 = workInProgress.child; _primaryChildFragment4.memoizedState = mountSuspenseOffscreenState(renderLanes); workInProgress.memoizedState = SUSPENDED_MARKER; return fallbackChildFragment; } } } function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) { fiber.lanes = mergeLanes(fiber.lanes, renderLanes); var alternate = fiber.alternate; if (alternate !== null) { alternate.lanes = mergeLanes(alternate.lanes, renderLanes); } scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot); } function propagateSuspenseContextChange(workInProgress, firstChild, renderLanes) { // Mark any Suspense boundaries with fallbacks as having work to do. // If they were previously forced into fallbacks, they may now be able // to unblock. var node = firstChild; while (node !== null) { if (node.tag === SuspenseComponent) { var state = node.memoizedState; if (state !== null) { scheduleSuspenseWorkOnFiber(node, renderLanes, workInProgress); } } else if (node.tag === SuspenseListComponent) { // If the tail is hidden there might not be an Suspense boundaries // to schedule work on. In this case we have to schedule it on the // list itself. // We don't have to traverse to the children of the list since // the list will propagate the change when it rerenders. scheduleSuspenseWorkOnFiber(node, renderLanes, workInProgress); } else if (node.child !== null) { node.child.return = node; node = node.child; continue; } if (node === workInProgress) { return; } while (node.sibling === null) { if (node.return === null || node.return === workInProgress) { return; } node = node.return; } node.sibling.return = node.return; node = node.sibling; } } function findLastContentRow(firstChild) { // This is going to find the last row among these children that is already // showing content on the screen, as opposed to being in fallback state or // new. If a row has multiple Suspense boundaries, any of them being in the // fallback state, counts as the whole row being in a fallback state. // Note that the "rows" will be workInProgress, but any nested children // will still be current since we haven't rendered them yet. The mounted // order may not be the same as the new order. We use the new order. var row = firstChild; var lastContentRow = null; while (row !== null) { var currentRow = row.alternate; // New rows can't be content rows. if (currentRow !== null && findFirstSuspended(currentRow) === null) { lastContentRow = row; } row = row.sibling; } return lastContentRow; } function validateRevealOrder(revealOrder) { { if (revealOrder !== undefined && revealOrder !== 'forwards' && revealOrder !== 'backwards' && revealOrder !== 'together' && !didWarnAboutRevealOrder[revealOrder]) { didWarnAboutRevealOrder[revealOrder] = true; if (typeof revealOrder === 'string') { switch (revealOrder.toLowerCase()) { case 'together': case 'forwards': case 'backwards': { error('"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase()); break; } case 'forward': case 'backward': { error('"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase()); break; } default: error('"%s" is not a supported revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder); break; } } else { error('%s is not a supported value for revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder); } } } } function validateTailOptions(tailMode, revealOrder) { { if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) { if (tailMode !== 'collapsed' && tailMode !== 'hidden') { didWarnAboutTailOptions[tailMode] = true; error('"%s" is not a supported value for tail on <SuspenseList />. ' + 'Did you mean "collapsed" or "hidden"?', tailMode); } else if (revealOrder !== 'forwards' && revealOrder !== 'backwards') { didWarnAboutTailOptions[tailMode] = true; error('<SuspenseList tail="%s" /> is only valid if revealOrder is ' + '"forwards" or "backwards". ' + 'Did you mean to specify revealOrder="forwards"?', tailMode); } } } } function validateSuspenseListNestedChild(childSlot, index) { { var isAnArray = isArray(childSlot); var isIterable = !isAnArray && typeof getIteratorFn(childSlot) === 'function'; if (isAnArray || isIterable) { var type = isAnArray ? 'array' : 'iterable'; error('A nested %s was passed to row #%s in <SuspenseList />. Wrap it in ' + 'an additional SuspenseList to configure its revealOrder: ' + '<SuspenseList revealOrder=...> ... ' + '<SuspenseList revealOrder=...>{%s}</SuspenseList> ... ' + '</SuspenseList>', type, index, type); return false; } } return true; } function validateSuspenseListChildren(children, revealOrder) { { if ((revealOrder === 'forwards' || revealOrder === 'backwards') && children !== undefined && children !== null && children !== false) { if (isArray(children)) { for (var i = 0; i < children.length; i++) { if (!validateSuspenseListNestedChild(children[i], i)) { return; } } } else { var iteratorFn = getIteratorFn(children); if (typeof iteratorFn === 'function') { var childrenIterator = iteratorFn.call(children); if (childrenIterator) { var step = childrenIterator.next(); var _i = 0; for (; !step.done; step = childrenIterator.next()) { if (!validateSuspenseListNestedChild(step.value, _i)) { return; } _i++; } } } else { error('A single row was passed to a <SuspenseList revealOrder="%s" />. ' + 'This is not useful since it needs multiple rows. ' + 'Did you mean to pass multiple children or an array?', revealOrder); } } } } } function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode) { var renderState = workInProgress.memoizedState; if (renderState === null) { workInProgress.memoizedState = { isBackwards: isBackwards, rendering: null, renderingStartTime: 0, last: lastContentRow, tail: tail, tailMode: tailMode }; } else { // We can reuse the existing object from previous renders. renderState.isBackwards = isBackwards; renderState.rendering = null; renderState.renderingStartTime = 0; renderState.last = lastContentRow; renderState.tail = tail; renderState.tailMode = tailMode; } } // This can end up rendering this component multiple passes. // The first pass splits the children fibers into two sets. A head and tail. // We first render the head. If anything is in fallback state, we do another // pass through beginWork to rerender all children (including the tail) with // the force suspend context. If the first render didn't have anything in // in fallback state. Then we render each row in the tail one-by-one. // That happens in the completeWork phase without going back to beginWork. function updateSuspenseListComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps; var revealOrder = nextProps.revealOrder; var tailMode = nextProps.tail; var newChildren = nextProps.children; validateRevealOrder(revealOrder); validateTailOptions(tailMode, revealOrder); validateSuspenseListChildren(newChildren, revealOrder); reconcileChildren(current, workInProgress, newChildren, renderLanes); var suspenseContext = suspenseStackCursor.current; var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback); if (shouldForceFallback) { suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback); workInProgress.flags |= DidCapture; } else { var didSuspendBefore = current !== null && (current.flags & DidCapture) !== NoFlags; if (didSuspendBefore) { // If we previously forced a fallback, we need to schedule work // on any nested boundaries to let them know to try to render // again. This is the same as context updating. propagateSuspenseContextChange(workInProgress, workInProgress.child, renderLanes); } suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); } pushSuspenseContext(workInProgress, suspenseContext); if ((workInProgress.mode & ConcurrentMode) === NoMode) { // In legacy mode, SuspenseList doesn't work so we just // use make it a noop by treating it as the default revealOrder. workInProgress.memoizedState = null; } else { switch (revealOrder) { case 'forwards': { var lastContentRow = findLastContentRow(workInProgress.child); var tail; if (lastContentRow === null) { // The whole list is part of the tail. // TODO: We could fast path by just rendering the tail now. tail = workInProgress.child; workInProgress.child = null; } else { // Disconnect the tail rows after the content row. // We're going to render them separately later. tail = lastContentRow.sibling; lastContentRow.sibling = null; } initSuspenseListRenderState(workInProgress, false, // isBackwards tail, lastContentRow, tailMode); break; } case 'backwards': { // We're going to find the first row that has existing content. // At the same time we're going to reverse the list of everything // we pass in the meantime. That's going to be our tail in reverse // order. var _tail = null; var row = workInProgress.child; workInProgress.child = null; while (row !== null) { var currentRow = row.alternate; // New rows can't be content rows. if (currentRow !== null && findFirstSuspended(currentRow) === null) { // This is the beginning of the main content. workInProgress.child = row; break; } var nextRow = row.sibling; row.sibling = _tail; _tail = row; row = nextRow; } // TODO: If workInProgress.child is null, we can continue on the tail immediately. initSuspenseListRenderState(workInProgress, true, // isBackwards _tail, null, // last tailMode); break; } case 'together': { initSuspenseListRenderState(workInProgress, false, // isBackwards null, // tail null, // last undefined); break; } default: { // The default reveal order is the same as not having // a boundary. workInProgress.memoizedState = null; } } } return workInProgress.child; } function updatePortalComponent(current, workInProgress, renderLanes) { pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); var nextChildren = workInProgress.pendingProps; if (current === null) { // Portals are special because we don't append the children during mount // but at commit. Therefore we need to track insertions which the normal // flow doesn't do during mount. This doesn't happen at the root because // the root always starts with a "current" with a null child. // TODO: Consider unifying this with how the root works. workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderLanes); } else { reconcileChildren(current, workInProgress, nextChildren, renderLanes); } return workInProgress.child; } var hasWarnedAboutUsingNoValuePropOnContextProvider = false; function updateContextProvider(current, workInProgress, renderLanes) { var providerType = workInProgress.type; var context = providerType._context; var newProps = workInProgress.pendingProps; var oldProps = workInProgress.memoizedProps; var newValue = newProps.value; { if (!('value' in newProps)) { if (!hasWarnedAboutUsingNoValuePropOnContextProvider) { hasWarnedAboutUsingNoValuePropOnContextProvider = true; error('The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?'); } } var providerPropTypes = workInProgress.type.propTypes; if (providerPropTypes) { checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider'); } } pushProvider(workInProgress, context, newValue); { if (oldProps !== null) { var oldValue = oldProps.value; if (objectIs(oldValue, newValue)) { // No change. Bailout early if children are the same. if (oldProps.children === newProps.children && !hasContextChanged()) { return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } } else { // The context value changed. Search for matching consumers and schedule // them to update. propagateContextChange(workInProgress, context, renderLanes); } } } var newChildren = newProps.children; reconcileChildren(current, workInProgress, newChildren, renderLanes); return workInProgress.child; } var hasWarnedAboutUsingContextAsConsumer = false; function updateContextConsumer(current, workInProgress, renderLanes) { var context = workInProgress.type; // The logic below for Context differs depending on PROD or DEV mode. In // DEV mode, we create a separate object for Context.Consumer that acts // like a proxy to Context. This proxy object adds unnecessary code in PROD // so we use the old behaviour (Context.Consumer references Context) to // reduce size and overhead. The separate object references context via // a property called "_context", which also gives us the ability to check // in DEV mode if this property exists or not and warn if it does not. { if (context._context === undefined) { // This may be because it's a Context (rather than a Consumer). // Or it may be because it's older React where they're the same thing. // We only want to warn if we're sure it's a new React. if (context !== context.Consumer) { if (!hasWarnedAboutUsingContextAsConsumer) { hasWarnedAboutUsingContextAsConsumer = true; error('Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?'); } } } else { context = context._context; } } var newProps = workInProgress.pendingProps; var render = newProps.children; { if (typeof render !== 'function') { error('A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.'); } } prepareToReadContext(workInProgress, renderLanes); var newValue = readContext(context); { markComponentRenderStarted(workInProgress); } var newChildren; { ReactCurrentOwner$1.current = workInProgress; setIsRendering(true); newChildren = render(newValue); setIsRendering(false); } { markComponentRenderStopped(); } // React DevTools reads this flag. workInProgress.flags |= PerformedWork; reconcileChildren(current, workInProgress, newChildren, renderLanes); return workInProgress.child; } function markWorkInProgressReceivedUpdate() { didReceiveUpdate = true; } function resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress) { if ((workInProgress.mode & ConcurrentMode) === NoMode) { if (current !== null) { // A lazy component only mounts if it suspended inside a non- // concurrent tree, in an inconsistent state. We want to treat it like // a new mount, even though an empty version of it already committed. // Disconnect the alternate pointers. current.alternate = null; workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect workInProgress.flags |= Placement; } } } function bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) { if (current !== null) { // Reuse previous dependencies workInProgress.dependencies = current.dependencies; } { // Don't update "base" render times for bailouts. stopProfilerTimerIfRunning(); } markSkippedUpdateLanes(workInProgress.lanes); // Check if the children have any pending work. if (!includesSomeLane(renderLanes, workInProgress.childLanes)) { // The children don't have any work either. We can skip them. // TODO: Once we add back resuming, we should check if the children are // a work-in-progress set. If so, we need to transfer their effects. { return null; } } // This fiber doesn't have work, but its subtree does. Clone the child // fibers and continue. cloneChildFibers(current, workInProgress); return workInProgress.child; } function remountFiber(current, oldWorkInProgress, newWorkInProgress) { { var returnFiber = oldWorkInProgress.return; if (returnFiber === null) { // eslint-disable-next-line react-internal/prod-error-codes throw new Error('Cannot swap the root fiber.'); } // Disconnect from the old current. // It will get deleted. current.alternate = null; oldWorkInProgress.alternate = null; // Connect to the new tree. newWorkInProgress.index = oldWorkInProgress.index; newWorkInProgress.sibling = oldWorkInProgress.sibling; newWorkInProgress.return = oldWorkInProgress.return; newWorkInProgress.ref = oldWorkInProgress.ref; // Replace the child/sibling pointers above it. if (oldWorkInProgress === returnFiber.child) { returnFiber.child = newWorkInProgress; } else { var prevSibling = returnFiber.child; if (prevSibling === null) { // eslint-disable-next-line react-internal/prod-error-codes throw new Error('Expected parent to have a child.'); } while (prevSibling.sibling !== oldWorkInProgress) { prevSibling = prevSibling.sibling; if (prevSibling === null) { // eslint-disable-next-line react-internal/prod-error-codes throw new Error('Expected to find the previous sibling.'); } } prevSibling.sibling = newWorkInProgress; } // Delete the old fiber and place the new one. // Since the old fiber is disconnected, we have to schedule it manually. var deletions = returnFiber.deletions; if (deletions === null) { returnFiber.deletions = [current]; returnFiber.flags |= ChildDeletion; } else { deletions.push(current); } newWorkInProgress.flags |= Placement; // Restart work from the new fiber. return newWorkInProgress; } } function checkScheduledUpdateOrContext(current, renderLanes) { // Before performing an early bailout, we must check if there are pending // updates or context. var updateLanes = current.lanes; if (includesSomeLane(updateLanes, renderLanes)) { return true; } // No pending update, but because context is propagated lazily, we need return false; } function attemptEarlyBailoutIfNoScheduledUpdate(current, workInProgress, renderLanes) { // This fiber does not have any pending work. Bailout without entering // the begin phase. There's still some bookkeeping we that needs to be done // in this optimized path, mostly pushing stuff onto the stack. switch (workInProgress.tag) { case HostRoot: pushHostRootContext(workInProgress); var root = workInProgress.stateNode; resetHydrationState(); break; case HostComponent: pushHostContext(workInProgress); break; case ClassComponent: { var Component = workInProgress.type; if (isContextProvider(Component)) { pushContextProvider(workInProgress); } break; } case HostPortal: pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); break; case ContextProvider: { var newValue = workInProgress.memoizedProps.value; var context = workInProgress.type._context; pushProvider(workInProgress, context, newValue); break; } case Profiler: { // Profiler should only call onRender when one of its descendants actually rendered. var hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes); if (hasChildWork) { workInProgress.flags |= Update; } { // Reset effect durations for the next eventual effect phase. // These are reset during render to allow the DevTools commit hook a chance to read them, var stateNode = workInProgress.stateNode; stateNode.effectDuration = 0; stateNode.passiveEffectDuration = 0; } } break; case SuspenseComponent: { var state = workInProgress.memoizedState; if (state !== null) { if (state.dehydrated !== null) { pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); // We know that this component will suspend again because if it has // been unsuspended it has committed as a resolved Suspense component. // If it needs to be retried, it should have work scheduled on it. workInProgress.flags |= DidCapture; // We should never render the children of a dehydrated boundary until we // upgrade it. We return null instead of bailoutOnAlreadyFinishedWork. return null; } // If this boundary is currently timed out, we need to decide // whether to retry the primary children, or to skip over it and // go straight to the fallback. Check the priority of the primary // child fragment. var primaryChildFragment = workInProgress.child; var primaryChildLanes = primaryChildFragment.childLanes; if (includesSomeLane(renderLanes, primaryChildLanes)) { // The primary children have pending work. Use the normal path // to attempt to render the primary children again. return updateSuspenseComponent(current, workInProgress, renderLanes); } else { // The primary child fragment does not have pending work marked // on it pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); // The primary children do not have pending work with sufficient // priority. Bailout. var child = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); if (child !== null) { // The fallback children have pending work. Skip over the // primary children and work on the fallback. return child.sibling; } else { // Note: We can return `null` here because we already checked // whether there were nested context consumers, via the call to // `bailoutOnAlreadyFinishedWork` above. return null; } } } else { pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); } break; } case SuspenseListComponent: { var didSuspendBefore = (current.flags & DidCapture) !== NoFlags; var _hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes); if (didSuspendBefore) { if (_hasChildWork) { // If something was in fallback state last time, and we have all the // same children then we're still in progressive loading state. // Something might get unblocked by state updates or retries in the // tree which will affect the tail. So we need to use the normal // path to compute the correct tail. return updateSuspenseListComponent(current, workInProgress, renderLanes); } // If none of the children had any work, that means that none of // them got retried so they'll still be blocked in the same way // as before. We can fast bail out. workInProgress.flags |= DidCapture; } // If nothing suspended before and we're rendering the same children, // then the tail doesn't matter. Anything new that suspends will work // in the "together" mode, so we can continue from the state we had. var renderState = workInProgress.memoizedState; if (renderState !== null) { // Reset to the "together" mode in case we've started a different // update in the past but didn't complete it. renderState.rendering = null; renderState.tail = null; renderState.lastEffect = null; } pushSuspenseContext(workInProgress, suspenseStackCursor.current); if (_hasChildWork) { break; } else { // If none of the children had any work, that means that none of // them got retried so they'll still be blocked in the same way // as before. We can fast bail out. return null; } } case OffscreenComponent: case LegacyHiddenComponent: { // Need to check if the tree still needs to be deferred. This is // almost identical to the logic used in the normal update path, // so we'll just enter that. The only difference is we'll bail out // at the next level instead of this one, because the child props // have not changed. Which is fine. // TODO: Probably should refactor `beginWork` to split the bailout // path from the normal path. I'm tempted to do a labeled break here // but I won't :) workInProgress.lanes = NoLanes; return updateOffscreenComponent(current, workInProgress, renderLanes); } } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } function beginWork(current, workInProgress, renderLanes) { { if (workInProgress._debugNeedsRemount && current !== null) { // This will restart the begin phase with a new fiber. return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes)); } } if (current !== null) { var oldProps = current.memoizedProps; var newProps = workInProgress.pendingProps; if (oldProps !== newProps || hasContextChanged() || ( // Force a re-render if the implementation changed due to hot reload: workInProgress.type !== current.type )) { // If props or context changed, mark the fiber as having performed work. // This may be unset if the props are determined to be equal later (memo). didReceiveUpdate = true; } else { // Neither props nor legacy context changes. Check if there's a pending // update or context change. var hasScheduledUpdateOrContext = checkScheduledUpdateOrContext(current, renderLanes); if (!hasScheduledUpdateOrContext && // If this is the second pass of an error or suspense boundary, there // may not be work scheduled on `current`, so we check for this flag. (workInProgress.flags & DidCapture) === NoFlags) { // No pending updates or context. Bail out now. didReceiveUpdate = false; return attemptEarlyBailoutIfNoScheduledUpdate(current, workInProgress, renderLanes); } if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) { // This is a special case that only exists for legacy mode. // See https://github.com/facebook/react/pull/19216. didReceiveUpdate = true; } else { // An update was scheduled on this fiber, but there are no new props // nor legacy context. Set this to false. If an update queue or context // consumer produces a changed value, it will set this to true. Otherwise, // the component will assume the children have not changed and bail out. didReceiveUpdate = false; } } } else { didReceiveUpdate = false; if (getIsHydrating() && isForkedChild(workInProgress)) { // Check if this child belongs to a list of muliple children in // its parent. // // In a true multi-threaded implementation, we would render children on // parallel threads. This would represent the beginning of a new render // thread for this subtree. // // We only use this for id generation during hydration, which is why the // logic is located in this special branch. var slotIndex = workInProgress.index; var numberOfForks = getForksAtLevel(); pushTreeId(workInProgress, numberOfForks, slotIndex); } } // Before entering the begin phase, clear pending update priority. // TODO: This assumes that we're about to evaluate the component and process // the update queue. However, there's an exception: SimpleMemoComponent // sometimes bails out later in the begin phase. This indicates that we should // move this assignment out of the common path and into each branch. workInProgress.lanes = NoLanes; switch (workInProgress.tag) { case IndeterminateComponent: { return mountIndeterminateComponent(current, workInProgress, workInProgress.type, renderLanes); } case LazyComponent: { var elementType = workInProgress.elementType; return mountLazyComponent(current, workInProgress, elementType, renderLanes); } case FunctionComponent: { var Component = workInProgress.type; var unresolvedProps = workInProgress.pendingProps; var resolvedProps = workInProgress.elementType === Component ? unresolvedProps : resolveDefaultProps(Component, unresolvedProps); return updateFunctionComponent(current, workInProgress, Component, resolvedProps, renderLanes); } case ClassComponent: { var _Component = workInProgress.type; var _unresolvedProps = workInProgress.pendingProps; var _resolvedProps = workInProgress.elementType === _Component ? _unresolvedProps : resolveDefaultProps(_Component, _unresolvedProps); return updateClassComponent(current, workInProgress, _Component, _resolvedProps, renderLanes); } case HostRoot: return updateHostRoot(current, workInProgress, renderLanes); case HostComponent: return updateHostComponent(current, workInProgress, renderLanes); case HostText: return updateHostText(current, workInProgress); case SuspenseComponent: return updateSuspenseComponent(current, workInProgress, renderLanes); case HostPortal: return updatePortalComponent(current, workInProgress, renderLanes); case ForwardRef: { var type = workInProgress.type; var _unresolvedProps2 = workInProgress.pendingProps; var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2); return updateForwardRef(current, workInProgress, type, _resolvedProps2, renderLanes); } case Fragment: return updateFragment(current, workInProgress, renderLanes); case Mode: return updateMode(current, workInProgress, renderLanes); case Profiler: return updateProfiler(current, workInProgress, renderLanes); case ContextProvider: return updateContextProvider(current, workInProgress, renderLanes); case ContextConsumer: return updateContextConsumer(current, workInProgress, renderLanes); case MemoComponent: { var _type2 = workInProgress.type; var _unresolvedProps3 = workInProgress.pendingProps; // Resolve outer props first, then resolve inner props. var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3); { if (workInProgress.type !== workInProgress.elementType) { var outerPropTypes = _type2.propTypes; if (outerPropTypes) { checkPropTypes(outerPropTypes, _resolvedProps3, // Resolved for outer only 'prop', getComponentNameFromType(_type2)); } } } _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3); return updateMemoComponent(current, workInProgress, _type2, _resolvedProps3, renderLanes); } case SimpleMemoComponent: { return updateSimpleMemoComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, renderLanes); } case IncompleteClassComponent: { var _Component2 = workInProgress.type; var _unresolvedProps4 = workInProgress.pendingProps; var _resolvedProps4 = workInProgress.elementType === _Component2 ? _unresolvedProps4 : resolveDefaultProps(_Component2, _unresolvedProps4); return mountIncompleteClassComponent(current, workInProgress, _Component2, _resolvedProps4, renderLanes); } case SuspenseListComponent: { return updateSuspenseListComponent(current, workInProgress, renderLanes); } case ScopeComponent: { break; } case OffscreenComponent: { return updateOffscreenComponent(current, workInProgress, renderLanes); } } throw new Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in " + 'React. Please file an issue.'); } function markUpdate(workInProgress) { // Tag the fiber with an update effect. This turns a Placement into // a PlacementAndUpdate. workInProgress.flags |= Update; } function markRef$1(workInProgress) { workInProgress.flags |= Ref; { workInProgress.flags |= RefStatic; } } var appendAllChildren; var updateHostContainer; var updateHostComponent$1; var updateHostText$1; { // Mutation mode appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) { // We only have the top Fiber that was created but we need recurse down its // children to find all the terminal nodes. var node = workInProgress.child; while (node !== null) { if (node.tag === HostComponent || node.tag === HostText) { appendInitialChild(parent, node.stateNode); } else if (node.tag === HostPortal) ; else if (node.child !== null) { node.child.return = node; node = node.child; continue; } if (node === workInProgress) { return; } while (node.sibling === null) { if (node.return === null || node.return === workInProgress) { return; } node = node.return; } node.sibling.return = node.return; node = node.sibling; } }; updateHostContainer = function (current, workInProgress) {// Noop }; updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) { // If we have an alternate, that means this is an update and we need to // schedule a side-effect to do the updates. var oldProps = current.memoizedProps; if (oldProps === newProps) { // In mutation mode, this is sufficient for a bailout because // we won't touch this node even if children changed. return; } // If we get updated because one of our children updated, we don't // have newProps so we'll have to reuse them. // TODO: Split the update API as separate for the props vs. children. // Even better would be if children weren't special cased at all tho. var instance = workInProgress.stateNode; var currentHostContext = getHostContext(); // TODO: Experiencing an error where oldProps is null. Suggests a host // component is hitting the resume path. Figure out why. Possibly // related to `hidden`. var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext); // TODO: Type this specific to this type of component. workInProgress.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there // is a new ref we mark this as an update. All the work is done in commitWork. if (updatePayload) { markUpdate(workInProgress); } }; updateHostText$1 = function (current, workInProgress, oldText, newText) { // If the text differs, mark it as an update. All the work in done in commitWork. if (oldText !== newText) { markUpdate(workInProgress); } }; } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { if (getIsHydrating()) { // If we're hydrating, we should consume as many items as we can // so we don't leave any behind. return; } switch (renderState.tailMode) { case 'hidden': { // Any insertions at the end of the tail list after this point // should be invisible. If there are already mounted boundaries // anything before them are not considered for collapsing. // Therefore we need to go through the whole tail to find if // there are any. var tailNode = renderState.tail; var lastTailNode = null; while (tailNode !== null) { if (tailNode.alternate !== null) { lastTailNode = tailNode; } tailNode = tailNode.sibling; } // Next we're simply going to delete all insertions after the // last rendered item. if (lastTailNode === null) { // All remaining items in the tail are insertions. renderState.tail = null; } else { // Detach the insertion after the last node that was already // inserted. lastTailNode.sibling = null; } break; } case 'collapsed': { // Any insertions at the end of the tail list after this point // should be invisible. If there are already mounted boundaries // anything before them are not considered for collapsing. // Therefore we need to go through the whole tail to find if // there are any. var _tailNode = renderState.tail; var _lastTailNode = null; while (_tailNode !== null) { if (_tailNode.alternate !== null) { _lastTailNode = _tailNode; } _tailNode = _tailNode.sibling; } // Next we're simply going to delete all insertions after the // last rendered item. if (_lastTailNode === null) { // All remaining items in the tail are insertions. if (!hasRenderedATailFallback && renderState.tail !== null) { // We suspended during the head. We want to show at least one // row at the tail. So we'll keep on and cut off the rest. renderState.tail.sibling = null; } else { renderState.tail = null; } } else { // Detach the insertion after the last node that was already // inserted. _lastTailNode.sibling = null; } break; } } } function bubbleProperties(completedWork) { var didBailout = completedWork.alternate !== null && completedWork.alternate.child === completedWork.child; var newChildLanes = NoLanes; var subtreeFlags = NoFlags; if (!didBailout) { // Bubble up the earliest expiration time. if ( (completedWork.mode & ProfileMode) !== NoMode) { // In profiling mode, resetChildExpirationTime is also used to reset // profiler durations. var actualDuration = completedWork.actualDuration; var treeBaseDuration = completedWork.selfBaseDuration; var child = completedWork.child; while (child !== null) { newChildLanes = mergeLanes(newChildLanes, mergeLanes(child.lanes, child.childLanes)); subtreeFlags |= child.subtreeFlags; subtreeFlags |= child.flags; // When a fiber is cloned, its actualDuration is reset to 0. This value will // only be updated if work is done on the fiber (i.e. it doesn't bailout). // When work is done, it should bubble to the parent's actualDuration. If // the fiber has not been cloned though, (meaning no work was done), then // this value will reflect the amount of time spent working on a previous // render. In that case it should not bubble. We determine whether it was // cloned by comparing the child pointer. actualDuration += child.actualDuration; treeBaseDuration += child.treeBaseDuration; child = child.sibling; } completedWork.actualDuration = actualDuration; completedWork.treeBaseDuration = treeBaseDuration; } else { var _child = completedWork.child; while (_child !== null) { newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child.lanes, _child.childLanes)); subtreeFlags |= _child.subtreeFlags; subtreeFlags |= _child.flags; // Update the return pointer so the tree is consistent. This is a code // smell because it assumes the commit phase is never concurrent with // the render phase. Will address during refactor to alternate model. _child.return = completedWork; _child = _child.sibling; } } completedWork.subtreeFlags |= subtreeFlags; } else { // Bubble up the earliest expiration time. if ( (completedWork.mode & ProfileMode) !== NoMode) { // In profiling mode, resetChildExpirationTime is also used to reset // profiler durations. var _treeBaseDuration = completedWork.selfBaseDuration; var _child2 = completedWork.child; while (_child2 !== null) { newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child2.lanes, _child2.childLanes)); // "Static" flags share the lifetime of the fiber/hook they belong to, // so we should bubble those up even during a bailout. All the other // flags have a lifetime only of a single render + commit, so we should // ignore them. subtreeFlags |= _child2.subtreeFlags & StaticMask; subtreeFlags |= _child2.flags & StaticMask; _treeBaseDuration += _child2.treeBaseDuration; _child2 = _child2.sibling; } completedWork.treeBaseDuration = _treeBaseDuration; } else { var _child3 = completedWork.child; while (_child3 !== null) { newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child3.lanes, _child3.childLanes)); // "Static" flags share the lifetime of the fiber/hook they belong to, // so we should bubble those up even during a bailout. All the other // flags have a lifetime only of a single render + commit, so we should // ignore them. subtreeFlags |= _child3.subtreeFlags & StaticMask; subtreeFlags |= _child3.flags & StaticMask; // Update the return pointer so the tree is consistent. This is a code // smell because it assumes the commit phase is never concurrent with // the render phase. Will address during refactor to alternate model. _child3.return = completedWork; _child3 = _child3.sibling; } } completedWork.subtreeFlags |= subtreeFlags; } completedWork.childLanes = newChildLanes; return didBailout; } function completeDehydratedSuspenseBoundary(current, workInProgress, nextState) { if (hasUnhydratedTailNodes() && (workInProgress.mode & ConcurrentMode) !== NoMode && (workInProgress.flags & DidCapture) === NoFlags) { warnIfUnhydratedTailNodes(workInProgress); resetHydrationState(); workInProgress.flags |= ForceClientRender | Incomplete | ShouldCapture; return false; } var wasHydrated = popHydrationState(workInProgress); if (nextState !== null && nextState.dehydrated !== null) { // We might be inside a hydration state the first time we're picking up this // Suspense boundary, and also after we've reentered it for further hydration. if (current === null) { if (!wasHydrated) { throw new Error('A dehydrated suspense component was completed without a hydrated node. ' + 'This is probably a bug in React.'); } prepareToHydrateHostSuspenseInstance(workInProgress); bubbleProperties(workInProgress); { if ((workInProgress.mode & ProfileMode) !== NoMode) { var isTimedOutSuspense = nextState !== null; if (isTimedOutSuspense) { // Don't count time spent in a timed out Suspense subtree as part of the base duration. var primaryChildFragment = workInProgress.child; if (primaryChildFragment !== null) { // $FlowFixMe Flow doesn't support type casting in combination with the -= operator workInProgress.treeBaseDuration -= primaryChildFragment.treeBaseDuration; } } } } return false; } else { // We might have reentered this boundary to hydrate it. If so, we need to reset the hydration // state since we're now exiting out of it. popHydrationState doesn't do that for us. resetHydrationState(); if ((workInProgress.flags & DidCapture) === NoFlags) { // This boundary did not suspend so it's now hydrated and unsuspended. workInProgress.memoizedState = null; } // If nothing suspended, we need to schedule an effect to mark this boundary // as having hydrated so events know that they're free to be invoked. // It's also a signal to replay events and the suspense callback. // If something suspended, schedule an effect to attach retry listeners. // So we might as well always mark this. workInProgress.flags |= Update; bubbleProperties(workInProgress); { if ((workInProgress.mode & ProfileMode) !== NoMode) { var _isTimedOutSuspense = nextState !== null; if (_isTimedOutSuspense) { // Don't count time spent in a timed out Suspense subtree as part of the base duration. var _primaryChildFragment = workInProgress.child; if (_primaryChildFragment !== null) { // $FlowFixMe Flow doesn't support type casting in combination with the -= operator workInProgress.treeBaseDuration -= _primaryChildFragment.treeBaseDuration; } } } } return false; } } else { // Successfully completed this tree. If this was a forced client render, // there may have been recoverable errors during first hydration // attempt. If so, add them to a queue so we can log them in the // commit phase. upgradeHydrationErrorsToRecoverable(); // Fall through to normal Suspense path return true; } } function completeWork(current, workInProgress, renderLanes) { var newProps = workInProgress.pendingProps; // Note: This intentionally doesn't check if we're hydrating because comparing // to the current tree provider fiber is just as fast and less error-prone. // Ideally we would have a special version of the work loop only // for hydration. popTreeContext(workInProgress); switch (workInProgress.tag) { case IndeterminateComponent: case LazyComponent: case SimpleMemoComponent: case FunctionComponent: case ForwardRef: case Fragment: case Mode: case Profiler: case ContextConsumer: case MemoComponent: bubbleProperties(workInProgress); return null; case ClassComponent: { var Component = workInProgress.type; if (isContextProvider(Component)) { popContext(workInProgress); } bubbleProperties(workInProgress); return null; } case HostRoot: { var fiberRoot = workInProgress.stateNode; popHostContainer(workInProgress); popTopLevelContextObject(workInProgress); resetWorkInProgressVersions(); if (fiberRoot.pendingContext) { fiberRoot.context = fiberRoot.pendingContext; fiberRoot.pendingContext = null; } if (current === null || current.child === null) { // If we hydrated, pop so that we can delete any remaining children // that weren't hydrated. var wasHydrated = popHydrationState(workInProgress); if (wasHydrated) { // If we hydrated, then we'll need to schedule an update for // the commit side-effects on the root. markUpdate(workInProgress); } else { if (current !== null) { var prevState = current.memoizedState; if ( // Check if this is a client root !prevState.isDehydrated || // Check if we reverted to client rendering (e.g. due to an error) (workInProgress.flags & ForceClientRender) !== NoFlags) { // Schedule an effect to clear this container at the start of the // next commit. This handles the case of React rendering into a // container with previous children. It's also safe to do for // updates too, because current.child would only be null if the // previous render was null (so the container would already // be empty). workInProgress.flags |= Snapshot; // If this was a forced client render, there may have been // recoverable errors during first hydration attempt. If so, add // them to a queue so we can log them in the commit phase. upgradeHydrationErrorsToRecoverable(); } } } } updateHostContainer(current, workInProgress); bubbleProperties(workInProgress); return null; } case HostComponent: { popHostContext(workInProgress); var rootContainerInstance = getRootHostContainer(); var type = workInProgress.type; if (current !== null && workInProgress.stateNode != null) { updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance); if (current.ref !== workInProgress.ref) { markRef$1(workInProgress); } } else { if (!newProps) { if (workInProgress.stateNode === null) { throw new Error('We must have new props for new mounts. This error is likely ' + 'caused by a bug in React. Please file an issue.'); } // This can happen when we abort work. bubbleProperties(workInProgress); return null; } var currentHostContext = getHostContext(); // TODO: Move createInstance to beginWork and keep it on a context // "stack" as the parent. Then append children as we go in beginWork // or completeWork depending on whether we want to add them top->down or // bottom->up. Top->down is faster in IE11. var _wasHydrated = popHydrationState(workInProgress); if (_wasHydrated) { // TODO: Move this and createInstance step into the beginPhase // to consolidate. if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, currentHostContext)) { // If changes to the hydrated node need to be applied at the // commit-phase we mark this as such. markUpdate(workInProgress); } } else { var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress); appendAllChildren(instance, workInProgress, false, false); workInProgress.stateNode = instance; // Certain renderers require commit-time effects for initial mount. // (eg DOM renderer supports auto-focus for certain elements). // Make sure such renderers get scheduled for later work. if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance)) { markUpdate(workInProgress); } } if (workInProgress.ref !== null) { // If there is a ref on a host node we need to schedule a callback markRef$1(workInProgress); } } bubbleProperties(workInProgress); return null; } case HostText: { var newText = newProps; if (current && workInProgress.stateNode != null) { var oldText = current.memoizedProps; // If we have an alternate, that means this is an update and we need // to schedule a side-effect to do the updates. updateHostText$1(current, workInProgress, oldText, newText); } else { if (typeof newText !== 'string') { if (workInProgress.stateNode === null) { throw new Error('We must have new props for new mounts. This error is likely ' + 'caused by a bug in React. Please file an issue.'); } // This can happen when we abort work. } var _rootContainerInstance = getRootHostContainer(); var _currentHostContext = getHostContext(); var _wasHydrated2 = popHydrationState(workInProgress); if (_wasHydrated2) { if (prepareToHydrateHostTextInstance(workInProgress)) { markUpdate(workInProgress); } } else { workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress); } } bubbleProperties(workInProgress); return null; } case SuspenseComponent: { popSuspenseContext(workInProgress); var nextState = workInProgress.memoizedState; // Special path for dehydrated boundaries. We may eventually move this // to its own fiber type so that we can add other kinds of hydration // boundaries that aren't associated with a Suspense tree. In anticipation // of such a refactor, all the hydration logic is contained in // this branch. if (current === null || current.memoizedState !== null && current.memoizedState.dehydrated !== null) { var fallthroughToNormalSuspensePath = completeDehydratedSuspenseBoundary(current, workInProgress, nextState); if (!fallthroughToNormalSuspensePath) { if (workInProgress.flags & ShouldCapture) { // Special case. There were remaining unhydrated nodes. We treat // this as a mismatch. Revert to client rendering. return workInProgress; } else { // Did not finish hydrating, either because this is the initial // render or because something suspended. return null; } } // Continue with the normal Suspense path. } if ((workInProgress.flags & DidCapture) !== NoFlags) { // Something suspended. Re-render with the fallback children. workInProgress.lanes = renderLanes; // Do not reset the effect list. if ( (workInProgress.mode & ProfileMode) !== NoMode) { transferActualDuration(workInProgress); } // Don't bubble properties in this case. return workInProgress; } var nextDidTimeout = nextState !== null; var prevDidTimeout = current !== null && current.memoizedState !== null; // a passive effect, which is when we process the transitions if (nextDidTimeout !== prevDidTimeout) { // an effect to toggle the subtree's visibility. When we switch from // fallback -> primary, the inner Offscreen fiber schedules this effect // as part of its normal complete phase. But when we switch from // primary -> fallback, the inner Offscreen fiber does not have a complete // phase. So we need to schedule its effect here. // // We also use this flag to connect/disconnect the effects, but the same // logic applies: when re-connecting, the Offscreen fiber's complete // phase will handle scheduling the effect. It's only when the fallback // is active that we have to do anything special. if (nextDidTimeout) { var _offscreenFiber2 = workInProgress.child; _offscreenFiber2.flags |= Visibility; // TODO: This will still suspend a synchronous tree if anything // in the concurrent tree already suspended during this render. // This is a known bug. if ((workInProgress.mode & ConcurrentMode) !== NoMode) { // TODO: Move this back to throwException because this is too late // if this is a large tree which is common for initial loads. We // don't know if we should restart a render or not until we get // this marker, and this is too late. // If this render already had a ping or lower pri updates, // and this is the first time we know we're going to suspend we // should be able to immediately restart from within throwException. var hasInvisibleChildContext = current === null && (workInProgress.memoizedProps.unstable_avoidThisFallback !== true || !enableSuspenseAvoidThisFallback); if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) { // If this was in an invisible tree or a new render, then showing // this boundary is ok. renderDidSuspend(); } else { // Otherwise, we're going to have to hide content so we should // suspend for longer if possible. renderDidSuspendDelayIfPossible(); } } } } var wakeables = workInProgress.updateQueue; if (wakeables !== null) { // Schedule an effect to attach a retry listener to the promise. // TODO: Move to passive phase workInProgress.flags |= Update; } bubbleProperties(workInProgress); { if ((workInProgress.mode & ProfileMode) !== NoMode) { if (nextDidTimeout) { // Don't count time spent in a timed out Suspense subtree as part of the base duration. var primaryChildFragment = workInProgress.child; if (primaryChildFragment !== null) { // $FlowFixMe Flow doesn't support type casting in combination with the -= operator workInProgress.treeBaseDuration -= primaryChildFragment.treeBaseDuration; } } } } return null; } case HostPortal: popHostContainer(workInProgress); updateHostContainer(current, workInProgress); if (current === null) { preparePortalMount(workInProgress.stateNode.containerInfo); } bubbleProperties(workInProgress); return null; case ContextProvider: // Pop provider fiber var context = workInProgress.type._context; popProvider(context, workInProgress); bubbleProperties(workInProgress); return null; case IncompleteClassComponent: { // Same as class component case. I put it down here so that the tags are // sequential to ensure this switch is compiled to a jump table. var _Component = workInProgress.type; if (isContextProvider(_Component)) { popContext(workInProgress); } bubbleProperties(workInProgress); return null; } case SuspenseListComponent: { popSuspenseContext(workInProgress); var renderState = workInProgress.memoizedState; if (renderState === null) { // We're running in the default, "independent" mode. // We don't do anything in this mode. bubbleProperties(workInProgress); return null; } var didSuspendAlready = (workInProgress.flags & DidCapture) !== NoFlags; var renderedTail = renderState.rendering; if (renderedTail === null) { // We just rendered the head. if (!didSuspendAlready) { // This is the first pass. We need to figure out if anything is still // suspended in the rendered set. // If new content unsuspended, but there's still some content that // didn't. Then we need to do a second pass that forces everything // to keep showing their fallbacks. // We might be suspended if something in this render pass suspended, or // something in the previous committed pass suspended. Otherwise, // there's no chance so we can skip the expensive call to // findFirstSuspended. var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.flags & DidCapture) === NoFlags); if (!cannotBeSuspended) { var row = workInProgress.child; while (row !== null) { var suspended = findFirstSuspended(row); if (suspended !== null) { didSuspendAlready = true; workInProgress.flags |= DidCapture; cutOffTailIfNeeded(renderState, false); // If this is a newly suspended tree, it might not get committed as // part of the second pass. In that case nothing will subscribe to // its thenables. Instead, we'll transfer its thenables to the // SuspenseList so that it can retry if they resolve. // There might be multiple of these in the list but since we're // going to wait for all of them anyway, it doesn't really matter // which ones gets to ping. In theory we could get clever and keep // track of how many dependencies remain but it gets tricky because // in the meantime, we can add/remove/change items and dependencies. // We might bail out of the loop before finding any but that // doesn't matter since that means that the other boundaries that // we did find already has their listeners attached. var newThenables = suspended.updateQueue; if (newThenables !== null) { workInProgress.updateQueue = newThenables; workInProgress.flags |= Update; } // Rerender the whole list, but this time, we'll force fallbacks // to stay in place. // Reset the effect flags before doing the second pass since that's now invalid. // Reset the child fibers to their original state. workInProgress.subtreeFlags = NoFlags; resetChildFibers(workInProgress, renderLanes); // Set up the Suspense Context to force suspense and immediately // rerender the children. pushSuspenseContext(workInProgress, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback)); // Don't bubble properties in this case. return workInProgress.child; } row = row.sibling; } } if (renderState.tail !== null && now() > getRenderTargetTime()) { // We have already passed our CPU deadline but we still have rows // left in the tail. We'll just give up further attempts to render // the main content and only render fallbacks. workInProgress.flags |= DidCapture; didSuspendAlready = true; cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this // to get it started back up to attempt the next item. While in terms // of priority this work has the same priority as this current render, // it's not part of the same transition once the transition has // committed. If it's sync, we still want to yield so that it can be // painted. Conceptually, this is really the same as pinging. // We can use any RetryLane even if it's the one currently rendering // since we're leaving it behind on this node. workInProgress.lanes = SomeRetryLane; } } else { cutOffTailIfNeeded(renderState, false); } // Next we're going to render the tail. } else { // Append the rendered row to the child list. if (!didSuspendAlready) { var _suspended = findFirstSuspended(renderedTail); if (_suspended !== null) { workInProgress.flags |= DidCapture; didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't // get lost if this row ends up dropped during a second pass. var _newThenables = _suspended.updateQueue; if (_newThenables !== null) { workInProgress.updateQueue = _newThenables; workInProgress.flags |= Update; } cutOffTailIfNeeded(renderState, true); // This might have been modified. if (renderState.tail === null && renderState.tailMode === 'hidden' && !renderedTail.alternate && !getIsHydrating() // We don't cut it if we're hydrating. ) { // We're done. bubbleProperties(workInProgress); return null; } } else if ( // The time it took to render last row is greater than the remaining // time we have to render. So rendering one more row would likely // exceed it. now() * 2 - renderState.renderingStartTime > getRenderTargetTime() && renderLanes !== OffscreenLane) { // We have now passed our CPU deadline and we'll just give up further // attempts to render the main content and only render fallbacks. // The assumption is that this is usually faster. workInProgress.flags |= DidCapture; didSuspendAlready = true; cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this // to get it started back up to attempt the next item. While in terms // of priority this work has the same priority as this current render, // it's not part of the same transition once the transition has // committed. If it's sync, we still want to yield so that it can be // painted. Conceptually, this is really the same as pinging. // We can use any RetryLane even if it's the one currently rendering // since we're leaving it behind on this node. workInProgress.lanes = SomeRetryLane; } } if (renderState.isBackwards) { // The effect list of the backwards tail will have been added // to the end. This breaks the guarantee that life-cycles fire in // sibling order but that isn't a strong guarantee promised by React. // Especially since these might also just pop in during future commits. // Append to the beginning of the list. renderedTail.sibling = workInProgress.child; workInProgress.child = renderedTail; } else { var previousSibling = renderState.last; if (previousSibling !== null) { previousSibling.sibling = renderedTail; } else { workInProgress.child = renderedTail; } renderState.last = renderedTail; } } if (renderState.tail !== null) { // We still have tail rows to render. // Pop a row. var next = renderState.tail; renderState.rendering = next; renderState.tail = next.sibling; renderState.renderingStartTime = now(); next.sibling = null; // Restore the context. // TODO: We can probably just avoid popping it instead and only // setting it the first time we go from not suspended to suspended. var suspenseContext = suspenseStackCursor.current; if (didSuspendAlready) { suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback); } else { suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); } pushSuspenseContext(workInProgress, suspenseContext); // Do a pass over the next row. // Don't bubble properties in this case. return next; } bubbleProperties(workInProgress); return null; } case ScopeComponent: { break; } case OffscreenComponent: case LegacyHiddenComponent: { popRenderLanes(workInProgress); var _nextState = workInProgress.memoizedState; var nextIsHidden = _nextState !== null; if (current !== null) { var _prevState = current.memoizedState; var prevIsHidden = _prevState !== null; if (prevIsHidden !== nextIsHidden && ( // LegacyHidden doesn't do any hiding — it only pre-renders. !enableLegacyHidden )) { workInProgress.flags |= Visibility; } } if (!nextIsHidden || (workInProgress.mode & ConcurrentMode) === NoMode) { bubbleProperties(workInProgress); } else { // Don't bubble properties for hidden children unless we're rendering // at offscreen priority. if (includesSomeLane(subtreeRenderLanes, OffscreenLane)) { bubbleProperties(workInProgress); { // Check if there was an insertion or update in the hidden subtree. // If so, we need to hide those nodes in the commit phase, so // schedule a visibility effect. if ( workInProgress.subtreeFlags & (Placement | Update)) { workInProgress.flags |= Visibility; } } } } return null; } case CacheComponent: { return null; } case TracingMarkerComponent: { return null; } } throw new Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in " + 'React. Please file an issue.'); } function unwindWork(current, workInProgress, renderLanes) { // Note: This intentionally doesn't check if we're hydrating because comparing // to the current tree provider fiber is just as fast and less error-prone. // Ideally we would have a special version of the work loop only // for hydration. popTreeContext(workInProgress); switch (workInProgress.tag) { case ClassComponent: { var Component = workInProgress.type; if (isContextProvider(Component)) { popContext(workInProgress); } var flags = workInProgress.flags; if (flags & ShouldCapture) { workInProgress.flags = flags & ~ShouldCapture | DidCapture; if ( (workInProgress.mode & ProfileMode) !== NoMode) { transferActualDuration(workInProgress); } return workInProgress; } return null; } case HostRoot: { var root = workInProgress.stateNode; popHostContainer(workInProgress); popTopLevelContextObject(workInProgress); resetWorkInProgressVersions(); var _flags = workInProgress.flags; if ((_flags & ShouldCapture) !== NoFlags && (_flags & DidCapture) === NoFlags) { // There was an error during render that wasn't captured by a suspense // boundary. Do a second pass on the root to unmount the children. workInProgress.flags = _flags & ~ShouldCapture | DidCapture; return workInProgress; } // We unwound to the root without completing it. Exit. return null; } case HostComponent: { // TODO: popHydrationState popHostContext(workInProgress); return null; } case SuspenseComponent: { popSuspenseContext(workInProgress); var suspenseState = workInProgress.memoizedState; if (suspenseState !== null && suspenseState.dehydrated !== null) { if (workInProgress.alternate === null) { throw new Error('Threw in newly mounted dehydrated component. This is likely a bug in ' + 'React. Please file an issue.'); } resetHydrationState(); } var _flags2 = workInProgress.flags; if (_flags2 & ShouldCapture) { workInProgress.flags = _flags2 & ~ShouldCapture | DidCapture; // Captured a suspense effect. Re-render the boundary. if ( (workInProgress.mode & ProfileMode) !== NoMode) { transferActualDuration(workInProgress); } return workInProgress; } return null; } case SuspenseListComponent: { popSuspenseContext(workInProgress); // SuspenseList doesn't actually catch anything. It should've been // caught by a nested boundary. If not, it should bubble through. return null; } case HostPortal: popHostContainer(workInProgress); return null; case ContextProvider: var context = workInProgress.type._context; popProvider(context, workInProgress); return null; case OffscreenComponent: case LegacyHiddenComponent: popRenderLanes(workInProgress); return null; case CacheComponent: return null; default: return null; } } function unwindInterruptedWork(current, interruptedWork, renderLanes) { // Note: This intentionally doesn't check if we're hydrating because comparing // to the current tree provider fiber is just as fast and less error-prone. // Ideally we would have a special version of the work loop only // for hydration. popTreeContext(interruptedWork); switch (interruptedWork.tag) { case ClassComponent: { var childContextTypes = interruptedWork.type.childContextTypes; if (childContextTypes !== null && childContextTypes !== undefined) { popContext(interruptedWork); } break; } case HostRoot: { var root = interruptedWork.stateNode; popHostContainer(interruptedWork); popTopLevelContextObject(interruptedWork); resetWorkInProgressVersions(); break; } case HostComponent: { popHostContext(interruptedWork); break; } case HostPortal: popHostContainer(interruptedWork); break; case SuspenseComponent: popSuspenseContext(interruptedWork); break; case SuspenseListComponent: popSuspenseContext(interruptedWork); break; case ContextProvider: var context = interruptedWork.type._context; popProvider(context, interruptedWork); break; case OffscreenComponent: case LegacyHiddenComponent: popRenderLanes(interruptedWork); break; } } var didWarnAboutUndefinedSnapshotBeforeUpdate = null; { didWarnAboutUndefinedSnapshotBeforeUpdate = new Set(); } // Used during the commit phase to track the state of the Offscreen component stack. // Allows us to avoid traversing the return path to find the nearest Offscreen ancestor. // Only used when enableSuspenseLayoutEffectSemantics is enabled. var offscreenSubtreeIsHidden = false; var offscreenSubtreeWasHidden = false; var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set; var nextEffect = null; // Used for Profiling builds to track updaters. var inProgressLanes = null; var inProgressRoot = null; function reportUncaughtErrorInDEV(error) { // Wrapping each small part of the commit phase into a guarded // callback is a bit too slow (https://github.com/facebook/react/pull/21666). // But we rely on it to surface errors to DEV tools like overlays // (https://github.com/facebook/react/issues/21712). // As a compromise, rethrow only caught errors in a guard. { invokeGuardedCallback(null, function () { throw error; }); clearCaughtError(); } } var callComponentWillUnmountWithTimer = function (current, instance) { instance.props = current.memoizedProps; instance.state = current.memoizedState; if ( current.mode & ProfileMode) { try { startLayoutEffectTimer(); instance.componentWillUnmount(); } finally { recordLayoutEffectDuration(current); } } else { instance.componentWillUnmount(); } }; // Capture errors so they don't interrupt mounting. function safelyCallCommitHookLayoutEffectListMount(current, nearestMountedAncestor) { try { commitHookEffectListMount(Layout, current); } catch (error) { captureCommitPhaseError(current, nearestMountedAncestor, error); } } // Capture errors so they don't interrupt unmounting. function safelyCallComponentWillUnmount(current, nearestMountedAncestor, instance) { try { callComponentWillUnmountWithTimer(current, instance); } catch (error) { captureCommitPhaseError(current, nearestMountedAncestor, error); } } // Capture errors so they don't interrupt mounting. function safelyCallComponentDidMount(current, nearestMountedAncestor, instance) { try { instance.componentDidMount(); } catch (error) { captureCommitPhaseError(current, nearestMountedAncestor, error); } } // Capture errors so they don't interrupt mounting. function safelyAttachRef(current, nearestMountedAncestor) { try { commitAttachRef(current); } catch (error) { captureCommitPhaseError(current, nearestMountedAncestor, error); } } function safelyDetachRef(current, nearestMountedAncestor) { var ref = current.ref; if (ref !== null) { if (typeof ref === 'function') { var retVal; try { if (enableProfilerTimer && enableProfilerCommitHooks && current.mode & ProfileMode) { try { startLayoutEffectTimer(); retVal = ref(null); } finally { recordLayoutEffectDuration(current); } } else { retVal = ref(null); } } catch (error) { captureCommitPhaseError(current, nearestMountedAncestor, error); } { if (typeof retVal === 'function') { error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current)); } } } else { ref.current = null; } } } function safelyCallDestroy(current, nearestMountedAncestor, destroy) { try { destroy(); } catch (error) { captureCommitPhaseError(current, nearestMountedAncestor, error); } } var focusedInstanceHandle = null; var shouldFireAfterActiveInstanceBlur = false; function commitBeforeMutationEffects(root, firstChild) { focusedInstanceHandle = prepareForCommit(root.containerInfo); nextEffect = firstChild; commitBeforeMutationEffects_begin(); // We no longer need to track the active instance fiber var shouldFire = shouldFireAfterActiveInstanceBlur; shouldFireAfterActiveInstanceBlur = false; focusedInstanceHandle = null; return shouldFire; } function commitBeforeMutationEffects_begin() { while (nextEffect !== null) { var fiber = nextEffect; // This phase is only used for beforeActiveInstanceBlur. var child = fiber.child; if ((fiber.subtreeFlags & BeforeMutationMask) !== NoFlags && child !== null) { child.return = fiber; nextEffect = child; } else { commitBeforeMutationEffects_complete(); } } } function commitBeforeMutationEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; setCurrentFiber(fiber); try { commitBeforeMutationEffectsOnFiber(fiber); } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } resetCurrentFiber(); var sibling = fiber.sibling; if (sibling !== null) { sibling.return = fiber.return; nextEffect = sibling; return; } nextEffect = fiber.return; } } function commitBeforeMutationEffectsOnFiber(finishedWork) { var current = finishedWork.alternate; var flags = finishedWork.flags; if ((flags & Snapshot) !== NoFlags) { setCurrentFiber(finishedWork); switch (finishedWork.tag) { case FunctionComponent: case ForwardRef: case SimpleMemoComponent: { break; } case ClassComponent: { if (current !== null) { var prevProps = current.memoizedProps; var prevState = current.memoizedState; var instance = finishedWork.stateNode; // We could update instance props and state here, // but instead we rely on them being set during last render. // TODO: revisit this when we implement resuming. { if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { if (instance.props !== finishedWork.memoizedProps) { error('Expected %s props to match memoized props before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); } if (instance.state !== finishedWork.memoizedState) { error('Expected %s state to match memoized state before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); } } } var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState); { var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate; if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) { didWarnSet.add(finishedWork.type); error('%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentNameFromFiber(finishedWork)); } } instance.__reactInternalSnapshotBeforeUpdate = snapshot; } break; } case HostRoot: { { var root = finishedWork.stateNode; clearContainer(root.containerInfo); } break; } case HostComponent: case HostText: case HostPortal: case IncompleteClassComponent: // Nothing to do for these component types break; default: { throw new Error('This unit of work tag should not have side-effects. This error is ' + 'likely caused by a bug in React. Please file an issue.'); } } resetCurrentFiber(); } } function commitHookEffectListUnmount(flags, finishedWork, nearestMountedAncestor) { var updateQueue = finishedWork.updateQueue; var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; if (lastEffect !== null) { var firstEffect = lastEffect.next; var effect = firstEffect; do { if ((effect.tag & flags) === flags) { // Unmount var destroy = effect.destroy; effect.destroy = undefined; if (destroy !== undefined) { { if ((flags & Passive$1) !== NoFlags$1) { markComponentPassiveEffectUnmountStarted(finishedWork); } else if ((flags & Layout) !== NoFlags$1) { markComponentLayoutEffectUnmountStarted(finishedWork); } } { if ((flags & Insertion) !== NoFlags$1) { setIsRunningInsertionEffect(true); } } safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy); { if ((flags & Insertion) !== NoFlags$1) { setIsRunningInsertionEffect(false); } } { if ((flags & Passive$1) !== NoFlags$1) { markComponentPassiveEffectUnmountStopped(); } else if ((flags & Layout) !== NoFlags$1) { markComponentLayoutEffectUnmountStopped(); } } } } effect = effect.next; } while (effect !== firstEffect); } } function commitHookEffectListMount(flags, finishedWork) { var updateQueue = finishedWork.updateQueue; var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; if (lastEffect !== null) { var firstEffect = lastEffect.next; var effect = firstEffect; do { if ((effect.tag & flags) === flags) { { if ((flags & Passive$1) !== NoFlags$1) { markComponentPassiveEffectMountStarted(finishedWork); } else if ((flags & Layout) !== NoFlags$1) { markComponentLayoutEffectMountStarted(finishedWork); } } // Mount var create = effect.create; { if ((flags & Insertion) !== NoFlags$1) { setIsRunningInsertionEffect(true); } } effect.destroy = create(); { if ((flags & Insertion) !== NoFlags$1) { setIsRunningInsertionEffect(false); } } { if ((flags & Passive$1) !== NoFlags$1) { markComponentPassiveEffectMountStopped(); } else if ((flags & Layout) !== NoFlags$1) { markComponentLayoutEffectMountStopped(); } } { var destroy = effect.destroy; if (destroy !== undefined && typeof destroy !== 'function') { var hookName = void 0; if ((effect.tag & Layout) !== NoFlags) { hookName = 'useLayoutEffect'; } else if ((effect.tag & Insertion) !== NoFlags) { hookName = 'useInsertionEffect'; } else { hookName = 'useEffect'; } var addendum = void 0; if (destroy === null) { addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).'; } else if (typeof destroy.then === 'function') { addendum = '\n\nIt looks like you wrote ' + hookName + '(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + hookName + '(() => {\n' + ' async function fetchData() {\n' + ' // You can await here\n' + ' const response = await MyAPI.getData(someId);\n' + ' // ...\n' + ' }\n' + ' fetchData();\n' + "}, [someId]); // Or [] if effect doesn't need props or state\n\n" + 'Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching'; } else { addendum = ' You returned: ' + destroy; } error('%s must not return anything besides a function, ' + 'which is used for clean-up.%s', hookName, addendum); } } } effect = effect.next; } while (effect !== firstEffect); } } function commitPassiveEffectDurations(finishedRoot, finishedWork) { { // Only Profilers with work in their subtree will have an Update effect scheduled. if ((finishedWork.flags & Update) !== NoFlags) { switch (finishedWork.tag) { case Profiler: { var passiveEffectDuration = finishedWork.stateNode.passiveEffectDuration; var _finishedWork$memoize = finishedWork.memoizedProps, id = _finishedWork$memoize.id, onPostCommit = _finishedWork$memoize.onPostCommit; // This value will still reflect the previous commit phase. // It does not get reset until the start of the next commit phase. var commitTime = getCommitTime(); var phase = finishedWork.alternate === null ? 'mount' : 'update'; { if (isCurrentUpdateNested()) { phase = 'nested-update'; } } if (typeof onPostCommit === 'function') { onPostCommit(id, phase, passiveEffectDuration, commitTime); } // Bubble times to the next nearest ancestor Profiler. // After we process that Profiler, we'll bubble further up. var parentFiber = finishedWork.return; outer: while (parentFiber !== null) { switch (parentFiber.tag) { case HostRoot: var root = parentFiber.stateNode; root.passiveEffectDuration += passiveEffectDuration; break outer; case Profiler: var parentStateNode = parentFiber.stateNode; parentStateNode.passiveEffectDuration += passiveEffectDuration; break outer; } parentFiber = parentFiber.return; } break; } } } } } function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committedLanes) { if ((finishedWork.flags & LayoutMask) !== NoFlags) { switch (finishedWork.tag) { case FunctionComponent: case ForwardRef: case SimpleMemoComponent: { if ( !offscreenSubtreeWasHidden) { // At this point layout effects have already been destroyed (during mutation phase). // This is done to prevent sibling component effects from interfering with each other, // e.g. a destroy function in one component should never override a ref set // by a create function in another component during the same commit. if ( finishedWork.mode & ProfileMode) { try { startLayoutEffectTimer(); commitHookEffectListMount(Layout | HasEffect, finishedWork); } finally { recordLayoutEffectDuration(finishedWork); } } else { commitHookEffectListMount(Layout | HasEffect, finishedWork); } } break; } case ClassComponent: { var instance = finishedWork.stateNode; if (finishedWork.flags & Update) { if (!offscreenSubtreeWasHidden) { if (current === null) { // We could update instance props and state here, // but instead we rely on them being set during last render. // TODO: revisit this when we implement resuming. { if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { if (instance.props !== finishedWork.memoizedProps) { error('Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); } if (instance.state !== finishedWork.memoizedState) { error('Expected %s state to match memoized state before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); } } } if ( finishedWork.mode & ProfileMode) { try { startLayoutEffectTimer(); instance.componentDidMount(); } finally { recordLayoutEffectDuration(finishedWork); } } else { instance.componentDidMount(); } } else { var prevProps = finishedWork.elementType === finishedWork.type ? current.memoizedProps : resolveDefaultProps(finishedWork.type, current.memoizedProps); var prevState = current.memoizedState; // We could update instance props and state here, // but instead we rely on them being set during last render. // TODO: revisit this when we implement resuming. { if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { if (instance.props !== finishedWork.memoizedProps) { error('Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); } if (instance.state !== finishedWork.memoizedState) { error('Expected %s state to match memoized state before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); } } } if ( finishedWork.mode & ProfileMode) { try { startLayoutEffectTimer(); instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate); } finally { recordLayoutEffectDuration(finishedWork); } } else { instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate); } } } } // TODO: I think this is now always non-null by the time it reaches the // commit phase. Consider removing the type check. var updateQueue = finishedWork.updateQueue; if (updateQueue !== null) { { if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { if (instance.props !== finishedWork.memoizedProps) { error('Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); } if (instance.state !== finishedWork.memoizedState) { error('Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); } } } // We could update instance props and state here, // but instead we rely on them being set during last render. // TODO: revisit this when we implement resuming. commitUpdateQueue(finishedWork, updateQueue, instance); } break; } case HostRoot: { // TODO: I think this is now always non-null by the time it reaches the // commit phase. Consider removing the type check. var _updateQueue = finishedWork.updateQueue; if (_updateQueue !== null) { var _instance = null; if (finishedWork.child !== null) { switch (finishedWork.child.tag) { case HostComponent: _instance = getPublicInstance(finishedWork.child.stateNode); break; case ClassComponent: _instance = finishedWork.child.stateNode; break; } } commitUpdateQueue(finishedWork, _updateQueue, _instance); } break; } case HostComponent: { var _instance2 = finishedWork.stateNode; // Renderers may schedule work to be done after host components are mounted // (eg DOM renderer may schedule auto-focus for inputs and form controls). // These effects should only be committed when components are first mounted, // aka when there is no current/alternate. if (current === null && finishedWork.flags & Update) { var type = finishedWork.type; var props = finishedWork.memoizedProps; commitMount(_instance2, type, props); } break; } case HostText: { // We have no life-cycles associated with text. break; } case HostPortal: { // We have no life-cycles associated with portals. break; } case Profiler: { { var _finishedWork$memoize2 = finishedWork.memoizedProps, onCommit = _finishedWork$memoize2.onCommit, onRender = _finishedWork$memoize2.onRender; var effectDuration = finishedWork.stateNode.effectDuration; var commitTime = getCommitTime(); var phase = current === null ? 'mount' : 'update'; { if (isCurrentUpdateNested()) { phase = 'nested-update'; } } if (typeof onRender === 'function') { onRender(finishedWork.memoizedProps.id, phase, finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, commitTime); } { if (typeof onCommit === 'function') { onCommit(finishedWork.memoizedProps.id, phase, effectDuration, commitTime); } // Schedule a passive effect for this Profiler to call onPostCommit hooks. // This effect should be scheduled even if there is no onPostCommit callback for this Profiler, // because the effect is also where times bubble to parent Profilers. enqueuePendingPassiveProfilerEffect(finishedWork); // Propagate layout effect durations to the next nearest Profiler ancestor. // Do not reset these values until the next render so DevTools has a chance to read them first. var parentFiber = finishedWork.return; outer: while (parentFiber !== null) { switch (parentFiber.tag) { case HostRoot: var root = parentFiber.stateNode; root.effectDuration += effectDuration; break outer; case Profiler: var parentStateNode = parentFiber.stateNode; parentStateNode.effectDuration += effectDuration; break outer; } parentFiber = parentFiber.return; } } } break; } case SuspenseComponent: { commitSuspenseHydrationCallbacks(finishedRoot, finishedWork); break; } case SuspenseListComponent: case IncompleteClassComponent: case ScopeComponent: case OffscreenComponent: case LegacyHiddenComponent: case TracingMarkerComponent: { break; } default: throw new Error('This unit of work tag should not have side-effects. This error is ' + 'likely caused by a bug in React. Please file an issue.'); } } if ( !offscreenSubtreeWasHidden) { { if (finishedWork.flags & Ref) { commitAttachRef(finishedWork); } } } } function reappearLayoutEffectsOnFiber(node) { // Turn on layout effects in a tree that previously disappeared. // TODO (Offscreen) Check: flags & LayoutStatic switch (node.tag) { case FunctionComponent: case ForwardRef: case SimpleMemoComponent: { if ( node.mode & ProfileMode) { try { startLayoutEffectTimer(); safelyCallCommitHookLayoutEffectListMount(node, node.return); } finally { recordLayoutEffectDuration(node); } } else { safelyCallCommitHookLayoutEffectListMount(node, node.return); } break; } case ClassComponent: { var instance = node.stateNode; if (typeof instance.componentDidMount === 'function') { safelyCallComponentDidMount(node, node.return, instance); } safelyAttachRef(node, node.return); break; } case HostComponent: { safelyAttachRef(node, node.return); break; } } } function hideOrUnhideAllChildren(finishedWork, isHidden) { // Only hide or unhide the top-most host nodes. var hostSubtreeRoot = null; { // We only have the top Fiber that was inserted but we need to recurse down its // children to find all the terminal nodes. var node = finishedWork; while (true) { if (node.tag === HostComponent) { if (hostSubtreeRoot === null) { hostSubtreeRoot = node; try { var instance = node.stateNode; if (isHidden) { hideInstance(instance); } else { unhideInstance(node.stateNode, node.memoizedProps); } } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } } else if (node.tag === HostText) { if (hostSubtreeRoot === null) { try { var _instance3 = node.stateNode; if (isHidden) { hideTextInstance(_instance3); } else { unhideTextInstance(_instance3, node.memoizedProps); } } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } } else if ((node.tag === OffscreenComponent || node.tag === LegacyHiddenComponent) && node.memoizedState !== null && node !== finishedWork) ; else if (node.child !== null) { node.child.return = node; node = node.child; continue; } if (node === finishedWork) { return; } while (node.sibling === null) { if (node.return === null || node.return === finishedWork) { return; } if (hostSubtreeRoot === node) { hostSubtreeRoot = null; } node = node.return; } if (hostSubtreeRoot === node) { hostSubtreeRoot = null; } node.sibling.return = node.return; node = node.sibling; } } } function commitAttachRef(finishedWork) { var ref = finishedWork.ref; if (ref !== null) { var instance = finishedWork.stateNode; var instanceToUse; switch (finishedWork.tag) { case HostComponent: instanceToUse = getPublicInstance(instance); break; default: instanceToUse = instance; } // Moved outside to ensure DCE works with this flag if (typeof ref === 'function') { var retVal; if ( finishedWork.mode & ProfileMode) { try { startLayoutEffectTimer(); retVal = ref(instanceToUse); } finally { recordLayoutEffectDuration(finishedWork); } } else { retVal = ref(instanceToUse); } { if (typeof retVal === 'function') { error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(finishedWork)); } } } else { { if (!ref.hasOwnProperty('current')) { error('Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().', getComponentNameFromFiber(finishedWork)); } } ref.current = instanceToUse; } } } function detachFiberMutation(fiber) { // Cut off the return pointer to disconnect it from the tree. // This enables us to detect and warn against state updates on an unmounted component. // It also prevents events from bubbling from within disconnected components. // // Ideally, we should also clear the child pointer of the parent alternate to let this // get GC:ed but we don't know which for sure which parent is the current // one so we'll settle for GC:ing the subtree of this child. // This child itself will be GC:ed when the parent updates the next time. // // Note that we can't clear child or sibling pointers yet. // They're needed for passive effects and for findDOMNode. // We defer those fields, and all other cleanup, to the passive phase (see detachFiberAfterEffects). // // Don't reset the alternate yet, either. We need that so we can detach the // alternate's fields in the passive phase. Clearing the return pointer is // sufficient for findDOMNode semantics. var alternate = fiber.alternate; if (alternate !== null) { alternate.return = null; } fiber.return = null; } function detachFiberAfterEffects(fiber) { var alternate = fiber.alternate; if (alternate !== null) { fiber.alternate = null; detachFiberAfterEffects(alternate); } // Note: Defensively using negation instead of < in case // `deletedTreeCleanUpLevel` is undefined. { // Clear cyclical Fiber fields. This level alone is designed to roughly // approximate the planned Fiber refactor. In that world, `setState` will be // bound to a special "instance" object instead of a Fiber. The Instance // object will not have any of these fields. It will only be connected to // the fiber tree via a single link at the root. So if this level alone is // sufficient to fix memory issues, that bodes well for our plans. fiber.child = null; fiber.deletions = null; fiber.sibling = null; // The `stateNode` is cyclical because on host nodes it points to the host // tree, which has its own pointers to children, parents, and siblings. // The other host nodes also point back to fibers, so we should detach that // one, too. if (fiber.tag === HostComponent) { var hostInstance = fiber.stateNode; if (hostInstance !== null) { detachDeletedInstance(hostInstance); } } fiber.stateNode = null; // I'm intentionally not clearing the `return` field in this level. We // already disconnect the `return` pointer at the root of the deleted // subtree (in `detachFiberMutation`). Besides, `return` by itself is not // cyclical — it's only cyclical when combined with `child`, `sibling`, and // `alternate`. But we'll clear it in the next level anyway, just in case. { fiber._debugOwner = null; } { // Theoretically, nothing in here should be necessary, because we already // disconnected the fiber from the tree. So even if something leaks this // particular fiber, it won't leak anything else // // The purpose of this branch is to be super aggressive so we can measure // if there's any difference in memory impact. If there is, that could // indicate a React leak we don't know about. fiber.return = null; fiber.dependencies = null; fiber.memoizedProps = null; fiber.memoizedState = null; fiber.pendingProps = null; fiber.stateNode = null; // TODO: Move to `commitPassiveUnmountInsideDeletedTreeOnFiber` instead. fiber.updateQueue = null; } } } function getHostParentFiber(fiber) { var parent = fiber.return; while (parent !== null) { if (isHostParent(parent)) { return parent; } parent = parent.return; } throw new Error('Expected to find a host parent. This error is likely caused by a bug ' + 'in React. Please file an issue.'); } function isHostParent(fiber) { return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal; } function getHostSibling(fiber) { // We're going to search forward into the tree until we find a sibling host // node. Unfortunately, if multiple insertions are done in a row we have to // search past them. This leads to exponential search for the next sibling. // TODO: Find a more efficient way to do this. var node = fiber; siblings: while (true) { // If we didn't find anything, let's try the next sibling. while (node.sibling === null) { if (node.return === null || isHostParent(node.return)) { // If we pop out of the root or hit the parent the fiber we are the // last sibling. return null; } node = node.return; } node.sibling.return = node.return; node = node.sibling; while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) { // If it is not host node and, we might have a host node inside it. // Try to search down until we find one. if (node.flags & Placement) { // If we don't have a child, try the siblings instead. continue siblings; } // If we don't have a child, try the siblings instead. // We also skip portals because they are not part of this host tree. if (node.child === null || node.tag === HostPortal) { continue siblings; } else { node.child.return = node; node = node.child; } } // Check if this host node is stable or about to be placed. if (!(node.flags & Placement)) { // Found it! return node.stateNode; } } } function commitPlacement(finishedWork) { var parentFiber = getHostParentFiber(finishedWork); // Note: these two variables *must* always be updated together. switch (parentFiber.tag) { case HostComponent: { var parent = parentFiber.stateNode; if (parentFiber.flags & ContentReset) { // Reset the text content of the parent before doing any insertions resetTextContent(parent); // Clear ContentReset from the effect tag parentFiber.flags &= ~ContentReset; } var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its // children to find all the terminal nodes. insertOrAppendPlacementNode(finishedWork, before, parent); break; } case HostRoot: case HostPortal: { var _parent = parentFiber.stateNode.containerInfo; var _before = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer(finishedWork, _before, _parent); break; } // eslint-disable-next-line-no-fallthrough default: throw new Error('Invalid host parent fiber. This error is likely caused by a bug ' + 'in React. Please file an issue.'); } } function insertOrAppendPlacementNodeIntoContainer(node, before, parent) { var tag = node.tag; var isHost = tag === HostComponent || tag === HostText; if (isHost) { var stateNode = node.stateNode; if (before) { insertInContainerBefore(parent, stateNode, before); } else { appendChildToContainer(parent, stateNode); } } else if (tag === HostPortal) ; else { var child = node.child; if (child !== null) { insertOrAppendPlacementNodeIntoContainer(child, before, parent); var sibling = child.sibling; while (sibling !== null) { insertOrAppendPlacementNodeIntoContainer(sibling, before, parent); sibling = sibling.sibling; } } } } function insertOrAppendPlacementNode(node, before, parent) { var tag = node.tag; var isHost = tag === HostComponent || tag === HostText; if (isHost) { var stateNode = node.stateNode; if (before) { insertBefore(parent, stateNode, before); } else { appendChild(parent, stateNode); } } else if (tag === HostPortal) ; else { var child = node.child; if (child !== null) { insertOrAppendPlacementNode(child, before, parent); var sibling = child.sibling; while (sibling !== null) { insertOrAppendPlacementNode(sibling, before, parent); sibling = sibling.sibling; } } } } // These are tracked on the stack as we recursively traverse a // deleted subtree. // TODO: Update these during the whole mutation phase, not just during // a deletion. var hostParent = null; var hostParentIsContainer = false; function commitDeletionEffects(root, returnFiber, deletedFiber) { { // We only have the top Fiber that was deleted but we need to recurse down its // children to find all the terminal nodes. // Recursively delete all host nodes from the parent, detach refs, clean // up mounted layout effects, and call componentWillUnmount. // We only need to remove the topmost host child in each branch. But then we // still need to keep traversing to unmount effects, refs, and cWU. TODO: We // could split this into two separate traversals functions, where the second // one doesn't include any removeChild logic. This is maybe the same // function as "disappearLayoutEffects" (or whatever that turns into after // the layout phase is refactored to use recursion). // Before starting, find the nearest host parent on the stack so we know // which instance/container to remove the children from. // TODO: Instead of searching up the fiber return path on every deletion, we // can track the nearest host component on the JS stack as we traverse the // tree during the commit phase. This would make insertions faster, too. var parent = returnFiber; findParent: while (parent !== null) { switch (parent.tag) { case HostComponent: { hostParent = parent.stateNode; hostParentIsContainer = false; break findParent; } case HostRoot: { hostParent = parent.stateNode.containerInfo; hostParentIsContainer = true; break findParent; } case HostPortal: { hostParent = parent.stateNode.containerInfo; hostParentIsContainer = true; break findParent; } } parent = parent.return; } if (hostParent === null) { throw new Error('Expected to find a host parent. This error is likely caused by ' + 'a bug in React. Please file an issue.'); } commitDeletionEffectsOnFiber(root, returnFiber, deletedFiber); hostParent = null; hostParentIsContainer = false; } detachFiberMutation(deletedFiber); } function recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, parent) { // TODO: Use a static flag to skip trees that don't have unmount effects var child = parent.child; while (child !== null) { commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, child); child = child.sibling; } } function commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, deletedFiber) { onCommitUnmount(deletedFiber); // The cases in this outer switch modify the stack before they traverse // into their subtree. There are simpler cases in the inner switch // that don't modify the stack. switch (deletedFiber.tag) { case HostComponent: { if (!offscreenSubtreeWasHidden) { safelyDetachRef(deletedFiber, nearestMountedAncestor); } // Intentional fallthrough to next branch } // eslint-disable-next-line-no-fallthrough case HostText: { // We only need to remove the nearest host child. Set the host parent // to `null` on the stack to indicate that nested children don't // need to be removed. { var prevHostParent = hostParent; var prevHostParentIsContainer = hostParentIsContainer; hostParent = null; recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); hostParent = prevHostParent; hostParentIsContainer = prevHostParentIsContainer; if (hostParent !== null) { // Now that all the child effects have unmounted, we can remove the // node from the tree. if (hostParentIsContainer) { removeChildFromContainer(hostParent, deletedFiber.stateNode); } else { removeChild(hostParent, deletedFiber.stateNode); } } } return; } case DehydratedFragment: { // Delete the dehydrated suspense boundary and all of its content. { if (hostParent !== null) { if (hostParentIsContainer) { clearSuspenseBoundaryFromContainer(hostParent, deletedFiber.stateNode); } else { clearSuspenseBoundary(hostParent, deletedFiber.stateNode); } } } return; } case HostPortal: { { // When we go into a portal, it becomes the parent to remove from. var _prevHostParent = hostParent; var _prevHostParentIsContainer = hostParentIsContainer; hostParent = deletedFiber.stateNode.containerInfo; hostParentIsContainer = true; recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); hostParent = _prevHostParent; hostParentIsContainer = _prevHostParentIsContainer; } return; } case FunctionComponent: case ForwardRef: case MemoComponent: case SimpleMemoComponent: { if (!offscreenSubtreeWasHidden) { var updateQueue = deletedFiber.updateQueue; if (updateQueue !== null) { var lastEffect = updateQueue.lastEffect; if (lastEffect !== null) { var firstEffect = lastEffect.next; var effect = firstEffect; do { var _effect = effect, destroy = _effect.destroy, tag = _effect.tag; if (destroy !== undefined) { if ((tag & Insertion) !== NoFlags$1) { safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy); } else if ((tag & Layout) !== NoFlags$1) { { markComponentLayoutEffectUnmountStarted(deletedFiber); } if ( deletedFiber.mode & ProfileMode) { startLayoutEffectTimer(); safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy); recordLayoutEffectDuration(deletedFiber); } else { safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy); } { markComponentLayoutEffectUnmountStopped(); } } } effect = effect.next; } while (effect !== firstEffect); } } } recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); return; } case ClassComponent: { if (!offscreenSubtreeWasHidden) { safelyDetachRef(deletedFiber, nearestMountedAncestor); var instance = deletedFiber.stateNode; if (typeof instance.componentWillUnmount === 'function') { safelyCallComponentWillUnmount(deletedFiber, nearestMountedAncestor, instance); } } recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); return; } case ScopeComponent: { recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); return; } case OffscreenComponent: { if ( // TODO: Remove this dead flag deletedFiber.mode & ConcurrentMode) { // If this offscreen component is hidden, we already unmounted it. Before // deleting the children, track that it's already unmounted so that we // don't attempt to unmount the effects again. // TODO: If the tree is hidden, in most cases we should be able to skip // over the nested children entirely. An exception is we haven't yet found // the topmost host node to delete, which we already track on the stack. // But the other case is portals, which need to be detached no matter how // deeply they are nested. We should use a subtree flag to track whether a // subtree includes a nested portal. var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || deletedFiber.memoizedState !== null; recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; } else { recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); } break; } default: { recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); return; } } } function commitSuspenseCallback(finishedWork) { // TODO: Move this to passive phase var newState = finishedWork.memoizedState; } function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) { var newState = finishedWork.memoizedState; if (newState === null) { var current = finishedWork.alternate; if (current !== null) { var prevState = current.memoizedState; if (prevState !== null) { var suspenseInstance = prevState.dehydrated; if (suspenseInstance !== null) { commitHydratedSuspenseInstance(suspenseInstance); } } } } } function attachSuspenseRetryListeners(finishedWork) { // If this boundary just timed out, then it will have a set of wakeables. // For each wakeable, attach a listener so that when it resolves, React // attempts to re-render the boundary in the primary (pre-timeout) state. var wakeables = finishedWork.updateQueue; if (wakeables !== null) { finishedWork.updateQueue = null; var retryCache = finishedWork.stateNode; if (retryCache === null) { retryCache = finishedWork.stateNode = new PossiblyWeakSet(); } wakeables.forEach(function (wakeable) { // Memoize using the boundary fiber to prevent redundant listeners. var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); if (!retryCache.has(wakeable)) { retryCache.add(wakeable); { if (isDevToolsPresent) { if (inProgressLanes !== null && inProgressRoot !== null) { // If we have pending work still, associate the original updaters with it. restorePendingUpdaters(inProgressRoot, inProgressLanes); } else { throw Error('Expected finished root and lanes to be set. This is a bug in React.'); } } } wakeable.then(retry, retry); } }); } } // This function detects when a Suspense boundary goes from visible to hidden. function commitMutationEffects(root, finishedWork, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; setCurrentFiber(finishedWork); commitMutationEffectsOnFiber(finishedWork, root); setCurrentFiber(finishedWork); inProgressLanes = null; inProgressRoot = null; } function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { // Deletions effects can be scheduled on any fiber type. They need to happen // before the children effects hae fired. var deletions = parentFiber.deletions; if (deletions !== null) { for (var i = 0; i < deletions.length; i++) { var childToDelete = deletions[i]; try { commitDeletionEffects(root, parentFiber, childToDelete); } catch (error) { captureCommitPhaseError(childToDelete, parentFiber, error); } } } var prevDebugFiber = getCurrentFiber(); if (parentFiber.subtreeFlags & MutationMask) { var child = parentFiber.child; while (child !== null) { setCurrentFiber(child); commitMutationEffectsOnFiber(child, root); child = child.sibling; } } setCurrentFiber(prevDebugFiber); } function commitMutationEffectsOnFiber(finishedWork, root, lanes) { var current = finishedWork.alternate; var flags = finishedWork.flags; // The effect flag should be checked *after* we refine the type of fiber, // because the fiber tag is more specific. An exception is any flag related // to reconcilation, because those can be set on all fiber types. switch (finishedWork.tag) { case FunctionComponent: case ForwardRef: case MemoComponent: case SimpleMemoComponent: { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); if (flags & Update) { try { commitHookEffectListUnmount(Insertion | HasEffect, finishedWork, finishedWork.return); commitHookEffectListMount(Insertion | HasEffect, finishedWork); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } // Layout effects are destroyed during the mutation phase so that all // destroy functions for all fibers are called before any create functions. // This prevents sibling component effects from interfering with each other, // e.g. a destroy function in one component should never override a ref set // by a create function in another component during the same commit. if ( finishedWork.mode & ProfileMode) { try { startLayoutEffectTimer(); commitHookEffectListUnmount(Layout | HasEffect, finishedWork, finishedWork.return); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } recordLayoutEffectDuration(finishedWork); } else { try { commitHookEffectListUnmount(Layout | HasEffect, finishedWork, finishedWork.return); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } } return; } case ClassComponent: { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); if (flags & Ref) { if (current !== null) { safelyDetachRef(current, current.return); } } return; } case HostComponent: { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); if (flags & Ref) { if (current !== null) { safelyDetachRef(current, current.return); } } { // TODO: ContentReset gets cleared by the children during the commit // phase. This is a refactor hazard because it means we must read // flags the flags after `commitReconciliationEffects` has already run; // the order matters. We should refactor so that ContentReset does not // rely on mutating the flag during commit. Like by setting a flag // during the render phase instead. if (finishedWork.flags & ContentReset) { var instance = finishedWork.stateNode; try { resetTextContent(instance); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } if (flags & Update) { var _instance4 = finishedWork.stateNode; if (_instance4 != null) { // Commit the work prepared earlier. var newProps = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps // as the newProps. The updatePayload will contain the real change in // this case. var oldProps = current !== null ? current.memoizedProps : newProps; var type = finishedWork.type; // TODO: Type the updateQueue to be specific to host components. var updatePayload = finishedWork.updateQueue; finishedWork.updateQueue = null; if (updatePayload !== null) { try { commitUpdate(_instance4, updatePayload, type, oldProps, newProps, finishedWork); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } } } } return; } case HostText: { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); if (flags & Update) { { if (finishedWork.stateNode === null) { throw new Error('This should have a text node initialized. This error is likely ' + 'caused by a bug in React. Please file an issue.'); } var textInstance = finishedWork.stateNode; var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps // as the newProps. The updatePayload will contain the real change in // this case. var oldText = current !== null ? current.memoizedProps : newText; try { commitTextUpdate(textInstance, oldText, newText); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } } return; } case HostRoot: { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); if (flags & Update) { { if (current !== null) { var prevRootState = current.memoizedState; if (prevRootState.isDehydrated) { try { commitHydratedContainer(root.containerInfo); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } } } } return; } case HostPortal: { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); return; } case SuspenseComponent: { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); var offscreenFiber = finishedWork.child; if (offscreenFiber.flags & Visibility) { var offscreenInstance = offscreenFiber.stateNode; var newState = offscreenFiber.memoizedState; var isHidden = newState !== null; // Track the current state on the Offscreen instance so we can // read it during an event offscreenInstance.isHidden = isHidden; if (isHidden) { var wasHidden = offscreenFiber.alternate !== null && offscreenFiber.alternate.memoizedState !== null; if (!wasHidden) { // TODO: Move to passive phase markCommitTimeOfFallback(); } } } if (flags & Update) { try { commitSuspenseCallback(finishedWork); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } attachSuspenseRetryListeners(finishedWork); } return; } case OffscreenComponent: { var _wasHidden = current !== null && current.memoizedState !== null; if ( // TODO: Remove this dead flag finishedWork.mode & ConcurrentMode) { // Before committing the children, track on the stack whether this // offscreen subtree was already hidden, so that we don't unmount the // effects again. var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || _wasHidden; recursivelyTraverseMutationEffects(root, finishedWork); offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; } else { recursivelyTraverseMutationEffects(root, finishedWork); } commitReconciliationEffects(finishedWork); if (flags & Visibility) { var _offscreenInstance = finishedWork.stateNode; var _newState = finishedWork.memoizedState; var _isHidden = _newState !== null; var offscreenBoundary = finishedWork; // Track the current state on the Offscreen instance so we can // read it during an event _offscreenInstance.isHidden = _isHidden; { if (_isHidden) { if (!_wasHidden) { if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) { nextEffect = offscreenBoundary; var offscreenChild = offscreenBoundary.child; while (offscreenChild !== null) { nextEffect = offscreenChild; disappearLayoutEffects_begin(offscreenChild); offscreenChild = offscreenChild.sibling; } } } } } { // TODO: This needs to run whenever there's an insertion or update // inside a hidden Offscreen tree. hideOrUnhideAllChildren(offscreenBoundary, _isHidden); } } return; } case SuspenseListComponent: { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); if (flags & Update) { attachSuspenseRetryListeners(finishedWork); } return; } case ScopeComponent: { return; } default: { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); return; } } } function commitReconciliationEffects(finishedWork) { // Placement effects (insertions, reorders) can be scheduled on any fiber // type. They needs to happen after the children effects have fired, but // before the effects on this fiber have fired. var flags = finishedWork.flags; if (flags & Placement) { try { commitPlacement(finishedWork); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } // Clear the "placement" from effect tag so that we know that this is // inserted, before any life-cycles like componentDidMount gets called. // TODO: findDOMNode doesn't rely on this any more but isMounted does // and isMounted is deprecated anyway so we should be able to kill this. finishedWork.flags &= ~Placement; } if (flags & Hydrating) { finishedWork.flags &= ~Hydrating; } } function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; nextEffect = finishedWork; commitLayoutEffects_begin(finishedWork, root, committedLanes); inProgressLanes = null; inProgressRoot = null; } function commitLayoutEffects_begin(subtreeRoot, root, committedLanes) { // Suspense layout effects semantics don't change for legacy roots. var isModernRoot = (subtreeRoot.mode & ConcurrentMode) !== NoMode; while (nextEffect !== null) { var fiber = nextEffect; var firstChild = fiber.child; if ( fiber.tag === OffscreenComponent && isModernRoot) { // Keep track of the current Offscreen stack's state. var isHidden = fiber.memoizedState !== null; var newOffscreenSubtreeIsHidden = isHidden || offscreenSubtreeIsHidden; if (newOffscreenSubtreeIsHidden) { // The Offscreen tree is hidden. Skip over its layout effects. commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes); continue; } else { // TODO (Offscreen) Also check: subtreeFlags & LayoutMask var current = fiber.alternate; var wasHidden = current !== null && current.memoizedState !== null; var newOffscreenSubtreeWasHidden = wasHidden || offscreenSubtreeWasHidden; var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden; var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; // Traverse the Offscreen subtree with the current Offscreen as the root. offscreenSubtreeIsHidden = newOffscreenSubtreeIsHidden; offscreenSubtreeWasHidden = newOffscreenSubtreeWasHidden; if (offscreenSubtreeWasHidden && !prevOffscreenSubtreeWasHidden) { // This is the root of a reappearing boundary. Turn its layout effects // back on. nextEffect = fiber; reappearLayoutEffects_begin(fiber); } var child = firstChild; while (child !== null) { nextEffect = child; commitLayoutEffects_begin(child, // New root; bubble back up to here and stop. root, committedLanes); child = child.sibling; } // Restore Offscreen state and resume in our-progress traversal. nextEffect = fiber; offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes); continue; } } if ((fiber.subtreeFlags & LayoutMask) !== NoFlags && firstChild !== null) { firstChild.return = fiber; nextEffect = firstChild; } else { commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes); } } } function commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes) { while (nextEffect !== null) { var fiber = nextEffect; if ((fiber.flags & LayoutMask) !== NoFlags) { var current = fiber.alternate; setCurrentFiber(fiber); try { commitLayoutEffectOnFiber(root, current, fiber, committedLanes); } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } resetCurrentFiber(); } if (fiber === subtreeRoot) { nextEffect = null; return; } var sibling = fiber.sibling; if (sibling !== null) { sibling.return = fiber.return; nextEffect = sibling; return; } nextEffect = fiber.return; } } function disappearLayoutEffects_begin(subtreeRoot) { while (nextEffect !== null) { var fiber = nextEffect; var firstChild = fiber.child; // TODO (Offscreen) Check: flags & (RefStatic | LayoutStatic) switch (fiber.tag) { case FunctionComponent: case ForwardRef: case MemoComponent: case SimpleMemoComponent: { if ( fiber.mode & ProfileMode) { try { startLayoutEffectTimer(); commitHookEffectListUnmount(Layout, fiber, fiber.return); } finally { recordLayoutEffectDuration(fiber); } } else { commitHookEffectListUnmount(Layout, fiber, fiber.return); } break; } case ClassComponent: { // TODO (Offscreen) Check: flags & RefStatic safelyDetachRef(fiber, fiber.return); var instance = fiber.stateNode; if (typeof instance.componentWillUnmount === 'function') { safelyCallComponentWillUnmount(fiber, fiber.return, instance); } break; } case HostComponent: { safelyDetachRef(fiber, fiber.return); break; } case OffscreenComponent: { // Check if this is a var isHidden = fiber.memoizedState !== null; if (isHidden) { // Nested Offscreen tree is already hidden. Don't disappear // its effects. disappearLayoutEffects_complete(subtreeRoot); continue; } break; } } // TODO (Offscreen) Check: subtreeFlags & LayoutStatic if (firstChild !== null) { firstChild.return = fiber; nextEffect = firstChild; } else { disappearLayoutEffects_complete(subtreeRoot); } } } function disappearLayoutEffects_complete(subtreeRoot) { while (nextEffect !== null) { var fiber = nextEffect; if (fiber === subtreeRoot) { nextEffect = null; return; } var sibling = fiber.sibling; if (sibling !== null) { sibling.return = fiber.return; nextEffect = sibling; return; } nextEffect = fiber.return; } } function reappearLayoutEffects_begin(subtreeRoot) { while (nextEffect !== null) { var fiber = nextEffect; var firstChild = fiber.child; if (fiber.tag === OffscreenComponent) { var isHidden = fiber.memoizedState !== null; if (isHidden) { // Nested Offscreen tree is still hidden. Don't re-appear its effects. reappearLayoutEffects_complete(subtreeRoot); continue; } } // TODO (Offscreen) Check: subtreeFlags & LayoutStatic if (firstChild !== null) { // This node may have been reused from a previous render, so we can't // assume its return pointer is correct. firstChild.return = fiber; nextEffect = firstChild; } else { reappearLayoutEffects_complete(subtreeRoot); } } } function reappearLayoutEffects_complete(subtreeRoot) { while (nextEffect !== null) { var fiber = nextEffect; // TODO (Offscreen) Check: flags & LayoutStatic setCurrentFiber(fiber); try { reappearLayoutEffectsOnFiber(fiber); } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } resetCurrentFiber(); if (fiber === subtreeRoot) { nextEffect = null; return; } var sibling = fiber.sibling; if (sibling !== null) { // This node may have been reused from a previous render, so we can't // assume its return pointer is correct. sibling.return = fiber.return; nextEffect = sibling; return; } nextEffect = fiber.return; } } function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { nextEffect = finishedWork; commitPassiveMountEffects_begin(finishedWork, root, committedLanes, committedTransitions); } function commitPassiveMountEffects_begin(subtreeRoot, root, committedLanes, committedTransitions) { while (nextEffect !== null) { var fiber = nextEffect; var firstChild = fiber.child; if ((fiber.subtreeFlags & PassiveMask) !== NoFlags && firstChild !== null) { firstChild.return = fiber; nextEffect = firstChild; } else { commitPassiveMountEffects_complete(subtreeRoot, root, committedLanes, committedTransitions); } } } function commitPassiveMountEffects_complete(subtreeRoot, root, committedLanes, committedTransitions) { while (nextEffect !== null) { var fiber = nextEffect; if ((fiber.flags & Passive) !== NoFlags) { setCurrentFiber(fiber); try { commitPassiveMountOnFiber(root, fiber, committedLanes, committedTransitions); } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } resetCurrentFiber(); } if (fiber === subtreeRoot) { nextEffect = null; return; } var sibling = fiber.sibling; if (sibling !== null) { sibling.return = fiber.return; nextEffect = sibling; return; } nextEffect = fiber.return; } } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { switch (finishedWork.tag) { case FunctionComponent: case ForwardRef: case SimpleMemoComponent: { if ( finishedWork.mode & ProfileMode) { startPassiveEffectTimer(); try { commitHookEffectListMount(Passive$1 | HasEffect, finishedWork); } finally { recordPassiveEffectDuration(finishedWork); } } else { commitHookEffectListMount(Passive$1 | HasEffect, finishedWork); } break; } } } function commitPassiveUnmountEffects(firstChild) { nextEffect = firstChild; commitPassiveUnmountEffects_begin(); } function commitPassiveUnmountEffects_begin() { while (nextEffect !== null) { var fiber = nextEffect; var child = fiber.child; if ((nextEffect.flags & ChildDeletion) !== NoFlags) { var deletions = fiber.deletions; if (deletions !== null) { for (var i = 0; i < deletions.length; i++) { var fiberToDelete = deletions[i]; nextEffect = fiberToDelete; commitPassiveUnmountEffectsInsideOfDeletedTree_begin(fiberToDelete, fiber); } { // A fiber was deleted from this parent fiber, but it's still part of // the previous (alternate) parent fiber's list of children. Because // children are a linked list, an earlier sibling that's still alive // will be connected to the deleted fiber via its `alternate`: // // live fiber // --alternate--> previous live fiber // --sibling--> deleted fiber // // We can't disconnect `alternate` on nodes that haven't been deleted // yet, but we can disconnect the `sibling` and `child` pointers. var previousFiber = fiber.alternate; if (previousFiber !== null) { var detachedChild = previousFiber.child; if (detachedChild !== null) { previousFiber.child = null; do { var detachedSibling = detachedChild.sibling; detachedChild.sibling = null; detachedChild = detachedSibling; } while (detachedChild !== null); } } } nextEffect = fiber; } } if ((fiber.subtreeFlags & PassiveMask) !== NoFlags && child !== null) { child.return = fiber; nextEffect = child; } else { commitPassiveUnmountEffects_complete(); } } } function commitPassiveUnmountEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; if ((fiber.flags & Passive) !== NoFlags) { setCurrentFiber(fiber); commitPassiveUnmountOnFiber(fiber); resetCurrentFiber(); } var sibling = fiber.sibling; if (sibling !== null) { sibling.return = fiber.return; nextEffect = sibling; return; } nextEffect = fiber.return; } } function commitPassiveUnmountOnFiber(finishedWork) { switch (finishedWork.tag) { case FunctionComponent: case ForwardRef: case SimpleMemoComponent: { if ( finishedWork.mode & ProfileMode) { startPassiveEffectTimer(); commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork, finishedWork.return); recordPassiveEffectDuration(finishedWork); } else { commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork, finishedWork.return); } break; } } } function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot, nearestMountedAncestor) { while (nextEffect !== null) { var fiber = nextEffect; // Deletion effects fire in parent -> child order // TODO: Check if fiber has a PassiveStatic flag setCurrentFiber(fiber); commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); resetCurrentFiber(); var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. (But, if we // do this, still need to handle `deletedTreeCleanUpLevel` correctly.) if (child !== null) { child.return = fiber; nextEffect = child; } else { commitPassiveUnmountEffectsInsideOfDeletedTree_complete(deletedSubtreeRoot); } } } function commitPassiveUnmountEffectsInsideOfDeletedTree_complete(deletedSubtreeRoot) { while (nextEffect !== null) { var fiber = nextEffect; var sibling = fiber.sibling; var returnFiber = fiber.return; { // Recursively traverse the entire deleted tree and clean up fiber fields. // This is more aggressive than ideal, and the long term goal is to only // have to detach the deleted tree at the root. detachFiberAfterEffects(fiber); if (fiber === deletedSubtreeRoot) { nextEffect = null; return; } } if (sibling !== null) { sibling.return = returnFiber; nextEffect = sibling; return; } nextEffect = returnFiber; } } function commitPassiveUnmountInsideDeletedTreeOnFiber(current, nearestMountedAncestor) { switch (current.tag) { case FunctionComponent: case ForwardRef: case SimpleMemoComponent: { if ( current.mode & ProfileMode) { startPassiveEffectTimer(); commitHookEffectListUnmount(Passive$1, current, nearestMountedAncestor); recordPassiveEffectDuration(current); } else { commitHookEffectListUnmount(Passive$1, current, nearestMountedAncestor); } break; } } } // TODO: Reuse reappearLayoutEffects traversal here? function invokeLayoutEffectMountInDEV(fiber) { { // We don't need to re-check StrictEffectsMode here. // This function is only called if that check has already passed. switch (fiber.tag) { case FunctionComponent: case ForwardRef: case SimpleMemoComponent: { try { commitHookEffectListMount(Layout | HasEffect, fiber); } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } break; } case ClassComponent: { var instance = fiber.stateNode; try { instance.componentDidMount(); } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } break; } } } } function invokePassiveEffectMountInDEV(fiber) { { // We don't need to re-check StrictEffectsMode here. // This function is only called if that check has already passed. switch (fiber.tag) { case FunctionComponent: case ForwardRef: case SimpleMemoComponent: { try { commitHookEffectListMount(Passive$1 | HasEffect, fiber); } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } break; } } } } function invokeLayoutEffectUnmountInDEV(fiber) { { // We don't need to re-check StrictEffectsMode here. // This function is only called if that check has already passed. switch (fiber.tag) { case FunctionComponent: case ForwardRef: case SimpleMemoComponent: { try { commitHookEffectListUnmount(Layout | HasEffect, fiber, fiber.return); } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } break; } case ClassComponent: { var instance = fiber.stateNode; if (typeof instance.componentWillUnmount === 'function') { safelyCallComponentWillUnmount(fiber, fiber.return, instance); } break; } } } } function invokePassiveEffectUnmountInDEV(fiber) { { // We don't need to re-check StrictEffectsMode here. // This function is only called if that check has already passed. switch (fiber.tag) { case FunctionComponent: case ForwardRef: case SimpleMemoComponent: { try { commitHookEffectListUnmount(Passive$1 | HasEffect, fiber, fiber.return); } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } } } } } var COMPONENT_TYPE = 0; var HAS_PSEUDO_CLASS_TYPE = 1; var ROLE_TYPE = 2; var TEST_NAME_TYPE = 3; var TEXT_TYPE = 4; if (typeof Symbol === 'function' && Symbol.for) { var symbolFor = Symbol.for; COMPONENT_TYPE = symbolFor('selector.component'); HAS_PSEUDO_CLASS_TYPE = symbolFor('selector.has_pseudo_class'); ROLE_TYPE = symbolFor('selector.role'); TEST_NAME_TYPE = symbolFor('selector.test_id'); TEXT_TYPE = symbolFor('selector.text'); } var commitHooks = []; function onCommitRoot$1() { { commitHooks.forEach(function (commitHook) { return commitHook(); }); } } var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; function isLegacyActEnvironment(fiber) { { // Legacy mode. We preserve the behavior of React 17's act. It assumes an // act environment whenever `jest` is defined, but you can still turn off // spurious warnings by setting IS_REACT_ACT_ENVIRONMENT explicitly // to false. var isReactActEnvironmentGlobal = // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global typeof IS_REACT_ACT_ENVIRONMENT !== 'undefined' ? IS_REACT_ACT_ENVIRONMENT : undefined; // $FlowExpectedError - Flow doesn't know about jest var jestIsDefined = typeof jest !== 'undefined'; return jestIsDefined && isReactActEnvironmentGlobal !== false; } } function isConcurrentActEnvironment() { { var isReactActEnvironmentGlobal = // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global typeof IS_REACT_ACT_ENVIRONMENT !== 'undefined' ? IS_REACT_ACT_ENVIRONMENT : undefined; if (!isReactActEnvironmentGlobal && ReactCurrentActQueue.current !== null) { // TODO: Include link to relevant documentation page. error('The current testing environment is not configured to support ' + 'act(...)'); } return isReactActEnvironmentGlobal; } } var ceil = Math.ceil; var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, ReactCurrentBatchConfig$3 = ReactSharedInternals.ReactCurrentBatchConfig, ReactCurrentActQueue$1 = ReactSharedInternals.ReactCurrentActQueue; var NoContext = /* */ 0; var BatchedContext = /* */ 1; var RenderContext = /* */ 2; var CommitContext = /* */ 4; var RootInProgress = 0; var RootFatalErrored = 1; var RootErrored = 2; var RootSuspended = 3; var RootSuspendedWithDelay = 4; var RootCompleted = 5; var RootDidNotComplete = 6; // Describes where we are in the React execution stack var executionContext = NoContext; // The root we're working on var workInProgressRoot = null; // The fiber we're working on var workInProgress = null; // The lanes we're rendering var workInProgressRootRenderLanes = NoLanes; // Stack that allows components to change the render lanes for its subtree // This is a superset of the lanes we started working on at the root. The only // case where it's different from `workInProgressRootRenderLanes` is when we // enter a subtree that is hidden and needs to be unhidden: Suspense and // Offscreen component. // // Most things in the work loop should deal with workInProgressRootRenderLanes. // Most things in begin/complete phases should deal with subtreeRenderLanes. var subtreeRenderLanes = NoLanes; var subtreeRenderLanesCursor = createCursor(NoLanes); // Whether to root completed, errored, suspended, etc. var workInProgressRootExitStatus = RootInProgress; // A fatal error, if one is thrown var workInProgressRootFatalError = null; // "Included" lanes refer to lanes that were worked on during this render. It's // slightly different than `renderLanes` because `renderLanes` can change as you // enter and exit an Offscreen tree. This value is the combination of all render // lanes for the entire render phase. var workInProgressRootIncludedLanes = NoLanes; // The work left over by components that were visited during this render. Only // includes unprocessed updates, not work in bailed out children. var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an interleaved event) during this render. var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase. var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI. // We will log them once the tree commits. var workInProgressRootRecoverableErrors = null; // The most recent time we committed a fallback. This lets us ensure a train // model where we don't commit new loading states in too quick succession. var globalMostRecentFallbackTime = 0; var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering // more and prefer CPU suspense heuristics instead. var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU // suspense heuristics and opt out of rendering more content. var RENDER_TIMEOUT_MS = 500; var workInProgressTransitions = null; function resetRenderTimer() { workInProgressRootRenderTargetTime = now() + RENDER_TIMEOUT_MS; } function getRenderTargetTime() { return workInProgressRootRenderTargetTime; } var hasUncaughtError = false; var firstUncaughtError = null; var legacyErrorBoundariesThatAlreadyFailed = null; // Only used when enableProfilerNestedUpdateScheduledHook is true; var rootDoesHavePassiveEffects = false; var rootWithPendingPassiveEffects = null; var pendingPassiveEffectsLanes = NoLanes; var pendingPassiveProfilerEffects = []; var pendingPassiveTransitions = null; // Use these to prevent an infinite loop of nested updates var NESTED_UPDATE_LIMIT = 50; var nestedUpdateCount = 0; var rootWithNestedUpdates = null; var isFlushingPassiveEffects = false; var didScheduleUpdateDuringPassiveEffects = false; var NESTED_PASSIVE_UPDATE_LIMIT = 50; var nestedPassiveUpdateCount = 0; var rootWithPassiveNestedUpdates = null; // If two updates are scheduled within the same event, we should treat their // event times as simultaneous, even if the actual clock time has advanced // between the first and second call. var currentEventTime = NoTimestamp; var currentEventTransitionLane = NoLanes; var isRunningInsertionEffect = false; function getWorkInProgressRoot() { return workInProgressRoot; } function requestEventTime() { if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { // We're inside React, so it's fine to read the actual time. return now(); } // We're not inside React, so we may be in the middle of a browser event. if (currentEventTime !== NoTimestamp) { // Use the same start time for all updates until we enter React again. return currentEventTime; } // This is the first update since React yielded. Compute a new start time. currentEventTime = now(); return currentEventTime; } function requestUpdateLane(fiber) { // Special cases var mode = fiber.mode; if ((mode & ConcurrentMode) === NoMode) { return SyncLane; } else if ( (executionContext & RenderContext) !== NoContext && workInProgressRootRenderLanes !== NoLanes) { // This is a render phase update. These are not officially supported. The // old behavior is to give this the same "thread" (lanes) as // whatever is currently rendering. So if you call `setState` on a component // that happens later in the same render, it will flush. Ideally, we want to // remove the special case and treat them as if they came from an // interleaved event. Regardless, this pattern is not officially supported. // This behavior is only a fallback. The flag only exists until we can roll // out the setState warning, since existing code might accidentally rely on // the current behavior. return pickArbitraryLane(workInProgressRootRenderLanes); } var isTransition = requestCurrentTransition() !== NoTransition; if (isTransition) { if ( ReactCurrentBatchConfig$3.transition !== null) { var transition = ReactCurrentBatchConfig$3.transition; if (!transition._updatedFibers) { transition._updatedFibers = new Set(); } transition._updatedFibers.add(fiber); } // The algorithm for assigning an update to a lane should be stable for all // updates at the same priority within the same event. To do this, the // inputs to the algorithm must be the same. // // The trick we use is to cache the first of each of these inputs within an // event. Then reset the cached values once we can be sure the event is // over. Our heuristic for that is whenever we enter a concurrent work loop. if (currentEventTransitionLane === NoLane) { // All transitions within the same event are assigned the same lane. currentEventTransitionLane = claimNextTransitionLane(); } return currentEventTransitionLane; } // Updates originating inside certain React methods, like flushSync, have // their priority set by tracking it with a context variable. // // The opaque type returned by the host config is internally a lane, so we can // use that directly. // TODO: Move this type conversion to the event priority module. var updateLane = getCurrentUpdatePriority(); if (updateLane !== NoLane) { return updateLane; } // This update originated outside React. Ask the host environment for an // appropriate priority, based on the type of event. // // The opaque type returned by the host config is internally a lane, so we can // use that directly. // TODO: Move this type conversion to the event priority module. var eventLane = getCurrentEventPriority(); return eventLane; } function requestRetryLane(fiber) { // This is a fork of `requestUpdateLane` designed specifically for Suspense // "retries" — a special update that attempts to flip a Suspense boundary // from its placeholder state to its primary/resolved state. // Special cases var mode = fiber.mode; if ((mode & ConcurrentMode) === NoMode) { return SyncLane; } return claimNextRetryLane(); } function scheduleUpdateOnFiber(root, fiber, lane, eventTime) { checkForNestedUpdates(); { if (isRunningInsertionEffect) { error('useInsertionEffect must not schedule updates.'); } } { if (isFlushingPassiveEffects) { didScheduleUpdateDuringPassiveEffects = true; } } // Mark that the root has a pending update. markRootUpdated(root, lane, eventTime); if ((executionContext & RenderContext) !== NoLanes && root === workInProgressRoot) { // This update was dispatched during the render phase. This is a mistake // if the update originates from user space (with the exception of local // hook updates, which are handled differently and don't reach this // function), but there are some internal React features that use this as // an implementation detail, like selective hydration. warnAboutRenderPhaseUpdatesInDEV(fiber); // Track lanes that were updated during the render phase } else { // This is a normal update, scheduled from outside the render phase. For // example, during an input event. { if (isDevToolsPresent) { addFiberToLanesMap(root, fiber, lane); } } warnIfUpdatesNotWrappedWithActDEV(fiber); if (root === workInProgressRoot) { // Received an update to a tree that's in the middle of rendering. Mark // that there was an interleaved update work on this root. Unless the // `deferRenderPhaseUpdateToNextBatch` flag is off and this is a render // phase update. In that case, we don't treat render phase updates as if // they were interleaved, for backwards compat reasons. if ( (executionContext & RenderContext) === NoContext) { workInProgressRootInterleavedUpdatedLanes = mergeLanes(workInProgressRootInterleavedUpdatedLanes, lane); } if (workInProgressRootExitStatus === RootSuspendedWithDelay) { // The root already suspended with a delay, which means this render // definitely won't finish. Since we have a new update, let's mark it as // suspended now, right before marking the incoming update. This has the // effect of interrupting the current render and switching to the update. // TODO: Make sure this doesn't override pings that happen while we've // already started rendering. markRootSuspended$1(root, workInProgressRootRenderLanes); } } ensureRootIsScheduled(root, eventTime); if (lane === SyncLane && executionContext === NoContext && (fiber.mode & ConcurrentMode) === NoMode && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. !( ReactCurrentActQueue$1.isBatchingLegacy)) { // Flush the synchronous work now, unless we're already working or inside // a batch. This is intentionally inside scheduleUpdateOnFiber instead of // scheduleCallbackForFiber to preserve the ability to schedule a callback // without immediately flushing it. We only do this for user-initiated // updates, to preserve historical behavior of legacy mode. resetRenderTimer(); flushSyncCallbacksOnlyInLegacyMode(); } } } function scheduleInitialHydrationOnRoot(root, lane, eventTime) { // This is a special fork of scheduleUpdateOnFiber that is only used to // schedule the initial hydration of a root that has just been created. Most // of the stuff in scheduleUpdateOnFiber can be skipped. // // The main reason for this separate path, though, is to distinguish the // initial children from subsequent updates. In fully client-rendered roots // (createRoot instead of hydrateRoot), all top-level renders are modeled as // updates, but hydration roots are special because the initial render must // match what was rendered on the server. var current = root.current; current.lanes = lane; markRootUpdated(root, lane, eventTime); ensureRootIsScheduled(root, eventTime); } function isUnsafeClassRenderPhaseUpdate(fiber) { // Check if this is a render phase update. Only called by class components, // which special (deprecated) behavior for UNSAFE_componentWillReceive props. return (// TODO: Remove outdated deferRenderPhaseUpdateToNextBatch experiment. We // decided not to enable it. (executionContext & RenderContext) !== NoContext ); } // Use this function to schedule a task for a root. There's only one task per // root; if a task was already scheduled, we'll check to make sure the priority // of the existing task is the same as the priority of the next level that the // root has work on. This function is called on every update, and right before // exiting a task. function ensureRootIsScheduled(root, currentTime) { var existingCallbackNode = root.callbackNode; // Check if any lanes are being starved by other work. If so, mark them as // expired so we know to work on those next. markStarvedLanesAsExpired(root, currentTime); // Determine the next lanes to work on, and their priority. var nextLanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes); if (nextLanes === NoLanes) { // Special case: There's nothing to work on. if (existingCallbackNode !== null) { cancelCallback$1(existingCallbackNode); } root.callbackNode = null; root.callbackPriority = NoLane; return; } // We use the highest priority lane to represent the priority of the callback. var newCallbackPriority = getHighestPriorityLane(nextLanes); // Check if there's an existing task. We may be able to reuse it. var existingCallbackPriority = root.callbackPriority; if (existingCallbackPriority === newCallbackPriority && // Special case related to `act`. If the currently scheduled task is a // Scheduler task, rather than an `act` task, cancel it and re-scheduled // on the `act` queue. !( ReactCurrentActQueue$1.current !== null && existingCallbackNode !== fakeActCallbackNode)) { { // If we're going to re-use an existing task, it needs to exist. // Assume that discrete update microtasks are non-cancellable and null. // TODO: Temporary until we confirm this warning is not fired. if (existingCallbackNode == null && existingCallbackPriority !== SyncLane) { error('Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.'); } } // The priority hasn't changed. We can reuse the existing task. Exit. return; } if (existingCallbackNode != null) { // Cancel the existing callback. We'll schedule a new one below. cancelCallback$1(existingCallbackNode); } // Schedule a new callback. var newCallbackNode; if (newCallbackPriority === SyncLane) { // Special case: Sync React callbacks are scheduled on a special // internal queue if (root.tag === LegacyRoot) { if ( ReactCurrentActQueue$1.isBatchingLegacy !== null) { ReactCurrentActQueue$1.didScheduleLegacyUpdate = true; } scheduleLegacySyncCallback(performSyncWorkOnRoot.bind(null, root)); } else { scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root)); } { // Flush the queue in a microtask. if ( ReactCurrentActQueue$1.current !== null) { // Inside `act`, use our internal `act` queue so that these get flushed // at the end of the current scope even when using the sync version // of `act`. ReactCurrentActQueue$1.current.push(flushSyncCallbacks); } else { scheduleMicrotask(function () { // In Safari, appending an iframe forces microtasks to run. // https://github.com/facebook/react/issues/22459 // We don't support running callbacks in the middle of render // or commit so we need to check against that. if ((executionContext & (RenderContext | CommitContext)) === NoContext) { // Note that this would still prematurely flush the callbacks // if this happens outside render or commit phase (e.g. in an event). flushSyncCallbacks(); } }); } } newCallbackNode = null; } else { var schedulerPriorityLevel; switch (lanesToEventPriority(nextLanes)) { case DiscreteEventPriority: schedulerPriorityLevel = ImmediatePriority; break; case ContinuousEventPriority: schedulerPriorityLevel = UserBlockingPriority; break; case DefaultEventPriority: schedulerPriorityLevel = NormalPriority; break; case IdleEventPriority: schedulerPriorityLevel = IdlePriority; break; default: schedulerPriorityLevel = NormalPriority; break; } newCallbackNode = scheduleCallback$1(schedulerPriorityLevel, performConcurrentWorkOnRoot.bind(null, root)); } root.callbackPriority = newCallbackPriority; root.callbackNode = newCallbackNode; } // This is the entry point for every concurrent task, i.e. anything that // goes through Scheduler. function performConcurrentWorkOnRoot(root, didTimeout) { { resetNestedUpdateFlag(); } // Since we know we're in a React event, we can clear the current // event time. The next update will compute a new event time. currentEventTime = NoTimestamp; currentEventTransitionLane = NoLanes; if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { throw new Error('Should not already be working.'); } // Flush any pending passive effects before deciding which lanes to work on, // in case they schedule additional work. var originalCallbackNode = root.callbackNode; var didFlushPassiveEffects = flushPassiveEffects(); if (didFlushPassiveEffects) { // Something in the passive effect phase may have canceled the current task. // Check if the task node for this root was changed. if (root.callbackNode !== originalCallbackNode) { // The current task was canceled. Exit. We don't need to call // `ensureRootIsScheduled` because the check above implies either that // there's a new task, or that there's no remaining work on this root. return null; } } // Determine the next lanes to work on, using the fields stored // on the root. var lanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes); if (lanes === NoLanes) { // Defensive coding. This is never expected to happen. return null; } // We disable time-slicing in some cases: if the work has been CPU-bound // for too long ("expired" work, to prevent starvation), or we're in // sync-updates-by-default mode. // TODO: We only check `didTimeout` defensively, to account for a Scheduler // bug we're still investigating. Once the bug in Scheduler is fixed, // we can remove this, since we track expiration ourselves. var shouldTimeSlice = !includesBlockingLane(root, lanes) && !includesExpiredLane(root, lanes) && ( !didTimeout); var exitStatus = shouldTimeSlice ? renderRootConcurrent(root, lanes) : renderRootSync(root, lanes); if (exitStatus !== RootInProgress) { if (exitStatus === RootErrored) { // If something threw an error, try rendering one more time. We'll // render synchronously to block concurrent data mutations, and we'll // includes all pending updates are included. If it still fails after // the second attempt, we'll give up and commit the resulting tree. var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); if (errorRetryLanes !== NoLanes) { lanes = errorRetryLanes; exitStatus = recoverFromConcurrentError(root, errorRetryLanes); } } if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); markRootSuspended$1(root, lanes); ensureRootIsScheduled(root, now()); throw fatalError; } if (exitStatus === RootDidNotComplete) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. // // This should only happen during a concurrent render, not a discrete or // synchronous update. We should have already checked for this when we // unwound the stack. markRootSuspended$1(root, lanes); } else { // The render completed. // Check if this render may have yielded to a concurrent event, and if so, // confirm that any newly rendered stores are consistent. // TODO: It's possible that even a concurrent render may never have yielded // to the main thread, if it was fast enough, or if it expired. We could // skip the consistency check in that case, too. var renderWasConcurrent = !includesBlockingLane(root, lanes); var finishedWork = root.current.alternate; if (renderWasConcurrent && !isRenderConsistentWithExternalStores(finishedWork)) { // A store was mutated in an interleaved event. Render again, // synchronously, to block further mutations. exitStatus = renderRootSync(root, lanes); // We need to check again if something threw if (exitStatus === RootErrored) { var _errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); if (_errorRetryLanes !== NoLanes) { lanes = _errorRetryLanes; exitStatus = recoverFromConcurrentError(root, _errorRetryLanes); // We assume the tree is now consistent because we didn't yield to any // concurrent events. } } if (exitStatus === RootFatalErrored) { var _fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); markRootSuspended$1(root, lanes); ensureRootIsScheduled(root, now()); throw _fatalError; } } // We now have a consistent tree. The next step is either to commit it, // or, if something suspended, wait to commit it after a timeout. root.finishedWork = finishedWork; root.finishedLanes = lanes; finishConcurrentRender(root, exitStatus, lanes); } } ensureRootIsScheduled(root, now()); if (root.callbackNode === originalCallbackNode) { // The task node scheduled for this root is the same one that's // currently executed. Need to return a continuation. return performConcurrentWorkOnRoot.bind(null, root); } return null; } function recoverFromConcurrentError(root, errorRetryLanes) { // If an error occurred during hydration, discard server response and fall // back to client side render. // Before rendering again, save the errors from the previous attempt. var errorsFromFirstAttempt = workInProgressRootConcurrentErrors; if (isRootDehydrated(root)) { // The shell failed to hydrate. Set a flag to force a client rendering // during the next attempt. To do this, we call prepareFreshStack now // to create the root work-in-progress fiber. This is a bit weird in terms // of factoring, because it relies on renderRootSync not calling // prepareFreshStack again in the call below, which happens because the // root and lanes haven't changed. // // TODO: I think what we should do is set ForceClientRender inside // throwException, like we do for nested Suspense boundaries. The reason // it's here instead is so we can switch to the synchronous work loop, too. // Something to consider for a future refactor. var rootWorkInProgress = prepareFreshStack(root, errorRetryLanes); rootWorkInProgress.flags |= ForceClientRender; { errorHydratingContainer(root.containerInfo); } } var exitStatus = renderRootSync(root, errorRetryLanes); if (exitStatus !== RootErrored) { // Successfully finished rendering on retry // The errors from the failed first attempt have been recovered. Add // them to the collection of recoverable errors. We'll log them in the // commit phase. var errorsFromSecondAttempt = workInProgressRootRecoverableErrors; workInProgressRootRecoverableErrors = errorsFromFirstAttempt; // The errors from the second attempt should be queued after the errors // from the first attempt, to preserve the causal sequence. if (errorsFromSecondAttempt !== null) { queueRecoverableErrors(errorsFromSecondAttempt); } } return exitStatus; } function queueRecoverableErrors(errors) { if (workInProgressRootRecoverableErrors === null) { workInProgressRootRecoverableErrors = errors; } else { workInProgressRootRecoverableErrors.push.apply(workInProgressRootRecoverableErrors, errors); } } function finishConcurrentRender(root, exitStatus, lanes) { switch (exitStatus) { case RootInProgress: case RootFatalErrored: { throw new Error('Root did not complete. This is a bug in React.'); } // Flow knows about invariant, so it complains if I add a break // statement, but eslint doesn't know about invariant, so it complains // if I do. eslint-disable-next-line no-fallthrough case RootErrored: { // We should have already attempted to retry this tree. If we reached // this point, it errored again. Commit it. commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); break; } case RootSuspended: { markRootSuspended$1(root, lanes); // We have an acceptable loading state. We need to figure out if we // should immediately commit it or wait a bit. if (includesOnlyRetries(lanes) && // do not delay if we're inside an act() scope !shouldForceFlushFallbacksInDEV()) { // This render only included retries, no updates. Throttle committing // retries so that we don't show too many loading states too quickly. var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); // Don't bother with a very short suspense time. if (msUntilTimeout > 10) { var nextLanes = getNextLanes(root, NoLanes); if (nextLanes !== NoLanes) { // There's additional work on this root. break; } var suspendedLanes = root.suspendedLanes; if (!isSubsetOfLanes(suspendedLanes, lanes)) { // We should prefer to render the fallback of at the last // suspended level. Ping the last suspended level to try // rendering it again. // FIXME: What if the suspended lanes are Idle? Should not restart. var eventTime = requestEventTime(); markRootPinged(root, suspendedLanes); break; } // The render is suspended, it hasn't timed out, and there's no // lower priority work to do. Instead of committing the fallback // immediately, wait for more data to arrive. root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root, workInProgressRootRecoverableErrors, workInProgressTransitions), msUntilTimeout); break; } } // The work expired. Commit immediately. commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); break; } case RootSuspendedWithDelay: { markRootSuspended$1(root, lanes); if (includesOnlyTransitions(lanes)) { // This is a transition, so we should exit without committing a // placeholder and without scheduling a timeout. Delay indefinitely // until we receive more data. break; } if (!shouldForceFlushFallbacksInDEV()) { // This is not a transition, but we did trigger an avoided state. // Schedule a placeholder to display after a short delay, using the Just // Noticeable Difference. // TODO: Is the JND optimization worth the added complexity? If this is // the only reason we track the event time, then probably not. // Consider removing. var mostRecentEventTime = getMostRecentEventTime(root, lanes); var eventTimeMs = mostRecentEventTime; var timeElapsedMs = now() - eventTimeMs; var _msUntilTimeout = jnd(timeElapsedMs) - timeElapsedMs; // Don't bother with a very short suspense time. if (_msUntilTimeout > 10) { // Instead of committing the fallback immediately, wait for more data // to arrive. root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root, workInProgressRootRecoverableErrors, workInProgressTransitions), _msUntilTimeout); break; } } // Commit the placeholder. commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); break; } case RootCompleted: { // The work completed. Ready to commit. commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); break; } default: { throw new Error('Unknown root exit status.'); } } } function isRenderConsistentWithExternalStores(finishedWork) { // Search the rendered tree for external store reads, and check whether the // stores were mutated in a concurrent event. Intentionally using an iterative // loop instead of recursion so we can exit early. var node = finishedWork; while (true) { if (node.flags & StoreConsistency) { var updateQueue = node.updateQueue; if (updateQueue !== null) { var checks = updateQueue.stores; if (checks !== null) { for (var i = 0; i < checks.length; i++) { var check = checks[i]; var getSnapshot = check.getSnapshot; var renderedValue = check.value; try { if (!objectIs(getSnapshot(), renderedValue)) { // Found an inconsistent store. return false; } } catch (error) { // If `getSnapshot` throws, return `false`. This will schedule // a re-render, and the error will be rethrown during render. return false; } } } } } var child = node.child; if (node.subtreeFlags & StoreConsistency && child !== null) { child.return = node; node = child; continue; } if (node === finishedWork) { return true; } while (node.sibling === null) { if (node.return === null || node.return === finishedWork) { return true; } node = node.return; } node.sibling.return = node.return; node = node.sibling; } // Flow doesn't know this is unreachable, but eslint does // eslint-disable-next-line no-unreachable return true; } function markRootSuspended$1(root, suspendedLanes) { // When suspending, we should always exclude lanes that were pinged or (more // rarely, since we try to avoid it) updated during the render phase. // TODO: Lol maybe there's a better way to factor this besides this // obnoxiously named function :) suspendedLanes = removeLanes(suspendedLanes, workInProgressRootPingedLanes); suspendedLanes = removeLanes(suspendedLanes, workInProgressRootInterleavedUpdatedLanes); markRootSuspended(root, suspendedLanes); } // This is the entry point for synchronous tasks that don't go // through Scheduler function performSyncWorkOnRoot(root) { { syncNestedUpdateFlag(); } if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { throw new Error('Should not already be working.'); } flushPassiveEffects(); var lanes = getNextLanes(root, NoLanes); if (!includesSomeLane(lanes, SyncLane)) { // There's no remaining sync work left. ensureRootIsScheduled(root, now()); return null; } var exitStatus = renderRootSync(root, lanes); if (root.tag !== LegacyRoot && exitStatus === RootErrored) { // If something threw an error, try rendering one more time. We'll render // synchronously to block concurrent data mutations, and we'll includes // all pending updates are included. If it still fails after the second // attempt, we'll give up and commit the resulting tree. var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); if (errorRetryLanes !== NoLanes) { lanes = errorRetryLanes; exitStatus = recoverFromConcurrentError(root, errorRetryLanes); } } if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); markRootSuspended$1(root, lanes); ensureRootIsScheduled(root, now()); throw fatalError; } if (exitStatus === RootDidNotComplete) { throw new Error('Root did not complete. This is a bug in React.'); } // We now have a consistent tree. Because this is a sync render, we // will commit it even if something suspended. var finishedWork = root.current.alternate; root.finishedWork = finishedWork; root.finishedLanes = lanes; commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); // Before exiting, make sure there's a callback scheduled for the next // pending level. ensureRootIsScheduled(root, now()); return null; } function flushRoot(root, lanes) { if (lanes !== NoLanes) { markRootEntangled(root, mergeLanes(lanes, SyncLane)); ensureRootIsScheduled(root, now()); if ((executionContext & (RenderContext | CommitContext)) === NoContext) { resetRenderTimer(); flushSyncCallbacks(); } } } function batchedUpdates$1(fn, a) { var prevExecutionContext = executionContext; executionContext |= BatchedContext; try { return fn(a); } finally { executionContext = prevExecutionContext; // If there were legacy sync updates, flush them at the end of the outer // most batchedUpdates-like method. if (executionContext === NoContext && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. !( ReactCurrentActQueue$1.isBatchingLegacy)) { resetRenderTimer(); flushSyncCallbacksOnlyInLegacyMode(); } } } function discreteUpdates(fn, a, b, c, d) { var previousPriority = getCurrentUpdatePriority(); var prevTransition = ReactCurrentBatchConfig$3.transition; try { ReactCurrentBatchConfig$3.transition = null; setCurrentUpdatePriority(DiscreteEventPriority); return fn(a, b, c, d); } finally { setCurrentUpdatePriority(previousPriority); ReactCurrentBatchConfig$3.transition = prevTransition; if (executionContext === NoContext) { resetRenderTimer(); } } } // Overload the definition to the two valid signatures. // Warning, this opts-out of checking the function body. // eslint-disable-next-line no-redeclare function flushSync(fn) { // In legacy mode, we flush pending passive effects at the beginning of the // next event, not at the end of the previous one. if (rootWithPendingPassiveEffects !== null && rootWithPendingPassiveEffects.tag === LegacyRoot && (executionContext & (RenderContext | CommitContext)) === NoContext) { flushPassiveEffects(); } var prevExecutionContext = executionContext; executionContext |= BatchedContext; var prevTransition = ReactCurrentBatchConfig$3.transition; var previousPriority = getCurrentUpdatePriority(); try { ReactCurrentBatchConfig$3.transition = null; setCurrentUpdatePriority(DiscreteEventPriority); if (fn) { return fn(); } else { return undefined; } } finally { setCurrentUpdatePriority(previousPriority); ReactCurrentBatchConfig$3.transition = prevTransition; executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch. // Note that this will happen even if batchedUpdates is higher up // the stack. if ((executionContext & (RenderContext | CommitContext)) === NoContext) { flushSyncCallbacks(); } } } function isAlreadyRendering() { // Used by the renderer to print a warning if certain APIs are called from // the wrong context. return (executionContext & (RenderContext | CommitContext)) !== NoContext; } function pushRenderLanes(fiber, lanes) { push(subtreeRenderLanesCursor, subtreeRenderLanes, fiber); subtreeRenderLanes = mergeLanes(subtreeRenderLanes, lanes); workInProgressRootIncludedLanes = mergeLanes(workInProgressRootIncludedLanes, lanes); } function popRenderLanes(fiber) { subtreeRenderLanes = subtreeRenderLanesCursor.current; pop(subtreeRenderLanesCursor, fiber); } function prepareFreshStack(root, lanes) { root.finishedWork = null; root.finishedLanes = NoLanes; var timeoutHandle = root.timeoutHandle; if (timeoutHandle !== noTimeout) { // The root previous suspended and scheduled a timeout to commit a fallback // state. Now that we have additional work, cancel the timeout. root.timeoutHandle = noTimeout; // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above cancelTimeout(timeoutHandle); } if (workInProgress !== null) { var interruptedWork = workInProgress.return; while (interruptedWork !== null) { var current = interruptedWork.alternate; unwindInterruptedWork(current, interruptedWork); interruptedWork = interruptedWork.return; } } workInProgressRoot = root; var rootWorkInProgress = createWorkInProgress(root.current, null); workInProgress = rootWorkInProgress; workInProgressRootRenderLanes = subtreeRenderLanes = workInProgressRootIncludedLanes = lanes; workInProgressRootExitStatus = RootInProgress; workInProgressRootFatalError = null; workInProgressRootSkippedLanes = NoLanes; workInProgressRootInterleavedUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; workInProgressRootConcurrentErrors = null; workInProgressRootRecoverableErrors = null; finishQueueingConcurrentUpdates(); { ReactStrictModeWarnings.discardPendingWarnings(); } return rootWorkInProgress; } function handleError(root, thrownValue) { do { var erroredWork = workInProgress; try { // Reset module-level state that was set during the render phase. resetContextDependencies(); resetHooksAfterThrow(); resetCurrentFiber(); // TODO: I found and added this missing line while investigating a // separate issue. Write a regression test using string refs. ReactCurrentOwner$2.current = null; if (erroredWork === null || erroredWork.return === null) { // Expected to be working on a non-root fiber. This is a fatal error // because there's no ancestor that can handle it; the root is // supposed to capture all errors that weren't caught by an error // boundary. workInProgressRootExitStatus = RootFatalErrored; workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next // sibling, or the parent if there are no siblings. But since the root // has no siblings nor a parent, we set it to null. Usually this is // handled by `completeUnitOfWork` or `unwindWork`, but since we're // intentionally not calling those, we need set it here. // TODO: Consider calling `unwindWork` to pop the contexts. workInProgress = null; return; } if (enableProfilerTimer && erroredWork.mode & ProfileMode) { // Record the time spent rendering before an error was thrown. This // avoids inaccurate Profiler durations in the case of a // suspended render. stopProfilerTimerIfRunningAndRecordDelta(erroredWork, true); } if (enableSchedulingProfiler) { markComponentRenderStopped(); if (thrownValue !== null && typeof thrownValue === 'object' && typeof thrownValue.then === 'function') { var wakeable = thrownValue; markComponentSuspended(erroredWork, wakeable, workInProgressRootRenderLanes); } else { markComponentErrored(erroredWork, thrownValue, workInProgressRootRenderLanes); } } throwException(root, erroredWork.return, erroredWork, thrownValue, workInProgressRootRenderLanes); completeUnitOfWork(erroredWork); } catch (yetAnotherThrownValue) { // Something in the return path also threw. thrownValue = yetAnotherThrownValue; if (workInProgress === erroredWork && erroredWork !== null) { // If this boundary has already errored, then we had trouble processing // the error. Bubble it to the next boundary. erroredWork = erroredWork.return; workInProgress = erroredWork; } else { erroredWork = workInProgress; } continue; } // Return to the normal work loop. return; } while (true); } function pushDispatcher() { var prevDispatcher = ReactCurrentDispatcher$2.current; ReactCurrentDispatcher$2.current = ContextOnlyDispatcher; if (prevDispatcher === null) { // The React isomorphic package does not include a default dispatcher. // Instead the first renderer will lazily attach one, in order to give // nicer error messages. return ContextOnlyDispatcher; } else { return prevDispatcher; } } function popDispatcher(prevDispatcher) { ReactCurrentDispatcher$2.current = prevDispatcher; } function markCommitTimeOfFallback() { globalMostRecentFallbackTime = now(); } function markSkippedUpdateLanes(lane) { workInProgressRootSkippedLanes = mergeLanes(lane, workInProgressRootSkippedLanes); } function renderDidSuspend() { if (workInProgressRootExitStatus === RootInProgress) { workInProgressRootExitStatus = RootSuspended; } } function renderDidSuspendDelayIfPossible() { if (workInProgressRootExitStatus === RootInProgress || workInProgressRootExitStatus === RootSuspended || workInProgressRootExitStatus === RootErrored) { workInProgressRootExitStatus = RootSuspendedWithDelay; } // Check if there are updates that we skipped tree that might have unblocked // this render. if (workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes))) { // Mark the current render as suspended so that we switch to working on // the updates that were skipped. Usually we only suspend at the end of // the render phase. // TODO: We should probably always mark the root as suspended immediately // (inside this function), since by suspending at the end of the render // phase introduces a potential mistake where we suspend lanes that were // pinged or updated while we were rendering. markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes); } } function renderDidError(error) { if (workInProgressRootExitStatus !== RootSuspendedWithDelay) { workInProgressRootExitStatus = RootErrored; } if (workInProgressRootConcurrentErrors === null) { workInProgressRootConcurrentErrors = [error]; } else { workInProgressRootConcurrentErrors.push(error); } } // Called during render to determine if anything has suspended. // Returns false if we're not sure. function renderHasNotSuspendedYet() { // If something errored or completed, we can't really be sure, // so those are false. return workInProgressRootExitStatus === RootInProgress; } function renderRootSync(root, lanes) { var prevExecutionContext = executionContext; executionContext |= RenderContext; var prevDispatcher = pushDispatcher(); // If the root or lanes have changed, throw out the existing stack // and prepare a fresh one. Otherwise we'll continue where we left off. if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { { if (isDevToolsPresent) { var memoizedUpdaters = root.memoizedUpdaters; if (memoizedUpdaters.size > 0) { restorePendingUpdaters(root, workInProgressRootRenderLanes); memoizedUpdaters.clear(); } // At this point, move Fibers that scheduled the upcoming work from the Map to the Set. // If we bailout on this work, we'll move them back (like above). // It's important to move them now in case the work spawns more work at the same priority with different updaters. // That way we can keep the current update and future updates separate. movePendingFibersToMemoized(root, lanes); } } workInProgressTransitions = getTransitionsForLanes(); prepareFreshStack(root, lanes); } { markRenderStarted(lanes); } do { try { workLoopSync(); break; } catch (thrownValue) { handleError(root, thrownValue); } } while (true); resetContextDependencies(); executionContext = prevExecutionContext; popDispatcher(prevDispatcher); if (workInProgress !== null) { // This is a sync render, so we should have finished the whole tree. throw new Error('Cannot commit an incomplete root. This error is likely caused by a ' + 'bug in React. Please file an issue.'); } { markRenderStopped(); } // Set this to null to indicate there's no in-progress render. workInProgressRoot = null; workInProgressRootRenderLanes = NoLanes; return workInProgressRootExitStatus; } // The work loop is an extremely hot path. Tell Closure not to inline it. /** @noinline */ function workLoopSync() { // Already timed out, so perform work without checking if we need to yield. while (workInProgress !== null) { performUnitOfWork(workInProgress); } } function renderRootConcurrent(root, lanes) { var prevExecutionContext = executionContext; executionContext |= RenderContext; var prevDispatcher = pushDispatcher(); // If the root or lanes have changed, throw out the existing stack // and prepare a fresh one. Otherwise we'll continue where we left off. if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { { if (isDevToolsPresent) { var memoizedUpdaters = root.memoizedUpdaters; if (memoizedUpdaters.size > 0) { restorePendingUpdaters(root, workInProgressRootRenderLanes); memoizedUpdaters.clear(); } // At this point, move Fibers that scheduled the upcoming work from the Map to the Set. // If we bailout on this work, we'll move them back (like above). // It's important to move them now in case the work spawns more work at the same priority with different updaters. // That way we can keep the current update and future updates separate. movePendingFibersToMemoized(root, lanes); } } workInProgressTransitions = getTransitionsForLanes(); resetRenderTimer(); prepareFreshStack(root, lanes); } { markRenderStarted(lanes); } do { try { workLoopConcurrent(); break; } catch (thrownValue) { handleError(root, thrownValue); } } while (true); resetContextDependencies(); popDispatcher(prevDispatcher); executionContext = prevExecutionContext; if (workInProgress !== null) { // Still work remaining. { markRenderYielded(); } return RootInProgress; } else { // Completed the tree. { markRenderStopped(); } // Set this to null to indicate there's no in-progress render. workInProgressRoot = null; workInProgressRootRenderLanes = NoLanes; // Return the final exit status. return workInProgressRootExitStatus; } } /** @noinline */ function workLoopConcurrent() { // Perform work until Scheduler asks us to yield while (workInProgress !== null && !shouldYield()) { performUnitOfWork(workInProgress); } } function performUnitOfWork(unitOfWork) { // The current, flushed, state of this fiber is the alternate. Ideally // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = unitOfWork.alternate; setCurrentFiber(unitOfWork); var next; if ( (unitOfWork.mode & ProfileMode) !== NoMode) { startProfilerTimer(unitOfWork); next = beginWork$1(current, unitOfWork, subtreeRenderLanes); stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); } else { next = beginWork$1(current, unitOfWork, subtreeRenderLanes); } resetCurrentFiber(); unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { // If this doesn't spawn new work, complete the current work. completeUnitOfWork(unitOfWork); } else { workInProgress = next; } ReactCurrentOwner$2.current = null; } function completeUnitOfWork(unitOfWork) { // Attempt to complete the current unit of work, then move to the next // sibling. If there are no more siblings, return to the parent fiber. var completedWork = unitOfWork; do { // The current, flushed, state of this fiber is the alternate. Ideally // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = completedWork.alternate; var returnFiber = completedWork.return; // Check if the work completed or if something threw. if ((completedWork.flags & Incomplete) === NoFlags) { setCurrentFiber(completedWork); var next = void 0; if ( (completedWork.mode & ProfileMode) === NoMode) { next = completeWork(current, completedWork, subtreeRenderLanes); } else { startProfilerTimer(completedWork); next = completeWork(current, completedWork, subtreeRenderLanes); // Update render duration assuming we didn't error. stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); } resetCurrentFiber(); if (next !== null) { // Completing this fiber spawned new work. Work on that next. workInProgress = next; return; } } else { // This fiber did not complete because something threw. Pop values off // the stack without entering the complete phase. If this is a boundary, // capture values if possible. var _next = unwindWork(current, completedWork); // Because this fiber did not complete, don't reset its lanes. if (_next !== null) { // If completing this work spawned new work, do that next. We'll come // back here again. // Since we're restarting, remove anything that is not a host effect // from the effect tag. _next.flags &= HostEffectMask; workInProgress = _next; return; } if ( (completedWork.mode & ProfileMode) !== NoMode) { // Record the render duration for the fiber that errored. stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing. var actualDuration = completedWork.actualDuration; var child = completedWork.child; while (child !== null) { actualDuration += child.actualDuration; child = child.sibling; } completedWork.actualDuration = actualDuration; } if (returnFiber !== null) { // Mark the parent fiber as incomplete and clear its subtree flags. returnFiber.flags |= Incomplete; returnFiber.subtreeFlags = NoFlags; returnFiber.deletions = null; } else { // We've unwound all the way to the root. workInProgressRootExitStatus = RootDidNotComplete; workInProgress = null; return; } } var siblingFiber = completedWork.sibling; if (siblingFiber !== null) { // If there is more work to do in this returnFiber, do that next. workInProgress = siblingFiber; return; } // Otherwise, return to the parent completedWork = returnFiber; // Update the next thing we're working on in case something throws. workInProgress = completedWork; } while (completedWork !== null); // We've reached the root. if (workInProgressRootExitStatus === RootInProgress) { workInProgressRootExitStatus = RootCompleted; } } function commitRoot(root, recoverableErrors, transitions) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. var previousUpdateLanePriority = getCurrentUpdatePriority(); var prevTransition = ReactCurrentBatchConfig$3.transition; try { ReactCurrentBatchConfig$3.transition = null; setCurrentUpdatePriority(DiscreteEventPriority); commitRootImpl(root, recoverableErrors, transitions, previousUpdateLanePriority); } finally { ReactCurrentBatchConfig$3.transition = prevTransition; setCurrentUpdatePriority(previousUpdateLanePriority); } return null; } function commitRootImpl(root, recoverableErrors, transitions, renderPriorityLevel) { do { // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which // means `flushPassiveEffects` will sometimes result in additional // passive effects. So we need to keep flushing in a loop until there are // no more pending effects. // TODO: Might be better if `flushPassiveEffects` did not automatically // flush synchronous work at the end, to avoid factoring hazards like this. flushPassiveEffects(); } while (rootWithPendingPassiveEffects !== null); flushRenderPhaseStrictModeWarningsInDEV(); if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { throw new Error('Should not already be working.'); } var finishedWork = root.finishedWork; var lanes = root.finishedLanes; { markCommitStarted(lanes); } if (finishedWork === null) { { markCommitStopped(); } return null; } else { { if (lanes === NoLanes) { error('root.finishedLanes should not be empty during a commit. This is a ' + 'bug in React.'); } } } root.finishedWork = null; root.finishedLanes = NoLanes; if (finishedWork === root.current) { throw new Error('Cannot commit the same tree as before. This error is likely caused by ' + 'a bug in React. Please file an issue.'); } // commitRoot never returns a continuation; it always finishes synchronously. // So we can clear these now to allow a new callback to be scheduled. root.callbackNode = null; root.callbackPriority = NoLane; // Update the first and last pending times on this root. The new first // pending time is whatever is left on the root fiber. var remainingLanes = mergeLanes(finishedWork.lanes, finishedWork.childLanes); markRootFinished(root, remainingLanes); if (root === workInProgressRoot) { // We can reset these now that they are finished. workInProgressRoot = null; workInProgress = null; workInProgressRootRenderLanes = NoLanes; } // If there are pending passive effects, schedule a callback to process them. // Do this as early as possible, so it is queued before anything else that // might get scheduled in the commit phase. (See #16714.) // TODO: Delete all other places that schedule the passive effect callback // They're redundant. if ((finishedWork.subtreeFlags & PassiveMask) !== NoFlags || (finishedWork.flags & PassiveMask) !== NoFlags) { if (!rootDoesHavePassiveEffects) { rootDoesHavePassiveEffects = true; // to store it in pendingPassiveTransitions until they get processed // We need to pass this through as an argument to commitRoot // because workInProgressTransitions might have changed between // the previous render and commit if we throttle the commit // with setTimeout pendingPassiveTransitions = transitions; scheduleCallback$1(NormalPriority, function () { flushPassiveEffects(); // This render triggered passive effects: release the root cache pool // *after* passive effects fire to avoid freeing a cache pool that may // be referenced by a node in the tree (HostRoot, Cache boundary etc) return null; }); } } // Check if there are any effects in the whole tree. // TODO: This is left over from the effect list implementation, where we had // to check for the existence of `firstEffect` to satisfy Flow. I think the // only other reason this optimization exists is because it affects profiling. // Reconsider whether this is necessary. var subtreeHasEffects = (finishedWork.subtreeFlags & (BeforeMutationMask | MutationMask | LayoutMask | PassiveMask)) !== NoFlags; var rootHasEffect = (finishedWork.flags & (BeforeMutationMask | MutationMask | LayoutMask | PassiveMask)) !== NoFlags; if (subtreeHasEffects || rootHasEffect) { var prevTransition = ReactCurrentBatchConfig$3.transition; ReactCurrentBatchConfig$3.transition = null; var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; executionContext |= CommitContext; // Reset this to null before calling lifecycles ReactCurrentOwner$2.current = null; // The commit phase is broken into several sub-phases. We do a separate pass // of the effect list for each phase: all mutation effects come before all // layout effects, and so on. // The first phase a "before mutation" phase. We use this phase to read the // state of the host tree right before we mutate it. This is where // getSnapshotBeforeUpdate is called. var shouldFireAfterActiveInstanceBlur = commitBeforeMutationEffects(root, finishedWork); { // Mark the current commit time to be shared by all Profilers in this // batch. This enables them to be grouped later. recordCommitTime(); } commitMutationEffects(root, finishedWork, lanes); resetAfterCommit(root.containerInfo); // The work-in-progress tree is now the current tree. This must come after // the mutation phase, so that the previous tree is still current during // componentWillUnmount, but before the layout phase, so that the finished // work is current during componentDidMount/Update. root.current = finishedWork; // The next phase is the layout phase, where we call effects that read { markLayoutEffectsStarted(lanes); } commitLayoutEffects(finishedWork, root, lanes); { markLayoutEffectsStopped(); } // opportunity to paint. requestPaint(); executionContext = prevExecutionContext; // Reset the priority to the previous non-sync value. setCurrentUpdatePriority(previousPriority); ReactCurrentBatchConfig$3.transition = prevTransition; } else { // No effects. root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were // no effects. // TODO: Maybe there's a better way to report this. { recordCommitTime(); } } var rootDidHavePassiveEffects = rootDoesHavePassiveEffects; if (rootDoesHavePassiveEffects) { // This commit has passive effects. Stash a reference to them. But don't // schedule a callback until after flushing layout work. rootDoesHavePassiveEffects = false; rootWithPendingPassiveEffects = root; pendingPassiveEffectsLanes = lanes; } else { { nestedPassiveUpdateCount = 0; rootWithPassiveNestedUpdates = null; } } // Read this again, since an effect might have updated it remainingLanes = root.pendingLanes; // Check if there's remaining work on this root // TODO: This is part of the `componentDidCatch` implementation. Its purpose // is to detect whether something might have called setState inside // `componentDidCatch`. The mechanism is known to be flawed because `setState` // inside `componentDidCatch` is itself flawed — that's why we recommend // `getDerivedStateFromError` instead. However, it could be improved by // checking if remainingLanes includes Sync work, instead of whether there's // any work remaining at all (which would also include stuff like Suspense // retries or transitions). It's been like this for a while, though, so fixing // it probably isn't that urgent. if (remainingLanes === NoLanes) { // If there's no remaining work, we can clear the set of already failed // error boundaries. legacyErrorBoundariesThatAlreadyFailed = null; } { if (!rootDidHavePassiveEffects) { commitDoubleInvokeEffectsInDEV(root.current, false); } } onCommitRoot(finishedWork.stateNode, renderPriorityLevel); { if (isDevToolsPresent) { root.memoizedUpdaters.clear(); } } { onCommitRoot$1(); } // Always call this before exiting `commitRoot`, to ensure that any // additional work on this root is scheduled. ensureRootIsScheduled(root, now()); if (recoverableErrors !== null) { // There were errors during this render, but recovered from them without // needing to surface it to the UI. We log them here. var onRecoverableError = root.onRecoverableError; for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; var componentStack = recoverableError.stack; var digest = recoverableError.digest; onRecoverableError(recoverableError.value, { componentStack: componentStack, digest: digest }); } } if (hasUncaughtError) { hasUncaughtError = false; var error$1 = firstUncaughtError; firstUncaughtError = null; throw error$1; } // If the passive effects are the result of a discrete render, flush them // synchronously at the end of the current task so that the result is // immediately observable. Otherwise, we assume that they are not // order-dependent and do not need to be observed by external systems, so we // can wait until after paint. // TODO: We can optimize this by not scheduling the callback earlier. Since we // currently schedule the callback in multiple places, will wait until those // are consolidated. if (includesSomeLane(pendingPassiveEffectsLanes, SyncLane) && root.tag !== LegacyRoot) { flushPassiveEffects(); } // Read this again, since a passive effect might have updated it remainingLanes = root.pendingLanes; if (includesSomeLane(remainingLanes, SyncLane)) { { markNestedUpdateScheduled(); } // Count the number of times the root synchronously re-renders without // finishing. If there are too many, it indicates an infinite update loop. if (root === rootWithNestedUpdates) { nestedUpdateCount++; } else { nestedUpdateCount = 0; rootWithNestedUpdates = root; } } else { nestedUpdateCount = 0; } // If layout work was scheduled, flush it now. flushSyncCallbacks(); { markCommitStopped(); } return null; } function flushPassiveEffects() { // Returns whether passive effects were flushed. // TODO: Combine this check with the one in flushPassiveEFfectsImpl. We should // probably just combine the two functions. I believe they were only separate // in the first place because we used to wrap it with // `Scheduler.runWithPriority`, which accepts a function. But now we track the // priority within React itself, so we can mutate the variable directly. if (rootWithPendingPassiveEffects !== null) { var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes); var priority = lowerEventPriority(DefaultEventPriority, renderPriority); var prevTransition = ReactCurrentBatchConfig$3.transition; var previousPriority = getCurrentUpdatePriority(); try { ReactCurrentBatchConfig$3.transition = null; setCurrentUpdatePriority(priority); return flushPassiveEffectsImpl(); } finally { setCurrentUpdatePriority(previousPriority); ReactCurrentBatchConfig$3.transition = prevTransition; // Once passive effects have run for the tree - giving components a } } return false; } function enqueuePendingPassiveProfilerEffect(fiber) { { pendingPassiveProfilerEffects.push(fiber); if (!rootDoesHavePassiveEffects) { rootDoesHavePassiveEffects = true; scheduleCallback$1(NormalPriority, function () { flushPassiveEffects(); return null; }); } } } function flushPassiveEffectsImpl() { if (rootWithPendingPassiveEffects === null) { return false; } // Cache and clear the transitions flag var transitions = pendingPassiveTransitions; pendingPassiveTransitions = null; var root = rootWithPendingPassiveEffects; var lanes = pendingPassiveEffectsLanes; rootWithPendingPassiveEffects = null; // TODO: This is sometimes out of sync with rootWithPendingPassiveEffects. // Figure out why and fix it. It's not causing any known issues (probably // because it's only used for profiling), but it's a refactor hazard. pendingPassiveEffectsLanes = NoLanes; if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { throw new Error('Cannot flush passive effects while already rendering.'); } { isFlushingPassiveEffects = true; didScheduleUpdateDuringPassiveEffects = false; } { markPassiveEffectsStarted(lanes); } var prevExecutionContext = executionContext; executionContext |= CommitContext; commitPassiveUnmountEffects(root.current); commitPassiveMountEffects(root, root.current, lanes, transitions); // TODO: Move to commitPassiveMountEffects { var profilerEffects = pendingPassiveProfilerEffects; pendingPassiveProfilerEffects = []; for (var i = 0; i < profilerEffects.length; i++) { var _fiber = profilerEffects[i]; commitPassiveEffectDurations(root, _fiber); } } { markPassiveEffectsStopped(); } { commitDoubleInvokeEffectsInDEV(root.current, true); } executionContext = prevExecutionContext; flushSyncCallbacks(); { // If additional passive effects were scheduled, increment a counter. If this // exceeds the limit, we'll fire a warning. if (didScheduleUpdateDuringPassiveEffects) { if (root === rootWithPassiveNestedUpdates) { nestedPassiveUpdateCount++; } else { nestedPassiveUpdateCount = 0; rootWithPassiveNestedUpdates = root; } } else { nestedPassiveUpdateCount = 0; } isFlushingPassiveEffects = false; didScheduleUpdateDuringPassiveEffects = false; } // TODO: Move to commitPassiveMountEffects onPostCommitRoot(root); { var stateNode = root.current.stateNode; stateNode.effectDuration = 0; stateNode.passiveEffectDuration = 0; } return true; } function isAlreadyFailedLegacyErrorBoundary(instance) { return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance); } function markLegacyErrorBoundaryAsFailed(instance) { if (legacyErrorBoundariesThatAlreadyFailed === null) { legacyErrorBoundariesThatAlreadyFailed = new Set([instance]); } else { legacyErrorBoundariesThatAlreadyFailed.add(instance); } } function prepareToThrowUncaughtError(error) { if (!hasUncaughtError) { hasUncaughtError = true; firstUncaughtError = error; } } var onUncaughtError = prepareToThrowUncaughtError; function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { var errorInfo = createCapturedValueAtFiber(error, sourceFiber); var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane); var root = enqueueUpdate(rootFiber, update, SyncLane); var eventTime = requestEventTime(); if (root !== null) { markRootUpdated(root, SyncLane, eventTime); ensureRootIsScheduled(root, eventTime); } } function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error$1) { { reportUncaughtErrorInDEV(error$1); setIsRunningInsertionEffect(false); } if (sourceFiber.tag === HostRoot) { // Error was thrown at the root. There is no parent, so the root // itself should capture it. captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error$1); return; } var fiber = null; { fiber = nearestMountedAncestor; } while (fiber !== null) { if (fiber.tag === HostRoot) { captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error$1); return; } else if (fiber.tag === ClassComponent) { var ctor = fiber.type; var instance = fiber.stateNode; if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { var errorInfo = createCapturedValueAtFiber(error$1, sourceFiber); var update = createClassErrorUpdate(fiber, errorInfo, SyncLane); var root = enqueueUpdate(fiber, update, SyncLane); var eventTime = requestEventTime(); if (root !== null) { markRootUpdated(root, SyncLane, eventTime); ensureRootIsScheduled(root, eventTime); } return; } } fiber = fiber.return; } { // TODO: Until we re-land skipUnmountedBoundaries (see #20147), this warning // will fire for errors that are thrown by destroy functions inside deleted // trees. What it should instead do is propagate the error to the parent of // the deleted tree. In the meantime, do not add this warning to the // allowlist; this is only for our internal use. error('Internal React error: Attempted to capture a commit phase error ' + 'inside a detached tree. This indicates a bug in React. Likely ' + 'causes include deleting the same fiber more than once, committing an ' + 'already-finished tree, or an inconsistent return pointer.\n\n' + 'Error message:\n\n%s', error$1); } } function pingSuspendedRoot(root, wakeable, pingedLanes) { var pingCache = root.pingCache; if (pingCache !== null) { // The wakeable resolved, so we no longer need to memoize, because it will // never be thrown again. pingCache.delete(wakeable); } var eventTime = requestEventTime(); markRootPinged(root, pingedLanes); warnIfSuspenseResolutionNotWrappedWithActDEV(root); if (workInProgressRoot === root && isSubsetOfLanes(workInProgressRootRenderLanes, pingedLanes)) { // Received a ping at the same priority level at which we're currently // rendering. We might want to restart this render. This should mirror // the logic of whether or not a root suspends once it completes. // TODO: If we're rendering sync either due to Sync, Batched or expired, // we should probably never restart. // If we're suspended with delay, or if it's a retry, we'll always suspend // so we can always restart. if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) { // Restart from the root. prepareFreshStack(root, NoLanes); } else { // Even though we can't restart right now, we might get an // opportunity later. So we mark this render as having a ping. workInProgressRootPingedLanes = mergeLanes(workInProgressRootPingedLanes, pingedLanes); } } ensureRootIsScheduled(root, eventTime); } function retryTimedOutBoundary(boundaryFiber, retryLane) { // The boundary fiber (a Suspense component or SuspenseList component) // previously was rendered in its fallback state. One of the promises that // suspended it has resolved, which means at least part of the tree was // likely unblocked. Try rendering again, at a new lanes. if (retryLane === NoLane) { // TODO: Assign this to `suspenseState.retryLane`? to avoid // unnecessary entanglement? retryLane = requestRetryLane(boundaryFiber); } // TODO: Special case idle priority? var eventTime = requestEventTime(); var root = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); if (root !== null) { markRootUpdated(root, retryLane, eventTime); ensureRootIsScheduled(root, eventTime); } } function retryDehydratedSuspenseBoundary(boundaryFiber) { var suspenseState = boundaryFiber.memoizedState; var retryLane = NoLane; if (suspenseState !== null) { retryLane = suspenseState.retryLane; } retryTimedOutBoundary(boundaryFiber, retryLane); } function resolveRetryWakeable(boundaryFiber, wakeable) { var retryLane = NoLane; // Default var retryCache; switch (boundaryFiber.tag) { case SuspenseComponent: retryCache = boundaryFiber.stateNode; var suspenseState = boundaryFiber.memoizedState; if (suspenseState !== null) { retryLane = suspenseState.retryLane; } break; case SuspenseListComponent: retryCache = boundaryFiber.stateNode; break; default: throw new Error('Pinged unknown suspense boundary type. ' + 'This is probably a bug in React.'); } if (retryCache !== null) { // The wakeable resolved, so we no longer need to memoize, because it will // never be thrown again. retryCache.delete(wakeable); } retryTimedOutBoundary(boundaryFiber, retryLane); } // Computes the next Just Noticeable Difference (JND) boundary. // The theory is that a person can't tell the difference between small differences in time. // Therefore, if we wait a bit longer than necessary that won't translate to a noticeable // difference in the experience. However, waiting for longer might mean that we can avoid // showing an intermediate loading state. The longer we have already waited, the harder it // is to tell small differences in time. Therefore, the longer we've already waited, // the longer we can wait additionally. At some point we have to give up though. // We pick a train model where the next boundary commits at a consistent schedule. // These particular numbers are vague estimates. We expect to adjust them based on research. function jnd(timeElapsed) { return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3000 ? 3000 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960; } function checkForNestedUpdates() { if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { nestedUpdateCount = 0; rootWithNestedUpdates = null; throw new Error('Maximum update depth exceeded. This can happen when a component ' + 'repeatedly calls setState inside componentWillUpdate or ' + 'componentDidUpdate. React limits the number of nested updates to ' + 'prevent infinite loops.'); } { if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) { nestedPassiveUpdateCount = 0; rootWithPassiveNestedUpdates = null; error('Maximum update depth exceeded. This can happen when a component ' + "calls setState inside useEffect, but useEffect either doesn't " + 'have a dependency array, or one of the dependencies changes on ' + 'every render.'); } } } function flushRenderPhaseStrictModeWarningsInDEV() { { ReactStrictModeWarnings.flushLegacyContextWarning(); { ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); } } } function commitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { { // TODO (StrictEffects) Should we set a marker on the root if it contains strict effects // so we don't traverse unnecessarily? similar to subtreeFlags but just at the root level. // Maybe not a big deal since this is DEV only behavior. setCurrentFiber(fiber); invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV); if (hasPassiveEffects) { invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectUnmountInDEV); } invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectMountInDEV); if (hasPassiveEffects) { invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV); } resetCurrentFiber(); } } function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) { { // We don't need to re-check StrictEffectsMode here. // This function is only called if that check has already passed. var current = firstChild; var subtreeRoot = null; while (current !== null) { var primarySubtreeFlag = current.subtreeFlags & fiberFlags; if (current !== subtreeRoot && current.child !== null && primarySubtreeFlag !== NoFlags) { current = current.child; } else { if ((current.flags & fiberFlags) !== NoFlags) { invokeEffectFn(current); } if (current.sibling !== null) { current = current.sibling; } else { current = subtreeRoot = current.return; } } } } } var didWarnStateUpdateForNotYetMountedComponent = null; function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { { if ((executionContext & RenderContext) !== NoContext) { // We let the other warning about render phase updates deal with this one. return; } if (!(fiber.mode & ConcurrentMode)) { return; } var tag = fiber.tag; if (tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent) { // Only warn for user-defined components, not internal ones like Suspense. return; } // We show the whole stack but dedupe on the top component's name because // the problematic code almost always lies inside that component. var componentName = getComponentNameFromFiber(fiber) || 'ReactComponent'; if (didWarnStateUpdateForNotYetMountedComponent !== null) { if (didWarnStateUpdateForNotYetMountedComponent.has(componentName)) { return; } didWarnStateUpdateForNotYetMountedComponent.add(componentName); } else { didWarnStateUpdateForNotYetMountedComponent = new Set([componentName]); } var previousFiber = current; try { setCurrentFiber(fiber); error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); } finally { if (previousFiber) { setCurrentFiber(fiber); } else { resetCurrentFiber(); } } } } var beginWork$1; { var dummyFiber = null; beginWork$1 = function (current, unitOfWork, lanes) { // If a component throws an error, we replay it again in a synchronously // dispatched event, so that the debugger will treat it as an uncaught // error See ReactErrorUtils for more information. // Before entering the begin phase, copy the work-in-progress onto a dummy // fiber. If beginWork throws, we'll use this to reset the state. var originalWorkInProgressCopy = assignFiberPropertiesInDEV(dummyFiber, unitOfWork); try { return beginWork(current, unitOfWork, lanes); } catch (originalError) { if (didSuspendOrErrorWhileHydratingDEV() || originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') { // Don't replay promises. // Don't replay errors if we are hydrating and have already suspended or handled an error throw originalError; } // Keep this code in sync with handleError; any changes here must have // corresponding changes there. resetContextDependencies(); resetHooksAfterThrow(); // Don't reset current debug fiber, since we're about to work on the // same fiber again. // Unwind the failed stack frame unwindInterruptedWork(current, unitOfWork); // Restore the original properties of the fiber. assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy); if ( unitOfWork.mode & ProfileMode) { // Reset the profiler timer. startProfilerTimer(unitOfWork); } // Run beginWork again. invokeGuardedCallback(null, beginWork, null, current, unitOfWork, lanes); if (hasCaughtError()) { var replayError = clearCaughtError(); if (typeof replayError === 'object' && replayError !== null && replayError._suppressLogging && typeof originalError === 'object' && originalError !== null && !originalError._suppressLogging) { // If suppressed, let the flag carry over to the original error which is the one we'll rethrow. originalError._suppressLogging = true; } } // We always throw the original error in case the second render pass is not idempotent. // This can happen if a memoized function or CommonJS module doesn't throw after first invocation. throw originalError; } }; } var didWarnAboutUpdateInRender = false; var didWarnAboutUpdateInRenderForAnotherComponent; { didWarnAboutUpdateInRenderForAnotherComponent = new Set(); } function warnAboutRenderPhaseUpdatesInDEV(fiber) { { if (isRendering && !getIsUpdatingOpaqueValueInRenderPhaseInDEV()) { switch (fiber.tag) { case FunctionComponent: case ForwardRef: case SimpleMemoComponent: { var renderingComponentName = workInProgress && getComponentNameFromFiber(workInProgress) || 'Unknown'; // Dedupe by the rendering component because it's the one that needs to be fixed. var dedupeKey = renderingComponentName; if (!didWarnAboutUpdateInRenderForAnotherComponent.has(dedupeKey)) { didWarnAboutUpdateInRenderForAnotherComponent.add(dedupeKey); var setStateComponentName = getComponentNameFromFiber(fiber) || 'Unknown'; error('Cannot update a component (`%s`) while rendering a ' + 'different component (`%s`). To locate the bad setState() call inside `%s`, ' + 'follow the stack trace as described in https://reactjs.org/link/setstate-in-render', setStateComponentName, renderingComponentName, renderingComponentName); } break; } case ClassComponent: { if (!didWarnAboutUpdateInRender) { error('Cannot update during an existing state transition (such as ' + 'within `render`). Render methods should be a pure ' + 'function of props and state.'); didWarnAboutUpdateInRender = true; } break; } } } } } function restorePendingUpdaters(root, lanes) { { if (isDevToolsPresent) { var memoizedUpdaters = root.memoizedUpdaters; memoizedUpdaters.forEach(function (schedulingFiber) { addFiberToLanesMap(root, schedulingFiber, lanes); }); // This function intentionally does not clear memoized updaters. // Those may still be relevant to the current commit // and a future one (e.g. Suspense). } } } var fakeActCallbackNode = {}; function scheduleCallback$1(priorityLevel, callback) { { // If we're currently inside an `act` scope, bypass Scheduler and push to // the `act` queue instead. var actQueue = ReactCurrentActQueue$1.current; if (actQueue !== null) { actQueue.push(callback); return fakeActCallbackNode; } else { return scheduleCallback(priorityLevel, callback); } } } function cancelCallback$1(callbackNode) { if ( callbackNode === fakeActCallbackNode) { return; } // In production, always call Scheduler. This function will be stripped out. return cancelCallback(callbackNode); } function shouldForceFlushFallbacksInDEV() { // Never force flush in production. This function should get stripped out. return ReactCurrentActQueue$1.current !== null; } function warnIfUpdatesNotWrappedWithActDEV(fiber) { { if (fiber.mode & ConcurrentMode) { if (!isConcurrentActEnvironment()) { // Not in an act environment. No need to warn. return; } } else { // Legacy mode has additional cases where we suppress a warning. if (!isLegacyActEnvironment()) { // Not in an act environment. No need to warn. return; } if (executionContext !== NoContext) { // Legacy mode doesn't warn if the update is batched, i.e. // batchedUpdates or flushSync. return; } if (fiber.tag !== FunctionComponent && fiber.tag !== ForwardRef && fiber.tag !== SimpleMemoComponent) { // For backwards compatibility with pre-hooks code, legacy mode only // warns for updates that originate from a hook. return; } } if (ReactCurrentActQueue$1.current === null) { var previousFiber = current; try { setCurrentFiber(fiber); error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://reactjs.org/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); } finally { if (previousFiber) { setCurrentFiber(fiber); } else { resetCurrentFiber(); } } } } } function warnIfSuspenseResolutionNotWrappedWithActDEV(root) { { if (root.tag !== LegacyRoot && isConcurrentActEnvironment() && ReactCurrentActQueue$1.current === null) { error('A suspended resource finished loading inside a test, but the event ' + 'was not wrapped in act(...).\n\n' + 'When testing, code that resolves suspended data should be wrapped ' + 'into act(...):\n\n' + 'act(() => {\n' + ' /* finish loading suspended data */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://reactjs.org/link/wrap-tests-with-act'); } } } function setIsRunningInsertionEffect(isRunning) { { isRunningInsertionEffect = isRunning; } } /* eslint-disable react-internal/prod-error-codes */ var resolveFamily = null; // $FlowFixMe Flow gets confused by a WeakSet feature check below. var failedBoundaries = null; var setRefreshHandler = function (handler) { { resolveFamily = handler; } }; function resolveFunctionForHotReloading(type) { { if (resolveFamily === null) { // Hot reloading is disabled. return type; } var family = resolveFamily(type); if (family === undefined) { return type; } // Use the latest known implementation. return family.current; } } function resolveClassForHotReloading(type) { // No implementation differences. return resolveFunctionForHotReloading(type); } function resolveForwardRefForHotReloading(type) { { if (resolveFamily === null) { // Hot reloading is disabled. return type; } var family = resolveFamily(type); if (family === undefined) { // Check if we're dealing with a real forwardRef. Don't want to crash early. if (type !== null && type !== undefined && typeof type.render === 'function') { // ForwardRef is special because its resolved .type is an object, // but it's possible that we only have its inner render function in the map. // If that inner render function is different, we'll build a new forwardRef type. var currentRender = resolveFunctionForHotReloading(type.render); if (type.render !== currentRender) { var syntheticType = { $$typeof: REACT_FORWARD_REF_TYPE, render: currentRender }; if (type.displayName !== undefined) { syntheticType.displayName = type.displayName; } return syntheticType; } } return type; } // Use the latest known implementation. return family.current; } } function isCompatibleFamilyForHotReloading(fiber, element) { { if (resolveFamily === null) { // Hot reloading is disabled. return false; } var prevType = fiber.elementType; var nextType = element.type; // If we got here, we know types aren't === equal. var needsCompareFamilies = false; var $$typeofNextType = typeof nextType === 'object' && nextType !== null ? nextType.$$typeof : null; switch (fiber.tag) { case ClassComponent: { if (typeof nextType === 'function') { needsCompareFamilies = true; } break; } case FunctionComponent: { if (typeof nextType === 'function') { needsCompareFamilies = true; } else if ($$typeofNextType === REACT_LAZY_TYPE) { // We don't know the inner type yet. // We're going to assume that the lazy inner type is stable, // and so it is sufficient to avoid reconciling it away. // We're not going to unwrap or actually use the new lazy type. needsCompareFamilies = true; } break; } case ForwardRef: { if ($$typeofNextType === REACT_FORWARD_REF_TYPE) { needsCompareFamilies = true; } else if ($$typeofNextType === REACT_LAZY_TYPE) { needsCompareFamilies = true; } break; } case MemoComponent: case SimpleMemoComponent: { if ($$typeofNextType === REACT_MEMO_TYPE) { // TODO: if it was but can no longer be simple, // we shouldn't set this. needsCompareFamilies = true; } else if ($$typeofNextType === REACT_LAZY_TYPE) { needsCompareFamilies = true; } break; } default: return false; } // Check if both types have a family and it's the same one. if (needsCompareFamilies) { // Note: memo() and forwardRef() we'll compare outer rather than inner type. // This means both of them need to be registered to preserve state. // If we unwrapped and compared the inner types for wrappers instead, // then we would risk falsely saying two separate memo(Foo) // calls are equivalent because they wrap the same Foo function. var prevFamily = resolveFamily(prevType); if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) { return true; } } return false; } } function markFailedErrorBoundaryForHotReloading(fiber) { { if (resolveFamily === null) { // Hot reloading is disabled. return; } if (typeof WeakSet !== 'function') { return; } if (failedBoundaries === null) { failedBoundaries = new WeakSet(); } failedBoundaries.add(fiber); } } var scheduleRefresh = function (root, update) { { if (resolveFamily === null) { // Hot reloading is disabled. return; } var staleFamilies = update.staleFamilies, updatedFamilies = update.updatedFamilies; flushPassiveEffects(); flushSync(function () { scheduleFibersWithFamiliesRecursively(root.current, updatedFamilies, staleFamilies); }); } }; var scheduleRoot = function (root, element) { { if (root.context !== emptyContextObject) { // Super edge case: root has a legacy _renderSubtree context // but we don't know the parentComponent so we can't pass it. // Just ignore. We'll delete this with _renderSubtree code path later. return; } flushPassiveEffects(); flushSync(function () { updateContainer(element, root, null, null); }); } }; function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) { { var alternate = fiber.alternate, child = fiber.child, sibling = fiber.sibling, tag = fiber.tag, type = fiber.type; var candidateType = null; switch (tag) { case FunctionComponent: case SimpleMemoComponent: case ClassComponent: candidateType = type; break; case ForwardRef: candidateType = type.render; break; } if (resolveFamily === null) { throw new Error('Expected resolveFamily to be set during hot reload.'); } var needsRender = false; var needsRemount = false; if (candidateType !== null) { var family = resolveFamily(candidateType); if (family !== undefined) { if (staleFamilies.has(family)) { needsRemount = true; } else if (updatedFamilies.has(family)) { if (tag === ClassComponent) { needsRemount = true; } else { needsRender = true; } } } } if (failedBoundaries !== null) { if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) { needsRemount = true; } } if (needsRemount) { fiber._debugNeedsRemount = true; } if (needsRemount || needsRender) { var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); if (_root !== null) { scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); } } if (child !== null && !needsRemount) { scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies); } if (sibling !== null) { scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies); } } } var findHostInstancesForRefresh = function (root, families) { { var hostInstances = new Set(); var types = new Set(families.map(function (family) { return family.current; })); findHostInstancesForMatchingFibersRecursively(root.current, types, hostInstances); return hostInstances; } }; function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) { { var child = fiber.child, sibling = fiber.sibling, tag = fiber.tag, type = fiber.type; var candidateType = null; switch (tag) { case FunctionComponent: case SimpleMemoComponent: case ClassComponent: candidateType = type; break; case ForwardRef: candidateType = type.render; break; } var didMatch = false; if (candidateType !== null) { if (types.has(candidateType)) { didMatch = true; } } if (didMatch) { // We have a match. This only drills down to the closest host components. // There's no need to search deeper because for the purpose of giving // visual feedback, "flashing" outermost parent rectangles is sufficient. findHostInstancesForFiberShallowly(fiber, hostInstances); } else { // If there's no match, maybe there will be one further down in the child tree. if (child !== null) { findHostInstancesForMatchingFibersRecursively(child, types, hostInstances); } } if (sibling !== null) { findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances); } } } function findHostInstancesForFiberShallowly(fiber, hostInstances) { { var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances); if (foundHostInstances) { return; } // If we didn't find any host children, fallback to closest host parent. var node = fiber; while (true) { switch (node.tag) { case HostComponent: hostInstances.add(node.stateNode); return; case HostPortal: hostInstances.add(node.stateNode.containerInfo); return; case HostRoot: hostInstances.add(node.stateNode.containerInfo); return; } if (node.return === null) { throw new Error('Expected to reach root first.'); } node = node.return; } } } function findChildHostInstancesForFiberShallowly(fiber, hostInstances) { { var node = fiber; var foundHostInstances = false; while (true) { if (node.tag === HostComponent) { // We got a match. foundHostInstances = true; hostInstances.add(node.stateNode); // There may still be more, so keep searching. } else if (node.child !== null) { node.child.return = node; node = node.child; continue; } if (node === fiber) { return foundHostInstances; } while (node.sibling === null) { if (node.return === null || node.return === fiber) { return foundHostInstances; } node = node.return; } node.sibling.return = node.return; node = node.sibling; } } return false; } var hasBadMapPolyfill; { hasBadMapPolyfill = false; try { var nonExtensibleObject = Object.preventExtensions({}); /* eslint-disable no-new */ new Map([[nonExtensibleObject, null]]); new Set([nonExtensibleObject]); /* eslint-enable no-new */ } catch (e) { // TODO: Consider warning about bad polyfills hasBadMapPolyfill = true; } } function FiberNode(tag, pendingProps, key, mode) { // Instance this.tag = tag; this.key = key; this.elementType = null; this.type = null; this.stateNode = null; // Fiber this.return = null; this.child = null; this.sibling = null; this.index = 0; this.ref = null; this.pendingProps = pendingProps; this.memoizedProps = null; this.updateQueue = null; this.memoizedState = null; this.dependencies = null; this.mode = mode; // Effects this.flags = NoFlags; this.subtreeFlags = NoFlags; this.deletions = null; this.lanes = NoLanes; this.childLanes = NoLanes; this.alternate = null; { // Note: The following is done to avoid a v8 performance cliff. // // Initializing the fields below to smis and later updating them with // double values will cause Fibers to end up having separate shapes. // This behavior/bug has something to do with Object.preventExtension(). // Fortunately this only impacts DEV builds. // Unfortunately it makes React unusably slow for some applications. // To work around this, initialize the fields below with doubles. // // Learn more about this here: // https://github.com/facebook/react/issues/14365 // https://bugs.chromium.org/p/v8/issues/detail?id=8538 this.actualDuration = Number.NaN; this.actualStartTime = Number.NaN; this.selfBaseDuration = Number.NaN; this.treeBaseDuration = Number.NaN; // It's okay to replace the initial doubles with smis after initialization. // This won't trigger the performance cliff mentioned above, // and it simplifies other profiler code (including DevTools). this.actualDuration = 0; this.actualStartTime = -1; this.selfBaseDuration = 0; this.treeBaseDuration = 0; } { // This isn't directly used but is handy for debugging internals: this._debugSource = null; this._debugOwner = null; this._debugNeedsRemount = false; this._debugHookTypes = null; if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') { Object.preventExtensions(this); } } } // This is a constructor function, rather than a POJO constructor, still // please ensure we do the following: // 1) Nobody should add any instance methods on this. Instance methods can be // more difficult to predict when they get optimized and they are almost // never inlined properly in static compilers. // 2) Nobody should rely on `instanceof Fiber` for type testing. We should // always know when it is a fiber. // 3) We might want to experiment with using numeric keys since they are easier // to optimize in a non-JIT environment. // 4) We can easily go from a constructor to a createFiber object literal if that // is faster. // 5) It should be easy to port this to a C struct and keep a C implementation // compatible. var createFiber = function (tag, pendingProps, key, mode) { // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors return new FiberNode(tag, pendingProps, key, mode); }; function shouldConstruct$1(Component) { var prototype = Component.prototype; return !!(prototype && prototype.isReactComponent); } function isSimpleFunctionComponent(type) { return typeof type === 'function' && !shouldConstruct$1(type) && type.defaultProps === undefined; } function resolveLazyComponentTag(Component) { if (typeof Component === 'function') { return shouldConstruct$1(Component) ? ClassComponent : FunctionComponent; } else if (Component !== undefined && Component !== null) { var $$typeof = Component.$$typeof; if ($$typeof === REACT_FORWARD_REF_TYPE) { return ForwardRef; } if ($$typeof === REACT_MEMO_TYPE) { return MemoComponent; } } return IndeterminateComponent; } // This is used to create an alternate fiber to do work on. function createWorkInProgress(current, pendingProps) { var workInProgress = current.alternate; if (workInProgress === null) { // We use a double buffering pooling technique because we know that we'll // only ever need at most two versions of a tree. We pool the "other" unused // node that we're free to reuse. This is lazily created to avoid allocating // extra objects for things that are never updated. It also allow us to // reclaim the extra memory if needed. workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode); workInProgress.elementType = current.elementType; workInProgress.type = current.type; workInProgress.stateNode = current.stateNode; { // DEV-only fields workInProgress._debugSource = current._debugSource; workInProgress._debugOwner = current._debugOwner; workInProgress._debugHookTypes = current._debugHookTypes; } workInProgress.alternate = current; current.alternate = workInProgress; } else { workInProgress.pendingProps = pendingProps; // Needed because Blocks store data on type. workInProgress.type = current.type; // We already have an alternate. // Reset the effect tag. workInProgress.flags = NoFlags; // The effects are no longer valid. workInProgress.subtreeFlags = NoFlags; workInProgress.deletions = null; { // We intentionally reset, rather than copy, actualDuration & actualStartTime. // This prevents time from endlessly accumulating in new commits. // This has the downside of resetting values for different priority renders, // But works for yielding (the common case) and should support resuming. workInProgress.actualDuration = 0; workInProgress.actualStartTime = -1; } } // Reset all effects except static ones. // Static effects are not specific to a render. workInProgress.flags = current.flags & StaticMask; workInProgress.childLanes = current.childLanes; workInProgress.lanes = current.lanes; workInProgress.child = current.child; workInProgress.memoizedProps = current.memoizedProps; workInProgress.memoizedState = current.memoizedState; workInProgress.updateQueue = current.updateQueue; // Clone the dependencies object. This is mutated during the render phase, so // it cannot be shared with the current fiber. var currentDependencies = current.dependencies; workInProgress.dependencies = currentDependencies === null ? null : { lanes: currentDependencies.lanes, firstContext: currentDependencies.firstContext }; // These will be overridden during the parent's reconciliation workInProgress.sibling = current.sibling; workInProgress.index = current.index; workInProgress.ref = current.ref; { workInProgress.selfBaseDuration = current.selfBaseDuration; workInProgress.treeBaseDuration = current.treeBaseDuration; } { workInProgress._debugNeedsRemount = current._debugNeedsRemount; switch (workInProgress.tag) { case IndeterminateComponent: case FunctionComponent: case SimpleMemoComponent: workInProgress.type = resolveFunctionForHotReloading(current.type); break; case ClassComponent: workInProgress.type = resolveClassForHotReloading(current.type); break; case ForwardRef: workInProgress.type = resolveForwardRefForHotReloading(current.type); break; } } return workInProgress; } // Used to reuse a Fiber for a second pass. function resetWorkInProgress(workInProgress, renderLanes) { // This resets the Fiber to what createFiber or createWorkInProgress would // have set the values to before during the first pass. Ideally this wouldn't // be necessary but unfortunately many code paths reads from the workInProgress // when they should be reading from current and writing to workInProgress. // We assume pendingProps, index, key, ref, return are still untouched to // avoid doing another reconciliation. // Reset the effect flags but keep any Placement tags, since that's something // that child fiber is setting, not the reconciliation. workInProgress.flags &= StaticMask | Placement; // The effects are no longer valid. var current = workInProgress.alternate; if (current === null) { // Reset to createFiber's initial values. workInProgress.childLanes = NoLanes; workInProgress.lanes = renderLanes; workInProgress.child = null; workInProgress.subtreeFlags = NoFlags; workInProgress.memoizedProps = null; workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.dependencies = null; workInProgress.stateNode = null; { // Note: We don't reset the actualTime counts. It's useful to accumulate // actual time across multiple render passes. workInProgress.selfBaseDuration = 0; workInProgress.treeBaseDuration = 0; } } else { // Reset to the cloned values that createWorkInProgress would've. workInProgress.childLanes = current.childLanes; workInProgress.lanes = current.lanes; workInProgress.child = current.child; workInProgress.subtreeFlags = NoFlags; workInProgress.deletions = null; workInProgress.memoizedProps = current.memoizedProps; workInProgress.memoizedState = current.memoizedState; workInProgress.updateQueue = current.updateQueue; // Needed because Blocks store data on type. workInProgress.type = current.type; // Clone the dependencies object. This is mutated during the render phase, so // it cannot be shared with the current fiber. var currentDependencies = current.dependencies; workInProgress.dependencies = currentDependencies === null ? null : { lanes: currentDependencies.lanes, firstContext: currentDependencies.firstContext }; { // Note: We don't reset the actualTime counts. It's useful to accumulate // actual time across multiple render passes. workInProgress.selfBaseDuration = current.selfBaseDuration; workInProgress.treeBaseDuration = current.treeBaseDuration; } } return workInProgress; } function createHostRootFiber(tag, isStrictMode, concurrentUpdatesByDefaultOverride) { var mode; if (tag === ConcurrentRoot) { mode = ConcurrentMode; if (isStrictMode === true) { mode |= StrictLegacyMode; { mode |= StrictEffectsMode; } } } else { mode = NoMode; } if ( isDevToolsPresent) { // Always collect profile timings when DevTools are present. // This enables DevTools to start capturing timing at any point– // Without some nodes in the tree having empty base times. mode |= ProfileMode; } return createFiber(HostRoot, null, null, mode); } function createFiberFromTypeAndProps(type, // React$ElementType key, pendingProps, owner, mode, lanes) { var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. var resolvedType = type; if (typeof type === 'function') { if (shouldConstruct$1(type)) { fiberTag = ClassComponent; { resolvedType = resolveClassForHotReloading(resolvedType); } } else { { resolvedType = resolveFunctionForHotReloading(resolvedType); } } } else if (typeof type === 'string') { fiberTag = HostComponent; } else { getTag: switch (type) { case REACT_FRAGMENT_TYPE: return createFiberFromFragment(pendingProps.children, mode, lanes, key); case REACT_STRICT_MODE_TYPE: fiberTag = Mode; mode |= StrictLegacyMode; if ( (mode & ConcurrentMode) !== NoMode) { // Strict effects should never run on legacy roots mode |= StrictEffectsMode; } break; case REACT_PROFILER_TYPE: return createFiberFromProfiler(pendingProps, mode, lanes, key); case REACT_SUSPENSE_TYPE: return createFiberFromSuspense(pendingProps, mode, lanes, key); case REACT_SUSPENSE_LIST_TYPE: return createFiberFromSuspenseList(pendingProps, mode, lanes, key); case REACT_OFFSCREEN_TYPE: return createFiberFromOffscreen(pendingProps, mode, lanes, key); case REACT_LEGACY_HIDDEN_TYPE: // eslint-disable-next-line no-fallthrough case REACT_SCOPE_TYPE: // eslint-disable-next-line no-fallthrough case REACT_CACHE_TYPE: // eslint-disable-next-line no-fallthrough case REACT_TRACING_MARKER_TYPE: // eslint-disable-next-line no-fallthrough case REACT_DEBUG_TRACING_MODE_TYPE: // eslint-disable-next-line no-fallthrough default: { if (typeof type === 'object' && type !== null) { switch (type.$$typeof) { case REACT_PROVIDER_TYPE: fiberTag = ContextProvider; break getTag; case REACT_CONTEXT_TYPE: // This is a consumer fiberTag = ContextConsumer; break getTag; case REACT_FORWARD_REF_TYPE: fiberTag = ForwardRef; { resolvedType = resolveForwardRefForHotReloading(resolvedType); } break getTag; case REACT_MEMO_TYPE: fiberTag = MemoComponent; break getTag; case REACT_LAZY_TYPE: fiberTag = LazyComponent; resolvedType = null; break getTag; } } var info = ''; { if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; } var ownerName = owner ? getComponentNameFromFiber(owner) : null; if (ownerName) { info += '\n\nCheck the render method of `' + ownerName + '`.'; } } throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info)); } } } var fiber = createFiber(fiberTag, pendingProps, key, mode); fiber.elementType = type; fiber.type = resolvedType; fiber.lanes = lanes; { fiber._debugOwner = owner; } return fiber; } function createFiberFromElement(element, mode, lanes) { var owner = null; { owner = element._owner; } var type = element.type; var key = element.key; var pendingProps = element.props; var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, lanes); { fiber._debugSource = element._source; fiber._debugOwner = element._owner; } return fiber; } function createFiberFromFragment(elements, mode, lanes, key) { var fiber = createFiber(Fragment, elements, key, mode); fiber.lanes = lanes; return fiber; } function createFiberFromProfiler(pendingProps, mode, lanes, key) { { if (typeof pendingProps.id !== 'string') { error('Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.', typeof pendingProps.id); } } var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); fiber.elementType = REACT_PROFILER_TYPE; fiber.lanes = lanes; { fiber.stateNode = { effectDuration: 0, passiveEffectDuration: 0 }; } return fiber; } function createFiberFromSuspense(pendingProps, mode, lanes, key) { var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); fiber.elementType = REACT_SUSPENSE_TYPE; fiber.lanes = lanes; return fiber; } function createFiberFromSuspenseList(pendingProps, mode, lanes, key) { var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode); fiber.elementType = REACT_SUSPENSE_LIST_TYPE; fiber.lanes = lanes; return fiber; } function createFiberFromOffscreen(pendingProps, mode, lanes, key) { var fiber = createFiber(OffscreenComponent, pendingProps, key, mode); fiber.elementType = REACT_OFFSCREEN_TYPE; fiber.lanes = lanes; var primaryChildInstance = { isHidden: false }; fiber.stateNode = primaryChildInstance; return fiber; } function createFiberFromText(content, mode, lanes) { var fiber = createFiber(HostText, content, null, mode); fiber.lanes = lanes; return fiber; } function createFiberFromHostInstanceForDeletion() { var fiber = createFiber(HostComponent, null, null, NoMode); fiber.elementType = 'DELETED'; return fiber; } function createFiberFromDehydratedFragment(dehydratedNode) { var fiber = createFiber(DehydratedFragment, null, null, NoMode); fiber.stateNode = dehydratedNode; return fiber; } function createFiberFromPortal(portal, mode, lanes) { var pendingProps = portal.children !== null ? portal.children : []; var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); fiber.lanes = lanes; fiber.stateNode = { containerInfo: portal.containerInfo, pendingChildren: null, // Used by persistent updates implementation: portal.implementation }; return fiber; } // Used for stashing WIP properties to replay failed work in DEV. function assignFiberPropertiesInDEV(target, source) { if (target === null) { // This Fiber's initial properties will always be overwritten. // We only use a Fiber to ensure the same hidden class so DEV isn't slow. target = createFiber(IndeterminateComponent, null, null, NoMode); } // This is intentionally written as a list of all properties. // We tried to use Object.assign() instead but this is called in // the hottest path, and Object.assign() was too slow: // https://github.com/facebook/react/issues/12502 // This code is DEV-only so size is not a concern. target.tag = source.tag; target.key = source.key; target.elementType = source.elementType; target.type = source.type; target.stateNode = source.stateNode; target.return = source.return; target.child = source.child; target.sibling = source.sibling; target.index = source.index; target.ref = source.ref; target.pendingProps = source.pendingProps; target.memoizedProps = source.memoizedProps; target.updateQueue = source.updateQueue; target.memoizedState = source.memoizedState; target.dependencies = source.dependencies; target.mode = source.mode; target.flags = source.flags; target.subtreeFlags = source.subtreeFlags; target.deletions = source.deletions; target.lanes = source.lanes; target.childLanes = source.childLanes; target.alternate = source.alternate; { target.actualDuration = source.actualDuration; target.actualStartTime = source.actualStartTime; target.selfBaseDuration = source.selfBaseDuration; target.treeBaseDuration = source.treeBaseDuration; } target._debugSource = source._debugSource; target._debugOwner = source._debugOwner; target._debugNeedsRemount = source._debugNeedsRemount; target._debugHookTypes = source._debugHookTypes; return target; } function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix, onRecoverableError) { this.tag = tag; this.containerInfo = containerInfo; this.pendingChildren = null; this.current = null; this.pingCache = null; this.finishedWork = null; this.timeoutHandle = noTimeout; this.context = null; this.pendingContext = null; this.callbackNode = null; this.callbackPriority = NoLane; this.eventTimes = createLaneMap(NoLanes); this.expirationTimes = createLaneMap(NoTimestamp); this.pendingLanes = NoLanes; this.suspendedLanes = NoLanes; this.pingedLanes = NoLanes; this.expiredLanes = NoLanes; this.mutableReadLanes = NoLanes; this.finishedLanes = NoLanes; this.entangledLanes = NoLanes; this.entanglements = createLaneMap(NoLanes); this.identifierPrefix = identifierPrefix; this.onRecoverableError = onRecoverableError; { this.mutableSourceEagerHydrationData = null; } { this.effectDuration = 0; this.passiveEffectDuration = 0; } { this.memoizedUpdaters = new Set(); var pendingUpdatersLaneMap = this.pendingUpdatersLaneMap = []; for (var _i = 0; _i < TotalLanes; _i++) { pendingUpdatersLaneMap.push(new Set()); } } { switch (tag) { case ConcurrentRoot: this._debugRootType = hydrate ? 'hydrateRoot()' : 'createRoot()'; break; case LegacyRoot: this._debugRootType = hydrate ? 'hydrate()' : 'render()'; break; } } } function createFiberRoot(containerInfo, tag, hydrate, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, // TODO: We have several of these arguments that are conceptually part of the // host config, but because they are passed in at runtime, we have to thread // them through the root constructor. Perhaps we should put them all into a // single type, like a DynamicHostConfig that is defined by the renderer. identifierPrefix, onRecoverableError, transitionCallbacks) { var root = new FiberRootNode(containerInfo, tag, hydrate, identifierPrefix, onRecoverableError); // stateNode is any. var uninitializedFiber = createHostRootFiber(tag, isStrictMode); root.current = uninitializedFiber; uninitializedFiber.stateNode = root; { var _initialState = { element: initialChildren, isDehydrated: hydrate, cache: null, // not enabled yet transitions: null, pendingSuspenseBoundaries: null }; uninitializedFiber.memoizedState = _initialState; } initializeUpdateQueue(uninitializedFiber); return root; } var ReactVersion = '18.3.1'; function createPortal(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. implementation) { var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; { checkKeyStringCoercion(key); } return { // This tag allow us to uniquely identify this as a React Portal $$typeof: REACT_PORTAL_TYPE, key: key == null ? null : '' + key, children: children, containerInfo: containerInfo, implementation: implementation }; } var didWarnAboutNestedUpdates; var didWarnAboutFindNodeInStrictMode; { didWarnAboutNestedUpdates = false; didWarnAboutFindNodeInStrictMode = {}; } function getContextForSubtree(parentComponent) { if (!parentComponent) { return emptyContextObject; } var fiber = get(parentComponent); var parentContext = findCurrentUnmaskedContext(fiber); if (fiber.tag === ClassComponent) { var Component = fiber.type; if (isContextProvider(Component)) { return processChildContext(fiber, Component, parentContext); } } return parentContext; } function findHostInstanceWithWarning(component, methodName) { { var fiber = get(component); if (fiber === undefined) { if (typeof component.render === 'function') { throw new Error('Unable to find node on an unmounted component.'); } else { var keys = Object.keys(component).join(','); throw new Error("Argument appears to not be a ReactComponent. Keys: " + keys); } } var hostFiber = findCurrentHostFiber(fiber); if (hostFiber === null) { return null; } if (hostFiber.mode & StrictLegacyMode) { var componentName = getComponentNameFromFiber(fiber) || 'Component'; if (!didWarnAboutFindNodeInStrictMode[componentName]) { didWarnAboutFindNodeInStrictMode[componentName] = true; var previousFiber = current; try { setCurrentFiber(hostFiber); if (fiber.mode & StrictLegacyMode) { error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-find-node', methodName, methodName, componentName); } else { error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which renders StrictMode children. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-find-node', methodName, methodName, componentName); } } finally { // Ideally this should reset to previous but this shouldn't be called in // render and there's another warning for that anyway. if (previousFiber) { setCurrentFiber(previousFiber); } else { resetCurrentFiber(); } } } } return hostFiber.stateNode; } } function createContainer(containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) { var hydrate = false; var initialChildren = null; return createFiberRoot(containerInfo, tag, hydrate, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError); } function createHydrationContainer(initialChildren, // TODO: Remove `callback` when we delete legacy mode. callback, containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) { var hydrate = true; var root = createFiberRoot(containerInfo, tag, hydrate, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError); // TODO: Move this to FiberRoot constructor root.context = getContextForSubtree(null); // Schedule the initial render. In a hydration root, this is different from // a regular update because the initial render must match was was rendered // on the server. // NOTE: This update intentionally doesn't have a payload. We're only using // the update to schedule work on the root fiber (and, for legacy roots, to // enqueue the callback if one is provided). var current = root.current; var eventTime = requestEventTime(); var lane = requestUpdateLane(current); var update = createUpdate(eventTime, lane); update.callback = callback !== undefined && callback !== null ? callback : null; enqueueUpdate(current, update, lane); scheduleInitialHydrationOnRoot(root, lane, eventTime); return root; } function updateContainer(element, container, parentComponent, callback) { { onScheduleRoot(container, element); } var current$1 = container.current; var eventTime = requestEventTime(); var lane = requestUpdateLane(current$1); { markRenderScheduled(lane); } var context = getContextForSubtree(parentComponent); if (container.context === null) { container.context = context; } else { container.pendingContext = context; } { if (isRendering && current !== null && !didWarnAboutNestedUpdates) { didWarnAboutNestedUpdates = true; error('Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentNameFromFiber(current) || 'Unknown'); } } var update = createUpdate(eventTime, lane); // Caution: React DevTools currently depends on this property // being called "element". update.payload = { element: element }; callback = callback === undefined ? null : callback; if (callback !== null) { { if (typeof callback !== 'function') { error('render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback); } } update.callback = callback; } var root = enqueueUpdate(current$1, update, lane); if (root !== null) { scheduleUpdateOnFiber(root, current$1, lane, eventTime); entangleTransitions(root, current$1, lane); } return lane; } function getPublicRootInstance(container) { var containerFiber = container.current; if (!containerFiber.child) { return null; } switch (containerFiber.child.tag) { case HostComponent: return getPublicInstance(containerFiber.child.stateNode); default: return containerFiber.child.stateNode; } } function attemptSynchronousHydration$1(fiber) { switch (fiber.tag) { case HostRoot: { var root = fiber.stateNode; if (isRootDehydrated(root)) { // Flush the first scheduled "update". var lanes = getHighestPriorityPendingLanes(root); flushRoot(root, lanes); } break; } case SuspenseComponent: { flushSync(function () { var root = enqueueConcurrentRenderForLane(fiber, SyncLane); if (root !== null) { var eventTime = requestEventTime(); scheduleUpdateOnFiber(root, fiber, SyncLane, eventTime); } }); // If we're still blocked after this, we need to increase // the priority of any promises resolving within this // boundary so that they next attempt also has higher pri. var retryLane = SyncLane; markRetryLaneIfNotHydrated(fiber, retryLane); break; } } } function markRetryLaneImpl(fiber, retryLane) { var suspenseState = fiber.memoizedState; if (suspenseState !== null && suspenseState.dehydrated !== null) { suspenseState.retryLane = higherPriorityLane(suspenseState.retryLane, retryLane); } } // Increases the priority of thenables when they resolve within this boundary. function markRetryLaneIfNotHydrated(fiber, retryLane) { markRetryLaneImpl(fiber, retryLane); var alternate = fiber.alternate; if (alternate) { markRetryLaneImpl(alternate, retryLane); } } function attemptContinuousHydration$1(fiber) { if (fiber.tag !== SuspenseComponent) { // We ignore HostRoots here because we can't increase // their priority and they should not suspend on I/O, // since you have to wrap anything that might suspend in // Suspense. return; } var lane = SelectiveHydrationLane; var root = enqueueConcurrentRenderForLane(fiber, lane); if (root !== null) { var eventTime = requestEventTime(); scheduleUpdateOnFiber(root, fiber, lane, eventTime); } markRetryLaneIfNotHydrated(fiber, lane); } function attemptHydrationAtCurrentPriority$1(fiber) { if (fiber.tag !== SuspenseComponent) { // We ignore HostRoots here because we can't increase // their priority other than synchronously flush it. return; } var lane = requestUpdateLane(fiber); var root = enqueueConcurrentRenderForLane(fiber, lane); if (root !== null) { var eventTime = requestEventTime(); scheduleUpdateOnFiber(root, fiber, lane, eventTime); } markRetryLaneIfNotHydrated(fiber, lane); } function findHostInstanceWithNoPortals(fiber) { var hostFiber = findCurrentHostFiberWithNoPortals(fiber); if (hostFiber === null) { return null; } return hostFiber.stateNode; } var shouldErrorImpl = function (fiber) { return null; }; function shouldError(fiber) { return shouldErrorImpl(fiber); } var shouldSuspendImpl = function (fiber) { return false; }; function shouldSuspend(fiber) { return shouldSuspendImpl(fiber); } var overrideHookState = null; var overrideHookStateDeletePath = null; var overrideHookStateRenamePath = null; var overrideProps = null; var overridePropsDeletePath = null; var overridePropsRenamePath = null; var scheduleUpdate = null; var setErrorHandler = null; var setSuspenseHandler = null; { var copyWithDeleteImpl = function (obj, path, index) { var key = path[index]; var updated = isArray(obj) ? obj.slice() : assign({}, obj); if (index + 1 === path.length) { if (isArray(updated)) { updated.splice(key, 1); } else { delete updated[key]; } return updated; } // $FlowFixMe number or string is fine here updated[key] = copyWithDeleteImpl(obj[key], path, index + 1); return updated; }; var copyWithDelete = function (obj, path) { return copyWithDeleteImpl(obj, path, 0); }; var copyWithRenameImpl = function (obj, oldPath, newPath, index) { var oldKey = oldPath[index]; var updated = isArray(obj) ? obj.slice() : assign({}, obj); if (index + 1 === oldPath.length) { var newKey = newPath[index]; // $FlowFixMe number or string is fine here updated[newKey] = updated[oldKey]; if (isArray(updated)) { updated.splice(oldKey, 1); } else { delete updated[oldKey]; } } else { // $FlowFixMe number or string is fine here updated[oldKey] = copyWithRenameImpl( // $FlowFixMe number or string is fine here obj[oldKey], oldPath, newPath, index + 1); } return updated; }; var copyWithRename = function (obj, oldPath, newPath) { if (oldPath.length !== newPath.length) { warn('copyWithRename() expects paths of the same length'); return; } else { for (var i = 0; i < newPath.length - 1; i++) { if (oldPath[i] !== newPath[i]) { warn('copyWithRename() expects paths to be the same except for the deepest key'); return; } } } return copyWithRenameImpl(obj, oldPath, newPath, 0); }; var copyWithSetImpl = function (obj, path, index, value) { if (index >= path.length) { return value; } var key = path[index]; var updated = isArray(obj) ? obj.slice() : assign({}, obj); // $FlowFixMe number or string is fine here updated[key] = copyWithSetImpl(obj[key], path, index + 1, value); return updated; }; var copyWithSet = function (obj, path, value) { return copyWithSetImpl(obj, path, 0, value); }; var findHook = function (fiber, id) { // For now, the "id" of stateful hooks is just the stateful hook index. // This may change in the future with e.g. nested hooks. var currentHook = fiber.memoizedState; while (currentHook !== null && id > 0) { currentHook = currentHook.next; id--; } return currentHook; }; // Support DevTools editable values for useState and useReducer. overrideHookState = function (fiber, id, path, value) { var hook = findHook(fiber, id); if (hook !== null) { var newState = copyWithSet(hook.memoizedState, path, value); hook.memoizedState = newState; hook.baseState = newState; // We aren't actually adding an update to the queue, // because there is no update we can add for useReducer hooks that won't trigger an error. // (There's no appropriate action type for DevTools overrides.) // As a result though, React will see the scheduled update as a noop and bailout. // Shallow cloning props works as a workaround for now to bypass the bailout check. fiber.memoizedProps = assign({}, fiber.memoizedProps); var root = enqueueConcurrentRenderForLane(fiber, SyncLane); if (root !== null) { scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); } } }; overrideHookStateDeletePath = function (fiber, id, path) { var hook = findHook(fiber, id); if (hook !== null) { var newState = copyWithDelete(hook.memoizedState, path); hook.memoizedState = newState; hook.baseState = newState; // We aren't actually adding an update to the queue, // because there is no update we can add for useReducer hooks that won't trigger an error. // (There's no appropriate action type for DevTools overrides.) // As a result though, React will see the scheduled update as a noop and bailout. // Shallow cloning props works as a workaround for now to bypass the bailout check. fiber.memoizedProps = assign({}, fiber.memoizedProps); var root = enqueueConcurrentRenderForLane(fiber, SyncLane); if (root !== null) { scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); } } }; overrideHookStateRenamePath = function (fiber, id, oldPath, newPath) { var hook = findHook(fiber, id); if (hook !== null) { var newState = copyWithRename(hook.memoizedState, oldPath, newPath); hook.memoizedState = newState; hook.baseState = newState; // We aren't actually adding an update to the queue, // because there is no update we can add for useReducer hooks that won't trigger an error. // (There's no appropriate action type for DevTools overrides.) // As a result though, React will see the scheduled update as a noop and bailout. // Shallow cloning props works as a workaround for now to bypass the bailout check. fiber.memoizedProps = assign({}, fiber.memoizedProps); var root = enqueueConcurrentRenderForLane(fiber, SyncLane); if (root !== null) { scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); } } }; // Support DevTools props for function components, forwardRef, memo, host components, etc. overrideProps = function (fiber, path, value) { fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value); if (fiber.alternate) { fiber.alternate.pendingProps = fiber.pendingProps; } var root = enqueueConcurrentRenderForLane(fiber, SyncLane); if (root !== null) { scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); } }; overridePropsDeletePath = function (fiber, path) { fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path); if (fiber.alternate) { fiber.alternate.pendingProps = fiber.pendingProps; } var root = enqueueConcurrentRenderForLane(fiber, SyncLane); if (root !== null) { scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); } }; overridePropsRenamePath = function (fiber, oldPath, newPath) { fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath); if (fiber.alternate) { fiber.alternate.pendingProps = fiber.pendingProps; } var root = enqueueConcurrentRenderForLane(fiber, SyncLane); if (root !== null) { scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); } }; scheduleUpdate = function (fiber) { var root = enqueueConcurrentRenderForLane(fiber, SyncLane); if (root !== null) { scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); } }; setErrorHandler = function (newShouldErrorImpl) { shouldErrorImpl = newShouldErrorImpl; }; setSuspenseHandler = function (newShouldSuspendImpl) { shouldSuspendImpl = newShouldSuspendImpl; }; } function findHostInstanceByFiber(fiber) { var hostFiber = findCurrentHostFiber(fiber); if (hostFiber === null) { return null; } return hostFiber.stateNode; } function emptyFindFiberByHostInstance(instance) { return null; } function getCurrentFiberForDevTools() { return current; } function injectIntoDevTools(devToolsConfig) { var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; return injectInternals({ bundleType: devToolsConfig.bundleType, version: devToolsConfig.version, rendererPackageName: devToolsConfig.rendererPackageName, rendererConfig: devToolsConfig.rendererConfig, overrideHookState: overrideHookState, overrideHookStateDeletePath: overrideHookStateDeletePath, overrideHookStateRenamePath: overrideHookStateRenamePath, overrideProps: overrideProps, overridePropsDeletePath: overridePropsDeletePath, overridePropsRenamePath: overridePropsRenamePath, setErrorHandler: setErrorHandler, setSuspenseHandler: setSuspenseHandler, scheduleUpdate: scheduleUpdate, currentDispatcherRef: ReactCurrentDispatcher, findHostInstanceByFiber: findHostInstanceByFiber, findFiberByHostInstance: findFiberByHostInstance || emptyFindFiberByHostInstance, // React Refresh findHostInstancesForRefresh: findHostInstancesForRefresh , scheduleRefresh: scheduleRefresh , scheduleRoot: scheduleRoot , setRefreshHandler: setRefreshHandler , // Enables DevTools to append owner stacks to error messages in DEV mode. getCurrentFiber: getCurrentFiberForDevTools , // Enables DevTools to detect reconciler version rather than renderer version // which may not match for third party renderers. reconcilerVersion: ReactVersion }); } /* global reportError */ var defaultOnRecoverableError = typeof reportError === 'function' ? // In modern browsers, reportError will dispatch an error event, // emulating an uncaught JavaScript error. reportError : function (error) { // In older browsers and test environments, fallback to console.error. // eslint-disable-next-line react-internal/no-production-logging console['error'](error); }; function ReactDOMRoot(internalRoot) { this._internalRoot = internalRoot; } ReactDOMHydrationRoot.prototype.render = ReactDOMRoot.prototype.render = function (children) { var root = this._internalRoot; if (root === null) { throw new Error('Cannot update an unmounted root.'); } { if (typeof arguments[1] === 'function') { error('render(...): does not support the second callback argument. ' + 'To execute a side effect after rendering, declare it in a component body with useEffect().'); } else if (isValidContainer(arguments[1])) { error('You passed a container to the second argument of root.render(...). ' + "You don't need to pass it again since you already passed it to create the root."); } else if (typeof arguments[1] !== 'undefined') { error('You passed a second argument to root.render(...) but it only accepts ' + 'one argument.'); } var container = root.containerInfo; if (container.nodeType !== COMMENT_NODE) { var hostInstance = findHostInstanceWithNoPortals(root.current); if (hostInstance) { if (hostInstance.parentNode !== container) { error('render(...): It looks like the React-rendered content of the ' + 'root container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + "root.unmount() to empty a root's container."); } } } } updateContainer(children, root, null, null); }; ReactDOMHydrationRoot.prototype.unmount = ReactDOMRoot.prototype.unmount = function () { { if (typeof arguments[0] === 'function') { error('unmount(...): does not support a callback argument. ' + 'To execute a side effect after rendering, declare it in a component body with useEffect().'); } } var root = this._internalRoot; if (root !== null) { this._internalRoot = null; var container = root.containerInfo; { if (isAlreadyRendering()) { error('Attempted to synchronously unmount a root while React was already ' + 'rendering. React cannot finish unmounting the root until the ' + 'current render has completed, which may lead to a race condition.'); } } flushSync(function () { updateContainer(null, root, null, null); }); unmarkContainerAsRoot(container); } }; function createRoot(container, options) { if (!isValidContainer(container)) { throw new Error('createRoot(...): Target container is not a DOM element.'); } warnIfReactDOMContainerInDEV(container); var isStrictMode = false; var concurrentUpdatesByDefaultOverride = false; var identifierPrefix = ''; var onRecoverableError = defaultOnRecoverableError; var transitionCallbacks = null; if (options !== null && options !== undefined) { { if (options.hydrate) { warn('hydrate through createRoot is deprecated. Use ReactDOMClient.hydrateRoot(container, <App />) instead.'); } else { if (typeof options === 'object' && options !== null && options.$$typeof === REACT_ELEMENT_TYPE) { error('You passed a JSX element to createRoot. You probably meant to ' + 'call root.render instead. ' + 'Example usage:\n\n' + ' let root = createRoot(domContainer);\n' + ' root.render(<App />);'); } } } if (options.unstable_strictMode === true) { isStrictMode = true; } if (options.identifierPrefix !== undefined) { identifierPrefix = options.identifierPrefix; } if (options.onRecoverableError !== undefined) { onRecoverableError = options.onRecoverableError; } if (options.transitionCallbacks !== undefined) { transitionCallbacks = options.transitionCallbacks; } } var root = createContainer(container, ConcurrentRoot, null, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError); markContainerAsRoot(root.current, container); var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container; listenToAllSupportedEvents(rootContainerElement); return new ReactDOMRoot(root); } function ReactDOMHydrationRoot(internalRoot) { this._internalRoot = internalRoot; } function scheduleHydration(target) { if (target) { queueExplicitHydrationTarget(target); } } ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = scheduleHydration; function hydrateRoot(container, initialChildren, options) { if (!isValidContainer(container)) { throw new Error('hydrateRoot(...): Target container is not a DOM element.'); } warnIfReactDOMContainerInDEV(container); { if (initialChildren === undefined) { error('Must provide initial children as second argument to hydrateRoot. ' + 'Example usage: hydrateRoot(domContainer, <App />)'); } } // For now we reuse the whole bag of options since they contain // the hydration callbacks. var hydrationCallbacks = options != null ? options : null; // TODO: Delete this option var mutableSources = options != null && options.hydratedSources || null; var isStrictMode = false; var concurrentUpdatesByDefaultOverride = false; var identifierPrefix = ''; var onRecoverableError = defaultOnRecoverableError; if (options !== null && options !== undefined) { if (options.unstable_strictMode === true) { isStrictMode = true; } if (options.identifierPrefix !== undefined) { identifierPrefix = options.identifierPrefix; } if (options.onRecoverableError !== undefined) { onRecoverableError = options.onRecoverableError; } } var root = createHydrationContainer(initialChildren, null, container, ConcurrentRoot, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError); markContainerAsRoot(root.current, container); // This can't be a comment node since hydration doesn't work on comment nodes anyway. listenToAllSupportedEvents(container); if (mutableSources) { for (var i = 0; i < mutableSources.length; i++) { var mutableSource = mutableSources[i]; registerMutableSourceForHydration(root, mutableSource); } } return new ReactDOMHydrationRoot(root); } function isValidContainer(node) { return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || !disableCommentsAsDOMContainers )); } // TODO: Remove this function which also includes comment nodes. // We only use it in places that are currently more relaxed. function isValidContainerLegacy(node) { return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === ' react-mount-point-unstable ')); } function warnIfReactDOMContainerInDEV(container) { { if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === 'BODY') { error('createRoot(): Creating roots directly with document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try using a container element created ' + 'for your app.'); } if (isContainerMarkedAsRoot(container)) { if (container._reactRootContainer) { error('You are calling ReactDOMClient.createRoot() on a container that was previously ' + 'passed to ReactDOM.render(). This is not supported.'); } else { error('You are calling ReactDOMClient.createRoot() on a container that ' + 'has already been passed to createRoot() before. Instead, call ' + 'root.render() on the existing root instead if you want to update it.'); } } } } var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner; var topLevelUpdateWarnings; { topLevelUpdateWarnings = function (container) { if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) { var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer.current); if (hostInstance) { if (hostInstance.parentNode !== container) { error('render(...): It looks like the React-rendered content of this ' + 'container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + 'ReactDOM.unmountComponentAtNode to empty a container.'); } } } var isRootRenderedBySomeReact = !!container._reactRootContainer; var rootEl = getReactRootElementInContainer(container); var hasNonRootReactChild = !!(rootEl && getInstanceFromNode(rootEl)); if (hasNonRootReactChild && !isRootRenderedBySomeReact) { error('render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.'); } if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === 'BODY') { error('render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.'); } }; } function getReactRootElementInContainer(container) { if (!container) { return null; } if (container.nodeType === DOCUMENT_NODE) { return container.documentElement; } else { return container.firstChild; } } function noopOnRecoverableError() {// This isn't reachable because onRecoverableError isn't called in the // legacy API. } function legacyCreateRootFromDOMContainer(container, initialChildren, parentComponent, callback, isHydrationContainer) { if (isHydrationContainer) { if (typeof callback === 'function') { var originalCallback = callback; callback = function () { var instance = getPublicRootInstance(root); originalCallback.call(instance); }; } var root = createHydrationContainer(initialChildren, callback, container, LegacyRoot, null, // hydrationCallbacks false, // isStrictMode false, // concurrentUpdatesByDefaultOverride, '', // identifierPrefix noopOnRecoverableError); container._reactRootContainer = root; markContainerAsRoot(root.current, container); var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container; listenToAllSupportedEvents(rootContainerElement); flushSync(); return root; } else { // First clear any existing content. var rootSibling; while (rootSibling = container.lastChild) { container.removeChild(rootSibling); } if (typeof callback === 'function') { var _originalCallback = callback; callback = function () { var instance = getPublicRootInstance(_root); _originalCallback.call(instance); }; } var _root = createContainer(container, LegacyRoot, null, // hydrationCallbacks false, // isStrictMode false, // concurrentUpdatesByDefaultOverride, '', // identifierPrefix noopOnRecoverableError); container._reactRootContainer = _root; markContainerAsRoot(_root.current, container); var _rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container; listenToAllSupportedEvents(_rootContainerElement); // Initial mount should not be batched. flushSync(function () { updateContainer(initialChildren, _root, parentComponent, callback); }); return _root; } } function warnOnInvalidCallback$1(callback, callerName) { { if (callback !== null && typeof callback !== 'function') { error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback); } } } function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) { { topLevelUpdateWarnings(container); warnOnInvalidCallback$1(callback === undefined ? null : callback, 'render'); } var maybeRoot = container._reactRootContainer; var root; if (!maybeRoot) { // Initial mount root = legacyCreateRootFromDOMContainer(container, children, parentComponent, callback, forceHydrate); } else { root = maybeRoot; if (typeof callback === 'function') { var originalCallback = callback; callback = function () { var instance = getPublicRootInstance(root); originalCallback.call(instance); }; } // Update updateContainer(children, root, parentComponent, callback); } return getPublicRootInstance(root); } var didWarnAboutFindDOMNode = false; function findDOMNode(componentOrElement) { { if (!didWarnAboutFindDOMNode) { didWarnAboutFindDOMNode = true; error('findDOMNode is deprecated and will be removed in the next major ' + 'release. Instead, add a ref directly to the element you want ' + 'to reference. Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-find-node'); } var owner = ReactCurrentOwner$3.current; if (owner !== null && owner.stateNode !== null) { var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender; if (!warnedAboutRefsInRender) { error('%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromType(owner.type) || 'A component'); } owner.stateNode._warnedAboutRefsInRender = true; } } if (componentOrElement == null) { return null; } if (componentOrElement.nodeType === ELEMENT_NODE) { return componentOrElement; } { return findHostInstanceWithWarning(componentOrElement, 'findDOMNode'); } } function hydrate(element, container, callback) { { error('ReactDOM.hydrate is no longer supported in React 18. Use hydrateRoot ' + 'instead. Until you switch to the new API, your app will behave as ' + "if it's running React 17. Learn " + 'more: https://reactjs.org/link/switch-to-createroot'); } if (!isValidContainerLegacy(container)) { throw new Error('Target container is not a DOM element.'); } { var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; if (isModernRoot) { error('You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOMClient.createRoot(). This is not supported. ' + 'Did you mean to call hydrateRoot(container, element)?'); } } // TODO: throw or warn if we couldn't hydrate? return legacyRenderSubtreeIntoContainer(null, element, container, true, callback); } function render(element, container, callback) { { error('ReactDOM.render is no longer supported in React 18. Use createRoot ' + 'instead. Until you switch to the new API, your app will behave as ' + "if it's running React 17. Learn " + 'more: https://reactjs.org/link/switch-to-createroot'); } if (!isValidContainerLegacy(container)) { throw new Error('Target container is not a DOM element.'); } { var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; if (isModernRoot) { error('You are calling ReactDOM.render() on a container that was previously ' + 'passed to ReactDOMClient.createRoot(). This is not supported. ' + 'Did you mean to call root.render(element)?'); } } return legacyRenderSubtreeIntoContainer(null, element, container, false, callback); } function unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) { { error('ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported ' + 'in React 18. Consider using a portal instead. Until you switch to ' + "the createRoot API, your app will behave as if it's running React " + '17. Learn more: https://reactjs.org/link/switch-to-createroot'); } if (!isValidContainerLegacy(containerNode)) { throw new Error('Target container is not a DOM element.'); } if (parentComponent == null || !has(parentComponent)) { throw new Error('parentComponent must be a valid React Component'); } return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback); } var didWarnAboutUnmountComponentAtNode = false; function unmountComponentAtNode(container) { { if (!didWarnAboutUnmountComponentAtNode) { didWarnAboutUnmountComponentAtNode = true; error('unmountComponentAtNode is deprecated and will be removed in the ' + 'next major release. Switch to the createRoot API. Learn ' + 'more: https://reactjs.org/link/switch-to-createroot'); } } if (!isValidContainerLegacy(container)) { throw new Error('unmountComponentAtNode(...): Target container is not a DOM element.'); } { var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; if (isModernRoot) { error('You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' + 'passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.unmount()?'); } } if (container._reactRootContainer) { { var rootEl = getReactRootElementInContainer(container); var renderedByDifferentReact = rootEl && !getInstanceFromNode(rootEl); if (renderedByDifferentReact) { error("unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.'); } } // Unmount should not be batched. flushSync(function () { legacyRenderSubtreeIntoContainer(null, null, container, false, function () { // $FlowFixMe This should probably use `delete container._reactRootContainer` container._reactRootContainer = null; unmarkContainerAsRoot(container); }); }); // If you call unmountComponentAtNode twice in quick succession, you'll // get `true` twice. That's probably fine? return true; } else { { var _rootEl = getReactRootElementInContainer(container); var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode(_rootEl)); // Check if the container itself is a React root node. var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainerLegacy(container.parentNode) && !!container.parentNode._reactRootContainer; if (hasNonRootReactChild) { error("unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.'); } } return false; } } setAttemptSynchronousHydration(attemptSynchronousHydration$1); setAttemptContinuousHydration(attemptContinuousHydration$1); setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority$1); setGetCurrentUpdatePriority(getCurrentUpdatePriority); setAttemptHydrationAtPriority(runWithPriority); { if (typeof Map !== 'function' || // $FlowIssue Flow incorrectly thinks Map has no prototype Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || // $FlowIssue Flow incorrectly thinks Set has no prototype Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') { error('React depends on Map and Set built-in types. Make sure that you load a ' + 'polyfill in older browsers. https://reactjs.org/link/react-polyfills'); } } setRestoreImplementation(restoreControlledState$3); setBatchingImplementation(batchedUpdates$1, discreteUpdates, flushSync); function createPortal$1(children, container) { var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; if (!isValidContainer(container)) { throw new Error('Target container is not a DOM element.'); } // TODO: pass ReactDOM portal implementation as third argument // $FlowFixMe The Flow type is opaque but there's no way to actually create it. return createPortal(children, container, null, key); } function renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) { return unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback); } var Internals = { usingClientEntryPoint: false, // Keep in sync with ReactTestUtils.js. // This is an array for better minification. Events: [getInstanceFromNode, getNodeFromInstance, getFiberCurrentPropsFromNode, enqueueStateRestore, restoreStateIfNeeded, batchedUpdates$1] }; function createRoot$1(container, options) { { if (!Internals.usingClientEntryPoint && !true) { error('You are importing createRoot from "react-dom" which is not supported. ' + 'You should instead import it from "react-dom/client".'); } } return createRoot(container, options); } function hydrateRoot$1(container, initialChildren, options) { { if (!Internals.usingClientEntryPoint && !true) { error('You are importing hydrateRoot from "react-dom" which is not supported. ' + 'You should instead import it from "react-dom/client".'); } } return hydrateRoot(container, initialChildren, options); } // Overload the definition to the two valid signatures. // Warning, this opts-out of checking the function body. // eslint-disable-next-line no-redeclare function flushSync$1(fn) { { if (isAlreadyRendering()) { error('flushSync was called from inside a lifecycle method. React cannot ' + 'flush when React is already rendering. Consider moving this call to ' + 'a scheduler task or micro task.'); } } return flushSync(fn); } var foundDevTools = injectIntoDevTools({ findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 1 , version: ReactVersion, rendererPackageName: 'react-dom' }); { if (!foundDevTools && canUseDOM && window.top === window.self) { // If we're in Chrome or Firefox, provide a download link if not installed. if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) { var protocol = window.location.protocol; // Don't warn in exotic cases like chrome-extension://. if (/^(https?|file):$/.test(protocol)) { // eslint-disable-next-line react-internal/no-production-logging console.info('%cDownload the React DevTools ' + 'for a better development experience: ' + 'https://reactjs.org/link/react-devtools' + (protocol === 'file:' ? '\nYou might need to use a local HTTP server (instead of file://): ' + 'https://reactjs.org/link/react-devtools-faq' : ''), 'font-weight:bold'); } } } } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = createPortal$1; exports.createRoot = createRoot$1; exports.findDOMNode = findDOMNode; exports.flushSync = flushSync$1; exports.hydrate = hydrate; exports.hydrateRoot = hydrateRoot$1; exports.render = render; exports.unmountComponentAtNode = unmountComponentAtNode; exports.unstable_batchedUpdates = batchedUpdates$1; exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer; exports.version = ReactVersion; }))); vendor/lodash.min.js 0000644 00000212063 15151622574 0010447 0 ustar 00 /** * @license * Lodash <https://lodash.com/> * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ (function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u<i;){var o=n[u];t(e,o,r(o),n)}return e}function r(n,t){for(var r=-1,e=null==n?0:n.length;++r<e&&!1!==t(n[r],r,n););return n}function e(n,t){for(var r=null==n?0:n.length;r--&&!1!==t(n[r],r,n););return n}function u(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(!t(n[r],r,n))return!1;return!0}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function o(n,t){return!(null==n||!n.length)&&g(n,t,0)>-1}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function c(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}function p(n){return n.match(Qn)||[]}function _(n,t,r){var e;return r(n,(function(n,r,u){if(t(n,r,u))return e=r,!1})),e}function v(n,t,r,e){for(var u=n.length,i=r+(e?1:-1);e?i--:++i<u;)if(t(n[i],i,n))return i;return-1}function g(n,t,r){return t==t?function(n,t,r){for(var e=r-1,u=n.length;++e<u;)if(n[e]===t)return e;return-1}(n,t,r):v(n,d,r)}function y(n,t,r,e){for(var u=r-1,i=n.length;++u<i;)if(e(n[u],t))return u;return-1}function d(n){return n!=n}function b(n,t){var r=null==n?0:n.length;return r?j(n,t)/r:X}function w(n){return function(t){return null==t?N:t[n]}}function m(n){return function(t){return null==n?N:n[t]}}function x(n,t,r,e,u){return u(n,(function(n,u,i){r=e?(e=!1,n):t(r,n,u,i)})),r}function j(n,t){for(var r,e=-1,u=n.length;++e<u;){var i=t(n[e]);i!==N&&(r=r===N?i:r+i)}return r}function A(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function k(n){return n?n.slice(0,M(n)+1).replace(Vn,""):n}function O(n){return function(t){return n(t)}}function I(n,t){return c(t,(function(t){return n[t]}))}function R(n,t){return n.has(t)}function z(n,t){for(var r=-1,e=n.length;++r<e&&g(t,n[r],0)>-1;);return r}function E(n,t){for(var r=n.length;r--&&g(t,n[r],0)>-1;);return r}function S(n){return"\\"+Yt[n]}function W(n){return Zt.test(n)}function L(n){return Kt.test(n)}function C(n){var t=-1,r=Array(n.size);return n.forEach((function(n,e){r[++t]=[e,n]})),r}function U(n,t){return function(r){return n(t(r))}}function B(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&o!==Z||(n[r]=Z,i[u++]=r)}return i}function T(n){var t=-1,r=Array(n.size);return n.forEach((function(n){r[++t]=n})),r}function $(n){return W(n)?function(n){for(var t=Pt.lastIndex=0;Pt.test(n);)++t;return t}(n):_r(n)}function D(n){return W(n)?function(n){return n.match(Pt)||[]}(n):function(n){return n.split("")}(n)}function M(n){for(var t=n.length;t--&&Gn.test(n.charAt(t)););return t}function F(n){return n.match(qt)||[]}var N,P="Expected a function",q="__lodash_hash_undefined__",Z="__lodash_placeholder__",K=16,V=32,G=64,H=128,J=256,Y=1/0,Q=9007199254740991,X=NaN,nn=4294967295,tn=nn-1,rn=nn>>>1,en=[["ary",H],["bind",1],["bindKey",2],["curry",8],["curryRight",K],["flip",512],["partial",V],["partialRight",G],["rearg",J]],un="[object Arguments]",on="[object Array]",fn="[object Boolean]",cn="[object Date]",an="[object Error]",ln="[object Function]",sn="[object GeneratorFunction]",hn="[object Map]",pn="[object Number]",_n="[object Object]",vn="[object Promise]",gn="[object RegExp]",yn="[object Set]",dn="[object String]",bn="[object Symbol]",wn="[object WeakMap]",mn="[object ArrayBuffer]",xn="[object DataView]",jn="[object Float32Array]",An="[object Float64Array]",kn="[object Int8Array]",On="[object Int16Array]",In="[object Int32Array]",Rn="[object Uint8Array]",zn="[object Uint8ClampedArray]",En="[object Uint16Array]",Sn="[object Uint32Array]",Wn=/\b__p \+= '';/g,Ln=/\b(__p \+=) '' \+/g,Cn=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Un=/&(?:amp|lt|gt|quot|#39);/g,Bn=/[&<>"']/g,Tn=RegExp(Un.source),$n=RegExp(Bn.source),Dn=/<%-([\s\S]+?)%>/g,Mn=/<%([\s\S]+?)%>/g,Fn=/<%=([\s\S]+?)%>/g,Nn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pn=/^\w*$/,qn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Zn=/[\\^$.*+?()[\]{}|]/g,Kn=RegExp(Zn.source),Vn=/^\s+/,Gn=/\s/,Hn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Jn=/\{\n\/\* \[wrapped with (.+)\] \*/,Yn=/,? & /,Qn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Xn=/[()=,{}\[\]\/\s]/,nt=/\\(\\)?/g,tt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,rt=/\w*$/,et=/^[-+]0x[0-9a-f]+$/i,ut=/^0b[01]+$/i,it=/^\[object .+?Constructor\]$/,ot=/^0o[0-7]+$/i,ft=/^(?:0|[1-9]\d*)$/,ct=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,at=/($^)/,lt=/['\n\r\u2028\u2029\\]/g,st="\\ud800-\\udfff",ht="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",pt="\\u2700-\\u27bf",_t="a-z\\xdf-\\xf6\\xf8-\\xff",vt="A-Z\\xc0-\\xd6\\xd8-\\xde",gt="\\ufe0e\\ufe0f",yt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",dt="['’]",bt="["+st+"]",wt="["+yt+"]",mt="["+ht+"]",xt="\\d+",jt="["+pt+"]",At="["+_t+"]",kt="[^"+st+yt+xt+pt+_t+vt+"]",Ot="\\ud83c[\\udffb-\\udfff]",It="[^"+st+"]",Rt="(?:\\ud83c[\\udde6-\\uddff]){2}",zt="[\\ud800-\\udbff][\\udc00-\\udfff]",Et="["+vt+"]",St="\\u200d",Wt="(?:"+At+"|"+kt+")",Lt="(?:"+Et+"|"+kt+")",Ct="(?:['’](?:d|ll|m|re|s|t|ve))?",Ut="(?:['’](?:D|LL|M|RE|S|T|VE))?",Bt="(?:"+mt+"|"+Ot+")"+"?",Tt="["+gt+"]?",$t=Tt+Bt+("(?:"+St+"(?:"+[It,Rt,zt].join("|")+")"+Tt+Bt+")*"),Dt="(?:"+[jt,Rt,zt].join("|")+")"+$t,Mt="(?:"+[It+mt+"?",mt,Rt,zt,bt].join("|")+")",Ft=RegExp(dt,"g"),Nt=RegExp(mt,"g"),Pt=RegExp(Ot+"(?="+Ot+")|"+Mt+$t,"g"),qt=RegExp([Et+"?"+At+"+"+Ct+"(?="+[wt,Et,"$"].join("|")+")",Lt+"+"+Ut+"(?="+[wt,Et+Wt,"$"].join("|")+")",Et+"?"+Wt+"+"+Ct,Et+"+"+Ut,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",xt,Dt].join("|"),"g"),Zt=RegExp("["+St+st+ht+gt+"]"),Kt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Vt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Gt=-1,Ht={};Ht[jn]=Ht[An]=Ht[kn]=Ht[On]=Ht[In]=Ht[Rn]=Ht[zn]=Ht[En]=Ht[Sn]=!0,Ht[un]=Ht[on]=Ht[mn]=Ht[fn]=Ht[xn]=Ht[cn]=Ht[an]=Ht[ln]=Ht[hn]=Ht[pn]=Ht[_n]=Ht[gn]=Ht[yn]=Ht[dn]=Ht[wn]=!1;var Jt={};Jt[un]=Jt[on]=Jt[mn]=Jt[xn]=Jt[fn]=Jt[cn]=Jt[jn]=Jt[An]=Jt[kn]=Jt[On]=Jt[In]=Jt[hn]=Jt[pn]=Jt[_n]=Jt[gn]=Jt[yn]=Jt[dn]=Jt[bn]=Jt[Rn]=Jt[zn]=Jt[En]=Jt[Sn]=!0,Jt[an]=Jt[ln]=Jt[wn]=!1;var Yt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Qt=parseFloat,Xt=parseInt,nr="object"==typeof global&&global&&global.Object===Object&&global,tr="object"==typeof self&&self&&self.Object===Object&&self,rr=nr||tr||Function("return this")(),er="object"==typeof exports&&exports&&!exports.nodeType&&exports,ur=er&&"object"==typeof module&&module&&!module.nodeType&&module,ir=ur&&ur.exports===er,or=ir&&nr.process,fr=function(){try{var n=ur&&ur.require&&ur.require("util").types;return n||or&&or.binding&&or.binding("util")}catch(n){}}(),cr=fr&&fr.isArrayBuffer,ar=fr&&fr.isDate,lr=fr&&fr.isMap,sr=fr&&fr.isRegExp,hr=fr&&fr.isSet,pr=fr&&fr.isTypedArray,_r=w("length"),vr=m({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),gr=m({"&":"&","<":"<",">":">",'"':""","'":"'"}),yr=m({"&":"&","<":"<",">":">",""":'"',"'":"'"}),dr=function m(Gn){function Qn(n){if(Mu(n)&&!Sf(n)&&!(n instanceof pt)){if(n instanceof ht)return n;if(zi.call(n,"__wrapped__"))return hu(n)}return new ht(n)}function st(){}function ht(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=N}function pt(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=nn,this.__views__=[]}function _t(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function vt(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function gt(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function yt(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new gt;++t<r;)this.add(n[t])}function dt(n){this.size=(this.__data__=new vt(n)).size}function bt(n,t){var r=Sf(n),e=!r&&Ef(n),u=!r&&!e&&Lf(n),i=!r&&!e&&!u&&$f(n),o=r||e||u||i,f=o?A(n.length,xi):[],c=f.length;for(var a in n)!t&&!zi.call(n,a)||o&&("length"==a||u&&("offset"==a||"parent"==a)||i&&("buffer"==a||"byteLength"==a||"byteOffset"==a)||Je(a,c))||f.push(a);return f}function wt(n){var t=n.length;return t?n[Lr(0,t-1)]:N}function mt(n,t){return cu(le(n),Et(t,0,n.length))}function xt(n){return cu(le(n))}function jt(n,t,r){(r===N||Wu(n[t],r))&&(r!==N||t in n)||Rt(n,t,r)}function At(n,t,r){var e=n[t];zi.call(n,t)&&Wu(e,r)&&(r!==N||t in n)||Rt(n,t,r)}function kt(n,t){for(var r=n.length;r--;)if(Wu(n[r][0],t))return r;return-1}function Ot(n,t,r,e){return Ro(n,(function(n,u,i){t(e,n,r(n),i)})),e}function It(n,t){return n&&se(t,ni(t),n)}function Rt(n,t,r){"__proto__"==t&&Vi?Vi(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}function zt(n,t){for(var r=-1,e=t.length,u=vi(e),i=null==n;++r<e;)u[r]=i?N:Qu(n,t[r]);return u}function Et(n,t,r){return n==n&&(r!==N&&(n=n<=r?n:r),t!==N&&(n=n>=t?n:t)),n}function St(n,t,e,u,i,o){var f,c=1&t,a=2&t,l=4&t;if(e&&(f=i?e(n,u,i,o):e(n)),f!==N)return f;if(!Du(n))return n;var s=Sf(n);if(s){if(f=function(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&zi.call(n,"index")&&(r.index=n.index,r.input=n.input),r}(n),!c)return le(n,f)}else{var h=Mo(n),p=h==ln||h==sn;if(Lf(n))return ue(n,c);if(h==_n||h==un||p&&!i){if(f=a||p?{}:Ge(n),!c)return a?function(n,t){return se(n,Do(n),t)}(n,function(n,t){return n&&se(t,ti(t),n)}(f,n)):function(n,t){return se(n,$o(n),t)}(n,It(f,n))}else{if(!Jt[h])return i?n:{};f=function(n,t,r){var e=n.constructor;switch(t){case mn:return ie(n);case fn:case cn:return new e(+n);case xn:return function(n,t){return new n.constructor(t?ie(n.buffer):n.buffer,n.byteOffset,n.byteLength)}(n,r);case jn:case An:case kn:case On:case In:case Rn:case zn:case En:case Sn:return oe(n,r);case hn:return new e;case pn:case dn:return new e(n);case gn:return function(n){var t=new n.constructor(n.source,rt.exec(n));return t.lastIndex=n.lastIndex,t}(n);case yn:return new e;case bn:return function(n){return ko?wi(ko.call(n)):{}}(n)}}(n,h,c)}}o||(o=new dt);var _=o.get(n);if(_)return _;o.set(n,f),Tf(n)?n.forEach((function(r){f.add(St(r,t,e,r,n,o))})):Uf(n)&&n.forEach((function(r,u){f.set(u,St(r,t,e,u,n,o))}));var v=s?N:(l?a?Me:De:a?ti:ni)(n);return r(v||n,(function(r,u){v&&(r=n[u=r]),At(f,u,St(r,t,e,u,n,o))})),f}function Wt(n,t,r){var e=r.length;if(null==n)return!e;for(n=wi(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===N&&!(u in n)||!i(o))return!1}return!0}function Lt(n,t,r){if("function"!=typeof n)throw new ji(P);return Po((function(){n.apply(N,r)}),t)}function Ct(n,t,r,e){var u=-1,i=o,a=!0,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,O(r))),e?(i=f,a=!1):t.length>=200&&(i=R,a=!1,t=new yt(t));n:for(;++u<l;){var p=n[u],_=null==r?p:r(p);if(p=e||0!==p?p:0,a&&_==_){for(var v=h;v--;)if(t[v]===_)continue n;s.push(p)}else i(t,_,e)||s.push(p)}return s}function Ut(n,t){var r=!0;return Ro(n,(function(n,e,u){return r=!!t(n,e,u)})),r}function Bt(n,t,r){for(var e=-1,u=n.length;++e<u;){var i=n[e],o=t(i);if(null!=o&&(f===N?o==o&&!qu(o):r(o,f)))var f=o,c=i}return c}function Tt(n,t){var r=[];return Ro(n,(function(n,e,u){t(n,e,u)&&r.push(n)})),r}function $t(n,t,r,e,u){var i=-1,o=n.length;for(r||(r=He),u||(u=[]);++i<o;){var f=n[i];t>0&&r(f)?t>1?$t(f,t-1,r,e,u):a(u,f):e||(u[u.length]=f)}return u}function Dt(n,t){return n&&Eo(n,t,ni)}function Mt(n,t){return n&&So(n,t,ni)}function Pt(n,t){return i(t,(function(t){return Bu(n[t])}))}function qt(n,t){for(var r=0,e=(t=re(t,n)).length;null!=n&&r<e;)n=n[au(t[r++])];return r&&r==e?n:N}function Zt(n,t,r){var e=t(n);return Sf(n)?e:a(e,r(n))}function Kt(n){return null==n?n===N?"[object Undefined]":"[object Null]":Ki&&Ki in wi(n)?function(n){var t=zi.call(n,Ki),r=n[Ki];try{n[Ki]=N;var e=!0}catch(n){}var u=Wi.call(n);return e&&(t?n[Ki]=r:delete n[Ki]),u}(n):function(n){return Wi.call(n)}(n)}function Yt(n,t){return n>t}function nr(n,t){return null!=n&&zi.call(n,t)}function tr(n,t){return null!=n&&t in wi(n)}function er(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=vi(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,O(t))),s=io(p.length,s),l[a]=!r&&(t||u>=120&&p.length>=120)?new yt(a&&p):N}p=n[0];var _=-1,v=l[0];n:for(;++_<u&&h.length<s;){var g=p[_],y=t?t(g):g;if(g=r||0!==g?g:0,!(v?R(v,y):e(h,y,r))){for(a=i;--a;){var d=l[a];if(!(d?R(d,y):e(n[a],y,r)))continue n}v&&v.push(y),h.push(g)}}return h}function ur(t,r,e){var u=null==(t=uu(t,r=re(r,t)))?t:t[au(yu(r))];return null==u?N:n(u,t,e)}function or(n){return Mu(n)&&Kt(n)==un}function fr(n,t,r,e,u){return n===t||(null==n||null==t||!Mu(n)&&!Mu(t)?n!=n&&t!=t:function(n,t,r,e,u,i){var o=Sf(n),f=Sf(t),c=o?on:Mo(n),a=f?on:Mo(t);c=c==un?_n:c,a=a==un?_n:a;var l=c==_n,s=a==_n,h=c==a;if(h&&Lf(n)){if(!Lf(t))return!1;o=!0,l=!1}if(h&&!l)return i||(i=new dt),o||$f(n)?Te(n,t,r,e,u,i):function(n,t,r,e,u,i,o){switch(r){case xn:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;n=n.buffer,t=t.buffer;case mn:return!(n.byteLength!=t.byteLength||!i(new $i(n),new $i(t)));case fn:case cn:case pn:return Wu(+n,+t);case an:return n.name==t.name&&n.message==t.message;case gn:case dn:return n==t+"";case hn:var f=C;case yn:var c=1&e;if(f||(f=T),n.size!=t.size&&!c)return!1;var a=o.get(n);if(a)return a==t;e|=2,o.set(n,t);var l=Te(f(n),f(t),e,u,i,o);return o.delete(n),l;case bn:if(ko)return ko.call(n)==ko.call(t)}return!1}(n,t,c,r,e,u,i);if(!(1&r)){var p=l&&zi.call(n,"__wrapped__"),_=s&&zi.call(t,"__wrapped__");if(p||_){var v=p?n.value():n,g=_?t.value():t;return i||(i=new dt),u(v,g,r,e,i)}}return!!h&&(i||(i=new dt),function(n,t,r,e,u,i){var o=1&r,f=De(n),c=f.length;if(c!=De(t).length&&!o)return!1;for(var a=c;a--;){var l=f[a];if(!(o?l in t:zi.call(t,l)))return!1}var s=i.get(n),h=i.get(t);if(s&&h)return s==t&&h==n;var p=!0;i.set(n,t),i.set(t,n);for(var _=o;++a<c;){var v=n[l=f[a]],g=t[l];if(e)var y=o?e(g,v,l,t,n,i):e(v,g,l,n,t,i);if(!(y===N?v===g||u(v,g,r,e,i):y)){p=!1;break}_||(_="constructor"==l)}if(p&&!_){var d=n.constructor,b=t.constructor;d!=b&&"constructor"in n&&"constructor"in t&&!("function"==typeof d&&d instanceof d&&"function"==typeof b&&b instanceof b)&&(p=!1)}return i.delete(n),i.delete(t),p}(n,t,r,e,u,i))}(n,t,r,e,fr,u))}function _r(n,t,r,e){var u=r.length,i=u,o=!e;if(null==n)return!i;for(n=wi(n);u--;){var f=r[u];if(o&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return!1}for(;++u<i;){var c=(f=r[u])[0],a=n[c],l=f[1];if(o&&f[2]){if(a===N&&!(c in n))return!1}else{var s=new dt;if(e)var h=e(a,l,c,n,t,s);if(!(h===N?fr(l,a,3,e,s):h))return!1}}return!0}function br(n){return!(!Du(n)||function(n){return!!Si&&Si in n}(n))&&(Bu(n)?Ui:it).test(lu(n))}function wr(n){return"function"==typeof n?n:null==n?ci:"object"==typeof n?Sf(n)?Or(n[0],n[1]):kr(n):hi(n)}function mr(n){if(!nu(n))return eo(n);var t=[];for(var r in wi(n))zi.call(n,r)&&"constructor"!=r&&t.push(r);return t}function xr(n){if(!Du(n))return function(n){var t=[];if(null!=n)for(var r in wi(n))t.push(r);return t}(n);var t=nu(n),r=[];for(var e in n)("constructor"!=e||!t&&zi.call(n,e))&&r.push(e);return r}function jr(n,t){return n<t}function Ar(n,t){var r=-1,e=Lu(n)?vi(n.length):[];return Ro(n,(function(n,u,i){e[++r]=t(n,u,i)})),e}function kr(n){var t=Ze(n);return 1==t.length&&t[0][2]?ru(t[0][0],t[0][1]):function(r){return r===n||_r(r,n,t)}}function Or(n,t){return Qe(n)&&tu(t)?ru(au(n),t):function(r){var e=Qu(r,n);return e===N&&e===t?Xu(r,n):fr(t,e,3)}}function Ir(n,t,r,e,u){n!==t&&Eo(t,(function(i,o){if(u||(u=new dt),Du(i))!function(n,t,r,e,u,i,o){var f=iu(n,r),c=iu(t,r),a=o.get(c);if(a)return jt(n,r,a),N;var l=i?i(f,c,r+"",n,t,o):N,s=l===N;if(s){var h=Sf(c),p=!h&&Lf(c),_=!h&&!p&&$f(c);l=c,h||p||_?Sf(f)?l=f:Cu(f)?l=le(f):p?(s=!1,l=ue(c,!0)):_?(s=!1,l=oe(c,!0)):l=[]:Nu(c)||Ef(c)?(l=f,Ef(f)?l=Ju(f):Du(f)&&!Bu(f)||(l=Ge(c))):s=!1}s&&(o.set(c,l),u(l,c,e,i,o),o.delete(c)),jt(n,r,l)}(n,t,o,r,Ir,e,u);else{var f=e?e(iu(n,o),i,o+"",n,t,u):N;f===N&&(f=i),jt(n,o,f)}}),ti)}function Rr(n,t){var r=n.length;if(r)return Je(t+=t<0?r:0,r)?n[t]:N}function zr(n,t,r){t=t.length?c(t,(function(n){return Sf(n)?function(t){return qt(t,1===n.length?n[0]:n)}:n})):[ci];var e=-1;return t=c(t,O(Pe())),function(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].value;return n}(Ar(n,(function(n,r,u){return{criteria:c(t,(function(t){return t(n)})),index:++e,value:n}})),(function(n,t){return function(n,t,r){for(var e=-1,u=n.criteria,i=t.criteria,o=u.length,f=r.length;++e<o;){var c=fe(u[e],i[e]);if(c)return e>=f?c:c*("desc"==r[e]?-1:1)}return n.index-t.index}(n,t,r)}))}function Er(n,t,r){for(var e=-1,u=t.length,i={};++e<u;){var o=t[e],f=qt(n,o);r(f,o)&&$r(i,re(o,n),f)}return i}function Sr(n,t,r,e){var u=e?y:g,i=-1,o=t.length,f=n;for(n===t&&(t=le(t)),r&&(f=c(n,O(r)));++i<o;)for(var a=0,l=t[i],s=r?r(l):l;(a=u(f,s,a,e))>-1;)f!==n&&Pi.call(f,a,1),Pi.call(n,a,1);return n}function Wr(n,t){for(var r=n?t.length:0,e=r-1;r--;){var u=t[r];if(r==e||u!==i){var i=u;Je(u)?Pi.call(n,u,1):Gr(n,u)}}return n}function Lr(n,t){return n+Qi(co()*(t-n+1))}function Cr(n,t){var r="";if(!n||t<1||t>Q)return r;do{t%2&&(r+=n),(t=Qi(t/2))&&(n+=n)}while(t);return r}function Ur(n,t){return qo(eu(n,t,ci),n+"")}function Br(n){return wt(ei(n))}function Tr(n,t){var r=ei(n);return cu(r,Et(t,0,r.length))}function $r(n,t,r,e){if(!Du(n))return n;for(var u=-1,i=(t=re(t,n)).length,o=i-1,f=n;null!=f&&++u<i;){var c=au(t[u]),a=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return n;if(u!=o){var l=f[c];(a=e?e(l,c,f):N)===N&&(a=Du(l)?l:Je(t[u+1])?[]:{})}At(f,c,a),f=f[c]}return n}function Dr(n){return cu(ei(n))}function Mr(n,t,r){var e=-1,u=n.length;t<0&&(t=-t>u?0:u+t),(r=r>u?u:r)<0&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0;for(var i=vi(u);++e<u;)i[e]=n[e+t];return i}function Fr(n,t){var r;return Ro(n,(function(n,e,u){return!(r=t(n,e,u))})),!!r}function Nr(n,t,r){var e=0,u=null==n?e:n.length;if("number"==typeof t&&t==t&&u<=rn){for(;e<u;){var i=e+u>>>1,o=n[i];null!==o&&!qu(o)&&(r?o<=t:o<t)?e=i+1:u=i}return u}return Pr(n,t,ci,r)}function Pr(n,t,r,e){var u=0,i=null==n?0:n.length;if(0===i)return 0;for(var o=(t=r(t))!=t,f=null===t,c=qu(t),a=t===N;u<i;){var l=Qi((u+i)/2),s=r(n[l]),h=s!==N,p=null===s,_=s==s,v=qu(s);if(o)var g=e||_;else g=a?_&&(e||h):f?_&&h&&(e||!p):c?_&&h&&!p&&(e||!v):!p&&!v&&(e?s<=t:s<t);g?u=l+1:i=l}return io(i,tn)}function qr(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r],f=t?t(o):o;if(!r||!Wu(f,c)){var c=f;i[u++]=0===o?0:o}}return i}function Zr(n){return"number"==typeof n?n:qu(n)?X:+n}function Kr(n){if("string"==typeof n)return n;if(Sf(n))return c(n,Kr)+"";if(qu(n))return Oo?Oo.call(n):"";var t=n+"";return"0"==t&&1/n==-Y?"-0":t}function Vr(n,t,r){var e=-1,u=o,i=n.length,c=!0,a=[],l=a;if(r)c=!1,u=f;else if(i>=200){var s=t?null:Bo(n);if(s)return T(s);c=!1,u=R,l=new yt}else l=t?[]:a;n:for(;++e<i;){var h=n[e],p=t?t(h):h;if(h=r||0!==h?h:0,c&&p==p){for(var _=l.length;_--;)if(l[_]===p)continue n;t&&l.push(p),a.push(h)}else u(l,p,r)||(l!==a&&l.push(p),a.push(h))}return a}function Gr(n,t){return null==(n=uu(n,t=re(t,n)))||delete n[au(yu(t))]}function Hr(n,t,r,e){return $r(n,t,r(qt(n,t)),e)}function Jr(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++i<u)&&t(n[i],i,n););return r?Mr(n,e?0:i,e?i+1:u):Mr(n,e?i+1:0,e?u:i)}function Yr(n,t){var r=n;return r instanceof pt&&(r=r.value()),l(t,(function(n,t){return t.func.apply(t.thisArg,a([n],t.args))}),r)}function Qr(n,t,r){var e=n.length;if(e<2)return e?Vr(n[0]):[];for(var u=-1,i=vi(e);++u<e;)for(var o=n[u],f=-1;++f<e;)f!=u&&(i[u]=Ct(i[u]||o,n[f],t,r));return Vr($t(i,1),t,r)}function Xr(n,t,r){for(var e=-1,u=n.length,i=t.length,o={};++e<u;)r(o,n[e],e<i?t[e]:N);return o}function ne(n){return Cu(n)?n:[]}function te(n){return"function"==typeof n?n:ci}function re(n,t){return Sf(n)?n:Qe(n,t)?[n]:Zo(Yu(n))}function ee(n,t,r){var e=n.length;return r=r===N?e:r,!t&&r>=e?n:Mr(n,t,r)}function ue(n,t){if(t)return n.slice();var r=n.length,e=Di?Di(r):new n.constructor(r);return n.copy(e),e}function ie(n){var t=new n.constructor(n.byteLength);return new $i(t).set(new $i(n)),t}function oe(n,t){return new n.constructor(t?ie(n.buffer):n.buffer,n.byteOffset,n.length)}function fe(n,t){if(n!==t){var r=n!==N,e=null===n,u=n==n,i=qu(n),o=t!==N,f=null===t,c=t==t,a=qu(t);if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&n<t||a&&r&&u&&!e&&!i||f&&r&&u||!o&&u||!c)return-1}return 0}function ce(n,t,r,e){for(var u=-1,i=n.length,o=r.length,f=-1,c=t.length,a=uo(i-o,0),l=vi(c+a),s=!e;++f<c;)l[f]=t[f];for(;++u<o;)(s||u<i)&&(l[r[u]]=n[u]);for(;a--;)l[f++]=n[u++];return l}function ae(n,t,r,e){for(var u=-1,i=n.length,o=-1,f=r.length,c=-1,a=t.length,l=uo(i-f,0),s=vi(l+a),h=!e;++u<l;)s[u]=n[u];for(var p=u;++c<a;)s[p+c]=t[c];for(;++o<f;)(h||u<i)&&(s[p+r[o]]=n[u++]);return s}function le(n,t){var r=-1,e=n.length;for(t||(t=vi(e));++r<e;)t[r]=n[r];return t}function se(n,t,r,e){var u=!r;r||(r={});for(var i=-1,o=t.length;++i<o;){var f=t[i],c=e?e(r[f],n[f],f,r,n):N;c===N&&(c=n[f]),u?Rt(r,f,c):At(r,f,c)}return r}function he(n,r){return function(e,u){var i=Sf(e)?t:Ot,o=r?r():{};return i(e,n,Pe(u,2),o)}}function pe(n){return Ur((function(t,r){var e=-1,u=r.length,i=u>1?r[u-1]:N,o=u>2?r[2]:N;for(i=n.length>3&&"function"==typeof i?(u--,i):N,o&&Ye(r[0],r[1],o)&&(i=u<3?N:i,u=1),t=wi(t);++e<u;){var f=r[e];f&&n(t,f,e,i)}return t}))}function _e(n,t){return function(r,e){if(null==r)return r;if(!Lu(r))return n(r,e);for(var u=r.length,i=t?u:-1,o=wi(r);(t?i--:++i<u)&&!1!==e(o[i],i,o););return r}}function ve(n){return function(t,r,e){for(var u=-1,i=wi(t),o=e(t),f=o.length;f--;){var c=o[n?f:++u];if(!1===r(i[c],c,i))break}return t}}function ge(n){return function(t){var r=W(t=Yu(t))?D(t):N,e=r?r[0]:t.charAt(0),u=r?ee(r,1).join(""):t.slice(1);return e[n]()+u}}function ye(n){return function(t){return l(oi(ii(t).replace(Ft,"")),n,"")}}function de(n){return function(){var t=arguments;switch(t.length){case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=Io(n.prototype),e=n.apply(r,t);return Du(e)?e:r}}function be(t,r,e){var u=de(t);return function i(){for(var o=arguments.length,f=vi(o),c=o,a=Ne(i);c--;)f[c]=arguments[c];var l=o<3&&f[0]!==a&&f[o-1]!==a?[]:B(f,a);return(o-=l.length)<e?Ee(t,r,xe,i.placeholder,N,f,l,N,N,e-o):n(this&&this!==rr&&this instanceof i?u:t,this,f)}}function we(n){return function(t,r,e){var u=wi(t);if(!Lu(t)){var i=Pe(r,3);t=ni(t),r=function(n){return i(u[n],n,u)}}var o=n(t,r,e);return o>-1?u[i?t[o]:o]:N}}function me(n){return $e((function(t){var r=t.length,e=r,u=ht.prototype.thru;for(n&&t.reverse();e--;){var i=t[e];if("function"!=typeof i)throw new ji(P);if(u&&!o&&"wrapper"==Fe(i))var o=new ht([],!0)}for(e=o?e:r;++e<r;){var f=Fe(i=t[e]),c="wrapper"==f?To(i):N;o=c&&Xe(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?o[Fe(c[0])].apply(o,c[3]):1==i.length&&Xe(i)?o[f]():o.thru(i)}return function(){var n=arguments,e=n[0];if(o&&1==n.length&&Sf(e))return o.plant(e).value();for(var u=0,i=r?t[u].apply(this,n):e;++u<r;)i=t[u].call(this,i);return i}}))}function xe(n,t,r,e,u,i,o,f,c,a){var l=t&H,s=1&t,h=2&t,p=24&t,_=512&t,v=h?N:de(n);return function g(){for(var y=arguments.length,d=vi(y),b=y;b--;)d[b]=arguments[b];if(p)var w=Ne(g),m=function(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;return e}(d,w);if(e&&(d=ce(d,e,u,p)),i&&(d=ae(d,i,o,p)),y-=m,p&&y<a)return Ee(n,t,xe,g.placeholder,r,d,B(d,w),f,c,a-y);var x=s?r:this,j=h?x[n]:n;return y=d.length,f?d=function(n,t){for(var r=n.length,e=io(t.length,r),u=le(n);e--;){var i=t[e];n[e]=Je(i,r)?u[i]:N}return n}(d,f):_&&y>1&&d.reverse(),l&&c<y&&(d.length=c),this&&this!==rr&&this instanceof g&&(j=v||de(j)),j.apply(x,d)}}function je(n,t){return function(r,e){return function(n,t,r,e){return Dt(n,(function(n,u,i){t(e,r(n),u,i)})),e}(r,n,t(e),{})}}function Ae(n,t){return function(r,e){var u;if(r===N&&e===N)return t;if(r!==N&&(u=r),e!==N){if(u===N)return e;"string"==typeof r||"string"==typeof e?(r=Kr(r),e=Kr(e)):(r=Zr(r),e=Zr(e)),u=n(r,e)}return u}}function ke(t){return $e((function(r){return r=c(r,O(Pe())),Ur((function(e){var u=this;return t(r,(function(t){return n(t,u,e)}))}))}))}function Oe(n,t){var r=(t=t===N?" ":Kr(t)).length;if(r<2)return r?Cr(t,n):t;var e=Cr(t,Yi(n/$(t)));return W(t)?ee(D(e),0,n).join(""):e.slice(0,n)}function Ie(t,r,e,u){var i=1&r,o=de(t);return function r(){for(var f=-1,c=arguments.length,a=-1,l=u.length,s=vi(l+c),h=this&&this!==rr&&this instanceof r?o:t;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++f];return n(h,i?e:this,s)}}function Re(n){return function(t,r,e){return e&&"number"!=typeof e&&Ye(t,r,e)&&(r=e=N),t=Ku(t),r===N?(r=t,t=0):r=Ku(r),function(n,t,r,e){for(var u=-1,i=uo(Yi((t-n)/(r||1)),0),o=vi(i);i--;)o[e?i:++u]=n,n+=r;return o}(t,r,e=e===N?t<r?1:-1:Ku(e),n)}}function ze(n){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=Hu(t),r=Hu(r)),n(t,r)}}function Ee(n,t,r,e,u,i,o,f,c,a){var l=8&t;t|=l?V:G,4&(t&=~(l?G:V))||(t&=-4);var s=[n,t,u,l?i:N,l?o:N,l?N:i,l?N:o,f,c,a],h=r.apply(N,s);return Xe(n)&&No(h,s),h.placeholder=e,ou(h,n,t)}function Se(n){var t=bi[n];return function(n,r){if(n=Hu(n),(r=null==r?0:io(Vu(r),292))&&to(n)){var e=(Yu(n)+"e").split("e");return+((e=(Yu(t(e[0]+"e"+(+e[1]+r)))+"e").split("e"))[0]+"e"+(+e[1]-r))}return t(n)}}function We(n){return function(t){var r=Mo(t);return r==hn?C(t):r==yn?function(n){var t=-1,r=Array(n.size);return n.forEach((function(n){r[++t]=[n,n]})),r}(t):function(n,t){return c(t,(function(t){return[t,n[t]]}))}(t,n(t))}}function Le(n,t,r,e,u,i,o,f){var c=2&t;if(!c&&"function"!=typeof n)throw new ji(P);var a=e?e.length:0;if(a||(t&=-97,e=u=N),o=o===N?o:uo(Vu(o),0),f=f===N?f:Vu(f),a-=u?u.length:0,t&G){var l=e,s=u;e=u=N}var h=c?N:To(n),p=[n,t,r,e,u,l,s,i,o,f];if(h&&function(n,t){var r=n[1],e=t[1],u=r|e,i=u<131,o=e==H&&8==r||e==H&&r==J&&n[7].length<=t[8]||384==e&&t[7].length<=t[8]&&8==r;if(!i&&!o)return n;1&e&&(n[2]=t[2],u|=1&r?0:4);var f=t[3];if(f){var c=n[3];n[3]=c?ce(c,f,t[4]):f,n[4]=c?B(n[3],Z):t[4]}f=t[5],f&&(c=n[5],n[5]=c?ae(c,f,t[6]):f,n[6]=c?B(n[5],Z):t[6]),f=t[7],f&&(n[7]=f),e&H&&(n[8]=null==n[8]?t[8]:io(n[8],t[8])),null==n[9]&&(n[9]=t[9]),n[0]=t[0],n[1]=u}(p,h),n=p[0],t=p[1],r=p[2],e=p[3],u=p[4],!(f=p[9]=p[9]===N?c?0:n.length:uo(p[9]-a,0))&&24&t&&(t&=-25),t&&1!=t)_=8==t||t==K?be(n,t,f):t!=V&&33!=t||u.length?xe.apply(N,p):Ie(n,t,r,e);else var _=function(n,t,r){var e=1&t,u=de(n);return function t(){return(this&&this!==rr&&this instanceof t?u:n).apply(e?r:this,arguments)}}(n,t,r);return ou((h?Wo:No)(_,p),n,t)}function Ce(n,t,r,e){return n===N||Wu(n,Oi[r])&&!zi.call(e,r)?t:n}function Ue(n,t,r,e,u,i){return Du(n)&&Du(t)&&(i.set(t,n),Ir(n,t,N,Ue,i),i.delete(t)),n}function Be(n){return Nu(n)?N:n}function Te(n,t,r,e,u,i){var o=1&r,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return!1;var a=i.get(n),l=i.get(t);if(a&&l)return a==t&&l==n;var s=-1,p=!0,_=2&r?new yt:N;for(i.set(n,t),i.set(t,n);++s<f;){var v=n[s],g=t[s];if(e)var y=o?e(g,v,s,t,n,i):e(v,g,s,n,t,i);if(y!==N){if(y)continue;p=!1;break}if(_){if(!h(t,(function(n,t){if(!R(_,t)&&(v===n||u(v,n,r,e,i)))return _.push(t)}))){p=!1;break}}else if(v!==g&&!u(v,g,r,e,i)){p=!1;break}}return i.delete(n),i.delete(t),p}function $e(n){return qo(eu(n,N,vu),n+"")}function De(n){return Zt(n,ni,$o)}function Me(n){return Zt(n,ti,Do)}function Fe(n){for(var t=n.name+"",r=yo[t],e=zi.call(yo,t)?r.length:0;e--;){var u=r[e],i=u.func;if(null==i||i==n)return u.name}return t}function Ne(n){return(zi.call(Qn,"placeholder")?Qn:n).placeholder}function Pe(){var n=Qn.iteratee||ai;return n=n===ai?wr:n,arguments.length?n(arguments[0],arguments[1]):n}function qe(n,t){var r=n.__data__;return function(n){var t=typeof n;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==n:null===n}(t)?r["string"==typeof t?"string":"hash"]:r.map}function Ze(n){for(var t=ni(n),r=t.length;r--;){var e=t[r],u=n[e];t[r]=[e,u,tu(u)]}return t}function Ke(n,t){var r=function(n,t){return null==n?N:n[t]}(n,t);return br(r)?r:N}function Ve(n,t,r){for(var e=-1,u=(t=re(t,n)).length,i=!1;++e<u;){var o=au(t[e]);if(!(i=null!=n&&r(n,o)))break;n=n[o]}return i||++e!=u?i:!!(u=null==n?0:n.length)&&$u(u)&&Je(o,u)&&(Sf(n)||Ef(n))}function Ge(n){return"function"!=typeof n.constructor||nu(n)?{}:Io(Mi(n))}function He(n){return Sf(n)||Ef(n)||!!(qi&&n&&n[qi])}function Je(n,t){var r=typeof n;return!!(t=null==t?Q:t)&&("number"==r||"symbol"!=r&&ft.test(n))&&n>-1&&n%1==0&&n<t}function Ye(n,t,r){if(!Du(r))return!1;var e=typeof t;return!!("number"==e?Lu(r)&&Je(t,r.length):"string"==e&&t in r)&&Wu(r[t],n)}function Qe(n,t){if(Sf(n))return!1;var r=typeof n;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!qu(n))||Pn.test(n)||!Nn.test(n)||null!=t&&n in wi(t)}function Xe(n){var t=Fe(n),r=Qn[t];if("function"!=typeof r||!(t in pt.prototype))return!1;if(n===r)return!0;var e=To(r);return!!e&&n===e[0]}function nu(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||Oi)}function tu(n){return n==n&&!Du(n)}function ru(n,t){return function(r){return null!=r&&r[n]===t&&(t!==N||n in wi(r))}}function eu(t,r,e){return r=uo(r===N?t.length-1:r,0),function(){for(var u=arguments,i=-1,o=uo(u.length-r,0),f=vi(o);++i<o;)f[i]=u[r+i];i=-1;for(var c=vi(r+1);++i<r;)c[i]=u[i];return c[r]=e(f),n(t,this,c)}}function uu(n,t){return t.length<2?n:qt(n,Mr(t,0,-1))}function iu(n,t){if(("constructor"!==t||"function"!=typeof n[t])&&"__proto__"!=t)return n[t]}function ou(n,t,r){var e=t+"";return qo(n,function(n,t){var r=t.length;if(!r)return n;var e=r-1;return t[e]=(r>1?"& ":"")+t[e],t=t.join(r>2?", ":" "),n.replace(Hn,"{\n/* [wrapped with "+t+"] */\n")}(e,su(function(n){var t=n.match(Jn);return t?t[1].split(Yn):[]}(e),r)))}function fu(n){var t=0,r=0;return function(){var e=oo(),u=16-(e-r);if(r=e,u>0){if(++t>=800)return arguments[0]}else t=0;return n.apply(N,arguments)}}function cu(n,t){var r=-1,e=n.length,u=e-1;for(t=t===N?e:t;++r<t;){var i=Lr(r,u),o=n[i];n[i]=n[r],n[r]=o}return n.length=t,n}function au(n){if("string"==typeof n||qu(n))return n;var t=n+"";return"0"==t&&1/n==-Y?"-0":t}function lu(n){if(null!=n){try{return Ri.call(n)}catch(n){}try{return n+""}catch(n){}}return""}function su(n,t){return r(en,(function(r){var e="_."+r[0];t&r[1]&&!o(n,e)&&n.push(e)})),n.sort()}function hu(n){if(n instanceof pt)return n.clone();var t=new ht(n.__wrapped__,n.__chain__);return t.__actions__=le(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function pu(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:Vu(r);return u<0&&(u=uo(e+u,0)),v(n,Pe(t,3),u)}function _u(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==N&&(u=Vu(r),u=r<0?uo(e+u,0):io(u,e-1)),v(n,Pe(t,3),u,!0)}function vu(n){return null!=n&&n.length?$t(n,1):[]}function gu(n){return n&&n.length?n[0]:N}function yu(n){var t=null==n?0:n.length;return t?n[t-1]:N}function du(n,t){return n&&n.length&&t&&t.length?Sr(n,t):n}function bu(n){return null==n?n:ao.call(n)}function wu(n){if(!n||!n.length)return[];var t=0;return n=i(n,(function(n){if(Cu(n))return t=uo(n.length,t),!0})),A(t,(function(t){return c(n,w(t))}))}function mu(t,r){if(!t||!t.length)return[];var e=wu(t);return null==r?e:c(e,(function(t){return n(r,N,t)}))}function xu(n){var t=Qn(n);return t.__chain__=!0,t}function ju(n,t){return t(n)}function Au(n,t){return(Sf(n)?r:Ro)(n,Pe(t,3))}function ku(n,t){return(Sf(n)?e:zo)(n,Pe(t,3))}function Ou(n,t){return(Sf(n)?c:Ar)(n,Pe(t,3))}function Iu(n,t,r){return t=r?N:t,t=n&&null==t?n.length:t,Le(n,H,N,N,N,N,t)}function Ru(n,t){var r;if("function"!=typeof t)throw new ji(P);return n=Vu(n),function(){return--n>0&&(r=t.apply(this,arguments)),n<=1&&(t=N),r}}function zu(n,t,r){function e(t){var r=c,e=a;return c=a=N,_=t,s=n.apply(e,r)}function u(n){var r=n-p;return p===N||r>=t||r<0||g&&n-_>=l}function i(){var n=bf();return u(n)?o(n):(h=Po(i,function(n){var r=t-(n-p);return g?io(r,l-(n-_)):r}(n)),N)}function o(n){return h=N,y&&c?e(n):(c=a=N,s)}function f(){var n=bf(),r=u(n);if(c=arguments,a=this,p=n,r){if(h===N)return function(n){return _=n,h=Po(i,t),v?e(n):s}(p);if(g)return Uo(h),h=Po(i,t),e(p)}return h===N&&(h=Po(i,t)),s}var c,a,l,s,h,p,_=0,v=!1,g=!1,y=!0;if("function"!=typeof n)throw new ji(P);return t=Hu(t)||0,Du(r)&&(v=!!r.leading,l=(g="maxWait"in r)?uo(Hu(r.maxWait)||0,t):l,y="trailing"in r?!!r.trailing:y),f.cancel=function(){h!==N&&Uo(h),_=0,c=p=a=h=N},f.flush=function(){return h===N?s:o(bf())},f}function Eu(n,t){if("function"!=typeof n||null!=t&&"function"!=typeof t)throw new ji(P);var r=function(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;if(i.has(u))return i.get(u);var o=n.apply(this,e);return r.cache=i.set(u,o)||i,o};return r.cache=new(Eu.Cache||gt),r}function Su(n){if("function"!=typeof n)throw new ji(P);return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function Wu(n,t){return n===t||n!=n&&t!=t}function Lu(n){return null!=n&&$u(n.length)&&!Bu(n)}function Cu(n){return Mu(n)&&Lu(n)}function Uu(n){if(!Mu(n))return!1;var t=Kt(n);return t==an||"[object DOMException]"==t||"string"==typeof n.message&&"string"==typeof n.name&&!Nu(n)}function Bu(n){if(!Du(n))return!1;var t=Kt(n);return t==ln||t==sn||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Tu(n){return"number"==typeof n&&n==Vu(n)}function $u(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=Q}function Du(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function Mu(n){return null!=n&&"object"==typeof n}function Fu(n){return"number"==typeof n||Mu(n)&&Kt(n)==pn}function Nu(n){if(!Mu(n)||Kt(n)!=_n)return!1;var t=Mi(n);if(null===t)return!0;var r=zi.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Ri.call(r)==Li}function Pu(n){return"string"==typeof n||!Sf(n)&&Mu(n)&&Kt(n)==dn}function qu(n){return"symbol"==typeof n||Mu(n)&&Kt(n)==bn}function Zu(n){if(!n)return[];if(Lu(n))return Pu(n)?D(n):le(n);if(Zi&&n[Zi])return function(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}(n[Zi]());var t=Mo(n);return(t==hn?C:t==yn?T:ei)(n)}function Ku(n){return n?(n=Hu(n))===Y||n===-Y?17976931348623157e292*(n<0?-1:1):n==n?n:0:0===n?n:0}function Vu(n){var t=Ku(n),r=t%1;return t==t?r?t-r:t:0}function Gu(n){return n?Et(Vu(n),0,nn):0}function Hu(n){if("number"==typeof n)return n;if(qu(n))return X;if(Du(n)){var t="function"==typeof n.valueOf?n.valueOf():n;n=Du(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=k(n);var r=ut.test(n);return r||ot.test(n)?Xt(n.slice(2),r?2:8):et.test(n)?X:+n}function Ju(n){return se(n,ti(n))}function Yu(n){return null==n?"":Kr(n)}function Qu(n,t,r){var e=null==n?N:qt(n,t);return e===N?r:e}function Xu(n,t){return null!=n&&Ve(n,t,tr)}function ni(n){return Lu(n)?bt(n):mr(n)}function ti(n){return Lu(n)?bt(n,!0):xr(n)}function ri(n,t){if(null==n)return{};var r=c(Me(n),(function(n){return[n]}));return t=Pe(t),Er(n,r,(function(n,r){return t(n,r[0])}))}function ei(n){return null==n?[]:I(n,ni(n))}function ui(n){return lc(Yu(n).toLowerCase())}function ii(n){return(n=Yu(n))&&n.replace(ct,vr).replace(Nt,"")}function oi(n,t,r){return n=Yu(n),(t=r?N:t)===N?L(n)?F(n):p(n):n.match(t)||[]}function fi(n){return function(){return n}}function ci(n){return n}function ai(n){return wr("function"==typeof n?n:St(n,1))}function li(n,t,e){var u=ni(t),i=Pt(t,u);null!=e||Du(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=Pt(t,ni(t)));var o=!(Du(e)&&"chain"in e&&!e.chain),f=Bu(n);return r(i,(function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__);return(r.__actions__=le(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})})),n}function si(){}function hi(n){return Qe(n)?w(au(n)):function(n){return function(t){return qt(t,n)}}(n)}function pi(){return[]}function _i(){return!1}var vi=(Gn=null==Gn?rr:dr.defaults(rr.Object(),Gn,dr.pick(rr,Vt))).Array,gi=Gn.Date,yi=Gn.Error,di=Gn.Function,bi=Gn.Math,wi=Gn.Object,mi=Gn.RegExp,xi=Gn.String,ji=Gn.TypeError,Ai=vi.prototype,ki=di.prototype,Oi=wi.prototype,Ii=Gn["__core-js_shared__"],Ri=ki.toString,zi=Oi.hasOwnProperty,Ei=0,Si=function(){var n=/[^.]+$/.exec(Ii&&Ii.keys&&Ii.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),Wi=Oi.toString,Li=Ri.call(wi),Ci=rr._,Ui=mi("^"+Ri.call(zi).replace(Zn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Bi=ir?Gn.Buffer:N,Ti=Gn.Symbol,$i=Gn.Uint8Array,Di=Bi?Bi.allocUnsafe:N,Mi=U(wi.getPrototypeOf,wi),Fi=wi.create,Ni=Oi.propertyIsEnumerable,Pi=Ai.splice,qi=Ti?Ti.isConcatSpreadable:N,Zi=Ti?Ti.iterator:N,Ki=Ti?Ti.toStringTag:N,Vi=function(){try{var n=Ke(wi,"defineProperty");return n({},"",{}),n}catch(n){}}(),Gi=Gn.clearTimeout!==rr.clearTimeout&&Gn.clearTimeout,Hi=gi&&gi.now!==rr.Date.now&&gi.now,Ji=Gn.setTimeout!==rr.setTimeout&&Gn.setTimeout,Yi=bi.ceil,Qi=bi.floor,Xi=wi.getOwnPropertySymbols,no=Bi?Bi.isBuffer:N,to=Gn.isFinite,ro=Ai.join,eo=U(wi.keys,wi),uo=bi.max,io=bi.min,oo=gi.now,fo=Gn.parseInt,co=bi.random,ao=Ai.reverse,lo=Ke(Gn,"DataView"),so=Ke(Gn,"Map"),ho=Ke(Gn,"Promise"),po=Ke(Gn,"Set"),_o=Ke(Gn,"WeakMap"),vo=Ke(wi,"create"),go=_o&&new _o,yo={},bo=lu(lo),wo=lu(so),mo=lu(ho),xo=lu(po),jo=lu(_o),Ao=Ti?Ti.prototype:N,ko=Ao?Ao.valueOf:N,Oo=Ao?Ao.toString:N,Io=function(){function n(){}return function(t){if(!Du(t))return{};if(Fi)return Fi(t);n.prototype=t;var r=new n;return n.prototype=N,r}}();Qn.templateSettings={escape:Dn,evaluate:Mn,interpolate:Fn,variable:"",imports:{_:Qn}},Qn.prototype=st.prototype,Qn.prototype.constructor=Qn,ht.prototype=Io(st.prototype),ht.prototype.constructor=ht,pt.prototype=Io(st.prototype),pt.prototype.constructor=pt,_t.prototype.clear=function(){this.__data__=vo?vo(null):{},this.size=0},_t.prototype.delete=function(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t},_t.prototype.get=function(n){var t=this.__data__;if(vo){var r=t[n];return r===q?N:r}return zi.call(t,n)?t[n]:N},_t.prototype.has=function(n){var t=this.__data__;return vo?t[n]!==N:zi.call(t,n)},_t.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=vo&&t===N?q:t,this},vt.prototype.clear=function(){this.__data__=[],this.size=0},vt.prototype.delete=function(n){var t=this.__data__,r=kt(t,n);return!(r<0||(r==t.length-1?t.pop():Pi.call(t,r,1),--this.size,0))},vt.prototype.get=function(n){var t=this.__data__,r=kt(t,n);return r<0?N:t[r][1]},vt.prototype.has=function(n){return kt(this.__data__,n)>-1},vt.prototype.set=function(n,t){var r=this.__data__,e=kt(r,n);return e<0?(++this.size,r.push([n,t])):r[e][1]=t,this},gt.prototype.clear=function(){this.size=0,this.__data__={hash:new _t,map:new(so||vt),string:new _t}},gt.prototype.delete=function(n){var t=qe(this,n).delete(n);return this.size-=t?1:0,t},gt.prototype.get=function(n){return qe(this,n).get(n)},gt.prototype.has=function(n){return qe(this,n).has(n)},gt.prototype.set=function(n,t){var r=qe(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},yt.prototype.add=yt.prototype.push=function(n){return this.__data__.set(n,q),this},yt.prototype.has=function(n){return this.__data__.has(n)},dt.prototype.clear=function(){this.__data__=new vt,this.size=0},dt.prototype.delete=function(n){var t=this.__data__,r=t.delete(n);return this.size=t.size,r},dt.prototype.get=function(n){return this.__data__.get(n)},dt.prototype.has=function(n){return this.__data__.has(n)},dt.prototype.set=function(n,t){var r=this.__data__;if(r instanceof vt){var e=r.__data__;if(!so||e.length<199)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new gt(e)}return r.set(n,t),this.size=r.size,this};var Ro=_e(Dt),zo=_e(Mt,!0),Eo=ve(),So=ve(!0),Wo=go?function(n,t){return go.set(n,t),n}:ci,Lo=Vi?function(n,t){return Vi(n,"toString",{configurable:!0,enumerable:!1,value:fi(t),writable:!0})}:ci,Co=Ur,Uo=Gi||function(n){return rr.clearTimeout(n)},Bo=po&&1/T(new po([,-0]))[1]==Y?function(n){return new po(n)}:si,To=go?function(n){return go.get(n)}:si,$o=Xi?function(n){return null==n?[]:(n=wi(n),i(Xi(n),(function(t){return Ni.call(n,t)})))}:pi,Do=Xi?function(n){for(var t=[];n;)a(t,$o(n)),n=Mi(n);return t}:pi,Mo=Kt;(lo&&Mo(new lo(new ArrayBuffer(1)))!=xn||so&&Mo(new so)!=hn||ho&&Mo(ho.resolve())!=vn||po&&Mo(new po)!=yn||_o&&Mo(new _o)!=wn)&&(Mo=function(n){var t=Kt(n),r=t==_n?n.constructor:N,e=r?lu(r):"";if(e)switch(e){case bo:return xn;case wo:return hn;case mo:return vn;case xo:return yn;case jo:return wn}return t});var Fo=Ii?Bu:_i,No=fu(Wo),Po=Ji||function(n,t){return rr.setTimeout(n,t)},qo=fu(Lo),Zo=function(n){var t=Eu(n,(function(n){return 500===r.size&&r.clear(),n})),r=t.cache;return t}((function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(qn,(function(n,r,e,u){t.push(e?u.replace(nt,"$1"):r||n)})),t})),Ko=Ur((function(n,t){return Cu(n)?Ct(n,$t(t,1,Cu,!0)):[]})),Vo=Ur((function(n,t){var r=yu(t);return Cu(r)&&(r=N),Cu(n)?Ct(n,$t(t,1,Cu,!0),Pe(r,2)):[]})),Go=Ur((function(n,t){var r=yu(t);return Cu(r)&&(r=N),Cu(n)?Ct(n,$t(t,1,Cu,!0),N,r):[]})),Ho=Ur((function(n){var t=c(n,ne);return t.length&&t[0]===n[0]?er(t):[]})),Jo=Ur((function(n){var t=yu(n),r=c(n,ne);return t===yu(r)?t=N:r.pop(),r.length&&r[0]===n[0]?er(r,Pe(t,2)):[]})),Yo=Ur((function(n){var t=yu(n),r=c(n,ne);return(t="function"==typeof t?t:N)&&r.pop(),r.length&&r[0]===n[0]?er(r,N,t):[]})),Qo=Ur(du),Xo=$e((function(n,t){var r=null==n?0:n.length,e=zt(n,t);return Wr(n,c(t,(function(n){return Je(n,r)?+n:n})).sort(fe)),e})),nf=Ur((function(n){return Vr($t(n,1,Cu,!0))})),tf=Ur((function(n){var t=yu(n);return Cu(t)&&(t=N),Vr($t(n,1,Cu,!0),Pe(t,2))})),rf=Ur((function(n){var t=yu(n);return t="function"==typeof t?t:N,Vr($t(n,1,Cu,!0),N,t)})),ef=Ur((function(n,t){return Cu(n)?Ct(n,t):[]})),uf=Ur((function(n){return Qr(i(n,Cu))})),of=Ur((function(n){var t=yu(n);return Cu(t)&&(t=N),Qr(i(n,Cu),Pe(t,2))})),ff=Ur((function(n){var t=yu(n);return t="function"==typeof t?t:N,Qr(i(n,Cu),N,t)})),cf=Ur(wu),af=Ur((function(n){var t=n.length,r=t>1?n[t-1]:N;return r="function"==typeof r?(n.pop(),r):N,mu(n,r)})),lf=$e((function(n){var t=n.length,r=t?n[0]:0,e=this.__wrapped__,u=function(t){return zt(t,n)};return!(t>1||this.__actions__.length)&&e instanceof pt&&Je(r)?((e=e.slice(r,+r+(t?1:0))).__actions__.push({func:ju,args:[u],thisArg:N}),new ht(e,this.__chain__).thru((function(n){return t&&!n.length&&n.push(N),n}))):this.thru(u)})),sf=he((function(n,t,r){zi.call(n,r)?++n[r]:Rt(n,r,1)})),hf=we(pu),pf=we(_u),_f=he((function(n,t,r){zi.call(n,r)?n[r].push(t):Rt(n,r,[t])})),vf=Ur((function(t,r,e){var u=-1,i="function"==typeof r,o=Lu(t)?vi(t.length):[];return Ro(t,(function(t){o[++u]=i?n(r,t,e):ur(t,r,e)})),o})),gf=he((function(n,t,r){Rt(n,r,t)})),yf=he((function(n,t,r){n[r?0:1].push(t)}),(function(){return[[],[]]})),df=Ur((function(n,t){if(null==n)return[];var r=t.length;return r>1&&Ye(n,t[0],t[1])?t=[]:r>2&&Ye(t[0],t[1],t[2])&&(t=[t[0]]),zr(n,$t(t,1),[])})),bf=Hi||function(){return rr.Date.now()},wf=Ur((function(n,t,r){var e=1;if(r.length){var u=B(r,Ne(wf));e|=V}return Le(n,e,t,r,u)})),mf=Ur((function(n,t,r){var e=3;if(r.length){var u=B(r,Ne(mf));e|=V}return Le(t,e,n,r,u)})),xf=Ur((function(n,t){return Lt(n,1,t)})),jf=Ur((function(n,t,r){return Lt(n,Hu(t)||0,r)}));Eu.Cache=gt;var Af=Co((function(t,r){var e=(r=1==r.length&&Sf(r[0])?c(r[0],O(Pe())):c($t(r,1),O(Pe()))).length;return Ur((function(u){for(var i=-1,o=io(u.length,e);++i<o;)u[i]=r[i].call(this,u[i]);return n(t,this,u)}))})),kf=Ur((function(n,t){return Le(n,V,N,t,B(t,Ne(kf)))})),Of=Ur((function(n,t){return Le(n,G,N,t,B(t,Ne(Of)))})),If=$e((function(n,t){return Le(n,J,N,N,N,t)})),Rf=ze(Yt),zf=ze((function(n,t){return n>=t})),Ef=or(function(){return arguments}())?or:function(n){return Mu(n)&&zi.call(n,"callee")&&!Ni.call(n,"callee")},Sf=vi.isArray,Wf=cr?O(cr):function(n){return Mu(n)&&Kt(n)==mn},Lf=no||_i,Cf=ar?O(ar):function(n){return Mu(n)&&Kt(n)==cn},Uf=lr?O(lr):function(n){return Mu(n)&&Mo(n)==hn},Bf=sr?O(sr):function(n){return Mu(n)&&Kt(n)==gn},Tf=hr?O(hr):function(n){return Mu(n)&&Mo(n)==yn},$f=pr?O(pr):function(n){return Mu(n)&&$u(n.length)&&!!Ht[Kt(n)]},Df=ze(jr),Mf=ze((function(n,t){return n<=t})),Ff=pe((function(n,t){if(nu(t)||Lu(t))return se(t,ni(t),n),N;for(var r in t)zi.call(t,r)&&At(n,r,t[r])})),Nf=pe((function(n,t){se(t,ti(t),n)})),Pf=pe((function(n,t,r,e){se(t,ti(t),n,e)})),qf=pe((function(n,t,r,e){se(t,ni(t),n,e)})),Zf=$e(zt),Kf=Ur((function(n,t){n=wi(n);var r=-1,e=t.length,u=e>2?t[2]:N;for(u&&Ye(t[0],t[1],u)&&(e=1);++r<e;)for(var i=t[r],o=ti(i),f=-1,c=o.length;++f<c;){var a=o[f],l=n[a];(l===N||Wu(l,Oi[a])&&!zi.call(n,a))&&(n[a]=i[a])}return n})),Vf=Ur((function(t){return t.push(N,Ue),n(Qf,N,t)})),Gf=je((function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=Wi.call(t)),n[t]=r}),fi(ci)),Hf=je((function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=Wi.call(t)),zi.call(n,t)?n[t].push(r):n[t]=[r]}),Pe),Jf=Ur(ur),Yf=pe((function(n,t,r){Ir(n,t,r)})),Qf=pe((function(n,t,r,e){Ir(n,t,r,e)})),Xf=$e((function(n,t){var r={};if(null==n)return r;var e=!1;t=c(t,(function(t){return t=re(t,n),e||(e=t.length>1),t})),se(n,Me(n),r),e&&(r=St(r,7,Be));for(var u=t.length;u--;)Gr(r,t[u]);return r})),nc=$e((function(n,t){return null==n?{}:function(n,t){return Er(n,t,(function(t,r){return Xu(n,r)}))}(n,t)})),tc=We(ni),rc=We(ti),ec=ye((function(n,t,r){return t=t.toLowerCase(),n+(r?ui(t):t)})),uc=ye((function(n,t,r){return n+(r?"-":"")+t.toLowerCase()})),ic=ye((function(n,t,r){return n+(r?" ":"")+t.toLowerCase()})),oc=ge("toLowerCase"),fc=ye((function(n,t,r){return n+(r?"_":"")+t.toLowerCase()})),cc=ye((function(n,t,r){return n+(r?" ":"")+lc(t)})),ac=ye((function(n,t,r){return n+(r?" ":"")+t.toUpperCase()})),lc=ge("toUpperCase"),sc=Ur((function(t,r){try{return n(t,N,r)}catch(n){return Uu(n)?n:new yi(n)}})),hc=$e((function(n,t){return r(t,(function(t){t=au(t),Rt(n,t,wf(n[t],n))})),n})),pc=me(),_c=me(!0),vc=Ur((function(n,t){return function(r){return ur(r,n,t)}})),gc=Ur((function(n,t){return function(r){return ur(n,r,t)}})),yc=ke(c),dc=ke(u),bc=ke(h),wc=Re(),mc=Re(!0),xc=Ae((function(n,t){return n+t}),0),jc=Se("ceil"),Ac=Ae((function(n,t){return n/t}),1),kc=Se("floor"),Oc=Ae((function(n,t){return n*t}),1),Ic=Se("round"),Rc=Ae((function(n,t){return n-t}),0);return Qn.after=function(n,t){if("function"!=typeof t)throw new ji(P);return n=Vu(n),function(){if(--n<1)return t.apply(this,arguments)}},Qn.ary=Iu,Qn.assign=Ff,Qn.assignIn=Nf,Qn.assignInWith=Pf,Qn.assignWith=qf,Qn.at=Zf,Qn.before=Ru,Qn.bind=wf,Qn.bindAll=hc,Qn.bindKey=mf,Qn.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return Sf(n)?n:[n]},Qn.chain=xu,Qn.chunk=function(n,t,r){t=(r?Ye(n,t,r):t===N)?1:uo(Vu(t),0);var e=null==n?0:n.length;if(!e||t<1)return[];for(var u=0,i=0,o=vi(Yi(e/t));u<e;)o[i++]=Mr(n,u,u+=t);return o},Qn.compact=function(n){for(var t=-1,r=null==n?0:n.length,e=0,u=[];++t<r;){var i=n[t];i&&(u[e++]=i)}return u},Qn.concat=function(){var n=arguments.length;if(!n)return[];for(var t=vi(n-1),r=arguments[0],e=n;e--;)t[e-1]=arguments[e];return a(Sf(r)?le(r):[r],$t(t,1))},Qn.cond=function(t){var r=null==t?0:t.length,e=Pe();return t=r?c(t,(function(n){if("function"!=typeof n[1])throw new ji(P);return[e(n[0]),n[1]]})):[],Ur((function(e){for(var u=-1;++u<r;){var i=t[u];if(n(i[0],this,e))return n(i[1],this,e)}}))},Qn.conforms=function(n){return function(n){var t=ni(n);return function(r){return Wt(r,n,t)}}(St(n,1))},Qn.constant=fi,Qn.countBy=sf,Qn.create=function(n,t){var r=Io(n);return null==t?r:It(r,t)},Qn.curry=function n(t,r,e){var u=Le(t,8,N,N,N,N,N,r=e?N:r);return u.placeholder=n.placeholder,u},Qn.curryRight=function n(t,r,e){var u=Le(t,K,N,N,N,N,N,r=e?N:r);return u.placeholder=n.placeholder,u},Qn.debounce=zu,Qn.defaults=Kf,Qn.defaultsDeep=Vf,Qn.defer=xf,Qn.delay=jf,Qn.difference=Ko,Qn.differenceBy=Vo,Qn.differenceWith=Go,Qn.drop=function(n,t,r){var e=null==n?0:n.length;return e?Mr(n,(t=r||t===N?1:Vu(t))<0?0:t,e):[]},Qn.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?Mr(n,0,(t=e-(t=r||t===N?1:Vu(t)))<0?0:t):[]},Qn.dropRightWhile=function(n,t){return n&&n.length?Jr(n,Pe(t,3),!0,!0):[]},Qn.dropWhile=function(n,t){return n&&n.length?Jr(n,Pe(t,3),!0):[]},Qn.fill=function(n,t,r,e){var u=null==n?0:n.length;return u?(r&&"number"!=typeof r&&Ye(n,t,r)&&(r=0,e=u),function(n,t,r,e){var u=n.length;for((r=Vu(r))<0&&(r=-r>u?0:u+r),(e=e===N||e>u?u:Vu(e))<0&&(e+=u),e=r>e?0:Gu(e);r<e;)n[r++]=t;return n}(n,t,r,e)):[]},Qn.filter=function(n,t){return(Sf(n)?i:Tt)(n,Pe(t,3))},Qn.flatMap=function(n,t){return $t(Ou(n,t),1)},Qn.flatMapDeep=function(n,t){return $t(Ou(n,t),Y)},Qn.flatMapDepth=function(n,t,r){return r=r===N?1:Vu(r),$t(Ou(n,t),r)},Qn.flatten=vu,Qn.flattenDeep=function(n){return null!=n&&n.length?$t(n,Y):[]},Qn.flattenDepth=function(n,t){return null!=n&&n.length?$t(n,t=t===N?1:Vu(t)):[]},Qn.flip=function(n){return Le(n,512)},Qn.flow=pc,Qn.flowRight=_c,Qn.fromPairs=function(n){for(var t=-1,r=null==n?0:n.length,e={};++t<r;){var u=n[t];e[u[0]]=u[1]}return e},Qn.functions=function(n){return null==n?[]:Pt(n,ni(n))},Qn.functionsIn=function(n){return null==n?[]:Pt(n,ti(n))},Qn.groupBy=_f,Qn.initial=function(n){return null!=n&&n.length?Mr(n,0,-1):[]},Qn.intersection=Ho,Qn.intersectionBy=Jo,Qn.intersectionWith=Yo,Qn.invert=Gf,Qn.invertBy=Hf,Qn.invokeMap=vf,Qn.iteratee=ai,Qn.keyBy=gf,Qn.keys=ni,Qn.keysIn=ti,Qn.map=Ou,Qn.mapKeys=function(n,t){var r={};return t=Pe(t,3),Dt(n,(function(n,e,u){Rt(r,t(n,e,u),n)})),r},Qn.mapValues=function(n,t){var r={};return t=Pe(t,3),Dt(n,(function(n,e,u){Rt(r,e,t(n,e,u))})),r},Qn.matches=function(n){return kr(St(n,1))},Qn.matchesProperty=function(n,t){return Or(n,St(t,1))},Qn.memoize=Eu,Qn.merge=Yf,Qn.mergeWith=Qf,Qn.method=vc,Qn.methodOf=gc,Qn.mixin=li,Qn.negate=Su,Qn.nthArg=function(n){return n=Vu(n),Ur((function(t){return Rr(t,n)}))},Qn.omit=Xf,Qn.omitBy=function(n,t){return ri(n,Su(Pe(t)))},Qn.once=function(n){return Ru(2,n)},Qn.orderBy=function(n,t,r,e){return null==n?[]:(Sf(t)||(t=null==t?[]:[t]),Sf(r=e?N:r)||(r=null==r?[]:[r]),zr(n,t,r))},Qn.over=yc,Qn.overArgs=Af,Qn.overEvery=dc,Qn.overSome=bc,Qn.partial=kf,Qn.partialRight=Of,Qn.partition=yf,Qn.pick=nc,Qn.pickBy=ri,Qn.property=hi,Qn.propertyOf=function(n){return function(t){return null==n?N:qt(n,t)}},Qn.pull=Qo,Qn.pullAll=du,Qn.pullAllBy=function(n,t,r){return n&&n.length&&t&&t.length?Sr(n,t,Pe(r,2)):n},Qn.pullAllWith=function(n,t,r){return n&&n.length&&t&&t.length?Sr(n,t,N,r):n},Qn.pullAt=Xo,Qn.range=wc,Qn.rangeRight=mc,Qn.rearg=If,Qn.reject=function(n,t){return(Sf(n)?i:Tt)(n,Su(Pe(t,3)))},Qn.remove=function(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],i=n.length;for(t=Pe(t,3);++e<i;){var o=n[e];t(o,e,n)&&(r.push(o),u.push(e))}return Wr(n,u),r},Qn.rest=function(n,t){if("function"!=typeof n)throw new ji(P);return Ur(n,t=t===N?t:Vu(t))},Qn.reverse=bu,Qn.sampleSize=function(n,t,r){return t=(r?Ye(n,t,r):t===N)?1:Vu(t),(Sf(n)?mt:Tr)(n,t)},Qn.set=function(n,t,r){return null==n?n:$r(n,t,r)},Qn.setWith=function(n,t,r,e){return e="function"==typeof e?e:N,null==n?n:$r(n,t,r,e)},Qn.shuffle=function(n){return(Sf(n)?xt:Dr)(n)},Qn.slice=function(n,t,r){var e=null==n?0:n.length;return e?(r&&"number"!=typeof r&&Ye(n,t,r)?(t=0,r=e):(t=null==t?0:Vu(t),r=r===N?e:Vu(r)),Mr(n,t,r)):[]},Qn.sortBy=df,Qn.sortedUniq=function(n){return n&&n.length?qr(n):[]},Qn.sortedUniqBy=function(n,t){return n&&n.length?qr(n,Pe(t,2)):[]},Qn.split=function(n,t,r){return r&&"number"!=typeof r&&Ye(n,t,r)&&(t=r=N),(r=r===N?nn:r>>>0)?(n=Yu(n))&&("string"==typeof t||null!=t&&!Bf(t))&&(!(t=Kr(t))&&W(n))?ee(D(n),0,r):n.split(t,r):[]},Qn.spread=function(t,r){if("function"!=typeof t)throw new ji(P);return r=null==r?0:uo(Vu(r),0),Ur((function(e){var u=e[r],i=ee(e,0,r);return u&&a(i,u),n(t,this,i)}))},Qn.tail=function(n){var t=null==n?0:n.length;return t?Mr(n,1,t):[]},Qn.take=function(n,t,r){return n&&n.length?Mr(n,0,(t=r||t===N?1:Vu(t))<0?0:t):[]},Qn.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?Mr(n,(t=e-(t=r||t===N?1:Vu(t)))<0?0:t,e):[]},Qn.takeRightWhile=function(n,t){return n&&n.length?Jr(n,Pe(t,3),!1,!0):[]},Qn.takeWhile=function(n,t){return n&&n.length?Jr(n,Pe(t,3)):[]},Qn.tap=function(n,t){return t(n),n},Qn.throttle=function(n,t,r){var e=!0,u=!0;if("function"!=typeof n)throw new ji(P);return Du(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),zu(n,t,{leading:e,maxWait:t,trailing:u})},Qn.thru=ju,Qn.toArray=Zu,Qn.toPairs=tc,Qn.toPairsIn=rc,Qn.toPath=function(n){return Sf(n)?c(n,au):qu(n)?[n]:le(Zo(Yu(n)))},Qn.toPlainObject=Ju,Qn.transform=function(n,t,e){var u=Sf(n),i=u||Lf(n)||$f(n);if(t=Pe(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:Du(n)&&Bu(o)?Io(Mi(n)):{}}return(i?r:Dt)(n,(function(n,r,u){return t(e,n,r,u)})),e},Qn.unary=function(n){return Iu(n,1)},Qn.union=nf,Qn.unionBy=tf,Qn.unionWith=rf,Qn.uniq=function(n){return n&&n.length?Vr(n):[]},Qn.uniqBy=function(n,t){return n&&n.length?Vr(n,Pe(t,2)):[]},Qn.uniqWith=function(n,t){return t="function"==typeof t?t:N,n&&n.length?Vr(n,N,t):[]},Qn.unset=function(n,t){return null==n||Gr(n,t)},Qn.unzip=wu,Qn.unzipWith=mu,Qn.update=function(n,t,r){return null==n?n:Hr(n,t,te(r))},Qn.updateWith=function(n,t,r,e){return e="function"==typeof e?e:N,null==n?n:Hr(n,t,te(r),e)},Qn.values=ei,Qn.valuesIn=function(n){return null==n?[]:I(n,ti(n))},Qn.without=ef,Qn.words=oi,Qn.wrap=function(n,t){return kf(te(t),n)},Qn.xor=uf,Qn.xorBy=of,Qn.xorWith=ff,Qn.zip=cf,Qn.zipObject=function(n,t){return Xr(n||[],t||[],At)},Qn.zipObjectDeep=function(n,t){return Xr(n||[],t||[],$r)},Qn.zipWith=af,Qn.entries=tc,Qn.entriesIn=rc,Qn.extend=Nf,Qn.extendWith=Pf,li(Qn,Qn),Qn.add=xc,Qn.attempt=sc,Qn.camelCase=ec,Qn.capitalize=ui,Qn.ceil=jc,Qn.clamp=function(n,t,r){return r===N&&(r=t,t=N),r!==N&&(r=(r=Hu(r))==r?r:0),t!==N&&(t=(t=Hu(t))==t?t:0),Et(Hu(n),t,r)},Qn.clone=function(n){return St(n,4)},Qn.cloneDeep=function(n){return St(n,5)},Qn.cloneDeepWith=function(n,t){return St(n,5,t="function"==typeof t?t:N)},Qn.cloneWith=function(n,t){return St(n,4,t="function"==typeof t?t:N)},Qn.conformsTo=function(n,t){return null==t||Wt(n,t,ni(t))},Qn.deburr=ii,Qn.defaultTo=function(n,t){return null==n||n!=n?t:n},Qn.divide=Ac,Qn.endsWith=function(n,t,r){n=Yu(n),t=Kr(t);var e=n.length,u=r=r===N?e:Et(Vu(r),0,e);return(r-=t.length)>=0&&n.slice(r,u)==t},Qn.eq=Wu,Qn.escape=function(n){return(n=Yu(n))&&$n.test(n)?n.replace(Bn,gr):n},Qn.escapeRegExp=function(n){return(n=Yu(n))&&Kn.test(n)?n.replace(Zn,"\\$&"):n},Qn.every=function(n,t,r){var e=Sf(n)?u:Ut;return r&&Ye(n,t,r)&&(t=N),e(n,Pe(t,3))},Qn.find=hf,Qn.findIndex=pu,Qn.findKey=function(n,t){return _(n,Pe(t,3),Dt)},Qn.findLast=pf,Qn.findLastIndex=_u,Qn.findLastKey=function(n,t){return _(n,Pe(t,3),Mt)},Qn.floor=kc,Qn.forEach=Au,Qn.forEachRight=ku,Qn.forIn=function(n,t){return null==n?n:Eo(n,Pe(t,3),ti)},Qn.forInRight=function(n,t){return null==n?n:So(n,Pe(t,3),ti)},Qn.forOwn=function(n,t){return n&&Dt(n,Pe(t,3))},Qn.forOwnRight=function(n,t){return n&&Mt(n,Pe(t,3))},Qn.get=Qu,Qn.gt=Rf,Qn.gte=zf,Qn.has=function(n,t){return null!=n&&Ve(n,t,nr)},Qn.hasIn=Xu,Qn.head=gu,Qn.identity=ci,Qn.includes=function(n,t,r,e){n=Lu(n)?n:ei(n),r=r&&!e?Vu(r):0;var u=n.length;return r<0&&(r=uo(u+r,0)),Pu(n)?r<=u&&n.indexOf(t,r)>-1:!!u&&g(n,t,r)>-1},Qn.indexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:Vu(r);return u<0&&(u=uo(e+u,0)),g(n,t,u)},Qn.inRange=function(n,t,r){return t=Ku(t),r===N?(r=t,t=0):r=Ku(r),function(n,t,r){return n>=io(t,r)&&n<uo(t,r)}(n=Hu(n),t,r)},Qn.invoke=Jf,Qn.isArguments=Ef,Qn.isArray=Sf,Qn.isArrayBuffer=Wf,Qn.isArrayLike=Lu,Qn.isArrayLikeObject=Cu,Qn.isBoolean=function(n){return!0===n||!1===n||Mu(n)&&Kt(n)==fn},Qn.isBuffer=Lf,Qn.isDate=Cf,Qn.isElement=function(n){return Mu(n)&&1===n.nodeType&&!Nu(n)},Qn.isEmpty=function(n){if(null==n)return!0;if(Lu(n)&&(Sf(n)||"string"==typeof n||"function"==typeof n.splice||Lf(n)||$f(n)||Ef(n)))return!n.length;var t=Mo(n);if(t==hn||t==yn)return!n.size;if(nu(n))return!mr(n).length;for(var r in n)if(zi.call(n,r))return!1;return!0},Qn.isEqual=function(n,t){return fr(n,t)},Qn.isEqualWith=function(n,t,r){var e=(r="function"==typeof r?r:N)?r(n,t):N;return e===N?fr(n,t,N,r):!!e},Qn.isError=Uu,Qn.isFinite=function(n){return"number"==typeof n&&to(n)},Qn.isFunction=Bu,Qn.isInteger=Tu,Qn.isLength=$u,Qn.isMap=Uf,Qn.isMatch=function(n,t){return n===t||_r(n,t,Ze(t))},Qn.isMatchWith=function(n,t,r){return r="function"==typeof r?r:N,_r(n,t,Ze(t),r)},Qn.isNaN=function(n){return Fu(n)&&n!=+n},Qn.isNative=function(n){if(Fo(n))throw new yi("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return br(n)},Qn.isNil=function(n){return null==n},Qn.isNull=function(n){return null===n},Qn.isNumber=Fu,Qn.isObject=Du,Qn.isObjectLike=Mu,Qn.isPlainObject=Nu,Qn.isRegExp=Bf,Qn.isSafeInteger=function(n){return Tu(n)&&n>=-Q&&n<=Q},Qn.isSet=Tf,Qn.isString=Pu,Qn.isSymbol=qu,Qn.isTypedArray=$f,Qn.isUndefined=function(n){return n===N},Qn.isWeakMap=function(n){return Mu(n)&&Mo(n)==wn},Qn.isWeakSet=function(n){return Mu(n)&&"[object WeakSet]"==Kt(n)},Qn.join=function(n,t){return null==n?"":ro.call(n,t)},Qn.kebabCase=uc,Qn.last=yu,Qn.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;return r!==N&&(u=(u=Vu(r))<0?uo(e+u,0):io(u,e-1)),t==t?function(n,t,r){for(var e=r+1;e--;)if(n[e]===t)return e;return e}(n,t,u):v(n,d,u,!0)},Qn.lowerCase=ic,Qn.lowerFirst=oc,Qn.lt=Df,Qn.lte=Mf,Qn.max=function(n){return n&&n.length?Bt(n,ci,Yt):N},Qn.maxBy=function(n,t){return n&&n.length?Bt(n,Pe(t,2),Yt):N},Qn.mean=function(n){return b(n,ci)},Qn.meanBy=function(n,t){return b(n,Pe(t,2))},Qn.min=function(n){return n&&n.length?Bt(n,ci,jr):N},Qn.minBy=function(n,t){return n&&n.length?Bt(n,Pe(t,2),jr):N},Qn.stubArray=pi,Qn.stubFalse=_i,Qn.stubObject=function(){return{}},Qn.stubString=function(){return""},Qn.stubTrue=function(){return!0},Qn.multiply=Oc,Qn.nth=function(n,t){return n&&n.length?Rr(n,Vu(t)):N},Qn.noConflict=function(){return rr._===this&&(rr._=Ci),this},Qn.noop=si,Qn.now=bf,Qn.pad=function(n,t,r){n=Yu(n);var e=(t=Vu(t))?$(n):0;if(!t||e>=t)return n;var u=(t-e)/2;return Oe(Qi(u),r)+n+Oe(Yi(u),r)},Qn.padEnd=function(n,t,r){n=Yu(n);var e=(t=Vu(t))?$(n):0;return t&&e<t?n+Oe(t-e,r):n},Qn.padStart=function(n,t,r){n=Yu(n);var e=(t=Vu(t))?$(n):0;return t&&e<t?Oe(t-e,r)+n:n},Qn.parseInt=function(n,t,r){return r||null==t?t=0:t&&(t=+t),fo(Yu(n).replace(Vn,""),t||0)},Qn.random=function(n,t,r){if(r&&"boolean"!=typeof r&&Ye(n,t,r)&&(t=r=N),r===N&&("boolean"==typeof t?(r=t,t=N):"boolean"==typeof n&&(r=n,n=N)),n===N&&t===N?(n=0,t=1):(n=Ku(n),t===N?(t=n,n=0):t=Ku(t)),n>t){var e=n;n=t,t=e}if(r||n%1||t%1){var u=co();return io(n+u*(t-n+Qt("1e-"+((u+"").length-1))),t)}return Lr(n,t)},Qn.reduce=function(n,t,r){var e=Sf(n)?l:x,u=arguments.length<3;return e(n,Pe(t,4),r,u,Ro)},Qn.reduceRight=function(n,t,r){var e=Sf(n)?s:x,u=arguments.length<3;return e(n,Pe(t,4),r,u,zo)},Qn.repeat=function(n,t,r){return t=(r?Ye(n,t,r):t===N)?1:Vu(t),Cr(Yu(n),t)},Qn.replace=function(){var n=arguments,t=Yu(n[0]);return n.length<3?t:t.replace(n[1],n[2])},Qn.result=function(n,t,r){var e=-1,u=(t=re(t,n)).length;for(u||(u=1,n=N);++e<u;){var i=null==n?N:n[au(t[e])];i===N&&(e=u,i=r),n=Bu(i)?i.call(n):i}return n},Qn.round=Ic,Qn.runInContext=m,Qn.sample=function(n){return(Sf(n)?wt:Br)(n)},Qn.size=function(n){if(null==n)return 0;if(Lu(n))return Pu(n)?$(n):n.length;var t=Mo(n);return t==hn||t==yn?n.size:mr(n).length},Qn.snakeCase=fc,Qn.some=function(n,t,r){var e=Sf(n)?h:Fr;return r&&Ye(n,t,r)&&(t=N),e(n,Pe(t,3))},Qn.sortedIndex=function(n,t){return Nr(n,t)},Qn.sortedIndexBy=function(n,t,r){return Pr(n,t,Pe(r,2))},Qn.sortedIndexOf=function(n,t){var r=null==n?0:n.length;if(r){var e=Nr(n,t);if(e<r&&Wu(n[e],t))return e}return-1},Qn.sortedLastIndex=function(n,t){return Nr(n,t,!0)},Qn.sortedLastIndexBy=function(n,t,r){return Pr(n,t,Pe(r,2),!0)},Qn.sortedLastIndexOf=function(n,t){if(null!=n&&n.length){var r=Nr(n,t,!0)-1;if(Wu(n[r],t))return r}return-1},Qn.startCase=cc,Qn.startsWith=function(n,t,r){return n=Yu(n),r=null==r?0:Et(Vu(r),0,n.length),t=Kr(t),n.slice(r,r+t.length)==t},Qn.subtract=Rc,Qn.sum=function(n){return n&&n.length?j(n,ci):0},Qn.sumBy=function(n,t){return n&&n.length?j(n,Pe(t,2)):0},Qn.template=function(n,t,r){var e=Qn.templateSettings;r&&Ye(n,t,r)&&(t=N),n=Yu(n),t=Pf({},t,e,Ce);var u,i,o=Pf({},t.imports,e.imports,Ce),f=ni(o),c=I(o,f),a=0,l=t.interpolate||at,s="__p += '",h=mi((t.escape||at).source+"|"+l.source+"|"+(l===Fn?tt:at).source+"|"+(t.evaluate||at).source+"|$","g"),p="//# sourceURL="+(zi.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Gt+"]")+"\n";n.replace(h,(function(t,r,e,o,f,c){return e||(e=o),s+=n.slice(a,c).replace(lt,S),r&&(u=!0,s+="' +\n__e("+r+") +\n'"),f&&(i=!0,s+="';\n"+f+";\n__p += '"),e&&(s+="' +\n((__t = ("+e+")) == null ? '' : __t) +\n'"),a=c+t.length,t})),s+="';\n";var _=zi.call(t,"variable")&&t.variable;if(_){if(Xn.test(_))throw new yi("Invalid `variable` option passed into `_.template`")}else s="with (obj) {\n"+s+"\n}\n";s=(i?s.replace(Wn,""):s).replace(Ln,"$1").replace(Cn,"$1;"),s="function("+(_||"obj")+") {\n"+(_?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+s+"return __p\n}";var v=sc((function(){return di(f,p+"return "+s).apply(N,c)}));if(v.source=s,Uu(v))throw v;return v},Qn.times=function(n,t){if((n=Vu(n))<1||n>Q)return[];var r=nn,e=io(n,nn);t=Pe(t),n-=nn;for(var u=A(e,t);++r<n;)t(r);return u},Qn.toFinite=Ku,Qn.toInteger=Vu,Qn.toLength=Gu,Qn.toLower=function(n){return Yu(n).toLowerCase()},Qn.toNumber=Hu,Qn.toSafeInteger=function(n){return n?Et(Vu(n),-Q,Q):0===n?n:0},Qn.toString=Yu,Qn.toUpper=function(n){return Yu(n).toUpperCase()},Qn.trim=function(n,t,r){if((n=Yu(n))&&(r||t===N))return k(n);if(!n||!(t=Kr(t)))return n;var e=D(n),u=D(t);return ee(e,z(e,u),E(e,u)+1).join("")},Qn.trimEnd=function(n,t,r){if((n=Yu(n))&&(r||t===N))return n.slice(0,M(n)+1);if(!n||!(t=Kr(t)))return n;var e=D(n);return ee(e,0,E(e,D(t))+1).join("")},Qn.trimStart=function(n,t,r){if((n=Yu(n))&&(r||t===N))return n.replace(Vn,"");if(!n||!(t=Kr(t)))return n;var e=D(n);return ee(e,z(e,D(t))).join("")},Qn.truncate=function(n,t){var r=30,e="...";if(Du(t)){var u="separator"in t?t.separator:u;r="length"in t?Vu(t.length):r,e="omission"in t?Kr(t.omission):e}var i=(n=Yu(n)).length;if(W(n)){var o=D(n);i=o.length}if(r>=i)return n;var f=r-$(e);if(f<1)return e;var c=o?ee(o,0,f).join(""):n.slice(0,f);if(u===N)return c+e;if(o&&(f+=c.length-f),Bf(u)){if(n.slice(f).search(u)){var a,l=c;for(u.global||(u=mi(u.source,Yu(rt.exec(u))+"g")),u.lastIndex=0;a=u.exec(l);)var s=a.index;c=c.slice(0,s===N?f:s)}}else if(n.indexOf(Kr(u),f)!=f){var h=c.lastIndexOf(u);h>-1&&(c=c.slice(0,h))}return c+e},Qn.unescape=function(n){return(n=Yu(n))&&Tn.test(n)?n.replace(Un,yr):n},Qn.uniqueId=function(n){var t=++Ei;return Yu(n)+t},Qn.upperCase=ac,Qn.upperFirst=lc,Qn.each=Au,Qn.eachRight=ku,Qn.first=gu,li(Qn,function(){var n={};return Dt(Qn,(function(t,r){zi.call(Qn.prototype,r)||(n[r]=t)})),n}(),{chain:!1}),Qn.VERSION="4.17.21",r(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(n){Qn[n].placeholder=Qn})),r(["drop","take"],(function(n,t){pt.prototype[n]=function(r){r=r===N?1:uo(Vu(r),0);var e=this.__filtered__&&!t?new pt(this):this.clone();return e.__filtered__?e.__takeCount__=io(r,e.__takeCount__):e.__views__.push({size:io(r,nn),type:n+(e.__dir__<0?"Right":"")}),e},pt.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}})),r(["filter","map","takeWhile"],(function(n,t){var r=t+1,e=1==r||3==r;pt.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:Pe(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}})),r(["head","last"],(function(n,t){var r="take"+(t?"Right":"");pt.prototype[n]=function(){return this[r](1).value()[0]}})),r(["initial","tail"],(function(n,t){var r="drop"+(t?"":"Right");pt.prototype[n]=function(){return this.__filtered__?new pt(this):this[r](1)}})),pt.prototype.compact=function(){return this.filter(ci)},pt.prototype.find=function(n){return this.filter(n).head()},pt.prototype.findLast=function(n){return this.reverse().find(n)},pt.prototype.invokeMap=Ur((function(n,t){return"function"==typeof n?new pt(this):this.map((function(r){return ur(r,n,t)}))})),pt.prototype.reject=function(n){return this.filter(Su(Pe(n)))},pt.prototype.slice=function(n,t){n=Vu(n);var r=this;return r.__filtered__&&(n>0||t<0)?new pt(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==N&&(r=(t=Vu(t))<0?r.dropRight(-t):r.take(t-n)),r)},pt.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},pt.prototype.toArray=function(){return this.take(nn)},Dt(pt.prototype,(function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=Qn[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);u&&(Qn.prototype[t]=function(){var t=this.__wrapped__,o=e?[1]:arguments,f=t instanceof pt,c=o[0],l=f||Sf(t),s=function(n){var t=u.apply(Qn,a([n],o));return e&&h?t[0]:t};l&&r&&"function"==typeof c&&1!=c.length&&(f=l=!1);var h=this.__chain__,p=!!this.__actions__.length,_=i&&!h,v=f&&!p;if(!i&&l){t=v?t:new pt(this);var g=n.apply(t,o);return g.__actions__.push({func:ju,args:[s],thisArg:N}),new ht(g,h)}return _&&v?n.apply(this,o):(g=this.thru(s),_?e?g.value()[0]:g.value():g)})})),r(["pop","push","shift","sort","splice","unshift"],(function(n){var t=Ai[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);Qn.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(Sf(u)?u:[],n)}return this[r]((function(r){return t.apply(Sf(r)?r:[],n)}))}})),Dt(pt.prototype,(function(n,t){var r=Qn[t];if(r){var e=r.name+"";zi.call(yo,e)||(yo[e]=[]),yo[e].push({name:t,func:r})}})),yo[xe(N,2).name]=[{name:"wrapper",func:N}],pt.prototype.clone=function(){var n=new pt(this.__wrapped__);return n.__actions__=le(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=le(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=le(this.__views__),n},pt.prototype.reverse=function(){if(this.__filtered__){var n=new pt(this);n.__dir__=-1,n.__filtered__=!0}else(n=this.clone()).__dir__*=-1;return n},pt.prototype.value=function(){var n=this.__wrapped__.value(),t=this.__dir__,r=Sf(n),e=t<0,u=r?n.length:0,i=function(n,t,r){for(var e=-1,u=r.length;++e<u;){var i=r[e],o=i.size;switch(i.type){case"drop":n+=o;break;case"dropRight":t-=o;break;case"take":t=io(t,n+o);break;case"takeRight":n=uo(n,t-o)}}return{start:n,end:t}}(0,u,this.__views__),o=i.start,f=i.end,c=f-o,a=e?f:o-1,l=this.__iteratees__,s=l.length,h=0,p=io(c,this.__takeCount__);if(!r||!e&&u==c&&p==c)return Yr(n,this.__actions__);var _=[];n:for(;c--&&h<p;){for(var v=-1,g=n[a+=t];++v<s;){var y=l[v],d=y.iteratee,b=y.type,w=d(g);if(2==b)g=w;else if(!w){if(1==b)continue n;break n}}_[h++]=g}return _},Qn.prototype.at=lf,Qn.prototype.chain=function(){return xu(this)},Qn.prototype.commit=function(){return new ht(this.value(),this.__chain__)},Qn.prototype.next=function(){this.__values__===N&&(this.__values__=Zu(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?N:this.__values__[this.__index__++]}},Qn.prototype.plant=function(n){for(var t,r=this;r instanceof st;){var e=hu(r);e.__index__=0,e.__values__=N,t?u.__wrapped__=e:t=e;var u=e;r=r.__wrapped__}return u.__wrapped__=n,t},Qn.prototype.reverse=function(){var n=this.__wrapped__;if(n instanceof pt){var t=n;return this.__actions__.length&&(t=new pt(this)),(t=t.reverse()).__actions__.push({func:ju,args:[bu],thisArg:N}),new ht(t,this.__chain__)}return this.thru(bu)},Qn.prototype.toJSON=Qn.prototype.valueOf=Qn.prototype.value=function(){return Yr(this.__wrapped__,this.__actions__)},Qn.prototype.first=Qn.prototype.head,Zi&&(Qn.prototype[Zi]=function(){return this}),Qn}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(rr._=dr,define((function(){return dr}))):ur?((ur.exports=dr)._=dr,er._=dr):rr._=dr}).call(this); vendor/wp-polyfill-formdata.js 0000604 00000027142 15151622574 0012462 0 ustar 00 /* formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */ /* global FormData self Blob File */ /* eslint-disable no-inner-declarations */ if (typeof Blob !== 'undefined' && (typeof FormData === 'undefined' || !FormData.prototype.keys)) { const global = typeof globalThis === 'object' ? globalThis : typeof window === 'object' ? window : typeof self === 'object' ? self : this // keep a reference to native implementation const _FormData = global.FormData // To be monkey patched const _send = global.XMLHttpRequest && global.XMLHttpRequest.prototype.send const _fetch = global.Request && global.fetch const _sendBeacon = global.navigator && global.navigator.sendBeacon // Might be a worker thread... const _match = global.Element && global.Element.prototype // Unable to patch Request/Response constructor correctly #109 // only way is to use ES6 class extend // https://github.com/babel/babel/issues/1966 const stringTag = global.Symbol && Symbol.toStringTag // Add missing stringTags to blob and files if (stringTag) { if (!Blob.prototype[stringTag]) { Blob.prototype[stringTag] = 'Blob' } if ('File' in global && !File.prototype[stringTag]) { File.prototype[stringTag] = 'File' } } // Fix so you can construct your own File try { new File([], '') // eslint-disable-line } catch (a) { global.File = function File (b, d, c) { const blob = new Blob(b, c || {}) const t = c && void 0 !== c.lastModified ? new Date(c.lastModified) : new Date() Object.defineProperties(blob, { name: { value: d }, lastModified: { value: +t }, toString: { value () { return '[object File]' } } }) if (stringTag) { Object.defineProperty(blob, stringTag, { value: 'File' }) } return blob } } function ensureArgs (args, expected) { if (args.length < expected) { throw new TypeError(`${expected} argument required, but only ${args.length} present.`) } } /** * @param {string} name * @param {string | undefined} filename * @returns {[string, File|string]} */ function normalizeArgs (name, value, filename) { if (value instanceof Blob) { filename = filename !== undefined ? String(filename + '') : typeof value.name === 'string' ? value.name : 'blob' if (value.name !== filename || Object.prototype.toString.call(value) === '[object Blob]') { value = new File([value], filename) } return [String(name), value] } return [String(name), String(value)] } // normalize line feeds for textarea // https://html.spec.whatwg.org/multipage/form-elements.html#textarea-line-break-normalisation-transformation function normalizeLinefeeds (value) { return value.replace(/\r?\n|\r/g, '\r\n') } /** * @template T * @param {ArrayLike<T>} arr * @param {{ (elm: T): void; }} cb */ function each (arr, cb) { for (let i = 0; i < arr.length; i++) { cb(arr[i]) } } const escape = str => str.replace(/\n/g, '%0A').replace(/\r/g, '%0D').replace(/"/g, '%22') /** * @implements {Iterable} */ class FormDataPolyfill { /** * FormData class * * @param {HTMLFormElement=} form */ constructor (form) { /** @type {[string, string|File][]} */ this._data = [] const self = this form && each(form.elements, (/** @type {HTMLInputElement} */ elm) => { if ( !elm.name || elm.disabled || elm.type === 'submit' || elm.type === 'button' || elm.matches('form fieldset[disabled] *') ) return if (elm.type === 'file') { const files = elm.files && elm.files.length ? elm.files : [new File([], '', { type: 'application/octet-stream' })] // #78 each(files, file => { self.append(elm.name, file) }) } else if (elm.type === 'select-multiple' || elm.type === 'select-one') { each(elm.options, opt => { !opt.disabled && opt.selected && self.append(elm.name, opt.value) }) } else if (elm.type === 'checkbox' || elm.type === 'radio') { if (elm.checked) self.append(elm.name, elm.value) } else { const value = elm.type === 'textarea' ? normalizeLinefeeds(elm.value) : elm.value self.append(elm.name, value) } }) } /** * Append a field * * @param {string} name field name * @param {string|Blob|File} value string / blob / file * @param {string=} filename filename to use with blob * @return {undefined} */ append (name, value, filename) { ensureArgs(arguments, 2) this._data.push(normalizeArgs(name, value, filename)) } /** * Delete all fields values given name * * @param {string} name Field name * @return {undefined} */ delete (name) { ensureArgs(arguments, 1) const result = [] name = String(name) each(this._data, entry => { entry[0] !== name && result.push(entry) }) this._data = result } /** * Iterate over all fields as [name, value] * * @return {Iterator} */ * entries () { for (var i = 0; i < this._data.length; i++) { yield this._data[i] } } /** * Iterate over all fields * * @param {Function} callback Executed for each item with parameters (value, name, thisArg) * @param {Object=} thisArg `this` context for callback function */ forEach (callback, thisArg) { ensureArgs(arguments, 1) for (const [name, value] of this) { callback.call(thisArg, value, name, this) } } /** * Return first field value given name * or null if non existent * * @param {string} name Field name * @return {string|File|null} value Fields value */ get (name) { ensureArgs(arguments, 1) const entries = this._data name = String(name) for (let i = 0; i < entries.length; i++) { if (entries[i][0] === name) { return entries[i][1] } } return null } /** * Return all fields values given name * * @param {string} name Fields name * @return {Array} [{String|File}] */ getAll (name) { ensureArgs(arguments, 1) const result = [] name = String(name) each(this._data, data => { data[0] === name && result.push(data[1]) }) return result } /** * Check for field name existence * * @param {string} name Field name * @return {boolean} */ has (name) { ensureArgs(arguments, 1) name = String(name) for (let i = 0; i < this._data.length; i++) { if (this._data[i][0] === name) { return true } } return false } /** * Iterate over all fields name * * @return {Iterator} */ * keys () { for (const [name] of this) { yield name } } /** * Overwrite all values given name * * @param {string} name Filed name * @param {string} value Field value * @param {string=} filename Filename (optional) */ set (name, value, filename) { ensureArgs(arguments, 2) name = String(name) /** @type {[string, string|File][]} */ const result = [] const args = normalizeArgs(name, value, filename) let replace = true // - replace the first occurrence with same name // - discards the remaining with same name // - while keeping the same order items where added each(this._data, data => { data[0] === name ? replace && (replace = !result.push(args)) : result.push(data) }) replace && result.push(args) this._data = result } /** * Iterate over all fields * * @return {Iterator} */ * values () { for (const [, value] of this) { yield value } } /** * Return a native (perhaps degraded) FormData with only a `append` method * Can throw if it's not supported * * @return {FormData} */ ['_asNative'] () { const fd = new _FormData() for (const [name, value] of this) { fd.append(name, value) } return fd } /** * [_blob description] * * @return {Blob} [description] */ ['_blob'] () { const boundary = '----formdata-polyfill-' + Math.random(), chunks = [], p = `--${boundary}\r\nContent-Disposition: form-data; name="` this.forEach((value, name) => typeof value == 'string' ? chunks.push(p + escape(normalizeLinefeeds(name)) + `"\r\n\r\n${normalizeLinefeeds(value)}\r\n`) : chunks.push(p + escape(normalizeLinefeeds(name)) + `"; filename="${escape(value.name)}"\r\nContent-Type: ${value.type||"application/octet-stream"}\r\n\r\n`, value, `\r\n`)) chunks.push(`--${boundary}--`) return new Blob(chunks, { type: "multipart/form-data; boundary=" + boundary }) } /** * The class itself is iterable * alias for formdata.entries() * * @return {Iterator} */ [Symbol.iterator] () { return this.entries() } /** * Create the default string description. * * @return {string} [object FormData] */ toString () { return '[object FormData]' } } if (_match && !_match.matches) { _match.matches = _match.matchesSelector || _match.mozMatchesSelector || _match.msMatchesSelector || _match.oMatchesSelector || _match.webkitMatchesSelector || function (s) { var matches = (this.document || this.ownerDocument).querySelectorAll(s) var i = matches.length while (--i >= 0 && matches.item(i) !== this) {} return i > -1 } } if (stringTag) { /** * Create the default string description. * It is accessed internally by the Object.prototype.toString(). */ FormDataPolyfill.prototype[stringTag] = 'FormData' } // Patch xhr's send method to call _blob transparently if (_send) { const setRequestHeader = global.XMLHttpRequest.prototype.setRequestHeader global.XMLHttpRequest.prototype.setRequestHeader = function (name, value) { setRequestHeader.call(this, name, value) if (name.toLowerCase() === 'content-type') this._hasContentType = true } global.XMLHttpRequest.prototype.send = function (data) { // need to patch send b/c old IE don't send blob's type (#44) if (data instanceof FormDataPolyfill) { const blob = data['_blob']() if (!this._hasContentType) this.setRequestHeader('Content-Type', blob.type) _send.call(this, blob) } else { _send.call(this, data) } } } // Patch fetch's function to call _blob transparently if (_fetch) { global.fetch = function (input, init) { if (init && init.body && init.body instanceof FormDataPolyfill) { init.body = init.body['_blob']() } return _fetch.call(this, input, init) } } // Patch navigator.sendBeacon to use native FormData if (_sendBeacon) { global.navigator.sendBeacon = function (url, data) { if (data instanceof FormDataPolyfill) { data = data['_asNative']() } return _sendBeacon.call(this, url, data) } } global['FormData'] = FormDataPolyfill } vendor/wp-polyfill-node-contains.min.js 0000644 00000000534 15151622574 0014210 0 ustar 00 (()=>{function e(e){if(!(0 in arguments))throw new TypeError("1 argument is required");do{if(this===e)return!0}while(e=e&&e.parentNode);return!1}if("HTMLElement"in self&&"contains"in HTMLElement.prototype)try{delete HTMLElement.prototype.contains}catch(e){}"Node"in self?Node.prototype.contains=e:document.contains=Element.prototype.contains=e})(); vendor/lodash.js 0000604 00002046542 15151622574 0007672 0 ustar 00 /** * @license * Lodash <https://lodash.com/> * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ ;(function() { /** Used as a safe reference for `undefined` in pre-ES5 environments. */ var undefined; /** Used as the semantic version number. */ var VERSION = '4.17.21'; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** Error message constants. */ var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', FUNC_ERROR_TEXT = 'Expected a function', INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used as the maximum memoize cache size. */ var MAX_MEMOIZE_SIZE = 500; /** Used as the internal argument placeholder. */ var PLACEHOLDER = '__lodash_placeholder__'; /** Used to compose bitmasks for cloning. */ var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4; /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; /** Used to compose bitmasks for function metadata. */ var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512; /** Used as default options for `_.truncate`. */ var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = '...'; /** Used to detect hot functions by number of calls within a span of milliseconds. */ var HOT_COUNT = 800, HOT_SPAN = 16; /** Used to indicate the type of lazy iteratees. */ var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3; /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 1.7976931348623157e+308, NAN = 0 / 0; /** Used as references for the maximum length and index of an array. */ var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; /** Used to associate wrap methods with their bit flags. */ var wrapFlags = [ ['ary', WRAP_ARY_FLAG], ['bind', WRAP_BIND_FLAG], ['bindKey', WRAP_BIND_KEY_FLAG], ['curry', WRAP_CURRY_FLAG], ['curryRight', WRAP_CURRY_RIGHT_FLAG], ['flip', WRAP_FLIP_FLAG], ['partial', WRAP_PARTIAL_FLAG], ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], ['rearg', WRAP_REARG_FLAG] ]; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', asyncTag = '[object AsyncFunction]', boolTag = '[object Boolean]', dateTag = '[object Date]', domExcTag = '[object DOMException]', errorTag = '[object Error]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', numberTag = '[object Number]', nullTag = '[object Null]', objectTag = '[object Object]', promiseTag = '[object Promise]', proxyTag = '[object Proxy]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]', undefinedTag = '[object Undefined]', weakMapTag = '[object WeakMap]', weakSetTag = '[object WeakSet]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** Used to match empty string literals in compiled template source. */ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; /** Used to match HTML entities and HTML characters. */ var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source); /** Used to match template delimiters. */ var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); /** Used to match leading whitespace. */ var reTrimStart = /^\s+/; /** Used to match a single whitespace character. */ var reWhitespace = /\s/; /** Used to match wrap detail comments. */ var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /; /** Used to match words composed of alphanumeric characters. */ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; /** * Used to validate the `validate` option in `_.template` variable. * * Forbids characters which could potentially change the meaning of the function argument definition: * - "()," (modification of function parameters) * - "=" (default value) * - "[]{}" (destructuring of function parameters) * - "/" (beginning of a comment) * - whitespace */ var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; /** * Used to match * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; /** Used to match `RegExp` flags from their coerced string values. */ var reFlags = /\w*$/; /** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; /** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Used to match Latin Unicode letters (excluding mathematical operators). */ var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; /** Used to ensure capturing order of template delimiters. */ var reNoMatch = /($^)/; /** Used to match unescaped characters in compiled string literals. */ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', rsComboMarksRange = '\\u0300-\\u036f', reComboHalfMarksRange = '\\ufe20-\\ufe2f', rsComboSymbolsRange = '\\u20d0-\\u20ff', rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = '\\u2700-\\u27bf', rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', rsPunctuationRange = '\\u2000-\\u206f', rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', rsVarRange = '\\ufe0e\\ufe0f', rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; /** Used to compose unicode capture groups. */ var rsApos = "['\u2019]", rsAstral = '[' + rsAstralRange + ']', rsBreak = '[' + rsBreakRange + ']', rsCombo = '[' + rsComboRange + ']', rsDigits = '\\d+', rsDingbat = '[' + rsDingbatRange + ']', rsLower = '[' + rsLowerRange + ']', rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', rsFitz = '\\ud83c[\\udffb-\\udfff]', rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', rsNonAstral = '[^' + rsAstralRange + ']', rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsUpper = '[' + rsUpperRange + ']', rsZWJ = '\\u200d'; /** Used to compose unicode regexes. */ var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', reOptMod = rsModifier + '?', rsOptVar = '[' + rsVarRange + ']?', rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; /** Used to match apostrophes. */ var reApos = RegExp(rsApos, 'g'); /** * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). */ var reComboMark = RegExp(rsCombo, 'g'); /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); /** Used to match complex or compound words. */ var reUnicodeWord = RegExp([ rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, rsUpper + '+' + rsOptContrUpper, rsOrdUpper, rsOrdLower, rsDigits, rsEmoji ].join('|'), 'g'); /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); /** Used to detect strings that need a more robust regexp to match words. */ var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; /** Used to assign default `context` object properties. */ var contextProps = [ 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' ]; /** Used to make template sourceURLs easier to identify. */ var templateCounter = -1; /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; /** Used to map Latin Unicode letters to basic Latin letters. */ var deburredLetters = { // Latin-1 Supplement block. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', '\xc7': 'C', '\xe7': 'c', '\xd0': 'D', '\xf0': 'd', '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', '\xd1': 'N', '\xf1': 'n', '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', '\xc6': 'Ae', '\xe6': 'ae', '\xde': 'Th', '\xfe': 'th', '\xdf': 'ss', // Latin Extended-A block. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', '\u0134': 'J', '\u0135': 'j', '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', '\u0163': 't', '\u0165': 't', '\u0167': 't', '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', '\u0174': 'W', '\u0175': 'w', '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', '\u0132': 'IJ', '\u0133': 'ij', '\u0152': 'Oe', '\u0153': 'oe', '\u0149': "'n", '\u017f': 's' }; /** Used to map characters to HTML entities. */ var htmlEscapes = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }; /** Used to map HTML entities to characters. */ var htmlUnescapes = { '&': '&', '<': '<', '>': '>', '"': '"', ''': "'" }; /** Used to escape characters for inclusion in compiled string literals. */ var stringEscapes = { '\\': '\\', "'": "'", '\n': 'n', '\r': 'r', '\u2028': 'u2028', '\u2029': 'u2029' }; /** Built-in method references without a dependency on `root`. */ var freeParseFloat = parseFloat, freeParseInt = parseInt; /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); /** Detect free variable `exports`. */ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && freeGlobal.process; /** Used to access faster Node.js helpers. */ var nodeUtil = (function() { try { // Use `util.types` for Node.js 10+. var types = freeModule && freeModule.require && freeModule.require('util').types; if (types) { return types; } // Legacy `process.binding('util')` for Node.js < 10. return freeProcess && freeProcess.binding && freeProcess.binding('util'); } catch (e) {} }()); /* Node.js helper references. */ var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; /*--------------------------------------------------------------------------*/ /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. * * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. * @param {Array} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { switch (args.length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); case 3: return func.call(thisArg, args[0], args[1], args[2]); } return func.apply(thisArg, args); } /** * A specialized version of `baseAggregator` for arrays. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} setter The function to set `accumulator` values. * @param {Function} iteratee The iteratee to transform keys. * @param {Object} accumulator The initial aggregated object. * @returns {Function} Returns `accumulator`. */ function arrayAggregator(array, setter, iteratee, accumulator) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { var value = array[index]; setter(accumulator, value, iteratee(value), array); } return accumulator; } /** * A specialized version of `_.forEach` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEach(array, iteratee) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (iteratee(array[index], index, array) === false) { break; } } return array; } /** * A specialized version of `_.forEachRight` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEachRight(array, iteratee) { var length = array == null ? 0 : array.length; while (length--) { if (iteratee(array[length], length, array) === false) { break; } } return array; } /** * A specialized version of `_.every` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false`. */ function arrayEvery(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (!predicate(array[index], index, array)) { return false; } } return true; } /** * A specialized version of `_.filter` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[resIndex++] = value; } } return result; } /** * A specialized version of `_.includes` for arrays without support for * specifying an index to search from. * * @private * @param {Array} [array] The array to inspect. * @param {*} target The value to search for. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludes(array, value) { var length = array == null ? 0 : array.length; return !!length && baseIndexOf(array, value, 0) > -1; } /** * This function is like `arrayIncludes` except that it accepts a comparator. * * @private * @param {Array} [array] The array to inspect. * @param {*} target The value to search for. * @param {Function} comparator The comparator invoked per element. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludesWith(array, value, comparator) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (comparator(value, array[index])) { return true; } } return false; } /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, length = array == null ? 0 : array.length, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } /** * Appends the elements of `values` to `array`. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to append. * @returns {Array} Returns `array`. */ function arrayPush(array, values) { var index = -1, length = values.length, offset = array.length; while (++index < length) { array[offset + index] = values[index]; } return array; } /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as * the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, length = array == null ? 0 : array.length; if (initAccum && length) { accumulator = array[++index]; } while (++index < length) { accumulator = iteratee(accumulator, array[index], index, array); } return accumulator; } /** * A specialized version of `_.reduceRight` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the last element of `array` as * the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduceRight(array, iteratee, accumulator, initAccum) { var length = array == null ? 0 : array.length; if (initAccum && length) { accumulator = array[--length]; } while (length--) { accumulator = iteratee(accumulator, array[length], length, array); } return accumulator; } /** * A specialized version of `_.some` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function arraySome(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } /** * Gets the size of an ASCII `string`. * * @private * @param {string} string The string inspect. * @returns {number} Returns the string size. */ var asciiSize = baseProperty('length'); /** * Converts an ASCII `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function asciiToArray(string) { return string.split(''); } /** * Splits an ASCII `string` into an array of its words. * * @private * @param {string} The string to inspect. * @returns {Array} Returns the words of `string`. */ function asciiWords(string) { return string.match(reAsciiWord) || []; } /** * The base implementation of methods like `_.findKey` and `_.findLastKey`, * without support for iteratee shorthands, which iterates over `collection` * using `eachFunc`. * * @private * @param {Array|Object} collection The collection to inspect. * @param {Function} predicate The function invoked per iteration. * @param {Function} eachFunc The function to iterate over `collection`. * @returns {*} Returns the found element or its key, else `undefined`. */ function baseFindKey(collection, predicate, eachFunc) { var result; eachFunc(collection, function(value, key, collection) { if (predicate(value, key, collection)) { result = key; return false; } }); return result; } /** * The base implementation of `_.findIndex` and `_.findLastIndex` without * support for iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Function} predicate The function invoked per iteration. * @param {number} fromIndex The index to search from. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseFindIndex(array, predicate, fromIndex, fromRight) { var length = array.length, index = fromIndex + (fromRight ? 1 : -1); while ((fromRight ? index-- : ++index < length)) { if (predicate(array[index], index, array)) { return index; } } return -1; } /** * The base implementation of `_.indexOf` without `fromIndex` bounds checks. * * @private * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} fromIndex The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); } /** * This function is like `baseIndexOf` except that it accepts a comparator. * * @private * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} fromIndex The index to search from. * @param {Function} comparator The comparator invoked per element. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOfWith(array, value, fromIndex, comparator) { var index = fromIndex - 1, length = array.length; while (++index < length) { if (comparator(array[index], value)) { return index; } } return -1; } /** * The base implementation of `_.isNaN` without support for number objects. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. */ function baseIsNaN(value) { return value !== value; } /** * The base implementation of `_.mean` and `_.meanBy` without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {number} Returns the mean. */ function baseMean(array, iteratee) { var length = array == null ? 0 : array.length; return length ? (baseSum(array, iteratee) / length) : NAN; } /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } /** * The base implementation of `_.propertyOf` without support for deep paths. * * @private * @param {Object} object The object to query. * @returns {Function} Returns the new accessor function. */ function basePropertyOf(object) { return function(key) { return object == null ? undefined : object[key]; }; } /** * The base implementation of `_.reduce` and `_.reduceRight`, without support * for iteratee shorthands, which iterates over `collection` using `eachFunc`. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} accumulator The initial value. * @param {boolean} initAccum Specify using the first or last element of * `collection` as the initial value. * @param {Function} eachFunc The function to iterate over `collection`. * @returns {*} Returns the accumulated value. */ function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection); }); return accumulator; } /** * The base implementation of `_.sortBy` which uses `comparer` to define the * sort order of `array` and replaces criteria objects with their corresponding * values. * * @private * @param {Array} array The array to sort. * @param {Function} comparer The function to define sort order. * @returns {Array} Returns `array`. */ function baseSortBy(array, comparer) { var length = array.length; array.sort(comparer); while (length--) { array[length] = array[length].value; } return array; } /** * The base implementation of `_.sum` and `_.sumBy` without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {number} Returns the sum. */ function baseSum(array, iteratee) { var result, index = -1, length = array.length; while (++index < length) { var current = iteratee(array[index]); if (current !== undefined) { result = result === undefined ? current : (result + current); } } return result; } /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * * @private * @param {number} n The number of times to invoke `iteratee`. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } /** * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array * of key-value pairs for `object` corresponding to the property names of `props`. * * @private * @param {Object} object The object to query. * @param {Array} props The property names to get values for. * @returns {Object} Returns the key-value pairs. */ function baseToPairs(object, props) { return arrayMap(props, function(key) { return [key, object[key]]; }); } /** * The base implementation of `_.trim`. * * @private * @param {string} string The string to trim. * @returns {string} Returns the trimmed string. */ function baseTrim(string) { return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') : string; } /** * The base implementation of `_.unary` without support for storing metadata. * * @private * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new capped function. */ function baseUnary(func) { return function(value) { return func(value); }; } /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names * of `props`. * * @private * @param {Object} object The object to query. * @param {Array} props The property names to get values for. * @returns {Object} Returns the array of property values. */ function baseValues(object, props) { return arrayMap(props, function(key) { return object[key]; }); } /** * Checks if a `cache` value for `key` exists. * * @private * @param {Object} cache The cache to query. * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function cacheHas(cache, key) { return cache.has(key); } /** * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol * that is not found in the character symbols. * * @private * @param {Array} strSymbols The string symbols to inspect. * @param {Array} chrSymbols The character symbols to find. * @returns {number} Returns the index of the first unmatched string symbol. */ function charsStartIndex(strSymbols, chrSymbols) { var index = -1, length = strSymbols.length; while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} return index; } /** * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol * that is not found in the character symbols. * * @private * @param {Array} strSymbols The string symbols to inspect. * @param {Array} chrSymbols The character symbols to find. * @returns {number} Returns the index of the last unmatched string symbol. */ function charsEndIndex(strSymbols, chrSymbols) { var index = strSymbols.length; while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} return index; } /** * Gets the number of `placeholder` occurrences in `array`. * * @private * @param {Array} array The array to inspect. * @param {*} placeholder The placeholder to search for. * @returns {number} Returns the placeholder count. */ function countHolders(array, placeholder) { var length = array.length, result = 0; while (length--) { if (array[length] === placeholder) { ++result; } } return result; } /** * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A * letters to basic Latin letters. * * @private * @param {string} letter The matched letter to deburr. * @returns {string} Returns the deburred letter. */ var deburrLetter = basePropertyOf(deburredLetters); /** * Used by `_.escape` to convert characters to HTML entities. * * @private * @param {string} chr The matched character to escape. * @returns {string} Returns the escaped character. */ var escapeHtmlChar = basePropertyOf(htmlEscapes); /** * Used by `_.template` to escape characters for inclusion in compiled string literals. * * @private * @param {string} chr The matched character to escape. * @returns {string} Returns the escaped character. */ function escapeStringChar(chr) { return '\\' + stringEscapes[chr]; } /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } /** * Checks if `string` contains Unicode symbols. * * @private * @param {string} string The string to inspect. * @returns {boolean} Returns `true` if a symbol is found, else `false`. */ function hasUnicode(string) { return reHasUnicode.test(string); } /** * Checks if `string` contains a word composed of Unicode symbols. * * @private * @param {string} string The string to inspect. * @returns {boolean} Returns `true` if a word is found, else `false`. */ function hasUnicodeWord(string) { return reHasUnicodeWord.test(string); } /** * Converts `iterator` to an array. * * @private * @param {Object} iterator The iterator to convert. * @returns {Array} Returns the converted array. */ function iteratorToArray(iterator) { var data, result = []; while (!(data = iterator.next()).done) { result.push(data.value); } return result; } /** * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } /** * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. * @param {Function} transform The argument transform. * @returns {Function} Returns the new function. */ function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } /** * Replaces all `placeholder` elements in `array` with an internal placeholder * and returns an array of their indexes. * * @private * @param {Array} array The array to modify. * @param {*} placeholder The placeholder to replace. * @returns {Array} Returns the new array of placeholder indexes. */ function replaceHolders(array, placeholder) { var index = -1, length = array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (value === placeholder || value === PLACEHOLDER) { array[index] = PLACEHOLDER; result[resIndex++] = index; } } return result; } /** * Converts `set` to an array of its values. * * @private * @param {Object} set The set to convert. * @returns {Array} Returns the values. */ function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; } /** * Converts `set` to its value-value pairs. * * @private * @param {Object} set The set to convert. * @returns {Array} Returns the value-value pairs. */ function setToPairs(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = [value, value]; }); return result; } /** * A specialized version of `_.indexOf` which performs strict equality * comparisons of values, i.e. `===`. * * @private * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} fromIndex The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ function strictIndexOf(array, value, fromIndex) { var index = fromIndex - 1, length = array.length; while (++index < length) { if (array[index] === value) { return index; } } return -1; } /** * A specialized version of `_.lastIndexOf` which performs strict equality * comparisons of values, i.e. `===`. * * @private * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} fromIndex The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ function strictLastIndexOf(array, value, fromIndex) { var index = fromIndex + 1; while (index--) { if (array[index] === value) { return index; } } return index; } /** * Gets the number of symbols in `string`. * * @private * @param {string} string The string to inspect. * @returns {number} Returns the string size. */ function stringSize(string) { return hasUnicode(string) ? unicodeSize(string) : asciiSize(string); } /** * Converts `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function stringToArray(string) { return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string); } /** * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace * character of `string`. * * @private * @param {string} string The string to inspect. * @returns {number} Returns the index of the last non-whitespace character. */ function trimmedEndIndex(string) { var index = string.length; while (index-- && reWhitespace.test(string.charAt(index))) {} return index; } /** * Used by `_.unescape` to convert HTML entities to characters. * * @private * @param {string} chr The matched character to unescape. * @returns {string} Returns the unescaped character. */ var unescapeHtmlChar = basePropertyOf(htmlUnescapes); /** * Gets the size of a Unicode `string`. * * @private * @param {string} string The string inspect. * @returns {number} Returns the string size. */ function unicodeSize(string) { var result = reUnicode.lastIndex = 0; while (reUnicode.test(string)) { ++result; } return result; } /** * Converts a Unicode `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function unicodeToArray(string) { return string.match(reUnicode) || []; } /** * Splits a Unicode `string` into an array of its words. * * @private * @param {string} The string to inspect. * @returns {Array} Returns the words of `string`. */ function unicodeWords(string) { return string.match(reUnicodeWord) || []; } /*--------------------------------------------------------------------------*/ /** * Create a new pristine `lodash` function using the `context` object. * * @static * @memberOf _ * @since 1.1.0 * @category Util * @param {Object} [context=root] The context object. * @returns {Function} Returns a new `lodash` function. * @example * * _.mixin({ 'foo': _.constant('foo') }); * * var lodash = _.runInContext(); * lodash.mixin({ 'bar': lodash.constant('bar') }); * * _.isFunction(_.foo); * // => true * _.isFunction(_.bar); * // => false * * lodash.isFunction(lodash.foo); * // => false * lodash.isFunction(lodash.bar); * // => true * * // Create a suped-up `defer` in Node.js. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; */ var runInContext = (function runInContext(context) { context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); /** Built-in constructor references. */ var Array = context.Array, Date = context.Date, Error = context.Error, Function = context.Function, Math = context.Math, Object = context.Object, RegExp = context.RegExp, String = context.String, TypeError = context.TypeError; /** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = context['__core-js_shared__']; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to generate unique IDs. */ var idCounter = 0; /** Used to detect methods masquerading as native. */ var maskSrcKey = (function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** Used to infer the `Object` constructor. */ var objectCtorString = funcToString.call(Object); /** Used to restore the original `_` reference in `_.noConflict`. */ var oldDash = root._; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ var Buffer = moduleExports ? context.Buffer : undefined, Symbol = context.Symbol, Uint8Array = context.Uint8Array, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, getPrototype = overArg(Object.getPrototypeOf, Object), objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, symIterator = Symbol ? Symbol.iterator : undefined, symToStringTag = Symbol ? Symbol.toStringTag : undefined; var defineProperty = (function() { try { var func = getNative(Object, 'defineProperty'); func({}, '', {}); return func; } catch (e) {} }()); /** Mocked built-ins. */ var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date && Date.now !== root.Date.now && Date.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeCeil = Math.ceil, nativeFloor = Math.floor, nativeGetSymbols = Object.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object.keys, Object), nativeMax = Math.max, nativeMin = Math.min, nativeNow = Date.now, nativeParseInt = context.parseInt, nativeRandom = Math.random, nativeReverse = arrayProto.reverse; /* Built-in method references that are verified to be native. */ var DataView = getNative(context, 'DataView'), Map = getNative(context, 'Map'), Promise = getNative(context, 'Promise'), Set = getNative(context, 'Set'), WeakMap = getNative(context, 'WeakMap'), nativeCreate = getNative(Object, 'create'); /** Used to store function metadata. */ var metaMap = WeakMap && new WeakMap; /** Used to lookup unminified function names. */ var realNames = {}; /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; /*------------------------------------------------------------------------*/ /** * Creates a `lodash` object which wraps `value` to enable implicit method * chain sequences. Methods that operate on and return arrays, collections, * and functions can be chained together. Methods that retrieve a single value * or may return a primitive value will automatically end the chain sequence * and return the unwrapped value. Otherwise, the value must be unwrapped * with `_#value`. * * Explicit chain sequences, which must be unwrapped with `_#value`, may be * enabled using `_.chain`. * * The execution of chained methods is lazy, that is, it's deferred until * `_#value` is implicitly or explicitly called. * * Lazy evaluation allows several methods to support shortcut fusion. * Shortcut fusion is an optimization to merge iteratee calls; this avoids * the creation of intermediate arrays and can greatly reduce the number of * iteratee executions. Sections of a chain sequence qualify for shortcut * fusion if the section is applied to an array and iteratees accept only * one argument. The heuristic for whether a section qualifies for shortcut * fusion is subject to change. * * Chaining is supported in custom builds as long as the `_#value` method is * directly or indirectly included in the build. * * In addition to lodash methods, wrappers have `Array` and `String` methods. * * The wrapper `Array` methods are: * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` * * The wrapper `String` methods are: * `replace` and `split` * * The wrapper methods that support shortcut fusion are: * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` * * The chainable wrapper methods are: * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, * `zipObject`, `zipObjectDeep`, and `zipWith` * * The wrapper methods that are **not** chainable by default are: * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, * `upperFirst`, `value`, and `words` * * @name _ * @constructor * @category Seq * @param {*} value The value to wrap in a `lodash` instance. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * function square(n) { * return n * n; * } * * var wrapped = _([1, 2, 3]); * * // Returns an unwrapped value. * wrapped.reduce(_.add); * // => 6 * * // Returns a wrapped value. * var squares = wrapped.map(square); * * _.isArray(squares); * // => false * * _.isArray(squares.value()); * // => true */ function lodash(value) { if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { if (value instanceof LodashWrapper) { return value; } if (hasOwnProperty.call(value, '__wrapped__')) { return wrapperClone(value); } } return new LodashWrapper(value); } /** * The base implementation of `_.create` without support for assigning * properties to the created object. * * @private * @param {Object} proto The object to inherit from. * @returns {Object} Returns the new object. */ var baseCreate = (function() { function object() {} return function(proto) { if (!isObject(proto)) { return {}; } if (objectCreate) { return objectCreate(proto); } object.prototype = proto; var result = new object; object.prototype = undefined; return result; }; }()); /** * The function whose prototype chain sequence wrappers inherit from. * * @private */ function baseLodash() { // No operation performed. } /** * The base constructor for creating `lodash` wrapper objects. * * @private * @param {*} value The value to wrap. * @param {boolean} [chainAll] Enable explicit method chain sequences. */ function LodashWrapper(value, chainAll) { this.__wrapped__ = value; this.__actions__ = []; this.__chain__ = !!chainAll; this.__index__ = 0; this.__values__ = undefined; } /** * By default, the template delimiters used by lodash are like those in * embedded Ruby (ERB) as well as ES2015 template strings. Change the * following template settings to use alternative delimiters. * * @static * @memberOf _ * @type {Object} */ lodash.templateSettings = { /** * Used to detect `data` property values to be HTML-escaped. * * @memberOf _.templateSettings * @type {RegExp} */ 'escape': reEscape, /** * Used to detect code to be evaluated. * * @memberOf _.templateSettings * @type {RegExp} */ 'evaluate': reEvaluate, /** * Used to detect `data` property values to inject. * * @memberOf _.templateSettings * @type {RegExp} */ 'interpolate': reInterpolate, /** * Used to reference the data object in the template text. * * @memberOf _.templateSettings * @type {string} */ 'variable': '', /** * Used to import variables into the compiled template. * * @memberOf _.templateSettings * @type {Object} */ 'imports': { /** * A reference to the `lodash` function. * * @memberOf _.templateSettings.imports * @type {Function} */ '_': lodash } }; // Ensure wrappers are instances of `baseLodash`. lodash.prototype = baseLodash.prototype; lodash.prototype.constructor = lodash; LodashWrapper.prototype = baseCreate(baseLodash.prototype); LodashWrapper.prototype.constructor = LodashWrapper; /*------------------------------------------------------------------------*/ /** * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. * * @private * @constructor * @param {*} value The value to wrap. */ function LazyWrapper(value) { this.__wrapped__ = value; this.__actions__ = []; this.__dir__ = 1; this.__filtered__ = false; this.__iteratees__ = []; this.__takeCount__ = MAX_ARRAY_LENGTH; this.__views__ = []; } /** * Creates a clone of the lazy wrapper object. * * @private * @name clone * @memberOf LazyWrapper * @returns {Object} Returns the cloned `LazyWrapper` object. */ function lazyClone() { var result = new LazyWrapper(this.__wrapped__); result.__actions__ = copyArray(this.__actions__); result.__dir__ = this.__dir__; result.__filtered__ = this.__filtered__; result.__iteratees__ = copyArray(this.__iteratees__); result.__takeCount__ = this.__takeCount__; result.__views__ = copyArray(this.__views__); return result; } /** * Reverses the direction of lazy iteration. * * @private * @name reverse * @memberOf LazyWrapper * @returns {Object} Returns the new reversed `LazyWrapper` object. */ function lazyReverse() { if (this.__filtered__) { var result = new LazyWrapper(this); result.__dir__ = -1; result.__filtered__ = true; } else { result = this.clone(); result.__dir__ *= -1; } return result; } /** * Extracts the unwrapped value from its lazy wrapper. * * @private * @name value * @memberOf LazyWrapper * @returns {*} Returns the unwrapped value. */ function lazyValue() { var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : (start - 1), iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); if (!isArr || (!isRight && arrLength == length && takeCount == length)) { return baseWrapperValue(array, this.__actions__); } var result = []; outer: while (length-- && resIndex < takeCount) { index += dir; var iterIndex = -1, value = array[index]; while (++iterIndex < iterLength) { var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value); if (type == LAZY_MAP_FLAG) { value = computed; } else if (!computed) { if (type == LAZY_FILTER_FLAG) { continue outer; } else { break outer; } } } result[resIndex++] = value; } return result; } // Ensure `LazyWrapper` is an instance of `baseLodash`. LazyWrapper.prototype = baseCreate(baseLodash.prototype); LazyWrapper.prototype.constructor = LazyWrapper; /*------------------------------------------------------------------------*/ /** * Creates a hash object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the hash. * * @private * @name clear * @memberOf Hash */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; } /** * Removes `key` and its value from the hash. * * @private * @name delete * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { var result = this.has(key) && delete this.__data__[key]; this.size -= result ? 1 : 0; return result; } /** * Gets the hash value for `key`. * * @private * @name get * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined; } /** * Checks if a hash value for `key` exists. * * @private * @name has * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { var data = this.__data__; return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); } /** * Sets the hash `key` to `value`. * * @private * @name set * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { var data = this.__data__; this.size += this.has(key) ? 0 : 1; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this; } // Add methods to `Hash`. Hash.prototype.clear = hashClear; Hash.prototype['delete'] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; /*------------------------------------------------------------------------*/ /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the list cache. * * @private * @name clear * @memberOf ListCache */ function listCacheClear() { this.__data__ = []; this.size = 0; } /** * Removes `key` and its value from the list cache. * * @private * @name delete * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } --this.size; return true; } /** * Gets the list cache value for `key`. * * @private * @name get * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; } /** * Checks if a list cache value for `key` exists. * * @private * @name has * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } /** * Sets the list cache `key` to `value`. * * @private * @name set * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { ++this.size; data.push([key, value]); } else { data[index][1] = value; } return this; } // Add methods to `ListCache`. ListCache.prototype.clear = listCacheClear; ListCache.prototype['delete'] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; /*------------------------------------------------------------------------*/ /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapCacheClear() { this.size = 0; this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; } /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { var result = getMapData(this, key)['delete'](key); this.size -= result ? 1 : 0; return result; } /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return getMapData(this, key).get(key); } /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { return getMapData(this, key).has(key); } /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { var data = getMapData(this, key), size = data.size; data.set(key, value); this.size += data.size == size ? 0 : 1; return this; } // Add methods to `MapCache`. MapCache.prototype.clear = mapCacheClear; MapCache.prototype['delete'] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; /*------------------------------------------------------------------------*/ /** * * Creates an array cache object to store unique values. * * @private * @constructor * @param {Array} [values] The values to cache. */ function SetCache(values) { var index = -1, length = values == null ? 0 : values.length; this.__data__ = new MapCache; while (++index < length) { this.add(values[index]); } } /** * Adds `value` to the array cache. * * @private * @name add * @memberOf SetCache * @alias push * @param {*} value The value to cache. * @returns {Object} Returns the cache instance. */ function setCacheAdd(value) { this.__data__.set(value, HASH_UNDEFINED); return this; } /** * Checks if `value` is in the array cache. * * @private * @name has * @memberOf SetCache * @param {*} value The value to search for. * @returns {number} Returns `true` if `value` is found, else `false`. */ function setCacheHas(value) { return this.__data__.has(value); } // Add methods to `SetCache`. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; /*------------------------------------------------------------------------*/ /** * Creates a stack cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Stack(entries) { var data = this.__data__ = new ListCache(entries); this.size = data.size; } /** * Removes all key-value entries from the stack. * * @private * @name clear * @memberOf Stack */ function stackClear() { this.__data__ = new ListCache; this.size = 0; } /** * Removes `key` and its value from the stack. * * @private * @name delete * @memberOf Stack * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { var data = this.__data__, result = data['delete'](key); this.size = data.size; return result; } /** * Gets the stack value for `key`. * * @private * @name get * @memberOf Stack * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function stackGet(key) { return this.__data__.get(key); } /** * Checks if a stack value for `key` exists. * * @private * @name has * @memberOf Stack * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function stackHas(key) { return this.__data__.has(key); } /** * Sets the stack `key` to `value`. * * @private * @name set * @memberOf Stack * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { var data = this.__data__; if (data instanceof ListCache) { var pairs = data.__data__; if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { pairs.push([key, value]); this.size = ++data.size; return this; } data = this.__data__ = new MapCache(pairs); } data.set(key, value); this.size = data.size; return this; } // Add methods to `Stack`. Stack.prototype.clear = stackClear; Stack.prototype['delete'] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; /*------------------------------------------------------------------------*/ /** * Creates an array of the enumerable property names of the array-like `value`. * * @private * @param {*} value The value to query. * @param {boolean} inherited Specify returning inherited property names. * @returns {Array} Returns the array of property names. */ function arrayLikeKeys(value, inherited) { var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode. key == 'length' || // Node.js 0.10 has enumerable non-index properties on buffers. (isBuff && (key == 'offset' || key == 'parent')) || // PhantomJS 2 has enumerable non-index properties on typed arrays. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || // Skip index properties. isIndex(key, length) ))) { result.push(key); } } return result; } /** * A specialized version of `_.sample` for arrays. * * @private * @param {Array} array The array to sample. * @returns {*} Returns the random element. */ function arraySample(array) { var length = array.length; return length ? array[baseRandom(0, length - 1)] : undefined; } /** * A specialized version of `_.sampleSize` for arrays. * * @private * @param {Array} array The array to sample. * @param {number} n The number of elements to sample. * @returns {Array} Returns the random elements. */ function arraySampleSize(array, n) { return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); } /** * A specialized version of `_.shuffle` for arrays. * * @private * @param {Array} array The array to shuffle. * @returns {Array} Returns the new shuffled array. */ function arrayShuffle(array) { return shuffleSelf(copyArray(array)); } /** * This function is like `assignValue` except that it doesn't assign * `undefined` values. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignMergeValue(object, key, value) { if ((value !== undefined && !eq(object[key], value)) || (value === undefined && !(key in object))) { baseAssignValue(object, key, value); } } /** * Assigns `value` to `key` of `object` if the existing value is not equivalent * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignValue(object, key, value) { var objValue = object[key]; if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) { baseAssignValue(object, key, value); } } /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } /** * Aggregates elements of `collection` on `accumulator` with keys transformed * by `iteratee` and values set by `setter`. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} setter The function to set `accumulator` values. * @param {Function} iteratee The iteratee to transform keys. * @param {Object} accumulator The initial aggregated object. * @returns {Function} Returns `accumulator`. */ function baseAggregator(collection, setter, iteratee, accumulator) { baseEach(collection, function(value, key, collection) { setter(accumulator, value, iteratee(value), collection); }); return accumulator; } /** * The base implementation of `_.assign` without support for multiple sources * or `customizer` functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @returns {Object} Returns `object`. */ function baseAssign(object, source) { return object && copyObject(source, keys(source), object); } /** * The base implementation of `_.assignIn` without support for multiple sources * or `customizer` functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @returns {Object} Returns `object`. */ function baseAssignIn(object, source) { return object && copyObject(source, keysIn(source), object); } /** * The base implementation of `assignValue` and `assignMergeValue` without * value checks. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function baseAssignValue(object, key, value) { if (key == '__proto__' && defineProperty) { defineProperty(object, key, { 'configurable': true, 'enumerable': true, 'value': value, 'writable': true }); } else { object[key] = value; } } /** * The base implementation of `_.at` without support for individual paths. * * @private * @param {Object} object The object to iterate over. * @param {string[]} paths The property paths to pick. * @returns {Array} Returns the picked elements. */ function baseAt(object, paths) { var index = -1, length = paths.length, result = Array(length), skip = object == null; while (++index < length) { result[index] = skip ? undefined : get(object, paths[index]); } return result; } /** * The base implementation of `_.clamp` which doesn't coerce arguments. * * @private * @param {number} number The number to clamp. * @param {number} [lower] The lower bound. * @param {number} upper The upper bound. * @returns {number} Returns the clamped number. */ function baseClamp(number, lower, upper) { if (number === number) { if (upper !== undefined) { number = number <= upper ? number : upper; } if (lower !== undefined) { number = number >= lower ? number : lower; } } return number; } /** * The base implementation of `_.clone` and `_.cloneDeep` which tracks * traversed objects. * * @private * @param {*} value The value to clone. * @param {boolean} bitmask The bitmask flags. * 1 - Deep clone * 2 - Flatten inherited properties * 4 - Clone symbols * @param {Function} [customizer] The function to customize cloning. * @param {string} [key] The key of `value`. * @param {Object} [object] The parent object of `value`. * @param {Object} [stack] Tracks traversed objects and their clone counterparts. * @returns {*} Returns the cloned value. */ function baseClone(value, bitmask, customizer, key, object, stack) { var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; if (customizer) { result = object ? customizer(value, key, object, stack) : customizer(value); } if (result !== undefined) { return result; } if (!isObject(value)) { return value; } var isArr = isArray(value); if (isArr) { result = initCloneArray(value); if (!isDeep) { return copyArray(value, result); } } else { var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; if (isBuffer(value)) { return cloneBuffer(value, isDeep); } if (tag == objectTag || tag == argsTag || (isFunc && !object)) { result = (isFlat || isFunc) ? {} : initCloneObject(value); if (!isDeep) { return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { return object ? value : {}; } result = initCloneByTag(value, tag, isDeep); } } // Check for circular references and return its corresponding clone. stack || (stack = new Stack); var stacked = stack.get(value); if (stacked) { return stacked; } stack.set(value, result); if (isSet(value)) { value.forEach(function(subValue) { result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); }); } else if (isMap(value)) { value.forEach(function(subValue, key) { result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); }); } var keysFunc = isFull ? (isFlat ? getAllKeysIn : getAllKeys) : (isFlat ? keysIn : keys); var props = isArr ? undefined : keysFunc(value); arrayEach(props || value, function(subValue, key) { if (props) { key = subValue; subValue = value[key]; } // Recursively populate clone (susceptible to call stack limits). assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); }); return result; } /** * The base implementation of `_.conforms` which doesn't clone `source`. * * @private * @param {Object} source The object of property predicates to conform to. * @returns {Function} Returns the new spec function. */ function baseConforms(source) { var props = keys(source); return function(object) { return baseConformsTo(object, source, props); }; } /** * The base implementation of `_.conformsTo` which accepts `props` to check. * * @private * @param {Object} object The object to inspect. * @param {Object} source The object of property predicates to conform to. * @returns {boolean} Returns `true` if `object` conforms, else `false`. */ function baseConformsTo(object, source, props) { var length = props.length; if (object == null) { return !length; } object = Object(object); while (length--) { var key = props[length], predicate = source[key], value = object[key]; if ((value === undefined && !(key in object)) || !predicate(value)) { return false; } } return true; } /** * The base implementation of `_.delay` and `_.defer` which accepts `args` * to provide to `func`. * * @private * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. * @param {Array} args The arguments to provide to `func`. * @returns {number|Object} Returns the timer id or timeout object. */ function baseDelay(func, wait, args) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return setTimeout(function() { func.apply(undefined, args); }, wait); } /** * The base implementation of methods like `_.difference` without support * for excluding multiple arrays or iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Array} values The values to exclude. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of filtered values. */ function baseDifference(array, values, iteratee, comparator) { var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length; if (!length) { return result; } if (iteratee) { values = arrayMap(values, baseUnary(iteratee)); } if (comparator) { includes = arrayIncludesWith; isCommon = false; } else if (values.length >= LARGE_ARRAY_SIZE) { includes = cacheHas; isCommon = false; values = new SetCache(values); } outer: while (++index < length) { var value = array[index], computed = iteratee == null ? value : iteratee(value); value = (comparator || value !== 0) ? value : 0; if (isCommon && computed === computed) { var valuesIndex = valuesLength; while (valuesIndex--) { if (values[valuesIndex] === computed) { continue outer; } } result.push(value); } else if (!includes(values, computed, comparator)) { result.push(value); } } return result; } /** * The base implementation of `_.forEach` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object} Returns `collection`. */ var baseEach = createBaseEach(baseForOwn); /** * The base implementation of `_.forEachRight` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object} Returns `collection`. */ var baseEachRight = createBaseEach(baseForOwnRight, true); /** * The base implementation of `_.every` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false` */ function baseEvery(collection, predicate) { var result = true; baseEach(collection, function(value, index, collection) { result = !!predicate(value, index, collection); return result; }); return result; } /** * The base implementation of methods like `_.max` and `_.min` which accepts a * `comparator` to determine the extremum value. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The iteratee invoked per iteration. * @param {Function} comparator The comparator used to compare values. * @returns {*} Returns the extremum value. */ function baseExtremum(array, iteratee, comparator) { var index = -1, length = array.length; while (++index < length) { var value = array[index], current = iteratee(value); if (current != null && (computed === undefined ? (current === current && !isSymbol(current)) : comparator(current, computed) )) { var computed = current, result = value; } } return result; } /** * The base implementation of `_.fill` without an iteratee call guard. * * @private * @param {Array} array The array to fill. * @param {*} value The value to fill `array` with. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns `array`. */ function baseFill(array, value, start, end) { var length = array.length; start = toInteger(start); if (start < 0) { start = -start > length ? 0 : (length + start); } end = (end === undefined || end > length) ? length : toInteger(end); if (end < 0) { end += length; } end = start > end ? 0 : toLength(end); while (start < end) { array[start++] = value; } return array; } /** * The base implementation of `_.filter` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function baseFilter(collection, predicate) { var result = []; baseEach(collection, function(value, index, collection) { if (predicate(value, index, collection)) { result.push(value); } }); return result; } /** * The base implementation of `_.flatten` with support for restricting flattening. * * @private * @param {Array} array The array to flatten. * @param {number} depth The maximum recursion depth. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. * @param {Array} [result=[]] The initial result value. * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, depth, predicate, isStrict, result) { var index = -1, length = array.length; predicate || (predicate = isFlattenable); result || (result = []); while (++index < length) { var value = array[index]; if (depth > 0 && predicate(value)) { if (depth > 1) { // Recursively flatten arrays (susceptible to call stack limits). baseFlatten(value, depth - 1, predicate, isStrict, result); } else { arrayPush(result, value); } } else if (!isStrict) { result[result.length] = value; } } return result; } /** * The base implementation of `baseForOwn` which iterates over `object` * properties returned by `keysFunc` and invokes `iteratee` for each property. * Iteratee functions may exit iteration early by explicitly returning `false`. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ var baseFor = createBaseFor(); /** * This function is like `baseFor` except that it iterates over properties * in the opposite order. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ var baseForRight = createBaseFor(true); /** * The base implementation of `_.forOwn` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } /** * The base implementation of `_.forOwnRight` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwnRight(object, iteratee) { return object && baseForRight(object, iteratee, keys); } /** * The base implementation of `_.functions` which creates an array of * `object` function property names filtered from `props`. * * @private * @param {Object} object The object to inspect. * @param {Array} props The property names to filter. * @returns {Array} Returns the function names. */ function baseFunctions(object, props) { return arrayFilter(props, function(key) { return isFunction(object[key]); }); } /** * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ function baseGet(object, path) { path = castPath(path, object); var index = 0, length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; } return (index && index == length) ? object : undefined; } /** * The base implementation of `getAllKeys` and `getAllKeysIn` which uses * `keysFunc` and `symbolsFunc` to get the enumerable property names and * symbols of `object`. * * @private * @param {Object} object The object to query. * @param {Function} keysFunc The function to get the keys of `object`. * @param {Function} symbolsFunc The function to get the symbols of `object`. * @returns {Array} Returns the array of property names and symbols. */ function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result = keysFunc(object); return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); } /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (value == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) ? getRawTag(value) : objectToString(value); } /** * The base implementation of `_.gt` which doesn't coerce arguments. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is greater than `other`, * else `false`. */ function baseGt(value, other) { return value > other; } /** * The base implementation of `_.has` without support for deep paths. * * @private * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHas(object, key) { return object != null && hasOwnProperty.call(object, key); } /** * The base implementation of `_.hasIn` without support for deep paths. * * @private * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHasIn(object, key) { return object != null && key in Object(object); } /** * The base implementation of `_.inRange` which doesn't coerce arguments. * * @private * @param {number} number The number to check. * @param {number} start The start of the range. * @param {number} end The end of the range. * @returns {boolean} Returns `true` if `number` is in the range, else `false`. */ function baseInRange(number, start, end) { return number >= nativeMin(start, end) && number < nativeMax(start, end); } /** * The base implementation of methods like `_.intersection`, without support * for iteratee shorthands, that accepts an array of arrays to inspect. * * @private * @param {Array} arrays The arrays to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of shared values. */ function baseIntersection(arrays, iteratee, comparator) { var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = []; while (othIndex--) { var array = arrays[othIndex]; if (othIndex && iteratee) { array = arrayMap(array, baseUnary(iteratee)); } maxLength = nativeMin(array.length, maxLength); caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) ? new SetCache(othIndex && array) : undefined; } array = arrays[0]; var index = -1, seen = caches[0]; outer: while (++index < length && result.length < maxLength) { var value = array[index], computed = iteratee ? iteratee(value) : value; value = (comparator || value !== 0) ? value : 0; if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator) )) { othIndex = othLength; while (--othIndex) { var cache = caches[othIndex]; if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator)) ) { continue outer; } } if (seen) { seen.push(computed); } result.push(value); } } return result; } /** * The base implementation of `_.invert` and `_.invertBy` which inverts * `object` with values transformed by `iteratee` and set by `setter`. * * @private * @param {Object} object The object to iterate over. * @param {Function} setter The function to set `accumulator` values. * @param {Function} iteratee The iteratee to transform values. * @param {Object} accumulator The initial inverted object. * @returns {Function} Returns `accumulator`. */ function baseInverter(object, setter, iteratee, accumulator) { baseForOwn(object, function(value, key, object) { setter(accumulator, iteratee(value), key, object); }); return accumulator; } /** * The base implementation of `_.invoke` without support for individual * method arguments. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the method to invoke. * @param {Array} args The arguments to invoke the method with. * @returns {*} Returns the result of the invoked method. */ function baseInvoke(object, path, args) { path = castPath(path, object); object = parent(object, path); var func = object == null ? object : object[toKey(last(path))]; return func == null ? undefined : apply(func, object, args); } /** * The base implementation of `_.isArguments`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, */ function baseIsArguments(value) { return isObjectLike(value) && baseGetTag(value) == argsTag; } /** * The base implementation of `_.isArrayBuffer` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. */ function baseIsArrayBuffer(value) { return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; } /** * The base implementation of `_.isDate` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a date object, else `false`. */ function baseIsDate(value) { return isObjectLike(value) && baseGetTag(value) == dateTag; } /** * The base implementation of `_.isEqual` which supports partial comparisons * and tracks traversed objects. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {boolean} bitmask The bitmask flags. * 1 - Unordered comparison * 2 - Partial comparison * @param {Function} [customizer] The function to customize comparisons. * @param {Object} [stack] Tracks traversed `value` and `other` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, bitmask, customizer, stack) { if (value === other) { return true; } if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); } /** * A specialized version of `baseIsEqual` for arrays and objects which performs * deep comparisons and tracks traversed objects enabling objects with circular * references to be compared. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); objTag = objTag == argsTag ? objectTag : objTag; othTag = othTag == argsTag ? objectTag : othTag; var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && isBuffer(object)) { if (!isBuffer(other)) { return false; } objIsArr = true; objIsObj = false; } if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack); return equalObjects(object, other, bitmask, customizer, equalFunc, stack); } /** * The base implementation of `_.isMap` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a map, else `false`. */ function baseIsMap(value) { return isObjectLike(value) && getTag(value) == mapTag; } /** * The base implementation of `_.isMatch` without support for iteratee shorthands. * * @private * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Array} matchData The property names, values, and compare flags to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index, noCustomizer = !customizer; if (object == null) { return !length; } object = Object(object); while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) ? data[1] !== object[data[0]] : !(data[0] in object) ) { return false; } } while (++index < length) { data = matchData[index]; var key = data[0], objValue = object[key], srcValue = data[1]; if (noCustomizer && data[2]) { if (objValue === undefined && !(key in object)) { return false; } } else { var stack = new Stack; if (customizer) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result )) { return false; } } } return true; } /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } /** * The base implementation of `_.isRegExp` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. */ function baseIsRegExp(value) { return isObjectLike(value) && baseGetTag(value) == regexpTag; } /** * The base implementation of `_.isSet` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a set, else `false`. */ function baseIsSet(value) { return isObjectLike(value) && getTag(value) == setTag; } /** * The base implementation of `_.isTypedArray` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. */ function baseIsTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** * The base implementation of `_.iteratee`. * * @private * @param {*} [value=_.identity] The value to convert to an iteratee. * @returns {Function} Returns the iteratee. */ function baseIteratee(value) { // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. if (typeof value == 'function') { return value; } if (value == null) { return identity; } if (typeof value == 'object') { return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); } return property(value); } /** * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result = []; for (var key in Object(object)) { if (hasOwnProperty.call(object, key) && key != 'constructor') { result.push(key); } } return result; } /** * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeysIn(object) { if (!isObject(object)) { return nativeKeysIn(object); } var isProto = isPrototype(object), result = []; for (var key in object) { if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } return result; } /** * The base implementation of `_.lt` which doesn't coerce arguments. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is less than `other`, * else `false`. */ function baseLt(value, other) { return value < other; } /** * The base implementation of `_.map` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function baseMap(collection, iteratee) { var index = -1, result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value, key, collection) { result[++index] = iteratee(value, key, collection); }); return result; } /** * The base implementation of `_.matches` which doesn't clone `source`. * * @private * @param {Object} source The object of property values to match. * @returns {Function} Returns the new spec function. */ function baseMatches(source) { var matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { return matchesStrictComparable(matchData[0][0], matchData[0][1]); } return function(object) { return object === source || baseIsMatch(object, source, matchData); }; } /** * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. * * @private * @param {string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function baseMatchesProperty(path, srcValue) { if (isKey(path) && isStrictComparable(srcValue)) { return matchesStrictComparable(toKey(path), srcValue); } return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } /** * The base implementation of `_.merge` without support for multiple sources. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {number} srcIndex The index of `source`. * @param {Function} [customizer] The function to customize merged values. * @param {Object} [stack] Tracks traversed source values and their merged * counterparts. */ function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } baseFor(source, function(srcValue, key) { stack || (stack = new Stack); if (isObject(srcValue)) { baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { var newValue = customizer ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) : undefined; if (newValue === undefined) { newValue = srcValue; } assignMergeValue(object, key, newValue); } }, keysIn); } /** * A specialized version of `baseMerge` for arrays and objects which performs * deep merges and tracks traversed objects enabling objects with circular * references to be merged. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {string} key The key of the value to merge. * @param {number} srcIndex The index of `source`. * @param {Function} mergeFunc The function to merge values. * @param {Function} [customizer] The function to customize assigned values. * @param {Object} [stack] Tracks traversed source values and their merged * counterparts. */ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue); if (stacked) { assignMergeValue(object, key, stacked); return; } var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined; var isCommon = newValue === undefined; if (isCommon) { var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); newValue = srcValue; if (isArr || isBuff || isTyped) { if (isArray(objValue)) { newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } else if (isBuff) { isCommon = false; newValue = cloneBuffer(srcValue, true); } else if (isTyped) { isCommon = false; newValue = cloneTypedArray(srcValue, true); } else { newValue = []; } } else if (isPlainObject(srcValue) || isArguments(srcValue)) { newValue = objValue; if (isArguments(objValue)) { newValue = toPlainObject(objValue); } else if (!isObject(objValue) || isFunction(objValue)) { newValue = initCloneObject(srcValue); } } else { isCommon = false; } } if (isCommon) { // Recursively merge objects and arrays (susceptible to call stack limits). stack.set(srcValue, newValue); mergeFunc(newValue, srcValue, srcIndex, customizer, stack); stack['delete'](srcValue); } assignMergeValue(object, key, newValue); } /** * The base implementation of `_.nth` which doesn't coerce arguments. * * @private * @param {Array} array The array to query. * @param {number} n The index of the element to return. * @returns {*} Returns the nth element of `array`. */ function baseNth(array, n) { var length = array.length; if (!length) { return; } n += n < 0 ? length : 0; return isIndex(n, length) ? array[n] : undefined; } /** * The base implementation of `_.orderBy` without param guards. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. * @param {string[]} orders The sort orders of `iteratees`. * @returns {Array} Returns the new sorted array. */ function baseOrderBy(collection, iteratees, orders) { if (iteratees.length) { iteratees = arrayMap(iteratees, function(iteratee) { if (isArray(iteratee)) { return function(value) { return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); } } return iteratee; }); } else { iteratees = [identity]; } var index = -1; iteratees = arrayMap(iteratees, baseUnary(getIteratee())); var result = baseMap(collection, function(value, key, collection) { var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); }); return { 'criteria': criteria, 'index': ++index, 'value': value }; }); return baseSortBy(result, function(object, other) { return compareMultiple(object, other, orders); }); } /** * The base implementation of `_.pick` without support for individual * property identifiers. * * @private * @param {Object} object The source object. * @param {string[]} paths The property paths to pick. * @returns {Object} Returns the new object. */ function basePick(object, paths) { return basePickBy(object, paths, function(value, path) { return hasIn(object, path); }); } /** * The base implementation of `_.pickBy` without support for iteratee shorthands. * * @private * @param {Object} object The source object. * @param {string[]} paths The property paths to pick. * @param {Function} predicate The function invoked per property. * @returns {Object} Returns the new object. */ function basePickBy(object, paths, predicate) { var index = -1, length = paths.length, result = {}; while (++index < length) { var path = paths[index], value = baseGet(object, path); if (predicate(value, path)) { baseSet(result, castPath(path, object), value); } } return result; } /** * A specialized version of `baseProperty` which supports deep paths. * * @private * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. */ function basePropertyDeep(path) { return function(object) { return baseGet(object, path); }; } /** * The base implementation of `_.pullAllBy` without support for iteratee * shorthands. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns `array`. */ function basePullAll(array, values, iteratee, comparator) { var indexOf = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values.length, seen = array; if (array === values) { values = copyArray(values); } if (iteratee) { seen = arrayMap(array, baseUnary(iteratee)); } while (++index < length) { var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value; while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { if (seen !== array) { splice.call(seen, fromIndex, 1); } splice.call(array, fromIndex, 1); } } return array; } /** * The base implementation of `_.pullAt` without support for individual * indexes or capturing the removed elements. * * @private * @param {Array} array The array to modify. * @param {number[]} indexes The indexes of elements to remove. * @returns {Array} Returns `array`. */ function basePullAt(array, indexes) { var length = array ? indexes.length : 0, lastIndex = length - 1; while (length--) { var index = indexes[length]; if (length == lastIndex || index !== previous) { var previous = index; if (isIndex(index)) { splice.call(array, index, 1); } else { baseUnset(array, index); } } } return array; } /** * The base implementation of `_.random` without support for returning * floating-point numbers. * * @private * @param {number} lower The lower bound. * @param {number} upper The upper bound. * @returns {number} Returns the random number. */ function baseRandom(lower, upper) { return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); } /** * The base implementation of `_.range` and `_.rangeRight` which doesn't * coerce arguments. * * @private * @param {number} start The start of the range. * @param {number} end The end of the range. * @param {number} step The value to increment or decrement by. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Array} Returns the range of numbers. */ function baseRange(start, end, step, fromRight) { var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length); while (length--) { result[fromRight ? length : ++index] = start; start += step; } return result; } /** * The base implementation of `_.repeat` which doesn't coerce arguments. * * @private * @param {string} string The string to repeat. * @param {number} n The number of times to repeat the string. * @returns {string} Returns the repeated string. */ function baseRepeat(string, n) { var result = ''; if (!string || n < 1 || n > MAX_SAFE_INTEGER) { return result; } // Leverage the exponentiation by squaring algorithm for a faster repeat. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. do { if (n % 2) { result += string; } n = nativeFloor(n / 2); if (n) { string += string; } } while (n); return result; } /** * The base implementation of `_.rest` which doesn't validate or coerce arguments. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @returns {Function} Returns the new function. */ function baseRest(func, start) { return setToString(overRest(func, start, identity), func + ''); } /** * The base implementation of `_.sample`. * * @private * @param {Array|Object} collection The collection to sample. * @returns {*} Returns the random element. */ function baseSample(collection) { return arraySample(values(collection)); } /** * The base implementation of `_.sampleSize` without param guards. * * @private * @param {Array|Object} collection The collection to sample. * @param {number} n The number of elements to sample. * @returns {Array} Returns the random elements. */ function baseSampleSize(collection, n) { var array = values(collection); return shuffleSelf(array, baseClamp(n, 0, array.length)); } /** * The base implementation of `_.set`. * * @private * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @param {Function} [customizer] The function to customize path creation. * @returns {Object} Returns `object`. */ function baseSet(object, path, value, customizer) { if (!isObject(object)) { return object; } path = castPath(path, object); var index = -1, length = path.length, lastIndex = length - 1, nested = object; while (nested != null && ++index < length) { var key = toKey(path[index]), newValue = value; if (key === '__proto__' || key === 'constructor' || key === 'prototype') { return object; } if (index != lastIndex) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) ? objValue : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); nested = nested[key]; } return object; } /** * The base implementation of `setData` without support for hot loop shorting. * * @private * @param {Function} func The function to associate metadata with. * @param {*} data The metadata. * @returns {Function} Returns `func`. */ var baseSetData = !metaMap ? identity : function(func, data) { metaMap.set(func, data); return func; }; /** * The base implementation of `setToString` without support for hot loop shorting. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var baseSetToString = !defineProperty ? identity : function(func, string) { return defineProperty(func, 'toString', { 'configurable': true, 'enumerable': false, 'value': constant(string), 'writable': true }); }; /** * The base implementation of `_.shuffle`. * * @private * @param {Array|Object} collection The collection to shuffle. * @returns {Array} Returns the new shuffled array. */ function baseShuffle(collection) { return shuffleSelf(values(collection)); } /** * The base implementation of `_.slice` without an iteratee call guard. * * @private * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of `array`. */ function baseSlice(array, start, end) { var index = -1, length = array.length; if (start < 0) { start = -start > length ? 0 : (length + start); } end = end > length ? length : end; if (end < 0) { end += length; } length = start > end ? 0 : ((end - start) >>> 0); start >>>= 0; var result = Array(length); while (++index < length) { result[index] = array[index + start]; } return result; } /** * The base implementation of `_.some` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function baseSome(collection, predicate) { var result; baseEach(collection, function(value, index, collection) { result = predicate(value, index, collection); return !result; }); return !!result; } /** * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which * performs a binary search of `array` to determine the index at which `value` * should be inserted into `array` in order to maintain its sort order. * * @private * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {boolean} [retHighest] Specify returning the highest qualified index. * @returns {number} Returns the index at which `value` should be inserted * into `array`. */ function baseSortedIndex(array, value, retHighest) { var low = 0, high = array == null ? low : array.length; if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { while (low < high) { var mid = (low + high) >>> 1, computed = array[mid]; if (computed !== null && !isSymbol(computed) && (retHighest ? (computed <= value) : (computed < value))) { low = mid + 1; } else { high = mid; } } return high; } return baseSortedIndexBy(array, value, identity, retHighest); } /** * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` * which invokes `iteratee` for `value` and each element of `array` to compute * their sort ranking. The iteratee is invoked with one argument; (value). * * @private * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function} iteratee The iteratee invoked per element. * @param {boolean} [retHighest] Specify returning the highest qualified index. * @returns {number} Returns the index at which `value` should be inserted * into `array`. */ function baseSortedIndexBy(array, value, iteratee, retHighest) { var low = 0, high = array == null ? 0 : array.length; if (high === 0) { return 0; } value = iteratee(value); var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined; while (low < high) { var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), othIsDefined = computed !== undefined, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed); if (valIsNaN) { var setLow = retHighest || othIsReflexive; } else if (valIsUndefined) { setLow = othIsReflexive && (retHighest || othIsDefined); } else if (valIsNull) { setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); } else if (valIsSymbol) { setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); } else if (othIsNull || othIsSymbol) { setLow = false; } else { setLow = retHighest ? (computed <= value) : (computed < value); } if (setLow) { low = mid + 1; } else { high = mid; } } return nativeMin(high, MAX_ARRAY_INDEX); } /** * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without * support for iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. */ function baseSortedUniq(array, iteratee) { var index = -1, length = array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value) : value; if (!index || !eq(computed, seen)) { var seen = computed; result[resIndex++] = value === 0 ? 0 : value; } } return result; } /** * The base implementation of `_.toNumber` which doesn't ensure correct * conversions of binary, hexadecimal, or octal string values. * * @private * @param {*} value The value to process. * @returns {number} Returns the number. */ function baseToNumber(value) { if (typeof value == 'number') { return value; } if (isSymbol(value)) { return NAN; } return +value; } /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (isArray(value)) { // Recursively convert values (susceptible to call stack limits). return arrayMap(value, baseToString) + ''; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * The base implementation of `_.uniqBy` without support for iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new duplicate free array. */ function baseUniq(array, iteratee, comparator) { var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result; if (comparator) { isCommon = false; includes = arrayIncludesWith; } else if (length >= LARGE_ARRAY_SIZE) { var set = iteratee ? null : createSet(array); if (set) { return setToArray(set); } isCommon = false; includes = cacheHas; seen = new SetCache; } else { seen = iteratee ? [] : result; } outer: while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value) : value; value = (comparator || value !== 0) ? value : 0; if (isCommon && computed === computed) { var seenIndex = seen.length; while (seenIndex--) { if (seen[seenIndex] === computed) { continue outer; } } if (iteratee) { seen.push(computed); } result.push(value); } else if (!includes(seen, computed, comparator)) { if (seen !== result) { seen.push(computed); } result.push(value); } } return result; } /** * The base implementation of `_.unset`. * * @private * @param {Object} object The object to modify. * @param {Array|string} path The property path to unset. * @returns {boolean} Returns `true` if the property is deleted, else `false`. */ function baseUnset(object, path) { path = castPath(path, object); object = parent(object, path); return object == null || delete object[toKey(last(path))]; } /** * The base implementation of `_.update`. * * @private * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to update. * @param {Function} updater The function to produce the updated value. * @param {Function} [customizer] The function to customize path creation. * @returns {Object} Returns `object`. */ function baseUpdate(object, path, updater, customizer) { return baseSet(object, path, updater(baseGet(object, path)), customizer); } /** * The base implementation of methods like `_.dropWhile` and `_.takeWhile` * without support for iteratee shorthands. * * @private * @param {Array} array The array to query. * @param {Function} predicate The function invoked per iteration. * @param {boolean} [isDrop] Specify dropping elements instead of taking them. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Array} Returns the slice of `array`. */ function baseWhile(array, predicate, isDrop, fromRight) { var length = array.length, index = fromRight ? length : -1; while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {} return isDrop ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); } /** * The base implementation of `wrapperValue` which returns the result of * performing a sequence of actions on the unwrapped `value`, where each * successive action is supplied the return value of the previous. * * @private * @param {*} value The unwrapped value. * @param {Array} actions Actions to perform to resolve the unwrapped value. * @returns {*} Returns the resolved value. */ function baseWrapperValue(value, actions) { var result = value; if (result instanceof LazyWrapper) { result = result.value(); } return arrayReduce(actions, function(result, action) { return action.func.apply(action.thisArg, arrayPush([result], action.args)); }, result); } /** * The base implementation of methods like `_.xor`, without support for * iteratee shorthands, that accepts an array of arrays to inspect. * * @private * @param {Array} arrays The arrays to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of values. */ function baseXor(arrays, iteratee, comparator) { var length = arrays.length; if (length < 2) { return length ? baseUniq(arrays[0]) : []; } var index = -1, result = Array(length); while (++index < length) { var array = arrays[index], othIndex = -1; while (++othIndex < length) { if (othIndex != index) { result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); } } } return baseUniq(baseFlatten(result, 1), iteratee, comparator); } /** * This base implementation of `_.zipObject` which assigns values using `assignFunc`. * * @private * @param {Array} props The property identifiers. * @param {Array} values The property values. * @param {Function} assignFunc The function to assign values. * @returns {Object} Returns the new object. */ function baseZipObject(props, values, assignFunc) { var index = -1, length = props.length, valsLength = values.length, result = {}; while (++index < length) { var value = index < valsLength ? values[index] : undefined; assignFunc(result, props[index], value); } return result; } /** * Casts `value` to an empty array if it's not an array like object. * * @private * @param {*} value The value to inspect. * @returns {Array|Object} Returns the cast array-like object. */ function castArrayLikeObject(value) { return isArrayLikeObject(value) ? value : []; } /** * Casts `value` to `identity` if it's not a function. * * @private * @param {*} value The value to inspect. * @returns {Function} Returns cast function. */ function castFunction(value) { return typeof value == 'function' ? value : identity; } /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @param {Object} [object] The object to query keys on. * @returns {Array} Returns the cast property path array. */ function castPath(value, object) { if (isArray(value)) { return value; } return isKey(value, object) ? [value] : stringToPath(toString(value)); } /** * A `baseRest` alias which can be replaced with `identity` by module * replacement plugins. * * @private * @type {Function} * @param {Function} func The function to apply a rest parameter to. * @returns {Function} Returns the new function. */ var castRest = baseRest; /** * Casts `array` to a slice if it's needed. * * @private * @param {Array} array The array to inspect. * @param {number} start The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the cast slice. */ function castSlice(array, start, end) { var length = array.length; end = end === undefined ? length : end; return (!start && end >= length) ? array : baseSlice(array, start, end); } /** * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). * * @private * @param {number|Object} id The timer id or timeout object of the timer to clear. */ var clearTimeout = ctxClearTimeout || function(id) { return root.clearTimeout(id); }; /** * Creates a clone of `buffer`. * * @private * @param {Buffer} buffer The buffer to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Buffer} Returns the cloned buffer. */ function cloneBuffer(buffer, isDeep) { if (isDeep) { return buffer.slice(); } var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); buffer.copy(result); return result; } /** * Creates a clone of `arrayBuffer`. * * @private * @param {ArrayBuffer} arrayBuffer The array buffer to clone. * @returns {ArrayBuffer} Returns the cloned array buffer. */ function cloneArrayBuffer(arrayBuffer) { var result = new arrayBuffer.constructor(arrayBuffer.byteLength); new Uint8Array(result).set(new Uint8Array(arrayBuffer)); return result; } /** * Creates a clone of `dataView`. * * @private * @param {Object} dataView The data view to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned data view. */ function cloneDataView(dataView, isDeep) { var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); } /** * Creates a clone of `regexp`. * * @private * @param {Object} regexp The regexp to clone. * @returns {Object} Returns the cloned regexp. */ function cloneRegExp(regexp) { var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); result.lastIndex = regexp.lastIndex; return result; } /** * Creates a clone of the `symbol` object. * * @private * @param {Object} symbol The symbol object to clone. * @returns {Object} Returns the cloned symbol object. */ function cloneSymbol(symbol) { return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; } /** * Creates a clone of `typedArray`. * * @private * @param {Object} typedArray The typed array to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); } /** * Compares values to sort them in ascending order. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {number} Returns the sort order indicator for `value`. */ function compareAscending(value, other) { if (value !== other) { var valIsDefined = value !== undefined, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value); var othIsDefined = other !== undefined, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other); if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || (valIsNull && othIsDefined && othIsReflexive) || (!valIsDefined && othIsReflexive) || !valIsReflexive) { return 1; } if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || (othIsNull && valIsDefined && valIsReflexive) || (!othIsDefined && valIsReflexive) || !othIsReflexive) { return -1; } } return 0; } /** * Used by `_.orderBy` to compare multiple properties of a value to another * and stable sort them. * * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, * specify an order of "desc" for descending or "asc" for ascending sort order * of corresponding values. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {boolean[]|string[]} orders The order to sort by for each property. * @returns {number} Returns the sort order indicator for `object`. */ function compareMultiple(object, other, orders) { var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; while (++index < length) { var result = compareAscending(objCriteria[index], othCriteria[index]); if (result) { if (index >= ordersLength) { return result; } var order = orders[index]; return result * (order == 'desc' ? -1 : 1); } } // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications // that causes it, under certain circumstances, to provide the same value for // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 // for more details. // // This also ensures a stable sort in V8 and other engines. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. return object.index - other.index; } /** * Creates an array that is the composition of partially applied arguments, * placeholders, and provided arguments into a single array of arguments. * * @private * @param {Array} args The provided arguments. * @param {Array} partials The arguments to prepend to those provided. * @param {Array} holders The `partials` placeholder indexes. * @params {boolean} [isCurried] Specify composing for a curried function. * @returns {Array} Returns the new array of composed arguments. */ function composeArgs(args, partials, holders, isCurried) { var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result = Array(leftLength + rangeLength), isUncurried = !isCurried; while (++leftIndex < leftLength) { result[leftIndex] = partials[leftIndex]; } while (++argsIndex < holdersLength) { if (isUncurried || argsIndex < argsLength) { result[holders[argsIndex]] = args[argsIndex]; } } while (rangeLength--) { result[leftIndex++] = args[argsIndex++]; } return result; } /** * This function is like `composeArgs` except that the arguments composition * is tailored for `_.partialRight`. * * @private * @param {Array} args The provided arguments. * @param {Array} partials The arguments to append to those provided. * @param {Array} holders The `partials` placeholder indexes. * @params {boolean} [isCurried] Specify composing for a curried function. * @returns {Array} Returns the new array of composed arguments. */ function composeArgsRight(args, partials, holders, isCurried) { var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result = Array(rangeLength + rightLength), isUncurried = !isCurried; while (++argsIndex < rangeLength) { result[argsIndex] = args[argsIndex]; } var offset = argsIndex; while (++rightIndex < rightLength) { result[offset + rightIndex] = partials[rightIndex]; } while (++holdersIndex < holdersLength) { if (isUncurried || argsIndex < argsLength) { result[offset + holders[holdersIndex]] = args[argsIndex++]; } } return result; } /** * Copies the values of `source` to `array`. * * @private * @param {Array} source The array to copy values from. * @param {Array} [array=[]] The array to copy values to. * @returns {Array} Returns `array`. */ function copyArray(source, array) { var index = -1, length = source.length; array || (array = Array(length)); while (++index < length) { array[index] = source[index]; } return array; } /** * Copies properties of `source` to `object`. * * @private * @param {Object} source The object to copy properties from. * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @param {Function} [customizer] The function to customize copied values. * @returns {Object} Returns `object`. */ function copyObject(source, props, object, customizer) { var isNew = !object; object || (object = {}); var index = -1, length = props.length; while (++index < length) { var key = props[index]; var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined; if (newValue === undefined) { newValue = source[key]; } if (isNew) { baseAssignValue(object, key, newValue); } else { assignValue(object, key, newValue); } } return object; } /** * Copies own symbols of `source` to `object`. * * @private * @param {Object} source The object to copy symbols from. * @param {Object} [object={}] The object to copy symbols to. * @returns {Object} Returns `object`. */ function copySymbols(source, object) { return copyObject(source, getSymbols(source), object); } /** * Copies own and inherited symbols of `source` to `object`. * * @private * @param {Object} source The object to copy symbols from. * @param {Object} [object={}] The object to copy symbols to. * @returns {Object} Returns `object`. */ function copySymbolsIn(source, object) { return copyObject(source, getSymbolsIn(source), object); } /** * Creates a function like `_.groupBy`. * * @private * @param {Function} setter The function to set accumulator values. * @param {Function} [initializer] The accumulator object initializer. * @returns {Function} Returns the new aggregator function. */ function createAggregator(setter, initializer) { return function(collection, iteratee) { var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; return func(collection, setter, getIteratee(iteratee, 2), accumulator); }; } /** * Creates a function like `_.assign`. * * @private * @param {Function} assigner The function to assign values. * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { return baseRest(function(object, sources) { var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') ? (length--, customizer) : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; } object = Object(object); while (++index < length) { var source = sources[index]; if (source) { assigner(object, source, index, customizer); } } return object; }); } /** * Creates a `baseEach` or `baseEachRight` function. * * @private * @param {Function} eachFunc The function to iterate over a collection. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { if (collection == null) { return collection; } if (!isArrayLike(collection)) { return eachFunc(collection, iteratee); } var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection); while ((fromRight ? index-- : ++index < length)) { if (iteratee(iterable[index], index, iterable) === false) { break; } } return collection; }; } /** * Creates a base function for methods like `_.forIn` and `_.forOwn`. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseFor(fromRight) { return function(object, iteratee, keysFunc) { var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; while (length--) { var key = props[fromRight ? length : ++index]; if (iteratee(iterable[key], key, iterable) === false) { break; } } return object; }; } /** * Creates a function that wraps `func` to invoke it with the optional `this` * binding of `thisArg`. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @param {*} [thisArg] The `this` binding of `func`. * @returns {Function} Returns the new wrapped function. */ function createBind(func, bitmask, thisArg) { var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); function wrapper() { var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return fn.apply(isBind ? thisArg : this, arguments); } return wrapper; } /** * Creates a function like `_.lowerFirst`. * * @private * @param {string} methodName The name of the `String` case method to use. * @returns {Function} Returns the new case function. */ function createCaseFirst(methodName) { return function(string) { string = toString(string); var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined; var chr = strSymbols ? strSymbols[0] : string.charAt(0); var trailing = strSymbols ? castSlice(strSymbols, 1).join('') : string.slice(1); return chr[methodName]() + trailing; }; } /** * Creates a function like `_.camelCase`. * * @private * @param {Function} callback The function to combine each word. * @returns {Function} Returns the new compounder function. */ function createCompounder(callback) { return function(string) { return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); }; } /** * Creates a function that produces an instance of `Ctor` regardless of * whether it was invoked as part of a `new` expression or by `call` or `apply`. * * @private * @param {Function} Ctor The constructor to wrap. * @returns {Function} Returns the new wrapped function. */ function createCtor(Ctor) { return function() { // Use a `switch` statement to work with class constructors. See // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist // for more details. var args = arguments; switch (args.length) { case 0: return new Ctor; case 1: return new Ctor(args[0]); case 2: return new Ctor(args[0], args[1]); case 3: return new Ctor(args[0], args[1], args[2]); case 4: return new Ctor(args[0], args[1], args[2], args[3]); case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); } var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args); // Mimic the constructor's `return` behavior. // See https://es5.github.io/#x13.2.2 for more details. return isObject(result) ? result : thisBinding; }; } /** * Creates a function that wraps `func` to enable currying. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @param {number} arity The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createCurry(func, bitmask, arity) { var Ctor = createCtor(func); function wrapper() { var length = arguments.length, args = Array(length), index = length, placeholder = getHolder(wrapper); while (index--) { args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) ? [] : replaceHolders(args, placeholder); length -= holders.length; if (length < arity) { return createRecurry( func, bitmask, createHybrid, wrapper.placeholder, undefined, args, holders, undefined, undefined, arity - length); } var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return apply(fn, this, args); } return wrapper; } /** * Creates a `_.find` or `_.findLast` function. * * @private * @param {Function} findIndexFunc The function to find the collection index. * @returns {Function} Returns the new find function. */ function createFind(findIndexFunc) { return function(collection, predicate, fromIndex) { var iterable = Object(collection); if (!isArrayLike(collection)) { var iteratee = getIteratee(predicate, 3); collection = keys(collection); predicate = function(key) { return iteratee(iterable[key], key, iterable); }; } var index = findIndexFunc(collection, predicate, fromIndex); return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; }; } /** * Creates a `_.flow` or `_.flowRight` function. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new flow function. */ function createFlow(fromRight) { return flatRest(function(funcs) { var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru; if (fromRight) { funcs.reverse(); } while (index--) { var func = funcs[index]; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } if (prereq && !wrapper && getFuncName(func) == 'wrapper') { var wrapper = new LodashWrapper([], true); } } index = wrapper ? index : length; while (++index < length) { func = funcs[index]; var funcName = getFuncName(func), data = funcName == 'wrapper' ? getData(func) : undefined; if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1 ) { wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); } else { wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func); } } return function() { var args = arguments, value = args[0]; if (wrapper && args.length == 1 && isArray(value)) { return wrapper.plant(value).value(); } var index = 0, result = length ? funcs[index].apply(this, args) : value; while (++index < length) { result = funcs[index].call(this, result); } return result; }; }); } /** * Creates a function that wraps `func` to invoke it with optional `this` * binding of `thisArg`, partial application, and currying. * * @private * @param {Function|string} func The function or method name to wrap. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to prepend to those provided to * the new function. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [partialsRight] The arguments to append to those provided * to the new function. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. * @param {number} [arity] The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined : createCtor(func); function wrapper() { var length = arguments.length, args = Array(length), index = length; while (index--) { args[index] = arguments[index]; } if (isCurried) { var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder); } if (partials) { args = composeArgs(args, partials, holders, isCurried); } if (partialsRight) { args = composeArgsRight(args, partialsRight, holdersRight, isCurried); } length -= holdersCount; if (isCurried && length < arity) { var newHolders = replaceHolders(args, placeholder); return createRecurry( func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length ); } var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func; length = args.length; if (argPos) { args = reorder(args, argPos); } else if (isFlip && length > 1) { args.reverse(); } if (isAry && ary < length) { args.length = ary; } if (this && this !== root && this instanceof wrapper) { fn = Ctor || createCtor(fn); } return fn.apply(thisBinding, args); } return wrapper; } /** * Creates a function like `_.invertBy`. * * @private * @param {Function} setter The function to set accumulator values. * @param {Function} toIteratee The function to resolve iteratees. * @returns {Function} Returns the new inverter function. */ function createInverter(setter, toIteratee) { return function(object, iteratee) { return baseInverter(object, setter, toIteratee(iteratee), {}); }; } /** * Creates a function that performs a mathematical operation on two values. * * @private * @param {Function} operator The function to perform the operation. * @param {number} [defaultValue] The value used for `undefined` arguments. * @returns {Function} Returns the new mathematical operation function. */ function createMathOperation(operator, defaultValue) { return function(value, other) { var result; if (value === undefined && other === undefined) { return defaultValue; } if (value !== undefined) { result = value; } if (other !== undefined) { if (result === undefined) { return other; } if (typeof value == 'string' || typeof other == 'string') { value = baseToString(value); other = baseToString(other); } else { value = baseToNumber(value); other = baseToNumber(other); } result = operator(value, other); } return result; }; } /** * Creates a function like `_.over`. * * @private * @param {Function} arrayFunc The function to iterate over iteratees. * @returns {Function} Returns the new over function. */ function createOver(arrayFunc) { return flatRest(function(iteratees) { iteratees = arrayMap(iteratees, baseUnary(getIteratee())); return baseRest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee) { return apply(iteratee, thisArg, args); }); }); }); } /** * Creates the padding for `string` based on `length`. The `chars` string * is truncated if the number of characters exceeds `length`. * * @private * @param {number} length The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padding for `string`. */ function createPadding(length, chars) { chars = chars === undefined ? ' ' : baseToString(chars); var charsLength = chars.length; if (charsLength < 2) { return charsLength ? baseRepeat(chars, length) : chars; } var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join('') : result.slice(0, length); } /** * Creates a function that wraps `func` to invoke it with the `this` binding * of `thisArg` and `partials` prepended to the arguments it receives. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @param {*} thisArg The `this` binding of `func`. * @param {Array} partials The arguments to prepend to those provided to * the new function. * @returns {Function} Returns the new wrapped function. */ function createPartial(func, bitmask, thisArg, partials) { var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); function wrapper() { var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; while (++leftIndex < leftLength) { args[leftIndex] = partials[leftIndex]; } while (argsLength--) { args[leftIndex++] = arguments[++argsIndex]; } return apply(fn, isBind ? thisArg : this, args); } return wrapper; } /** * Creates a `_.range` or `_.rangeRight` function. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new range function. */ function createRange(fromRight) { return function(start, end, step) { if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { end = step = undefined; } // Ensure the sign of `-0` is preserved. start = toFinite(start); if (end === undefined) { end = start; start = 0; } else { end = toFinite(end); } step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); return baseRange(start, end, step, fromRight); }; } /** * Creates a function that performs a relational operation on two values. * * @private * @param {Function} operator The function to perform the operation. * @returns {Function} Returns the new relational operation function. */ function createRelationalOperation(operator) { return function(value, other) { if (!(typeof value == 'string' && typeof other == 'string')) { value = toNumber(value); other = toNumber(other); } return operator(value, other); }; } /** * Creates a function that wraps `func` to continue currying. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @param {Function} wrapFunc The function to create the `func` wrapper. * @param {*} placeholder The placeholder value. * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to prepend to those provided to * the new function. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. * @param {number} [arity] The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined, newHoldersRight = isCurry ? undefined : holders, newPartials = isCurry ? partials : undefined, newPartialsRight = isCurry ? undefined : partials; bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); } var newData = [ func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, newHoldersRight, argPos, ary, arity ]; var result = wrapFunc.apply(undefined, newData); if (isLaziable(func)) { setData(result, newData); } result.placeholder = placeholder; return setWrapToString(result, func, bitmask); } /** * Creates a function like `_.round`. * * @private * @param {string} methodName The name of the `Math` method to use when rounding. * @returns {Function} Returns the new round function. */ function createRound(methodName) { var func = Math[methodName]; return function(number, precision) { number = toNumber(number); precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); if (precision && nativeIsFinite(number)) { // Shift with exponential notation to avoid floating-point issues. // See [MDN](https://mdn.io/round#Examples) for more details. var pair = (toString(number) + 'e').split('e'), value = func(pair[0] + 'e' + (+pair[1] + precision)); pair = (toString(value) + 'e').split('e'); return +(pair[0] + 'e' + (+pair[1] - precision)); } return func(number); }; } /** * Creates a set object of `values`. * * @private * @param {Array} values The values to add to the set. * @returns {Object} Returns the new set. */ var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { return new Set(values); }; /** * Creates a `_.toPairs` or `_.toPairsIn` function. * * @private * @param {Function} keysFunc The function to get the keys of a given object. * @returns {Function} Returns the new pairs function. */ function createToPairs(keysFunc) { return function(object) { var tag = getTag(object); if (tag == mapTag) { return mapToArray(object); } if (tag == setTag) { return setToPairs(object); } return baseToPairs(object, keysFunc(object)); }; } /** * Creates a function that either curries or invokes `func` with optional * `this` binding and partially applied arguments. * * @private * @param {Function|string} func The function or method name to wrap. * @param {number} bitmask The bitmask flags. * 1 - `_.bind` * 2 - `_.bindKey` * 4 - `_.curry` or `_.curryRight` of a bound function * 8 - `_.curry` * 16 - `_.curryRight` * 32 - `_.partial` * 64 - `_.partialRight` * 128 - `_.rearg` * 256 - `_.ary` * 512 - `_.flip` * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to be partially applied. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. * @param {number} [arity] The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; if (!isBindKey && typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } var length = partials ? partials.length : 0; if (!length) { bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); partials = holders = undefined; } ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); arity = arity === undefined ? arity : toInteger(arity); length -= holders ? holders.length : 0; if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { var partialsRight = partials, holdersRight = holders; partials = holders = undefined; } var data = isBindKey ? undefined : getData(func); var newData = [ func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity ]; if (data) { mergeData(newData, data); } func = newData[0]; bitmask = newData[1]; thisArg = newData[2]; partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] === undefined ? (isBindKey ? 0 : func.length) : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); } if (!bitmask || bitmask == WRAP_BIND_FLAG) { var result = createBind(func, bitmask, thisArg); } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { result = createCurry(func, bitmask, arity); } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { result = createPartial(func, bitmask, thisArg, partials); } else { result = createHybrid.apply(undefined, newData); } var setter = data ? baseSetData : setData; return setWrapToString(setter(result, newData), func, bitmask); } /** * Used by `_.defaults` to customize its `_.assignIn` use to assign properties * of source objects to the destination object for all destination properties * that resolve to `undefined`. * * @private * @param {*} objValue The destination value. * @param {*} srcValue The source value. * @param {string} key The key of the property to assign. * @param {Object} object The parent object of `objValue`. * @returns {*} Returns the value to assign. */ function customDefaultsAssignIn(objValue, srcValue, key, object) { if (objValue === undefined || (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { return srcValue; } return objValue; } /** * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source * objects into destination objects that are passed thru. * * @private * @param {*} objValue The destination value. * @param {*} srcValue The source value. * @param {string} key The key of the property to merge. * @param {Object} object The parent object of `objValue`. * @param {Object} source The parent object of `srcValue`. * @param {Object} [stack] Tracks traversed source values and their merged * counterparts. * @returns {*} Returns the value to assign. */ function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { if (isObject(objValue) && isObject(srcValue)) { // Recursively merge objects and arrays (susceptible to call stack limits). stack.set(srcValue, objValue); baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); stack['delete'](srcValue); } return objValue; } /** * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain * objects. * * @private * @param {*} value The value to inspect. * @param {string} key The key of the property to inspect. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. */ function customOmitClone(value) { return isPlainObject(value) ? undefined : value; } /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. * * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } // Check that cyclic values are equal. var arrStacked = stack.get(array); var othStacked = stack.get(other); if (arrStacked && othStacked) { return arrStacked == other && othStacked == array; } var index = -1, result = true, seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; stack.set(array, other); stack.set(other, array); // Ignore non-index properties. while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { continue; } result = false; break; } // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { return seen.push(othIndex); } })) { result = false; break; } } else if (!( arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack) )) { result = false; break; } } stack['delete'](array); stack['delete'](other); return result; } /** * A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * * **Note:** This function only supports comparing values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { case dataViewTag: if ((object.byteLength != other.byteLength) || (object.byteOffset != other.byteOffset)) { return false; } object = object.buffer; other = other.buffer; case arrayBufferTag: if ((object.byteLength != other.byteLength) || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { return false; } return true; case boolTag: case dateTag: case numberTag: // Coerce booleans to `1` or `0` and dates to milliseconds. // Invalid dates are coerced to `NaN`. return eq(+object, +other); case errorTag: return object.name == other.name && object.message == other.message; case regexpTag: case stringTag: // Coerce regexes to strings and treat strings, primitives and objects, // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring // for more details. return object == (other + ''); case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & COMPARE_PARTIAL_FLAG; convert || (convert = setToArray); if (object.size != other.size && !isPartial) { return false; } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked) { return stacked == other; } bitmask |= COMPARE_UNORDERED_FLAG; // Recursively compare objects (susceptible to call stack limits). stack.set(object, other); var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); stack['delete'](object); return result; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object) == symbolValueOf.call(other); } } return false; } /** * A specialized version of `baseIsEqualDeep` for objects with support for * partial deep comparisons. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { return false; } } // Check that cyclic values are equal. var objStacked = stack.get(object); var othStacked = stack.get(other); if (objStacked && othStacked) { return objStacked == other && othStacked == object; } var result = true; stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) : compared )) { result = false; break; } skipCtor || (skipCtor = key == 'constructor'); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } stack['delete'](object); stack['delete'](other); return result; } /** * A specialized version of `baseRest` which flattens the rest array. * * @private * @param {Function} func The function to apply a rest parameter to. * @returns {Function} Returns the new function. */ function flatRest(func) { return setToString(overRest(func, undefined, flatten), func + ''); } /** * Creates an array of own enumerable property names and symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names and symbols. */ function getAllKeys(object) { return baseGetAllKeys(object, keys, getSymbols); } /** * Creates an array of own and inherited enumerable property names and * symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names and symbols. */ function getAllKeysIn(object) { return baseGetAllKeys(object, keysIn, getSymbolsIn); } /** * Gets metadata for `func`. * * @private * @param {Function} func The function to query. * @returns {*} Returns the metadata for `func`. */ var getData = !metaMap ? noop : function(func) { return metaMap.get(func); }; /** * Gets the name of `func`. * * @private * @param {Function} func The function to query. * @returns {string} Returns the function name. */ function getFuncName(func) { var result = (func.name + ''), array = realNames[result], length = hasOwnProperty.call(realNames, result) ? array.length : 0; while (length--) { var data = array[length], otherFunc = data.func; if (otherFunc == null || otherFunc == func) { return data.name; } } return result; } /** * Gets the argument placeholder value for `func`. * * @private * @param {Function} func The function to inspect. * @returns {*} Returns the placeholder value. */ function getHolder(func) { var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; return object.placeholder; } /** * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, * this function returns the custom method, otherwise it returns `baseIteratee`. * If arguments are provided, the chosen function is invoked with them and * its result is returned. * * @private * @param {*} [value] The value to convert to an iteratee. * @param {number} [arity] The arity of the created iteratee. * @returns {Function} Returns the chosen function or its result. */ function getIteratee() { var result = lodash.iteratee || iteratee; result = result === iteratee ? baseIteratee : result; return arguments.length ? result(arguments[0], arguments[1]) : result; } /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } /** * Gets the property names, values, and compare flags of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the match data of `object`. */ function getMatchData(object) { var result = keys(object), length = result.length; while (length--) { var key = result[length], value = object[key]; result[length] = [key, value, isStrictComparable(value)]; } return result; } /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = undefined; var unmasked = true; } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } /** * Creates an array of the own enumerable symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbols = !nativeGetSymbols ? stubArray : function(object) { if (object == null) { return []; } object = Object(object); return arrayFilter(nativeGetSymbols(object), function(symbol) { return propertyIsEnumerable.call(object, symbol); }); }; /** * Creates an array of the own and inherited enumerable symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { var result = []; while (object) { arrayPush(result, getSymbols(object)); object = getPrototype(object); } return result; }; /** * Gets the `toStringTag` of `value`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || (Set && getTag(new Set) != setTag) || (WeakMap && getTag(new WeakMap) != weakMapTag)) { getTag = function(value) { var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : ''; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result; }; } /** * Gets the view, applying any `transforms` to the `start` and `end` positions. * * @private * @param {number} start The start of the view. * @param {number} end The end of the view. * @param {Array} transforms The transformations to apply to the view. * @returns {Object} Returns an object containing the `start` and `end` * positions of the view. */ function getView(start, end, transforms) { var index = -1, length = transforms.length; while (++index < length) { var data = transforms[index], size = data.size; switch (data.type) { case 'drop': start += size; break; case 'dropRight': end -= size; break; case 'take': end = nativeMin(end, start + size); break; case 'takeRight': start = nativeMax(start, end - size); break; } } return { 'start': start, 'end': end }; } /** * Extracts wrapper details from the `source` body comment. * * @private * @param {string} source The source to inspect. * @returns {Array} Returns the wrapper details. */ function getWrapDetails(source) { var match = source.match(reWrapDetails); return match ? match[1].split(reSplitDetails) : []; } /** * Checks if `path` exists on `object`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @param {Function} hasFunc The function to check properties. * @returns {boolean} Returns `true` if `path` exists, else `false`. */ function hasPath(object, path, hasFunc) { path = castPath(path, object); var index = -1, length = path.length, result = false; while (++index < length) { var key = toKey(path[index]); if (!(result = object != null && hasFunc(object, key))) { break; } object = object[key]; } if (result || ++index != length) { return result; } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); } /** * Initializes an array clone. * * @private * @param {Array} array The array to clone. * @returns {Array} Returns the initialized clone. */ function initCloneArray(array) { var length = array.length, result = new array.constructor(length); // Add properties assigned by `RegExp#exec`. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { result.index = array.index; result.input = array.input; } return result; } /** * Initializes an object clone. * * @private * @param {Object} object The object to clone. * @returns {Object} Returns the initialized clone. */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) ? baseCreate(getPrototype(object)) : {}; } /** * Initializes an object clone based on its `toStringTag`. * * **Note:** This function only supports cloning values with tags of * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. * * @private * @param {Object} object The object to clone. * @param {string} tag The `toStringTag` of the object to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the initialized clone. */ function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: return cloneArrayBuffer(object); case boolTag: case dateTag: return new Ctor(+object); case dataViewTag: return cloneDataView(object, isDeep); case float32Tag: case float64Tag: case int8Tag: case int16Tag: case int32Tag: case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: return cloneTypedArray(object, isDeep); case mapTag: return new Ctor; case numberTag: case stringTag: return new Ctor(object); case regexpTag: return cloneRegExp(object); case setTag: return new Ctor; case symbolTag: return cloneSymbol(object); } } /** * Inserts wrapper `details` in a comment at the top of the `source` body. * * @private * @param {string} source The source to modify. * @returns {Array} details The details to insert. * @returns {string} Returns the modified source. */ function insertWrapDetails(source, details) { var length = details.length; if (!length) { return source; } var lastIndex = length - 1; details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; details = details.join(length > 2 ? ', ' : ' '); return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); } /** * Checks if `value` is a flattenable `arguments` object or array. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. */ function isFlattenable(value) { return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { var type = typeof value; length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (type == 'number' || (type != 'symbol' && reIsUint.test(value))) && (value > -1 && value % 1 == 0 && value < length); } /** * Checks if the given arguments are from an iteratee call. * * @private * @param {*} value The potential iteratee value argument. * @param {*} index The potential iteratee index or key argument. * @param {*} object The potential iteratee object argument. * @returns {boolean} Returns `true` if the arguments are from an iteratee call, * else `false`. */ function isIterateeCall(value, index, object) { if (!isObject(object)) { return false; } var type = typeof index; if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object) ) { return eq(object[index], value); } return false; } /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { if (isArray(value)) { return false; } var type = typeof value; if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object)); } /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') ? (value !== '__proto__') : (value === null); } /** * Checks if `func` has a lazy counterpart. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` has a lazy counterpart, * else `false`. */ function isLaziable(func) { var funcName = getFuncName(func), other = lodash[funcName]; if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { return false; } if (func === other) { return true; } var data = getData(other); return !!data && func === data[0]; } /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && (maskSrcKey in func); } /** * Checks if `func` is capable of being masked. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `func` is maskable, else `false`. */ var isMaskable = coreJsData ? isFunction : stubFalse; /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; return value === proto; } /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` if suitable for strict * equality comparisons, else `false`. */ function isStrictComparable(value) { return value === value && !isObject(value); } /** * A specialized version of `matchesProperty` for source values suitable * for strict equality comparisons, i.e. `===`. * * @private * @param {string} key The key of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function matchesStrictComparable(key, srcValue) { return function(object) { if (object == null) { return false; } return object[key] === srcValue && (srcValue !== undefined || (key in Object(object))); }; } /** * A specialized version of `_.memoize` which clears the memoized function's * cache when it exceeds `MAX_MEMOIZE_SIZE`. * * @private * @param {Function} func The function to have its output memoized. * @returns {Function} Returns the new memoized function. */ function memoizeCapped(func) { var result = memoize(func, function(key) { if (cache.size === MAX_MEMOIZE_SIZE) { cache.clear(); } return key; }); var cache = result.cache; return result; } /** * Merges the function metadata of `source` into `data`. * * Merging metadata reduces the number of wrappers used to invoke a function. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` * may be applied regardless of execution order. Methods like `_.ary` and * `_.rearg` modify function arguments, making the order in which they are * executed important, preventing the merging of metadata. However, we make * an exception for a safe combined case where curried functions have `_.ary` * and or `_.rearg` applied. * * @private * @param {Array} data The destination metadata. * @param {Array} source The source metadata. * @returns {Array} Returns `data`. */ function mergeData(data, source) { var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { return data; } // Use source `thisArg` if available. if (srcBitmask & WRAP_BIND_FLAG) { data[2] = source[2]; // Set when currying a bound function. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; } // Compose partial arguments. var value = source[3]; if (value) { var partials = data[3]; data[3] = partials ? composeArgs(partials, value, source[4]) : value; data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; } // Compose partial right arguments. value = source[5]; if (value) { partials = data[5]; data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; } // Use source `argPos` if available. value = source[7]; if (value) { data[7] = value; } // Use source `ary` if it's smaller. if (srcBitmask & WRAP_ARY_FLAG) { data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); } // Use source `arity` if one is not provided. if (data[9] == null) { data[9] = source[9]; } // Use source `func` and merge bitmasks. data[0] = source[0]; data[1] = newBitmask; return data; } /** * This function is like * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * except that it includes inherited enumerable properties. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function nativeKeysIn(object) { var result = []; if (object != null) { for (var key in Object(object)) { result.push(key); } } return result; } /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function objectToString(value) { return nativeObjectToString.call(value); } /** * A specialized version of `baseRest` which transforms the rest array. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @param {Function} transform The rest array transform. * @returns {Function} Returns the new function. */ function overRest(func, start, transform) { start = nativeMax(start === undefined ? (func.length - 1) : start, 0); return function() { var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); while (++index < length) { array[index] = args[start + index]; } index = -1; var otherArgs = Array(start + 1); while (++index < start) { otherArgs[index] = args[index]; } otherArgs[start] = transform(array); return apply(func, this, otherArgs); }; } /** * Gets the parent value at `path` of `object`. * * @private * @param {Object} object The object to query. * @param {Array} path The path to get the parent value of. * @returns {*} Returns the parent value. */ function parent(object, path) { return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); } /** * Reorder `array` according to the specified indexes where the element at * the first index is assigned as the first element, the element at * the second index is assigned as the second element, and so on. * * @private * @param {Array} array The array to reorder. * @param {Array} indexes The arranged array indexes. * @returns {Array} Returns `array`. */ function reorder(array, indexes) { var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array); while (length--) { var index = indexes[length]; array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; } return array; } /** * Gets the value at `key`, unless `key` is "__proto__" or "constructor". * * @private * @param {Object} object The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function safeGet(object, key) { if (key === 'constructor' && typeof object[key] === 'function') { return; } if (key == '__proto__') { return; } return object[key]; } /** * Sets metadata for `func`. * * **Note:** If this function becomes hot, i.e. is invoked a lot in a short * period of time, it will trip its breaker and transition to an identity * function to avoid garbage collection pauses in V8. See * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) * for more details. * * @private * @param {Function} func The function to associate metadata with. * @param {*} data The metadata. * @returns {Function} Returns `func`. */ var setData = shortOut(baseSetData); /** * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). * * @private * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. * @returns {number|Object} Returns the timer id or timeout object. */ var setTimeout = ctxSetTimeout || function(func, wait) { return root.setTimeout(func, wait); }; /** * Sets the `toString` method of `func` to return `string`. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var setToString = shortOut(baseSetToString); /** * Sets the `toString` method of `wrapper` to mimic the source of `reference` * with wrapper details in a comment at the top of the source body. * * @private * @param {Function} wrapper The function to modify. * @param {Function} reference The reference function. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @returns {Function} Returns `wrapper`. */ function setWrapToString(wrapper, reference, bitmask) { var source = (reference + ''); return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); } /** * Creates a function that'll short out and invoke `identity` instead * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` * milliseconds. * * @private * @param {Function} func The function to restrict. * @returns {Function} Returns the new shortable function. */ function shortOut(func) { var count = 0, lastCalled = 0; return function() { var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); lastCalled = stamp; if (remaining > 0) { if (++count >= HOT_COUNT) { return arguments[0]; } } else { count = 0; } return func.apply(undefined, arguments); }; } /** * A specialized version of `_.shuffle` which mutates and sets the size of `array`. * * @private * @param {Array} array The array to shuffle. * @param {number} [size=array.length] The size of `array`. * @returns {Array} Returns `array`. */ function shuffleSelf(array, size) { var index = -1, length = array.length, lastIndex = length - 1; size = size === undefined ? length : size; while (++index < size) { var rand = baseRandom(index, lastIndex), value = array[rand]; array[rand] = array[index]; array[index] = value; } array.length = size; return array; } /** * Converts `string` to a property path array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ var stringToPath = memoizeCapped(function(string) { var result = []; if (string.charCodeAt(0) === 46 /* . */) { result.push(''); } string.replace(rePropName, function(match, number, quote, subString) { result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); }); return result; }); /** * Converts `value` to a string key if it's not a string or symbol. * * @private * @param {*} value The value to inspect. * @returns {string|symbol} Returns the key. */ function toKey(value) { if (typeof value == 'string' || isSymbol(value)) { return value; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * Converts `func` to its source code. * * @private * @param {Function} func The function to convert. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return (func + ''); } catch (e) {} } return ''; } /** * Updates wrapper `details` based on `bitmask` flags. * * @private * @returns {Array} details The details to modify. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @returns {Array} Returns `details`. */ function updateWrapDetails(details, bitmask) { arrayEach(wrapFlags, function(pair) { var value = '_.' + pair[0]; if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { details.push(value); } }); return details.sort(); } /** * Creates a clone of `wrapper`. * * @private * @param {Object} wrapper The wrapper to clone. * @returns {Object} Returns the cloned wrapper. */ function wrapperClone(wrapper) { if (wrapper instanceof LazyWrapper) { return wrapper.clone(); } var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); result.__actions__ = copyArray(wrapper.__actions__); result.__index__ = wrapper.__index__; result.__values__ = wrapper.__values__; return result; } /*------------------------------------------------------------------------*/ /** * Creates an array of elements split into groups the length of `size`. * If `array` can't be split evenly, the final chunk will be the remaining * elements. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to process. * @param {number} [size=1] The length of each chunk * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the new array of chunks. * @example * * _.chunk(['a', 'b', 'c', 'd'], 2); * // => [['a', 'b'], ['c', 'd']] * * _.chunk(['a', 'b', 'c', 'd'], 3); * // => [['a', 'b', 'c'], ['d']] */ function chunk(array, size, guard) { if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { size = 1; } else { size = nativeMax(toInteger(size), 0); } var length = array == null ? 0 : array.length; if (!length || size < 1) { return []; } var index = 0, resIndex = 0, result = Array(nativeCeil(length / size)); while (index < length) { result[resIndex++] = baseSlice(array, index, (index += size)); } return result; } /** * Creates an array with all falsey values removed. The values `false`, `null`, * `0`, `""`, `undefined`, and `NaN` are falsey. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to compact. * @returns {Array} Returns the new array of filtered values. * @example * * _.compact([0, 1, false, 2, '', 3]); * // => [1, 2, 3] */ function compact(array) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (value) { result[resIndex++] = value; } } return result; } /** * Creates a new array concatenating `array` with any additional arrays * and/or values. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to concatenate. * @param {...*} [values] The values to concatenate. * @returns {Array} Returns the new concatenated array. * @example * * var array = [1]; * var other = _.concat(array, 2, [3], [[4]]); * * console.log(other); * // => [1, 2, 3, [4]] * * console.log(array); * // => [1] */ function concat() { var length = arguments.length; if (!length) { return []; } var args = Array(length - 1), array = arguments[0], index = length; while (index--) { args[index - 1] = arguments[index]; } return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); } /** * Creates an array of `array` values not included in the other given arrays * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. The order and references of result values are * determined by the first array. * * **Note:** Unlike `_.pullAll`, this method returns a new array. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. * @returns {Array} Returns the new array of filtered values. * @see _.without, _.xor * @example * * _.difference([2, 1], [2, 3]); * // => [1] */ var difference = baseRest(function(array, values) { return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : []; }); /** * This method is like `_.difference` except that it accepts `iteratee` which * is invoked for each element of `array` and `values` to generate the criterion * by which they're compared. The order and references of result values are * determined by the first array. The iteratee is invoked with one argument: * (value). * * **Note:** Unlike `_.pullAllBy`, this method returns a new array. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); * // => [1.2] * * // The `_.property` iteratee shorthand. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); * // => [{ 'x': 2 }] */ var differenceBy = baseRest(function(array, values) { var iteratee = last(values); if (isArrayLikeObject(iteratee)) { iteratee = undefined; } return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) : []; }); /** * This method is like `_.difference` except that it accepts `comparator` * which is invoked to compare elements of `array` to `values`. The order and * references of result values are determined by the first array. The comparator * is invoked with two arguments: (arrVal, othVal). * * **Note:** Unlike `_.pullAllWith`, this method returns a new array. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); * // => [{ 'x': 2, 'y': 1 }] */ var differenceWith = baseRest(function(array, values) { var comparator = last(values); if (isArrayLikeObject(comparator)) { comparator = undefined; } return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) : []; }); /** * Creates a slice of `array` with `n` elements dropped from the beginning. * * @static * @memberOf _ * @since 0.5.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.drop([1, 2, 3]); * // => [2, 3] * * _.drop([1, 2, 3], 2); * // => [3] * * _.drop([1, 2, 3], 5); * // => [] * * _.drop([1, 2, 3], 0); * // => [1, 2, 3] */ function drop(array, n, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } n = (guard || n === undefined) ? 1 : toInteger(n); return baseSlice(array, n < 0 ? 0 : n, length); } /** * Creates a slice of `array` with `n` elements dropped from the end. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.dropRight([1, 2, 3]); * // => [1, 2] * * _.dropRight([1, 2, 3], 2); * // => [1] * * _.dropRight([1, 2, 3], 5); * // => [] * * _.dropRight([1, 2, 3], 0); * // => [1, 2, 3] */ function dropRight(array, n, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } n = (guard || n === undefined) ? 1 : toInteger(n); n = length - n; return baseSlice(array, 0, n < 0 ? 0 : n); } /** * Creates a slice of `array` excluding elements dropped from the end. * Elements are dropped until `predicate` returns falsey. The predicate is * invoked with three arguments: (value, index, array). * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * * _.dropRightWhile(users, function(o) { return !o.active; }); * // => objects for ['barney'] * * // The `_.matches` iteratee shorthand. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); * // => objects for ['barney', 'fred'] * * // The `_.matchesProperty` iteratee shorthand. * _.dropRightWhile(users, ['active', false]); * // => objects for ['barney'] * * // The `_.property` iteratee shorthand. * _.dropRightWhile(users, 'active'); * // => objects for ['barney', 'fred', 'pebbles'] */ function dropRightWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), true, true) : []; } /** * Creates a slice of `array` excluding elements dropped from the beginning. * Elements are dropped until `predicate` returns falsey. The predicate is * invoked with three arguments: (value, index, array). * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': true } * ]; * * _.dropWhile(users, function(o) { return !o.active; }); * // => objects for ['pebbles'] * * // The `_.matches` iteratee shorthand. * _.dropWhile(users, { 'user': 'barney', 'active': false }); * // => objects for ['fred', 'pebbles'] * * // The `_.matchesProperty` iteratee shorthand. * _.dropWhile(users, ['active', false]); * // => objects for ['pebbles'] * * // The `_.property` iteratee shorthand. * _.dropWhile(users, 'active'); * // => objects for ['barney', 'fred', 'pebbles'] */ function dropWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), true) : []; } /** * Fills elements of `array` with `value` from `start` up to, but not * including, `end`. * * **Note:** This method mutates `array`. * * @static * @memberOf _ * @since 3.2.0 * @category Array * @param {Array} array The array to fill. * @param {*} value The value to fill `array` with. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3]; * * _.fill(array, 'a'); * console.log(array); * // => ['a', 'a', 'a'] * * _.fill(Array(3), 2); * // => [2, 2, 2] * * _.fill([4, 6, 8, 10], '*', 1, 3); * // => [4, '*', '*', 10] */ function fill(array, value, start, end) { var length = array == null ? 0 : array.length; if (!length) { return []; } if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { start = 0; end = length; } return baseFill(array, value, start, end); } /** * This method is like `_.find` except that it returns the index of the first * element `predicate` returns truthy for instead of the element itself. * * @static * @memberOf _ * @since 1.1.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @param {number} [fromIndex=0] The index to search from. * @returns {number} Returns the index of the found element, else `-1`. * @example * * var users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': true } * ]; * * _.findIndex(users, function(o) { return o.user == 'barney'; }); * // => 0 * * // The `_.matches` iteratee shorthand. * _.findIndex(users, { 'user': 'fred', 'active': false }); * // => 1 * * // The `_.matchesProperty` iteratee shorthand. * _.findIndex(users, ['active', false]); * // => 0 * * // The `_.property` iteratee shorthand. * _.findIndex(users, 'active'); * // => 2 */ function findIndex(array, predicate, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = fromIndex == null ? 0 : toInteger(fromIndex); if (index < 0) { index = nativeMax(length + index, 0); } return baseFindIndex(array, getIteratee(predicate, 3), index); } /** * This method is like `_.findIndex` except that it iterates over elements * of `collection` from right to left. * * @static * @memberOf _ * @since 2.0.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @param {number} [fromIndex=array.length-1] The index to search from. * @returns {number} Returns the index of the found element, else `-1`. * @example * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); * // => 2 * * // The `_.matches` iteratee shorthand. * _.findLastIndex(users, { 'user': 'barney', 'active': true }); * // => 0 * * // The `_.matchesProperty` iteratee shorthand. * _.findLastIndex(users, ['active', false]); * // => 2 * * // The `_.property` iteratee shorthand. * _.findLastIndex(users, 'active'); * // => 0 */ function findLastIndex(array, predicate, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = length - 1; if (fromIndex !== undefined) { index = toInteger(fromIndex); index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); } return baseFindIndex(array, getIteratee(predicate, 3), index, true); } /** * Flattens `array` a single level deep. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to flatten. * @returns {Array} Returns the new flattened array. * @example * * _.flatten([1, [2, [3, [4]], 5]]); * // => [1, 2, [3, [4]], 5] */ function flatten(array) { var length = array == null ? 0 : array.length; return length ? baseFlatten(array, 1) : []; } /** * Recursively flattens `array`. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to flatten. * @returns {Array} Returns the new flattened array. * @example * * _.flattenDeep([1, [2, [3, [4]], 5]]); * // => [1, 2, 3, 4, 5] */ function flattenDeep(array) { var length = array == null ? 0 : array.length; return length ? baseFlatten(array, INFINITY) : []; } /** * Recursively flatten `array` up to `depth` times. * * @static * @memberOf _ * @since 4.4.0 * @category Array * @param {Array} array The array to flatten. * @param {number} [depth=1] The maximum recursion depth. * @returns {Array} Returns the new flattened array. * @example * * var array = [1, [2, [3, [4]], 5]]; * * _.flattenDepth(array, 1); * // => [1, 2, [3, [4]], 5] * * _.flattenDepth(array, 2); * // => [1, 2, 3, [4], 5] */ function flattenDepth(array, depth) { var length = array == null ? 0 : array.length; if (!length) { return []; } depth = depth === undefined ? 1 : toInteger(depth); return baseFlatten(array, depth); } /** * The inverse of `_.toPairs`; this method returns an object composed * from key-value `pairs`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} pairs The key-value pairs. * @returns {Object} Returns the new object. * @example * * _.fromPairs([['a', 1], ['b', 2]]); * // => { 'a': 1, 'b': 2 } */ function fromPairs(pairs) { var index = -1, length = pairs == null ? 0 : pairs.length, result = {}; while (++index < length) { var pair = pairs[index]; result[pair[0]] = pair[1]; } return result; } /** * Gets the first element of `array`. * * @static * @memberOf _ * @since 0.1.0 * @alias first * @category Array * @param {Array} array The array to query. * @returns {*} Returns the first element of `array`. * @example * * _.head([1, 2, 3]); * // => 1 * * _.head([]); * // => undefined */ function head(array) { return (array && array.length) ? array[0] : undefined; } /** * Gets the index at which the first occurrence of `value` is found in `array` * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. If `fromIndex` is negative, it's used as the * offset from the end of `array`. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} [fromIndex=0] The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.indexOf([1, 2, 1, 2], 2); * // => 1 * * // Search from the `fromIndex`. * _.indexOf([1, 2, 1, 2], 2, 2); * // => 3 */ function indexOf(array, value, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = fromIndex == null ? 0 : toInteger(fromIndex); if (index < 0) { index = nativeMax(length + index, 0); } return baseIndexOf(array, value, index); } /** * Gets all but the last element of `array`. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @returns {Array} Returns the slice of `array`. * @example * * _.initial([1, 2, 3]); * // => [1, 2] */ function initial(array) { var length = array == null ? 0 : array.length; return length ? baseSlice(array, 0, -1) : []; } /** * Creates an array of unique values that are included in all given arrays * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. The order and references of result values are * determined by the first array. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of intersecting values. * @example * * _.intersection([2, 1], [2, 3]); * // => [2] */ var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped) : []; }); /** * This method is like `_.intersection` except that it accepts `iteratee` * which is invoked for each element of each `arrays` to generate the criterion * by which they're compared. The order and references of result values are * determined by the first array. The iteratee is invoked with one argument: * (value). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of intersecting values. * @example * * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); * // => [2.1] * * // The `_.property` iteratee shorthand. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }] */ var intersectionBy = baseRest(function(arrays) { var iteratee = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); if (iteratee === last(mapped)) { iteratee = undefined; } else { mapped.pop(); } return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped, getIteratee(iteratee, 2)) : []; }); /** * This method is like `_.intersection` except that it accepts `comparator` * which is invoked to compare elements of `arrays`. The order and references * of result values are determined by the first array. The comparator is * invoked with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of intersecting values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.intersectionWith(objects, others, _.isEqual); * // => [{ 'x': 1, 'y': 2 }] */ var intersectionWith = baseRest(function(arrays) { var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); comparator = typeof comparator == 'function' ? comparator : undefined; if (comparator) { mapped.pop(); } return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped, undefined, comparator) : []; }); /** * Converts all elements in `array` into a string separated by `separator`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to convert. * @param {string} [separator=','] The element separator. * @returns {string} Returns the joined string. * @example * * _.join(['a', 'b', 'c'], '~'); * // => 'a~b~c' */ function join(array, separator) { return array == null ? '' : nativeJoin.call(array, separator); } /** * Gets the last element of `array`. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @returns {*} Returns the last element of `array`. * @example * * _.last([1, 2, 3]); * // => 3 */ function last(array) { var length = array == null ? 0 : array.length; return length ? array[length - 1] : undefined; } /** * This method is like `_.indexOf` except that it iterates over elements of * `array` from right to left. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} [fromIndex=array.length-1] The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.lastIndexOf([1, 2, 1, 2], 2); * // => 3 * * // Search from the `fromIndex`. * _.lastIndexOf([1, 2, 1, 2], 2, 2); * // => 1 */ function lastIndexOf(array, value, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = length; if (fromIndex !== undefined) { index = toInteger(fromIndex); index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); } return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true); } /** * Gets the element at index `n` of `array`. If `n` is negative, the nth * element from the end is returned. * * @static * @memberOf _ * @since 4.11.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=0] The index of the element to return. * @returns {*} Returns the nth element of `array`. * @example * * var array = ['a', 'b', 'c', 'd']; * * _.nth(array, 1); * // => 'b' * * _.nth(array, -2); * // => 'c'; */ function nth(array, n) { return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; } /** * Removes all given values from `array` using * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` * to remove elements from an array by predicate. * * @static * @memberOf _ * @since 2.0.0 * @category Array * @param {Array} array The array to modify. * @param {...*} [values] The values to remove. * @returns {Array} Returns `array`. * @example * * var array = ['a', 'b', 'c', 'a', 'b', 'c']; * * _.pull(array, 'a', 'c'); * console.log(array); * // => ['b', 'b'] */ var pull = baseRest(pullAll); /** * This method is like `_.pull` except that it accepts an array of values to remove. * * **Note:** Unlike `_.difference`, this method mutates `array`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @returns {Array} Returns `array`. * @example * * var array = ['a', 'b', 'c', 'a', 'b', 'c']; * * _.pullAll(array, ['a', 'c']); * console.log(array); * // => ['b', 'b'] */ function pullAll(array, values) { return (array && array.length && values && values.length) ? basePullAll(array, values) : array; } /** * This method is like `_.pullAll` except that it accepts `iteratee` which is * invoked for each element of `array` and `values` to generate the criterion * by which they're compared. The iteratee is invoked with one argument: (value). * * **Note:** Unlike `_.differenceBy`, this method mutates `array`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns `array`. * @example * * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; * * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); * console.log(array); * // => [{ 'x': 2 }] */ function pullAllBy(array, values, iteratee) { return (array && array.length && values && values.length) ? basePullAll(array, values, getIteratee(iteratee, 2)) : array; } /** * This method is like `_.pullAll` except that it accepts `comparator` which * is invoked to compare elements of `array` to `values`. The comparator is * invoked with two arguments: (arrVal, othVal). * * **Note:** Unlike `_.differenceWith`, this method mutates `array`. * * @static * @memberOf _ * @since 4.6.0 * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns `array`. * @example * * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; * * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); * console.log(array); * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] */ function pullAllWith(array, values, comparator) { return (array && array.length && values && values.length) ? basePullAll(array, values, undefined, comparator) : array; } /** * Removes elements from `array` corresponding to `indexes` and returns an * array of removed elements. * * **Note:** Unlike `_.at`, this method mutates `array`. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to modify. * @param {...(number|number[])} [indexes] The indexes of elements to remove. * @returns {Array} Returns the new array of removed elements. * @example * * var array = ['a', 'b', 'c', 'd']; * var pulled = _.pullAt(array, [1, 3]); * * console.log(array); * // => ['a', 'c'] * * console.log(pulled); * // => ['b', 'd'] */ var pullAt = flatRest(function(array, indexes) { var length = array == null ? 0 : array.length, result = baseAt(array, indexes); basePullAt(array, arrayMap(indexes, function(index) { return isIndex(index, length) ? +index : index; }).sort(compareAscending)); return result; }); /** * Removes all elements from `array` that `predicate` returns truthy for * and returns an array of the removed elements. The predicate is invoked * with three arguments: (value, index, array). * * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` * to pull elements from an array by value. * * @static * @memberOf _ * @since 2.0.0 * @category Array * @param {Array} array The array to modify. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the new array of removed elements. * @example * * var array = [1, 2, 3, 4]; * var evens = _.remove(array, function(n) { * return n % 2 == 0; * }); * * console.log(array); * // => [1, 3] * * console.log(evens); * // => [2, 4] */ function remove(array, predicate) { var result = []; if (!(array && array.length)) { return result; } var index = -1, indexes = [], length = array.length; predicate = getIteratee(predicate, 3); while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result.push(value); indexes.push(index); } } basePullAt(array, indexes); return result; } /** * Reverses `array` so that the first element becomes the last, the second * element becomes the second to last, and so on. * * **Note:** This method mutates `array` and is based on * [`Array#reverse`](https://mdn.io/Array/reverse). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to modify. * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3]; * * _.reverse(array); * // => [3, 2, 1] * * console.log(array); * // => [3, 2, 1] */ function reverse(array) { return array == null ? array : nativeReverse.call(array); } /** * Creates a slice of `array` from `start` up to, but not including, `end`. * * **Note:** This method is used instead of * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are * returned. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of `array`. */ function slice(array, start, end) { var length = array == null ? 0 : array.length; if (!length) { return []; } if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { start = 0; end = length; } else { start = start == null ? 0 : toInteger(start); end = end === undefined ? length : toInteger(end); } return baseSlice(array, start, end); } /** * Uses a binary search to determine the lowest index at which `value` * should be inserted into `array` in order to maintain its sort order. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @returns {number} Returns the index at which `value` should be inserted * into `array`. * @example * * _.sortedIndex([30, 50], 40); * // => 1 */ function sortedIndex(array, value) { return baseSortedIndex(array, value); } /** * This method is like `_.sortedIndex` except that it accepts `iteratee` * which is invoked for `value` and each element of `array` to compute their * sort ranking. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the index at which `value` should be inserted * into `array`. * @example * * var objects = [{ 'x': 4 }, { 'x': 5 }]; * * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); * // => 0 * * // The `_.property` iteratee shorthand. * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); * // => 0 */ function sortedIndexBy(array, value, iteratee) { return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); } /** * This method is like `_.indexOf` except that it performs a binary * search on a sorted `array`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.sortedIndexOf([4, 5, 5, 5, 6], 5); * // => 1 */ function sortedIndexOf(array, value) { var length = array == null ? 0 : array.length; if (length) { var index = baseSortedIndex(array, value); if (index < length && eq(array[index], value)) { return index; } } return -1; } /** * This method is like `_.sortedIndex` except that it returns the highest * index at which `value` should be inserted into `array` in order to * maintain its sort order. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @returns {number} Returns the index at which `value` should be inserted * into `array`. * @example * * _.sortedLastIndex([4, 5, 5, 5, 6], 5); * // => 4 */ function sortedLastIndex(array, value) { return baseSortedIndex(array, value, true); } /** * This method is like `_.sortedLastIndex` except that it accepts `iteratee` * which is invoked for `value` and each element of `array` to compute their * sort ranking. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the index at which `value` should be inserted * into `array`. * @example * * var objects = [{ 'x': 4 }, { 'x': 5 }]; * * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); * // => 1 * * // The `_.property` iteratee shorthand. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); * // => 1 */ function sortedLastIndexBy(array, value, iteratee) { return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); } /** * This method is like `_.lastIndexOf` except that it performs a binary * search on a sorted `array`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); * // => 3 */ function sortedLastIndexOf(array, value) { var length = array == null ? 0 : array.length; if (length) { var index = baseSortedIndex(array, value, true) - 1; if (eq(array[index], value)) { return index; } } return -1; } /** * This method is like `_.uniq` except that it's designed and optimized * for sorted arrays. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. * @example * * _.sortedUniq([1, 1, 2]); * // => [1, 2] */ function sortedUniq(array) { return (array && array.length) ? baseSortedUniq(array) : []; } /** * This method is like `_.uniqBy` except that it's designed and optimized * for sorted arrays. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); * // => [1.1, 2.3] */ function sortedUniqBy(array, iteratee) { return (array && array.length) ? baseSortedUniq(array, getIteratee(iteratee, 2)) : []; } /** * Gets all but the first element of `array`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to query. * @returns {Array} Returns the slice of `array`. * @example * * _.tail([1, 2, 3]); * // => [2, 3] */ function tail(array) { var length = array == null ? 0 : array.length; return length ? baseSlice(array, 1, length) : []; } /** * Creates a slice of `array` with `n` elements taken from the beginning. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to take. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.take([1, 2, 3]); * // => [1] * * _.take([1, 2, 3], 2); * // => [1, 2] * * _.take([1, 2, 3], 5); * // => [1, 2, 3] * * _.take([1, 2, 3], 0); * // => [] */ function take(array, n, guard) { if (!(array && array.length)) { return []; } n = (guard || n === undefined) ? 1 : toInteger(n); return baseSlice(array, 0, n < 0 ? 0 : n); } /** * Creates a slice of `array` with `n` elements taken from the end. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to take. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.takeRight([1, 2, 3]); * // => [3] * * _.takeRight([1, 2, 3], 2); * // => [2, 3] * * _.takeRight([1, 2, 3], 5); * // => [1, 2, 3] * * _.takeRight([1, 2, 3], 0); * // => [] */ function takeRight(array, n, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } n = (guard || n === undefined) ? 1 : toInteger(n); n = length - n; return baseSlice(array, n < 0 ? 0 : n, length); } /** * Creates a slice of `array` with elements taken from the end. Elements are * taken until `predicate` returns falsey. The predicate is invoked with * three arguments: (value, index, array). * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * * _.takeRightWhile(users, function(o) { return !o.active; }); * // => objects for ['fred', 'pebbles'] * * // The `_.matches` iteratee shorthand. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); * // => objects for ['pebbles'] * * // The `_.matchesProperty` iteratee shorthand. * _.takeRightWhile(users, ['active', false]); * // => objects for ['fred', 'pebbles'] * * // The `_.property` iteratee shorthand. * _.takeRightWhile(users, 'active'); * // => [] */ function takeRightWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), false, true) : []; } /** * Creates a slice of `array` with elements taken from the beginning. Elements * are taken until `predicate` returns falsey. The predicate is invoked with * three arguments: (value, index, array). * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': true } * ]; * * _.takeWhile(users, function(o) { return !o.active; }); * // => objects for ['barney', 'fred'] * * // The `_.matches` iteratee shorthand. * _.takeWhile(users, { 'user': 'barney', 'active': false }); * // => objects for ['barney'] * * // The `_.matchesProperty` iteratee shorthand. * _.takeWhile(users, ['active', false]); * // => objects for ['barney', 'fred'] * * // The `_.property` iteratee shorthand. * _.takeWhile(users, 'active'); * // => [] */ function takeWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3)) : []; } /** * Creates an array of unique values, in order, from all given arrays using * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of combined values. * @example * * _.union([2], [1, 2]); * // => [2, 1] */ var union = baseRest(function(arrays) { return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); }); /** * This method is like `_.union` except that it accepts `iteratee` which is * invoked for each element of each `arrays` to generate the criterion by * which uniqueness is computed. Result values are chosen from the first * array in which the value occurs. The iteratee is invoked with one argument: * (value). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of combined values. * @example * * _.unionBy([2.1], [1.2, 2.3], Math.floor); * // => [2.1, 1.2] * * // The `_.property` iteratee shorthand. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ var unionBy = baseRest(function(arrays) { var iteratee = last(arrays); if (isArrayLikeObject(iteratee)) { iteratee = undefined; } return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); }); /** * This method is like `_.union` except that it accepts `comparator` which * is invoked to compare elements of `arrays`. Result values are chosen from * the first array in which the value occurs. The comparator is invoked * with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of combined values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.unionWith(objects, others, _.isEqual); * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] */ var unionWith = baseRest(function(arrays) { var comparator = last(arrays); comparator = typeof comparator == 'function' ? comparator : undefined; return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); }); /** * Creates a duplicate-free version of an array, using * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons, in which only the first occurrence of each element * is kept. The order of result values is determined by the order they occur * in the array. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. * @example * * _.uniq([2, 1, 2]); * // => [2, 1] */ function uniq(array) { return (array && array.length) ? baseUniq(array) : []; } /** * This method is like `_.uniq` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * uniqueness is computed. The order of result values is determined by the * order they occur in the array. The iteratee is invoked with one argument: * (value). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * _.uniqBy([2.1, 1.2, 2.3], Math.floor); * // => [2.1, 1.2] * * // The `_.property` iteratee shorthand. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ function uniqBy(array, iteratee) { return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; } /** * This method is like `_.uniq` except that it accepts `comparator` which * is invoked to compare elements of `array`. The order of result values is * determined by the order they occur in the array.The comparator is invoked * with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.uniqWith(objects, _.isEqual); * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] */ function uniqWith(array, comparator) { comparator = typeof comparator == 'function' ? comparator : undefined; return (array && array.length) ? baseUniq(array, undefined, comparator) : []; } /** * This method is like `_.zip` except that it accepts an array of grouped * elements and creates an array regrouping the elements to their pre-zip * configuration. * * @static * @memberOf _ * @since 1.2.0 * @category Array * @param {Array} array The array of grouped elements to process. * @returns {Array} Returns the new array of regrouped elements. * @example * * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); * // => [['a', 1, true], ['b', 2, false]] * * _.unzip(zipped); * // => [['a', 'b'], [1, 2], [true, false]] */ function unzip(array) { if (!(array && array.length)) { return []; } var length = 0; array = arrayFilter(array, function(group) { if (isArrayLikeObject(group)) { length = nativeMax(group.length, length); return true; } }); return baseTimes(length, function(index) { return arrayMap(array, baseProperty(index)); }); } /** * This method is like `_.unzip` except that it accepts `iteratee` to specify * how regrouped values should be combined. The iteratee is invoked with the * elements of each group: (...group). * * @static * @memberOf _ * @since 3.8.0 * @category Array * @param {Array} array The array of grouped elements to process. * @param {Function} [iteratee=_.identity] The function to combine * regrouped values. * @returns {Array} Returns the new array of regrouped elements. * @example * * var zipped = _.zip([1, 2], [10, 20], [100, 200]); * // => [[1, 10, 100], [2, 20, 200]] * * _.unzipWith(zipped, _.add); * // => [3, 30, 300] */ function unzipWith(array, iteratee) { if (!(array && array.length)) { return []; } var result = unzip(array); if (iteratee == null) { return result; } return arrayMap(result, function(group) { return apply(iteratee, undefined, group); }); } /** * Creates an array excluding all given values using * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * **Note:** Unlike `_.pull`, this method returns a new array. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @param {...*} [values] The values to exclude. * @returns {Array} Returns the new array of filtered values. * @see _.difference, _.xor * @example * * _.without([2, 1, 2, 3], 1, 2); * // => [3] */ var without = baseRest(function(array, values) { return isArrayLikeObject(array) ? baseDifference(array, values) : []; }); /** * Creates an array of unique values that is the * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) * of the given arrays. The order of result values is determined by the order * they occur in the arrays. * * @static * @memberOf _ * @since 2.4.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of filtered values. * @see _.difference, _.without * @example * * _.xor([2, 1], [2, 3]); * // => [1, 3] */ var xor = baseRest(function(arrays) { return baseXor(arrayFilter(arrays, isArrayLikeObject)); }); /** * This method is like `_.xor` except that it accepts `iteratee` which is * invoked for each element of each `arrays` to generate the criterion by * which by which they're compared. The order of result values is determined * by the order they occur in the arrays. The iteratee is invoked with one * argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); * // => [1.2, 3.4] * * // The `_.property` iteratee shorthand. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 2 }] */ var xorBy = baseRest(function(arrays) { var iteratee = last(arrays); if (isArrayLikeObject(iteratee)) { iteratee = undefined; } return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); }); /** * This method is like `_.xor` except that it accepts `comparator` which is * invoked to compare elements of `arrays`. The order of result values is * determined by the order they occur in the arrays. The comparator is invoked * with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.xorWith(objects, others, _.isEqual); * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] */ var xorWith = baseRest(function(arrays) { var comparator = last(arrays); comparator = typeof comparator == 'function' ? comparator : undefined; return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); }); /** * Creates an array of grouped elements, the first of which contains the * first elements of the given arrays, the second of which contains the * second elements of the given arrays, and so on. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {...Array} [arrays] The arrays to process. * @returns {Array} Returns the new array of grouped elements. * @example * * _.zip(['a', 'b'], [1, 2], [true, false]); * // => [['a', 1, true], ['b', 2, false]] */ var zip = baseRest(unzip); /** * This method is like `_.fromPairs` except that it accepts two arrays, * one of property identifiers and one of corresponding values. * * @static * @memberOf _ * @since 0.4.0 * @category Array * @param {Array} [props=[]] The property identifiers. * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example * * _.zipObject(['a', 'b'], [1, 2]); * // => { 'a': 1, 'b': 2 } */ function zipObject(props, values) { return baseZipObject(props || [], values || [], assignValue); } /** * This method is like `_.zipObject` except that it supports property paths. * * @static * @memberOf _ * @since 4.1.0 * @category Array * @param {Array} [props=[]] The property identifiers. * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example * * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } */ function zipObjectDeep(props, values) { return baseZipObject(props || [], values || [], baseSet); } /** * This method is like `_.zip` except that it accepts `iteratee` to specify * how grouped values should be combined. The iteratee is invoked with the * elements of each group: (...group). * * @static * @memberOf _ * @since 3.8.0 * @category Array * @param {...Array} [arrays] The arrays to process. * @param {Function} [iteratee=_.identity] The function to combine * grouped values. * @returns {Array} Returns the new array of grouped elements. * @example * * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { * return a + b + c; * }); * // => [111, 222] */ var zipWith = baseRest(function(arrays) { var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : undefined; iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; return unzipWith(arrays, iteratee); }); /*------------------------------------------------------------------------*/ /** * Creates a `lodash` wrapper instance that wraps `value` with explicit method * chain sequences enabled. The result of such sequences must be unwrapped * with `_#value`. * * @static * @memberOf _ * @since 1.3.0 * @category Seq * @param {*} value The value to wrap. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 }, * { 'user': 'pebbles', 'age': 1 } * ]; * * var youngest = _ * .chain(users) * .sortBy('age') * .map(function(o) { * return o.user + ' is ' + o.age; * }) * .head() * .value(); * // => 'pebbles is 1' */ function chain(value) { var result = lodash(value); result.__chain__ = true; return result; } /** * This method invokes `interceptor` and returns `value`. The interceptor * is invoked with one argument; (value). The purpose of this method is to * "tap into" a method chain sequence in order to modify intermediate results. * * @static * @memberOf _ * @since 0.1.0 * @category Seq * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @returns {*} Returns `value`. * @example * * _([1, 2, 3]) * .tap(function(array) { * // Mutate input array. * array.pop(); * }) * .reverse() * .value(); * // => [2, 1] */ function tap(value, interceptor) { interceptor(value); return value; } /** * This method is like `_.tap` except that it returns the result of `interceptor`. * The purpose of this method is to "pass thru" values replacing intermediate * results in a method chain sequence. * * @static * @memberOf _ * @since 3.0.0 * @category Seq * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @returns {*} Returns the result of `interceptor`. * @example * * _(' abc ') * .chain() * .trim() * .thru(function(value) { * return [value]; * }) * .value(); * // => ['abc'] */ function thru(value, interceptor) { return interceptor(value); } /** * This method is the wrapper version of `_.at`. * * @name at * @memberOf _ * @since 1.0.0 * @category Seq * @param {...(string|string[])} [paths] The property paths to pick. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; * * _(object).at(['a[0].b.c', 'a[1]']).value(); * // => [3, 4] */ var wrapperAt = flatRest(function(paths) { var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) { return baseAt(object, paths); }; if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { return this.thru(interceptor); } value = value.slice(start, +start + (length ? 1 : 0)); value.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); return new LodashWrapper(value, this.__chain__).thru(function(array) { if (length && !array.length) { array.push(undefined); } return array; }); }); /** * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. * * @name chain * @memberOf _ * @since 0.1.0 * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * // A sequence without explicit chaining. * _(users).head(); * // => { 'user': 'barney', 'age': 36 } * * // A sequence with explicit chaining. * _(users) * .chain() * .head() * .pick('user') * .value(); * // => { 'user': 'barney' } */ function wrapperChain() { return chain(this); } /** * Executes the chain sequence and returns the wrapped result. * * @name commit * @memberOf _ * @since 3.2.0 * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var array = [1, 2]; * var wrapped = _(array).push(3); * * console.log(array); * // => [1, 2] * * wrapped = wrapped.commit(); * console.log(array); * // => [1, 2, 3] * * wrapped.last(); * // => 3 * * console.log(array); * // => [1, 2, 3] */ function wrapperCommit() { return new LodashWrapper(this.value(), this.__chain__); } /** * Gets the next value on a wrapped object following the * [iterator protocol](https://mdn.io/iteration_protocols#iterator). * * @name next * @memberOf _ * @since 4.0.0 * @category Seq * @returns {Object} Returns the next iterator value. * @example * * var wrapped = _([1, 2]); * * wrapped.next(); * // => { 'done': false, 'value': 1 } * * wrapped.next(); * // => { 'done': false, 'value': 2 } * * wrapped.next(); * // => { 'done': true, 'value': undefined } */ function wrapperNext() { if (this.__values__ === undefined) { this.__values__ = toArray(this.value()); } var done = this.__index__ >= this.__values__.length, value = done ? undefined : this.__values__[this.__index__++]; return { 'done': done, 'value': value }; } /** * Enables the wrapper to be iterable. * * @name Symbol.iterator * @memberOf _ * @since 4.0.0 * @category Seq * @returns {Object} Returns the wrapper object. * @example * * var wrapped = _([1, 2]); * * wrapped[Symbol.iterator]() === wrapped; * // => true * * Array.from(wrapped); * // => [1, 2] */ function wrapperToIterator() { return this; } /** * Creates a clone of the chain sequence planting `value` as the wrapped value. * * @name plant * @memberOf _ * @since 3.2.0 * @category Seq * @param {*} value The value to plant. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * function square(n) { * return n * n; * } * * var wrapped = _([1, 2]).map(square); * var other = wrapped.plant([3, 4]); * * other.value(); * // => [9, 16] * * wrapped.value(); * // => [1, 4] */ function wrapperPlant(value) { var result, parent = this; while (parent instanceof baseLodash) { var clone = wrapperClone(parent); clone.__index__ = 0; clone.__values__ = undefined; if (result) { previous.__wrapped__ = clone; } else { result = clone; } var previous = clone; parent = parent.__wrapped__; } previous.__wrapped__ = value; return result; } /** * This method is the wrapper version of `_.reverse`. * * **Note:** This method mutates the wrapped array. * * @name reverse * @memberOf _ * @since 0.1.0 * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var array = [1, 2, 3]; * * _(array).reverse().value() * // => [3, 2, 1] * * console.log(array); * // => [3, 2, 1] */ function wrapperReverse() { var value = this.__wrapped__; if (value instanceof LazyWrapper) { var wrapped = value; if (this.__actions__.length) { wrapped = new LazyWrapper(this); } wrapped = wrapped.reverse(); wrapped.__actions__.push({ 'func': thru, 'args': [reverse], 'thisArg': undefined }); return new LodashWrapper(wrapped, this.__chain__); } return this.thru(reverse); } /** * Executes the chain sequence to resolve the unwrapped value. * * @name value * @memberOf _ * @since 0.1.0 * @alias toJSON, valueOf * @category Seq * @returns {*} Returns the resolved unwrapped value. * @example * * _([1, 2, 3]).value(); * // => [1, 2, 3] */ function wrapperValue() { return baseWrapperValue(this.__wrapped__, this.__actions__); } /*------------------------------------------------------------------------*/ /** * Creates an object composed of keys generated from the results of running * each element of `collection` thru `iteratee`. The corresponding value of * each key is the number of times the key was returned by `iteratee`. The * iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 0.5.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * * _.countBy([6.1, 4.2, 6.3], Math.floor); * // => { '4': 1, '6': 2 } * * // The `_.property` iteratee shorthand. * _.countBy(['one', 'two', 'three'], 'length'); * // => { '3': 2, '5': 1 } */ var countBy = createAggregator(function(result, value, key) { if (hasOwnProperty.call(result, key)) { ++result[key]; } else { baseAssignValue(result, key, 1); } }); /** * Checks if `predicate` returns truthy for **all** elements of `collection`. * Iteration is stopped once `predicate` returns falsey. The predicate is * invoked with three arguments: (value, index|key, collection). * * **Note:** This method returns `true` for * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of * elements of empty collections. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false`. * @example * * _.every([true, 1, null, 'yes'], Boolean); * // => false * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': false } * ]; * * // The `_.matches` iteratee shorthand. * _.every(users, { 'user': 'barney', 'active': false }); * // => false * * // The `_.matchesProperty` iteratee shorthand. * _.every(users, ['active', false]); * // => true * * // The `_.property` iteratee shorthand. * _.every(users, 'active'); * // => false */ function every(collection, predicate, guard) { var func = isArray(collection) ? arrayEvery : baseEvery; if (guard && isIterateeCall(collection, predicate, guard)) { predicate = undefined; } return func(collection, getIteratee(predicate, 3)); } /** * Iterates over elements of `collection`, returning an array of all elements * `predicate` returns truthy for. The predicate is invoked with three * arguments: (value, index|key, collection). * * **Note:** Unlike `_.remove`, this method returns a new array. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the new filtered array. * @see _.reject * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false } * ]; * * _.filter(users, function(o) { return !o.active; }); * // => objects for ['fred'] * * // The `_.matches` iteratee shorthand. * _.filter(users, { 'age': 36, 'active': true }); * // => objects for ['barney'] * * // The `_.matchesProperty` iteratee shorthand. * _.filter(users, ['active', false]); * // => objects for ['fred'] * * // The `_.property` iteratee shorthand. * _.filter(users, 'active'); * // => objects for ['barney'] * * // Combining several predicates using `_.overEvery` or `_.overSome`. * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); * // => objects for ['fred', 'barney'] */ function filter(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; return func(collection, getIteratee(predicate, 3)); } /** * Iterates over elements of `collection`, returning the first element * `predicate` returns truthy for. The predicate is invoked with three * arguments: (value, index|key, collection). * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to inspect. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @param {number} [fromIndex=0] The index to search from. * @returns {*} Returns the matched element, else `undefined`. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false }, * { 'user': 'pebbles', 'age': 1, 'active': true } * ]; * * _.find(users, function(o) { return o.age < 40; }); * // => object for 'barney' * * // The `_.matches` iteratee shorthand. * _.find(users, { 'age': 1, 'active': true }); * // => object for 'pebbles' * * // The `_.matchesProperty` iteratee shorthand. * _.find(users, ['active', false]); * // => object for 'fred' * * // The `_.property` iteratee shorthand. * _.find(users, 'active'); * // => object for 'barney' */ var find = createFind(findIndex); /** * This method is like `_.find` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @since 2.0.0 * @category Collection * @param {Array|Object} collection The collection to inspect. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @param {number} [fromIndex=collection.length-1] The index to search from. * @returns {*} Returns the matched element, else `undefined`. * @example * * _.findLast([1, 2, 3, 4], function(n) { * return n % 2 == 1; * }); * // => 3 */ var findLast = createFind(findLastIndex); /** * Creates a flattened array of values by running each element in `collection` * thru `iteratee` and flattening the mapped results. The iteratee is invoked * with three arguments: (value, index|key, collection). * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the new flattened array. * @example * * function duplicate(n) { * return [n, n]; * } * * _.flatMap([1, 2], duplicate); * // => [1, 1, 2, 2] */ function flatMap(collection, iteratee) { return baseFlatten(map(collection, iteratee), 1); } /** * This method is like `_.flatMap` except that it recursively flattens the * mapped results. * * @static * @memberOf _ * @since 4.7.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the new flattened array. * @example * * function duplicate(n) { * return [[[n, n]]]; * } * * _.flatMapDeep([1, 2], duplicate); * // => [1, 1, 2, 2] */ function flatMapDeep(collection, iteratee) { return baseFlatten(map(collection, iteratee), INFINITY); } /** * This method is like `_.flatMap` except that it recursively flattens the * mapped results up to `depth` times. * * @static * @memberOf _ * @since 4.7.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {number} [depth=1] The maximum recursion depth. * @returns {Array} Returns the new flattened array. * @example * * function duplicate(n) { * return [[[n, n]]]; * } * * _.flatMapDepth([1, 2], duplicate, 2); * // => [[1, 1], [2, 2]] */ function flatMapDepth(collection, iteratee, depth) { depth = depth === undefined ? 1 : toInteger(depth); return baseFlatten(map(collection, iteratee), depth); } /** * Iterates over elements of `collection` and invokes `iteratee` for each element. * The iteratee is invoked with three arguments: (value, index|key, collection). * Iteratee functions may exit iteration early by explicitly returning `false`. * * **Note:** As with other "Collections" methods, objects with a "length" * property are iterated like arrays. To avoid this behavior use `_.forIn` * or `_.forOwn` for object iteration. * * @static * @memberOf _ * @since 0.1.0 * @alias each * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array|Object} Returns `collection`. * @see _.forEachRight * @example * * _.forEach([1, 2], function(value) { * console.log(value); * }); * // => Logs `1` then `2`. * * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { * console.log(key); * }); * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forEach(collection, iteratee) { var func = isArray(collection) ? arrayEach : baseEach; return func(collection, getIteratee(iteratee, 3)); } /** * This method is like `_.forEach` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @since 2.0.0 * @alias eachRight * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array|Object} Returns `collection`. * @see _.forEach * @example * * _.forEachRight([1, 2], function(value) { * console.log(value); * }); * // => Logs `2` then `1`. */ function forEachRight(collection, iteratee) { var func = isArray(collection) ? arrayEachRight : baseEachRight; return func(collection, getIteratee(iteratee, 3)); } /** * Creates an object composed of keys generated from the results of running * each element of `collection` thru `iteratee`. The order of grouped values * is determined by the order they occur in `collection`. The corresponding * value of each key is an array of elements responsible for generating the * key. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * * _.groupBy([6.1, 4.2, 6.3], Math.floor); * // => { '4': [4.2], '6': [6.1, 6.3] } * * // The `_.property` iteratee shorthand. * _.groupBy(['one', 'two', 'three'], 'length'); * // => { '3': ['one', 'two'], '5': ['three'] } */ var groupBy = createAggregator(function(result, value, key) { if (hasOwnProperty.call(result, key)) { result[key].push(value); } else { baseAssignValue(result, key, [value]); } }); /** * Checks if `value` is in `collection`. If `collection` is a string, it's * checked for a substring of `value`, otherwise * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * is used for equality comparisons. If `fromIndex` is negative, it's used as * the offset from the end of `collection`. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object|string} collection The collection to inspect. * @param {*} value The value to search for. * @param {number} [fromIndex=0] The index to search from. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. * @returns {boolean} Returns `true` if `value` is found, else `false`. * @example * * _.includes([1, 2, 3], 1); * // => true * * _.includes([1, 2, 3], 1, 2); * // => false * * _.includes({ 'a': 1, 'b': 2 }, 1); * // => true * * _.includes('abcd', 'bc'); * // => true */ function includes(collection, value, fromIndex, guard) { collection = isArrayLike(collection) ? collection : values(collection); fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; var length = collection.length; if (fromIndex < 0) { fromIndex = nativeMax(length + fromIndex, 0); } return isString(collection) ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) : (!!length && baseIndexOf(collection, value, fromIndex) > -1); } /** * Invokes the method at `path` of each element in `collection`, returning * an array of the results of each invoked method. Any additional arguments * are provided to each invoked method. If `path` is a function, it's invoked * for, and `this` bound to, each element in `collection`. * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Array|Function|string} path The path of the method to invoke or * the function invoked per iteration. * @param {...*} [args] The arguments to invoke each method with. * @returns {Array} Returns the array of results. * @example * * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); * // => [[1, 5, 7], [1, 2, 3]] * * _.invokeMap([123, 456], String.prototype.split, ''); * // => [['1', '2', '3'], ['4', '5', '6']] */ var invokeMap = baseRest(function(collection, path, args) { var index = -1, isFunc = typeof path == 'function', result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value) { result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); }); return result; }); /** * Creates an object composed of keys generated from the results of running * each element of `collection` thru `iteratee`. The corresponding value of * each key is the last element responsible for generating the key. The * iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * * var array = [ * { 'dir': 'left', 'code': 97 }, * { 'dir': 'right', 'code': 100 } * ]; * * _.keyBy(array, function(o) { * return String.fromCharCode(o.code); * }); * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } * * _.keyBy(array, 'dir'); * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } */ var keyBy = createAggregator(function(result, value, key) { baseAssignValue(result, key, value); }); /** * Creates an array of values by running each element in `collection` thru * `iteratee`. The iteratee is invoked with three arguments: * (value, index|key, collection). * * Many lodash methods are guarded to work as iteratees for methods like * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * * The guarded methods are: * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, * `template`, `trim`, `trimEnd`, `trimStart`, and `words` * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the new mapped array. * @example * * function square(n) { * return n * n; * } * * _.map([4, 8], square); * // => [16, 64] * * _.map({ 'a': 4, 'b': 8 }, square); * // => [16, 64] (iteration order is not guaranteed) * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * // The `_.property` iteratee shorthand. * _.map(users, 'user'); * // => ['barney', 'fred'] */ function map(collection, iteratee) { var func = isArray(collection) ? arrayMap : baseMap; return func(collection, getIteratee(iteratee, 3)); } /** * This method is like `_.sortBy` except that it allows specifying the sort * orders of the iteratees to sort by. If `orders` is unspecified, all values * are sorted in ascending order. Otherwise, specify an order of "desc" for * descending or "asc" for ascending sort order of corresponding values. * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] * The iteratees to sort by. * @param {string[]} [orders] The sort orders of `iteratees`. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 34 }, * { 'user': 'fred', 'age': 40 }, * { 'user': 'barney', 'age': 36 } * ]; * * // Sort by `user` in ascending order and by `age` in descending order. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] */ function orderBy(collection, iteratees, orders, guard) { if (collection == null) { return []; } if (!isArray(iteratees)) { iteratees = iteratees == null ? [] : [iteratees]; } orders = guard ? undefined : orders; if (!isArray(orders)) { orders = orders == null ? [] : [orders]; } return baseOrderBy(collection, iteratees, orders); } /** * Creates an array of elements split into two groups, the first of which * contains elements `predicate` returns truthy for, the second of which * contains elements `predicate` returns falsey for. The predicate is * invoked with one argument: (value). * * @static * @memberOf _ * @since 3.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the array of grouped elements. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true }, * { 'user': 'pebbles', 'age': 1, 'active': false } * ]; * * _.partition(users, function(o) { return o.active; }); * // => objects for [['fred'], ['barney', 'pebbles']] * * // The `_.matches` iteratee shorthand. * _.partition(users, { 'age': 1, 'active': false }); * // => objects for [['pebbles'], ['barney', 'fred']] * * // The `_.matchesProperty` iteratee shorthand. * _.partition(users, ['active', false]); * // => objects for [['barney', 'pebbles'], ['fred']] * * // The `_.property` iteratee shorthand. * _.partition(users, 'active'); * // => objects for [['fred'], ['barney', 'pebbles']] */ var partition = createAggregator(function(result, value, key) { result[key ? 0 : 1].push(value); }, function() { return [[], []]; }); /** * Reduces `collection` to a value which is the accumulated result of running * each element in `collection` thru `iteratee`, where each successive * invocation is supplied the return value of the previous. If `accumulator` * is not given, the first element of `collection` is used as the initial * value. The iteratee is invoked with four arguments: * (accumulator, value, index|key, collection). * * Many lodash methods are guarded to work as iteratees for methods like * `_.reduce`, `_.reduceRight`, and `_.transform`. * * The guarded methods are: * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, * and `sortBy` * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @returns {*} Returns the accumulated value. * @see _.reduceRight * @example * * _.reduce([1, 2], function(sum, n) { * return sum + n; * }, 0); * // => 3 * * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { * (result[value] || (result[value] = [])).push(key); * return result; * }, {}); * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) */ function reduce(collection, iteratee, accumulator) { var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3; return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); } /** * This method is like `_.reduce` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @returns {*} Returns the accumulated value. * @see _.reduce * @example * * var array = [[0, 1], [2, 3], [4, 5]]; * * _.reduceRight(array, function(flattened, other) { * return flattened.concat(other); * }, []); * // => [4, 5, 2, 3, 0, 1] */ function reduceRight(collection, iteratee, accumulator) { var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3; return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); } /** * The opposite of `_.filter`; this method returns the elements of `collection` * that `predicate` does **not** return truthy for. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the new filtered array. * @see _.filter * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true } * ]; * * _.reject(users, function(o) { return !o.active; }); * // => objects for ['fred'] * * // The `_.matches` iteratee shorthand. * _.reject(users, { 'age': 40, 'active': true }); * // => objects for ['barney'] * * // The `_.matchesProperty` iteratee shorthand. * _.reject(users, ['active', false]); * // => objects for ['fred'] * * // The `_.property` iteratee shorthand. * _.reject(users, 'active'); * // => objects for ['barney'] */ function reject(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; return func(collection, negate(getIteratee(predicate, 3))); } /** * Gets a random element from `collection`. * * @static * @memberOf _ * @since 2.0.0 * @category Collection * @param {Array|Object} collection The collection to sample. * @returns {*} Returns the random element. * @example * * _.sample([1, 2, 3, 4]); * // => 2 */ function sample(collection) { var func = isArray(collection) ? arraySample : baseSample; return func(collection); } /** * Gets `n` random elements at unique keys from `collection` up to the * size of `collection`. * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to sample. * @param {number} [n=1] The number of elements to sample. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the random elements. * @example * * _.sampleSize([1, 2, 3], 2); * // => [3, 1] * * _.sampleSize([1, 2, 3], 4); * // => [2, 3, 1] */ function sampleSize(collection, n, guard) { if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { n = 1; } else { n = toInteger(n); } var func = isArray(collection) ? arraySampleSize : baseSampleSize; return func(collection, n); } /** * Creates an array of shuffled values, using a version of the * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to shuffle. * @returns {Array} Returns the new shuffled array. * @example * * _.shuffle([1, 2, 3, 4]); * // => [4, 1, 3, 2] */ function shuffle(collection) { var func = isArray(collection) ? arrayShuffle : baseShuffle; return func(collection); } /** * Gets the size of `collection` by returning its length for array-like * values or the number of own enumerable string keyed properties for objects. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object|string} collection The collection to inspect. * @returns {number} Returns the collection size. * @example * * _.size([1, 2, 3]); * // => 3 * * _.size({ 'a': 1, 'b': 2 }); * // => 2 * * _.size('pebbles'); * // => 7 */ function size(collection) { if (collection == null) { return 0; } if (isArrayLike(collection)) { return isString(collection) ? stringSize(collection) : collection.length; } var tag = getTag(collection); if (tag == mapTag || tag == setTag) { return collection.size; } return baseKeys(collection).length; } /** * Checks if `predicate` returns truthy for **any** element of `collection`. * Iteration is stopped once `predicate` returns truthy. The predicate is * invoked with three arguments: (value, index|key, collection). * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. * @example * * _.some([null, 0, 'yes', false], Boolean); * // => true * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false } * ]; * * // The `_.matches` iteratee shorthand. * _.some(users, { 'user': 'barney', 'active': false }); * // => false * * // The `_.matchesProperty` iteratee shorthand. * _.some(users, ['active', false]); * // => true * * // The `_.property` iteratee shorthand. * _.some(users, 'active'); * // => true */ function some(collection, predicate, guard) { var func = isArray(collection) ? arraySome : baseSome; if (guard && isIterateeCall(collection, predicate, guard)) { predicate = undefined; } return func(collection, getIteratee(predicate, 3)); } /** * Creates an array of elements, sorted in ascending order by the results of * running each element in a collection thru each iteratee. This method * performs a stable sort, that is, it preserves the original sort order of * equal elements. The iteratees are invoked with one argument: (value). * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {...(Function|Function[])} [iteratees=[_.identity]] * The iteratees to sort by. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 30 }, * { 'user': 'barney', 'age': 34 } * ]; * * _.sortBy(users, [function(o) { return o.user; }]); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] * * _.sortBy(users, ['user', 'age']); * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] */ var sortBy = baseRest(function(collection, iteratees) { if (collection == null) { return []; } var length = iteratees.length; if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { iteratees = []; } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { iteratees = [iteratees[0]]; } return baseOrderBy(collection, baseFlatten(iteratees, 1), []); }); /*------------------------------------------------------------------------*/ /** * Gets the timestamp of the number of milliseconds that have elapsed since * the Unix epoch (1 January 1970 00:00:00 UTC). * * @static * @memberOf _ * @since 2.4.0 * @category Date * @returns {number} Returns the timestamp. * @example * * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); * // => Logs the number of milliseconds it took for the deferred invocation. */ var now = ctxNow || function() { return root.Date.now(); }; /*------------------------------------------------------------------------*/ /** * The opposite of `_.before`; this method creates a function that invokes * `func` once it's called `n` or more times. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {number} n The number of calls before `func` is invoked. * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * var saves = ['profile', 'settings']; * * var done = _.after(saves.length, function() { * console.log('done saving!'); * }); * * _.forEach(saves, function(type) { * asyncSave({ 'type': type, 'complete': done }); * }); * // => Logs 'done saving!' after the two async saves have completed. */ function after(n, func) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } n = toInteger(n); return function() { if (--n < 1) { return func.apply(this, arguments); } }; } /** * Creates a function that invokes `func`, with up to `n` arguments, * ignoring any additional arguments. * * @static * @memberOf _ * @since 3.0.0 * @category Function * @param {Function} func The function to cap arguments for. * @param {number} [n=func.length] The arity cap. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Function} Returns the new capped function. * @example * * _.map(['6', '8', '10'], _.ary(parseInt, 1)); * // => [6, 8, 10] */ function ary(func, n, guard) { n = guard ? undefined : n; n = (func && n == null) ? func.length : n; return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); } /** * Creates a function that invokes `func`, with the `this` binding and arguments * of the created function, while it's called less than `n` times. Subsequent * calls to the created function return the result of the last `func` invocation. * * @static * @memberOf _ * @since 3.0.0 * @category Function * @param {number} n The number of calls at which `func` is no longer invoked. * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * jQuery(element).on('click', _.before(5, addContactToList)); * // => Allows adding up to 4 contacts to the list. */ function before(n, func) { var result; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } n = toInteger(n); return function() { if (--n > 0) { result = func.apply(this, arguments); } if (n <= 1) { func = undefined; } return result; }; } /** * Creates a function that invokes `func` with the `this` binding of `thisArg` * and `partials` prepended to the arguments it receives. * * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for partially applied arguments. * * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" * property of bound functions. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to bind. * @param {*} thisArg The `this` binding of `func`. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * * function greet(greeting, punctuation) { * return greeting + ' ' + this.user + punctuation; * } * * var object = { 'user': 'fred' }; * * var bound = _.bind(greet, object, 'hi'); * bound('!'); * // => 'hi fred!' * * // Bound with placeholders. * var bound = _.bind(greet, object, _, '!'); * bound('hi'); * // => 'hi fred!' */ var bind = baseRest(function(func, thisArg, partials) { var bitmask = WRAP_BIND_FLAG; if (partials.length) { var holders = replaceHolders(partials, getHolder(bind)); bitmask |= WRAP_PARTIAL_FLAG; } return createWrap(func, bitmask, thisArg, partials, holders); }); /** * Creates a function that invokes the method at `object[key]` with `partials` * prepended to the arguments it receives. * * This method differs from `_.bind` by allowing bound functions to reference * methods that may be redefined or don't yet exist. See * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) * for more details. * * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * @static * @memberOf _ * @since 0.10.0 * @category Function * @param {Object} object The object to invoke the method on. * @param {string} key The key of the method. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * * var object = { * 'user': 'fred', * 'greet': function(greeting, punctuation) { * return greeting + ' ' + this.user + punctuation; * } * }; * * var bound = _.bindKey(object, 'greet', 'hi'); * bound('!'); * // => 'hi fred!' * * object.greet = function(greeting, punctuation) { * return greeting + 'ya ' + this.user + punctuation; * }; * * bound('!'); * // => 'hiya fred!' * * // Bound with placeholders. * var bound = _.bindKey(object, 'greet', _, '!'); * bound('hi'); * // => 'hiya fred!' */ var bindKey = baseRest(function(object, key, partials) { var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; if (partials.length) { var holders = replaceHolders(partials, getHolder(bindKey)); bitmask |= WRAP_PARTIAL_FLAG; } return createWrap(key, bitmask, object, partials, holders); }); /** * Creates a function that accepts arguments of `func` and either invokes * `func` returning its result, if at least `arity` number of arguments have * been provided, or returns a function that accepts the remaining `func` * arguments, and so on. The arity of `func` may be specified if `func.length` * is not sufficient. * * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for provided arguments. * * **Note:** This method doesn't set the "length" property of curried functions. * * @static * @memberOf _ * @since 2.0.0 * @category Function * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Function} Returns the new curried function. * @example * * var abc = function(a, b, c) { * return [a, b, c]; * }; * * var curried = _.curry(abc); * * curried(1)(2)(3); * // => [1, 2, 3] * * curried(1, 2)(3); * // => [1, 2, 3] * * curried(1, 2, 3); * // => [1, 2, 3] * * // Curried with placeholders. * curried(1)(_, 3)(2); * // => [1, 2, 3] */ function curry(func, arity, guard) { arity = guard ? undefined : arity; var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); result.placeholder = curry.placeholder; return result; } /** * This method is like `_.curry` except that arguments are applied to `func` * in the manner of `_.partialRight` instead of `_.partial`. * * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for provided arguments. * * **Note:** This method doesn't set the "length" property of curried functions. * * @static * @memberOf _ * @since 3.0.0 * @category Function * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Function} Returns the new curried function. * @example * * var abc = function(a, b, c) { * return [a, b, c]; * }; * * var curried = _.curryRight(abc); * * curried(3)(2)(1); * // => [1, 2, 3] * * curried(2, 3)(1); * // => [1, 2, 3] * * curried(1, 2, 3); * // => [1, 2, 3] * * // Curried with placeholders. * curried(3)(1, _)(2); * // => [1, 2, 3] */ function curryRight(func, arity, guard) { arity = guard ? undefined : arity; var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); result.placeholder = curryRight.placeholder; return result; } /** * Creates a debounced function that delays invoking `func` until after `wait` * milliseconds have elapsed since the last time the debounced function was * invoked. The debounced function comes with a `cancel` method to cancel * delayed `func` invocations and a `flush` method to immediately invoke them. * Provide `options` to indicate whether `func` should be invoked on the * leading and/or trailing edge of the `wait` timeout. The `func` is invoked * with the last arguments provided to the debounced function. Subsequent * calls to the debounced function return the result of the last `func` * invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the debounced function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until to the next tick, similar to `setTimeout` with a timeout of `0`. * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.debounce` and `_.throttle`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to debounce. * @param {number} [wait=0] The number of milliseconds to delay. * @param {Object} [options={}] The options object. * @param {boolean} [options.leading=false] * Specify invoking on the leading edge of the timeout. * @param {number} [options.maxWait] * The maximum time `func` is allowed to be delayed before it's invoked. * @param {boolean} [options.trailing=true] * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new debounced function. * @example * * // Avoid costly calculations while the window size is in flux. * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); * * // Invoke `sendMail` when clicked, debouncing subsequent calls. * jQuery(element).on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * })); * * // Ensure `batchLog` is invoked once after 1 second of debounced calls. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); * var source = new EventSource('/stream'); * jQuery(source).on('message', debounced); * * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ function debounce(func, wait, options) { var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } wait = toNumber(wait) || 0; if (isObject(options)) { leading = !!options.leading; maxing = 'maxWait' in options; maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; trailing = 'trailing' in options ? !!options.trailing : trailing; } function invokeFunc(time) { var args = lastArgs, thisArg = lastThis; lastArgs = lastThis = undefined; lastInvokeTime = time; result = func.apply(thisArg, args); return result; } function leadingEdge(time) { // Reset any `maxWait` timer. lastInvokeTime = time; // Start the timer for the trailing edge. timerId = setTimeout(timerExpired, wait); // Invoke the leading edge. return leading ? invokeFunc(time) : result; } function remainingWait(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; } function shouldInvoke(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { var time = now(); if (shouldInvoke(time)) { return trailingEdge(time); } // Restart the timer. timerId = setTimeout(timerExpired, remainingWait(time)); } function trailingEdge(time) { timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been // debounced at least once. if (trailing && lastArgs) { return invokeFunc(time); } lastArgs = lastThis = undefined; return result; } function cancel() { if (timerId !== undefined) { clearTimeout(timerId); } lastInvokeTime = 0; lastArgs = lastCallTime = lastThis = timerId = undefined; } function flush() { return timerId === undefined ? result : trailingEdge(now()); } function debounced() { var time = now(), isInvoking = shouldInvoke(time); lastArgs = arguments; lastThis = this; lastCallTime = time; if (isInvoking) { if (timerId === undefined) { return leadingEdge(lastCallTime); } if (maxing) { // Handle invocations in a tight loop. clearTimeout(timerId); timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } } if (timerId === undefined) { timerId = setTimeout(timerExpired, wait); } return result; } debounced.cancel = cancel; debounced.flush = flush; return debounced; } /** * Defers invoking the `func` until the current call stack has cleared. Any * additional arguments are provided to `func` when it's invoked. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to defer. * @param {...*} [args] The arguments to invoke `func` with. * @returns {number} Returns the timer id. * @example * * _.defer(function(text) { * console.log(text); * }, 'deferred'); * // => Logs 'deferred' after one millisecond. */ var defer = baseRest(function(func, args) { return baseDelay(func, 1, args); }); /** * Invokes `func` after `wait` milliseconds. Any additional arguments are * provided to `func` when it's invoked. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. * @param {...*} [args] The arguments to invoke `func` with. * @returns {number} Returns the timer id. * @example * * _.delay(function(text) { * console.log(text); * }, 1000, 'later'); * // => Logs 'later' after one second. */ var delay = baseRest(function(func, wait, args) { return baseDelay(func, toNumber(wait) || 0, args); }); /** * Creates a function that invokes `func` with arguments reversed. * * @static * @memberOf _ * @since 4.0.0 * @category Function * @param {Function} func The function to flip arguments for. * @returns {Function} Returns the new flipped function. * @example * * var flipped = _.flip(function() { * return _.toArray(arguments); * }); * * flipped('a', 'b', 'c', 'd'); * // => ['d', 'c', 'b', 'a'] */ function flip(func) { return createWrap(func, WRAP_FLIP_FLAG); } /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `clear`, `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoized function. * @example * * var object = { 'a': 1, 'b': 2 }; * var other = { 'c': 3, 'd': 4 }; * * var values = _.memoize(_.values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * * // Replace `_.memoize.Cache`. * _.memoize.Cache = WeakMap; */ function memoize(func, resolver) { if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); memoized.cache = cache.set(key, result) || cache; return result; }; memoized.cache = new (memoize.Cache || MapCache); return memoized; } // Expose `MapCache`. memoize.Cache = MapCache; /** * Creates a function that negates the result of the predicate `func`. The * `func` predicate is invoked with the `this` binding and arguments of the * created function. * * @static * @memberOf _ * @since 3.0.0 * @category Function * @param {Function} predicate The predicate to negate. * @returns {Function} Returns the new negated function. * @example * * function isEven(n) { * return n % 2 == 0; * } * * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); * // => [1, 3, 5] */ function negate(predicate) { if (typeof predicate != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return function() { var args = arguments; switch (args.length) { case 0: return !predicate.call(this); case 1: return !predicate.call(this, args[0]); case 2: return !predicate.call(this, args[0], args[1]); case 3: return !predicate.call(this, args[0], args[1], args[2]); } return !predicate.apply(this, args); }; } /** * Creates a function that is restricted to invoking `func` once. Repeat calls * to the function return the value of the first invocation. The `func` is * invoked with the `this` binding and arguments of the created function. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * var initialize = _.once(createApplication); * initialize(); * initialize(); * // => `createApplication` is invoked once */ function once(func) { return before(2, func); } /** * Creates a function that invokes `func` with its arguments transformed. * * @static * @since 4.0.0 * @memberOf _ * @category Function * @param {Function} func The function to wrap. * @param {...(Function|Function[])} [transforms=[_.identity]] * The argument transforms. * @returns {Function} Returns the new function. * @example * * function doubled(n) { * return n * 2; * } * * function square(n) { * return n * n; * } * * var func = _.overArgs(function(x, y) { * return [x, y]; * }, [square, doubled]); * * func(9, 3); * // => [81, 6] * * func(10, 5); * // => [100, 10] */ var overArgs = castRest(function(func, transforms) { transforms = (transforms.length == 1 && isArray(transforms[0])) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); var funcsLength = transforms.length; return baseRest(function(args) { var index = -1, length = nativeMin(args.length, funcsLength); while (++index < length) { args[index] = transforms[index].call(this, args[index]); } return apply(func, this, args); }); }); /** * Creates a function that invokes `func` with `partials` prepended to the * arguments it receives. This method is like `_.bind` except it does **not** * alter the `this` binding. * * The `_.partial.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * **Note:** This method doesn't set the "length" property of partially * applied functions. * * @static * @memberOf _ * @since 0.2.0 * @category Function * @param {Function} func The function to partially apply arguments to. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * * function greet(greeting, name) { * return greeting + ' ' + name; * } * * var sayHelloTo = _.partial(greet, 'hello'); * sayHelloTo('fred'); * // => 'hello fred' * * // Partially applied with placeholders. * var greetFred = _.partial(greet, _, 'fred'); * greetFred('hi'); * // => 'hi fred' */ var partial = baseRest(function(func, partials) { var holders = replaceHolders(partials, getHolder(partial)); return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); }); /** * This method is like `_.partial` except that partially applied arguments * are appended to the arguments it receives. * * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * **Note:** This method doesn't set the "length" property of partially * applied functions. * * @static * @memberOf _ * @since 1.0.0 * @category Function * @param {Function} func The function to partially apply arguments to. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * * function greet(greeting, name) { * return greeting + ' ' + name; * } * * var greetFred = _.partialRight(greet, 'fred'); * greetFred('hi'); * // => 'hi fred' * * // Partially applied with placeholders. * var sayHelloTo = _.partialRight(greet, 'hello', _); * sayHelloTo('fred'); * // => 'hello fred' */ var partialRight = baseRest(function(func, partials) { var holders = replaceHolders(partials, getHolder(partialRight)); return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); }); /** * Creates a function that invokes `func` with arguments arranged according * to the specified `indexes` where the argument value at the first index is * provided as the first argument, the argument value at the second index is * provided as the second argument, and so on. * * @static * @memberOf _ * @since 3.0.0 * @category Function * @param {Function} func The function to rearrange arguments for. * @param {...(number|number[])} indexes The arranged argument indexes. * @returns {Function} Returns the new function. * @example * * var rearged = _.rearg(function(a, b, c) { * return [a, b, c]; * }, [2, 0, 1]); * * rearged('b', 'c', 'a') * // => ['a', 'b', 'c'] */ var rearg = flatRest(function(func, indexes) { return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); }); /** * Creates a function that invokes `func` with the `this` binding of the * created function and arguments from `start` and beyond provided as * an array. * * **Note:** This method is based on the * [rest parameter](https://mdn.io/rest_parameters). * * @static * @memberOf _ * @since 4.0.0 * @category Function * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @returns {Function} Returns the new function. * @example * * var say = _.rest(function(what, names) { * return what + ' ' + _.initial(names).join(', ') + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); * }); * * say('hello', 'fred', 'barney', 'pebbles'); * // => 'hello fred, barney, & pebbles' */ function rest(func, start) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } start = start === undefined ? start : toInteger(start); return baseRest(func, start); } /** * Creates a function that invokes `func` with the `this` binding of the * create function and an array of arguments much like * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). * * **Note:** This method is based on the * [spread operator](https://mdn.io/spread_operator). * * @static * @memberOf _ * @since 3.2.0 * @category Function * @param {Function} func The function to spread arguments over. * @param {number} [start=0] The start position of the spread. * @returns {Function} Returns the new function. * @example * * var say = _.spread(function(who, what) { * return who + ' says ' + what; * }); * * say(['fred', 'hello']); * // => 'fred says hello' * * var numbers = Promise.all([ * Promise.resolve(40), * Promise.resolve(36) * ]); * * numbers.then(_.spread(function(x, y) { * return x + y; * })); * // => a Promise of 76 */ function spread(func, start) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } start = start == null ? 0 : nativeMax(toInteger(start), 0); return baseRest(function(args) { var array = args[start], otherArgs = castSlice(args, 0, start); if (array) { arrayPush(otherArgs, array); } return apply(func, this, otherArgs); }); } /** * Creates a throttled function that only invokes `func` at most once per * every `wait` milliseconds. The throttled function comes with a `cancel` * method to cancel delayed `func` invocations and a `flush` method to * immediately invoke them. Provide `options` to indicate whether `func` * should be invoked on the leading and/or trailing edge of the `wait` * timeout. The `func` is invoked with the last arguments provided to the * throttled function. Subsequent calls to the throttled function return the * result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the throttled function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until to the next tick, similar to `setTimeout` with a timeout of `0`. * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.throttle` and `_.debounce`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to throttle. * @param {number} [wait=0] The number of milliseconds to throttle invocations to. * @param {Object} [options={}] The options object. * @param {boolean} [options.leading=true] * Specify invoking on the leading edge of the timeout. * @param {boolean} [options.trailing=true] * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new throttled function. * @example * * // Avoid excessively updating the position while scrolling. * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); * * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); * jQuery(element).on('click', throttled); * * // Cancel the trailing throttled invocation. * jQuery(window).on('popstate', throttled.cancel); */ function throttle(func, wait, options) { var leading = true, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } if (isObject(options)) { leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing }); } /** * Creates a function that accepts up to one argument, ignoring any * additional arguments. * * @static * @memberOf _ * @since 4.0.0 * @category Function * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new capped function. * @example * * _.map(['6', '8', '10'], _.unary(parseInt)); * // => [6, 8, 10] */ function unary(func) { return ary(func, 1); } /** * Creates a function that provides `value` to `wrapper` as its first * argument. Any additional arguments provided to the function are appended * to those provided to the `wrapper`. The wrapper is invoked with the `this` * binding of the created function. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {*} value The value to wrap. * @param {Function} [wrapper=identity] The wrapper function. * @returns {Function} Returns the new function. * @example * * var p = _.wrap(_.escape, function(func, text) { * return '<p>' + func(text) + '</p>'; * }); * * p('fred, barney, & pebbles'); * // => '<p>fred, barney, & pebbles</p>' */ function wrap(value, wrapper) { return partial(castFunction(wrapper), value); } /*------------------------------------------------------------------------*/ /** * Casts `value` as an array if it's not one. * * @static * @memberOf _ * @since 4.4.0 * @category Lang * @param {*} value The value to inspect. * @returns {Array} Returns the cast array. * @example * * _.castArray(1); * // => [1] * * _.castArray({ 'a': 1 }); * // => [{ 'a': 1 }] * * _.castArray('abc'); * // => ['abc'] * * _.castArray(null); * // => [null] * * _.castArray(undefined); * // => [undefined] * * _.castArray(); * // => [] * * var array = [1, 2, 3]; * console.log(_.castArray(array) === array); * // => true */ function castArray() { if (!arguments.length) { return []; } var value = arguments[0]; return isArray(value) ? value : [value]; } /** * Creates a shallow clone of `value`. * * **Note:** This method is loosely based on the * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) * and supports cloning arrays, array buffers, booleans, date objects, maps, * numbers, `Object` objects, regexes, sets, strings, symbols, and typed * arrays. The own enumerable properties of `arguments` objects are cloned * as plain objects. An empty object is returned for uncloneable values such * as error objects, functions, DOM nodes, and WeakMaps. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to clone. * @returns {*} Returns the cloned value. * @see _.cloneDeep * @example * * var objects = [{ 'a': 1 }, { 'b': 2 }]; * * var shallow = _.clone(objects); * console.log(shallow[0] === objects[0]); * // => true */ function clone(value) { return baseClone(value, CLONE_SYMBOLS_FLAG); } /** * This method is like `_.clone` except that it accepts `customizer` which * is invoked to produce the cloned value. If `customizer` returns `undefined`, * cloning is handled by the method instead. The `customizer` is invoked with * up to four arguments; (value [, index|key, object, stack]). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to clone. * @param {Function} [customizer] The function to customize cloning. * @returns {*} Returns the cloned value. * @see _.cloneDeepWith * @example * * function customizer(value) { * if (_.isElement(value)) { * return value.cloneNode(false); * } * } * * var el = _.cloneWith(document.body, customizer); * * console.log(el === document.body); * // => false * console.log(el.nodeName); * // => 'BODY' * console.log(el.childNodes.length); * // => 0 */ function cloneWith(value, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); } /** * This method is like `_.clone` except that it recursively clones `value`. * * @static * @memberOf _ * @since 1.0.0 * @category Lang * @param {*} value The value to recursively clone. * @returns {*} Returns the deep cloned value. * @see _.clone * @example * * var objects = [{ 'a': 1 }, { 'b': 2 }]; * * var deep = _.cloneDeep(objects); * console.log(deep[0] === objects[0]); * // => false */ function cloneDeep(value) { return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); } /** * This method is like `_.cloneWith` except that it recursively clones `value`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to recursively clone. * @param {Function} [customizer] The function to customize cloning. * @returns {*} Returns the deep cloned value. * @see _.cloneWith * @example * * function customizer(value) { * if (_.isElement(value)) { * return value.cloneNode(true); * } * } * * var el = _.cloneDeepWith(document.body, customizer); * * console.log(el === document.body); * // => false * console.log(el.nodeName); * // => 'BODY' * console.log(el.childNodes.length); * // => 20 */ function cloneDeepWith(value, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); } /** * Checks if `object` conforms to `source` by invoking the predicate * properties of `source` with the corresponding property values of `object`. * * **Note:** This method is equivalent to `_.conforms` when `source` is * partially applied. * * @static * @memberOf _ * @since 4.14.0 * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property predicates to conform to. * @returns {boolean} Returns `true` if `object` conforms, else `false`. * @example * * var object = { 'a': 1, 'b': 2 }; * * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); * // => true * * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); * // => false */ function conformsTo(object, source) { return source == null || baseConformsTo(object, source, keys(source)); } /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } /** * Checks if `value` is greater than `other`. * * @static * @memberOf _ * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is greater than `other`, * else `false`. * @see _.lt * @example * * _.gt(3, 1); * // => true * * _.gt(3, 3); * // => false * * _.gt(1, 3); * // => false */ var gt = createRelationalOperation(baseGt); /** * Checks if `value` is greater than or equal to `other`. * * @static * @memberOf _ * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is greater than or equal to * `other`, else `false`. * @see _.lte * @example * * _.gte(3, 1); * // => true * * _.gte(3, 3); * // => true * * _.gte(1, 3); * // => false */ var gte = createRelationalOperation(function(value, other) { return value >= other; }); /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); }; /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; /** * Checks if `value` is classified as an `ArrayBuffer` object. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. * @example * * _.isArrayBuffer(new ArrayBuffer(2)); * // => true * * _.isArrayBuffer(new Array(2)); * // => false */ var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } /** * Checks if `value` is classified as a boolean primitive or object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. * @example * * _.isBoolean(false); * // => true * * _.isBoolean(null); * // => false */ function isBoolean(value) { return value === true || value === false || (isObjectLike(value) && baseGetTag(value) == boolTag); } /** * Checks if `value` is a buffer. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. * @example * * _.isBuffer(new Buffer(2)); * // => true * * _.isBuffer(new Uint8Array(2)); * // => false */ var isBuffer = nativeIsBuffer || stubFalse; /** * Checks if `value` is classified as a `Date` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a date object, else `false`. * @example * * _.isDate(new Date); * // => true * * _.isDate('Mon April 23 2012'); * // => false */ var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; /** * Checks if `value` is likely a DOM element. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. * @example * * _.isElement(document.body); * // => true * * _.isElement('<body>'); * // => false */ function isElement(value) { return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); } /** * Checks if `value` is an empty object, collection, map, or set. * * Objects are considered empty if they have no own enumerable string keyed * properties. * * Array-like values such as `arguments` objects, arrays, buffers, strings, or * jQuery-like collections are considered empty if they have a `length` of `0`. * Similarly, maps and sets are considered empty if they have a `size` of `0`. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is empty, else `false`. * @example * * _.isEmpty(null); * // => true * * _.isEmpty(true); * // => true * * _.isEmpty(1); * // => true * * _.isEmpty([1, 2, 3]); * // => false * * _.isEmpty({ 'a': 1 }); * // => false */ function isEmpty(value) { if (value == null) { return true; } if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); if (tag == mapTag || tag == setTag) { return !value.size; } if (isPrototype(value)) { return !baseKeys(value).length; } for (var key in value) { if (hasOwnProperty.call(value, key)) { return false; } } return true; } /** * Performs a deep comparison between two values to determine if they are * equivalent. * * **Note:** This method supports comparing arrays, array buffers, booleans, * date objects, error objects, maps, numbers, `Object` objects, regexes, * sets, strings, symbols, and typed arrays. `Object` objects are compared * by their own, not inherited, enumerable properties. Functions and DOM * nodes are compared by strict equality, i.e. `===`. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.isEqual(object, other); * // => true * * object === other; * // => false */ function isEqual(value, other) { return baseIsEqual(value, other); } /** * This method is like `_.isEqual` except that it accepts `customizer` which * is invoked to compare values. If `customizer` returns `undefined`, comparisons * are handled by the method instead. The `customizer` is invoked with up to * six arguments: (objValue, othValue [, index|key, object, other, stack]). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * function isGreeting(value) { * return /^h(?:i|ello)$/.test(value); * } * * function customizer(objValue, othValue) { * if (isGreeting(objValue) && isGreeting(othValue)) { * return true; * } * } * * var array = ['hello', 'goodbye']; * var other = ['hi', 'goodbye']; * * _.isEqualWith(array, other, customizer); * // => true */ function isEqualWith(value, other, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; var result = customizer ? customizer(value, other) : undefined; return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; } /** * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, * `SyntaxError`, `TypeError`, or `URIError` object. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an error object, else `false`. * @example * * _.isError(new Error); * // => true * * _.isError(Error); * // => false */ function isError(value) { if (!isObjectLike(value)) { return false; } var tag = baseGetTag(value); return tag == errorTag || tag == domExcTag || (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); } /** * Checks if `value` is a finite primitive number. * * **Note:** This method is based on * [`Number.isFinite`](https://mdn.io/Number/isFinite). * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. * @example * * _.isFinite(3); * // => true * * _.isFinite(Number.MIN_VALUE); * // => true * * _.isFinite(Infinity); * // => false * * _.isFinite('3'); * // => false */ function isFinite(value) { return typeof value == 'number' && nativeIsFinite(value); } /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { if (!isObject(value)) { return false; } // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 9 which returns 'object' for typed arrays and other constructors. var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } /** * Checks if `value` is an integer. * * **Note:** This method is based on * [`Number.isInteger`](https://mdn.io/Number/isInteger). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an integer, else `false`. * @example * * _.isInteger(3); * // => true * * _.isInteger(Number.MIN_VALUE); * // => false * * _.isInteger(Infinity); * // => false * * _.isInteger('3'); * // => false */ function isInteger(value) { return typeof value == 'number' && value == toInteger(value); } /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return value != null && typeof value == 'object'; } /** * Checks if `value` is classified as a `Map` object. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a map, else `false`. * @example * * _.isMap(new Map); * // => true * * _.isMap(new WeakMap); * // => false */ var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; /** * Performs a partial deep comparison between `object` and `source` to * determine if `object` contains equivalent property values. * * **Note:** This method is equivalent to `_.matches` when `source` is * partially applied. * * Partial comparisons will match empty array and empty object `source` * values against any array or object value, respectively. See `_.isEqual` * for a list of supported value comparisons. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @returns {boolean} Returns `true` if `object` is a match, else `false`. * @example * * var object = { 'a': 1, 'b': 2 }; * * _.isMatch(object, { 'b': 2 }); * // => true * * _.isMatch(object, { 'b': 1 }); * // => false */ function isMatch(object, source) { return object === source || baseIsMatch(object, source, getMatchData(source)); } /** * This method is like `_.isMatch` except that it accepts `customizer` which * is invoked to compare values. If `customizer` returns `undefined`, comparisons * are handled by the method instead. The `customizer` is invoked with five * arguments: (objValue, srcValue, index|key, object, source). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. * @example * * function isGreeting(value) { * return /^h(?:i|ello)$/.test(value); * } * * function customizer(objValue, srcValue) { * if (isGreeting(objValue) && isGreeting(srcValue)) { * return true; * } * } * * var object = { 'greeting': 'hello' }; * var source = { 'greeting': 'hi' }; * * _.isMatchWith(object, source, customizer); * // => true */ function isMatchWith(object, source, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; return baseIsMatch(object, source, getMatchData(source), customizer); } /** * Checks if `value` is `NaN`. * * **Note:** This method is based on * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for * `undefined` and other non-number values. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. * @example * * _.isNaN(NaN); * // => true * * _.isNaN(new Number(NaN)); * // => true * * isNaN(undefined); * // => true * * _.isNaN(undefined); * // => false */ function isNaN(value) { // An `NaN` primitive is the only value that is not equal to itself. // Perform the `toStringTag` check first to avoid errors with some // ActiveX objects in IE. return isNumber(value) && value != +value; } /** * Checks if `value` is a pristine native function. * * **Note:** This method can't reliably detect native functions in the presence * of the core-js package because core-js circumvents this kind of detection. * Despite multiple requests, the core-js maintainer has made it clear: any * attempt to fix the detection will be obstructed. As a result, we're left * with little choice but to throw an error. Unfortunately, this also affects * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), * which rely on core-js. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. * @example * * _.isNative(Array.prototype.push); * // => true * * _.isNative(_); * // => false */ function isNative(value) { if (isMaskable(value)) { throw new Error(CORE_ERROR_TEXT); } return baseIsNative(value); } /** * Checks if `value` is `null`. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `null`, else `false`. * @example * * _.isNull(null); * // => true * * _.isNull(void 0); * // => false */ function isNull(value) { return value === null; } /** * Checks if `value` is `null` or `undefined`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is nullish, else `false`. * @example * * _.isNil(null); * // => true * * _.isNil(void 0); * // => true * * _.isNil(NaN); * // => false */ function isNil(value) { return value == null; } /** * Checks if `value` is classified as a `Number` primitive or object. * * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are * classified as numbers, use the `_.isFinite` method. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a number, else `false`. * @example * * _.isNumber(3); * // => true * * _.isNumber(Number.MIN_VALUE); * // => true * * _.isNumber(Infinity); * // => true * * _.isNumber('3'); * // => false */ function isNumber(value) { return typeof value == 'number' || (isObjectLike(value) && baseGetTag(value) == numberTag); } /** * Checks if `value` is a plain object, that is, an object created by the * `Object` constructor or one with a `[[Prototype]]` of `null`. * * @static * @memberOf _ * @since 0.8.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Foo() { * this.a = 1; * } * * _.isPlainObject(new Foo); * // => false * * _.isPlainObject([1, 2, 3]); * // => false * * _.isPlainObject({ 'x': 0, 'y': 0 }); * // => true * * _.isPlainObject(Object.create(null)); * // => true */ function isPlainObject(value) { if (!isObjectLike(value) || baseGetTag(value) != objectTag) { return false; } var proto = getPrototype(value); if (proto === null) { return true; } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; } /** * Checks if `value` is classified as a `RegExp` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. * @example * * _.isRegExp(/abc/); * // => true * * _.isRegExp('/abc/'); * // => false */ var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; /** * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 * double precision number which isn't the result of a rounded unsafe integer. * * **Note:** This method is based on * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. * @example * * _.isSafeInteger(3); * // => true * * _.isSafeInteger(Number.MIN_VALUE); * // => false * * _.isSafeInteger(Infinity); * // => false * * _.isSafeInteger('3'); * // => false */ function isSafeInteger(value) { return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is classified as a `Set` object. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a set, else `false`. * @example * * _.isSet(new Set); * // => true * * _.isSet(new WeakSet); * // => false */ var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; /** * Checks if `value` is classified as a `String` primitive or object. * * @static * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a string, else `false`. * @example * * _.isString('abc'); * // => true * * _.isString(1); * // => false */ function isString(value) { return typeof value == 'string' || (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); } /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && baseGetTag(value) == symbolTag); } /** * Checks if `value` is classified as a typed array. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. * @example * * _.isTypedArray(new Uint8Array); * // => true * * _.isTypedArray([]); * // => false */ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; /** * Checks if `value` is `undefined`. * * @static * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. * @example * * _.isUndefined(void 0); * // => true * * _.isUndefined(null); * // => false */ function isUndefined(value) { return value === undefined; } /** * Checks if `value` is classified as a `WeakMap` object. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. * @example * * _.isWeakMap(new WeakMap); * // => true * * _.isWeakMap(new Map); * // => false */ function isWeakMap(value) { return isObjectLike(value) && getTag(value) == weakMapTag; } /** * Checks if `value` is classified as a `WeakSet` object. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. * @example * * _.isWeakSet(new WeakSet); * // => true * * _.isWeakSet(new Set); * // => false */ function isWeakSet(value) { return isObjectLike(value) && baseGetTag(value) == weakSetTag; } /** * Checks if `value` is less than `other`. * * @static * @memberOf _ * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is less than `other`, * else `false`. * @see _.gt * @example * * _.lt(1, 3); * // => true * * _.lt(3, 3); * // => false * * _.lt(3, 1); * // => false */ var lt = createRelationalOperation(baseLt); /** * Checks if `value` is less than or equal to `other`. * * @static * @memberOf _ * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is less than or equal to * `other`, else `false`. * @see _.gte * @example * * _.lte(1, 3); * // => true * * _.lte(3, 3); * // => true * * _.lte(3, 1); * // => false */ var lte = createRelationalOperation(function(value, other) { return value <= other; }); /** * Converts `value` to an array. * * @static * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {Array} Returns the converted array. * @example * * _.toArray({ 'a': 1, 'b': 2 }); * // => [1, 2] * * _.toArray('abc'); * // => ['a', 'b', 'c'] * * _.toArray(1); * // => [] * * _.toArray(null); * // => [] */ function toArray(value) { if (!value) { return []; } if (isArrayLike(value)) { return isString(value) ? stringToArray(value) : copyArray(value); } if (symIterator && value[symIterator]) { return iteratorToArray(value[symIterator]()); } var tag = getTag(value), func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); return func(value); } /** * Converts `value` to a finite number. * * @static * @memberOf _ * @since 4.12.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted number. * @example * * _.toFinite(3.2); * // => 3.2 * * _.toFinite(Number.MIN_VALUE); * // => 5e-324 * * _.toFinite(Infinity); * // => 1.7976931348623157e+308 * * _.toFinite('3.2'); * // => 3.2 */ function toFinite(value) { if (!value) { return value === 0 ? value : 0; } value = toNumber(value); if (value === INFINITY || value === -INFINITY) { var sign = (value < 0 ? -1 : 1); return sign * MAX_INTEGER; } return value === value ? value : 0; } /** * Converts `value` to an integer. * * **Note:** This method is loosely based on * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toInteger(3.2); * // => 3 * * _.toInteger(Number.MIN_VALUE); * // => 0 * * _.toInteger(Infinity); * // => 1.7976931348623157e+308 * * _.toInteger('3.2'); * // => 3 */ function toInteger(value) { var result = toFinite(value), remainder = result % 1; return result === result ? (remainder ? result - remainder : result) : 0; } /** * Converts `value` to an integer suitable for use as the length of an * array-like object. * * **Note:** This method is based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toLength(3.2); * // => 3 * * _.toLength(Number.MIN_VALUE); * // => 0 * * _.toLength(Infinity); * // => 4294967295 * * _.toLength('3.2'); * // => 3 */ function toLength(value) { return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; } /** * Converts `value` to a number. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * * _.toNumber(3.2); * // => 3.2 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 * * _.toNumber(Infinity); * // => Infinity * * _.toNumber('3.2'); * // => 3.2 */ function toNumber(value) { if (typeof value == 'number') { return value; } if (isSymbol(value)) { return NAN; } if (isObject(value)) { var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { return value === 0 ? value : +value; } value = baseTrim(value); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : (reIsBadHex.test(value) ? NAN : +value); } /** * Converts `value` to a plain object flattening inherited enumerable string * keyed properties of `value` to own properties of the plain object. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to convert. * @returns {Object} Returns the converted plain object. * @example * * function Foo() { * this.b = 2; * } * * Foo.prototype.c = 3; * * _.assign({ 'a': 1 }, new Foo); * // => { 'a': 1, 'b': 2 } * * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); * // => { 'a': 1, 'b': 2, 'c': 3 } */ function toPlainObject(value) { return copyObject(value, keysIn(value)); } /** * Converts `value` to a safe integer. A safe integer can be compared and * represented correctly. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toSafeInteger(3.2); * // => 3 * * _.toSafeInteger(Number.MIN_VALUE); * // => 0 * * _.toSafeInteger(Infinity); * // => 9007199254740991 * * _.toSafeInteger('3.2'); * // => 3 */ function toSafeInteger(value) { return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : (value === 0 ? value : 0); } /** * Converts `value` to a string. An empty string is returned for `null` * and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {string} Returns the converted string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { return value == null ? '' : baseToString(value); } /*------------------------------------------------------------------------*/ /** * Assigns own enumerable string keyed properties of source objects to the * destination object. Source objects are applied from left to right. * Subsequent sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object` and is loosely based on * [`Object.assign`](https://mdn.io/Object/assign). * * @static * @memberOf _ * @since 0.10.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @see _.assignIn * @example * * function Foo() { * this.a = 1; * } * * function Bar() { * this.c = 3; * } * * Foo.prototype.b = 2; * Bar.prototype.d = 4; * * _.assign({ 'a': 0 }, new Foo, new Bar); * // => { 'a': 1, 'c': 3 } */ var assign = createAssigner(function(object, source) { if (isPrototype(source) || isArrayLike(source)) { copyObject(source, keys(source), object); return; } for (var key in source) { if (hasOwnProperty.call(source, key)) { assignValue(object, key, source[key]); } } }); /** * This method is like `_.assign` except that it iterates over own and * inherited source properties. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.0.0 * @alias extend * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @see _.assign * @example * * function Foo() { * this.a = 1; * } * * function Bar() { * this.c = 3; * } * * Foo.prototype.b = 2; * Bar.prototype.d = 4; * * _.assignIn({ 'a': 0 }, new Foo, new Bar); * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } */ var assignIn = createAssigner(function(object, source) { copyObject(source, keysIn(source), object); }); /** * This method is like `_.assignIn` except that it accepts `customizer` * which is invoked to produce the assigned values. If `customizer` returns * `undefined`, assignment is handled by the method instead. The `customizer` * is invoked with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.0.0 * @alias extendWith * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @see _.assignWith * @example * * function customizer(objValue, srcValue) { * return _.isUndefined(objValue) ? srcValue : objValue; * } * * var defaults = _.partialRight(_.assignInWith, customizer); * * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } */ var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { copyObject(source, keysIn(source), object, customizer); }); /** * This method is like `_.assign` except that it accepts `customizer` * which is invoked to produce the assigned values. If `customizer` returns * `undefined`, assignment is handled by the method instead. The `customizer` * is invoked with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @see _.assignInWith * @example * * function customizer(objValue, srcValue) { * return _.isUndefined(objValue) ? srcValue : objValue; * } * * var defaults = _.partialRight(_.assignWith, customizer); * * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } */ var assignWith = createAssigner(function(object, source, srcIndex, customizer) { copyObject(source, keys(source), object, customizer); }); /** * Creates an array of values corresponding to `paths` of `object`. * * @static * @memberOf _ * @since 1.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {...(string|string[])} [paths] The property paths to pick. * @returns {Array} Returns the picked values. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; * * _.at(object, ['a[0].b.c', 'a[1]']); * // => [3, 4] */ var at = flatRest(baseAt); /** * Creates an object that inherits from the `prototype` object. If a * `properties` object is given, its own enumerable string keyed properties * are assigned to the created object. * * @static * @memberOf _ * @since 2.3.0 * @category Object * @param {Object} prototype The object to inherit from. * @param {Object} [properties] The properties to assign to the object. * @returns {Object} Returns the new object. * @example * * function Shape() { * this.x = 0; * this.y = 0; * } * * function Circle() { * Shape.call(this); * } * * Circle.prototype = _.create(Shape.prototype, { * 'constructor': Circle * }); * * var circle = new Circle; * circle instanceof Circle; * // => true * * circle instanceof Shape; * // => true */ function create(prototype, properties) { var result = baseCreate(prototype); return properties == null ? result : baseAssign(result, properties); } /** * Assigns own and inherited enumerable string keyed properties of source * objects to the destination object for all destination properties that * resolve to `undefined`. Source objects are applied from left to right. * Once a property is set, additional values of the same property are ignored. * * **Note:** This method mutates `object`. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @see _.defaultsDeep * @example * * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } */ var defaults = baseRest(function(object, sources) { object = Object(object); var index = -1; var length = sources.length; var guard = length > 2 ? sources[2] : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { length = 1; } while (++index < length) { var source = sources[index]; var props = keysIn(source); var propsIndex = -1; var propsLength = props.length; while (++propsIndex < propsLength) { var key = props[propsIndex]; var value = object[key]; if (value === undefined || (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { object[key] = source[key]; } } } return object; }); /** * This method is like `_.defaults` except that it recursively assigns * default properties. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 3.10.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @see _.defaults * @example * * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); * // => { 'a': { 'b': 2, 'c': 3 } } */ var defaultsDeep = baseRest(function(args) { args.push(undefined, customDefaultsMerge); return apply(mergeWith, undefined, args); }); /** * This method is like `_.find` except that it returns the key of the first * element `predicate` returns truthy for instead of the element itself. * * @static * @memberOf _ * @since 1.1.0 * @category Object * @param {Object} object The object to inspect. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {string|undefined} Returns the key of the matched element, * else `undefined`. * @example * * var users = { * 'barney': { 'age': 36, 'active': true }, * 'fred': { 'age': 40, 'active': false }, * 'pebbles': { 'age': 1, 'active': true } * }; * * _.findKey(users, function(o) { return o.age < 40; }); * // => 'barney' (iteration order is not guaranteed) * * // The `_.matches` iteratee shorthand. * _.findKey(users, { 'age': 1, 'active': true }); * // => 'pebbles' * * // The `_.matchesProperty` iteratee shorthand. * _.findKey(users, ['active', false]); * // => 'fred' * * // The `_.property` iteratee shorthand. * _.findKey(users, 'active'); * // => 'barney' */ function findKey(object, predicate) { return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); } /** * This method is like `_.findKey` except that it iterates over elements of * a collection in the opposite order. * * @static * @memberOf _ * @since 2.0.0 * @category Object * @param {Object} object The object to inspect. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {string|undefined} Returns the key of the matched element, * else `undefined`. * @example * * var users = { * 'barney': { 'age': 36, 'active': true }, * 'fred': { 'age': 40, 'active': false }, * 'pebbles': { 'age': 1, 'active': true } * }; * * _.findLastKey(users, function(o) { return o.age < 40; }); * // => returns 'pebbles' assuming `_.findKey` returns 'barney' * * // The `_.matches` iteratee shorthand. * _.findLastKey(users, { 'age': 36, 'active': true }); * // => 'barney' * * // The `_.matchesProperty` iteratee shorthand. * _.findLastKey(users, ['active', false]); * // => 'fred' * * // The `_.property` iteratee shorthand. * _.findLastKey(users, 'active'); * // => 'pebbles' */ function findLastKey(object, predicate) { return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); } /** * Iterates over own and inherited enumerable string keyed properties of an * object and invokes `iteratee` for each property. The iteratee is invoked * with three arguments: (value, key, object). Iteratee functions may exit * iteration early by explicitly returning `false`. * * @static * @memberOf _ * @since 0.3.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @see _.forInRight * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forIn(new Foo, function(value, key) { * console.log(key); * }); * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). */ function forIn(object, iteratee) { return object == null ? object : baseFor(object, getIteratee(iteratee, 3), keysIn); } /** * This method is like `_.forIn` except that it iterates over properties of * `object` in the opposite order. * * @static * @memberOf _ * @since 2.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @see _.forIn * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forInRight(new Foo, function(value, key) { * console.log(key); * }); * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. */ function forInRight(object, iteratee) { return object == null ? object : baseForRight(object, getIteratee(iteratee, 3), keysIn); } /** * Iterates over own enumerable string keyed properties of an object and * invokes `iteratee` for each property. The iteratee is invoked with three * arguments: (value, key, object). Iteratee functions may exit iteration * early by explicitly returning `false`. * * @static * @memberOf _ * @since 0.3.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @see _.forOwnRight * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forOwn(new Foo, function(value, key) { * console.log(key); * }); * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forOwn(object, iteratee) { return object && baseForOwn(object, getIteratee(iteratee, 3)); } /** * This method is like `_.forOwn` except that it iterates over properties of * `object` in the opposite order. * * @static * @memberOf _ * @since 2.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @see _.forOwn * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forOwnRight(new Foo, function(value, key) { * console.log(key); * }); * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. */ function forOwnRight(object, iteratee) { return object && baseForOwnRight(object, getIteratee(iteratee, 3)); } /** * Creates an array of function property names from own enumerable properties * of `object`. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the function names. * @see _.functionsIn * @example * * function Foo() { * this.a = _.constant('a'); * this.b = _.constant('b'); * } * * Foo.prototype.c = _.constant('c'); * * _.functions(new Foo); * // => ['a', 'b'] */ function functions(object) { return object == null ? [] : baseFunctions(object, keys(object)); } /** * Creates an array of function property names from own and inherited * enumerable properties of `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the function names. * @see _.functions * @example * * function Foo() { * this.a = _.constant('a'); * this.b = _.constant('b'); * } * * Foo.prototype.c = _.constant('c'); * * _.functionsIn(new Foo); * // => ['a', 'b', 'c'] */ function functionsIn(object) { return object == null ? [] : baseFunctions(object, keysIn(object)); } /** * Gets the value at `path` of `object`. If the resolved value is * `undefined`, the `defaultValue` is returned in its place. * * @static * @memberOf _ * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.get(object, 'a[0].b.c'); * // => 3 * * _.get(object, ['a', '0', 'b', 'c']); * // => 3 * * _.get(object, 'a.b.c', 'default'); * // => 'default' */ function get(object, path, defaultValue) { var result = object == null ? undefined : baseGet(object, path); return result === undefined ? defaultValue : result; } /** * Checks if `path` is a direct property of `object`. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = { 'a': { 'b': 2 } }; * var other = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.has(object, 'a'); * // => true * * _.has(object, 'a.b'); * // => true * * _.has(object, ['a', 'b']); * // => true * * _.has(other, 'a'); * // => false */ function has(object, path) { return object != null && hasPath(object, path, baseHas); } /** * Checks if `path` is a direct or inherited property of `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.hasIn(object, 'a'); * // => true * * _.hasIn(object, 'a.b'); * // => true * * _.hasIn(object, ['a', 'b']); * // => true * * _.hasIn(object, 'b'); * // => false */ function hasIn(object, path) { return object != null && hasPath(object, path, baseHasIn); } /** * Creates an object composed of the inverted keys and values of `object`. * If `object` contains duplicate values, subsequent values overwrite * property assignments of previous values. * * @static * @memberOf _ * @since 0.7.0 * @category Object * @param {Object} object The object to invert. * @returns {Object} Returns the new inverted object. * @example * * var object = { 'a': 1, 'b': 2, 'c': 1 }; * * _.invert(object); * // => { '1': 'c', '2': 'b' } */ var invert = createInverter(function(result, value, key) { if (value != null && typeof value.toString != 'function') { value = nativeObjectToString.call(value); } result[value] = key; }, constant(identity)); /** * This method is like `_.invert` except that the inverted object is generated * from the results of running each element of `object` thru `iteratee`. The * corresponding inverted value of each inverted key is an array of keys * responsible for generating the inverted value. The iteratee is invoked * with one argument: (value). * * @static * @memberOf _ * @since 4.1.0 * @category Object * @param {Object} object The object to invert. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Object} Returns the new inverted object. * @example * * var object = { 'a': 1, 'b': 2, 'c': 1 }; * * _.invertBy(object); * // => { '1': ['a', 'c'], '2': ['b'] } * * _.invertBy(object, function(value) { * return 'group' + value; * }); * // => { 'group1': ['a', 'c'], 'group2': ['b'] } */ var invertBy = createInverter(function(result, value, key) { if (value != null && typeof value.toString != 'function') { value = nativeObjectToString.call(value); } if (hasOwnProperty.call(result, value)) { result[value].push(key); } else { result[value] = [key]; } }, getIteratee); /** * Invokes the method at `path` of `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the method to invoke. * @param {...*} [args] The arguments to invoke the method with. * @returns {*} Returns the result of the invoked method. * @example * * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; * * _.invoke(object, 'a[0].b.c.slice', 1, 3); * // => [2, 3] */ var invoke = baseRest(baseInvoke); /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } /** * Creates an array of the own and inherited enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); } /** * The opposite of `_.mapValues`; this method creates an object with the * same values as `object` and keys generated by running each own enumerable * string keyed property of `object` thru `iteratee`. The iteratee is invoked * with three arguments: (value, key, object). * * @static * @memberOf _ * @since 3.8.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns the new mapped object. * @see _.mapValues * @example * * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { * return key + value; * }); * // => { 'a1': 1, 'b2': 2 } */ function mapKeys(object, iteratee) { var result = {}; iteratee = getIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { baseAssignValue(result, iteratee(value, key, object), value); }); return result; } /** * Creates an object with the same keys as `object` and values generated * by running each own enumerable string keyed property of `object` thru * `iteratee`. The iteratee is invoked with three arguments: * (value, key, object). * * @static * @memberOf _ * @since 2.4.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns the new mapped object. * @see _.mapKeys * @example * * var users = { * 'fred': { 'user': 'fred', 'age': 40 }, * 'pebbles': { 'user': 'pebbles', 'age': 1 } * }; * * _.mapValues(users, function(o) { return o.age; }); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) * * // The `_.property` iteratee shorthand. * _.mapValues(users, 'age'); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ function mapValues(object, iteratee) { var result = {}; iteratee = getIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { baseAssignValue(result, key, iteratee(value, key, object)); }); return result; } /** * This method is like `_.assign` except that it recursively merges own and * inherited enumerable string keyed properties of source objects into the * destination object. Source properties that resolve to `undefined` are * skipped if a destination value exists. Array and plain object properties * are merged recursively. Other objects and value types are overridden by * assignment. Source objects are applied from left to right. Subsequent * sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 0.5.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * var object = { * 'a': [{ 'b': 2 }, { 'd': 4 }] * }; * * var other = { * 'a': [{ 'c': 3 }, { 'e': 5 }] * }; * * _.merge(object, other); * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } */ var merge = createAssigner(function(object, source, srcIndex) { baseMerge(object, source, srcIndex); }); /** * This method is like `_.merge` except that it accepts `customizer` which * is invoked to produce the merged values of the destination and source * properties. If `customizer` returns `undefined`, merging is handled by the * method instead. The `customizer` is invoked with six arguments: * (objValue, srcValue, key, object, source, stack). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} customizer The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * function customizer(objValue, srcValue) { * if (_.isArray(objValue)) { * return objValue.concat(srcValue); * } * } * * var object = { 'a': [1], 'b': [2] }; * var other = { 'a': [3], 'b': [4] }; * * _.mergeWith(object, other, customizer); * // => { 'a': [1, 3], 'b': [2, 4] } */ var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { baseMerge(object, source, srcIndex, customizer); }); /** * The opposite of `_.pick`; this method creates an object composed of the * own and inherited enumerable property paths of `object` that are not omitted. * * **Note:** This method is considerably slower than `_.pick`. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The source object. * @param {...(string|string[])} [paths] The property paths to omit. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.omit(object, ['a', 'c']); * // => { 'b': '2' } */ var omit = flatRest(function(object, paths) { var result = {}; if (object == null) { return result; } var isDeep = false; paths = arrayMap(paths, function(path) { path = castPath(path, object); isDeep || (isDeep = path.length > 1); return path; }); copyObject(object, getAllKeysIn(object), result); if (isDeep) { result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); } var length = paths.length; while (length--) { baseUnset(result, paths[length]); } return result; }); /** * The opposite of `_.pickBy`; this method creates an object composed of * the own and inherited enumerable string keyed properties of `object` that * `predicate` doesn't return truthy for. The predicate is invoked with two * arguments: (value, key). * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The source object. * @param {Function} [predicate=_.identity] The function invoked per property. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.omitBy(object, _.isNumber); * // => { 'b': '2' } */ function omitBy(object, predicate) { return pickBy(object, negate(getIteratee(predicate))); } /** * Creates an object composed of the picked `object` properties. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The source object. * @param {...(string|string[])} [paths] The property paths to pick. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.pick(object, ['a', 'c']); * // => { 'a': 1, 'c': 3 } */ var pick = flatRest(function(object, paths) { return object == null ? {} : basePick(object, paths); }); /** * Creates an object composed of the `object` properties `predicate` returns * truthy for. The predicate is invoked with two arguments: (value, key). * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The source object. * @param {Function} [predicate=_.identity] The function invoked per property. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.pickBy(object, _.isNumber); * // => { 'a': 1, 'c': 3 } */ function pickBy(object, predicate) { if (object == null) { return {}; } var props = arrayMap(getAllKeysIn(object), function(prop) { return [prop]; }); predicate = getIteratee(predicate); return basePickBy(object, props, function(value, path) { return predicate(value, path[0]); }); } /** * This method is like `_.get` except that if the resolved value is a * function it's invoked with the `this` binding of its parent object and * its result is returned. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to resolve. * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; * * _.result(object, 'a[0].b.c1'); * // => 3 * * _.result(object, 'a[0].b.c2'); * // => 4 * * _.result(object, 'a[0].b.c3', 'default'); * // => 'default' * * _.result(object, 'a[0].b.c3', _.constant('default')); * // => 'default' */ function result(object, path, defaultValue) { path = castPath(path, object); var index = -1, length = path.length; // Ensure the loop is entered when path is empty. if (!length) { length = 1; object = undefined; } while (++index < length) { var value = object == null ? undefined : object[toKey(path[index])]; if (value === undefined) { index = length; value = defaultValue; } object = isFunction(value) ? value.call(object) : value; } return object; } /** * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, * it's created. Arrays are created for missing index properties while objects * are created for all other missing properties. Use `_.setWith` to customize * `path` creation. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 3.7.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @returns {Object} Returns `object`. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.set(object, 'a[0].b.c', 4); * console.log(object.a[0].b.c); * // => 4 * * _.set(object, ['x', '0', 'y', 'z'], 5); * console.log(object.x[0].y.z); * // => 5 */ function set(object, path, value) { return object == null ? object : baseSet(object, path, value); } /** * This method is like `_.set` except that it accepts `customizer` which is * invoked to produce the objects of `path`. If `customizer` returns `undefined` * path creation is handled by the method instead. The `customizer` is invoked * with three arguments: (nsValue, key, nsObject). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * var object = {}; * * _.setWith(object, '[0][1]', 'a', Object); * // => { '0': { '1': 'a' } } */ function setWith(object, path, value, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; return object == null ? object : baseSet(object, path, value, customizer); } /** * Creates an array of own enumerable string keyed-value pairs for `object` * which can be consumed by `_.fromPairs`. If `object` is a map or set, its * entries are returned. * * @static * @memberOf _ * @since 4.0.0 * @alias entries * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the key-value pairs. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.toPairs(new Foo); * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) */ var toPairs = createToPairs(keys); /** * Creates an array of own and inherited enumerable string keyed-value pairs * for `object` which can be consumed by `_.fromPairs`. If `object` is a map * or set, its entries are returned. * * @static * @memberOf _ * @since 4.0.0 * @alias entriesIn * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the key-value pairs. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.toPairsIn(new Foo); * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) */ var toPairsIn = createToPairs(keysIn); /** * An alternative to `_.reduce`; this method transforms `object` to a new * `accumulator` object which is the result of running each of its own * enumerable string keyed properties thru `iteratee`, with each invocation * potentially mutating the `accumulator` object. If `accumulator` is not * provided, a new object with the same `[[Prototype]]` will be used. The * iteratee is invoked with four arguments: (accumulator, value, key, object). * Iteratee functions may exit iteration early by explicitly returning `false`. * * @static * @memberOf _ * @since 1.3.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The custom accumulator value. * @returns {*} Returns the accumulated value. * @example * * _.transform([2, 3, 4], function(result, n) { * result.push(n *= n); * return n % 2 == 0; * }, []); * // => [4, 9] * * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { * (result[value] || (result[value] = [])).push(key); * }, {}); * // => { '1': ['a', 'c'], '2': ['b'] } */ function transform(object, iteratee, accumulator) { var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object); iteratee = getIteratee(iteratee, 4); if (accumulator == null) { var Ctor = object && object.constructor; if (isArrLike) { accumulator = isArr ? new Ctor : []; } else if (isObject(object)) { accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; } else { accumulator = {}; } } (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { return iteratee(accumulator, value, index, object); }); return accumulator; } /** * Removes the property at `path` of `object`. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to unset. * @returns {boolean} Returns `true` if the property is deleted, else `false`. * @example * * var object = { 'a': [{ 'b': { 'c': 7 } }] }; * _.unset(object, 'a[0].b.c'); * // => true * * console.log(object); * // => { 'a': [{ 'b': {} }] }; * * _.unset(object, ['a', '0', 'b', 'c']); * // => true * * console.log(object); * // => { 'a': [{ 'b': {} }] }; */ function unset(object, path) { return object == null ? true : baseUnset(object, path); } /** * This method is like `_.set` except that accepts `updater` to produce the * value to set. Use `_.updateWith` to customize `path` creation. The `updater` * is invoked with one argument: (value). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.6.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {Function} updater The function to produce the updated value. * @returns {Object} Returns `object`. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.update(object, 'a[0].b.c', function(n) { return n * n; }); * console.log(object.a[0].b.c); * // => 9 * * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); * console.log(object.x[0].y.z); * // => 0 */ function update(object, path, updater) { return object == null ? object : baseUpdate(object, path, castFunction(updater)); } /** * This method is like `_.update` except that it accepts `customizer` which is * invoked to produce the objects of `path`. If `customizer` returns `undefined` * path creation is handled by the method instead. The `customizer` is invoked * with three arguments: (nsValue, key, nsObject). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.6.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {Function} updater The function to produce the updated value. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * var object = {}; * * _.updateWith(object, '[0][1]', _.constant('a'), Object); * // => { '0': { '1': 'a' } } */ function updateWith(object, path, updater, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); } /** * Creates an array of the own enumerable string keyed property values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property values. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.values(new Foo); * // => [1, 2] (iteration order is not guaranteed) * * _.values('hi'); * // => ['h', 'i'] */ function values(object) { return object == null ? [] : baseValues(object, keys(object)); } /** * Creates an array of the own and inherited enumerable string keyed property * values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property values. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.valuesIn(new Foo); * // => [1, 2, 3] (iteration order is not guaranteed) */ function valuesIn(object) { return object == null ? [] : baseValues(object, keysIn(object)); } /*------------------------------------------------------------------------*/ /** * Clamps `number` within the inclusive `lower` and `upper` bounds. * * @static * @memberOf _ * @since 4.0.0 * @category Number * @param {number} number The number to clamp. * @param {number} [lower] The lower bound. * @param {number} upper The upper bound. * @returns {number} Returns the clamped number. * @example * * _.clamp(-10, -5, 5); * // => -5 * * _.clamp(10, -5, 5); * // => 5 */ function clamp(number, lower, upper) { if (upper === undefined) { upper = lower; lower = undefined; } if (upper !== undefined) { upper = toNumber(upper); upper = upper === upper ? upper : 0; } if (lower !== undefined) { lower = toNumber(lower); lower = lower === lower ? lower : 0; } return baseClamp(toNumber(number), lower, upper); } /** * Checks if `n` is between `start` and up to, but not including, `end`. If * `end` is not specified, it's set to `start` with `start` then set to `0`. * If `start` is greater than `end` the params are swapped to support * negative ranges. * * @static * @memberOf _ * @since 3.3.0 * @category Number * @param {number} number The number to check. * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @returns {boolean} Returns `true` if `number` is in the range, else `false`. * @see _.range, _.rangeRight * @example * * _.inRange(3, 2, 4); * // => true * * _.inRange(4, 8); * // => true * * _.inRange(4, 2); * // => false * * _.inRange(2, 2); * // => false * * _.inRange(1.2, 2); * // => true * * _.inRange(5.2, 4); * // => false * * _.inRange(-3, -2, -6); * // => true */ function inRange(number, start, end) { start = toFinite(start); if (end === undefined) { end = start; start = 0; } else { end = toFinite(end); } number = toNumber(number); return baseInRange(number, start, end); } /** * Produces a random number between the inclusive `lower` and `upper` bounds. * If only one argument is provided a number between `0` and the given number * is returned. If `floating` is `true`, or either `lower` or `upper` are * floats, a floating-point number is returned instead of an integer. * * **Note:** JavaScript follows the IEEE-754 standard for resolving * floating-point values which can produce unexpected results. * * @static * @memberOf _ * @since 0.7.0 * @category Number * @param {number} [lower=0] The lower bound. * @param {number} [upper=1] The upper bound. * @param {boolean} [floating] Specify returning a floating-point number. * @returns {number} Returns the random number. * @example * * _.random(0, 5); * // => an integer between 0 and 5 * * _.random(5); * // => also an integer between 0 and 5 * * _.random(5, true); * // => a floating-point number between 0 and 5 * * _.random(1.2, 5.2); * // => a floating-point number between 1.2 and 5.2 */ function random(lower, upper, floating) { if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { upper = floating = undefined; } if (floating === undefined) { if (typeof upper == 'boolean') { floating = upper; upper = undefined; } else if (typeof lower == 'boolean') { floating = lower; lower = undefined; } } if (lower === undefined && upper === undefined) { lower = 0; upper = 1; } else { lower = toFinite(lower); if (upper === undefined) { upper = lower; lower = 0; } else { upper = toFinite(upper); } } if (lower > upper) { var temp = lower; lower = upper; upper = temp; } if (floating || lower % 1 || upper % 1) { var rand = nativeRandom(); return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); } return baseRandom(lower, upper); } /*------------------------------------------------------------------------*/ /** * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the camel cased string. * @example * * _.camelCase('Foo Bar'); * // => 'fooBar' * * _.camelCase('--foo-bar--'); * // => 'fooBar' * * _.camelCase('__FOO_BAR__'); * // => 'fooBar' */ var camelCase = createCompounder(function(result, word, index) { word = word.toLowerCase(); return result + (index ? capitalize(word) : word); }); /** * Converts the first character of `string` to upper case and the remaining * to lower case. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to capitalize. * @returns {string} Returns the capitalized string. * @example * * _.capitalize('FRED'); * // => 'Fred' */ function capitalize(string) { return upperFirst(toString(string).toLowerCase()); } /** * Deburrs `string` by converting * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) * letters to basic Latin letters and removing * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to deburr. * @returns {string} Returns the deburred string. * @example * * _.deburr('déjà vu'); * // => 'deja vu' */ function deburr(string) { string = toString(string); return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); } /** * Checks if `string` ends with the given target string. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to inspect. * @param {string} [target] The string to search for. * @param {number} [position=string.length] The position to search up to. * @returns {boolean} Returns `true` if `string` ends with `target`, * else `false`. * @example * * _.endsWith('abc', 'c'); * // => true * * _.endsWith('abc', 'b'); * // => false * * _.endsWith('abc', 'b', 2); * // => true */ function endsWith(string, target, position) { string = toString(string); target = baseToString(target); var length = string.length; position = position === undefined ? length : baseClamp(toInteger(position), 0, length); var end = position; position -= target.length; return position >= 0 && string.slice(position, end) == target; } /** * Converts the characters "&", "<", ">", '"', and "'" in `string` to their * corresponding HTML entities. * * **Note:** No other characters are escaped. To escape additional * characters use a third-party library like [_he_](https://mths.be/he). * * Though the ">" character is escaped for symmetry, characters like * ">" and "/" don't need escaping in HTML and have no special meaning * unless they're part of a tag or unquoted attribute value. See * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * * When working with HTML you should always * [quote attribute values](http://wonko.com/post/html-escaping) to reduce * XSS vectors. * * @static * @since 0.1.0 * @memberOf _ * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. * @example * * _.escape('fred, barney, & pebbles'); * // => 'fred, barney, & pebbles' */ function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; } /** * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. * @example * * _.escapeRegExp('[lodash](https://lodash.com/)'); * // => '\[lodash\]\(https://lodash\.com/\)' */ function escapeRegExp(string) { string = toString(string); return (string && reHasRegExpChar.test(string)) ? string.replace(reRegExpChar, '\\$&') : string; } /** * Converts `string` to * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the kebab cased string. * @example * * _.kebabCase('Foo Bar'); * // => 'foo-bar' * * _.kebabCase('fooBar'); * // => 'foo-bar' * * _.kebabCase('__FOO_BAR__'); * // => 'foo-bar' */ var kebabCase = createCompounder(function(result, word, index) { return result + (index ? '-' : '') + word.toLowerCase(); }); /** * Converts `string`, as space separated words, to lower case. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the lower cased string. * @example * * _.lowerCase('--Foo-Bar--'); * // => 'foo bar' * * _.lowerCase('fooBar'); * // => 'foo bar' * * _.lowerCase('__FOO_BAR__'); * // => 'foo bar' */ var lowerCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + word.toLowerCase(); }); /** * Converts the first character of `string` to lower case. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the converted string. * @example * * _.lowerFirst('Fred'); * // => 'fred' * * _.lowerFirst('FRED'); * // => 'fRED' */ var lowerFirst = createCaseFirst('toLowerCase'); /** * Pads `string` on the left and right sides if it's shorter than `length`. * Padding characters are truncated if they can't be evenly divided by `length`. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.pad('abc', 8); * // => ' abc ' * * _.pad('abc', 8, '_-'); * // => '_-abc_-_' * * _.pad('abc', 3); * // => 'abc' */ function pad(string, length, chars) { string = toString(string); length = toInteger(length); var strLength = length ? stringSize(string) : 0; if (!length || strLength >= length) { return string; } var mid = (length - strLength) / 2; return ( createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars) ); } /** * Pads `string` on the right side if it's shorter than `length`. Padding * characters are truncated if they exceed `length`. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.padEnd('abc', 6); * // => 'abc ' * * _.padEnd('abc', 6, '_-'); * // => 'abc_-_' * * _.padEnd('abc', 3); * // => 'abc' */ function padEnd(string, length, chars) { string = toString(string); length = toInteger(length); var strLength = length ? stringSize(string) : 0; return (length && strLength < length) ? (string + createPadding(length - strLength, chars)) : string; } /** * Pads `string` on the left side if it's shorter than `length`. Padding * characters are truncated if they exceed `length`. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.padStart('abc', 6); * // => ' abc' * * _.padStart('abc', 6, '_-'); * // => '_-_abc' * * _.padStart('abc', 3); * // => 'abc' */ function padStart(string, length, chars) { string = toString(string); length = toInteger(length); var strLength = length ? stringSize(string) : 0; return (length && strLength < length) ? (createPadding(length - strLength, chars) + string) : string; } /** * Converts `string` to an integer of the specified radix. If `radix` is * `undefined` or `0`, a `radix` of `10` is used unless `value` is a * hexadecimal, in which case a `radix` of `16` is used. * * **Note:** This method aligns with the * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. * * @static * @memberOf _ * @since 1.1.0 * @category String * @param {string} string The string to convert. * @param {number} [radix=10] The radix to interpret `value` by. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {number} Returns the converted integer. * @example * * _.parseInt('08'); * // => 8 * * _.map(['6', '08', '10'], _.parseInt); * // => [6, 8, 10] */ function parseInt(string, radix, guard) { if (guard || radix == null) { radix = 0; } else if (radix) { radix = +radix; } return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); } /** * Repeats the given string `n` times. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to repeat. * @param {number} [n=1] The number of times to repeat the string. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the repeated string. * @example * * _.repeat('*', 3); * // => '***' * * _.repeat('abc', 2); * // => 'abcabc' * * _.repeat('abc', 0); * // => '' */ function repeat(string, n, guard) { if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { n = 1; } else { n = toInteger(n); } return baseRepeat(toString(string), n); } /** * Replaces matches for `pattern` in `string` with `replacement`. * * **Note:** This method is based on * [`String#replace`](https://mdn.io/String/replace). * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to modify. * @param {RegExp|string} pattern The pattern to replace. * @param {Function|string} replacement The match replacement. * @returns {string} Returns the modified string. * @example * * _.replace('Hi Fred', 'Fred', 'Barney'); * // => 'Hi Barney' */ function replace() { var args = arguments, string = toString(args[0]); return args.length < 3 ? string : string.replace(args[1], args[2]); } /** * Converts `string` to * [snake case](https://en.wikipedia.org/wiki/Snake_case). * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the snake cased string. * @example * * _.snakeCase('Foo Bar'); * // => 'foo_bar' * * _.snakeCase('fooBar'); * // => 'foo_bar' * * _.snakeCase('--FOO-BAR--'); * // => 'foo_bar' */ var snakeCase = createCompounder(function(result, word, index) { return result + (index ? '_' : '') + word.toLowerCase(); }); /** * Splits `string` by `separator`. * * **Note:** This method is based on * [`String#split`](https://mdn.io/String/split). * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to split. * @param {RegExp|string} separator The separator pattern to split by. * @param {number} [limit] The length to truncate results to. * @returns {Array} Returns the string segments. * @example * * _.split('a-b-c', '-', 2); * // => ['a', 'b'] */ function split(string, separator, limit) { if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { separator = limit = undefined; } limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; if (!limit) { return []; } string = toString(string); if (string && ( typeof separator == 'string' || (separator != null && !isRegExp(separator)) )) { separator = baseToString(separator); if (!separator && hasUnicode(string)) { return castSlice(stringToArray(string), 0, limit); } } return string.split(separator, limit); } /** * Converts `string` to * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). * * @static * @memberOf _ * @since 3.1.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the start cased string. * @example * * _.startCase('--foo-bar--'); * // => 'Foo Bar' * * _.startCase('fooBar'); * // => 'Foo Bar' * * _.startCase('__FOO_BAR__'); * // => 'FOO BAR' */ var startCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + upperFirst(word); }); /** * Checks if `string` starts with the given target string. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to inspect. * @param {string} [target] The string to search for. * @param {number} [position=0] The position to search from. * @returns {boolean} Returns `true` if `string` starts with `target`, * else `false`. * @example * * _.startsWith('abc', 'a'); * // => true * * _.startsWith('abc', 'b'); * // => false * * _.startsWith('abc', 'b', 1); * // => true */ function startsWith(string, target, position) { string = toString(string); position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length); target = baseToString(target); return string.slice(position, position + target.length) == target; } /** * Creates a compiled template function that can interpolate data properties * in "interpolate" delimiters, HTML-escape interpolated data properties in * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data * properties may be accessed as free variables in the template. If a setting * object is given, it takes precedence over `_.templateSettings` values. * * **Note:** In the development build `_.template` utilizes * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * for easier debugging. * * For more information on precompiling templates see * [lodash's custom builds documentation](https://lodash.com/custom-builds). * * For more information on Chrome extension sandboxes see * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). * * @static * @since 0.1.0 * @memberOf _ * @category String * @param {string} [string=''] The template string. * @param {Object} [options={}] The options object. * @param {RegExp} [options.escape=_.templateSettings.escape] * The HTML "escape" delimiter. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] * The "evaluate" delimiter. * @param {Object} [options.imports=_.templateSettings.imports] * An object to import into the template as free variables. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] * The "interpolate" delimiter. * @param {string} [options.sourceURL='lodash.templateSources[n]'] * The sourceURL of the compiled template. * @param {string} [options.variable='obj'] * The data object variable name. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Function} Returns the compiled template function. * @example * * // Use the "interpolate" delimiter to create a compiled template. * var compiled = _.template('hello <%= user %>!'); * compiled({ 'user': 'fred' }); * // => 'hello fred!' * * // Use the HTML "escape" delimiter to escape data property values. * var compiled = _.template('<b><%- value %></b>'); * compiled({ 'value': '<script>' }); * // => '<b><script></b>' * * // Use the "evaluate" delimiter to execute JavaScript and generate HTML. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>'); * compiled({ 'users': ['fred', 'barney'] }); * // => '<li>fred</li><li>barney</li>' * * // Use the internal `print` function in "evaluate" delimiters. * var compiled = _.template('<% print("hello " + user); %>!'); * compiled({ 'user': 'barney' }); * // => 'hello barney!' * * // Use the ES template literal delimiter as an "interpolate" delimiter. * // Disable support by replacing the "interpolate" delimiter. * var compiled = _.template('hello ${ user }!'); * compiled({ 'user': 'pebbles' }); * // => 'hello pebbles!' * * // Use backslashes to treat delimiters as plain text. * var compiled = _.template('<%= "\\<%- value %\\>" %>'); * compiled({ 'value': 'ignored' }); * // => '<%- value %>' * * // Use the `imports` option to import `jQuery` as `jq`. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>'; * var compiled = _.template(text, { 'imports': { 'jq': jQuery } }); * compiled({ 'users': ['fred', 'barney'] }); * // => '<li>fred</li><li>barney</li>' * * // Use the `sourceURL` option to specify a custom sourceURL for the template. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' }); * compiled(data); * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector. * * // Use the `variable` option to ensure a with-statement isn't used in the compiled template. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' }); * compiled.source; * // => function(data) { * // var __t, __p = ''; * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!'; * // return __p; * // } * * // Use custom template delimiters. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; * var compiled = _.template('hello {{ user }}!'); * compiled({ 'user': 'mustache' }); * // => 'hello mustache!' * * // Use the `source` property to inline compiled templates for meaningful * // line numbers in error messages and stack traces. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\ * var JST = {\ * "main": ' + _.template(mainText).source + '\ * };\ * '); */ function template(string, options, guard) { // Based on John Resig's `tmpl` implementation // (http://ejohn.org/blog/javascript-micro-templating/) // and Laura Doktorova's doT.js (https://github.com/olado/doT). var settings = lodash.templateSettings; if (guard && isIterateeCall(string, options, guard)) { options = undefined; } string = toString(string); options = assignInWith({}, options, settings, customDefaultsAssignIn); var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; // Compile the regexp to match each delimiter. var reDelimiters = RegExp( (options.escape || reNoMatch).source + '|' + interpolate.source + '|' + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' + (options.evaluate || reNoMatch).source + '|$' , 'g'); // Use a sourceURL for easier debugging. // The sourceURL gets injected into the source that's eval-ed, so be careful // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in // and escape the comment, thus injecting code that gets evaled. var sourceURL = '//# sourceURL=' + (hasOwnProperty.call(options, 'sourceURL') ? (options.sourceURL + '').replace(/\s/g, ' ') : ('lodash.templateSources[' + (++templateCounter) + ']') ) + '\n'; string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { interpolateValue || (interpolateValue = esTemplateValue); // Escape characters that can't be included in string literals. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); // Replace delimiters with snippets. if (escapeValue) { isEscaping = true; source += "' +\n__e(" + escapeValue + ") +\n'"; } if (evaluateValue) { isEvaluating = true; source += "';\n" + evaluateValue + ";\n__p += '"; } if (interpolateValue) { source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; } index = offset + match.length; // The JS engine embedded in Adobe products needs `match` returned in // order to produce the correct `offset` value. return match; }); source += "';\n"; // If `variable` is not specified wrap a with-statement around the generated // code to add the data object to the top of the scope chain. var variable = hasOwnProperty.call(options, 'variable') && options.variable; if (!variable) { source = 'with (obj) {\n' + source + '\n}\n'; } // Throw an error if a forbidden character was found in `variable`, to prevent // potential command injection attacks. else if (reForbiddenIdentifierChars.test(variable)) { throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT); } // Cleanup code by stripping empty strings. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) .replace(reEmptyStringMiddle, '$1') .replace(reEmptyStringTrailing, '$1;'); // Frame code as the function body. source = 'function(' + (variable || 'obj') + ') {\n' + (variable ? '' : 'obj || (obj = {});\n' ) + "var __t, __p = ''" + (isEscaping ? ', __e = _.escape' : '' ) + (isEvaluating ? ', __j = Array.prototype.join;\n' + "function print() { __p += __j.call(arguments, '') }\n" : ';\n' ) + source + 'return __p\n}'; var result = attempt(function() { return Function(importsKeys, sourceURL + 'return ' + source) .apply(undefined, importsValues); }); // Provide the compiled function's source by its `toString` method or // the `source` property as a convenience for inlining compiled templates. result.source = source; if (isError(result)) { throw result; } return result; } /** * Converts `string`, as a whole, to lower case just like * [String#toLowerCase](https://mdn.io/toLowerCase). * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the lower cased string. * @example * * _.toLower('--Foo-Bar--'); * // => '--foo-bar--' * * _.toLower('fooBar'); * // => 'foobar' * * _.toLower('__FOO_BAR__'); * // => '__foo_bar__' */ function toLower(value) { return toString(value).toLowerCase(); } /** * Converts `string`, as a whole, to upper case just like * [String#toUpperCase](https://mdn.io/toUpperCase). * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the upper cased string. * @example * * _.toUpper('--foo-bar--'); * // => '--FOO-BAR--' * * _.toUpper('fooBar'); * // => 'FOOBAR' * * _.toUpper('__foo_bar__'); * // => '__FOO_BAR__' */ function toUpper(value) { return toString(value).toUpperCase(); } /** * Removes leading and trailing whitespace or specified characters from `string`. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * * _.trim(' abc '); * // => 'abc' * * _.trim('-_-abc-_-', '_-'); * // => 'abc' * * _.map([' foo ', ' bar '], _.trim); * // => ['foo', 'bar'] */ function trim(string, chars, guard) { string = toString(string); if (string && (guard || chars === undefined)) { return baseTrim(string); } if (!string || !(chars = baseToString(chars))) { return string; } var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; return castSlice(strSymbols, start, end).join(''); } /** * Removes trailing whitespace or specified characters from `string`. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * * _.trimEnd(' abc '); * // => ' abc' * * _.trimEnd('-_-abc-_-', '_-'); * // => '-_-abc' */ function trimEnd(string, chars, guard) { string = toString(string); if (string && (guard || chars === undefined)) { return string.slice(0, trimmedEndIndex(string) + 1); } if (!string || !(chars = baseToString(chars))) { return string; } var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; return castSlice(strSymbols, 0, end).join(''); } /** * Removes leading whitespace or specified characters from `string`. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * * _.trimStart(' abc '); * // => 'abc ' * * _.trimStart('-_-abc-_-', '_-'); * // => 'abc-_-' */ function trimStart(string, chars, guard) { string = toString(string); if (string && (guard || chars === undefined)) { return string.replace(reTrimStart, ''); } if (!string || !(chars = baseToString(chars))) { return string; } var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars)); return castSlice(strSymbols, start).join(''); } /** * Truncates `string` if it's longer than the given maximum string length. * The last characters of the truncated string are replaced with the omission * string which defaults to "...". * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to truncate. * @param {Object} [options={}] The options object. * @param {number} [options.length=30] The maximum string length. * @param {string} [options.omission='...'] The string to indicate text is omitted. * @param {RegExp|string} [options.separator] The separator pattern to truncate to. * @returns {string} Returns the truncated string. * @example * * _.truncate('hi-diddly-ho there, neighborino'); * // => 'hi-diddly-ho there, neighbo...' * * _.truncate('hi-diddly-ho there, neighborino', { * 'length': 24, * 'separator': ' ' * }); * // => 'hi-diddly-ho there,...' * * _.truncate('hi-diddly-ho there, neighborino', { * 'length': 24, * 'separator': /,? +/ * }); * // => 'hi-diddly-ho there...' * * _.truncate('hi-diddly-ho there, neighborino', { * 'omission': ' [...]' * }); * // => 'hi-diddly-ho there, neig [...]' */ function truncate(string, options) { var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; if (isObject(options)) { var separator = 'separator' in options ? options.separator : separator; length = 'length' in options ? toInteger(options.length) : length; omission = 'omission' in options ? baseToString(options.omission) : omission; } string = toString(string); var strLength = string.length; if (hasUnicode(string)) { var strSymbols = stringToArray(string); strLength = strSymbols.length; } if (length >= strLength) { return string; } var end = length - stringSize(omission); if (end < 1) { return omission; } var result = strSymbols ? castSlice(strSymbols, 0, end).join('') : string.slice(0, end); if (separator === undefined) { return result + omission; } if (strSymbols) { end += (result.length - end); } if (isRegExp(separator)) { if (string.slice(end).search(separator)) { var match, substring = result; if (!separator.global) { separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g'); } separator.lastIndex = 0; while ((match = separator.exec(substring))) { var newEnd = match.index; } result = result.slice(0, newEnd === undefined ? end : newEnd); } } else if (string.indexOf(baseToString(separator), end) != end) { var index = result.lastIndexOf(separator); if (index > -1) { result = result.slice(0, index); } } return result + omission; } /** * The inverse of `_.escape`; this method converts the HTML entities * `&`, `<`, `>`, `"`, and `'` in `string` to * their corresponding characters. * * **Note:** No other HTML entities are unescaped. To unescape additional * HTML entities use a third-party library like [_he_](https://mths.be/he). * * @static * @memberOf _ * @since 0.6.0 * @category String * @param {string} [string=''] The string to unescape. * @returns {string} Returns the unescaped string. * @example * * _.unescape('fred, barney, & pebbles'); * // => 'fred, barney, & pebbles' */ function unescape(string) { string = toString(string); return (string && reHasEscapedHtml.test(string)) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; } /** * Converts `string`, as space separated words, to upper case. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the upper cased string. * @example * * _.upperCase('--foo-bar'); * // => 'FOO BAR' * * _.upperCase('fooBar'); * // => 'FOO BAR' * * _.upperCase('__foo_bar__'); * // => 'FOO BAR' */ var upperCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + word.toUpperCase(); }); /** * Converts the first character of `string` to upper case. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the converted string. * @example * * _.upperFirst('fred'); * // => 'Fred' * * _.upperFirst('FRED'); * // => 'FRED' */ var upperFirst = createCaseFirst('toUpperCase'); /** * Splits `string` into an array of its words. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to inspect. * @param {RegExp|string} [pattern] The pattern to match words. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the words of `string`. * @example * * _.words('fred, barney, & pebbles'); * // => ['fred', 'barney', 'pebbles'] * * _.words('fred, barney, & pebbles', /[^, ]+/g); * // => ['fred', 'barney', '&', 'pebbles'] */ function words(string, pattern, guard) { string = toString(string); pattern = guard ? undefined : pattern; if (pattern === undefined) { return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); } return string.match(pattern) || []; } /*------------------------------------------------------------------------*/ /** * Attempts to invoke `func`, returning either the result or the caught error * object. Any additional arguments are provided to `func` when it's invoked. * * @static * @memberOf _ * @since 3.0.0 * @category Util * @param {Function} func The function to attempt. * @param {...*} [args] The arguments to invoke `func` with. * @returns {*} Returns the `func` result or error object. * @example * * // Avoid throwing errors for invalid selectors. * var elements = _.attempt(function(selector) { * return document.querySelectorAll(selector); * }, '>_>'); * * if (_.isError(elements)) { * elements = []; * } */ var attempt = baseRest(function(func, args) { try { return apply(func, undefined, args); } catch (e) { return isError(e) ? e : new Error(e); } }); /** * Binds methods of an object to the object itself, overwriting the existing * method. * * **Note:** This method doesn't set the "length" property of bound functions. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {Object} object The object to bind and assign the bound methods to. * @param {...(string|string[])} methodNames The object method names to bind. * @returns {Object} Returns `object`. * @example * * var view = { * 'label': 'docs', * 'click': function() { * console.log('clicked ' + this.label); * } * }; * * _.bindAll(view, ['click']); * jQuery(element).on('click', view.click); * // => Logs 'clicked docs' when clicked. */ var bindAll = flatRest(function(object, methodNames) { arrayEach(methodNames, function(key) { key = toKey(key); baseAssignValue(object, key, bind(object[key], object)); }); return object; }); /** * Creates a function that iterates over `pairs` and invokes the corresponding * function of the first predicate to return truthy. The predicate-function * pairs are invoked with the `this` binding and arguments of the created * function. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {Array} pairs The predicate-function pairs. * @returns {Function} Returns the new composite function. * @example * * var func = _.cond([ * [_.matches({ 'a': 1 }), _.constant('matches A')], * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], * [_.stubTrue, _.constant('no match')] * ]); * * func({ 'a': 1, 'b': 2 }); * // => 'matches A' * * func({ 'a': 0, 'b': 1 }); * // => 'matches B' * * func({ 'a': '1', 'b': '2' }); * // => 'no match' */ function cond(pairs) { var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee(); pairs = !length ? [] : arrayMap(pairs, function(pair) { if (typeof pair[1] != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return [toIteratee(pair[0]), pair[1]]; }); return baseRest(function(args) { var index = -1; while (++index < length) { var pair = pairs[index]; if (apply(pair[0], this, args)) { return apply(pair[1], this, args); } } }); } /** * Creates a function that invokes the predicate properties of `source` with * the corresponding property values of a given object, returning `true` if * all predicates return truthy, else `false`. * * **Note:** The created function is equivalent to `_.conformsTo` with * `source` partially applied. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {Object} source The object of property predicates to conform to. * @returns {Function} Returns the new spec function. * @example * * var objects = [ * { 'a': 2, 'b': 1 }, * { 'a': 1, 'b': 2 } * ]; * * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } })); * // => [{ 'a': 1, 'b': 2 }] */ function conforms(source) { return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); } /** * Creates a function that returns `value`. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {*} value The value to return from the new function. * @returns {Function} Returns the new constant function. * @example * * var objects = _.times(2, _.constant({ 'a': 1 })); * * console.log(objects); * // => [{ 'a': 1 }, { 'a': 1 }] * * console.log(objects[0] === objects[1]); * // => true */ function constant(value) { return function() { return value; }; } /** * Checks `value` to determine whether a default value should be returned in * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, * or `undefined`. * * @static * @memberOf _ * @since 4.14.0 * @category Util * @param {*} value The value to check. * @param {*} defaultValue The default value. * @returns {*} Returns the resolved value. * @example * * _.defaultTo(1, 10); * // => 1 * * _.defaultTo(undefined, 10); * // => 10 */ function defaultTo(value, defaultValue) { return (value == null || value !== value) ? defaultValue : value; } /** * Creates a function that returns the result of invoking the given functions * with the `this` binding of the created function, where each successive * invocation is supplied the return value of the previous. * * @static * @memberOf _ * @since 3.0.0 * @category Util * @param {...(Function|Function[])} [funcs] The functions to invoke. * @returns {Function} Returns the new composite function. * @see _.flowRight * @example * * function square(n) { * return n * n; * } * * var addSquare = _.flow([_.add, square]); * addSquare(1, 2); * // => 9 */ var flow = createFlow(); /** * This method is like `_.flow` except that it creates a function that * invokes the given functions from right to left. * * @static * @since 3.0.0 * @memberOf _ * @category Util * @param {...(Function|Function[])} [funcs] The functions to invoke. * @returns {Function} Returns the new composite function. * @see _.flow * @example * * function square(n) { * return n * n; * } * * var addSquare = _.flowRight([square, _.add]); * addSquare(1, 2); * // => 9 */ var flowRight = createFlow(true); /** * This method returns the first argument it receives. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'a': 1 }; * * console.log(_.identity(object) === object); * // => true */ function identity(value) { return value; } /** * Creates a function that invokes `func` with the arguments of the created * function. If `func` is a property name, the created function returns the * property value for a given element. If `func` is an array or object, the * created function returns `true` for elements that contain the equivalent * source properties, otherwise it returns `false`. * * @static * @since 4.0.0 * @memberOf _ * @category Util * @param {*} [func=_.identity] The value to convert to a callback. * @returns {Function} Returns the callback. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false } * ]; * * // The `_.matches` iteratee shorthand. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); * // => [{ 'user': 'barney', 'age': 36, 'active': true }] * * // The `_.matchesProperty` iteratee shorthand. * _.filter(users, _.iteratee(['user', 'fred'])); * // => [{ 'user': 'fred', 'age': 40 }] * * // The `_.property` iteratee shorthand. * _.map(users, _.iteratee('user')); * // => ['barney', 'fred'] * * // Create custom iteratee shorthands. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { * return !_.isRegExp(func) ? iteratee(func) : function(string) { * return func.test(string); * }; * }); * * _.filter(['abc', 'def'], /ef/); * // => ['def'] */ function iteratee(func) { return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG)); } /** * Creates a function that performs a partial deep comparison between a given * object and `source`, returning `true` if the given object has equivalent * property values, else `false`. * * **Note:** The created function is equivalent to `_.isMatch` with `source` * partially applied. * * Partial comparisons will match empty array and empty object `source` * values against any array or object value, respectively. See `_.isEqual` * for a list of supported value comparisons. * * **Note:** Multiple values can be checked by combining several matchers * using `_.overSome` * * @static * @memberOf _ * @since 3.0.0 * @category Util * @param {Object} source The object of property values to match. * @returns {Function} Returns the new spec function. * @example * * var objects = [ * { 'a': 1, 'b': 2, 'c': 3 }, * { 'a': 4, 'b': 5, 'c': 6 } * ]; * * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); * // => [{ 'a': 4, 'b': 5, 'c': 6 }] * * // Checking for several possible values * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matches(source) { return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); } /** * Creates a function that performs a partial deep comparison between the * value at `path` of a given object to `srcValue`, returning `true` if the * object value is equivalent, else `false`. * * **Note:** Partial comparisons will match empty array and empty object * `srcValue` values against any array or object value, respectively. See * `_.isEqual` for a list of supported value comparisons. * * **Note:** Multiple values can be checked by combining several matchers * using `_.overSome` * * @static * @memberOf _ * @since 3.2.0 * @category Util * @param {Array|string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. * @example * * var objects = [ * { 'a': 1, 'b': 2, 'c': 3 }, * { 'a': 4, 'b': 5, 'c': 6 } * ]; * * _.find(objects, _.matchesProperty('a', 4)); * // => { 'a': 4, 'b': 5, 'c': 6 } * * // Checking for several possible values * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matchesProperty(path, srcValue) { return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); } /** * Creates a function that invokes the method at `path` of a given object. * Any additional arguments are provided to the invoked method. * * @static * @memberOf _ * @since 3.7.0 * @category Util * @param {Array|string} path The path of the method to invoke. * @param {...*} [args] The arguments to invoke the method with. * @returns {Function} Returns the new invoker function. * @example * * var objects = [ * { 'a': { 'b': _.constant(2) } }, * { 'a': { 'b': _.constant(1) } } * ]; * * _.map(objects, _.method('a.b')); * // => [2, 1] * * _.map(objects, _.method(['a', 'b'])); * // => [2, 1] */ var method = baseRest(function(path, args) { return function(object) { return baseInvoke(object, path, args); }; }); /** * The opposite of `_.method`; this method creates a function that invokes * the method at a given path of `object`. Any additional arguments are * provided to the invoked method. * * @static * @memberOf _ * @since 3.7.0 * @category Util * @param {Object} object The object to query. * @param {...*} [args] The arguments to invoke the method with. * @returns {Function} Returns the new invoker function. * @example * * var array = _.times(3, _.constant), * object = { 'a': array, 'b': array, 'c': array }; * * _.map(['a[2]', 'c[0]'], _.methodOf(object)); * // => [2, 0] * * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); * // => [2, 0] */ var methodOf = baseRest(function(object, args) { return function(path) { return baseInvoke(object, path, args); }; }); /** * Adds all own enumerable string keyed function properties of a source * object to the destination object. If `object` is a function, then methods * are added to its prototype as well. * * **Note:** Use `_.runInContext` to create a pristine `lodash` function to * avoid conflicts caused by modifying the original. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {Function|Object} [object=lodash] The destination object. * @param {Object} source The object of functions to add. * @param {Object} [options={}] The options object. * @param {boolean} [options.chain=true] Specify whether mixins are chainable. * @returns {Function|Object} Returns `object`. * @example * * function vowels(string) { * return _.filter(string, function(v) { * return /[aeiou]/i.test(v); * }); * } * * _.mixin({ 'vowels': vowels }); * _.vowels('fred'); * // => ['e'] * * _('fred').vowels().value(); * // => ['e'] * * _.mixin({ 'vowels': vowels }, { 'chain': false }); * _('fred').vowels(); * // => ['e'] */ function mixin(object, source, options) { var props = keys(source), methodNames = baseFunctions(source, props); if (options == null && !(isObject(source) && (methodNames.length || !props.length))) { options = source; source = object; object = this; methodNames = baseFunctions(source, keys(source)); } var chain = !(isObject(options) && 'chain' in options) || !!options.chain, isFunc = isFunction(object); arrayEach(methodNames, function(methodName) { var func = source[methodName]; object[methodName] = func; if (isFunc) { object.prototype[methodName] = function() { var chainAll = this.__chain__; if (chain || chainAll) { var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__); actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); result.__chain__ = chainAll; return result; } return func.apply(object, arrayPush([this.value()], arguments)); }; } }); return object; } /** * Reverts the `_` variable to its previous value and returns a reference to * the `lodash` function. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @returns {Function} Returns the `lodash` function. * @example * * var lodash = _.noConflict(); */ function noConflict() { if (root._ === this) { root._ = oldDash; } return this; } /** * This method returns `undefined`. * * @static * @memberOf _ * @since 2.3.0 * @category Util * @example * * _.times(2, _.noop); * // => [undefined, undefined] */ function noop() { // No operation performed. } /** * Creates a function that gets the argument at index `n`. If `n` is negative, * the nth argument from the end is returned. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {number} [n=0] The index of the argument to return. * @returns {Function} Returns the new pass-thru function. * @example * * var func = _.nthArg(1); * func('a', 'b', 'c', 'd'); * // => 'b' * * var func = _.nthArg(-2); * func('a', 'b', 'c', 'd'); * // => 'c' */ function nthArg(n) { n = toInteger(n); return baseRest(function(args) { return baseNth(args, n); }); } /** * Creates a function that invokes `iteratees` with the arguments it receives * and returns their results. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {...(Function|Function[])} [iteratees=[_.identity]] * The iteratees to invoke. * @returns {Function} Returns the new function. * @example * * var func = _.over([Math.max, Math.min]); * * func(1, 2, 3, 4); * // => [4, 1] */ var over = createOver(arrayMap); /** * Creates a function that checks if **all** of the `predicates` return * truthy when invoked with the arguments it receives. * * Following shorthands are possible for providing predicates. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {...(Function|Function[])} [predicates=[_.identity]] * The predicates to check. * @returns {Function} Returns the new function. * @example * * var func = _.overEvery([Boolean, isFinite]); * * func('1'); * // => true * * func(null); * // => false * * func(NaN); * // => false */ var overEvery = createOver(arrayEvery); /** * Creates a function that checks if **any** of the `predicates` return * truthy when invoked with the arguments it receives. * * Following shorthands are possible for providing predicates. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {...(Function|Function[])} [predicates=[_.identity]] * The predicates to check. * @returns {Function} Returns the new function. * @example * * var func = _.overSome([Boolean, isFinite]); * * func('1'); * // => true * * func(null); * // => true * * func(NaN); * // => false * * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }]) * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]]) */ var overSome = createOver(arraySome); /** * Creates a function that returns the value at `path` of a given object. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. * @example * * var objects = [ * { 'a': { 'b': 2 } }, * { 'a': { 'b': 1 } } * ]; * * _.map(objects, _.property('a.b')); * // => [2, 1] * * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); * // => [1, 2] */ function property(path) { return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); } /** * The opposite of `_.property`; this method creates a function that returns * the value at a given path of `object`. * * @static * @memberOf _ * @since 3.0.0 * @category Util * @param {Object} object The object to query. * @returns {Function} Returns the new accessor function. * @example * * var array = [0, 1, 2], * object = { 'a': array, 'b': array, 'c': array }; * * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); * // => [2, 0] * * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); * // => [2, 0] */ function propertyOf(object) { return function(path) { return object == null ? undefined : baseGet(object, path); }; } /** * Creates an array of numbers (positive and/or negative) progressing from * `start` up to, but not including, `end`. A step of `-1` is used if a negative * `start` is specified without an `end` or `step`. If `end` is not specified, * it's set to `start` with `start` then set to `0`. * * **Note:** JavaScript follows the IEEE-754 standard for resolving * floating-point values which can produce unexpected results. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @param {number} [step=1] The value to increment or decrement by. * @returns {Array} Returns the range of numbers. * @see _.inRange, _.rangeRight * @example * * _.range(4); * // => [0, 1, 2, 3] * * _.range(-4); * // => [0, -1, -2, -3] * * _.range(1, 5); * // => [1, 2, 3, 4] * * _.range(0, 20, 5); * // => [0, 5, 10, 15] * * _.range(0, -4, -1); * // => [0, -1, -2, -3] * * _.range(1, 4, 0); * // => [1, 1, 1] * * _.range(0); * // => [] */ var range = createRange(); /** * This method is like `_.range` except that it populates values in * descending order. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @param {number} [step=1] The value to increment or decrement by. * @returns {Array} Returns the range of numbers. * @see _.inRange, _.range * @example * * _.rangeRight(4); * // => [3, 2, 1, 0] * * _.rangeRight(-4); * // => [-3, -2, -1, 0] * * _.rangeRight(1, 5); * // => [4, 3, 2, 1] * * _.rangeRight(0, 20, 5); * // => [15, 10, 5, 0] * * _.rangeRight(0, -4, -1); * // => [-3, -2, -1, 0] * * _.rangeRight(1, 4, 0); * // => [1, 1, 1] * * _.rangeRight(0); * // => [] */ var rangeRight = createRange(true); /** * This method returns a new empty array. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {Array} Returns the new empty array. * @example * * var arrays = _.times(2, _.stubArray); * * console.log(arrays); * // => [[], []] * * console.log(arrays[0] === arrays[1]); * // => false */ function stubArray() { return []; } /** * This method returns `false`. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {boolean} Returns `false`. * @example * * _.times(2, _.stubFalse); * // => [false, false] */ function stubFalse() { return false; } /** * This method returns a new empty object. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {Object} Returns the new empty object. * @example * * var objects = _.times(2, _.stubObject); * * console.log(objects); * // => [{}, {}] * * console.log(objects[0] === objects[1]); * // => false */ function stubObject() { return {}; } /** * This method returns an empty string. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {string} Returns the empty string. * @example * * _.times(2, _.stubString); * // => ['', ''] */ function stubString() { return ''; } /** * This method returns `true`. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {boolean} Returns `true`. * @example * * _.times(2, _.stubTrue); * // => [true, true] */ function stubTrue() { return true; } /** * Invokes the iteratee `n` times, returning an array of the results of * each invocation. The iteratee is invoked with one argument; (index). * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {number} n The number of times to invoke `iteratee`. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the array of results. * @example * * _.times(3, String); * // => ['0', '1', '2'] * * _.times(4, _.constant(0)); * // => [0, 0, 0, 0] */ function times(n, iteratee) { n = toInteger(n); if (n < 1 || n > MAX_SAFE_INTEGER) { return []; } var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH); iteratee = getIteratee(iteratee); n -= MAX_ARRAY_LENGTH; var result = baseTimes(length, iteratee); while (++index < n) { iteratee(index); } return result; } /** * Converts `value` to a property path array. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {*} value The value to convert. * @returns {Array} Returns the new property path array. * @example * * _.toPath('a.b.c'); * // => ['a', 'b', 'c'] * * _.toPath('a[0].b.c'); * // => ['a', '0', 'b', 'c'] */ function toPath(value) { if (isArray(value)) { return arrayMap(value, toKey); } return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); } /** * Generates a unique ID. If `prefix` is given, the ID is appended to it. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {string} [prefix=''] The value to prefix the ID with. * @returns {string} Returns the unique ID. * @example * * _.uniqueId('contact_'); * // => 'contact_104' * * _.uniqueId(); * // => '105' */ function uniqueId(prefix) { var id = ++idCounter; return toString(prefix) + id; } /*------------------------------------------------------------------------*/ /** * Adds two numbers. * * @static * @memberOf _ * @since 3.4.0 * @category Math * @param {number} augend The first number in an addition. * @param {number} addend The second number in an addition. * @returns {number} Returns the total. * @example * * _.add(6, 4); * // => 10 */ var add = createMathOperation(function(augend, addend) { return augend + addend; }, 0); /** * Computes `number` rounded up to `precision`. * * @static * @memberOf _ * @since 3.10.0 * @category Math * @param {number} number The number to round up. * @param {number} [precision=0] The precision to round up to. * @returns {number} Returns the rounded up number. * @example * * _.ceil(4.006); * // => 5 * * _.ceil(6.004, 2); * // => 6.01 * * _.ceil(6040, -2); * // => 6100 */ var ceil = createRound('ceil'); /** * Divide two numbers. * * @static * @memberOf _ * @since 4.7.0 * @category Math * @param {number} dividend The first number in a division. * @param {number} divisor The second number in a division. * @returns {number} Returns the quotient. * @example * * _.divide(6, 4); * // => 1.5 */ var divide = createMathOperation(function(dividend, divisor) { return dividend / divisor; }, 1); /** * Computes `number` rounded down to `precision`. * * @static * @memberOf _ * @since 3.10.0 * @category Math * @param {number} number The number to round down. * @param {number} [precision=0] The precision to round down to. * @returns {number} Returns the rounded down number. * @example * * _.floor(4.006); * // => 4 * * _.floor(0.046, 2); * // => 0.04 * * _.floor(4060, -2); * // => 4000 */ var floor = createRound('floor'); /** * Computes the maximum value of `array`. If `array` is empty or falsey, * `undefined` is returned. * * @static * @since 0.1.0 * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {*} Returns the maximum value. * @example * * _.max([4, 2, 8, 6]); * // => 8 * * _.max([]); * // => undefined */ function max(array) { return (array && array.length) ? baseExtremum(array, identity, baseGt) : undefined; } /** * This method is like `_.max` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * the value is ranked. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {*} Returns the maximum value. * @example * * var objects = [{ 'n': 1 }, { 'n': 2 }]; * * _.maxBy(objects, function(o) { return o.n; }); * // => { 'n': 2 } * * // The `_.property` iteratee shorthand. * _.maxBy(objects, 'n'); * // => { 'n': 2 } */ function maxBy(array, iteratee) { return (array && array.length) ? baseExtremum(array, getIteratee(iteratee, 2), baseGt) : undefined; } /** * Computes the mean of the values in `array`. * * @static * @memberOf _ * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. * @returns {number} Returns the mean. * @example * * _.mean([4, 2, 8, 6]); * // => 5 */ function mean(array) { return baseMean(array, identity); } /** * This method is like `_.mean` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the value to be averaged. * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.7.0 * @category Math * @param {Array} array The array to iterate over. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the mean. * @example * * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; * * _.meanBy(objects, function(o) { return o.n; }); * // => 5 * * // The `_.property` iteratee shorthand. * _.meanBy(objects, 'n'); * // => 5 */ function meanBy(array, iteratee) { return baseMean(array, getIteratee(iteratee, 2)); } /** * Computes the minimum value of `array`. If `array` is empty or falsey, * `undefined` is returned. * * @static * @since 0.1.0 * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {*} Returns the minimum value. * @example * * _.min([4, 2, 8, 6]); * // => 2 * * _.min([]); * // => undefined */ function min(array) { return (array && array.length) ? baseExtremum(array, identity, baseLt) : undefined; } /** * This method is like `_.min` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * the value is ranked. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {*} Returns the minimum value. * @example * * var objects = [{ 'n': 1 }, { 'n': 2 }]; * * _.minBy(objects, function(o) { return o.n; }); * // => { 'n': 1 } * * // The `_.property` iteratee shorthand. * _.minBy(objects, 'n'); * // => { 'n': 1 } */ function minBy(array, iteratee) { return (array && array.length) ? baseExtremum(array, getIteratee(iteratee, 2), baseLt) : undefined; } /** * Multiply two numbers. * * @static * @memberOf _ * @since 4.7.0 * @category Math * @param {number} multiplier The first number in a multiplication. * @param {number} multiplicand The second number in a multiplication. * @returns {number} Returns the product. * @example * * _.multiply(6, 4); * // => 24 */ var multiply = createMathOperation(function(multiplier, multiplicand) { return multiplier * multiplicand; }, 1); /** * Computes `number` rounded to `precision`. * * @static * @memberOf _ * @since 3.10.0 * @category Math * @param {number} number The number to round. * @param {number} [precision=0] The precision to round to. * @returns {number} Returns the rounded number. * @example * * _.round(4.006); * // => 4 * * _.round(4.006, 2); * // => 4.01 * * _.round(4060, -2); * // => 4100 */ var round = createRound('round'); /** * Subtract two numbers. * * @static * @memberOf _ * @since 4.0.0 * @category Math * @param {number} minuend The first number in a subtraction. * @param {number} subtrahend The second number in a subtraction. * @returns {number} Returns the difference. * @example * * _.subtract(6, 4); * // => 2 */ var subtract = createMathOperation(function(minuend, subtrahend) { return minuend - subtrahend; }, 0); /** * Computes the sum of the values in `array`. * * @static * @memberOf _ * @since 3.4.0 * @category Math * @param {Array} array The array to iterate over. * @returns {number} Returns the sum. * @example * * _.sum([4, 2, 8, 6]); * // => 20 */ function sum(array) { return (array && array.length) ? baseSum(array, identity) : 0; } /** * This method is like `_.sum` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the value to be summed. * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the sum. * @example * * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; * * _.sumBy(objects, function(o) { return o.n; }); * // => 20 * * // The `_.property` iteratee shorthand. * _.sumBy(objects, 'n'); * // => 20 */ function sumBy(array, iteratee) { return (array && array.length) ? baseSum(array, getIteratee(iteratee, 2)) : 0; } /*------------------------------------------------------------------------*/ // Add methods that return wrapped values in chain sequences. lodash.after = after; lodash.ary = ary; lodash.assign = assign; lodash.assignIn = assignIn; lodash.assignInWith = assignInWith; lodash.assignWith = assignWith; lodash.at = at; lodash.before = before; lodash.bind = bind; lodash.bindAll = bindAll; lodash.bindKey = bindKey; lodash.castArray = castArray; lodash.chain = chain; lodash.chunk = chunk; lodash.compact = compact; lodash.concat = concat; lodash.cond = cond; lodash.conforms = conforms; lodash.constant = constant; lodash.countBy = countBy; lodash.create = create; lodash.curry = curry; lodash.curryRight = curryRight; lodash.debounce = debounce; lodash.defaults = defaults; lodash.defaultsDeep = defaultsDeep; lodash.defer = defer; lodash.delay = delay; lodash.difference = difference; lodash.differenceBy = differenceBy; lodash.differenceWith = differenceWith; lodash.drop = drop; lodash.dropRight = dropRight; lodash.dropRightWhile = dropRightWhile; lodash.dropWhile = dropWhile; lodash.fill = fill; lodash.filter = filter; lodash.flatMap = flatMap; lodash.flatMapDeep = flatMapDeep; lodash.flatMapDepth = flatMapDepth; lodash.flatten = flatten; lodash.flattenDeep = flattenDeep; lodash.flattenDepth = flattenDepth; lodash.flip = flip; lodash.flow = flow; lodash.flowRight = flowRight; lodash.fromPairs = fromPairs; lodash.functions = functions; lodash.functionsIn = functionsIn; lodash.groupBy = groupBy; lodash.initial = initial; lodash.intersection = intersection; lodash.intersectionBy = intersectionBy; lodash.intersectionWith = intersectionWith; lodash.invert = invert; lodash.invertBy = invertBy; lodash.invokeMap = invokeMap; lodash.iteratee = iteratee; lodash.keyBy = keyBy; lodash.keys = keys; lodash.keysIn = keysIn; lodash.map = map; lodash.mapKeys = mapKeys; lodash.mapValues = mapValues; lodash.matches = matches; lodash.matchesProperty = matchesProperty; lodash.memoize = memoize; lodash.merge = merge; lodash.mergeWith = mergeWith; lodash.method = method; lodash.methodOf = methodOf; lodash.mixin = mixin; lodash.negate = negate; lodash.nthArg = nthArg; lodash.omit = omit; lodash.omitBy = omitBy; lodash.once = once; lodash.orderBy = orderBy; lodash.over = over; lodash.overArgs = overArgs; lodash.overEvery = overEvery; lodash.overSome = overSome; lodash.partial = partial; lodash.partialRight = partialRight; lodash.partition = partition; lodash.pick = pick; lodash.pickBy = pickBy; lodash.property = property; lodash.propertyOf = propertyOf; lodash.pull = pull; lodash.pullAll = pullAll; lodash.pullAllBy = pullAllBy; lodash.pullAllWith = pullAllWith; lodash.pullAt = pullAt; lodash.range = range; lodash.rangeRight = rangeRight; lodash.rearg = rearg; lodash.reject = reject; lodash.remove = remove; lodash.rest = rest; lodash.reverse = reverse; lodash.sampleSize = sampleSize; lodash.set = set; lodash.setWith = setWith; lodash.shuffle = shuffle; lodash.slice = slice; lodash.sortBy = sortBy; lodash.sortedUniq = sortedUniq; lodash.sortedUniqBy = sortedUniqBy; lodash.split = split; lodash.spread = spread; lodash.tail = tail; lodash.take = take; lodash.takeRight = takeRight; lodash.takeRightWhile = takeRightWhile; lodash.takeWhile = takeWhile; lodash.tap = tap; lodash.throttle = throttle; lodash.thru = thru; lodash.toArray = toArray; lodash.toPairs = toPairs; lodash.toPairsIn = toPairsIn; lodash.toPath = toPath; lodash.toPlainObject = toPlainObject; lodash.transform = transform; lodash.unary = unary; lodash.union = union; lodash.unionBy = unionBy; lodash.unionWith = unionWith; lodash.uniq = uniq; lodash.uniqBy = uniqBy; lodash.uniqWith = uniqWith; lodash.unset = unset; lodash.unzip = unzip; lodash.unzipWith = unzipWith; lodash.update = update; lodash.updateWith = updateWith; lodash.values = values; lodash.valuesIn = valuesIn; lodash.without = without; lodash.words = words; lodash.wrap = wrap; lodash.xor = xor; lodash.xorBy = xorBy; lodash.xorWith = xorWith; lodash.zip = zip; lodash.zipObject = zipObject; lodash.zipObjectDeep = zipObjectDeep; lodash.zipWith = zipWith; // Add aliases. lodash.entries = toPairs; lodash.entriesIn = toPairsIn; lodash.extend = assignIn; lodash.extendWith = assignInWith; // Add methods to `lodash.prototype`. mixin(lodash, lodash); /*------------------------------------------------------------------------*/ // Add methods that return unwrapped values in chain sequences. lodash.add = add; lodash.attempt = attempt; lodash.camelCase = camelCase; lodash.capitalize = capitalize; lodash.ceil = ceil; lodash.clamp = clamp; lodash.clone = clone; lodash.cloneDeep = cloneDeep; lodash.cloneDeepWith = cloneDeepWith; lodash.cloneWith = cloneWith; lodash.conformsTo = conformsTo; lodash.deburr = deburr; lodash.defaultTo = defaultTo; lodash.divide = divide; lodash.endsWith = endsWith; lodash.eq = eq; lodash.escape = escape; lodash.escapeRegExp = escapeRegExp; lodash.every = every; lodash.find = find; lodash.findIndex = findIndex; lodash.findKey = findKey; lodash.findLast = findLast; lodash.findLastIndex = findLastIndex; lodash.findLastKey = findLastKey; lodash.floor = floor; lodash.forEach = forEach; lodash.forEachRight = forEachRight; lodash.forIn = forIn; lodash.forInRight = forInRight; lodash.forOwn = forOwn; lodash.forOwnRight = forOwnRight; lodash.get = get; lodash.gt = gt; lodash.gte = gte; lodash.has = has; lodash.hasIn = hasIn; lodash.head = head; lodash.identity = identity; lodash.includes = includes; lodash.indexOf = indexOf; lodash.inRange = inRange; lodash.invoke = invoke; lodash.isArguments = isArguments; lodash.isArray = isArray; lodash.isArrayBuffer = isArrayBuffer; lodash.isArrayLike = isArrayLike; lodash.isArrayLikeObject = isArrayLikeObject; lodash.isBoolean = isBoolean; lodash.isBuffer = isBuffer; lodash.isDate = isDate; lodash.isElement = isElement; lodash.isEmpty = isEmpty; lodash.isEqual = isEqual; lodash.isEqualWith = isEqualWith; lodash.isError = isError; lodash.isFinite = isFinite; lodash.isFunction = isFunction; lodash.isInteger = isInteger; lodash.isLength = isLength; lodash.isMap = isMap; lodash.isMatch = isMatch; lodash.isMatchWith = isMatchWith; lodash.isNaN = isNaN; lodash.isNative = isNative; lodash.isNil = isNil; lodash.isNull = isNull; lodash.isNumber = isNumber; lodash.isObject = isObject; lodash.isObjectLike = isObjectLike; lodash.isPlainObject = isPlainObject; lodash.isRegExp = isRegExp; lodash.isSafeInteger = isSafeInteger; lodash.isSet = isSet; lodash.isString = isString; lodash.isSymbol = isSymbol; lodash.isTypedArray = isTypedArray; lodash.isUndefined = isUndefined; lodash.isWeakMap = isWeakMap; lodash.isWeakSet = isWeakSet; lodash.join = join; lodash.kebabCase = kebabCase; lodash.last = last; lodash.lastIndexOf = lastIndexOf; lodash.lowerCase = lowerCase; lodash.lowerFirst = lowerFirst; lodash.lt = lt; lodash.lte = lte; lodash.max = max; lodash.maxBy = maxBy; lodash.mean = mean; lodash.meanBy = meanBy; lodash.min = min; lodash.minBy = minBy; lodash.stubArray = stubArray; lodash.stubFalse = stubFalse; lodash.stubObject = stubObject; lodash.stubString = stubString; lodash.stubTrue = stubTrue; lodash.multiply = multiply; lodash.nth = nth; lodash.noConflict = noConflict; lodash.noop = noop; lodash.now = now; lodash.pad = pad; lodash.padEnd = padEnd; lodash.padStart = padStart; lodash.parseInt = parseInt; lodash.random = random; lodash.reduce = reduce; lodash.reduceRight = reduceRight; lodash.repeat = repeat; lodash.replace = replace; lodash.result = result; lodash.round = round; lodash.runInContext = runInContext; lodash.sample = sample; lodash.size = size; lodash.snakeCase = snakeCase; lodash.some = some; lodash.sortedIndex = sortedIndex; lodash.sortedIndexBy = sortedIndexBy; lodash.sortedIndexOf = sortedIndexOf; lodash.sortedLastIndex = sortedLastIndex; lodash.sortedLastIndexBy = sortedLastIndexBy; lodash.sortedLastIndexOf = sortedLastIndexOf; lodash.startCase = startCase; lodash.startsWith = startsWith; lodash.subtract = subtract; lodash.sum = sum; lodash.sumBy = sumBy; lodash.template = template; lodash.times = times; lodash.toFinite = toFinite; lodash.toInteger = toInteger; lodash.toLength = toLength; lodash.toLower = toLower; lodash.toNumber = toNumber; lodash.toSafeInteger = toSafeInteger; lodash.toString = toString; lodash.toUpper = toUpper; lodash.trim = trim; lodash.trimEnd = trimEnd; lodash.trimStart = trimStart; lodash.truncate = truncate; lodash.unescape = unescape; lodash.uniqueId = uniqueId; lodash.upperCase = upperCase; lodash.upperFirst = upperFirst; // Add aliases. lodash.each = forEach; lodash.eachRight = forEachRight; lodash.first = head; mixin(lodash, (function() { var source = {}; baseForOwn(lodash, function(func, methodName) { if (!hasOwnProperty.call(lodash.prototype, methodName)) { source[methodName] = func; } }); return source; }()), { 'chain': false }); /*------------------------------------------------------------------------*/ /** * The semantic version number. * * @static * @memberOf _ * @type {string} */ lodash.VERSION = VERSION; // Assign default placeholders. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) { lodash[methodName].placeholder = lodash; }); // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. arrayEach(['drop', 'take'], function(methodName, index) { LazyWrapper.prototype[methodName] = function(n) { n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = (this.__filtered__ && !index) ? new LazyWrapper(this) : this.clone(); if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); } else { result.__views__.push({ 'size': nativeMin(n, MAX_ARRAY_LENGTH), 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') }); } return result; }; LazyWrapper.prototype[methodName + 'Right'] = function(n) { return this.reverse()[methodName](n).reverse(); }; }); // Add `LazyWrapper` methods that accept an `iteratee` value. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; LazyWrapper.prototype[methodName] = function(iteratee) { var result = this.clone(); result.__iteratees__.push({ 'iteratee': getIteratee(iteratee, 3), 'type': type }); result.__filtered__ = result.__filtered__ || isFilter; return result; }; }); // Add `LazyWrapper` methods for `_.head` and `_.last`. arrayEach(['head', 'last'], function(methodName, index) { var takeName = 'take' + (index ? 'Right' : ''); LazyWrapper.prototype[methodName] = function() { return this[takeName](1).value()[0]; }; }); // Add `LazyWrapper` methods for `_.initial` and `_.tail`. arrayEach(['initial', 'tail'], function(methodName, index) { var dropName = 'drop' + (index ? '' : 'Right'); LazyWrapper.prototype[methodName] = function() { return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); }; }); LazyWrapper.prototype.compact = function() { return this.filter(identity); }; LazyWrapper.prototype.find = function(predicate) { return this.filter(predicate).head(); }; LazyWrapper.prototype.findLast = function(predicate) { return this.reverse().find(predicate); }; LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { if (typeof path == 'function') { return new LazyWrapper(this); } return this.map(function(value) { return baseInvoke(value, path, args); }); }); LazyWrapper.prototype.reject = function(predicate) { return this.filter(negate(getIteratee(predicate))); }; LazyWrapper.prototype.slice = function(start, end) { start = toInteger(start); var result = this; if (result.__filtered__ && (start > 0 || end < 0)) { return new LazyWrapper(result); } if (start < 0) { result = result.takeRight(-start); } else if (start) { result = result.drop(start); } if (end !== undefined) { end = toInteger(end); result = end < 0 ? result.dropRight(-end) : result.take(end - start); } return result; }; LazyWrapper.prototype.takeRightWhile = function(predicate) { return this.reverse().takeWhile(predicate).reverse(); }; LazyWrapper.prototype.toArray = function() { return this.take(MAX_ARRAY_LENGTH); }; // Add `LazyWrapper` methods to `lodash.prototype`. baseForOwn(LazyWrapper.prototype, function(func, methodName) { var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName], retUnwrapped = isTaker || /^find/.test(methodName); if (!lodashFunc) { return; } lodash.prototype[methodName] = function() { var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value); var interceptor = function(value) { var result = lodashFunc.apply(lodash, arrayPush([value], args)); return (isTaker && chainAll) ? result[0] : result; }; if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { // Avoid lazy use if the iteratee has a "length" value other than `1`. isLazy = useLazy = false; } var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid; if (!retUnwrapped && useLazy) { value = onlyLazy ? value : new LazyWrapper(this); var result = func.apply(value, args); result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); return new LodashWrapper(result, chainAll); } if (isUnwrapped && onlyLazy) { return func.apply(this, args); } result = this.thru(interceptor); return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result; }; }); // Add `Array` methods to `lodash.prototype`. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', retUnwrapped = /^(?:pop|shift)$/.test(methodName); lodash.prototype[methodName] = function() { var args = arguments; if (retUnwrapped && !this.__chain__) { var value = this.value(); return func.apply(isArray(value) ? value : [], args); } return this[chainName](function(value) { return func.apply(isArray(value) ? value : [], args); }); }; }); // Map minified method names to their real names. baseForOwn(LazyWrapper.prototype, function(func, methodName) { var lodashFunc = lodash[methodName]; if (lodashFunc) { var key = lodashFunc.name + ''; if (!hasOwnProperty.call(realNames, key)) { realNames[key] = []; } realNames[key].push({ 'name': methodName, 'func': lodashFunc }); } }); realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': undefined }]; // Add methods to `LazyWrapper`. LazyWrapper.prototype.clone = lazyClone; LazyWrapper.prototype.reverse = lazyReverse; LazyWrapper.prototype.value = lazyValue; // Add chain sequence methods to the `lodash` wrapper. lodash.prototype.at = wrapperAt; lodash.prototype.chain = wrapperChain; lodash.prototype.commit = wrapperCommit; lodash.prototype.next = wrapperNext; lodash.prototype.plant = wrapperPlant; lodash.prototype.reverse = wrapperReverse; lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; // Add lazy aliases. lodash.prototype.first = lodash.prototype.head; if (symIterator) { lodash.prototype[symIterator] = wrapperToIterator; } return lodash; }); /*--------------------------------------------------------------------------*/ // Export lodash. var _ = runInContext(); // Some AMD build optimizers, like r.js, check for condition patterns like: if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { // Expose Lodash on the global object to prevent errors when Lodash is // loaded by a script tag in the presence of an AMD loader. // See http://requirejs.org/docs/errors.html#mismatch for more details. // Use `_.noConflict` to remove Lodash from the global object. root._ = _; // Define as an anonymous module so, through path mapping, it can be // referenced as the "underscore" module. define(function() { return _; }); } // Check for `exports` after `define` in case a build optimizer adds it. else if (freeModule) { // Export for Node.js. (freeModule.exports = _)._ = _; // Export for CommonJS support. freeExports._ = _; } else { // Export to the global object. root._ = _; } }.call(this)); vendor/regenerator-runtime.js 0000644 00000061333 15151622574 0012413 0 ustar 00 /** * Copyright (c) 2014-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var runtime = (function (exports) { "use strict"; var Op = Object.prototype; var hasOwn = Op.hasOwnProperty; var defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }; var undefined; // More compressible than void 0. var $Symbol = typeof Symbol === "function" ? Symbol : {}; var iteratorSymbol = $Symbol.iterator || "@@iterator"; var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); return obj[key]; } try { // IE 8 has a broken Object.defineProperty that only works on DOM objects. define({}, ""); } catch (err) { define = function(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; var generator = Object.create(protoGenerator.prototype); var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next, // .throw, and .return methods. defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }); return generator; } exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion // record like context.tryEntries[i].completion. This interface could // have been (and was previously) designed to take a closure to be // invoked without arguments, but in all the cases we care about we // already have an existing method we want to call, so there's no need // to create a new function object. We can even get away with assuming // the method takes exactly one argument, since that happens to be true // in every case, so we don't have to touch the arguments object. The // only additional allocation required is the completion record, which // has a stable shape and so hopefully should be cheap to allocate. function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } var GenStateSuspendedStart = "suspendedStart"; var GenStateSuspendedYield = "suspendedYield"; var GenStateExecuting = "executing"; var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as // breaking out of the dispatch switch statement. var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and // .constructor.prototype properties for functions that return Generator // objects. For full spec compliance, you may wish to configure your // minifier not to mangle the names of these two functions. function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that // don't natively support it. var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf; var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { // This environment has a native %IteratorPrototype%; use it instead // of the polyfill. IteratorPrototype = NativeIteratorPrototype; } var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); GeneratorFunction.prototype = GeneratorFunctionPrototype; defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: true }); defineProperty( GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: true } ); GeneratorFunction.displayName = define( GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction" ); // Helper for defining the .next, .throw, and .return methods of the // Iterator interface in terms of a single ._invoke method. function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function(method) { define(prototype, method, function(arg) { return this._invoke(method, arg); }); }); } exports.isGeneratorFunction = function(genFun) { var ctor = typeof genFun === "function" && genFun.constructor; return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can // do is to check its .name property. (ctor.displayName || ctor.name) === "GeneratorFunction" : false; }; exports.mark = function(genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { genFun.__proto__ = GeneratorFunctionPrototype; define(genFun, toStringTagSymbol, "GeneratorFunction"); } genFun.prototype = Object.create(Gp); return genFun; }; // Within the body of any async function, `await x` is transformed to // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test // `hasOwn.call(value, "__await")` to determine if the yielded value is // meant to be awaited. exports.awrap = function(arg) { return { __await: arg }; }; function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (record.type === "throw") { reject(record.arg); } else { var result = record.arg; var value = result.value; if (value && typeof value === "object" && hasOwn.call(value, "__await")) { return PromiseImpl.resolve(value.__await).then(function(value) { invoke("next", value, resolve, reject); }, function(err) { invoke("throw", err, resolve, reject); }); } return PromiseImpl.resolve(value).then(function(unwrapped) { // When a yielded Promise is resolved, its final value becomes // the .value of the Promise<{value,done}> result for the // current iteration. result.value = unwrapped; resolve(result); }, function(error) { // If a rejected Promise was yielded, throw the rejection back // into the async generator function so it can be handled there. return invoke("throw", error, resolve, reject); }); } } var previousPromise; function enqueue(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function(resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = // If enqueue has been called before, then we want to wait until // all previous Promises have been resolved before calling invoke, // so that results are always delivered in the correct order. If // enqueue has not been called before, then it is important to // call invoke immediately, without waiting on a callback to fire, // so that the async generator function has the opportunity to do // any necessary setup in a predictable way. This predictability // is why the Promise constructor synchronously invokes its // executor callback, and why async functions synchronously // execute code before the first await. Since we implement simple // async functions in terms of async generators, it is especially // important to get this right, even though it requires care. previousPromise ? previousPromise.then( callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later // invocations of the iterator. callInvokeWithMethodAndArg ) : callInvokeWithMethodAndArg(); } // Define the unified helper method that is used to implement .next, // .throw, and .return (see defineIteratorMethods). defineProperty(this, "_invoke", { value: enqueue }); } defineIteratorMethods(AsyncIterator.prototype); define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }); exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of // AsyncIterator objects; they just return a Promise for the value of // the final result produced by the iterator. exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { if (PromiseImpl === void 0) PromiseImpl = Promise; var iter = new AsyncIterator( wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl ); return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. : iter.next().then(function(result) { return result.done ? result.value : iter.next(); }); }; function makeInvokeMethod(innerFn, self, context) { var state = GenStateSuspendedStart; return function invoke(method, arg) { if (state === GenStateExecuting) { throw new Error("Generator is already running"); } if (state === GenStateCompleted) { if (method === "throw") { throw arg; } // Be forgiving, per GeneratorResume behavior specified since ES2015: // ES2015 spec, step 3: https://262.ecma-international.org/6.0/#sec-generatorresume // Latest spec, step 2: https://tc39.es/ecma262/#sec-generatorresume return doneResult(); } context.method = method; context.arg = arg; while (true) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (context.method === "next") { // Setting context._sent for legacy support of Babel's // function.sent implementation. context.sent = context._sent = context.arg; } else if (context.method === "throw") { if (state === GenStateSuspendedStart) { state = GenStateCompleted; throw context.arg; } context.dispatchException(context.arg); } else if (context.method === "return") { context.abrupt("return", context.arg); } state = GenStateExecuting; var record = tryCatch(innerFn, self, context); if (record.type === "normal") { // If an exception is thrown from innerFn, we leave state === // GenStateExecuting and loop back for another invocation. state = context.done ? GenStateCompleted : GenStateSuspendedYield; if (record.arg === ContinueSentinel) { continue; } return { value: record.arg, done: context.done }; } else if (record.type === "throw") { state = GenStateCompleted; // Dispatch the exception by looping back around to the // context.dispatchException(context.arg) call above. context.method = "throw"; context.arg = record.arg; } } }; } // Call delegate.iterator[context.method](context.arg) and handle the // result, either by returning a { value, done } result from the // delegate iterator, or by modifying context.method and context.arg, // setting context.delegate to null, and returning the ContinueSentinel. function maybeInvokeDelegate(delegate, context) { var methodName = context.method; var method = delegate.iterator[methodName]; if (method === undefined) { // A .throw or .return when the delegate iterator has no .throw // method, or a missing .next method, always terminate the // yield* loop. context.delegate = null; // Note: ["return"] must be used for ES3 parsing compatibility. if (methodName === "throw" && delegate.iterator["return"]) { // If the delegate iterator has a return method, give it a // chance to clean up. context.method = "return"; context.arg = undefined; maybeInvokeDelegate(delegate, context); if (context.method === "throw") { // If maybeInvokeDelegate(context) changed context.method from // "return" to "throw", let that override the TypeError below. return ContinueSentinel; } } if (methodName !== "return") { context.method = "throw"; context.arg = new TypeError( "The iterator does not provide a '" + methodName + "' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (record.type === "throw") { context.method = "throw"; context.arg = record.arg; context.delegate = null; return ContinueSentinel; } var info = record.arg; if (! info) { context.method = "throw"; context.arg = new TypeError("iterator result is not an object"); context.delegate = null; return ContinueSentinel; } if (info.done) { // Assign the result of the finished delegate to the temporary // variable specified by delegate.resultName (see delegateYield). context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield). context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the // exception, let the outer generator proceed normally. If // context.method was "next", forget context.arg since it has been // "consumed" by the delegate iterator. If context.method was // "return", allow the original .return call to continue in the // outer generator. if (context.method !== "return") { context.method = "next"; context.arg = undefined; } } else { // Re-yield the result returned by the delegate method. return info; } // The delegate iterator is finished, so forget it and continue with // the outer generator. context.delegate = null; return ContinueSentinel; } // Define Generator.prototype.{next,throw,return} in terms of the // unified ._invoke helper method. defineIteratorMethods(Gp); define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the // @@iterator function is called on it. Some browsers' implementations of the // iterator prototype chain incorrectly implement this, causing the Generator // object to not be returned from this call. This ensures that doesn't happen. // See https://github.com/facebook/regenerator/issues/274 for more details. define(Gp, iteratorSymbol, function() { return this; }); define(Gp, "toString", function() { return "[object Generator]"; }); function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; if (1 in locs) { entry.catchLoc = locs[1]; } if (2 in locs) { entry.finallyLoc = locs[2]; entry.afterLoc = locs[3]; } this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal"; delete record.arg; entry.completion = record; } function Context(tryLocsList) { // The root entry object (effectively a try statement without a catch // or a finally block) gives us a place to store values thrown from // locations where there is no enclosing try statement. this.tryEntries = [{ tryLoc: "root" }]; tryLocsList.forEach(pushTryEntry, this); this.reset(true); } exports.keys = function(val) { var object = Object(val); var keys = []; for (var key in object) { keys.push(key); } keys.reverse(); // Rather than returning an object with a next method, we keep // things simple and return the next function itself. return function next() { while (keys.length) { var key = keys.pop(); if (key in object) { next.value = key; next.done = false; return next; } } // To avoid creating an additional object, we just hang the .value // and .done properties off the next function object itself. This // also ensures that the minifier will not anonymize the function. next.done = true; return next; }; }; function values(iterable) { if (iterable != null) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) { return iteratorMethod.call(iterable); } if (typeof iterable.next === "function") { return iterable; } if (!isNaN(iterable.length)) { var i = -1, next = function next() { while (++i < iterable.length) { if (hasOwn.call(iterable, i)) { next.value = iterable[i]; next.done = false; return next; } } next.value = undefined; next.done = true; return next; }; return next.next = next; } } throw new TypeError(typeof iterable + " is not iterable"); } exports.values = values; function doneResult() { return { value: undefined, done: true }; } Context.prototype = { constructor: Context, reset: function(skipTempReset) { this.prev = 0; this.next = 0; // Resetting context._sent for legacy support of Babel's // function.sent implementation. this.sent = this._sent = undefined; this.done = false; this.delegate = null; this.method = "next"; this.arg = undefined; this.tryEntries.forEach(resetTryEntry); if (!skipTempReset) { for (var name in this) { // Not sure about the optimal order of these conditions: if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { this[name] = undefined; } } } }, stop: function() { this.done = true; var rootEntry = this.tryEntries[0]; var rootRecord = rootEntry.completion; if (rootRecord.type === "throw") { throw rootRecord.arg; } return this.rval; }, dispatchException: function(exception) { if (this.done) { throw exception; } var context = this; function handle(loc, caught) { record.type = "throw"; record.arg = exception; context.next = loc; if (caught) { // If the dispatched exception was caught by a catch block, // then let that catch block handle the exception normally. context.method = "next"; context.arg = undefined; } return !! caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; var record = entry.completion; if (entry.tryLoc === "root") { // Exception thrown outside of any try block that could handle // it, so set the completion value of the entire function to // throw the exception. return handle("end"); } if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"); var hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } else if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else if (hasCatch) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } } else if (hasFinally) { if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else { throw new Error("try statement without catch or finally"); } } } }, abrupt: function(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { // Ignore the finally entry if control is not jumping to a // location outside the try/catch block. finallyEntry = null; } var record = finallyEntry ? finallyEntry.completion : {}; record.type = type; record.arg = arg; if (finallyEntry) { this.method = "next"; this.next = finallyEntry.finallyLoc; return ContinueSentinel; } return this.complete(record); }, complete: function(record, afterLoc) { if (record.type === "throw") { throw record.arg; } if (record.type === "break" || record.type === "continue") { this.next = record.arg; } else if (record.type === "return") { this.rval = this.arg = record.arg; this.method = "return"; this.next = "end"; } else if (record.type === "normal" && afterLoc) { this.next = afterLoc; } return ContinueSentinel; }, finish: function(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) { this.complete(entry.completion, entry.afterLoc); resetTryEntry(entry); return ContinueSentinel; } } }, "catch": function(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (record.type === "throw") { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } // The context.catch method must only be called with a location // argument that corresponds to a known catch block. throw new Error("illegal catch attempt"); }, delegateYield: function(iterable, resultName, nextLoc) { this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }; if (this.method === "next") { // Deliberately forget the last sent value so that we don't // accidentally pass it on to the delegate. this.arg = undefined; } return ContinueSentinel; } }; // Regardless of whether this script is executing as a CommonJS module // or not, return the runtime object so that we can declare the variable // regeneratorRuntime in the outer scope, which allows this module to be // injected easily by `bin/regenerator --include-runtime script.js`. return exports; }( // If this script is executing as a CommonJS module, use module.exports // as the regeneratorRuntime namespace. Otherwise create a new empty // object. Either way, the resulting object will be used to initialize // the regeneratorRuntime variable at the top of this file. typeof module === "object" ? module.exports : {} )); try { regeneratorRuntime = runtime; } catch (accidentalStrictMode) { // This module should not be running in strict mode, so the above // assignment should always work unless something is misconfigured. Just // in case runtime.js accidentally runs in strict mode, in modern engines // we can explicitly access globalThis. In older engines we can escape // strict mode using a global Function call. This could conceivably fail // if a Content Security Policy forbids using Function, but in that case // the proper solution is to fix the accidental strict mode problem. If // you've misconfigured your bundler to force strict mode and applied a // CSP to forbid Function, and you're not willing to fix either of those // problems, please detail your unique predicament in a GitHub issue. if (typeof globalThis === "object") { globalThis.regeneratorRuntime = runtime; } else { Function("r", "regeneratorRuntime = r")(runtime); } } vendor/wp-polyfill-dom-rect.min.js 0000644 00000001534 15151622574 0013162 0 ustar 00 (()=>{function e(e){return void 0===e?0:Number(e)}function t(e,t){return!(e===t||isNaN(e)&&isNaN(t))}self.DOMRect=function(n,i,u,r){var o,f,a,c,m=e(n),b=e(i),d=e(u),g=e(r);Object.defineProperties(this,{x:{get:function(){return m},set:function(e){t(m,e)&&(m=e,o=f=void 0)},enumerable:!0},y:{get:function(){return b},set:function(e){t(b,e)&&(b=e,a=c=void 0)},enumerable:!0},width:{get:function(){return d},set:function(e){t(d,e)&&(d=e,o=f=void 0)},enumerable:!0},height:{get:function(){return g},set:function(e){t(g,e)&&(g=e,a=c=void 0)},enumerable:!0},left:{get:function(){return o=void 0===o?m+Math.min(0,d):o},enumerable:!0},right:{get:function(){return f=void 0===f?m+Math.max(0,d):f},enumerable:!0},top:{get:function(){return a=void 0===a?b+Math.min(0,g):a},enumerable:!0},bottom:{get:function(){return c=void 0===c?b+Math.max(0,g):c},enumerable:!0}})}})(); dom.min.js 0000644 00000030466 15151622574 0006464 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{__unstableStripHTML:()=>J,computeCaretRect:()=>b,documentHasSelection:()=>w,documentHasTextSelection:()=>N,documentHasUncollapsedSelection:()=>C,focus:()=>ct,getFilesFromDataTransfer:()=>st,getOffsetParent:()=>S,getPhrasingContentSchema:()=>et,getRectangleFromRange:()=>g,getScrollContainer:()=>v,insertAfter:()=>q,isEmpty:()=>K,isEntirelySelected:()=>A,isFormElement:()=>D,isHorizontalEdge:()=>H,isNumberInput:()=>V,isPhrasingContent:()=>nt,isRTL:()=>P,isSelectionForward:()=>x,isTextContent:()=>rt,isTextField:()=>E,isVerticalEdge:()=>B,placeCaretAtHorizontalEdge:()=>U,placeCaretAtVerticalEdge:()=>z,remove:()=>W,removeInvalidHTML:()=>at,replace:()=>k,replaceTag:()=>G,safeHTML:()=>$,unwrap:()=>X,wrap:()=>Y});var n={};t.r(n),t.d(n,{find:()=>i});var r={};function o(t){return t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0}function i(t,{sequential:e=!1}={}){const n=t.querySelectorAll(function(t){return[t?'[tabindex]:not([tabindex^="-"])':"[tabindex]","a[href]","button:not([disabled])",'input:not([type="hidden"]):not([disabled])',"select:not([disabled])","textarea:not([disabled])",'iframe:not([tabindex^="-"])',"object","embed","summary","area[href]","[contenteditable]:not([contenteditable=false])"].join(",")}(e));return Array.from(n).filter((t=>{if(!o(t))return!1;const{nodeName:e}=t;return"AREA"!==e||function(t){const e=t.closest("map[name]");if(!e)return!1;const n=t.ownerDocument.querySelector('img[usemap="#'+e.name+'"]');return!!n&&o(n)}(t)}))}function a(t){const e=t.getAttribute("tabindex");return null===e?0:parseInt(e,10)}function s(t){return-1!==a(t)}function c(t,e){return{element:t,index:e}}function l(t){return t.element}function u(t,e){const n=a(t.element),r=a(e.element);return n===r?t.index-e.index:n-r}function d(t){return t.filter(s).map(c).sort(u).map(l).reduce(function(){const t={};return function(e,n){const{nodeName:r,type:o,checked:i,name:a}=n;if("INPUT"!==r||"radio"!==o||!a)return e.concat(n);const s=t.hasOwnProperty(a);if(!i&&s)return e;if(s){const n=t[a];e=e.filter((t=>t!==n))}return t[a]=n,e.concat(n)}}(),[])}function f(t){return d(i(t))}function m(t){return d(i(t.ownerDocument.body)).reverse().find((e=>t.compareDocumentPosition(e)&t.DOCUMENT_POSITION_PRECEDING))}function h(t){return d(i(t.ownerDocument.body)).find((e=>t.compareDocumentPosition(e)&t.DOCUMENT_POSITION_FOLLOWING))}function p(t,e){0}function g(t){if(!t.collapsed){const e=Array.from(t.getClientRects());if(1===e.length)return e[0];const n=e.filter((({width:t})=>t>1));if(0===n.length)return t.getBoundingClientRect();if(1===n.length)return n[0];let{top:r,bottom:o,left:i,right:a}=n[0];for(const{top:t,bottom:e,left:s,right:c}of n)t<r&&(r=t),e>o&&(o=e),s<i&&(i=s),c>a&&(a=c);return new window.DOMRect(i,r,a-i,o-r)}const{startContainer:e}=t,{ownerDocument:n}=e;if("BR"===e.nodeName){const{parentNode:r}=e;p();const o=Array.from(r.childNodes).indexOf(e);p(),(t=n.createRange()).setStart(r,o),t.setEnd(r,o)}const r=t.getClientRects();if(r.length>1)return null;let o=r[0];if(!o||0===o.height){p();const e=n.createTextNode("");(t=t.cloneRange()).insertNode(e),o=t.getClientRects()[0],p(e.parentNode),e.parentNode.removeChild(e)}return o}function b(t){const e=t.getSelection();p();const n=e.rangeCount?e.getRangeAt(0):null;return n?g(n):null}function N(t){p(t.defaultView);const e=t.defaultView.getSelection();p();const n=e.rangeCount?e.getRangeAt(0):null;return!!n&&!n.collapsed}function y(t){return"INPUT"===t?.nodeName}function E(t){return y(t)&&t.type&&!["button","checkbox","hidden","file","radio","image","range","reset","submit","number","email","time"].includes(t.type)||"TEXTAREA"===t.nodeName||"true"===t.contentEditable}function C(t){return N(t)||!!t.activeElement&&function(t){if(!y(t)&&!E(t))return!1;try{const{selectionStart:e,selectionEnd:n}=t;return null===e||e!==n}catch(t){return!0}}(t.activeElement)}function w(t){return!!t.activeElement&&(y(t.activeElement)||E(t.activeElement)||N(t))}function T(t){return p(t.ownerDocument.defaultView),t.ownerDocument.defaultView.getComputedStyle(t)}function v(t,e="vertical"){if(t){if(("vertical"===e||"all"===e)&&t.scrollHeight>t.clientHeight){const{overflowY:e}=T(t);if(/(auto|scroll)/.test(e))return t}if(("horizontal"===e||"all"===e)&&t.scrollWidth>t.clientWidth){const{overflowX:e}=T(t);if(/(auto|scroll)/.test(e))return t}return t.ownerDocument===t.parentNode?t:v(t.parentNode,e)}}function S(t){let e;for(;(e=t.parentNode)&&e.nodeType!==e.ELEMENT_NODE;);return e?"static"!==T(e).position?e:e.offsetParent:null}function O(t){return"INPUT"===t.tagName||"TEXTAREA"===t.tagName}function A(t){if(O(t))return 0===t.selectionStart&&t.value.length===t.selectionEnd;if(!t.isContentEditable)return!0;const{ownerDocument:e}=t,{defaultView:n}=e;p();const r=n.getSelection();p();const o=r.rangeCount?r.getRangeAt(0):null;if(!o)return!0;const{startContainer:i,endContainer:a,startOffset:s,endOffset:c}=o;if(i===t&&a===t&&0===s&&c===t.childNodes.length)return!0;t.lastChild;p();const l=a.nodeType===a.TEXT_NODE?a.data.length:a.childNodes.length;return R(i,t,"firstChild")&&R(a,t,"lastChild")&&0===s&&c===l}function R(t,e,n){let r=e;do{if(t===r)return!0;r=r[n]}while(r);return!1}function D(t){if(!t)return!1;const{tagName:e}=t;return O(t)||"BUTTON"===e||"SELECT"===e}function P(t){return"rtl"===T(t).direction}function x(t){const{anchorNode:e,focusNode:n,anchorOffset:r,focusOffset:o}=t;p(),p();const i=e.compareDocumentPosition(n);return!(i&e.DOCUMENT_POSITION_PRECEDING)&&(!!(i&e.DOCUMENT_POSITION_FOLLOWING)||(0!==i||r<=o))}function L(t,e,n,r){const o=r.style.zIndex,i=r.style.position,{position:a="static"}=T(r);"static"===a&&(r.style.position="relative"),r.style.zIndex="10000";const s=function(t,e,n){if(t.caretRangeFromPoint)return t.caretRangeFromPoint(e,n);if(!t.caretPositionFromPoint)return null;const r=t.caretPositionFromPoint(e,n);if(!r)return null;const o=t.createRange();return o.setStart(r.offsetNode,r.offset),o.collapse(!0),o}(t,e,n);return r.style.zIndex=o,r.style.position=i,s}function M(t,e,n){let r=n();return r&&r.startContainer&&t.contains(r.startContainer)||(t.scrollIntoView(e),r=n(),r&&r.startContainer&&t.contains(r.startContainer))?r:null}function I(t,e,n=!1){if(O(t)&&"number"==typeof t.selectionStart)return t.selectionStart===t.selectionEnd&&(e?0===t.selectionStart:t.value.length===t.selectionStart);if(!t.isContentEditable)return!0;const{ownerDocument:r}=t,{defaultView:o}=r;p();const i=o.getSelection();if(!i||!i.rangeCount)return!1;const a=i.getRangeAt(0),s=a.cloneRange(),c=x(i),l=i.isCollapsed;l||s.collapse(!c);const u=g(s),d=g(a);if(!u||!d)return!1;const f=function(t){const e=Array.from(t.getClientRects());if(!e.length)return;const n=Math.min(...e.map((({top:t})=>t)));return Math.max(...e.map((({bottom:t})=>t)))-n}(a);if(!l&&f&&f>u.height&&c===e)return!1;const m=P(t)?!e:e,h=t.getBoundingClientRect(),b=m?h.left+1:h.right-1,N=e?h.top+1:h.bottom-1,y=M(t,e,(()=>L(r,b,N,t)));if(!y)return!1;const E=g(y);if(!E)return!1;const C=e?"top":"bottom",w=m?"left":"right",T=E[C]-d[C],v=E[w]-u[w],S=Math.abs(T)<=1,A=Math.abs(v)<=1;return n?S:S&&A}function H(t,e){return I(t,e)}t.r(r),t.d(r,{find:()=>f,findNext:()=>h,findPrevious:()=>m,isTabbableIndex:()=>s});const _=window.wp.deprecated;var F=t.n(_);function V(t){return F()("wp.dom.isNumberInput",{since:"6.1",version:"6.5"}),y(t)&&"number"===t.type&&!isNaN(t.valueAsNumber)}function B(t,e){return I(t,e,!0)}function j(t,e,n){if(!t)return;if(t.focus(),O(t)){if("number"!=typeof t.selectionStart)return;return void(e?(t.selectionStart=t.value.length,t.selectionEnd=t.value.length):(t.selectionStart=0,t.selectionEnd=0))}if(!t.isContentEditable)return;const r=M(t,e,(()=>function(t,e,n){const{ownerDocument:r}=t,o=P(t)?!e:e,i=t.getBoundingClientRect();return void 0===n?n=e?i.right-1:i.left+1:n<=i.left?n=i.left+1:n>=i.right&&(n=i.right-1),L(r,n,o?i.bottom-1:i.top+1,t)}(t,e,n)));if(!r)return;const{ownerDocument:o}=t,{defaultView:i}=o;p();const a=i.getSelection();p(),a.removeAllRanges(),a.addRange(r)}function U(t,e){return j(t,e,void 0)}function z(t,e,n){return j(t,e,n?.left)}function q(t,e){p(e.parentNode),e.parentNode.insertBefore(t,e.nextSibling)}function W(t){p(t.parentNode),t.parentNode.removeChild(t)}function k(t,e){p(t.parentNode),q(e,t.parentNode),W(t)}function X(t){const e=t.parentNode;for(p();t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}function G(t,e){const n=t.ownerDocument.createElement(e);for(;t.firstChild;)n.appendChild(t.firstChild);return p(t.parentNode),t.parentNode.replaceChild(n,t),n}function Y(t,e){p(e.parentNode),e.parentNode.insertBefore(t,e),t.appendChild(e)}function $(t){const{body:e}=document.implementation.createHTMLDocument("");e.innerHTML=t;const n=e.getElementsByTagName("*");let r=n.length;for(;r--;){const t=n[r];if("SCRIPT"===t.tagName)W(t);else{let e=t.attributes.length;for(;e--;){const{name:n}=t.attributes[e];n.startsWith("on")&&t.removeAttribute(n)}}}return e.innerHTML}function J(t){t=$(t);const e=document.implementation.createHTMLDocument("");return e.body.innerHTML=t,e.body.textContent||""}function K(t){switch(t.nodeType){case t.TEXT_NODE:return/^[ \f\n\r\t\v\u00a0]*$/.test(t.nodeValue||"");case t.ELEMENT_NODE:return!t.hasAttributes()&&(!t.hasChildNodes()||Array.from(t.childNodes).every(K));default:return!0}}const Q={strong:{},em:{},s:{},del:{},ins:{},a:{attributes:["href","target","rel","id"]},code:{},abbr:{attributes:["title"]},sub:{},sup:{},br:{},small:{},q:{attributes:["cite"]},dfn:{attributes:["title"]},data:{attributes:["value"]},time:{attributes:["datetime"]},var:{},samp:{},kbd:{},i:{},b:{},u:{},mark:{},ruby:{},rt:{},rp:{},bdi:{attributes:["dir"]},bdo:{attributes:["dir"]},wbr:{},"#text":{}},Z=["#text","br"];Object.keys(Q).filter((t=>!Z.includes(t))).forEach((t=>{const{[t]:e,...n}=Q;Q[t].children=n}));const tt={...Q,audio:{attributes:["src","preload","autoplay","mediagroup","loop","muted"]},canvas:{attributes:["width","height"]},embed:{attributes:["src","type","width","height"]},img:{attributes:["alt","src","srcset","usemap","ismap","width","height"]},object:{attributes:["data","type","name","usemap","form","width","height"]},video:{attributes:["src","poster","preload","playsinline","autoplay","mediagroup","loop","muted","controls","width","height"]},math:{attributes:["display","xmlns"],children:"*"}};function et(t){if("paste"!==t)return tt;const{u:e,abbr:n,data:r,time:o,wbr:i,bdi:a,bdo:s,...c}={...tt,ins:{children:tt.ins.children},del:{children:tt.del.children}};return c}function nt(t){const e=t.nodeName.toLowerCase();return et().hasOwnProperty(e)||"span"===e}function rt(t){const e=t.nodeName.toLowerCase();return Q.hasOwnProperty(e)||"span"===e}const ot=()=>{};function it(t,e,n,r){Array.from(t).forEach((t=>{const o=t.nodeName.toLowerCase();if(!n.hasOwnProperty(o)||n[o].isMatch&&!n[o].isMatch?.(t))it(t.childNodes,e,n,r),r&&!nt(t)&&t.nextElementSibling&&q(e.createElement("br"),t),X(t);else if(function(t){return!!t&&t.nodeType===t.ELEMENT_NODE}(t)){const{attributes:i=[],classes:a=[],children:s,require:c=[],allowEmpty:l}=n[o];if(s&&!l&&K(t))return void W(t);if(t.hasAttributes()&&(Array.from(t.attributes).forEach((({name:e})=>{"class"===e||i.includes(e)||t.removeAttribute(e)})),t.classList&&t.classList.length)){const e=a.map((t=>"*"===t?()=>!0:"string"==typeof t?e=>e===t:t instanceof RegExp?e=>t.test(e):ot));Array.from(t.classList).forEach((n=>{e.some((t=>t(n)))||t.classList.remove(n)})),t.classList.length||t.removeAttribute("class")}if(t.hasChildNodes()){if("*"===s)return;if(s)c.length&&!t.querySelector(c.join(","))?(it(t.childNodes,e,n,r),X(t)):t.parentNode&&"BODY"===t.parentNode.nodeName&&nt(t)?(it(t.childNodes,e,n,r),Array.from(t.childNodes).some((t=>!nt(t)))&&X(t)):it(t.childNodes,e,s,r);else for(;t.firstChild;)W(t.firstChild)}}}))}function at(t,e,n){const r=document.implementation.createHTMLDocument("");return r.body.innerHTML=t,it(r.body.childNodes,r,e,n),r.body.innerHTML}function st(t){const e=Array.from(t.files);return Array.from(t.items).forEach((t=>{const n=t.getAsFile();n&&!e.find((({name:t,type:e,size:r})=>t===n.name&&e===n.type&&r===n.size))&&e.push(n)})),e}const ct={focusable:n,tabbable:r};(window.wp=window.wp||{}).dom=e})(); media-utils.js 0000644 00000056543 15151622574 0007344 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { MediaUpload: () => (/* reexport */ media_upload_default), privateApis: () => (/* reexport */ privateApis), transformAttachment: () => (/* reexport */ transformAttachment), uploadMedia: () => (/* reexport */ uploadMedia), validateFileSize: () => (/* reexport */ validateFileSize), validateMimeType: () => (/* reexport */ validateMimeType), validateMimeTypeForUser: () => (/* reexport */ validateMimeTypeForUser) }); ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// ./node_modules/@wordpress/media-utils/build-module/components/media-upload/index.js const DEFAULT_EMPTY_GALLERY = []; const getFeaturedImageMediaFrame = () => { const { wp } = window; return wp.media.view.MediaFrame.Select.extend({ /** * Enables the Set Featured Image Button. * * @param {Object} toolbar toolbar for featured image state * @return {void} */ featuredImageToolbar(toolbar) { this.createSelectToolbar(toolbar, { text: wp.media.view.l10n.setFeaturedImage, state: this.options.state }); }, /** * Handle the edit state requirements of selected media item. * * @return {void} */ editState() { const selection = this.state("featured-image").get("selection"); const view = new wp.media.view.EditImage({ model: selection.single(), controller: this }).render(); this.content.set(view); view.loadEditor(); }, /** * Create the default states. * * @return {void} */ createStates: function createStates() { this.on( "toolbar:create:featured-image", this.featuredImageToolbar, this ); this.on("content:render:edit-image", this.editState, this); this.states.add([ new wp.media.controller.FeaturedImage(), new wp.media.controller.EditImage({ model: this.options.editImage }) ]); } }); }; const getSingleMediaFrame = () => { const { wp } = window; return wp.media.view.MediaFrame.Select.extend({ /** * Create the default states on the frame. */ createStates() { const options = this.options; if (this.options.states) { return; } this.states.add([ // Main states. new wp.media.controller.Library({ library: wp.media.query(options.library), multiple: options.multiple, title: options.title, priority: 20, filterable: "uploaded" // Allow filtering by uploaded images. }), new wp.media.controller.EditImage({ model: options.editImage }) ]); } }); }; const getGalleryDetailsMediaFrame = () => { const { wp } = window; return wp.media.view.MediaFrame.Post.extend({ /** * Set up gallery toolbar. * * @return {void} */ galleryToolbar() { const editing = this.state().get("editing"); this.toolbar.set( new wp.media.view.Toolbar({ controller: this, items: { insert: { style: "primary", text: editing ? wp.media.view.l10n.updateGallery : wp.media.view.l10n.insertGallery, priority: 80, requires: { library: true }, /** * @fires wp.media.controller.State#update */ click() { const controller = this.controller, state = controller.state(); controller.close(); state.trigger( "update", state.get("library") ); controller.setState(controller.options.state); controller.reset(); } } } }) ); }, /** * Handle the edit state requirements of selected media item. * * @return {void} */ editState() { const selection = this.state("gallery").get("selection"); const view = new wp.media.view.EditImage({ model: selection.single(), controller: this }).render(); this.content.set(view); view.loadEditor(); }, /** * Create the default states. * * @return {void} */ createStates: function createStates() { this.on("toolbar:create:main-gallery", this.galleryToolbar, this); this.on("content:render:edit-image", this.editState, this); this.states.add([ new wp.media.controller.Library({ id: "gallery", title: wp.media.view.l10n.createGalleryTitle, priority: 40, toolbar: "main-gallery", filterable: "uploaded", multiple: "add", editable: false, library: wp.media.query({ type: "image", ...this.options.library }) }), new wp.media.controller.EditImage({ model: this.options.editImage }), new wp.media.controller.GalleryEdit({ library: this.options.selection, editing: this.options.editing, menu: "gallery", displaySettings: false, multiple: true }), new wp.media.controller.GalleryAdd() ]); } }); }; const slimImageObject = (img) => { const attrSet = [ "sizes", "mime", "type", "subtype", "id", "url", "alt", "link", "caption" ]; return attrSet.reduce((result, key) => { if (img?.hasOwnProperty(key)) { result[key] = img[key]; } return result; }, {}); }; const getAttachmentsCollection = (ids) => { const { wp } = window; return wp.media.query({ order: "ASC", orderby: "post__in", post__in: ids, posts_per_page: -1, query: true, type: "image" }); }; class MediaUpload extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); this.openModal = this.openModal.bind(this); this.onOpen = this.onOpen.bind(this); this.onSelect = this.onSelect.bind(this); this.onUpdate = this.onUpdate.bind(this); this.onClose = this.onClose.bind(this); } initializeListeners() { this.frame.on("select", this.onSelect); this.frame.on("update", this.onUpdate); this.frame.on("open", this.onOpen); this.frame.on("close", this.onClose); } /** * Sets the Gallery frame and initializes listeners. * * @return {void} */ buildAndSetGalleryFrame() { const { addToGallery = false, allowedTypes, multiple = false, value = DEFAULT_EMPTY_GALLERY } = this.props; if (value === this.lastGalleryValue) { return; } const { wp } = window; this.lastGalleryValue = value; if (this.frame) { this.frame.remove(); } let currentState; if (addToGallery) { currentState = "gallery-library"; } else { currentState = value && value.length ? "gallery-edit" : "gallery"; } if (!this.GalleryDetailsMediaFrame) { this.GalleryDetailsMediaFrame = getGalleryDetailsMediaFrame(); } const attachments = getAttachmentsCollection(value); const selection = new wp.media.model.Selection(attachments.models, { props: attachments.props.toJSON(), multiple }); this.frame = new this.GalleryDetailsMediaFrame({ mimeType: allowedTypes, state: currentState, multiple, selection, editing: !!value?.length }); wp.media.frame = this.frame; this.initializeListeners(); } /** * Initializes the Media Library requirements for the featured image flow. * * @return {void} */ buildAndSetFeatureImageFrame() { const { wp } = window; const { value: featuredImageId, multiple, allowedTypes } = this.props; const featuredImageFrame = getFeaturedImageMediaFrame(); const attachments = getAttachmentsCollection(featuredImageId); const selection = new wp.media.model.Selection(attachments.models, { props: attachments.props.toJSON() }); this.frame = new featuredImageFrame({ mimeType: allowedTypes, state: "featured-image", multiple, selection, editing: featuredImageId }); wp.media.frame = this.frame; wp.media.view.settings.post = { ...wp.media.view.settings.post, featuredImageId: featuredImageId || -1 }; } /** * Initializes the Media Library requirements for the single image flow. * * @return {void} */ buildAndSetSingleMediaFrame() { const { wp } = window; const { allowedTypes, multiple = false, title = (0,external_wp_i18n_namespaceObject.__)("Select or Upload Media"), value } = this.props; const frameConfig = { title, multiple }; if (!!allowedTypes) { frameConfig.library = { type: allowedTypes }; } if (this.frame) { this.frame.remove(); } const singleImageFrame = getSingleMediaFrame(); const attachments = getAttachmentsCollection(value); const selection = new wp.media.model.Selection(attachments.models, { props: attachments.props.toJSON() }); this.frame = new singleImageFrame({ mimeType: allowedTypes, multiple, selection, ...frameConfig }); wp.media.frame = this.frame; } componentWillUnmount() { this.frame?.remove(); } onUpdate(selections) { const { onSelect, multiple = false } = this.props; const state = this.frame.state(); const selectedImages = selections || state.get("selection"); if (!selectedImages || !selectedImages.models.length) { return; } if (multiple) { onSelect( selectedImages.models.map( (model) => slimImageObject(model.toJSON()) ) ); } else { onSelect(slimImageObject(selectedImages.models[0].toJSON())); } } onSelect() { const { onSelect, multiple = false } = this.props; const attachment = this.frame.state().get("selection").toJSON(); onSelect(multiple ? attachment : attachment[0]); } onOpen() { const { wp } = window; const { value } = this.props; this.updateCollection(); if (this.props.mode) { this.frame.content.mode(this.props.mode); } const hasMedia = Array.isArray(value) ? !!value?.length : !!value; if (!hasMedia) { return; } const isGallery = this.props.gallery; const selection = this.frame.state().get("selection"); const valueArray = Array.isArray(value) ? value : [value]; if (!isGallery) { valueArray.forEach((id) => { selection.add(wp.media.attachment(id)); }); } const attachments = getAttachmentsCollection(valueArray); attachments.more().done(function() { if (isGallery && attachments?.models?.length) { selection.add(attachments.models); } }); } onClose() { const { onClose } = this.props; if (onClose) { onClose(); } this.frame.detach(); } updateCollection() { const frameContent = this.frame.content.get(); if (frameContent && frameContent.collection) { const collection = frameContent.collection; collection.toArray().forEach((model) => model.trigger("destroy", model)); collection.mirroring._hasMore = true; collection.more(); } } openModal() { const { gallery = false, unstableFeaturedImageFlow = false, modalClass } = this.props; if (gallery) { this.buildAndSetGalleryFrame(); } else { this.buildAndSetSingleMediaFrame(); } if (modalClass) { this.frame.$el.addClass(modalClass); } if (unstableFeaturedImageFlow) { this.buildAndSetFeatureImageFrame(); } this.initializeListeners(); this.frame.open(); } render() { return this.props.render({ open: this.openModal }); } } var media_upload_default = MediaUpload; ;// ./node_modules/@wordpress/media-utils/build-module/components/index.js ;// external ["wp","blob"] const external_wp_blob_namespaceObject = window["wp"]["blob"]; ;// external ["wp","apiFetch"] const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// ./node_modules/@wordpress/media-utils/build-module/utils/flatten-form-data.js function isPlainObject(data) { return data !== null && typeof data === "object" && Object.getPrototypeOf(data) === Object.prototype; } function flattenFormData(formData, key, data) { if (isPlainObject(data)) { for (const [name, value] of Object.entries(data)) { flattenFormData(formData, `${key}[${name}]`, value); } } else if (data !== void 0) { formData.append(key, String(data)); } } ;// ./node_modules/@wordpress/media-utils/build-module/utils/transform-attachment.js function transformAttachment(attachment) { const { alt_text, source_url, ...savedMediaProps } = attachment; return { ...savedMediaProps, alt: attachment.alt_text, caption: attachment.caption?.raw ?? "", title: attachment.title.raw, url: attachment.source_url, poster: attachment._embedded?.["wp:featuredmedia"]?.[0]?.source_url || void 0 }; } ;// ./node_modules/@wordpress/media-utils/build-module/utils/upload-to-server.js async function uploadToServer(file, additionalData = {}, signal) { const data = new FormData(); data.append("file", file, file.name || file.type.replace("/", ".")); for (const [key, value] of Object.entries(additionalData)) { flattenFormData( data, key, value ); } return transformAttachment( await external_wp_apiFetch_default()({ // This allows the video block to directly get a video's poster image. path: "/wp/v2/media?_embed=wp:featuredmedia", body: data, method: "POST", signal }) ); } ;// ./node_modules/@wordpress/media-utils/build-module/utils/upload-error.js class UploadError extends Error { code; file; constructor({ code, message, file, cause }) { super(message, { cause }); Object.setPrototypeOf(this, new.target.prototype); this.code = code; this.file = file; } } ;// ./node_modules/@wordpress/media-utils/build-module/utils/validate-mime-type.js function validateMimeType(file, allowedTypes) { if (!allowedTypes) { return; } const isAllowedType = allowedTypes.some((allowedType) => { if (allowedType.includes("/")) { return allowedType === file.type; } return file.type.startsWith(`${allowedType}/`); }); if (file.type && !isAllowedType) { throw new UploadError({ code: "MIME_TYPE_NOT_SUPPORTED", message: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: file name. (0,external_wp_i18n_namespaceObject.__)("%s: Sorry, this file type is not supported here."), file.name ), file }); } } ;// ./node_modules/@wordpress/media-utils/build-module/utils/get-mime-types-array.js function getMimeTypesArray(wpMimeTypesObject) { if (!wpMimeTypesObject) { return null; } return Object.entries(wpMimeTypesObject).flatMap( ([extensionsString, mime]) => { const [type] = mime.split("/"); const extensions = extensionsString.split("|"); return [ mime, ...extensions.map( (extension) => `${type}/${extension}` ) ]; } ); } ;// ./node_modules/@wordpress/media-utils/build-module/utils/validate-mime-type-for-user.js function validateMimeTypeForUser(file, wpAllowedMimeTypes) { const allowedMimeTypesForUser = getMimeTypesArray(wpAllowedMimeTypes); if (!allowedMimeTypesForUser) { return; } const isAllowedMimeTypeForUser = allowedMimeTypesForUser.includes( file.type ); if (file.type && !isAllowedMimeTypeForUser) { throw new UploadError({ code: "MIME_TYPE_NOT_ALLOWED_FOR_USER", message: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: file name. (0,external_wp_i18n_namespaceObject.__)( "%s: Sorry, you are not allowed to upload this file type." ), file.name ), file }); } } ;// ./node_modules/@wordpress/media-utils/build-module/utils/validate-file-size.js function validateFileSize(file, maxUploadFileSize) { if (file.size <= 0) { throw new UploadError({ code: "EMPTY_FILE", message: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: file name. (0,external_wp_i18n_namespaceObject.__)("%s: This file is empty."), file.name ), file }); } if (maxUploadFileSize && file.size > maxUploadFileSize) { throw new UploadError({ code: "SIZE_ABOVE_LIMIT", message: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: file name. (0,external_wp_i18n_namespaceObject.__)( "%s: This file exceeds the maximum upload size for this site." ), file.name ), file }); } } ;// ./node_modules/@wordpress/media-utils/build-module/utils/upload-media.js function uploadMedia({ wpAllowedMimeTypes, allowedTypes, additionalData = {}, filesList, maxUploadFileSize, onError, onFileChange, signal, multiple = true }) { if (!multiple && filesList.length > 1) { onError?.(new Error((0,external_wp_i18n_namespaceObject.__)("Only one file can be used here."))); return; } const validFiles = []; const filesSet = []; const setAndUpdateFiles = (index, value) => { if (!window.__experimentalMediaProcessing) { if (filesSet[index]?.url) { (0,external_wp_blob_namespaceObject.revokeBlobURL)(filesSet[index].url); } } filesSet[index] = value; onFileChange?.( filesSet.filter((attachment) => attachment !== null) ); }; for (const mediaFile of filesList) { try { validateMimeTypeForUser(mediaFile, wpAllowedMimeTypes); } catch (error) { onError?.(error); continue; } try { validateMimeType(mediaFile, allowedTypes); } catch (error) { onError?.(error); continue; } try { validateFileSize(mediaFile, maxUploadFileSize); } catch (error) { onError?.(error); continue; } validFiles.push(mediaFile); if (!window.__experimentalMediaProcessing) { filesSet.push({ url: (0,external_wp_blob_namespaceObject.createBlobURL)(mediaFile) }); onFileChange?.(filesSet); } } validFiles.map(async (file, index) => { try { const attachment = await uploadToServer( file, additionalData, signal ); setAndUpdateFiles(index, attachment); } catch (error) { setAndUpdateFiles(index, null); let message; if (typeof error === "object" && error !== null && "message" in error) { message = typeof error.message === "string" ? error.message : String(error.message); } else { message = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: file name (0,external_wp_i18n_namespaceObject.__)("Error while uploading file %s to the media library."), file.name ); } onError?.( new UploadError({ code: "GENERAL", message, file, cause: error instanceof Error ? error : void 0 }) ); } }); } ;// ./node_modules/@wordpress/media-utils/build-module/utils/sideload-to-server.js async function sideloadToServer(file, attachmentId, additionalData = {}, signal) { const data = new FormData(); data.append("file", file, file.name || file.type.replace("/", ".")); for (const [key, value] of Object.entries(additionalData)) { flattenFormData( data, key, value ); } return transformAttachment( await external_wp_apiFetch_default()({ path: `/wp/v2/media/${attachmentId}/sideload`, body: data, method: "POST", signal }) ); } ;// ./node_modules/@wordpress/media-utils/build-module/utils/sideload-media.js const noop = () => { }; async function sideloadMedia({ file, attachmentId, additionalData = {}, signal, onFileChange, onError = noop }) { try { const attachment = await sideloadToServer( file, attachmentId, additionalData, signal ); onFileChange?.([attachment]); } catch (error) { let message; if (error instanceof Error) { message = error.message; } else { message = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: file name (0,external_wp_i18n_namespaceObject.__)("Error while sideloading file %s to the server."), file.name ); } onError( new UploadError({ code: "GENERAL", message, file, cause: error instanceof Error ? error : void 0 }) ); } } ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/media-utils/build-module/lock-unlock.js const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/media-utils" ); ;// ./node_modules/@wordpress/media-utils/build-module/private-apis.js const privateApis = {}; lock(privateApis, { sideloadMedia: sideloadMedia }); ;// ./node_modules/@wordpress/media-utils/build-module/index.js (window.wp = window.wp || {}).mediaUtils = __webpack_exports__; /******/ })() ; i18n.min.js 0000644 00000012302 15151622574 0006451 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var t={d:(n,e)=>{for(var r in e)t.o(e,r)&&!t.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:e[r]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};t.r(n),t.d(n,{__:()=>F,_n:()=>L,_nx:()=>D,_x:()=>w,createI18n:()=>h,defaultI18n:()=>b,getLocaleData:()=>g,hasTranslation:()=>O,isRTL:()=>P,resetLocaleData:()=>x,setLocaleData:()=>v,sprintf:()=>l,subscribe:()=>m});var e,r,a,i,o=/%(((\d+)\$)|(\(([$_a-zA-Z][$_a-zA-Z0-9]*)\)))?[ +0#-]*\d*(\.(\d+|\*))?(ll|[lhqL])?([cduxXefgsp%])/g;function l(t,...n){return function(t,...n){var e=0;return Array.isArray(n[0])&&(n=n[0]),t.replace(o,(function(){var t,r,a,i,o;return t=arguments[3],r=arguments[5],"%"===(i=arguments[9])?"%":("*"===(a=arguments[7])&&(a=n[e],e++),void 0===r?(void 0===t&&(t=e+1),e++,o=n[t-1]):n[0]&&"object"==typeof n[0]&&n[0].hasOwnProperty(r)&&(o=n[0][r]),"f"===i?o=parseFloat(o)||0:"d"===i&&(o=parseInt(o)||0),void 0!==a&&("f"===i?o=o.toFixed(a):"s"===i&&(o=o.substr(0,a))),null!=o?o:"")}))}(t,...n)}e={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},r=["(","?"],a={")":["("],":":["?","?:"]},i=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;var s={"!":function(t){return!t},"*":function(t,n){return t*n},"/":function(t,n){return t/n},"%":function(t,n){return t%n},"+":function(t,n){return t+n},"-":function(t,n){return t-n},"<":function(t,n){return t<n},"<=":function(t,n){return t<=n},">":function(t,n){return t>n},">=":function(t,n){return t>=n},"==":function(t,n){return t===n},"!=":function(t,n){return t!==n},"&&":function(t,n){return t&&n},"||":function(t,n){return t||n},"?:":function(t,n,e){if(t)throw n;return e}};function u(t){var n=function(t){for(var n,o,l,s,u=[],d=[];n=t.match(i);){for(o=n[0],(l=t.substr(0,n.index).trim())&&u.push(l);s=d.pop();){if(a[o]){if(a[o][0]===s){o=a[o][1]||o;break}}else if(r.indexOf(s)>=0||e[s]<e[o]){d.push(s);break}u.push(s)}a[o]||d.push(o),t=t.substr(n.index+o.length)}return(t=t.trim())&&u.push(t),u.concat(d.reverse())}(t);return function(t){return function(t,n){var e,r,a,i,o,l,u=[];for(e=0;e<t.length;e++){if(o=t[e],i=s[o]){for(r=i.length,a=Array(r);r--;)a[r]=u.pop();try{l=i.apply(null,a)}catch(t){return t}}else l=n.hasOwnProperty(o)?n[o]:+o;u.push(l)}return u[0]}(n,t)}}var d={contextDelimiter:"",onMissingKey:null};function c(t,n){var e;for(e in this.data=t,this.pluralForms={},this.options={},d)this.options[e]=void 0!==n&&e in n?n[e]:d[e]}c.prototype.getPluralForm=function(t,n){var e,r,a,i=this.pluralForms[t];return i||("function"!=typeof(a=(e=this.data[t][""])["Plural-Forms"]||e["plural-forms"]||e.plural_forms)&&(r=function(t){var n,e,r;for(n=t.split(";"),e=0;e<n.length;e++)if(0===(r=n[e].trim()).indexOf("plural="))return r.substr(7)}(e["Plural-Forms"]||e["plural-forms"]||e.plural_forms),a=function(t){var n=u(t);return function(t){return+n({n:t})}}(r)),i=this.pluralForms[t]=a),i(n)},c.prototype.dcnpgettext=function(t,n,e,r,a){var i,o,l;return i=void 0===a?0:this.getPluralForm(t,a),o=e,n&&(o=n+this.options.contextDelimiter+e),(l=this.data[t][o])&&l[i]?l[i]:(this.options.onMissingKey&&this.options.onMissingKey(e,t),0===i?e:r)};const p={plural_forms:t=>1===t?0:1},f=/^i18n\.(n?gettext|has_translation)(_|$)/,h=(t,n,e)=>{const r=new c({}),a=new Set,i=()=>{a.forEach((t=>t()))},o=(t,n="default")=>{r.data[n]={...r.data[n],...t},r.data[n][""]={...p,...r.data[n]?.[""]},delete r.pluralForms[n]},l=(t,n)=>{o(t,n),i()},s=(t="default",n,e,a,i)=>(r.data[t]||o(void 0,t),r.dcnpgettext(t,n,e,a,i)),u=t=>t||"default",d=(t,n,r)=>{let a=s(r,n,t);return e?(a=e.applyFilters("i18n.gettext_with_context",a,t,n,r),e.applyFilters("i18n.gettext_with_context_"+u(r),a,t,n,r)):a};if(t&&l(t,n),e){const t=t=>{f.test(t)&&i()};e.addAction("hookAdded","core/i18n",t),e.addAction("hookRemoved","core/i18n",t)}return{getLocaleData:(t="default")=>r.data[t],setLocaleData:l,addLocaleData:(t,n="default")=>{r.data[n]={...r.data[n],...t,"":{...p,...r.data[n]?.[""],...t?.[""]}},delete r.pluralForms[n],i()},resetLocaleData:(t,n)=>{r.data={},r.pluralForms={},l(t,n)},subscribe:t=>(a.add(t),()=>a.delete(t)),__:(t,n)=>{let r=s(n,void 0,t);return e?(r=e.applyFilters("i18n.gettext",r,t,n),e.applyFilters("i18n.gettext_"+u(n),r,t,n)):r},_x:d,_n:(t,n,r,a)=>{let i=s(a,void 0,t,n,r);return e?(i=e.applyFilters("i18n.ngettext",i,t,n,r,a),e.applyFilters("i18n.ngettext_"+u(a),i,t,n,r,a)):i},_nx:(t,n,r,a,i)=>{let o=s(i,a,t,n,r);return e?(o=e.applyFilters("i18n.ngettext_with_context",o,t,n,r,a,i),e.applyFilters("i18n.ngettext_with_context_"+u(i),o,t,n,r,a,i)):o},isRTL:()=>"rtl"===d("ltr","text direction"),hasTranslation:(t,n,a)=>{const i=n?n+""+t:t;let o=!!r.data?.[a??"default"]?.[i];return e&&(o=e.applyFilters("i18n.has_translation",o,t,n,a),o=e.applyFilters("i18n.has_translation_"+u(a),o,t,n,a)),o}}},_=window.wp.hooks,y=h(void 0,void 0,_.defaultHooks);var b=y;const g=y.getLocaleData.bind(y),v=y.setLocaleData.bind(y),x=y.resetLocaleData.bind(y),m=y.subscribe.bind(y),F=y.__.bind(y),w=y._x.bind(y),L=y._n.bind(y),D=y._nx.bind(y),P=y.isRTL.bind(y),O=y.hasTranslation.bind(y);(window.wp=window.wp||{}).i18n=n})(); editor.min.js 0000644 00001463451 15151622574 0007200 0 ustar 00 /*! This file is auto-generated */ (()=>{var e={66:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===s}(e)}(e)};var s="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((s=e,Array.isArray(s)?[]:{}),e,t):e;var s}function o(e,t,s){return e.concat(t).map((function(e){return n(e,s)}))}function r(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function i(e,t){try{return t in e}catch(e){return!1}}function a(e,t,s){var o={};return s.isMergeableObject(e)&&r(e).forEach((function(t){o[t]=n(e[t],s)})),r(t).forEach((function(r){(function(e,t){return i(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,r)||(i(e,r)&&s.isMergeableObject(t[r])?o[r]=function(e,t){if(!t.customMerge)return l;var s=t.customMerge(e);return"function"==typeof s?s:l}(r,s)(e[r],t[r],s):o[r]=n(t[r],s))})),o}function l(e,s,r){(r=r||{}).arrayMerge=r.arrayMerge||o,r.isMergeableObject=r.isMergeableObject||t,r.cloneUnlessOtherwiseSpecified=n;var i=Array.isArray(s);return i===Array.isArray(e)?i?r.arrayMerge(e,s,r):a(e,s,r):n(s,r)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,s){return l(e,s,t)}),{})};var c=l;e.exports=c},461:(e,t,s)=>{var n=s(6109);e.exports=function(e){var t=n(e,"line-height"),s=parseFloat(t,10);if(t===s+""){var o=e.style.lineHeight;e.style.lineHeight=t+"em",t=n(e,"line-height"),s=parseFloat(t,10),o?e.style.lineHeight=o:delete e.style.lineHeight}if(-1!==t.indexOf("pt")?(s*=4,s/=3):-1!==t.indexOf("mm")?(s*=96,s/=25.4):-1!==t.indexOf("cm")?(s*=96,s/=2.54):-1!==t.indexOf("in")?s*=96:-1!==t.indexOf("pc")&&(s*=16),s=Math.round(s),"normal"===t){var r=e.nodeName,i=document.createElement(r);i.innerHTML=" ","TEXTAREA"===r.toUpperCase()&&i.setAttribute("rows","1");var a=n(e,"font-size");i.style.fontSize=a,i.style.padding="0px",i.style.border="0px";var l=document.body;l.appendChild(i),s=i.offsetHeight,l.removeChild(i)}return s}},628:(e,t,s)=>{"use strict";var n=s(4067);function o(){}function r(){}r.resetWarningCache=o,e.exports=function(){function e(e,t,s,o,r,i){if(i!==n){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var s={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:r,resetWarningCache:o};return s.PropTypes=s,s}},1609:e=>{"use strict";e.exports=window.React},4067:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4132:(e,t,s)=>{"use strict";var n=s(4462);t.A=n.TextareaAutosize},4306:function(e,t){var s,n,o; /*! autosize 4.0.4 license: MIT http://www.jacklmoore.com/autosize */n=[e,t],s=function(e,t){"use strict";var s,n,o="function"==typeof Map?new Map:(s=[],n=[],{has:function(e){return s.indexOf(e)>-1},get:function(e){return n[s.indexOf(e)]},set:function(e,t){-1===s.indexOf(e)&&(s.push(e),n.push(t))},delete:function(e){var t=s.indexOf(e);t>-1&&(s.splice(t,1),n.splice(t,1))}}),r=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){r=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function i(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!o.has(e)){var t=null,s=null,n=null,i=function(){e.clientWidth!==s&&p()},a=function(t){window.removeEventListener("resize",i,!1),e.removeEventListener("input",p,!1),e.removeEventListener("keyup",p,!1),e.removeEventListener("autosize:destroy",a,!1),e.removeEventListener("autosize:update",p,!1),Object.keys(t).forEach((function(s){e.style[s]=t[s]})),o.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",a,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",p,!1),window.addEventListener("resize",i,!1),e.addEventListener("input",p,!1),e.addEventListener("autosize:update",p,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",o.set(e,{destroy:a,update:p}),l()}function l(){var s=window.getComputedStyle(e,null);"vertical"===s.resize?e.style.resize="none":"both"===s.resize&&(e.style.resize="horizontal"),t="content-box"===s.boxSizing?-(parseFloat(s.paddingTop)+parseFloat(s.paddingBottom)):parseFloat(s.borderTopWidth)+parseFloat(s.borderBottomWidth),isNaN(t)&&(t=0),p()}function c(t){var s=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=s,e.style.overflowY=t}function d(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function u(){if(0!==e.scrollHeight){var n=d(e),o=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+t+"px",s=e.clientWidth,n.forEach((function(e){e.node.scrollTop=e.scrollTop})),o&&(document.documentElement.scrollTop=o)}}function p(){u();var t=Math.round(parseFloat(e.style.height)),s=window.getComputedStyle(e,null),o="content-box"===s.boxSizing?Math.round(parseFloat(s.height)):e.offsetHeight;if(o<t?"hidden"===s.overflowY&&(c("scroll"),u(),o="content-box"===s.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==s.overflowY&&(c("hidden"),u(),o="content-box"===s.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),n!==o){n=o;var i=r("autosize:resized");try{e.dispatchEvent(i)}catch(e){}}}}function a(e){var t=o.get(e);t&&t.destroy()}function l(e){var t=o.get(e);t&&t.update()}var c=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((c=function(e){return e}).destroy=function(e){return e},c.update=function(e){return e}):((c=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],(function(e){return i(e,t)})),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],a),e},c.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],l),e}),t.default=c,e.exports=t.default},void 0===(o="function"==typeof s?s.apply(t,n):s)||(e.exports=o)},4462:function(e,t,s){"use strict";var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])},function(e,t){function s(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(s.prototype=t.prototype,new s)}),r=this&&this.__assign||Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var o in t=arguments[s])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i=this&&this.__rest||function(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&(s[n[o]]=e[n[o]])}return s};t.__esModule=!0;var a=s(1609),l=s(5826),c=s(4306),d=s(461),u="autosize:resized",p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={lineHeight:null},t.textarea=null,t.onResize=function(e){t.props.onResize&&t.props.onResize(e)},t.updateLineHeight=function(){t.textarea&&t.setState({lineHeight:d(t.textarea)})},t.onChange=function(e){var s=t.props.onChange;t.currentValue=e.currentTarget.value,s&&s(e)},t}return o(t,e),t.prototype.componentDidMount=function(){var e=this,t=this.props,s=t.maxRows,n=t.async;"number"==typeof s&&this.updateLineHeight(),"number"==typeof s||n?setTimeout((function(){return e.textarea&&c(e.textarea)})):this.textarea&&c(this.textarea),this.textarea&&this.textarea.addEventListener(u,this.onResize)},t.prototype.componentWillUnmount=function(){this.textarea&&(this.textarea.removeEventListener(u,this.onResize),c.destroy(this.textarea))},t.prototype.render=function(){var e=this,t=this.props,s=(t.onResize,t.maxRows),n=(t.onChange,t.style),o=(t.innerRef,t.children),l=i(t,["onResize","maxRows","onChange","style","innerRef","children"]),c=this.state.lineHeight,d=s&&c?c*s:null;return a.createElement("textarea",r({},l,{onChange:this.onChange,style:d?r({},n,{maxHeight:d}):n,ref:function(t){e.textarea=t,"function"==typeof e.props.innerRef?e.props.innerRef(t):e.props.innerRef&&(e.props.innerRef.current=t)}}),o)},t.prototype.componentDidUpdate=function(){this.textarea&&c.update(this.textarea)},t.defaultProps={rows:1,async:!1},t.propTypes={rows:l.number,maxRows:l.number,onResize:l.func,innerRef:l.any,async:l.bool},t}(a.Component);t.TextareaAutosize=a.forwardRef((function(e,t){return a.createElement(p,r({},e,{innerRef:t}))}))},5215:e=>{"use strict";e.exports=function e(t,s){if(t===s)return!0;if(t&&s&&"object"==typeof t&&"object"==typeof s){if(t.constructor!==s.constructor)return!1;var n,o,r;if(Array.isArray(t)){if((n=t.length)!=s.length)return!1;for(o=n;0!=o--;)if(!e(t[o],s[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if((n=(r=Object.keys(t)).length)!==Object.keys(s).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(s,r[o]))return!1;for(o=n;0!=o--;){var i=r[o];if(!e(t[i],s[i]))return!1}return!0}return t!=t&&s!=s}},5826:(e,t,s)=>{e.exports=s(628)()},6109:e=>{e.exports=function(e,t,s){return((s=window.getComputedStyle)?s(e):e.currentStyle)[t.replace(/-(\w)/gi,(function(e,t){return t.toUpperCase()}))]}},9681:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},s=Object.keys(t).join("|"),n=new RegExp(s,"g"),o=new RegExp(s,"");function r(e){return t[e]}var i=function(e){return e.replace(n,r)};e.exports=i,e.exports.has=function(e){return!!e.match(o)},e.exports.remove=i}},t={};function s(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n].call(r.exports,r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";s.r(n),s.d(n,{AlignmentToolbar:()=>Yh,Autocomplete:()=>Zh,AutosaveMonitor:()=>Oc,BlockAlignmentToolbar:()=>qh,BlockControls:()=>Kh,BlockEdit:()=>Qh,BlockEditorKeyboardShortcuts:()=>Xh,BlockFormatControls:()=>Jh,BlockIcon:()=>eg,BlockInspector:()=>tg,BlockList:()=>sg,BlockMover:()=>ng,BlockNavigationDropdown:()=>og,BlockSelectionClearer:()=>rg,BlockSettingsMenu:()=>ig,BlockTitle:()=>ag,BlockToolbar:()=>lg,CharacterCount:()=>Oh,ColorPalette:()=>cg,ContrastChecker:()=>dg,CopyHandler:()=>ug,DefaultBlockAppender:()=>pg,DocumentBar:()=>Gc,DocumentOutline:()=>ed,DocumentOutlineCheck:()=>td,EditorHistoryRedo:()=>rd,EditorHistoryUndo:()=>id,EditorKeyboardShortcuts:()=>kl,EditorKeyboardShortcutsRegister:()=>sd,EditorNotices:()=>ld,EditorProvider:()=>Al,EditorSnackbars:()=>dd,EntitiesSavedStates:()=>yd,ErrorBoundary:()=>kd,FontSizePicker:()=>mg,InnerBlocks:()=>gg,Inserter:()=>hg,InspectorAdvancedControls:()=>_g,InspectorControls:()=>fg,LocalAutosaveMonitor:()=>Ed,MediaPlaceholder:()=>Sg,MediaUpload:()=>kg,MediaUploadCheck:()=>Cg,MultiSelectScrollIntoView:()=>Pg,NavigableToolbar:()=>jg,ObserveTyping:()=>Eg,PageAttributesCheck:()=>Td,PageAttributesOrder:()=>Nd,PageAttributesPanel:()=>Wd,PageAttributesParent:()=>zd,PageTemplate:()=>nu,PanelColorSettings:()=>bg,PlainText:()=>yg,PluginBlockSettingsMenuItem:()=>_u,PluginDocumentSettingPanel:()=>gu,PluginMoreMenuItem:()=>fu,PluginPostPublishPanel:()=>vu,PluginPostStatusInfo:()=>Cu,PluginPrePublishPanel:()=>Tu,PluginPreviewMenuItem:()=>Iu,PluginSidebar:()=>Bu,PluginSidebarMoreMenuItem:()=>Nu,PostAuthor:()=>Wu,PostAuthorCheck:()=>Zu,PostAuthorPanel:()=>qu,PostComments:()=>Qu,PostDiscussionPanel:()=>sp,PostExcerpt:()=>np,PostExcerptCheck:()=>op,PostExcerptPanel:()=>up,PostFeaturedImage:()=>wp,PostFeaturedImageCheck:()=>gp,PostFeaturedImagePanel:()=>kp,PostFormat:()=>jp,PostFormatCheck:()=>Cp,PostLastRevision:()=>Bp,PostLastRevisionCheck:()=>Ep,PostLastRevisionPanel:()=>Np,PostLockedModal:()=>Rp,PostPendingStatus:()=>Ap,PostPendingStatusCheck:()=>Dp,PostPingbacks:()=>Xu,PostPreviewButton:()=>Mp,PostPublishButton:()=>Vp,PostPublishButtonLabel:()=>Lp,PostPublishPanel:()=>Ym,PostSavedState:()=>nh,PostSchedule:()=>am,PostScheduleCheck:()=>oh,PostScheduleLabel:()=>cm,PostSchedulePanel:()=>ih,PostSticky:()=>Xm,PostStickyCheck:()=>Qm,PostSwitchToDraftButton:()=>ah,PostSyncStatus:()=>lh,PostTaxonomies:()=>dh,PostTaxonomiesCheck:()=>uh,PostTaxonomiesFlatTermSelector:()=>wm,PostTaxonomiesHierarchicalTermSelector:()=>Dm,PostTaxonomiesPanel:()=>mh,PostTemplatePanel:()=>Vu,PostTextEditor:()=>gh,PostTitle:()=>vh,PostTitleRaw:()=>wh,PostTrash:()=>kh,PostTrashCheck:()=>Sh,PostTypeSupportCheck:()=>Id,PostURL:()=>Ch,PostURLCheck:()=>Ph,PostURLLabel:()=>jh,PostURLPanel:()=>Th,PostVisibility:()=>zp,PostVisibilityCheck:()=>Nh,PostVisibilityLabel:()=>Gp,RichText:()=>Wh,RichTextShortcut:()=>xg,RichTextToolbarButton:()=>vg,ServerSideRender:()=>zh(),SkipToSelectedBlock:()=>Tg,TableOfContents:()=>Vh,TextEditorGlobalKeyboardShortcuts:()=>$g,ThemeSupportCheck:()=>hp,TimeToRead:()=>Lh,URLInput:()=>Ig,URLInputButton:()=>Bg,URLPopover:()=>Ng,UnsavedChangesWarning:()=>Uh,VisualEditorGlobalKeyboardShortcuts:()=>Gg,Warning:()=>Rg,WordCount:()=>Ah,WritingFlow:()=>Dg,__unstableRichTextInputEvent:()=>wg,cleanForSlug:()=>Wg,createCustomColorsHOC:()=>Ag,getColorClassName:()=>Mg,getColorObjectByAttributeValues:()=>Lg,getColorObjectByColorValue:()=>Og,getFontSize:()=>Fg,getFontSizeClass:()=>Vg,getTemplatePartIcon:()=>H,mediaUpload:()=>yi,privateApis:()=>Xy,registerEntityAction:()=>Jy,registerEntityField:()=>tx,store:()=>vc,storeConfig:()=>xc,transformStyles:()=>g.transformStyles,unregisterEntityAction:()=>ex,unregisterEntityField:()=>sx,useEntitiesSavedStatesIsDirty:()=>fd,usePostScheduleLabel:()=>dm,usePostURLLabel:()=>Eh,usePostVisibilityLabel:()=>$p,userAutocompleter:()=>Sc,withColorContext:()=>Ug,withColors:()=>Hg,withFontSizes:()=>zg});var e={};s.r(e),s.d(e,{__experimentalGetDefaultTemplatePartAreas:()=>ls,__experimentalGetDefaultTemplateType:()=>cs,__experimentalGetDefaultTemplateTypes:()=>as,__experimentalGetTemplateInfo:()=>ds,__unstableIsEditorReady:()=>et,canInsertBlockType:()=>ns,canUserUseUnfilteredHTML:()=>$e,didPostSaveRequestFail:()=>Ee,didPostSaveRequestSucceed:()=>je,getActivePostLock:()=>Ge,getAdjacentBlockClientId:()=>Et,getAutosaveAttribute:()=>me,getBlock:()=>mt,getBlockAttributes:()=>pt,getBlockCount:()=>yt,getBlockHierarchyRootClientId:()=>jt,getBlockIndex:()=>Ht,getBlockInsertionPoint:()=>Xt,getBlockListSettings:()=>is,getBlockMode:()=>qt,getBlockName:()=>dt,getBlockOrder:()=>Ut,getBlockRootClientId:()=>Pt,getBlockSelectionEnd:()=>vt,getBlockSelectionStart:()=>xt,getBlocks:()=>ht,getBlocksByClientId:()=>bt,getClientIdsOfDescendants:()=>gt,getClientIdsWithDescendants:()=>_t,getCurrentPost:()=>ne,getCurrentPostAttribute:()=>de,getCurrentPostId:()=>re,getCurrentPostLastRevisionId:()=>le,getCurrentPostRevisionsCount:()=>ae,getCurrentPostType:()=>oe,getCurrentTemplateId:()=>ie,getDeviceType:()=>nt,getEditedPostAttribute:()=>pe,getEditedPostContent:()=>Re,getEditedPostPreviewLink:()=>Be,getEditedPostSlug:()=>Le,getEditedPostVisibility:()=>he,getEditorBlocks:()=>Ze,getEditorMode:()=>it,getEditorSelection:()=>Je,getEditorSelectionEnd:()=>Xe,getEditorSelectionStart:()=>Qe,getEditorSettings:()=>tt,getFirstMultiSelectedBlockClientId:()=>Dt,getGlobalBlockCount:()=>ft,getInserterItems:()=>os,getLastMultiSelectedBlockClientId:()=>At,getMultiSelectedBlockClientIds:()=>Nt,getMultiSelectedBlocks:()=>Rt,getMultiSelectedBlocksEndClientId:()=>Vt,getMultiSelectedBlocksStartClientId:()=>Ft,getNextBlockClientId:()=>It,getPermalink:()=>Me,getPermalinkParts:()=>Oe,getPostEdits:()=>ce,getPostLockUser:()=>ze,getPostTypeLabel:()=>us,getPreviousBlockClientId:()=>Tt,getRenderingMode:()=>st,getSelectedBlock:()=>Ct,getSelectedBlockClientId:()=>kt,getSelectedBlockCount:()=>wt,getSelectedBlocksInitialCaretPosition:()=>Bt,getStateBeforeOptimisticTransaction:()=>at,getSuggestedPostFormat:()=>Ne,getTemplate:()=>ts,getTemplateLock:()=>ss,hasChangedContent:()=>J,hasEditorRedo:()=>Q,hasEditorUndo:()=>K,hasInserterItems:()=>rs,hasMultiSelection:()=>Wt,hasNonPostEntityChanges:()=>te,hasSelectedBlock:()=>St,hasSelectedInnerBlock:()=>Gt,inSomeHistory:()=>lt,isAncestorMultiSelected:()=>Ot,isAutosavingPost:()=>Te,isBlockInsertionPointVisible:()=>Jt,isBlockMultiSelected:()=>Lt,isBlockSelected:()=>zt,isBlockValid:()=>ut,isBlockWithinSelection:()=>$t,isCaretWithinFormattedText:()=>Qt,isCleanNewPost:()=>se,isCurrentPostPending:()=>ge,isCurrentPostPublished:()=>_e,isCurrentPostScheduled:()=>fe,isDeletingPost:()=>ke,isEditedPostAutosaveable:()=>ve,isEditedPostBeingScheduled:()=>we,isEditedPostDateFloating:()=>Se,isEditedPostDirty:()=>ee,isEditedPostEmpty:()=>xe,isEditedPostNew:()=>X,isEditedPostPublishable:()=>be,isEditedPostSaveable:()=>ye,isEditorPanelEnabled:()=>qe,isEditorPanelOpened:()=>Ke,isEditorPanelRemoved:()=>Ye,isFirstMultiSelectedBlock:()=>Mt,isInserterOpened:()=>rt,isListViewOpened:()=>ot,isMultiSelecting:()=>Zt,isPermalinkEditable:()=>Ae,isPostAutosavingLocked:()=>Ue,isPostLockTakeover:()=>He,isPostLocked:()=>Fe,isPostSavingLocked:()=>Ve,isPreviewingPost:()=>Ie,isPublishSidebarEnabled:()=>We,isPublishSidebarOpened:()=>ps,isPublishingPost:()=>De,isSavingNonPostEntityChanges:()=>Pe,isSavingPost:()=>Ce,isSelectionEnabled:()=>Yt,isTyping:()=>Kt,isValidTemplate:()=>es});var t={};s.r(t),s.d(t,{__experimentalTearDownEditor:()=>vs,__unstableSaveForPreview:()=>Bs,autosave:()=>Is,clearSelectedBlock:()=>hn,closePublishSidebar:()=>sn,createUndoLevel:()=>Ds,disablePublishSidebar:()=>Ls,editPost:()=>Ps,enablePublishSidebar:()=>Ms,enterFormattedText:()=>Rn,exitFormattedText:()=>Dn,hideInsertionPoint:()=>kn,insertBlock:()=>vn,insertBlocks:()=>wn,insertDefaultBlock:()=>An,lockPostAutosaving:()=>Vs,lockPostSaving:()=>Os,mergeBlocks:()=>jn,moveBlockToPosition:()=>xn,moveBlocksDown:()=>bn,moveBlocksUp:()=>yn,multiSelect:()=>mn,openPublishSidebar:()=>tn,receiveBlocks:()=>an,redo:()=>Ns,refreshPost:()=>Es,removeBlock:()=>Tn,removeBlocks:()=>En,removeEditorPanel:()=>Ys,replaceBlock:()=>fn,replaceBlocks:()=>_n,resetBlocks:()=>rn,resetEditorBlocks:()=>Hs,resetPost:()=>ws,savePost:()=>js,selectBlock:()=>dn,setDeviceType:()=>$s,setEditedPost:()=>Cs,setIsInserterOpened:()=>qs,setIsListViewOpened:()=>Ks,setRenderingMode:()=>Gs,setTemplateValidity:()=>Cn,setupEditor:()=>xs,setupEditorState:()=>ks,showInsertionPoint:()=>Sn,startMultiSelect:()=>un,startTyping:()=>Bn,stopMultiSelect:()=>pn,stopTyping:()=>Nn,switchEditorMode:()=>en,synchronizeTemplate:()=>Pn,toggleBlockMode:()=>In,toggleDistractionFree:()=>Qs,toggleEditorPanelEnabled:()=>Ws,toggleEditorPanelOpened:()=>Zs,togglePublishSidebar:()=>nn,toggleSelection:()=>gn,toggleSpotlightMode:()=>Xs,toggleTopToolbar:()=>Js,trashPost:()=>Ts,undo:()=>Rs,unlockPostAutosaving:()=>Us,unlockPostSaving:()=>Fs,updateBlock:()=>ln,updateBlockAttributes:()=>cn,updateBlockListSettings:()=>Mn,updateEditorSettings:()=>zs,updatePost:()=>Ss,updatePostLock:()=>As});var o={};s.r(o),s.d(o,{closeModal:()=>xa,disableComplementaryArea:()=>ma,enableComplementaryArea:()=>pa,openModal:()=>ya,pinItem:()=>ha,setDefaultComplementaryArea:()=>ua,setFeatureDefaults:()=>ba,setFeatureValue:()=>fa,toggleFeature:()=>_a,unpinItem:()=>ga});var r={};s.r(r),s.d(r,{getActiveComplementaryArea:()=>va,isComplementaryAreaLoading:()=>wa,isFeatureActive:()=>ka,isItemPinned:()=>Sa,isModalActive:()=>Ca});var i={};s.r(i),s.d(i,{ActionItem:()=>Na,ComplementaryArea:()=>Va,ComplementaryAreaMoreMenuItem:()=>Da,FullscreenMode:()=>Ua,InterfaceSkeleton:()=>Wa,PinnedItems:()=>Ma,store:()=>ja});var a={};s.r(a),s.d(a,{createTemplate:()=>Zl,hideBlockTypes:()=>ql,registerEntityAction:()=>Vl,registerEntityField:()=>Hl,registerPostTypeSchema:()=>$l,removeTemplates:()=>Xl,revertTemplate:()=>Ql,saveDirtyEntities:()=>Kl,setCanvasMinHeight:()=>ec,setCurrentTemplateId:()=>Wl,setDefaultRenderingMode:()=>Jl,setIsReady:()=>Gl,showBlockTypes:()=>Yl,unregisterEntityAction:()=>Ul,unregisterEntityField:()=>zl});var l={};s.r(l),s.d(l,{getCanvasMinHeight:()=>yc,getDefaultRenderingMode:()=>bc,getEntityActions:()=>hc,getEntityFields:()=>_c,getInserter:()=>lc,getInserterSidebarToggleRef:()=>dc,getListViewToggleRef:()=>cc,getPostBlocksByName:()=>fc,getPostIcon:()=>pc,hasPostMetaChanges:()=>mc,isEntityReady:()=>gc});const c=window.ReactJSXRuntime,d=window.wp.data,u=window.wp.coreData,p=window.wp.element,m=window.wp.compose,h=window.wp.hooks,g=window.wp.blockEditor,_={...g.SETTINGS_DEFAULTS,richEditingEnabled:!0,codeEditingEnabled:!0,fontLibraryEnabled:!0,enableCustomFields:void 0,defaultRenderingMode:"post-only"};var f=(0,d.combineReducers)({actions:function(e={},t){switch(t.type){case"REGISTER_ENTITY_ACTION":return{...e,[t.kind]:{...e[t.kind],[t.name]:[...(e[t.kind]?.[t.name]??[]).filter((e=>e.id!==t.config.id)),t.config]}};case"UNREGISTER_ENTITY_ACTION":return{...e,[t.kind]:{...e[t.kind],[t.name]:(e[t.kind]?.[t.name]??[]).filter((e=>e.id!==t.actionId))}}}return e},fields:function(e={},t){switch(t.type){case"REGISTER_ENTITY_FIELD":return{...e,[t.kind]:{...e[t.kind],[t.name]:[...(e[t.kind]?.[t.name]??[]).filter((e=>e.id!==t.config.id)),t.config]}};case"UNREGISTER_ENTITY_FIELD":return{...e,[t.kind]:{...e[t.kind],[t.name]:(e[t.kind]?.[t.name]??[]).filter((e=>e.id!==t.fieldId))}}}return e},isReady:function(e={},t){return"SET_IS_READY"===t.type?{...e,[t.kind]:{...e[t.kind],[t.name]:!0}}:e}});function b(e){return e&&"object"==typeof e&&"raw"in e?e.raw:e}var y=(0,d.combineReducers)({postId:function(e=null,t){return"SET_EDITED_POST"===t.type?t.postId:e},postType:function(e=null,t){return"SET_EDITED_POST"===t.type?t.postType:e},templateId:function(e=null,t){return"SET_CURRENT_TEMPLATE_ID"===t.type?t.id:e},saving:function(e={},t){switch(t.type){case"REQUEST_POST_UPDATE_START":case"REQUEST_POST_UPDATE_FINISH":return{pending:"REQUEST_POST_UPDATE_START"===t.type,options:t.options||{}}}return e},deleting:function(e={},t){switch(t.type){case"REQUEST_POST_DELETE_START":case"REQUEST_POST_DELETE_FINISH":return{pending:"REQUEST_POST_DELETE_START"===t.type}}return e},postLock:function(e={isLocked:!1},t){return"UPDATE_POST_LOCK"===t.type?t.lock:e},template:function(e={isValid:!0},t){return"SET_TEMPLATE_VALIDITY"===t.type?{...e,isValid:t.isValid}:e},postSavingLock:function(e={},t){switch(t.type){case"LOCK_POST_SAVING":return{...e,[t.lockName]:!0};case"UNLOCK_POST_SAVING":{const{[t.lockName]:s,...n}=e;return n}}return e},editorSettings:function(e=_,t){return"UPDATE_EDITOR_SETTINGS"===t.type?{...e,...t.settings}:e},postAutosavingLock:function(e={},t){switch(t.type){case"LOCK_POST_AUTOSAVING":return{...e,[t.lockName]:!0};case"UNLOCK_POST_AUTOSAVING":{const{[t.lockName]:s,...n}=e;return n}}return e},renderingMode:function(e="post-only",t){return"SET_RENDERING_MODE"===t.type?t.mode:e},deviceType:function(e="Desktop",t){return"SET_DEVICE_TYPE"===t.type?t.deviceType:e},removedPanels:function(e=[],t){if("REMOVE_PANEL"===t.type)if(!e.includes(t.panelName))return[...e,t.panelName];return e},blockInserterPanel:function(e=!1,t){switch(t.type){case"SET_IS_LIST_VIEW_OPENED":return!t.isOpen&&e;case"SET_IS_INSERTER_OPENED":return t.value}return e},inserterSidebarToggleRef:function(e={current:null}){return e},listViewPanel:function(e=!1,t){switch(t.type){case"SET_IS_INSERTER_OPENED":return!t.value&&e;case"SET_IS_LIST_VIEW_OPENED":return t.isOpen}return e},listViewToggleRef:function(e={current:null}){return e},publishSidebarActive:function(e=!1,t){switch(t.type){case"OPEN_PUBLISH_SIDEBAR":return!0;case"CLOSE_PUBLISH_SIDEBAR":return!1;case"TOGGLE_PUBLISH_SIDEBAR":return!e}return e},canvasMinHeight:function(e=0,t){return"SET_CANVAS_MIN_HEIGHT"===t.type?t.minHeight:e},dataviews:f});const x=window.wp.blocks,v=window.wp.date,w=window.wp.url,S=window.wp.deprecated;var k=s.n(S);const C=window.wp.preferences,P=new Set(["meta"]),j=/%(?:postname|pagename)%/,E=6e4,T=["title","excerpt","content"],I="wp_template",B="wp_template_part",N="wp_block",R="wp_navigation",D="custom",A=["wp_template","wp_template_part"],M=[...A,"wp_block","wp_navigation"],L=window.wp.primitives;var O=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M18.5 10.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"})}),F=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",d:"M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})}),V=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.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.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})}),U=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.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"})});function H(e){return"header"===e?O:"footer"===e?F:"sidebar"===e?V:U}const z=window.wp.privateApis,{lock:G,unlock:$}=(0,z.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/editor");var W=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.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"})});const Z={},Y=e=>{if(!e)return Z;const{templateTypes:t,templateAreas:s,template:n}=e,{description:o,slug:r,title:i,area:a}=n,{title:l,description:c}=Object.values(t).find((e=>e.slug===r))??Z,d="string"==typeof i?i:i?.rendered,u="string"==typeof o?o:o?.raw,p=s?.map((e=>({...e,icon:H(e.icon)}))),m=p?.find((e=>a===e.area))?.icon||W;return{title:d&&d!==r?d:l||r,description:u||c,icon:m}},q={},K=(0,d.createRegistrySelector)((e=>()=>e(u.store).hasUndo())),Q=(0,d.createRegistrySelector)((e=>()=>e(u.store).hasRedo()));function X(e){return"auto-draft"===ne(e).status}function J(e){return"content"in ce(e)}const ee=(0,d.createRegistrySelector)((e=>t=>{const s=oe(t),n=re(t);return e(u.store).hasEditsForEntityRecord("postType",s,n)})),te=(0,d.createRegistrySelector)((e=>t=>{const s=e(u.store).__experimentalGetDirtyEntityRecords(),{type:n,id:o}=ne(t);return s.some((e=>"postType"!==e.kind||e.name!==n||e.key!==o))}));function se(e){return!ee(e)&&X(e)}const ne=(0,d.createRegistrySelector)((e=>t=>{const s=re(t),n=oe(t),o=e(u.store).getRawEntityRecord("postType",n,s);return o||q}));function oe(e){return e.postType}function re(e){return e.postId}function ie(e){return e.templateId}function ae(e){return ne(e)._links?.["version-history"]?.[0]?.count??0}function le(e){return ne(e)._links?.["predecessor-version"]?.[0]?.id??null}const ce=(0,d.createRegistrySelector)((e=>t=>{const s=oe(t),n=re(t);return e(u.store).getEntityRecordEdits("postType",s,n)||q}));function de(e,t){switch(t){case"type":return oe(e);case"id":return re(e);default:const s=ne(e);if(!s.hasOwnProperty(t))break;return b(s[t])}}const ue=(0,d.createSelector)(((e,t)=>{const s=ce(e);return s.hasOwnProperty(t)?{...de(e,t),...s[t]}:de(e,t)}),((e,t)=>[de(e,t),ce(e)[t]]));function pe(e,t){if("content"===t)return Re(e);const s=ce(e);return s.hasOwnProperty(t)?P.has(t)?ue(e,t):s[t]:de(e,t)}const me=(0,d.createRegistrySelector)((e=>(t,s)=>{if(!T.includes(s)&&"preview_link"!==s)return;const n=oe(t);if("wp_template"===n)return!1;const o=re(t),r=e(u.store).getCurrentUser()?.id,i=e(u.store).getAutosave(n,o,r);return i?b(i[s]):void 0}));function he(e){if("private"===pe(e,"status"))return"private";return pe(e,"password")?"password":"public"}function ge(e){return"pending"===ne(e).status}function _e(e,t){const s=t||ne(e);return-1!==["publish","private"].indexOf(s.status)||"future"===s.status&&!(0,v.isInTheFuture)(new Date(Number((0,v.getDate)(s.date))-E))}function fe(e){return"future"===ne(e).status&&!_e(e)}function be(e){const t=ne(e);return ee(e)||-1===["publish","private","future"].indexOf(t.status)}function ye(e){return!Ce(e)&&(!!pe(e,"title")||!!pe(e,"excerpt")||!xe(e)||"native"===p.Platform.OS)}const xe=(0,d.createRegistrySelector)((e=>t=>{const s=re(t),n=oe(t),o=e(u.store).getEditedEntityRecord("postType",n,s);if("function"!=typeof o.content)return!o.content;const r=pe(t,"blocks");if(0===r.length)return!0;if(r.length>1)return!1;const i=r[0].name;return(i===(0,x.getDefaultBlockName)()||i===(0,x.getFreeformContentHandlerName)())&&!Re(t)})),ve=(0,d.createRegistrySelector)((e=>t=>{if(!ye(t))return!1;if(Ue(t))return!1;const s=oe(t),n=e(u.store).getPostType(s);if("wp_template"===s||!n?.supports?.autosave)return!1;const o=re(t),r=e(u.store).hasFetchedAutosaves(s,o),i=e(u.store).getCurrentUser()?.id,a=e(u.store).getAutosave(s,o,i);return!!r&&(!a||(!!J(t)||["title","excerpt","meta"].some((e=>b(a[e])!==pe(t,e)))))}));function we(e){const t=pe(e,"date"),s=new Date(Number((0,v.getDate)(t))-E);return(0,v.isInTheFuture)(s)}function Se(e){const t=pe(e,"date"),s=pe(e,"modified"),n=ne(e).status;return("draft"===n||"auto-draft"===n||"pending"===n)&&(t===s||null===t)}function ke(e){return!!e.deleting.pending}function Ce(e){return!!e.saving.pending}const Pe=(0,d.createRegistrySelector)((e=>t=>{const s=e(u.store).__experimentalGetEntitiesBeingSaved(),{type:n,id:o}=ne(t);return s.some((e=>"postType"!==e.kind||e.name!==n||e.key!==o))})),je=(0,d.createRegistrySelector)((e=>t=>{const s=oe(t),n=re(t);return!e(u.store).getLastEntitySaveError("postType",s,n)})),Ee=(0,d.createRegistrySelector)((e=>t=>{const s=oe(t),n=re(t);return!!e(u.store).getLastEntitySaveError("postType",s,n)}));function Te(e){return Ce(e)&&Boolean(e.saving.options?.isAutosave)}function Ie(e){return Ce(e)&&Boolean(e.saving.options?.isPreview)}function Be(e){if(e.saving.pending||Ce(e))return;let t=me(e,"preview_link");t&&"draft"!==ne(e).status||(t=pe(e,"link"),t&&(t=(0,w.addQueryArgs)(t,{preview:!0})));const s=pe(e,"featured_media");return t&&s?(0,w.addQueryArgs)(t,{_thumbnail_id:s}):t}const Ne=(0,d.createRegistrySelector)((e=>()=>{const t=e(g.store).getBlocks();if(t.length>2)return null;let s;if(1===t.length&&(s=t[0].name,"core/embed"===s)){const e=t[0].attributes?.providerNameSlug;["youtube","vimeo"].includes(e)?s="core/video":["spotify","soundcloud"].includes(e)&&(s="core/audio")}switch(2===t.length&&"core/paragraph"===t[1].name&&(s=t[0].name),s){case"core/image":return"image";case"core/quote":case"core/pullquote":return"quote";case"core/gallery":return"gallery";case"core/video":return"video";case"core/audio":return"audio";default:return null}})),Re=(0,d.createRegistrySelector)((e=>t=>{const s=re(t),n=oe(t),o=e(u.store).getEditedEntityRecord("postType",n,s);if(o){if("function"==typeof o.content)return o.content(o);if(o.blocks)return(0,x.__unstableSerializeAndClean)(o.blocks);if(o.content)return o.content}return""}));function De(e){return Ce(e)&&!_e(e)&&"publish"===pe(e,"status")}function Ae(e){const t=pe(e,"permalink_template");return j.test(t)}function Me(e){const t=Oe(e);if(!t)return null;const{prefix:s,postName:n,suffix:o}=t;return Ae(e)?s+n+o:s}function Le(e){return pe(e,"slug")||(0,w.cleanForSlug)(pe(e,"title"))||re(e)}function Oe(e){const t=pe(e,"permalink_template");if(!t)return null;const s=pe(e,"slug")||pe(e,"generated_slug"),[n,o]=t.split(j);return{prefix:n,postName:s,suffix:o}}function Fe(e){return e.postLock.isLocked}function Ve(e){return Object.keys(e.postSavingLock).length>0}function Ue(e){return Object.keys(e.postAutosavingLock).length>0}function He(e){return e.postLock.isTakeover}function ze(e){return e.postLock.user}function Ge(e){return e.postLock.activePostLock}function $e(e){return Boolean(ne(e)._links?.hasOwnProperty("wp:action-unfiltered-html"))}const We=(0,d.createRegistrySelector)((e=>()=>!!e(C.store).get("core","isPublishSidebarEnabled"))),Ze=(0,d.createSelector)((e=>pe(e,"blocks")||(0,x.parse)(Re(e))),(e=>[pe(e,"blocks"),Re(e)]));function Ye(e,t){return e.removedPanels.includes(t)}const qe=(0,d.createRegistrySelector)((e=>(t,s)=>{const n=e(C.store).get("core","inactivePanels");return!Ye(t,s)&&!n?.includes(s)})),Ke=(0,d.createRegistrySelector)((e=>(t,s)=>{const n=e(C.store).get("core","openPanels");return!!n?.includes(s)}));function Qe(e){return k()("select('core/editor').getEditorSelectionStart",{since:"5.8",alternative:"select('core/editor').getEditorSelection"}),pe(e,"selection")?.selectionStart}function Xe(e){return k()("select('core/editor').getEditorSelectionStart",{since:"5.8",alternative:"select('core/editor').getEditorSelection"}),pe(e,"selection")?.selectionEnd}function Je(e){return pe(e,"selection")}function et(e){return!!e.postId}function tt(e){return e.editorSettings}function st(e){return e.renderingMode}const nt=(0,d.createRegistrySelector)((e=>t=>$(e(g.store)).isZoomOut()?"Desktop":t.deviceType));function ot(e){return e.listViewPanel}function rt(e){return!!e.blockInserterPanel}const it=(0,d.createRegistrySelector)((e=>()=>e(C.store).get("core","editorMode")??"visual"));function at(){return k()("select('core/editor').getStateBeforeOptimisticTransaction",{since:"5.7",hint:"No state history is kept on this store anymore"}),null}function lt(){return k()("select('core/editor').inSomeHistory",{since:"5.7",hint:"No state history is kept on this store anymore"}),!1}function ct(e){return(0,d.createRegistrySelector)((t=>(s,...n)=>(k()("`wp.data.select( 'core/editor' )."+e+"`",{since:"5.3",alternative:"`wp.data.select( 'core/block-editor' )."+e+"`",version:"6.2"}),t(g.store)[e](...n))))}const dt=ct("getBlockName"),ut=ct("isBlockValid"),pt=ct("getBlockAttributes"),mt=ct("getBlock"),ht=ct("getBlocks"),gt=ct("getClientIdsOfDescendants"),_t=ct("getClientIdsWithDescendants"),ft=ct("getGlobalBlockCount"),bt=ct("getBlocksByClientId"),yt=ct("getBlockCount"),xt=ct("getBlockSelectionStart"),vt=ct("getBlockSelectionEnd"),wt=ct("getSelectedBlockCount"),St=ct("hasSelectedBlock"),kt=ct("getSelectedBlockClientId"),Ct=ct("getSelectedBlock"),Pt=ct("getBlockRootClientId"),jt=ct("getBlockHierarchyRootClientId"),Et=ct("getAdjacentBlockClientId"),Tt=ct("getPreviousBlockClientId"),It=ct("getNextBlockClientId"),Bt=ct("getSelectedBlocksInitialCaretPosition"),Nt=ct("getMultiSelectedBlockClientIds"),Rt=ct("getMultiSelectedBlocks"),Dt=ct("getFirstMultiSelectedBlockClientId"),At=ct("getLastMultiSelectedBlockClientId"),Mt=ct("isFirstMultiSelectedBlock"),Lt=ct("isBlockMultiSelected"),Ot=ct("isAncestorMultiSelected"),Ft=ct("getMultiSelectedBlocksStartClientId"),Vt=ct("getMultiSelectedBlocksEndClientId"),Ut=ct("getBlockOrder"),Ht=ct("getBlockIndex"),zt=ct("isBlockSelected"),Gt=ct("hasSelectedInnerBlock"),$t=ct("isBlockWithinSelection"),Wt=ct("hasMultiSelection"),Zt=ct("isMultiSelecting"),Yt=ct("isSelectionEnabled"),qt=ct("getBlockMode"),Kt=ct("isTyping"),Qt=ct("isCaretWithinFormattedText"),Xt=ct("getBlockInsertionPoint"),Jt=ct("isBlockInsertionPointVisible"),es=ct("isValidTemplate"),ts=ct("getTemplate"),ss=ct("getTemplateLock"),ns=ct("canInsertBlockType"),os=ct("getInserterItems"),rs=ct("hasInserterItems"),is=ct("getBlockListSettings"),as=(0,d.createRegistrySelector)((e=>()=>(k()("select('core/editor').__experimentalGetDefaultTemplateTypes",{since:"6.8",alternative:"select('core/core-data').getCurrentTheme()?.default_template_types"}),e(u.store).getCurrentTheme()?.default_template_types))),ls=(0,d.createRegistrySelector)((e=>(0,d.createSelector)((()=>{k()("select('core/editor').__experimentalGetDefaultTemplatePartAreas",{since:"6.8",alternative:"select('core/core-data').getCurrentTheme()?.default_template_part_areas"});return(e(u.store).getCurrentTheme()?.default_template_part_areas||[]).map((e=>({...e,icon:H(e.icon)})))})))),cs=(0,d.createRegistrySelector)((e=>(0,d.createSelector)(((t,s)=>{k()("select('core/editor').__experimentalGetDefaultTemplateType",{since:"6.8"});const n=e(u.store).getCurrentTheme()?.default_template_types;return n?Object.values(n).find((e=>e.slug===s))??q:q})))),ds=(0,d.createRegistrySelector)((e=>(0,d.createSelector)(((t,s)=>{if(k()("select('core/editor').__experimentalGetTemplateInfo",{since:"6.8"}),!s)return q;const n=e(u.store).getCurrentTheme(),o=n?.default_template_types||[];return Y({template:s,templateAreas:n?.default_template_part_areas||[],templateTypes:o})})))),us=(0,d.createRegistrySelector)((e=>t=>{const s=oe(t),n=e(u.store).getPostType(s);return n?.labels?.singular_name}));function ps(e){return e.publishSidebarActive}const ms=window.wp.a11y,hs=window.wp.apiFetch;var gs=s.n(hs);const _s=window.wp.notices,fs=window.wp.i18n;function bs(e,t){return`wp-autosave-block-editor-post-${t?"auto-draft":e}`}function ys(e,t){window.sessionStorage.removeItem(bs(e,t))}const xs=(e,t,s)=>({dispatch:n})=>{n.setEditedPost(e.type,e.id);if("auto-draft"===e.status&&s){let o;o="content"in t?t.content:e.content.raw;let r=(0,x.parse)(o);r=(0,x.synchronizeBlocksWithTemplate)(r,s),n.resetEditorBlocks(r,{__unstableShouldCreateUndoLevel:!1})}t&&Object.values(t).some((([t,s])=>s!==(e[t]?.raw??e[t])))&&n.editPost(t)};function vs(){return k()("wp.data.dispatch( 'core/editor' ).__experimentalTearDownEditor",{since:"6.5"}),{type:"DO_NOTHING"}}function ws(){return k()("wp.data.dispatch( 'core/editor' ).resetPost",{since:"6.0",version:"6.3",alternative:"Initialize the editor with the setupEditorState action"}),{type:"DO_NOTHING"}}function Ss(){return k()("wp.data.dispatch( 'core/editor' ).updatePost",{since:"5.7",alternative:"Use the core entities store instead"}),{type:"DO_NOTHING"}}function ks(e){return k()("wp.data.dispatch( 'core/editor' ).setupEditorState",{since:"6.5",alternative:"wp.data.dispatch( 'core/editor' ).setEditedPost"}),Cs(e.type,e.id)}function Cs(e,t){return{type:"SET_EDITED_POST",postType:e,postId:t}}const Ps=(e,t)=>({select:s,registry:n})=>{const{id:o,type:r}=s.getCurrentPost();n.dispatch(u.store).editEntityRecord("postType",r,o,e,t)},js=(e={})=>async({select:t,dispatch:s,registry:n})=>{if(!t.isEditedPostSaveable())return;const o=t.getEditedPostContent();e.isAutosave||s.editPost({content:o},{undoIgnore:!0});const r=t.getCurrentPost();let i={id:r.id,...n.select(u.store).getEntityRecordNonTransientEdits("postType",r.type,r.id),content:o};s({type:"REQUEST_POST_UPDATE_START",options:e});let a=!1;try{i=await(0,h.applyFiltersAsync)("editor.preSavePost",i,e)}catch(e){a=e}if(!a)try{await n.dispatch(u.store).saveEntityRecord("postType",r.type,i,e)}catch(e){a=e.message&&"unknown_error"!==e.code?e.message:(0,fs.__)("An error occurred while updating.")}if(a||(a=n.select(u.store).getLastEntitySaveError("postType",r.type,r.id)),!a)try{await(0,h.applyFilters)("editor.__unstableSavePost",Promise.resolve(),e)}catch(e){a=e}if(!a)try{await(0,h.doActionAsync)("editor.savePost",{id:r.id},e)}catch(e){a=e}if(s({type:"REQUEST_POST_UPDATE_FINISH",options:e}),a){const e=function(e){const{post:t,edits:s,error:n}=e;if(n&&"rest_autosave_no_changes"===n.code)return[];const o=-1!==["publish","private","future"].indexOf(t.status);if("offline_error"===n.code){const e={publish:(0,fs.__)("Publishing failed because you were offline."),private:(0,fs.__)("Publishing failed because you were offline."),future:(0,fs.__)("Scheduling failed because you were offline."),default:(0,fs.__)("Updating failed because you were offline.")};return[!o&&s.status in e?e[s.status]:e.default,{id:"editor-save"}]}const r={publish:(0,fs.__)("Publishing failed."),private:(0,fs.__)("Publishing failed."),future:(0,fs.__)("Scheduling failed."),default:(0,fs.__)("Updating failed.")};let i=!o&&s.status in r?r[s.status]:r.default;return n.message&&!/<\/?[^>]*>/.test(n.message)&&(i=[i,n.message].join(" ")),[i,{id:"editor-save"}]}({post:r,edits:i,error:a});e.length&&n.dispatch(_s.store).createErrorNotice(...e)}else{const s=t.getCurrentPost(),o=function(e){const{previousPost:t,post:s,postType:n}=e;if(e.options?.isAutosave)return[];const o=["publish","private","future"],r=o.includes(t.status),i=o.includes(s.status),a="trash"===s.status&&"trash"!==t.status;let l,c,d=n?.viewable??!1;a?(l=n.labels.item_trashed,d=!1):r||i?r&&!i?(l=n.labels.item_reverted_to_draft,d=!1):l=!r&&i?{publish:n.labels.item_published,private:n.labels.item_published_privately,future:n.labels.item_scheduled}[s.status]:n.labels.item_updated:(l=(0,fs.__)("Draft saved."),c=!0);const u=[];return d&&u.push({label:c?(0,fs.__)("View Preview"):n.labels.view_item,url:s.link,openInNewTab:!0}),[l,{id:"editor-save",type:"snackbar",actions:u}]}({previousPost:r,post:s,postType:await n.resolveSelect(u.store).getPostType(s.type),options:e});o.length&&n.dispatch(_s.store).createSuccessNotice(...o),e.isAutosave||n.dispatch(g.store).__unstableMarkLastChangeAsPersistent()}};function Es(){return k()("wp.data.dispatch( 'core/editor' ).refreshPost",{since:"6.0",version:"6.3",alternative:"Use the core entities store instead"}),{type:"DO_NOTHING"}}const Ts=()=>async({select:e,dispatch:t,registry:s})=>{const n=e.getCurrentPostType(),o=await s.resolveSelect(u.store).getPostType(n),{rest_base:r,rest_namespace:i="wp/v2"}=o;t({type:"REQUEST_POST_DELETE_START"});try{const s=e.getCurrentPost();await gs()({path:`/${i}/${r}/${s.id}`,method:"DELETE"}),await t.savePost()}catch(e){s.dispatch(_s.store).createErrorNotice(...(a={error:e},[a.error.message&&"unknown_error"!==a.error.code?a.error.message:(0,fs.__)("Trashing failed"),{id:"editor-trash-fail"}]))}var a;t({type:"REQUEST_POST_DELETE_FINISH"})},Is=({local:e=!1,...t}={})=>async({select:s,dispatch:n})=>{const o=s.getCurrentPost();if("wp_template"!==o.type)if(e){const e=s.isEditedPostNew(),t=s.getEditedPostAttribute("title"),n=s.getEditedPostAttribute("content"),r=s.getEditedPostAttribute("excerpt");!function(e,t,s,n,o){window.sessionStorage.setItem(bs(e,t),JSON.stringify({post_title:s,content:n,excerpt:o}))}(o.id,e,t,n,r)}else await n.savePost({isAutosave:!0,...t})},Bs=({forceIsAutosaveable:e}={})=>async({select:t,dispatch:s})=>{if((e||t.isEditedPostAutosaveable())&&!t.isPostLocked()){["draft","auto-draft"].includes(t.getEditedPostAttribute("status"))?await s.savePost({isPreview:!0}):await s.autosave({isPreview:!0})}return t.getEditedPostPreviewLink()},Ns=()=>({registry:e})=>{e.dispatch(u.store).redo()},Rs=()=>({registry:e})=>{e.dispatch(u.store).undo()};function Ds(){return k()("wp.data.dispatch( 'core/editor' ).createUndoLevel",{since:"6.0",version:"6.3",alternative:"Use the core entities store instead"}),{type:"DO_NOTHING"}}function As(e){return{type:"UPDATE_POST_LOCK",lock:e}}const Ms=()=>({registry:e})=>{e.dispatch(C.store).set("core","isPublishSidebarEnabled",!0)},Ls=()=>({registry:e})=>{e.dispatch(C.store).set("core","isPublishSidebarEnabled",!1)};function Os(e){return{type:"LOCK_POST_SAVING",lockName:e}}function Fs(e){return{type:"UNLOCK_POST_SAVING",lockName:e}}function Vs(e){return{type:"LOCK_POST_AUTOSAVING",lockName:e}}function Us(e){return{type:"UNLOCK_POST_AUTOSAVING",lockName:e}}const Hs=(e,t={})=>({select:s,dispatch:n,registry:o})=>{const{__unstableShouldCreateUndoLevel:r,selection:i}=t,a={blocks:e,selection:i};if(!1!==r){const{id:e,type:t}=s.getCurrentPost();if(o.select(u.store).getEditedEntityRecord("postType",t,e).blocks===a.blocks)return void o.dispatch(u.store).__unstableCreateUndoLevel("postType",t,e);a.content=({blocks:e=[]})=>(0,x.__unstableSerializeAndClean)(e)}n.editPost(a)};function zs(e){return{type:"UPDATE_EDITOR_SETTINGS",settings:e}}const Gs=e=>({dispatch:t,registry:s,select:n})=>{n.__unstableIsEditorReady()&&(s.dispatch(g.store).clearSelectedBlock(),t.editPost({selection:void 0},{undoIgnore:!0})),t({type:"SET_RENDERING_MODE",mode:e})};function $s(e){return{type:"SET_DEVICE_TYPE",deviceType:e}}const Ws=e=>({registry:t})=>{const s=t.select(C.store).get("core","inactivePanels")??[];let n;n=!!s?.includes(e)?s.filter((t=>t!==e)):[...s,e],t.dispatch(C.store).set("core","inactivePanels",n)},Zs=e=>({registry:t})=>{const s=t.select(C.store).get("core","openPanels")??[];let n;n=!!s?.includes(e)?s.filter((t=>t!==e)):[...s,e],t.dispatch(C.store).set("core","openPanels",n)};function Ys(e){return{type:"REMOVE_PANEL",panelName:e}}const qs=e=>({dispatch:t,registry:s})=>{"object"==typeof e&&e.hasOwnProperty("rootClientId")&&e.hasOwnProperty("insertionIndex")&&$(s.dispatch(g.store)).setInsertionPoint({rootClientId:e.rootClientId,index:e.insertionIndex}),t({type:"SET_IS_INSERTER_OPENED",value:e})};function Ks(e){return{type:"SET_IS_LIST_VIEW_OPENED",isOpen:e}}const Qs=({createNotice:e=!0}={})=>({dispatch:t,registry:s})=>{const n=s.select(C.store).get("core","distractionFree");n&&s.dispatch(C.store).set("core","fixedToolbar",!1),n||s.batch((()=>{s.dispatch(C.store).set("core","fixedToolbar",!0),t.setIsInserterOpened(!1),t.setIsListViewOpened(!1),$(s.dispatch(g.store)).resetZoomLevel()})),s.batch((()=>{s.dispatch(C.store).set("core","distractionFree",!n),e&&s.dispatch(_s.store).createInfoNotice(n?(0,fs.__)("Distraction free mode deactivated."):(0,fs.__)("Distraction free mode activated."),{id:"core/editor/distraction-free-mode/notice",type:"snackbar",actions:[{label:(0,fs.__)("Undo"),onClick:()=>{s.batch((()=>{s.dispatch(C.store).set("core","fixedToolbar",n),s.dispatch(C.store).toggle("core","distractionFree")}))}}]})}))},Xs=()=>({registry:e})=>{e.dispatch(C.store).toggle("core","focusMode");const t=e.select(C.store).get("core","focusMode");e.dispatch(_s.store).createInfoNotice(t?(0,fs.__)("Spotlight mode activated."):(0,fs.__)("Spotlight mode deactivated."),{id:"core/editor/toggle-spotlight-mode/notice",type:"snackbar",actions:[{label:(0,fs.__)("Undo"),onClick:()=>{e.dispatch(C.store).toggle("core","focusMode")}}]})},Js=()=>({registry:e})=>{e.dispatch(C.store).toggle("core","fixedToolbar");const t=e.select(C.store).get("core","fixedToolbar");e.dispatch(_s.store).createInfoNotice(t?(0,fs.__)("Top toolbar activated."):(0,fs.__)("Top toolbar deactivated."),{id:"core/editor/toggle-top-toolbar/notice",type:"snackbar",actions:[{label:(0,fs.__)("Undo"),onClick:()=>{e.dispatch(C.store).toggle("core","fixedToolbar")}}]})},en=e=>({dispatch:t,registry:s})=>{if(s.dispatch(C.store).set("core","editorMode",e),"visual"!==e&&(s.dispatch(g.store).clearSelectedBlock(),$(s.dispatch(g.store)).resetZoomLevel()),"visual"===e)(0,ms.speak)((0,fs.__)("Visual editor selected"),"assertive");else if("text"===e){s.select(C.store).get("core","distractionFree")&&t.toggleDistractionFree(),(0,ms.speak)((0,fs.__)("Code editor selected"),"assertive")}};function tn(){return{type:"OPEN_PUBLISH_SIDEBAR"}}function sn(){return{type:"CLOSE_PUBLISH_SIDEBAR"}}function nn(){return{type:"TOGGLE_PUBLISH_SIDEBAR"}}const on=e=>(...t)=>({registry:s})=>{k()("`wp.data.dispatch( 'core/editor' )."+e+"`",{since:"5.3",alternative:"`wp.data.dispatch( 'core/block-editor' )."+e+"`",version:"6.2"}),s.dispatch(g.store)[e](...t)},rn=on("resetBlocks"),an=on("receiveBlocks"),ln=on("updateBlock"),cn=on("updateBlockAttributes"),dn=on("selectBlock"),un=on("startMultiSelect"),pn=on("stopMultiSelect"),mn=on("multiSelect"),hn=on("clearSelectedBlock"),gn=on("toggleSelection"),_n=on("replaceBlocks"),fn=on("replaceBlock"),bn=on("moveBlocksDown"),yn=on("moveBlocksUp"),xn=on("moveBlockToPosition"),vn=on("insertBlock"),wn=on("insertBlocks"),Sn=on("showInsertionPoint"),kn=on("hideInsertionPoint"),Cn=on("setTemplateValidity"),Pn=on("synchronizeTemplate"),jn=on("mergeBlocks"),En=on("removeBlocks"),Tn=on("removeBlock"),In=on("toggleBlockMode"),Bn=on("startTyping"),Nn=on("stopTyping"),Rn=on("enterFormattedText"),Dn=on("exitFormattedText"),An=on("insertDefaultBlock"),Mn=on("updateBlockListSettings"),Ln=window.wp.htmlEntities;function On(e){return!!e&&(e.source===D&&(Boolean(e?.plugin)||e?.has_theme_file))}var Fn=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})});var Vn={id:"view-post",label:(0,fs._x)("View","verb"),isPrimary:!0,icon:Fn,isEligible:e=>"trash"!==e.status,callback(e,{onActionPerformed:t}){const s=e[0];window.open(s?.link,"_blank"),t&&t(e)}};var Un={id:"view-post-revisions",context:"list",label(e){const t=e[0]._links?.["version-history"]?.[0]?.count??0;return(0,fs.sprintf)((0,fs.__)("View revisions (%d)"),t)},isEligible(e){if("trash"===e.status)return!1;return!!(e?._links?.["predecessor-version"]?.[0]?.id??null)&&(e?._links?.["version-history"]?.[0]?.count??0)>1},callback(e,{onActionPerformed:t}){const s=e[0],n=(0,w.addQueryArgs)("revision.php",{revision:s?._links?.["predecessor-version"]?.[0]?.id});document.location.href=n,t&&t(e)}};const Hn=window.wp.components;var zn=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z"})});var Gn=function(){return Gn=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var o in t=arguments[s])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Gn.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function $n(e){return e.toLowerCase()}var Wn=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],Zn=/[^A-Z0-9]+/gi;function Yn(e,t,s){return t instanceof RegExp?e.replace(t,s):t.reduce((function(e,t){return e.replace(t,s)}),e)}function qn(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var s=t.splitRegexp,n=void 0===s?Wn:s,o=t.stripRegexp,r=void 0===o?Zn:o,i=t.transform,a=void 0===i?$n:i,l=t.delimiter,c=void 0===l?" ":l,d=Yn(Yn(e,n,"$1\0$2"),r,"\0"),u=0,p=d.length;"\0"===d.charAt(u);)u++;for(;"\0"===d.charAt(p-1);)p--;return d.slice(u,p).split("\0").map(a).join(c)}(e,Gn({delimiter:"."},t))}function Kn(e,t){return void 0===t&&(t={}),qn(e,Gn({delimiter:"-"},t))}function Qn(e,t){return`fields-create-template-part-modal__area-option-${e}-${t}`}function Xn(e,t){return`fields-create-template-part-modal__area-option-description-${e}-${t}`}function Jn({modalTitle:e,...t}){const s=(0,d.useSelect)((e=>e(u.store).getPostType("wp_template_part")?.labels?.add_new_item),[]);return(0,c.jsx)(Hn.Modal,{title:e||s,onRequestClose:t.closeModal,overlayClassName:"fields-create-template-part-modal",focusOnMount:"firstContentElement",size:"medium",children:(0,c.jsx)(to,{...t})})}const eo=e=>"header"===e?O:"footer"===e?F:"sidebar"===e?V:U;function to({defaultArea:e="uncategorized",blocks:t=[],confirmLabel:s=(0,fs.__)("Add"),closeModal:n,onCreate:o,onError:r,defaultTitle:i=""}){const{createErrorNotice:a}=(0,d.useDispatch)(_s.store),{saveEntityRecord:l}=(0,d.useDispatch)(u.store),h=(0,d.useSelect)((e=>e(u.store).getEntityRecords("postType","wp_template_part",{per_page:-1})),[])??[],[g,_]=(0,p.useState)(i),[f,b]=(0,p.useState)(e),[y,v]=(0,p.useState)(!1),w=(0,m.useInstanceId)(Jn),S=(0,d.useSelect)((e=>e(u.store).getCurrentTheme()?.default_template_part_areas),[]);async function k(){if(g&&!y)try{v(!0);const e=((e,t)=>{const s=e.toLowerCase(),n=t.map((e=>e.title.rendered.toLowerCase()));if(!n.includes(s))return e;let o=2;for(;n.includes(`${s} ${o}`);)o++;return`${e} ${o}`})(g,h),s=(e=>Kn(e).replace(/[^\w-]+/g,"")||"wp-custom-part")(e),n=await l("postType","wp_template_part",{slug:s,title:e,content:(0,x.serialize)(t),area:f},{throwOnError:!0});await o(n)}catch(e){const t=e instanceof Error&&"code"in e&&e.message&&"unknown_error"!==e.code?e.message:(0,fs.__)("An error occurred while creating the template part.");a(t,{type:"snackbar"}),r?.()}finally{v(!1)}}return(0,c.jsx)("form",{onSubmit:async e=>{e.preventDefault(),await k()},children:(0,c.jsxs)(Hn.__experimentalVStack,{spacing:"4",children:[(0,c.jsx)(Hn.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,fs.__)("Name"),value:g,onChange:_,required:!0}),(0,c.jsxs)("fieldset",{className:"fields-create-template-part-modal__area-fieldset",children:[(0,c.jsx)(Hn.BaseControl.VisualLabel,{as:"legend",children:(0,fs.__)("Area")}),(0,c.jsx)("div",{className:"fields-create-template-part-modal__area-radio-group",children:(S??[]).map((e=>{const t=eo(e.icon);return(0,c.jsxs)("div",{className:"fields-create-template-part-modal__area-radio-wrapper",children:[(0,c.jsx)("input",{type:"radio",id:Qn(e.area,w),name:`fields-create-template-part-modal__area-${w}`,value:e.area,checked:f===e.area,onChange:()=>{b(e.area)},"aria-describedby":Xn(e.area,w)}),(0,c.jsx)(Hn.Icon,{icon:t,className:"fields-create-template-part-modal__area-radio-icon"}),(0,c.jsx)("label",{htmlFor:Qn(e.area,w),className:"fields-create-template-part-modal__area-radio-label",children:e.label}),(0,c.jsx)(Hn.Icon,{icon:zn,className:"fields-create-template-part-modal__area-radio-checkmark"}),(0,c.jsx)("p",{className:"fields-create-template-part-modal__area-radio-description",id:Xn(e.area,w),children:e.description})]},e.area)}))})]}),(0,c.jsxs)(Hn.__experimentalHStack,{justify:"right",children:[(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{n()},children:(0,fs.__)("Cancel")}),(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit","aria-disabled":!g||y,isBusy:y,children:s})]})]})})}function so(e){return"wp_template"===e.type||"wp_template_part"===e.type}function no(e,t=(0,fs.__)("(no title)")){let s="";return"string"==typeof e.title?s=(0,Ln.decodeEntities)(e.title):e.title&&"rendered"in e.title?s=(0,Ln.decodeEntities)(e.title.rendered):e.title&&"raw"in e.title&&(s=(0,Ln.decodeEntities)(e.title.raw)),s||t}function oo(e){return!!e&&([e.source,e.source].includes("custom")&&!Boolean("wp_template"===e.type&&e?.plugin)&&!e.has_theme_file)}const ro={id:"duplicate-template-part",label:(0,fs._x)("Duplicate","action label"),isEligible:e=>"wp_template_part"===e.type,modalHeader:(0,fs._x)("Duplicate template part","action label"),modalFocusOnMount:"firstContentElement",RenderModal:({items:e,closeModal:t})=>{const[s]=e,n=(0,p.useMemo)((()=>s.blocks??(0,x.parse)("string"==typeof s.content?s.content:s.content.raw,{__unstableSkipMigrationLogs:!0})),[s.content,s.blocks]),{createSuccessNotice:o}=(0,d.useDispatch)(_s.store);return(0,c.jsx)(to,{blocks:n,defaultArea:s.area,defaultTitle:(0,fs.sprintf)((0,fs._x)("%s (Copy)","template part"),no(s)),onCreate:function(e){o((0,fs.sprintf)((0,fs._x)('"%s" duplicated.',"template part"),no(e)),{type:"snackbar",id:"edit-site-patterns-success"}),t?.()},onError:t,confirmLabel:(0,fs._x)("Duplicate","action label"),closeModal:t??(()=>{})})}};var io=ro;const ao=window.wp.patterns,{lock:lo,unlock:co}=(0,z.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/fields"),{CreatePatternModalContents:uo,useDuplicatePatternProps:po}=co(ao.privateApis),mo={id:"duplicate-pattern",label:(0,fs._x)("Duplicate","action label"),isEligible:e=>"wp_template_part"!==e.type,modalHeader:(0,fs._x)("Duplicate pattern","action label"),modalFocusOnMount:"firstContentElement",RenderModal:({items:e,closeModal:t})=>{const[s]=e,n=po({pattern:s,onSuccess:()=>t?.()});return(0,c.jsx)(uo,{onClose:t,confirmLabel:(0,fs._x)("Duplicate","action label"),...n})}};var ho=mo;const{PATTERN_TYPES:go}=co(ao.privateApis),_o={id:"rename-post",label:(0,fs.__)("Rename"),modalFocusOnMount:"firstContentElement",isEligible:e=>"trash"!==e.status&&(["wp_template","wp_template_part",...Object.values(go)].includes(e.type)?function(e){return"wp_template"===e.type}(e)?oo(e)&&e.is_custom&&e.permissions?.update:function(e){return"wp_template_part"===e.type}(e)?"custom"===e.source&&!e?.has_theme_file&&e.permissions?.update:e.type===go.user&&e.permissions?.update:e.permissions?.update),RenderModal:({items:e,closeModal:t,onActionPerformed:s})=>{const[n]=e,[o,r]=(0,p.useState)((()=>no(n,""))),{editEntityRecord:i,saveEditedEntityRecord:a}=(0,d.useDispatch)(u.store),{createSuccessNotice:l,createErrorNotice:m}=(0,d.useDispatch)(_s.store);return(0,c.jsx)("form",{onSubmit:async function(c){c.preventDefault();try{await i("postType",n.type,n.id,{title:o}),r(""),t?.(),await a("postType",n.type,n.id,{throwOnError:!0}),l((0,fs.__)("Name updated"),{type:"snackbar"}),s?.(e)}catch(e){const t=e,s=t.message&&"unknown_error"!==t.code?t.message:(0,fs.__)("An error occurred while updating the name");m(s,{type:"snackbar"})}},children:(0,c.jsxs)(Hn.__experimentalVStack,{spacing:"5",children:[(0,c.jsx)(Hn.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,fs.__)("Name"),value:o,onChange:r,required:!0}),(0,c.jsxs)(Hn.__experimentalHStack,{justify:"right",children:[(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{t?.()},children:(0,fs.__)("Cancel")}),(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",children:(0,fs.__)("Save")})]})]})})}};var fo=_o;const bo={id:"order-pages",label:(0,fs.__)("Order"),isEligible:({status:e})=>"trash"!==e,modalFocusOnMount:"firstContentElement",RenderModal:function({items:e,closeModal:t,onActionPerformed:s}){const[n,o]=(0,p.useState)(e[0]),{editEntityRecord:r,saveEditedEntityRecord:i}=(0,d.useDispatch)(u.store),{createSuccessNotice:a,createErrorNotice:l}=(0,d.useDispatch)(_s.store),m=function(e){return"number"==typeof e.menu_order&&Number.isInteger(e.menu_order)}(n);return(0,c.jsx)("form",{onSubmit:async function(o){if(o.preventDefault(),m)try{await r("postType",n.type,n.id,{menu_order:n.menu_order}),t?.(),await i("postType",n.type,n.id,{throwOnError:!0}),a((0,fs.__)("Order updated."),{type:"snackbar"}),s?.(e)}catch(e){const t=e,s=t.message&&"unknown_error"!==t.code?t.message:(0,fs.__)("An error occurred while updating the order");l(s,{type:"snackbar"})}},children:(0,c.jsxs)(Hn.__experimentalVStack,{spacing:"5",children:[(0,c.jsx)("div",{children:(0,fs.__)("Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.")}),(0,c.jsx)(Hn.__experimentalInputControl,{__next40pxDefaultSize:!0,label:(0,fs.__)("Order"),type:"number",value:"number"==typeof n.menu_order&&Number.isInteger(n.menu_order)?String(n.menu_order):"",onChange:e=>{const t=parseInt(e,10);o({...n,menu_order:isNaN(t)?void 0:t})}}),(0,c.jsxs)(Hn.__experimentalHStack,{justify:"right",children:[(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{t?.()},children:(0,fs.__)("Cancel")}),(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",accessibleWhenDisabled:!0,disabled:!m,children:(0,fs.__)("Save")})]})]})})}};var yo=bo;"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,t,s){const n=Number(0xffffffffn&t),o=Number(t>>32n);this.setUint32(e+(s?0:4),n,s),this.setUint32(e+(s?4:0),o,s)}});var xo=e=>new DataView(new ArrayBuffer(e)),vo=e=>new Uint8Array(e.buffer||e),wo=e=>(new TextEncoder).encode(String(e)),So=e=>Math.min(4294967295,Number(e)),ko=e=>Math.min(65535,Number(e));function Co(e,t,s){void 0===t||t instanceof Date||(t=new Date(t));const n=void 0!==e;if(s||(s=n?436:509),e instanceof File)return{isFile:n,t:t||new Date(e.lastModified),bytes:e.stream(),mode:s};if(e instanceof Response)return{isFile:n,t:t||new Date(e.headers.get("Last-Modified")||Date.now()),bytes:e.body,mode:s};if(void 0===t)t=new Date;else if(isNaN(t))throw new Error("Invalid modification date.");if(!n)return{isFile:n,t,mode:s};if("string"==typeof e)return{isFile:n,t,bytes:wo(e),mode:s};if(e instanceof Blob)return{isFile:n,t,bytes:e.stream(),mode:s};if(e instanceof Uint8Array||e instanceof ReadableStream)return{isFile:n,t,bytes:e,mode:s};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{isFile:n,t,bytes:vo(e),mode:s};if(Symbol.asyncIterator in e)return{isFile:n,t,bytes:Po(e[Symbol.asyncIterator]()),mode:s};throw new TypeError("Unsupported input format.")}function Po(e,t=e){return new ReadableStream({async pull(t){let s=0;for(;t.desiredSize>s;){const n=await e.next();if(!n.value){t.close();break}{const e=jo(n.value);t.enqueue(e),s+=e.byteLength}}},cancel(e){t.throw?.(e)}})}function jo(e){return"string"==typeof e?wo(e):e instanceof Uint8Array?e:vo(e)}function Eo(e,t,s){let[n,o]=function(e){return e?e instanceof Uint8Array?[e,1]:ArrayBuffer.isView(e)||e instanceof ArrayBuffer?[vo(e),1]:[wo(e),0]:[void 0,0]}(t);if(e instanceof File)return{i:Io(n||wo(e.name)),o:BigInt(e.size),u:o};if(e instanceof Response){const t=e.headers.get("content-disposition"),r=t&&t.match(/;\s*filename\*?\s*=\s*(?:UTF-\d+''|)["']?([^;"'\r\n]*)["']?(?:;|$)/i),i=r&&r[1]||e.url&&new URL(e.url).pathname.split("/").findLast(Boolean),a=i&&decodeURIComponent(i),l=s||+e.headers.get("content-length");return{i:Io(n||wo(a)),o:BigInt(l),u:o}}return n=Io(n,void 0!==e||void 0!==s),"string"==typeof e?{i:n,o:BigInt(wo(e).length),u:o}:e instanceof Blob?{i:n,o:BigInt(e.size),u:o}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{i:n,o:BigInt(e.byteLength),u:o}:{i:n,o:To(e,s),u:o}}function To(e,t){return t>-1?BigInt(t):e?void 0:0n}function Io(e,t=1){if(!e||e.every((e=>47===e)))throw new Error("The file must have a name.");if(t)for(;47===e[e.length-1];)e=e.subarray(0,-1);else 47!==e[e.length-1]&&(e=new Uint8Array([...e,47]));return e}var Bo=new Uint32Array(256);for(let e=0;e<256;++e){let t=e;for(let e=0;e<8;++e)t=t>>>1^(1&t&&3988292384);Bo[e]=t}function No(e,t=0){t=~t;for(var s=0,n=e.length;s<n;s++)t=t>>>8^Bo[255&t^e[s]];return~t>>>0}function Ro(e,t,s=0){const n=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,o=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;t.setUint16(s,n,1),t.setUint16(s+2,o,1)}function Do({i:e,u:t},s){return 8*(!t||(s??function(e){try{Ao.decode(e)}catch{return 0}return 1}(e)))}var Ao=new TextDecoder("utf8",{fatal:1});function Mo(e,t=0){const s=xo(30);return s.setUint32(0,1347093252),s.setUint32(4,754976768|t),Ro(e.t,s,10),s.setUint16(26,e.i.length,1),vo(s)}async function*Lo(e){let{bytes:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.l=No(t,0),e.o=BigInt(t.length);else{e.o=0n;const s=t.getReader();for(;;){const{value:t,done:n}=await s.read();if(n)break;e.l=No(t,e.l),e.o+=BigInt(t.length),yield t}}}function Oo(e,t){const s=xo(16+(t?8:0));return s.setUint32(0,1347094280),s.setUint32(4,e.isFile?e.l:0,1),t?(s.setBigUint64(8,e.o,1),s.setBigUint64(16,e.o,1)):(s.setUint32(8,So(e.o),1),s.setUint32(12,So(e.o),1)),vo(s)}function Fo(e,t,s=0,n=0){const o=xo(46);return o.setUint32(0,1347092738),o.setUint32(4,755182848),o.setUint16(8,2048|s),Ro(e.t,o,12),o.setUint32(16,e.isFile?e.l:0,1),o.setUint32(20,So(e.o),1),o.setUint32(24,So(e.o),1),o.setUint16(28,e.i.length,1),o.setUint16(30,n,1),o.setUint16(40,e.mode|(e.isFile?32768:16384),1),o.setUint32(42,So(t),1),vo(o)}function Vo(e,t,s){const n=xo(s);return n.setUint16(0,1,1),n.setUint16(2,s-4,1),16&s&&(n.setBigUint64(4,e.o,1),n.setBigUint64(12,e.o,1)),n.setBigUint64(s-8,t,1),vo(n)}function Uo(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified,e.mode]]}function Ho(e,t={}){const s={"Content-Type":"application/zip","Content-Disposition":"attachment"};return("bigint"==typeof t.length||Number.isInteger(t.length))&&t.length>0&&(s["Content-Length"]=String(t.length)),t.metadata&&(s["Content-Length"]=String((e=>function(e){let t=BigInt(22),s=0n,n=0;for(const o of e){if(!o.i)throw new Error("Every file must have a non-empty name.");if(void 0===o.o)throw new Error(`Missing size for file "${(new TextDecoder).decode(o.i)}".`);const e=o.o>=0xffffffffn,r=s>=0xffffffffn;s+=BigInt(46+o.i.length+(e&&8))+o.o,t+=BigInt(o.i.length+46+(12*r|28*e)),n||(n=e)}return(n||s>=0xffffffffn)&&(t+=BigInt(76)),t+s}(function*(e){for(const t of e)yield Eo(...Uo(t)[0])}(e)))(t.metadata))),new Response(zo(e,t),{headers:s})}function zo(e,t={}){const s=function(e){const t=e[Symbol.iterator in e?Symbol.iterator:Symbol.asyncIterator]();return{async next(){const e=await t.next();if(e.done)return e;const[s,n]=Uo(e.value);return{done:0,value:Object.assign(Co(...n),Eo(...s))}},throw:t.throw?.bind(t),[Symbol.asyncIterator](){return this}}}(e);return Po(async function*(e,t){const s=[];let n=0n,o=0n,r=0;for await(const i of e){const e=Do(i,t.buffersAreUTF8);yield Mo(i,e),yield new Uint8Array(i.i),i.isFile&&(yield*Lo(i));const a=i.o>=0xffffffffn,l=12*(n>=0xffffffffn)|28*a;yield Oo(i,a),s.push(Fo(i,n,e,l)),s.push(i.i),l&&s.push(Vo(i,n,l)),a&&(n+=8n),o++,n+=BigInt(46+i.i.length)+i.o,r||(r=a)}let i=0n;for(const e of s)yield e,i+=BigInt(e.length);if(r||n>=0xffffffffn){const e=xo(76);e.setUint32(0,1347094022),e.setBigUint64(4,BigInt(44),1),e.setUint32(12,755182848),e.setBigUint64(24,o,1),e.setBigUint64(32,o,1),e.setBigUint64(40,i,1),e.setBigUint64(48,n,1),e.setUint32(56,1347094023),e.setBigUint64(64,n+i,1),e.setUint32(72,1,1),yield vo(e)}const a=xo(22);a.setUint32(0,1347093766),a.setUint16(8,ko(o),1),a.setUint16(10,ko(o),1),a.setUint32(12,So(i),1),a.setUint32(16,So(n),1),yield vo(a)}(s,t),s)}const Go=window.wp.blob;var $o=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.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"})});function Wo(e){return JSON.stringify({__file:e.type,title:no(e),content:"string"==typeof e.content?e.content:e.content?.raw,syncStatus:e.wp_pattern_sync_status},null,2)}var Zo={id:"export-pattern",label:(0,fs.__)("Export as JSON"),icon:$o,supportsBulk:!0,isEligible:e=>"wp_block"===e.type,callback:async e=>{if(1===e.length)return(0,Go.downloadBlob)(`${Kn(no(e[0])||e[0].slug)}.json`,Wo(e[0]),"application/json");const t={},s=e.map((e=>{const s=Kn(no(e)||e.slug);return t[s]=(t[s]||0)+1,{name:s+(t[s]>1?"-"+(t[s]-1):"")+".json",lastModified:new Date,input:Wo(e)}}));return(0,Go.downloadBlob)((0,fs.__)("patterns-export")+".zip",await Ho(s).blob(),"application/zip")}},Yo=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.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"})});var qo={id:"restore",label:(0,fs.__)("Restore"),isPrimary:!0,icon:Yo,supportsBulk:!0,isEligible:e=>!so(e)&&"wp_block"!==e.type&&"trash"===e.status&&e.permissions?.update,async callback(e,{registry:t,onActionPerformed:s}){const{createSuccessNotice:n,createErrorNotice:o}=t.dispatch(_s.store),{editEntityRecord:r,saveEditedEntityRecord:i}=t.dispatch(u.store);await Promise.allSettled(e.map((e=>r("postType",e.type,e.id,{status:"draft"}))));const a=await Promise.allSettled(e.map((e=>i("postType",e.type,e.id,{throwOnError:!0}))));if(a.every((({status:e})=>"fulfilled"===e))){let t;t=1===e.length?(0,fs.sprintf)((0,fs.__)('"%s" has been restored.'),no(e[0])):"page"===e[0].type?(0,fs.sprintf)((0,fs.__)("%d pages have been restored."),e.length):(0,fs.sprintf)((0,fs.__)("%d posts have been restored."),e.length),n(t,{type:"snackbar",id:"restore-post-action"}),s&&s(e)}else{let e;if(1===a.length){const t=a[0];e=t.reason?.message?t.reason.message:(0,fs.__)("An error occurred while restoring the post.")}else{const t=new Set,s=a.filter((({status:e})=>"rejected"===e));for(const e of s){const s=e;s.reason?.message&&t.add(s.reason.message)}e=0===t.size?(0,fs.__)("An error occurred while restoring the posts."):1===t.size?(0,fs.sprintf)((0,fs.__)("An error occurred while restoring the posts: %s"),[...t][0]):(0,fs.sprintf)((0,fs.__)("Some errors occurred while restoring the posts: %s"),[...t].join(","))}o(e,{type:"snackbar"})}}};const Ko=async(e,{allowUndo:t=!0}={})=>{const s="edit-site-template-reverted";var n;if((0,d.dispatch)(_s.store).removeNotice(s),(n=e)&&"custom"===n.source&&(Boolean(n?.plugin)||n?.has_theme_file))try{const n=(0,d.select)(u.store).getEntityConfig("postType",e.type);if(!n)return void(0,d.dispatch)(_s.store).createErrorNotice((0,fs.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});const o=(0,w.addQueryArgs)(`${n.baseURL}/${e.id}`,{context:"edit",source:e.origin}),r=await gs()({path:o});if(!r)return void(0,d.dispatch)(_s.store).createErrorNotice((0,fs.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});const i=({blocks:e=[]})=>(0,x.__unstableSerializeAndClean)(e),a=(0,d.select)(u.store).getEditedEntityRecord("postType",e.type,e.id);(0,d.dispatch)(u.store).editEntityRecord("postType",e.type,e.id,{content:i,blocks:a.blocks,source:"custom"},{undoIgnore:!0});const l=(0,x.parse)(r?.content?.raw);if((0,d.dispatch)(u.store).editEntityRecord("postType",e.type,r.id,{content:i,blocks:l,source:"theme"}),t){const t=()=>{(0,d.dispatch)(u.store).editEntityRecord("postType",e.type,a.id,{content:i,blocks:a.blocks,source:"custom"})};(0,d.dispatch)(_s.store).createSuccessNotice((0,fs.__)("Template reset."),{type:"snackbar",id:s,actions:[{label:(0,fs.__)("Undo"),onClick:t}]})}}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,fs.__)("Template revert failed. Please reload.");(0,d.dispatch)(_s.store).createErrorNotice(t,{type:"snackbar"})}else(0,d.dispatch)(_s.store).createErrorNotice((0,fs.__)("This template is not revertable."),{type:"snackbar"})},Qo={id:"reset-post",label:(0,fs.__)("Reset"),isEligible:e=>so(e)&&"custom"===e?.source&&(Boolean("wp_template"===e.type&&e?.plugin)||e?.has_theme_file),icon:Yo,supportsBulk:!0,hideModalHeader:!0,modalFocusOnMount:"firstContentElement",RenderModal:({items:e,closeModal:t,onActionPerformed:s})=>{const[n,o]=(0,p.useState)(!1),{saveEditedEntityRecord:r}=(0,d.useDispatch)(u.store),{createSuccessNotice:i,createErrorNotice:a}=(0,d.useDispatch)(_s.store);return(0,c.jsxs)(Hn.__experimentalVStack,{spacing:"5",children:[(0,c.jsx)(Hn.__experimentalText,{children:(0,fs.__)("Reset to default and clear all customizations?")}),(0,c.jsxs)(Hn.__experimentalHStack,{justify:"right",children:[(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,disabled:n,accessibleWhenDisabled:!0,children:(0,fs.__)("Cancel")}),(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:async()=>{o(!0),await(async()=>{try{for(const t of e)await Ko(t,{allowUndo:!1}),await r("postType",t.type,t.id);i(e.length>1?(0,fs.sprintf)((0,fs.__)("%d items reset."),e.length):(0,fs.sprintf)((0,fs.__)('"%s" reset.'),no(e[0])),{type:"snackbar",id:"revert-template-action"})}catch(t){let s;s="wp_template"===e[0].type?1===e.length?(0,fs.__)("An error occurred while reverting the template."):(0,fs.__)("An error occurred while reverting the templates."):1===e.length?(0,fs.__)("An error occurred while reverting the template part."):(0,fs.__)("An error occurred while reverting the template parts.");const n=t,o=n.message&&"unknown_error"!==n.code?n.message:s;a(o,{type:"snackbar"})}})(),s?.(e),o(!1),t?.()},isBusy:n,disabled:n,accessibleWhenDisabled:!0,children:(0,fs.__)("Reset")})]})]})}};var Xo=Qo,Jo=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})});function er(e){const t=new Set;if(1===e.length){const s=e[0];s.reason?.message&&t.add(s.reason.message)}else{const s=e.filter((({status:e})=>"rejected"===e));for(const e of s){const s=e;s.reason?.message&&t.add(s.reason.message)}}return t}const{PATTERN_TYPES:tr}=co(ao.privateApis),sr={id:"delete-post",label:(0,fs.__)("Delete"),isPrimary:!0,icon:Jo,isEligible:e=>so(e)?oo(e):e.type===tr.user,supportsBulk:!0,hideModalHeader:!0,modalFocusOnMount:"firstContentElement",RenderModal:({items:e,closeModal:t,onActionPerformed:s})=>{const[n,o]=(0,p.useState)(!1),r=e.every((e=>so(e)&&e?.has_theme_file));return(0,c.jsxs)(Hn.__experimentalVStack,{spacing:"5",children:[(0,c.jsx)(Hn.__experimentalText,{children:e.length>1?(0,fs.sprintf)((0,fs._n)("Delete %d item?","Delete %d items?",e.length),e.length):(0,fs.sprintf)((0,fs._x)('Delete "%s"?',"template part"),no(e[0]))}),(0,c.jsxs)(Hn.__experimentalHStack,{justify:"right",children:[(0,c.jsx)(Hn.Button,{variant:"tertiary",onClick:t,disabled:n,accessibleWhenDisabled:!0,__next40pxDefaultSize:!0,children:(0,fs.__)("Cancel")}),(0,c.jsx)(Hn.Button,{variant:"primary",onClick:async()=>{o(!0);const n={success:{messages:{getMessage:e=>r?(0,fs.sprintf)((0,fs.__)('"%s" reset.'),(0,Ln.decodeEntities)(no(e))):(0,fs.sprintf)((0,fs._x)('"%s" deleted.',"template part"),(0,Ln.decodeEntities)(no(e))),getBatchMessage:()=>r?(0,fs.__)("Items reset."):(0,fs.__)("Items deleted.")}},error:{messages:{getMessage:e=>1===e.size?[...e][0]:r?(0,fs.__)("An error occurred while reverting the item."):(0,fs.__)("An error occurred while deleting the item."),getBatchMessage:e=>0===e.size?r?(0,fs.__)("An error occurred while reverting the items."):(0,fs.__)("An error occurred while deleting the items."):1===e.size?r?(0,fs.sprintf)((0,fs.__)("An error occurred while reverting the items: %s"),[...e][0]):(0,fs.sprintf)((0,fs.__)("An error occurred while deleting the items: %s"),[...e][0]):r?(0,fs.sprintf)((0,fs.__)("Some errors occurred while reverting the items: %s"),[...e].join(",")):(0,fs.sprintf)((0,fs.__)("Some errors occurred while deleting the items: %s"),[...e].join(","))}}};await(async(e,t,s)=>{const{createSuccessNotice:n,createErrorNotice:o}=(0,d.dispatch)(_s.store),{deleteEntityRecord:r}=(0,d.dispatch)(u.store),i=await Promise.allSettled(e.map((e=>r("postType",e.type,e.id,{force:!0},{throwOnError:!0}))));if(i.every((({status:e})=>"fulfilled"===e))){let o;o=1===i.length?t.success.messages.getMessage(e[0]):t.success.messages.getBatchMessage(e),n(o,{type:t.success.type??"snackbar",id:t.success.id}),s.onActionPerformed?.(e)}else{const e=er(i);let n="";n=1===i.length?t.error.messages.getMessage(e):t.error.messages.getBatchMessage(e),o(n,{type:t.error.type??"snackbar",id:t.error.id}),s.onActionError?.()}})(e,n,{onActionPerformed:s}),o(!1),t?.()},isBusy:n,disabled:n,accessibleWhenDisabled:!0,__next40pxDefaultSize:!0,children:(0,fs.__)("Delete")})]})]})}};var nr=sr;const or={id:"move-to-trash",label:(0,fs.__)("Trash"),isPrimary:!0,icon:Jo,isEligible:e=>!so(e)&&"wp_block"!==e.type&&(!!e.status&&!["auto-draft","trash"].includes(e.status)&&e.permissions?.delete),supportsBulk:!0,hideModalHeader:!0,modalFocusOnMount:"firstContentElement",RenderModal:({items:e,closeModal:t,onActionPerformed:s})=>{const[n,o]=(0,p.useState)(!1),{createSuccessNotice:r,createErrorNotice:i}=(0,d.useDispatch)(_s.store),{deleteEntityRecord:a}=(0,d.useDispatch)(u.store);return(0,c.jsxs)(Hn.__experimentalVStack,{spacing:"5",children:[(0,c.jsx)(Hn.__experimentalText,{children:1===e.length?(0,fs.sprintf)((0,fs.__)('Are you sure you want to move "%s" to the trash?'),no(e[0])):(0,fs.sprintf)((0,fs._n)("Are you sure you want to move %d item to the trash ?","Are you sure you want to move %d items to the trash ?",e.length),e.length)}),(0,c.jsxs)(Hn.__experimentalHStack,{justify:"right",children:[(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,disabled:n,accessibleWhenDisabled:!0,children:(0,fs.__)("Cancel")}),(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:async()=>{o(!0);const n=await Promise.allSettled(e.map((e=>a("postType",e.type,e.id.toString(),{},{throwOnError:!0}))));if(n.every((({status:e})=>"fulfilled"===e))){let t;t=1===n.length?(0,fs.sprintf)((0,fs.__)('"%s" moved to the trash.'),no(e[0])):(0,fs.sprintf)((0,fs._n)("%d item moved to the trash.","%d items moved to the trash.",e.length),e.length),r(t,{type:"snackbar",id:"move-to-trash-action"})}else{let e;if(1===n.length){const t=n[0];e=t.reason?.message?t.reason.message:(0,fs.__)("An error occurred while moving the item to the trash.")}else{const t=new Set,s=n.filter((({status:e})=>"rejected"===e));for(const e of s){const s=e;s.reason?.message&&t.add(s.reason.message)}e=0===t.size?(0,fs.__)("An error occurred while moving the items to the trash."):1===t.size?(0,fs.sprintf)((0,fs.__)("An error occurred while moving the item to the trash: %s"),[...t][0]):(0,fs.sprintf)((0,fs.__)("Some errors occurred while moving the items to the trash: %s"),[...t].join(","))}i(e,{type:"snackbar"})}s&&s(e),o(!1),t?.()},isBusy:n,disabled:n,accessibleWhenDisabled:!0,children:(0,fs._x)("Trash","verb")})]})]})}};var rr=or;const ir={id:"permanently-delete",label:(0,fs.__)("Permanently delete"),supportsBulk:!0,icon:Jo,isEligible(e){if(so(e)||"wp_block"===e.type)return!1;const{status:t,permissions:s}=e;return"trash"===t&&s?.delete},hideModalHeader:!0,modalFocusOnMount:"firstContentElement",RenderModal:({items:e,closeModal:t,onActionPerformed:s})=>{const[n,o]=(0,p.useState)(!1),{createSuccessNotice:r,createErrorNotice:i}=(0,d.useDispatch)(_s.store),{deleteEntityRecord:a}=(0,d.useDispatch)(u.store);return(0,c.jsxs)(Hn.__experimentalVStack,{spacing:"5",children:[(0,c.jsx)(Hn.__experimentalText,{children:e.length>1?(0,fs.sprintf)((0,fs._n)("Are you sure you want to permanently delete %d item?","Are you sure you want to permanently delete %d items?",e.length),e.length):(0,fs.sprintf)((0,fs.__)('Are you sure you want to permanently delete "%s"?'),(0,Ln.decodeEntities)(no(e[0])))}),(0,c.jsxs)(Hn.__experimentalHStack,{justify:"right",children:[(0,c.jsx)(Hn.Button,{variant:"tertiary",onClick:t,disabled:n,accessibleWhenDisabled:!0,__next40pxDefaultSize:!0,children:(0,fs.__)("Cancel")}),(0,c.jsx)(Hn.Button,{variant:"primary",onClick:async()=>{o(!0);const n=await Promise.allSettled(e.map((e=>a("postType",e.type,e.id,{force:!0},{throwOnError:!0}))));if(n.every((({status:e})=>"fulfilled"===e))){let t;t=1===n.length?(0,fs.sprintf)((0,fs.__)('"%s" permanently deleted.'),no(e[0])):(0,fs.__)("The items were permanently deleted."),r(t,{type:"snackbar",id:"permanently-delete-post-action"}),s?.(e)}else{let e;if(1===n.length){const t=n[0];e=t.reason?.message?t.reason.message:(0,fs.__)("An error occurred while permanently deleting the item.")}else{const t=new Set,s=n.filter((({status:e})=>"rejected"===e));for(const e of s){const s=e;s.reason?.message&&t.add(s.reason.message)}e=0===t.size?(0,fs.__)("An error occurred while permanently deleting the items."):1===t.size?(0,fs.sprintf)((0,fs.__)("An error occurred while permanently deleting the items: %s"),[...t][0]):(0,fs.sprintf)((0,fs.__)("Some errors occurred while permanently deleting the items: %s"),[...t].join(","))}i(e,{type:"snackbar"})}o(!1),t?.()},isBusy:n,disabled:n,accessibleWhenDisabled:!0,__next40pxDefaultSize:!0,children:(0,fs.__)("Delete permanently")})]})]})}};var ar=ir;const lr=window.wp.mediaUtils;var cr=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M5 11.25h14v1.5H5z"})});const dr={id:"featured_media",type:"media",label:(0,fs.__)("Featured Image"),Edit:({data:e,field:t,onChange:s})=>{const{id:n}=t,o=t.getValue({item:e}),r=(0,d.useSelect)((e=>{const{getEntityRecord:t}=e(u.store);return t("postType","attachment",o)}),[o]),i=(0,p.useCallback)((e=>s({[n]:e})),[n,s]),a=r?.source_url,l=r?.title?.rendered,m=(0,p.useRef)(null);return(0,c.jsx)("fieldset",{className:"fields-controls__featured-image",children:(0,c.jsx)("div",{className:"fields-controls__featured-image-container",children:(0,c.jsx)(lr.MediaUpload,{onSelect:e=>{i(e.id)},allowedTypes:["image"],render:({open:e})=>(0,c.jsx)("div",{ref:m,role:"button",tabIndex:-1,onClick:()=>{e()},onKeyDown:e,children:(0,c.jsxs)(Hn.__experimentalGrid,{rowGap:0,columnGap:8,templateColumns:"24px 1fr 24px",children:[a&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("img",{className:"fields-controls__featured-image-image",alt:"",width:24,height:24,src:a}),(0,c.jsx)("span",{className:"fields-controls__featured-image-title",children:l})]}),!a&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"fields-controls__featured-image-placeholder",style:{width:"24px",height:"24px"}}),(0,c.jsx)("span",{className:"fields-controls__featured-image-title",children:(0,fs.__)("Choose an image…")})]}),a&&(0,c.jsx)(c.Fragment,{children:(0,c.jsx)(Hn.Button,{size:"small",className:"fields-controls__featured-image-remove-button",icon:cr,onClick:e=>{e.stopPropagation(),i(0)}})})]})})})})})},render:({item:e,config:t})=>{const s=e?._embedded?.["wp:featuredmedia"]?.[0],n=s?.source_url;return n?(0,c.jsx)("img",{className:"fields-controls__featured-image-image",src:n,alt:"",srcSet:s?.media_details?.sizes?Object.values(s.media_details.sizes).map((e=>`${e.source_url} ${e.width}w`)).join(", "):void 0,sizes:t?.sizes||"100vw"}):(0,c.jsx)("span",{className:"fields-controls__featured-image-placeholder"})},enableSorting:!1,filterBy:!1};var ur=dr;function pr(e){var t,s,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]&&(s=pr(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}const mr=function(){for(var e,t,s=0,n="",o=arguments.length;s<o;s++)(e=arguments[s])&&(t=pr(e))&&(n&&(n+=" "),n+=t);return n};var hr=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",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",clipRule:"evenodd"})});var gr=function({item:e}){const t=e?._embedded?.author?.[0]?.name,s=e?._embedded?.author?.[0]?.avatar_urls?.[48],[n,o]=(0,p.useState)(!1);return(0,c.jsxs)(Hn.__experimentalHStack,{alignment:"left",spacing:0,children:[!!s&&(0,c.jsx)("div",{className:mr("page-templates-author-field__avatar",{"is-loaded":n}),children:(0,c.jsx)("img",{onLoad:()=>o(!0),alt:(0,fs.__)("Author avatar"),src:s})}),!s&&(0,c.jsx)("div",{className:"page-templates-author-field__icon",children:(0,c.jsx)(Hn.Icon,{icon:hr})}),(0,c.jsx)("span",{className:"page-templates-author-field__name",children:t})]})};const _r={label:(0,fs.__)("Author"),id:"author",type:"integer",getElements:async()=>(await(0,d.resolveSelect)(u.store).getEntityRecords("root","user",{per_page:-1})??[]).map((({id:e,name:t})=>({value:e,label:t}))),render:gr,sort:(e,t,s)=>{const n=e._embedded?.author?.[0]?.name||"",o=t._embedded?.author?.[0]?.name||"";return"asc"===s?n.localeCompare(o):o.localeCompare(n)},filterBy:{operators:["isAny","isNone"]}};var fr=_r,br=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})}),yr=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})}),xr=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})}),vr=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})}),wr=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})});var Sr=[{value:"draft",label:(0,fs.__)("Draft"),icon:br,description:(0,fs.__)("Not ready to publish.")},{value:"future",label:(0,fs.__)("Scheduled"),icon:yr,description:(0,fs.__)("Publish automatically on a chosen date.")},{value:"pending",label:(0,fs.__)("Pending Review"),icon:xr,description:(0,fs.__)("Waiting for review before publishing.")},{value:"private",label:(0,fs.__)("Private"),icon:vr,description:(0,fs.__)("Only visible to site admins and editors.")},{value:"publish",label:(0,fs.__)("Published"),icon:wr,description:(0,fs.__)("Visible to everyone.")},{value:"trash",label:(0,fs.__)("Trash"),icon:Jo}];var kr=function({item:e}){const t=Sr.find((({value:t})=>t===e.status)),s=t?.label||e.status,n=t?.icon;return(0,c.jsxs)(Hn.__experimentalHStack,{alignment:"left",spacing:0,children:[n&&(0,c.jsx)("div",{className:"edit-site-post-list__status-icon",children:(0,c.jsx)(Hn.Icon,{icon:n})}),(0,c.jsx)("span",{children:s})]})};var Cr={label:(0,fs.__)("Status"),id:"status",type:"text",elements:Sr,render:kr,Edit:"radio",enableSorting:!1,filterBy:{operators:["isAny"]}};const Pr=e=>(0,v.dateI18n)((0,v.getSettings)().formats.datetimeAbbreviated,(0,v.getDate)(e));var jr=({item:e})=>{if(["draft","private"].includes(e.status??""))return(0,p.createInterpolateElement)((0,fs.sprintf)((0,fs.__)("<span>Modified: <time>%s</time></span>"),Pr(e.date??null)),{span:(0,c.jsx)("span",{}),time:(0,c.jsx)("time",{})});if("future"===e.status)return(0,p.createInterpolateElement)((0,fs.sprintf)((0,fs.__)("<span>Scheduled: <time>%s</time></span>"),Pr(e.date??null)),{span:(0,c.jsx)("span",{}),time:(0,c.jsx)("time",{})});if("publish"===e.status)return(0,p.createInterpolateElement)((0,fs.sprintf)((0,fs.__)("<span>Published: <time>%s</time></span>"),Pr(e.date??null)),{span:(0,c.jsx)("span",{}),time:(0,c.jsx)("time",{})});const t=(0,v.getDate)(e.modified??null)>(0,v.getDate)(e.date??null)?e.modified:e.date;return"pending"===e.status?(0,p.createInterpolateElement)((0,fs.sprintf)((0,fs.__)("<span>Modified: <time>%s</time></span>"),Pr(t??null)),{span:(0,c.jsx)("span",{}),time:(0,c.jsx)("time",{})}):(0,c.jsx)("time",{children:Pr(e.date??null)})};var Er={id:"date",type:"datetime",label:(0,fs.__)("Date"),render:jr,filterBy:!1},Tr=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z"})});const Ir=e=>"object"!=typeof e?"":e.slug||(0,w.cleanForSlug)(no(e))||e.id.toString(),Br=({field:e,onChange:t,data:s})=>{const{id:n}=e,o=e.getValue({item:s})||Ir(s),r=s.permalink_template||"",i=/%(?:postname|pagename)%/,[a,l]=r.split(i),u=a,h=l,g=i.test(r),_=(0,p.useRef)(o),f=o||_.current,b=g?`${u}${f}${h}`:(0,w.safeDecodeURIComponent)(s.link||"");(0,p.useEffect)((()=>{o&&void 0===_.current&&(_.current=o)}),[o]);const y=(0,p.useCallback)((e=>t({[n]:e})),[n,t]),{createNotice:x}=(0,d.useDispatch)(_s.store),v=(0,m.useCopyToClipboard)(b,(()=>{x("info",(0,fs.__)("Copied Permalink to clipboard."),{isDismissible:!0,type:"snackbar"})})),S="editor-post-url__slug-description-"+(0,m.useInstanceId)(Br);return(0,c.jsxs)("fieldset",{className:"fields-controls__slug",children:[g&&(0,c.jsxs)(Hn.__experimentalVStack,{children:[(0,c.jsxs)(Hn.__experimentalVStack,{spacing:"0px",children:[(0,c.jsx)("span",{children:(0,fs.__)("Customize the last part of the Permalink.")}),(0,c.jsx)(Hn.ExternalLink,{href:"https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink",children:(0,fs.__)("Learn more")})]}),(0,c.jsx)(Hn.__experimentalInputControl,{__next40pxDefaultSize:!0,prefix:(0,c.jsx)(Hn.__experimentalInputControlPrefixWrapper,{children:"/"}),suffix:(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,icon:Tr,ref:v,label:(0,fs.__)("Copy")}),label:(0,fs.__)("Link"),hideLabelFromVision:!0,value:o,autoComplete:"off",spellCheck:"false",type:"text",className:"fields-controls__slug-input",onChange:e=>{y(e)},onBlur:()=>{""===o&&y(_.current)},"aria-describedby":S}),(0,c.jsxs)("div",{className:"fields-controls__slug-help",children:[(0,c.jsx)("span",{className:"fields-controls__slug-help-visual-label",children:(0,fs.__)("Permalink:")}),(0,c.jsxs)(Hn.ExternalLink,{className:"fields-controls__slug-help-link",href:b,children:[(0,c.jsx)("span",{className:"fields-controls__slug-help-prefix",children:u}),(0,c.jsx)("span",{className:"fields-controls__slug-help-slug",children:f}),(0,c.jsx)("span",{className:"fields-controls__slug-help-suffix",children:h})]})]})]}),!g&&(0,c.jsx)(Hn.ExternalLink,{className:"fields-controls__slug-help",href:b,children:b})]})};var Nr=Br;var Rr=({item:e})=>{const t=Ir(e),s=(0,p.useRef)(t);(0,p.useEffect)((()=>{t&&void 0===s.current&&(s.current=t)}),[t]);return`${t||s.current}`};var Dr={id:"slug",type:"text",label:(0,fs.__)("Slug"),Edit:Nr,render:Rr,filterBy:!1},Ar=s(9681),Mr=s.n(Ar);function Lr(e){return"object"==typeof e.title&&"rendered"in e.title&&e.title.rendered?(0,Ln.decodeEntities)(e.title.rendered):`#${e?.id} (${(0,fs.__)("no title")})`}const Or=(e,t)=>{const s=Mr()(e||"").toLowerCase(),n=Mr()(t||"").toLowerCase();return s===n?0:s.startsWith(n)?s.length:1/0};function Fr({data:e,onChangeControl:t}){const[s,n]=(0,p.useState)(null),o=e.parent,r=e.id,i=e.type,{parentPostTitle:a,pageItems:l,isHierarchical:h}=(0,d.useSelect)((e=>{const{getEntityRecord:t,getEntityRecords:n,getPostType:a}=e(u.store),l=a(i),c=l?.hierarchical&&l.viewable,d=o?t("postType",i,o):null,p={per_page:100,exclude:r,parent_exclude:r,orderby:"menu_order",order:"asc",_fields:"id,title,parent",...null!==s&&{search:s}};return{isHierarchical:c,parentPostTitle:d?Lr(d):"",pageItems:c?n("postType",i,p):null}}),[s,o,r,i]),g=(0,p.useMemo)((()=>{const e=(t,n=0)=>{const o=t.map((t=>[{value:t.id,label:"— ".repeat(n)+(0,Ln.decodeEntities)(t.name),rawName:t.name},...e(t.children||[],n+1)])).sort((([e],[t])=>Or(e.rawName,s??"")>=Or(t.rawName,s??"")?1:-1));return o.flat()};if(!l)return[];let t=l.map((e=>({id:e.id,parent:e.parent??null,name:Lr(e)})));s||(t=function(e){const t=e.map((e=>({children:[],...e})));if(t.some((({parent:e})=>null==e)))return t;const s=t.reduce(((e,t)=>{const{parent:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e}),{}),n=e=>e.map((e=>{const t=s[e.id];return{...e,children:t&&t.length?n(t):[]}}));return n(s[0]||[])}(t));const n=e(t),r=n.find((e=>e.value===o));return o&&a&&!r&&n.unshift({value:o,label:a,rawName:""}),n.map((e=>({...e,value:e.value.toString()})))}),[l,s,a,o]);if(!h)return null;return(0,c.jsx)(Hn.ComboboxControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,fs.__)("Parent"),help:(0,fs.__)("Choose a parent page."),value:o?.toString(),options:g,onFilterValueChange:(0,m.debounce)((e=>{n(e)}),300),onChange:e=>{if(e)return t(parseInt(e,10)??0);t(0)},hideLabelFromVision:!0})}var Vr={id:"parent",type:"text",label:(0,fs.__)("Parent"),Edit:({data:e,field:t,onChange:s})=>{const{id:n}=t,o=(0,d.useSelect)((e=>e(u.store).getEntityRecord("root","__unstableBase")?.home),[]),r=(0,p.useCallback)((e=>s({[n]:e})),[n,s]);return(0,c.jsx)("fieldset",{className:"fields-controls__parent",children:(0,c.jsxs)("div",{children:[(0,p.createInterpolateElement)((0,fs.sprintf)((0,fs.__)('Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %1$s<wbr />/services<wbr />/pricing.'),(0,w.filterURLForDisplay)(o).replace(/([/.])/g,"<wbr />$1")),{wbr:(0,c.jsx)("wbr",{})}),(0,c.jsx)("p",{children:(0,p.createInterpolateElement)((0,fs.__)("They also show up as sub-items in the default navigation menu. <a>Learn more.</a>"),{a:(0,c.jsx)(Hn.ExternalLink,{href:(0,fs.__)("https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes"),children:void 0})})}),(0,c.jsx)(Fr,{data:e,onChangeControl:r})]})})},render:({item:e})=>{const t=(0,d.useSelect)((t=>{const{getEntityRecord:s}=t(u.store);return e?.parent?s("postType",e.type,e.parent):null}),[e.parent,e.type]);return t?(0,c.jsx)(c.Fragment,{children:Lr(t)}):(0,c.jsx)(c.Fragment,{children:(0,fs.__)("None")})},enableSorting:!0,filterBy:!1};var Ur={id:"comment_status",label:(0,fs.__)("Comments"),type:"text",Edit:"radio",enableSorting:!1,enableHiding:!1,filterBy:!1,elements:[{value:"open",label:(0,fs.__)("Open"),description:(0,fs.__)("Visitors can add new comments and replies.")},{value:"closed",label:(0,fs.__)("Closed"),description:(0,fs.__)("Visitors cannot add new comments or replies. Existing comments remain visible.")}]};var Hr={id:"ping_status",label:(0,fs.__)("Trackbacks & Pingbacks"),type:"text",Edit:function({data:e,onChange:t}){const s=e?.ping_status??"open";return(0,c.jsx)(Hn.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,fs.__)("Enable pingbacks & trackbacks"),checked:"open"===s,onChange:s=>{t({...e,ping_status:s?"open":"closed"})},help:(0,c.jsx)(Hn.ExternalLink,{href:(0,fs.__)("https://wordpress.org/documentation/article/trackbacks-and-pingbacks/"),children:(0,fs.__)("Learn more about pingbacks & trackbacks")})})},enableSorting:!1,enableHiding:!1,filterBy:!1,elements:[{value:"open",label:(0,fs.__)("Allow"),description:(0,fs.__)("Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.")},{value:"closed",label:(0,fs.__)("Don't allow"),description:(0,fs.__)("Don't allow link notifications from other blogs (pingbacks and trackbacks) on new articles.")}]};var zr={id:"discussion",label:(0,fs.__)("Discussion"),type:"text",render:({item:e})=>{const t="open"===e.comment_status,s="open"===e.ping_status;return t&&s?(0,fs.__)("Open"):t&&!s?(0,fs.__)("Comments only"):!t&&s?(0,fs.__)("Pings only"):(0,fs.__)("Closed")},filterBy:!1};const Gr=[],$r={id:"template",type:"text",label:(0,fs.__)("Template"),Edit:({data:e,field:t,onChange:s})=>{const{id:n}=t,o=e.type,r="number"==typeof e.id?e.id:parseInt(e.id,10),i=e.slug,{canSwitchTemplate:a,templates:l}=(0,d.useSelect)((e=>{const t=e(u.store).getEntityRecords("postType","wp_template",{per_page:-1,post_type:o})??Gr,{getHomePage:s,getPostsPageId:n}=co(e(u.store)),i=n()===+r,a="page"===o&&s()?.postId===+r;return{templates:t,canSwitchTemplate:!i&&!a}}),[r,o]),h=(0,p.useMemo)((()=>a?l.filter((t=>t.is_custom&&t.slug!==e.template&&!!t.content.raw)).map((e=>({name:e.slug,blocks:(0,x.parse)(e.content.raw),title:(0,Ln.decodeEntities)(e.title.rendered),id:e.id}))):[]),[a,e.template,l]),_=(0,m.useAsyncList)(h),f=t.getValue({item:e}),b=l.find((e=>e.slug===f)),y=(0,d.useSelect)((e=>{if(b)return b;let t;if(t=i?"page"===o?`${o}-${i}`:`single-${o}-${i}`:"page"===o?"page":`single-${o}`,o){const s=e(u.store).getDefaultTemplateId({slug:t});return e(u.store).getEntityRecord("postType","wp_template",s)}}),[b,o,i]),[v,w]=(0,p.useState)(!1),S=(0,p.useCallback)((e=>s({[n]:e})),[n,s]);return(0,c.jsxs)("fieldset",{className:"fields-controls__template",children:[(0,c.jsx)(Hn.Dropdown,{popoverProps:{placement:"bottom-start"},renderToggle:({onToggle:e})=>(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"tertiary",size:"compact",onClick:e,children:y?no(y):""}),renderContent:({onToggle:e})=>(0,c.jsxs)(Hn.MenuGroup,{children:[(0,c.jsx)(Hn.MenuItem,{onClick:()=>{w(!0),e()},children:(0,fs.__)("Change template")}),""!==f&&(0,c.jsx)(Hn.MenuItem,{onClick:()=>{S(""),e()},children:(0,fs.__)("Use default template")})]})}),v&&(0,c.jsx)(Hn.Modal,{title:(0,fs.__)("Choose a template"),onRequestClose:()=>w(!1),overlayClassName:"fields-controls__template-modal",isFullScreen:!0,children:(0,c.jsx)("div",{className:"fields-controls__template-content",children:(0,c.jsx)(g.__experimentalBlockPatternsList,{label:(0,fs.__)("Templates"),blockPatterns:h,shownPatterns:_,onClickPattern:e=>{S(e.name),w(!1)}})})})]})},enableSorting:!1,filterBy:!1};var Wr=$r;var Zr=function({data:e,onChange:t,field:s}){const[n,o]=(0,p.useState)(!!s.getValue({item:e}));return(0,c.jsxs)(Hn.__experimentalVStack,{as:"fieldset",spacing:4,className:"fields-controls__password",children:[(0,c.jsx)(Hn.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,fs.__)("Password protected"),help:(0,fs.__)("Only visible to those who know the password"),checked:n,onChange:e=>{o(e),e||t({password:""})}}),n&&(0,c.jsx)("div",{className:"fields-controls__password-input",children:(0,c.jsx)(Hn.TextControl,{label:(0,fs.__)("Password"),onChange:e=>t({password:e}),value:s.getValue({item:e})||"",placeholder:(0,fs.__)("Use a secure password"),type:"text",__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,maxLength:255})})]})};var Yr={id:"password",type:"text",label:(0,fs.__)("Password"),Edit:Zr,enableSorting:!1,enableHiding:!1,isVisible:e=>"private"!==e.status,filterBy:!1};function qr({item:e,className:t,children:s}){const n=no(e);return(0,c.jsxs)(Hn.__experimentalHStack,{className:mr("fields-field__title",t),alignment:"center",justify:"flex-start",children:[(0,c.jsx)("span",{children:n||(0,fs.__)("(no title)")}),s]})}function Kr({item:e}){return(0,c.jsx)(qr,{item:e})}const{Badge:Qr}=co(Hn.privateApis);var Xr={type:"text",id:"title",label:(0,fs.__)("Title"),placeholder:(0,fs.__)("No title"),getValue:({item:e})=>no(e),render:function({item:e}){const{frontPageId:t,postsPageId:s}=(0,d.useSelect)((e=>{const{getEntityRecord:t}=e(u.store),s=t("root","site");return{frontPageId:s?.page_on_front,postsPageId:s?.page_for_posts}}),[]);return(0,c.jsx)(qr,{item:e,className:"fields-field__page-title",children:[t,s].includes(e.id)&&(0,c.jsx)(Qr,{children:e.id===t?(0,fs.__)("Homepage"):(0,fs.__)("Posts Page")})})},enableHiding:!1,enableGlobalSearch:!0,filterBy:!1};var Jr={type:"text",label:(0,fs.__)("Template"),placeholder:(0,fs.__)("No title"),id:"title",getValue:({item:e})=>no(e),render:Kr,enableHiding:!1,enableGlobalSearch:!0,filterBy:!1},ei=(0,p.forwardRef)((({icon:e,size:t=24,...s},n)=>(0,p.cloneElement)(e,{width:t,height:t,...s,ref:n}))),ti=(0,c.jsx)(L.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z"})});const{PATTERN_TYPES:si}=co(ao.privateApis);var ni={type:"text",id:"title",label:(0,fs.__)("Title"),placeholder:(0,fs.__)("No title"),getValue:({item:e})=>no(e),render:function({item:e}){return(0,c.jsx)(qr,{item:e,className:"fields-field__pattern-title",children:e.type===si.theme&&(0,c.jsx)(Hn.Tooltip,{placement:"top",text:(0,fs.__)("This pattern cannot be edited."),children:(0,c.jsx)(ei,{icon:ti,size:24})})})},enableHiding:!1,enableGlobalSearch:!0,filterBy:!1};var oi={type:"text",id:"title",label:(0,fs.__)("Title"),placeholder:(0,fs.__)("No title"),getValue:({item:e})=>no(e),render:Kr,enableHiding:!0,enableGlobalSearch:!0,filterBy:!1};var ri=(0,m.createHigherOrderComponent)((e=>({useSubRegistry:t=!0,...s})=>{const n=(0,d.useRegistry)(),[o]=(0,p.useState)((()=>new WeakMap)),r=function(e,t,s){if(!s)return t;let n=e.get(t);return n||(n=(0,d.createRegistry)({"core/block-editor":g.storeConfig},t),n.registerStore("core/editor",xc),e.set(t,n)),n}(o,n,t);return r===n?(0,c.jsx)(e,{registry:n,...s}):(0,c.jsx)(d.RegistryProvider,{value:r,children:(0,c.jsx)(e,{registry:r,...s})})}),"withRegistryProvider");const ii=(e,t)=>`<a ${ai(e)}>${t}</a>`,ai=e=>`href="${e}" target="_blank" rel="noreferrer noopener"`,li=e=>{const{title:t,foreign_landing_url:s,creator:n,creator_url:o,license:r,license_version:i,license_url:a}=e,l=((e,t)=>{let s=e.trim();return"pdm"!==e&&(s=e.toUpperCase().replace("SAMPLING","Sampling")),t&&(s+=` ${t}`),["pdm","cc0"].includes(e)||(s=`CC ${s}`),s})(r,i),c=(0,Ln.decodeEntities)(n);let d;return d=c?t?(0,fs.sprintf)((0,fs._x)('"%1$s" by %2$s/ %3$s',"caption"),ii(s,(0,Ln.decodeEntities)(t)),o?ii(o,c):c,a?ii(`${a}?ref=openverse`,l):l):(0,fs.sprintf)((0,fs._x)("<a %1$s>Work</a> by %2$s/ %3$s","caption"),ai(s),o?ii(o,c):c,a?ii(`${a}?ref=openverse`,l):l):t?(0,fs.sprintf)((0,fs._x)('"%1$s"/ %2$s',"caption"),ii(s,(0,Ln.decodeEntities)(t)),a?ii(`${a}?ref=openverse`,l):l):(0,fs.sprintf)((0,fs._x)("<a %1$s>Work</a>/ %2$s","caption"),ai(s),a?ii(`${a}?ref=openverse`,l):l),d.replace(/\s{2}/g," ")},ci=async(e={})=>(await(0,d.resolveSelect)(u.store).getEntityRecords("postType","attachment",{...e,orderBy:e?.search?"relevance":"date"})).map((e=>({...e,alt:e.alt_text,url:e.source_url,previewUrl:e.media_details?.sizes?.medium?.source_url,caption:e.caption?.raw})));var di=[{name:"images",labels:{name:(0,fs.__)("Images"),search_items:(0,fs.__)("Search images")},mediaType:"image",fetch:async(e={})=>ci({...e,media_type:"image"})},{name:"videos",labels:{name:(0,fs.__)("Videos"),search_items:(0,fs.__)("Search videos")},mediaType:"video",fetch:async(e={})=>ci({...e,media_type:"video"})},{name:"audio",labels:{name:(0,fs.__)("Audio"),search_items:(0,fs.__)("Search audio")},mediaType:"audio",fetch:async(e={})=>ci({...e,media_type:"audio"})},{name:"openverse",labels:{name:(0,fs.__)("Openverse"),search_items:(0,fs.__)("Search Openverse")},mediaType:"image",async fetch(e={}){const t={...e,mature:!1,excluded_source:"flickr,inaturalist,wikimedia",license:"pdm,cc0"},s={per_page:"page_size",search:"q"},n=new URL("https://api.openverse.org/v1/images/");Object.entries(t).forEach((([e,t])=>{const o=s[e]||e;n.searchParams.set(o,t)}));const o=await window.fetch(n,{headers:{"User-Agent":"WordPress/inserter-media-fetch"}});return(await o.json()).results.map((e=>({...e,title:e.title?.toLowerCase().startsWith("file:")?e.title.slice(5):e.title,sourceId:e.id,id:void 0,caption:li(e),previewUrl:e.thumbnail})))},getReportUrl:({sourceId:e})=>`https://wordpress.org/openverse/image/${e}/report/`,isExternalResource:!0}];const ui={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let pi;const mi=new Uint8Array(16);function hi(){if(!pi&&(pi="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!pi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return pi(mi)}const gi=[];for(let e=0;e<256;++e)gi.push((e+256).toString(16).slice(1));function _i(e,t=0){return gi[e[t+0]]+gi[e[t+1]]+gi[e[t+2]]+gi[e[t+3]]+"-"+gi[e[t+4]]+gi[e[t+5]]+"-"+gi[e[t+6]]+gi[e[t+7]]+"-"+gi[e[t+8]]+gi[e[t+9]]+"-"+gi[e[t+10]]+gi[e[t+11]]+gi[e[t+12]]+gi[e[t+13]]+gi[e[t+14]]+gi[e[t+15]]}const fi=function(e,t,s){if(ui.randomUUID&&!t&&!e)return ui.randomUUID();const n=(e=e||{}).random||(e.rng||hi)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){s=s||0;for(let e=0;e<16;++e)t[s+e]=n[e];return t}return _i(n)},bi=()=>{};function yi({additionalData:e={},allowedTypes:t,filesList:s,maxUploadFileSize:n,onError:o=bi,onFileChange:r,onSuccess:i,multiple:a=!0}){const{receiveEntityRecords:l}=(0,d.dispatch)(u.store),{getCurrentPost:c,getEditorSettings:p}=(0,d.select)(vc),{lockPostAutosaving:m,unlockPostAutosaving:h,lockPostSaving:g,unlockPostSaving:_}=(0,d.dispatch)(vc),f=p().allowedMimeTypes,b=`image-upload-${fi()}`;let y=!1;n=n||p().maxUploadFileSize;const x=c(),v="number"==typeof x?.id?x.id:x?.wp_id,w=v?{post:v}:{},S=()=>{_(b),h(b),y=!1};(0,lr.uploadMedia)({allowedTypes:t,filesList:s,onFileChange:e=>{y?S():(g(b),m(b),y=!0),r?.(e);const t=e.filter((e=>e?.id));if(t?.length){l("postType","attachment",t,void 0,!0)}},onSuccess:i,additionalData:{...w,...e},maxUploadFileSize:n,onError:({message:e})=>{S(),o(e)},wpAllowedMimeTypes:f,multiple:a})}const{sideloadMedia:xi}=$(lr.privateApis);var vi=xi,wi=s(66),Si=s.n(wi); /*! * is-plain-object <https://github.com/jonschlinkert/is-plain-object> * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ function ki(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ci(e){var t,s;return!1!==ki(e)&&(void 0===(t=e.constructor)||!1!==ki(s=t.prototype)&&!1!==s.hasOwnProperty("isPrototypeOf"))}const{GlobalStylesContext:Pi,cleanEmptyObject:ji}=$(g.privateApis);function Ei(e,t){return Si()(e,t,{isMergeableObject:Ci,customMerge:e=>{if("backgroundImage"===e)return(e,t)=>t}})}function Ti(){const[e,t,s]=function(){const{globalStylesId:e,isReady:t,settings:s,styles:n,_links:o}=(0,d.useSelect)((e=>{const{getEntityRecord:t,getEditedEntityRecord:s,hasFinishedResolution:n,canUser:o}=e(u.store),r=e(u.store).__experimentalGetCurrentGlobalStylesId();let i;const a=r?o("update",{kind:"root",name:"globalStyles",id:r}):null;r&&"boolean"==typeof a&&(i=a?s("root","globalStyles",r):t("root","globalStyles",r,{context:"view"}));let l=!1;return n("__experimentalGetCurrentGlobalStylesId")&&(l=!r||(a?n("getEditedEntityRecord",["root","globalStyles",r]):n("getEntityRecord",["root","globalStyles",r,{context:"view"}]))),{globalStylesId:r,isReady:l,settings:i?.settings,styles:i?.styles,_links:i?._links}}),[]),{getEditedEntityRecord:r}=(0,d.useSelect)(u.store),{editEntityRecord:i}=(0,d.useDispatch)(u.store);return[t,(0,p.useMemo)((()=>({settings:s??{},styles:n??{},_links:o??{}})),[s,n,o]),(0,p.useCallback)(((t,s={})=>{const n=r("root","globalStyles",e),o="function"==typeof t?t({styles:n?.styles??{},settings:n?.settings??{},_links:n?._links??{}}):t;i("root","globalStyles",e,{styles:ji(o.styles)||{},settings:ji(o.settings)||{},_links:ji(o._links)||{}},s)}),[e,i,r])]}(),[n,o]=function(){const e=(0,d.useSelect)((e=>e(u.store).__experimentalGetCurrentThemeBaseGlobalStyles()),[]);return[!!e,e]}(),r=(0,p.useMemo)((()=>o&&t?Ei(o,t):{}),[t,o]);return(0,p.useMemo)((()=>({isReady:e&&n,user:t,base:o,merged:r,setUserConfig:s})),[r,t,o,s,e,n])}const Ii={};function Bi(e){const{RECEIVE_INTERMEDIATE_RESULTS:t}=$(u.privateApis),{getEntityRecords:s}=e(u.store);return s("postType","wp_block",{per_page:-1,[t]:!0})}const Ni=["__experimentalBlockBindingsSupportedAttributes","__experimentalBlockDirectory","__experimentalDiscussionSettings","__experimentalFeatures","__experimentalGlobalStylesBaseStyles","alignWide","blockInspectorTabs","maxUploadFileSize","allowedMimeTypes","bodyPlaceholder","canLockBlocks","canUpdateBlockBindings","capabilities","clearBlockSelection","codeEditingEnabled","colors","disableCustomColors","disableCustomFontSizes","disableCustomSpacingSizes","disableCustomGradients","disableLayoutStyles","enableCustomLineHeight","enableCustomSpacing","enableCustomUnits","enableOpenverseMediaCategory","fontSizes","gradients","generateAnchors","onNavigateToEntityRecord","imageDefaultSize","imageDimensions","imageEditing","imageSizes","isPreviewMode","isRTL","locale","maxWidth","postContentAttributes","postsPerPage","readOnly","styles","titlePlaceholder","supportsLayout","widgetTypesToHideFromLegacyWidgetBlock","__unstableHasCustomAppender","__unstableResolvedAssets","__unstableIsBlockBasedTheme"],{globalStylesDataKey:Ri,globalStylesLinksDataKey:Di,selectBlockPatternsKey:Ai,reusableBlocksSelectKey:Mi,sectionRootClientIdKey:Li,mediaEditKey:Oi}=$(g.privateApis);var Fi=function(e,t,s,n){const o=(0,m.useViewportMatch)("medium"),{allowRightClickOverrides:r,blockTypes:i,focusMode:a,hasFixedToolbar:l,isDistractionFree:c,keepCaretInsideBlock:h,hasUploadPermissions:_,hiddenBlockTypes:f,canUseUnfilteredHTML:b,userCanCreatePages:y,pageOnFront:v,pageForPosts:w,userPatternCategories:S,restBlockPatternCategories:k,sectionRootClientId:P}=(0,d.useSelect)((e=>{const{canUser:r,getRawEntityRecord:i,getEntityRecord:a,getUserPatternCategories:l,getBlockPatternCategories:c}=e(u.store),{get:d}=e(C.store),{getBlockTypes:p}=e(x.store),{getBlocksByName:m,getBlockAttributes:h}=e(g.store),_=r("read",{kind:"root",name:"site"})?a("root","site"):void 0;return{allowRightClickOverrides:d("core","allowRightClickOverrides"),blockTypes:p(),canUseUnfilteredHTML:i("postType",t,s)?._links?.hasOwnProperty("wp:action-unfiltered-html"),focusMode:d("core","focusMode"),hasFixedToolbar:d("core","fixedToolbar")||!o,hiddenBlockTypes:d("core","hiddenBlockTypes"),isDistractionFree:d("core","distractionFree"),keepCaretInsideBlock:d("core","keepCaretInsideBlock"),hasUploadPermissions:r("create",{kind:"postType",name:"attachment"})??!0,userCanCreatePages:r("create",{kind:"postType",name:"page"}),pageOnFront:_?.page_on_front,pageForPosts:_?.page_for_posts,userPatternCategories:l(),restBlockPatternCategories:c(),sectionRootClientId:"template-locked"===n?m("core/post-content")?.[0]??"":m("core/group").find((e=>"main"===h(e)?.tagName))??""}}),[t,s,o,n]),{merged:j}=Ti(),E=j.styles??Ii,T=j._links??Ii,I=e.__experimentalAdditionalBlockPatterns??e.__experimentalBlockPatterns,B=e.__experimentalAdditionalBlockPatternCategories??e.__experimentalBlockPatternCategories,N=(0,p.useMemo)((()=>[...I||[]].filter((({postTypes:e})=>!e||Array.isArray(e)&&e.includes(t)))),[I,t]),R=(0,p.useMemo)((()=>[...B||[],...k||[]].filter(((e,t,s)=>t===s.findIndex((t=>e.name===t.name))))),[B,k]),{undo:D,setIsInserterOpened:A}=(0,d.useDispatch)(vc),{editMediaEntity:M}=$((0,d.useDispatch)(u.store)),{saveEntityRecord:L}=(0,d.useDispatch)(u.store),O=(0,p.useCallback)((e=>y?L("postType","page",e):Promise.reject({message:(0,fs.__)("You do not have permission to create Pages.")})),[L,y]),F=(0,p.useMemo)((()=>{if(f&&f.length>0){return(!0===e.allowedBlockTypes?i.map((({name:e})=>e)):e.allowedBlockTypes||[]).filter((e=>!f.includes(e)))}return e.allowedBlockTypes}),[e.allowedBlockTypes,f,i]),V=!1===e.focusMode;return(0,p.useMemo)((()=>{const s={...Object.fromEntries(Object.entries(e).filter((([e])=>Ni.includes(e)))),[Ri]:E,[Di]:T,allowedBlockTypes:F,allowRightClickOverrides:r,focusMode:a&&!V,hasFixedToolbar:l,isDistractionFree:c,keepCaretInsideBlock:h,[Oi]:_?M:void 0,mediaUpload:_?yi:void 0,mediaSideload:_?vi:void 0,__experimentalBlockPatterns:N,[Ai]:e=>{const{hasFinishedResolution:s,getBlockPatternsForPostType:n}=$(e(u.store)),o=n(t);return s("getBlockPatterns")?o:void 0},[Mi]:Bi,__experimentalBlockPatternCategories:R,__experimentalUserPatternCategories:S,__experimentalFetchLinkSuggestions:(t,s)=>(0,u.__experimentalFetchLinkSuggestions)(t,s,e),inserterMediaCategories:di,__experimentalFetchRichUrlData:u.__experimentalFetchUrlData,__experimentalCanUserUseUnfilteredHTML:b,__experimentalUndo:D,outlineMode:!c&&"wp_template"===t,__experimentalCreatePageEntity:O,__experimentalUserCanCreatePages:y,pageOnFront:v,pageForPosts:w,__experimentalPreferPatternsOnRoot:"wp_template"===t,templateLock:"wp_navigation"===t?"insert":e.templateLock,template:"wp_navigation"===t?[["core/navigation",{},[]]]:e.template,__experimentalSetIsInserterOpened:A,[Li]:P,editorTool:"post-only"===n&&"wp_template"!==t?"edit":void 0};return s}),[F,r,a,V,l,c,h,e,_,S,N,R,b,D,O,y,v,w,t,A,P,E,T,n,M])};const Vi=["core/post-title","core/post-featured-image","core/post-content"];function Ui(){const e=(0,p.useMemo)((()=>[...(0,h.applyFilters)("editor.postContentBlockTypes",Vi)]),[]),t=(0,d.useSelect)((t=>{const{getPostBlocksByName:s}=$(t(vc));return s(e)}),[e]);return t}function Hi(){const e=Ui(),{templateParts:t}=(0,d.useSelect)((e=>{const{getBlocksByName:t}=e(g.store);return{templateParts:t("core/template-part")}}),[]),s=(0,d.useSelect)((e=>{const{getBlockOrder:s}=e(g.store);return t.flatMap((e=>s(e)))}),[t]),n=(0,d.useRegistry)();return(0,p.useEffect)((()=>{const{setBlockEditingMode:e,unsetBlockEditingMode:t}=n.dispatch(g.store);return e("","disabled"),()=>{t("")}}),[n]),(0,p.useEffect)((()=>{const{setBlockEditingMode:t,unsetBlockEditingMode:s}=n.dispatch(g.store);return n.batch((()=>{for(const s of e)t(s,"contentOnly")})),()=>{n.batch((()=>{for(const t of e)s(t)}))}}),[e,n]),(0,p.useEffect)((()=>{const{setBlockEditingMode:e,unsetBlockEditingMode:s}=n.dispatch(g.store);return n.batch((()=>{for(const s of t)e(s,"contentOnly")})),()=>{n.batch((()=>{for(const e of t)s(e)}))}}),[t,n]),(0,p.useEffect)((()=>{const{setBlockEditingMode:e,unsetBlockEditingMode:t}=n.dispatch(g.store);return n.batch((()=>{for(const t of s)e(t,"disabled")})),()=>{n.batch((()=>{for(const e of s)t(e)}))}}),[s,n]),null}function zi(){const e=(0,d.useSelect)((e=>e(g.store).getBlockOrder()?.[0]),[]),{setBlockEditingMode:t,unsetBlockEditingMode:s}=(0,d.useDispatch)(g.store);(0,p.useEffect)((()=>{if(e)return t(e,"contentOnly"),()=>{s(e)}}),[e,s,t])}const Gi=["wp_block","wp_template","wp_template_part"];var $i=(0,c.jsxs)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,c.jsx)(L.Path,{d:"m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z"}),(0,c.jsx)(L.Path,{d:"m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z"})]}),Wi=(0,c.jsx)(L.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(L.Path,{d:"M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"})}),Zi=(0,c.jsx)(L.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(L.Path,{d:"M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"})}),Yi=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",clipRule:"evenodd",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-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z"})}),qi=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})}),Ki=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"})}),Qi=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.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"})}),Xi=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})}),Ji=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.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"})}),ea=(0,c.jsxs)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,c.jsx)(L.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,c.jsx)(L.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"})]}),ta=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.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"})}),sa=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.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"})});const na=window.wp.commands;var oa=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"})}),ra=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"})});const ia=window.wp.viewport,aa=window.wp.plugins;var la=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.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"})});function ca(e){return["core/edit-post","core/edit-site"].includes(e)?(k()(`${e} interface scope`,{alternative:"core interface scope",hint:"core/edit-post and core/edit-site are merging.",version:"6.6"}),"core"):e}function da(e,t){return"core"===e&&"edit-site/template"===t?(k()("edit-site/template sidebar",{alternative:"edit-post/document",version:"6.6"}),"edit-post/document"):"core"===e&&"edit-site/block-inspector"===t?(k()("edit-site/block-inspector sidebar",{alternative:"edit-post/block",version:"6.6"}),"edit-post/block"):t}const ua=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e=ca(e),area:t=da(e,t)}),pa=(e,t)=>({registry:s,dispatch:n})=>{if(!t)return;e=ca(e),t=da(e,t);s.select(C.store).get(e,"isComplementaryAreaVisible")||s.dispatch(C.store).set(e,"isComplementaryAreaVisible",!0),n({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},ma=e=>({registry:t})=>{e=ca(e);t.select(C.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(C.store).set(e,"isComplementaryAreaVisible",!1)},ha=(e,t)=>({registry:s})=>{if(!t)return;e=ca(e),t=da(e,t);const n=s.select(C.store).get(e,"pinnedItems");!0!==n?.[t]&&s.dispatch(C.store).set(e,"pinnedItems",{...n,[t]:!0})},ga=(e,t)=>({registry:s})=>{if(!t)return;e=ca(e),t=da(e,t);const n=s.select(C.store).get(e,"pinnedItems");s.dispatch(C.store).set(e,"pinnedItems",{...n,[t]:!1})};function _a(e,t){return function({registry:s}){k()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),s.dispatch(C.store).toggle(e,t)}}function fa(e,t,s){return function({registry:n}){k()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),n.dispatch(C.store).set(e,t,!!s)}}function ba(e,t){return function({registry:s}){k()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),s.dispatch(C.store).setDefaults(e,t)}}function ya(e){return{type:"OPEN_MODAL",name:e}}function xa(){return{type:"CLOSE_MODAL"}}const va=(0,d.createRegistrySelector)((e=>(t,s)=>{s=ca(s);const n=e(C.store).get(s,"isComplementaryAreaVisible");if(void 0!==n)return!1===n?null:t?.complementaryAreas?.[s]})),wa=(0,d.createRegistrySelector)((e=>(t,s)=>{s=ca(s);const n=e(C.store).get(s,"isComplementaryAreaVisible"),o=t?.complementaryAreas?.[s];return n&&void 0===o})),Sa=(0,d.createRegistrySelector)((e=>(t,s,n)=>{n=da(s=ca(s),n);const o=e(C.store).get(s,"pinnedItems");return o?.[n]??!0})),ka=(0,d.createRegistrySelector)((e=>(t,s,n)=>(k()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(C.store).get(s,n))));function Ca(e,t){return e.activeModal===t}var Pa=(0,d.combineReducers)({complementaryAreas:function(e={},t){switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:s,area:n}=t;return e[s]?e:{...e,[s]:n}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:s,area:n}=t;return{...e,[s]:n}}}return e},activeModal:function(e=null,t){switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e}});const ja=(0,d.createReduxStore)("core/interface",{reducer:Pa,actions:o,selectors:r});function Ea({as:e=Hn.Button,scope:t,identifier:s,icon:n,selectedIcon:o,name:r,shortcut:i,...a}){const l=e,u=(0,aa.usePluginContext)(),p=n||u.icon,m=s||`${u.name}/${r}`,h=(0,d.useSelect)((e=>e(ja).getActiveComplementaryArea(t)===m),[m,t]),{enableComplementaryArea:g,disableComplementaryArea:_}=(0,d.useDispatch)(ja);return(0,c.jsx)(l,{icon:o&&h?o:p,"aria-controls":m.replace("/",":"),"aria-checked":(f=a.role,["checkbox","option","radio","switch","menuitemcheckbox","menuitemradio","treeitem"].includes(f)?h:void 0),onClick:()=>{h?_(t):g(t,m)},shortcut:i,...a});var f}(0,d.register)(ja);var Ta=({children:e,className:t,toggleButtonProps:s})=>{const n=(0,c.jsx)(Ea,{icon:la,...s});return(0,c.jsxs)("div",{className:mr("components-panel__header","interface-complementary-area-header",t),tabIndex:-1,children:[e,n]})};const Ia=()=>{};function Ba({name:e,as:t=Hn.Button,onClick:s,...n}){return(0,c.jsx)(Hn.Fill,{name:e,children:({onClick:e})=>(0,c.jsx)(t,{onClick:s||e?(...t)=>{(s||Ia)(...t),(e||Ia)(...t)}:void 0,...n})})}Ba.Slot=function({name:e,as:t=Hn.MenuGroup,fillProps:s={},bubblesVirtually:n,...o}){return(0,c.jsx)(Hn.Slot,{name:e,bubblesVirtually:n,fillProps:s,children:e=>{if(!p.Children.toArray(e).length)return null;const s=[];p.Children.forEach(e,(({props:{__unstableExplicitMenuItem:e,__unstableTarget:t}})=>{t&&e&&s.push(t)}));const n=p.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&s.includes(e.props.__unstableTarget)?null:e));return(0,c.jsx)(t,{...o,children:n})}})};var Na=Ba;const Ra=({__unstableExplicitMenuItem:e,__unstableTarget:t,...s})=>(0,c.jsx)(Hn.MenuItem,{...s});function Da({scope:e,target:t,__unstableExplicitMenuItem:s,...n}){return(0,c.jsx)(Ea,{as:n=>(0,c.jsx)(Na,{__unstableExplicitMenuItem:s,__unstableTarget:`${e}/${t}`,as:Ra,name:`${e}/plugin-more-menu`,...n}),role:"menuitemcheckbox",selectedIcon:zn,name:t,scope:e,...n})}function Aa({scope:e,...t}){return(0,c.jsx)(Hn.Fill,{name:`PinnedItems/${e}`,...t})}Aa.Slot=function({scope:e,className:t,...s}){return(0,c.jsx)(Hn.Slot,{name:`PinnedItems/${e}`,...s,children:e=>e?.length>0&&(0,c.jsx)("div",{className:mr(t,"interface-pinned-items"),children:e})})};var Ma=Aa;const La={open:{width:280},closed:{width:0},mobileOpen:{width:"100vw"}};function Oa({activeArea:e,isActive:t,scope:s,children:n,className:o,id:r}){const i=(0,m.useReducedMotion)(),a=(0,m.useViewportMatch)("medium","<"),l=(0,m.usePrevious)(e),d=(0,m.usePrevious)(t),[,u]=(0,p.useState)({});(0,p.useEffect)((()=>{u({})}),[t]);const h={type:"tween",duration:i||a||l&&e&&e!==l?0:.3,ease:[.6,0,.4,1]};return(0,c.jsx)(Hn.Fill,{name:`ComplementaryArea/${s}`,children:(0,c.jsx)(Hn.__unstableAnimatePresence,{initial:!1,children:(d||t)&&(0,c.jsx)(Hn.__unstableMotion.div,{variants:La,initial:"closed",animate:a?"mobileOpen":"open",exit:"closed",transition:h,className:"interface-complementary-area__fill",children:(0,c.jsx)("div",{id:r,className:o,style:{width:a?"100vw":280},children:n})})})})}function Fa({children:e,className:t,closeLabel:s=(0,fs.__)("Close plugin"),identifier:n,header:o,headerClassName:r,icon:i,isPinnable:a=!0,panelClassName:l,scope:u,name:h,title:g,toggleShortcut:_,isActiveByDefault:f}){const b=(0,aa.usePluginContext)(),y=i||b.icon,x=n||`${b.name}/${h}`,[v,w]=(0,p.useState)(!1),{isLoading:S,isActive:k,isPinned:P,activeArea:j,isSmall:E,isLarge:T,showIconLabels:I}=(0,d.useSelect)((e=>{const{getActiveComplementaryArea:t,isComplementaryAreaLoading:s,isItemPinned:n}=e(ja),{get:o}=e(C.store),r=t(u);return{isLoading:s(u),isActive:r===x,isPinned:n(u,x),activeArea:r,isSmall:e(ia.store).isViewportMatch("< medium"),isLarge:e(ia.store).isViewportMatch("large"),showIconLabels:o("core","showIconLabels")}}),[x,u]),B=(0,m.useViewportMatch)("medium","<");!function(e,t,s,n,o){const r=(0,p.useRef)(!1),i=(0,p.useRef)(!1),{enableComplementaryArea:a,disableComplementaryArea:l}=(0,d.useDispatch)(ja);(0,p.useEffect)((()=>{n&&o&&!r.current?(l(e),i.current=!0):i.current&&!o&&r.current?(i.current=!1,a(e,t)):i.current&&s&&s!==t&&(i.current=!1),o!==r.current&&(r.current=o)}),[n,o,e,t,s,l,a])}(u,x,j,k,E);const{enableComplementaryArea:N,disableComplementaryArea:R,pinItem:D,unpinItem:A}=(0,d.useDispatch)(ja);if((0,p.useEffect)((()=>{f&&void 0===j&&!E?N(u,x):void 0===j&&E&&R(u,x),w(!0)}),[j,f,u,x,E,N,R]),v)return(0,c.jsxs)(c.Fragment,{children:[a&&(0,c.jsx)(Ma,{scope:u,children:P&&(0,c.jsx)(Ea,{scope:u,identifier:x,isPressed:k&&(!I||T),"aria-expanded":k,"aria-disabled":S,label:g,icon:I?zn:y,showTooltip:!I,variant:I?"tertiary":void 0,size:"compact",shortcut:_})}),h&&a&&(0,c.jsx)(Da,{target:h,scope:u,icon:y,identifier:x,children:g}),(0,c.jsxs)(Oa,{activeArea:j,isActive:k,className:mr("interface-complementary-area",t),scope:u,id:x.replace("/",":"),children:[(0,c.jsx)(Ta,{className:r,closeLabel:s,onClose:()=>R(u),toggleButtonProps:{label:s,size:"compact",shortcut:_,scope:u,identifier:x},children:o||(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("h2",{className:"interface-complementary-area-header__title",children:g}),a&&!B&&(0,c.jsx)(Hn.Button,{className:"interface-complementary-area__pin-unpin-item",icon:P?oa:ra,label:P?(0,fs.__)("Unpin from toolbar"):(0,fs.__)("Pin to toolbar"),onClick:()=>(P?A:D)(u,x),isPressed:P,"aria-expanded":P,size:"compact"})]})}),(0,c.jsx)(Hn.Panel,{className:l,children:e})]})]})}Fa.Slot=function({scope:e,...t}){return(0,c.jsx)(Hn.Slot,{name:`ComplementaryArea/${e}`,...t})};var Va=Fa;var Ua=({isActive:e})=>((0,p.useEffect)((()=>{let e=!1;return document.body.classList.contains("sticky-menu")&&(e=!0,document.body.classList.remove("sticky-menu")),()=>{e&&document.body.classList.add("sticky-menu")}}),[]),(0,p.useEffect)((()=>(e?document.body.classList.add("is-fullscreen-mode"):document.body.classList.remove("is-fullscreen-mode"),()=>{e&&document.body.classList.remove("is-fullscreen-mode")})),[e]),null);const Ha=(0,p.forwardRef)((({children:e,className:t,ariaLabel:s,as:n="div",...o},r)=>(0,c.jsx)(n,{ref:r,className:mr("admin-ui-navigable-region",t),"aria-label":s,role:"region",tabIndex:"-1",...o,children:e})));Ha.displayName="NavigableRegion";var za=Ha;const Ga={type:"tween",duration:.25,ease:[.6,0,.4,1]};const $a={hidden:{opacity:1,marginTop:-60},visible:{opacity:1,marginTop:0},distractionFreeHover:{opacity:1,marginTop:0,transition:{...Ga,delay:.2,delayChildren:.2}},distractionFreeHidden:{opacity:0,marginTop:-60},distractionFreeDisabled:{opacity:0,marginTop:0,transition:{...Ga,delay:.8,delayChildren:.8}}};var Wa=(0,p.forwardRef)((function({isDistractionFree:e,footer:t,header:s,editorNotices:n,sidebar:o,secondarySidebar:r,content:i,actions:a,labels:l,className:d},u){const[h,g]=(0,m.useResizeObserver)(),_=(0,m.useViewportMatch)("medium","<"),f={type:"tween",duration:(0,m.useReducedMotion)()?0:.25,ease:[.6,0,.4,1]};!function(e){(0,p.useEffect)((()=>{const t=document&&document.querySelector(`html:not(.${e})`);if(t)return t.classList.toggle(e),()=>{t.classList.toggle(e)}}),[e])}("interface-interface-skeleton__html-container");const b={...{header:(0,fs._x)("Header","header landmark area"),body:(0,fs.__)("Content"),secondarySidebar:(0,fs.__)("Block Library"),sidebar:(0,fs._x)("Settings","settings landmark area"),actions:(0,fs.__)("Publish"),footer:(0,fs.__)("Footer")},...l};return(0,c.jsxs)("div",{ref:u,className:mr(d,"interface-interface-skeleton",!!t&&"has-footer"),children:[(0,c.jsxs)("div",{className:"interface-interface-skeleton__editor",children:[(0,c.jsx)(Hn.__unstableAnimatePresence,{initial:!1,children:!!s&&(0,c.jsx)(za,{as:Hn.__unstableMotion.div,className:"interface-interface-skeleton__header","aria-label":b.header,initial:e&&!_?"distractionFreeHidden":"hidden",whileHover:e&&!_?"distractionFreeHover":"visible",animate:e&&!_?"distractionFreeDisabled":"visible",exit:e&&!_?"distractionFreeHidden":"hidden",variants:$a,transition:f,children:s})}),e&&(0,c.jsx)("div",{className:"interface-interface-skeleton__header",children:n}),(0,c.jsxs)("div",{className:"interface-interface-skeleton__body",children:[(0,c.jsx)(Hn.__unstableAnimatePresence,{initial:!1,children:!!r&&(0,c.jsx)(za,{className:"interface-interface-skeleton__secondary-sidebar",ariaLabel:b.secondarySidebar,as:Hn.__unstableMotion.div,initial:"closed",animate:"open",exit:"closed",variants:{open:{width:g.width},closed:{width:0}},transition:f,children:(0,c.jsxs)(Hn.__unstableMotion.div,{style:{position:"absolute",width:_?"100vw":"fit-content",height:"100%",left:0},variants:{open:{x:0},closed:{x:"-100%"}},transition:f,children:[h,r]})})}),(0,c.jsx)(za,{className:"interface-interface-skeleton__content",ariaLabel:b.body,children:i}),!!o&&(0,c.jsx)(za,{className:"interface-interface-skeleton__sidebar",ariaLabel:b.sidebar,children:o}),!!a&&(0,c.jsx)(za,{className:"interface-interface-skeleton__actions",ariaLabel:b.actions,children:a})]})]}),!!t&&(0,c.jsx)(za,{className:"interface-interface-skeleton__footer",ariaLabel:b.footer,children:t})]})}));const{RenamePatternModal:Za}=$(ao.privateApis),Ya="editor/pattern-rename";function qa(){const{record:e,postType:t}=(0,d.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s}=e(vc),{getEditedEntityRecord:n}=e(u.store),o=t();return{record:n("postType",o,s()),postType:o}}),[]),{closeModal:s}=(0,d.useDispatch)(ja);return(0,d.useSelect)((e=>e(ja).isModalActive(Ya)))&&t===N?(0,c.jsx)(Za,{onClose:s,pattern:e}):null}const{DuplicatePatternModal:Ka}=$(ao.privateApis),Qa="editor/pattern-duplicate";function Xa(){const{record:e,postType:t}=(0,d.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s}=e(vc),{getEditedEntityRecord:n}=e(u.store),o=t();return{record:n("postType",o,s()),postType:o}}),[]),{closeModal:s}=(0,d.useDispatch)(ja);return(0,d.useSelect)((e=>e(ja).isModalActive(Qa)))&&t===N?(0,c.jsx)(Ka,{onClose:s,onSuccess:()=>s(),pattern:e}):null}const{BlockRemovalWarningModal:Ja}=$(g.privateApis),el=["core/post-content","core/post-template","core/query"],tl=[{postTypes:["wp_template","wp_template_part"],callback(e){if(e.filter((({name:e})=>el.includes(e))).length)return(0,fs._n)("Deleting this block will stop your post or page content from displaying on this template. It is not recommended.","Some of the deleted blocks will stop your post or page content from displaying on this template. It is not recommended.",e.length)}},{postTypes:["wp_block"],callback(e){if(e.filter((({attributes:e})=>e?.metadata?.bindings&&Object.values(e.metadata.bindings).some((e=>"core/pattern-overrides"===e.source)))).length)return(0,fs._n)("The deleted block allows instance overrides. Removing it may result in content not displaying where this pattern is used. Are you sure you want to proceed?","Some of the deleted blocks allow instance overrides. Removing them may result in content not displaying where this pattern is used. Are you sure you want to proceed?",e.length)}}];function sl(){const e=(0,d.useSelect)((e=>e(vc).getCurrentPostType()),[]),t=(0,p.useMemo)((()=>tl.filter((t=>t.postTypes.includes(e)))),[e]);return Ja&&t?(0,c.jsx)(Ja,{rules:t}):null}function nl({blockPatterns:e,onChoosePattern:t}){const{editEntityRecord:s}=(0,d.useDispatch)(u.store),{postType:n,postId:o}=(0,d.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s}=e(vc);return{postType:t(),postId:s()}}),[]);return(0,c.jsx)(g.__experimentalBlockPatternsList,{blockPatterns:e,onClickPattern:(e,r)=>{s("postType",n,o,{blocks:r,content:({blocks:e=[]})=>(0,x.__unstableSerializeAndClean)(e)}),t()}})}function ol({onClose:e}){const[t,s]=(0,p.useState)(!0),{set:n}=(0,d.useDispatch)(C.store),o=function(){const{blockPatternsWithPostContentBlockType:e,postType:t}=(0,d.useSelect)((e=>{const{getPatternsByBlockTypes:t,getBlocksByName:s}=e(g.store),{getCurrentPostType:n,getRenderingMode:o}=e(vc);return{blockPatternsWithPostContentBlockType:t("core/post-content","post-only"===o()?"":s("core/post-content")?.[0]),postType:n()}}),[]);return(0,p.useMemo)((()=>e?.length?e.filter((e=>"page"===t&&!e.postTypes||Array.isArray(e.postTypes)&&e.postTypes.includes(t))):[]),[t,e])}();if(!(o.length>0))return null;function r(){e(),n("core","enableChoosePatternModal",t)}return(0,c.jsxs)(Hn.Modal,{className:"editor-start-page-options__modal",title:(0,fs.__)("Choose a pattern"),isFullScreen:!0,onRequestClose:r,children:[(0,c.jsx)("div",{className:"editor-start-page-options__modal-content",children:(0,c.jsx)(nl,{blockPatterns:o,onChoosePattern:r})}),(0,c.jsx)(Hn.Flex,{className:"editor-start-page-options__modal__actions",justify:"flex-start",expanded:!1,children:(0,c.jsx)(Hn.FlexItem,{children:(0,c.jsx)(Hn.CheckboxControl,{__nextHasNoMarginBottom:!0,checked:t,label:(0,fs.__)("Always show starter patterns for new pages"),onChange:e=>{s(e)}})})})]})}function rl(){const[e,t]=(0,p.useState)(!1),{isEditedPostDirty:s,isEditedPostEmpty:n}=(0,d.useSelect)(vc),{isModalActive:o}=(0,d.useSelect)(ja),{enabled:r,postId:i}=(0,d.useSelect)((e=>{const{getCurrentPostId:t,getCurrentPostType:s}=e(vc),n=e(C.store).get("core","enableChoosePatternModal");return{postId:t(),enabled:n&&I!==s()}}),[]);return(0,p.useEffect)((()=>{const e=!s()&&n(),i=o("editor/preferences");r&&e&&!i&&t(!0)}),[r,i,s,n,o]),e?(0,c.jsx)(ol,{onClose:()=>t(!1)}):null}const il=window.wp.keyboardShortcuts,al=[{keyCombination:{modifier:"primary",character:"b"},description:(0,fs.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,fs.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,fs.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,fs.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,fs.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,fs.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,fs.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,fs.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},aliases:[{modifier:"access",character:"7"}],description:(0,fs.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,fs.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")},{keyCombination:{modifier:"primaryShift",character:"SPACE"},description:(0,fs.__)("Add non breaking space.")}],ll=window.wp.keycodes;function cl({keyCombination:e,forceAriaLabel:t}){const s=e.modifier?ll.displayShortcutList[e.modifier](e.character):e.character,n=e.modifier?ll.shortcutAriaLabel[e.modifier](e.character):e.character;return(0,c.jsx)("kbd",{className:"editor-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||n,children:(Array.isArray(s)?s:[s]).map(((e,t)=>"+"===e?(0,c.jsx)(p.Fragment,{children:e},t):(0,c.jsx)("kbd",{className:"editor-keyboard-shortcut-help-modal__shortcut-key",children:e},t)))})}var dl=function({description:e,keyCombination:t,aliases:s=[],ariaLabel:n}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"editor-keyboard-shortcut-help-modal__shortcut-description",children:e}),(0,c.jsxs)("div",{className:"editor-keyboard-shortcut-help-modal__shortcut-term",children:[(0,c.jsx)(cl,{keyCombination:t,forceAriaLabel:n}),s.map(((e,t)=>(0,c.jsx)(cl,{keyCombination:e,forceAriaLabel:n},t)))]})]})};var ul=function({name:e}){const{keyCombination:t,description:s,aliases:n}=(0,d.useSelect)((t=>{const{getShortcutKeyCombination:s,getShortcutDescription:n,getShortcutAliases:o}=t(il.store);return{keyCombination:s(e),aliases:o(e),description:n(e)}}),[e]);return t?(0,c.jsx)(dl,{keyCombination:t,description:s,aliases:n}):null};const pl="editor/keyboard-shortcut-help",ml=({shortcuts:e})=>(0,c.jsx)("ul",{className:"editor-keyboard-shortcut-help-modal__shortcut-list",role:"list",children:e.map(((e,t)=>(0,c.jsx)("li",{className:"editor-keyboard-shortcut-help-modal__shortcut",children:"string"==typeof e?(0,c.jsx)(ul,{name:e}):(0,c.jsx)(dl,{...e})},t)))}),hl=({title:e,shortcuts:t,className:s})=>(0,c.jsxs)("section",{className:mr("editor-keyboard-shortcut-help-modal__section",s),children:[!!e&&(0,c.jsx)("h2",{className:"editor-keyboard-shortcut-help-modal__section-title",children:e}),(0,c.jsx)(ml,{shortcuts:t})]}),gl=({title:e,categoryName:t,additionalShortcuts:s=[]})=>{const n=(0,d.useSelect)((e=>e(il.store).getCategoryShortcuts(t)),[t]);return(0,c.jsx)(hl,{title:e,shortcuts:n.concat(s)})};var _l=function(){const e=(0,d.useSelect)((e=>e(ja).isModalActive(pl)),[]),{openModal:t,closeModal:s}=(0,d.useDispatch)(ja),n=()=>{e?s():t(pl)};return(0,il.useShortcut)("core/editor/keyboard-shortcuts",n),e?(0,c.jsxs)(Hn.Modal,{className:"editor-keyboard-shortcut-help-modal",title:(0,fs.__)("Keyboard shortcuts"),closeButtonLabel:(0,fs.__)("Close"),onRequestClose:n,children:[(0,c.jsx)(hl,{className:"editor-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/editor/keyboard-shortcuts"]}),(0,c.jsx)(gl,{title:(0,fs.__)("Global shortcuts"),categoryName:"global"}),(0,c.jsx)(gl,{title:(0,fs.__)("Selection shortcuts"),categoryName:"selection"}),(0,c.jsx)(gl,{title:(0,fs.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,fs.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,fs.__)("Forward-slash")}]}),(0,c.jsx)(hl,{title:(0,fs.__)("Text formatting"),shortcuts:al}),(0,c.jsx)(gl,{title:(0,fs.__)("List View shortcuts"),categoryName:"list-view"})]}):null};function fl({clientId:e,onClose:t}){const s=Ui(),{entity:n,onNavigateToEntityRecord:o,canEditTemplates:r}=(0,d.useSelect)((t=>{const{getBlockParentsByBlockName:n,getSettings:o,getBlockAttributes:r,getBlockParents:i}=t(g.store),{getCurrentTemplateId:a,getRenderingMode:l}=t(vc),c=n(e,"core/block",!0)[0];let d;if(c?d=t(u.store).getEntityRecord("postType","wp_block",r(c).ref):"template-locked"!==l()||i(e).some((e=>s.includes(e)))||(d=t(u.store).getEntityRecord("postType","wp_template",a())),!d)return{};return{canEditTemplates:t(u.store).canUser("create",{kind:"postType",name:"wp_template"}),entity:d,onNavigateToEntityRecord:o().onNavigateToEntityRecord}}),[e,s]);if(!n)return(0,c.jsx)(bl,{clientId:e,onClose:t});const i="wp_block"===n.type;let a=i?(0,fs.__)("Edit the pattern to move, delete, or make further changes to this block."):(0,fs.__)("Edit the template to move, delete, or make further changes to this block.");return r||(a=(0,fs.__)("Only users with permissions to edit the template can move or delete this block")),(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(g.__unstableBlockSettingsMenuFirstItem,{children:(0,c.jsx)(Hn.MenuItem,{onClick:()=>{o({postId:n.id,postType:n.type})},disabled:!r,children:i?(0,fs.__)("Edit pattern"):(0,fs.__)("Edit template")})}),(0,c.jsx)(Hn.__experimentalText,{variant:"muted",as:"p",className:"editor-content-only-settings-menu__description",children:a})]})}function bl({clientId:e,onClose:t}){const{contentLockingParent:s}=(0,d.useSelect)((t=>{const{getContentLockingParent:s}=$(t(g.store));return{contentLockingParent:s(e)}}),[e]),n=(0,g.useBlockDisplayInformation)(s),o=(0,d.useDispatch)(g.store);if(!n?.title)return null;const{modifyContentLockBlock:r}=$(o);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(g.__unstableBlockSettingsMenuFirstItem,{children:(0,c.jsx)(Hn.MenuItem,{onClick:()=>{r(s),t()},children:(0,fs._x)("Unlock","Unlock content locked blocks")})}),(0,c.jsx)(Hn.__experimentalText,{variant:"muted",as:"p",className:"editor-content-only-settings-menu__description",children:(0,fs.__)("Temporarily unlock the parent block to edit, delete or make further changes to this block.")})]})}function yl(){return(0,c.jsx)(g.BlockSettingsMenuControls,{children:({selectedClientIds:e,onClose:t})=>1===e.length&&(0,c.jsx)(fl,{clientId:e[0],onClose:t})})}function xl(e){const{slug:t,patterns:s}=(0,d.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s}=e(vc),{getEntityRecord:n,getBlockPatterns:o}=e(u.store),r=s();return{slug:n("postType",t(),r).slug,patterns:o()}}),[]),n=(0,d.useSelect)((e=>e(u.store).getCurrentTheme().stylesheet));return(0,p.useMemo)((()=>[{name:"fallback",blocks:(0,x.parse)(e),title:(0,fs.__)("Fallback content")},...s.filter((e=>Array.isArray(e.templateTypes)&&e.templateTypes.some((e=>t.startsWith(e))))).map((e=>({...e,blocks:(0,x.parse)(e.content).map((e=>function(e){return e.innerBlocks.find((e=>"core/template-part"===e.name))&&(e.innerBlocks=e.innerBlocks.map((e=>("core/template-part"===e.name&&void 0===e.attributes.theme&&(e.attributes.theme=n),e)))),"core/template-part"===e.name&&void 0===e.attributes.theme&&(e.attributes.theme=n),e}(e)))})))]),[e,t,s])}function vl({fallbackContent:e,onChoosePattern:t,postType:s}){const[,,n]=(0,u.useEntityBlockEditor)("postType",s),o=xl(e);return(0,c.jsx)(g.__experimentalBlockPatternsList,{blockPatterns:o,onClickPattern:(e,s)=>{n(s,{selection:void 0}),t()}})}function wl({slug:e,isCustom:t,onClose:s,postType:n}){const o=function(e,t=!1){return(0,d.useSelect)((s=>{const{getEntityRecord:n,getDefaultTemplateId:o}=s(u.store),r=o({slug:e,is_custom:t,ignore_empty:!0});return r?n("postType",I,r)?.content?.raw:void 0}),[e,t])}(e,t);return o?(0,c.jsxs)(Hn.Modal,{className:"editor-start-template-options__modal",title:(0,fs.__)("Choose a pattern"),closeLabel:(0,fs.__)("Cancel"),focusOnMount:"firstElement",onRequestClose:s,isFullScreen:!0,children:[(0,c.jsx)("div",{className:"editor-start-template-options__modal-content",children:(0,c.jsx)(vl,{fallbackContent:o,slug:e,isCustom:t,postType:n,onChoosePattern:()=>{s()}})}),(0,c.jsx)(Hn.Flex,{className:"editor-start-template-options__modal__actions",justify:"flex-end",expanded:!1,children:(0,c.jsx)(Hn.FlexItem,{children:(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:s,children:(0,fs.__)("Skip")})})})]}):null}function Sl(){const[e,t]=(0,p.useState)(!1),{shouldOpenModal:s,slug:n,isCustom:o,postType:r,postId:i}=(0,d.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s}=e(vc),n=t(),o=s(),{getEditedEntityRecord:r,hasEditsForEntityRecord:i}=e(u.store),a=r("postType",n,o);return{shouldOpenModal:!i("postType",n,o)&&""===a.content&&I===n,slug:a.slug,isCustom:a.is_custom,postType:n,postId:o}}),[]);return(0,p.useEffect)((()=>{t(!1)}),[r,i]),!s||e?null:(0,c.jsx)(wl,{slug:n,isCustom:o,postType:r,onClose:()=>t(!0)})}function kl(){const e=(0,d.useSelect)((e=>{const{richEditingEnabled:t,codeEditingEnabled:s}=e(vc).getEditorSettings();return!t||!s}),[]),{getBlockSelectionStart:t}=(0,d.useSelect)(g.store),{getActiveComplementaryArea:s}=(0,d.useSelect)(ja),{enableComplementaryArea:n,disableComplementaryArea:o}=(0,d.useDispatch)(ja),{redo:r,undo:i,savePost:a,setIsListViewOpened:l,switchEditorMode:c,toggleDistractionFree:u}=(0,d.useDispatch)(vc),{isEditedPostDirty:p,isPostSavingLocked:m,isListViewOpened:h,getEditorMode:_}=(0,d.useSelect)(vc);return(0,il.useShortcut)("core/editor/toggle-mode",(()=>{c("visual"===_()?"text":"visual")}),{isDisabled:e}),(0,il.useShortcut)("core/editor/toggle-distraction-free",(()=>{u()})),(0,il.useShortcut)("core/editor/undo",(e=>{i(),e.preventDefault()})),(0,il.useShortcut)("core/editor/redo",(e=>{r(),e.preventDefault()})),(0,il.useShortcut)("core/editor/save",(e=>{e.preventDefault(),m()||p()&&a()})),(0,il.useShortcut)("core/editor/toggle-list-view",(e=>{h()||(e.preventDefault(),l(!0))})),(0,il.useShortcut)("core/editor/toggle-sidebar",(e=>{e.preventDefault();if(["edit-post/document","edit-post/block"].includes(s("core")))o("core");else{const e=t()?"edit-post/block":"edit-post/document";n("core",e)}})),null}function Cl({clientId:e,onClose:t}){const{getBlocks:s}=(0,d.useSelect)(g.store),{replaceBlocks:n}=(0,d.useDispatch)(g.store);return(0,d.useSelect)((t=>t(g.store).canRemoveBlock(e)),[e])?(0,c.jsx)(Hn.MenuItem,{onClick:()=>{n(e,s(e)),t()},children:(0,fs.__)("Detach")}):null}function Pl({clientIds:e,blocks:t}){const[s,n]=(0,p.useState)(!1),{replaceBlocks:o}=(0,d.useDispatch)(g.store),{createSuccessNotice:r}=(0,d.useDispatch)(_s.store),{isBlockBasedTheme:i,canCreate:a}=(0,d.useSelect)((e=>({isBlockBasedTheme:e(u.store).getCurrentTheme()?.is_block_theme,canCreate:e(g.store).canInsertBlockType("core/template-part")})),[]);if(!i||!a)return null;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.MenuItem,{icon:U,onClick:()=>{n(!0)},"aria-expanded":s,"aria-haspopup":"dialog",children:(0,fs.__)("Create template part")}),s&&(0,c.jsx)(Jn,{closeModal:()=>{n(!1)},blocks:t,onCreate:async t=>{o(e,(0,x.createBlock)("core/template-part",{slug:t.slug,theme:t.theme})),r((0,fs.__)("Template part created."),{type:"snackbar"})}})]})}function jl(){return(0,c.jsx)(g.BlockSettingsMenuControls,{children:({selectedClientIds:e,onClose:t})=>(0,c.jsx)(El,{clientIds:e,onClose:t})})}function El({clientIds:e,onClose:t}){const{blocks:s}=(0,d.useSelect)((t=>{const{getBlocksByClientId:s}=t(g.store);return{blocks:s(e)}}),[e]);return 1===s.length&&"core/template-part"===s[0]?.name?(0,c.jsx)(Cl,{clientId:e[0],onClose:t}):(0,c.jsx)(Pl,{clientIds:e,blocks:s})}const{ExperimentalBlockEditorProvider:Tl}=$(g.privateApis),{PatternsMenuItems:Il}=$(ao.privateApis),Bl=()=>{},Nl=["wp_block","wp_navigation","wp_template_part"];const Rl=ri((({post:e,settings:t,recovery:s,initialEdits:n,children:o,BlockEditorProviderComponent:r=Tl,__unstableTemplate:i})=>{const a=!!i,{editorSettings:l,selection:m,isReady:_,mode:f,defaultMode:b,postTypeEntities:y}=(0,d.useSelect)((t=>{const{getEditorSettings:s,getEditorSelection:n,getRenderingMode:o,__unstableIsEditorReady:r,getDefaultRenderingMode:i}=$(t(vc)),{getEntitiesConfig:l}=t(u.store),c=o(),d=i(e.type),p="template-locked"===d?a:void 0!==d,m=void 0!==d;return{editorSettings:s(),isReady:r(),mode:m?c:void 0,defaultMode:p?d:void 0,selection:n(),postTypeEntities:"wp_template"===e.type?l("postType"):null}}),[e.type,a]),v=a&&"post-only"!==f,w=v?i:e,S=(0,p.useMemo)((()=>{const t={};if("wp_template"===e.type){if("page"===e.slug)t.postType="page";else if("single"===e.slug)t.postType="post";else if("single"===e.slug.split("-")[0]){const s=y?.map((e=>e.name))||[],n=e.slug.match(`^single-(${s.join("|")})(?:-.+)?$`);n&&(t.postType=n[1])}}else Nl.includes(w.type)&&!v||(t.postId=e.id,t.postType=e.type);return{...t,templateSlug:"wp_template"===w.type?w.slug:void 0}}),[v,e.id,e.type,e.slug,w.type,w.slug,y]),{id:k,type:P}=w,j=Fi(l,P,k,f),[E,T,R]=function(e,t,s){const n="template-locked"===s?"template":"post",[o,r,i]=(0,u.useEntityBlockEditor)("postType",e.type,{id:e.id}),[a,l,c]=(0,u.useEntityBlockEditor)("postType",t?.type,{id:t?.id}),d=(0,p.useMemo)((()=>{if("wp_navigation"===e.type)return[(0,x.createBlock)("core/navigation",{ref:e.id,templateLock:!1})]}),[e.type,e.id]),m=(0,p.useMemo)((()=>d||("template"===n?a:o)),[d,n,a,o]);return t&&"template-locked"===s||"wp_navigation"===e.type?[m,Bl,Bl]:[m,"post"===n?r:l,"post"===n?i:c]}(e,i,f),{updatePostLock:D,setupEditor:A,updateEditorSettings:M,setCurrentTemplateId:L,setEditedPost:O,setRenderingMode:F}=$((0,d.useDispatch)(vc)),{createWarningNotice:V}=(0,d.useDispatch)(_s.store);return(0,p.useLayoutEffect)((()=>{s||(D(t.postLock),A(e,n,t.template),t.autosave&&V((0,fs.__)("There is an autosave of this post that is more recent than the version below."),{id:"autosave-exists",actions:[{label:(0,fs.__)("View the autosave"),url:t.autosave.editLink}]}))}),[]),(0,p.useEffect)((()=>{O(e.type,e.id)}),[e.type,e.id,O]),(0,p.useEffect)((()=>{M(t)}),[t,M]),(0,p.useEffect)((()=>{L(i?.id)}),[i?.id,L]),(0,p.useEffect)((()=>{b&&F(b)}),[b,F]),function(e,t){(0,p.useEffect)((()=>((0,h.addFilter)("blockEditor.__unstableCanInsertBlockType","removeTemplatePartsFromInserter",((s,n)=>!(!Gi.includes(e)&&"core/template-part"===n.name&&"post-only"===t)&&s)),(0,h.addFilter)("blockEditor.__unstableCanInsertBlockType","removePostContentFromInserter",((t,s,n,{getBlockParentsByBlockName:o})=>Gi.includes(e)||"core/post-content"!==s.name?t:o(n,"core/query").length>0)),()=>{(0,h.removeFilter)("blockEditor.__unstableCanInsertBlockType","removeTemplatePartsFromInserter"),(0,h.removeFilter)("blockEditor.__unstableCanInsertBlockType","removePostContentFromInserter")})),[e,t])}(e.type,f),(0,na.useCommandLoader)({name:"core/editor/edit-ui",hook:function(){const{editorMode:e,isListViewOpen:t,showBlockBreadcrumbs:s,isDistractionFree:n,isFocusMode:o,isPreviewMode:r,isViewable:i,isCodeEditingEnabled:a,isRichEditingEnabled:l,isPublishSidebarEnabled:c}=(0,d.useSelect)((e=>{const{get:t}=e(C.store),{isListViewOpened:s,getCurrentPostType:n,getEditorSettings:o}=e(vc),{getSettings:r}=e(g.store),{getPostType:i}=e(u.store);return{editorMode:t("core","editorMode")??"visual",isListViewOpen:s(),showBlockBreadcrumbs:t("core","showBlockBreadcrumbs"),isDistractionFree:t("core","distractionFree"),isFocusMode:t("core","focusMode"),isPreviewMode:r().isPreviewMode,isViewable:i(n())?.viewable??!1,isCodeEditingEnabled:o().codeEditingEnabled,isRichEditingEnabled:o().richEditingEnabled,isPublishSidebarEnabled:e(vc).isPublishSidebarEnabled()}}),[]),{getActiveComplementaryArea:p}=(0,d.useSelect)(ja),{toggle:m}=(0,d.useDispatch)(C.store),{createInfoNotice:h}=(0,d.useDispatch)(_s.store),{__unstableSaveForPreview:_,setIsListViewOpened:f,switchEditorMode:b,toggleDistractionFree:y,toggleSpotlightMode:x,toggleTopToolbar:v}=(0,d.useDispatch)(vc),{openModal:w,enableComplementaryArea:S,disableComplementaryArea:k}=(0,d.useDispatch)(ja),{getCurrentPostId:P}=(0,d.useSelect)(vc),j=a&&l;if(r)return{commands:[],isLoading:!1};const E=[];return E.push({name:"core/open-shortcut-help",label:(0,fs.__)("Keyboard shortcuts"),icon:$i,callback:({close:e})=>{e(),w("editor/keyboard-shortcut-help")}}),E.push({name:"core/toggle-distraction-free",label:n?(0,fs.__)("Exit Distraction free"):(0,fs.__)("Enter Distraction free"),callback:({close:e})=>{y(),e()}}),E.push({name:"core/open-preferences",label:(0,fs.__)("Editor preferences"),callback:({close:e})=>{e(),w("editor/preferences")}}),E.push({name:"core/toggle-spotlight-mode",label:o?(0,fs.__)("Exit Spotlight mode"):(0,fs.__)("Enter Spotlight mode"),callback:({close:e})=>{x(),e()}}),E.push({name:"core/toggle-list-view",label:t?(0,fs.__)("Close List View"):(0,fs.__)("Open List View"),icon:Wi,callback:({close:e})=>{f(!t),e(),h(t?(0,fs.__)("List View off."):(0,fs.__)("List View on."),{id:"core/editor/toggle-list-view/notice",type:"snackbar"})}}),E.push({name:"core/toggle-top-toolbar",label:(0,fs.__)("Top toolbar"),callback:({close:e})=>{v(),e()}}),j&&E.push({name:"core/toggle-code-editor",label:"visual"===e?(0,fs.__)("Open code editor"):(0,fs.__)("Exit code editor"),icon:Zi,callback:({close:t})=>{b("visual"===e?"text":"visual"),t()}}),E.push({name:"core/toggle-breadcrumbs",label:s?(0,fs.__)("Hide block breadcrumbs"):(0,fs.__)("Show block breadcrumbs"),callback:({close:e})=>{m("core","showBlockBreadcrumbs"),e(),h(s?(0,fs.__)("Breadcrumbs hidden."):(0,fs.__)("Breadcrumbs visible."),{id:"core/editor/toggle-breadcrumbs/notice",type:"snackbar"})}}),E.push({name:"core/open-settings-sidebar",label:(0,fs.__)("Show or hide the Settings panel"),icon:(0,fs.isRTL)()?Yi:qi,callback:({close:e})=>{const t=p("core");e(),"edit-post/document"===t?k("core"):S("core","edit-post/document")}}),E.push({name:"core/open-block-inspector",label:(0,fs.__)("Show or hide the Block settings panel"),icon:Ki,callback:({close:e})=>{const t=p("core");e(),"edit-post/block"===t?k("core"):S("core","edit-post/block")}}),E.push({name:"core/toggle-publish-sidebar",label:c?(0,fs.__)("Disable pre-publish checks"):(0,fs.__)("Enable pre-publish checks"),icon:Qi,callback:({close:e})=>{e(),m("core","isPublishSidebarEnabled"),h(c?(0,fs.__)("Pre-publish checks disabled."):(0,fs.__)("Pre-publish checks enabled."),{id:"core/editor/publish-sidebar/notice",type:"snackbar"})}}),i&&E.push({name:"core/preview-link",label:(0,fs.__)("Preview in a new tab"),icon:Fn,callback:async({close:e})=>{e();const t=P(),s=await _();window.open(s,`wp-preview-${t}`)}}),{commands:E,isLoading:!1}}}),(0,na.useCommandLoader)({name:"core/editor/contextual-commands",hook:function(){const{postType:e}=(0,d.useSelect)((e=>{const{getCurrentPostType:t}=e(vc);return{postType:t()}}),[]),{openModal:t}=(0,d.useDispatch)(ja),s=[];return e===N&&(s.push({name:"core/rename-pattern",label:(0,fs.__)("Rename pattern"),icon:Xi,callback:({close:e})=>{t(Ya),e()}}),s.push({name:"core/duplicate-pattern",label:(0,fs.__)("Duplicate pattern"),icon:Ji,callback:({close:e})=>{t(Qa),e()}})),{isLoading:!1,commands:s}},context:"entity-edit"}),(0,na.useCommandLoader)({name:"core/editor/page-content-focus",hook:function(){const{onNavigateToEntityRecord:e,goBack:t,templateId:s,isPreviewMode:n}=(0,d.useSelect)((e=>{const{getRenderingMode:t,getEditorSettings:s,getCurrentTemplateId:n}=$(e(vc)),o=s();return{isTemplateHidden:"post-only"===t(),onNavigateToEntityRecord:o.onNavigateToEntityRecord,getEditorSettings:s,goBack:o.onNavigateToPreviousEntityRecord,templateId:n(),isPreviewMode:o.isPreviewMode}}),[]),{editedRecord:o,hasResolved:r}=(0,u.useEntityRecord)("postType","wp_template",s);if(n)return{isLoading:!1,commands:[]};const i=[];return s&&r&&i.push({name:"core/switch-to-template-focus",label:(0,fs.sprintf)((0,fs.__)("Edit template: %s"),(0,Ln.decodeEntities)(o.title)),icon:W,callback:({close:t})=>{e({postId:s,postType:"wp_template"}),t()}}),t&&i.push({name:"core/switch-to-previous-entity",label:(0,fs.__)("Go back"),icon:ea,callback:({close:e})=>{t(),e()}}),{isLoading:!1,commands:i}},context:"entity-edit"}),(0,na.useCommandLoader)({name:"core/edit-site/manipulate-document",hook:function(){const{postType:e,postId:t}=(0,d.useSelect)((e=>{const{getCurrentPostId:t,getCurrentPostType:s}=e(vc);return{postType:s(),postId:t()}}),[]),{editedRecord:s,hasResolved:n}=(0,u.useEntityRecord)("postType",e,t),{revertTemplate:o}=$((0,d.useDispatch)(vc));if(!n||![B,I].includes(e))return{isLoading:!0,commands:[]};const r=[];if(On(s)){const e=s.type===I?(0,fs.sprintf)((0,fs.__)("Reset template: %s"),(0,Ln.decodeEntities)(s.title)):(0,fs.sprintf)((0,fs.__)("Reset template part: %s"),(0,Ln.decodeEntities)(s.title));r.push({name:"core/reset-template",label:e,icon:(0,fs.isRTL)()?ta:sa,callback:({close:e})=>{o(s),e()}})}return{isLoading:!n,commands:r}}}),_&&f?(0,c.jsx)(u.EntityProvider,{kind:"root",type:"site",children:(0,c.jsx)(u.EntityProvider,{kind:"postType",type:e.type,id:e.id,children:(0,c.jsx)(g.BlockContextProvider,{value:S,children:(0,c.jsxs)(r,{value:E,onChange:R,onInput:T,selection:m,settings:j,useSubRegistry:!1,children:[o,!t.isPreviewMode&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Il,{}),(0,c.jsx)(jl,{}),(0,c.jsx)(yl,{}),"template-locked"===f&&(0,c.jsx)(Hi,{}),"wp_navigation"===P&&(0,c.jsx)(zi,{}),(0,c.jsx)(kl,{}),(0,c.jsx)(_l,{}),(0,c.jsx)(sl,{}),(0,c.jsx)(rl,{}),(0,c.jsx)(Sl,{}),(0,c.jsx)(qa,{}),(0,c.jsx)(Xa,{})]})]})})})}):null}));function Dl(e){return(0,c.jsx)(Rl,{...e,BlockEditorProviderComponent:g.BlockEditorProvider,children:e.children})}var Al=Dl;const{useGlobalStyle:Ml}=$(g.privateApis);function Ll({template:e,post:t}){const[s="white"]=Ml("color.background"),[n]=(0,u.useEntityBlockEditor)("postType",t.type,{id:t.id}),[o]=(0,u.useEntityBlockEditor)("postType",e?.type,{id:e?.id}),r=e&&o?o:n,i=!r?.length;return(0,c.jsxs)("div",{className:"editor-fields-content-preview",style:{backgroundColor:s},children:[i&&(0,c.jsx)("span",{className:"editor-fields-content-preview__empty",children:(0,fs.__)("Empty content")}),!i&&(0,c.jsx)(g.BlockPreview.Async,{children:(0,c.jsx)(g.BlockPreview,{blocks:r})})]})}const Ol={type:"media",id:"content-preview",label:(0,fs.__)("Content preview"),render:function({item:e}){const{settings:t,template:s}=(0,d.useSelect)((t=>{const{canUser:s,getPostType:n,getTemplateId:o,getEntityRecord:r}=$(t(u.store)),i=s("read",{kind:"postType",name:"wp_template"}),a=t(vc).getEditorSettings(),l=a.supportsTemplateMode,c=n(e.type)?.viewable??!1,d=l&&c&&i?o(e.type,e.id):null;return{settings:a,template:d?r("postType","wp_template",d):void 0}}),[e.type,e.id]);return(0,c.jsx)(Dl,{post:e,settings:t,__unstableTemplate:s,children:(0,c.jsx)(Ll,{template:s,post:e})})},enableSorting:!1};var Fl=Ol;function Vl(e,t,s){return{type:"REGISTER_ENTITY_ACTION",kind:e,name:t,config:s}}function Ul(e,t,s){return{type:"UNREGISTER_ENTITY_ACTION",kind:e,name:t,actionId:s}}function Hl(e,t,s){return{type:"REGISTER_ENTITY_FIELD",kind:e,name:t,config:s}}function zl(e,t,s){return{type:"UNREGISTER_ENTITY_FIELD",kind:e,name:t,fieldId:s}}function Gl(e,t){return{type:"SET_IS_READY",kind:e,name:t}}const $l=e=>async({registry:t})=>{if($(t.select(vc)).isEntityReady("postType",e))return;$(t.dispatch(vc)).setIsReady("postType",e);const s=await t.resolveSelect(u.store).getPostType(e),n=await t.resolveSelect(u.store).canUser("create",{kind:"postType",name:e}),o=await t.resolveSelect(u.store).getCurrentTheme(),r=[s.viewable?Vn:void 0,s.supports?.revisions?Un:void 0,void 0,"wp_template_part"===s.slug&&n&&o?.is_block_theme?io:void 0,n&&"wp_block"===s.slug?ho:void 0,s.supports?.title?fo:void 0,s.supports?.["page-attributes"]?yo:void 0,"wp_block"===s.slug?Zo:void 0,qo,Xo,nr,rr,ar].filter(Boolean),i=[s.supports?.thumbnail&&o?.theme_supports?.["post-thumbnails"]&&ur,s.supports?.author&&fr,Cr,Er,Dr,s.supports?.["page-attributes"]&&Vr,s.supports?.comments&&Ur,s.supports?.trackbacks&&Hr,(s.supports?.comments||s.supports?.trackbacks)&&zr,Wr,Yr,s.supports?.editor&&s.viewable&&Fl].filter(Boolean);if(s.supports?.title){let t;t="page"===e?Xr:"wp_template"===e?Jr:"wp_block"===e?ni:oi,i.push(t)}t.batch((()=>{r.forEach((s=>{$(t.dispatch(vc)).registerEntityAction("postType",e,s)})),i.forEach((s=>{$(t.dispatch(vc)).registerEntityField("postType",e,s)}))})),(0,h.doAction)("core.registerPostTypeSchema",e)};function Wl(e){return{type:"SET_CURRENT_TEMPLATE_ID",id:e}}const Zl=e=>async({select:t,dispatch:s,registry:n})=>{const o=await n.dispatch(u.store).saveEntityRecord("postType","wp_template",e);return n.dispatch(u.store).editEntityRecord("postType",t.getCurrentPostType(),t.getCurrentPostId(),{template:o.slug}),n.dispatch(_s.store).createSuccessNotice((0,fs.__)("Custom template created. You're in template mode now."),{type:"snackbar",actions:[{label:(0,fs.__)("Go back"),onClick:()=>s.setRenderingMode(t.getEditorSettings().defaultRenderingMode)}]}),o},Yl=e=>({registry:t})=>{const s=(t.select(C.store).get("core","hiddenBlockTypes")??[]).filter((t=>!(Array.isArray(e)?e:[e]).includes(t)));t.dispatch(C.store).set("core","hiddenBlockTypes",s)},ql=e=>({registry:t})=>{const s=t.select(C.store).get("core","hiddenBlockTypes")??[],n=new Set([...s,...Array.isArray(e)?e:[e]]);t.dispatch(C.store).set("core","hiddenBlockTypes",[...n])},Kl=({onSave:e,dirtyEntityRecords:t=[],entitiesToSkip:s=[],close:n}={})=>({registry:o})=>{const r=[{kind:"postType",name:"wp_navigation"}],i="site-editor-save-success",a=o.select(u.store).getEntityRecord("root","__unstableBase")?.home;o.dispatch(_s.store).removeNotice(i);const l=t.filter((({kind:e,name:t,key:n,property:o})=>!s.some((s=>s.kind===e&&s.name===t&&s.key===n&&s.property===o))));n?.(l);const c=[],d=[];l.forEach((({kind:e,name:t,key:s,property:n})=>{"root"===e&&"site"===t?c.push(n):(r.some((s=>s.kind===e&&s.name===t))&&o.dispatch(u.store).editEntityRecord(e,t,s,{status:"publish"}),d.push(o.dispatch(u.store).saveEditedEntityRecord(e,t,s)))})),c.length&&d.push(o.dispatch(u.store).__experimentalSaveSpecifiedEntityEdits("root","site",void 0,c)),o.dispatch(g.store).__unstableMarkLastChangeAsPersistent(),Promise.all(d).then((t=>e?e(t):t)).then((e=>{e.some((e=>void 0===e))?o.dispatch(_s.store).createErrorNotice((0,fs.__)("Saving failed.")):o.dispatch(_s.store).createSuccessNotice((0,fs.__)("Site updated."),{type:"snackbar",id:i,actions:[{label:(0,fs.__)("View site"),url:a,openInNewTab:!0}]})})).catch((e=>o.dispatch(_s.store).createErrorNotice(`${(0,fs.__)("Saving failed.")} ${e}`)))},Ql=(e,{allowUndo:t=!0}={})=>async({registry:s})=>{const n="edit-site-template-reverted";if(s.dispatch(_s.store).removeNotice(n),On(e))try{const o=s.select(u.store).getEntityConfig("postType",e.type);if(!o)return void s.dispatch(_s.store).createErrorNotice((0,fs.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});const r=(0,w.addQueryArgs)(`${o.baseURL}/${e.id}`,{context:"edit",source:e.origin}),i=await gs()({path:r});if(!i)return void s.dispatch(_s.store).createErrorNotice((0,fs.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});const a=({blocks:e=[]})=>(0,x.__unstableSerializeAndClean)(e),l=s.select(u.store).getEditedEntityRecord("postType",e.type,e.id);s.dispatch(u.store).editEntityRecord("postType",e.type,e.id,{content:a,blocks:l.blocks,source:"custom"},{undoIgnore:!0});const c=(0,x.parse)(i?.content?.raw);if(s.dispatch(u.store).editEntityRecord("postType",e.type,i.id,{content:a,blocks:c,source:"theme"}),t){const t=()=>{s.dispatch(u.store).editEntityRecord("postType",e.type,l.id,{content:a,blocks:l.blocks,source:"custom"})};s.dispatch(_s.store).createSuccessNotice((0,fs.__)("Template reset."),{type:"snackbar",id:n,actions:[{label:(0,fs.__)("Undo"),onClick:t}]})}}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,fs.__)("Template revert failed. Please reload.");s.dispatch(_s.store).createErrorNotice(t,{type:"snackbar"})}else s.dispatch(_s.store).createErrorNotice((0,fs.__)("This template is not revertable."),{type:"snackbar"})},Xl=e=>async({registry:t})=>{const s=e.every((e=>e?.has_theme_file)),n=await Promise.allSettled(e.map((e=>t.dispatch(u.store).deleteEntityRecord("postType",e.type,e.id,{force:!0},{throwOnError:!0}))));if(n.every((({status:e})=>"fulfilled"===e))){let n;if(1===e.length){let t;"string"==typeof e[0].title?t=e[0].title:"string"==typeof e[0].title?.rendered?t=e[0].title?.rendered:"string"==typeof e[0].title?.raw&&(t=e[0].title?.raw),n=s?(0,fs.sprintf)((0,fs.__)('"%s" reset.'),(0,Ln.decodeEntities)(t)):(0,fs.sprintf)((0,fs._x)('"%s" deleted.',"template part"),(0,Ln.decodeEntities)(t))}else n=s?(0,fs.__)("Items reset."):(0,fs.__)("Items deleted.");t.dispatch(_s.store).createSuccessNotice(n,{type:"snackbar",id:"editor-template-deleted-success"})}else{let e;if(1===n.length)e=n[0].reason?.message?n[0].reason.message:s?(0,fs.__)("An error occurred while reverting the item."):(0,fs.__)("An error occurred while deleting the item.");else{const t=new Set,o=n.filter((({status:e})=>"rejected"===e));for(const e of o)e.reason?.message&&t.add(e.reason.message);e=0===t.size?(0,fs.__)("An error occurred while deleting the items."):1===t.size?s?(0,fs.sprintf)((0,fs.__)("An error occurred while reverting the items: %s"),[...t][0]):(0,fs.sprintf)((0,fs.__)("An error occurred while deleting the items: %s"),[...t][0]):s?(0,fs.sprintf)((0,fs.__)("Some errors occurred while reverting the items: %s"),[...t].join(",")):(0,fs.sprintf)((0,fs.__)("Some errors occurred while deleting the items: %s"),[...t].join(","))}t.dispatch(_s.store).createErrorNotice(e,{type:"snackbar"})}},Jl=e=>({select:t,registry:s})=>{const n=t.getCurrentPostType(),o=s.select(u.store).getCurrentTheme()?.stylesheet,r=s.select(C.store).get("core","renderingModes")?.[o]??{};if(r[n]===e)return;const i={[o]:{...r,[n]:e}};s.dispatch(C.store).set("core","renderingModes",i)};function ec(e){return{type:"SET_CANVAS_MIN_HEIGHT",minHeight:e}}var tc=s(5215),sc=s.n(tc),nc=(0,c.jsx)(L.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(L.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"})}),oc=(0,c.jsx)(L.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(L.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"})});const rc=[];const ic={rootClientId:void 0,insertionIndex:void 0,filterValue:void 0},ac=["post-only","template-locked"],lc=(0,d.createRegistrySelector)((e=>(0,d.createSelector)((t=>{if("object"==typeof t.blockInserterPanel)return t.blockInserterPanel;if("template-locked"===st(t)){const[t]=e(g.store).getBlocksByName("core/post-content");if(t)return{rootClientId:t,insertionIndex:void 0,filterValue:void 0}}return ic}),(t=>{const[s]=e(g.store).getBlocksByName("core/post-content");return[t.blockInserterPanel,st(t),s]}))));function cc(e){return e.listViewToggleRef}function dc(e){return e.inserterSidebarToggleRef}const uc={wp_block:Ji,wp_navigation:nc,page:ea,post:oc},pc=(0,d.createRegistrySelector)((e=>(t,s,n)=>{{if("wp_template_part"===s||"wp_template"===s){const t=(e(u.store).getCurrentTheme()?.default_template_part_areas||[]).find((e=>n.area===e.area));return t?.icon?H(t.icon):W}if(uc[s])return uc[s];const t=e(u.store).getPostType(s);return"string"==typeof t?.icon&&t.icon.startsWith("dashicons-")?t.icon.slice(10):ea}})),mc=(0,d.createRegistrySelector)((e=>(t,s,n)=>{const{type:o,id:r}=ne(t),i=e(u.store).getEntityRecordNonTransientEdits("postType",s||o,n||r);if(!i?.meta)return!1;const a=e(u.store).getEntityRecord("postType",s||o,n||r)?.meta;return!sc()({...a,footnotes:void 0},{...i.meta,footnotes:void 0})}));function hc(e,...t){return function(e,t,s){return e.actions[t]?.[s]??rc}(e.dataviews,...t)}function gc(e,...t){return function(e,t,s){return e.isReady[t]?.[s]}(e.dataviews,...t)}function _c(e,...t){return function(e,t,s){return e.fields[t]?.[s]??rc}(e.dataviews,...t)}const fc=(0,d.createRegistrySelector)((e=>(0,d.createSelector)(((t,s)=>{s=Array.isArray(s)?s:[s];const{getBlocksByName:n,getBlockParents:o,getBlockName:r}=e(g.store);return n(s).filter((e=>o(e).every((e=>{const t=r(e);return"core/query"!==t&&!s.includes(t)}))))}),(()=>[e(g.store).getBlocks()])))),bc=(0,d.createRegistrySelector)((e=>(t,s)=>{const{getPostType:n,getCurrentTheme:o,hasFinishedResolution:r}=e(u.store),i=o(),a=n(s);if(!r("getPostType",[s])||!r("getCurrentTheme"))return;const l=i?.stylesheet,c=e(C.store).get("core","renderingModes")?.[l]?.[s],d=Array.isArray(a?.supports?.editor)?a.supports.editor.find((e=>"default-mode"in e))?.["default-mode"]:void 0,p=c||d;return ac.includes(p)?p:"post-only"}));function yc(e){return e.canvasMinHeight}const xc={reducer:y,selectors:e,actions:t},vc=(0,d.createReduxStore)("core/editor",{...xc});(0,d.register)(vc),$(vc).registerPrivateActions(a),$(vc).registerPrivateSelectors(l);function wc(e){const t=e.avatar_urls&&e.avatar_urls[24]?(0,c.jsx)("img",{className:"editor-autocompleters__user-avatar",alt:"",src:e.avatar_urls[24]}):(0,c.jsx)("span",{className:"editor-autocompleters__no-avatar"});return(0,c.jsxs)(c.Fragment,{children:[t,(0,c.jsx)("span",{className:"editor-autocompleters__user-name",children:e.name}),(0,c.jsx)("span",{className:"editor-autocompleters__user-slug",children:e.slug})]})}(0,h.addFilter)("blocks.registerBlockType","core/editor/custom-sources-backwards-compatibility/shim-attribute-source",(function(e){const t=Object.fromEntries(Object.entries(e.attributes??{}).filter((([,{source:e}])=>"meta"===e)).map((([e,{meta:t}])=>[e,t])));return Object.entries(t).length&&(e.edit=(e=>(0,m.createHigherOrderComponent)((t=>({attributes:s,setAttributes:n,...o})=>{const r=(0,d.useSelect)((e=>e(vc).getCurrentPostType()),[]),[i,a]=(0,u.useEntityProp)("postType",r,"meta"),l=(0,p.useMemo)((()=>({...s,...Object.fromEntries(Object.entries(e).map((([e,t])=>[e,i[t]])))})),[s,i]);return(0,c.jsx)(t,{attributes:l,setAttributes:t=>{const s=Object.fromEntries(Object.entries(t??{}).filter((([t])=>t in e)).map((([t,s])=>[e[t],s])));Object.entries(s).length&&a(s),n(t)},...o})}),"withMetaAttributeSource"))(t)(e.edit)),e}));var Sc={name:"users",className:"editor-autocompleters__user",triggerPrefix:"@",useItems(e){const t=(0,d.useSelect)((t=>{const{getUsers:s}=t(u.store);return s({context:"view",search:encodeURIComponent(e)})}),[e]);return[(0,p.useMemo)((()=>t?t.map((e=>({key:`user-${e.slug}`,value:e,label:wc(e)}))):[]),[t])]},getOptionCompletion:e=>`@${e.slug}`};(0,h.addFilter)("editor.Autocomplete.completers","editor/autocompleters/set-default-completers",(function(e=[]){return e.push({...Sc}),e})),(0,h.addFilter)("editor.MediaUpload","core/editor/components/media-upload",(()=>lr.MediaUpload));const{PatternOverridesControls:kc,ResetOverridesControl:Cc,PatternOverridesBlockControls:Pc,PATTERN_TYPES:jc,PARTIAL_SYNCING_SUPPORTED_BLOCKS:Ec,PATTERN_SYNC_TYPES:Tc}=$(ao.privateApis),Ic=(0,m.createHigherOrderComponent)((e=>t=>{const s=!!Ec[t.name];return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(e,{...t},"edit"),t.isSelected&&s&&(0,c.jsx)(Bc,{...t}),s&&(0,c.jsx)(Pc,{})]})}),"withPatternOverrideControls");function Bc(e){const t=(0,g.useBlockEditingMode)(),{hasPatternOverridesSource:s,isEditingSyncedPattern:n}=(0,d.useSelect)((e=>{const{getCurrentPostType:t,getEditedPostAttribute:s}=e(vc);return{hasPatternOverridesSource:!!(0,x.getBlockBindingsSource)("core/pattern-overrides"),isEditingSyncedPattern:t()===jc.user&&s("meta")?.wp_pattern_sync_status!==Tc.unsynced&&s("wp_pattern_sync_status")!==Tc.unsynced}}),[]),o=e.attributes.metadata?.bindings,r=!!o&&Object.values(o).some((e=>"core/pattern-overrides"===e.source)),i=n&&"default"===t,a=!n&&!!e.attributes.metadata?.name&&"disabled"!==t&&r;return s?(0,c.jsxs)(c.Fragment,{children:[i&&(0,c.jsx)(kc,{...e}),a&&(0,c.jsx)(Cc,{...e})]}):null}(0,h.addFilter)("editor.BlockEdit","core/editor/with-pattern-override-controls",Ic);const Nc=["core/navigation-link","core/navigation-submenu"];function Rc({attributes:e}){const{kind:t,id:s,type:n}=e,o=(0,g.useBlockEditingMode)(),r=(0,d.useSelect)((e=>e(g.store).getSettings().onNavigateToEntityRecord),[]),i=(0,p.useCallback)((()=>{"post-type"===t&&"page"===n&&s&&r&&r({postId:s,postType:n})}),[t,s,n,r]);return"post-type"===t&&"page"===n&&s&&r&&"contentOnly"===o?(0,c.jsx)(g.__unstableBlockToolbarLastItem,{children:(0,c.jsx)(Hn.ToolbarGroup,{children:(0,c.jsx)(Hn.ToolbarButton,{name:"view",title:(0,fs.__)("View"),onClick:i,children:(0,fs.__)("View")})})}):null}const Dc=(0,m.createHigherOrderComponent)((e=>t=>{const s=Nc.includes(t.name);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(e,{...t},"edit"),t.isSelected&&s&&(0,c.jsx)(Rc,{...t})]})}),"withNavigationViewButton");(0,h.addFilter)("editor.BlockEdit","core/editor/with-navigation-view-button",Dc);function Ac({clientId:e}){const{selectBlock:t,flashBlock:s}=(0,d.useDispatch)(g.store),{enableComplementaryArea:n}=(0,d.useDispatch)(ja),{hasNavigationBlocks:o,firstNavigationBlockId:r,isNavigationEditable:i}=(0,d.useSelect)((t=>{const{getClientIdsOfDescendants:s,getBlockName:n,getBlockEditingMode:o}=t(g.store),r=s(e).filter((e=>"core/navigation"===n(e))),i=r.length>0,a=i?r[0]:null;return{hasNavigationBlocks:i,firstNavigationBlockId:a,isNavigationEditable:"disabled"!==o(a)}}),[e]),a=(0,p.useCallback)((()=>{r&&(t(r),s(r,500),n("core","edit-post/block"))}),[r,t,s,n]);return o&&i?(0,c.jsx)(g.__unstableBlockToolbarLastItem,{children:(0,c.jsx)(Hn.ToolbarGroup,{children:(0,c.jsx)(Hn.ToolbarButton,{label:(0,fs.__)("Edit navigation"),onClick:a,children:(0,fs.__)("Edit navigation")})})}):null}const Mc=(0,m.createHigherOrderComponent)((e=>t=>{const s="core/template-part"===t.name;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(e,{...t},"edit"),t.isSelected&&s&&(0,c.jsx)(Ac,{clientId:t.clientId})]})}),"withTemplatePartNavigationEditButton");(0,h.addFilter)("editor.BlockEdit","core/editor/with-template-part-navigation-edit-button",Mc);class Lc extends p.Component{constructor(e){super(e),this.needsAutosave=!(!e.isDirty||!e.isAutosaveable)}componentDidMount(){this.props.disableIntervalChecks||this.setAutosaveTimer()}componentDidUpdate(e){this.props.disableIntervalChecks?this.props.editsReference!==e.editsReference&&this.props.autosave():(this.props.interval!==e.interval&&(clearTimeout(this.timerId),this.setAutosaveTimer()),this.props.isDirty&&(!this.props.isAutosaving||e.isAutosaving)?this.props.editsReference!==e.editsReference&&(this.needsAutosave=!0):this.needsAutosave=!1)}componentWillUnmount(){clearTimeout(this.timerId)}setAutosaveTimer(e=1e3*this.props.interval){this.timerId=setTimeout((()=>{this.autosaveTimerHandler()}),e)}autosaveTimerHandler(){this.props.isAutosaveable?(this.needsAutosave&&(this.needsAutosave=!1,this.props.autosave()),this.setAutosaveTimer()):this.setAutosaveTimer(1e3)}render(){return null}}var Oc=(0,m.compose)([(0,d.withSelect)(((e,t)=>{const{getReferenceByDistinctEdits:s}=e(u.store),{isEditedPostDirty:n,isEditedPostAutosaveable:o,isAutosavingPost:r,getEditorSettings:i}=e(vc),{interval:a=i().autosaveInterval}=t;return{editsReference:s(),isDirty:n(),isAutosaveable:o(),isAutosaving:r(),interval:a}})),(0,d.withDispatch)(((e,t)=>({autosave(){const{autosave:s=e(vc).autosave}=t;s()}})))])(Lc),Fc=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"})}),Vc=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"})});const Uc=window.wp.dom;function Hc(e){const{isFrontPage:t,isPostsPage:s}=(0,d.useSelect)((t=>{const{canUser:s,getEditedEntityRecord:n}=t(u.store),o=s("read",{kind:"root",name:"site"})?n("root","site"):void 0,r=parseInt(e,10);return{isFrontPage:o?.page_on_front===r,isPostsPage:o?.page_for_posts===r}}));return t?(0,fs.__)("Homepage"):!!s&&(0,fs.__)("Posts Page")}const zc=Hn.__unstableMotion.create(Hn.Button);function Gc(e){const{postId:t,postType:s,postTypeLabel:n,documentTitle:o,isNotFound:r,templateTitle:i,onNavigateToPreviousEntityRecord:a,isTemplatePreview:l}=(0,d.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s,getEditorSettings:n,getRenderingMode:o}=e(vc),{getEditedEntityRecord:r,getPostType:i,getCurrentTheme:a,isResolving:l}=e(u.store),c=t(),d=s(),p=r("postType",c,d),{default_template_types:m=[]}=a()??{},h=Y({templateTypes:m,template:p}),g=i(c)?.labels?.singular_name;return{postId:d,postType:c,postTypeLabel:g,documentTitle:p.title,isNotFound:!p&&!l("getEditedEntityRecord","postType",c,d),templateTitle:h.title,onNavigateToPreviousEntityRecord:n().onNavigateToPreviousEntityRecord,isTemplatePreview:"template-locked"===o()}}),[]),{open:h}=(0,d.useDispatch)(na.store),_=(0,m.useReducedMotion)(),f=A.includes(s),b=!!a,y=f?i:o,x=e.title||y,v=e.icon,w=Hc(t),S=(0,p.useRef)(!1);return(0,p.useEffect)((()=>{S.current=!0}),[]),(0,c.jsxs)("div",{className:mr("editor-document-bar",{"has-back-button":b}),children:[(0,c.jsx)(Hn.__unstableAnimatePresence,{children:b&&(0,c.jsx)(zc,{className:"editor-document-bar__back",icon:(0,fs.isRTL)()?Fc:Vc,onClick:e=>{e.stopPropagation(),a()},size:"compact",initial:!!S.current&&{opacity:0,transform:"translateX(15%)"},animate:{opacity:1,transform:"translateX(0%)"},exit:{opacity:0,transform:"translateX(15%)"},transition:_?{duration:0}:void 0,children:(0,fs.__)("Back")})}),!f&&l&&!b&&(0,c.jsx)(g.BlockIcon,{icon:W,className:"editor-document-bar__icon-layout"}),r?(0,c.jsx)(Hn.__experimentalText,{children:(0,fs.__)("Document not found")}):(0,c.jsxs)(Hn.Button,{className:"editor-document-bar__command",onClick:()=>h(),size:"compact",children:[(0,c.jsxs)(Hn.__unstableMotion.div,{className:"editor-document-bar__title",initial:!!S.current&&{opacity:0,transform:b?"translateX(15%)":"translateX(-15%)"},animate:{opacity:1,transform:"translateX(0%)"},transition:_?{duration:0}:void 0,children:[v&&(0,c.jsx)(g.BlockIcon,{icon:v}),(0,c.jsxs)(Hn.__experimentalText,{size:"body",as:"h1",children:[(0,c.jsx)("span",{className:"editor-document-bar__post-title",children:x?(0,Uc.__unstableStripHTML)(x):(0,fs.__)("No title")}),w&&(0,c.jsx)("span",{className:"editor-document-bar__post-type-label",children:`· ${w}`}),n&&!e.title&&!w&&(0,c.jsx)("span",{className:"editor-document-bar__post-type-label",children:`· ${(0,Ln.decodeEntities)(n)}`})]})]},b),(0,c.jsx)("span",{className:"editor-document-bar__shortcut",children:ll.displayShortcut.primary("k")})]})]})}const $c=window.wp.richText;var Wc=({children:e,isValid:t,isDisabled:s,level:n,href:o,onSelect:r})=>(0,c.jsx)("li",{className:mr("document-outline__item",`is-${n.toLowerCase()}`,{"is-invalid":!t,"is-disabled":s}),children:(0,c.jsxs)("a",{href:o,className:"document-outline__button","aria-disabled":s,onClick:function(e){s?e.preventDefault():r()},children:[(0,c.jsx)("span",{className:"document-outline__emdash","aria-hidden":"true"}),(0,c.jsx)("strong",{className:"document-outline__level",children:n}),(0,c.jsx)("span",{className:"document-outline__item-content",children:e})]})});const Zc=(0,c.jsx)("em",{children:(0,fs.__)("(Empty heading)")}),Yc=[(0,c.jsx)("br",{},"incorrect-break"),(0,c.jsx)("em",{children:(0,fs.__)("(Incorrect heading level)")},"incorrect-message")],qc=[(0,c.jsx)("br",{},"incorrect-break-h1"),(0,c.jsx)("em",{children:(0,fs.__)("(Your theme may already use a H1 for the post title)")},"incorrect-message-h1")],Kc=[(0,c.jsx)("br",{},"incorrect-break-multiple-h1"),(0,c.jsx)("em",{children:(0,fs.__)("(Multiple H1 headings are not recommended)")},"incorrect-message-multiple-h1")];function Qc(){return(0,c.jsxs)(Hn.SVG,{width:"138",height:"148",viewBox:"0 0 138 148",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,c.jsx)(Hn.Rect,{width:"138",height:"148",rx:"4",fill:"#F0F6FC"}),(0,c.jsx)(Hn.Line,{x1:"44",y1:"28",x2:"24",y2:"28",stroke:"#DDDDDD"}),(0,c.jsx)(Hn.Rect,{x:"48",y:"16",width:"27",height:"23",rx:"4",fill:"#DDDDDD"}),(0,c.jsx)(Hn.Path,{d:"M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z",fill:"black"}),(0,c.jsx)(Hn.Line,{x1:"55",y1:"59",x2:"24",y2:"59",stroke:"#DDDDDD"}),(0,c.jsx)(Hn.Rect,{x:"59",y:"47",width:"29",height:"23",rx:"4",fill:"#DDDDDD"}),(0,c.jsx)(Hn.Path,{d:"M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z",fill:"black"}),(0,c.jsx)(Hn.Line,{x1:"80",y1:"90",x2:"24",y2:"90",stroke:"#DDDDDD"}),(0,c.jsx)(Hn.Rect,{x:"84",y:"78",width:"30",height:"23",rx:"4",fill:"#F0B849"}),(0,c.jsx)(Hn.Path,{d:"M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z",fill:"black"}),(0,c.jsx)(Hn.Line,{x1:"66",y1:"121",x2:"24",y2:"121",stroke:"#DDDDDD"}),(0,c.jsx)(Hn.Rect,{x:"70",y:"109",width:"29",height:"23",rx:"4",fill:"#DDDDDD"}),(0,c.jsx)(Hn.Path,{d:"M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z",fill:"black"})]})}const Xc=(e=[])=>e.filter((e=>"core/heading"===e.name)).map((e=>({...e,level:e.attributes.level,isEmpty:Jc(e)}))),Jc=e=>!e.attributes.content||0===e.attributes.content.trim().length;function ed({onSelect:e,hasOutlineItemsDisabled:t}){const{selectBlock:s}=(0,d.useDispatch)(g.store),{title:n,isTitleSupported:o}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t}=e(vc),{getPostType:s}=e(u.store),n=s(t("type"));return{title:t("title"),isTitleSupported:n?.supports?.title??!1}})),r=(0,d.useSelect)((e=>{const{getClientIdsWithDescendants:t,getBlock:s}=e(g.store);return t().map((e=>s(e)))})),i=(0,d.useSelect)((e=>{if("post-only"===e(vc).getRenderingMode())return;const{getBlocksByName:t,getClientIdsOfDescendants:s}=e(g.store),[n]=t("core/post-content");return n?s(n):void 0}),[]),a=(0,p.useRef)(1),l=(0,p.useMemo)((()=>Xc(r)),[r]);if(l.length<1)return(0,c.jsxs)("div",{className:"editor-document-outline has-no-headings",children:[(0,c.jsx)(Qc,{}),(0,c.jsx)("p",{children:(0,fs.__)("Navigate the structure of your document and address issues like empty or incorrect heading levels.")})]});const m=document.querySelector(".editor-post-title__input"),h=o&&n&&m,_=l.reduce(((e,t)=>({...e,[t.level]:(e[t.level]||0)+1})),{})[1]>1;return(0,c.jsx)("div",{className:"document-outline",children:(0,c.jsxs)("ul",{children:[h&&(0,c.jsx)(Wc,{level:(0,fs.__)("Title"),isValid:!0,onSelect:e,href:`#${m.id}`,isDisabled:t,children:n}),l.map((n=>{const o=n.level>a.current+1,r=!(n.isEmpty||o||!n.level||1===n.level&&(_||h));return a.current=n.level,(0,c.jsxs)(Wc,{level:`H${n.level}`,isValid:r,isDisabled:t||(l=n.clientId,!(!Array.isArray(i)||i.includes(l))),href:`#block-${n.clientId}`,onSelect:()=>{s(n.clientId),e?.()},children:[n.isEmpty?Zc:(0,$c.getTextContent)((0,$c.create)({html:n.attributes.content})),o&&Yc,1===n.level&&_&&Kc,h&&1===n.level&&!_&&qc]},n.clientId);var l}))]})})}function td({children:e}){const t=(0,d.useSelect)((e=>{const{getGlobalBlockCount:t}=e(g.store);return t("core/heading")>0}));return t?e:null}var sd=function(){const{registerShortcut:e}=(0,d.useDispatch)(il.store);return(0,p.useEffect)((()=>{e({name:"core/editor/toggle-mode",category:"global",description:(0,fs.__)("Switch between visual editor and code editor."),keyCombination:{modifier:"secondary",character:"m"}}),e({name:"core/editor/save",category:"global",description:(0,fs.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/editor/undo",category:"global",description:(0,fs.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/editor/redo",category:"global",description:(0,fs.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"},aliases:(0,ll.isAppleOS)()?[]:[{modifier:"primary",character:"y"}]}),e({name:"core/editor/toggle-list-view",category:"global",description:(0,fs.__)("Show or hide the List View."),keyCombination:{modifier:"access",character:"o"}}),e({name:"core/editor/toggle-distraction-free",category:"global",description:(0,fs.__)("Enter or exit distraction free mode."),keyCombination:{modifier:"primaryShift",character:"\\"}}),e({name:"core/editor/toggle-sidebar",category:"global",description:(0,fs.__)("Show or hide the Settings panel."),keyCombination:{modifier:"primaryShift",character:","}}),e({name:"core/editor/keyboard-shortcuts",category:"main",description:(0,fs.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/editor/next-region",category:"global",description:(0,fs.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),e({name:"core/editor/previous-region",category:"global",description:(0,fs.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"},{modifier:"ctrlShift",character:"~"}]})}),[e]),(0,c.jsx)(g.BlockEditorKeyboardShortcuts.Register,{})},nd=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"})}),od=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"})});var rd=(0,p.forwardRef)((function(e,t){const s=(0,ll.isAppleOS)()?ll.displayShortcut.primaryShift("z"):ll.displayShortcut.primary("y"),n=(0,d.useSelect)((e=>e(vc).hasEditorRedo()),[]),{redo:o}=(0,d.useDispatch)(vc);return(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,...e,ref:t,icon:(0,fs.isRTL)()?od:nd,label:(0,fs.__)("Redo"),shortcut:s,"aria-disabled":!n,onClick:n?o:void 0,className:"editor-history__redo"})}));var id=(0,p.forwardRef)((function(e,t){const s=(0,d.useSelect)((e=>e(vc).hasEditorUndo()),[]),{undo:n}=(0,d.useDispatch)(vc);return(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,...e,ref:t,icon:(0,fs.isRTL)()?nd:od,label:(0,fs.__)("Undo"),shortcut:ll.displayShortcut.primary("z"),"aria-disabled":!s,onClick:s?n:void 0,className:"editor-history__undo"})}));function ad(){const[e,t]=(0,p.useState)(!1),s=(0,d.useSelect)((e=>e(g.store).isValidTemplate()),[]),{setTemplateValidity:n,synchronizeTemplate:o}=(0,d.useDispatch)(g.store);return s?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.Notice,{className:"editor-template-validation-notice",isDismissible:!1,status:"warning",actions:[{label:(0,fs.__)("Keep it as is"),onClick:()=>n(!0)},{label:(0,fs.__)("Reset the template"),onClick:()=>t(!0)}],children:(0,fs.__)("The content of your post doesn’t match the template assigned to your post type.")}),(0,c.jsx)(Hn.__experimentalConfirmDialog,{isOpen:e,confirmButtonText:(0,fs.__)("Reset"),onConfirm:()=>{t(!1),o()},onCancel:()=>t(!1),size:"medium",children:(0,fs.__)("Resetting the template may result in loss of content, do you want to continue?")})]})}var ld=function(){const{notices:e}=(0,d.useSelect)((e=>({notices:e(_s.store).getNotices()})),[]),{removeNotice:t}=(0,d.useDispatch)(_s.store),s=e.filter((({isDismissible:e,type:t})=>e&&"default"===t)),n=e.filter((({isDismissible:e,type:t})=>!e&&"default"===t));return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.NoticeList,{notices:n,className:"components-editor-notices__pinned"}),(0,c.jsx)(Hn.NoticeList,{notices:s,className:"components-editor-notices__dismissible",onRemove:t,children:(0,c.jsx)(ad,{})})]})};const cd=-3;function dd(){const e=(0,d.useSelect)((e=>e(_s.store).getNotices()),[]),{removeNotice:t}=(0,d.useDispatch)(_s.store),s=e.filter((({type:e})=>"snackbar"===e)).slice(cd);return(0,c.jsx)(Hn.SnackbarList,{notices:s,className:"components-editor-notices__snackbar",onRemove:t})}function ud({record:e,checked:t,onChange:s}){const{name:n,kind:o,title:r,key:i}=e,{entityRecordTitle:a,hasPostMetaChanges:l}=(0,d.useSelect)((e=>{if("postType"!==o||"wp_template"!==n)return{entityRecordTitle:r,hasPostMetaChanges:$(e(vc)).hasPostMetaChanges(n,i)};const t=e(u.store).getEditedEntityRecord(o,n,i),{default_template_types:s=[]}=e(u.store).getCurrentTheme()??{};return{entityRecordTitle:Y({template:t,templateTypes:s}).title,hasPostMetaChanges:$(e(vc)).hasPostMetaChanges(n,i)}}),[n,o,r,i]);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.PanelRow,{children:(0,c.jsx)(Hn.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,Ln.decodeEntities)(a)||(0,fs.__)("Untitled"),checked:t,onChange:s,className:"entities-saved-states__change-control"})}),l&&(0,c.jsx)("ul",{className:"entities-saved-states__changes",children:(0,c.jsx)("li",{children:(0,fs.__)("Post Meta.")})})]})}const{getGlobalStylesChanges:pd,GlobalStylesContext:md}=$(g.privateApis);function hd({record:e}){const{user:t}=(0,p.useContext)(md),s=(0,d.useSelect)((t=>t(u.store).getEntityRecord(e.kind,e.name,e.key)),[e.kind,e.name,e.key]),n=pd(t,s,{maxResults:10});return n.length?(0,c.jsx)("ul",{className:"entities-saved-states__changes",children:n.map((e=>(0,c.jsx)("li",{children:e},e)))}):null}function gd({record:e,count:t}){if("globalStyles"===e?.name)return null;const s=function(e,t){switch(e){case"site":return 1===t?(0,fs.__)("This change will affect your whole site."):(0,fs.__)("These changes will affect your whole site.");case"wp_template":return(0,fs.__)("This change will affect other parts of your site that use this template.");case"page":case"post":return(0,fs.__)("The following has been modified.")}}(e?.name,t);return s?(0,c.jsx)(Hn.PanelRow,{children:s}):null}function _d({list:e,unselectedEntities:t,setUnselectedEntities:s}){const n=e.length,o=e[0];let r=(0,d.useSelect)((e=>e(u.store).getEntityConfig(o.kind,o.name)),[o.kind,o.name]).label;return"wp_template_part"===o?.name&&(r=1===n?(0,fs.__)("Template Part"):(0,fs.__)("Template Parts")),(0,c.jsxs)(Hn.PanelBody,{title:r,initialOpen:!0,className:"entities-saved-states__panel-body",children:[(0,c.jsx)(gd,{record:o,count:n}),e.map((e=>(0,c.jsx)(ud,{record:e,checked:!t.some((t=>t.kind===e.kind&&t.name===e.name&&t.key===e.key&&t.property===e.property)),onChange:t=>s(e,t)},e.key||e.property))),"globalStyles"===o?.name&&(0,c.jsx)(hd,{record:o})]})}const fd=()=>{const{editedEntities:e,siteEdits:t,siteEntityConfig:s}=(0,d.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,getEntityRecordEdits:s,getEntityConfig:n}=e(u.store);return{editedEntities:t(),siteEdits:s("root","site"),siteEntityConfig:n("root","site")}}),[]),n=(0,p.useMemo)((()=>{const n=e.filter((e=>!("root"===e.kind&&"site"===e.name))),o=s?.meta?.labels??{},r=[];for(const e in t)r.push({kind:"root",name:"site",title:o[e]||e,property:e});return[...n,...r]}),[e,t,s]),[o,r]=(0,p.useState)([]);return{dirtyEntityRecords:n,isDirty:n.length-o.length>0,setUnselectedEntities:({kind:e,name:t,key:s,property:n},i)=>{r(i?o.filter((o=>o.kind!==e||o.name!==t||o.key!==s||o.property!==n)):[...o,{kind:e,name:t,key:s,property:n}])},unselectedEntities:o}};function bd(e){return e}function yd({close:e,renderDialog:t,variant:s}){const n=fd();return(0,c.jsx)(xd,{close:e,renderDialog:t,variant:s,...n})}function xd({additionalPrompt:e,close:t,onSave:s=bd,saveEnabled:n,saveLabel:o=(0,fs.__)("Save"),renderDialog:r,dirtyEntityRecords:i,isDirty:a,setUnselectedEntities:l,unselectedEntities:u,variant:h="default"}){const g=(0,p.useRef)(),{saveDirtyEntities:_}=$((0,d.useDispatch)(vc)),f=i.reduce(((e,t)=>{const{name:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e}),{}),{site:b,wp_template:y,wp_template_part:x,...v}=f,w=[b,y,x,...Object.values(v)].filter(Array.isArray),S=n??a,k=(0,p.useCallback)((()=>t()),[t]),[C,P]=(0,m.__experimentalUseDialog)({onClose:()=>k()}),j=(0,m.useInstanceId)(xd,"entities-saved-states__panel-label"),E=(0,m.useInstanceId)(xd,"entities-saved-states__panel-description"),T=i.length?(0,fs.__)("Select the items you want to save."):void 0,I="inline"===h,B=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.FlexItem,{isBlock:!I,as:Hn.Button,variant:I?"tertiary":"secondary",size:I?void 0:"compact",onClick:k,children:(0,fs.__)("Cancel")}),(0,c.jsx)(Hn.FlexItem,{isBlock:!I,as:Hn.Button,ref:g,variant:"primary",size:I?void 0:"compact",disabled:!S,accessibleWhenDisabled:!0,onClick:()=>_({onSave:s,dirtyEntityRecords:i,entitiesToSkip:u,close:t}),className:"editor-entities-saved-states__save-button",children:o})]});return(0,c.jsxs)("div",{ref:r?C:void 0,...r&&P,className:mr("entities-saved-states__panel",{"is-inline":I}),role:r?"dialog":void 0,"aria-labelledby":r?j:void 0,"aria-describedby":r?E:void 0,children:[!I&&(0,c.jsx)(Hn.Flex,{className:"entities-saved-states__panel-header",gap:2,children:B}),(0,c.jsxs)("div",{className:"entities-saved-states__text-prompt",children:[(0,c.jsx)("div",{className:"entities-saved-states__text-prompt--header-wrapper",children:(0,c.jsx)("strong",{id:r?j:void 0,className:"entities-saved-states__text-prompt--header",children:(0,fs.__)("Are you ready to save?")})}),(0,c.jsxs)("div",{id:r?E:void 0,children:[e,(0,c.jsx)("p",{className:"entities-saved-states__text-prompt--changes-count",children:a?(0,p.createInterpolateElement)((0,fs.sprintf)((0,fs._n)("There is <strong>%d site change</strong> waiting to be saved.","There are <strong>%d site changes</strong> waiting to be saved.",i.length),i.length),{strong:(0,c.jsx)("strong",{})}):T})]})]}),w.map((e=>(0,c.jsx)(_d,{list:e,unselectedEntities:u,setUnselectedEntities:l},e[0].name))),I&&(0,c.jsx)(Hn.Flex,{direction:"row",justify:"flex-end",className:"entities-saved-states__panel-footer",children:B})]})}function vd(){try{return(0,d.select)(vc).getEditedPostContent()}catch(e){}}function wd({text:e,children:t,variant:s="secondary"}){const n=(0,m.useCopyToClipboard)(e);return(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:s,ref:n,children:t})}class Sd extends p.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){(0,h.doAction)("editor.ErrorBoundary.errorLogged",e)}static getDerivedStateFromError(e){return{error:e}}render(){const{error:e}=this.state,{canCopyContent:t=!1}=this.props;return e?(0,c.jsxs)(Hn.__experimentalHStack,{className:"editor-error-boundary",alignment:"baseline",spacing:4,justify:"space-between",expanded:!1,wrap:!0,children:[(0,c.jsx)(Hn.__experimentalText,{as:"p",children:(0,fs.__)("The editor has encountered an unexpected error.")}),(0,c.jsxs)(Hn.__experimentalHStack,{expanded:!1,children:[t&&(0,c.jsx)(wd,{text:vd,children:(0,fs.__)("Copy contents")}),(0,c.jsx)(wd,{variant:"primary",text:e?.stack,children:(0,fs.__)("Copy error")})]})]}):this.props.children}}var kd=Sd;const Cd=window.requestIdleCallback?window.requestIdleCallback:window.requestAnimationFrame;let Pd;function jd(){const{postId:e,isEditedPostNew:t,hasRemoteAutosave:s}=(0,d.useSelect)((e=>({postId:e(vc).getCurrentPostId(),isEditedPostNew:e(vc).isEditedPostNew(),hasRemoteAutosave:!!e(vc).getEditorSettings().autosave})),[]),{getEditedPostAttribute:n}=(0,d.useSelect)(vc),{createWarningNotice:o,removeNotice:r}=(0,d.useDispatch)(_s.store),{editPost:i,resetEditorBlocks:a}=(0,d.useDispatch)(vc);(0,p.useEffect)((()=>{let l=function(e,t){return window.sessionStorage.getItem(bs(e,t))}(e,t);if(!l)return;try{l=JSON.parse(l)}catch{return}const{post_title:c,content:d,excerpt:u}=l,p={title:c,content:d,excerpt:u};if(!Object.keys(p).some((e=>p[e]!==n(e))))return void ys(e,t);if(s)return;const m="wpEditorAutosaveRestore";o((0,fs.__)("The backup of this post in your browser is different from the version below."),{id:m,actions:[{label:(0,fs.__)("Restore the backup"),onClick(){const{content:e,...t}=p;i(t),a((0,x.parse)(p.content)),r(m)}}]})}),[t,e])}var Ed=(0,m.ifCondition)((()=>{if(void 0!==Pd)return Pd;try{window.sessionStorage.setItem("__wpEditorTestSessionStorage",""),window.sessionStorage.removeItem("__wpEditorTestSessionStorage"),Pd=!0}catch{Pd=!1}return Pd}))((function(){const{autosave:e}=(0,d.useDispatch)(vc),t=(0,p.useCallback)((()=>{Cd((()=>e({local:!0})))}),[]);jd(),function(){const{postId:e,isEditedPostNew:t,isDirty:s,isAutosaving:n,didError:o}=(0,d.useSelect)((e=>({postId:e(vc).getCurrentPostId(),isEditedPostNew:e(vc).isEditedPostNew(),isDirty:e(vc).isEditedPostDirty(),isAutosaving:e(vc).isAutosavingPost(),didError:e(vc).didPostSaveRequestFail()})),[]),r=(0,p.useRef)(s),i=(0,p.useRef)(n);(0,p.useEffect)((()=>{!o&&(i.current&&!n||r.current&&!s)&&ys(e,t),r.current=s,i.current=n}),[s,n,o]);const a=(0,m.usePrevious)(t),l=(0,m.usePrevious)(e);(0,p.useEffect)((()=>{l===e&&a&&!t&&ys(e,!0)}),[t,e])}();const s=(0,d.useSelect)((e=>e(vc).getEditorSettings().localAutosaveInterval),[]);return(0,c.jsx)(Oc,{interval:s,autosave:t})}));var Td=function({children:e}){const t=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t}=e(vc),{getPostType:s}=e(u.store),n=s(t("type"));return!!n?.supports?.["page-attributes"]}),[]);return t?e:null};var Id=function({children:e,supportKeys:t}){const s=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t}=e(vc),{getPostType:s}=e(u.store);return s(t("type"))}),[]);let n=!!s;return s&&(n=(Array.isArray(t)?t:[t]).some((e=>function(e={},t){if(void 0!==e[t])return!!e[t];const[s,n]=t.split("."),[o]=Array.isArray(e[s])?e[s]:[];return Array.isArray(o)?o.includes(n):!!o?.[n]}(s.supports,e)))),n?e:null};function Bd(){const e=(0,d.useSelect)((e=>e(vc).getEditedPostAttribute("menu_order")??0),[]),{editPost:t}=(0,d.useDispatch)(vc),[s,n]=(0,p.useState)(null),o=s??e;return(0,c.jsx)(Hn.Flex,{children:(0,c.jsx)(Hn.FlexBlock,{children:(0,c.jsx)(Hn.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,fs.__)("Order"),help:(0,fs.__)("Set the page order."),value:o,onChange:e=>{n(e);const s=Number(e);Number.isInteger(s)&&""!==e.trim?.()&&t({menu_order:s})},hideLabelFromVision:!0,onBlur:()=>{n(null)}})})})}function Nd(){return(0,c.jsx)(Id,{supportKeys:"page-attributes",children:(0,c.jsx)(Bd,{})})}var Rd=(0,p.forwardRef)((({className:e,label:t,children:s},n)=>(0,c.jsxs)(Hn.__experimentalHStack,{className:mr("editor-post-panel__row",e),ref:n,children:[t&&(0,c.jsx)("div",{className:"editor-post-panel__row-label",children:t}),(0,c.jsx)("div",{className:"editor-post-panel__row-control",children:s})]})));function Dd(e){const t=e.map((e=>({children:[],parent:void 0,...e})));if(t.some((({parent:e})=>void 0===e)))return t;const s=t.reduce(((e,t)=>{const{parent:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e}),{}),n=e=>e.map((e=>{const t=s[e.id];return{...e,children:t&&t.length?n(t):[]}}));return n(s[0]||[])}const Ad=e=>(0,Ln.decodeEntities)(e),Md=e=>({...e,name:Ad(e.name)}),Ld=e=>(e??[]).map(Md);function Od(e){return e?.title?.rendered?(0,Ln.decodeEntities)(e.title.rendered):`#${e.id} (${(0,fs.__)("no title")})`}const Fd=(e,t)=>{const s=Mr()(e||"").toLowerCase(),n=Mr()(t||"").toLowerCase();return s===n?0:s.startsWith(n)?s.length:1/0};function Vd(){const{editPost:e}=(0,d.useDispatch)(vc),[t,s]=(0,p.useState)(!1),{isHierarchical:n,parentPostId:o,parentPostTitle:r,pageItems:i,isLoading:a}=(0,d.useSelect)((e=>{const{getPostType:s,getEntityRecords:n,getEntityRecord:o,isResolving:r}=e(u.store),{getCurrentPostId:i,getEditedPostAttribute:a}=e(vc),l=a("type"),c=a("parent"),d=s(l),p=i(),m=d?.hierarchical??!1,h={per_page:100,exclude:p,parent_exclude:p,orderby:"menu_order",order:"asc",_fields:"id,title,parent"};t&&(h.search=t);const g=c?o("postType",l,c):null;return{isHierarchical:m,parentPostId:c,parentPostTitle:g?Od(g):"",pageItems:m?n("postType",l,h):null,isLoading:!!m&&r("getEntityRecords",["postType",l,h])}}),[t]),l=(0,p.useMemo)((()=>{const e=(s,n=0)=>{const o=s.map((t=>[{value:t.id,label:"— ".repeat(n)+(0,Ln.decodeEntities)(t.name),rawName:t.name},...e(t.children||[],n+1)])).sort((([e],[s])=>Fd(e.rawName,t)>=Fd(s.rawName,t)?1:-1));return o.flat()};if(!i)return[];let s=i.map((e=>({id:e.id,parent:e.parent,name:Od(e)})));t||(s=Dd(s));const n=e(s),a=n.find((e=>e.value===o));return r&&!a&&n.unshift({value:o,label:r}),n}),[i,t,r,o]);if(!n)return null;return(0,c.jsx)(Hn.ComboboxControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,className:"editor-page-attributes__parent",label:(0,fs.__)("Parent"),help:(0,fs.__)("Choose a parent page."),value:o,options:l,onFilterValueChange:(0,m.debounce)((e=>{s(e)}),300),onChange:t=>{e({parent:t})},hideLabelFromVision:!0,isLoading:a})}function Ud({isOpen:e,onClick:t}){const s=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t}=e(vc),s=t("parent");if(!s)return null;const{getEntityRecord:n}=e(u.store);return n("postType",t("type"),s)}),[]),n=(0,p.useMemo)((()=>s?Od(s):(0,fs.__)("None")),[s]);return(0,c.jsx)(Hn.Button,{size:"compact",className:"editor-post-parent__panel-toggle",variant:"tertiary","aria-expanded":e,"aria-label":(0,fs.sprintf)((0,fs.__)("Change parent: %s"),n),onClick:t,children:n})}function Hd(){const e=(0,d.useSelect)((e=>e(u.store).getEntityRecord("root","__unstableBase")?.home),[]),[t,s]=(0,p.useState)(null),n=(0,p.useMemo)((()=>({anchor:t,placement:"left-start",offset:36,shift:!0})),[t]);return(0,c.jsx)(Rd,{label:(0,fs.__)("Parent"),ref:s,children:(0,c.jsx)(Hn.Dropdown,{popoverProps:n,className:"editor-post-parent__panel-dropdown",contentClassName:"editor-post-parent__panel-dialog",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,c.jsx)(Ud,{isOpen:e,onClick:t}),renderContent:({onClose:t})=>(0,c.jsxs)("div",{className:"editor-post-parent",children:[(0,c.jsx)(g.__experimentalInspectorPopoverHeader,{title:(0,fs.__)("Parent"),onClose:t}),(0,c.jsxs)("div",{children:[(0,p.createInterpolateElement)((0,fs.sprintf)((0,fs.__)('Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %s<wbr />/services<wbr />/pricing.'),(0,w.filterURLForDisplay)(e).replace(/([/.])/g,"<wbr />$1")),{wbr:(0,c.jsx)("wbr",{})}),(0,c.jsx)("p",{children:(0,p.createInterpolateElement)((0,fs.__)("They also show up as sub-items in the default navigation menu. <a>Learn more.</a>"),{a:(0,c.jsx)(Hn.ExternalLink,{href:(0,fs.__)("https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes")})})})]}),(0,c.jsx)(Vd,{})]})})})}var zd=Vd;const Gd="page-attributes";function $d(){const{isEnabled:e,postType:t}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t,isEditorPanelEnabled:s}=e(vc),{getPostType:n}=e(u.store);return{isEnabled:s(Gd),postType:n(t("type"))}}),[]);return e&&t?(0,c.jsx)(Hd,{}):null}function Wd(){return(0,c.jsx)(Td,{children:(0,c.jsx)($d,{})})}var Zd=(0,c.jsx)(L.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z"})});const Yd=(0,fs.__)("Custom Template");function qd({onClose:e}){const{defaultBlockTemplate:t,onNavigateToEntityRecord:s}=(0,d.useSelect)((e=>{const{getEditorSettings:t,getCurrentTemplateId:s}=e(vc);return{defaultBlockTemplate:t().defaultBlockTemplate,onNavigateToEntityRecord:t().onNavigateToEntityRecord,getTemplateId:s}})),{createTemplate:n}=$((0,d.useDispatch)(vc)),[o,r]=(0,p.useState)(""),[i,a]=(0,p.useState)(!1),l=()=>{r(""),e()};return(0,c.jsx)(Hn.Modal,{title:(0,fs.__)("Create custom template"),onRequestClose:l,focusOnMount:"firstContentElement",size:"small",overlayClassName:"editor-post-template__create-template-modal",children:(0,c.jsx)("form",{className:"editor-post-template__create-form",onSubmit:async e=>{if(e.preventDefault(),i)return;a(!0);const r=t??(0,x.serialize)([(0,x.createBlock)("core/group",{tagName:"header",layout:{inherit:!0}},[(0,x.createBlock)("core/site-title"),(0,x.createBlock)("core/site-tagline")]),(0,x.createBlock)("core/separator"),(0,x.createBlock)("core/group",{tagName:"main"},[(0,x.createBlock)("core/group",{layout:{inherit:!0}},[(0,x.createBlock)("core/post-title")]),(0,x.createBlock)("core/post-content",{layout:{inherit:!0}})])]),c=await n({slug:Kn(o||Yd)||"wp-custom-template",content:r,title:o||Yd});a(!1),s({postId:c.id,postType:"wp_template"}),l()},children:(0,c.jsxs)(Hn.__experimentalVStack,{spacing:"3",children:[(0,c.jsx)(Hn.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,fs.__)("Name"),value:o,onChange:r,placeholder:Yd,disabled:i,help:(0,fs.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')}),(0,c.jsxs)(Hn.__experimentalHStack,{justify:"right",children:[(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:l,children:(0,fs.__)("Cancel")}),(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",isBusy:i,"aria-disabled":i,children:(0,fs.__)("Create")})]})]})})})}function Kd(){return(0,d.useSelect)((e=>{const{getCurrentPostId:t,getCurrentPostType:s}=e(vc);return{postId:t(),postType:s()}}),[])}function Qd(){const{postType:e,postId:t}=Kd();return(0,d.useSelect)((s=>{const{canUser:n,getEntityRecord:o,getEntityRecords:r}=s(u.store),i=n("read",{kind:"root",name:"site"})?o("root","site"):void 0,a=+t===i?.page_for_posts,l="page"===e&&+t===i?.page_on_front,c=l?r("postType","wp_template",{per_page:-1}):[],d=l&&!!c?.some((({slug:e})=>"front-page"===e));return!a&&!d}),[t,e])}function Xd(e){return(0,d.useSelect)((t=>t(u.store).getEntityRecords("postType","wp_template",{per_page:-1,post_type:e})),[e])}function Jd(e){const t=eu(),s=Qd(),n=Xd(e);return(0,p.useMemo)((()=>s&&n?.filter((e=>e.is_custom&&e.slug!==t&&!!e.content.raw))),[n,t,s])}function eu(){const{postType:e,postId:t}=Kd(),s=Xd(e),n=(0,d.useSelect)((s=>{const n=s(u.store).getEditedEntityRecord("postType",e,t);return n?.template}),[e,t]);if(n)return s?.find((e=>e.slug===n))?.slug}function tu({isOpen:e,onClick:t}){const s=(0,d.useSelect)((e=>{const t=e(vc).getEditedPostAttribute("template"),{supportsTemplateMode:s,availableTemplates:n}=e(vc).getEditorSettings();if(!s&&n[t])return n[t];const o=e(u.store).canUser("create",{kind:"postType",name:"wp_template"})&&e(vc).getCurrentTemplateId();return o?.title||o?.slug||n?.[t]}),[]);return(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"tertiary","aria-expanded":e,"aria-label":(0,fs.__)("Template options"),onClick:t,children:s??(0,fs.__)("Default template")})}function su({onClose:e}){const t=Qd(),{availableTemplates:s,fetchedTemplates:n,selectedTemplateSlug:o,canCreate:r,canEdit:i,currentTemplateId:a,onNavigateToEntityRecord:l,getEditorSettings:m}=(0,d.useSelect)((e=>{const{canUser:s,getEntityRecords:n}=e(u.store),o=e(vc).getEditorSettings(),r=s("create",{kind:"postType",name:"wp_template"}),i=e(vc).getCurrentTemplateId();return{availableTemplates:o.availableTemplates,fetchedTemplates:r?n("postType","wp_template",{post_type:e(vc).getCurrentPostType(),per_page:-1}):void 0,selectedTemplateSlug:e(vc).getEditedPostAttribute("template"),canCreate:t&&r&&o.supportsTemplateMode,canEdit:t&&r&&o.supportsTemplateMode&&!!i,currentTemplateId:i,onNavigateToEntityRecord:o.onNavigateToEntityRecord,getEditorSettings:e(vc).getEditorSettings}}),[t]),h=(0,p.useMemo)((()=>Object.entries({...s,...Object.fromEntries((n??[]).map((({slug:e,title:t})=>[e,t.rendered])))}).map((([e,t])=>({value:e,label:t})))),[s,n]),_=h.find((e=>e.value===o))??h.find((e=>!e.value)),{editPost:f}=(0,d.useDispatch)(vc),{createSuccessNotice:b}=(0,d.useDispatch)(_s.store),[y,x]=(0,p.useState)(!1);return(0,c.jsxs)("div",{className:"editor-post-template__classic-theme-dropdown",children:[(0,c.jsx)(g.__experimentalInspectorPopoverHeader,{title:(0,fs.__)("Template"),help:(0,fs.__)("Templates define the way content is displayed when viewing your site."),actions:r?[{icon:Zd,label:(0,fs.__)("Add template"),onClick:()=>x(!0)}]:[],onClose:e}),t?(0,c.jsx)(Hn.SelectControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:!0,label:(0,fs.__)("Template"),value:_?.value??"",options:h,onChange:e=>f({template:e||""})}):(0,c.jsx)(Hn.Notice,{status:"warning",isDismissible:!1,children:(0,fs.__)("The posts page template cannot be changed.")}),i&&l&&(0,c.jsx)("p",{children:(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:()=>{l({postId:a,postType:"wp_template"}),e(),b((0,fs.__)("Editing template. Changes made here affect all posts and pages that use the template."),{type:"snackbar",actions:[{label:(0,fs.__)("Go back"),onClick:()=>m().onNavigateToPreviousEntityRecord()}]})},children:(0,fs.__)("Edit template")})}),y&&(0,c.jsx)(qd,{onClose:()=>x(!1)})]})}var nu=function(){const[e,t]=(0,p.useState)(null),s=(0,p.useMemo)((()=>({anchor:e,className:"editor-post-template__dropdown",placement:"left-start",offset:36,shift:!0})),[e]);return(0,c.jsx)(Rd,{label:(0,fs.__)("Template"),ref:t,children:(0,c.jsx)(Hn.Dropdown,{popoverProps:s,focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,c.jsx)(tu,{isOpen:e,onClick:t}),renderContent:({onClose:e})=>(0,c.jsx)(su,{onClose:e})})})};const ou=window.wp.warning;var ru=s.n(ou);const{PreferenceBaseOption:iu}=$(C.privateApis);function au(e){const{toggleEditorPanelEnabled:t}=(0,d.useDispatch)(vc),{isChecked:s,isRemoved:n}=(0,d.useSelect)((t=>{const{isEditorPanelEnabled:s,isEditorPanelRemoved:n}=t(vc);return{isChecked:s(e.panelName),isRemoved:n(e.panelName)}}),[e.panelName]);return n?null:(0,c.jsx)(iu,{isChecked:s,onChange:()=>t(e.panelName),...e})}const{Fill:lu,Slot:cu}=(0,Hn.createSlotFill)("EnablePluginDocumentSettingPanelOption"),du=({label:e,panelName:t})=>(0,c.jsx)(lu,{children:(0,c.jsx)(au,{label:e,panelName:t})});du.Slot=cu;var uu=du;const{Fill:pu,Slot:mu}=(0,Hn.createSlotFill)("PluginDocumentSettingPanel"),hu=({name:e,className:t,title:s,icon:n,children:o})=>{const{name:r}=(0,aa.usePluginContext)(),i=`${r}/${e}`,{opened:a,isEnabled:l}=(0,d.useSelect)((e=>{const{isEditorPanelOpened:t,isEditorPanelEnabled:s}=e(vc);return{opened:t(i),isEnabled:s(i)}}),[i]),{toggleEditorPanelOpened:u}=(0,d.useDispatch)(vc);return void 0===e&&ru()("PluginDocumentSettingPanel requires a name property."),(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(uu,{label:s,panelName:i}),(0,c.jsx)(pu,{children:l&&(0,c.jsx)(Hn.PanelBody,{className:t,title:s,icon:n,opened:a,onToggle:()=>u(i),children:o})})]})};hu.Slot=mu;var gu=hu;var _u=({allowedBlocks:e,icon:t,label:s,onClick:n,small:o,role:r})=>(0,c.jsx)(g.BlockSettingsMenuControls,{children:({selectedBlocks:i,onClose:a})=>((e,t)=>{return!Array.isArray(t)||(s=t,0===e.filter((e=>!s.includes(e))).length);var s})(i,e)?(0,c.jsx)(Hn.MenuItem,{onClick:(0,m.compose)(n,a),icon:t,label:o?s:void 0,role:r,children:!o&&s}):null});function fu(e){const t=(0,aa.usePluginContext)();return(0,c.jsx)(Na,{name:"core/plugin-more-menu",as:e.as??Hn.MenuItem,icon:e.icon||t.icon,...e})}const{Fill:bu,Slot:yu}=(0,Hn.createSlotFill)("PluginPostPublishPanel"),xu=({children:e,className:t,title:s,initialOpen:n=!1,icon:o})=>{const{icon:r}=(0,aa.usePluginContext)();return(0,c.jsx)(bu,{children:(0,c.jsx)(Hn.PanelBody,{className:t,initialOpen:n||!s,title:s,icon:o??r,children:e})})};xu.Slot=yu;var vu=xu;const{Fill:wu,Slot:Su}=(0,Hn.createSlotFill)("PluginPostStatusInfo"),ku=({children:e,className:t})=>(0,c.jsx)(wu,{children:(0,c.jsx)(Hn.PanelRow,{className:t,children:e})});ku.Slot=Su;var Cu=ku;const{Fill:Pu,Slot:ju}=(0,Hn.createSlotFill)("PluginPrePublishPanel"),Eu=({children:e,className:t,title:s,initialOpen:n=!1,icon:o})=>{const{icon:r}=(0,aa.usePluginContext)();return(0,c.jsx)(Pu,{children:(0,c.jsx)(Hn.PanelBody,{className:t,initialOpen:n||!s,title:s,icon:o??r,children:e})})};Eu.Slot=ju;var Tu=Eu;function Iu(e){const t=(0,aa.usePluginContext)();return(0,c.jsx)(Na,{name:"core/plugin-preview-menu",as:e.as??Hn.MenuItem,icon:e.icon||t.icon,...e})}function Bu({className:e,...t}){return(0,c.jsx)(Va,{panelClassName:e,className:"editor-sidebar",scope:"core",...t})}function Nu(e){return(0,c.jsx)(Da,{__unstableExplicitMenuItem:!0,scope:"core",...e})}function Ru(e=""){return e=(e=Mr()(e)).trim().toLowerCase()}function Du(e,t){const s=Ru(t),n=Ru(e.title);let o=0;if(s===n)o+=30;else if(n.startsWith(s))o+=20;else{s.split(" ").every((e=>n.includes(e)))&&(o+=10)}return o}function Au({onClick:e}){const[t,s]=(0,p.useState)(!1),{postType:n,postId:o}=Kd(),r=Jd(n),{editEntityRecord:i}=(0,d.useDispatch)(u.store);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.MenuItem,{disabled:!r?.length,accessibleWhenDisabled:!0,onClick:()=>s(!0),children:(0,fs.__)("Change template")}),t&&(0,c.jsx)(Hn.Modal,{title:(0,fs.__)("Choose a template"),onRequestClose:()=>s(!1),overlayClassName:"editor-post-template__swap-template-modal",isFullScreen:!0,children:(0,c.jsx)("div",{className:"editor-post-template__swap-template-modal-content",children:(0,c.jsx)(Mu,{postType:n,onSelect:async t=>{i("postType",n,o,{template:t.name},{undoIgnore:!0}),s(!1),e()}})})})]})}function Mu({postType:e,onSelect:t}){const[s,n]=(0,p.useState)(""),o=Jd(e),r=(0,p.useMemo)((()=>o.map((e=>({name:e.slug,blocks:(0,x.parse)(e.content.raw),title:(0,Ln.decodeEntities)(e.title.rendered),id:e.id})))),[o]),i=(0,p.useMemo)((()=>function(e=[],t=""){if(!t)return e;const s=e.map((e=>[e,Du(e,t)])).filter((([,e])=>e>0));return s.sort((([,e],[,t])=>t-e)),s.map((([e])=>e))}(r,s)),[r,s]);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.SearchControl,{__nextHasNoMarginBottom:!0,onChange:n,value:s,label:(0,fs.__)("Search"),placeholder:(0,fs.__)("Search"),className:"editor-post-template__swap-template-search"}),(0,c.jsx)(g.__experimentalBlockPatternsList,{label:(0,fs.__)("Templates"),blockPatterns:i,onClickPattern:t})]})}function Lu({onClick:e}){const t=eu(),s=Qd(),{postType:n,postId:o}=Kd(),{editEntityRecord:r}=(0,d.useDispatch)(u.store);return t&&s?(0,c.jsx)(Hn.MenuItem,{onClick:()=>{r("postType",n,o,{template:""},{undoIgnore:!0}),e()},children:(0,fs.__)("Use default template")}):null}function Ou(){const{canCreateTemplates:e}=(0,d.useSelect)((e=>{const{canUser:t}=e(u.store);return{canCreateTemplates:t("create",{kind:"postType",name:"wp_template"})}}),[]),[t,s]=(0,p.useState)(!1),n=Qd();return e&&n?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.MenuItem,{onClick:()=>{s(!0)},children:(0,fs.__)("Create new template")}),t&&(0,c.jsx)(qd,{onClose:()=>{s(!1)}})]}):null}function Fu({id:e}){const{isTemplateHidden:t,onNavigateToEntityRecord:s,getEditorSettings:n,hasGoBack:o}=(0,d.useSelect)((e=>{const{getRenderingMode:t,getEditorSettings:s}=$(e(vc)),n=s();return{isTemplateHidden:"post-only"===t(),onNavigateToEntityRecord:n.onNavigateToEntityRecord,getEditorSettings:s,hasGoBack:n.hasOwnProperty("onNavigateToPreviousEntityRecord")}}),[]),{get:r}=(0,d.useSelect)(C.store),{editedRecord:i,hasResolved:a}=(0,u.useEntityRecord)("postType","wp_template",e),{createSuccessNotice:l}=(0,d.useDispatch)(_s.store),{setRenderingMode:m,setDefaultRenderingMode:h}=$((0,d.useDispatch)(vc)),g=(0,d.useSelect)((e=>!!e(u.store).canUser("create",{kind:"postType",name:"wp_template"})),[]),[_,f]=(0,p.useState)(null),b=(0,p.useMemo)((()=>({anchor:_,className:"editor-post-template__dropdown",placement:"left-start",offset:36,shift:!0})),[_]);if(!a)return null;const y=o?[{label:(0,fs.__)("Go back"),onClick:()=>n().onNavigateToPreviousEntityRecord()}]:void 0;return(0,c.jsx)(Rd,{label:(0,fs.__)("Template"),ref:f,children:(0,c.jsx)(Hn.DropdownMenu,{popoverProps:b,focusOnMount:!0,toggleProps:{size:"compact",variant:"tertiary",tooltipPosition:"middle left"},label:(0,fs.__)("Template options"),text:(0,Ln.decodeEntities)(i.title),icon:null,children:({onClose:e})=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(Hn.MenuGroup,{children:[g&&(0,c.jsx)(Hn.MenuItem,{onClick:()=>{s({postId:i.id,postType:"wp_template"}),e(),r("core/edit-site","welcomeGuideTemplate")||l((0,fs.__)("Editing template. Changes made here affect all posts and pages that use the template."),{type:"snackbar",actions:y})},children:(0,fs.__)("Edit template")}),(0,c.jsx)(Au,{onClick:e}),(0,c.jsx)(Lu,{onClick:e}),g&&(0,c.jsx)(Ou,{})]}),(0,c.jsx)(Hn.MenuGroup,{children:(0,c.jsx)(Hn.MenuItem,{icon:t?void 0:zn,isSelected:!t,role:"menuitemcheckbox",onClick:()=>{const e=t?"template-locked":"post-only";m(e),h(e)},children:(0,fs.__)("Show template")})})]})})})}function Vu(){const{templateId:e,isBlockTheme:t}=(0,d.useSelect)((e=>{const{getCurrentTemplateId:t,getEditorSettings:s}=e(vc);return{templateId:t(),isBlockTheme:s().__unstableIsBlockBasedTheme}}),[]),s=(0,d.useSelect)((e=>{const t=e(vc).getCurrentPostType(),s=e(u.store).getPostType(t);if(!s?.viewable)return!1;const n=e(vc).getEditorSettings();if(!!n.availableTemplates&&Object.keys(n.availableTemplates).length>0)return!0;if(!n.supportsTemplateMode)return!1;return e(u.store).canUser("create",{kind:"postType",name:"wp_template"})??!1}),[]),n=(0,d.useSelect)((e=>!!s&&e(u.store).canUser("read",{kind:"postType",name:"wp_template"})),[s]);return t&&n||!s?t&&e?(0,c.jsx)(Fu,{id:e}):null:(0,c.jsx)(nu,{})}const Uu={_fields:"id,name",context:"view"},Hu={who:"authors",per_page:100,...Uu};function zu(e){const{authorId:t,authors:s,postAuthor:n,isLoading:o}=(0,d.useSelect)((t=>{const{getUser:s,getUsers:n,isResolving:o}=t(u.store),{getEditedPostAttribute:r}=t(vc),i=r("author"),a={...Hu};return e&&(a.search=e,a.search_columns=["name"]),{authorId:i,authors:n(a),postAuthor:s(i,Uu),isLoading:o("getUsers",[a])}}),[e]);return{authorId:t,authorOptions:(0,p.useMemo)((()=>{const e=(s??[]).map((e=>({value:e.id,label:(0,Ln.decodeEntities)(e.name)}))),t=e.findIndex((({value:e})=>n?.id===e));let o=[];return t<0&&n?o=[{value:n.id,label:(0,Ln.decodeEntities)(n.name)}]:t<0&&!n&&(o=[{value:0,label:(0,fs.__)("(No author)")}]),[...o,...e]}),[s,n]),postAuthor:n,isLoading:o}}function Gu(){const[e,t]=(0,p.useState)(),{editPost:s}=(0,d.useDispatch)(vc),{authorId:n,authorOptions:o,isLoading:r}=zu(e);return(0,c.jsx)(Hn.ComboboxControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,fs.__)("Author"),options:o,value:n,onFilterValueChange:(0,m.debounce)(t,300),onChange:e=>{e&&s({author:e})},allowReset:!1,hideLabelFromVision:!0,isLoading:r})}function $u(){const{editPost:e}=(0,d.useDispatch)(vc),{authorId:t,authorOptions:s}=zu();return(0,c.jsx)(Hn.SelectControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,className:"post-author-selector",label:(0,fs.__)("Author"),options:s,onChange:t=>{const s=Number(t);e({author:s})},value:t,hideLabelFromVision:!0})}var Wu=function(){return(0,d.useSelect)((e=>{const t=e(u.store).getUsers(Hu);return t?.length>=25}),[])?(0,c.jsx)(Gu,{}):(0,c.jsx)($u,{})};function Zu({children:e}){const{hasAssignAuthorAction:t}=(0,d.useSelect)((e=>{const t=e(vc).getCurrentPost();return{hasAssignAuthorAction:!!t?._links?.["wp:action-assign-author"]}}),[]);return t?(0,c.jsx)(Id,{supportKeys:"author",children:e}):null}function Yu({isOpen:e,onClick:t}){const{postAuthor:s}=(0,d.useSelect)((e=>{const t=e(vc).getEditedPostAttribute("author");return{postAuthor:e(u.store).getUser(t,Uu)}}),[]),n=(0,Ln.decodeEntities)(s?.name)||(0,fs.__)("(No author)");return(0,c.jsx)(Hn.Button,{size:"compact",className:"editor-post-author__panel-toggle",variant:"tertiary","aria-expanded":e,"aria-label":(0,fs.sprintf)((0,fs.__)("Change author: %s"),n),onClick:t,children:n})}var qu=function(){const[e,t]=(0,p.useState)(null),s=(0,p.useMemo)((()=>({anchor:e,placement:"left-start",offset:36,shift:!0})),[e]);return(0,c.jsx)(Zu,{children:(0,c.jsx)(Rd,{label:(0,fs.__)("Author"),ref:t,children:(0,c.jsx)(Hn.Dropdown,{popoverProps:s,contentClassName:"editor-post-author__panel-dialog",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,c.jsx)(Yu,{isOpen:e,onClick:t}),renderContent:({onClose:e})=>(0,c.jsxs)("div",{className:"editor-post-author",children:[(0,c.jsx)(g.__experimentalInspectorPopoverHeader,{title:(0,fs.__)("Author"),onClose:e}),(0,c.jsx)(Wu,{onClose:e})]})})})})};const Ku=[{label:(0,fs._x)("Open",'Adjective: e.g. "Comments are open"'),value:"open",description:(0,fs.__)("Visitors can add new comments and replies.")},{label:(0,fs.__)("Closed"),value:"closed",description:[(0,fs.__)("Visitors cannot add new comments or replies."),(0,fs.__)("Existing comments remain visible.")].join(" ")}];var Qu=function(){const e=(0,d.useSelect)((e=>e(vc).getEditedPostAttribute("comment_status")??"open"),[]),{editPost:t}=(0,d.useDispatch)(vc);return(0,c.jsx)("form",{children:(0,c.jsx)(Hn.__experimentalVStack,{spacing:4,children:(0,c.jsx)(Hn.RadioControl,{className:"editor-change-status__options",hideLabelFromVision:!0,label:(0,fs.__)("Comment status"),options:Ku,onChange:e=>t({comment_status:e}),selected:e})})})};var Xu=function(){const e=(0,d.useSelect)((e=>e(vc).getEditedPostAttribute("ping_status")??"open"),[]),{editPost:t}=(0,d.useDispatch)(vc);return(0,c.jsx)(Hn.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,fs.__)("Enable pingbacks & trackbacks"),checked:"open"===e,onChange:()=>t({ping_status:"open"===e?"closed":"open"}),help:(0,c.jsx)(Hn.ExternalLink,{href:(0,fs.__)("https://wordpress.org/documentation/article/trackbacks-and-pingbacks/"),children:(0,fs.__)("Learn more about pingbacks & trackbacks")})})};const Ju="discussion-panel";function ep({onClose:e}){return(0,c.jsxs)("div",{className:"editor-post-discussion",children:[(0,c.jsx)(g.__experimentalInspectorPopoverHeader,{title:(0,fs.__)("Discussion"),onClose:e}),(0,c.jsxs)(Hn.__experimentalVStack,{spacing:4,children:[(0,c.jsx)(Id,{supportKeys:"comments",children:(0,c.jsx)(Qu,{})}),(0,c.jsx)(Id,{supportKeys:"trackbacks",children:(0,c.jsx)(Xu,{})})]})]})}function tp({isOpen:e,onClick:t}){const{commentStatus:s,pingStatus:n,commentsSupported:o,trackbacksSupported:r}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t}=e(vc),{getPostType:s}=e(u.store),n=s(t("type"));return{commentStatus:t("comment_status")??"open",pingStatus:t("ping_status")??"open",commentsSupported:!!n.supports.comments,trackbacksSupported:!!n.supports.trackbacks}}),[]);let i;return i="open"===s?"open"===n?(0,fs._x)("Open",'Adjective: e.g. "Comments are open"'):r?(0,fs.__)("Comments only"):(0,fs._x)("Open",'Adjective: e.g. "Comments are open"'):"open"===n?o?(0,fs.__)("Pings only"):(0,fs.__)("Pings enabled"):(0,fs.__)("Closed"),(0,c.jsx)(Hn.Button,{size:"compact",className:"editor-post-discussion__panel-toggle",variant:"tertiary","aria-label":(0,fs.__)("Change discussion options"),"aria-expanded":e,onClick:t,children:i})}function sp(){const{isEnabled:e}=(0,d.useSelect)((e=>{const{isEditorPanelEnabled:t}=e(vc);return{isEnabled:t(Ju)}}),[]),[t,s]=(0,p.useState)(null),n=(0,p.useMemo)((()=>({anchor:t,placement:"left-start",offset:36,shift:!0})),[t]);return e?(0,c.jsx)(Id,{supportKeys:["comments","trackbacks"],children:(0,c.jsx)(Rd,{label:(0,fs.__)("Discussion"),ref:s,children:(0,c.jsx)(Hn.Dropdown,{popoverProps:n,className:"editor-post-discussion__panel-dropdown",contentClassName:"editor-post-discussion__panel-dialog",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,c.jsx)(tp,{isOpen:e,onClick:t}),renderContent:({onClose:e})=>(0,c.jsx)(ep,{onClose:e})})})}):null}function np({hideLabelFromVision:e=!1,updateOnBlur:t=!1}){const{excerpt:s,shouldUseDescriptionLabel:n,usedAttribute:o}=(0,d.useSelect)((e=>{const{getCurrentPostType:t,getEditedPostAttribute:s}=e(vc),n=t(),o=["wp_template","wp_template_part"].includes(n)?"description":"excerpt";return{excerpt:s(o),shouldUseDescriptionLabel:["wp_template","wp_template_part","wp_block"].includes(n),usedAttribute:o}}),[]),{editPost:r}=(0,d.useDispatch)(vc),[i,a]=(0,p.useState)((0,Ln.decodeEntities)(s)),l=e=>{r({[o]:e})},u=n?(0,fs.__)("Write a description (optional)"):(0,fs.__)("Write an excerpt (optional)");return(0,c.jsx)("div",{className:"editor-post-excerpt",children:(0,c.jsx)(Hn.TextareaControl,{__nextHasNoMarginBottom:!0,label:u,hideLabelFromVision:e,className:"editor-post-excerpt__textarea",onChange:t?a:l,onBlur:t?()=>l(i):void 0,value:t?i:s,help:n?(0,fs.__)("Write a description"):(0,c.jsx)(Hn.ExternalLink,{href:(0,fs.__)("https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt"),children:(0,fs.__)("Learn more about manual excerpts")})})})}var op=function({children:e}){return(0,c.jsx)(Id,{supportKeys:"excerpt",children:e})};const{Fill:rp,Slot:ip}=(0,Hn.createSlotFill)("PluginPostExcerpt"),ap=({children:e,className:t})=>(0,c.jsx)(rp,{children:(0,c.jsx)(Hn.PanelRow,{className:t,children:e})});ap.Slot=ip;var lp=ap;const cp="post-excerpt";function dp(){const{isOpened:e,isEnabled:t,postType:s}=(0,d.useSelect)((e=>{const{isEditorPanelOpened:t,isEditorPanelEnabled:s,getCurrentPostType:n}=e(vc);return{isOpened:t(cp),isEnabled:s(cp),postType:n()}}),[]),{toggleEditorPanelOpened:n}=(0,d.useDispatch)(vc);if(!t)return null;const o=["wp_template","wp_template_part","wp_block"].includes(s);return(0,c.jsx)(Hn.PanelBody,{title:o?(0,fs.__)("Description"):(0,fs.__)("Excerpt"),opened:e,onToggle:()=>n(cp),children:(0,c.jsx)(lp.Slot,{children:e=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(np,{}),e]})})})}function up(){return(0,c.jsx)(op,{children:(0,c.jsx)(dp,{})})}function pp(){return(0,c.jsx)(op,{children:(0,c.jsx)(mp,{})})}function mp(){const{shouldRender:e,excerpt:t,shouldBeUsedAsDescription:s,allowEditing:n}=(0,d.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s,getEditedPostAttribute:n,isEditorPanelEnabled:o}=e(vc),r=t(),i=["wp_template","wp_template_part"].includes(r),a="wp_block"===r,l=i||a,c=n(i?"description":"excerpt"),d=i&&e(u.store).getEntityRecord("postType",r,s()),p=o(cp)||l;return{excerpt:c,shouldRender:p,shouldBeUsedAsDescription:l,allowEditing:p&&(!l||a||d&&d.source===D&&!d.has_theme_file&&d.is_custom)}}),[]),[o,r]=(0,p.useState)(null),i=s?(0,fs.__)("Description"):(0,fs.__)("Excerpt"),a=(0,p.useMemo)((()=>({anchor:o,"aria-label":i,headerTitle:i,placement:"left-start",offset:36,shift:!0})),[o,i]);if(!e)return!1;const l=!!t&&(0,c.jsx)(Hn.__experimentalText,{align:"left",numberOfLines:4,truncate:n,children:(0,Ln.decodeEntities)(t)});if(!n)return l;const m=s?(0,fs.__)("Add a description…"):(0,fs.__)("Add an excerpt…"),h=s?(0,fs.__)("Edit description"):(0,fs.__)("Edit excerpt");return(0,c.jsxs)(Hn.__experimentalVStack,{children:[l,(0,c.jsx)(Hn.Dropdown,{className:"editor-post-excerpt__dropdown",contentClassName:"editor-post-excerpt__dropdown__content",popoverProps:a,focusOnMount:!0,ref:r,renderToggle:({onToggle:e})=>(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,onClick:e,variant:"link",children:l?h:m}),renderContent:({onClose:e})=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(g.__experimentalInspectorPopoverHeader,{title:i,onClose:e}),(0,c.jsx)(Hn.__experimentalVStack,{spacing:4,children:(0,c.jsx)(lp.Slot,{children:e=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(np,{hideLabelFromVision:!0,updateOnBlur:!0}),e]})})})]})})]})}function hp({children:e,supportKeys:t}){const{postType:s,themeSupports:n}=(0,d.useSelect)((e=>({postType:e(vc).getEditedPostAttribute("type"),themeSupports:e(u.store).getThemeSupports()})),[]);return(Array.isArray(t)?t:[t]).some((e=>{const t=n?.[e]??!1;return"post-thumbnails"===e&&Array.isArray(t)?t.includes(s):t}))?e:null}var gp=function({children:e}){return(0,c.jsx)(hp,{supportKeys:"post-thumbnails",children:(0,c.jsx)(Id,{supportKeys:"thumbnail",children:e})})};const _p=["image"],fp=(0,fs.__)("Featured image"),bp=(0,fs.__)("Add a featured image"),yp=(0,c.jsx)("p",{children:(0,fs.__)("To edit the featured image, you need permission to upload media.")});const xp=(0,d.withSelect)((e=>{const{getEntityRecord:t,getPostType:s,hasFinishedResolution:n}=e(u.store),{getCurrentPostId:o,getEditedPostAttribute:r}=e(vc),i=r("featured_media");return{media:i?t("postType","attachment",i,{context:"view"}):null,currentPostId:o(),postType:s(r("type")),featuredImageId:i,isRequestingFeaturedImageMedia:!!i&&!n("getEntityRecord",["postType","attachment",i,{context:"view"}])}})),vp=(0,d.withDispatch)(((e,{noticeOperations:t},{select:s})=>{const{editPost:n}=e(vc);return{onUpdateImage(e){n({featured_media:e.id})},onDropImage(e){s(g.store).getSettings().mediaUpload({allowedTypes:["image"],filesList:e,onFileChange([e]){n({featured_media:e.id})},onError(e){t.removeAllNotices(),t.createErrorNotice(e)},multiple:!1})},onRemoveImage(){n({featured_media:0})}}}));var wp=(0,m.compose)(Hn.withNotices,xp,vp,(0,Hn.withFilters)("editor.PostFeaturedImage"))((function({currentPostId:e,featuredImageId:t,onUpdateImage:s,onRemoveImage:n,media:o,postType:r,noticeUI:i,noticeOperations:a,isRequestingFeaturedImageMedia:l}){const u=(0,p.useRef)(!1),[m,_]=(0,p.useState)(!1),{getSettings:f}=(0,d.useSelect)(g.store),{mediaSourceUrl:b}=function(e,t){if(!e)return{};const s=(0,h.applyFilters)("editor.PostFeaturedImage.imageSize","large",e.id,t);if(s in(e?.media_details?.sizes??{}))return{mediaWidth:e.media_details.sizes[s].width,mediaHeight:e.media_details.sizes[s].height,mediaSourceUrl:e.media_details.sizes[s].source_url};const n=(0,h.applyFilters)("editor.PostFeaturedImage.imageSize","thumbnail",e.id,t);return n in(e?.media_details?.sizes??{})?{mediaWidth:e.media_details.sizes[n].width,mediaHeight:e.media_details.sizes[n].height,mediaSourceUrl:e.media_details.sizes[n].source_url}:{mediaWidth:e.media_details.width,mediaHeight:e.media_details.height,mediaSourceUrl:e.source_url}}(o,e);function y(e){f().mediaUpload({allowedTypes:_p,filesList:e,onFileChange([e]){(0,Go.isBlobURL)(e?.url)?_(!0):(e&&s(e),_(!1))},onError(e){a.removeAllNotices(),a.createErrorNotice(e)},multiple:!1})}function x(e){return e.alt_text?(0,fs.sprintf)((0,fs.__)("Current image: %s"),e.alt_text):(0,fs.sprintf)((0,fs.__)("The current image has no alternative text. The file name is: %s"),e.media_details.sizes?.full?.file||e.slug)}function v(e){u.current&&e&&(e.focus(),u.current=!1)}const w=!l&&!!t&&!o;return(0,c.jsxs)(gp,{children:[i,(0,c.jsxs)("div",{className:"editor-post-featured-image",children:[o&&(0,c.jsx)("div",{id:`editor-post-featured-image-${t}-describedby`,className:"hidden",children:x(o)}),(0,c.jsx)(g.MediaUploadCheck,{fallback:yp,children:(0,c.jsx)(g.MediaUpload,{title:r?.labels?.featured_image||fp,onSelect:s,unstableFeaturedImageFlow:!0,allowedTypes:_p,modalClass:"editor-post-featured-image__media-modal",render:({open:e})=>(0,c.jsxs)("div",{className:"editor-post-featured-image__container",children:[w?(0,c.jsx)(Hn.Notice,{status:"warning",isDismissible:!1,children:(0,fs.__)("Could not retrieve the featured image data.")}):(0,c.jsxs)(Hn.Button,{__next40pxDefaultSize:!0,ref:v,className:t?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:e,"aria-label":t?(0,fs.__)("Edit or replace the featured image"):null,"aria-describedby":t?`editor-post-featured-image-${t}-describedby`:null,"aria-haspopup":"dialog",disabled:m,accessibleWhenDisabled:!0,children:[!!t&&o&&(0,c.jsx)("img",{className:"editor-post-featured-image__preview-image",src:b,alt:x(o)}),(m||l)&&(0,c.jsx)(Hn.Spinner,{}),!t&&!m&&(r?.labels?.set_featured_image||bp)]}),!!t&&(0,c.jsxs)(Hn.__experimentalHStack,{className:mr("editor-post-featured-image__actions",{"editor-post-featured-image__actions-missing-image":w,"editor-post-featured-image__actions-is-requesting-image":l}),children:[(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,className:"editor-post-featured-image__action",onClick:e,"aria-haspopup":"dialog",variant:w?"secondary":void 0,children:(0,fs.__)("Replace")}),(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,className:"editor-post-featured-image__action",onClick:()=>{n(),u.current=!0},variant:w?"secondary":void 0,isDestructive:w,children:(0,fs.__)("Remove")})]}),(0,c.jsx)(Hn.DropZone,{onFilesDrop:y})]}),value:t})})]})]})}));const Sp="featured-image";function kp({withPanelBody:e=!0}){const{postType:t,isEnabled:s,isOpened:n}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t,isEditorPanelEnabled:s,isEditorPanelOpened:n}=e(vc),{getPostType:o}=e(u.store);return{postType:o(t("type")),isEnabled:s(Sp),isOpened:n(Sp)}}),[]),{toggleEditorPanelOpened:o}=(0,d.useDispatch)(vc);return s?e?(0,c.jsx)(gp,{children:(0,c.jsx)(Hn.PanelBody,{title:t?.labels?.featured_image??(0,fs.__)("Featured image"),opened:n,onToggle:()=>o(Sp),children:(0,c.jsx)(wp,{})})}):(0,c.jsx)(gp,{children:(0,c.jsx)(wp,{})}):null}function Cp({children:e}){return(0,d.useSelect)((e=>e(vc).getEditorSettings().disablePostFormats),[])?null:(0,c.jsx)(Id,{supportKeys:"post-formats",children:e})}const Pp=[{id:"aside",caption:(0,fs.__)("Aside")},{id:"audio",caption:(0,fs.__)("Audio")},{id:"chat",caption:(0,fs.__)("Chat")},{id:"gallery",caption:(0,fs.__)("Gallery")},{id:"image",caption:(0,fs.__)("Image")},{id:"link",caption:(0,fs.__)("Link")},{id:"quote",caption:(0,fs.__)("Quote")},{id:"standard",caption:(0,fs.__)("Standard")},{id:"status",caption:(0,fs.__)("Status")},{id:"video",caption:(0,fs.__)("Video")}].sort(((e,t)=>{const s=e.caption.toUpperCase(),n=t.caption.toUpperCase();return s<n?-1:s>n?1:0}));function jp(){const e=`post-format-selector-${(0,m.useInstanceId)(jp)}`,{postFormat:t,suggestedFormat:s,supportedFormats:n}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t,getSuggestedPostFormat:s}=e(vc),n=t("format"),o=e(u.store).getThemeSupports();return{postFormat:n??"standard",suggestedFormat:s(),supportedFormats:o.formats}}),[]),o=Pp.filter((e=>n?.includes(e.id)||t===e.id)),r=o.find((e=>e.id===s)),{editPost:i}=(0,d.useDispatch)(vc),a=e=>i({format:e});return(0,c.jsx)(Cp,{children:(0,c.jsxs)("div",{className:"editor-post-format",children:[(0,c.jsx)(Hn.RadioControl,{className:"editor-post-format__options",label:(0,fs.__)("Post Format"),selected:t,onChange:e=>a(e),id:e,options:o.map((e=>({label:e.caption,value:e.id}))),hideLabelFromVision:!0}),r&&r.id!==t&&(0,c.jsx)("p",{className:"editor-post-format__suggestion",children:(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:()=>a(r.id),children:(0,fs.sprintf)((0,fs.__)("Apply suggested format: %s"),r.caption)})})]})})}var Ep=function({children:e}){const{lastRevisionId:t,revisionsCount:s}=(0,d.useSelect)((e=>{const{getCurrentPostLastRevisionId:t,getCurrentPostRevisionsCount:s}=e(vc);return{lastRevisionId:t(),revisionsCount:s()}}),[]);return!t||s<2?null:(0,c.jsx)(Id,{supportKeys:"revisions",children:e})};function Tp(){return(0,d.useSelect)((e=>{const{getCurrentPostLastRevisionId:t,getCurrentPostRevisionsCount:s}=e(vc);return{lastRevisionId:t(),revisionsCount:s()}}),[])}function Ip(){const{lastRevisionId:e,revisionsCount:t}=Tp();return(0,c.jsx)(Ep,{children:(0,c.jsx)(Rd,{label:(0,fs.__)("Revisions"),children:(0,c.jsx)(Hn.Button,{href:(0,w.addQueryArgs)("revision.php",{revision:e}),className:"editor-private-post-last-revision__button",text:t,variant:"tertiary",size:"compact"})})})}var Bp=function(){const{lastRevisionId:e,revisionsCount:t}=Tp();return(0,c.jsx)(Ep,{children:(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,href:(0,w.addQueryArgs)("revision.php",{revision:e}),className:"editor-post-last-revision__title",icon:Yo,iconPosition:"right",text:(0,fs.sprintf)((0,fs.__)("Revisions (%s)"),t)})})};var Np=function(){return(0,c.jsx)(Ep,{children:(0,c.jsx)(Hn.PanelBody,{className:"editor-post-last-revision__panel",children:(0,c.jsx)(Bp,{})})})};var Rp=function e(){const t="core/editor/post-locked-modal-"+(0,m.useInstanceId)(e),{autosave:s,updatePostLock:n}=(0,d.useDispatch)(vc),{isLocked:o,isTakeover:r,user:i,postId:a,postLockUtils:l,activePostLock:g,postType:_,previewLink:f}=(0,d.useSelect)((e=>{const{isPostLocked:t,isPostLockTakeover:s,getPostLockUser:n,getCurrentPostId:o,getActivePostLock:r,getEditedPostAttribute:i,getEditedPostPreviewLink:a,getEditorSettings:l}=e(vc),{getPostType:c}=e(u.store);return{isLocked:t(),isTakeover:s(),user:n(),postId:o(),postLockUtils:l().postLockUtils,activePostLock:r(),postType:c(i("type")),previewLink:a()}}),[]);if((0,p.useEffect)((()=>{function e(){if(o||!g)return;const e=new window.FormData;if(e.append("action","wp-remove-post-lock"),e.append("_wpnonce",l.unlockNonce),e.append("post_ID",a),e.append("active_post_lock",g),window.navigator.sendBeacon)window.navigator.sendBeacon(l.ajaxUrl,e);else{const t=new window.XMLHttpRequest;t.open("POST",l.ajaxUrl,!1),t.send(e)}}return(0,h.addAction)("heartbeat.send",t,(function(e){o||(e["wp-refresh-post-lock"]={lock:g,post_id:a})})),(0,h.addAction)("heartbeat.tick",t,(function(e){if(!e["wp-refresh-post-lock"])return;const t=e["wp-refresh-post-lock"];t.lock_error?(s(),n({isLocked:!0,isTakeover:!0,user:{name:t.lock_error.name,avatar:t.lock_error.avatar_src_2x}})):t.new_lock&&n({isLocked:!1,activePostLock:t.new_lock})})),window.addEventListener("beforeunload",e),()=>{(0,h.removeAction)("heartbeat.send",t),(0,h.removeAction)("heartbeat.tick",t),window.removeEventListener("beforeunload",e)}}),[]),!o)return null;const b=i.name,y=i.avatar,x=(0,w.addQueryArgs)("post.php",{"get-post-lock":"1",lockKey:!0,post:a,action:"edit",_wpnonce:l.nonce}),v=(0,w.addQueryArgs)("edit.php",{post_type:_?.slug}),S=(0,fs.__)("Exit editor");return(0,c.jsx)(Hn.Modal,{title:r?(0,fs.__)("Someone else has taken over this post"):(0,fs.__)("This post is already being edited"),focusOnMount:!0,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,isDismissible:!1,className:"editor-post-locked-modal",size:"medium",children:(0,c.jsxs)(Hn.__experimentalHStack,{alignment:"top",spacing:6,children:[!!y&&(0,c.jsx)("img",{src:y,alt:(0,fs.__)("Avatar"),className:"editor-post-locked-modal__avatar",width:64,height:64}),(0,c.jsxs)("div",{children:[!!r&&(0,c.jsx)("p",{children:(0,p.createInterpolateElement)(b?(0,fs.sprintf)((0,fs.__)("<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved."),b):(0,fs.__)("Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved."),{strong:(0,c.jsx)("strong",{}),PreviewLink:(0,c.jsx)(Hn.ExternalLink,{href:f,children:(0,fs.__)("preview")})})}),!r&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("p",{children:(0,p.createInterpolateElement)(b?(0,fs.sprintf)((0,fs.__)("<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over."),b):(0,fs.__)("Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over."),{strong:(0,c.jsx)("strong",{}),PreviewLink:(0,c.jsx)(Hn.ExternalLink,{href:f,children:(0,fs.__)("preview")})})}),(0,c.jsx)("p",{children:(0,fs.__)("If you take over, the other user will lose editing control to the post, but their changes will be saved.")})]}),(0,c.jsxs)(Hn.__experimentalHStack,{className:"editor-post-locked-modal__buttons",justify:"flex-end",children:[!r&&(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"tertiary",href:x,children:(0,fs.__)("Take over")}),(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"primary",href:v,children:S})]})]})]})})};var Dp=function({children:e}){const{hasPublishAction:t,isPublished:s}=(0,d.useSelect)((e=>{const{isCurrentPostPublished:t,getCurrentPost:s}=e(vc);return{hasPublishAction:s()._links?.["wp:action-publish"]??!1,isPublished:t()}}),[]);return s||!t?null:e};var Ap=function(){const e=(0,d.useSelect)((e=>e(vc).getEditedPostAttribute("status")),[]),{editPost:t}=(0,d.useDispatch)(vc);return(0,c.jsx)(Dp,{children:(0,c.jsx)(Hn.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,fs.__)("Pending review"),checked:"pending"===e,onChange:()=>{t({status:"pending"===e?"draft":"pending"})}})})};function Mp({className:e,textContent:t,forceIsAutosaveable:s,role:n,onPreview:o}){const{postId:r,currentPostLink:i,previewLink:a,isSaveable:l,isViewable:m}=(0,d.useSelect)((e=>{const t=e(vc),s=e(u.store).getPostType(t.getCurrentPostType("type")),n=s?.viewable??!1;return n?{postId:t.getCurrentPostId(),currentPostLink:t.getCurrentPostAttribute("link"),previewLink:t.getEditedPostPreviewLink(),isSaveable:t.isEditedPostSaveable(),isViewable:n}:{isViewable:n}}),[]),{__unstableSaveForPreview:g}=(0,d.useDispatch)(vc);if(!m)return null;const _=`wp-preview-${r}`,f=a||i;return(0,c.jsx)(Hn.Button,{variant:e?void 0:"tertiary",className:e||"editor-post-preview",href:f,target:_,accessibleWhenDisabled:!0,disabled:!l,onClick:async e=>{e.preventDefault();const t=window.open("",_);t.focus(),function(e){let t=(0,p.renderToString)((0,c.jsxs)("div",{className:"editor-post-preview-button__interstitial-message",children:[(0,c.jsxs)(Hn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 96 96",children:[(0,c.jsx)(Hn.Path,{className:"outer",d:"M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",fill:"none"}),(0,c.jsx)(Hn.Path,{className:"inner",d:"M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z",fill:"none"})]}),(0,c.jsx)("p",{children:(0,fs.__)("Generating preview…")})]}));t+='\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\t\t}\n\t\t</style>\n\t',t=(0,h.applyFilters)("editor.PostPreview.interstitialMarkup",t),e.write(t),e.title=(0,fs.__)("Generating preview…"),e.close()}(t.document);const n=await g({forceIsAutosaveable:s});t.location=n,o?.()},role:n,size:"compact",children:t||(0,c.jsxs)(c.Fragment,{children:[(0,fs._x)("Preview","imperative verb"),(0,c.jsx)(Hn.VisuallyHidden,{as:"span",children:(0,fs.__)("(opens in a new tab)")})]})})}function Lp(){const e=(0,m.useViewportMatch)("medium","<"),{isPublished:t,isBeingScheduled:s,isSaving:n,isPublishing:o,hasPublishAction:r,isAutosaving:i,hasNonPostEntityChanges:a,postStatusHasChanged:l,postStatus:c}=(0,d.useSelect)((e=>{const{isCurrentPostPublished:t,isEditedPostBeingScheduled:s,isSavingPost:n,isPublishingPost:o,getCurrentPost:r,getCurrentPostType:i,isAutosavingPost:a,getPostEdits:l,getEditedPostAttribute:c}=e(vc);return{isPublished:t(),isBeingScheduled:s(),isSaving:n(),isPublishing:o(),hasPublishAction:r()._links?.["wp:action-publish"]??!1,postType:i(),isAutosaving:a(),hasNonPostEntityChanges:e(vc).hasNonPostEntityChanges(),postStatusHasChanged:!!l()?.status,postStatus:c("status")}}),[]);return o?(0,fs.__)("Publishing…"):(t||s)&&n&&!i?(0,fs.__)("Saving…"):r?a||t||l&&!["future","publish"].includes(c)||!l&&"future"===c?(0,fs.__)("Save"):s?(0,fs.__)("Schedule"):(0,fs.__)("Publish"):e?(0,fs.__)("Publish"):(0,fs.__)("Submit for Review")}const Op=()=>{};class Fp extends p.Component{constructor(e){super(e),this.createOnClick=this.createOnClick.bind(this),this.closeEntitiesSavedStates=this.closeEntitiesSavedStates.bind(this),this.state={entitiesSavedStatesCallback:!1}}createOnClick(e){return(...t)=>{const{hasNonPostEntityChanges:s,setEntitiesSavedStatesCallback:n}=this.props;return s&&n?(this.setState({entitiesSavedStatesCallback:()=>e(...t)}),n((()=>this.closeEntitiesSavedStates)),Op):e(...t)}}closeEntitiesSavedStates(e){const{postType:t,postId:s}=this.props,{entitiesSavedStatesCallback:n}=this.state;this.setState({entitiesSavedStatesCallback:!1},(()=>{e&&e.some((e=>"postType"===e.kind&&e.name===t&&e.key===s))&&n()}))}render(){const{forceIsDirty:e,hasPublishAction:t,isBeingScheduled:s,isOpen:n,isPostSavingLocked:o,isPublishable:r,isPublished:i,isSaveable:a,isSaving:l,isAutoSaving:d,isToggle:u,savePostStatus:p,onSubmit:m=Op,onToggle:h,visibility:g,hasNonPostEntityChanges:_,isSavingNonPostEntityChanges:f,postStatus:b,postStatusHasChanged:y}=this.props,x=(l||!a||o||!r&&!e)&&(!_||f),v=(i||l||!a||!r&&!e)&&(!_||f);let w="publish";y?w=b:t?"private"===g?w="private":s&&(w="future"):w="pending";const S={"aria-disabled":x,className:"editor-post-publish-button",isBusy:!d&&l,variant:"primary",onClick:this.createOnClick((()=>{x||(m(),p(w))})),"aria-haspopup":_?"dialog":void 0},k={"aria-disabled":v,"aria-expanded":n,className:"editor-post-publish-panel__toggle",isBusy:l&&i,variant:"primary",size:"compact",onClick:this.createOnClick((()=>{v||h()})),"aria-haspopup":_?"dialog":void 0},C=u?k:S;return(0,c.jsx)(c.Fragment,{children:(0,c.jsx)(Hn.Button,{...C,className:`${C.className} editor-post-publish-button__button`,size:"compact",children:(0,c.jsx)(Lp,{})})})}}var Vp=(0,m.compose)([(0,d.withSelect)((e=>{const{isSavingPost:t,isAutosavingPost:s,isEditedPostBeingScheduled:n,getEditedPostVisibility:o,isCurrentPostPublished:r,isEditedPostSaveable:i,isEditedPostPublishable:a,isPostSavingLocked:l,getCurrentPost:c,getCurrentPostType:d,getCurrentPostId:u,hasNonPostEntityChanges:p,isSavingNonPostEntityChanges:m,getEditedPostAttribute:h,getPostEdits:g}=e(vc);return{isSaving:t(),isAutoSaving:s(),isBeingScheduled:n(),visibility:o(),isSaveable:i(),isPostSavingLocked:l(),isPublishable:a(),isPublished:r(),hasPublishAction:c()._links?.["wp:action-publish"]??!1,postType:d(),postId:u(),postStatus:h("status"),postStatusHasChanged:g()?.status,hasNonPostEntityChanges:p(),isSavingNonPostEntityChanges:m()}})),(0,d.withDispatch)((e=>{const{editPost:t,savePost:s}=e(vc);return{savePostStatus:e=>{t({status:e},{undoIgnore:!0}),s()}}}))])(Fp),Up=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,c.jsx)(L.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"})});const Hp=[{label:(0,fs.__)("Public"),value:"public",description:(0,fs.__)("Visible to everyone.")},{label:(0,fs.__)("Private"),value:"private",description:(0,fs.__)("Only visible to site admins and editors.")},{label:(0,fs.__)("Password protected"),value:"password",description:(0,fs.__)("Only visible to those who know the password.")}];function zp({onClose:e}){const t=(0,m.useInstanceId)(zp),{status:s,visibility:n,password:o}=(0,d.useSelect)((e=>({status:e(vc).getEditedPostAttribute("status"),visibility:e(vc).getEditedPostVisibility(),password:e(vc).getEditedPostAttribute("password")}))),{editPost:r}=(0,d.useDispatch)(vc),[i,a]=(0,p.useState)(!!o);return(0,c.jsxs)("div",{className:"editor-post-visibility",children:[(0,c.jsx)(g.__experimentalInspectorPopoverHeader,{title:(0,fs.__)("Visibility"),help:(0,fs.__)("Control how this post is viewed."),onClose:e}),(0,c.jsxs)(Hn.__experimentalVStack,{spacing:4,children:[(0,c.jsx)(Hn.RadioControl,{label:(0,fs.__)("Visibility"),hideLabelFromVision:!0,options:Hp,selected:i?"password":n,onChange:function(e){r({public:{status:"private"===n?"draft":s,password:""},private:{status:"private",password:""},password:{status:"private"===n?"draft":s,password:o||""}}[e]),a("password"===e)}}),i&&(0,c.jsx)(Hn.TextControl,{label:(0,fs.__)("Password"),onChange:e=>{r({password:e})},value:o,placeholder:(0,fs.__)("Use a secure password"),type:"text",id:`editor-post-visibility__password-input-${t}`,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,maxLength:255})]})]})}function Gp(){return $p()}function $p(){const e=(0,d.useSelect)((e=>e(vc).getEditedPostVisibility()),[]);return Hp.find((t=>t.value===e))?.label}function Wp(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Zp(e){const t=Wp(e);return t.setDate(1),t.setHours(0,0,0,0),t}function Yp(e){const t=Wp(e),s=t.getMonth();return t.setFullYear(t.getFullYear(),s+1,0),t.setHours(23,59,59,999),t}Math.pow(10,8);const qp=6e4,Kp=36e5;function Qp(e,t){const s=t?.additionalDigits??2,n=function(e){const t={},s=e.split(Xp.dateTimeDelimiter);let n;if(s.length>2)return t;/:/.test(s[0])?n=s[0]:(t.date=s[0],n=s[1],Xp.timeZoneDelimiter.test(t.date)&&(t.date=e.split(Xp.timeZoneDelimiter)[0],n=e.substr(t.date.length,e.length)));if(n){const e=Xp.timezone.exec(n);e?(t.time=n.replace(e[1],""),t.timezone=e[1]):t.time=n}return t}(e);let o;if(n.date){const e=function(e,t){const s=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),n=e.match(s);if(!n)return{year:NaN,restDateString:""};const o=n[1]?parseInt(n[1]):null,r=n[2]?parseInt(n[2]):null;return{year:null===r?o:100*r,restDateString:e.slice((n[1]||n[2]).length)}}(n.date,s);o=function(e,t){if(null===t)return new Date(NaN);const s=e.match(Jp);if(!s)return new Date(NaN);const n=!!s[4],o=sm(s[1]),r=sm(s[2])-1,i=sm(s[3]),a=sm(s[4]),l=sm(s[5])-1;if(n)return function(e,t,s){return t>=1&&t<=53&&s>=0&&s<=6}(0,a,l)?function(e,t,s){const n=new Date(0);n.setUTCFullYear(e,0,4);const o=n.getUTCDay()||7,r=7*(t-1)+s+1-o;return n.setUTCDate(n.getUTCDate()+r),n}(t,a,l):new Date(NaN);{const e=new Date(0);return function(e,t,s){return t>=0&&t<=11&&s>=1&&s<=(om[t]||(rm(e)?29:28))}(t,r,i)&&function(e,t){return t>=1&&t<=(rm(e)?366:365)}(t,o)?(e.setUTCFullYear(t,r,Math.max(o,i)),e):new Date(NaN)}}(e.restDateString,e.year)}if(!o||isNaN(o.getTime()))return new Date(NaN);const r=o.getTime();let i,a=0;if(n.time&&(a=function(e){const t=e.match(em);if(!t)return NaN;const s=nm(t[1]),n=nm(t[2]),o=nm(t[3]);if(!function(e,t,s){if(24===e)return 0===t&&0===s;return s>=0&&s<60&&t>=0&&t<60&&e>=0&&e<25}(s,n,o))return NaN;return s*Kp+n*qp+1e3*o}(n.time),isNaN(a)))return new Date(NaN);if(!n.timezone){const e=new Date(r+a),t=new Date(0);return t.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),t.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),t}return i=function(e){if("Z"===e)return 0;const t=e.match(tm);if(!t)return 0;const s="+"===t[1]?-1:1,n=parseInt(t[2]),o=t[3]&&parseInt(t[3])||0;if(!function(e,t){return t>=0&&t<=59}(0,o))return NaN;return s*(n*Kp+o*qp)}(n.timezone),isNaN(i)?new Date(NaN):new Date(r+a+i)}const Xp={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Jp=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,em=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,tm=/^([+-])(\d{2})(?::?(\d{2}))?$/;function sm(e){return e?parseInt(e):1}function nm(e){return e&&parseFloat(e.replace(",","."))||0}const om=[31,null,31,30,31,30,31,31,30,31,30,31];function rm(e){return e%400==0||e%4==0&&e%100!=0}const{PrivatePublishDateTimePicker:im}=$(g.privateApis);function am(e){return(0,c.jsx)(lm,{...e,showPopoverHeaderActions:!0,isCompact:!1})}function lm({onClose:e,showPopoverHeaderActions:t,isCompact:s}){const{postDate:n,postType:o}=(0,d.useSelect)((e=>({postDate:e(vc).getEditedPostAttribute("date"),postType:e(vc).getCurrentPostType()})),[]),{editPost:r}=(0,d.useDispatch)(vc),[i,a]=(0,p.useState)(Zp(new Date(n))),l=(0,d.useSelect)((e=>e(u.store).getEntityRecords("postType",o,{status:"publish,future",after:Zp(i).toISOString(),before:Yp(i).toISOString(),exclude:[e(vc).getCurrentPostId()],per_page:100,_fields:"id,date"})),[i,o]),m=(0,p.useMemo)((()=>(l||[]).map((({date:e})=>({date:new Date(e)})))),[l]),h=(0,v.getSettings)(),g=/a(?!\\)/i.test(h.formats.time.toLowerCase().replace(/\\\\/g,"").split("").reverse().join(""));return(0,c.jsx)(im,{currentDate:n,onChange:e=>r({date:e}),is12Hour:g,dateOrder:(0,fs._x)("dmy","date order"),events:m,onMonthPreviewed:e=>a(Qp(e)),onClose:e,isCompact:s,showPopoverHeaderActions:t})}function cm(e){return dm(e)}function dm({full:e=!1}={}){const{date:t,isFloating:s}=(0,d.useSelect)((e=>({date:e(vc).getEditedPostAttribute("date"),isFloating:e(vc).isEditedPostDateFloating()})),[]);return e?um(t):function(e,{isFloating:t=!1,now:s=new Date}={}){if(!e||t)return(0,fs.__)("Immediately");if(!function(e){const{timezone:t}=(0,v.getSettings)(),s=Number(t.offset),n=e.getTimezoneOffset()/60*-1;return s===n}(s))return um(e);const n=(0,v.getDate)(e);if(pm(n,s))return(0,fs.sprintf)((0,fs.__)("Today at %s"),(0,v.dateI18n)((0,fs._x)("g:i a","post schedule time format"),n));const o=new Date(s);if(o.setDate(o.getDate()+1),pm(n,o))return(0,fs.sprintf)((0,fs.__)("Tomorrow at %s"),(0,v.dateI18n)((0,fs._x)("g:i a","post schedule time format"),n));if(n.getFullYear()===s.getFullYear())return(0,v.dateI18n)((0,fs._x)("F j g:i a","post schedule date format without year"),n);return(0,v.dateI18n)((0,fs._x)("F j, Y g:i a","post schedule full date format"),n)}(t,{isFloating:s})}function um(e){const t=(0,v.getDate)(e),s=function(){const{timezone:e}=(0,v.getSettings)();if(e.abbr&&isNaN(Number(e.abbr)))return e.abbr;return`UTC${e.offset<0?"":"+"}${e.offsetFormatted}`}(),n=(0,v.dateI18n)((0,fs._x)("F j, Y g:i a","post schedule full date format"),t);return(0,fs.isRTL)()?`${s} ${n}`:`${n} ${s}`}function pm(e,t){return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}const mm=3,hm={per_page:10,orderby:"count",order:"desc",hide_empty:!0,_fields:"id,name,count",context:"view"};function gm({onSelect:e,taxonomy:t}){const{_terms:s,showTerms:n}=(0,d.useSelect)((e=>{const s=e(u.store).getEntityRecords("taxonomy",t.slug,hm);return{_terms:s,showTerms:s?.length>=mm}}),[t.slug]);if(!n)return null;const o=Ld(s);return(0,c.jsxs)("div",{className:"editor-post-taxonomies__flat-term-most-used",children:[(0,c.jsx)(Hn.BaseControl.VisualLabel,{as:"h3",className:"editor-post-taxonomies__flat-term-most-used-label",children:t.labels.most_used}),(0,c.jsx)("ul",{role:"list",className:"editor-post-taxonomies__flat-term-most-used-list",children:o.map((t=>(0,c.jsx)("li",{children:(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:()=>e(t),children:t.name})},t.id)))})]})}const _m=[],fm=100,bm={per_page:fm,_fields:"id,name",context:"view"},ym=(e,t)=>Ad(e).toLowerCase()===Ad(t).toLowerCase(),xm=(e,t)=>e.map((e=>t.find((t=>ym(t.name,e)))?.id)).filter((e=>void 0!==e)),vm=({children:e,__nextHasNoMarginBottom:t})=>t?(0,c.jsx)(Hn.__experimentalVStack,{spacing:4,children:e}):(0,c.jsx)(p.Fragment,{children:e});function wm({slug:e,__nextHasNoMarginBottom:t}){const[s,n]=(0,p.useState)([]),[o,r]=(0,p.useState)(""),i=(0,m.useDebounce)(r,500);t||k()("Bottom margin styles for wp.editor.PostTaxonomiesFlatTermSelector",{since:"6.7",version:"7.0",hint:"Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version."});const{terms:a,termIds:l,taxonomy:h,hasAssignAction:g,hasCreateAction:_,hasResolvedTerms:f}=(0,d.useSelect)((t=>{const{getCurrentPost:s,getEditedPostAttribute:n}=t(vc),{getEntityRecords:o,getEntityRecord:r,hasFinishedResolution:i}=t(u.store),a=s(),l=r("root","taxonomy",e),c=l?n(l.rest_base):_m,d={...bm,include:c?.join(","),per_page:-1};return{hasCreateAction:!!l&&(a._links?.["wp:action-create-"+l.rest_base]??!1),hasAssignAction:!!l&&(a._links?.["wp:action-assign-"+l.rest_base]??!1),taxonomy:l,termIds:c,terms:c?.length?o("taxonomy",e,d):_m,hasResolvedTerms:i("getEntityRecords",["taxonomy",e,d])}}),[e]),{searchResults:b}=(0,d.useSelect)((t=>{const{getEntityRecords:s}=t(u.store);return{searchResults:o?s("taxonomy",e,{...bm,search:o}):_m}}),[o,e]);(0,p.useEffect)((()=>{if(f){const e=(a??[]).map((e=>Ad(e.name)));n(e)}}),[a,f]);const y=(0,p.useMemo)((()=>(b??[]).map((e=>Ad(e.name)))),[b]),{editPost:x}=(0,d.useDispatch)(vc),{saveEntityRecord:v}=(0,d.useDispatch)(u.store),{createErrorNotice:w}=(0,d.useDispatch)(_s.store);if(!g)return null;function S(e){x({[h.rest_base]:e})}const C=h?.labels?.add_new_item??("post_tag"===e?(0,fs.__)("Add Tag"):(0,fs.__)("Add Term")),P=h?.labels?.singular_name??("post_tag"===e?(0,fs.__)("Tag"):(0,fs.__)("Term")),j=(0,fs.sprintf)((0,fs._x)("%s added","term"),P),E=(0,fs.sprintf)((0,fs._x)("%s removed","term"),P),T=(0,fs.sprintf)((0,fs._x)("Remove %s","term"),P);return(0,c.jsxs)(vm,{__nextHasNoMarginBottom:t,children:[(0,c.jsx)(Hn.FormTokenField,{__next40pxDefaultSize:!0,value:s,suggestions:y,onChange:function(t){const s=[...a??[],...b??[]],o=t.reduce(((e,t)=>(e.some((e=>e.toLowerCase()===t.toLowerCase()))||e.push(t),e)),[]),r=o.filter((e=>!s.find((t=>ym(t.name,e)))));n(o),0!==r.length?_&&Promise.all(r.map((t=>async function(t){try{const s=await v("taxonomy",e,t,{throwOnError:!0});return Md(s)}catch(e){if("term_exists"!==e.code)throw e;return{id:e.data.term_id,name:t.name}}}({name:t})))).then((e=>{const t=s.concat(e);S(xm(o,t))})).catch((e=>{w(e.message,{type:"snackbar"}),S(xm(o,s))})):S(xm(o,s))},onInputChange:i,maxSuggestions:fm,label:C,messages:{added:j,removed:E,remove:T},__nextHasNoMarginBottom:t}),(0,c.jsx)(gm,{taxonomy:h,onSelect:function(t){if(l.includes(t.id))return;const s=[...l,t.id],n="post_tag"===e?(0,fs.__)("Tag"):(0,fs.__)("Term"),o=(0,fs.sprintf)((0,fs._x)("%s added","term"),h?.labels?.singular_name??n);(0,ms.speak)(o,"assertive"),S(s)}})]})}var Sm=(0,Hn.withFilters)("editor.PostTaxonomyType")(wm);const km=()=>{const e=(0,d.useSelect)((e=>{const t=e(u.store).getTaxonomy("post_tag");return t?.labels}),[]),t=e?.add_new_item??(0,fs.__)("Add tag"),s=e?.name??(0,fs.__)("Tags"),n=[(0,fs.__)("Suggestion:"),(0,c.jsx)("span",{className:"editor-post-publish-panel__link",children:t},"label")];return(0,c.jsxs)(Hn.PanelBody,{initialOpen:!1,title:n,children:[(0,c.jsx)("p",{children:(0,fs.sprintf)((0,fs.__)("%s help users and search engines navigate your site and find your content. Add a few keywords to describe your post."),s)}),(0,c.jsx)(Sm,{slug:"post_tag",__nextHasNoMarginBottom:!0})]})};var Cm=()=>{const{postHasTags:e,siteHasTags:t,isPostTypeSupported:s}=(0,d.useSelect)((e=>{const t=e(vc).getCurrentPostType(),s=e(u.store).getEntityRecord("root","taxonomy","post_tag"),n=s?.types?.includes(t),o=void 0!==s,r=s&&e(vc).getEditedPostAttribute(s.rest_base),i=!!n&&!!e(u.store).getEntityRecords("taxonomy","post_tag",{per_page:1})?.length;return{postHasTags:!!r?.length,siteHasTags:i,isPostTypeSupported:o&&n}}),[]),[n]=(0,p.useState)(e);return s&&t?n?null:(0,c.jsx)(km,{}):null};const Pm=(e,t)=>Pp.filter((t=>e?.includes(t.id))).find((e=>e.id===t)),jm=({suggestedPostFormat:e,suggestionText:t,onUpdatePostFormat:s})=>(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:()=>s(e),children:t});function Em(){const{currentPostFormat:e,suggestion:t}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t,getSuggestedPostFormat:s}=e(vc),n=e(u.store).getThemeSupports().formats??[];return{currentPostFormat:t("format"),suggestion:Pm(n,s())}}),[]),{editPost:s}=(0,d.useDispatch)(vc),n=[(0,fs.__)("Suggestion:"),(0,c.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,fs.__)("Use a post format")},"label")];return t&&t.id!==e?(0,c.jsxs)(Hn.PanelBody,{initialOpen:!1,title:n,children:[(0,c.jsx)("p",{children:(0,fs.__)("Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.")}),(0,c.jsx)("p",{children:(0,c.jsx)(jm,{onUpdatePostFormat:e=>s({format:e}),suggestedPostFormat:t.id,suggestionText:(0,fs.sprintf)((0,fs.__)('Apply the "%1$s" format.'),t.caption)})})]}):null}const{normalizeTextString:Tm}=$(Hn.privateApis),{RECEIVE_INTERMEDIATE_RESULTS:Im}=$(u.privateApis),Bm={per_page:-1,orderby:"name",order:"asc",_fields:"id,name,parent",context:"view",[Im]:!0},Nm=8,Rm=[];function Dm({slug:e}){const[t,s]=(0,p.useState)(!1),[n,o]=(0,p.useState)(""),[r,i]=(0,p.useState)(""),[a,l]=(0,p.useState)(!1),[h,g]=(0,p.useState)(""),[_,f]=(0,p.useState)([]),b=(0,m.useDebounce)(ms.speak,500),{hasCreateAction:y,hasAssignAction:x,terms:v,loading:w,availableTerms:S,taxonomy:k}=(0,d.useSelect)((t=>{const{getCurrentPost:s,getEditedPostAttribute:n}=t(vc),{getEntityRecord:o,getEntityRecords:r,isResolving:i}=t(u.store),a=o("root","taxonomy",e),l=s();return{hasCreateAction:!!a&&!!l._links?.["wp:action-create-"+a.rest_base],hasAssignAction:!!a&&!!l._links?.["wp:action-assign-"+a.rest_base],terms:a?n(a.rest_base):Rm,loading:i("getEntityRecords",["taxonomy",e,Bm]),availableTerms:r("taxonomy",e,Bm)||Rm,taxonomy:a}}),[e]),{editPost:C}=(0,d.useDispatch)(vc),{saveEntityRecord:P}=(0,d.useDispatch)(u.store),j=(0,p.useMemo)((()=>function(e,t){const s=e=>-1!==t.indexOf(e.id)||void 0!==e.children&&e.children.map(s).filter((e=>e)).length>0,n=[...e];return n.sort(((e,t)=>{const n=s(e),o=s(t);return n===o?0:n&&!o?-1:!n&&o?1:0})),n}(Dd(S),v)),[S]),{createErrorNotice:E}=(0,d.useDispatch)(_s.store);if(!x)return null;const T=e=>{C({[k.rest_base]:e})},I=e=>e.map((e=>(0,c.jsxs)("div",{className:"editor-post-taxonomies__hierarchical-terms-choice",children:[(0,c.jsx)(Hn.CheckboxControl,{__nextHasNoMarginBottom:!0,checked:-1!==v.indexOf(e.id),onChange:()=>{(e=>{const t=v.includes(e)?v.filter((t=>t!==e)):[...v,e];T(t)})(parseInt(e.id,10))},label:(0,Ln.decodeEntities)(e.name)}),!!e.children.length&&(0,c.jsx)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices",children:I(e.children)})]},e.id))),B=(t,s,n)=>k?.labels?.[t]??("category"===e?s:n),N=B("add_new_item",(0,fs.__)("Add Category"),(0,fs.__)("Add Term")),R=B("new_item_name",(0,fs.__)("Add Category"),(0,fs.__)("Add Term")),D=B("parent_item",(0,fs.__)("Parent Category"),(0,fs.__)("Parent Term")),A=`— ${D} —`,M=N,L=k?.labels?.search_items??(0,fs.__)("Search Terms"),O=k?.name??(0,fs.__)("Terms"),F=S.length>=Nm;return(0,c.jsxs)(Hn.Flex,{direction:"column",gap:"4",children:[F&&!w&&(0,c.jsx)(Hn.SearchControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:L,placeholder:L,value:h,onChange:e=>{const t=j.map(function(e){const t=s=>{if(""===e)return s;const n={...s};return n.children.length>0&&(n.children=n.children.map(t).filter((e=>e))),(-1!==Tm(n.name).indexOf(Tm(e))||n.children.length>0)&&n};return t}(e)).filter((e=>e)),s=e=>{let t=0;for(let n=0;n<e.length;n++)t++,void 0!==e[n].children&&(t+=s(e[n].children));return t};g(e),f(t);const n=s(t),o=(0,fs.sprintf)((0,fs._n)("%d result found.","%d results found.",n),n);b(o,"assertive")}}),w&&(0,c.jsx)(Hn.Flex,{justify:"center",style:{height:"40px"},children:(0,c.jsx)(Hn.Spinner,{})}),(0,c.jsx)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":O,children:I(""!==h?_:j)}),!w&&y&&(0,c.jsx)(Hn.FlexItem,{children:(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,onClick:()=>{l(!a)},className:"editor-post-taxonomies__hierarchical-terms-add","aria-expanded":a,variant:"link",children:N})}),a&&(0,c.jsx)("form",{onSubmit:async a=>{if(a.preventDefault(),""===n||t)return;const l=function(e,t,s){return e.find((e=>(!e.parent&&!t||parseInt(e.parent)===parseInt(t))&&e.name.toLowerCase()===s.toLowerCase()))}(S,r,n);if(l)return v.some((e=>e===l.id))||T([...v,l.id]),o(""),void i("");let c;s(!0);try{c=await(d={name:n,parent:r||void 0},P("taxonomy",e,d,{throwOnError:!0}))}catch(e){return void E(e.message,{type:"snackbar"})}var d;const u="category"===e?(0,fs.__)("Category"):(0,fs.__)("Term"),p=(0,fs.sprintf)((0,fs._x)("%s added","term"),k?.labels?.singular_name??u);(0,ms.speak)(p,"assertive"),s(!1),o(""),i(""),T([...v,c.id])},children:(0,c.jsxs)(Hn.Flex,{direction:"column",gap:"4",children:[(0,c.jsx)(Hn.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:R,value:n,onChange:e=>{o(e)},required:!0}),!!S.length&&(0,c.jsx)(Hn.TreeSelect,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:D,noOptionLabel:A,onChange:e=>{i(e)},selectedId:r,tree:j}),(0,c.jsx)(Hn.FlexItem,{children:(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",children:M})})]})})]})}var Am=(0,Hn.withFilters)("editor.PostTaxonomyType")(Dm);var Mm=function(){const{hasNoCategory:e,hasSiteCategories:t}=(0,d.useSelect)((e=>{const t=e(vc).getCurrentPostType(),{canUser:s,getEntityRecord:n}=e(u.store),o=n("root","taxonomy","category"),r=s("read",{kind:"root",name:"site"})?n("root","site")?.default_category:void 0,i=r?n("taxonomy","category",r):void 0,a=o&&o.types.some((e=>e===t)),l=o&&e(vc).getEditedPostAttribute(o.rest_base),c=!!a&&!!e(u.store).getEntityRecords("taxonomy","category",{exclude:[r],per_page:1})?.length;return{hasNoCategory:!!o&&!!i&&a&&(0===l?.length||1===l?.length&&i?.id===l[0]),hasSiteCategories:c}}),[]),[s,n]=(0,p.useState)(!1);if((0,p.useEffect)((()=>{e&&n(!0)}),[e]),!s||!t)return null;const o=[(0,fs.__)("Suggestion:"),(0,c.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,fs.__)("Assign a category")},"label")];return(0,c.jsxs)(Hn.PanelBody,{initialOpen:!1,title:o,children:[(0,c.jsx)("p",{children:(0,fs.__)("Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.")}),(0,c.jsx)(Am,{slug:"category"})]})};function Lm(e){return Object.fromEntries(Object.entries(function(e){const t=new Set;return Object.fromEntries(e.map((e=>{const s=(0,w.getFilename)(e);let n="";if(s){const e=s.split(".");e.length>1&&e.pop(),n=e.join(".")}return n||(n=fi()),t.has(n)&&(n=`${n}-${fi()}`),t.add(n),[e,n]})))}(e)).map((([e,t])=>{const s=window.fetch(e.includes("?")?e:e+"?").then((e=>e.blob())).then((e=>new File([e],`${t}.png`,{type:e.type})));return[e,s]})))}function Om(e){const t=[];return e.forEach((e=>{t.push(e),t.push(...Om(e.innerBlocks))})),t}function Fm(e){if("core/image"===e.name||"core/cover"===e.name){const{url:t,alt:s,id:n}=e.attributes;return{url:t,alt:s,id:n}}if("core/media-text"===e.name){const{mediaUrl:t,mediaAlt:s,mediaId:n}=e.attributes;return{url:t,alt:s,id:n}}return{}}function Vm({clientId:e,alt:t,url:s}){const{selectBlock:n}=(0,d.useDispatch)(g.store);return(0,c.jsx)(Hn.__unstableMotion.img,{tabIndex:0,role:"button","aria-label":(0,fs.__)("Select image block."),onClick:()=>{n(e)},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(n(e),t.preventDefault())},alt:t,src:s,animate:{opacity:1},exit:{opacity:0,scale:0},style:{width:"32px",height:"32px",objectFit:"cover",borderRadius:"2px",cursor:"pointer"},whileHover:{scale:1.08}},e)}function Um(){const[e,t]=(0,p.useState)(!1),[s,n]=(0,p.useState)(!1),[o,r]=(0,p.useState)(!1),{editorBlocks:i,mediaUpload:a}=(0,d.useSelect)((e=>({editorBlocks:e(g.store).getBlocks(),mediaUpload:e(g.store).getSettings().mediaUpload})),[]),l=Om(i).filter((e=>function(e){return"core/image"===e.name||"core/cover"===e.name?e.attributes.url&&!e.attributes.id:"core/media-text"===e.name?e.attributes.mediaUrl&&!e.attributes.mediaId:void 0}(e))),{updateBlockAttributes:u}=(0,d.useDispatch)(g.store);if(!a||!l.length)return null;const m=[(0,fs.__)("Suggestion:"),(0,c.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,fs.__)("External media")},"label")];return(0,c.jsxs)(Hn.PanelBody,{initialOpen:!0,title:m,children:[(0,c.jsx)("p",{children:(0,fs.__)("Upload external images to the Media Library. Images from different domains may load slowly, display incorrectly, or be removed unexpectedly.")}),(0,c.jsxs)("div",{style:{display:"inline-flex",flexWrap:"wrap",gap:"8px"},children:[(0,c.jsx)(Hn.__unstableAnimatePresence,{onExitComplete:()=>n(!1),children:l.map((e=>{const{url:t,alt:s}=Fm(e);return(0,c.jsx)(Vm,{clientId:e.clientId,url:t,alt:s},e.clientId)}))}),e||s?(0,c.jsx)(Hn.Spinner,{}):(0,c.jsx)(Hn.Button,{size:"compact",variant:"primary",onClick:function(){t(!0),r(!1);const e=new Set(l.map((e=>{const{url:t}=Fm(e);return t}))),s=Object.fromEntries(Object.entries(Lm([...e])).map((([e,t])=>[e,t.then((e=>new Promise(((t,s)=>{a({filesList:[e],onFileChange:([e])=>{(0,Go.isBlobURL)(e.url)||t(e)},onError(){s()}})}))))])));Promise.allSettled(l.map((e=>{const{url:t}=Fm(e);return s[t].then((t=>function(e,t){"core/image"!==e.name&&"core/cover"!==e.name||u(e.clientId,{id:t.id,url:t.url}),"core/media-text"===e.name&&u(e.clientId,{mediaId:t.id,mediaUrl:t.url})}(e,t))).then((()=>n(!0))).catch((()=>r(!0)))}))).finally((()=>{t(!1)}))},children:(0,fs._x)("Upload","verb")})]}),o&&(0,c.jsx)("p",{children:(0,fs.__)("Upload failed, try again.")})]})}var Hm=function({children:e}){const{isBeingScheduled:t,isRequestingSiteIcon:s,hasPublishAction:n,siteIconUrl:o,siteTitle:r,siteHome:i}=(0,d.useSelect)((e=>{const{getCurrentPost:t,isEditedPostBeingScheduled:s}=e(vc),{getEntityRecord:n,isResolving:o}=e(u.store),r=n("root","__unstableBase",void 0)||{};return{hasPublishAction:t()._links?.["wp:action-publish"]??!1,isBeingScheduled:s(),isRequestingSiteIcon:o("getEntityRecord",["root","__unstableBase",void 0]),siteIconUrl:r.site_icon_url,siteTitle:r.name,siteHome:r.home&&(0,w.filterURLForDisplay)(r.home)}}),[]);let a,l,p=(0,c.jsx)(Hn.Icon,{className:"components-site-icon",size:"36px",icon:Up});return o&&(p=(0,c.jsx)("img",{alt:(0,fs.__)("Site Icon"),className:"components-site-icon",src:o})),s&&(p=null),n?t?(a=(0,fs.__)("Are you ready to schedule?"),l=(0,fs.__)("Your work will be published at the specified date and time.")):(a=(0,fs.__)("Are you ready to publish?"),l=(0,fs.__)("Double-check your settings before publishing.")):(a=(0,fs.__)("Are you ready to submit for review?"),l=(0,fs.__)("Your work will be reviewed and then approved.")),(0,c.jsxs)("div",{className:"editor-post-publish-panel__prepublish",children:[(0,c.jsx)("div",{children:(0,c.jsx)("strong",{children:a})}),(0,c.jsx)("p",{children:l}),(0,c.jsxs)("div",{className:"components-site-card",children:[p,(0,c.jsxs)("div",{className:"components-site-info",children:[(0,c.jsx)("span",{className:"components-site-name",children:(0,Ln.decodeEntities)(r)||(0,fs.__)("(Untitled)")}),(0,c.jsx)("span",{className:"components-site-home",children:i})]})]}),(0,c.jsx)(Um,{}),n&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.PanelBody,{initialOpen:!1,title:[(0,fs.__)("Visibility:"),(0,c.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,c.jsx)(Gp,{})},"label")],children:(0,c.jsx)(zp,{})}),(0,c.jsx)(Hn.PanelBody,{initialOpen:!1,title:[(0,fs.__)("Publish:"),(0,c.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,c.jsx)(cm,{})},"label")],children:(0,c.jsx)(am,{})})]}),(0,c.jsx)(Em,{}),(0,c.jsx)(Cm,{}),(0,c.jsx)(Mm,{}),e]})};const zm="%postname%",Gm="%pagename%";function $m({text:e}){const[t,s]=(0,p.useState)(!1),n=(0,p.useRef)(),o=(0,m.useCopyToClipboard)(e,(()=>{s(!0),n.current&&clearTimeout(n.current),n.current=setTimeout((()=>{s(!1)}),4e3)}));return(0,p.useEffect)((()=>()=>{n.current&&clearTimeout(n.current)}),[]),(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"secondary",ref:o,children:t?(0,fs.__)("Copied!"):(0,fs.__)("Copy")})}function Wm({focusOnMount:e,children:t}){const{post:s,postType:n,isScheduled:o}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t,getCurrentPost:s,isCurrentPostScheduled:n}=e(vc),{getPostType:o}=e(u.store);return{post:s(),postType:o(t("type")),isScheduled:n()}}),[]),r=n?.labels?.singular_name,i=n?.labels?.view_item,a=n?.labels?.add_new_item,l="future"===s.status?(e=>{const{slug:t}=e;return e.permalink_template.includes(zm)?e.permalink_template.replace(zm,t):e.permalink_template.includes(Gm)?e.permalink_template.replace(Gm,t):e.permalink_template})(s):s.link,m=(0,w.addQueryArgs)("post-new.php",{post_type:s.type}),h=(0,p.useCallback)((t=>{e&&t&&t.focus()}),[e]),g=o?(0,c.jsxs)(c.Fragment,{children:[(0,fs.__)("is now scheduled. It will go live on")," ",(0,c.jsx)(cm,{}),"."]}):(0,fs.__)("is now live.");return(0,c.jsxs)("div",{className:"post-publish-panel__postpublish",children:[(0,c.jsxs)(Hn.PanelBody,{className:"post-publish-panel__postpublish-header",children:[(0,c.jsx)(Hn.ExternalLink,{ref:h,href:l,children:(0,Ln.decodeEntities)(s.title)||(0,fs.__)("(no title)")})," ",g]}),(0,c.jsxs)(Hn.PanelBody,{children:[(0,c.jsx)("p",{className:"post-publish-panel__postpublish-subheader",children:(0,c.jsx)("strong",{children:(0,fs.__)("What’s next?")})}),(0,c.jsxs)("div",{className:"post-publish-panel__postpublish-post-address-container",children:[(0,c.jsx)(Hn.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,className:"post-publish-panel__postpublish-post-address",readOnly:!0,label:(0,fs.sprintf)((0,fs.__)("%s address"),r),value:(0,w.safeDecodeURIComponent)(l),onFocus:e=>e.target.select()}),(0,c.jsx)("div",{className:"post-publish-panel__postpublish-post-address__copy-button-wrap",children:(0,c.jsx)($m,{text:l})})]}),(0,c.jsxs)("div",{className:"post-publish-panel__postpublish-buttons",children:[!o&&(0,c.jsxs)(Hn.Button,{variant:"primary",href:l,__next40pxDefaultSize:!0,icon:Fn,iconPosition:"right",target:"_blank",children:[i,(0,c.jsx)(Hn.VisuallyHidden,{as:"span",children:(0,fs.__)("(opens in a new tab)")})]}),(0,c.jsx)(Hn.Button,{variant:o?"primary":"secondary",__next40pxDefaultSize:!0,href:m,children:a})]})]}),t]})}class Zm extends p.Component{constructor(){super(...arguments),this.onSubmit=this.onSubmit.bind(this),this.cancelButtonNode=(0,p.createRef)()}componentDidMount(){this.timeoutID=setTimeout((()=>{this.cancelButtonNode.current.focus()}),0)}componentWillUnmount(){clearTimeout(this.timeoutID)}componentDidUpdate(e){(e.isPublished&&!this.props.isSaving&&this.props.isDirty||this.props.currentPostId!==e.currentPostId)&&this.props.onClose()}onSubmit(){const{onClose:e,hasPublishAction:t,isPostTypeViewable:s}=this.props;t&&s||e()}render(){const{forceIsDirty:e,isBeingScheduled:t,isPublished:s,isPublishSidebarEnabled:n,isScheduled:o,isSaving:r,isSavingNonPostEntityChanges:i,onClose:a,onTogglePublishSidebar:l,PostPublishExtension:d,PrePublishExtension:u,currentPostId:p,...m}=this.props,{hasPublishAction:h,isDirty:g,isPostTypeViewable:_,...f}=m,b=s||o&&t,y=!b&&!r,x=b&&!r;return(0,c.jsxs)("div",{className:"editor-post-publish-panel",...f,children:[(0,c.jsx)("div",{className:"editor-post-publish-panel__header",children:x?(0,c.jsx)(Hn.Button,{size:"compact",onClick:a,icon:la,label:(0,fs.__)("Close panel")}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"editor-post-publish-panel__header-cancel-button",children:(0,c.jsx)(Hn.Button,{ref:this.cancelButtonNode,accessibleWhenDisabled:!0,disabled:i,onClick:a,variant:"secondary",size:"compact",children:(0,fs.__)("Cancel")})}),(0,c.jsx)("div",{className:"editor-post-publish-panel__header-publish-button",children:(0,c.jsx)(Vp,{onSubmit:this.onSubmit,forceIsDirty:e})})]})}),(0,c.jsxs)("div",{className:"editor-post-publish-panel__content",children:[y&&(0,c.jsx)(Hm,{children:u&&(0,c.jsx)(u,{})}),x&&(0,c.jsx)(Wm,{focusOnMount:!0,children:d&&(0,c.jsx)(d,{})}),r&&(0,c.jsx)(Hn.Spinner,{})]}),(0,c.jsx)("div",{className:"editor-post-publish-panel__footer",children:(0,c.jsx)(Hn.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,fs.__)("Always show pre-publish checks."),checked:n,onChange:l})})]})}}var Ym=(0,m.compose)([(0,d.withSelect)((e=>{const{getPostType:t}=e(u.store),{getCurrentPost:s,getCurrentPostId:n,getEditedPostAttribute:o,isCurrentPostPublished:r,isCurrentPostScheduled:i,isEditedPostBeingScheduled:a,isEditedPostDirty:l,isAutosavingPost:c,isSavingPost:d,isSavingNonPostEntityChanges:p}=e(vc),{isPublishSidebarEnabled:m}=e(vc),h=t(o("type"));return{hasPublishAction:s()._links?.["wp:action-publish"]??!1,isPostTypeViewable:h?.viewable,isBeingScheduled:a(),isDirty:l(),isPublished:r(),isPublishSidebarEnabled:m(),isSaving:d()&&!c(),isSavingNonPostEntityChanges:p(),isScheduled:i(),currentPostId:n()}})),(0,d.withDispatch)(((e,{isPublishSidebarEnabled:t})=>{const{disablePublishSidebar:s,enablePublishSidebar:n}=e(vc);return{onTogglePublishSidebar:()=>{t?s():n()}}})),Hn.withFocusReturn,Hn.withConstrainedTabbing])(Zm),qm=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M17.3 10.1C17.3 7.60001 15.2 5.70001 12.5 5.70001C10.3 5.70001 8.4 7.10001 7.9 9.00001H7.7C5.7 9.00001 4 10.7 4 12.8C4 14.9 5.7 16.6 7.7 16.6H9.5V15.2H7.7C6.5 15.2 5.5 14.1 5.5 12.9C5.5 11.7 6.5 10.5 7.7 10.5H9L9.3 9.40001C9.7 8.10001 11 7.20001 12.5 7.20001C14.3 7.20001 15.8 8.50001 15.8 10.1V11.4L17.1 11.6C17.9 11.7 18.5 12.5 18.5 13.4C18.5 14.4 17.7 15.2 16.8 15.2H14.5V16.6H16.7C18.5 16.6 19.9 15.1 19.9 13.3C20 11.7 18.8 10.4 17.3 10.1Z M14.1245 14.2426L15.1852 13.182L12.0032 10L8.82007 13.1831L9.88072 14.2438L11.25 12.8745V18H12.75V12.8681L14.1245 14.2426Z"})}),Km=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z"})});function Qm({children:e}){const{hasStickyAction:t,postType:s}=(0,d.useSelect)((e=>{const t=e(vc).getCurrentPost();return{hasStickyAction:t._links?.["wp:action-sticky"]??!1,postType:e(vc).getCurrentPostType()}}),[]);return"post"===s&&t?e:null}function Xm(){const e=(0,d.useSelect)((e=>e(vc).getEditedPostAttribute("sticky")??!1),[]),{editPost:t}=(0,d.useDispatch)(vc);return(0,c.jsx)(Qm,{children:(0,c.jsx)(Hn.CheckboxControl,{className:"editor-post-sticky__checkbox-control",label:(0,fs.__)("Sticky"),help:(0,fs.__)("Pin this post to the top of the blog."),checked:e,onChange:()=>t({sticky:!e}),__nextHasNoMarginBottom:!0})})}const Jm={"auto-draft":{label:(0,fs.__)("Draft"),icon:br},draft:{label:(0,fs.__)("Draft"),icon:br},pending:{label:(0,fs.__)("Pending"),icon:xr},private:{label:(0,fs.__)("Private"),icon:vr},future:{label:(0,fs.__)("Scheduled"),icon:yr},publish:{label:(0,fs.__)("Published"),icon:wr}},eh=[{label:(0,fs.__)("Draft"),value:"draft",description:(0,fs.__)("Not ready to publish.")},{label:(0,fs.__)("Pending"),value:"pending",description:(0,fs.__)("Waiting for review before publishing.")},{label:(0,fs.__)("Private"),value:"private",description:(0,fs.__)("Only visible to site admins and editors.")},{label:(0,fs.__)("Scheduled"),value:"future",description:(0,fs.__)("Publish automatically on a chosen date.")},{label:(0,fs.__)("Published"),value:"publish",description:(0,fs.__)("Visible to everyone.")}],th=[I,B,N,R];function sh(){const{status:e,date:t,password:s,postId:n,postType:o,canEdit:r}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t,getCurrentPostId:s,getCurrentPostType:n,getCurrentPost:o}=e(vc);return{status:t("status"),date:t("date"),password:t("password"),postId:s(),postType:n(),canEdit:o()._links?.["wp:action-publish"]??!1}}),[]),[i,a]=(0,p.useState)(!!s),l=(0,m.useInstanceId)(sh,"editor-change-status__password-input"),{editEntityRecord:h}=(0,d.useDispatch)(u.store),[_,f]=(0,p.useState)(null),b=(0,p.useMemo)((()=>({anchor:_,"aria-label":(0,fs.__)("Status & visibility"),headerTitle:(0,fs.__)("Status & visibility"),placement:"left-start",offset:36,shift:!0})),[_]);if(th.includes(o))return null;const y=({status:r=e,password:i=s,date:a=t})=>{h("postType",o,n,{status:r,date:a,password:i})},x=e=>{a(e),e||y({password:""})},v=n=>{let o=t,r=s;"future"===e&&new Date(t)>new Date&&(o=null),"private"===n&&s&&(r=""),y({status:n,date:o,password:r})};return(0,c.jsx)(Rd,{label:(0,fs.__)("Status"),ref:f,children:r?(0,c.jsx)(Hn.Dropdown,{className:"editor-post-status",contentClassName:"editor-change-status__content",popoverProps:b,focusOnMount:!0,renderToggle:({onToggle:t,isOpen:s})=>(0,c.jsx)(Hn.Button,{className:"editor-post-status__toggle",variant:"tertiary",size:"compact",onClick:t,icon:Jm[e]?.icon,"aria-label":(0,fs.sprintf)((0,fs.__)("Change status: %s"),Jm[e]?.label),"aria-expanded":s,children:Jm[e]?.label}),renderContent:({onClose:t})=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(g.__experimentalInspectorPopoverHeader,{title:(0,fs.__)("Status & visibility"),onClose:t}),(0,c.jsx)("form",{onSubmit:e=>{e.preventDefault(),t()},children:(0,c.jsxs)(Hn.__experimentalVStack,{spacing:4,children:[(0,c.jsx)(Hn.RadioControl,{className:"editor-change-status__options",hideLabelFromVision:!0,label:(0,fs.__)("Status"),options:eh,onChange:v,selected:"auto-draft"===e?"draft":e}),"future"===e&&(0,c.jsx)("div",{className:"editor-change-status__publish-date-wrapper",children:(0,c.jsx)(lm,{showPopoverHeaderActions:!1,isCompact:!0})}),"private"!==e&&(0,c.jsxs)(Hn.__experimentalVStack,{as:"fieldset",spacing:4,className:"editor-change-status__password-fieldset",children:[(0,c.jsx)(Hn.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,fs.__)("Password protected"),help:(0,fs.__)("Only visible to those who know the password."),checked:i,onChange:x}),i&&(0,c.jsx)("div",{className:"editor-change-status__password-input",children:(0,c.jsx)(Hn.TextControl,{label:(0,fs.__)("Password"),onChange:e=>y({password:e}),value:s,placeholder:(0,fs.__)("Use a secure password"),type:"text",id:l,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,maxLength:255})})]}),(0,c.jsx)(Xm,{})]})})]})}):(0,c.jsx)("div",{className:"editor-post-status is-read-only",children:Jm[e]?.label})})}function nh({forceIsDirty:e}){const[t,s]=(0,p.useState)(!1),n=(0,m.useViewportMatch)("small"),{isAutosaving:o,isDirty:r,isNew:i,isPublished:a,isSaveable:l,isSaving:u,isScheduled:h,hasPublishAction:g,showIconLabels:_,postStatus:f,postStatusHasChanged:b}=(0,d.useSelect)((t=>{const{isEditedPostNew:s,isCurrentPostPublished:n,isCurrentPostScheduled:o,isEditedPostDirty:r,isSavingPost:i,isEditedPostSaveable:a,getCurrentPost:l,isAutosavingPost:c,getEditedPostAttribute:d,getPostEdits:u}=t(vc),{get:p}=t(C.store);return{isAutosaving:c(),isDirty:e||r(),isNew:s(),isPublished:n(),isSaving:i(),isSaveable:a(),isScheduled:o(),hasPublishAction:l()?._links?.["wp:action-publish"]??!1,showIconLabels:p("core","showIconLabels"),postStatus:d("status"),postStatusHasChanged:!!u()?.status}}),[e]),y="pending"===f,{savePost:x}=(0,d.useDispatch)(vc),v=(0,m.usePrevious)(u);if((0,p.useEffect)((()=>{let e;return v&&!u&&(s(!0),e=setTimeout((()=>{s(!1)}),1e3)),()=>clearTimeout(e)}),[u]),!g&&y)return null;const w=!["pending","draft","auto-draft"].includes(f)&&eh.map((({value:e})=>e)).includes(f);if(a||h||w||b&&["pending","draft"].includes(f))return null;const S=y?(0,fs.__)("Save as pending"):(0,fs.__)("Save draft"),k=(0,fs.__)("Save"),P=t||!i&&!r,j=u||P,E=u||P||!l;let T;return u?T=o?(0,fs.__)("Autosaving"):(0,fs.__)("Saving"):P?T=(0,fs.__)("Saved"):n?T=S:_&&(T=k),(0,c.jsxs)(Hn.Button,{className:l||u?mr({"editor-post-save-draft":!j,"editor-post-saved-state":j,"is-saving":u,"is-autosaving":o,"is-saved":P,[(0,Hn.__unstableGetAnimateClassName)({type:"loading"})]:u}):void 0,onClick:E?void 0:()=>x(),shortcut:E?void 0:ll.displayShortcut.primary("s"),variant:"tertiary",size:"compact",icon:n?void 0:qm,label:T||S,"aria-disabled":E,children:[j&&(0,c.jsx)(ei,{icon:P?zn:Km}),T]})}function oh({children:e}){return(0,d.useSelect)((e=>e(vc).getCurrentPost()._links?.["wp:action-publish"]??!1),[])?e:null}const rh=[I,B,N,R];function ih(){const[e,t]=(0,p.useState)(null),s=(0,d.useSelect)((e=>e(vc).getCurrentPostType()),[]),n=(0,p.useMemo)((()=>({anchor:e,"aria-label":(0,fs.__)("Change publish date"),placement:"left-start",offset:36,shift:!0})),[e]),o=dm(),r=dm({full:!0});return rh.includes(s)?null:(0,c.jsx)(oh,{children:(0,c.jsx)(Rd,{label:(0,fs.__)("Publish"),ref:t,children:(0,c.jsx)(Hn.Dropdown,{popoverProps:n,focusOnMount:!0,className:"editor-post-schedule__panel-dropdown",contentClassName:"editor-post-schedule__dialog",renderToggle:({onToggle:e,isOpen:t})=>(0,c.jsx)(Hn.Button,{size:"compact",className:"editor-post-schedule__dialog-toggle",variant:"tertiary",tooltipPosition:"middle left",onClick:e,"aria-label":(0,fs.sprintf)((0,fs.__)("Change date: %s"),o),label:r,showTooltip:o!==r,"aria-expanded":t,children:o}),renderContent:({onClose:e})=>(0,c.jsx)(am,{onClose:e})})})})}function ah(){k()("wp.editor.PostSwitchToDraftButton",{since:"6.7",version:"6.9"});const[e,t]=(0,p.useState)(!1),{editPost:s,savePost:n}=(0,d.useDispatch)(vc),{isSaving:o,isPublished:r,isScheduled:i}=(0,d.useSelect)((e=>{const{isSavingPost:t,isCurrentPostPublished:s,isCurrentPostScheduled:n}=e(vc);return{isSaving:t(),isPublished:s(),isScheduled:n()}}),[]),a=o||!r&&!i;let l,u;r?(l=(0,fs.__)("Are you sure you want to unpublish this post?"),u=(0,fs.__)("Unpublish")):i&&(l=(0,fs.__)("Are you sure you want to unschedule this post?"),u=(0,fs.__)("Unschedule"));return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,className:"editor-post-switch-to-draft",onClick:()=>{a||t(!0)},"aria-disabled":a,variant:"secondary",style:{flexGrow:"1",justifyContent:"center"},children:(0,fs.__)("Switch to draft")}),(0,c.jsx)(Hn.__experimentalConfirmDialog,{isOpen:e,onConfirm:()=>{t(!1),s({status:"draft"}),n()},onCancel:()=>t(!1),confirmButtonText:u,children:l})]})}function lh(){const{syncStatus:e,postType:t}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t}=e(vc),s=t("meta");return{syncStatus:"unsynced"===s?.wp_pattern_sync_status?"unsynced":t("wp_pattern_sync_status"),postType:t("type")}}));return"wp_block"!==t?null:(0,c.jsx)(Rd,{label:(0,fs.__)("Sync status"),children:(0,c.jsx)("div",{className:"editor-post-sync-status__value",children:"unsynced"===e?(0,fs._x)("Not synced","pattern (singular)"):(0,fs._x)("Synced","pattern (singular)")})})}const ch=e=>e;var dh=function({taxonomyWrapper:e=ch}){const{postType:t,taxonomies:s}=(0,d.useSelect)((e=>({postType:e(vc).getCurrentPostType(),taxonomies:e(u.store).getEntityRecords("root","taxonomy",{per_page:-1})})),[]);return(s??[]).filter((e=>e.types.includes(t)&&e.visibility?.show_ui)).map((t=>{const s=t.hierarchical?Am:Sm,n={slug:t.slug,...t.hierarchical?{}:{__nextHasNoMarginBottom:!0}};return(0,c.jsx)(p.Fragment,{children:e((0,c.jsx)(s,{...n}),t)},`taxonomy-${t.slug}`)}))};function uh({children:e}){const t=(0,d.useSelect)((e=>{const t=e(vc).getCurrentPostType(),s=e(u.store).getEntityRecords("root","taxonomy",{per_page:-1});return s?.some((e=>e.types.includes(t)))}),[]);return t?e:null}function ph({taxonomy:e,children:t}){const s=e?.slug,n=s?`taxonomy-panel-${s}`:"",{isEnabled:o,isOpened:r}=(0,d.useSelect)((e=>{const{isEditorPanelEnabled:t,isEditorPanelOpened:o}=e(vc);return{isEnabled:!!s&&t(n),isOpened:!!s&&o(n)}}),[n,s]),{toggleEditorPanelOpened:i}=(0,d.useDispatch)(vc);if(!o)return null;const a=e?.labels?.menu_name;return a?(0,c.jsx)(Hn.PanelBody,{title:a,opened:r,onToggle:()=>i(n),children:t}):null}function mh(){return(0,c.jsx)(uh,{children:(0,c.jsx)(dh,{taxonomyWrapper:(e,t)=>(0,c.jsx)(ph,{taxonomy:t,children:e})})})}var hh=s(4132);function gh(){const e=(0,m.useInstanceId)(gh),{content:t,blocks:s,type:n,id:o}=(0,d.useSelect)((e=>{const{getEditedEntityRecord:t}=e(u.store),{getCurrentPostType:s,getCurrentPostId:n}=e(vc),o=s(),r=n(),i=t("postType",o,r);return{content:i?.content,blocks:i?.blocks,type:o,id:r}}),[]),{editEntityRecord:r}=(0,d.useDispatch)(u.store),i=(0,p.useMemo)((()=>t instanceof Function?t({blocks:s}):s?(0,x.__unstableSerializeAndClean)(s):t),[t,s]);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.VisuallyHidden,{as:"label",htmlFor:`post-content-${e}`,children:(0,fs.__)("Type text or HTML")}),(0,c.jsx)(hh.A,{autoComplete:"off",dir:"auto",value:i,onChange:e=>{r("postType",n,o,{content:e.target.value,blocks:void 0,selection:void 0})},className:"editor-post-text-editor",id:`post-content-${e}`,placeholder:(0,fs.__)("Start writing with text or HTML")})]})}const _h="wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text",fh=/[\r\n]+/g;function bh(e){const t=(0,p.useRef)(),{isCleanNewPost:s}=(0,d.useSelect)((e=>{const{isCleanNewPost:t}=e(vc);return{isCleanNewPost:t()}}),[]);return(0,p.useImperativeHandle)(e,(()=>({focus:()=>{t?.current?.focus()}}))),(0,p.useEffect)((()=>{if(!t.current)return;const{defaultView:e}=t.current.ownerDocument,{name:n,parent:o}=e,r="editor-canvas"===n?o.document:e.document,{activeElement:i,body:a}=r;!s||i&&a!==i||t.current.focus()}),[s]),{ref:t}}function yh(){const{editPost:e}=(0,d.useDispatch)(vc),{title:t}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t}=e(vc);return{title:t("title")}}),[]);return{title:t,setTitle:function(t){e({title:t})}}}const xh=(0,p.forwardRef)(((e,t)=>{const{placeholder:s}=(0,d.useSelect)((e=>{const{getSettings:t}=e(g.store),{titlePlaceholder:s}=t();return{placeholder:s}}),[]),[n,o]=(0,p.useState)(!1),{ref:r}=bh(t),{title:i,setTitle:a}=yh(),[l,u]=(0,p.useState)({}),{clearSelectedBlock:h,insertBlocks:_,insertDefaultBlock:f}=(0,d.useDispatch)(g.store),b=(0,Ln.decodeEntities)(s)||(0,fs.__)("Add title"),{value:y,onChange:v,ref:w}=(0,$c.__unstableUseRichText)({value:i,onChange(e){a(e.replace(fh," "))},placeholder:b,selectionStart:l.start,selectionEnd:l.end,onSelectionChange(e,t){u((s=>{const{start:n,end:o}=s;return n===e&&o===t?s:{start:e,end:t}}))},__unstableDisableFormats:!1});function S(e){_(e,0)}const k=mr(_h,{"is-selected":n});return(0,c.jsx)("h1",{ref:(0,m.useMergeRefs)([w,r]),contentEditable:!0,className:k,"aria-label":b,role:"textbox","aria-multiline":"true",onFocus:function(){o(!0),h()},onBlur:function(){o(!1),u({})},onKeyDown:function(e){e.keyCode===ll.ENTER&&(e.preventDefault(),f(void 0,void 0,0))},onPaste:function(e){const t=e.clipboardData;let s="",n="";try{s=t.getData("text/plain"),n=t.getData("text/html")}catch(e){return}window.console.log("Received HTML:\n\n",n),window.console.log("Received plain text:\n\n",s);const o=(0,x.pasteHandler)({HTML:n,plainText:s});if(e.preventDefault(),o.length)if("string"!=typeof o){const[e]=o;if(i||"core/heading"!==e.name&&"core/paragraph"!==e.name)S(o);else{const t=(0,Uc.__unstableStripHTML)(e.attributes.content);a(t),S(o.slice(1))}}else{const e=(0,Uc.__unstableStripHTML)(o);v((0,$c.insert)(y,(0,$c.create)({html:e})))}}})}));var vh=(0,p.forwardRef)(((e,t)=>(0,c.jsx)(Id,{supportKeys:"title",children:(0,c.jsx)(xh,{ref:t})})));var wh=(0,p.forwardRef)((function(e,t){const{placeholder:s}=(0,d.useSelect)((e=>{const{getSettings:t}=e(g.store),{titlePlaceholder:s}=t();return{placeholder:s}}),[]),[n,o]=(0,p.useState)(!1),{title:r,setTitle:i}=yh(),{ref:a}=bh(t),l=mr(_h,{"is-selected":n,"is-raw-text":!0}),u=(0,Ln.decodeEntities)(s)||(0,fs.__)("Add title");return(0,c.jsx)(Hn.TextareaControl,{ref:a,value:r,onChange:function(e){i(e.replace(fh," "))},onFocus:function(){o(!0)},onBlur:function(){o(!1)},label:s,className:l,placeholder:u,hideLabelFromVision:!0,autoComplete:"off",dir:"auto",rows:1,__nextHasNoMarginBottom:!0})}));function Sh({children:e}){const{canTrashPost:t}=(0,d.useSelect)((e=>{const{isEditedPostNew:t,getCurrentPostId:s,getCurrentPostType:n}=e(vc),{canUser:o}=e(u.store),r=n(),i=s(),a=t(),l=!!i&&o("delete",{kind:"postType",name:r,id:i});return{canTrashPost:(!a||i)&&l&&!M.includes(r)}}),[]);return t?e:null}function kh({onActionPerformed:e}){const t=(0,d.useRegistry)(),{isNew:s,isDeleting:n,postId:o,title:r}=(0,d.useSelect)((e=>{const t=e(vc);return{isNew:t.isEditedPostNew(),isDeleting:t.isDeletingPost(),postId:t.getCurrentPostId(),title:t.getCurrentPostAttribute("title")}}),[]),{trashPost:i}=(0,d.useDispatch)(vc),[a,l]=(0,p.useState)(!1);if(s||!o)return null;return(0,c.jsxs)(Sh,{children:[(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,className:"editor-post-trash",isDestructive:!0,variant:"secondary",isBusy:n,"aria-disabled":n,onClick:n?void 0:()=>l(!0),children:(0,fs.__)("Move to trash")}),(0,c.jsx)(Hn.__experimentalConfirmDialog,{isOpen:a,onConfirm:async()=>{l(!1),await i();const s=await t.resolveSelect(vc).getCurrentPost();e?.("move-to-trash",[s])},onCancel:()=>l(!1),confirmButtonText:(0,fs.__)("Move to trash"),size:"small",children:(0,fs.sprintf)((0,fs.__)('Are you sure you want to move "%s" to the trash?'),r)})]})}function Ch({onClose:e}){const{isEditable:t,postSlug:s,postLink:n,permalinkPrefix:o,permalinkSuffix:r,permalink:i}=(0,d.useSelect)((e=>{const t=e(vc).getCurrentPost(),s=e(vc).getCurrentPostType(),n=e(u.store).getPostType(s),o=e(vc).getPermalinkParts(),r=t?._links?.["wp:action-publish"]??!1;return{isEditable:e(vc).isPermalinkEditable()&&r,postSlug:(0,w.safeDecodeURIComponent)(e(vc).getEditedPostSlug()),viewPostLabel:n?.labels.view_item,postLink:t.link,permalinkPrefix:o?.prefix,permalinkSuffix:o?.suffix,permalink:(0,w.safeDecodeURIComponent)(e(vc).getPermalink())}}),[]),{editPost:a}=(0,d.useDispatch)(vc),{createNotice:l}=(0,d.useDispatch)(_s.store),[h,_]=(0,p.useState)(!1),f=(0,m.useCopyToClipboard)(i,(()=>{l("info",(0,fs.__)("Copied Permalink to clipboard."),{isDismissible:!0,type:"snackbar"})})),b="editor-post-url__slug-description-"+(0,m.useInstanceId)(Ch);return(0,c.jsxs)("div",{className:"editor-post-url",children:[(0,c.jsx)(g.__experimentalInspectorPopoverHeader,{title:(0,fs.__)("Slug"),onClose:e}),(0,c.jsxs)(Hn.__experimentalVStack,{spacing:3,children:[t&&(0,c.jsx)("p",{className:"editor-post-url__intro",children:(0,p.createInterpolateElement)((0,fs.__)("<span>Customize the last part of the Permalink.</span> <a>Learn more.</a>"),{span:(0,c.jsx)("span",{id:b}),a:(0,c.jsx)(Hn.ExternalLink,{href:(0,fs.__)("https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink")})})}),(0,c.jsxs)("div",{children:[t&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.__experimentalInputControl,{__next40pxDefaultSize:!0,prefix:(0,c.jsx)(Hn.__experimentalInputControlPrefixWrapper,{children:"/"}),suffix:(0,c.jsx)(Hn.__experimentalInputControlSuffixWrapper,{variant:"control",children:(0,c.jsx)(Hn.Button,{icon:Tr,ref:f,size:"small",label:"Copy"})}),label:(0,fs.__)("Slug"),hideLabelFromVision:!0,value:h?"":s,autoComplete:"off",spellCheck:"false",type:"text",className:"editor-post-url__input",onChange:e=>{a({slug:e}),e?h&&_(!1):h||_(!0)},onBlur:e=>{a({slug:(0,w.cleanForSlug)(e.target.value)}),h&&_(!1)},"aria-describedby":b}),(0,c.jsxs)("p",{className:"editor-post-url__permalink",children:[(0,c.jsx)("span",{className:"editor-post-url__permalink-visual-label",children:(0,fs.__)("Permalink:")}),(0,c.jsxs)(Hn.ExternalLink,{className:"editor-post-url__link",href:n,target:"_blank",children:[(0,c.jsx)("span",{className:"editor-post-url__link-prefix",children:o}),(0,c.jsx)("span",{className:"editor-post-url__link-slug",children:s}),(0,c.jsx)("span",{className:"editor-post-url__link-suffix",children:r})]})]})]}),!t&&(0,c.jsx)(Hn.ExternalLink,{className:"editor-post-url__link",href:n,target:"_blank",children:n})]})]})]})}function Ph({children:e}){const t=(0,d.useSelect)((e=>{const t=e(vc).getCurrentPostType(),s=e(u.store).getPostType(t);if(!s?.viewable)return!1;if(!e(vc).getCurrentPost().link)return!1;return!!e(vc).getPermalinkParts()}),[]);return t?e:null}function jh(){return Eh()}function Eh(){const e=(0,d.useSelect)((e=>e(vc).getPermalink()),[]);return(0,w.filterURLForDisplay)((0,w.safeDecodeURIComponent)(e))}function Th(){const{isFrontPage:e}=(0,d.useSelect)((e=>{const{getCurrentPostId:t}=e(vc),{getEditedEntityRecord:s,canUser:n}=e(u.store),o=n("read",{kind:"root",name:"site"})?s("root","site"):void 0,r=t();return{isFrontPage:o?.page_on_front===r}}),[]),[t,s]=(0,p.useState)(null),n=(0,p.useMemo)((()=>({anchor:t,placement:"left-start",offset:36,shift:!0})),[t]),o=e?(0,fs.__)("Link"):(0,fs.__)("Slug");return(0,c.jsx)(Ph,{children:(0,c.jsxs)(Rd,{label:o,ref:s,children:[!e&&(0,c.jsx)(Hn.Dropdown,{popoverProps:n,className:"editor-post-url__panel-dropdown",contentClassName:"editor-post-url__panel-dialog",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,c.jsx)(Ih,{isOpen:e,onClick:t}),renderContent:({onClose:e})=>(0,c.jsx)(Ch,{onClose:e})}),e&&(0,c.jsx)(Bh,{})]})})}function Ih({isOpen:e,onClick:t}){const{slug:s}=(0,d.useSelect)((e=>({slug:e(vc).getEditedPostSlug()})),[]),n=(0,w.safeDecodeURIComponent)(s);return(0,c.jsx)(Hn.Button,{size:"compact",className:"editor-post-url__panel-toggle",variant:"tertiary","aria-expanded":e,"aria-label":(0,fs.sprintf)((0,fs.__)("Change link: %s"),n),onClick:t,children:(0,c.jsx)(c.Fragment,{children:n})})}function Bh(){const{postLink:e}=(0,d.useSelect)((e=>{const{getCurrentPost:t}=e(vc);return{postLink:t()?.link}}),[]);return(0,c.jsx)(Hn.ExternalLink,{className:"editor-post-url__front-page-link",href:e,target:"_blank",children:e})}function Nh({render:e}){return e({canEdit:(0,d.useSelect)((e=>e(vc).getCurrentPost()._links?.["wp:action-publish"]??!1))})}var Rh=(0,c.jsx)(L.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(L.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z"})});const Dh=window.wp.wordcount;function Ah(){const e=(0,d.useSelect)((e=>e(vc).getEditedPostAttribute("content")),[]),t=(0,fs._x)("words","Word count type. Do not translate!");return(0,c.jsx)("span",{className:"word-count",children:(0,Dh.count)(e,t)})}const Mh=189;function Lh(){const e=(0,d.useSelect)((e=>e(vc).getEditedPostAttribute("content")),[]),t=(0,fs._x)("words","Word count type. Do not translate!"),s=Math.round((0,Dh.count)(e,t)/Mh),n=0===s?(0,p.createInterpolateElement)((0,fs.__)("<span>< 1</span> minute"),{span:(0,c.jsx)("span",{})}):(0,p.createInterpolateElement)((0,fs.sprintf)((0,fs._n)("<span>%s</span> minute","<span>%s</span> minutes",s),s),{span:(0,c.jsx)("span",{})});return(0,c.jsx)("span",{className:"time-to-read",children:n})}function Oh(){const e=(0,d.useSelect)((e=>e(vc).getEditedPostAttribute("content")),[]);return(0,Dh.count)(e,"characters_including_spaces")}var Fh=function({hasOutlineItemsDisabled:e,onRequestClose:t}){const{headingCount:s,paragraphCount:n,numberOfBlocks:o}=(0,d.useSelect)((e=>{const{getGlobalBlockCount:t}=e(g.store);return{headingCount:t("core/heading"),paragraphCount:t("core/paragraph"),numberOfBlocks:t()}}),[]);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"table-of-contents__wrapper",role:"note","aria-label":(0,fs.__)("Document Statistics"),tabIndex:"0",children:(0,c.jsxs)("ul",{role:"list",className:"table-of-contents__counts",children:[(0,c.jsxs)("li",{className:"table-of-contents__count",children:[(0,fs.__)("Words"),(0,c.jsx)(Ah,{})]}),(0,c.jsxs)("li",{className:"table-of-contents__count",children:[(0,fs.__)("Characters"),(0,c.jsx)("span",{className:"table-of-contents__number",children:(0,c.jsx)(Oh,{})})]}),(0,c.jsxs)("li",{className:"table-of-contents__count",children:[(0,fs.__)("Time to read"),(0,c.jsx)(Lh,{})]}),(0,c.jsxs)("li",{className:"table-of-contents__count",children:[(0,fs.__)("Headings"),(0,c.jsx)("span",{className:"table-of-contents__number",children:s})]}),(0,c.jsxs)("li",{className:"table-of-contents__count",children:[(0,fs.__)("Paragraphs"),(0,c.jsx)("span",{className:"table-of-contents__number",children:n})]}),(0,c.jsxs)("li",{className:"table-of-contents__count",children:[(0,fs.__)("Blocks"),(0,c.jsx)("span",{className:"table-of-contents__number",children:o})]})]})}),s>0&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("hr",{}),(0,c.jsx)("h2",{className:"table-of-contents__title",children:(0,fs.__)("Document Outline")}),(0,c.jsx)(ed,{onSelect:t,hasOutlineItemsDisabled:e})]})]})};var Vh=(0,p.forwardRef)((function({hasOutlineItemsDisabled:e,repositionDropdown:t,...s},n){const o=(0,d.useSelect)((e=>!!e(g.store).getBlockCount()),[]);return(0,c.jsx)(Hn.Dropdown,{popoverProps:{placement:t?"right":"bottom"},className:"table-of-contents",contentClassName:"table-of-contents__popover",renderToggle:({isOpen:e,onToggle:t})=>(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,...s,ref:n,onClick:o?t:void 0,icon:Rh,"aria-expanded":e,"aria-haspopup":"true",label:(0,fs.__)("Details"),tooltipPosition:"bottom","aria-disabled":!o}),renderContent:({onClose:t})=>(0,c.jsx)(Fh,{onRequestClose:t,hasOutlineItemsDisabled:e})})}));function Uh(){const{__experimentalGetDirtyEntityRecords:e}=(0,d.useSelect)(u.store);return(0,p.useEffect)((()=>{const t=t=>{if(e().length>0)return t.returnValue=(0,fs.__)("You have unsaved changes. If you proceed, they will be lost."),t.returnValue};return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}}),[e]),null}const Hh=window.wp.serverSideRender;var zh=s.n(Hh);function Gh(e,t,s=[]){const n=(0,p.forwardRef)(((s,n)=>(k()("wp.editor."+e,{since:"5.3",alternative:"wp.blockEditor."+e,version:"6.2"}),(0,c.jsx)(t,{ref:n,...s}))));return s.forEach((s=>{n[s]=Gh(e+"."+s,t[s])})),n}function $h(e,t){return(...s)=>(k()("wp.editor."+e,{since:"5.3",alternative:"wp.blockEditor."+e,version:"6.2"}),t(...s))}const Wh=Gh("RichText",g.RichText,["Content"]);Wh.isEmpty=$h("RichText.isEmpty",g.RichText.isEmpty);const Zh=Gh("Autocomplete",g.Autocomplete),Yh=Gh("AlignmentToolbar",g.AlignmentToolbar),qh=Gh("BlockAlignmentToolbar",g.BlockAlignmentToolbar),Kh=Gh("BlockControls",g.BlockControls,["Slot"]),Qh=Gh("BlockEdit",g.BlockEdit),Xh=Gh("BlockEditorKeyboardShortcuts",g.BlockEditorKeyboardShortcuts),Jh=Gh("BlockFormatControls",g.BlockFormatControls,["Slot"]),eg=Gh("BlockIcon",g.BlockIcon),tg=Gh("BlockInspector",g.BlockInspector),sg=Gh("BlockList",g.BlockList),ng=Gh("BlockMover",g.BlockMover),og=Gh("BlockNavigationDropdown",g.BlockNavigationDropdown),rg=Gh("BlockSelectionClearer",g.BlockSelectionClearer),ig=Gh("BlockSettingsMenu",g.BlockSettingsMenu),ag=Gh("BlockTitle",g.BlockTitle),lg=Gh("BlockToolbar",g.BlockToolbar),cg=Gh("ColorPalette",g.ColorPalette),dg=Gh("ContrastChecker",g.ContrastChecker),ug=Gh("CopyHandler",g.CopyHandler),pg=Gh("DefaultBlockAppender",g.DefaultBlockAppender),mg=Gh("FontSizePicker",g.FontSizePicker),hg=Gh("Inserter",g.Inserter),gg=Gh("InnerBlocks",g.InnerBlocks,["ButtonBlockAppender","DefaultBlockAppender","Content"]),_g=Gh("InspectorAdvancedControls",g.InspectorAdvancedControls,["Slot"]),fg=Gh("InspectorControls",g.InspectorControls,["Slot"]),bg=Gh("PanelColorSettings",g.PanelColorSettings),yg=Gh("PlainText",g.PlainText),xg=Gh("RichTextShortcut",g.RichTextShortcut),vg=Gh("RichTextToolbarButton",g.RichTextToolbarButton),wg=Gh("__unstableRichTextInputEvent",g.__unstableRichTextInputEvent),Sg=Gh("MediaPlaceholder",g.MediaPlaceholder),kg=Gh("MediaUpload",g.MediaUpload),Cg=Gh("MediaUploadCheck",g.MediaUploadCheck),Pg=Gh("MultiSelectScrollIntoView",g.MultiSelectScrollIntoView),jg=Gh("NavigableToolbar",g.NavigableToolbar),Eg=Gh("ObserveTyping",g.ObserveTyping),Tg=Gh("SkipToSelectedBlock",g.SkipToSelectedBlock),Ig=Gh("URLInput",g.URLInput),Bg=Gh("URLInputButton",g.URLInputButton),Ng=Gh("URLPopover",g.URLPopover),Rg=Gh("Warning",g.Warning),Dg=Gh("WritingFlow",g.WritingFlow),Ag=$h("createCustomColorsHOC",g.createCustomColorsHOC),Mg=$h("getColorClassName",g.getColorClassName),Lg=$h("getColorObjectByAttributeValues",g.getColorObjectByAttributeValues),Og=$h("getColorObjectByColorValue",g.getColorObjectByColorValue),Fg=$h("getFontSize",g.getFontSize),Vg=$h("getFontSizeClass",g.getFontSizeClass),Ug=$h("withColorContext",g.withColorContext),Hg=$h("withColors",g.withColors),zg=$h("withFontSizes",g.withFontSizes),Gg=kl,$g=kl;function Wg(e){return k()("wp.editor.cleanForSlug",{since:"12.7",plugin:"Gutenberg",alternative:"wp.url.cleanForSlug"}),(0,w.cleanForSlug)(e)}var Zg=(0,Hn.createSlotFill)(Symbol("EditCanvasContainerSlot"));const Yg="__experimentalMainDashboardButton",{Fill:qg,Slot:Kg}=(0,Hn.createSlotFill)(Yg),Qg=qg;Qg.Slot=()=>{const e=(0,Hn.__experimentalUseSlotFills)(Yg);return(0,c.jsx)(Kg,{bubblesVirtually:!0,fillProps:{length:e?e.length:0}})};var Xg=Qg,Jg=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.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"})}),e_=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.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"})});const{useHasBlockToolbar:t_}=$(g.privateApis);function s_({isCollapsed:e,onToggle:t}){const{blockSelectionStart:s}=(0,d.useSelect)((e=>({blockSelectionStart:e(g.store).getBlockSelectionStart()})),[]),n=t_(),o=!!s;return(0,p.useEffect)((()=>{s&&t(!1)}),[s,t]),n?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:mr("editor-collapsible-block-toolbar",{"is-collapsed":e||!o}),children:(0,c.jsx)(g.BlockToolbar,{hideDragHandle:!0})}),(0,c.jsx)(Hn.Popover.Slot,{name:"block-toolbar"}),(0,c.jsx)(Hn.Button,{className:"editor-collapsible-block-toolbar__toggle",icon:e?Jg:e_,onClick:()=>{t(!e)},label:e?(0,fs.__)("Show block tools"):(0,fs.__)("Hide block tools"),size:"compact"})]}):null}var n_=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})});var o_=function({className:e,disableBlockTools:t=!1}){const{setIsInserterOpened:s,setIsListViewOpened:n}=(0,d.useDispatch)(vc),{isDistractionFree:o,isInserterOpened:r,isListViewOpen:i,listViewShortcut:a,inserterSidebarToggleRef:l,listViewToggleRef:u,showIconLabels:h}=(0,d.useSelect)((e=>{const{get:t}=e(C.store),{isListViewOpened:s,getEditorMode:n,getInserterSidebarToggleRef:o,getListViewToggleRef:r}=$(e(vc)),{getShortcutRepresentation:i}=e(il.store);return{isInserterOpened:e(vc).isInserterOpened(),isListViewOpen:s(),listViewShortcut:i("core/editor/toggle-list-view"),inserterSidebarToggleRef:o(),listViewToggleRef:r(),showIconLabels:t("core","showIconLabels"),isDistractionFree:t("core","distractionFree"),isVisualMode:"visual"===n()}}),[]),_=(0,m.useViewportMatch)("wide"),f=(0,fs.__)("Document tools"),b=(0,p.useCallback)((()=>n(!i)),[n,i]),y=(0,p.useCallback)((()=>s(!r)),[r,s]),x=(0,fs._x)("Block Inserter","Generic label for block inserter button"),v=r?(0,fs.__)("Close"):(0,fs.__)("Add");return(0,c.jsx)(g.NavigableToolbar,{className:mr("editor-document-tools","edit-post-header-toolbar",e),"aria-label":f,variant:"unstyled",children:(0,c.jsxs)("div",{className:"editor-document-tools__left",children:[!o&&(0,c.jsx)(Hn.ToolbarButton,{ref:l,className:"editor-document-tools__inserter-toggle",variant:"primary",isPressed:r,onMouseDown:e=>{r&&e.preventDefault()},onClick:y,disabled:t,icon:n_,label:h?v:x,showTooltip:!h,"aria-expanded":r}),(_||!h)&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.ToolbarItem,{as:id,showTooltip:!h,variant:h?"tertiary":void 0,size:"compact"}),(0,c.jsx)(Hn.ToolbarItem,{as:rd,showTooltip:!h,variant:h?"tertiary":void 0,size:"compact"}),!o&&(0,c.jsx)(Hn.ToolbarButton,{className:"editor-document-tools__document-overview-toggle",icon:Wi,disabled:t,isPressed:i,label:(0,fs.__)("Document Overview"),onClick:b,shortcut:a,showTooltip:!h,variant:h?"tertiary":void 0,"aria-expanded":i,ref:u})]})]})})},r_=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})});function i_(){const{createNotice:e}=(0,d.useDispatch)(_s.store),{getCurrentPostId:t,getCurrentPostType:s}=(0,d.useSelect)(vc),{getEditedEntityRecord:n}=(0,d.useSelect)(u.store);const o=(0,m.useCopyToClipboard)((function(){const e=n("postType",s(),t());return e?"function"==typeof e.content?e.content(e):e.blocks?(0,x.__unstableSerializeAndClean)(e.blocks):e.content?e.content:void 0:""}),(function(){e("info",(0,fs.__)("All content copied."),{isDismissible:!0,type:"snackbar"})}));return(0,c.jsx)(Hn.MenuItem,{ref:o,children:(0,fs.__)("Copy all blocks")})}const a_=[{value:"visual",label:(0,fs.__)("Visual editor")},{value:"text",label:(0,fs.__)("Code editor")}];var l_=function(){const{shortcut:e,isRichEditingEnabled:t,isCodeEditingEnabled:s,mode:n}=(0,d.useSelect)((e=>({shortcut:e(il.store).getShortcutRepresentation("core/editor/toggle-mode"),isRichEditingEnabled:e(vc).getEditorSettings().richEditingEnabled,isCodeEditingEnabled:e(vc).getEditorSettings().codeEditingEnabled,mode:e(vc).getEditorMode()})),[]),{switchEditorMode:o}=(0,d.useDispatch)(vc);let r=n;t||"visual"!==n||(r="text"),s||"text"!==n||(r="visual");const i=a_.map((n=>(s||"text"!==n.value||(n={...n,disabled:!0}),t||"visual"!==n.value||(n={...n,disabled:!0,info:(0,fs.__)("You can enable the visual editor in your profile settings.")}),n.value===r||n.disabled?n:{...n,shortcut:e})));return(0,c.jsx)(Hn.MenuGroup,{label:(0,fs.__)("Editor"),children:(0,c.jsx)(Hn.MenuItemsChoice,{choices:i,value:r,onSelect:o})})};const{Fill:c_,Slot:d_}=(0,Hn.createSlotFill)("ToolsMoreMenuGroup");c_.Slot=({fillProps:e})=>(0,c.jsx)(d_,{fillProps:e});var u_=c_;const{Fill:p_,Slot:m_}=(0,Hn.createSlotFill)("web"===p.Platform.OS?Symbol("ViewMoreMenuGroup"):"ViewMoreMenuGroup");p_.Slot=({fillProps:e})=>(0,c.jsx)(m_,{fillProps:e});var h_=p_;function g_(){const{openModal:e}=(0,d.useDispatch)(ja),{set:t}=(0,d.useDispatch)(C.store),{toggleDistractionFree:s}=(0,d.useDispatch)(vc),n=(0,d.useSelect)((e=>e(C.store).get("core","showIconLabels")),[]),o=()=>{t("core","distractionFree",!1)};return(0,c.jsx)(c.Fragment,{children:(0,c.jsx)(Hn.DropdownMenu,{icon:r_,label:(0,fs.__)("Options"),popoverProps:{placement:"bottom-end",className:"more-menu-dropdown__content"},toggleProps:{showTooltip:!n,...n&&{variant:"tertiary"},tooltipPosition:"bottom",size:"compact"},children:({onClose:t})=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(Hn.MenuGroup,{label:(0,fs._x)("View","noun"),children:[(0,c.jsx)(C.PreferenceToggleMenuItem,{scope:"core",name:"fixedToolbar",onToggle:o,label:(0,fs.__)("Top toolbar"),info:(0,fs.__)("Access all block and document tools in a single place"),messageActivated:(0,fs.__)("Top toolbar activated."),messageDeactivated:(0,fs.__)("Top toolbar deactivated.")}),(0,c.jsx)(C.PreferenceToggleMenuItem,{scope:"core",name:"distractionFree",label:(0,fs.__)("Distraction free"),info:(0,fs.__)("Write with calmness"),handleToggling:!1,onToggle:()=>s({createNotice:!1}),messageActivated:(0,fs.__)("Distraction free mode activated."),messageDeactivated:(0,fs.__)("Distraction free mode deactivated."),shortcut:ll.displayShortcut.primaryShift("\\")}),(0,c.jsx)(C.PreferenceToggleMenuItem,{scope:"core",name:"focusMode",label:(0,fs.__)("Spotlight mode"),info:(0,fs.__)("Focus on one block at a time"),messageActivated:(0,fs.__)("Spotlight mode activated."),messageDeactivated:(0,fs.__)("Spotlight mode deactivated.")}),(0,c.jsx)(h_.Slot,{fillProps:{onClose:t}})]}),(0,c.jsx)(l_,{}),(0,c.jsx)(Na.Slot,{name:"core/plugin-more-menu",label:(0,fs.__)("Panels"),fillProps:{onClick:t}}),(0,c.jsxs)(Hn.MenuGroup,{label:(0,fs.__)("Tools"),children:[(0,c.jsx)(Hn.MenuItem,{onClick:()=>e("editor/keyboard-shortcut-help"),shortcut:ll.displayShortcut.access("h"),children:(0,fs.__)("Keyboard shortcuts")}),(0,c.jsx)(i_,{}),(0,c.jsxs)(Hn.MenuItem,{icon:Fn,href:(0,fs.__)("https://wordpress.org/documentation/article/wordpress-block-editor/"),target:"_blank",rel:"noopener noreferrer",children:[(0,fs.__)("Help"),(0,c.jsx)(Hn.VisuallyHidden,{as:"span",children:(0,fs.__)("(opens in a new tab)")})]}),(0,c.jsx)(u_.Slot,{fillProps:{onClose:t}})]}),(0,c.jsx)(Hn.MenuGroup,{children:(0,c.jsx)(Hn.MenuItem,{onClick:()=>e("editor/preferences"),children:(0,fs.__)("Preferences")})})]})})})}const __="toggle",f_="button";function b_({forceIsDirty:e,setEntitiesSavedStatesCallback:t}){let s;const n=(0,m.useViewportMatch)("medium","<"),{togglePublishSidebar:o}=(0,d.useDispatch)(vc),{hasPublishAction:r,isBeingScheduled:i,isPending:a,isPublished:l,isPublishSidebarEnabled:u,isPublishSidebarOpened:p,isScheduled:h,postStatus:g,postStatusHasChanged:_}=(0,d.useSelect)((e=>({hasPublishAction:!!e(vc).getCurrentPost()?._links?.["wp:action-publish"],isBeingScheduled:e(vc).isEditedPostBeingScheduled(),isPending:e(vc).isCurrentPostPending(),isPublished:e(vc).isCurrentPostPublished(),isPublishSidebarEnabled:e(vc).isPublishSidebarEnabled(),isPublishSidebarOpened:e(vc).isPublishSidebarOpened(),isScheduled:e(vc).isCurrentPostScheduled(),postStatus:e(vc).getEditedPostAttribute("status"),postStatusHasChanged:e(vc).getPostEdits()?.status})),[]);return s=l||_&&!["future","publish"].includes(g)||h&&i||a&&!r&&!n?f_:n||u?__:f_,(0,c.jsx)(Vp,{forceIsDirty:e,isOpen:p,isToggle:s===__,onToggle:o,setEntitiesSavedStatesCallback:t})}function y_(){const{hasLoaded:e,permalink:t,isPublished:s,label:n,showIconLabels:o}=(0,d.useSelect)((e=>{const t=e(vc).getCurrentPostType(),s=e(u.store).getPostType(t),{get:n}=e(C.store);return{permalink:e(vc).getPermalink(),isPublished:e(vc).isCurrentPostPublished(),label:s?.labels.view_item,hasLoaded:!!s,showIconLabels:n("core","showIconLabels")}}),[]);return s&&t&&e?(0,c.jsx)(Hn.Button,{icon:Fn,label:n||(0,fs.__)("View post"),href:t,target:"_blank",showTooltip:!o,size:"compact"}):null}var x_=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})}),v_=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.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"})}),w_=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{d:"M17 4H7c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12zm-7.5-.5h4V16h-4v1.5z"})});function S_({forceIsAutosaveable:e,disabled:t}){const{deviceType:s,homeUrl:n,isTemplate:o,isViewable:r,showIconLabels:i,isTemplateHidden:a,templateId:l}=(0,d.useSelect)((e=>{const{getDeviceType:t,getCurrentPostType:s,getCurrentTemplateId:n,getRenderingMode:o}=e(vc),{getEntityRecord:r,getPostType:i}=e(u.store),{get:a}=e(C.store),l=s();return{deviceType:t(),homeUrl:r("root","__unstableBase")?.home,isTemplate:"wp_template"===l,isViewable:i(l)?.viewable??!1,showIconLabels:a("core","showIconLabels"),isTemplateHidden:"post-only"===o(),templateId:n()}}),[]),{setDeviceType:p,setRenderingMode:h,setDefaultRenderingMode:_}=$((0,d.useDispatch)(vc)),{resetZoomLevel:f}=$((0,d.useDispatch)(g.store)),b=e=>{p(e),f()};if((0,m.useViewportMatch)("medium","<"))return null;const y={className:"editor-preview-dropdown__toggle",iconPosition:"right",size:"compact",showTooltip:!i,disabled:t,accessibleWhenDisabled:t},x={"aria-label":(0,fs.__)("View options")},v={desktop:x_,mobile:v_,tablet:w_},w=[{value:"Desktop",label:(0,fs.__)("Desktop"),icon:x_},{value:"Tablet",label:(0,fs.__)("Tablet"),icon:w_},{value:"Mobile",label:(0,fs.__)("Mobile"),icon:v_}];return(0,c.jsx)(Hn.DropdownMenu,{className:mr("editor-preview-dropdown",`editor-preview-dropdown--${s.toLowerCase()}`),popoverProps:{placement:"bottom-end"},toggleProps:y,menuProps:x,icon:v[s.toLowerCase()],label:(0,fs.__)("View"),disableOpenOnArrowDown:t,children:({onClose:t})=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.MenuGroup,{children:(0,c.jsx)(Hn.MenuItemsChoice,{choices:w,value:s,onSelect:b})}),o&&(0,c.jsx)(Hn.MenuGroup,{children:(0,c.jsxs)(Hn.MenuItem,{href:n,target:"_blank",icon:Fn,onClick:t,children:[(0,fs.__)("View site"),(0,c.jsx)(Hn.VisuallyHidden,{as:"span",children:(0,fs.__)("(opens in a new tab)")})]})}),!o&&!!l&&(0,c.jsx)(Hn.MenuGroup,{children:(0,c.jsx)(Hn.MenuItem,{icon:a?void 0:zn,isSelected:!a,role:"menuitemcheckbox",onClick:()=>{const e=a?"template-locked":"post-only";h(e),_(e),f()},children:(0,fs.__)("Show template")})}),r&&(0,c.jsx)(Hn.MenuGroup,{children:(0,c.jsx)(Mp,{className:"editor-preview-dropdown__button-external",role:"menuitem",forceIsAutosaveable:e,"aria-label":(0,fs.__)("Preview in new tab"),textContent:(0,c.jsxs)(c.Fragment,{children:[(0,fs.__)("Preview in new tab"),(0,c.jsx)(Hn.Icon,{icon:Fn})]}),onPreview:t})}),(0,c.jsx)(Na.Slot,{name:"core/plugin-preview-menu",fillProps:{onClick:t}})]})})}var k_=(0,c.jsx)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(L.Path,{fill:"none",d:"M5.75 12.75V18.25H11.25M12.75 5.75H18.25V11.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"square"})});var C_=({disabled:e})=>{const{isZoomOut:t,showIconLabels:s,isDistractionFree:n}=(0,d.useSelect)((e=>({isZoomOut:$(e(g.store)).isZoomOut(),showIconLabels:e(C.store).get("core","showIconLabels"),isDistractionFree:e(C.store).get("core","distractionFree")}))),{resetZoomLevel:o,setZoomLevel:r}=$((0,d.useDispatch)(g.store)),{registerShortcut:i,unregisterShortcut:a}=(0,d.useDispatch)(il.store);(0,p.useEffect)((()=>(i({name:"core/editor/zoom",category:"global",description:(0,fs.__)("Enter or exit zoom out."),keyCombination:{modifier:(0,ll.isAppleOS)()?"primaryShift":"secondary",character:"0"}}),()=>{a("core/editor/zoom")})),[i,a]),(0,il.useShortcut)("core/editor/zoom",(()=>{t?o():r("auto-scaled")}),{isDisabled:n});return(0,c.jsx)(Hn.Button,{accessibleWhenDisabled:!0,disabled:e,onClick:()=>{t?o():r("auto-scaled")},icon:k_,label:(0,fs.__)("Zoom Out"),isPressed:t,size:"compact",showTooltip:!s,className:"editor-zoom-out-toggle"})};const P_={distractionFreeDisabled:{y:"-50px"},distractionFreeHover:{y:0},distractionFreeHidden:{y:"-50px"},visible:{y:0},hidden:{y:0}},j_={distractionFreeDisabled:{x:"-100%"},distractionFreeHover:{x:0},distractionFreeHidden:{x:"-100%"},visible:{x:0},hidden:{x:0}};var E_=function({customSaveButton:e,forceIsDirty:t,forceDisableBlockTools:s,setEntitiesSavedStatesCallback:n,title:o}){const r=(0,m.useViewportMatch)("large"),i=(0,m.useViewportMatch)("medium"),a=(0,m.useMediaQuery)("(max-width: 403px)"),{postType:l,isTextEditor:u,isPublishSidebarOpened:h,showIconLabels:_,hasFixedToolbar:f,hasBlockSelection:b,hasSectionRootClientId:y}=(0,d.useSelect)((e=>{const{get:t}=e(C.store),{getEditorMode:s,getCurrentPostType:n,isPublishSidebarOpened:o}=e(vc),{getBlockSelectionStart:r,getSectionRootClientId:i}=$(e(g.store));return{postType:n(),isTextEditor:"text"===s(),isPublishSidebarOpened:o(),showIconLabels:t("core","showIconLabels"),hasFixedToolbar:t("core","fixedToolbar"),hasBlockSelection:!!r(),hasSectionRootClientId:!!i()}}),[]),x=["post","page","wp_template"].includes(l)&&y,v=[R,B,N].includes(l)||s,[w,S]=(0,p.useState)(!0),k=!a&&(!f||f&&(!b||w)),P=(()=>{const e=(0,Hn.__experimentalUseSlotFills)(Yg);return Boolean(e&&e.length)})();return(0,c.jsxs)("div",{className:"editor-header edit-post-header",children:[P&&(0,c.jsx)(Hn.__unstableMotion.div,{className:"editor-header__back-button",variants:j_,transition:{type:"tween"},children:(0,c.jsx)(Xg.Slot,{})}),(0,c.jsxs)(Hn.__unstableMotion.div,{variants:P_,className:"editor-header__toolbar",transition:{type:"tween"},children:[(0,c.jsx)(o_,{disableBlockTools:s||u}),f&&i&&(0,c.jsx)(s_,{isCollapsed:w,onToggle:S})]}),k&&(0,c.jsx)(Hn.__unstableMotion.div,{className:"editor-header__center",variants:P_,transition:{type:"tween"},children:(0,c.jsx)(Gc,{title:o})}),(0,c.jsxs)(Hn.__unstableMotion.div,{variants:P_,transition:{type:"tween"},className:"editor-header__settings",children:[!e&&!h&&(0,c.jsx)(nh,{forceIsDirty:t}),(0,c.jsx)(y_,{}),(0,c.jsx)(S_,{forceIsAutosaveable:t,disabled:v}),(0,c.jsx)(Mp,{className:"editor-header__post-preview-button",forceIsAutosaveable:t}),r&&x&&(0,c.jsx)(C_,{disabled:s}),(r||!_)&&(0,c.jsx)(Ma.Slot,{scope:"core"}),!e&&(0,c.jsx)(b_,{forceIsDirty:t,setEntitiesSavedStatesCallback:n}),e,(0,c.jsx)(g_,{})]})]})};const{PrivateInserterLibrary:T_}=$(g.privateApis);function I_(){const{blockSectionRootClientId:e,inserterSidebarToggleRef:t,inserter:s,showMostUsedBlocks:n,sidebarIsOpened:o}=(0,d.useSelect)((e=>{const{getInserterSidebarToggleRef:t,getInserter:s,isPublishSidebarOpened:n}=$(e(vc)),{getBlockRootClientId:o,isZoomOut:r,getSectionRootClientId:i}=$(e(g.store)),{get:a}=e(C.store),{getActiveComplementaryArea:l}=e(ja);return{inserterSidebarToggleRef:t(),inserter:s(),showMostUsedBlocks:a("core","mostUsedBlocks"),blockSectionRootClientId:(()=>{if(r()){const e=i();if(e)return e}return o()})(),sidebarIsOpened:!(!l("core")&&!n())}}),[]),{setIsInserterOpened:r}=(0,d.useDispatch)(vc),{disableComplementaryArea:i}=(0,d.useDispatch)(ja),a=(0,m.useViewportMatch)("medium","<"),l=(0,p.useRef)(),u=(0,p.useCallback)((()=>{r(!1),t.current?.focus()}),[t,r]),h=(0,p.useCallback)((e=>{e.keyCode!==ll.ESCAPE||e.defaultPrevented||(e.preventDefault(),u())}),[u]),_=(0,c.jsx)("div",{className:"editor-inserter-sidebar__content",children:(0,c.jsx)(T_,{showMostUsedBlocks:n,showInserterHelpPanel:!0,shouldFocusBlock:a,rootClientId:e,onSelect:s.onSelect,__experimentalInitialTab:s.tab,__experimentalInitialCategory:s.category,__experimentalFilterValue:s.filterValue,onPatternCategorySelection:o?()=>i("core"):void 0,ref:l,onClose:u})});return(0,c.jsx)("div",{onKeyDown:h,className:"editor-inserter-sidebar",children:_})}function B_(){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:"editor-list-view-sidebar__outline",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)(Hn.__experimentalText,{children:(0,fs.__)("Characters:")}),(0,c.jsx)(Hn.__experimentalText,{children:(0,c.jsx)(Oh,{})})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)(Hn.__experimentalText,{children:(0,fs.__)("Words:")}),(0,c.jsx)(Ah,{})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)(Hn.__experimentalText,{children:(0,fs.__)("Time to read:")}),(0,c.jsx)(Lh,{})]})]}),(0,c.jsx)(ed,{})]})}const{TabbedSidebar:N_}=$(g.privateApis);function R_(){const{setIsListViewOpened:e}=(0,d.useDispatch)(vc),{getListViewToggleRef:t}=$((0,d.useSelect)(vc)),s=(0,m.useFocusOnMount)("firstElement"),n=(0,p.useCallback)((()=>{e(!1),t().current?.focus()}),[t,e]),o=(0,p.useCallback)((e=>{e.keyCode!==ll.ESCAPE||e.defaultPrevented||(e.preventDefault(),n())}),[n]),[r,i]=(0,p.useState)(null),[a,l]=(0,p.useState)("list-view"),u=(0,p.useRef)(),h=(0,p.useRef)(),_=(0,p.useRef)(),f=(0,m.useMergeRefs)([s,_,i]);const b=(0,p.useCallback)((()=>{u.current.contains(u.current.ownerDocument.activeElement)?n():function(e){const t=Uc.focus.tabbable.find(h.current)[0];if("list-view"===e){const e=Uc.focus.tabbable.find(_.current)[0];(u.current.contains(e)?e:t).focus()}else t.focus()}(a)}),[n,a]);return(0,il.useShortcut)("core/editor/toggle-list-view",b),(0,c.jsx)("div",{className:"editor-list-view-sidebar",onKeyDown:o,ref:u,children:(0,c.jsx)(N_,{tabs:[{name:"list-view",title:(0,fs._x)("List View","Post overview"),panel:(0,c.jsx)("div",{className:"editor-list-view-sidebar__list-view-container",children:(0,c.jsx)("div",{className:"editor-list-view-sidebar__list-view-panel-content",children:(0,c.jsx)(g.__experimentalListView,{dropZoneElement:r})})}),panelRef:f},{name:"outline",title:(0,fs._x)("Outline","Post overview"),panel:(0,c.jsx)("div",{className:"editor-list-view-sidebar__list-view-container",children:(0,c.jsx)(B_,{})})}],onClose:n,onSelect:e=>l(e),defaultTabId:"list-view",ref:h,closeButtonLabel:(0,fs.__)("Close")})})}const{Fill:D_,Slot:A_}=(0,Hn.createSlotFill)("ActionsPanel");function M_({setEntitiesSavedStatesCallback:e,closeEntitiesSavedStates:t,isEntitiesSavedStatesOpen:s,forceIsDirtyPublishPanel:n}){const{closePublishSidebar:o,togglePublishSidebar:r}=(0,d.useDispatch)(vc),{publishSidebarOpened:i,isPublishable:a,isDirty:l,hasOtherEntitiesChanges:u}=(0,d.useSelect)((e=>{const{isPublishSidebarOpened:t,isEditedPostPublishable:s,isCurrentPostPublished:n,isEditedPostDirty:o,hasNonPostEntityChanges:r}=e(vc),i=r();return{publishSidebarOpened:t(),isPublishable:!n()&&s(),isDirty:i||o(),hasOtherEntitiesChanges:i}}),[]),m=(0,p.useCallback)((()=>e(!0)),[]);let h;return h=i?(0,c.jsx)(Ym,{onClose:o,forceIsDirty:n,PrePublishExtension:Tu.Slot,PostPublishExtension:vu.Slot}):a&&!u?(0,c.jsx)("div",{className:"editor-layout__toggle-publish-panel",children:(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"secondary",onClick:r,"aria-expanded":!1,children:(0,fs.__)("Open publish panel")})}):(0,c.jsx)("div",{className:"editor-layout__toggle-entities-saved-states-panel",children:(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"secondary",onClick:m,"aria-expanded":!1,"aria-haspopup":"dialog",disabled:!l,accessibleWhenDisabled:!0,children:(0,fs.__)("Open save panel")})}),(0,c.jsxs)(c.Fragment,{children:[s&&(0,c.jsx)(yd,{close:t,renderDialog:!0}),(0,c.jsx)(A_,{bubblesVirtually:!0}),!s&&h]})}function L_({autoFocus:e=!1}){const{switchEditorMode:t}=(0,d.useDispatch)(vc),{shortcut:s,isRichEditingEnabled:n}=(0,d.useSelect)((e=>{const{getEditorSettings:t}=e(vc),{getShortcutRepresentation:s}=e(il.store);return{shortcut:s("core/editor/toggle-mode"),isRichEditingEnabled:t().richEditingEnabled}}),[]),o=(0,p.useRef)();return(0,p.useEffect)((()=>{e||o?.current?.focus()}),[e]),(0,c.jsxs)("div",{className:"editor-text-editor",children:[n&&(0,c.jsxs)("div",{className:"editor-text-editor__toolbar",children:[(0,c.jsx)("h2",{children:(0,fs.__)("Editing code")}),(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>t("visual"),shortcut:s,children:(0,fs.__)("Exit code editor")})]}),(0,c.jsxs)("div",{className:"editor-text-editor__body",children:[(0,c.jsx)(wh,{ref:o}),(0,c.jsx)(gh,{})]})]})}function O_({contentRef:e}){const{onNavigateToEntityRecord:t,templateId:s}=(0,d.useSelect)((e=>{const{getEditorSettings:t,getCurrentTemplateId:s}=e(vc);return{onNavigateToEntityRecord:t().onNavigateToEntityRecord,templateId:s()}}),[]),n=(0,d.useSelect)((e=>!!e(u.store).canUser("create",{kind:"postType",name:"wp_template"})),[]),[o,r]=(0,p.useState)(!1);return(0,p.useEffect)((()=>{const t=e=>{n&&e.target.classList.contains("is-root-container")&&"core/template-part"!==e.target.dataset?.type&&(e.defaultPrevented||(e.preventDefault(),r(!0)))},s=e.current;return s?.addEventListener("dblclick",t),()=>{s?.removeEventListener("dblclick",t)}}),[e,n]),n?(0,c.jsx)(Hn.__experimentalConfirmDialog,{isOpen:o,confirmButtonText:(0,fs.__)("Edit template"),onConfirm:()=>{r(!1),t({postId:s,postType:"wp_template"})},onCancel:()=>r(!1),size:"medium",children:(0,fs.__)("You’ve tried to select a block that is part of a template that may be used elsewhere on your site. Would you like to edit the template?")}):null}function F_({direction:e,resizeWidthBy:t}){const s=`resizable-editor__resize-help-${e}`;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Hn.Tooltip,{text:(0,fs.__)("Drag to resize"),children:(0,c.jsx)(Hn.__unstableMotion.button,{className:`editor-resizable-editor__resize-handle is-${e}`,"aria-label":(0,fs.__)("Drag to resize"),"aria-describedby":s,onKeyDown:function(s){const{keyCode:n}=s;n!==ll.LEFT&&n!==ll.RIGHT||(s.preventDefault(),"left"===e&&n===ll.LEFT||"right"===e&&n===ll.RIGHT?t(20):("left"===e&&n===ll.RIGHT||"right"===e&&n===ll.LEFT)&&t(-20))},variants:{active:{opacity:1,scaleY:1.3}},whileFocus:"active",whileHover:"active",whileTap:"active",role:"separator","aria-orientation":"vertical"},"handle")}),(0,c.jsx)(Hn.VisuallyHidden,{id:s,children:(0,fs.__)("Use left and right arrow keys to resize the canvas.")})]})}const V_={position:void 0,userSelect:void 0,cursor:void 0,width:void 0,height:void 0,top:void 0,right:void 0,bottom:void 0,left:void 0};var U_=function({className:e,enableResizing:t,height:s,children:n}){const[o,r]=(0,p.useState)("100%"),i=(0,p.useRef)(),a=(0,p.useCallback)((e=>{i.current&&r(i.current.offsetWidth+e)}),[]);return(0,c.jsx)(Hn.ResizableBox,{className:mr("editor-resizable-editor",e,{"is-resizable":t}),ref:e=>{i.current=e?.resizable},size:{width:t?o:"100%",height:t&&s?s:"100%"},onResizeStop:(e,t,s)=>{r(s.style.width)},minWidth:300,maxWidth:"100%",maxHeight:"100%",enable:{left:t,right:t},showHandle:t,resizeRatio:2,handleComponent:{left:(0,c.jsx)(F_,{direction:"left",resizeWidthBy:a}),right:(0,c.jsx)(F_,{direction:"right",resizeWidthBy:a})},handleClasses:void 0,handleStyles:{left:V_,right:V_},children:n})};function H_(e,t,s){return Math.min(Math.max(e,t),s)}function z_(e,t,s){const n=e-H_(e,s.left,s.right),o=t-H_(t,s.top,s.bottom);return Math.sqrt(n*n+o*o)}function G_({isEnabled:e=!0}={}){const{getEnabledClientIdsTree:t,getBlockName:s,getBlockOrder:n}=$((0,d.useSelect)(g.store)),{selectBlock:o}=(0,d.useDispatch)(g.store);return(0,m.useRefEffect)((r=>{if(!e)return;const i=e=>{(e.target===r||e.target.classList.contains("is-root-container"))&&((e,i)=>{const a=t().flatMap((({clientId:e})=>{const t=s(e);if("core/template-part"===t)return[];if("core/post-content"===t){const t=n(e);if(t.length)return t}return[e]}));let l=1/0,c=null;for(const t of a){const s=r.querySelector(`[data-block="${t}"]`);if(!s)continue;const n=z_(e,i,s.getBoundingClientRect());n<l&&n<500&&(l=n,c=t)}c&&o(c)})(e.clientX,e.clientY)};return r.addEventListener("click",i),()=>r.removeEventListener("click",i)}),[e])}function $_(){const{getSettings:e,isZoomOut:t}=$((0,d.useSelect)(g.store)),{resetZoomLevel:s}=$((0,d.useDispatch)(g.store));return(0,m.useRefEffect)((n=>{function o(n){if(t()&&!n.defaultPrevented){n.preventDefault();const{__experimentalSetIsInserterOpened:t}=e();"function"==typeof t&&t(!1),s()}}return n.addEventListener("dblclick",o),()=>{n.removeEventListener("dblclick",o)}}),[e,t,s])}const{LayoutStyle:W_,useLayoutClasses:Z_,useLayoutStyles:Y_,ExperimentalBlockCanvas:q_,useFlashEditableBlocks:K_}=$(g.privateApis),Q_=[N,I,R,B];function X_(e){for(let t=0;t<e.length;t++){if("core/post-content"===e[t].name)return e[t].attributes;if(e[t].innerBlocks.length){const s=X_(e[t].innerBlocks);if(s)return s}}}function J_(e){for(let t=0;t<e.length;t++)if("core/post-content"===e[t].name)return!0;return!1}var ef=function({autoFocus:e,styles:t,disableIframe:s=!1,iframeProps:n,contentRef:o,className:r}){const i=(0,m.useViewportMatch)("small","<"),{renderingMode:a,postContentAttributes:l,editedPostTemplate:h={},wrapperBlockName:_,wrapperUniqueId:f,deviceType:b,isFocusedEntity:y,isDesignPostType:v,postType:w,isPreview:S,canvasMinHeight:k}=(0,d.useSelect)((e=>{const{getCurrentPostId:t,getCurrentPostType:s,getCurrentTemplateId:n,getEditorSettings:o,getRenderingMode:r,getDeviceType:i,getCanvasMinHeight:a}=$(e(vc)),{getPostType:l,getEditedEntityRecord:c}=e(u.store),d=s(),p=r();let m;d===N?m="core/block":"post-only"===p&&(m="core/post-content");const h=o(),g=h.supportsTemplateMode,_=l(d),f=n(),b=f?c("postType",I,f):void 0;return{renderingMode:p,postContentAttributes:h.postContentAttributes,isDesignPostType:Q_.includes(d),editedPostTemplate:_?.viewable&&g?b:void 0,wrapperBlockName:m,wrapperUniqueId:t(),deviceType:i(),isFocusedEntity:!!h.onNavigateToPreviousEntityRecord,postType:d,isPreview:h.isPreviewMode,canvasMinHeight:a()}}),[]),{isCleanNewPost:C}=(0,d.useSelect)(vc),{hasRootPaddingAwareAlignments:P,themeHasDisabledLayoutStyles:j,themeSupportsLayout:E,isZoomedOut:T}=(0,d.useSelect)((e=>{const{getSettings:t,isZoomOut:s}=$(e(g.store)),n=t();return{themeHasDisabledLayoutStyles:n.disableLayoutStyles,themeSupportsLayout:n.supportsLayout,hasRootPaddingAwareAlignments:n.__experimentalFeatures?.useRootPaddingAwareAlignments,isZoomedOut:s()}}),[]),D=(0,p.useRef)(),A=(0,g.__experimentalUseResizeCanvas)(b),[M]=(0,g.useSettings)("layout"),L=(0,p.useMemo)((()=>"post-only"!==a||v?{type:"default"}:E?{...M,type:"constrained"}:{type:"default"}),[a,E,M,v]),O=(0,p.useMemo)((()=>{if(!h?.content&&!h?.blocks&&l)return l;if(h?.blocks)return X_(h?.blocks);const e="string"==typeof h?.content?h?.content:"";return X_((0,x.parse)(e))||{}}),[h?.content,h?.blocks,l]),F=(0,p.useMemo)((()=>{if(!h?.content&&!h?.blocks)return!1;if(h?.blocks)return J_(h?.blocks);const e="string"==typeof h?.content?h?.content:"";return J_((0,x.parse)(e))||!1}),[h?.content,h?.blocks]),{layout:V={},align:U=""}=O||{},H=Z_(O,"core/post-content"),z=mr({"is-layout-flow":!E},E&&H,U&&`align${U}`),G=Y_(O,"core/post-content",".block-editor-block-list__layout.is-root-container"),W=(0,p.useMemo)((()=>V&&("constrained"===V?.type||V?.inherit||V?.contentSize||V?.wideSize)?{...M,...V,type:"constrained"}:{...M,...V,type:"default"}),[V?.type,V?.inherit,V?.contentSize,V?.wideSize,M]),Z=l?W:L,Y="default"!==Z?.type||F?Z:L,q=(0,g.__unstableUseTypingObserver)(),K=(0,p.useRef)();(0,p.useEffect)((()=>{e&&C()&&K?.current?.focus()}),[e,C]);const Q=[R,B,N].includes(w)&&!S&&!i&&!T,X=(0,p.useMemo)((()=>{if(!D.current)return k;const{ownerDocument:e}=D.current,t=e.documentElement.scrollTop||e.body.scrollTop;return k+t}),[k]),J=(0,p.useMemo)((()=>[...t??[],{css:`:where(.block-editor-iframe__body){display:flow-root;${X?`min-height:${X}px;`:""}}.is-root-container{display:flow-root;${Q?"min-height:0!important;":""}}\n\t\t\t\t${Q?".block-editor-iframe__html{background:var(--wp-editor-canvas-background);display:flex;align-items:center;justify-content:center;min-height:100vh;}.block-editor-iframe__body{width:100%;}":""}`}]),[t,Q,X]),ee=(0,g.__unstableUseTypewriter)();return o=(0,m.useMergeRefs)([D,o,"post-only"===a?ee:null,K_({isEnabled:"template-locked"===a}),G_({isEnabled:"template-locked"===a}),$_()]),(0,c.jsx)("div",{className:mr("editor-visual-editor","edit-post-visual-editor",r,{"has-padding":y||Q,"is-resizable":Q,"is-iframed":!s}),children:(0,c.jsx)(U_,{enableResizing:Q,height:"100%",children:(0,c.jsxs)(q_,{shouldIframe:!s,contentRef:o,styles:J,height:"100%",iframeProps:{...n,style:{...n?.style,...A}},children:[E&&!j&&"post-only"===a&&!v&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(W_,{selector:".editor-visual-editor__post-title-wrapper",layout:L}),(0,c.jsx)(W_,{selector:".block-editor-block-list__layout.is-root-container",layout:Y}),U&&(0,c.jsx)(W_,{css:".is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}"}),G&&(0,c.jsx)(W_,{layout:W,css:G})]}),"post-only"===a&&!v&&(0,c.jsx)("div",{className:mr("editor-visual-editor__post-title-wrapper","edit-post-visual-editor__post-title-wrapper",{"has-global-padding":P}),contentEditable:!1,ref:q,style:{marginTop:"4rem"},children:(0,c.jsx)(vh,{ref:K})}),(0,c.jsxs)(g.RecursionProvider,{blockName:_,uniqueId:f,children:[(0,c.jsx)(g.BlockList,{className:mr("is-"+b.toLowerCase()+"-preview","post-only"!==a||v?"wp-site-blocks":`${z} wp-block-post-content`,{"has-global-padding":"post-only"===a&&!v&&P}),layout:Z,dropZoneElement:s?D.current:D.current?.parentNode,__unstableDisableDropZone:"template-locked"===a}),"template-locked"===a&&(0,c.jsx)(O_,{contentRef:D})]})]})})})};const tf={header:(0,fs.__)("Editor top bar"),body:(0,fs.__)("Editor content"),sidebar:(0,fs.__)("Editor settings"),actions:(0,fs.__)("Editor publish"),footer:(0,fs.__)("Editor footer")};function sf({className:e,styles:t,children:s,forceIsDirty:n,contentRef:o,disableIframe:r,autoFocus:i,customSaveButton:a,customSavePanel:l,forceDisableBlockTools:u,title:h,iframeProps:_}){const{mode:f,isInserterOpened:b,isListViewOpened:y,isDistractionFree:x,isPreviewMode:v,showBlockBreadcrumbs:w,documentLabel:S}=(0,d.useSelect)((e=>{const{get:t}=e(C.store),{getEditorSettings:s,getPostTypeLabel:n}=e(vc),o=s(),r=n();let i=e(vc).getEditorMode();return o.richEditingEnabled||"visual"!==i||(i="text"),o.codeEditingEnabled||"text"!==i||(i="visual"),{mode:i,isInserterOpened:e(vc).isInserterOpened(),isListViewOpened:e(vc).isListViewOpened(),isDistractionFree:t("core","distractionFree"),isPreviewMode:o.isPreviewMode,showBlockBreadcrumbs:t("core","showBlockBreadcrumbs"),documentLabel:r||(0,fs._x)("Document","noun, breadcrumb")}}),[]),k=(0,m.useViewportMatch)("medium"),P=y?(0,fs.__)("Document Overview"):(0,fs.__)("Block Library"),[j,E]=(0,p.useState)(!1),T=(0,p.useCallback)((e=>{"function"==typeof j&&j(e),E(!1)}),[j]);return(0,c.jsx)(Wa,{isDistractionFree:x,className:mr("editor-editor-interface",e,{"is-entity-save-view-open":!!j,"is-distraction-free":x&&!v}),labels:{...tf,secondarySidebar:P},header:!v&&(0,c.jsx)(E_,{forceIsDirty:n,setEntitiesSavedStatesCallback:E,customSaveButton:a,forceDisableBlockTools:u,title:h}),editorNotices:(0,c.jsx)(ld,{}),secondarySidebar:!v&&"visual"===f&&(b&&(0,c.jsx)(I_,{})||y&&(0,c.jsx)(R_,{})),sidebar:!v&&!x&&(0,c.jsx)(Va.Slot,{scope:"core"}),content:(0,c.jsxs)(c.Fragment,{children:[!x&&!v&&(0,c.jsx)(ld,{}),(0,c.jsx)(Zg.Slot,{children:([e])=>e||(0,c.jsxs)(c.Fragment,{children:[!v&&"text"===f&&(0,c.jsx)(L_,{autoFocus:i}),!v&&!k&&"visual"===f&&(0,c.jsx)(g.BlockToolbar,{hideDragHandle:!0}),(v||"visual"===f)&&(0,c.jsx)(ef,{styles:t,contentRef:o,disableIframe:r,autoFocus:i,iframeProps:_}),s]})})]}),footer:!v&&!x&&k&&w&&"visual"===f&&(0,c.jsx)(g.BlockBreadcrumb,{rootLabelText:S}),actions:v?void 0:l||(0,c.jsx)(M_,{closeEntitiesSavedStates:T,isEntitiesSavedStatesOpen:j,setEntitiesSavedStatesCallback:E,forceIsDirtyPublishPanel:n})})}const{OverridesPanel:nf}=$(ao.privateApis);function of(){return(0,d.useSelect)((e=>"wp_block"===e(vc).getCurrentPostType()),[])?(0,c.jsx)(nf,{}):null}function rf(e){return"string"==typeof e.title?(0,Ln.decodeEntities)(e.title):e.title&&"rendered"in e.title?(0,Ln.decodeEntities)(e.title.rendered):e.title&&"raw"in e.title?(0,Ln.decodeEntities)(e.title.raw):""}const af=({items:e,closeModal:t})=>{const[s]=e,n=rf(s),{showOnFront:o,currentHomePage:r,isSaving:i}=(0,d.useSelect)((e=>{const{getEntityRecord:t,isSavingEntityRecord:s}=e(u.store),n=t("root","site"),o=t("postType","page",n?.page_on_front);return{showOnFront:n?.show_on_front,currentHomePage:o,isSaving:s("root","site")}})),{saveEntityRecord:a}=(0,d.useDispatch)(u.store),{createSuccessNotice:l,createErrorNotice:p}=(0,d.useDispatch)(_s.store);let m="";"posts"===o?m=(0,fs.__)("This will replace the current homepage which is set to display latest posts."):r&&(m=(0,fs.sprintf)((0,fs.__)('This will replace the current homepage: "%s"'),rf(r)));const h=(0,fs.sprintf)((0,fs.__)('Set "%1$s" as the site homepage? %2$s'),n,m).trim(),g=(0,fs.__)("Set homepage");return(0,c.jsx)("form",{onSubmit:async function(e){e.preventDefault();try{await a("root","site",{page_on_front:s.id,show_on_front:"page"}),l((0,fs.__)("Homepage updated."),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,fs.__)("An error occurred while setting the homepage.");p(t,{type:"snackbar"})}finally{t?.()}},children:(0,c.jsxs)(Hn.__experimentalVStack,{spacing:"5",children:[(0,c.jsx)(Hn.__experimentalText,{children:h}),(0,c.jsxs)(Hn.__experimentalHStack,{justify:"right",children:[(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{t?.()},disabled:i,accessibleWhenDisabled:!0,children:(0,fs.__)("Cancel")}),(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",disabled:i,accessibleWhenDisabled:!0,children:g})]})]})})},lf=({items:e,closeModal:t})=>{const[s]=e,n=rf(s),{currentPostsPage:o,isPageForPostsSet:r,isSaving:i}=(0,d.useSelect)((e=>{const{getEntityRecord:t,isSavingEntityRecord:s}=e(u.store),n=t("root","site");return{currentPostsPage:t("postType","page",n?.page_for_posts),isPageForPostsSet:0!==n?.page_for_posts,isSaving:s("root","site")}})),{saveEntityRecord:a}=(0,d.useDispatch)(u.store),{createSuccessNotice:l,createErrorNotice:p}=(0,d.useDispatch)(_s.store);const m=r&&o?(0,fs.sprintf)((0,fs.__)('This will replace the current posts page: "%s"'),rf(o)):(0,fs.__)("This page will show the latest posts."),h=(0,fs.sprintf)((0,fs.__)('Set "%1$s" as the posts page? %2$s'),n,m),g=(0,fs.__)("Set posts page");return(0,c.jsx)("form",{onSubmit:async function(e){e.preventDefault();try{await a("root","site",{page_for_posts:s.id,show_on_front:"page"}),l((0,fs.__)("Posts page updated."),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,fs.__)("An error occurred while setting the posts page.");p(t,{type:"snackbar"})}finally{t?.()}},children:(0,c.jsxs)(Hn.__experimentalVStack,{spacing:"5",children:[(0,c.jsx)(Hn.__experimentalText,{children:h}),(0,c.jsxs)(Hn.__experimentalHStack,{justify:"right",children:[(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{t?.()},disabled:i,accessibleWhenDisabled:!0,children:(0,fs.__)("Cancel")}),(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",disabled:i,accessibleWhenDisabled:!0,children:g})]})]})})};function cf({postType:e,onActionPerformed:t,context:s}){const{defaultActions:n}=(0,d.useSelect)((t=>{const{getEntityActions:s}=$(t(vc));return{defaultActions:s("postType",e)}}),[e]),o=(0,d.useSelect)((t=>{if("page"!==e)return!1;const{getDefaultTemplateId:s,getEntityRecord:n,canUser:o}=t(u.store);if(!o("update",{kind:"root",name:"site"}))return!1;const r=s({slug:"front-page"});if(!r)return!0;const i=n("postType","wp_template",r);return!i||"front-page"!==i.slug}),[e]),r=(()=>{const{pageOnFront:e,pageForPosts:t}=(0,d.useSelect)((e=>{const{getEntityRecord:t,canUser:s}=e(u.store),n=s("read",{kind:"root",name:"site"})?t("root","site"):void 0;return{pageOnFront:n?.page_on_front,pageForPosts:n?.page_for_posts}}));return(0,p.useMemo)((()=>({id:"set-as-homepage",label:(0,fs.__)("Set as homepage"),isEligible:s=>"publish"===s.status&&"page"===s.type&&e!==s.id&&t!==s.id,modalFocusOnMount:"firstContentElement",RenderModal:af})),[t,e])})(),i=(()=>{const{pageOnFront:e,pageForPosts:t}=(0,d.useSelect)((e=>{const{getEntityRecord:t,canUser:s}=e(u.store),n=s("read",{kind:"root",name:"site"})?t("root","site"):void 0;return{pageOnFront:n?.page_on_front,pageForPosts:n?.page_for_posts}}));return(0,p.useMemo)((()=>({id:"set-as-posts-page",label:(0,fs.__)("Set as posts page"),isEligible:s=>"publish"===s.status&&"page"===s.type&&e!==s.id&&t!==s.id,modalFocusOnMount:"firstContentElement",RenderModal:lf})),[t,e])})(),{registerPostTypeSchema:a}=$((0,d.useDispatch)(vc));return(0,p.useEffect)((()=>{a(e)}),[a,e]),(0,p.useMemo)((()=>{let e=[...n];if(o&&e.push(r,i),e=e.sort(((e,t)=>"move-to-trash"===t.id?-1:0)),e=e.filter((e=>!e.context||e.context===s)),t)for(let s=0;s<e.length;++s){if(e[s].callback){const n=e[s].callback;e[s]={...e[s],callback:(o,r)=>{n(o,{...r,onActionPerformed:n=>{r?.onActionPerformed&&r.onActionPerformed(n),t(e[s].id,n)}})}}}if(e[s].RenderModal){const n=e[s].RenderModal;e[s]={...e[s],RenderModal:o=>(0,c.jsx)(n,{...o,onActionPerformed:n=>{o.onActionPerformed&&o.onActionPerformed(n),t(e[s].id,n)}})}}}return e}),[s,n,t,r,i,o])}const{Menu:df,kebabCase:uf}=$(Hn.privateApis);function pf({postType:e,postId:t,onActionPerformed:s}){const[n,o]=(0,p.useState)(null),{item:r,permissions:i}=(0,d.useSelect)((s=>{const{getEditedEntityRecord:n,getEntityRecordPermissions:o}=$(s(u.store));return{item:n("postType",e,t),permissions:o("postType",e,t)}}),[t,e]),a=(0,p.useMemo)((()=>({...r,permissions:i})),[r,i]),l=cf({postType:e,onActionPerformed:s}),m=(0,p.useMemo)((()=>l.filter((e=>!e.isEligible||e.isEligible(a)))),[l,a]);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(df,{placement:"bottom-end",children:[(0,c.jsx)(df.TriggerButton,{render:(0,c.jsx)(Hn.Button,{size:"small",icon:r_,label:(0,fs.__)("Actions"),disabled:!m.length,accessibleWhenDisabled:!0,className:"editor-all-actions-button"})}),(0,c.jsx)(df.Popover,{children:(0,c.jsx)(gf,{actions:m,items:[a],setActiveModalAction:o})})]}),!!n&&(0,c.jsx)(hf,{action:n,items:[a],closeModal:()=>o(null)})]})}function mf({action:e,onClick:t,items:s}){const n="string"==typeof e.label?e.label:e.label(s);return(0,c.jsx)(df.Item,{onClick:t,children:(0,c.jsx)(df.ItemLabel,{children:n})})}function hf({action:e,items:t,closeModal:s}){const n="string"==typeof e.label?e.label:e.label(t);return(0,c.jsx)(Hn.Modal,{title:e.modalHeader||n,__experimentalHideHeader:!!e.hideModalHeader,onRequestClose:s??(()=>{}),focusOnMount:"firstContentElement",size:"medium",overlayClassName:`editor-action-modal editor-action-modal__${uf(e.id)}`,children:(0,c.jsx)(e.RenderModal,{items:t,closeModal:s})})}function gf({actions:e,items:t,setActiveModalAction:s}){const n=(0,d.useRegistry)();return(0,c.jsx)(df.Group,{children:e.map((e=>(0,c.jsx)(mf,{action:e,onClick:()=>{"RenderModal"in e?s(e):e.callback(t,{registry:n})},items:t},e.id)))})}const{Badge:_f}=$(Hn.privateApis);function ff({postType:e,postId:t,onActionPerformed:s}){const n=(0,p.useMemo)((()=>Array.isArray(t)?t:[t]),[t]),{postTitle:o,icon:r,labels:i}=(0,d.useSelect)((t=>{const{getEditedEntityRecord:s,getCurrentTheme:o,getPostType:r}=t(u.store),{getPostIcon:i}=$(t(vc));let a="";const l=s("postType",e,n[0]);if(1===n.length){const{default_template_types:t=[]}=o()??{},s=[I,B].includes(e)?Y({template:l,templateTypes:t}):{};a=s?.title||l?.title}return{postTitle:a,icon:i(e,{area:l?.area}),labels:r(e)?.labels}}),[n,e]),a=Hc(t);let l=(0,fs.__)("No title");return i?.name&&n.length>1?l=(0,fs.sprintf)((0,fs.__)("%1$d %2$s"),n.length,i?.name):o&&(l=(0,Uc.__unstableStripHTML)(o)),(0,c.jsxs)(Hn.__experimentalVStack,{spacing:1,className:"editor-post-card-panel",children:[(0,c.jsxs)(Hn.__experimentalHStack,{spacing:2,className:"editor-post-card-panel__header",align:"flex-start",children:[(0,c.jsx)(Hn.Icon,{className:"editor-post-card-panel__icon",icon:r}),(0,c.jsxs)(Hn.__experimentalText,{numberOfLines:2,truncate:!0,className:"editor-post-card-panel__title",as:"h2",children:[(0,c.jsx)("span",{className:"editor-post-card-panel__title-name",children:l}),a&&1===n.length&&(0,c.jsx)(_f,{children:a})]}),1===n.length&&(0,c.jsx)(pf,{postType:e,postId:n[0],onActionPerformed:s})]}),n.length>1&&(0,c.jsx)(Hn.__experimentalText,{className:"editor-post-card-panel__description",children:(0,fs.sprintf)((0,fs.__)("Changes will be applied to all selected %s."),i?.name.toLowerCase())})]})}function bf(){const{postContent:e}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t,getCurrentPostType:s,getCurrentPostId:n}=e(vc),{canUser:o}=e(u.store),{getEntityRecord:r}=e(u.store),i=o("read",{kind:"root",name:"site"})?r("root","site"):void 0,a=s();return{postContent:!(+n()===i?.page_for_posts)&&![I,B].includes(a)&&t("content")}}),[]),t=(0,fs._x)("words","Word count type. Do not translate!"),s=(0,p.useMemo)((()=>e?(0,Dh.count)(e,t):0),[e,t]);if(!s)return null;const n=Math.round(s/189),o=(0,fs.sprintf)((0,fs._n)("%s word","%s words",s),s.toLocaleString()),r=n<=1?(0,fs.__)("1 minute"):(0,fs.sprintf)((0,fs._n)("%s minute","%s minutes",n),n.toLocaleString());return(0,c.jsx)("div",{className:"editor-post-content-information",children:(0,c.jsx)(Hn.__experimentalText,{children:(0,fs.sprintf)((0,fs.__)("%1$s, %2$s read time."),o,r)})})}var yf=function(){const{postFormat:e}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t}=e(vc);return{postFormat:t("format")??"standard"}}),[]),t=Pp.find((t=>t.id===e)),[s,n]=(0,p.useState)(null),o=(0,p.useMemo)((()=>({anchor:s,placement:"left-start",offset:36,shift:!0})),[s]);return(0,c.jsx)(Cp,{children:(0,c.jsx)(Rd,{label:(0,fs.__)("Format"),ref:n,children:(0,c.jsx)(Hn.Dropdown,{popoverProps:o,contentClassName:"editor-post-format__dialog",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:s})=>(0,c.jsx)(Hn.Button,{size:"compact",variant:"tertiary","aria-expanded":e,"aria-label":(0,fs.sprintf)((0,fs.__)("Change format: %s"),t?.caption),onClick:s,children:t?.caption}),renderContent:({onClose:e})=>(0,c.jsxs)("div",{className:"editor-post-format__dialog-content",children:[(0,c.jsx)(g.__experimentalInspectorPopoverHeader,{title:(0,fs.__)("Format"),onClose:e}),(0,c.jsx)(jp,{})]})})})})};function xf(){const e=(0,d.useSelect)((e=>e(vc).getEditedPostAttribute("modified")),[]),t=e&&(0,fs.sprintf)((0,fs.__)("Last edited %s."),(0,v.humanTimeDiff)(e));return t?(0,c.jsx)("div",{className:"editor-post-last-edited-panel",children:(0,c.jsx)(Hn.__experimentalText,{children:t})}):null}var vf=function({className:e,children:t}){return(0,c.jsx)(Hn.__experimentalVStack,{className:mr("editor-post-panel__section",e),children:t})};const wf={};function Sf(){const{editEntityRecord:e}=(0,d.useDispatch)(u.store),{postsPageTitle:t,postsPageId:s,isTemplate:n,postSlug:o}=(0,d.useSelect)((e=>{const{getEntityRecord:t,getEditedEntityRecord:s,canUser:n}=e(u.store),o=n("read",{kind:"root",name:"site"})?t("root","site"):void 0,r=o?.page_for_posts?s("postType","page",o?.page_for_posts):wf,{getEditedPostAttribute:i,getCurrentPostType:a}=e(vc);return{postsPageId:r?.id,postsPageTitle:r?.title,isTemplate:a()===I,postSlug:i("slug")}}),[]),[r,i]=(0,p.useState)(null),a=(0,p.useMemo)((()=>({anchor:r,placement:"left-start",offset:36,shift:!0})),[r]);if(!n||!["home","index"].includes(o)||!s)return null;const l=t=>{e("postType","page",s,{title:t})},h=(0,Ln.decodeEntities)(t);return(0,c.jsx)(Rd,{label:(0,fs.__)("Blog title"),ref:i,children:(0,c.jsx)(Hn.Dropdown,{popoverProps:a,contentClassName:"editor-blog-title-dropdown__content",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,c.jsx)(Hn.Button,{size:"compact",variant:"tertiary","aria-expanded":e,"aria-label":(0,fs.sprintf)((0,fs.__)("Change blog title: %s"),h),onClick:t,children:h}),renderContent:({onClose:e})=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(g.__experimentalInspectorPopoverHeader,{title:(0,fs.__)("Blog title"),onClose:e}),(0,c.jsx)(Hn.__experimentalInputControl,{placeholder:(0,fs.__)("No title"),size:"__unstable-large",value:t,onChange:(0,m.debounce)(l,300),label:(0,fs.__)("Blog title"),help:(0,fs.__)("Set the Posts Page title. Appears in search results, and when the page is shared on social media."),hideLabelFromVision:!0})]})})})}function kf(){const{editEntityRecord:e}=(0,d.useDispatch)(u.store),{postsPerPage:t,isTemplate:s,postSlug:n}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t,getCurrentPostType:s}=e(vc),{getEditedEntityRecord:n,canUser:o}=e(u.store),r=o("read",{kind:"root",name:"site"})?n("root","site"):void 0;return{isTemplate:s()===I,postSlug:t("slug"),postsPerPage:r?.posts_per_page||1}}),[]),[o,r]=(0,p.useState)(null),i=(0,p.useMemo)((()=>({anchor:o,placement:"left-start",offset:36,shift:!0})),[o]);if(!s||!["home","index"].includes(n))return null;const a=t=>{e("root","site",void 0,{posts_per_page:t})};return(0,c.jsx)(Rd,{label:(0,fs.__)("Posts per page"),ref:r,children:(0,c.jsx)(Hn.Dropdown,{popoverProps:i,contentClassName:"editor-posts-per-page-dropdown__content",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:s})=>(0,c.jsx)(Hn.Button,{size:"compact",variant:"tertiary","aria-expanded":e,"aria-label":(0,fs.__)("Change posts per page"),onClick:s,children:t}),renderContent:({onClose:e})=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(g.__experimentalInspectorPopoverHeader,{title:(0,fs.__)("Posts per page"),onClose:e}),(0,c.jsx)(Hn.__experimentalNumberControl,{placeholder:0,value:t,size:"__unstable-large",spinControls:"custom",step:"1",min:"1",onChange:a,label:(0,fs.__)("Posts per page"),help:(0,fs.__)("Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting."),hideLabelFromVision:!0})]})})})}const Cf=[{label:(0,fs._x)("Open",'Adjective: e.g. "Comments are open"'),value:"open",description:(0,fs.__)("Visitors can add new comments and replies.")},{label:(0,fs.__)("Closed"),value:"",description:[(0,fs.__)("Visitors cannot add new comments or replies."),(0,fs.__)("Existing comments remain visible.")].join(" ")}];function Pf(){const{editEntityRecord:e}=(0,d.useDispatch)(u.store),{allowCommentsOnNewPosts:t,isTemplate:s,postSlug:n}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t,getCurrentPostType:s}=e(vc),{getEditedEntityRecord:n,canUser:o}=e(u.store),r=o("read",{kind:"root",name:"site"})?n("root","site"):void 0;return{isTemplate:s()===I,postSlug:t("slug"),allowCommentsOnNewPosts:r?.default_comment_status||""}}),[]),[o,r]=(0,p.useState)(null),i=(0,p.useMemo)((()=>({anchor:o,placement:"left-start",offset:36,shift:!0})),[o]);if(!s||!["home","index"].includes(n))return null;const a=t=>{e("root","site",void 0,{default_comment_status:t?"open":null})};return(0,c.jsx)(Rd,{label:(0,fs.__)("Discussion"),ref:r,children:(0,c.jsx)(Hn.Dropdown,{popoverProps:i,contentClassName:"editor-site-discussion-dropdown__content",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:s})=>(0,c.jsx)(Hn.Button,{size:"compact",variant:"tertiary","aria-expanded":e,"aria-label":(0,fs.__)("Change discussion settings"),onClick:s,children:t?(0,fs.__)("Comments open"):(0,fs.__)("Comments closed")}),renderContent:({onClose:e})=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(g.__experimentalInspectorPopoverHeader,{title:(0,fs.__)("Discussion"),onClose:e}),(0,c.jsxs)(Hn.__experimentalVStack,{spacing:3,children:[(0,c.jsx)(Hn.__experimentalText,{children:(0,fs.__)("Changes will apply to new posts only. Individual posts may override these settings.")}),(0,c.jsx)(Hn.RadioControl,{className:"editor-site-discussion__options",hideLabelFromVision:!0,label:(0,fs.__)("Comment status"),options:Cf,onChange:a,selected:t})]})]})})})}function jf({onActionPerformed:e}){const{isRemovedPostStatusPanel:t,postType:s,postId:n}=(0,d.useSelect)((e=>{const{isEditorPanelRemoved:t,getCurrentPostType:s,getCurrentPostId:n}=e(vc);return{isRemovedPostStatusPanel:t("post-status"),postType:s(),postId:n()}}),[]);return(0,c.jsx)(vf,{className:"editor-post-summary",children:(0,c.jsx)(Cu.Slot,{children:o=>(0,c.jsx)(c.Fragment,{children:(0,c.jsxs)(Hn.__experimentalVStack,{spacing:4,children:[(0,c.jsx)(ff,{postType:s,postId:n,onActionPerformed:e}),(0,c.jsx)(kp,{withPanelBody:!1}),(0,c.jsx)(pp,{}),(0,c.jsxs)(Hn.__experimentalVStack,{spacing:1,children:[(0,c.jsx)(bf,{}),(0,c.jsx)(xf,{})]}),!t&&(0,c.jsxs)(Hn.__experimentalVStack,{spacing:4,children:[(0,c.jsxs)(Hn.__experimentalVStack,{spacing:1,children:[(0,c.jsx)(sh,{}),(0,c.jsx)(ih,{}),(0,c.jsx)(Th,{}),(0,c.jsx)(qu,{}),(0,c.jsx)(Vu,{}),(0,c.jsx)(sp,{}),(0,c.jsx)(Ip,{}),(0,c.jsx)(Wd,{}),(0,c.jsx)(lh,{}),(0,c.jsx)(Sf,{}),(0,c.jsx)(kf,{}),(0,c.jsx)(Pf,{}),(0,c.jsx)(yf,{}),o]}),(0,c.jsx)(kh,{onActionPerformed:e})]})]})})})})}const{EXCLUDED_PATTERN_SOURCES:Ef,PATTERN_TYPES:Tf}=$(ao.privateApis);function If(e,t){return e.innerBlocks=e.innerBlocks.map((e=>If(e,t))),"core/template-part"===e.name&&void 0===e.attributes.theme&&(e.attributes.theme=t),e}function Bf(e,t){return e.filter(((e,s,n)=>((e,t,s)=>t===s.findIndex((t=>e.name===t.name)))(e,s,n)&&(e=>!Ef.includes(e.source))(e)&&(e=>e.templateTypes?.includes(t.slug)||e.blockTypes?.includes("core/template-part/"+t.area))(e)))}function Nf(e,t){return e.map((e=>({...e,keywords:e.keywords||[],type:Tf.theme,blocks:(0,x.parse)(e.content,{__unstableSkipMigrationLogs:!0}).map((e=>If(e,t)))})))}function Rf({availableTemplates:e,onSelect:t}){return e&&0!==e?.length?(0,c.jsx)(g.__experimentalBlockPatternsList,{label:(0,fs.__)("Templates"),blockPatterns:e,onClickPattern:t,showTitlesAsTooltip:!0}):null}function Df(){const{area:e,name:t,slug:s,postType:n,postId:o}=(0,d.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s}=e(vc),{getEditedEntityRecord:n}=e(u.store),o=t(),r=s(),i=n("postType",o,r);return{area:i?.area,name:i?.name,slug:i?.slug,postType:o,postId:r}}),[]),{editEntityRecord:r}=(0,d.useDispatch)(u.store),i=function({area:e,name:t,slug:s}){const{blockPatterns:n,restBlockPatterns:o,currentThemeStylesheet:r}=(0,d.useSelect)((e=>{const{getEditorSettings:t}=e(vc),s=t();return{blockPatterns:s.__experimentalAdditionalBlockPatterns??s.__experimentalBlockPatterns,restBlockPatterns:e(u.store).getBlockPatterns(),currentThemeStylesheet:e(u.store).getCurrentTheme().stylesheet}}),[]);return(0,p.useMemo)((()=>Nf(Bf([...n||[],...o||[]],{area:e,name:t,slug:s}),r)),[e,t,s,n,o,r])}({area:e,name:t,slug:s});return i?.length?(0,c.jsx)(Hn.PanelBody,{title:(0,fs.__)("Design"),initialOpen:n===B,children:(0,c.jsx)(Rf,{availableTemplates:i,onSelect:async e=>{await r("postType",n,o,{blocks:e.blocks,content:(0,x.serialize)(e.blocks)})}})}):null}function Af(){const{postType:e}=(0,d.useSelect)((e=>{const{getCurrentPostType:t}=e(vc);return{postType:t()}}),[]);return[B,I].includes(e)?(0,c.jsx)(Df,{}):null}const Mf={document:"edit-post/document",block:"edit-post/block"},{Tabs:Lf}=$(Hn.privateApis);var Of=(0,p.forwardRef)(((e,t)=>{const{documentLabel:s}=(0,d.useSelect)((e=>{const{getPostTypeLabel:t}=e(vc);return{documentLabel:t()||(0,fs._x)("Document","noun, panel")}}),[]);return(0,c.jsxs)(Lf.TabList,{ref:t,children:[(0,c.jsx)(Lf.Tab,{tabId:Mf.document,"data-tab-id":Mf.document,children:s}),(0,c.jsx)(Lf.Tab,{tabId:Mf.block,"data-tab-id":Mf.block,children:(0,fs.__)("Block")})]})}));const{BlockQuickNavigation:Ff}=$(g.privateApis),Vf=["core/post-title","core/post-featured-image","core/post-content"];function Uf(){const e=(0,p.useMemo)((()=>(0,h.applyFilters)("editor.postContentBlockTypes",Vf)),[]),{clientIds:t,postType:s,renderingMode:n}=(0,d.useSelect)((t=>{const{getCurrentPostType:s,getPostBlocksByName:n,getRenderingMode:o}=$(t(vc)),r=s();return{postType:r,clientIds:n(I===r?"core/template-part":e),renderingMode:o()}}),[e]),{enableComplementaryArea:o}=(0,d.useDispatch)(ja);return"post-only"===n&&s!==I||0===t.length?null:(0,c.jsx)(Hn.PanelBody,{title:(0,fs.__)("Content"),children:(0,c.jsx)(Ff,{clientIds:t,onSelect:()=>{o("core","edit-post/document")}})})}const{BlockQuickNavigation:Hf}=$(g.privateApis);function zf(){const e=(0,d.useSelect)((e=>{const{getBlockTypes:t}=e(x.store);return t()}),[]),t=(0,p.useMemo)((()=>e.filter((e=>"theme"===e.category)).map((({name:e})=>e))),[e]),s=(0,d.useSelect)((e=>{const{getBlocksByName:s}=e(g.store);return s(t)}),[t]);return 0===s.length?null:(0,c.jsx)(Hn.PanelBody,{title:(0,fs.__)("Content"),children:(0,c.jsx)(Hf,{clientIds:s})})}function Gf(){const e=(0,d.useSelect)((e=>{const{getCurrentPostType:t}=e(vc);return t()}),[]);return e!==B?null:(0,c.jsx)(zf,{})}var $f=function(){const{hasBlockSelection:e}=(0,d.useSelect)((e=>({hasBlockSelection:!!e(g.store).getBlockSelectionStart()})),[]),{getActiveComplementaryArea:t}=(0,d.useSelect)(ja),{enableComplementaryArea:s}=(0,d.useDispatch)(ja),{get:n}=(0,d.useSelect)(C.store);(0,p.useEffect)((()=>{const o=t("core"),r=["edit-post/document","edit-post/block"].includes(o),i=n("core","distractionFree");r&&!i&&s("core",e?"edit-post/block":"edit-post/document")}),[e,t,s,n])};const{Tabs:Wf}=$(Hn.privateApis),Zf=p.Platform.select({web:!0,native:!1}),Yf=({tabName:e,keyboardShortcut:t,onActionPerformed:s,extraPanels:n})=>{const o=(0,p.useRef)(null),r=(0,p.useContext)(Wf.Context);return(0,p.useEffect)((()=>{const t=Array.from(o.current?.querySelectorAll('[role="tab"]')||[]),s=t.find((t=>t.getAttribute("data-tab-id")===e)),n=s?.ownerDocument.activeElement;t.some((e=>n&&n.id===e.id))&&s&&s.id!==n?.id&&s?.focus()}),[e]),(0,c.jsx)(Bu,{identifier:e,header:(0,c.jsx)(Wf.Context.Provider,{value:r,children:(0,c.jsx)(Of,{ref:o})}),closeLabel:(0,fs.__)("Close Settings"),className:"editor-sidebar__panel",headerClassName:"editor-sidebar__panel-tabs",title:(0,fs._x)("Settings","panel button label"),toggleShortcut:t,icon:(0,fs.isRTL)()?Yi:qi,isActiveByDefault:Zf,children:(0,c.jsxs)(Wf.Context.Provider,{value:r,children:[(0,c.jsxs)(Wf.TabPanel,{tabId:Mf.document,focusable:!1,children:[(0,c.jsx)(jf,{onActionPerformed:s}),(0,c.jsx)(gu.Slot,{}),(0,c.jsx)(Uf,{}),(0,c.jsx)(Gf,{}),(0,c.jsx)(Af,{}),(0,c.jsx)(mh,{}),(0,c.jsx)(of,{}),n]}),(0,c.jsx)(Wf.TabPanel,{tabId:Mf.block,focusable:!1,children:(0,c.jsx)(g.BlockInspector,{})})]})})};var qf=({extraPanels:e,onActionPerformed:t})=>{$f();const{tabName:s,keyboardShortcut:n,showSummary:o}=(0,d.useSelect)((e=>{const t=e(il.store).getShortcutRepresentation("core/editor/toggle-sidebar"),s=e(ja).getActiveComplementaryArea("core");let n=s;return[Mf.block,Mf.document].includes(s)||(n=e(g.store).getBlockSelectionStart()?Mf.block:Mf.document),{tabName:n,keyboardShortcut:t,showSummary:![I,B,R].includes(e(vc).getCurrentPostType())}}),[]),{enableComplementaryArea:r}=(0,d.useDispatch)(ja),i=(0,p.useCallback)((e=>{e&&r("core",e)}),[r]);return(0,c.jsx)(Wf,{selectedTabId:s,onSelect:i,selectOnMove:!1,children:(0,c.jsx)(Yf,{tabName:s,keyboardShortcut:n,showSummary:o,onActionPerformed:t,extraPanels:e})})},Kf=(0,c.jsx)(L.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(L.Path,{d:"M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z"})});const Qf="edit-post/collab-history-sidebar",Xf="edit-post/collab-sidebar",Jf=[Qf,Xf];function eb(){}const tb=["#3858E9","#9fB1FF","#1D35B4","#1A1919","#E26F56","#33F078","#FFF972","#7A00DF"];function sb(e){return tb[e%tb.length]}function nb(e,t,s){if(!t)return;const n=e?`[role=treeitem][id="comment-thread-${e}"]`:"[role=treeitem]:not([id])",o=s?`${n} ${s}`:n;return new Promise((e=>{if(t.querySelector(o))return e(t.querySelector(o));let s=null;const n=new window.MutationObserver((()=>{t.querySelector(o)&&(clearTimeout(s),n.disconnect(),e(t.querySelector(o)))}));n.observe(t,{childList:!0,subtree:!0}),s=setTimeout((()=>{n.disconnect(),e(null)}),3e3)})).then((e=>e?.focus()))}var ob=function({avatar:e,name:t,date:s,userId:n}){const o=!!e,r=(0,v.getSettings)(),{currentUserAvatar:i,currentUserName:a,currentUserId:l,dateFormat:p=r.formats.date}=(0,d.useSelect)((e=>{const{canUser:t,getCurrentUser:s,getEntityRecord:n}=e(u.store),r=t("read",{kind:"root",name:"site"})?n("root","site"):void 0;if(o)return{dateFormat:r?.date_format};const{getSettings:i}=e(g.store),{__experimentalDiscussionSettings:a}=i(),l=a?.avatarURL,c=s();return{currentUserAvatar:c?.avatar_urls?.[48]??l,currentUserName:c?.name,currentUserId:c?.id,dateFormat:r?.date_format}}),[o]),m=(0,v.getDate)(s),h=(0,v.dateI18n)("c",m),_=Math.floor((new Date-m)/864e5)<30?(0,v.humanTimeDiff)(m):(0,v.dateI18n)(p,m),f=(0,v.dateI18n)((0,fs._x)("F j, Y g:i a","Note date full date format"),s);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("img",{src:e||i,className:"editor-collab-sidebar-panel__user-avatar",alt:(0,fs.__)("User avatar"),width:32,height:32,style:{borderColor:sb(n??l)}}),(0,c.jsxs)(Hn.__experimentalVStack,{spacing:"0",children:[(0,c.jsx)("span",{className:"editor-collab-sidebar-panel__user-name",children:t??a}),s&&(0,c.jsx)(Hn.Tooltip,{text:f,children:(0,c.jsx)("time",{dateTime:h,className:"editor-collab-sidebar-panel__user-time",children:_})})]})]})};var rb=function e({onSubmit:t,onCancel:s,thread:n,submitButtonText:o,labelText:r,reflowComments:i=eb}){const[a,l]=(0,p.useState)(n?.content?.raw??""),d=(0,m.useDebounce)(i,100),u=(0,m.useInstanceId)(e,"comment-input"),h=a===n?.content?.raw||!(g=a,g.trim()).length;var g;return(0,c.jsxs)(Hn.__experimentalVStack,{className:"editor-collab-sidebar-panel__comment-form",spacing:"4",as:"form",onSubmit:e=>{e.preventDefault(),t(a),l("")},children:[(0,c.jsx)(Hn.VisuallyHidden,{as:"label",htmlFor:u,children:r??(0,fs.__)("Note")}),(0,c.jsx)(hh.A,{id:u,value:a??"",onChange:e=>{var t;t=e.target.value,l(t),d()},rows:1,maxRows:20,onKeyDown:e=>{ll.isKeyboardEvent.primary(e,"Enter")&&!h&&e.target.parentNode.requestSubmit()}}),(0,c.jsxs)(Hn.__experimentalHStack,{spacing:"2",justify:"flex-end",wrap:!0,children:[(0,c.jsx)(Hn.Button,{size:"compact",variant:"tertiary",onClick:s,children:(0,c.jsx)(Hn.__experimentalTruncate,{children:(0,fs.__)("Cancel")})}),(0,c.jsx)(Hn.Button,{size:"compact",accessibleWhenDisabled:!0,variant:"primary",type:"submit",disabled:h,children:(0,c.jsx)(Hn.__experimentalTruncate,{children:o})})]})]})};Math.min,Math.max,Math.round,Math.floor;function ib(e){return e.split("-")[0]}function ab(e){return e.split("-")[1]}function lb(e){return"y"===e?"height":"width"}function cb(e){return["top","bottom"].includes(ib(e))?"y":"x"}function db(e){return"x"===cb(e)?"y":"x"}function ub(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function pb(e,t,s){let{reference:n,floating:o}=e;const r=cb(t),i=db(t),a=lb(i),l=ib(t),c="y"===r,d=n.x+n.width/2-o.width/2,u=n.y+n.height/2-o.height/2,p=n[a]/2-o[a]/2;let m;switch(l){case"top":m={x:d,y:n.y-o.height};break;case"bottom":m={x:d,y:n.y+n.height};break;case"right":m={x:n.x+n.width,y:u};break;case"left":m={x:n.x-o.width,y:u};break;default:m={x:n.x,y:n.y}}switch(ab(t)){case"start":m[i]-=p*(s&&c?-1:1);break;case"end":m[i]+=p*(s&&c?-1:1)}return m}const mb=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){const{x:s,y:n}=t,o=await async function(e,t){const{placement:s,platform:n,elements:o}=e,r=await(null==n.isRTL?void 0:n.isRTL(o.floating)),i=ib(s),a=ab(s),l="y"===cb(s),c=["left","top"].includes(i)?-1:1,d=r&&l?-1:1,u=(m=e,"function"==typeof(p=t)?p(m):p);var p,m;let{mainAxis:h,crossAxis:g,alignmentAxis:_}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return a&&"number"==typeof _&&(g="end"===a?-1*_:_),l?{x:g*d,y:h*c}:{x:h*c,y:g*d}}(t,e);return{x:s+o.x,y:n+o.y,data:o}}}},hb=Math.min,gb=Math.max,_b=Math.round,fb=Math.floor,bb=e=>({x:e,y:e});function yb(){return"undefined"!=typeof window}function xb(e){return Sb(e)?(e.nodeName||"").toLowerCase():"#document"}function vb(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function wb(e){var t;return null==(t=(Sb(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Sb(e){return!!yb()&&(e instanceof Node||e instanceof vb(e).Node)}function kb(e){return!!yb()&&(e instanceof Element||e instanceof vb(e).Element)}function Cb(e){return!!yb()&&(e instanceof HTMLElement||e instanceof vb(e).HTMLElement)}function Pb(e){return!(!yb()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof vb(e).ShadowRoot)}function jb(e){const{overflow:t,overflowX:s,overflowY:n,display:o}=Rb(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+s)&&!["inline","contents"].includes(o)}function Eb(e){return["table","td","th"].includes(xb(e))}function Tb(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Ib(e){const t=Bb(),s=kb(e)?Rb(e):e;return["transform","translate","scale","rotate","perspective"].some((e=>!!s[e]&&"none"!==s[e]))||!!s.containerType&&"normal"!==s.containerType||!t&&!!s.backdropFilter&&"none"!==s.backdropFilter||!t&&!!s.filter&&"none"!==s.filter||["transform","translate","scale","rotate","perspective","filter"].some((e=>(s.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(s.contain||"").includes(e)))}function Bb(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Nb(e){return["html","body","#document"].includes(xb(e))}function Rb(e){return vb(e).getComputedStyle(e)}function Db(e){return kb(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ab(e){if("html"===xb(e))return e;const t=e.assignedSlot||e.parentNode||Pb(e)&&e.host||wb(e);return Pb(t)?t.host:t}function Mb(e){const t=Ab(e);return Nb(t)?e.ownerDocument?e.ownerDocument.body:e.body:Cb(t)&&jb(t)?t:Mb(t)}function Lb(e,t,s){var n;void 0===t&&(t=[]),void 0===s&&(s=!0);const o=Mb(e),r=o===(null==(n=e.ownerDocument)?void 0:n.body),i=vb(o);if(r){const e=function(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}(i);return t.concat(i,i.visualViewport||[],jb(o)?o:[],e&&s?Lb(e):[])}return t.concat(o,Lb(o,[],s))}function Ob(e){const t=Rb(e);let s=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=Cb(e),r=o?e.offsetWidth:s,i=o?e.offsetHeight:n,a=_b(s)!==r||_b(n)!==i;return a&&(s=r,n=i),{width:s,height:n,$:a}}function Fb(e){return kb(e)?e:e.contextElement}function Vb(e){const t=Fb(e);if(!Cb(t))return bb(1);const s=t.getBoundingClientRect(),{width:n,height:o,$:r}=Ob(t);let i=(r?_b(s.width):s.width)/n,a=(r?_b(s.height):s.height)/o;return i&&Number.isFinite(i)||(i=1),a&&Number.isFinite(a)||(a=1),{x:i,y:a}}const Ub=bb(0);function Hb(e){const t=vb(e);return Bb()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Ub}function zb(e,t,s,n){void 0===t&&(t=!1),void 0===s&&(s=!1);const o=e.getBoundingClientRect(),r=Fb(e);let i=bb(1);t&&(n?kb(n)&&(i=Vb(n)):i=Vb(e));const a=function(e,t,s){return void 0===t&&(t=!1),!(!s||t&&s!==vb(e))&&t}(r,s,n)?Hb(r):bb(0);let l=(o.left+a.x)/i.x,c=(o.top+a.y)/i.y,d=o.width/i.x,u=o.height/i.y;if(r){const e=vb(r),t=n&&kb(n)?vb(n):n;let s=e,o=s.frameElement;for(;o&&n&&t!==s;){const e=Vb(o),t=o.getBoundingClientRect(),n=Rb(o),r=t.left+(o.clientLeft+parseFloat(n.paddingLeft))*e.x,i=t.top+(o.clientTop+parseFloat(n.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=r,c+=i,s=vb(o),o=s.frameElement}}return ub({width:d,height:u,x:l,y:c})}const Gb=[":popover-open",":modal"];function $b(e){return Gb.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Wb(e){return zb(wb(e)).left+Db(e).scrollLeft}function Zb(e,t,s){let n;if("viewport"===t)n=function(e,t){const s=vb(e),n=wb(e),o=s.visualViewport;let r=n.clientWidth,i=n.clientHeight,a=0,l=0;if(o){r=o.width,i=o.height;const e=Bb();(!e||e&&"fixed"===t)&&(a=o.offsetLeft,l=o.offsetTop)}return{width:r,height:i,x:a,y:l}}(e,s);else if("document"===t)n=function(e){const t=wb(e),s=Db(e),n=e.ownerDocument.body,o=gb(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),r=gb(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-s.scrollLeft+Wb(e);const a=-s.scrollTop;return"rtl"===Rb(n).direction&&(i+=gb(t.clientWidth,n.clientWidth)-o),{width:o,height:r,x:i,y:a}}(wb(e));else if(kb(t))n=function(e,t){const s=zb(e,!0,"fixed"===t),n=s.top+e.clientTop,o=s.left+e.clientLeft,r=Cb(e)?Vb(e):bb(1);return{width:e.clientWidth*r.x,height:e.clientHeight*r.y,x:o*r.x,y:n*r.y}}(t,s);else{const s=Hb(e);n={...t,x:t.x-s.x,y:t.y-s.y}}return ub(n)}function Yb(e,t){const s=Ab(e);return!(s===t||!kb(s)||Nb(s))&&("fixed"===Rb(s).position||Yb(s,t))}function qb(e,t,s){const n=Cb(t),o=wb(t),r="fixed"===s,i=zb(e,!0,r,t);let a={scrollLeft:0,scrollTop:0};const l=bb(0);if(n||!n&&!r)if(("body"!==xb(t)||jb(o))&&(a=Db(t)),n){const e=zb(t,!0,r,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=Wb(o));return{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function Kb(e,t){return Cb(e)&&"fixed"!==Rb(e).position?t?t(e):e.offsetParent:null}function Qb(e,t){const s=vb(e);if(!Cb(e)||$b(e))return s;let n=Kb(e,t);for(;n&&Eb(n)&&"static"===Rb(n).position;)n=Kb(n,t);return n&&("html"===xb(n)||"body"===xb(n)&&"static"===Rb(n).position&&!Ib(n))?s:n||function(e){let t=Ab(e);for(;Cb(t)&&!Nb(t);){if(Ib(t))return t;if(Tb(t))return null;t=Ab(t)}return null}(e)||s}const Xb={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:s,offsetParent:n,strategy:o}=e;const r="fixed"===o,i=wb(n),a=!!t&&$b(t.floating);if(n===i||a&&r)return s;let l={scrollLeft:0,scrollTop:0},c=bb(1);const d=bb(0),u=Cb(n);if((u||!u&&!r)&&(("body"!==xb(n)||jb(i))&&(l=Db(n)),Cb(n))){const e=zb(n);c=Vb(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}return{width:s.width*c.x,height:s.height*c.y,x:s.x*c.x-l.scrollLeft*c.x+d.x,y:s.y*c.y-l.scrollTop*c.y+d.y}},getDocumentElement:wb,getClippingRect:function(e){let{element:t,boundary:s,rootBoundary:n,strategy:o}=e;const r=[..."clippingAncestors"===s?function(e,t){const s=t.get(e);if(s)return s;let n=Lb(e,[],!1).filter((e=>kb(e)&&"body"!==xb(e))),o=null;const r="fixed"===Rb(e).position;let i=r?Ab(e):e;for(;kb(i)&&!Nb(i);){const t=Rb(i),s=Ib(i);s||"fixed"!==t.position||(o=null),(r?!s&&!o:!s&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||jb(i)&&!s&&Yb(e,i))?n=n.filter((e=>e!==i)):o=t,i=Ab(i)}return t.set(e,n),n}(t,this._c):[].concat(s),n],i=r[0],a=r.reduce(((e,s)=>{const n=Zb(t,s,o);return e.top=gb(n.top,e.top),e.right=hb(n.right,e.right),e.bottom=hb(n.bottom,e.bottom),e.left=gb(n.left,e.left),e}),Zb(t,i,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Qb,getElementRects:async function(e){const t=this.getOffsetParent||Qb,s=this.getDimensions;return{reference:qb(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await s(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:s}=Ob(e);return{width:t,height:s}},getScale:Vb,isElement:kb,isRTL:function(e){return"rtl"===Rb(e).direction}};function Jb(e,t,s,n){void 0===n&&(n={});const{ancestorScroll:o=!0,ancestorResize:r=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:l=!1}=n,c=Fb(e),d=o||r?[...c?Lb(c):[],...Lb(t)]:[];d.forEach((e=>{o&&e.addEventListener("scroll",s,{passive:!0}),r&&e.addEventListener("resize",s)}));const u=c&&a?function(e,t){let s,n=null;const o=wb(e);function r(){var e;clearTimeout(s),null==(e=n)||e.disconnect(),n=null}return function i(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),r();const{left:c,top:d,width:u,height:p}=e.getBoundingClientRect();if(a||t(),!u||!p)return;const m={rootMargin:-fb(d)+"px "+-fb(o.clientWidth-(c+u))+"px "+-fb(o.clientHeight-(d+p))+"px "+-fb(c)+"px",threshold:gb(0,hb(1,l))||1};let h=!0;function g(e){const t=e[0].intersectionRatio;if(t!==l){if(!h)return i();t?i(!1,t):s=setTimeout((()=>{i(!1,1e-7)}),100)}h=!1}try{n=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),r}(c,s):null;let p,m=-1,h=null;i&&(h=new ResizeObserver((e=>{let[n]=e;n&&n.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),s()})),c&&!l&&h.observe(c),h.observe(t));let g=l?zb(e):null;return l&&function t(){const n=zb(e);!g||n.x===g.x&&n.y===g.y&&n.width===g.width&&n.height===g.height||s();g=n,p=requestAnimationFrame(t)}(),s(),()=>{var e;d.forEach((e=>{o&&e.removeEventListener("scroll",s),r&&e.removeEventListener("resize",s)})),null==u||u(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const ey=(e,t,s)=>{const n=new Map,o={platform:Xb,...s},r={...o.platform,_c:n};return(async(e,t,s)=>{const{placement:n="bottom",strategy:o="absolute",middleware:r=[],platform:i}=s,a=r.filter(Boolean),l=await(null==i.isRTL?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=pb(c,n,l),p=n,m={},h=0;for(let s=0;s<a.length;s++){const{name:r,fn:g}=a[s],{x:_,y:f,data:b,reset:y}=await g({x:d,y:u,initialPlacement:n,placement:p,strategy:o,middlewareData:m,rects:c,platform:i,elements:{reference:e,floating:t}});d=null!=_?_:d,u=null!=f?f:u,m={...m,[r]:{...m[r],...b}},y&&h<=50&&(h++,"object"==typeof y&&(y.placement&&(p=y.placement),y.rects&&(c=!0===y.rects?await i.getElementRects({reference:e,floating:t,strategy:o}):y.rects),({x:d,y:u}=pb(c,p,l))),s=-1)}return{x:d,y:u,placement:p,strategy:o,middlewareData:m}})(e,t,{...o,platform:r})};var ty=s(1609);const sy=window.ReactDOM;var ny="undefined"!=typeof document?ty.useLayoutEffect:ty.useEffect;function oy(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let s,n,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(s=e.length,s!==t.length)return!1;for(n=s;0!=n--;)if(!oy(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),s=o.length,s!==Object.keys(t).length)return!1;for(n=s;0!=n--;)if(!{}.hasOwnProperty.call(t,o[n]))return!1;for(n=s;0!=n--;){const s=o[n];if(("_owner"!==s||!e.$$typeof)&&!oy(e[s],t[s]))return!1}return!0}return e!=e&&t!=t}function ry(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function iy(e,t){const s=ry(e);return Math.round(t*s)/s}function ay(e){const t=ty.useRef(e);return ny((()=>{t.current=e})),t}const{useBlockElementRef:ly,cleanEmptyObject:cy}=$(g.privateApis);function dy({thread:e,calculatedOffset:t,setHeights:s,selectedThread:n,setBlockRef:o,commentLastUpdated:r}){const i=(0,p.useRef)();ly(e.blockClientId,i);const a=(0,d.useSelect)((t=>e.blockClientId?t(g.store).getBlockMode(e.blockClientId):null),[e.blockClientId]),l=(0,p.useCallback)(((e,t)=>{s((s=>s[e]!==t?{...s,[e]:t}:s))}),[s]),{y:c,refs:u}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:s="absolute",middleware:n=[],platform:o,elements:{reference:r,floating:i}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[d,u]=ty.useState({x:0,y:0,strategy:s,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=ty.useState(n);oy(p,n)||m(n);const[h,g]=ty.useState(null),[_,f]=ty.useState(null),b=ty.useCallback((e=>{e!==w.current&&(w.current=e,g(e))}),[]),y=ty.useCallback((e=>{e!==S.current&&(S.current=e,f(e))}),[]),x=r||h,v=i||_,w=ty.useRef(null),S=ty.useRef(null),k=ty.useRef(d),C=null!=l,P=ay(l),j=ay(o),E=ty.useCallback((()=>{if(!w.current||!S.current)return;const e={placement:t,strategy:s,middleware:p};j.current&&(e.platform=j.current),ey(w.current,S.current,e).then((e=>{const t={...e,isPositioned:!0};T.current&&!oy(k.current,t)&&(k.current=t,sy.flushSync((()=>{u(t)})))}))}),[p,t,s,j]);ny((()=>{!1===c&&k.current.isPositioned&&(k.current.isPositioned=!1,u((e=>({...e,isPositioned:!1}))))}),[c]);const T=ty.useRef(!1);ny((()=>(T.current=!0,()=>{T.current=!1})),[]),ny((()=>{if(x&&(w.current=x),v&&(S.current=v),x&&v){if(P.current)return P.current(x,v,E);E()}}),[x,v,E,P,C]);const I=ty.useMemo((()=>({reference:w,floating:S,setReference:b,setFloating:y})),[b,y]),B=ty.useMemo((()=>({reference:x,floating:v})),[x,v]),N=ty.useMemo((()=>{const e={position:s,left:0,top:0};if(!B.floating)return e;const t=iy(B.floating,d.x),n=iy(B.floating,d.y);return a?{...e,transform:"translate("+t+"px, "+n+"px)",...ry(B.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:t,top:n}}),[s,a,B.floating,d.x,d.y]);return ty.useMemo((()=>({...d,update:E,refs:I,elements:B,floatingStyles:N})),[d,E,I,B,N])}({placement:"right-start",middleware:[mb({crossAxis:t||-16})],whileElementsMounted:Jb});return(0,p.useEffect)((()=>{i.current&&u.setReference(i.current)}),[i,u,r,a]),(0,p.useEffect)((()=>{u.floating?.current&&o(e.id,i.current)}),[e.id,u.floating,o]),(0,p.useEffect)((()=>{if(u.floating?.current){const t=u.floating.current.scrollHeight;l(e.id,t)}}),[e.id,l,u.floating,n,r]),{blockRef:i,y:c,refs:u}}const{useBlockElement:uy}=$(g.privateApis);function py({onSubmit:e,newNoteFormState:t,setNewNoteFormState:s,commentSidebarRef:n,reflowComments:o=eb,isFloating:r=!1,y:i,refs:a}){const{clientId:l}=(0,d.useSelect)((e=>{const{getSelectedBlockClientId:t}=e(g.store);return{clientId:t()}}),[]),u=uy(l),{toggleBlockSpotlight:p}=$((0,d.useDispatch)(g.store));return"open"===t&&l?(0,c.jsxs)(Hn.__experimentalVStack,{className:mr("editor-collab-sidebar-panel__thread is-selected",{"is-floating":r}),spacing:"3",tabIndex:0,"aria-label":(0,fs.__)("New note"),role:"treeitem",ref:r?a.setFloating:void 0,style:r?{top:i,opacity:i?void 0:0}:void 0,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(p(l,!1),s("closed"))},children:[(0,c.jsx)(Hn.__experimentalHStack,{alignment:"left",spacing:"3",children:(0,c.jsx)(ob,{})}),(0,c.jsx)(rb,{onSubmit:async t=>{const{id:o}=await e({content:t});nb(o,n.current),s("creating")},onCancel:()=>{s("closed"),u?.focus(),p(l,!1)},reflowComments:o,submitButtonText:(0,fs.__)("Add note"),labelText:(0,fs.__)("New note")})]}):null}const{useBlockElement:my}=$(g.privateApis),{Menu:hy}=$(Hn.privateApis);function gy({threads:e,onEditComment:t,onAddReply:s,onCommentDelete:n,newNoteFormState:o,setNewNoteFormState:r,commentSidebarRef:i,reflowComments:a,isFloating:l=!1,commentLastUpdated:u}){const[m,h]=(0,p.useState)({}),[_,f]=(0,p.useState)(null),[b,y]=(0,p.useState)({}),[x,v]=(0,p.useState)({}),{setCanvasMinHeight:w}=$((0,d.useDispatch)(vc)),{selectBlock:S,toggleBlockSpotlight:k}=$((0,d.useDispatch)(g.store)),{blockCommentId:C,selectedBlockClientId:P,orderedBlockIds:j,blockMode:E}=(0,d.useSelect)((e=>{const{getBlockAttributes:t,getSelectedBlockClientId:s,getClientIdsWithDescendants:n,getBlockMode:o}=e(g.store),r=s();return{blockCommentId:r?t(r)?.metadata?.noteId:null,selectedBlockClientId:r,orderedBlockIds:n(),blockMode:r?o(r):null}}),[]),T=my(P),I=(0,p.useMemo)((()=>{const t=[...e],s=[];if(l&&"open"===o){const e={id:"new-note-thread",blockClientId:P,content:{rendered:""}};return j.forEach((n=>{if(n===P)s.push(e);else{const e=t.find((e=>e.blockClientId===n));e&&s.push(e)}})),s}return t}),[e,l,o,P,j]),B=async e=>{const t=I.findIndex((t=>t.id===e.id)),s=I[t+1],o=I[t-1];if(await n(e),0!==e.parent)return f(e.parent),void nb(e.parent,i.current);s?(f(s.id),nb(s.id,i.current)):o?(f(o.id),nb(o.id,i.current)):(f(null),r("closed"),T?.focus())};(0,p.useEffect)((()=>{f("open"===o?"new-note-thread":C)}),[C,o]);const N=(0,p.useCallback)(((e,t)=>{v((s=>({...s,[e]:t})))}),[]);(0,p.useEffect)((()=>{const{offsets:e,minHeight:t}=(()=>{const e={};if(!l)return{offsets:e,minHeight:0};const t=I.findIndex((e=>e.id===_)),s=-1===t?0:t,n=I[s];if(!n||!x[n.id])return{offsets:e,minHeight:0};let o=x[n.id],r=o?.getBoundingClientRect();const i=r?.top||0,a=m[n.id]||0;e[n.id]=-16;let c={threadTop:i-16,threadHeight:a};for(let t=s+1;t<I.length;t++){const s=I[t];if(!x[s.id])continue;o=x[s.id],r=o?.getBoundingClientRect();const n=r?.top||0,i=m[s.id]||0;let a=-16;const l=c.threadTop+c.threadHeight;n<l+16&&(a=l-n+20),e[s.id]=a,c={threadTop:n+a,threadHeight:i}}let d={threadTop:i-16};for(let s=t-1;s>=0;s--){const t=I[s];if(!x[t.id])continue;o=x[t.id],r=o?.getBoundingClientRect();const n=r?.top||0,i=m[t.id]||0;let a=-16;n+i>d.threadTop&&(a=d.threadTop-n-i-20),e[t.id]=a,d={threadTop:n+a}}let u=0;const p=I[I.length-1];if(x[p.id]){const t=x[p.id],s=t?.getBoundingClientRect();u=(s?.top||0)+(m[p.id]||0)+(e[p.id]||0)+32}return{offsets:e,minHeight:u}})();Object.keys(e).length>0&&y(e),w(t)}),[m,x,l,I,_,w,E]);return Array.isArray(I)&&I.length>0||l?(0,c.jsxs)(c.Fragment,{children:[!l&&"open"===o&&(0,c.jsx)(py,{onSubmit:s,newNoteFormState:o,setNewNoteFormState:r,commentSidebarRef:i}),I.map((e=>(0,c.jsx)(_y,{thread:e,onAddReply:s,onCommentDelete:B,onEditComment:t,isSelected:_===e.id,setSelectedThread:f,setNewNoteFormState:r,commentSidebarRef:i,reflowComments:a,isFloating:l,calculatedOffset:b[e.id]??0,setHeights:h,setBlockRef:N,selectedThread:_,commentLastUpdated:u,newNoteFormState:o,onKeyDown:t=>((e,t,s)=>{if(e.defaultPrevented)return;const n=I.findIndex((e=>e.id===t.id));"Enter"!==e.key&&"ArrowRight"!==e.key||e.currentTarget!==e.target||s?("Enter"===e.key||"ArrowLeft"===e.key)&&e.currentTarget===e.target&&s||"Escape"===e.key?(f(null),r("closed"),t.blockClientId&&k(t.blockClientId,!1),nb(t.id,i.current)):"ArrowDown"===e.key&&n<I.length-1&&e.currentTarget===e.target?nb(I[n+1].id,i.current):"ArrowUp"===e.key&&n>0&&e.currentTarget===e.target?nb(I[n-1].id,i.current):"Home"===e.key&&e.currentTarget===e.target?nb(I[0].id,i.current):"End"===e.key&&e.currentTarget===e.target&&nb(I[I.length-1].id,i.current):(r("closed"),f(t.id),t.blockClientId&&(S(t.blockClientId,null),k(t.blockClientId,!0)))})(t,e,_===e.id)},e.id)))]}):(0,c.jsx)(py,{onSubmit:s,newNoteFormState:o,setNewNoteFormState:r,commentSidebarRef:i})}function _y({thread:e,onEditComment:t,onAddReply:s,onCommentDelete:n,isSelected:o,setNewNoteFormState:r,commentSidebarRef:i,reflowComments:a,isFloating:l,calculatedOffset:u,setHeights:h,setBlockRef:_,setSelectedThread:f,selectedThread:b,commentLastUpdated:y,newNoteFormState:x,onKeyDown:v}){const{toggleBlockHighlight:w,selectBlock:S,toggleBlockSpotlight:k}=$((0,d.useDispatch)(g.store)),C=my(e.blockClientId),P=(0,m.useDebounce)(w,50),{y:j,refs:E}=dy({thread:e,calculatedOffset:u,setHeights:h,setBlockRef:_,selectedThread:b,commentLastUpdated:y}),T=(0,p.useRef)(!1),I=()=>{f(null),r("closed"),k(e.blockClientId,!1)},B=e?.reply||[],N=B.length>0?B[B.length-1]:void 0,R=B.length>0?B.slice(0,-1):[],D=function(e,t=10){if(!e)return"";const s=(0,fs._x)("words","Word count type. Do not translate!"),n=e.trim();let o="";if("words"===s)o=n.split(" ",t).join(" ");else if("characters_excluding_spaces"===s){const e=n.split("",t).join(""),s=e.length-e.replaceAll(" ","").length;o=n.split("",t+s).join("")}else"characters_including_spaces"===s&&(o=n.split("",t).join(""));return o!==n?o+"…":o}((0,Uc.__unstableStripHTML)(e.content?.rendered),10),A=e.blockClientId?(0,fs.sprintf)((0,fs.__)("Note: %s"),D):(0,fs.sprintf)((0,fs.__)("Original block deleted. Note: %s"),D);return"new-note-thread"===e.id&&"open"===x&&l?(0,c.jsx)(py,{onSubmit:s,newNoteFormState:x,setNewNoteFormState:r,commentSidebarRef:i,reflowComments:a,isFloating:l,y:j,refs:E}):(0,c.jsxs)(Hn.__experimentalVStack,{className:mr("editor-collab-sidebar-panel__thread",{"is-selected":o,"is-floating":l}),id:`comment-thread-${e.id}`,spacing:"3",onClick:()=>{r("closed"),f(e.id),k(e.blockClientId,!0),e.blockClientId&&S(e.blockClientId,null)},onMouseEnter:()=>{P(e.blockClientId,!0)},onMouseLeave:()=>{P(e.blockClientId,!1)},onFocus:()=>{w(e.blockClientId,!0)},onBlur:t=>{const s=t.relatedTarget?.closest(".editor-collab-sidebar-panel__thread"),n=t.relatedTarget?.closest('[role="dialog"]'),o=T.current;s&&!o||n||o&&t.currentTarget.contains(t.relatedTarget)||(w(e.blockClientId,!1),I())},onKeyUp:e=>{"Tab"===e.key&&(T.current=!1)},onKeyDown:e=>{"Tab"===e.key?T.current=!0:v(e)},tabIndex:0,role:"treeitem","aria-label":A,"aria-expanded":o,ref:l?E.setFloating:void 0,style:l?{top:j}:void 0,children:[(0,c.jsx)(Hn.Button,{className:"editor-collab-sidebar-panel__skip-to-comment",variant:"secondary",size:"compact",onClick:()=>{nb(e.id,i.current,"textarea")},children:(0,fs.__)("Add new reply")}),!e.blockClientId&&(0,c.jsx)(Hn.__experimentalText,{as:"p",weight:500,variant:"muted",children:(0,fs.__)("Original block deleted.")}),(0,c.jsx)(fy,{thread:e,isExpanded:o,onEdit:(s={})=>{t(s),"approved"===s.status&&(I(),l?C?.focus():nb(e.id,i.current))},onDelete:n,reflowComments:a}),o&&B.map((s=>(0,c.jsx)(fy,{thread:s,parent:e,isExpanded:o,onEdit:t,onDelete:n,reflowComments:a},s.id))),!o&&R.length>0&&(0,c.jsx)(Hn.__experimentalHStack,{className:"editor-collab-sidebar-panel__more-reply-separator",children:(0,c.jsx)(Hn.Button,{size:"compact",variant:"tertiary",className:"editor-collab-sidebar-panel__more-reply-button",onClick:()=>{f(e.id),nb(e.id,i.current)},children:(0,fs.sprintf)((0,fs._n)("%s more reply","%s more replies",R.length),R.length)})}),!o&&N&&(0,c.jsx)(fy,{thread:N,parent:e,isExpanded:o,onEdit:t,onDelete:n,reflowComments:a}),o&&(0,c.jsxs)(Hn.__experimentalVStack,{spacing:"2",role:"treeitem",children:[(0,c.jsx)(Hn.__experimentalHStack,{alignment:"left",spacing:"3",justify:"flex-start",children:(0,c.jsx)(ob,{})}),(0,c.jsx)(Hn.__experimentalVStack,{spacing:"2",children:(0,c.jsx)(rb,{onSubmit:n=>{"approved"===e.status?t({id:e.id,status:"hold",content:n}):s({content:n,parent:e.id})},onCancel:t=>{t.stopPropagation(),I(),nb(e.id,i.current)},submitButtonText:"approved"===e.status?(0,fs.__)("Reopen & Reply"):(0,fs.__)("Reply"),rows:"approved"===e.status?2:4,labelText:(0,fs.sprintf)((0,fs.__)("Reply to note %1$s by %2$s"),e.id,e.author_name),reflowComments:a})})]}),!!e.blockClientId&&(0,c.jsx)(Hn.Button,{className:"editor-collab-sidebar-panel__skip-to-block",variant:"secondary",size:"compact",onClick:e=>{e.stopPropagation(),C?.focus()},children:(0,fs.__)("Back to block")})]})}const fy=({thread:e,parent:t,isExpanded:s,onEdit:n,onDelete:o,reflowComments:r})=>{const[i,a]=(0,p.useState)(!1),[l,d]=(0,p.useState)(!1),u=(0,p.useRef)(null),m=()=>{a(!1),d(!1),u.current?.focus()},h="note"===e.type&&e.meta&&("resolved"===e.meta._wp_note_status||"reopen"===e.meta._wp_note_status),g=[{id:"edit",title:(0,fs.__)("Edit"),isEligible:({status:e})=>"approved"!==e,onClick:()=>{a("edit")}},{id:"reopen",title:(0,fs._x)("Reopen","Reopen note"),isEligible:({status:e})=>"approved"===e,onClick:()=>{n({id:e.id,status:"hold"})}},{id:"delete",title:(0,fs.__)("Delete"),isEligible:()=>!0,onClick:()=>{a("delete"),d(!0)}}],_=0===e.parent,f="approved"!==t?.status?g.filter((t=>t.isEligible(e))):[],b=0===e.parent?(0,fs.__)("Are you sure you want to delete this note? This will also delete all of this note's replies."):(0,fs.__)("Are you sure you want to delete this reply?");return(0,c.jsxs)(Hn.__experimentalVStack,{spacing:"2",role:0!==e.parent?"treeitem":void 0,children:[(0,c.jsxs)(Hn.__experimentalHStack,{alignment:"left",spacing:"3",justify:"flex-start",children:[(0,c.jsx)(ob,{avatar:e?.author_avatar_urls?.[48],name:e?.author_name,date:e?.date,userId:e?.author}),s&&(0,c.jsx)(Hn.FlexItem,{className:"editor-collab-sidebar-panel__comment-status",onClick:e=>{e.stopPropagation()},children:(0,c.jsxs)(Hn.__experimentalHStack,{spacing:"0",children:[_&&(0,c.jsx)(Hn.Button,{label:(0,fs._x)("Resolve","Mark note as resolved"),size:"small",icon:wr,disabled:"approved"===e.status,accessibleWhenDisabled:"approved"===e.status,onClick:()=>{n({id:e.id,status:"approved"})}}),(0,c.jsxs)(hy,{placement:"bottom-end",children:[(0,c.jsx)(hy.TriggerButton,{render:(0,c.jsx)(Hn.Button,{ref:u,size:"small",icon:r_,label:(0,fs.__)("Actions"),disabled:!f.length,accessibleWhenDisabled:!0})}),(0,c.jsx)(hy.Popover,{modal:!1,children:f.map((e=>(0,c.jsx)(hy.Item,{onClick:()=>e.onClick(),children:(0,c.jsx)(hy.ItemLabel,{children:e.title})},e.id)))})]})]})})]}),"edit"===i?(0,c.jsx)(rb,{onSubmit:t=>{n({id:e.id,content:t}),a(!1),u.current?.focus()},onCancel:()=>m(),thread:e,submitButtonText:(0,fs._x)("Update","verb"),labelText:(0,fs.sprintf)((0,fs.__)("Edit note %1$s by %2$s"),e.id,e.author_name),reflowComments:r}):(0,c.jsx)(p.RawHTML,{className:mr("editor-collab-sidebar-panel__user-comment",{"editor-collab-sidebar-panel__resolution-text":h}),children:h?(()=>{const t="resolved"===e.meta._wp_note_status?(0,fs.__)("Marked as resolved"):(0,fs.__)("Reopened"),s=e?.content?.raw;return s&&"string"==typeof s&&""!==s.trim()?(0,fs.sprintf)((0,fs.__)("%1$s: %2$s"),t,s):t})():e?.content?.rendered}),"delete"===i&&(0,c.jsx)(Hn.__experimentalConfirmDialog,{isOpen:l,onConfirm:()=>{o(e),a(!1),d(!1)},onCancel:m,confirmButtonText:(0,fs.__)("Delete"),children:b})]})};const{CommentIconSlotFill:by}=$(g.privateApis),yy=({clientId:e,onClick:t,isDistractionFree:s})=>{const n=(0,d.useSelect)((t=>t(g.store).getBlock(e)),[e]);if(!n?.isValid||n?.name===(0,x.getUnregisteredTypeHandlerName)())return null;const o=s||"core/freeform"===n?.name;let r;return s?r=(0,fs.__)("Notes are disabled in distraction free mode."):"core/freeform"===n?.name&&(r=(0,fs.__)("Convert to blocks to add notes.")),(0,c.jsx)(Hn.MenuItem,{icon:Kf,onClick:t,"aria-haspopup":"dialog",disabled:o,info:r,children:(0,fs.__)("Add note")})};var xy=({onClick:e,isDistractionFree:t})=>(0,c.jsx)(by.Fill,{children:({clientId:s,onClose:n})=>(0,c.jsx)(yy,{clientId:s,isDistractionFree:t,onClick:()=>{e(),n()}})});const{CommentIconToolbarSlotFill:vy}=$(g.privateApis);var wy=({onClick:e,thread:t})=>{const s=(0,p.useMemo)((()=>{if(!t)return[];const e=new Map,s=[t,...t.reply];return s.sort(((e,t)=>new Date(e.date)-new Date(t.date))),s.forEach((t=>{t.author_name&&t.author_avatar_urls&&(e.has(t.author)||e.set(t.author,{name:t.author_name,avatar:t.author_avatar_urls?.[48]||t.author_avatar_urls?.[96],id:t.author,date:t.date}))})),Array.from(e.values())}),[t]);if(!s.length)return null;const n=s.length>3?s.slice(0,2):s,o=Math.max(0,s.length-n.length),r=s.length>100&&o>0?(0,fs.__)("100+"):(0,fs.sprintf)((0,fs.__)("+%s"),o);return(0,c.jsx)(vy.Fill,{children:(0,c.jsx)(Hn.ToolbarButton,{className:"comment-avatar-indicator",label:(0,fs.__)("View notes"),onClick:e,showTooltip:!0,children:(0,c.jsxs)(Hn.__experimentalHStack,{spacing:"1",children:[n.map((e=>(0,c.jsx)("img",{src:e.avatar,alt:e.name,className:"comment-avatar",style:{borderColor:sb(e.id)}},e.id))),o>0&&(0,c.jsx)(Hn.__experimentalText,{weight:500,children:r})]})})})};function Sy({newNoteFormState:e,setNewNoteFormState:t,styles:s,comments:n,commentSidebarRef:o,reflowComments:r,commentLastUpdated:i,isFloating:a=!1}){const{onCreate:l,onEdit:p,onDelete:m}=function(e=eb){const{createNotice:t}=(0,d.useDispatch)(_s.store),{saveEntityRecord:s,deleteEntityRecord:n}=(0,d.useDispatch)(u.store),{getCurrentPostId:o}=(0,d.useSelect)(vc),{getBlockAttributes:r,getSelectedBlockClientId:i}=(0,d.useSelect)(g.store),{updateBlockAttributes:a}=(0,d.useDispatch)(g.store),l=e=>{const s=e.message&&"unknown_error"!==e.code?(0,Ln.decodeEntities)(e.message):(0,fs.__)("An error occurred while performing an update.");t("error",s,{type:"snackbar",isDismissible:!0})};return{onCreate:async({content:n,parent:c})=>{try{const l=await s("root","comment",{post:o(),content:n,status:"hold",type:"note",parent:c||0},{throwOnError:!0});if(!c&&l?.id){const e=i(),t=r(e)?.metadata;a(e,{metadata:{...t,noteId:l.id}})}return t("snackbar",c?(0,fs.__)("Reply added."):(0,fs.__)("Note added."),{type:"snackbar",isDismissible:!0}),setTimeout(e,300),l}catch(t){e(),l(t)}},onEdit:async({id:n,content:r,status:i})=>{const a=i||"updated",c={approved:(0,fs.__)("Note marked as resolved."),hold:(0,fs.__)("Note reopened."),updated:(0,fs.__)("Note updated.")};try{if("approved"===i||"hold"===i){await s("root","comment",{id:n,status:i},{throwOnError:!0});const e={post:o(),content:r||"",type:"note",status:i,parent:n,meta:{_wp_note_status:"approved"===i?"resolved":"reopen"}};await s("root","comment",e,{throwOnError:!0})}else{const e={id:n,content:r,status:i};await s("root","comment",e,{throwOnError:!0})}t("snackbar",c[a]??(0,fs.__)("Note updated."),{type:"snackbar",isDismissible:!0}),e()}catch(t){e(),l(t)}},onDelete:async s=>{try{if(await n("root","comment",s.id,void 0,{throwOnError:!0}),!s.parent){const e=i(),t=r(e)?.metadata;a(e,{metadata:cy({...t,noteId:void 0})})}t("snackbar",(0,fs.__)("Note deleted."),{type:"snackbar",isDismissible:!0}),e()}catch(t){e(),l(t)}}}}(r);return(0,c.jsx)(Hn.__experimentalVStack,{className:"editor-collab-sidebar-panel",style:s,role:"tree",spacing:"3",justify:"flex-start",ref:e=>{e&&(o.current=e)},"aria-label":a?(0,fs.__)("Unresolved notes"):(0,fs.__)("All notes"),children:(0,c.jsx)(gy,{threads:n,onEditComment:p,onAddReply:l,onCommentDelete:m,newNoteFormState:e,setNewNoteFormState:t,commentSidebarRef:o,reflowComments:r,commentLastUpdated:i,isFloating:a})})}function ky({postId:e,mode:t}){const[s,n]=(0,p.useState)("closed"),{getActiveComplementaryArea:o}=(0,d.useSelect)(ja),{enableComplementaryArea:r}=(0,d.useDispatch)(ja),{toggleBlockSpotlight:i}=$((0,d.useDispatch)(g.store)),a=(0,m.useViewportMatch)("medium"),l=(0,p.useRef)(null),h=a&&"post-only"===t,{clientId:_,blockCommentId:f,isDistractionFree:b}=(0,d.useSelect)((e=>{const{getBlockAttributes:t,getSelectedBlockClientId:s,getSettings:n}=e(g.store),o=s();return{clientId:o,blockCommentId:o?t(o)?.metadata?.noteId:null,isDistractionFree:n().isDistractionFree}}),[]),{resultComments:y,unresolvedSortedThreads:x,reflowComments:v,commentLastUpdated:w}=function(e){const[t,s]=(0,p.useReducer)((()=>Date.now()),0),n={post:e,type:"note",status:"all",per_page:-1},{records:o}=(0,u.useEntityRecords)("root","comment",n,{enabled:!!e&&"number"==typeof e}),{getBlockAttributes:r}=(0,d.useSelect)(g.store),{clientIds:i}=(0,d.useSelect)((e=>{const{getClientIdsWithDescendants:t}=e(g.store);return{clientIds:t()}}),[]),{resultComments:a,unresolvedSortedThreads:l}=(0,p.useMemo)((()=>{if(!o||0===o.length)return{resultComments:[],unresolvedSortedThreads:[]};const e=i.reduce(((e,t)=>{const s=r(t)?.metadata?.noteId;return s&&(e[t]=s),e}),{}),t={},s=[];if(o.forEach((s=>{const n=Object.keys(e).find((t=>e[t]===s.id));t[s.id]={...s,reply:[],blockClientId:0===s.parent?n:null}})),o.forEach((e=>{0===e.parent?s.push(t[e.id]):t[e.parent]&&t[e.parent].reply.push(t[e.id])})),0===s?.length)return{resultComments:[],unresolvedSortedThreads:[]};const n=s.map((e=>({...e,reply:[...e.reply].reverse()}))),a=new Map(n.map((e=>[String(e.id),e]))),l=new Set(Object.values(e).map((e=>String(e)))),c=Object.values(e).map((e=>a.get(String(e)))).filter((e=>void 0!==e&&"hold"===e.status)),d=Object.values(e).map((e=>a.get(String(e)))).filter((e=>void 0!==e&&"approved"===e.status)),u=n.filter((e=>!l.has(String(e.id))));return{resultComments:[...c,...d,...u],unresolvedSortedThreads:c}}),[i,o,r]);return{resultComments:a,unresolvedSortedThreads:l,reflowComments:s,commentLastUpdated:t}}(e);!function(e=!1){const t=(0,d.useRegistry)();(0,p.useEffect)((()=>{if(!e)return;const{getActiveComplementaryArea:s}=t.select(ja),{disableComplementaryArea:n,enableComplementaryArea:o}=t.dispatch(ja),r=t.subscribe((()=>{null===s("core")&&o("core",Xf)}));return()=>{r(),s("core")===Xf&&n("core",Xf)}}),[e,t])}(h&&(x.length>0||"closed"!==s));const{merged:S}=Ti(),k=S?.styles?.color?.background,C=f?y.find((e=>e.id===f)):null,P=y.length>0||!h;async function j(){const e=await o("core"),t=Jf.find((t=>t===e));"approved"===C?.status?r("core",Qf):t&&P||r("core",h?Xf:Qf);const s=await o("core");Jf.includes(s)&&(n(C?"closed":"open"),nb(C?.id,l.current,C?void 0:"textarea"),i(_,!0))}return b?(0,c.jsx)(xy,{isDistractionFree:!0}):(0,c.jsxs)(c.Fragment,{children:[!!C&&(0,c.jsx)(wy,{thread:C,onClick:j}),(0,c.jsx)(xy,{onClick:j}),P&&(0,c.jsx)(Bu,{identifier:Qf,name:Qf,title:(0,fs.__)("All notes"),header:(0,c.jsx)("h2",{className:"interface-complementary-area-header__title",children:(0,fs.__)("All notes")}),icon:Kf,closeLabel:(0,fs.__)("Close Notes"),children:(0,c.jsx)(Sy,{comments:y,newNoteFormState:s,setNewNoteFormState:n,commentSidebarRef:l,reflowComments:v,commentLastUpdated:w})}),a&&(0,c.jsx)(Bu,{isPinnable:!1,header:!1,identifier:Xf,className:"editor-collab-sidebar",headerClassName:"editor-collab-sidebar__header",backgroundColor:k,children:(0,c.jsx)(Sy,{comments:x,newNoteFormState:s,setNewNoteFormState:n,commentSidebarRef:l,reflowComments:v,commentLastUpdated:w,styles:{backgroundColor:k},isFloating:!0})})]})}function Cy(){const{postId:e,mode:t,editorMode:s}=(0,d.useSelect)((e=>{const{getCurrentPostId:t,getRenderingMode:s,getEditorMode:n}=e(vc);return{postId:t(),mode:s(),editorMode:n()}}),[]);return e&&"number"==typeof e?"text"===s?null:(0,c.jsx)(Id,{supportKeys:"editor.notes",children:(0,c.jsx)(ky,{postId:e,mode:t})}):null}var Py=function({postType:e,postId:t,templateId:s,settings:n,children:o,initialEdits:r,onActionPerformed:i,extraContent:a,extraSidebarPanels:l,...p}){const{post:m,template:h,hasLoadedPost:g,error:_}=(0,d.useSelect)((n=>{const{getEntityRecord:o,getResolutionError:r,hasFinishedResolution:i}=n(u.store),a=["postType",e,t];return{post:o(...a),template:s?o("postType",I,s):void 0,hasLoadedPost:i("getEntityRecord",a),error:r("getEntityRecord",a)?.message}}),[e,t,s]);return(0,c.jsxs)(c.Fragment,{children:[g&&!m&&(0,c.jsx)(Hn.Notice,{status:_?"error":"warning",isDismissible:!1,children:_||(0,fs.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")}),!!m&&(0,c.jsxs)(Rl,{post:m,__unstableTemplate:h,settings:n,initialEdits:r,useSubRegistry:!1,children:[(0,c.jsx)(sf,{...p,children:a}),o,(0,c.jsx)(qf,{onActionPerformed:i,extraPanels:l}),(0,c.jsx)(Cy,{})]})]})};const{PreferenceBaseOption:jy}=$(C.privateApis);function Ey(e){const t=(0,d.useSelect)((e=>e(vc).isPublishSidebarEnabled()),[]),{enablePublishSidebar:s,disablePublishSidebar:n}=(0,d.useDispatch)(vc);return(0,c.jsx)(jy,{isChecked:t,onChange:e=>e?s():n(),...e})}const{BlockManager:Ty}=$(g.privateApis),Iy=[];function By(){const{showBlockTypes:e,hideBlockTypes:t}=$((0,d.useDispatch)(vc)),{blockTypes:s,allowedBlockTypes:n,hiddenBlockTypes:o}=(0,d.useSelect)((e=>({blockTypes:e(x.store).getBlockTypes(),allowedBlockTypes:e(vc).getEditorSettings().allowedBlockTypes,hiddenBlockTypes:e(C.store).get("core","hiddenBlockTypes")??Iy})),[]),r=(0,p.useMemo)((()=>!0===n?s:s.filter((({name:e})=>n?.includes(e)))),[n,s]).filter((e=>(0,x.hasBlockSupport)(e,"inserter",!0)&&(!e.parent||e.parent.includes("core/post-content")))),i=o.filter((e=>r.some((t=>t.name===e)))),a=r.filter((e=>!i.includes(e.name))),l=r.length-a.length;const u=s=>{if(a.length>s.length){const e=a.filter((e=>!s.find((({name:t})=>t===e.name))));t(e.map((({name:e})=>e)))}else if(a.length<s.length){const t=s.filter((e=>!a.find((({name:t})=>t===e.name))));e(t.map((({name:e})=>e)))}};return(0,c.jsxs)("div",{className:"editor-block-visibility",children:[!!l&&(0,c.jsxs)("div",{className:"editor-block-visibility__disabled-blocks-count",children:[(0,fs.sprintf)((0,fs._n)("%d block is hidden.","%d blocks are hidden.",l),l),(0,c.jsx)(Hn.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:function(){u(r)},children:(0,fs.__)("Reset")})]}),(0,c.jsx)(Ty,{blockTypes:r,selectedBlockTypes:a,onChange:u,showSelectAll:!1})]})}const{PreferencesModal:Ny,PreferencesModalTabs:Ry,PreferencesModalSection:Dy,PreferenceToggleControl:Ay}=$(C.privateApis);function My({extraSections:e={}}){const t=(0,m.useViewportMatch)("medium"),s=(0,d.useSelect)((e=>{const{getEditorSettings:s}=e(vc),{get:n}=e(C.store),o=s().richEditingEnabled;return!n("core","distractionFree")&&t&&o}),[t]),{setIsListViewOpened:n,setIsInserterOpened:o}=(0,d.useDispatch)(vc),{set:r}=(0,d.useDispatch)(C.store),i=(0,p.useMemo)((()=>[{name:"general",tabLabel:(0,fs.__)("General"),content:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(Dy,{title:(0,fs.__)("Interface"),children:[(0,c.jsx)(Ay,{scope:"core",featureName:"showListViewByDefault",help:(0,fs.__)("Opens the List View panel by default."),label:(0,fs.__)("Always open List View")}),s&&(0,c.jsx)(Ay,{scope:"core",featureName:"showBlockBreadcrumbs",help:(0,fs.__)("Display the block hierarchy trail at the bottom of the editor."),label:(0,fs.__)("Show block breadcrumbs")}),(0,c.jsx)(Ay,{scope:"core",featureName:"allowRightClickOverrides",help:(0,fs.__)("Allows contextual List View menus via right-click, overriding browser defaults."),label:(0,fs.__)("Allow right-click contextual menus")}),(0,c.jsx)(Ay,{scope:"core",featureName:"enableChoosePatternModal",help:(0,fs.__)("Pick from starter content when creating a new page."),label:(0,fs.__)("Show starter patterns")})]}),(0,c.jsxs)(Dy,{title:(0,fs.__)("Document settings"),description:(0,fs.__)("Select what settings are shown in the document panel."),children:[(0,c.jsx)(uu.Slot,{}),(0,c.jsx)(dh,{taxonomyWrapper:(e,t)=>(0,c.jsx)(au,{label:t.labels.menu_name,panelName:`taxonomy-panel-${t.slug}`})}),(0,c.jsx)(gp,{children:(0,c.jsx)(au,{label:(0,fs.__)("Featured image"),panelName:"featured-image"})}),(0,c.jsx)(op,{children:(0,c.jsx)(au,{label:(0,fs.__)("Excerpt"),panelName:"post-excerpt"})}),(0,c.jsx)(Id,{supportKeys:["comments","trackbacks"],children:(0,c.jsx)(au,{label:(0,fs.__)("Discussion"),panelName:"discussion-panel"})}),(0,c.jsx)(Td,{children:(0,c.jsx)(au,{label:(0,fs.__)("Page attributes"),panelName:"page-attributes"})})]}),t&&(0,c.jsx)(Dy,{title:(0,fs.__)("Publishing"),children:(0,c.jsx)(Ey,{help:(0,fs.__)("Review settings, such as visibility and tags."),label:(0,fs.__)("Enable pre-publish checks")})}),e?.general]})},{name:"appearance",tabLabel:(0,fs.__)("Appearance"),content:(0,c.jsxs)(Dy,{title:(0,fs.__)("Appearance"),description:(0,fs.__)("Customize the editor interface to suit your needs."),children:[(0,c.jsx)(Ay,{scope:"core",featureName:"fixedToolbar",onToggle:()=>r("core","distractionFree",!1),help:(0,fs.__)("Access all block and document tools in a single place."),label:(0,fs.__)("Top toolbar")}),(0,c.jsx)(Ay,{scope:"core",featureName:"distractionFree",onToggle:()=>{r("core","fixedToolbar",!0),o(!1),n(!1)},help:(0,fs.__)("Reduce visual distractions by hiding the toolbar and other elements to focus on writing."),label:(0,fs.__)("Distraction free")}),(0,c.jsx)(Ay,{scope:"core",featureName:"focusMode",help:(0,fs.__)("Highlights the current block and fades other content."),label:(0,fs.__)("Spotlight mode")}),e?.appearance]})},{name:"accessibility",tabLabel:(0,fs.__)("Accessibility"),content:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Dy,{title:(0,fs.__)("Navigation"),description:(0,fs.__)("Optimize the editing experience for enhanced control."),children:(0,c.jsx)(Ay,{scope:"core",featureName:"keepCaretInsideBlock",help:(0,fs.__)("Keeps the text cursor within blocks while navigating with arrow keys, preventing it from moving to other blocks and enhancing accessibility for keyboard users."),label:(0,fs.__)("Contain text cursor inside block")})}),(0,c.jsx)(Dy,{title:(0,fs.__)("Interface"),children:(0,c.jsx)(Ay,{scope:"core",featureName:"showIconLabels",label:(0,fs.__)("Show button text labels"),help:(0,fs.__)("Show text instead of icons on buttons across the interface.")})})]})},{name:"blocks",tabLabel:(0,fs.__)("Blocks"),content:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Dy,{title:(0,fs.__)("Inserter"),children:(0,c.jsx)(Ay,{scope:"core",featureName:"mostUsedBlocks",help:(0,fs.__)("Adds a category with the most frequently used blocks in the inserter."),label:(0,fs.__)("Show most used blocks")})}),(0,c.jsx)(Dy,{title:(0,fs.__)("Manage block visibility"),description:(0,fs.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later."),children:(0,c.jsx)(By,{})})]})},window.__experimentalMediaProcessing&&{name:"media",tabLabel:(0,fs.__)("Media"),content:(0,c.jsx)(c.Fragment,{children:(0,c.jsxs)(Dy,{title:(0,fs.__)("General"),description:(0,fs.__)("Customize options related to the media upload flow."),children:[(0,c.jsx)(Ay,{scope:"core/media",featureName:"optimizeOnUpload",help:(0,fs.__)("Compress media items before uploading to the server."),label:(0,fs.__)("Pre-upload compression")}),(0,c.jsx)(Ay,{scope:"core/media",featureName:"requireApproval",help:(0,fs.__)("Require approval step when optimizing existing media."),label:(0,fs.__)("Approval step")})]})})}].filter(Boolean)),[s,e,o,n,r,t]);return(0,c.jsx)(Ry,{sections:i})}var Ly=function({postType:e}){const{registerPostTypeSchema:t}=$((0,d.useDispatch)(vc));(0,p.useEffect)((()=>{t(e)}),[t,e]);const{fields:s}=(0,d.useSelect)((t=>{const{getEntityFields:s}=$(t(vc));return{fields:s("postType",e)}}),[e]);return s};const Oy="content";var Fy={name:"core/pattern-overrides",getValues({select:e,clientId:t,context:s,bindings:n}){const o=s["pattern/overrides"],{getBlockAttributes:r}=e(g.store),i=r(t),a={};for(const e of Object.keys(n)){const t=o?.[i?.metadata?.name]?.[e];void 0!==t?a[e]=""===t?void 0:t:a[e]=i[e]}return a},setValues({select:e,dispatch:t,clientId:s,bindings:n}){const{getBlockAttributes:o,getBlockParentsByBlockName:r,getBlocks:i}=e(g.store),a=o(s),l=a?.metadata?.name;if(!l)return;const[c]=r(s,"core/block",!0),d=Object.entries(n).reduce(((e,[t,{newValue:s}])=>(e[t]=s,e)),{});if(!c){const e=s=>{for(const n of s)n.attributes?.metadata?.name===l&&t(g.store).updateBlockAttributes(n.clientId,d),e(n.innerBlocks)};return void e(i())}const u=o(c)?.[Oy];t(g.store).updateBlockAttributes(c,{[Oy]:{...u,[l]:{...u?.[l],...Object.entries(d).reduce(((e,[t,s])=>(e[t]=void 0===s?"":s,e)),{})}}})},canUserEditValue:()=>!0};const Vy=["core/navigation-link","core/navigation-submenu"],Uy=[{label:(0,fs.__)("Post Date"),args:{field:"date"},type:"string"},{label:(0,fs.__)("Post Modified Date"),args:{field:"modified"},type:"string"},{label:(0,fs.__)("Post Link"),args:{field:"link"},type:"string"}];var Hy={name:"core/post-data",getValues({select:e,context:t,bindings:s,clientId:n}){const o=Uy.map((e=>e.args.field)),{getBlockAttributes:r,getBlockName:i}=e(g.store),a=i?.(n);let l,c;if(Vy.includes(a)){const e=r?.(n);l=e?.id,c=e?.type}else l=t?.postId,c=t?.postType;const{getEditedEntityRecord:d}=e(u.store),p=d("postType",c,l),m={};for(const[e,t]of Object.entries(s))o.includes(t.args.field)?m[e]=p?.[t.args.field]??Uy.find((e=>e.args.field===t.args.field)).label:m[e]={};return m},setValues({dispatch:e,context:t,bindings:s,clientId:n,select:o}){const{getBlockName:r}=o(g.store),i=r?.(n);if(Vy.includes(i))return!1;const a={};Object.values(s).forEach((({args:e,newValue:t})=>{a[e.field]=t})),e(u.store).editEntityRecord("postType",t?.postType,t?.postId,a)},canUserEditValue({select:e,context:t}){const{getBlockName:s,getSelectedBlockClientId:n}=e(g.store),o=n(),r=s?.(o);if(Vy.includes(r))return!1;if(t?.query||t?.queryId)return!1;if(!t?.postType)return!1;return!!e(u.store).canUser("update",{kind:"postType",name:t?.postType,id:t?.postId})},getFieldsList({select:e}){const t=e(g.store).getSelectedBlock();return"core/post-date"!==t?.name||Vy.includes(t?.name)?[]:Uy}};function zy(e,t){const{getRegisteredPostMeta:s}=$(e(u.store)),n=s(t?.postType),o=[];return Object.entries(n).forEach((([e,t])=>{"footnotes"!==e&&"_"!==e.charAt(0)&&o.push({label:t.title||e,args:{key:e},default:t.default,type:t.type})})),o}function Gy({select:e,context:t,args:s}){const n=zy(e,t).find((e=>e.args.key===s.key));if(!n)return s.key;if(!t?.postId)return n.default||n.label||s.key;const{getEditedEntityRecord:o}=e(u.store),r=o("postType",t?.postType,t?.postId).meta;return r?.[s.key]??n?.label??s.key}var $y={name:"core/post-meta",getValues({select:e,context:t,bindings:s}){const n={};for(const[o,r]of Object.entries(s))n[o]=Gy({select:e,context:t,args:r.args});return n},setValues({dispatch:e,context:t,bindings:s}){const n={};Object.values(s).forEach((({args:e,newValue:t})=>{n[e.key]=t})),e(u.store).editEntityRecord("postType",t?.postType,t?.postId,{meta:n})},canUserEditValue({select:e,context:t,args:s}){if(t?.query||t?.queryId)return!1;if(!t?.postType)return!1;if(!zy(e,t).some((e=>e.args.key===s.key)))return!1;if(e(vc).getEditorSettings().enableCustomFields)return!1;return!!e(u.store).canUser("update",{kind:"postType",name:t?.postType,id:t?.postId})},getFieldsList:({select:e,context:t})=>zy(e,t).map((({default:e,...t})=>({...t})))};const Wy=["core/navigation-link","core/navigation-submenu"];function Zy(e,t){return{id:{label:(0,fs.__)("Term ID"),value:t,type:"string"},name:{label:(0,fs.__)("Name"),value:e?.name,type:"string"},slug:{label:(0,fs.__)("Slug"),value:e?.slug,type:"string"},link:{label:(0,fs.__)("Link"),value:e?.link,type:"string"},description:{label:(0,fs.__)("Description"),value:e?.description,type:"string"},parent:{label:(0,fs.__)("Parent ID"),value:e?.parent,type:"string"},count:{label:(0,fs.__)("Count"),value:`(${e?.count??0})`,type:"string"}}}function Yy(e,t,s){const{getEntityRecord:n}=e(u.store),{getBlockAttributes:o,getBlockName:r}=e(g.store);let i,a;const l=r?.(s);let c,d;if(Wy.includes(l)){const e=o?.(s);c=e?.id;const t=e?.type;d="tag"===t?"post_tag":t}else c=t?.termId,d=t?.taxonomy;return d&&c?(i=n("taxonomy",d,c),!i&&t?.termData&&(i=t.termData),i&&(a=Zy(i,c))):t?.termData&&(i=t.termData,a=Zy(i,i?.term_id)),a&&Object.keys(a).length?a:null}var qy={name:"core/term-data",usesContext:["taxonomy","termId","termData"],getValues({select:e,context:t,bindings:s,clientId:n}){const o=Yy(e,t,n),r={};for(const[e,t]of Object.entries(s)){const s=t.args.field,{value:n,label:i}=o?.[s]||{};r[e]=n??i??s}return r},setValues:({dispatch:e,context:t,bindings:s})=>!1,canUserEditValue({select:e,context:t,args:s}){const{getBlockName:n,getSelectedBlockClientId:o}=e(g.store),r=o(),i=n?.(r);if(Wy.includes(i))return!1;if(t?.termQuery)return!1;if(!t?.taxonomy||!t?.termId)return!1;Yy(e,t,void 0)?.[s.field];return!1},getFieldsList({select:e,context:t}){const s=e(g.store).getSelectedBlockClientId(),n=Yy(e,t,s);return n?Object.entries(n).map((([e,t])=>({label:t.label,type:t.type,args:{field:e}}))):[]}};const{store:Ky,...Qy}=i,Xy={};function Jy(e,t,s){const{registerEntityAction:n}=$((0,d.dispatch)(vc))}function ex(e,t,s){const{unregisterEntityAction:n}=$((0,d.dispatch)(vc))}function tx(e,t,s){const{registerEntityField:n}=$((0,d.dispatch)(vc))}function sx(e,t,s){const{unregisterEntityField:n}=$((0,d.dispatch)(vc))}G(Xy,{CreateTemplatePartModal:Jn,patternTitleField:ni,templateTitleField:Jr,BackButton:Xg,EntitiesSavedStatesExtensible:xd,Editor:Py,EditorContentSlotFill:Zg,GlobalStylesProvider:function({children:e}){const t=Ti();return t.isReady?(0,c.jsx)(Pi.Provider,{value:t,children:e}):null},mergeBaseAndUserConfigs:Ei,PluginPostExcerpt:lp,PostCardPanel:ff,PreferencesModal:function({extraSections:e={}}){const t=(0,d.useSelect)((e=>e(ja).isModalActive("editor/preferences")),[]),{closeModal:s}=(0,d.useDispatch)(ja);return t?(0,c.jsx)(Ny,{closeModal:s,children:(0,c.jsx)(My,{extraSections:e})}):null},usePostActions:cf,usePostFields:Ly,ToolsMoreMenuGroup:u_,ViewMoreMenuGroup:h_,ResizableEditor:U_,registerCoreBlockBindingsSources:function(){(0,x.registerBlockBindingsSource)(Fy),(0,x.registerBlockBindingsSource)(Hy),(0,x.registerBlockBindingsSource)($y),(0,x.registerBlockBindingsSource)(qy)},getTemplateInfo:Y,interfaceStore:Ky,...Qy})})(),(window.wp=window.wp||{}).editor=n})(); patterns.min.js 0000644 00000052745 15151622574 0007551 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{privateApis:()=>K,store:()=>k});var n={};e.r(n),e.d(n,{convertSyncedPatternToStatic:()=>y,createPattern:()=>m,createPatternFromFile:()=>g,setEditingPattern:()=>h});var r={};e.r(r),e.d(r,{isEditingPattern:()=>f});const a=window.wp.data;var s=(0,a.combineReducers)({isEditingPattern:function(e={},t){return"SET_EDITING_PATTERN"===t?.type?{...e,[t.clientId]:t.isEditing}:e}});const o=window.wp.blocks,i=window.wp.coreData,c=window.wp.blockEditor,l={theme:"pattern",user:"wp_block"},d="all-patterns",u={full:"fully",unsynced:"unsynced"},p={"core/paragraph":["content"],"core/heading":["content"],"core/button":["text","url","linkTarget","rel"],"core/image":["id","url","title","alt","caption"]},_="core/pattern-overrides",m=(e,t,n,r)=>async({registry:a})=>{const s={title:e,content:n,status:"publish",meta:t===u.unsynced?{wp_pattern_sync_status:t}:void 0,wp_pattern_category:r};return await a.dispatch(i.store).saveEntityRecord("postType","wp_block",s)},g=(e,t)=>async({dispatch:n})=>{const r=await e.text();let a;try{a=JSON.parse(r)}catch(e){throw new Error("Invalid JSON file")}if("wp_block"!==a.__file||!a.title||!a.content||"string"!=typeof a.title||"string"!=typeof a.content||a.syncStatus&&"string"!=typeof a.syncStatus)throw new Error("Invalid pattern JSON file");return await n.createPattern(a.title,a.syncStatus,a.content,t)},y=e=>({registry:t})=>{const n=t.select(c.store).getBlock(e),r=n.attributes?.content;const a=t.select(c.store).getBlocks(n.clientId);t.dispatch(c.store).replaceBlocks(n.clientId,function e(t){return t.map((t=>{let n=t.attributes.metadata;if(n&&(n={...n},delete n.id,delete n.bindings,r?.[n.name]))for(const[e,a]of Object.entries(r[n.name]))(0,o.getBlockType)(t.name)?.attributes[e]&&(t.attributes[e]=a);return(0,o.cloneBlock)(t,{metadata:n&&Object.keys(n).length>0?n:void 0},e(t.innerBlocks))}))}(a))};function h(e,t){return{type:"SET_EDITING_PATTERN",clientId:e,isEditing:t}}function f(e,t){return e.isEditingPattern[t]}const x=window.wp.privateApis,{lock:b,unlock:v}=(0,x.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/patterns"),w={reducer:s},k=(0,a.createReduxStore)("core/patterns",{...w});(0,a.register)(k),v(k).registerPrivateActions(n),v(k).registerPrivateSelectors(r);const S=window.ReactJSXRuntime,C=window.wp.components,B=window.wp.element,j=window.wp.i18n;function P(e){return Object.keys(p).includes(e.name)&&!!e.attributes.metadata?.name&&!!e.attributes.metadata?.bindings&&Object.values(e.attributes.metadata.bindings).some((e=>"core/pattern-overrides"===e.source))}const{BlockQuickNavigation:T}=v(c.privateApis);const E=window.wp.notices,D=window.wp.compose,I=window.wp.htmlEntities,N="wp_pattern_category";function O({categoryTerms:e,onChange:t,categoryMap:n}){const[r,a]=(0,B.useState)(""),s=(0,D.useDebounce)(a,500),o=(0,B.useMemo)((()=>Array.from(n.values()).map((e=>{return t=e.label,(0,I.decodeEntities)(t);var t})).filter((e=>""===r||e.toLowerCase().includes(r.toLowerCase()))).sort(((e,t)=>e.localeCompare(t)))),[r,n]);return(0,S.jsx)(C.FormTokenField,{className:"patterns-menu-items__convert-modal-categories",value:e,suggestions:o,onChange:function(e){const n=e.reduce(((e,t)=>(e.some((e=>e.toLowerCase()===t.toLowerCase()))||e.push(t),e)),[]);t(n)},onInputChange:s,label:(0,j.__)("Categories"),tokenizeOnBlur:!0,__experimentalExpandOnFocus:!0,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})}function R(){const{saveEntityRecord:e,invalidateResolution:t}=(0,a.useDispatch)(i.store),{corePatternCategories:n,userPatternCategories:r}=(0,a.useSelect)((e=>{const{getUserPatternCategories:t,getBlockPatternCategories:n}=e(i.store);return{corePatternCategories:n(),userPatternCategories:t()}}),[]),s=(0,B.useMemo)((()=>{const e=new Map;return r.forEach((t=>{e.set(t.label.toLowerCase(),{label:t.label,name:t.name,id:t.id})})),n.forEach((t=>{e.has(t.label.toLowerCase())||"query"===t.name||e.set(t.label.toLowerCase(),{label:t.label,name:t.name})})),e}),[r,n]);return{categoryMap:s,findOrCreateTerm:async function(n){try{const r=s.get(n.toLowerCase());if(r?.id)return r.id;const a=r?{name:r.label,slug:r.name}:{name:n},o=await e("taxonomy",N,a,{throwOnError:!0});return t("getUserPatternCategories"),o.id}catch(e){if("term_exists"!==e.code)throw e;return e.data.term_id}}}}function M({className:e="patterns-menu-items__convert-modal",modalTitle:t,...n}){const r=(0,a.useSelect)((e=>e(i.store).getPostType(l.user)?.labels?.add_new_item),[]);return(0,S.jsx)(C.Modal,{title:t||r,onRequestClose:n.onClose,overlayClassName:e,focusOnMount:"firstContentElement",size:"small",children:(0,S.jsx)(A,{...n})})}function A({confirmLabel:e=(0,j.__)("Add"),defaultCategories:t=[],content:n,onClose:r,onError:s,onSuccess:o,defaultSyncType:i=u.full,defaultTitle:c=""}){const[l,p]=(0,B.useState)(i),[_,m]=(0,B.useState)(t),[g,y]=(0,B.useState)(c),[h,f]=(0,B.useState)(!1),{createPattern:x}=v((0,a.useDispatch)(k)),{createErrorNotice:b}=(0,a.useDispatch)(E.store),{categoryMap:w,findOrCreateTerm:P}=R();return(0,S.jsx)("form",{onSubmit:e=>{e.preventDefault(),async function(e,t){if(g&&!h)try{f(!0);const r=await Promise.all(_.map((e=>P(e)))),a=await x(e,t,"function"==typeof n?n():n,r);o({pattern:a,categoryId:d})}catch(e){b(e.message,{type:"snackbar",id:"pattern-create"}),s?.()}finally{f(!1),m([]),y("")}}(g,l)},children:(0,S.jsxs)(C.__experimentalVStack,{spacing:"5",children:[(0,S.jsx)(C.TextControl,{label:(0,j.__)("Name"),value:g,onChange:y,placeholder:(0,j.__)("My pattern"),className:"patterns-create-modal__name-input",__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,S.jsx)(O,{categoryTerms:_,onChange:m,categoryMap:w}),(0,S.jsx)(C.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,j._x)("Synced","pattern (singular)"),help:(0,j.__)("Sync this pattern across multiple locations."),checked:l===u.full,onChange:()=>{p(l===u.full?u.unsynced:u.full)}}),(0,S.jsxs)(C.__experimentalHStack,{justify:"right",children:[(0,S.jsx)(C.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{r(),y("")},children:(0,j.__)("Cancel")}),(0,S.jsx)(C.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit","aria-disabled":!g||h,isBusy:h,children:e})]})]})})}function z(e,t){return e.type!==l.user?t.core?.filter((t=>e.categories?.includes(t.name))).map((e=>e.label)):t.user?.filter((t=>e.wp_pattern_category?.includes(t.id))).map((e=>e.label))}function L({pattern:e,onSuccess:t}){const{createSuccessNotice:n}=(0,a.useDispatch)(E.store),r=(0,a.useSelect)((e=>{const{getUserPatternCategories:t,getBlockPatternCategories:n}=e(i.store);return{core:n(),user:t()}}));return e?{content:e.content,defaultCategories:z(e,r),defaultSyncType:e.type!==l.user?u.unsynced:e.wp_pattern_sync_status||u.full,defaultTitle:(0,j.sprintf)((0,j._x)("%s (Copy)","pattern"),"string"==typeof e.title?e.title:e.title.raw),onSuccess:({pattern:e})=>{n((0,j.sprintf)((0,j._x)('"%s" duplicated.',"pattern"),e.title.raw),{type:"snackbar",id:"patterns-create"}),t?.({pattern:e})}}:null}const U=window.wp.primitives;var H=(0,S.jsx)(U.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,S.jsx)(U.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"})});function V({clientIds:e,rootClientId:t,closeBlockSettingsMenu:n}){const{createSuccessNotice:r}=(0,a.useDispatch)(E.store),{replaceBlocks:s,updateBlockAttributes:l}=(0,a.useDispatch)(c.store),{setEditingPattern:d}=v((0,a.useDispatch)(k)),[p,_]=(0,B.useState)(!1),{getBlockAttributes:m}=(0,a.useSelect)(c.store),g=(0,a.useSelect)((n=>{const{canUser:r}=n(i.store),{getBlocksByClientId:a,canInsertBlockType:s,getBlockRootClientId:l}=n(c.store),d=t||(e.length>0?l(e[0]):void 0),u=a(e)??[],p=1===u.length&&u[0]&&(0,o.isReusableBlock)(u[0])&&!!n(i.store).getEntityRecord("postType","wp_block",u[0].attributes.ref);return!(window?.__experimentalContentOnlyPatternInsertion&&1===u.length&&u?.[0]?.attributes?.metadata?.patternName)&&!p&&s("core/block",d)&&u.every((e=>!!e&&e.isValid&&(e=>{const t=(0,o.getBlockType)(e),n=t&&"parent"in t;return(0,o.hasBlockSupport)(e,"reusable",!n)})(e.name)))&&!!r("create",{kind:"postType",name:"wp_block"})}),[e,t]),{getBlocksByClientId:y}=(0,a.useSelect)(c.store),h=(0,B.useCallback)((()=>(0,o.serialize)(y(e))),[y,e]);if(!g)return null;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.MenuItem,{icon:H,onClick:()=>_(!0),"aria-expanded":p,"aria-haspopup":"dialog",children:(0,j.__)("Create pattern")}),p&&(0,S.jsx)(M,{content:h,onSuccess:t=>{(({pattern:t})=>{if(t.wp_pattern_sync_status===u.unsynced){if(1===e?.length){const n=m(e[0]);l(e[0],{metadata:{...n?.metadata?n.metadata:{},patternName:`core/block/${t.id}`,name:t.title.raw}})}}else{const r=(0,o.createBlock)("core/block",{ref:t.id});s(e,r),d(r.clientId,!0),n()}r(t.wp_pattern_sync_status===u.unsynced?(0,j.sprintf)((0,j.__)("Unsynced pattern created: %s"),t.title.raw):(0,j.sprintf)((0,j.__)("Synced pattern created: %s"),t.title.raw),{type:"snackbar",id:"convert-to-pattern-success"}),_(!1)})(t)},onError:()=>{_(!1)},onClose:()=>{_(!1)}})]})}const F=window.wp.url;var q=function({clientId:e}){const{attributes:t,canDetach:n,isVisible:r,managePatternsUrl:s,isSyncedPattern:l,isUnsyncedPattern:d}=(0,a.useSelect)((t=>{const{canRemoveBlock:n,getBlock:r}=t(c.store),{canUser:a}=t(i.store),s=r(e),l=window?.__experimentalContentOnlyPatternInsertion&&!!s?.attributes?.metadata?.patternName,d=!!s&&(0,o.isReusableBlock)(s)&&!!a("update",{kind:"postType",name:"wp_block",id:s.attributes.ref});return{attributes:s.attributes,canDetach:l||d&&n(e),isUnsyncedPattern:l,isSyncedPattern:d,isVisible:l||d,managePatternsUrl:a("create",{kind:"postType",name:"wp_template"})?(0,F.addQueryArgs)("site-editor.php",{p:"/pattern"}):(0,F.addQueryArgs)("edit.php",{post_type:"wp_block"})}}),[e]),{updateBlockAttributes:u}=(0,a.useDispatch)(c.store),{convertSyncedPatternToStatic:p}=v((0,a.useDispatch)(k));return r?(0,S.jsxs)(S.Fragment,{children:[n&&(0,S.jsx)(C.MenuItem,{onClick:()=>{if(l&&p(e),d){const{patternName:n,...r}=t?.metadata??{};u(e,{metadata:r})}},children:(0,j.__)("Detach")}),(0,S.jsx)(C.MenuItem,{href:s,children:(0,j.__)("Manage patterns")})]}):null};const G=window.wp.a11y;function Y({placeholder:e,initialName:t="",onClose:n,onSave:r}){const[a,s]=(0,B.useState)(t),o=(0,B.useId)(),i=!!a.trim();return(0,S.jsx)(C.Modal,{title:(0,j.__)("Enable overrides"),onRequestClose:n,focusOnMount:"firstContentElement",aria:{describedby:o},size:"small",children:(0,S.jsx)("form",{onSubmit:e=>{e.preventDefault(),i&&(()=>{if(a!==t){const e=(0,j.sprintf)((0,j.__)('Block name changed to: "%s".'),a);(0,G.speak)(e,"assertive")}r(a),n()})()},children:(0,S.jsxs)(C.__experimentalVStack,{spacing:"6",children:[(0,S.jsx)(C.__experimentalText,{id:o,children:(0,j.__)("Overrides are changes you make to a block within a synced pattern instance. Use overrides to customize a synced pattern instance to suit its new context. Name this block to specify an override.")}),(0,S.jsx)(C.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:a,label:(0,j.__)("Name"),help:(0,j.__)('For example, if you are creating a recipe pattern, you use "Recipe Title", "Recipe Description", etc.'),placeholder:e,onChange:s}),(0,S.jsxs)(C.__experimentalHStack,{justify:"right",children:[(0,S.jsx)(C.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:n,children:(0,j.__)("Cancel")}),(0,S.jsx)(C.Button,{__next40pxDefaultSize:!0,"aria-disabled":!i,variant:"primary",type:"submit",children:(0,j.__)("Enable")})]})]})})})}function J({onClose:e,onSave:t}){const n=(0,B.useId)();return(0,S.jsx)(C.Modal,{title:(0,j.__)("Disable overrides"),onRequestClose:e,aria:{describedby:n},size:"small",children:(0,S.jsx)("form",{onSubmit:n=>{n.preventDefault(),t(),e()},children:(0,S.jsxs)(C.__experimentalVStack,{spacing:"6",children:[(0,S.jsx)(C.__experimentalText,{id:n,children:(0,j.__)("Are you sure you want to disable overrides? Disabling overrides will revert all applied overrides for this block throughout instances of this pattern.")}),(0,S.jsxs)(C.__experimentalHStack,{justify:"right",children:[(0,S.jsx)(C.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:e,children:(0,j.__)("Cancel")}),(0,S.jsx)(C.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",children:(0,j.__)("Disable")})]})]})})})}var $=function({attributes:e,setAttributes:t,name:n}){const r=(0,B.useId)(),[a,s]=(0,B.useState)(!1),[o,i]=(0,B.useState)(!1),l=!!e.metadata?.name,d=e.metadata?.bindings?.__default,u=l&&d?.source===_,p=d?.source&&d.source!==_,{updateBlockBindings:m}=(0,c.useBlockBindingsUtils)();function g(n,r){r&&t({metadata:{...e.metadata,name:r}}),m({__default:n?{source:_}:void 0})}if(p)return null;const y="core/image"===n&&!!e.href?.length,h=!u&&y?(0,j.__)("Overrides currently don't support image links. Remove the link first before enabling overrides."):(0,j.__)("Allow changes to this block throughout instances of this pattern.");return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(c.InspectorControls,{group:"advanced",children:(0,S.jsx)(C.BaseControl,{__nextHasNoMarginBottom:!0,id:r,label:(0,j.__)("Overrides"),help:h,children:(0,S.jsx)(C.Button,{__next40pxDefaultSize:!0,className:"pattern-overrides-control__allow-overrides-button",variant:"secondary","aria-haspopup":"dialog",onClick:()=>{u?i(!0):s(!0)},disabled:!u&&y,accessibleWhenDisabled:!0,children:u?(0,j.__)("Disable overrides"):(0,j.__)("Enable overrides")})})}),a&&(0,S.jsx)(Y,{initialName:e.metadata?.name,onClose:()=>s(!1),onSave:e=>{g(!0,e)}}),o&&(0,S.jsx)(J,{onClose:()=>i(!1),onSave:()=>g(!1)})]})};const Q="content";var W=(0,S.jsx)(U.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,S.jsx)(U.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})});const{useBlockDisplayTitle:Z}=v(c.privateApis);function X({clientIds:e}){const t=1===e.length,{icon:n,firstBlockName:r}=(0,a.useSelect)((n=>{const{getBlockAttributes:r,getBlockNamesByClientId:a}=n(c.store),{getBlockType:s,getActiveBlockVariation:i}=n(o.store),l=a(e),d=l[0],u=s(d);let p;if(t){const t=i(d,r(e[0]));p=t?.icon||u.icon}else{p=1===new Set(l).size?u.icon:W}return{icon:p,firstBlockName:r(e[0]).metadata.name}}),[e,t]),s=Z({clientId:e[0],maximumLength:35}),i=t?(0,j.sprintf)((0,j.__)('This %1$s is editable using the "%2$s" override.'),s.toLowerCase(),r):(0,j.__)("These blocks are editable using overrides."),l=(0,B.useId)();return(0,S.jsx)(C.ToolbarItem,{children:e=>(0,S.jsx)(C.DropdownMenu,{className:"patterns-pattern-overrides-toolbar-indicator",label:s,popoverProps:{placement:"bottom-start",className:"patterns-pattern-overrides-toolbar-indicator__popover"},icon:(0,S.jsx)(S.Fragment,{children:(0,S.jsx)(c.BlockIcon,{icon:n,className:"patterns-pattern-overrides-toolbar-indicator-icon",showColors:!0})}),toggleProps:{description:i,...e},menuProps:{orientation:"both","aria-describedby":l},children:()=>(0,S.jsx)(C.__experimentalText,{id:l,children:i})})})}const K={};b(K,{OverridesPanel:function(){const e=(0,a.useSelect)((e=>e(c.store).getClientIdsWithDescendants()),[]),{getBlock:t}=(0,a.useSelect)(c.store),n=(0,B.useMemo)((()=>e.filter((e=>P(t(e))))),[e,t]);return n?.length?(0,S.jsx)(C.PanelBody,{title:(0,j.__)("Overrides"),children:(0,S.jsx)(T,{clientIds:n})}):null},CreatePatternModal:M,CreatePatternModalContents:A,DuplicatePatternModal:function({pattern:e,onClose:t,onSuccess:n}){const r=L({pattern:e,onSuccess:n});return e?(0,S.jsx)(M,{modalTitle:(0,j.__)("Duplicate pattern"),confirmLabel:(0,j.__)("Duplicate"),onClose:t,onError:t,...r}):null},isOverridableBlock:P,hasOverridableBlocks:function e(t){return t.some((t=>!!P(t)||e(t.innerBlocks)))},useDuplicatePatternProps:L,RenamePatternModal:function({onClose:e,onError:t,onSuccess:n,pattern:r,...s}){const o=(0,I.decodeEntities)(r.title),[c,l]=(0,B.useState)(o),[d,u]=(0,B.useState)(!1),{editEntityRecord:p,__experimentalSaveSpecifiedEntityEdits:_}=(0,a.useDispatch)(i.store),{createSuccessNotice:m,createErrorNotice:g}=(0,a.useDispatch)(E.store);return(0,S.jsx)(C.Modal,{title:(0,j.__)("Rename"),...s,onRequestClose:e,focusOnMount:"firstContentElement",size:"small",children:(0,S.jsx)("form",{onSubmit:async a=>{if(a.preventDefault(),c&&c!==r.title&&!d)try{await p("postType",r.type,r.id,{title:c}),u(!0),l(""),e?.();const t=await _("postType",r.type,r.id,["title"],{throwOnError:!0});n?.(t),m((0,j.__)("Pattern renamed"),{type:"snackbar",id:"pattern-update"})}catch(e){t?.();const n=e.message&&"unknown_error"!==e.code?e.message:(0,j.__)("An error occurred while renaming the pattern.");g(n,{type:"snackbar",id:"pattern-update"})}finally{u(!1),l("")}},children:(0,S.jsxs)(C.__experimentalVStack,{spacing:"5",children:[(0,S.jsx)(C.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,j.__)("Name"),value:c,onChange:l,required:!0}),(0,S.jsxs)(C.__experimentalHStack,{justify:"right",children:[(0,S.jsx)(C.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{e?.(),l("")},children:(0,j.__)("Cancel")}),(0,S.jsx)(C.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",children:(0,j.__)("Save")})]})]})})})},PatternsMenuItems:function({rootClientId:e}){return(0,S.jsx)(c.BlockSettingsMenuControls,{children:({selectedClientIds:t,onClose:n})=>(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(V,{clientIds:t,rootClientId:e,closeBlockSettingsMenu:n}),1===t.length&&(0,S.jsx)(q,{clientId:t[0]})]})})},RenamePatternCategoryModal:function({category:e,existingCategories:t,onClose:n,onError:r,onSuccess:s,...o}){const c=(0,B.useId)(),l=(0,B.useRef)(),[d,u]=(0,B.useState)((0,I.decodeEntities)(e.name)),[p,_]=(0,B.useState)(!1),[m,g]=(0,B.useState)(!1),y=m?`patterns-rename-pattern-category-modal__validation-message-${c}`:void 0,{saveEntityRecord:h,invalidateResolution:f}=(0,a.useDispatch)(i.store),{createErrorNotice:x,createSuccessNotice:b}=(0,a.useDispatch)(E.store),v=()=>{n(),u("")};return(0,S.jsx)(C.Modal,{title:(0,j.__)("Rename"),onRequestClose:v,...o,children:(0,S.jsx)("form",{onSubmit:async a=>{if(a.preventDefault(),!p){if(!d||d===e.name){const e=(0,j.__)("Please enter a new name for this category.");return(0,G.speak)(e,"assertive"),g(e),void l.current?.focus()}if(t.patternCategories.find((t=>t.id!==e.id&&t.label.toLowerCase()===d.toLowerCase()))){const e=(0,j.__)("This category already exists. Please use a different name.");return(0,G.speak)(e,"assertive"),g(e),void l.current?.focus()}try{_(!0);const t=await h("taxonomy",N,{id:e.id,slug:e.slug,name:d});f("getUserPatternCategories"),s?.(t),n(),b((0,j.__)("Pattern category renamed."),{type:"snackbar",id:"pattern-category-update"})}catch(e){r?.(),x(e.message,{type:"snackbar",id:"pattern-category-update"})}finally{_(!1),u("")}}},children:(0,S.jsxs)(C.__experimentalVStack,{spacing:"5",children:[(0,S.jsxs)(C.__experimentalVStack,{spacing:"2",children:[(0,S.jsx)(C.TextControl,{ref:l,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,j.__)("Name"),value:d,onChange:e=>{m&&g(void 0),u(e)},"aria-describedby":y,required:!0}),m&&(0,S.jsx)("span",{className:"patterns-rename-pattern-category-modal__validation-message",id:y,children:m})]}),(0,S.jsxs)(C.__experimentalHStack,{justify:"right",children:[(0,S.jsx)(C.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:v,children:(0,j.__)("Cancel")}),(0,S.jsx)(C.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit","aria-disabled":!d||d===e.name||p,isBusy:p,children:(0,j.__)("Save")})]})]})})})},PatternOverridesControls:$,ResetOverridesControl:function(e){const t=e.attributes.metadata?.name,n=(0,a.useRegistry)(),r=(0,a.useSelect)((n=>{if(!t)return;const{getBlockAttributes:r,getBlockParentsByBlockName:a}=n(c.store),[s]=a(e.clientId,"core/block",!0);if(!s)return;const o=r(s)[Q];return o?o.hasOwnProperty(t):void 0}),[e.clientId,t]);return(0,S.jsx)(c.__unstableBlockToolbarLastItem,{children:(0,S.jsx)(C.ToolbarGroup,{children:(0,S.jsx)(C.ToolbarButton,{onClick:function(){const{getBlockAttributes:r,getBlockParentsByBlockName:a}=n.select(c.store),[s]=a(e.clientId,"core/block",!0);if(!s)return;const o=r(s)[Q];if(!o.hasOwnProperty(t))return;const{updateBlockAttributes:i,__unstableMarkLastChangeAsPersistent:l}=n.dispatch(c.store);l();let d={...o};delete d[t],Object.keys(d).length||(d=void 0),i(s,{[Q]:d})},disabled:!r,children:(0,j.__)("Reset")})})})},PatternOverridesBlockControls:function(){const{clientIds:e,hasPatternOverrides:t,hasParentPattern:n}=(0,a.useSelect)((e=>{const{getBlockAttributes:t,getSelectedBlockClientIds:n,getBlockParentsByBlockName:r}=e(c.store),a=n(),s=a.every((e=>Object.values(t(e)?.metadata?.bindings??{}).some((e=>e?.source===_)))),o=a.every((e=>r(e,"core/block",!0).length>0));return{clientIds:a,hasPatternOverrides:s,hasParentPattern:o}}),[]);return t&&n?(0,S.jsx)(c.BlockControls,{group:"parent",children:(0,S.jsx)(X,{clientIds:e})}):null},useAddPatternCategory:R,PATTERN_TYPES:l,PATTERN_DEFAULT_CATEGORY:d,PATTERN_USER_CATEGORY:"my-patterns",EXCLUDED_PATTERN_SOURCES:["core","pattern-directory/core","pattern-directory/featured"],PATTERN_SYNC_TYPES:u,PARTIAL_SYNCING_SUPPORTED_BLOCKS:p}),(window.wp=window.wp||{}).patterns=t})(); list-reusable-blocks.min.js 0000644 00000011177 15151622574 0011731 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.ReactJSXRuntime,n=window.wp.element,o=window.wp.i18n;var r=function(){return r=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},r.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function s(e){return e.toLowerCase()}var a=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],i=/[^A-Z0-9]+/gi;function l(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}function c(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,o=void 0===n?a:n,r=t.stripRegexp,c=void 0===r?i:r,p=t.transform,d=void 0===p?s:p,u=t.delimiter,w=void 0===u?" ":u,f=l(l(e,o,"$1\0$2"),c,"\0"),m=0,b=f.length;"\0"===f.charAt(m);)m++;for(;"\0"===f.charAt(b-1);)b--;return f.slice(m,b).split("\0").map(d).join(w)}(e,r({delimiter:"."},t))}const p=window.wp.apiFetch;var d=e.n(p);const u=window.wp.blob;var w=async function(e){const t=await d()({path:"/wp/v2/types/wp_block"}),n=await d()({path:`/wp/v2/${t.rest_base}/${e}?context=edit`}),o=n.title.raw,s=n.content.raw,a=n.wp_pattern_sync_status,i=JSON.stringify({__file:"wp_block",title:o,content:s,syncStatus:a},null,2),l=(void 0===p&&(p={}),c(o,r({delimiter:"-"},p))+".json");var p;(0,u.downloadBlob)(l,i,"application/json")};const f=window.wp.compose,m=window.wp.components;var b=async function(e){const t=await function(e){const t=new window.FileReader;return new Promise((n=>{t.onload=()=>{n(t.result)},t.readAsText(e)}))}(e);let n;try{n=JSON.parse(t)}catch(e){throw new Error("Invalid JSON file")}if("wp_block"!==n.__file||!n.title||!n.content||"string"!=typeof n.title||"string"!=typeof n.content||n.syncStatus&&"string"!=typeof n.syncStatus)throw new Error("Invalid pattern JSON file");const o=await d()({path:"/wp/v2/types/wp_block"});return await d()({path:`/wp/v2/${o.rest_base}`,data:{title:n.title,content:n.content,status:"publish",meta:"unsynced"===n.syncStatus?{wp_pattern_sync_status:n.syncStatus}:void 0},method:"POST"})};var _=(0,f.withInstanceId)((function({instanceId:e,onUpload:r}){const s="list-reusable-blocks-import-form-"+e,a=(0,n.useRef)(),[i,l]=(0,n.useState)(!1),[c,p]=(0,n.useState)(null),[d,u]=(0,n.useState)(null);return(0,t.jsxs)("form",{className:"list-reusable-blocks-import-form",onSubmit:e=>{e.preventDefault(),d&&(l({isLoading:!0}),b(d).then((e=>{a&&(l(!1),r(e))})).catch((e=>{if(!a)return;let t;switch(e.message){case"Invalid JSON file":t=(0,o.__)("Invalid JSON file");break;case"Invalid pattern JSON file":t=(0,o.__)("Invalid pattern JSON file");break;default:t=(0,o.__)("Unknown error")}l(!1),p(t)})))},ref:a,children:[c&&(0,t.jsx)(m.Notice,{status:"error",onRemove:()=>{p(null)},children:c}),(0,t.jsx)("label",{htmlFor:s,className:"list-reusable-blocks-import-form__label",children:(0,o.__)("File")}),(0,t.jsx)("input",{id:s,type:"file",onChange:e=>{u(e.target.files[0]),p(null)}}),(0,t.jsx)(m.Button,{__next40pxDefaultSize:!0,type:"submit",isBusy:i,accessibleWhenDisabled:!0,disabled:!d||i,variant:"secondary",className:"list-reusable-blocks-import-form__button",children:(0,o._x)("Import","button label")})]})}));var v=function({onUpload:e}){return(0,t.jsx)(m.Dropdown,{popoverProps:{placement:"bottom-start"},contentClassName:"list-reusable-blocks-import-dropdown__content",renderToggle:({isOpen:e,onToggle:n})=>(0,t.jsx)(m.Button,{size:"compact",className:"list-reusable-blocks-import-dropdown__button","aria-expanded":e,onClick:n,variant:"primary",children:(0,o.__)("Import from JSON")}),renderContent:({onClose:n})=>(0,t.jsx)(_,{onUpload:(0,f.pipe)(n,e)})})};document.body.addEventListener("click",(e=>{e.target.classList.contains("wp-list-reusable-blocks__export")&&(e.preventDefault(),w(e.target.dataset.id))})),document.addEventListener("DOMContentLoaded",(()=>{const e=document.querySelector(".page-title-action");if(!e)return;const r=document.createElement("div");r.className="list-reusable-blocks__container",e.parentNode.insertBefore(r,e),(0,n.createRoot)(r).render((0,t.jsx)(n.StrictMode,{children:(0,t.jsx)(v,{onUpload:()=>{const e=document.createElement("div");e.className="notice notice-success is-dismissible",e.innerHTML=`<p>${(0,o.__)("Pattern imported successfully!")}</p>`;const t=document.querySelector(".wp-header-end");t&&t.parentNode.insertBefore(e,t)}})}))})),(window.wp=window.wp||{}).listReusableBlocks={}})(); blob.js 0000644 00000006131 15151622574 0006031 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ createBlobURL: () => (/* binding */ createBlobURL), /* harmony export */ downloadBlob: () => (/* binding */ downloadBlob), /* harmony export */ getBlobByURL: () => (/* binding */ getBlobByURL), /* harmony export */ getBlobTypeByURL: () => (/* binding */ getBlobTypeByURL), /* harmony export */ isBlobURL: () => (/* binding */ isBlobURL), /* harmony export */ revokeBlobURL: () => (/* binding */ revokeBlobURL) /* harmony export */ }); const cache = {}; function createBlobURL(file) { const url = window.URL.createObjectURL(file); cache[url] = file; return url; } function getBlobByURL(url) { return cache[url]; } function getBlobTypeByURL(url) { return getBlobByURL(url)?.type.split("/")[0]; } function revokeBlobURL(url) { if (cache[url]) { window.URL.revokeObjectURL(url); } delete cache[url]; } function isBlobURL(url) { if (!url || !url.indexOf) { return false; } return url.indexOf("blob:") === 0; } function downloadBlob(filename, content, contentType = "") { if (!filename || !content) { return; } const file = new window.Blob([content], { type: contentType }); const url = window.URL.createObjectURL(file); const anchorElement = document.createElement("a"); anchorElement.href = url; anchorElement.download = filename; anchorElement.style.display = "none"; document.body.appendChild(anchorElement); anchorElement.click(); document.body.removeChild(anchorElement); window.URL.revokeObjectURL(url); } (window.wp = window.wp || {}).blob = __webpack_exports__; /******/ })() ; data-controls.min.js 0000604 00000002700 15151622574 0010441 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{__unstableAwaitPromise:()=>p,apiFetch:()=>i,controls:()=>u,dispatch:()=>d,select:()=>a,syncSelect:()=>l});const o=window.wp.apiFetch;var r=e.n(o);const n=window.wp.data,s=window.wp.deprecated;var c=e.n(s);function i(e){return{type:"API_FETCH",request:e}}function a(e,t,...o){return c()("`select` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `resolveSelect` control in `@wordpress/data`"}),n.controls.resolveSelect(e,t,...o)}function l(e,t,...o){return c()("`syncSelect` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `select` control in `@wordpress/data`"}),n.controls.select(e,t,...o)}function d(e,t,...o){return c()("`dispatch` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `dispatch` control in `@wordpress/data`"}),n.controls.dispatch(e,t,...o)}const p=function(e){return{type:"AWAIT_PROMISE",promise:e}},u={AWAIT_PROMISE:({promise:e})=>e,API_FETCH:({request:e})=>r()(e)};(window.wp=window.wp||{}).dataControls=t})(); deprecated.min.js 0000604 00000001254 15151622574 0007772 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={d:(n,o)=>{for(var t in o)e.o(o,t)&&!e.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:o[t]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n)},n={};e.d(n,{default:()=>i});const o=window.wp.hooks,t=Object.create(null);function i(e,n={}){const{since:i,version:r,alternative:d,plugin:a,link:c,hint:s}=n,l=`${e} is deprecated${i?` since version ${i}`:""}${r?` and will be removed${a?` from ${a}`:""} in version ${r}`:""}.${d?` Please use ${d} instead.`:""}${c?` See: ${c}`:""}${s?` Note: ${s}`:""}`;l in t||((0,o.doAction)("deprecated",e,n,l),console.warn(l),t[l]=!0)}(window.wp=window.wp||{}).deprecated=n.default})(); i18n.js 0000644 00000060543 15151622574 0005701 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { __: () => (/* reexport */ __), _n: () => (/* reexport */ _n), _nx: () => (/* reexport */ _nx), _x: () => (/* reexport */ _x), createI18n: () => (/* reexport */ createI18n), defaultI18n: () => (/* reexport */ default_i18n_default), getLocaleData: () => (/* reexport */ getLocaleData), hasTranslation: () => (/* reexport */ hasTranslation), isRTL: () => (/* reexport */ isRTL), resetLocaleData: () => (/* reexport */ resetLocaleData), setLocaleData: () => (/* reexport */ setLocaleData), sprintf: () => (/* reexport */ sprintf_sprintf), subscribe: () => (/* reexport */ subscribe) }); ;// ./node_modules/@tannin/sprintf/src/index.js /** * Regular expression matching format placeholder syntax. * * The pattern for matching named arguments is a naive and incomplete matcher * against valid JavaScript identifier names. * * via Mathias Bynens: * * >An identifier must start with $, _, or any character in the Unicode * >categories “Uppercase letter (Lu)”, “Lowercase letter (Ll)”, “Titlecase * >letter (Lt)”, “Modifier letter (Lm)”, “Other letter (Lo)”, or “Letter * >number (Nl)”. * > * >The rest of the string can contain the same characters, plus any U+200C zero * >width non-joiner characters, U+200D zero width joiner characters, and * >characters in the Unicode categories “Non-spacing mark (Mn)”, “Spacing * >combining mark (Mc)”, “Decimal digit number (Nd)”, or “Connector * >punctuation (Pc)”. * * If browser support is constrained to those supporting ES2015, this could be * made more accurate using the `u` flag: * * ``` * /^[$_\p{L}\p{Nl}][$_\p{L}\p{Nl}\u200C\u200D\p{Mn}\p{Mc}\p{Nd}\p{Pc}]*$/u; * ``` * * @see http://www.pixelbeat.org/programming/gcc/format_specs.html * @see https://mathiasbynens.be/notes/javascript-identifiers#valid-identifier-names * * @type {RegExp} */ var PATTERN = /%(((\d+)\$)|(\(([$_a-zA-Z][$_a-zA-Z0-9]*)\)))?[ +0#-]*\d*(\.(\d+|\*))?(ll|[lhqL])?([cduxXefgsp%])/g; // ▲ ▲ ▲ ▲ ▲ ▲ ▲ type // │ │ │ │ │ └ Length (unsupported) // │ │ │ │ └ Precision / max width // │ │ │ └ Min width (unsupported) // │ │ └ Flags (unsupported) // └ Index └ Name (for named arguments) /** * Given a format string, returns string with arguments interpolatation. * Arguments can either be provided directly via function arguments spread, or * with an array as the second argument. * * @see https://en.wikipedia.org/wiki/Printf_format_string * * @example * * ```js * import sprintf from '@tannin/sprintf'; * * sprintf( 'Hello %s!', 'world' ); * // ⇒ 'Hello world!' * ``` * @template {string} T * @overload * @param {T} string - string printf format string * @param {...import('../types').SprintfArgs<T>} args - arguments to interpolate * * @return {string} Formatted string. */ /** * Given a format string, returns string with arguments interpolatation. * Arguments can either be provided directly via function arguments spread, or * with an array as the second argument. * * @see https://en.wikipedia.org/wiki/Printf_format_string * * @example * * ```js * import sprintf from '@tannin/sprintf'; * * sprintf( 'Hello %s!', 'world' ); * // ⇒ 'Hello world!' * ``` * @template {string} T * @overload * @param {T} string - string printf format string * @param {import('../types').SprintfArgs<T>} args - arguments to interpolate * * @return {string} Formatted string. */ /** * Given a format string, returns string with arguments interpolatation. * Arguments can either be provided directly via function arguments spread, or * with an array as the second argument. * * @see https://en.wikipedia.org/wiki/Printf_format_string * * @example * * ```js * import sprintf from '@tannin/sprintf'; * * sprintf( 'Hello %s!', 'world' ); * // ⇒ 'Hello world!' * ``` * @template {string} T * @param {T} string - string printf format string * @param {...import('../types').SprintfArgs<T>} args - arguments to interpolate * * @return {string} Formatted string. */ function sprintf(string, ...args) { var i = 0; if (Array.isArray(args[0])) { args = /** @type {import('../types').SprintfArgs<T>[]} */ ( /** @type {unknown} */ args[0] ); } return string.replace(PATTERN, function () { var index, // name needs to be documented as `string | undefined` else value will have tpye unknown. /** * Name of the argument to substitute, if any. * * @type {string | undefined} */ name, precision, type, value; index = arguments[3]; name = arguments[5]; precision = arguments[7]; type = arguments[9]; // There's no placeholder substitution in the explicit "%", meaning it // is not necessary to increment argument index. if (type === '%') { return '%'; } // Asterisk precision determined by peeking / shifting next argument. if (precision === '*') { precision = args[i]; i++; } if (name === undefined) { // If not a positional argument, use counter value. if (index === undefined) { index = i + 1; } i++; // Positional argument. value = args[index - 1]; } else if ( args[0] && typeof args[0] === 'object' && args[0].hasOwnProperty(name) ) { // If it's a named argument, use name. value = args[0][name]; } // Parse as type. if (type === 'f') { value = parseFloat(value) || 0; } else if (type === 'd') { value = parseInt(value) || 0; } // Apply precision. if (precision !== undefined) { if (type === 'f') { value = value.toFixed(precision); } else if (type === 's') { value = value.substr(0, precision); } } // To avoid "undefined" concatenation, return empty string if no // placeholder substitution can be performed. return value !== undefined && value !== null ? value : ''; }); } ;// ./node_modules/@wordpress/i18n/build-module/sprintf.js function sprintf_sprintf(format, ...args) { return sprintf(format, ...args); } ;// ./node_modules/@tannin/postfix/index.js var PRECEDENCE, OPENERS, TERMINATORS, postfix_PATTERN; /** * Operator precedence mapping. * * @type {Object} */ PRECEDENCE = { '(': 9, '!': 8, '*': 7, '/': 7, '%': 7, '+': 6, '-': 6, '<': 5, '<=': 5, '>': 5, '>=': 5, '==': 4, '!=': 4, '&&': 3, '||': 2, '?': 1, '?:': 1, }; /** * Characters which signal pair opening, to be terminated by terminators. * * @type {string[]} */ OPENERS = [ '(', '?' ]; /** * Characters which signal pair termination, the value an array with the * opener as its first member. The second member is an optional operator * replacement to push to the stack. * * @type {string[]} */ TERMINATORS = { ')': [ '(' ], ':': [ '?', '?:' ], }; /** * Pattern matching operators and openers. * * @type {RegExp} */ postfix_PATTERN = /<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/; /** * Given a C expression, returns the equivalent postfix (Reverse Polish) * notation terms as an array. * * If a postfix string is desired, simply `.join( ' ' )` the result. * * @example * * ```js * import postfix from '@tannin/postfix'; * * postfix( 'n > 1' ); * // ⇒ [ 'n', '1', '>' ] * ``` * * @param {string} expression C expression. * * @return {string[]} Postfix terms. */ function postfix( expression ) { var terms = [], stack = [], match, operator, term, element; while ( ( match = expression.match( postfix_PATTERN ) ) ) { operator = match[ 0 ]; // Term is the string preceding the operator match. It may contain // whitespace, and may be empty (if operator is at beginning). term = expression.substr( 0, match.index ).trim(); if ( term ) { terms.push( term ); } while ( ( element = stack.pop() ) ) { if ( TERMINATORS[ operator ] ) { if ( TERMINATORS[ operator ][ 0 ] === element ) { // Substitution works here under assumption that because // the assigned operator will no longer be a terminator, it // will be pushed to the stack during the condition below. operator = TERMINATORS[ operator ][ 1 ] || operator; break; } } else if ( OPENERS.indexOf( element ) >= 0 || PRECEDENCE[ element ] < PRECEDENCE[ operator ] ) { // Push to stack if either an opener or when pop reveals an // element of lower precedence. stack.push( element ); break; } // For each popped from stack, push to terms. terms.push( element ); } if ( ! TERMINATORS[ operator ] ) { stack.push( operator ); } // Slice matched fragment from expression to continue match. expression = expression.substr( match.index + operator.length ); } // Push remainder of operand, if exists, to terms. expression = expression.trim(); if ( expression ) { terms.push( expression ); } // Pop remaining items from stack into terms. return terms.concat( stack.reverse() ); } ;// ./node_modules/@tannin/evaluate/index.js /** * Operator callback functions. * * @type {Object} */ var OPERATORS = { '!': function( a ) { return ! a; }, '*': function( a, b ) { return a * b; }, '/': function( a, b ) { return a / b; }, '%': function( a, b ) { return a % b; }, '+': function( a, b ) { return a + b; }, '-': function( a, b ) { return a - b; }, '<': function( a, b ) { return a < b; }, '<=': function( a, b ) { return a <= b; }, '>': function( a, b ) { return a > b; }, '>=': function( a, b ) { return a >= b; }, '==': function( a, b ) { return a === b; }, '!=': function( a, b ) { return a !== b; }, '&&': function( a, b ) { return a && b; }, '||': function( a, b ) { return a || b; }, '?:': function( a, b, c ) { if ( a ) { throw b; } return c; }, }; /** * Given an array of postfix terms and operand variables, returns the result of * the postfix evaluation. * * @example * * ```js * import evaluate from '@tannin/evaluate'; * * // 3 + 4 * 5 / 6 ⇒ '3 4 5 * 6 / +' * const terms = [ '3', '4', '5', '*', '6', '/', '+' ]; * * evaluate( terms, {} ); * // ⇒ 6.333333333333334 * ``` * * @param {string[]} postfix Postfix terms. * @param {Object} variables Operand variables. * * @return {*} Result of evaluation. */ function evaluate( postfix, variables ) { var stack = [], i, j, args, getOperatorResult, term, value; for ( i = 0; i < postfix.length; i++ ) { term = postfix[ i ]; getOperatorResult = OPERATORS[ term ]; if ( getOperatorResult ) { // Pop from stack by number of function arguments. j = getOperatorResult.length; args = Array( j ); while ( j-- ) { args[ j ] = stack.pop(); } try { value = getOperatorResult.apply( null, args ); } catch ( earlyReturn ) { return earlyReturn; } } else if ( variables.hasOwnProperty( term ) ) { value = variables[ term ]; } else { value = +term; } stack.push( value ); } return stack[ 0 ]; } ;// ./node_modules/@tannin/compile/index.js /** * Given a C expression, returns a function which can be called to evaluate its * result. * * @example * * ```js * import compile from '@tannin/compile'; * * const evaluate = compile( 'n > 1' ); * * evaluate( { n: 2 } ); * // ⇒ true * ``` * * @param {string} expression C expression. * * @return {(variables?:{[variable:string]:*})=>*} Compiled evaluator. */ function compile( expression ) { var terms = postfix( expression ); return function( variables ) { return evaluate( terms, variables ); }; } ;// ./node_modules/@tannin/plural-forms/index.js /** * Given a C expression, returns a function which, when called with a value, * evaluates the result with the value assumed to be the "n" variable of the * expression. The result will be coerced to its numeric equivalent. * * @param {string} expression C expression. * * @return {Function} Evaluator function. */ function pluralForms( expression ) { var evaluate = compile( expression ); return function( n ) { return +evaluate( { n: n } ); }; } ;// ./node_modules/tannin/index.js /** * Tannin constructor options. * * @typedef {Object} TanninOptions * * @property {string} [contextDelimiter] Joiner in string lookup with context. * @property {Function} [onMissingKey] Callback to invoke when key missing. */ /** * Domain metadata. * * @typedef {Object} TanninDomainMetadata * * @property {string} [domain] Domain name. * @property {string} [lang] Language code. * @property {(string|Function)} [plural_forms] Plural forms expression or * function evaluator. */ /** * Domain translation pair respectively representing the singular and plural * translation. * * @typedef {[string,string]} TanninTranslation */ /** * Locale data domain. The key is used as reference for lookup, the value an * array of two string entries respectively representing the singular and plural * translation. * * @typedef {{[key:string]:TanninDomainMetadata|TanninTranslation,'':TanninDomainMetadata|TanninTranslation}} TanninLocaleDomain */ /** * Jed-formatted locale data. * * @see http://messageformat.github.io/Jed/ * * @typedef {{[domain:string]:TanninLocaleDomain}} TanninLocaleData */ /** * Default Tannin constructor options. * * @type {TanninOptions} */ var DEFAULT_OPTIONS = { contextDelimiter: '\u0004', onMissingKey: null, }; /** * Given a specific locale data's config `plural_forms` value, returns the * expression. * * @example * * ``` * getPluralExpression( 'nplurals=2; plural=(n != 1);' ) === '(n != 1)' * ``` * * @param {string} pf Locale data plural forms. * * @return {string} Plural forms expression. */ function getPluralExpression( pf ) { var parts, i, part; parts = pf.split( ';' ); for ( i = 0; i < parts.length; i++ ) { part = parts[ i ].trim(); if ( part.indexOf( 'plural=' ) === 0 ) { return part.substr( 7 ); } } } /** * Tannin constructor. * * @class * * @param {TanninLocaleData} data Jed-formatted locale data. * @param {TanninOptions} [options] Tannin options. */ function Tannin( data, options ) { var key; /** * Jed-formatted locale data. * * @name Tannin#data * @type {TanninLocaleData} */ this.data = data; /** * Plural forms function cache, keyed by plural forms string. * * @name Tannin#pluralForms * @type {Object<string,Function>} */ this.pluralForms = {}; /** * Effective options for instance, including defaults. * * @name Tannin#options * @type {TanninOptions} */ this.options = {}; for ( key in DEFAULT_OPTIONS ) { this.options[ key ] = options !== undefined && key in options ? options[ key ] : DEFAULT_OPTIONS[ key ]; } } /** * Returns the plural form index for the given domain and value. * * @param {string} domain Domain on which to calculate plural form. * @param {number} n Value for which plural form is to be calculated. * * @return {number} Plural form index. */ Tannin.prototype.getPluralForm = function( domain, n ) { var getPluralForm = this.pluralForms[ domain ], config, plural, pf; if ( ! getPluralForm ) { config = this.data[ domain ][ '' ]; pf = ( config[ 'Plural-Forms' ] || config[ 'plural-forms' ] || // Ignore reason: As known, there's no way to document the empty // string property on a key to guarantee this as metadata. // @ts-ignore config.plural_forms ); if ( typeof pf !== 'function' ) { plural = getPluralExpression( config[ 'Plural-Forms' ] || config[ 'plural-forms' ] || // Ignore reason: As known, there's no way to document the empty // string property on a key to guarantee this as metadata. // @ts-ignore config.plural_forms ); pf = pluralForms( plural ); } getPluralForm = this.pluralForms[ domain ] = pf; } return getPluralForm( n ); }; /** * Translate a string. * * @param {string} domain Translation domain. * @param {string|void} context Context distinguishing terms of the same name. * @param {string} singular Primary key for translation lookup. * @param {string=} plural Fallback value used for non-zero plural * form index. * @param {number=} n Value to use in calculating plural form. * * @return {string} Translated string. */ Tannin.prototype.dcnpgettext = function( domain, context, singular, plural, n ) { var index, key, entry; if ( n === undefined ) { // Default to singular. index = 0; } else { // Find index by evaluating plural form for value. index = this.getPluralForm( domain, n ); } key = singular; // If provided, context is prepended to key with delimiter. if ( context ) { key = context + this.options.contextDelimiter + singular; } entry = this.data[ domain ][ key ]; // Verify not only that entry exists, but that the intended index is within // range and non-empty. if ( entry && entry[ index ] ) { return entry[ index ]; } if ( this.options.onMissingKey ) { this.options.onMissingKey( singular, domain ); } // If entry not found, fall back to singular vs. plural with zero index // representing the singular value. return index === 0 ? singular : plural; }; ;// ./node_modules/@wordpress/i18n/build-module/create-i18n.js const DEFAULT_LOCALE_DATA = { "": { plural_forms(n) { return n === 1 ? 0 : 1; } } }; const I18N_HOOK_REGEXP = /^i18n\.(n?gettext|has_translation)(_|$)/; const createI18n = (initialData, initialDomain, hooks) => { const tannin = new Tannin({}); const listeners = /* @__PURE__ */ new Set(); const notifyListeners = () => { listeners.forEach((listener) => listener()); }; const subscribe = (callback) => { listeners.add(callback); return () => listeners.delete(callback); }; const getLocaleData = (domain = "default") => tannin.data[domain]; const doSetLocaleData = (data, domain = "default") => { tannin.data[domain] = { ...tannin.data[domain], ...data }; tannin.data[domain][""] = { ...DEFAULT_LOCALE_DATA[""], ...tannin.data[domain]?.[""] }; delete tannin.pluralForms[domain]; }; const setLocaleData = (data, domain) => { doSetLocaleData(data, domain); notifyListeners(); }; const addLocaleData = (data, domain = "default") => { tannin.data[domain] = { ...tannin.data[domain], ...data, // Populate default domain configuration (supported locale date which omits // a plural forms expression). "": { ...DEFAULT_LOCALE_DATA[""], ...tannin.data[domain]?.[""], ...data?.[""] } }; delete tannin.pluralForms[domain]; notifyListeners(); }; const resetLocaleData = (data, domain) => { tannin.data = {}; tannin.pluralForms = {}; setLocaleData(data, domain); }; const dcnpgettext = (domain = "default", context, single, plural, number) => { if (!tannin.data[domain]) { doSetLocaleData(void 0, domain); } return tannin.dcnpgettext(domain, context, single, plural, number); }; const getFilterDomain = (domain) => domain || "default"; const __ = (text, domain) => { let translation = dcnpgettext(domain, void 0, text); if (!hooks) { return translation; } translation = hooks.applyFilters( "i18n.gettext", translation, text, domain ); return hooks.applyFilters( "i18n.gettext_" + getFilterDomain(domain), translation, text, domain ); }; const _x = (text, context, domain) => { let translation = dcnpgettext(domain, context, text); if (!hooks) { return translation; } translation = hooks.applyFilters( "i18n.gettext_with_context", translation, text, context, domain ); return hooks.applyFilters( "i18n.gettext_with_context_" + getFilterDomain(domain), translation, text, context, domain ); }; const _n = (single, plural, number, domain) => { let translation = dcnpgettext( domain, void 0, single, plural, number ); if (!hooks) { return translation; } translation = hooks.applyFilters( "i18n.ngettext", translation, single, plural, number, domain ); return hooks.applyFilters( "i18n.ngettext_" + getFilterDomain(domain), translation, single, plural, number, domain ); }; const _nx = (single, plural, number, context, domain) => { let translation = dcnpgettext( domain, context, single, plural, number ); if (!hooks) { return translation; } translation = hooks.applyFilters( "i18n.ngettext_with_context", translation, single, plural, number, context, domain ); return hooks.applyFilters( "i18n.ngettext_with_context_" + getFilterDomain(domain), translation, single, plural, number, context, domain ); }; const isRTL = () => { return "rtl" === _x("ltr", "text direction"); }; const hasTranslation = (single, context, domain) => { const key = context ? context + "" + single : single; let result = !!tannin.data?.[domain ?? "default"]?.[key]; if (hooks) { result = hooks.applyFilters( "i18n.has_translation", result, single, context, domain ); result = hooks.applyFilters( "i18n.has_translation_" + getFilterDomain(domain), result, single, context, domain ); } return result; }; if (initialData) { setLocaleData(initialData, initialDomain); } if (hooks) { const onHookAddedOrRemoved = (hookName) => { if (I18N_HOOK_REGEXP.test(hookName)) { notifyListeners(); } }; hooks.addAction("hookAdded", "core/i18n", onHookAddedOrRemoved); hooks.addAction("hookRemoved", "core/i18n", onHookAddedOrRemoved); } return { getLocaleData, setLocaleData, addLocaleData, resetLocaleData, subscribe, __, _x, _n, _nx, isRTL, hasTranslation }; }; ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// ./node_modules/@wordpress/i18n/build-module/default-i18n.js const i18n = createI18n(void 0, void 0, external_wp_hooks_namespaceObject.defaultHooks); var default_i18n_default = i18n; const getLocaleData = i18n.getLocaleData.bind(i18n); const setLocaleData = i18n.setLocaleData.bind(i18n); const resetLocaleData = i18n.resetLocaleData.bind(i18n); const subscribe = i18n.subscribe.bind(i18n); const __ = i18n.__.bind(i18n); const _x = i18n._x.bind(i18n); const _n = i18n._n.bind(i18n); const _nx = i18n._nx.bind(i18n); const isRTL = i18n.isRTL.bind(i18n); const hasTranslation = i18n.hasTranslation.bind(i18n); ;// ./node_modules/@wordpress/i18n/build-module/index.js (window.wp = window.wp || {}).i18n = __webpack_exports__; /******/ })() ; editor.js 0000644 00004276424 15151622574 0006423 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 66: /***/ ((module) => { "use strict"; var isMergeableObject = function isMergeableObject(value) { return isNonNullObject(value) && !isSpecial(value) }; function isNonNullObject(value) { return !!value && typeof value === 'object' } function isSpecial(value) { var stringValue = Object.prototype.toString.call(value); return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value) } // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 var canUseSymbol = typeof Symbol === 'function' && Symbol.for; var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; function isReactElement(value) { return value.$$typeof === REACT_ELEMENT_TYPE } function emptyTarget(val) { return Array.isArray(val) ? [] : {} } function cloneUnlessOtherwiseSpecified(value, options) { return (options.clone !== false && options.isMergeableObject(value)) ? deepmerge(emptyTarget(value), value, options) : value } function defaultArrayMerge(target, source, options) { return target.concat(source).map(function(element) { return cloneUnlessOtherwiseSpecified(element, options) }) } function getMergeFunction(key, options) { if (!options.customMerge) { return deepmerge } var customMerge = options.customMerge(key); return typeof customMerge === 'function' ? customMerge : deepmerge } function getEnumerableOwnPropertySymbols(target) { return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) { return Object.propertyIsEnumerable.call(target, symbol) }) : [] } function getKeys(target) { return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) } function propertyIsOnObject(object, property) { try { return property in object } catch(_) { return false } } // Protects from prototype poisoning and unexpected merging up the prototype chain. function propertyIsUnsafe(target, key) { return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. } function mergeObject(target, source, options) { var destination = {}; if (options.isMergeableObject(target)) { getKeys(target).forEach(function(key) { destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); }); } getKeys(source).forEach(function(key) { if (propertyIsUnsafe(target, key)) { return } if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { destination[key] = getMergeFunction(key, options)(target[key], source[key], options); } else { destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); } }); return destination } function deepmerge(target, source, options) { options = options || {}; options.arrayMerge = options.arrayMerge || defaultArrayMerge; options.isMergeableObject = options.isMergeableObject || isMergeableObject; // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() // implementations can use it. The caller may not replace it. options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; var sourceIsArray = Array.isArray(source); var targetIsArray = Array.isArray(target); var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; if (!sourceAndTargetTypesMatch) { return cloneUnlessOtherwiseSpecified(source, options) } else if (sourceIsArray) { return options.arrayMerge(target, source, options) } else { return mergeObject(target, source, options) } } deepmerge.all = function deepmergeAll(array, options) { if (!Array.isArray(array)) { throw new Error('first argument should be an array') } return array.reduce(function(prev, next) { return deepmerge(prev, next, options) }, {}) }; var deepmerge_1 = deepmerge; module.exports = deepmerge_1; /***/ }), /***/ 461: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { // Load in dependencies var computedStyle = __webpack_require__(6109); /** * Calculate the `line-height` of a given node * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. * @returns {Number} `line-height` of the element in pixels */ function lineHeight(node) { // Grab the line-height via style var lnHeightStr = computedStyle(node, 'line-height'); var lnHeight = parseFloat(lnHeightStr, 10); // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') if (lnHeightStr === lnHeight + '') { // Save the old lineHeight style and update the em unit to the element var _lnHeightStyle = node.style.lineHeight; node.style.lineHeight = lnHeightStr + 'em'; // Calculate the em based height lnHeightStr = computedStyle(node, 'line-height'); lnHeight = parseFloat(lnHeightStr, 10); // Revert the lineHeight style if (_lnHeightStyle) { node.style.lineHeight = _lnHeightStyle; } else { delete node.style.lineHeight; } } // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) // DEV: `em` units are converted to `pt` in IE6 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length if (lnHeightStr.indexOf('pt') !== -1) { lnHeight *= 4; lnHeight /= 3; // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) } else if (lnHeightStr.indexOf('mm') !== -1) { lnHeight *= 96; lnHeight /= 25.4; // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) } else if (lnHeightStr.indexOf('cm') !== -1) { lnHeight *= 96; lnHeight /= 2.54; // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) } else if (lnHeightStr.indexOf('in') !== -1) { lnHeight *= 96; // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) } else if (lnHeightStr.indexOf('pc') !== -1) { lnHeight *= 16; } // Continue our computation lnHeight = Math.round(lnHeight); // If the line-height is "normal", calculate by font-size if (lnHeightStr === 'normal') { // Create a temporary node var nodeName = node.nodeName; var _node = document.createElement(nodeName); _node.innerHTML = ' '; // If we have a text area, reset it to only 1 row // https://github.com/twolfson/line-height/issues/4 if (nodeName.toUpperCase() === 'TEXTAREA') { _node.setAttribute('rows', '1'); } // Set the font-size of the element var fontSizeStr = computedStyle(node, 'font-size'); _node.style.fontSize = fontSizeStr; // Remove default padding/border which can affect offset height // https://github.com/twolfson/line-height/issues/4 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight _node.style.padding = '0px'; _node.style.border = '0px'; // Append it to the body var body = document.body; body.appendChild(_node); // Assume the line height of the element is the height var height = _node.offsetHeight; lnHeight = height; // Remove our child from the DOM body.removeChild(_node); } // Return the calculated height return lnHeight; } // Export lineHeight module.exports = lineHeight; /***/ }), /***/ 628: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var ReactPropTypesSecret = __webpack_require__(4067); function emptyFunction() {} function emptyFunctionWithReset() {} emptyFunctionWithReset.resetWarningCache = emptyFunction; module.exports = function() { function shim(props, propName, componentName, location, propFullName, secret) { if (secret === ReactPropTypesSecret) { // It is still safe when called from React. return; } var err = new Error( 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); err.name = 'Invariant Violation'; throw err; }; shim.isRequired = shim; function getShim() { return shim; }; // Important! // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. var ReactPropTypes = { array: shim, bigint: shim, bool: shim, func: shim, number: shim, object: shim, string: shim, symbol: shim, any: shim, arrayOf: getShim, element: shim, elementType: shim, instanceOf: getShim, node: shim, objectOf: getShim, oneOf: getShim, oneOfType: getShim, shape: getShim, exact: getShim, checkPropTypes: emptyFunctionWithReset, resetWarningCache: emptyFunction }; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; /***/ }), /***/ 1609: /***/ ((module) => { "use strict"; module.exports = window["React"]; /***/ }), /***/ 4067: /***/ ((module) => { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; /***/ }), /***/ 4132: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; var __webpack_unused_export__; __webpack_unused_export__ = true; var TextareaAutosize_1 = __webpack_require__(4462); exports.A = TextareaAutosize_1.TextareaAutosize; /***/ }), /***/ 4306: /***/ (function(module, exports) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! autosize 4.0.4 license: MIT http://www.jacklmoore.com/autosize */ (function (global, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { var mod; } })(this, function (module, exports) { 'use strict'; var map = typeof Map === "function" ? new Map() : function () { var keys = []; var values = []; return { has: function has(key) { return keys.indexOf(key) > -1; }, get: function get(key) { return values[keys.indexOf(key)]; }, set: function set(key, value) { if (keys.indexOf(key) === -1) { keys.push(key); values.push(value); } }, delete: function _delete(key) { var index = keys.indexOf(key); if (index > -1) { keys.splice(index, 1); values.splice(index, 1); } } }; }(); var createEvent = function createEvent(name) { return new Event(name, { bubbles: true }); }; try { new Event('test'); } catch (e) { // IE does not support `new Event()` createEvent = function createEvent(name) { var evt = document.createEvent('Event'); evt.initEvent(name, true, false); return evt; }; } function assign(ta) { if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; var heightOffset = null; var clientWidth = null; var cachedHeight = null; function init() { var style = window.getComputedStyle(ta, null); if (style.resize === 'vertical') { ta.style.resize = 'none'; } else if (style.resize === 'both') { ta.style.resize = 'horizontal'; } if (style.boxSizing === 'content-box') { heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); } else { heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); } // Fix when a textarea is not on document body and heightOffset is Not a Number if (isNaN(heightOffset)) { heightOffset = 0; } update(); } function changeOverflow(value) { { // Chrome/Safari-specific fix: // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space // made available by removing the scrollbar. The following forces the necessary text reflow. var width = ta.style.width; ta.style.width = '0px'; // Force reflow: /* jshint ignore:start */ ta.offsetWidth; /* jshint ignore:end */ ta.style.width = width; } ta.style.overflowY = value; } function getParentOverflows(el) { var arr = []; while (el && el.parentNode && el.parentNode instanceof Element) { if (el.parentNode.scrollTop) { arr.push({ node: el.parentNode, scrollTop: el.parentNode.scrollTop }); } el = el.parentNode; } return arr; } function resize() { if (ta.scrollHeight === 0) { // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. return; } var overflows = getParentOverflows(ta); var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) ta.style.height = ''; ta.style.height = ta.scrollHeight + heightOffset + 'px'; // used to check if an update is actually necessary on window.resize clientWidth = ta.clientWidth; // prevents scroll-position jumping overflows.forEach(function (el) { el.node.scrollTop = el.scrollTop; }); if (docTop) { document.documentElement.scrollTop = docTop; } } function update() { resize(); var styleHeight = Math.round(parseFloat(ta.style.height)); var computed = window.getComputedStyle(ta, null); // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; // The actual height not matching the style height (set via the resize method) indicates that // the max-height has been exceeded, in which case the overflow should be allowed. if (actualHeight < styleHeight) { if (computed.overflowY === 'hidden') { changeOverflow('scroll'); resize(); actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; } } else { // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. if (computed.overflowY !== 'hidden') { changeOverflow('hidden'); resize(); actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; } } if (cachedHeight !== actualHeight) { cachedHeight = actualHeight; var evt = createEvent('autosize:resized'); try { ta.dispatchEvent(evt); } catch (err) { // Firefox will throw an error on dispatchEvent for a detached element // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 } } } var pageResize = function pageResize() { if (ta.clientWidth !== clientWidth) { update(); } }; var destroy = function (style) { window.removeEventListener('resize', pageResize, false); ta.removeEventListener('input', update, false); ta.removeEventListener('keyup', update, false); ta.removeEventListener('autosize:destroy', destroy, false); ta.removeEventListener('autosize:update', update, false); Object.keys(style).forEach(function (key) { ta.style[key] = style[key]; }); map.delete(ta); }.bind(ta, { height: ta.style.height, resize: ta.style.resize, overflowY: ta.style.overflowY, overflowX: ta.style.overflowX, wordWrap: ta.style.wordWrap }); ta.addEventListener('autosize:destroy', destroy, false); // IE9 does not fire onpropertychange or oninput for deletions, // so binding to onkeyup to catch most of those events. // There is no way that I know of to detect something like 'cut' in IE9. if ('onpropertychange' in ta && 'oninput' in ta) { ta.addEventListener('keyup', update, false); } window.addEventListener('resize', pageResize, false); ta.addEventListener('input', update, false); ta.addEventListener('autosize:update', update, false); ta.style.overflowX = 'hidden'; ta.style.wordWrap = 'break-word'; map.set(ta, { destroy: destroy, update: update }); init(); } function destroy(ta) { var methods = map.get(ta); if (methods) { methods.destroy(); } } function update(ta) { var methods = map.get(ta); if (methods) { methods.update(); } } var autosize = null; // Do nothing in Node.js environment and IE8 (or lower) if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { autosize = function autosize(el) { return el; }; autosize.destroy = function (el) { return el; }; autosize.update = function (el) { return el; }; } else { autosize = function autosize(el, options) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], function (x) { return assign(x, options); }); } return el; }; autosize.destroy = function (el) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], destroy); } return el; }; autosize.update = function (el) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], update); } return el; }; } exports.default = autosize; module.exports = exports['default']; }); /***/ }), /***/ 4462: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; }; exports.__esModule = true; var React = __webpack_require__(1609); var PropTypes = __webpack_require__(5826); var autosize = __webpack_require__(4306); var _getLineHeight = __webpack_require__(461); var getLineHeight = _getLineHeight; var RESIZED = "autosize:resized"; /** * A light replacement for built-in textarea component * which automaticaly adjusts its height to match the content */ var TextareaAutosizeClass = /** @class */ (function (_super) { __extends(TextareaAutosizeClass, _super); function TextareaAutosizeClass() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.state = { lineHeight: null }; _this.textarea = null; _this.onResize = function (e) { if (_this.props.onResize) { _this.props.onResize(e); } }; _this.updateLineHeight = function () { if (_this.textarea) { _this.setState({ lineHeight: getLineHeight(_this.textarea) }); } }; _this.onChange = function (e) { var onChange = _this.props.onChange; _this.currentValue = e.currentTarget.value; onChange && onChange(e); }; return _this; } TextareaAutosizeClass.prototype.componentDidMount = function () { var _this = this; var _a = this.props, maxRows = _a.maxRows, async = _a.async; if (typeof maxRows === "number") { this.updateLineHeight(); } if (typeof maxRows === "number" || async) { /* the defer is needed to: - force "autosize" to activate the scrollbar when this.props.maxRows is passed - support StyledComponents (see #71) */ setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); } else { this.textarea && autosize(this.textarea); } if (this.textarea) { this.textarea.addEventListener(RESIZED, this.onResize); } }; TextareaAutosizeClass.prototype.componentWillUnmount = function () { if (this.textarea) { this.textarea.removeEventListener(RESIZED, this.onResize); autosize.destroy(this.textarea); } }; TextareaAutosizeClass.prototype.render = function () { var _this = this; var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight; var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { _this.textarea = element; if (typeof _this.props.innerRef === 'function') { _this.props.innerRef(element); } else if (_this.props.innerRef) { _this.props.innerRef.current = element; } } }), children)); }; TextareaAutosizeClass.prototype.componentDidUpdate = function () { this.textarea && autosize.update(this.textarea); }; TextareaAutosizeClass.defaultProps = { rows: 1, async: false }; TextareaAutosizeClass.propTypes = { rows: PropTypes.number, maxRows: PropTypes.number, onResize: PropTypes.func, innerRef: PropTypes.any, async: PropTypes.bool }; return TextareaAutosizeClass; }(React.Component)); exports.TextareaAutosize = React.forwardRef(function (props, ref) { return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); }); /***/ }), /***/ 5215: /***/ ((module) => { "use strict"; // do not edit .js files directly - edit src/index.jst module.exports = function equal(a, b) { if (a === b) return true; if (a && b && typeof a == 'object' && typeof b == 'object') { if (a.constructor !== b.constructor) return false; var length, i, keys; if (Array.isArray(a)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false; return true; } if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; for (i = length; i-- !== 0;) { var key = keys[i]; if (!equal(a[key], b[key])) return false; } return true; } // true if both NaN, false otherwise return a!==a && b!==b; }; /***/ }), /***/ 5826: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ if (false) { var throwOnDirectAccess, ReactIs; } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod module.exports = __webpack_require__(628)(); } /***/ }), /***/ 6109: /***/ ((module) => { // This code has been refactored for 140 bytes // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js var computedStyle = function (el, prop, getComputedStyle) { getComputedStyle = window.getComputedStyle; // In one fell swoop return ( // If we have getComputedStyle getComputedStyle ? // Query it // TODO: From CSS-Query notes, we might need (node, null) for FF getComputedStyle(el) : // Otherwise, we are in IE and use currentStyle el.currentStyle )[ // Switch to camelCase for CSSOM // DEV: Grabbed from jQuery // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 prop.replace(/-(\w)/gi, function (word, letter) { return letter.toUpperCase(); }) ]; }; module.exports = computedStyle; /***/ }), /***/ 9681: /***/ ((module) => { var characterMap = { "À": "A", "Á": "A", "Â": "A", "Ã": "A", "Ä": "A", "Å": "A", "Ấ": "A", "Ắ": "A", "Ẳ": "A", "Ẵ": "A", "Ặ": "A", "Æ": "AE", "Ầ": "A", "Ằ": "A", "Ȃ": "A", "Ả": "A", "Ạ": "A", "Ẩ": "A", "Ẫ": "A", "Ậ": "A", "Ç": "C", "Ḉ": "C", "È": "E", "É": "E", "Ê": "E", "Ë": "E", "Ế": "E", "Ḗ": "E", "Ề": "E", "Ḕ": "E", "Ḝ": "E", "Ȇ": "E", "Ẻ": "E", "Ẽ": "E", "Ẹ": "E", "Ể": "E", "Ễ": "E", "Ệ": "E", "Ì": "I", "Í": "I", "Î": "I", "Ï": "I", "Ḯ": "I", "Ȋ": "I", "Ỉ": "I", "Ị": "I", "Ð": "D", "Ñ": "N", "Ò": "O", "Ó": "O", "Ô": "O", "Õ": "O", "Ö": "O", "Ø": "O", "Ố": "O", "Ṍ": "O", "Ṓ": "O", "Ȏ": "O", "Ỏ": "O", "Ọ": "O", "Ổ": "O", "Ỗ": "O", "Ộ": "O", "Ờ": "O", "Ở": "O", "Ỡ": "O", "Ớ": "O", "Ợ": "O", "Ù": "U", "Ú": "U", "Û": "U", "Ü": "U", "Ủ": "U", "Ụ": "U", "Ử": "U", "Ữ": "U", "Ự": "U", "Ý": "Y", "à": "a", "á": "a", "â": "a", "ã": "a", "ä": "a", "å": "a", "ấ": "a", "ắ": "a", "ẳ": "a", "ẵ": "a", "ặ": "a", "æ": "ae", "ầ": "a", "ằ": "a", "ȃ": "a", "ả": "a", "ạ": "a", "ẩ": "a", "ẫ": "a", "ậ": "a", "ç": "c", "ḉ": "c", "è": "e", "é": "e", "ê": "e", "ë": "e", "ế": "e", "ḗ": "e", "ề": "e", "ḕ": "e", "ḝ": "e", "ȇ": "e", "ẻ": "e", "ẽ": "e", "ẹ": "e", "ể": "e", "ễ": "e", "ệ": "e", "ì": "i", "í": "i", "î": "i", "ï": "i", "ḯ": "i", "ȋ": "i", "ỉ": "i", "ị": "i", "ð": "d", "ñ": "n", "ò": "o", "ó": "o", "ô": "o", "õ": "o", "ö": "o", "ø": "o", "ố": "o", "ṍ": "o", "ṓ": "o", "ȏ": "o", "ỏ": "o", "ọ": "o", "ổ": "o", "ỗ": "o", "ộ": "o", "ờ": "o", "ở": "o", "ỡ": "o", "ớ": "o", "ợ": "o", "ù": "u", "ú": "u", "û": "u", "ü": "u", "ủ": "u", "ụ": "u", "ử": "u", "ữ": "u", "ự": "u", "ý": "y", "ÿ": "y", "Ā": "A", "ā": "a", "Ă": "A", "ă": "a", "Ą": "A", "ą": "a", "Ć": "C", "ć": "c", "Ĉ": "C", "ĉ": "c", "Ċ": "C", "ċ": "c", "Č": "C", "č": "c", "C̆": "C", "c̆": "c", "Ď": "D", "ď": "d", "Đ": "D", "đ": "d", "Ē": "E", "ē": "e", "Ĕ": "E", "ĕ": "e", "Ė": "E", "ė": "e", "Ę": "E", "ę": "e", "Ě": "E", "ě": "e", "Ĝ": "G", "Ǵ": "G", "ĝ": "g", "ǵ": "g", "Ğ": "G", "ğ": "g", "Ġ": "G", "ġ": "g", "Ģ": "G", "ģ": "g", "Ĥ": "H", "ĥ": "h", "Ħ": "H", "ħ": "h", "Ḫ": "H", "ḫ": "h", "Ĩ": "I", "ĩ": "i", "Ī": "I", "ī": "i", "Ĭ": "I", "ĭ": "i", "Į": "I", "į": "i", "İ": "I", "ı": "i", "IJ": "IJ", "ij": "ij", "Ĵ": "J", "ĵ": "j", "Ķ": "K", "ķ": "k", "Ḱ": "K", "ḱ": "k", "K̆": "K", "k̆": "k", "Ĺ": "L", "ĺ": "l", "Ļ": "L", "ļ": "l", "Ľ": "L", "ľ": "l", "Ŀ": "L", "ŀ": "l", "Ł": "l", "ł": "l", "Ḿ": "M", "ḿ": "m", "M̆": "M", "m̆": "m", "Ń": "N", "ń": "n", "Ņ": "N", "ņ": "n", "Ň": "N", "ň": "n", "ʼn": "n", "N̆": "N", "n̆": "n", "Ō": "O", "ō": "o", "Ŏ": "O", "ŏ": "o", "Ő": "O", "ő": "o", "Œ": "OE", "œ": "oe", "P̆": "P", "p̆": "p", "Ŕ": "R", "ŕ": "r", "Ŗ": "R", "ŗ": "r", "Ř": "R", "ř": "r", "R̆": "R", "r̆": "r", "Ȓ": "R", "ȓ": "r", "Ś": "S", "ś": "s", "Ŝ": "S", "ŝ": "s", "Ş": "S", "Ș": "S", "ș": "s", "ş": "s", "Š": "S", "š": "s", "Ţ": "T", "ţ": "t", "ț": "t", "Ț": "T", "Ť": "T", "ť": "t", "Ŧ": "T", "ŧ": "t", "T̆": "T", "t̆": "t", "Ũ": "U", "ũ": "u", "Ū": "U", "ū": "u", "Ŭ": "U", "ŭ": "u", "Ů": "U", "ů": "u", "Ű": "U", "ű": "u", "Ų": "U", "ų": "u", "Ȗ": "U", "ȗ": "u", "V̆": "V", "v̆": "v", "Ŵ": "W", "ŵ": "w", "Ẃ": "W", "ẃ": "w", "X̆": "X", "x̆": "x", "Ŷ": "Y", "ŷ": "y", "Ÿ": "Y", "Y̆": "Y", "y̆": "y", "Ź": "Z", "ź": "z", "Ż": "Z", "ż": "z", "Ž": "Z", "ž": "z", "ſ": "s", "ƒ": "f", "Ơ": "O", "ơ": "o", "Ư": "U", "ư": "u", "Ǎ": "A", "ǎ": "a", "Ǐ": "I", "ǐ": "i", "Ǒ": "O", "ǒ": "o", "Ǔ": "U", "ǔ": "u", "Ǖ": "U", "ǖ": "u", "Ǘ": "U", "ǘ": "u", "Ǚ": "U", "ǚ": "u", "Ǜ": "U", "ǜ": "u", "Ứ": "U", "ứ": "u", "Ṹ": "U", "ṹ": "u", "Ǻ": "A", "ǻ": "a", "Ǽ": "AE", "ǽ": "ae", "Ǿ": "O", "ǿ": "o", "Þ": "TH", "þ": "th", "Ṕ": "P", "ṕ": "p", "Ṥ": "S", "ṥ": "s", "X́": "X", "x́": "x", "Ѓ": "Г", "ѓ": "г", "Ќ": "К", "ќ": "к", "A̋": "A", "a̋": "a", "E̋": "E", "e̋": "e", "I̋": "I", "i̋": "i", "Ǹ": "N", "ǹ": "n", "Ồ": "O", "ồ": "o", "Ṑ": "O", "ṑ": "o", "Ừ": "U", "ừ": "u", "Ẁ": "W", "ẁ": "w", "Ỳ": "Y", "ỳ": "y", "Ȁ": "A", "ȁ": "a", "Ȅ": "E", "ȅ": "e", "Ȉ": "I", "ȉ": "i", "Ȍ": "O", "ȍ": "o", "Ȑ": "R", "ȑ": "r", "Ȕ": "U", "ȕ": "u", "B̌": "B", "b̌": "b", "Č̣": "C", "č̣": "c", "Ê̌": "E", "ê̌": "e", "F̌": "F", "f̌": "f", "Ǧ": "G", "ǧ": "g", "Ȟ": "H", "ȟ": "h", "J̌": "J", "ǰ": "j", "Ǩ": "K", "ǩ": "k", "M̌": "M", "m̌": "m", "P̌": "P", "p̌": "p", "Q̌": "Q", "q̌": "q", "Ř̩": "R", "ř̩": "r", "Ṧ": "S", "ṧ": "s", "V̌": "V", "v̌": "v", "W̌": "W", "w̌": "w", "X̌": "X", "x̌": "x", "Y̌": "Y", "y̌": "y", "A̧": "A", "a̧": "a", "B̧": "B", "b̧": "b", "Ḑ": "D", "ḑ": "d", "Ȩ": "E", "ȩ": "e", "Ɛ̧": "E", "ɛ̧": "e", "Ḩ": "H", "ḩ": "h", "I̧": "I", "i̧": "i", "Ɨ̧": "I", "ɨ̧": "i", "M̧": "M", "m̧": "m", "O̧": "O", "o̧": "o", "Q̧": "Q", "q̧": "q", "U̧": "U", "u̧": "u", "X̧": "X", "x̧": "x", "Z̧": "Z", "z̧": "z", "й":"и", "Й":"И", "ё":"е", "Ё":"Е", }; var chars = Object.keys(characterMap).join('|'); var allAccents = new RegExp(chars, 'g'); var firstAccent = new RegExp(chars, ''); function matcher(match) { return characterMap[match]; } var removeAccents = function(string) { return string.replace(allAccents, matcher); }; var hasAccents = function(string) { return !!string.match(firstAccent); }; module.exports = removeAccents; module.exports.has = hasAccents; module.exports.remove = removeAccents; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. (() => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { AlignmentToolbar: () => (/* reexport */ AlignmentToolbar), Autocomplete: () => (/* reexport */ Autocomplete), AutosaveMonitor: () => (/* reexport */ autosave_monitor_default), BlockAlignmentToolbar: () => (/* reexport */ BlockAlignmentToolbar), BlockControls: () => (/* reexport */ BlockControls), BlockEdit: () => (/* reexport */ BlockEdit), BlockEditorKeyboardShortcuts: () => (/* reexport */ BlockEditorKeyboardShortcuts), BlockFormatControls: () => (/* reexport */ BlockFormatControls), BlockIcon: () => (/* reexport */ BlockIcon), BlockInspector: () => (/* reexport */ BlockInspector), BlockList: () => (/* reexport */ BlockList), BlockMover: () => (/* reexport */ BlockMover), BlockNavigationDropdown: () => (/* reexport */ BlockNavigationDropdown), BlockSelectionClearer: () => (/* reexport */ BlockSelectionClearer), BlockSettingsMenu: () => (/* reexport */ BlockSettingsMenu), BlockTitle: () => (/* reexport */ BlockTitle), BlockToolbar: () => (/* reexport */ BlockToolbar), CharacterCount: () => (/* reexport */ CharacterCount), ColorPalette: () => (/* reexport */ ColorPalette), ContrastChecker: () => (/* reexport */ ContrastChecker), CopyHandler: () => (/* reexport */ CopyHandler), DefaultBlockAppender: () => (/* reexport */ DefaultBlockAppender), DocumentBar: () => (/* reexport */ DocumentBar), DocumentOutline: () => (/* reexport */ DocumentOutline), DocumentOutlineCheck: () => (/* reexport */ DocumentOutlineCheck), EditorHistoryRedo: () => (/* reexport */ redo_redo_default), EditorHistoryUndo: () => (/* reexport */ undo_undo_default), EditorKeyboardShortcuts: () => (/* reexport */ EditorKeyboardShortcuts), EditorKeyboardShortcutsRegister: () => (/* reexport */ register_shortcuts_default), EditorNotices: () => (/* reexport */ editor_notices_default), EditorProvider: () => (/* reexport */ provider_default), EditorSnackbars: () => (/* reexport */ EditorSnackbars), EntitiesSavedStates: () => (/* reexport */ EntitiesSavedStates), ErrorBoundary: () => (/* reexport */ error_boundary_default), FontSizePicker: () => (/* reexport */ FontSizePicker), InnerBlocks: () => (/* reexport */ InnerBlocks), Inserter: () => (/* reexport */ Inserter), InspectorAdvancedControls: () => (/* reexport */ InspectorAdvancedControls), InspectorControls: () => (/* reexport */ InspectorControls), LocalAutosaveMonitor: () => (/* reexport */ local_autosave_monitor_default), MediaPlaceholder: () => (/* reexport */ MediaPlaceholder), MediaUpload: () => (/* reexport */ MediaUpload), MediaUploadCheck: () => (/* reexport */ MediaUploadCheck), MultiSelectScrollIntoView: () => (/* reexport */ MultiSelectScrollIntoView), NavigableToolbar: () => (/* reexport */ NavigableToolbar), ObserveTyping: () => (/* reexport */ ObserveTyping), PageAttributesCheck: () => (/* reexport */ check_check_default), PageAttributesOrder: () => (/* reexport */ PageAttributesOrderWithChecks), PageAttributesPanel: () => (/* reexport */ PageAttributesPanel), PageAttributesParent: () => (/* reexport */ parent_parent_default), PageTemplate: () => (/* reexport */ classic_theme_default), PanelColorSettings: () => (/* reexport */ PanelColorSettings), PlainText: () => (/* reexport */ PlainText), PluginBlockSettingsMenuItem: () => (/* reexport */ plugin_block_settings_menu_item_default), PluginDocumentSettingPanel: () => (/* reexport */ plugin_document_setting_panel_default), PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem), PluginPostPublishPanel: () => (/* reexport */ plugin_post_publish_panel_default), PluginPostStatusInfo: () => (/* reexport */ plugin_post_status_info_default), PluginPrePublishPanel: () => (/* reexport */ plugin_pre_publish_panel_default), PluginPreviewMenuItem: () => (/* reexport */ PluginPreviewMenuItem), PluginSidebar: () => (/* reexport */ PluginSidebar), PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), PostAuthor: () => (/* reexport */ post_author_default), PostAuthorCheck: () => (/* reexport */ PostAuthorCheck), PostAuthorPanel: () => (/* reexport */ panel_default), PostComments: () => (/* reexport */ post_comments_default), PostDiscussionPanel: () => (/* reexport */ PostDiscussionPanel), PostExcerpt: () => (/* reexport */ PostExcerpt), PostExcerptCheck: () => (/* reexport */ post_excerpt_check_check_default), PostExcerptPanel: () => (/* reexport */ PostExcerptPanel), PostFeaturedImage: () => (/* reexport */ post_featured_image_default), PostFeaturedImageCheck: () => (/* reexport */ post_featured_image_check_check_default), PostFeaturedImagePanel: () => (/* reexport */ PostFeaturedImagePanel), PostFormat: () => (/* reexport */ PostFormat), PostFormatCheck: () => (/* reexport */ PostFormatCheck), PostLastRevision: () => (/* reexport */ post_last_revision_default), PostLastRevisionCheck: () => (/* reexport */ post_last_revision_check_check_default), PostLastRevisionPanel: () => (/* reexport */ panel_panel_default), PostLockedModal: () => (/* reexport */ post_locked_modal_default), PostPendingStatus: () => (/* reexport */ post_pending_status_default), PostPendingStatusCheck: () => (/* reexport */ post_pending_status_check_check_default), PostPingbacks: () => (/* reexport */ post_pingbacks_default), PostPreviewButton: () => (/* reexport */ PostPreviewButton), PostPublishButton: () => (/* reexport */ post_publish_button_default), PostPublishButtonLabel: () => (/* reexport */ PublishButtonLabel), PostPublishPanel: () => (/* reexport */ post_publish_panel_default), PostSavedState: () => (/* reexport */ PostSavedState), PostSchedule: () => (/* reexport */ PostSchedule), PostScheduleCheck: () => (/* reexport */ PostScheduleCheck), PostScheduleLabel: () => (/* reexport */ PostScheduleLabel), PostSchedulePanel: () => (/* reexport */ PostSchedulePanel), PostSticky: () => (/* reexport */ PostSticky), PostStickyCheck: () => (/* reexport */ PostStickyCheck), PostSwitchToDraftButton: () => (/* reexport */ PostSwitchToDraftButton), PostSyncStatus: () => (/* reexport */ PostSyncStatus), PostTaxonomies: () => (/* reexport */ post_taxonomies_default), PostTaxonomiesCheck: () => (/* reexport */ PostTaxonomiesCheck), PostTaxonomiesFlatTermSelector: () => (/* reexport */ FlatTermSelector), PostTaxonomiesHierarchicalTermSelector: () => (/* reexport */ HierarchicalTermSelector), PostTaxonomiesPanel: () => (/* reexport */ panel_PostTaxonomies), PostTemplatePanel: () => (/* reexport */ PostTemplatePanel), PostTextEditor: () => (/* reexport */ PostTextEditor), PostTitle: () => (/* reexport */ post_title_default), PostTitleRaw: () => (/* reexport */ post_title_raw_default), PostTrash: () => (/* reexport */ PostTrash), PostTrashCheck: () => (/* reexport */ PostTrashCheck), PostTypeSupportCheck: () => (/* reexport */ post_type_support_check_default), PostURL: () => (/* reexport */ PostURL), PostURLCheck: () => (/* reexport */ PostURLCheck), PostURLLabel: () => (/* reexport */ PostURLLabel), PostURLPanel: () => (/* reexport */ PostURLPanel), PostVisibility: () => (/* reexport */ PostVisibility), PostVisibilityCheck: () => (/* reexport */ PostVisibilityCheck), PostVisibilityLabel: () => (/* reexport */ PostVisibilityLabel), RichText: () => (/* reexport */ RichText), RichTextShortcut: () => (/* reexport */ RichTextShortcut), RichTextToolbarButton: () => (/* reexport */ RichTextToolbarButton), ServerSideRender: () => (/* reexport */ (external_wp_serverSideRender_default())), SkipToSelectedBlock: () => (/* reexport */ SkipToSelectedBlock), TableOfContents: () => (/* reexport */ table_of_contents_default), TextEditorGlobalKeyboardShortcuts: () => (/* reexport */ TextEditorGlobalKeyboardShortcuts), ThemeSupportCheck: () => (/* reexport */ ThemeSupportCheck), TimeToRead: () => (/* reexport */ TimeToRead), URLInput: () => (/* reexport */ URLInput), URLInputButton: () => (/* reexport */ URLInputButton), URLPopover: () => (/* reexport */ URLPopover), UnsavedChangesWarning: () => (/* reexport */ UnsavedChangesWarning), VisualEditorGlobalKeyboardShortcuts: () => (/* reexport */ VisualEditorGlobalKeyboardShortcuts), Warning: () => (/* reexport */ Warning), WordCount: () => (/* reexport */ WordCount), WritingFlow: () => (/* reexport */ WritingFlow), __unstableRichTextInputEvent: () => (/* reexport */ __unstableRichTextInputEvent), cleanForSlug: () => (/* reexport */ cleanForSlug), createCustomColorsHOC: () => (/* reexport */ createCustomColorsHOC), getColorClassName: () => (/* reexport */ getColorClassName), getColorObjectByAttributeValues: () => (/* reexport */ getColorObjectByAttributeValues), getColorObjectByColorValue: () => (/* reexport */ getColorObjectByColorValue), getFontSize: () => (/* reexport */ getFontSize), getFontSizeClass: () => (/* reexport */ getFontSizeClass), getTemplatePartIcon: () => (/* reexport */ getTemplatePartIcon), mediaUpload: () => (/* reexport */ mediaUpload), privateApis: () => (/* reexport */ privateApis), registerEntityAction: () => (/* reexport */ api_registerEntityAction), registerEntityField: () => (/* reexport */ api_registerEntityField), store: () => (/* reexport */ store_store), storeConfig: () => (/* reexport */ storeConfig), transformStyles: () => (/* reexport */ external_wp_blockEditor_namespaceObject.transformStyles), unregisterEntityAction: () => (/* reexport */ api_unregisterEntityAction), unregisterEntityField: () => (/* reexport */ api_unregisterEntityField), useEntitiesSavedStatesIsDirty: () => (/* reexport */ useIsDirty), usePostScheduleLabel: () => (/* reexport */ usePostScheduleLabel), usePostURLLabel: () => (/* reexport */ usePostURLLabel), usePostVisibilityLabel: () => (/* reexport */ usePostVisibilityLabel), userAutocompleter: () => (/* reexport */ user_default), withColorContext: () => (/* reexport */ withColorContext), withColors: () => (/* reexport */ withColors), withFontSizes: () => (/* reexport */ withFontSizes) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { __experimentalGetDefaultTemplatePartAreas: () => (__experimentalGetDefaultTemplatePartAreas), __experimentalGetDefaultTemplateType: () => (__experimentalGetDefaultTemplateType), __experimentalGetDefaultTemplateTypes: () => (__experimentalGetDefaultTemplateTypes), __experimentalGetTemplateInfo: () => (__experimentalGetTemplateInfo), __unstableIsEditorReady: () => (__unstableIsEditorReady), canInsertBlockType: () => (canInsertBlockType), canUserUseUnfilteredHTML: () => (canUserUseUnfilteredHTML), didPostSaveRequestFail: () => (didPostSaveRequestFail), didPostSaveRequestSucceed: () => (didPostSaveRequestSucceed), getActivePostLock: () => (getActivePostLock), getAdjacentBlockClientId: () => (getAdjacentBlockClientId), getAutosaveAttribute: () => (getAutosaveAttribute), getBlock: () => (getBlock), getBlockAttributes: () => (getBlockAttributes), getBlockCount: () => (getBlockCount), getBlockHierarchyRootClientId: () => (getBlockHierarchyRootClientId), getBlockIndex: () => (getBlockIndex), getBlockInsertionPoint: () => (getBlockInsertionPoint), getBlockListSettings: () => (getBlockListSettings), getBlockMode: () => (getBlockMode), getBlockName: () => (getBlockName), getBlockOrder: () => (getBlockOrder), getBlockRootClientId: () => (getBlockRootClientId), getBlockSelectionEnd: () => (getBlockSelectionEnd), getBlockSelectionStart: () => (getBlockSelectionStart), getBlocks: () => (getBlocks), getBlocksByClientId: () => (getBlocksByClientId), getClientIdsOfDescendants: () => (getClientIdsOfDescendants), getClientIdsWithDescendants: () => (getClientIdsWithDescendants), getCurrentPost: () => (getCurrentPost), getCurrentPostAttribute: () => (getCurrentPostAttribute), getCurrentPostId: () => (getCurrentPostId), getCurrentPostLastRevisionId: () => (getCurrentPostLastRevisionId), getCurrentPostRevisionsCount: () => (getCurrentPostRevisionsCount), getCurrentPostType: () => (getCurrentPostType), getCurrentTemplateId: () => (getCurrentTemplateId), getDeviceType: () => (getDeviceType), getEditedPostAttribute: () => (getEditedPostAttribute), getEditedPostContent: () => (getEditedPostContent), getEditedPostPreviewLink: () => (getEditedPostPreviewLink), getEditedPostSlug: () => (getEditedPostSlug), getEditedPostVisibility: () => (getEditedPostVisibility), getEditorBlocks: () => (getEditorBlocks), getEditorMode: () => (getEditorMode), getEditorSelection: () => (getEditorSelection), getEditorSelectionEnd: () => (getEditorSelectionEnd), getEditorSelectionStart: () => (getEditorSelectionStart), getEditorSettings: () => (getEditorSettings), getFirstMultiSelectedBlockClientId: () => (getFirstMultiSelectedBlockClientId), getGlobalBlockCount: () => (getGlobalBlockCount), getInserterItems: () => (getInserterItems), getLastMultiSelectedBlockClientId: () => (getLastMultiSelectedBlockClientId), getMultiSelectedBlockClientIds: () => (getMultiSelectedBlockClientIds), getMultiSelectedBlocks: () => (getMultiSelectedBlocks), getMultiSelectedBlocksEndClientId: () => (getMultiSelectedBlocksEndClientId), getMultiSelectedBlocksStartClientId: () => (getMultiSelectedBlocksStartClientId), getNextBlockClientId: () => (getNextBlockClientId), getPermalink: () => (getPermalink), getPermalinkParts: () => (getPermalinkParts), getPostEdits: () => (getPostEdits), getPostLockUser: () => (getPostLockUser), getPostTypeLabel: () => (getPostTypeLabel), getPreviousBlockClientId: () => (getPreviousBlockClientId), getRenderingMode: () => (getRenderingMode), getSelectedBlock: () => (getSelectedBlock), getSelectedBlockClientId: () => (getSelectedBlockClientId), getSelectedBlockCount: () => (getSelectedBlockCount), getSelectedBlocksInitialCaretPosition: () => (getSelectedBlocksInitialCaretPosition), getStateBeforeOptimisticTransaction: () => (getStateBeforeOptimisticTransaction), getSuggestedPostFormat: () => (getSuggestedPostFormat), getTemplate: () => (getTemplate), getTemplateLock: () => (getTemplateLock), hasChangedContent: () => (hasChangedContent), hasEditorRedo: () => (hasEditorRedo), hasEditorUndo: () => (hasEditorUndo), hasInserterItems: () => (hasInserterItems), hasMultiSelection: () => (hasMultiSelection), hasNonPostEntityChanges: () => (hasNonPostEntityChanges), hasSelectedBlock: () => (hasSelectedBlock), hasSelectedInnerBlock: () => (hasSelectedInnerBlock), inSomeHistory: () => (inSomeHistory), isAncestorMultiSelected: () => (isAncestorMultiSelected), isAutosavingPost: () => (isAutosavingPost), isBlockInsertionPointVisible: () => (isBlockInsertionPointVisible), isBlockMultiSelected: () => (isBlockMultiSelected), isBlockSelected: () => (isBlockSelected), isBlockValid: () => (isBlockValid), isBlockWithinSelection: () => (isBlockWithinSelection), isCaretWithinFormattedText: () => (isCaretWithinFormattedText), isCleanNewPost: () => (isCleanNewPost), isCurrentPostPending: () => (isCurrentPostPending), isCurrentPostPublished: () => (isCurrentPostPublished), isCurrentPostScheduled: () => (isCurrentPostScheduled), isDeletingPost: () => (isDeletingPost), isEditedPostAutosaveable: () => (isEditedPostAutosaveable), isEditedPostBeingScheduled: () => (isEditedPostBeingScheduled), isEditedPostDateFloating: () => (isEditedPostDateFloating), isEditedPostDirty: () => (isEditedPostDirty), isEditedPostEmpty: () => (isEditedPostEmpty), isEditedPostNew: () => (isEditedPostNew), isEditedPostPublishable: () => (isEditedPostPublishable), isEditedPostSaveable: () => (isEditedPostSaveable), isEditorPanelEnabled: () => (isEditorPanelEnabled), isEditorPanelOpened: () => (isEditorPanelOpened), isEditorPanelRemoved: () => (isEditorPanelRemoved), isFirstMultiSelectedBlock: () => (isFirstMultiSelectedBlock), isInserterOpened: () => (isInserterOpened), isListViewOpened: () => (isListViewOpened), isMultiSelecting: () => (isMultiSelecting), isPermalinkEditable: () => (isPermalinkEditable), isPostAutosavingLocked: () => (isPostAutosavingLocked), isPostLockTakeover: () => (isPostLockTakeover), isPostLocked: () => (isPostLocked), isPostSavingLocked: () => (isPostSavingLocked), isPreviewingPost: () => (isPreviewingPost), isPublishSidebarEnabled: () => (isPublishSidebarEnabled), isPublishSidebarOpened: () => (isPublishSidebarOpened), isPublishingPost: () => (isPublishingPost), isSavingNonPostEntityChanges: () => (isSavingNonPostEntityChanges), isSavingPost: () => (isSavingPost), isSelectionEnabled: () => (isSelectionEnabled), isTyping: () => (isTyping), isValidTemplate: () => (isValidTemplate) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { __experimentalTearDownEditor: () => (__experimentalTearDownEditor), __unstableSaveForPreview: () => (__unstableSaveForPreview), autosave: () => (autosave), clearSelectedBlock: () => (clearSelectedBlock), closePublishSidebar: () => (closePublishSidebar), createUndoLevel: () => (createUndoLevel), disablePublishSidebar: () => (disablePublishSidebar), editPost: () => (editPost), enablePublishSidebar: () => (enablePublishSidebar), enterFormattedText: () => (enterFormattedText), exitFormattedText: () => (exitFormattedText), hideInsertionPoint: () => (hideInsertionPoint), insertBlock: () => (insertBlock), insertBlocks: () => (insertBlocks), insertDefaultBlock: () => (insertDefaultBlock), lockPostAutosaving: () => (lockPostAutosaving), lockPostSaving: () => (lockPostSaving), mergeBlocks: () => (mergeBlocks), moveBlockToPosition: () => (moveBlockToPosition), moveBlocksDown: () => (moveBlocksDown), moveBlocksUp: () => (moveBlocksUp), multiSelect: () => (multiSelect), openPublishSidebar: () => (openPublishSidebar), receiveBlocks: () => (receiveBlocks), redo: () => (redo), refreshPost: () => (refreshPost), removeBlock: () => (removeBlock), removeBlocks: () => (removeBlocks), removeEditorPanel: () => (removeEditorPanel), replaceBlock: () => (replaceBlock), replaceBlocks: () => (replaceBlocks), resetBlocks: () => (resetBlocks), resetEditorBlocks: () => (resetEditorBlocks), resetPost: () => (resetPost), savePost: () => (savePost), selectBlock: () => (selectBlock), setDeviceType: () => (setDeviceType), setEditedPost: () => (setEditedPost), setIsInserterOpened: () => (setIsInserterOpened), setIsListViewOpened: () => (setIsListViewOpened), setRenderingMode: () => (setRenderingMode), setTemplateValidity: () => (setTemplateValidity), setupEditor: () => (setupEditor), setupEditorState: () => (setupEditorState), showInsertionPoint: () => (showInsertionPoint), startMultiSelect: () => (startMultiSelect), startTyping: () => (startTyping), stopMultiSelect: () => (stopMultiSelect), stopTyping: () => (stopTyping), switchEditorMode: () => (switchEditorMode), synchronizeTemplate: () => (synchronizeTemplate), toggleBlockMode: () => (toggleBlockMode), toggleDistractionFree: () => (toggleDistractionFree), toggleEditorPanelEnabled: () => (toggleEditorPanelEnabled), toggleEditorPanelOpened: () => (toggleEditorPanelOpened), togglePublishSidebar: () => (togglePublishSidebar), toggleSelection: () => (toggleSelection), toggleSpotlightMode: () => (toggleSpotlightMode), toggleTopToolbar: () => (toggleTopToolbar), trashPost: () => (trashPost), undo: () => (undo), unlockPostAutosaving: () => (unlockPostAutosaving), unlockPostSaving: () => (unlockPostSaving), updateBlock: () => (updateBlock), updateBlockAttributes: () => (updateBlockAttributes), updateBlockListSettings: () => (updateBlockListSettings), updateEditorSettings: () => (updateEditorSettings), updatePost: () => (updatePost), updatePostLock: () => (updatePostLock) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js var store_actions_namespaceObject = {}; __webpack_require__.r(store_actions_namespaceObject); __webpack_require__.d(store_actions_namespaceObject, { closeModal: () => (closeModal), disableComplementaryArea: () => (disableComplementaryArea), enableComplementaryArea: () => (enableComplementaryArea), openModal: () => (openModal), pinItem: () => (pinItem), setDefaultComplementaryArea: () => (setDefaultComplementaryArea), setFeatureDefaults: () => (setFeatureDefaults), setFeatureValue: () => (setFeatureValue), toggleFeature: () => (toggleFeature), unpinItem: () => (unpinItem) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js var store_selectors_namespaceObject = {}; __webpack_require__.r(store_selectors_namespaceObject); __webpack_require__.d(store_selectors_namespaceObject, { getActiveComplementaryArea: () => (getActiveComplementaryArea), isComplementaryAreaLoading: () => (isComplementaryAreaLoading), isFeatureActive: () => (isFeatureActive), isItemPinned: () => (isItemPinned), isModalActive: () => (isModalActive) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/index.js var build_module_namespaceObject = {}; __webpack_require__.r(build_module_namespaceObject); __webpack_require__.d(build_module_namespaceObject, { ActionItem: () => (action_item_default), ComplementaryArea: () => (complementary_area_default), ComplementaryAreaMoreMenuItem: () => (ComplementaryAreaMoreMenuItem), FullscreenMode: () => (fullscreen_mode_default), InterfaceSkeleton: () => (interface_skeleton_default), PinnedItems: () => (pinned_items_default), store: () => (store) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/private-actions.js var store_private_actions_namespaceObject = {}; __webpack_require__.r(store_private_actions_namespaceObject); __webpack_require__.d(store_private_actions_namespaceObject, { createTemplate: () => (createTemplate), hideBlockTypes: () => (hideBlockTypes), registerEntityAction: () => (registerEntityAction), registerEntityField: () => (registerEntityField), registerPostTypeSchema: () => (registerPostTypeSchema), removeTemplates: () => (removeTemplates), revertTemplate: () => (private_actions_revertTemplate), saveDirtyEntities: () => (saveDirtyEntities), setCanvasMinHeight: () => (setCanvasMinHeight), setCurrentTemplateId: () => (setCurrentTemplateId), setDefaultRenderingMode: () => (setDefaultRenderingMode), setIsReady: () => (setIsReady), showBlockTypes: () => (showBlockTypes), unregisterEntityAction: () => (unregisterEntityAction), unregisterEntityField: () => (unregisterEntityField) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/private-selectors.js var store_private_selectors_namespaceObject = {}; __webpack_require__.r(store_private_selectors_namespaceObject); __webpack_require__.d(store_private_selectors_namespaceObject, { getCanvasMinHeight: () => (getCanvasMinHeight), getDefaultRenderingMode: () => (getDefaultRenderingMode), getEntityActions: () => (private_selectors_getEntityActions), getEntityFields: () => (private_selectors_getEntityFields), getInserter: () => (getInserter), getInserterSidebarToggleRef: () => (getInserterSidebarToggleRef), getListViewToggleRef: () => (getListViewToggleRef), getPostBlocksByName: () => (getPostBlocksByName), getPostIcon: () => (getPostIcon), hasPostMetaChanges: () => (hasPostMetaChanges), isEntityReady: () => (private_selectors_isEntityReady) }); ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// external ["wp","coreData"] const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// external ["wp","blockEditor"] const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; ;// ./node_modules/@wordpress/editor/build-module/store/defaults.js const EDITOR_SETTINGS_DEFAULTS = { ...external_wp_blockEditor_namespaceObject.SETTINGS_DEFAULTS, richEditingEnabled: true, codeEditingEnabled: true, fontLibraryEnabled: true, enableCustomFields: void 0, defaultRenderingMode: "post-only" }; ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/reducer.js function isReady(state = {}, action) { switch (action.type) { case "SET_IS_READY": return { ...state, [action.kind]: { ...state[action.kind], [action.name]: true } }; } return state; } function actions(state = {}, action) { switch (action.type) { case "REGISTER_ENTITY_ACTION": return { ...state, [action.kind]: { ...state[action.kind], [action.name]: [ ...(state[action.kind]?.[action.name] ?? []).filter( (_action) => _action.id !== action.config.id ), action.config ] } }; case "UNREGISTER_ENTITY_ACTION": { return { ...state, [action.kind]: { ...state[action.kind], [action.name]: (state[action.kind]?.[action.name] ?? []).filter((_action) => _action.id !== action.actionId) } }; } } return state; } function fields(state = {}, action) { switch (action.type) { case "REGISTER_ENTITY_FIELD": return { ...state, [action.kind]: { ...state[action.kind], [action.name]: [ ...(state[action.kind]?.[action.name] ?? []).filter( (_field) => _field.id !== action.config.id ), action.config ] } }; case "UNREGISTER_ENTITY_FIELD": return { ...state, [action.kind]: { ...state[action.kind], [action.name]: (state[action.kind]?.[action.name] ?? []).filter((_field) => _field.id !== action.fieldId) } }; } return state; } var reducer_default = (0,external_wp_data_namespaceObject.combineReducers)({ actions, fields, isReady }); ;// ./node_modules/@wordpress/editor/build-module/store/reducer.js function getPostRawValue(value) { if (value && "object" === typeof value && "raw" in value) { return value.raw; } return value; } function hasSameKeys(a, b) { const keysA = Object.keys(a).sort(); const keysB = Object.keys(b).sort(); return keysA.length === keysB.length && keysA.every((key, index) => keysB[index] === key); } function isUpdatingSamePostProperty(action, previousAction) { return action.type === "EDIT_POST" && hasSameKeys(action.edits, previousAction.edits); } function shouldOverwriteState(action, previousAction) { if (action.type === "RESET_EDITOR_BLOCKS") { return !action.shouldCreateUndoLevel; } if (!previousAction || action.type !== previousAction.type) { return false; } return isUpdatingSamePostProperty(action, previousAction); } function postId(state = null, action) { switch (action.type) { case "SET_EDITED_POST": return action.postId; } return state; } function templateId(state = null, action) { switch (action.type) { case "SET_CURRENT_TEMPLATE_ID": return action.id; } return state; } function postType(state = null, action) { switch (action.type) { case "SET_EDITED_POST": return action.postType; } return state; } function template(state = { isValid: true }, action) { switch (action.type) { case "SET_TEMPLATE_VALIDITY": return { ...state, isValid: action.isValid }; } return state; } function saving(state = {}, action) { switch (action.type) { case "REQUEST_POST_UPDATE_START": case "REQUEST_POST_UPDATE_FINISH": return { pending: action.type === "REQUEST_POST_UPDATE_START", options: action.options || {} }; } return state; } function deleting(state = {}, action) { switch (action.type) { case "REQUEST_POST_DELETE_START": case "REQUEST_POST_DELETE_FINISH": return { pending: action.type === "REQUEST_POST_DELETE_START" }; } return state; } function postLock(state = { isLocked: false }, action) { switch (action.type) { case "UPDATE_POST_LOCK": return action.lock; } return state; } function postSavingLock(state = {}, action) { switch (action.type) { case "LOCK_POST_SAVING": return { ...state, [action.lockName]: true }; case "UNLOCK_POST_SAVING": { const { [action.lockName]: removedLockName, ...restState } = state; return restState; } } return state; } function postAutosavingLock(state = {}, action) { switch (action.type) { case "LOCK_POST_AUTOSAVING": return { ...state, [action.lockName]: true }; case "UNLOCK_POST_AUTOSAVING": { const { [action.lockName]: removedLockName, ...restState } = state; return restState; } } return state; } function editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) { switch (action.type) { case "UPDATE_EDITOR_SETTINGS": return { ...state, ...action.settings }; } return state; } function renderingMode(state = "post-only", action) { switch (action.type) { case "SET_RENDERING_MODE": return action.mode; } return state; } function deviceType(state = "Desktop", action) { switch (action.type) { case "SET_DEVICE_TYPE": return action.deviceType; } return state; } function removedPanels(state = [], action) { switch (action.type) { case "REMOVE_PANEL": if (!state.includes(action.panelName)) { return [...state, action.panelName]; } } return state; } function blockInserterPanel(state = false, action) { switch (action.type) { case "SET_IS_LIST_VIEW_OPENED": return action.isOpen ? false : state; case "SET_IS_INSERTER_OPENED": return action.value; } return state; } function listViewPanel(state = false, action) { switch (action.type) { case "SET_IS_INSERTER_OPENED": return action.value ? false : state; case "SET_IS_LIST_VIEW_OPENED": return action.isOpen; } return state; } function listViewToggleRef(state = { current: null }) { return state; } function inserterSidebarToggleRef(state = { current: null }) { return state; } function publishSidebarActive(state = false, action) { switch (action.type) { case "OPEN_PUBLISH_SIDEBAR": return true; case "CLOSE_PUBLISH_SIDEBAR": return false; case "TOGGLE_PUBLISH_SIDEBAR": return !state; } return state; } function canvasMinHeight(state = 0, action) { switch (action.type) { case "SET_CANVAS_MIN_HEIGHT": return action.minHeight; } return state; } var reducer_reducer_default = (0,external_wp_data_namespaceObject.combineReducers)({ postId, postType, templateId, saving, deleting, postLock, template, postSavingLock, editorSettings, postAutosavingLock, renderingMode, deviceType, removedPanels, blockInserterPanel, inserterSidebarToggleRef, listViewPanel, listViewToggleRef, publishSidebarActive, canvasMinHeight, dataviews: reducer_default }); ;// external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// external ["wp","date"] const external_wp_date_namespaceObject = window["wp"]["date"]; ;// external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); ;// external ["wp","preferences"] const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; ;// ./node_modules/@wordpress/editor/build-module/store/constants.js const EDIT_MERGE_PROPERTIES = /* @__PURE__ */ new Set(["meta"]); const STORE_NAME = "core/editor"; const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; const ONE_MINUTE_IN_MS = 60 * 1e3; const AUTOSAVE_PROPERTIES = ["title", "excerpt", "content"]; const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = "uncategorized"; const TEMPLATE_POST_TYPE = "wp_template"; const TEMPLATE_PART_POST_TYPE = "wp_template_part"; const PATTERN_POST_TYPE = "wp_block"; const NAVIGATION_POST_TYPE = "wp_navigation"; const TEMPLATE_ORIGINS = { custom: "custom", theme: "theme", plugin: "plugin" }; const TEMPLATE_POST_TYPES = ["wp_template", "wp_template_part"]; const GLOBAL_POST_TYPES = [ ...TEMPLATE_POST_TYPES, "wp_block", "wp_navigation" ]; ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// ./node_modules/@wordpress/icons/build-module/library/header.js var header_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 10.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" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/footer.js var footer_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, { fillRule: "evenodd", d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/sidebar.js var sidebar_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.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js var symbol_filled_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); ;// ./node_modules/@wordpress/editor/build-module/utils/get-template-part-icon.js function getTemplatePartIcon(iconName) { if ("header" === iconName) { return header_default; } else if ("footer" === iconName) { return footer_default; } else if ("sidebar" === iconName) { return sidebar_default; } return symbol_filled_default; } ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/editor/build-module/lock-unlock.js const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/editor" ); ;// ./node_modules/@wordpress/icons/build-module/library/layout.js var layout_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); ;// ./node_modules/@wordpress/editor/build-module/utils/get-template-info.js const EMPTY_OBJECT = {}; const getTemplateInfo = (params) => { if (!params) { return EMPTY_OBJECT; } const { templateTypes, templateAreas, template } = params; const { description, slug, title, area } = template; const { title: defaultTitle, description: defaultDescription } = Object.values(templateTypes).find((type) => type.slug === slug) ?? EMPTY_OBJECT; const templateTitle = typeof title === "string" ? title : title?.rendered; const templateDescription = typeof description === "string" ? description : description?.raw; const templateAreasWithIcon = templateAreas?.map((item) => ({ ...item, icon: getTemplatePartIcon(item.icon) })); const templateIcon = templateAreasWithIcon?.find((item) => area === item.area)?.icon || layout_default; return { title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug, description: templateDescription || defaultDescription, icon: templateIcon }; }; ;// ./node_modules/@wordpress/editor/build-module/store/selectors.js const selectors_EMPTY_OBJECT = {}; const hasEditorUndo = (0,external_wp_data_namespaceObject.createRegistrySelector)((select) => () => { return select(external_wp_coreData_namespaceObject.store).hasUndo(); }); const hasEditorRedo = (0,external_wp_data_namespaceObject.createRegistrySelector)((select) => () => { return select(external_wp_coreData_namespaceObject.store).hasRedo(); }); function isEditedPostNew(state) { return getCurrentPost(state).status === "auto-draft"; } function hasChangedContent(state) { const edits = getPostEdits(state); return "content" in edits; } const isEditedPostDirty = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state) => { const postType = getCurrentPostType(state); const postId = getCurrentPostId(state); return select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord( "postType", postType, postId ); } ); const hasNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state) => { const dirtyEntityRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords(); const { type, id } = getCurrentPost(state); return dirtyEntityRecords.some( (entityRecord) => entityRecord.kind !== "postType" || entityRecord.name !== type || entityRecord.key !== id ); } ); function isCleanNewPost(state) { return !isEditedPostDirty(state) && isEditedPostNew(state); } const getCurrentPost = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state) => { const postId = getCurrentPostId(state); const postType = getCurrentPostType(state); const post = select(external_wp_coreData_namespaceObject.store).getRawEntityRecord( "postType", postType, postId ); if (post) { return post; } return selectors_EMPTY_OBJECT; } ); function getCurrentPostType(state) { return state.postType; } function getCurrentPostId(state) { return state.postId; } function getCurrentTemplateId(state) { return state.templateId; } function getCurrentPostRevisionsCount(state) { return getCurrentPost(state)._links?.["version-history"]?.[0]?.count ?? 0; } function getCurrentPostLastRevisionId(state) { return getCurrentPost(state)._links?.["predecessor-version"]?.[0]?.id ?? null; } const getPostEdits = (0,external_wp_data_namespaceObject.createRegistrySelector)((select) => (state) => { const postType = getCurrentPostType(state); const postId = getCurrentPostId(state); return select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits( "postType", postType, postId ) || selectors_EMPTY_OBJECT; }); function getCurrentPostAttribute(state, attributeName) { switch (attributeName) { case "type": return getCurrentPostType(state); case "id": return getCurrentPostId(state); default: const post = getCurrentPost(state); if (!post.hasOwnProperty(attributeName)) { break; } return getPostRawValue(post[attributeName]); } } const getNestedEditedPostProperty = (0,external_wp_data_namespaceObject.createSelector)( (state, attributeName) => { const edits = getPostEdits(state); if (!edits.hasOwnProperty(attributeName)) { return getCurrentPostAttribute(state, attributeName); } return { ...getCurrentPostAttribute(state, attributeName), ...edits[attributeName] }; }, (state, attributeName) => [ getCurrentPostAttribute(state, attributeName), getPostEdits(state)[attributeName] ] ); function getEditedPostAttribute(state, attributeName) { switch (attributeName) { case "content": return getEditedPostContent(state); } const edits = getPostEdits(state); if (!edits.hasOwnProperty(attributeName)) { return getCurrentPostAttribute(state, attributeName); } if (EDIT_MERGE_PROPERTIES.has(attributeName)) { return getNestedEditedPostProperty(state, attributeName); } return edits[attributeName]; } const getAutosaveAttribute = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, attributeName) => { if (!AUTOSAVE_PROPERTIES.includes(attributeName) && attributeName !== "preview_link") { return; } const postType = getCurrentPostType(state); if (postType === "wp_template") { return false; } const postId = getCurrentPostId(state); const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id; const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave( postType, postId, currentUserId ); if (autosave) { return getPostRawValue(autosave[attributeName]); } } ); function getEditedPostVisibility(state) { const status = getEditedPostAttribute(state, "status"); if (status === "private") { return "private"; } const password = getEditedPostAttribute(state, "password"); if (password) { return "password"; } return "public"; } function isCurrentPostPending(state) { return getCurrentPost(state).status === "pending"; } function isCurrentPostPublished(state, currentPost) { const post = currentPost || getCurrentPost(state); return ["publish", "private"].indexOf(post.status) !== -1 || post.status === "future" && !(0,external_wp_date_namespaceObject.isInTheFuture)( new Date(Number((0,external_wp_date_namespaceObject.getDate)(post.date)) - ONE_MINUTE_IN_MS) ); } function isCurrentPostScheduled(state) { return getCurrentPost(state).status === "future" && !isCurrentPostPublished(state); } function isEditedPostPublishable(state) { const post = getCurrentPost(state); return isEditedPostDirty(state) || ["publish", "private", "future"].indexOf(post.status) === -1; } function isEditedPostSaveable(state) { if (isSavingPost(state)) { return false; } return !!getEditedPostAttribute(state, "title") || !!getEditedPostAttribute(state, "excerpt") || !isEditedPostEmpty(state) || external_wp_element_namespaceObject.Platform.OS === "native"; } const isEditedPostEmpty = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state) => { const postId = getCurrentPostId(state); const postType = getCurrentPostType(state); const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( "postType", postType, postId ); if (typeof record.content !== "function") { return !record.content; } const blocks = getEditedPostAttribute(state, "blocks"); if (blocks.length === 0) { return true; } if (blocks.length > 1) { return false; } const blockName = blocks[0].name; if (blockName !== (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() && blockName !== (0,external_wp_blocks_namespaceObject.getFreeformContentHandlerName)()) { return false; } return !getEditedPostContent(state); } ); const isEditedPostAutosaveable = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state) => { if (!isEditedPostSaveable(state)) { return false; } if (isPostAutosavingLocked(state)) { return false; } const postType = getCurrentPostType(state); const postTypeObject = select(external_wp_coreData_namespaceObject.store).getPostType(postType); if (postType === "wp_template" || !postTypeObject?.supports?.autosave) { return false; } const postId = getCurrentPostId(state); const hasFetchedAutosave = select(external_wp_coreData_namespaceObject.store).hasFetchedAutosaves( postType, postId ); const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id; const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave( postType, postId, currentUserId ); if (!hasFetchedAutosave) { return false; } if (!autosave) { return true; } if (hasChangedContent(state)) { return true; } return ["title", "excerpt", "meta"].some( (field) => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field) ); } ); function isEditedPostBeingScheduled(state) { const date = getEditedPostAttribute(state, "date"); const checkedDate = new Date( Number((0,external_wp_date_namespaceObject.getDate)(date)) - ONE_MINUTE_IN_MS ); return (0,external_wp_date_namespaceObject.isInTheFuture)(checkedDate); } function isEditedPostDateFloating(state) { const date = getEditedPostAttribute(state, "date"); const modified = getEditedPostAttribute(state, "modified"); const status = getCurrentPost(state).status; if (status === "draft" || status === "auto-draft" || status === "pending") { return date === modified || date === null; } return false; } function isDeletingPost(state) { return !!state.deleting.pending; } function isSavingPost(state) { return !!state.saving.pending; } const isSavingNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state) => { const entitiesBeingSaved = select(external_wp_coreData_namespaceObject.store).__experimentalGetEntitiesBeingSaved(); const { type, id } = getCurrentPost(state); return entitiesBeingSaved.some( (entityRecord) => entityRecord.kind !== "postType" || entityRecord.name !== type || entityRecord.key !== id ); } ); const didPostSaveRequestSucceed = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state) => { const postType = getCurrentPostType(state); const postId = getCurrentPostId(state); return !select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError( "postType", postType, postId ); } ); const didPostSaveRequestFail = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state) => { const postType = getCurrentPostType(state); const postId = getCurrentPostId(state); return !!select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError( "postType", postType, postId ); } ); function isAutosavingPost(state) { return isSavingPost(state) && Boolean(state.saving.options?.isAutosave); } function isPreviewingPost(state) { return isSavingPost(state) && Boolean(state.saving.options?.isPreview); } function getEditedPostPreviewLink(state) { if (state.saving.pending || isSavingPost(state)) { return; } let previewLink = getAutosaveAttribute(state, "preview_link"); if (!previewLink || "draft" === getCurrentPost(state).status) { previewLink = getEditedPostAttribute(state, "link"); if (previewLink) { previewLink = (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { preview: true }); } } const featuredImageId = getEditedPostAttribute(state, "featured_media"); if (previewLink && featuredImageId) { return (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { _thumbnail_id: featuredImageId }); } return previewLink; } const getSuggestedPostFormat = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => () => { const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); if (blocks.length > 2) { return null; } let name; if (blocks.length === 1) { name = blocks[0].name; if (name === "core/embed") { const provider = blocks[0].attributes?.providerNameSlug; if (["youtube", "vimeo"].includes(provider)) { name = "core/video"; } else if (["spotify", "soundcloud"].includes(provider)) { name = "core/audio"; } } } if (blocks.length === 2 && blocks[1].name === "core/paragraph") { name = blocks[0].name; } switch (name) { case "core/image": return "image"; case "core/quote": case "core/pullquote": return "quote"; case "core/gallery": return "gallery"; case "core/video": return "video"; case "core/audio": return "audio"; default: return null; } } ); const getEditedPostContent = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state) => { const postId = getCurrentPostId(state); const postType = getCurrentPostType(state); const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( "postType", postType, postId ); if (record) { if (typeof record.content === "function") { return record.content(record); } else if (record.blocks) { return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); } else if (record.content) { return record.content; } } return ""; } ); function isPublishingPost(state) { return isSavingPost(state) && !isCurrentPostPublished(state) && getEditedPostAttribute(state, "status") === "publish"; } function isPermalinkEditable(state) { const permalinkTemplate = getEditedPostAttribute( state, "permalink_template" ); return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); } function getPermalink(state) { const permalinkParts = getPermalinkParts(state); if (!permalinkParts) { return null; } const { prefix, postName, suffix } = permalinkParts; if (isPermalinkEditable(state)) { return prefix + postName + suffix; } return prefix; } function getEditedPostSlug(state) { return getEditedPostAttribute(state, "slug") || (0,external_wp_url_namespaceObject.cleanForSlug)(getEditedPostAttribute(state, "title")) || getCurrentPostId(state); } function getPermalinkParts(state) { const permalinkTemplate = getEditedPostAttribute( state, "permalink_template" ); if (!permalinkTemplate) { return null; } const postName = getEditedPostAttribute(state, "slug") || getEditedPostAttribute(state, "generated_slug"); const [prefix, suffix] = permalinkTemplate.split( PERMALINK_POSTNAME_REGEX ); return { prefix, postName, suffix }; } function isPostLocked(state) { return state.postLock.isLocked; } function isPostSavingLocked(state) { return Object.keys(state.postSavingLock).length > 0; } function isPostAutosavingLocked(state) { return Object.keys(state.postAutosavingLock).length > 0; } function isPostLockTakeover(state) { return state.postLock.isTakeover; } function getPostLockUser(state) { return state.postLock.user; } function getActivePostLock(state) { return state.postLock.activePostLock; } function canUserUseUnfilteredHTML(state) { return Boolean( getCurrentPost(state)._links?.hasOwnProperty( "wp:action-unfiltered-html" ) ); } const isPublishSidebarEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => () => !!select(external_wp_preferences_namespaceObject.store).get("core", "isPublishSidebarEnabled") ); const getEditorBlocks = (0,external_wp_data_namespaceObject.createSelector)( (state) => { return getEditedPostAttribute(state, "blocks") || (0,external_wp_blocks_namespaceObject.parse)(getEditedPostContent(state)); }, (state) => [ getEditedPostAttribute(state, "blocks"), getEditedPostContent(state) ] ); function isEditorPanelRemoved(state, panelName) { return state.removedPanels.includes(panelName); } const isEditorPanelEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, panelName) => { const inactivePanels = select(external_wp_preferences_namespaceObject.store).get( "core", "inactivePanels" ); return !isEditorPanelRemoved(state, panelName) && !inactivePanels?.includes(panelName); } ); const isEditorPanelOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, panelName) => { const openPanels = select(external_wp_preferences_namespaceObject.store).get( "core", "openPanels" ); return !!openPanels?.includes(panelName); } ); function getEditorSelectionStart(state) { external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { since: "5.8", alternative: "select('core/editor').getEditorSelection" }); return getEditedPostAttribute(state, "selection")?.selectionStart; } function getEditorSelectionEnd(state) { external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { since: "5.8", alternative: "select('core/editor').getEditorSelection" }); return getEditedPostAttribute(state, "selection")?.selectionEnd; } function getEditorSelection(state) { return getEditedPostAttribute(state, "selection"); } function __unstableIsEditorReady(state) { return !!state.postId; } function getEditorSettings(state) { return state.editorSettings; } function getRenderingMode(state) { return state.renderingMode; } const getDeviceType = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state) => { const isZoomOut = unlock(select(external_wp_blockEditor_namespaceObject.store)).isZoomOut(); if (isZoomOut) { return "Desktop"; } return state.deviceType; } ); function isListViewOpened(state) { return state.listViewPanel; } function isInserterOpened(state) { return !!state.blockInserterPanel; } const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => () => select(external_wp_preferences_namespaceObject.store).get("core", "editorMode") ?? "visual" ); function getStateBeforeOptimisticTransaction() { external_wp_deprecated_default()("select('core/editor').getStateBeforeOptimisticTransaction", { since: "5.7", hint: "No state history is kept on this store anymore" }); return null; } function inSomeHistory() { external_wp_deprecated_default()("select('core/editor').inSomeHistory", { since: "5.7", hint: "No state history is kept on this store anymore" }); return false; } function getBlockEditorSelector(name) { return (0,external_wp_data_namespaceObject.createRegistrySelector)((select) => (state, ...args) => { external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + "`", { since: "5.3", alternative: "`wp.data.select( 'core/block-editor' )." + name + "`", version: "6.2" }); return select(external_wp_blockEditor_namespaceObject.store)[name](...args); }); } const getBlockName = getBlockEditorSelector("getBlockName"); const isBlockValid = getBlockEditorSelector("isBlockValid"); const getBlockAttributes = getBlockEditorSelector("getBlockAttributes"); const getBlock = getBlockEditorSelector("getBlock"); const getBlocks = getBlockEditorSelector("getBlocks"); const getClientIdsOfDescendants = getBlockEditorSelector( "getClientIdsOfDescendants" ); const getClientIdsWithDescendants = getBlockEditorSelector( "getClientIdsWithDescendants" ); const getGlobalBlockCount = getBlockEditorSelector( "getGlobalBlockCount" ); const getBlocksByClientId = getBlockEditorSelector( "getBlocksByClientId" ); const getBlockCount = getBlockEditorSelector("getBlockCount"); const getBlockSelectionStart = getBlockEditorSelector( "getBlockSelectionStart" ); const getBlockSelectionEnd = getBlockEditorSelector( "getBlockSelectionEnd" ); const getSelectedBlockCount = getBlockEditorSelector( "getSelectedBlockCount" ); const hasSelectedBlock = getBlockEditorSelector("hasSelectedBlock"); const getSelectedBlockClientId = getBlockEditorSelector( "getSelectedBlockClientId" ); const getSelectedBlock = getBlockEditorSelector("getSelectedBlock"); const getBlockRootClientId = getBlockEditorSelector( "getBlockRootClientId" ); const getBlockHierarchyRootClientId = getBlockEditorSelector( "getBlockHierarchyRootClientId" ); const getAdjacentBlockClientId = getBlockEditorSelector( "getAdjacentBlockClientId" ); const getPreviousBlockClientId = getBlockEditorSelector( "getPreviousBlockClientId" ); const getNextBlockClientId = getBlockEditorSelector( "getNextBlockClientId" ); const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector( "getSelectedBlocksInitialCaretPosition" ); const getMultiSelectedBlockClientIds = getBlockEditorSelector( "getMultiSelectedBlockClientIds" ); const getMultiSelectedBlocks = getBlockEditorSelector( "getMultiSelectedBlocks" ); const getFirstMultiSelectedBlockClientId = getBlockEditorSelector( "getFirstMultiSelectedBlockClientId" ); const getLastMultiSelectedBlockClientId = getBlockEditorSelector( "getLastMultiSelectedBlockClientId" ); const isFirstMultiSelectedBlock = getBlockEditorSelector( "isFirstMultiSelectedBlock" ); const isBlockMultiSelected = getBlockEditorSelector( "isBlockMultiSelected" ); const isAncestorMultiSelected = getBlockEditorSelector( "isAncestorMultiSelected" ); const getMultiSelectedBlocksStartClientId = getBlockEditorSelector( "getMultiSelectedBlocksStartClientId" ); const getMultiSelectedBlocksEndClientId = getBlockEditorSelector( "getMultiSelectedBlocksEndClientId" ); const getBlockOrder = getBlockEditorSelector("getBlockOrder"); const getBlockIndex = getBlockEditorSelector("getBlockIndex"); const isBlockSelected = getBlockEditorSelector("isBlockSelected"); const hasSelectedInnerBlock = getBlockEditorSelector( "hasSelectedInnerBlock" ); const isBlockWithinSelection = getBlockEditorSelector( "isBlockWithinSelection" ); const hasMultiSelection = getBlockEditorSelector("hasMultiSelection"); const isMultiSelecting = getBlockEditorSelector("isMultiSelecting"); const isSelectionEnabled = getBlockEditorSelector("isSelectionEnabled"); const getBlockMode = getBlockEditorSelector("getBlockMode"); const isTyping = getBlockEditorSelector("isTyping"); const isCaretWithinFormattedText = getBlockEditorSelector( "isCaretWithinFormattedText" ); const getBlockInsertionPoint = getBlockEditorSelector( "getBlockInsertionPoint" ); const isBlockInsertionPointVisible = getBlockEditorSelector( "isBlockInsertionPointVisible" ); const isValidTemplate = getBlockEditorSelector("isValidTemplate"); const getTemplate = getBlockEditorSelector("getTemplate"); const getTemplateLock = getBlockEditorSelector("getTemplateLock"); const canInsertBlockType = getBlockEditorSelector("canInsertBlockType"); const getInserterItems = getBlockEditorSelector("getInserterItems"); const hasInserterItems = getBlockEditorSelector("hasInserterItems"); const getBlockListSettings = getBlockEditorSelector( "getBlockListSettings" ); const __experimentalGetDefaultTemplateTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => () => { external_wp_deprecated_default()( "select('core/editor').__experimentalGetDefaultTemplateTypes", { since: "6.8", alternative: "select('core/core-data').getCurrentTheme()?.default_template_types" } ); return select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_types; } ); const __experimentalGetDefaultTemplatePartAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)(() => { external_wp_deprecated_default()( "select('core/editor').__experimentalGetDefaultTemplatePartAreas", { since: "6.8", alternative: "select('core/core-data').getCurrentTheme()?.default_template_part_areas" } ); const areas = select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || []; return areas.map((item) => { return { ...item, icon: getTemplatePartIcon(item.icon) }; }); }) ); const __experimentalGetDefaultTemplateType = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)((state, slug) => { external_wp_deprecated_default()( "select('core/editor').__experimentalGetDefaultTemplateType", { since: "6.8" } ); const templateTypes = select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_types; if (!templateTypes) { return selectors_EMPTY_OBJECT; } return Object.values(templateTypes).find( (type) => type.slug === slug ) ?? selectors_EMPTY_OBJECT; }) ); const __experimentalGetTemplateInfo = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)((state, template) => { external_wp_deprecated_default()("select('core/editor').__experimentalGetTemplateInfo", { since: "6.8" }); if (!template) { return selectors_EMPTY_OBJECT; } const currentTheme = select(external_wp_coreData_namespaceObject.store).getCurrentTheme(); const templateTypes = currentTheme?.default_template_types || []; const templateAreas = currentTheme?.default_template_part_areas || []; return getTemplateInfo({ template, templateAreas, templateTypes }); }) ); const getPostTypeLabel = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state) => { const currentPostType = getCurrentPostType(state); const postType = select(external_wp_coreData_namespaceObject.store).getPostType(currentPostType); return postType?.labels?.singular_name; } ); function isPublishSidebarOpened(state) { return state.publishSidebarActive; } ;// external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// external ["wp","apiFetch"] const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// external ["wp","notices"] const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// ./node_modules/@wordpress/editor/build-module/store/local-autosave.js function postKey(postId, isPostNew) { return `wp-autosave-block-editor-post-${isPostNew ? "auto-draft" : postId}`; } function localAutosaveGet(postId, isPostNew) { return window.sessionStorage.getItem(postKey(postId, isPostNew)); } function localAutosaveSet(postId, isPostNew, title, content, excerpt) { window.sessionStorage.setItem( postKey(postId, isPostNew), JSON.stringify({ post_title: title, content, excerpt }) ); } function localAutosaveClear(postId, isPostNew) { window.sessionStorage.removeItem(postKey(postId, isPostNew)); } ;// ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js function getNotificationArgumentsForSaveSuccess(data) { const { previousPost, post, postType } = data; if (data.options?.isAutosave) { return []; } const publishStatus = ["publish", "private", "future"]; const isPublished = publishStatus.includes(previousPost.status); const willPublish = publishStatus.includes(post.status); const willTrash = post.status === "trash" && previousPost.status !== "trash"; let noticeMessage; let shouldShowLink = postType?.viewable ?? false; let isDraft; if (willTrash) { noticeMessage = postType.labels.item_trashed; shouldShowLink = false; } else if (!isPublished && !willPublish) { noticeMessage = (0,external_wp_i18n_namespaceObject.__)("Draft saved."); isDraft = true; } else if (isPublished && !willPublish) { noticeMessage = postType.labels.item_reverted_to_draft; shouldShowLink = false; } else if (!isPublished && willPublish) { noticeMessage = { publish: postType.labels.item_published, private: postType.labels.item_published_privately, future: postType.labels.item_scheduled }[post.status]; } else { noticeMessage = postType.labels.item_updated; } const actions = []; if (shouldShowLink) { actions.push({ label: isDraft ? (0,external_wp_i18n_namespaceObject.__)("View Preview") : postType.labels.view_item, url: post.link, openInNewTab: true }); } return [ noticeMessage, { id: "editor-save", type: "snackbar", actions } ]; } function getNotificationArgumentsForSaveFail(data) { const { post, edits, error } = data; if (error && "rest_autosave_no_changes" === error.code) { return []; } const publishStatus = ["publish", "private", "future"]; const isPublished = publishStatus.indexOf(post.status) !== -1; if (error.code === "offline_error") { const messages2 = { publish: (0,external_wp_i18n_namespaceObject.__)("Publishing failed because you were offline."), private: (0,external_wp_i18n_namespaceObject.__)("Publishing failed because you were offline."), future: (0,external_wp_i18n_namespaceObject.__)("Scheduling failed because you were offline."), default: (0,external_wp_i18n_namespaceObject.__)("Updating failed because you were offline.") }; const noticeMessage2 = !isPublished && edits.status in messages2 ? messages2[edits.status] : messages2.default; return [noticeMessage2, { id: "editor-save" }]; } const messages = { publish: (0,external_wp_i18n_namespaceObject.__)("Publishing failed."), private: (0,external_wp_i18n_namespaceObject.__)("Publishing failed."), future: (0,external_wp_i18n_namespaceObject.__)("Scheduling failed."), default: (0,external_wp_i18n_namespaceObject.__)("Updating failed.") }; let noticeMessage = !isPublished && edits.status in messages ? messages[edits.status] : messages.default; if (error.message && !/<\/?[^>]*>/.test(error.message)) { noticeMessage = [noticeMessage, error.message].join(" "); } return [ noticeMessage, { id: "editor-save" } ]; } function getNotificationArgumentsForTrashFail(data) { return [ data.error.message && data.error.code !== "unknown_error" ? data.error.message : (0,external_wp_i18n_namespaceObject.__)("Trashing failed"), { id: "editor-trash-fail" } ]; } ;// ./node_modules/@wordpress/editor/build-module/store/actions.js const setupEditor = (post, edits, template) => ({ dispatch }) => { dispatch.setEditedPost(post.type, post.id); const isNewPost = post.status === "auto-draft"; if (isNewPost && template) { let content; if ("content" in edits) { content = edits.content; } else { content = post.content.raw; } let blocks = (0,external_wp_blocks_namespaceObject.parse)(content); blocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template); dispatch.resetEditorBlocks(blocks, { __unstableShouldCreateUndoLevel: false }); } if (edits && Object.values(edits).some( ([key, edit]) => edit !== (post[key]?.raw ?? post[key]) )) { dispatch.editPost(edits); } }; function __experimentalTearDownEditor() { external_wp_deprecated_default()( "wp.data.dispatch( 'core/editor' ).__experimentalTearDownEditor", { since: "6.5" } ); return { type: "DO_NOTHING" }; } function resetPost() { external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).resetPost", { since: "6.0", version: "6.3", alternative: "Initialize the editor with the setupEditorState action" }); return { type: "DO_NOTHING" }; } function updatePost() { external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", { since: "5.7", alternative: "Use the core entities store instead" }); return { type: "DO_NOTHING" }; } function setupEditorState(post) { external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).setupEditorState", { since: "6.5", alternative: "wp.data.dispatch( 'core/editor' ).setEditedPost" }); return setEditedPost(post.type, post.id); } function setEditedPost(postType, postId) { return { type: "SET_EDITED_POST", postType, postId }; } const editPost = (edits, options) => ({ select, registry }) => { const { id, type } = select.getCurrentPost(); registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord("postType", type, id, edits, options); }; const savePost = (options = {}) => async ({ select, dispatch, registry }) => { if (!select.isEditedPostSaveable()) { return; } const content = select.getEditedPostContent(); if (!options.isAutosave) { dispatch.editPost({ content }, { undoIgnore: true }); } const previousRecord = select.getCurrentPost(); let edits = { id: previousRecord.id, ...registry.select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits( "postType", previousRecord.type, previousRecord.id ), content }; dispatch({ type: "REQUEST_POST_UPDATE_START", options }); let error = false; try { edits = await (0,external_wp_hooks_namespaceObject.applyFiltersAsync)( "editor.preSavePost", edits, options ); } catch (err) { error = err; } if (!error) { try { await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord( "postType", previousRecord.type, edits, options ); } catch (err) { error = err.message && err.code !== "unknown_error" ? err.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while updating."); } } if (!error) { error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError( "postType", previousRecord.type, previousRecord.id ); } if (!error) { try { await (0,external_wp_hooks_namespaceObject.applyFilters)( "editor.__unstableSavePost", Promise.resolve(), options ); } catch (err) { error = err; } } if (!error) { try { await (0,external_wp_hooks_namespaceObject.doActionAsync)( "editor.savePost", { id: previousRecord.id }, options ); } catch (err) { error = err; } } dispatch({ type: "REQUEST_POST_UPDATE_FINISH", options }); if (error) { const args = getNotificationArgumentsForSaveFail({ post: previousRecord, edits, error }); if (args.length) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...args); } } else { const updatedRecord = select.getCurrentPost(); const args = getNotificationArgumentsForSaveSuccess({ previousPost: previousRecord, post: updatedRecord, postType: await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(updatedRecord.type), options }); if (args.length) { registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(...args); } if (!options.isAutosave) { registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent(); } } }; function refreshPost() { external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).refreshPost", { since: "6.0", version: "6.3", alternative: "Use the core entities store instead" }); return { type: "DO_NOTHING" }; } const trashPost = () => async ({ select, dispatch, registry }) => { const postTypeSlug = select.getCurrentPostType(); const postType = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); const { rest_base: restBase, rest_namespace: restNamespace = "wp/v2" } = postType; dispatch({ type: "REQUEST_POST_DELETE_START" }); try { const post = select.getCurrentPost(); await external_wp_apiFetch_default()({ path: `/${restNamespace}/${restBase}/${post.id}`, method: "DELETE" }); await dispatch.savePost(); } catch (error) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice( ...getNotificationArgumentsForTrashFail({ error }) ); } dispatch({ type: "REQUEST_POST_DELETE_FINISH" }); }; const autosave = ({ local = false, ...options } = {}) => async ({ select, dispatch }) => { const post = select.getCurrentPost(); if (post.type === "wp_template") { return; } if (local) { const isPostNew = select.isEditedPostNew(); const title = select.getEditedPostAttribute("title"); const content = select.getEditedPostAttribute("content"); const excerpt = select.getEditedPostAttribute("excerpt"); localAutosaveSet(post.id, isPostNew, title, content, excerpt); } else { await dispatch.savePost({ isAutosave: true, ...options }); } }; const __unstableSaveForPreview = ({ forceIsAutosaveable } = {}) => async ({ select, dispatch }) => { if ((forceIsAutosaveable || select.isEditedPostAutosaveable()) && !select.isPostLocked()) { const isDraft = ["draft", "auto-draft"].includes( select.getEditedPostAttribute("status") ); if (isDraft) { await dispatch.savePost({ isPreview: true }); } else { await dispatch.autosave({ isPreview: true }); } } return select.getEditedPostPreviewLink(); }; const redo = () => ({ registry }) => { registry.dispatch(external_wp_coreData_namespaceObject.store).redo(); }; const undo = () => ({ registry }) => { registry.dispatch(external_wp_coreData_namespaceObject.store).undo(); }; function createUndoLevel() { external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).createUndoLevel", { since: "6.0", version: "6.3", alternative: "Use the core entities store instead" }); return { type: "DO_NOTHING" }; } function updatePostLock(lock) { return { type: "UPDATE_POST_LOCK", lock }; } const enablePublishSidebar = () => ({ registry }) => { registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "isPublishSidebarEnabled", true); }; const disablePublishSidebar = () => ({ registry }) => { registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "isPublishSidebarEnabled", false); }; function lockPostSaving(lockName) { return { type: "LOCK_POST_SAVING", lockName }; } function unlockPostSaving(lockName) { return { type: "UNLOCK_POST_SAVING", lockName }; } function lockPostAutosaving(lockName) { return { type: "LOCK_POST_AUTOSAVING", lockName }; } function unlockPostAutosaving(lockName) { return { type: "UNLOCK_POST_AUTOSAVING", lockName }; } const resetEditorBlocks = (blocks, options = {}) => ({ select, dispatch, registry }) => { const { __unstableShouldCreateUndoLevel, selection } = options; const edits = { blocks, selection }; if (__unstableShouldCreateUndoLevel !== false) { const { id, type } = select.getCurrentPost(); const noChange = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord("postType", type, id).blocks === edits.blocks; if (noChange) { registry.dispatch(external_wp_coreData_namespaceObject.store).__unstableCreateUndoLevel("postType", type, id); return; } edits.content = ({ blocks: blocksForSerialization = [] }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); } dispatch.editPost(edits); }; function updateEditorSettings(settings) { return { type: "UPDATE_EDITOR_SETTINGS", settings }; } const setRenderingMode = (mode) => ({ dispatch, registry, select }) => { if (select.__unstableIsEditorReady()) { registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); dispatch.editPost({ selection: void 0 }, { undoIgnore: true }); } dispatch({ type: "SET_RENDERING_MODE", mode }); }; function setDeviceType(deviceType) { return { type: "SET_DEVICE_TYPE", deviceType }; } const toggleEditorPanelEnabled = (panelName) => ({ registry }) => { const inactivePanels = registry.select(external_wp_preferences_namespaceObject.store).get("core", "inactivePanels") ?? []; const isPanelInactive = !!inactivePanels?.includes(panelName); let updatedInactivePanels; if (isPanelInactive) { updatedInactivePanels = inactivePanels.filter( (invactivePanelName) => invactivePanelName !== panelName ); } else { updatedInactivePanels = [...inactivePanels, panelName]; } registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "inactivePanels", updatedInactivePanels); }; const toggleEditorPanelOpened = (panelName) => ({ registry }) => { const openPanels = registry.select(external_wp_preferences_namespaceObject.store).get("core", "openPanels") ?? []; const isPanelOpen = !!openPanels?.includes(panelName); let updatedOpenPanels; if (isPanelOpen) { updatedOpenPanels = openPanels.filter( (openPanelName) => openPanelName !== panelName ); } else { updatedOpenPanels = [...openPanels, panelName]; } registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "openPanels", updatedOpenPanels); }; function removeEditorPanel(panelName) { return { type: "REMOVE_PANEL", panelName }; } const setIsInserterOpened = (value) => ({ dispatch, registry }) => { if (typeof value === "object" && value.hasOwnProperty("rootClientId") && value.hasOwnProperty("insertionIndex")) { unlock(registry.dispatch(external_wp_blockEditor_namespaceObject.store)).setInsertionPoint({ rootClientId: value.rootClientId, index: value.insertionIndex }); } dispatch({ type: "SET_IS_INSERTER_OPENED", value }); }; function setIsListViewOpened(isOpen) { return { type: "SET_IS_LIST_VIEW_OPENED", isOpen }; } const toggleDistractionFree = ({ createNotice = true } = {}) => ({ dispatch, registry }) => { const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get("core", "distractionFree"); if (isDistractionFree) { registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "fixedToolbar", false); } if (!isDistractionFree) { registry.batch(() => { registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "fixedToolbar", true); dispatch.setIsInserterOpened(false); dispatch.setIsListViewOpened(false); unlock( registry.dispatch(external_wp_blockEditor_namespaceObject.store) ).resetZoomLevel(); }); } registry.batch(() => { registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "distractionFree", !isDistractionFree); if (createNotice) { registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice( isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)("Distraction free mode deactivated.") : (0,external_wp_i18n_namespaceObject.__)("Distraction free mode activated."), { id: "core/editor/distraction-free-mode/notice", type: "snackbar", actions: [ { label: (0,external_wp_i18n_namespaceObject.__)("Undo"), onClick: () => { registry.batch(() => { registry.dispatch(external_wp_preferences_namespaceObject.store).set( "core", "fixedToolbar", isDistractionFree ); registry.dispatch(external_wp_preferences_namespaceObject.store).toggle( "core", "distractionFree" ); }); } } ] } ); } }); }; const toggleSpotlightMode = () => ({ registry }) => { registry.dispatch(external_wp_preferences_namespaceObject.store).toggle("core", "focusMode"); const isFocusMode = registry.select(external_wp_preferences_namespaceObject.store).get("core", "focusMode"); registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice( isFocusMode ? (0,external_wp_i18n_namespaceObject.__)("Spotlight mode activated.") : (0,external_wp_i18n_namespaceObject.__)("Spotlight mode deactivated."), { id: "core/editor/toggle-spotlight-mode/notice", type: "snackbar", actions: [ { label: (0,external_wp_i18n_namespaceObject.__)("Undo"), onClick: () => { registry.dispatch(external_wp_preferences_namespaceObject.store).toggle("core", "focusMode"); } } ] } ); }; const toggleTopToolbar = () => ({ registry }) => { registry.dispatch(external_wp_preferences_namespaceObject.store).toggle("core", "fixedToolbar"); const isTopToolbar = registry.select(external_wp_preferences_namespaceObject.store).get("core", "fixedToolbar"); registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice( isTopToolbar ? (0,external_wp_i18n_namespaceObject.__)("Top toolbar activated.") : (0,external_wp_i18n_namespaceObject.__)("Top toolbar deactivated."), { id: "core/editor/toggle-top-toolbar/notice", type: "snackbar", actions: [ { label: (0,external_wp_i18n_namespaceObject.__)("Undo"), onClick: () => { registry.dispatch(external_wp_preferences_namespaceObject.store).toggle("core", "fixedToolbar"); } } ] } ); }; const switchEditorMode = (mode) => ({ dispatch, registry }) => { registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "editorMode", mode); if (mode !== "visual") { registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); unlock(registry.dispatch(external_wp_blockEditor_namespaceObject.store)).resetZoomLevel(); } if (mode === "visual") { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("Visual editor selected"), "assertive"); } else if (mode === "text") { const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get("core", "distractionFree"); if (isDistractionFree) { dispatch.toggleDistractionFree(); } (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("Code editor selected"), "assertive"); } }; function openPublishSidebar() { return { type: "OPEN_PUBLISH_SIDEBAR" }; } function closePublishSidebar() { return { type: "CLOSE_PUBLISH_SIDEBAR" }; } function togglePublishSidebar() { return { type: "TOGGLE_PUBLISH_SIDEBAR" }; } const getBlockEditorAction = (name) => (...args) => ({ registry }) => { external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + "`", { since: "5.3", alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + "`", version: "6.2" }); registry.dispatch(external_wp_blockEditor_namespaceObject.store)[name](...args); }; const resetBlocks = getBlockEditorAction("resetBlocks"); const receiveBlocks = getBlockEditorAction("receiveBlocks"); const updateBlock = getBlockEditorAction("updateBlock"); const updateBlockAttributes = getBlockEditorAction( "updateBlockAttributes" ); const selectBlock = getBlockEditorAction("selectBlock"); const startMultiSelect = getBlockEditorAction("startMultiSelect"); const stopMultiSelect = getBlockEditorAction("stopMultiSelect"); const multiSelect = getBlockEditorAction("multiSelect"); const clearSelectedBlock = getBlockEditorAction("clearSelectedBlock"); const toggleSelection = getBlockEditorAction("toggleSelection"); const replaceBlocks = getBlockEditorAction("replaceBlocks"); const replaceBlock = getBlockEditorAction("replaceBlock"); const moveBlocksDown = getBlockEditorAction("moveBlocksDown"); const moveBlocksUp = getBlockEditorAction("moveBlocksUp"); const moveBlockToPosition = getBlockEditorAction( "moveBlockToPosition" ); const insertBlock = getBlockEditorAction("insertBlock"); const insertBlocks = getBlockEditorAction("insertBlocks"); const showInsertionPoint = getBlockEditorAction("showInsertionPoint"); const hideInsertionPoint = getBlockEditorAction("hideInsertionPoint"); const setTemplateValidity = getBlockEditorAction( "setTemplateValidity" ); const synchronizeTemplate = getBlockEditorAction( "synchronizeTemplate" ); const mergeBlocks = getBlockEditorAction("mergeBlocks"); const removeBlocks = getBlockEditorAction("removeBlocks"); const removeBlock = getBlockEditorAction("removeBlock"); const toggleBlockMode = getBlockEditorAction("toggleBlockMode"); const startTyping = getBlockEditorAction("startTyping"); const stopTyping = getBlockEditorAction("stopTyping"); const enterFormattedText = getBlockEditorAction("enterFormattedText"); const exitFormattedText = getBlockEditorAction("exitFormattedText"); const insertDefaultBlock = getBlockEditorAction("insertDefaultBlock"); const updateBlockListSettings = getBlockEditorAction( "updateBlockListSettings" ); ;// external ["wp","htmlEntities"] const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; ;// ./node_modules/@wordpress/editor/build-module/store/utils/is-template-revertable.js function isTemplateRevertable(templateOrTemplatePart) { if (!templateOrTemplatePart) { return false; } return templateOrTemplatePart.source === TEMPLATE_ORIGINS.custom && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file); } ;// ./node_modules/@wordpress/icons/build-module/library/external.js var external_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.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" }) }); ;// ./node_modules/@wordpress/fields/build-module/actions/view-post.js const viewPost = { id: "view-post", label: (0,external_wp_i18n_namespaceObject._x)("View", "verb"), isPrimary: true, icon: external_default, isEligible(post) { return post.status !== "trash"; }, callback(posts, { onActionPerformed }) { const post = posts[0]; window.open(post?.link, "_blank"); if (onActionPerformed) { onActionPerformed(posts); } } }; var view_post_default = viewPost; ;// ./node_modules/@wordpress/fields/build-module/actions/view-post-revisions.js const viewPostRevisions = { id: "view-post-revisions", context: "list", label(items) { const revisionsCount = items[0]._links?.["version-history"]?.[0]?.count ?? 0; return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of revisions. */ (0,external_wp_i18n_namespaceObject.__)("View revisions (%d)"), revisionsCount ); }, isEligible(post) { if (post.status === "trash") { return false; } const lastRevisionId = post?._links?.["predecessor-version"]?.[0]?.id ?? null; const revisionsCount = post?._links?.["version-history"]?.[0]?.count ?? 0; return !!lastRevisionId && revisionsCount > 1; }, callback(posts, { onActionPerformed }) { const post = posts[0]; const href = (0,external_wp_url_namespaceObject.addQueryArgs)("revision.php", { revision: post?._links?.["predecessor-version"]?.[0]?.id }); document.location.href = href; if (onActionPerformed) { onActionPerformed(posts); } } }; var view_post_revisions_default = viewPostRevisions; ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// ./node_modules/@wordpress/icons/build-module/library/check.js var check_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) }); ;// ./node_modules/tslib/tslib.es6.mjs /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { 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); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { 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; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 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]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 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; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; 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); 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); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 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"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 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"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* harmony default export */ const tslib_es6 = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); ;// ./node_modules/lower-case/dist.es2015/index.js /** * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt */ var SUPPORTED_LOCALE = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, az: { regexp: /\u0130/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, lt: { regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, map: { I: "\u0069\u0307", J: "\u006A\u0307", Į: "\u012F\u0307", Ì: "\u0069\u0307\u0300", Í: "\u0069\u0307\u0301", Ĩ: "\u0069\u0307\u0303", }, }, }; /** * Localized lower case. */ function localeLowerCase(str, locale) { var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; if (lang) return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); return lowerCase(str); } /** * Lower case as a function. */ function lowerCase(str) { return str.toLowerCase(); } ;// ./node_modules/no-case/dist.es2015/index.js // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; /** * Normalize the string into something other libraries can manipulate easier. */ function noCase(input, options) { if (options === void 0) { options = {}; } 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; var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; // Trim the delimiter from around the output string. while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; // Transform each token independently. return result.slice(start, end).split("\0").map(transform).join(delimiter); } /** * Replace `re` in the input string with the replacement value. */ function replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } ;// ./node_modules/dot-case/dist.es2015/index.js function dotCase(input, options) { if (options === void 0) { options = {}; } return noCase(input, __assign({ delimiter: "." }, options)); } ;// ./node_modules/param-case/dist.es2015/index.js function paramCase(input, options) { if (options === void 0) { options = {}; } return dotCase(input, __assign({ delimiter: "-" }, options)); } ;// ./node_modules/@wordpress/fields/build-module/components/create-template-part-modal/utils.js const useExistingTemplateParts = () => { return (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecords( "postType", "wp_template_part", { per_page: -1 } ), [] ) ?? []; }; const getUniqueTemplatePartTitle = (title, templateParts) => { const lowercaseTitle = title.toLowerCase(); const existingTitles = templateParts.map( (templatePart) => templatePart.title.rendered.toLowerCase() ); if (!existingTitles.includes(lowercaseTitle)) { return title; } let suffix = 2; while (existingTitles.includes(`${lowercaseTitle} ${suffix}`)) { suffix++; } return `${title} ${suffix}`; }; const getCleanTemplatePartSlug = (title) => { return paramCase(title).replace(/[^\w-]+/g, "") || "wp-custom-part"; }; ;// ./node_modules/@wordpress/fields/build-module/components/create-template-part-modal/index.js function getAreaRadioId(value, instanceId) { return `fields-create-template-part-modal__area-option-${value}-${instanceId}`; } function getAreaRadioDescriptionId(value, instanceId) { return `fields-create-template-part-modal__area-option-description-${value}-${instanceId}`; } function CreateTemplatePartModal({ modalTitle, ...restProps }) { const defaultModalTitle = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getPostType("wp_template_part")?.labels?.add_new_item, [] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: modalTitle || defaultModalTitle, onRequestClose: restProps.closeModal, overlayClassName: "fields-create-template-part-modal", focusOnMount: "firstContentElement", size: "medium", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModalContents, { ...restProps }) } ); } const create_template_part_modal_getTemplatePartIcon = (iconName) => { if ("header" === iconName) { return header_default; } else if ("footer" === iconName) { return footer_default; } else if ("sidebar" === iconName) { return sidebar_default; } return symbol_filled_default; }; function CreateTemplatePartModalContents({ defaultArea = "uncategorized", blocks = [], confirmLabel = (0,external_wp_i18n_namespaceObject.__)("Add"), closeModal, onCreate, onError, defaultTitle = "" }) { const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const existingTemplateParts = useExistingTemplateParts(); const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(defaultTitle); const [area, setArea] = (0,external_wp_element_namespaceObject.useState)(defaultArea); const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false); const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CreateTemplatePartModal); const defaultTemplatePartAreas = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas, [] ); async function createTemplatePart() { if (!title || isSubmitting) { return; } try { setIsSubmitting(true); const uniqueTitle = getUniqueTemplatePartTitle( title, existingTemplateParts ); const cleanSlug = getCleanTemplatePartSlug(uniqueTitle); const templatePart = await saveEntityRecord( "postType", "wp_template_part", { slug: cleanSlug, title: uniqueTitle, content: (0,external_wp_blocks_namespaceObject.serialize)(blocks), area }, { throwOnError: true } ); await onCreate(templatePart); } catch (error) { const errorMessage = error instanceof Error && "code" in error && error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)( "An error occurred while creating the template part." ); createErrorNotice(errorMessage, { type: "snackbar" }); onError?.(); } finally { setIsSubmitting(false); } } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "form", { onSubmit: async (event) => { event.preventDefault(); await createTemplatePart(); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "4", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Name"), value: title, onChange: setTitle, required: true } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "fields-create-template-part-modal__area-fieldset", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Area") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "fields-create-template-part-modal__area-radio-group", children: (defaultTemplatePartAreas ?? []).map( (item) => { const icon = create_template_part_modal_getTemplatePartIcon(item.icon); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: "fields-create-template-part-modal__area-radio-wrapper", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "input", { type: "radio", id: getAreaRadioId( item.area, instanceId ), name: `fields-create-template-part-modal__area-${instanceId}`, value: item.area, checked: area === item.area, onChange: () => { setArea(item.area); }, "aria-describedby": getAreaRadioDescriptionId( item.area, instanceId ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Icon, { icon, className: "fields-create-template-part-modal__area-radio-icon" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "label", { htmlFor: getAreaRadioId( item.area, instanceId ), className: "fields-create-template-part-modal__area-radio-label", children: item.label } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Icon, { icon: check_default, className: "fields-create-template-part-modal__area-radio-checkmark" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "p", { className: "fields-create-template-part-modal__area-radio-description", id: getAreaRadioDescriptionId( item.area, instanceId ), children: item.description } ) ] }, item.area ); } ) }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { closeModal(); }, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", "aria-disabled": !title || isSubmitting, isBusy: isSubmitting, children: confirmLabel } ) ] }) ] }) } ); } ;// ./node_modules/@wordpress/fields/build-module/actions/utils.js function isTemplate(post) { return post.type === "wp_template"; } function isTemplatePart(post) { return post.type === "wp_template_part"; } function isTemplateOrTemplatePart(p) { return p.type === "wp_template" || p.type === "wp_template_part"; } function getItemTitle(item, fallback = (0,external_wp_i18n_namespaceObject.__)("(no title)")) { let title = ""; if (typeof item.title === "string") { title = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title); } else if (item.title && "rendered" in item.title) { title = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.rendered); } else if (item.title && "raw" in item.title) { title = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.raw); } return title || fallback; } function isTemplateRemovable(template) { if (!template) { return false; } return [template.source, template.source].includes("custom") && !Boolean(template.type === "wp_template" && template?.plugin) && !template.has_theme_file; } ;// ./node_modules/@wordpress/fields/build-module/actions/duplicate-template-part.js const duplicateTemplatePart = { id: "duplicate-template-part", label: (0,external_wp_i18n_namespaceObject._x)("Duplicate", "action label"), isEligible: (item) => item.type === "wp_template_part", modalHeader: (0,external_wp_i18n_namespaceObject._x)("Duplicate template part", "action label"), modalFocusOnMount: "firstContentElement", RenderModal: ({ items, closeModal }) => { const [item] = items; const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { return item.blocks ?? (0,external_wp_blocks_namespaceObject.parse)( typeof item.content === "string" ? item.content : item.content.raw, { __unstableSkipMigrationLogs: true } ); }, [item.content, item.blocks]); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); function onTemplatePartSuccess(templatePart) { createSuccessNotice( (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The new template part's title e.g. 'Call to action (copy)'. (0,external_wp_i18n_namespaceObject._x)('"%s" duplicated.', "template part"), getItemTitle(templatePart) ), { type: "snackbar", id: "edit-site-patterns-success" } ); closeModal?.(); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CreateTemplatePartModalContents, { blocks, defaultArea: item.area, defaultTitle: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Existing template part title */ (0,external_wp_i18n_namespaceObject._x)("%s (Copy)", "template part"), getItemTitle(item) ), onCreate: onTemplatePartSuccess, onError: closeModal, confirmLabel: (0,external_wp_i18n_namespaceObject._x)("Duplicate", "action label"), closeModal: closeModal ?? (() => { }) } ); } }; var duplicate_template_part_default = duplicateTemplatePart; ;// external ["wp","patterns"] const external_wp_patterns_namespaceObject = window["wp"]["patterns"]; ;// ./node_modules/@wordpress/fields/build-module/lock-unlock.js const { lock: lock_unlock_lock, unlock: lock_unlock_unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/fields" ); ;// ./node_modules/@wordpress/fields/build-module/actions/duplicate-pattern.js const { CreatePatternModalContents, useDuplicatePatternProps } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); const duplicatePattern = { id: "duplicate-pattern", label: (0,external_wp_i18n_namespaceObject._x)("Duplicate", "action label"), isEligible: (item) => item.type !== "wp_template_part", modalHeader: (0,external_wp_i18n_namespaceObject._x)("Duplicate pattern", "action label"), modalFocusOnMount: "firstContentElement", RenderModal: ({ items, closeModal }) => { const [item] = items; const duplicatedProps = useDuplicatePatternProps({ pattern: item, onSuccess: () => closeModal?.() }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CreatePatternModalContents, { onClose: closeModal, confirmLabel: (0,external_wp_i18n_namespaceObject._x)("Duplicate", "action label"), ...duplicatedProps } ); } }; var duplicate_pattern_default = duplicatePattern; ;// ./node_modules/@wordpress/fields/build-module/actions/rename-post.js const { PATTERN_TYPES } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); const renamePost = { id: "rename-post", label: (0,external_wp_i18n_namespaceObject.__)("Rename"), modalFocusOnMount: "firstContentElement", isEligible(post) { if (post.status === "trash") { return false; } if (![ "wp_template", "wp_template_part", ...Object.values(PATTERN_TYPES) ].includes(post.type)) { return post.permissions?.update; } if (isTemplate(post)) { return isTemplateRemovable(post) && post.is_custom && post.permissions?.update; } if (isTemplatePart(post)) { return post.source === "custom" && !post?.has_theme_file && post.permissions?.update; } return post.type === PATTERN_TYPES.user && post.permissions?.update; }, RenderModal: ({ items, closeModal, onActionPerformed }) => { const [item] = items; const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(() => getItemTitle(item, "")); const { editEntityRecord, saveEditedEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); async function onRename(event) { event.preventDefault(); try { await editEntityRecord("postType", item.type, item.id, { title }); setTitle(""); closeModal?.(); await saveEditedEntityRecord("postType", item.type, item.id, { throwOnError: true }); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Name updated"), { type: "snackbar" }); onActionPerformed?.(items); } catch (error) { const typedError = error; const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while updating the name"); createErrorNotice(errorMessage, { type: "snackbar" }); } } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onRename, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Name"), value: title, onChange: setTitle, required: true } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { closeModal?.(); }, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", children: (0,external_wp_i18n_namespaceObject.__)("Save") } ) ] }) ] }) }); } }; var rename_post_default = renamePost; ;// ./node_modules/@wordpress/fields/build-module/actions/reorder-page.js function isItemValid(item) { return typeof item.menu_order === "number" && Number.isInteger(item.menu_order); } function ReorderModal({ items, closeModal, onActionPerformed }) { const [item, setItem] = (0,external_wp_element_namespaceObject.useState)(items[0]); const { editEntityRecord, saveEditedEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const isValid = isItemValid(item); async function onOrder(event) { event.preventDefault(); if (!isValid) { return; } try { await editEntityRecord("postType", item.type, item.id, { menu_order: item.menu_order }); closeModal?.(); await saveEditedEntityRecord("postType", item.type, item.id, { throwOnError: true }); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Order updated."), { type: "snackbar" }); onActionPerformed?.(items); } catch (error) { const typedError = error; const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while updating the order"); createErrorNotice(errorMessage, { type: "snackbar" }); } } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onOrder, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: (0,external_wp_i18n_namespaceObject.__)( "Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalInputControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Order"), type: "number", value: typeof item.menu_order === "number" && Number.isInteger(item.menu_order) ? String(item.menu_order) : "", onChange: (value) => { const parsed = parseInt(value, 10); setItem({ ...item, menu_order: isNaN(parsed) ? void 0 : parsed }); } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { closeModal?.(); }, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", accessibleWhenDisabled: true, disabled: !isValid, children: (0,external_wp_i18n_namespaceObject.__)("Save") } ) ] }) ] }) }); } const reorderPage = { id: "order-pages", label: (0,external_wp_i18n_namespaceObject.__)("Order"), isEligible({ status }) { return status !== "trash"; }, modalFocusOnMount: "firstContentElement", RenderModal: ReorderModal }; var reorder_page_default = reorderPage; ;// ./node_modules/client-zip/index.js "stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,n,t){const i=Number(0xffffffffn&n),r=Number(n>>32n);this.setUint32(e+(t?0:4),i,t),this.setUint32(e+(t?4:0),r,t)}});var e=e=>new DataView(new ArrayBuffer(e)),n=e=>new Uint8Array(e.buffer||e),t=e=>(new TextEncoder).encode(String(e)),i=e=>Math.min(4294967295,Number(e)),r=e=>Math.min(65535,Number(e));function o(e,i,r){void 0===i||i instanceof Date||(i=new Date(i));const o=void 0!==e;if(r||(r=o?436:509),e instanceof File)return{isFile:o,t:i||new Date(e.lastModified),bytes:e.stream(),mode:r};if(e instanceof Response)return{isFile:o,t:i||new Date(e.headers.get("Last-Modified")||Date.now()),bytes:e.body,mode:r};if(void 0===i)i=new Date;else if(isNaN(i))throw new Error("Invalid modification date.");if(!o)return{isFile:o,t:i,mode:r};if("string"==typeof e)return{isFile:o,t:i,bytes:t(e),mode:r};if(e instanceof Blob)return{isFile:o,t:i,bytes:e.stream(),mode:r};if(e instanceof Uint8Array||e instanceof ReadableStream)return{isFile:o,t:i,bytes:e,mode:r};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{isFile:o,t:i,bytes:n(e),mode:r};if(Symbol.asyncIterator in e)return{isFile:o,t:i,bytes:f(e[Symbol.asyncIterator]()),mode:r};throw new TypeError("Unsupported input format.")}function f(e,n=e){return new ReadableStream({async pull(n){let t=0;for(;n.desiredSize>t;){const i=await e.next();if(!i.value){n.close();break}{const e=a(i.value);n.enqueue(e),t+=e.byteLength}}},cancel(e){n.throw?.(e)}})}function a(e){return"string"==typeof e?t(e):e instanceof Uint8Array?e:n(e)}function s(e,i,r){let[o,f]=function(e){return e?e instanceof Uint8Array?[e,1]:ArrayBuffer.isView(e)||e instanceof ArrayBuffer?[n(e),1]:[t(e),0]:[void 0,0]}(i);if(e instanceof File)return{i:d(o||t(e.name)),o:BigInt(e.size),u:f};if(e instanceof Response){const n=e.headers.get("content-disposition"),i=n&&n.match(/;\s*filename\*?\s*=\s*(?:UTF-\d+''|)["']?([^;"'\r\n]*)["']?(?:;|$)/i),a=i&&i[1]||e.url&&new URL(e.url).pathname.split("/").findLast(Boolean),s=a&&decodeURIComponent(a),u=r||+e.headers.get("content-length");return{i:d(o||t(s)),o:BigInt(u),u:f}}return o=d(o,void 0!==e||void 0!==r),"string"==typeof e?{i:o,o:BigInt(t(e).length),u:f}:e instanceof Blob?{i:o,o:BigInt(e.size),u:f}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{i:o,o:BigInt(e.byteLength),u:f}:{i:o,o:u(e,r),u:f}}function u(e,n){return n>-1?BigInt(n):e?void 0:0n}function d(e,n=1){if(!e||e.every((c=>47===c)))throw new Error("The file must have a name.");if(n)for(;47===e[e.length-1];)e=e.subarray(0,-1);else 47!==e[e.length-1]&&(e=new Uint8Array([...e,47]));return e}var l=new Uint32Array(256);for(let e=0;e<256;++e){let n=e;for(let e=0;e<8;++e)n=n>>>1^(1&n&&3988292384);l[e]=n}function y(e,n=0){n=~n;for(var t=0,i=e.length;t<i;t++)n=n>>>8^l[255&n^e[t]];return~n>>>0}function w(e,n,t=0){const i=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,r=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;n.setUint16(t,i,1),n.setUint16(t+2,r,1)}function B({i:e,u:n},t){return 8*(!n||(t??function(e){try{b.decode(e)}catch{return 0}return 1}(e)))}var b=new TextDecoder("utf8",{fatal:1});function p(t,i=0){const r=e(30);return r.setUint32(0,1347093252),r.setUint32(4,754976768|i),w(t.t,r,10),r.setUint16(26,t.i.length,1),n(r)}async function*g(e){let{bytes:n}=e;if("then"in n&&(n=await n),n instanceof Uint8Array)yield n,e.l=y(n,0),e.o=BigInt(n.length);else{e.o=0n;const t=n.getReader();for(;;){const{value:n,done:i}=await t.read();if(i)break;e.l=y(n,e.l),e.o+=BigInt(n.length),yield n}}}function I(t,r){const o=e(16+(r?8:0));return o.setUint32(0,1347094280),o.setUint32(4,t.isFile?t.l:0,1),r?(o.setBigUint64(8,t.o,1),o.setBigUint64(16,t.o,1)):(o.setUint32(8,i(t.o),1),o.setUint32(12,i(t.o),1)),n(o)}function v(t,r,o=0,f=0){const a=e(46);return a.setUint32(0,1347092738),a.setUint32(4,755182848),a.setUint16(8,2048|o),w(t.t,a,12),a.setUint32(16,t.isFile?t.l:0,1),a.setUint32(20,i(t.o),1),a.setUint32(24,i(t.o),1),a.setUint16(28,t.i.length,1),a.setUint16(30,f,1),a.setUint16(40,t.mode|(t.isFile?32768:16384),1),a.setUint32(42,i(r),1),n(a)}function h(t,i,r){const o=e(r);return o.setUint16(0,1,1),o.setUint16(2,r-4,1),16&r&&(o.setBigUint64(4,t.o,1),o.setBigUint64(12,t.o,1)),o.setBigUint64(r-8,i,1),n(o)}function D(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified,e.mode]]}var S=e=>function(e){let n=BigInt(22),t=0n,i=0;for(const r of e){if(!r.i)throw new Error("Every file must have a non-empty name.");if(void 0===r.o)throw new Error(`Missing size for file "${(new TextDecoder).decode(r.i)}".`);const e=r.o>=0xffffffffn,o=t>=0xffffffffn;t+=BigInt(46+r.i.length+(e&&8))+r.o,n+=BigInt(r.i.length+46+(12*o|28*e)),i||(i=e)}return(i||t>=0xffffffffn)&&(n+=BigInt(76)),n+t}(function*(e){for(const n of e)yield s(...D(n)[0])}(e));function A(e,n={}){const t={"Content-Type":"application/zip","Content-Disposition":"attachment"};return("bigint"==typeof n.length||Number.isInteger(n.length))&&n.length>0&&(t["Content-Length"]=String(n.length)),n.metadata&&(t["Content-Length"]=String(S(n.metadata))),new Response(N(e,n),{headers:t})}function N(t,a={}){const u=function(e){const n=e[Symbol.iterator in e?Symbol.iterator:Symbol.asyncIterator]();return{async next(){const e=await n.next();if(e.done)return e;const[t,i]=D(e.value);return{done:0,value:Object.assign(o(...i),s(...t))}},throw:n.throw?.bind(n),[Symbol.asyncIterator](){return this}}}(t);return f(async function*(t,o){const f=[];let a=0n,s=0n,u=0;for await(const e of t){const n=B(e,o.buffersAreUTF8);yield p(e,n),yield new Uint8Array(e.i),e.isFile&&(yield*g(e));const t=e.o>=0xffffffffn,i=12*(a>=0xffffffffn)|28*t;yield I(e,t),f.push(v(e,a,n,i)),f.push(e.i),i&&f.push(h(e,a,i)),t&&(a+=8n),s++,a+=BigInt(46+e.i.length)+e.o,u||(u=t)}let d=0n;for(const e of f)yield e,d+=BigInt(e.length);if(u||a>=0xffffffffn){const t=e(76);t.setUint32(0,1347094022),t.setBigUint64(4,BigInt(44),1),t.setUint32(12,755182848),t.setBigUint64(24,s,1),t.setBigUint64(32,s,1),t.setBigUint64(40,d,1),t.setBigUint64(48,a,1),t.setUint32(56,1347094023),t.setBigUint64(64,a+d,1),t.setUint32(72,1,1),yield n(t)}const l=e(22);l.setUint32(0,1347093766),l.setUint16(8,r(s),1),l.setUint16(10,r(s),1),l.setUint32(12,i(d),1),l.setUint32(16,i(a),1),yield n(l)}(u,a),u)} ;// external ["wp","blob"] const external_wp_blob_namespaceObject = window["wp"]["blob"]; ;// ./node_modules/@wordpress/icons/build-module/library/download.js var download_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" }) }); ;// ./node_modules/@wordpress/fields/build-module/actions/export-pattern.js function getJsonFromItem(item) { return JSON.stringify( { __file: item.type, title: getItemTitle(item), content: typeof item.content === "string" ? item.content : item.content?.raw, syncStatus: item.wp_pattern_sync_status }, null, 2 ); } const exportPattern = { id: "export-pattern", label: (0,external_wp_i18n_namespaceObject.__)("Export as JSON"), icon: download_default, supportsBulk: true, isEligible: (item) => item.type === "wp_block", callback: async (items) => { if (items.length === 1) { return (0,external_wp_blob_namespaceObject.downloadBlob)( `${paramCase( getItemTitle(items[0]) || items[0].slug )}.json`, getJsonFromItem(items[0]), "application/json" ); } const nameCount = {}; const filesToZip = items.map((item) => { const name = paramCase(getItemTitle(item) || item.slug); nameCount[name] = (nameCount[name] || 0) + 1; return { name: `${name + (nameCount[name] > 1 ? "-" + (nameCount[name] - 1) : "")}.json`, lastModified: /* @__PURE__ */ new Date(), input: getJsonFromItem(item) }; }); return (0,external_wp_blob_namespaceObject.downloadBlob)( (0,external_wp_i18n_namespaceObject.__)("patterns-export") + ".zip", await A(filesToZip).blob(), "application/zip" ); } }; var export_pattern_default = exportPattern; ;// ./node_modules/@wordpress/icons/build-module/library/backup.js var backup_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" }) }); ;// ./node_modules/@wordpress/fields/build-module/actions/restore-post.js const restorePost = { id: "restore", label: (0,external_wp_i18n_namespaceObject.__)("Restore"), isPrimary: true, icon: backup_default, supportsBulk: true, isEligible(item) { return !isTemplateOrTemplatePart(item) && item.type !== "wp_block" && item.status === "trash" && item.permissions?.update; }, async callback(posts, { registry, onActionPerformed }) { const { createSuccessNotice, createErrorNotice } = registry.dispatch(external_wp_notices_namespaceObject.store); const { editEntityRecord, saveEditedEntityRecord } = registry.dispatch(external_wp_coreData_namespaceObject.store); await Promise.allSettled( posts.map((post) => { return editEntityRecord("postType", post.type, post.id, { status: "draft" }); }) ); const promiseResult = await Promise.allSettled( posts.map((post) => { return saveEditedEntityRecord("postType", post.type, post.id, { throwOnError: true }); }) ); if (promiseResult.every(({ status }) => status === "fulfilled")) { let successMessage; if (posts.length === 1) { successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The number of posts. */ (0,external_wp_i18n_namespaceObject.__)('"%s" has been restored.'), getItemTitle(posts[0]) ); } else if (posts[0].type === "page") { successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: The number of posts. */ (0,external_wp_i18n_namespaceObject.__)("%d pages have been restored."), posts.length ); } else { successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: The number of posts. */ (0,external_wp_i18n_namespaceObject.__)("%d posts have been restored."), posts.length ); } createSuccessNotice(successMessage, { type: "snackbar", id: "restore-post-action" }); if (onActionPerformed) { onActionPerformed(posts); } } else { let errorMessage; if (promiseResult.length === 1) { const typedError = promiseResult[0]; if (typedError.reason?.message) { errorMessage = typedError.reason.message; } else { errorMessage = (0,external_wp_i18n_namespaceObject.__)( "An error occurred while restoring the post." ); } } else { const errorMessages = /* @__PURE__ */ new Set(); const failedPromises = promiseResult.filter( ({ status }) => status === "rejected" ); for (const failedPromise of failedPromises) { const typedError = failedPromise; if (typedError.reason?.message) { errorMessages.add(typedError.reason.message); } } if (errorMessages.size === 0) { errorMessage = (0,external_wp_i18n_namespaceObject.__)( "An error occurred while restoring the posts." ); } else if (errorMessages.size === 1) { errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */ (0,external_wp_i18n_namespaceObject.__)("An error occurred while restoring the posts: %s"), [...errorMessages][0] ); } else { errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */ (0,external_wp_i18n_namespaceObject.__)( "Some errors occurred while restoring the posts: %s" ), [...errorMessages].join(",") ); } } createErrorNotice(errorMessage, { type: "snackbar" }); } } }; var restore_post_default = restorePost; ;// ./node_modules/@wordpress/fields/build-module/actions/reset-post.js const reset_post_isTemplateRevertable = (templateOrTemplatePart) => { if (!templateOrTemplatePart) { return false; } return templateOrTemplatePart.source === "custom" && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file); }; const revertTemplate = async (template, { allowUndo = true } = {}) => { const noticeId = "edit-site-template-reverted"; (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).removeNotice(noticeId); if (!reset_post_isTemplateRevertable(template)) { (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice( (0,external_wp_i18n_namespaceObject.__)("This template is not revertable."), { type: "snackbar" } ); return; } try { const templateEntityConfig = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store).getEntityConfig( "postType", template.type ); if (!templateEntityConfig) { (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice( (0,external_wp_i18n_namespaceObject.__)( "The editor has encountered an unexpected error. Please reload." ), { type: "snackbar" } ); return; } const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)( `${templateEntityConfig.baseURL}/${template.id}`, { context: "edit", source: template.origin } ); const fileTemplate = await external_wp_apiFetch_default()({ path: fileTemplatePath }); if (!fileTemplate) { (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice( (0,external_wp_i18n_namespaceObject.__)( "The editor has encountered an unexpected error. Please reload." ), { type: "snackbar" } ); return; } const serializeBlocks = ({ blocks: blocksForSerialization = [] }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); const edited = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( "postType", template.type, template.id ); (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store).editEntityRecord( "postType", template.type, template.id, { content: serializeBlocks, // Required to make the `undo` behave correctly. blocks: edited.blocks, // Required to revert the blocks in the editor. source: "custom" // required to avoid turning the editor into a dirty state }, { undoIgnore: true // Required to merge this edit with the last undo level. } ); const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate?.content?.raw); (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store).editEntityRecord( "postType", template.type, fileTemplate.id, { content: serializeBlocks, blocks, source: "theme" } ); if (allowUndo) { const undoRevert = () => { (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store).editEntityRecord( "postType", template.type, edited.id, { content: serializeBlocks, blocks: edited.blocks, source: "custom" } ); }; (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createSuccessNotice( (0,external_wp_i18n_namespaceObject.__)("Template reset."), { type: "snackbar", id: noticeId, actions: [ { label: (0,external_wp_i18n_namespaceObject.__)("Undo"), onClick: undoRevert } ] } ); } } catch (error) { const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("Template revert failed. Please reload."); (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { type: "snackbar" }); } }; const resetPostAction = { id: "reset-post", label: (0,external_wp_i18n_namespaceObject.__)("Reset"), isEligible: (item) => { return isTemplateOrTemplatePart(item) && item?.source === "custom" && (Boolean(item.type === "wp_template" && item?.plugin) || item?.has_theme_file); }, icon: backup_default, supportsBulk: true, hideModalHeader: true, modalFocusOnMount: "firstContentElement", RenderModal: ({ items, closeModal, onActionPerformed }) => { const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); const { saveEditedEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const onConfirm = async () => { try { for (const template of items) { await revertTemplate(template, { allowUndo: false }); await saveEditedEntityRecord( "postType", template.type, template.id ); } createSuccessNotice( items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: The number of items. */ (0,external_wp_i18n_namespaceObject.__)("%d items reset."), items.length ) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The template/part's name. */ (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), getItemTitle(items[0]) ), { type: "snackbar", id: "revert-template-action" } ); } catch (error) { let fallbackErrorMessage; if (items[0].type === "wp_template") { fallbackErrorMessage = items.length === 1 ? (0,external_wp_i18n_namespaceObject.__)( "An error occurred while reverting the template." ) : (0,external_wp_i18n_namespaceObject.__)( "An error occurred while reverting the templates." ); } else { fallbackErrorMessage = items.length === 1 ? (0,external_wp_i18n_namespaceObject.__)( "An error occurred while reverting the template part." ) : (0,external_wp_i18n_namespaceObject.__)( "An error occurred while reverting the template parts." ); } const typedError = error; const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : fallbackErrorMessage; createErrorNotice(errorMessage, { type: "snackbar" }); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Reset to default and clear all customizations?") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: closeModal, disabled: isBusy, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: async () => { setIsBusy(true); await onConfirm(); onActionPerformed?.(items); setIsBusy(false); closeModal?.(); }, isBusy, disabled: isBusy, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)("Reset") } ) ] }) ] }); } }; var reset_post_default = resetPostAction; ;// ./node_modules/@wordpress/icons/build-module/library/trash.js var trash_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/fields/build-module/mutation/index.js function getErrorMessagesFromPromises(allSettledResults) { const errorMessages = /* @__PURE__ */ new Set(); if (allSettledResults.length === 1) { const typedError = allSettledResults[0]; if (typedError.reason?.message) { errorMessages.add(typedError.reason.message); } } else { const failedPromises = allSettledResults.filter( ({ status }) => status === "rejected" ); for (const failedPromise of failedPromises) { const typedError = failedPromise; if (typedError.reason?.message) { errorMessages.add(typedError.reason.message); } } } return errorMessages; } const deletePostWithNotices = async (posts, notice, callbacks) => { const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store); const { deleteEntityRecord } = (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store); const allSettledResults = await Promise.allSettled( posts.map((post) => { return deleteEntityRecord( "postType", post.type, post.id, { force: true }, { throwOnError: true } ); }) ); if (allSettledResults.every(({ status }) => status === "fulfilled")) { let successMessage; if (allSettledResults.length === 1) { successMessage = notice.success.messages.getMessage(posts[0]); } else { successMessage = notice.success.messages.getBatchMessage(posts); } createSuccessNotice(successMessage, { type: notice.success.type ?? "snackbar", id: notice.success.id }); callbacks.onActionPerformed?.(posts); } else { const errorMessages = getErrorMessagesFromPromises(allSettledResults); let errorMessage = ""; if (allSettledResults.length === 1) { errorMessage = notice.error.messages.getMessage(errorMessages); } else { errorMessage = notice.error.messages.getBatchMessage(errorMessages); } createErrorNotice(errorMessage, { type: notice.error.type ?? "snackbar", id: notice.error.id }); callbacks.onActionError?.(); } }; const editPostWithNotices = async (postsWithUpdates, notice, callbacks) => { const { createSuccessNotice, createErrorNotice } = dispatch(noticesStore); const { editEntityRecord, saveEditedEntityRecord } = dispatch(coreStore); await Promise.allSettled( postsWithUpdates.map((post) => { return editEntityRecord( "postType", post.originalPost.type, post.originalPost.id, { ...post.changes } ); }) ); const allSettledResults = await Promise.allSettled( postsWithUpdates.map((post) => { return saveEditedEntityRecord( "postType", post.originalPost.type, post.originalPost.id, { throwOnError: true } ); }) ); if (allSettledResults.every(({ status }) => status === "fulfilled")) { let successMessage; if (allSettledResults.length === 1) { successMessage = notice.success.messages.getMessage( postsWithUpdates[0].originalPost ); } else { successMessage = notice.success.messages.getBatchMessage( postsWithUpdates.map((post) => post.originalPost) ); } createSuccessNotice(successMessage, { type: notice.success.type ?? "snackbar", id: notice.success.id }); callbacks.onActionPerformed?.( postsWithUpdates.map((post) => post.originalPost) ); } else { const errorMessages = getErrorMessagesFromPromises(allSettledResults); let errorMessage = ""; if (allSettledResults.length === 1) { errorMessage = notice.error.messages.getMessage(errorMessages); } else { errorMessage = notice.error.messages.getBatchMessage(errorMessages); } createErrorNotice(errorMessage, { type: notice.error.type ?? "snackbar", id: notice.error.id }); callbacks.onActionError?.(); } }; ;// ./node_modules/@wordpress/fields/build-module/actions/delete-post.js const { PATTERN_TYPES: delete_post_PATTERN_TYPES } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); const deletePostAction = { id: "delete-post", label: (0,external_wp_i18n_namespaceObject.__)("Delete"), isPrimary: true, icon: trash_default, isEligible(post) { if (isTemplateOrTemplatePart(post)) { return isTemplateRemovable(post); } return post.type === delete_post_PATTERN_TYPES.user; }, supportsBulk: true, hideModalHeader: true, modalFocusOnMount: "firstContentElement", RenderModal: ({ items, closeModal, onActionPerformed }) => { const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); const isResetting = items.every( (item) => isTemplateOrTemplatePart(item) && item?.has_theme_file ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: number of items to delete. (0,external_wp_i18n_namespaceObject._n)( "Delete %d item?", "Delete %d items?", items.length ), items.length ) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The template or template part's title (0,external_wp_i18n_namespaceObject._x)('Delete "%s"?', "template part"), getItemTitle(items[0]) ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: closeModal, disabled: isBusy, accessibleWhenDisabled: true, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "primary", onClick: async () => { setIsBusy(true); const notice = { success: { messages: { getMessage: (item) => { return isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The template/part's name. */ (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)( getItemTitle(item) ) ) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The template/part's name. */ (0,external_wp_i18n_namespaceObject._x)( '"%s" deleted.', "template part" ), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)( getItemTitle(item) ) ); }, getBatchMessage: () => { return isResetting ? (0,external_wp_i18n_namespaceObject.__)("Items reset.") : (0,external_wp_i18n_namespaceObject.__)("Items deleted."); } } }, error: { messages: { getMessage: (error) => { if (error.size === 1) { return [...error][0]; } return isResetting ? (0,external_wp_i18n_namespaceObject.__)( "An error occurred while reverting the item." ) : (0,external_wp_i18n_namespaceObject.__)( "An error occurred while deleting the item." ); }, getBatchMessage: (errors) => { if (errors.size === 0) { return isResetting ? (0,external_wp_i18n_namespaceObject.__)( "An error occurred while reverting the items." ) : (0,external_wp_i18n_namespaceObject.__)( "An error occurred while deleting the items." ); } if (errors.size === 1) { return isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */ (0,external_wp_i18n_namespaceObject.__)( "An error occurred while reverting the items: %s" ), [...errors][0] ) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */ (0,external_wp_i18n_namespaceObject.__)( "An error occurred while deleting the items: %s" ), [...errors][0] ); } return isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */ (0,external_wp_i18n_namespaceObject.__)( "Some errors occurred while reverting the items: %s" ), [...errors].join( "," ) ) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */ (0,external_wp_i18n_namespaceObject.__)( "Some errors occurred while deleting the items: %s" ), [...errors].join( "," ) ); } } } }; await deletePostWithNotices(items, notice, { onActionPerformed }); setIsBusy(false); closeModal?.(); }, isBusy, disabled: isBusy, accessibleWhenDisabled: true, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)("Delete") } ) ] }) ] }); } }; var delete_post_default = deletePostAction; ;// ./node_modules/@wordpress/fields/build-module/actions/trash-post.js const trash_post_trashPost = { id: "move-to-trash", label: (0,external_wp_i18n_namespaceObject.__)("Trash"), isPrimary: true, icon: trash_default, isEligible(item) { if (isTemplateOrTemplatePart(item) || item.type === "wp_block") { return false; } return !!item.status && !["auto-draft", "trash"].includes(item.status) && item.permissions?.delete; }, supportsBulk: true, hideModalHeader: true, modalFocusOnMount: "firstContentElement", RenderModal: ({ items, closeModal, onActionPerformed }) => { const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { deleteEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: items.length === 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The item's title. (0,external_wp_i18n_namespaceObject.__)( 'Are you sure you want to move "%s" to the trash?' ), getItemTitle(items[0]) ) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: The number of items (2 or more). (0,external_wp_i18n_namespaceObject._n)( "Are you sure you want to move %d item to the trash ?", "Are you sure you want to move %d items to the trash ?", items.length ), items.length ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: closeModal, disabled: isBusy, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: async () => { setIsBusy(true); const promiseResult = await Promise.allSettled( items.map( (item) => deleteEntityRecord( "postType", item.type, item.id.toString(), {}, { throwOnError: true } ) ) ); if (promiseResult.every( ({ status }) => status === "fulfilled" )) { let successMessage; if (promiseResult.length === 1) { successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The item's title. */ (0,external_wp_i18n_namespaceObject.__)('"%s" moved to the trash.'), getItemTitle(items[0]) ); } else { successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: The number of items. */ (0,external_wp_i18n_namespaceObject._n)( "%d item moved to the trash.", "%d items moved to the trash.", items.length ), items.length ); } createSuccessNotice(successMessage, { type: "snackbar", id: "move-to-trash-action" }); } else { let errorMessage; if (promiseResult.length === 1) { const typedError = promiseResult[0]; if (typedError.reason?.message) { errorMessage = typedError.reason.message; } else { errorMessage = (0,external_wp_i18n_namespaceObject.__)( "An error occurred while moving the item to the trash." ); } } else { const errorMessages = /* @__PURE__ */ new Set(); const failedPromises = promiseResult.filter( ({ status }) => status === "rejected" ); for (const failedPromise of failedPromises) { const typedError = failedPromise; if (typedError.reason?.message) { errorMessages.add( typedError.reason.message ); } } if (errorMessages.size === 0) { errorMessage = (0,external_wp_i18n_namespaceObject.__)( "An error occurred while moving the items to the trash." ); } else if (errorMessages.size === 1) { errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */ (0,external_wp_i18n_namespaceObject.__)( "An error occurred while moving the item to the trash: %s" ), [...errorMessages][0] ); } else { errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */ (0,external_wp_i18n_namespaceObject.__)( "Some errors occurred while moving the items to the trash: %s" ), [...errorMessages].join(",") ); } } createErrorNotice(errorMessage, { type: "snackbar" }); } if (onActionPerformed) { onActionPerformed(items); } setIsBusy(false); closeModal?.(); }, isBusy, disabled: isBusy, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject._x)("Trash", "verb") } ) ] }) ] }); } }; var trash_post_default = trash_post_trashPost; ;// ./node_modules/@wordpress/fields/build-module/actions/permanently-delete-post.js const permanentlyDeletePost = { id: "permanently-delete", label: (0,external_wp_i18n_namespaceObject.__)("Permanently delete"), supportsBulk: true, icon: trash_default, isEligible(item) { if (isTemplateOrTemplatePart(item) || item.type === "wp_block") { return false; } const { status, permissions } = item; return status === "trash" && permissions?.delete; }, hideModalHeader: true, modalFocusOnMount: "firstContentElement", RenderModal: ({ items, closeModal, onActionPerformed }) => { const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { deleteEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: number of items to delete. (0,external_wp_i18n_namespaceObject._n)( "Are you sure you want to permanently delete %d item?", "Are you sure you want to permanently delete %d items?", items.length ), items.length ) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The post's title (0,external_wp_i18n_namespaceObject.__)( 'Are you sure you want to permanently delete "%s"?' ), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(getItemTitle(items[0])) ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: closeModal, disabled: isBusy, accessibleWhenDisabled: true, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "primary", onClick: async () => { setIsBusy(true); const promiseResult = await Promise.allSettled( items.map( (post) => deleteEntityRecord( "postType", post.type, post.id, { force: true }, { throwOnError: true } ) ) ); if (promiseResult.every( ({ status }) => status === "fulfilled" )) { let successMessage; if (promiseResult.length === 1) { successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The posts's title. */ (0,external_wp_i18n_namespaceObject.__)('"%s" permanently deleted.'), getItemTitle(items[0]) ); } else { successMessage = (0,external_wp_i18n_namespaceObject.__)( "The items were permanently deleted." ); } createSuccessNotice(successMessage, { type: "snackbar", id: "permanently-delete-post-action" }); onActionPerformed?.(items); } else { let errorMessage; if (promiseResult.length === 1) { const typedError = promiseResult[0]; if (typedError.reason?.message) { errorMessage = typedError.reason.message; } else { errorMessage = (0,external_wp_i18n_namespaceObject.__)( "An error occurred while permanently deleting the item." ); } } else { const errorMessages = /* @__PURE__ */ new Set(); const failedPromises = promiseResult.filter( ({ status }) => status === "rejected" ); for (const failedPromise of failedPromises) { const typedError = failedPromise; if (typedError.reason?.message) { errorMessages.add( typedError.reason.message ); } } if (errorMessages.size === 0) { errorMessage = (0,external_wp_i18n_namespaceObject.__)( "An error occurred while permanently deleting the items." ); } else if (errorMessages.size === 1) { errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */ (0,external_wp_i18n_namespaceObject.__)( "An error occurred while permanently deleting the items: %s" ), [...errorMessages][0] ); } else { errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */ (0,external_wp_i18n_namespaceObject.__)( "Some errors occurred while permanently deleting the items: %s" ), [...errorMessages].join(",") ); } } createErrorNotice(errorMessage, { type: "snackbar" }); } setIsBusy(false); closeModal?.(); }, isBusy, disabled: isBusy, accessibleWhenDisabled: true, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)("Delete permanently") } ) ] }) ] }); } }; var permanently_delete_post_default = permanentlyDeletePost; ;// external ["wp","mediaUtils"] const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; ;// ./node_modules/@wordpress/icons/build-module/library/line-solid.js var line_solid_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 11.25h14v1.5H5z" }) }); ;// ./node_modules/@wordpress/fields/build-module/fields/featured-image/featured-image-edit.js const FeaturedImageEdit = ({ data, field, onChange }) => { const { id } = field; const value = field.getValue({ item: data }); const media = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); return getEntityRecord("postType", "attachment", value); }, [value] ); const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)( (newValue) => onChange({ [id]: newValue }), [id, onChange] ); const url = media?.source_url; const title = media?.title?.rendered; const ref = (0,external_wp_element_namespaceObject.useRef)(null); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("fieldset", { className: "fields-controls__featured-image", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "fields-controls__featured-image-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_mediaUtils_namespaceObject.MediaUpload, { onSelect: (selectedMedia) => { onChangeControl(selectedMedia.id); }, allowedTypes: ["image"], render: ({ open }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { ref, role: "button", tabIndex: -1, onClick: () => { open(); }, onKeyDown: open, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalGrid, { rowGap: 0, columnGap: 8, templateColumns: "24px 1fr 24px", children: [ url && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { className: "fields-controls__featured-image-image", alt: "", width: 24, height: 24, src: url } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__featured-image-title", children: title }) ] }), !url && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { className: "fields-controls__featured-image-placeholder", style: { width: "24px", height: "24px" } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__featured-image-title", children: (0,external_wp_i18n_namespaceObject.__)("Choose an image\u2026") }) ] }), url && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", className: "fields-controls__featured-image-remove-button", icon: line_solid_default, onClick: (event) => { event.stopPropagation(); onChangeControl(0); } } ) }) ] } ) } ); } } ) }) }); }; ;// ./node_modules/@wordpress/fields/build-module/fields/featured-image/featured-image-view.js const FeaturedImageView = ({ item, config }) => { const media = item?._embedded?.["wp:featuredmedia"]?.[0]; const url = media?.source_url; if (url) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { className: "fields-controls__featured-image-image", src: url, alt: "", srcSet: media?.media_details?.sizes ? Object.values(media.media_details.sizes).map( (size) => `${size.source_url} ${size.width}w` ).join(", ") : void 0, sizes: config?.sizes || "100vw" } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__featured-image-placeholder" }); }; ;// ./node_modules/@wordpress/fields/build-module/fields/featured-image/index.js const featuredImageField = { id: "featured_media", type: "media", label: (0,external_wp_i18n_namespaceObject.__)("Featured Image"), Edit: FeaturedImageEdit, render: FeaturedImageView, enableSorting: false, filterBy: false }; var featured_image_default = featuredImageField; ;// ./node_modules/clsx/dist/clsx.mjs function clsx_r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=clsx_r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=clsx_r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); ;// ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js var comment_author_avatar_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", 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", clipRule: "evenodd" } ) }); ;// ./node_modules/@wordpress/fields/build-module/fields/author/author-view.js function AuthorView({ item }) { const text = item?._embedded?.author?.[0]?.name; const imageUrl = item?._embedded?.author?.[0]?.avatar_urls?.[48]; const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: 0, children: [ !!imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx("page-templates-author-field__avatar", { "is-loaded": isImageLoaded }), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { onLoad: () => setIsImageLoaded(true), alt: (0,external_wp_i18n_namespaceObject.__)("Author avatar"), src: imageUrl } ) } ), !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: comment_author_avatar_default }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "page-templates-author-field__name", children: text }) ] }); } var author_view_default = AuthorView; ;// ./node_modules/@wordpress/fields/build-module/fields/author/index.js const authorField = { label: (0,external_wp_i18n_namespaceObject.__)("Author"), id: "author", type: "integer", getElements: async () => { const authors = await (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store).getEntityRecords( "root", "user", { per_page: -1 } ) ?? []; return authors.map(({ id, name }) => ({ value: id, label: name })); }, render: author_view_default, sort: (a, b, direction) => { const nameA = a._embedded?.author?.[0]?.name || ""; const nameB = b._embedded?.author?.[0]?.name || ""; return direction === "asc" ? nameA.localeCompare(nameB) : nameB.localeCompare(nameA); }, filterBy: { operators: ["isAny", "isNone"] } }; var author_default = authorField; ;// ./node_modules/@wordpress/icons/build-module/library/drafts.js var drafts_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/scheduled.js var scheduled_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/pending.js var pending_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/not-allowed.js var not_allowed_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/published.js var published_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/fields/build-module/fields/status/status-elements.js const STATUSES = [ { value: "draft", label: (0,external_wp_i18n_namespaceObject.__)("Draft"), icon: drafts_default, description: (0,external_wp_i18n_namespaceObject.__)("Not ready to publish.") }, { value: "future", label: (0,external_wp_i18n_namespaceObject.__)("Scheduled"), icon: scheduled_default, description: (0,external_wp_i18n_namespaceObject.__)("Publish automatically on a chosen date.") }, { value: "pending", label: (0,external_wp_i18n_namespaceObject.__)("Pending Review"), icon: pending_default, description: (0,external_wp_i18n_namespaceObject.__)("Waiting for review before publishing.") }, { value: "private", label: (0,external_wp_i18n_namespaceObject.__)("Private"), icon: not_allowed_default, description: (0,external_wp_i18n_namespaceObject.__)("Only visible to site admins and editors.") }, { value: "publish", label: (0,external_wp_i18n_namespaceObject.__)("Published"), icon: published_default, description: (0,external_wp_i18n_namespaceObject.__)("Visible to everyone.") }, { value: "trash", label: (0,external_wp_i18n_namespaceObject.__)("Trash"), icon: trash_default } ]; var status_elements_default = STATUSES; ;// ./node_modules/@wordpress/fields/build-module/fields/status/status-view.js function StatusView({ item }) { const status = status_elements_default.find(({ value }) => value === item.status); const label = status?.label || item.status; const icon = status?.icon; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: 0, children: [ icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-post-list__status-icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: label }) ] }); } var status_view_default = StatusView; ;// ./node_modules/@wordpress/fields/build-module/fields/status/index.js const OPERATOR_IS_ANY = "isAny"; const statusField = { label: (0,external_wp_i18n_namespaceObject.__)("Status"), id: "status", type: "text", elements: status_elements_default, render: status_view_default, Edit: "radio", enableSorting: false, filterBy: { operators: [OPERATOR_IS_ANY] } }; var status_default = statusField; ;// ./node_modules/@wordpress/fields/build-module/fields/date/date-view.js const getFormattedDate = (dateToDisplay) => (0,external_wp_date_namespaceObject.dateI18n)( (0,external_wp_date_namespaceObject.getSettings)().formats.datetimeAbbreviated, (0,external_wp_date_namespaceObject.getDate)(dateToDisplay) ); const DateView = ({ item }) => { const isDraftOrPrivate = ["draft", "private"].includes( item.status ?? "" ); if (isDraftOrPrivate) { return (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: page creation or modification date. */ (0,external_wp_i18n_namespaceObject.__)("<span>Modified: <time>%s</time></span>"), getFormattedDate(item.date ?? null) ), { span: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), time: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) } ); } const isScheduled = item.status === "future"; if (isScheduled) { return (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: page creation date */ (0,external_wp_i18n_namespaceObject.__)("<span>Scheduled: <time>%s</time></span>"), getFormattedDate(item.date ?? null) ), { span: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), time: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) } ); } const isPublished = item.status === "publish"; if (isPublished) { return (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: page creation time */ (0,external_wp_i18n_namespaceObject.__)("<span>Published: <time>%s</time></span>"), getFormattedDate(item.date ?? null) ), { span: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), time: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) } ); } const dateToDisplay = (0,external_wp_date_namespaceObject.getDate)(item.modified ?? null) > (0,external_wp_date_namespaceObject.getDate)(item.date ?? null) ? item.modified : item.date; const isPending = item.status === "pending"; if (isPending) { return (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: page creation or modification date. */ (0,external_wp_i18n_namespaceObject.__)("<span>Modified: <time>%s</time></span>"), getFormattedDate(dateToDisplay ?? null) ), { span: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), time: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { children: getFormattedDate(item.date ?? null) }); }; var date_view_default = DateView; ;// ./node_modules/@wordpress/fields/build-module/fields/date/index.js const dateField = { id: "date", type: "datetime", label: (0,external_wp_i18n_namespaceObject.__)("Date"), render: date_view_default, filterBy: false }; var date_default = dateField; ;// ./node_modules/@wordpress/icons/build-module/library/copy-small.js var copy_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, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z" } ) }); ;// ./node_modules/@wordpress/fields/build-module/fields/slug/utils.js const getSlug = (item) => { if (typeof item !== "object") { return ""; } return item.slug || (0,external_wp_url_namespaceObject.cleanForSlug)(getItemTitle(item)) || item.id.toString(); }; ;// ./node_modules/@wordpress/fields/build-module/fields/slug/slug-edit.js const SlugEdit = ({ field, onChange, data }) => { const { id } = field; const slug = field.getValue({ item: data }) || getSlug(data); const permalinkTemplate = data.permalink_template || ""; const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; const [prefix, suffix] = permalinkTemplate.split( PERMALINK_POSTNAME_REGEX ); const permalinkPrefix = prefix; const permalinkSuffix = suffix; const isEditable = PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); const originalSlugRef = (0,external_wp_element_namespaceObject.useRef)(slug); const slugToDisplay = slug || originalSlugRef.current; const permalink = isEditable ? `${permalinkPrefix}${slugToDisplay}${permalinkSuffix}` : (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(data.link || ""); (0,external_wp_element_namespaceObject.useEffect)(() => { if (slug && originalSlugRef.current === void 0) { originalSlugRef.current = slug; } }, [slug]); const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)( (newValue) => onChange({ [id]: newValue }), [id, onChange] ); const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const copyButtonRef = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(permalink, () => { createNotice("info", (0,external_wp_i18n_namespaceObject.__)("Copied Permalink to clipboard."), { isDismissible: true, type: "snackbar" }); }); const postUrlSlugDescriptionId = "editor-post-url__slug-description-" + (0,external_wp_compose_namespaceObject.useInstanceId)(SlugEdit); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "fields-controls__slug", children: [ isEditable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "0px", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: (0,external_wp_i18n_namespaceObject.__)( "Customize the last part of the Permalink." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: "https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink", children: (0,external_wp_i18n_namespaceObject.__)("Learn more") }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalInputControl, { __next40pxDefaultSize: true, prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { children: "/" }), suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, icon: copy_small_default, ref: copyButtonRef, label: (0,external_wp_i18n_namespaceObject.__)("Copy") } ), label: (0,external_wp_i18n_namespaceObject.__)("Link"), hideLabelFromVision: true, value: slug, autoComplete: "off", spellCheck: "false", type: "text", className: "fields-controls__slug-input", onChange: (newValue) => { onChangeControl(newValue); }, onBlur: () => { if (slug === "") { onChangeControl(originalSlugRef.current); } }, "aria-describedby": postUrlSlugDescriptionId } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "fields-controls__slug-help", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__slug-help-visual-label", children: (0,external_wp_i18n_namespaceObject.__)("Permalink:") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.ExternalLink, { className: "fields-controls__slug-help-link", href: permalink, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__slug-help-prefix", children: permalinkPrefix }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__slug-help-slug", children: slugToDisplay }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__slug-help-suffix", children: permalinkSuffix }) ] } ) ] }) ] }), !isEditable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { className: "fields-controls__slug-help", href: permalink, children: permalink } ) ] }); }; var slug_edit_default = SlugEdit; ;// ./node_modules/@wordpress/fields/build-module/fields/slug/slug-view.js const SlugView = ({ item }) => { const slug = getSlug(item); const originalSlugRef = (0,external_wp_element_namespaceObject.useRef)(slug); (0,external_wp_element_namespaceObject.useEffect)(() => { if (slug && originalSlugRef.current === void 0) { originalSlugRef.current = slug; } }, [slug]); const slugToDisplay = slug || originalSlugRef.current; return `${slugToDisplay}`; }; var slug_view_default = SlugView; ;// ./node_modules/@wordpress/fields/build-module/fields/slug/index.js const slugField = { id: "slug", type: "text", label: (0,external_wp_i18n_namespaceObject.__)("Slug"), Edit: slug_edit_default, render: slug_view_default, filterBy: false }; var slug_default = slugField; // EXTERNAL MODULE: ./node_modules/remove-accents/index.js var remove_accents = __webpack_require__(9681); var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); ;// ./node_modules/@wordpress/fields/build-module/fields/parent/utils.js function getTitleWithFallbackName(post) { return typeof post.title === "object" && "rendered" in post.title && post.title.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#${post?.id} (${(0,external_wp_i18n_namespaceObject.__)("no title")})`; } ;// ./node_modules/@wordpress/fields/build-module/fields/parent/parent-edit.js function buildTermsTree(flatTerms) { const flatTermsWithParentAndChildren = flatTerms.map((term) => { return { children: [], ...term }; }); if (flatTermsWithParentAndChildren.some( ({ parent }) => parent === null || parent === void 0 )) { return flatTermsWithParentAndChildren; } const termsByParent = flatTermsWithParentAndChildren.reduce( (acc, term) => { const { parent } = term; if (!acc[parent]) { acc[parent] = []; } acc[parent].push(term); return acc; }, {} ); const fillWithChildren = (terms) => { return terms.map((term) => { const children = termsByParent[term.id]; return { ...term, children: children && children.length ? fillWithChildren(children) : [] }; }); }; return fillWithChildren(termsByParent["0"] || []); } const getItemPriority = (name, searchValue) => { const normalizedName = remove_accents_default()(name || "").toLowerCase(); const normalizedSearch = remove_accents_default()(searchValue || "").toLowerCase(); if (normalizedName === normalizedSearch) { return 0; } if (normalizedName.startsWith(normalizedSearch)) { return normalizedName.length; } return Infinity; }; function PageAttributesParent({ data, onChangeControl }) { const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(null); const pageId = data.parent; const postId = data.id; const postTypeSlug = data.type; const { parentPostTitle, pageItems, isHierarchical } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEntityRecord, getEntityRecords, getPostType } = select(external_wp_coreData_namespaceObject.store); const postTypeInfo = getPostType(postTypeSlug); const postIsHierarchical = postTypeInfo?.hierarchical && postTypeInfo.viewable; const parentPost = pageId ? getEntityRecord( "postType", postTypeSlug, pageId ) : null; const query = { per_page: 100, exclude: postId, parent_exclude: postId, orderby: "menu_order", order: "asc", _fields: "id,title,parent", ...fieldValue !== null && { search: fieldValue } }; return { isHierarchical: postIsHierarchical, parentPostTitle: parentPost ? getTitleWithFallbackName(parentPost) : "", pageItems: postIsHierarchical ? getEntityRecords( "postType", postTypeSlug, query ) : null }; }, [fieldValue, pageId, postId, postTypeSlug] ); const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { const getOptionsFromTree = (tree2, level = 0) => { const mappedNodes = tree2.map((treeNode) => [ { value: treeNode.id, label: "\u2014 ".repeat(level) + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(treeNode.name), rawName: treeNode.name }, ...getOptionsFromTree(treeNode.children || [], level + 1) ]); const sortedNodes = mappedNodes.sort(([a], [b]) => { const priorityA = getItemPriority( a.rawName, fieldValue ?? "" ); const priorityB = getItemPriority( b.rawName, fieldValue ?? "" ); return priorityA >= priorityB ? 1 : -1; }); return sortedNodes.flat(); }; if (!pageItems) { return []; } let tree = pageItems.map((item) => ({ id: item.id, parent: item.parent ?? null, name: getTitleWithFallbackName(item) })); if (!fieldValue) { tree = buildTermsTree(tree); } const opts = getOptionsFromTree(tree); const optsHasParent = opts.find((item) => item.value === pageId); if (pageId && parentPostTitle && !optsHasParent) { opts.unshift({ value: pageId, label: parentPostTitle, rawName: "" }); } return opts.map((option) => ({ ...option, value: option.value.toString() })); }, [pageItems, fieldValue, parentPostTitle, pageId]); if (!isHierarchical) { return null; } const handleKeydown = (inputValue) => { setFieldValue(inputValue); }; const handleChange = (selectedPostId) => { if (selectedPostId) { return onChangeControl(parseInt(selectedPostId, 10) ?? 0); } onChangeControl(0); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ComboboxControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Parent"), help: (0,external_wp_i18n_namespaceObject.__)("Choose a parent page."), value: pageId?.toString(), options: parentOptions, onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)( (value) => handleKeydown(value), 300 ), onChange: handleChange, hideLabelFromVision: true } ); } const ParentEdit = ({ data, field, onChange }) => { const { id } = field; const homeUrl = (0,external_wp_data_namespaceObject.useSelect)((select) => { return select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "__unstableBase")?.home; }, []); const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)( (newValue) => onChange({ [id]: newValue }), [id, onChange] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("fieldset", { className: "fields-controls__parent", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %1$s The home URL of the WordPress installation without the scheme. */ (0,external_wp_i18n_namespaceObject.__)( 'Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %1$s<wbr />/services<wbr />/pricing.' ), (0,external_wp_url_namespaceObject.filterURLForDisplay)(homeUrl).replace( /([/.])/g, "<wbr />$1" ) ), { wbr: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("wbr", {}) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.__)( "They also show up as sub-items in the default navigation menu. <a>Learn more.</a>" ), { a: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)( "https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes" ), children: void 0 } ) } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PageAttributesParent, { data, onChangeControl } ) ] }) }); }; ;// ./node_modules/@wordpress/fields/build-module/fields/parent/parent-view.js const ParentView = ({ item }) => { const parent = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); return item?.parent ? getEntityRecord("postType", item.type, item.parent) : null; }, [item.parent, item.type] ); if (parent) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: getTitleWithFallbackName(parent) }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: (0,external_wp_i18n_namespaceObject.__)("None") }); }; ;// ./node_modules/@wordpress/fields/build-module/fields/parent/index.js const parentField = { id: "parent", type: "text", label: (0,external_wp_i18n_namespaceObject.__)("Parent"), Edit: ParentEdit, render: ParentView, enableSorting: true, filterBy: false }; var parent_default = parentField; ;// ./node_modules/@wordpress/fields/build-module/fields/comment-status/index.js const commentStatusField = { id: "comment_status", label: (0,external_wp_i18n_namespaceObject.__)("Comments"), type: "text", Edit: "radio", enableSorting: false, enableHiding: false, filterBy: false, elements: [ { value: "open", label: (0,external_wp_i18n_namespaceObject.__)("Open"), description: (0,external_wp_i18n_namespaceObject.__)("Visitors can add new comments and replies.") }, { value: "closed", label: (0,external_wp_i18n_namespaceObject.__)("Closed"), description: (0,external_wp_i18n_namespaceObject.__)( "Visitors cannot add new comments or replies. Existing comments remain visible." ) } ] }; var comment_status_default = commentStatusField; ;// ./node_modules/@wordpress/fields/build-module/fields/ping-status/index.js function PingStatusEdit({ data, onChange }) { const pingStatus = data?.ping_status ?? "open"; const onTogglePingback = (checked) => { onChange({ ...data, ping_status: checked ? "open" : "closed" }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Enable pingbacks & trackbacks"), checked: pingStatus === "open", onChange: onTogglePingback, help: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)( "https://wordpress.org/documentation/article/trackbacks-and-pingbacks/" ), children: (0,external_wp_i18n_namespaceObject.__)("Learn more about pingbacks & trackbacks") } ) } ); } const pingStatusField = { id: "ping_status", label: (0,external_wp_i18n_namespaceObject.__)("Trackbacks & Pingbacks"), type: "text", Edit: PingStatusEdit, enableSorting: false, enableHiding: false, filterBy: false, elements: [ { value: "open", label: (0,external_wp_i18n_namespaceObject.__)("Allow"), description: (0,external_wp_i18n_namespaceObject.__)( "Allow link notifications from other blogs (pingbacks and trackbacks) on new articles." ) }, { value: "closed", label: (0,external_wp_i18n_namespaceObject.__)("Don't allow"), description: (0,external_wp_i18n_namespaceObject.__)( "Don't allow link notifications from other blogs (pingbacks and trackbacks) on new articles." ) } ] }; var ping_status_default = pingStatusField; ;// ./node_modules/@wordpress/fields/build-module/fields/discussion/index.js const discussionField = { id: "discussion", label: (0,external_wp_i18n_namespaceObject.__)("Discussion"), type: "text", render: ({ item }) => { const commentsOpen = item.comment_status === "open"; const pingsOpen = item.ping_status === "open"; if (commentsOpen && pingsOpen) { return (0,external_wp_i18n_namespaceObject.__)("Open"); } if (commentsOpen && !pingsOpen) { return (0,external_wp_i18n_namespaceObject.__)("Comments only"); } if (!commentsOpen && pingsOpen) { return (0,external_wp_i18n_namespaceObject.__)("Pings only"); } return (0,external_wp_i18n_namespaceObject.__)("Closed"); }, filterBy: false }; var discussion_default = discussionField; ;// ./node_modules/@wordpress/fields/build-module/fields/template/template-edit.js const EMPTY_ARRAY = []; const TemplateEdit = ({ data, field, onChange }) => { const { id } = field; const postType = data.type; const postId = typeof data.id === "number" ? data.id : parseInt(data.id, 10); const slug = data.slug; const { canSwitchTemplate, templates } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const allTemplates = select(external_wp_coreData_namespaceObject.store).getEntityRecords( "postType", "wp_template", { per_page: -1, post_type: postType } ) ?? EMPTY_ARRAY; const { getHomePage, getPostsPageId } = lock_unlock_unlock( select(external_wp_coreData_namespaceObject.store) ); const isPostsPage = getPostsPageId() === +postId; const isFrontPage = postType === "page" && getHomePage()?.postId === +postId; const allowSwitchingTemplate = !isPostsPage && !isFrontPage; return { templates: allTemplates, canSwitchTemplate: allowSwitchingTemplate }; }, [postId, postType] ); const templatesAsPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!canSwitchTemplate) { return []; } return templates.filter( (template) => template.is_custom && template.slug !== data.template && // Skip empty templates. !!template.content.raw ).map((template) => ({ name: template.slug, blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content.raw), title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title.rendered), id: template.id })); }, [canSwitchTemplate, data.template, templates]); const shownTemplates = (0,external_wp_compose_namespaceObject.useAsyncList)(templatesAsPatterns); const value = field.getValue({ item: data }); const foundTemplate = templates.find( (template) => template.slug === value ); const currentTemplate = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (foundTemplate) { return foundTemplate; } let slugToCheck; if (slug) { slugToCheck = postType === "page" ? `${postType}-${slug}` : `single-${postType}-${slug}`; } else { slugToCheck = postType === "page" ? "page" : `single-${postType}`; } if (postType) { const templateId = select(external_wp_coreData_namespaceObject.store).getDefaultTemplateId({ slug: slugToCheck }); return select(external_wp_coreData_namespaceObject.store).getEntityRecord( "postType", "wp_template", templateId ); } }, [foundTemplate, postType, slug] ); const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false); const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)( (newValue) => onChange({ [id]: newValue }), [id, onChange] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "fields-controls__template", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps: { placement: "bottom-start" }, renderToggle: ({ onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", size: "compact", onClick: onToggle, children: currentTemplate ? getItemTitle(currentTemplate) : "" } ), renderContent: ({ onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { setShowModal(true); onToggle(); }, children: (0,external_wp_i18n_namespaceObject.__)("Change template") } ), // The default template in a post is indicated by an empty string value !== "" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { onChangeControl(""); onToggle(); }, children: (0,external_wp_i18n_namespaceObject.__)("Use default template") } ) ] }) } ), showModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Choose a template"), onRequestClose: () => setShowModal(false), overlayClassName: "fields-controls__template-modal", isFullScreen: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "fields-controls__template-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { label: (0,external_wp_i18n_namespaceObject.__)("Templates"), blockPatterns: templatesAsPatterns, shownPatterns: shownTemplates, onClickPattern: (template) => { onChangeControl(template.name); setShowModal(false); } } ) }) } ) ] }); }; ;// ./node_modules/@wordpress/fields/build-module/fields/template/index.js const templateField = { id: "template", type: "text", label: (0,external_wp_i18n_namespaceObject.__)("Template"), Edit: TemplateEdit, enableSorting: false, filterBy: false }; var template_default = templateField; ;// ./node_modules/@wordpress/fields/build-module/fields/password/edit.js function PasswordEdit({ data, onChange, field }) { const [showPassword, setShowPassword] = (0,external_wp_element_namespaceObject.useState)( !!field.getValue({ item: data }) ); const handleTogglePassword = (value) => { setShowPassword(value); if (!value) { onChange({ password: "" }); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { as: "fieldset", spacing: 4, className: "fields-controls__password", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Password protected"), help: (0,external_wp_i18n_namespaceObject.__)("Only visible to those who know the password"), checked: showPassword, onChange: handleTogglePassword } ), showPassword && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "fields-controls__password-input", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { label: (0,external_wp_i18n_namespaceObject.__)("Password"), onChange: (value) => onChange({ password: value }), value: field.getValue({ item: data }) || "", placeholder: (0,external_wp_i18n_namespaceObject.__)("Use a secure password"), type: "text", __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, maxLength: 255 } ) }) ] } ); } var edit_default = PasswordEdit; ;// ./node_modules/@wordpress/fields/build-module/fields/password/index.js const passwordField = { id: "password", type: "text", label: (0,external_wp_i18n_namespaceObject.__)("Password"), Edit: edit_default, enableSorting: false, enableHiding: false, isVisible: (item) => item.status !== "private", filterBy: false }; var password_default = passwordField; ;// ./node_modules/@wordpress/fields/build-module/fields/title/view.js function BaseTitleView({ item, className, children }) { const renderedTitle = getItemTitle(item); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { className: dist_clsx("fields-field__title", className), alignment: "center", justify: "flex-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: renderedTitle || (0,external_wp_i18n_namespaceObject.__)("(no title)") }), children ] } ); } function TitleView({ item }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseTitleView, { item }); } ;// ./node_modules/@wordpress/fields/build-module/fields/page-title/view.js const { Badge } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function PageTitleView({ item }) { const { frontPageId, postsPageId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteSettings = getEntityRecord( "root", "site" ); return { frontPageId: siteSettings?.page_on_front, postsPageId: siteSettings?.page_for_posts }; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseTitleView, { item, className: "fields-field__page-title", children: [frontPageId, postsPageId].includes(item.id) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Badge, { children: item.id === frontPageId ? (0,external_wp_i18n_namespaceObject.__)("Homepage") : (0,external_wp_i18n_namespaceObject.__)("Posts Page") }) }); } ;// ./node_modules/@wordpress/fields/build-module/fields/page-title/index.js const pageTitleField = { type: "text", id: "title", label: (0,external_wp_i18n_namespaceObject.__)("Title"), placeholder: (0,external_wp_i18n_namespaceObject.__)("No title"), getValue: ({ item }) => getItemTitle(item), render: PageTitleView, enableHiding: false, enableGlobalSearch: true, filterBy: false }; var page_title_default = pageTitleField; ;// ./node_modules/@wordpress/fields/build-module/fields/template-title/index.js const templateTitleField = { type: "text", label: (0,external_wp_i18n_namespaceObject.__)("Template"), placeholder: (0,external_wp_i18n_namespaceObject.__)("No title"), id: "title", getValue: ({ item }) => getItemTitle(item), render: TitleView, enableHiding: false, enableGlobalSearch: true, filterBy: false }; var template_title_default = templateTitleField; ;// ./node_modules/@wordpress/icons/build-module/icon/index.js var icon_default = (0,external_wp_element_namespaceObject.forwardRef)( ({ icon, size = 24, ...props }, ref) => { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { width: size, height: size, ...props, ref }); } ); ;// ./node_modules/@wordpress/icons/build-module/library/lock-small.js var lock_small_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, { fillRule: "evenodd", clipRule: "evenodd", d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z" } ) }); ;// ./node_modules/@wordpress/fields/build-module/fields/pattern-title/view.js const { PATTERN_TYPES: view_PATTERN_TYPES } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); function PatternTitleView({ item }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseTitleView, { item, className: "fields-field__pattern-title", children: item.type === view_PATTERN_TYPES.theme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Tooltip, { placement: "top", text: (0,external_wp_i18n_namespaceObject.__)("This pattern cannot be edited."), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: lock_small_default, size: 24 }) } ) }); } ;// ./node_modules/@wordpress/fields/build-module/fields/pattern-title/index.js const patternTitleField = { type: "text", id: "title", label: (0,external_wp_i18n_namespaceObject.__)("Title"), placeholder: (0,external_wp_i18n_namespaceObject.__)("No title"), getValue: ({ item }) => getItemTitle(item), render: PatternTitleView, enableHiding: false, enableGlobalSearch: true, filterBy: false }; var pattern_title_default = patternTitleField; ;// ./node_modules/@wordpress/fields/build-module/fields/title/index.js const titleField = { type: "text", id: "title", label: (0,external_wp_i18n_namespaceObject.__)("Title"), placeholder: (0,external_wp_i18n_namespaceObject.__)("No title"), getValue: ({ item }) => getItemTitle(item), render: TitleView, enableHiding: true, enableGlobalSearch: true, filterBy: false }; var title_default = titleField; ;// ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js function getSubRegistry(subRegistries, registry, useSubRegistry) { if (!useSubRegistry) { return registry; } let subRegistry = subRegistries.get(registry); if (!subRegistry) { subRegistry = (0,external_wp_data_namespaceObject.createRegistry)( { "core/block-editor": external_wp_blockEditor_namespaceObject.storeConfig }, registry ); subRegistry.registerStore("core/editor", storeConfig); subRegistries.set(registry, subRegistry); } return subRegistry; } const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (WrappedComponent) => ({ useSubRegistry = true, ...props }) => { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => /* @__PURE__ */ new WeakMap()); const subRegistry = getSubRegistry( subRegistries, registry, useSubRegistry ); if (subRegistry === registry) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry, ...props }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.RegistryProvider, { value: subRegistry, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry: subRegistry, ...props }) }); }, "withRegistryProvider" ); var with_registry_provider_default = withRegistryProvider; ;// ./node_modules/@wordpress/editor/build-module/components/media-categories/index.js const getExternalLink = (url, text) => `<a ${getExternalLinkAttributes(url)}>${text}</a>`; const getExternalLinkAttributes = (url) => `href="${url}" target="_blank" rel="noreferrer noopener"`; const getOpenverseLicense = (license, licenseVersion) => { let licenseName = license.trim(); if (license !== "pdm") { licenseName = license.toUpperCase().replace("SAMPLING", "Sampling"); } if (licenseVersion) { licenseName += ` ${licenseVersion}`; } if (!["pdm", "cc0"].includes(license)) { licenseName = `CC ${licenseName}`; } return licenseName; }; const getOpenverseCaption = (item) => { const { title, foreign_landing_url: foreignLandingUrl, creator, creator_url: creatorUrl, license, license_version: licenseVersion, license_url: licenseUrl } = item; const fullLicense = getOpenverseLicense(license, licenseVersion); const _creator = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(creator); let _caption; if (_creator) { _caption = title ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1s: Title of a media work from Openverse; %2$s: Name of the work's creator; %3s: Work's licence e.g: "CC0 1.0". (0,external_wp_i18n_namespaceObject._x)('"%1$s" by %2$s/ %3$s', "caption"), getExternalLink( foreignLandingUrl, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) ), creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator, licenseUrl ? getExternalLink( `${licenseUrl}?ref=openverse`, fullLicense ) : fullLicense ) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: "CC0 1.0". (0,external_wp_i18n_namespaceObject._x)("<a %1$s>Work</a> by %2$s/ %3$s", "caption"), getExternalLinkAttributes(foreignLandingUrl), creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator, licenseUrl ? getExternalLink( `${licenseUrl}?ref=openverse`, fullLicense ) : fullLicense ); } else { _caption = title ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: "CC0 1.0". (0,external_wp_i18n_namespaceObject._x)('"%1$s"/ %2$s', "caption"), getExternalLink( foreignLandingUrl, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) ), licenseUrl ? getExternalLink( `${licenseUrl}?ref=openverse`, fullLicense ) : fullLicense ) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: "CC0 1.0". (0,external_wp_i18n_namespaceObject._x)("<a %1$s>Work</a>/ %2$s", "caption"), getExternalLinkAttributes(foreignLandingUrl), licenseUrl ? getExternalLink( `${licenseUrl}?ref=openverse`, fullLicense ) : fullLicense ); } return _caption.replace(/\s{2}/g, " "); }; const coreMediaFetch = async (query = {}) => { const mediaItems = await (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store).getEntityRecords( "postType", "attachment", { ...query, orderBy: !!query?.search ? "relevance" : "date" } ); return mediaItems.map((mediaItem) => ({ ...mediaItem, alt: mediaItem.alt_text, url: mediaItem.source_url, previewUrl: mediaItem.media_details?.sizes?.medium?.source_url, caption: mediaItem.caption?.raw })); }; const inserterMediaCategories = [ { name: "images", labels: { name: (0,external_wp_i18n_namespaceObject.__)("Images"), search_items: (0,external_wp_i18n_namespaceObject.__)("Search images") }, mediaType: "image", async fetch(query = {}) { return coreMediaFetch({ ...query, media_type: "image" }); } }, { name: "videos", labels: { name: (0,external_wp_i18n_namespaceObject.__)("Videos"), search_items: (0,external_wp_i18n_namespaceObject.__)("Search videos") }, mediaType: "video", async fetch(query = {}) { return coreMediaFetch({ ...query, media_type: "video" }); } }, { name: "audio", labels: { name: (0,external_wp_i18n_namespaceObject.__)("Audio"), search_items: (0,external_wp_i18n_namespaceObject.__)("Search audio") }, mediaType: "audio", async fetch(query = {}) { return coreMediaFetch({ ...query, media_type: "audio" }); } }, { name: "openverse", labels: { name: (0,external_wp_i18n_namespaceObject.__)("Openverse"), search_items: (0,external_wp_i18n_namespaceObject.__)("Search Openverse") }, mediaType: "image", async fetch(query = {}) { const defaultArgs = { mature: false, excluded_source: "flickr,inaturalist,wikimedia", license: "pdm,cc0" }; const finalQuery = { ...query, ...defaultArgs }; const mapFromInserterMediaRequest = { per_page: "page_size", search: "q" }; const url = new URL("https://api.openverse.org/v1/images/"); Object.entries(finalQuery).forEach(([key, value]) => { const queryKey = mapFromInserterMediaRequest[key] || key; url.searchParams.set(queryKey, value); }); const response = await window.fetch(url, { headers: { "User-Agent": "WordPress/inserter-media-fetch" } }); const jsonResponse = await response.json(); const results = jsonResponse.results; return results.map((result) => ({ ...result, // This is a temp solution for better titles, until Openverse API // completes the cleaning up of some titles of their upstream data. title: result.title?.toLowerCase().startsWith("file:") ? result.title.slice(5) : result.title, sourceId: result.id, id: void 0, caption: getOpenverseCaption(result), previewUrl: result.thumbnail })); }, getReportUrl: ({ sourceId }) => `https://wordpress.org/openverse/image/${sourceId}/report/`, isExternalResource: true } ]; var media_categories_default = inserterMediaCategories; ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/native.js const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); /* harmony default export */ const esm_browser_native = ({ randomUUID }); ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/rng.js // Unique ID creation requires a high quality random # generator. In the browser we therefore // require the crypto API and do not support built-in fallback to lower quality random number // generators (like Math.random()). let getRandomValues; const rnds8 = new Uint8Array(16); function rng() { // lazy load so that environments that need to polyfill have a chance to do so if (!getRandomValues) { // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); if (!getRandomValues) { throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); } } return getRandomValues(rnds8); } ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/stringify.js /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ const byteToHex = []; for (let i = 0; i < 256; ++i) { byteToHex.push((i + 0x100).toString(16).slice(1)); } function unsafeStringify(arr, offset = 0) { // Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; } function stringify(arr, offset = 0) { const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one // of the following: // - One or more input array values don't map to a hex octet (leading to // "undefined" in the uuid) // - Invalid input values for the RFC `version` or `variant` fields if (!validate(uuid)) { throw TypeError('Stringified UUID is invalid'); } return uuid; } /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify))); ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/v4.js function v4(options, buf, offset) { if (esm_browser_native.randomUUID && !buf && !options) { return esm_browser_native.randomUUID(); } options = options || {}; const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = rnds[6] & 0x0f | 0x40; rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided if (buf) { offset = offset || 0; for (let i = 0; i < 16; ++i) { buf[offset + i] = rnds[i]; } return buf; } return unsafeStringify(rnds); } /* harmony default export */ const esm_browser_v4 = (v4); ;// ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js const noop = () => { }; function mediaUpload({ additionalData = {}, allowedTypes, filesList, maxUploadFileSize, onError = noop, onFileChange, onSuccess, multiple = true }) { const { receiveEntityRecords } = (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store); const { getCurrentPost, getEditorSettings } = (0,external_wp_data_namespaceObject.select)(store_store); const { lockPostAutosaving, unlockPostAutosaving, lockPostSaving, unlockPostSaving } = (0,external_wp_data_namespaceObject.dispatch)(store_store); const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes; const lockKey = `image-upload-${esm_browser_v4()}`; let imageIsUploading = false; maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize; const currentPost = getCurrentPost(); const currentPostId = typeof currentPost?.id === "number" ? currentPost.id : currentPost?.wp_id; const setSaveLock = () => { lockPostSaving(lockKey); lockPostAutosaving(lockKey); imageIsUploading = true; }; const postData = currentPostId ? { post: currentPostId } : {}; const clearSaveLock = () => { unlockPostSaving(lockKey); unlockPostAutosaving(lockKey); imageIsUploading = false; }; (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ allowedTypes, filesList, onFileChange: (file) => { if (!imageIsUploading) { setSaveLock(); } else { clearSaveLock(); } onFileChange?.(file); const entityFiles = file.filter((_file) => _file?.id); if (entityFiles?.length) { const invalidateCache = true; receiveEntityRecords( "postType", "attachment", entityFiles, void 0, invalidateCache ); } }, onSuccess, additionalData: { ...postData, ...additionalData }, maxUploadFileSize, onError: ({ message }) => { clearSaveLock(); onError(message); }, wpAllowedMimeTypes, multiple }); } ;// ./node_modules/@wordpress/editor/build-module/utils/media-sideload/index.js const { sideloadMedia: mediaSideload } = unlock(external_wp_mediaUtils_namespaceObject.privateApis); var media_sideload_default = mediaSideload; // EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js var cjs = __webpack_require__(66); var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs); ;// ./node_modules/is-plain-object/dist/is-plain-object.mjs /*! * is-plain-object <https://github.com/jonschlinkert/is-plain-object> * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ function isObject(o) { return Object.prototype.toString.call(o) === '[object Object]'; } function isPlainObject(o) { var ctor,prot; if (isObject(o) === false) return false; // If has modified constructor ctor = o.constructor; if (ctor === undefined) return true; // If has modified prototype prot = ctor.prototype; if (isObject(prot) === false) return false; // If constructor does not have an Object-specific method if (prot.hasOwnProperty('isPrototypeOf') === false) { return false; } // Most likely a plain Object return true; } ;// ./node_modules/@wordpress/editor/build-module/components/global-styles-provider/index.js const { GlobalStylesContext, cleanEmptyObject } = unlock( external_wp_blockEditor_namespaceObject.privateApis ); function mergeBaseAndUserConfigs(base, user) { return cjs_default()(base, user, { /* * We only pass as arrays the presets, * in which case we want the new array of values * to override the old array (no merging). */ isMergeableObject: isPlainObject, /* * Exceptions to the above rule. * Background images should be replaced, not merged, * as they themselves are specific object definitions for the style. */ customMerge: (key) => { if (key === "backgroundImage") { return (baseConfig, userConfig) => userConfig; } return void 0; } }); } function useGlobalStylesUserConfig() { const { globalStylesId, isReady, settings, styles, _links } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEntityRecord, getEditedEntityRecord: getEditedEntityRecord2, hasFinishedResolution, canUser } = select(external_wp_coreData_namespaceObject.store); const _globalStylesId = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentGlobalStylesId(); let record; const userCanEditGlobalStyles = _globalStylesId ? canUser("update", { kind: "root", name: "globalStyles", id: _globalStylesId }) : null; if (_globalStylesId && /* * Test that the OPTIONS request for user capabilities is complete * before fetching the global styles entity record. * This is to avoid fetching the global styles entity unnecessarily. */ typeof userCanEditGlobalStyles === "boolean") { if (userCanEditGlobalStyles) { record = getEditedEntityRecord2( "root", "globalStyles", _globalStylesId ); } else { record = getEntityRecord( "root", "globalStyles", _globalStylesId, { context: "view" } ); } } let hasResolved = false; if (hasFinishedResolution( "__experimentalGetCurrentGlobalStylesId" )) { if (_globalStylesId) { hasResolved = userCanEditGlobalStyles ? hasFinishedResolution("getEditedEntityRecord", [ "root", "globalStyles", _globalStylesId ]) : hasFinishedResolution("getEntityRecord", [ "root", "globalStyles", _globalStylesId, { context: "view" } ]); } else { hasResolved = true; } } return { globalStylesId: _globalStylesId, isReady: hasResolved, settings: record?.settings, styles: record?.styles, _links: record?._links }; }, [] ); const { getEditedEntityRecord } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const config = (0,external_wp_element_namespaceObject.useMemo)(() => { return { settings: settings ?? {}, styles: styles ?? {}, _links: _links ?? {} }; }, [settings, styles, _links]); const setConfig = (0,external_wp_element_namespaceObject.useCallback)( /** * Set the global styles config. * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values. * Otherwise, overwrite the current config with the incoming object. * @param {Object} options Options for editEntityRecord Core selector. */ (callbackOrObject, options = {}) => { const record = getEditedEntityRecord( "root", "globalStyles", globalStylesId ); const currentConfig = { styles: record?.styles ?? {}, settings: record?.settings ?? {}, _links: record?._links ?? {} }; const updatedConfig = typeof callbackOrObject === "function" ? callbackOrObject(currentConfig) : callbackOrObject; editEntityRecord( "root", "globalStyles", globalStylesId, { styles: cleanEmptyObject(updatedConfig.styles) || {}, settings: cleanEmptyObject(updatedConfig.settings) || {}, _links: cleanEmptyObject(updatedConfig._links) || {} }, options ); }, [globalStylesId, editEntityRecord, getEditedEntityRecord] ); return [isReady, config, setConfig]; } function useGlobalStylesBaseConfig() { const baseConfig = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeBaseGlobalStyles(), [] ); return [!!baseConfig, baseConfig]; } function useGlobalStylesContext() { const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig(); const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig(); const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!baseConfig || !userConfig) { return {}; } return mergeBaseAndUserConfigs(baseConfig, userConfig); }, [userConfig, baseConfig]); const context = (0,external_wp_element_namespaceObject.useMemo)(() => { return { isReady: isUserConfigReady && isBaseConfigReady, user: userConfig, base: baseConfig, merged: mergedConfig, setUserConfig }; }, [ mergedConfig, userConfig, baseConfig, setUserConfig, isUserConfigReady, isBaseConfigReady ]); return context; } function GlobalStylesProvider({ children }) { const context = useGlobalStylesContext(); if (!context.isReady) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesContext.Provider, { value: context, children }); } ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js const use_block_editor_settings_EMPTY_OBJECT = {}; function __experimentalReusableBlocksSelect(select) { const { RECEIVE_INTERMEDIATE_RESULTS } = unlock(external_wp_coreData_namespaceObject.privateApis); const { getEntityRecords } = select(external_wp_coreData_namespaceObject.store); return getEntityRecords("postType", "wp_block", { per_page: -1, [RECEIVE_INTERMEDIATE_RESULTS]: true }); } const BLOCK_EDITOR_SETTINGS = [ "__experimentalBlockBindingsSupportedAttributes", "__experimentalBlockDirectory", "__experimentalDiscussionSettings", "__experimentalFeatures", "__experimentalGlobalStylesBaseStyles", "alignWide", "blockInspectorTabs", "maxUploadFileSize", "allowedMimeTypes", "bodyPlaceholder", "canLockBlocks", "canUpdateBlockBindings", "capabilities", "clearBlockSelection", "codeEditingEnabled", "colors", "disableCustomColors", "disableCustomFontSizes", "disableCustomSpacingSizes", "disableCustomGradients", "disableLayoutStyles", "enableCustomLineHeight", "enableCustomSpacing", "enableCustomUnits", "enableOpenverseMediaCategory", "fontSizes", "gradients", "generateAnchors", "onNavigateToEntityRecord", "imageDefaultSize", "imageDimensions", "imageEditing", "imageSizes", "isPreviewMode", "isRTL", "locale", "maxWidth", "postContentAttributes", "postsPerPage", "readOnly", "styles", "titlePlaceholder", "supportsLayout", "widgetTypesToHideFromLegacyWidgetBlock", "__unstableHasCustomAppender", "__unstableResolvedAssets", "__unstableIsBlockBasedTheme" ]; const { globalStylesDataKey, globalStylesLinksDataKey, selectBlockPatternsKey, reusableBlocksSelectKey, sectionRootClientIdKey, mediaEditKey } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function useBlockEditorSettings(settings, postType, postId, renderingMode) { const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); const { allowRightClickOverrides, blockTypes, focusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, hasUploadPermissions, hiddenBlockTypes, canUseUnfilteredHTML, userCanCreatePages, pageOnFront, pageForPosts, userPatternCategories, restBlockPatternCategories, sectionRootClientId } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { canUser, getRawEntityRecord, getEntityRecord, getUserPatternCategories, getBlockPatternCategories } = select(external_wp_coreData_namespaceObject.store); const { get } = select(external_wp_preferences_namespaceObject.store); const { getBlockTypes } = select(external_wp_blocks_namespaceObject.store); const { getBlocksByName, getBlockAttributes } = select(external_wp_blockEditor_namespaceObject.store); const siteSettings = canUser("read", { kind: "root", name: "site" }) ? getEntityRecord("root", "site") : void 0; function getSectionRootBlock() { if (renderingMode === "template-locked") { return getBlocksByName("core/post-content")?.[0] ?? ""; } return getBlocksByName("core/group").find( (clientId) => getBlockAttributes(clientId)?.tagName === "main" ) ?? ""; } return { allowRightClickOverrides: get( "core", "allowRightClickOverrides" ), blockTypes: getBlockTypes(), canUseUnfilteredHTML: getRawEntityRecord( "postType", postType, postId )?._links?.hasOwnProperty("wp:action-unfiltered-html"), focusMode: get("core", "focusMode"), hasFixedToolbar: get("core", "fixedToolbar") || !isLargeViewport, hiddenBlockTypes: get("core", "hiddenBlockTypes"), isDistractionFree: get("core", "distractionFree"), keepCaretInsideBlock: get("core", "keepCaretInsideBlock"), hasUploadPermissions: canUser("create", { kind: "postType", name: "attachment" }) ?? true, userCanCreatePages: canUser("create", { kind: "postType", name: "page" }), pageOnFront: siteSettings?.page_on_front, pageForPosts: siteSettings?.page_for_posts, userPatternCategories: getUserPatternCategories(), restBlockPatternCategories: getBlockPatternCategories(), sectionRootClientId: getSectionRootBlock() }; }, [postType, postId, isLargeViewport, renderingMode] ); const { merged: mergedGlobalStyles } = useGlobalStylesContext(); const globalStylesData = mergedGlobalStyles.styles ?? use_block_editor_settings_EMPTY_OBJECT; const globalStylesLinksData = mergedGlobalStyles._links ?? use_block_editor_settings_EMPTY_OBJECT; const settingsBlockPatterns = settings.__experimentalAdditionalBlockPatterns ?? // WP 6.0 settings.__experimentalBlockPatterns; const settingsBlockPatternCategories = settings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0 settings.__experimentalBlockPatternCategories; const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)( () => [...settingsBlockPatterns || []].filter( ({ postTypes }) => { return !postTypes || Array.isArray(postTypes) && postTypes.includes(postType); } ), [settingsBlockPatterns, postType] ); const blockPatternCategories = (0,external_wp_element_namespaceObject.useMemo)( () => [ ...settingsBlockPatternCategories || [], ...restBlockPatternCategories || [] ].filter( (x, index, arr) => index === arr.findIndex((y) => x.name === y.name) ), [settingsBlockPatternCategories, restBlockPatternCategories] ); const { undo, setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { editMediaEntity } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store)); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const createPageEntity = (0,external_wp_element_namespaceObject.useCallback)( (options) => { if (!userCanCreatePages) { return Promise.reject({ message: (0,external_wp_i18n_namespaceObject.__)( "You do not have permission to create Pages." ) }); } return saveEntityRecord("postType", "page", options); }, [saveEntityRecord, userCanCreatePages] ); const allowedBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { if (hiddenBlockTypes && hiddenBlockTypes.length > 0) { const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? blockTypes.map(({ name }) => name) : settings.allowedBlockTypes || []; return defaultAllowedBlockTypes.filter( (type) => !hiddenBlockTypes.includes(type) ); } return settings.allowedBlockTypes; }, [settings.allowedBlockTypes, hiddenBlockTypes, blockTypes]); const forceDisableFocusMode = settings.focusMode === false; return (0,external_wp_element_namespaceObject.useMemo)(() => { const blockEditorSettings = { ...Object.fromEntries( Object.entries(settings).filter( ([key]) => BLOCK_EDITOR_SETTINGS.includes(key) ) ), [globalStylesDataKey]: globalStylesData, [globalStylesLinksDataKey]: globalStylesLinksData, allowedBlockTypes, allowRightClickOverrides, focusMode: focusMode && !forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, [mediaEditKey]: hasUploadPermissions ? editMediaEntity : void 0, mediaUpload: hasUploadPermissions ? mediaUpload : void 0, mediaSideload: hasUploadPermissions ? media_sideload_default : void 0, __experimentalBlockPatterns: blockPatterns, [selectBlockPatternsKey]: (select) => { const { hasFinishedResolution, getBlockPatternsForPostType } = unlock(select(external_wp_coreData_namespaceObject.store)); const patterns = getBlockPatternsForPostType(postType); return hasFinishedResolution("getBlockPatterns") ? patterns : void 0; }, [reusableBlocksSelectKey]: __experimentalReusableBlocksSelect, __experimentalBlockPatternCategories: blockPatternCategories, __experimentalUserPatternCategories: userPatternCategories, __experimentalFetchLinkSuggestions: (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings), inserterMediaCategories: media_categories_default, __experimentalFetchRichUrlData: external_wp_coreData_namespaceObject.__experimentalFetchUrlData, // Todo: This only checks the top level post, not the post within a template or any other entity that can be edited. // This might be better as a generic "canUser" selector. __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML, //Todo: this is only needed for native and should probably be removed. __experimentalUndo: undo, // Check whether we want all site editor frames to have outlines // including the navigation / pattern / parts editors. outlineMode: !isDistractionFree && postType === "wp_template", // Check these two properties: they were not present in the site editor. __experimentalCreatePageEntity: createPageEntity, __experimentalUserCanCreatePages: userCanCreatePages, pageOnFront, pageForPosts, __experimentalPreferPatternsOnRoot: postType === "wp_template", templateLock: postType === "wp_navigation" ? "insert" : settings.templateLock, template: postType === "wp_navigation" ? [["core/navigation", {}, []]] : settings.template, __experimentalSetIsInserterOpened: setIsInserterOpened, [sectionRootClientIdKey]: sectionRootClientId, editorTool: renderingMode === "post-only" && postType !== "wp_template" ? "edit" : void 0 }; return blockEditorSettings; }, [ allowedBlockTypes, allowRightClickOverrides, focusMode, forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, settings, hasUploadPermissions, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts, postType, setIsInserterOpened, sectionRootClientId, globalStylesData, globalStylesLinksData, renderingMode, editMediaEntity ]); } var use_block_editor_settings_default = useBlockEditorSettings; ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-post-content-blocks.js const POST_CONTENT_BLOCK_TYPES = [ "core/post-title", "core/post-featured-image", "core/post-content" ]; function usePostContentBlocks() { const contentOnlyBlockTypes = (0,external_wp_element_namespaceObject.useMemo)( () => [ ...(0,external_wp_hooks_namespaceObject.applyFilters)( "editor.postContentBlockTypes", POST_CONTENT_BLOCK_TYPES ) ], [] ); const contentOnlyIds = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getPostBlocksByName } = unlock(select(store_store)); return getPostBlocksByName(contentOnlyBlockTypes); }, [contentOnlyBlockTypes] ); return contentOnlyIds; } ;// ./node_modules/@wordpress/editor/build-module/components/provider/disable-non-page-content-blocks.js function DisableNonPageContentBlocks() { const contentOnlyIds = usePostContentBlocks(); const { templateParts } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getBlocksByName } = select(external_wp_blockEditor_namespaceObject.store); return { templateParts: getBlocksByName("core/template-part") }; }, []); const disabledIds = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockOrder } = select(external_wp_blockEditor_namespaceObject.store); return templateParts.flatMap( (clientId) => getBlockOrder(clientId) ); }, [templateParts] ); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); (0,external_wp_element_namespaceObject.useEffect)(() => { const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); setBlockEditingMode("", "disabled"); return () => { unsetBlockEditingMode(""); }; }, [registry]); (0,external_wp_element_namespaceObject.useEffect)(() => { const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); registry.batch(() => { for (const clientId of contentOnlyIds) { setBlockEditingMode(clientId, "contentOnly"); } }); return () => { registry.batch(() => { for (const clientId of contentOnlyIds) { unsetBlockEditingMode(clientId); } }); }; }, [contentOnlyIds, registry]); (0,external_wp_element_namespaceObject.useEffect)(() => { const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); registry.batch(() => { for (const clientId of templateParts) { setBlockEditingMode(clientId, "contentOnly"); } }); return () => { registry.batch(() => { for (const clientId of templateParts) { unsetBlockEditingMode(clientId); } }); }; }, [templateParts, registry]); (0,external_wp_element_namespaceObject.useEffect)(() => { const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); registry.batch(() => { for (const clientId of disabledIds) { setBlockEditingMode(clientId, "disabled"); } }); return () => { registry.batch(() => { for (const clientId of disabledIds) { unsetBlockEditingMode(clientId); } }); }; }, [disabledIds, registry]); return null; } ;// ./node_modules/@wordpress/editor/build-module/components/provider/navigation-block-editing-mode.js function NavigationBlockEditingMode() { const blockClientId = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_blockEditor_namespaceObject.store).getBlockOrder()?.[0], [] ); const { setBlockEditingMode, unsetBlockEditingMode } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!blockClientId) { return; } setBlockEditingMode(blockClientId, "contentOnly"); return () => { unsetBlockEditingMode(blockClientId); }; }, [blockClientId, unsetBlockEditingMode, setBlockEditingMode]); } ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-hide-blocks-from-inserter.js const POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART = [ "wp_block", "wp_template", "wp_template_part" ]; function useHideBlocksFromInserter(postType, mode) { (0,external_wp_element_namespaceObject.useEffect)(() => { (0,external_wp_hooks_namespaceObject.addFilter)( "blockEditor.__unstableCanInsertBlockType", "removeTemplatePartsFromInserter", (canInsert, blockType) => { if (!POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART.includes( postType ) && blockType.name === "core/template-part" && mode === "post-only") { return false; } return canInsert; } ); (0,external_wp_hooks_namespaceObject.addFilter)( "blockEditor.__unstableCanInsertBlockType", "removePostContentFromInserter", (canInsert, blockType, rootClientId, { getBlockParentsByBlockName }) => { if (!POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART.includes( postType ) && blockType.name === "core/post-content") { return getBlockParentsByBlockName(rootClientId, "core/query").length > 0; } return canInsert; } ); return () => { (0,external_wp_hooks_namespaceObject.removeFilter)( "blockEditor.__unstableCanInsertBlockType", "removeTemplatePartsFromInserter" ); (0,external_wp_hooks_namespaceObject.removeFilter)( "blockEditor.__unstableCanInsertBlockType", "removePostContentFromInserter" ); }; }, [postType, mode]); } ;// ./node_modules/@wordpress/icons/build-module/library/keyboard.js var keyboard_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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z" }) ] }); ;// ./node_modules/@wordpress/icons/build-module/library/list-view.js var list_view_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 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/code.js var code_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.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/drawer-left.js var drawer_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, { fillRule: "evenodd", clipRule: "evenodd", 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-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/drawer-right.js var drawer_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/block-default.js var block_default_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 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js var format_list_bullets_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/pencil.js var pencil_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js var symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/page.js var page_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ /* @__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" }), /* @__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" }) ] }); ;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js var rotate_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/rotate-left.js var rotate_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z" }) }); ;// external ["wp","commands"] const external_wp_commands_namespaceObject = window["wp"]["commands"]; ;// ./node_modules/@wordpress/icons/build-module/library/star-filled.js var star_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: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/star-empty.js var star_empty_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, { fillRule: "evenodd", d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z", clipRule: "evenodd" } ) }); ;// external ["wp","viewport"] const external_wp_viewport_namespaceObject = window["wp"]["viewport"]; ;// external ["wp","plugins"] const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js var close_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); ;// ./node_modules/@wordpress/interface/build-module/store/deprecated.js function normalizeComplementaryAreaScope(scope) { if (["core/edit-post", "core/edit-site"].includes(scope)) { external_wp_deprecated_default()(`${scope} interface scope`, { alternative: "core interface scope", hint: "core/edit-post and core/edit-site are merging.", version: "6.6" }); return "core"; } return scope; } function normalizeComplementaryAreaName(scope, name) { if (scope === "core" && name === "edit-site/template") { external_wp_deprecated_default()(`edit-site/template sidebar`, { alternative: "edit-post/document", version: "6.6" }); return "edit-post/document"; } if (scope === "core" && name === "edit-site/block-inspector") { external_wp_deprecated_default()(`edit-site/block-inspector sidebar`, { alternative: "edit-post/block", version: "6.6" }); return "edit-post/block"; } return name; } ;// ./node_modules/@wordpress/interface/build-module/store/actions.js const setDefaultComplementaryArea = (scope, area) => { scope = normalizeComplementaryAreaScope(scope); area = normalizeComplementaryAreaName(scope, area); return { type: "SET_DEFAULT_COMPLEMENTARY_AREA", scope, area }; }; const enableComplementaryArea = (scope, area) => ({ registry, dispatch }) => { if (!area) { return; } scope = normalizeComplementaryAreaScope(scope); area = normalizeComplementaryAreaName(scope, area); const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, "isComplementaryAreaVisible"); if (!isComplementaryAreaVisible) { registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, "isComplementaryAreaVisible", true); } dispatch({ type: "ENABLE_COMPLEMENTARY_AREA", scope, area }); }; const disableComplementaryArea = (scope) => ({ registry }) => { scope = normalizeComplementaryAreaScope(scope); const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, "isComplementaryAreaVisible"); if (isComplementaryAreaVisible) { registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, "isComplementaryAreaVisible", false); } }; const pinItem = (scope, item) => ({ registry }) => { if (!item) { return; } scope = normalizeComplementaryAreaScope(scope); item = normalizeComplementaryAreaName(scope, item); const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, "pinnedItems"); if (pinnedItems?.[item] === true) { return; } registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, "pinnedItems", { ...pinnedItems, [item]: true }); }; const unpinItem = (scope, item) => ({ registry }) => { if (!item) { return; } scope = normalizeComplementaryAreaScope(scope); item = normalizeComplementaryAreaName(scope, item); const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, "pinnedItems"); registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, "pinnedItems", { ...pinnedItems, [item]: false }); }; function toggleFeature(scope, featureName) { return function({ registry }) { external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, { since: "6.0", alternative: `dispatch( 'core/preferences' ).toggle` }); registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName); }; } function setFeatureValue(scope, featureName, value) { return function({ registry }) { external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, { since: "6.0", alternative: `dispatch( 'core/preferences' ).set` }); registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value); }; } function setFeatureDefaults(scope, defaults) { return function({ registry }) { external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, { since: "6.0", alternative: `dispatch( 'core/preferences' ).setDefaults` }); registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults); }; } function openModal(name) { return { type: "OPEN_MODAL", name }; } function closeModal() { return { type: "CLOSE_MODAL" }; } ;// ./node_modules/@wordpress/interface/build-module/store/selectors.js const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, scope) => { scope = normalizeComplementaryAreaScope(scope); const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get( scope, "isComplementaryAreaVisible" ); if (isComplementaryAreaVisible === void 0) { return void 0; } if (isComplementaryAreaVisible === false) { return null; } return state?.complementaryAreas?.[scope]; } ); const isComplementaryAreaLoading = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, scope) => { scope = normalizeComplementaryAreaScope(scope); const isVisible = select(external_wp_preferences_namespaceObject.store).get( scope, "isComplementaryAreaVisible" ); const identifier = state?.complementaryAreas?.[scope]; return isVisible && identifier === void 0; } ); const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, scope, item) => { scope = normalizeComplementaryAreaScope(scope); item = normalizeComplementaryAreaName(scope, item); const pinnedItems = select(external_wp_preferences_namespaceObject.store).get( scope, "pinnedItems" ); return pinnedItems?.[item] ?? true; } ); const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, scope, featureName) => { external_wp_deprecated_default()( `select( 'core/interface' ).isFeatureActive( scope, featureName )`, { since: "6.0", alternative: `select( 'core/preferences' ).get( scope, featureName )` } ); return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName); } ); function isModalActive(state, modalName) { return state.activeModal === modalName; } ;// ./node_modules/@wordpress/interface/build-module/store/reducer.js function complementaryAreas(state = {}, action) { switch (action.type) { case "SET_DEFAULT_COMPLEMENTARY_AREA": { const { scope, area } = action; if (state[scope]) { return state; } return { ...state, [scope]: area }; } case "ENABLE_COMPLEMENTARY_AREA": { const { scope, area } = action; return { ...state, [scope]: area }; } } return state; } function activeModal(state = null, action) { switch (action.type) { case "OPEN_MODAL": return action.name; case "CLOSE_MODAL": return null; } return state; } var store_reducer_reducer_default = (0,external_wp_data_namespaceObject.combineReducers)({ complementaryAreas, activeModal }); ;// ./node_modules/@wordpress/interface/build-module/store/constants.js const constants_STORE_NAME = "core/interface"; ;// ./node_modules/@wordpress/interface/build-module/store/index.js const store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { reducer: store_reducer_reducer_default, actions: store_actions_namespaceObject, selectors: store_selectors_namespaceObject }); (0,external_wp_data_namespaceObject.register)(store); ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js function roleSupportsCheckedState(role) { return [ "checkbox", "option", "radio", "switch", "menuitemcheckbox", "menuitemradio", "treeitem" ].includes(role); } function ComplementaryAreaToggle({ as = external_wp_components_namespaceObject.Button, scope, identifier: identifierProp, icon: iconProp, selectedIcon, name, shortcut, ...props }) { const ComponentToUse = as; const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); const icon = iconProp || context.icon; const identifier = identifierProp || `${context.name}/${name}`; const isSelected = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).getActiveComplementaryArea(scope) === identifier, [identifier, scope] ); const { enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ComponentToUse, { icon: selectedIcon && isSelected ? selectedIcon : icon, "aria-controls": identifier.replace("/", ":"), "aria-checked": roleSupportsCheckedState(props.role) ? isSelected : void 0, onClick: () => { if (isSelected) { disableComplementaryArea(scope); } else { enableComplementaryArea(scope, identifier); } }, shortcut, ...props } ); } ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js const ComplementaryAreaHeader = ({ children, className, toggleButtonProps }) => { const toggleButton = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaToggle, { icon: close_small_default, ...toggleButtonProps }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: dist_clsx( "components-panel__header", "interface-complementary-area-header", className ), tabIndex: -1, children: [ children, toggleButton ] } ); }; var complementary_area_header_default = ComplementaryAreaHeader; ;// ./node_modules/@wordpress/interface/build-module/components/action-item/index.js const action_item_noop = () => { }; function ActionItemSlot({ name, as: Component = external_wp_components_namespaceObject.MenuGroup, fillProps = {}, bubblesVirtually, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Slot, { name, bubblesVirtually, fillProps, children: (fills) => { if (!external_wp_element_namespaceObject.Children.toArray(fills).length) { return null; } const initializedByPlugins = []; external_wp_element_namespaceObject.Children.forEach( fills, ({ props: { __unstableExplicitMenuItem, __unstableTarget } }) => { if (__unstableTarget && __unstableExplicitMenuItem) { initializedByPlugins.push(__unstableTarget); } } ); const children = external_wp_element_namespaceObject.Children.map(fills, (child) => { if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes( child.props.__unstableTarget )) { return null; } return child; }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...props, children }); } } ); } function ActionItem({ name, as: Component = external_wp_components_namespaceObject.Button, onClick, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name, children: ({ onClick: fpOnClick }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Component, { onClick: onClick || fpOnClick ? (...args) => { (onClick || action_item_noop)(...args); (fpOnClick || action_item_noop)(...args); } : void 0, ...props } ); } }); } ActionItem.Slot = ActionItemSlot; var action_item_default = ActionItem; ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js const PluginsMenuItem = ({ // Menu item is marked with unstable prop for backward compatibility. // They are removed so they don't leak to DOM elements. // @see https://github.com/WordPress/gutenberg/issues/14457 __unstableExplicitMenuItem, __unstableTarget, ...restProps }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ...restProps }); function ComplementaryAreaMoreMenuItem({ scope, target, __unstableExplicitMenuItem, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ComplementaryAreaToggle, { as: (toggleProps) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( action_item_default, { __unstableExplicitMenuItem, __unstableTarget: `${scope}/${target}`, as: PluginsMenuItem, name: `${scope}/plugin-more-menu`, ...toggleProps } ); }, role: "menuitemcheckbox", selectedIcon: check_default, name: target, scope, ...props } ); } ;// ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js function PinnedItems({ scope, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: `PinnedItems/${scope}`, ...props }); } function PinnedItemsSlot({ scope, className, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: `PinnedItems/${scope}`, ...props, children: (fills) => fills?.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx( className, "interface-pinned-items" ), children: fills } ) }); } PinnedItems.Slot = PinnedItemsSlot; var pinned_items_default = PinnedItems; ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js const ANIMATION_DURATION = 0.3; function ComplementaryAreaSlot({ scope, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: `ComplementaryArea/${scope}`, ...props }); } const SIDEBAR_WIDTH = 280; const variants = { open: { width: SIDEBAR_WIDTH }, closed: { width: 0 }, mobileOpen: { width: "100vw" } }; function ComplementaryAreaFill({ activeArea, isActive, scope, children, className, id }) { const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const previousActiveArea = (0,external_wp_compose_namespaceObject.usePrevious)(activeArea); const previousIsActive = (0,external_wp_compose_namespaceObject.usePrevious)(isActive); const [, setState] = (0,external_wp_element_namespaceObject.useState)({}); (0,external_wp_element_namespaceObject.useEffect)(() => { setState({}); }, [isActive]); const transition = { type: "tween", duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION, ease: [0.6, 0, 0.4, 1] }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: `ComplementaryArea/${scope}`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: (previousIsActive || isActive) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { variants, initial: "closed", animate: isMobileViewport ? "mobileOpen" : "open", exit: "closed", transition, className: "interface-complementary-area__fill", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { id, className, style: { width: isMobileViewport ? "100vw" : SIDEBAR_WIDTH }, children } ) } ) }) }); } function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { const previousIsSmallRef = (0,external_wp_element_namespaceObject.useRef)(false); const shouldOpenWhenNotSmallRef = (0,external_wp_element_namespaceObject.useRef)(false); const { enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isActive && isSmall && !previousIsSmallRef.current) { disableComplementaryArea(scope); shouldOpenWhenNotSmallRef.current = true; } else if ( // If there is a flag indicating the complementary area should be // enabled when we go from small to big window size and we are going // from a small to big window size. shouldOpenWhenNotSmallRef.current && !isSmall && previousIsSmallRef.current ) { shouldOpenWhenNotSmallRef.current = false; enableComplementaryArea(scope, identifier); } else if ( // If the flag is indicating the current complementary should be // reopened but another complementary area becomes active, remove // the flag. shouldOpenWhenNotSmallRef.current && activeArea && activeArea !== identifier ) { shouldOpenWhenNotSmallRef.current = false; } if (isSmall !== previousIsSmallRef.current) { previousIsSmallRef.current = isSmall; } }, [ isActive, isSmall, scope, identifier, activeArea, disableComplementaryArea, enableComplementaryArea ]); } function ComplementaryArea({ children, className, closeLabel = (0,external_wp_i18n_namespaceObject.__)("Close plugin"), identifier: identifierProp, header, headerClassName, icon: iconProp, isPinnable = true, panelClassName, scope, name, title, toggleShortcut, isActiveByDefault }) { const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); const icon = iconProp || context.icon; const identifier = identifierProp || `${context.name}/${name}`; const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false); const { isLoading, isActive, isPinned, activeArea, isSmall, isLarge, showIconLabels } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getActiveComplementaryArea, isComplementaryAreaLoading, isItemPinned } = select(store); const { get } = select(external_wp_preferences_namespaceObject.store); const _activeArea = getActiveComplementaryArea(scope); return { isLoading: isComplementaryAreaLoading(scope), isActive: _activeArea === identifier, isPinned: isItemPinned(scope, identifier), activeArea: _activeArea, isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch("< medium"), isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch("large"), showIconLabels: get("core", "showIconLabels") }; }, [identifier, scope] ); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); useAdjustComplementaryListener( scope, identifier, activeArea, isActive, isSmall ); const { enableComplementaryArea, disableComplementaryArea, pinItem, unpinItem } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isActiveByDefault && activeArea === void 0 && !isSmall) { enableComplementaryArea(scope, identifier); } else if (activeArea === void 0 && isSmall) { disableComplementaryArea(scope, identifier); } setIsReady(true); }, [ activeArea, isActiveByDefault, scope, identifier, isSmall, enableComplementaryArea, disableComplementaryArea ]); if (!isReady) { return; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ isPinnable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items_default, { scope, children: isPinned && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ComplementaryAreaToggle, { scope, identifier, isPressed: isActive && (!showIconLabels || isLarge), "aria-expanded": isActive, "aria-disabled": isLoading, label: title, icon: showIconLabels ? check_default : icon, showTooltip: !showIconLabels, variant: showIconLabels ? "tertiary" : void 0, size: "compact", shortcut: toggleShortcut } ) }), name && isPinnable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ComplementaryAreaMoreMenuItem, { target: name, scope, icon, identifier, children: title } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( ComplementaryAreaFill, { activeArea, isActive, className: dist_clsx("interface-complementary-area", className), scope, id: identifier.replace("/", ":"), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( complementary_area_header_default, { className: headerClassName, closeLabel, onClose: () => disableComplementaryArea(scope), toggleButtonProps: { label: closeLabel, size: "compact", shortcut: toggleShortcut, scope, identifier }, children: header || /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "interface-complementary-area-header__title", children: title }), isPinnable && !isMobileViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { className: "interface-complementary-area__pin-unpin-item", icon: isPinned ? star_filled_default : star_empty_default, label: isPinned ? (0,external_wp_i18n_namespaceObject.__)("Unpin from toolbar") : (0,external_wp_i18n_namespaceObject.__)("Pin to toolbar"), onClick: () => (isPinned ? unpinItem : pinItem)( scope, identifier ), isPressed: isPinned, "aria-expanded": isPinned, size: "compact" } ) ] }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Panel, { className: panelClassName, children }) ] } ) ] }); } ComplementaryArea.Slot = ComplementaryAreaSlot; var complementary_area_default = ComplementaryArea; ;// ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js const FullscreenMode = ({ isActive }) => { (0,external_wp_element_namespaceObject.useEffect)(() => { let isSticky = false; if (document.body.classList.contains("sticky-menu")) { isSticky = true; document.body.classList.remove("sticky-menu"); } return () => { if (isSticky) { document.body.classList.add("sticky-menu"); } }; }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isActive) { document.body.classList.add("is-fullscreen-mode"); } else { document.body.classList.remove("is-fullscreen-mode"); } return () => { if (isActive) { document.body.classList.remove("is-fullscreen-mode"); } }; }, [isActive]); return null; }; var fullscreen_mode_default = FullscreenMode; ;// ./node_modules/@wordpress/admin-ui/build-module/navigable-region/index.js const NavigableRegion = (0,external_wp_element_namespaceObject.forwardRef)( ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Tag, { ref, className: dist_clsx("admin-ui-navigable-region", className), "aria-label": ariaLabel, role: "region", tabIndex: "-1", ...props, children } ); } ); NavigableRegion.displayName = "NavigableRegion"; var navigable_region_default = NavigableRegion; ;// ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js const interface_skeleton_ANIMATION_DURATION = 0.25; const commonTransition = { type: "tween", duration: interface_skeleton_ANIMATION_DURATION, ease: [0.6, 0, 0.4, 1] }; function useHTMLClass(className) { (0,external_wp_element_namespaceObject.useEffect)(() => { const element = document && document.querySelector(`html:not(.${className})`); if (!element) { return; } element.classList.toggle(className); return () => { element.classList.toggle(className); }; }, [className]); } const headerVariants = { hidden: { opacity: 1, marginTop: -60 }, visible: { opacity: 1, marginTop: 0 }, distractionFreeHover: { opacity: 1, marginTop: 0, transition: { ...commonTransition, delay: 0.2, delayChildren: 0.2 } }, distractionFreeHidden: { opacity: 0, marginTop: -60 }, distractionFreeDisabled: { opacity: 0, marginTop: 0, transition: { ...commonTransition, delay: 0.8, delayChildren: 0.8 } } }; function InterfaceSkeleton({ isDistractionFree, footer, header, editorNotices, sidebar, secondarySidebar, content, actions, labels, className }, ref) { const [secondarySidebarResizeListener, secondarySidebarSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const defaultTransition = { type: "tween", duration: disableMotion ? 0 : interface_skeleton_ANIMATION_DURATION, ease: [0.6, 0, 0.4, 1] }; useHTMLClass("interface-interface-skeleton__html-container"); const defaultLabels = { /* translators: accessibility text for the top bar landmark region. */ header: (0,external_wp_i18n_namespaceObject._x)("Header", "header landmark area"), /* translators: accessibility text for the content landmark region. */ body: (0,external_wp_i18n_namespaceObject.__)("Content"), /* translators: accessibility text for the secondary sidebar landmark region. */ secondarySidebar: (0,external_wp_i18n_namespaceObject.__)("Block Library"), /* translators: accessibility text for the settings landmark region. */ sidebar: (0,external_wp_i18n_namespaceObject._x)("Settings", "settings landmark area"), /* translators: accessibility text for the publish landmark region. */ actions: (0,external_wp_i18n_namespaceObject.__)("Publish"), /* translators: accessibility text for the footer landmark region. */ footer: (0,external_wp_i18n_namespaceObject.__)("Footer") }; const mergedLabels = { ...defaultLabels, ...labels }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { ref, className: dist_clsx( className, "interface-interface-skeleton", !!footer && "has-footer" ), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "interface-interface-skeleton__editor", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: !!header && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( navigable_region_default, { as: external_wp_components_namespaceObject.__unstableMotion.div, className: "interface-interface-skeleton__header", "aria-label": mergedLabels.header, initial: isDistractionFree && !isMobileViewport ? "distractionFreeHidden" : "hidden", whileHover: isDistractionFree && !isMobileViewport ? "distractionFreeHover" : "visible", animate: isDistractionFree && !isMobileViewport ? "distractionFreeDisabled" : "visible", exit: isDistractionFree && !isMobileViewport ? "distractionFreeHidden" : "hidden", variants: headerVariants, transition: defaultTransition, children: header } ) }), isDistractionFree && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "interface-interface-skeleton__header", children: editorNotices }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "interface-interface-skeleton__body", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: !!secondarySidebar && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( navigable_region_default, { className: "interface-interface-skeleton__secondary-sidebar", ariaLabel: mergedLabels.secondarySidebar, as: external_wp_components_namespaceObject.__unstableMotion.div, initial: "closed", animate: "open", exit: "closed", variants: { open: { width: secondarySidebarSize.width }, closed: { width: 0 } }, transition: defaultTransition, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__unstableMotion.div, { style: { position: "absolute", width: isMobileViewport ? "100vw" : "fit-content", height: "100%", left: 0 }, variants: { open: { x: 0 }, closed: { x: "-100%" } }, transition: defaultTransition, children: [ secondarySidebarResizeListener, secondarySidebar ] } ) } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( navigable_region_default, { className: "interface-interface-skeleton__content", ariaLabel: mergedLabels.body, children: content } ), !!sidebar && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( navigable_region_default, { className: "interface-interface-skeleton__sidebar", ariaLabel: mergedLabels.sidebar, children: sidebar } ), !!actions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( navigable_region_default, { className: "interface-interface-skeleton__actions", ariaLabel: mergedLabels.actions, children: actions } ) ] }) ] }), !!footer && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( navigable_region_default, { className: "interface-interface-skeleton__footer", ariaLabel: mergedLabels.footer, children: footer } ) ] } ); } var interface_skeleton_default = (0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton); ;// ./node_modules/@wordpress/interface/build-module/components/index.js ;// ./node_modules/@wordpress/interface/build-module/index.js ;// ./node_modules/@wordpress/editor/build-module/components/pattern-rename-modal/index.js const { RenamePatternModal } = unlock(external_wp_patterns_namespaceObject.privateApis); const modalName = "editor/pattern-rename"; function PatternRenameModal() { const { record, postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostType, getCurrentPostId } = select(store_store); const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const _postType = getCurrentPostType(); return { record: getEditedEntityRecord( "postType", _postType, getCurrentPostId() ), postType: _postType }; }, []); const { closeModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); const isActive = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).isModalActive(modalName) ); if (!isActive || postType !== PATTERN_POST_TYPE) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenamePatternModal, { onClose: closeModal, pattern: record }); } ;// ./node_modules/@wordpress/editor/build-module/components/pattern-duplicate-modal/index.js const { DuplicatePatternModal } = unlock(external_wp_patterns_namespaceObject.privateApis); const pattern_duplicate_modal_modalName = "editor/pattern-duplicate"; function PatternDuplicateModal() { const { record, postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostType, getCurrentPostId } = select(store_store); const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const _postType = getCurrentPostType(); return { record: getEditedEntityRecord( "postType", _postType, getCurrentPostId() ), postType: _postType }; }, []); const { closeModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); const isActive = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).isModalActive(pattern_duplicate_modal_modalName) ); if (!isActive || postType !== PATTERN_POST_TYPE) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( DuplicatePatternModal, { onClose: closeModal, onSuccess: () => closeModal(), pattern: record } ); } ;// ./node_modules/@wordpress/editor/build-module/components/commands/index.js const getEditorCommandLoader = () => function useEditorCommandLoader() { const { editorMode, isListViewOpen, showBlockBreadcrumbs, isDistractionFree, isFocusMode, isPreviewMode, isViewable, isCodeEditingEnabled, isRichEditingEnabled, isPublishSidebarEnabled } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { get } = select(external_wp_preferences_namespaceObject.store); const { isListViewOpened, getCurrentPostType, getEditorSettings } = select(store_store); const { getSettings } = select(external_wp_blockEditor_namespaceObject.store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); return { editorMode: get("core", "editorMode") ?? "visual", isListViewOpen: isListViewOpened(), showBlockBreadcrumbs: get("core", "showBlockBreadcrumbs"), isDistractionFree: get("core", "distractionFree"), isFocusMode: get("core", "focusMode"), isPreviewMode: getSettings().isPreviewMode, isViewable: getPostType(getCurrentPostType())?.viewable ?? false, isCodeEditingEnabled: getEditorSettings().codeEditingEnabled, isRichEditingEnabled: getEditorSettings().richEditingEnabled, isPublishSidebarEnabled: select(store_store).isPublishSidebarEnabled() }; }, []); const { getActiveComplementaryArea } = (0,external_wp_data_namespaceObject.useSelect)(store); const { toggle } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const { createInfoNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { __unstableSaveForPreview, setIsListViewOpened, switchEditorMode, toggleDistractionFree, toggleSpotlightMode, toggleTopToolbar } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { openModal, enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { getCurrentPostId } = (0,external_wp_data_namespaceObject.useSelect)(store_store); const allowSwitchEditorMode = isCodeEditingEnabled && isRichEditingEnabled; if (isPreviewMode) { return { commands: [], isLoading: false }; } const commands = []; commands.push({ name: "core/open-shortcut-help", label: (0,external_wp_i18n_namespaceObject.__)("Keyboard shortcuts"), icon: keyboard_default, callback: ({ close }) => { close(); openModal("editor/keyboard-shortcut-help"); } }); commands.push({ name: "core/toggle-distraction-free", label: isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)("Exit Distraction free") : (0,external_wp_i18n_namespaceObject.__)("Enter Distraction free"), callback: ({ close }) => { toggleDistractionFree(); close(); } }); commands.push({ name: "core/open-preferences", label: (0,external_wp_i18n_namespaceObject.__)("Editor preferences"), callback: ({ close }) => { close(); openModal("editor/preferences"); } }); commands.push({ name: "core/toggle-spotlight-mode", label: isFocusMode ? (0,external_wp_i18n_namespaceObject.__)("Exit Spotlight mode") : (0,external_wp_i18n_namespaceObject.__)("Enter Spotlight mode"), callback: ({ close }) => { toggleSpotlightMode(); close(); } }); commands.push({ name: "core/toggle-list-view", label: isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)("Close List View") : (0,external_wp_i18n_namespaceObject.__)("Open List View"), icon: list_view_default, callback: ({ close }) => { setIsListViewOpened(!isListViewOpen); close(); createInfoNotice( isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)("List View off.") : (0,external_wp_i18n_namespaceObject.__)("List View on."), { id: "core/editor/toggle-list-view/notice", type: "snackbar" } ); } }); commands.push({ name: "core/toggle-top-toolbar", label: (0,external_wp_i18n_namespaceObject.__)("Top toolbar"), callback: ({ close }) => { toggleTopToolbar(); close(); } }); if (allowSwitchEditorMode) { commands.push({ name: "core/toggle-code-editor", label: editorMode === "visual" ? (0,external_wp_i18n_namespaceObject.__)("Open code editor") : (0,external_wp_i18n_namespaceObject.__)("Exit code editor"), icon: code_default, callback: ({ close }) => { switchEditorMode( editorMode === "visual" ? "text" : "visual" ); close(); } }); } commands.push({ name: "core/toggle-breadcrumbs", label: showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)("Hide block breadcrumbs") : (0,external_wp_i18n_namespaceObject.__)("Show block breadcrumbs"), callback: ({ close }) => { toggle("core", "showBlockBreadcrumbs"); close(); createInfoNotice( showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)("Breadcrumbs hidden.") : (0,external_wp_i18n_namespaceObject.__)("Breadcrumbs visible."), { id: "core/editor/toggle-breadcrumbs/notice", type: "snackbar" } ); } }); commands.push({ name: "core/open-settings-sidebar", label: (0,external_wp_i18n_namespaceObject.__)("Show or hide the Settings panel"), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left_default : drawer_right_default, callback: ({ close }) => { const activeSidebar = getActiveComplementaryArea("core"); close(); if (activeSidebar === "edit-post/document") { disableComplementaryArea("core"); } else { enableComplementaryArea("core", "edit-post/document"); } } }); commands.push({ name: "core/open-block-inspector", label: (0,external_wp_i18n_namespaceObject.__)("Show or hide the Block settings panel"), icon: block_default_default, callback: ({ close }) => { const activeSidebar = getActiveComplementaryArea("core"); close(); if (activeSidebar === "edit-post/block") { disableComplementaryArea("core"); } else { enableComplementaryArea("core", "edit-post/block"); } } }); commands.push({ name: "core/toggle-publish-sidebar", label: isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)("Disable pre-publish checks") : (0,external_wp_i18n_namespaceObject.__)("Enable pre-publish checks"), icon: format_list_bullets_default, callback: ({ close }) => { close(); toggle("core", "isPublishSidebarEnabled"); createInfoNotice( isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)("Pre-publish checks disabled.") : (0,external_wp_i18n_namespaceObject.__)("Pre-publish checks enabled."), { id: "core/editor/publish-sidebar/notice", type: "snackbar" } ); } }); if (isViewable) { commands.push({ name: "core/preview-link", label: (0,external_wp_i18n_namespaceObject.__)("Preview in a new tab"), icon: external_default, callback: async ({ close }) => { close(); const postId = getCurrentPostId(); const link = await __unstableSaveForPreview(); window.open(link, `wp-preview-${postId}`); } }); } return { commands, isLoading: false }; }; const getEditedEntityContextualCommands = () => function useEditedEntityContextualCommands() { const { postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostType } = select(store_store); return { postType: getCurrentPostType() }; }, []); const { openModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); const commands = []; if (postType === PATTERN_POST_TYPE) { commands.push({ name: "core/rename-pattern", label: (0,external_wp_i18n_namespaceObject.__)("Rename pattern"), icon: pencil_default, callback: ({ close }) => { openModal(modalName); close(); } }); commands.push({ name: "core/duplicate-pattern", label: (0,external_wp_i18n_namespaceObject.__)("Duplicate pattern"), icon: symbol_default, callback: ({ close }) => { openModal(pattern_duplicate_modal_modalName); close(); } }); } return { isLoading: false, commands }; }; const getPageContentFocusCommands = () => function usePageContentFocusCommands() { const { onNavigateToEntityRecord, goBack, templateId, isPreviewMode } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getRenderingMode, getEditorSettings: _getEditorSettings, getCurrentTemplateId } = unlock(select(store_store)); const editorSettings = _getEditorSettings(); return { isTemplateHidden: getRenderingMode() === "post-only", onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord, getEditorSettings: _getEditorSettings, goBack: editorSettings.onNavigateToPreviousEntityRecord, templateId: getCurrentTemplateId(), isPreviewMode: editorSettings.isPreviewMode }; }, []); const { editedRecord: template, hasResolved } = (0,external_wp_coreData_namespaceObject.useEntityRecord)( "postType", "wp_template", templateId ); if (isPreviewMode) { return { isLoading: false, commands: [] }; } const commands = []; if (templateId && hasResolved) { commands.push({ name: "core/switch-to-template-focus", label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template title */ (0,external_wp_i18n_namespaceObject.__)("Edit template: %s"), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title) ), icon: layout_default, callback: ({ close }) => { onNavigateToEntityRecord({ postId: templateId, postType: "wp_template" }); close(); } }); } if (!!goBack) { commands.push({ name: "core/switch-to-previous-entity", label: (0,external_wp_i18n_namespaceObject.__)("Go back"), icon: page_default, callback: ({ close }) => { goBack(); close(); } }); } return { isLoading: false, commands }; }; const getManipulateDocumentCommands = () => function useManipulateDocumentCommands() { const { postType, postId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostId, getCurrentPostType } = select(store_store); return { postType: getCurrentPostType(), postId: getCurrentPostId() }; }, []); const { editedRecord: template, hasResolved } = (0,external_wp_coreData_namespaceObject.useEntityRecord)( "postType", postType, postId ); const { revertTemplate } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); if (!hasResolved || ![TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE].includes( postType )) { return { isLoading: true, commands: [] }; } const commands = []; if (isTemplateRevertable(template)) { const label = template.type === TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template title */ (0,external_wp_i18n_namespaceObject.__)("Reset template: %s"), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title) ) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template part title */ (0,external_wp_i18n_namespaceObject.__)("Reset template part: %s"), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title) ); commands.push({ name: "core/reset-template", label, icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? rotate_right_default : rotate_left_default, callback: ({ close }) => { revertTemplate(template); close(); } }); } return { isLoading: !hasResolved, commands }; }; function useCommands() { (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: "core/editor/edit-ui", hook: getEditorCommandLoader() }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: "core/editor/contextual-commands", hook: getEditedEntityContextualCommands(), context: "entity-edit" }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: "core/editor/page-content-focus", hook: getPageContentFocusCommands(), context: "entity-edit" }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: "core/edit-site/manipulate-document", hook: getManipulateDocumentCommands() }); } ;// ./node_modules/@wordpress/editor/build-module/components/block-removal-warnings/index.js const { BlockRemovalWarningModal } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const TEMPLATE_BLOCKS = [ "core/post-content", "core/post-template", "core/query" ]; const BLOCK_REMOVAL_RULES = [ { // Template blocks. // The warning is only shown when a user manipulates templates or template parts. postTypes: ["wp_template", "wp_template_part"], callback(removedBlocks) { const removedTemplateBlocks = removedBlocks.filter( ({ name }) => TEMPLATE_BLOCKS.includes(name) ); if (removedTemplateBlocks.length) { return (0,external_wp_i18n_namespaceObject._n)( "Deleting this block will stop your post or page content from displaying on this template. It is not recommended.", "Some of the deleted blocks will stop your post or page content from displaying on this template. It is not recommended.", removedBlocks.length ); } } }, { // Pattern overrides. // The warning is only shown when the user edits a pattern. postTypes: ["wp_block"], callback(removedBlocks) { const removedBlocksWithOverrides = removedBlocks.filter( ({ attributes }) => attributes?.metadata?.bindings && Object.values(attributes.metadata.bindings).some( (binding) => binding.source === "core/pattern-overrides" ) ); if (removedBlocksWithOverrides.length) { return (0,external_wp_i18n_namespaceObject._n)( "The deleted block allows instance overrides. Removing it may result in content not displaying where this pattern is used. Are you sure you want to proceed?", "Some of the deleted blocks allow instance overrides. Removing them may result in content not displaying where this pattern is used. Are you sure you want to proceed?", removedBlocks.length ); } } } ]; function BlockRemovalWarnings() { const currentPostType = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getCurrentPostType(), [] ); const removalRulesForPostType = (0,external_wp_element_namespaceObject.useMemo)( () => BLOCK_REMOVAL_RULES.filter( (rule) => rule.postTypes.includes(currentPostType) ), [currentPostType] ); if (!BlockRemovalWarningModal) { return null; } if (!removalRulesForPostType) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRemovalWarningModal, { rules: removalRulesForPostType }); } ;// ./node_modules/@wordpress/editor/build-module/components/start-page-options/index.js function useStartPatterns() { const { blockPatternsWithPostContentBlockType, postType } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getPatternsByBlockTypes, getBlocksByName } = select(external_wp_blockEditor_namespaceObject.store); const { getCurrentPostType, getRenderingMode } = select(store_store); const rootClientId = getRenderingMode() === "post-only" ? "" : getBlocksByName("core/post-content")?.[0]; return { blockPatternsWithPostContentBlockType: getPatternsByBlockTypes( "core/post-content", rootClientId ), postType: getCurrentPostType() }; }, [] ); return (0,external_wp_element_namespaceObject.useMemo)(() => { if (!blockPatternsWithPostContentBlockType?.length) { return []; } return blockPatternsWithPostContentBlockType.filter((pattern) => { return postType === "page" && !pattern.postTypes || Array.isArray(pattern.postTypes) && pattern.postTypes.includes(postType); }); }, [postType, blockPatternsWithPostContentBlockType]); } function PatternSelection({ blockPatterns, onChoosePattern }) { const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { postType, postId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostType, getCurrentPostId } = select(store_store); return { postType: getCurrentPostType(), postId: getCurrentPostId() }; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { blockPatterns, onClickPattern: (_pattern, blocks) => { editEntityRecord("postType", postType, postId, { blocks, content: ({ blocks: blocksForSerialization = [] }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization) }); onChoosePattern(); } } ); } function StartPageOptionsModal({ onClose }) { const [showStartPatterns, setShowStartPatterns] = (0,external_wp_element_namespaceObject.useState)(true); const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const startPatterns = useStartPatterns(); const hasStartPattern = startPatterns.length > 0; if (!hasStartPattern) { return null; } function handleClose() { onClose(); setPreference("core", "enableChoosePatternModal", showStartPatterns); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Modal, { className: "editor-start-page-options__modal", title: (0,external_wp_i18n_namespaceObject.__)("Choose a pattern"), isFullScreen: true, onRequestClose: handleClose, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-start-page-options__modal-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PatternSelection, { blockPatterns: startPatterns, onChoosePattern: handleClose } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Flex, { className: "editor-start-page-options__modal__actions", justify: "flex-start", expanded: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, checked: showStartPatterns, label: (0,external_wp_i18n_namespaceObject.__)( "Always show starter patterns for new pages" ), onChange: (newValue) => { setShowStartPatterns(newValue); } } ) }) } ) ] } ); } function StartPageOptions() { const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(false); const { isEditedPostDirty, isEditedPostEmpty } = (0,external_wp_data_namespaceObject.useSelect)(store_store); const { isModalActive } = (0,external_wp_data_namespaceObject.useSelect)(store); const { enabled, postId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostId, getCurrentPostType } = select(store_store); const choosePatternModalEnabled = select(external_wp_preferences_namespaceObject.store).get( "core", "enableChoosePatternModal" ); return { postId: getCurrentPostId(), enabled: choosePatternModalEnabled && TEMPLATE_POST_TYPE !== getCurrentPostType() }; }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { const isFreshPage = !isEditedPostDirty() && isEditedPostEmpty(); const isPreferencesModalActive = isModalActive("editor/preferences"); if (!enabled || !isFreshPage || isPreferencesModalActive) { return; } setIsOpen(true); }, [ enabled, postId, isEditedPostDirty, isEditedPostEmpty, isModalActive ]); if (!isOpen) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StartPageOptionsModal, { onClose: () => setIsOpen(false) }); } ;// external ["wp","keyboardShortcuts"] const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/config.js const textFormattingShortcuts = [ { keyCombination: { modifier: "primary", character: "b" }, description: (0,external_wp_i18n_namespaceObject.__)("Make the selected text bold.") }, { keyCombination: { modifier: "primary", character: "i" }, description: (0,external_wp_i18n_namespaceObject.__)("Make the selected text italic.") }, { keyCombination: { modifier: "primary", character: "k" }, description: (0,external_wp_i18n_namespaceObject.__)("Convert the selected text into a link.") }, { keyCombination: { modifier: "primaryShift", character: "k" }, description: (0,external_wp_i18n_namespaceObject.__)("Remove a link.") }, { keyCombination: { character: "[[" }, description: (0,external_wp_i18n_namespaceObject.__)("Insert a link to a post or page.") }, { keyCombination: { modifier: "primary", character: "u" }, description: (0,external_wp_i18n_namespaceObject.__)("Underline the selected text.") }, { keyCombination: { modifier: "access", character: "d" }, description: (0,external_wp_i18n_namespaceObject.__)("Strikethrough the selected text.") }, { keyCombination: { modifier: "access", character: "x" }, description: (0,external_wp_i18n_namespaceObject.__)("Make the selected text inline code.") }, { keyCombination: { modifier: "access", character: "0" }, aliases: [ { modifier: "access", character: "7" } ], description: (0,external_wp_i18n_namespaceObject.__)("Convert the current heading to a paragraph.") }, { keyCombination: { modifier: "access", character: "1-6" }, description: (0,external_wp_i18n_namespaceObject.__)( "Convert the current paragraph or heading to a heading of level 1 to 6." ) }, { keyCombination: { modifier: "primaryShift", character: "SPACE" }, description: (0,external_wp_i18n_namespaceObject.__)("Add non breaking space.") } ]; ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/shortcut.js function KeyCombination({ keyCombination, forceAriaLabel }) { const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier]( keyCombination.character ) : keyCombination.character; const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier]( keyCombination.character ) : keyCombination.character; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "kbd", { className: "editor-keyboard-shortcut-help-modal__shortcut-key-combination", "aria-label": forceAriaLabel || ariaLabel, children: (Array.isArray(shortcut) ? shortcut : [shortcut]).map( (character, index) => { if (character === "+") { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children: character }, index); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "kbd", { className: "editor-keyboard-shortcut-help-modal__shortcut-key", children: character }, index ); } ) } ); } function Shortcut({ description, keyCombination, aliases = [], ariaLabel }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-keyboard-shortcut-help-modal__shortcut-description", children: description }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-keyboard-shortcut-help-modal__shortcut-term", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( KeyCombination, { keyCombination, forceAriaLabel: ariaLabel } ), aliases.map((alias, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( KeyCombination, { keyCombination: alias, forceAriaLabel: ariaLabel }, index )) ] }) ] }); } var shortcut_default = Shortcut; ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js function DynamicShortcut({ name }) { const { keyCombination, description, aliases } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getShortcutKeyCombination, getShortcutDescription, getShortcutAliases } = select(external_wp_keyboardShortcuts_namespaceObject.store); return { keyCombination: getShortcutKeyCombination(name), aliases: getShortcutAliases(name), description: getShortcutDescription(name) }; }, [name] ); if (!keyCombination) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( shortcut_default, { keyCombination, description, aliases } ); } var dynamic_shortcut_default = DynamicShortcut; ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/index.js const KEYBOARD_SHORTCUT_HELP_MODAL_NAME = "editor/keyboard-shortcut-help"; const ShortcutList = ({ shortcuts }) => ( /* * Disable reason: The `list` ARIA role is redundant but * Safari+VoiceOver won't announce the list otherwise. */ /* eslint-disable jsx-a11y/no-redundant-roles */ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "ul", { className: "editor-keyboard-shortcut-help-modal__shortcut-list", role: "list", children: shortcuts.map((shortcut, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "li", { className: "editor-keyboard-shortcut-help-modal__shortcut", children: typeof shortcut === "string" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dynamic_shortcut_default, { name: shortcut }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shortcut_default, { ...shortcut }) }, index )) } ) ); const ShortcutSection = ({ title, shortcuts, className }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "section", { className: dist_clsx( "editor-keyboard-shortcut-help-modal__section", className ), children: [ !!title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "editor-keyboard-shortcut-help-modal__section-title", children: title }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutList, { shortcuts }) ] } ); const ShortcutCategorySection = ({ title, categoryName, additionalShortcuts = [] }) => { const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)( (select) => { return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts( categoryName ); }, [categoryName] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShortcutSection, { title, shortcuts: categoryShortcuts.concat(additionalShortcuts) } ); }; function KeyboardShortcutHelpModal() { const isModalActive = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).isModalActive( KEYBOARD_SHORTCUT_HELP_MODAL_NAME ), [] ); const { openModal, closeModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); const toggleModal = () => { if (isModalActive) { closeModal(); } else { openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME); } }; (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/keyboard-shortcuts", toggleModal); if (!isModalActive) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Modal, { className: "editor-keyboard-shortcut-help-modal", title: (0,external_wp_i18n_namespaceObject.__)("Keyboard shortcuts"), closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close"), onRequestClose: toggleModal, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShortcutSection, { className: "editor-keyboard-shortcut-help-modal__main-shortcuts", shortcuts: ["core/editor/keyboard-shortcuts"] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)("Global shortcuts"), categoryName: "global" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)("Selection shortcuts"), categoryName: "selection" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)("Block shortcuts"), categoryName: "block", additionalShortcuts: [ { keyCombination: { character: "/" }, description: (0,external_wp_i18n_namespaceObject.__)( "Change the block type after adding a new paragraph." ), /* translators: The forward-slash character. e.g. '/'. */ ariaLabel: (0,external_wp_i18n_namespaceObject.__)("Forward-slash") } ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShortcutSection, { title: (0,external_wp_i18n_namespaceObject.__)("Text formatting"), shortcuts: textFormattingShortcuts } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)("List View shortcuts"), categoryName: "list-view" } ) ] } ); } var keyboard_shortcut_help_modal_default = KeyboardShortcutHelpModal; ;// ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/content-only-settings-menu.js function ContentOnlySettingsMenuItems({ clientId, onClose }) { const postContentBlocks = usePostContentBlocks(); const { entity, onNavigateToEntityRecord, canEditTemplates } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockParentsByBlockName, getSettings, getBlockAttributes, getBlockParents } = select(external_wp_blockEditor_namespaceObject.store); const { getCurrentTemplateId, getRenderingMode } = select(store_store); const patternParent = getBlockParentsByBlockName( clientId, "core/block", true )[0]; let record; if (patternParent) { record = select(external_wp_coreData_namespaceObject.store).getEntityRecord( "postType", "wp_block", getBlockAttributes(patternParent).ref ); } else if (getRenderingMode() === "template-locked" && !getBlockParents(clientId).some( (parent) => postContentBlocks.includes(parent) )) { record = select(external_wp_coreData_namespaceObject.store).getEntityRecord( "postType", "wp_template", getCurrentTemplateId() ); } if (!record) { return {}; } const _canEditTemplates = select(external_wp_coreData_namespaceObject.store).canUser("create", { kind: "postType", name: "wp_template" }); return { canEditTemplates: _canEditTemplates, entity: record, onNavigateToEntityRecord: getSettings().onNavigateToEntityRecord }; }, [clientId, postContentBlocks] ); if (!entity) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TemplateLockContentOnlyMenuItems, { clientId, onClose } ); } const isPattern = entity.type === "wp_block"; let helpText = isPattern ? (0,external_wp_i18n_namespaceObject.__)( "Edit the pattern to move, delete, or make further changes to this block." ) : (0,external_wp_i18n_namespaceObject.__)( "Edit the template to move, delete, or make further changes to this block." ); if (!canEditTemplates) { helpText = (0,external_wp_i18n_namespaceObject.__)( "Only users with permissions to edit the template can move or delete this block" ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { onNavigateToEntityRecord({ postId: entity.id, postType: entity.type }); }, disabled: !canEditTemplates, children: isPattern ? (0,external_wp_i18n_namespaceObject.__)("Edit pattern") : (0,external_wp_i18n_namespaceObject.__)("Edit template") } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalText, { variant: "muted", as: "p", className: "editor-content-only-settings-menu__description", children: helpText } ) ] }); } function TemplateLockContentOnlyMenuItems({ clientId, onClose }) { const { contentLockingParent } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getContentLockingParent } = unlock( select(external_wp_blockEditor_namespaceObject.store) ); return { contentLockingParent: getContentLockingParent(clientId) }; }, [clientId] ); const blockDisplayInformation = (0,external_wp_blockEditor_namespaceObject.useBlockDisplayInformation)(contentLockingParent); const blockEditorActions = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); if (!blockDisplayInformation?.title) { return null; } const { modifyContentLockBlock } = unlock(blockEditorActions); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { modifyContentLockBlock(contentLockingParent); onClose(); }, children: (0,external_wp_i18n_namespaceObject._x)("Unlock", "Unlock content locked blocks") } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalText, { variant: "muted", as: "p", className: "editor-content-only-settings-menu__description", children: (0,external_wp_i18n_namespaceObject.__)( "Temporarily unlock the parent block to edit, delete or make further changes to this block." ) } ) ] }); } function ContentOnlySettingsMenu() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => selectedClientIds.length === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ContentOnlySettingsMenuItems, { clientId: selectedClientIds[0], onClose } ) }); } ;// ./node_modules/@wordpress/editor/build-module/components/start-template-options/index.js function useFallbackTemplateContent(slug, isCustom = false) { return (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEntityRecord, getDefaultTemplateId } = select(external_wp_coreData_namespaceObject.store); const templateId = getDefaultTemplateId({ slug, is_custom: isCustom, ignore_empty: true }); return templateId ? getEntityRecord("postType", TEMPLATE_POST_TYPE, templateId)?.content?.raw : void 0; }, [slug, isCustom] ); } function start_template_options_useStartPatterns(fallbackContent) { const { slug, patterns } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostType, getCurrentPostId } = select(store_store); const { getEntityRecord, getBlockPatterns } = select(external_wp_coreData_namespaceObject.store); const postId = getCurrentPostId(); const postType = getCurrentPostType(); const record = getEntityRecord("postType", postType, postId); return { slug: record.slug, patterns: getBlockPatterns() }; }, []); const currentThemeStylesheet = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet ); function injectThemeAttributeInBlockTemplateContent(block) { if (block.innerBlocks.find( (innerBlock) => innerBlock.name === "core/template-part" )) { block.innerBlocks = block.innerBlocks.map((innerBlock) => { if (innerBlock.name === "core/template-part" && innerBlock.attributes.theme === void 0) { innerBlock.attributes.theme = currentThemeStylesheet; } return innerBlock; }); } if (block.name === "core/template-part" && block.attributes.theme === void 0) { block.attributes.theme = currentThemeStylesheet; } return block; } return (0,external_wp_element_namespaceObject.useMemo)(() => { return [ { name: "fallback", blocks: (0,external_wp_blocks_namespaceObject.parse)(fallbackContent), title: (0,external_wp_i18n_namespaceObject.__)("Fallback content") }, ...patterns.filter((pattern) => { return Array.isArray(pattern.templateTypes) && pattern.templateTypes.some( (templateType) => slug.startsWith(templateType) ); }).map((pattern) => { return { ...pattern, blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content).map( (block) => injectThemeAttributeInBlockTemplateContent(block) ) }; }) ]; }, [fallbackContent, slug, patterns]); } function start_template_options_PatternSelection({ fallbackContent, onChoosePattern, postType }) { const [, , onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)("postType", postType); const blockPatterns = start_template_options_useStartPatterns(fallbackContent); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { blockPatterns, onClickPattern: (pattern, blocks) => { onChange(blocks, { selection: void 0 }); onChoosePattern(); } } ); } function StartModal({ slug, isCustom, onClose, postType }) { const fallbackContent = useFallbackTemplateContent(slug, isCustom); if (!fallbackContent) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Modal, { className: "editor-start-template-options__modal", title: (0,external_wp_i18n_namespaceObject.__)("Choose a pattern"), closeLabel: (0,external_wp_i18n_namespaceObject.__)("Cancel"), focusOnMount: "firstElement", onRequestClose: onClose, isFullScreen: true, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-start-template-options__modal-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( start_template_options_PatternSelection, { fallbackContent, slug, isCustom, postType, onChoosePattern: () => { onClose(); } } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Flex, { className: "editor-start-template-options__modal__actions", justify: "flex-end", expanded: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: onClose, children: (0,external_wp_i18n_namespaceObject.__)("Skip") } ) }) } ) ] } ); } function StartTemplateOptions() { const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false); const { shouldOpenModal, slug, isCustom, postType, postId } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getCurrentPostType, getCurrentPostId } = select(store_store); const _postType = getCurrentPostType(); const _postId = getCurrentPostId(); const { getEditedEntityRecord, hasEditsForEntityRecord } = select(external_wp_coreData_namespaceObject.store); const templateRecord = getEditedEntityRecord( "postType", _postType, _postId ); const hasEdits = hasEditsForEntityRecord( "postType", _postType, _postId ); return { shouldOpenModal: !hasEdits && "" === templateRecord.content && TEMPLATE_POST_TYPE === _postType, slug: templateRecord.slug, isCustom: templateRecord.is_custom, postType: _postType, postId: _postId }; }, [] ); (0,external_wp_element_namespaceObject.useEffect)(() => { setIsClosed(false); }, [postType, postId]); if (!shouldOpenModal || isClosed) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( StartModal, { slug, isCustom, postType, onClose: () => setIsClosed(true) } ); } ;// ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/index.js function EditorKeyboardShortcuts() { const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { richEditingEnabled, codeEditingEnabled } = select(store_store).getEditorSettings(); return !richEditingEnabled || !codeEditingEnabled; }, []); const { getBlockSelectionStart } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const { getActiveComplementaryArea } = (0,external_wp_data_namespaceObject.useSelect)(store); const { enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { redo, undo, savePost, setIsListViewOpened, switchEditorMode, toggleDistractionFree } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { isEditedPostDirty, isPostSavingLocked, isListViewOpened, getEditorMode } = (0,external_wp_data_namespaceObject.useSelect)(store_store); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)( "core/editor/toggle-mode", () => { switchEditorMode( getEditorMode() === "visual" ? "text" : "visual" ); }, { isDisabled: isModeToggleDisabled } ); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/toggle-distraction-free", () => { toggleDistractionFree(); }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/undo", (event) => { undo(); event.preventDefault(); }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/redo", (event) => { redo(); event.preventDefault(); }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/save", (event) => { event.preventDefault(); if (isPostSavingLocked()) { return; } if (!isEditedPostDirty()) { return; } savePost(); }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/toggle-list-view", (event) => { if (!isListViewOpened()) { event.preventDefault(); setIsListViewOpened(true); } }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/toggle-sidebar", (event) => { event.preventDefault(); const isEditorSidebarOpened = [ "edit-post/document", "edit-post/block" ].includes(getActiveComplementaryArea("core")); if (isEditorSidebarOpened) { disableComplementaryArea("core"); } else { const sidebarToOpen = getBlockSelectionStart() ? "edit-post/block" : "edit-post/document"; enableComplementaryArea("core", sidebarToOpen); } }); return null; } ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/convert-to-regular.js function ConvertToRegularBlocks({ clientId, onClose }) { const { getBlocks } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const canRemove = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_blockEditor_namespaceObject.store).canRemoveBlock(clientId), [clientId] ); if (!canRemove) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { replaceBlocks(clientId, getBlocks(clientId)); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)("Detach") } ); } ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/convert-to-template-part.js function ConvertToTemplatePart({ clientIds, blocks }) { const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { isBlockBasedTheme, canCreate } = (0,external_wp_data_namespaceObject.useSelect)((select) => { return { isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, canCreate: select(external_wp_blockEditor_namespaceObject.store).canInsertBlockType( "core/template-part" ) }; }, []); if (!isBlockBasedTheme || !canCreate) { return null; } const onConvert = async (templatePart) => { replaceBlocks( clientIds, (0,external_wp_blocks_namespaceObject.createBlock)("core/template-part", { slug: templatePart.slug, theme: templatePart.theme }) ); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Template part created."), { type: "snackbar" }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: symbol_filled_default, onClick: () => { setIsModalOpen(true); }, "aria-expanded": isModalOpen, "aria-haspopup": "dialog", children: (0,external_wp_i18n_namespaceObject.__)("Create template part") } ), isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CreateTemplatePartModal, { closeModal: () => { setIsModalOpen(false); }, blocks, onCreate: onConvert } ) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/index.js function TemplatePartMenuItems() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TemplatePartConverterMenuItem, { clientIds: selectedClientIds, onClose } ) }); } function TemplatePartConverterMenuItem({ clientIds, onClose }) { const { blocks } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlocksByClientId } = select(external_wp_blockEditor_namespaceObject.store); return { blocks: getBlocksByClientId(clientIds) }; }, [clientIds] ); if (blocks.length === 1 && blocks[0]?.name === "core/template-part") { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ConvertToRegularBlocks, { clientId: clientIds[0], onClose } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToTemplatePart, { clientIds, blocks }); } ;// ./node_modules/@wordpress/editor/build-module/components/provider/index.js const { ExperimentalBlockEditorProvider } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { PatternsMenuItems } = unlock(external_wp_patterns_namespaceObject.privateApis); const provider_noop = () => { }; const NON_CONTEXTUAL_POST_TYPES = [ "wp_block", "wp_navigation", "wp_template_part" ]; function useBlockEditorProps(post, template, mode) { const rootLevelPost = mode === "template-locked" ? "template" : "post"; const [postBlocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)( "postType", post.type, { id: post.id } ); const [templateBlocks, onInputTemplate, onChangeTemplate] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)("postType", template?.type, { id: template?.id }); const maybeNavigationBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => { if (post.type === "wp_navigation") { return [ (0,external_wp_blocks_namespaceObject.createBlock)("core/navigation", { ref: post.id, // As the parent editor is locked with `templateLock`, the template locking // must be explicitly "unset" on the block itself to allow the user to modify // the block's content. templateLock: false }) ]; } }, [post.type, post.id]); const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { if (maybeNavigationBlocks) { return maybeNavigationBlocks; } if (rootLevelPost === "template") { return templateBlocks; } return postBlocks; }, [maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks]); const disableRootLevelChanges = !!template && mode === "template-locked" || post.type === "wp_navigation"; if (disableRootLevelChanges) { return [blocks, provider_noop, provider_noop]; } return [ blocks, rootLevelPost === "post" ? onInput : onInputTemplate, rootLevelPost === "post" ? onChange : onChangeTemplate ]; } const ExperimentalEditorProvider = with_registry_provider_default( ({ post, settings, recovery, initialEdits, children, BlockEditorProviderComponent = ExperimentalBlockEditorProvider, __unstableTemplate: template }) => { const hasTemplate = !!template; const { editorSettings, selection, isReady, mode, defaultMode, postTypeEntities } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEditorSettings, getEditorSelection, getRenderingMode, __unstableIsEditorReady, getDefaultRenderingMode } = unlock(select(store_store)); const { getEntitiesConfig } = select(external_wp_coreData_namespaceObject.store); const _mode = getRenderingMode(); const _defaultMode = getDefaultRenderingMode(post.type); const hasResolvedDefaultMode = _defaultMode === "template-locked" ? hasTemplate : _defaultMode !== void 0; const isRenderingModeReady = _defaultMode !== void 0; return { editorSettings: getEditorSettings(), isReady: __unstableIsEditorReady(), mode: isRenderingModeReady ? _mode : void 0, defaultMode: hasResolvedDefaultMode ? _defaultMode : void 0, selection: getEditorSelection(), postTypeEntities: post.type === "wp_template" ? getEntitiesConfig("postType") : null }; }, [post.type, hasTemplate] ); const shouldRenderTemplate = hasTemplate && mode !== "post-only"; const rootLevelPost = shouldRenderTemplate ? template : post; const defaultBlockContext = (0,external_wp_element_namespaceObject.useMemo)(() => { const postContext = {}; if (post.type === "wp_template") { if (post.slug === "page") { postContext.postType = "page"; } else if (post.slug === "single") { postContext.postType = "post"; } else if (post.slug.split("-")[0] === "single") { const postTypeNames = postTypeEntities?.map((entity) => entity.name) || []; const match = post.slug.match( `^single-(${postTypeNames.join("|")})(?:-.+)?$` ); if (match) { postContext.postType = match[1]; } } } else if (!NON_CONTEXTUAL_POST_TYPES.includes(rootLevelPost.type) || shouldRenderTemplate) { postContext.postId = post.id; postContext.postType = post.type; } return { ...postContext, templateSlug: rootLevelPost.type === "wp_template" ? rootLevelPost.slug : void 0 }; }, [ shouldRenderTemplate, post.id, post.type, post.slug, rootLevelPost.type, rootLevelPost.slug, postTypeEntities ]); const { id, type } = rootLevelPost; const blockEditorSettings = use_block_editor_settings_default( editorSettings, type, id, mode ); const [blocks, onInput, onChange] = useBlockEditorProps( post, template, mode ); const { updatePostLock, setupEditor, updateEditorSettings, setCurrentTemplateId, setEditedPost, setRenderingMode } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); const { createWarningNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (recovery) { return; } updatePostLock(settings.postLock); setupEditor(post, initialEdits, settings.template); if (settings.autosave) { createWarningNotice( (0,external_wp_i18n_namespaceObject.__)( "There is an autosave of this post that is more recent than the version below." ), { id: "autosave-exists", actions: [ { label: (0,external_wp_i18n_namespaceObject.__)("View the autosave"), url: settings.autosave.editLink } ] } ); } }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { setEditedPost(post.type, post.id); }, [post.type, post.id, setEditedPost]); (0,external_wp_element_namespaceObject.useEffect)(() => { updateEditorSettings(settings); }, [settings, updateEditorSettings]); (0,external_wp_element_namespaceObject.useEffect)(() => { setCurrentTemplateId(template?.id); }, [template?.id, setCurrentTemplateId]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (defaultMode) { setRenderingMode(defaultMode); } }, [defaultMode, setRenderingMode]); useHideBlocksFromInserter(post.type, mode); useCommands(); if (!isReady || !mode) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_coreData_namespaceObject.EntityProvider, { kind: "root", type: "site", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_coreData_namespaceObject.EntityProvider, { kind: "postType", type: post.type, id: post.id, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockContextProvider, { value: defaultBlockContext, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( BlockEditorProviderComponent, { value: blocks, onChange, onInput, selection, settings: blockEditorSettings, useSubRegistry: false, children: [ children, !settings.isPreviewMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsMenuItems, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartMenuItems, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContentOnlySettingsMenu, {}), mode === "template-locked" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DisableNonPageContentBlocks, {}), type === "wp_navigation" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationBlockEditingMode, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorKeyboardShortcuts, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal_default, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRemovalWarnings, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StartPageOptions, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StartTemplateOptions, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternRenameModal, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternDuplicateModal, {}) ] }) ] } ) }) } ) }); } ); function EditorProvider(props) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ExperimentalEditorProvider, { ...props, BlockEditorProviderComponent: external_wp_blockEditor_namespaceObject.BlockEditorProvider, children: props.children } ); } var provider_default = EditorProvider; ;// ./node_modules/@wordpress/editor/build-module/dataviews/fields/content-preview/content-preview-view.js const { useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function PostPreviewContainer({ template, post }) { const [backgroundColor = "white"] = useGlobalStyle("color.background"); const [postBlocks] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)("postType", post.type, { id: post.id }); const [templateBlocks] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)( "postType", template?.type, { id: template?.id } ); const blocks = template && templateBlocks ? templateBlocks : postBlocks; const isEmpty = !blocks?.length; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: "editor-fields-content-preview", style: { backgroundColor }, children: [ isEmpty && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-fields-content-preview__empty", children: (0,external_wp_i18n_namespaceObject.__)("Empty content") }), !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 }) }) ] } ); } function PostPreviewView({ item }) { const { settings, template } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { canUser, getPostType, getTemplateId, getEntityRecord } = unlock(select(external_wp_coreData_namespaceObject.store)); const canViewTemplate = canUser("read", { kind: "postType", name: "wp_template" }); const _settings = select(store_store).getEditorSettings(); const supportsTemplateMode = _settings.supportsTemplateMode; const isViewable = getPostType(item.type)?.viewable ?? false; const templateId = supportsTemplateMode && isViewable && canViewTemplate ? getTemplateId(item.type, item.id) : null; return { settings: _settings, template: templateId ? getEntityRecord("postType", "wp_template", templateId) : void 0 }; }, [item.type, item.id] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EditorProvider, { post: item, settings, __unstableTemplate: template, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPreviewContainer, { template, post: item }) } ); } ;// ./node_modules/@wordpress/editor/build-module/dataviews/fields/content-preview/index.js const postPreviewField = { type: "media", id: "content-preview", label: (0,external_wp_i18n_namespaceObject.__)("Content preview"), render: PostPreviewView, enableSorting: false }; var content_preview_default = postPreviewField; ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/private-actions.js function registerEntityAction(kind, name, config) { return { type: "REGISTER_ENTITY_ACTION", kind, name, config }; } function unregisterEntityAction(kind, name, actionId) { return { type: "UNREGISTER_ENTITY_ACTION", kind, name, actionId }; } function registerEntityField(kind, name, config) { return { type: "REGISTER_ENTITY_FIELD", kind, name, config }; } function unregisterEntityField(kind, name, fieldId) { return { type: "UNREGISTER_ENTITY_FIELD", kind, name, fieldId }; } function setIsReady(kind, name) { return { type: "SET_IS_READY", kind, name }; } const registerPostTypeSchema = (postType) => async ({ registry }) => { const isReady = unlock(registry.select(store_store)).isEntityReady( "postType", postType ); if (isReady) { return; } unlock(registry.dispatch(store_store)).setIsReady( "postType", postType ); const postTypeConfig = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postType); const canCreate = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).canUser("create", { kind: "postType", name: postType }); const currentTheme = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getCurrentTheme(); const actions = [ postTypeConfig.viewable ? view_post_default : void 0, !!postTypeConfig.supports?.revisions ? view_post_revisions_default : void 0, // @ts-ignore false ? 0 : void 0, postTypeConfig.slug === "wp_template_part" && canCreate && currentTheme?.is_block_theme ? duplicate_template_part_default : void 0, canCreate && postTypeConfig.slug === "wp_block" ? duplicate_pattern_default : void 0, postTypeConfig.supports?.title ? rename_post_default : void 0, postTypeConfig.supports?.["page-attributes"] ? reorder_page_default : void 0, postTypeConfig.slug === "wp_block" ? export_pattern_default : void 0, restore_post_default, reset_post_default, delete_post_default, trash_post_default, permanently_delete_post_default ].filter(Boolean); const fields = [ postTypeConfig.supports?.thumbnail && currentTheme?.theme_supports?.["post-thumbnails"] && featured_image_default, postTypeConfig.supports?.author && author_default, status_default, date_default, slug_default, postTypeConfig.supports?.["page-attributes"] && parent_default, postTypeConfig.supports?.comments && comment_status_default, postTypeConfig.supports?.trackbacks && ping_status_default, (postTypeConfig.supports?.comments || postTypeConfig.supports?.trackbacks) && discussion_default, template_default, password_default, postTypeConfig.supports?.editor && postTypeConfig.viewable && content_preview_default ].filter(Boolean); if (postTypeConfig.supports?.title) { let _titleField; if (postType === "page") { _titleField = page_title_default; } else if (postType === "wp_template") { _titleField = template_title_default; } else if (postType === "wp_block") { _titleField = pattern_title_default; } else { _titleField = title_default; } fields.push(_titleField); } registry.batch(() => { actions.forEach((action) => { unlock(registry.dispatch(store_store)).registerEntityAction( "postType", postType, action ); }); fields.forEach((field) => { unlock(registry.dispatch(store_store)).registerEntityField( "postType", postType, field ); }); }); (0,external_wp_hooks_namespaceObject.doAction)("core.registerPostTypeSchema", postType); }; ;// ./node_modules/@wordpress/editor/build-module/store/private-actions.js function setCurrentTemplateId(id) { return { type: "SET_CURRENT_TEMPLATE_ID", id }; } const createTemplate = (template) => async ({ select, dispatch, registry }) => { const savedTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord("postType", "wp_template", template); registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord( "postType", select.getCurrentPostType(), select.getCurrentPostId(), { template: savedTemplate.slug } ); registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice( (0,external_wp_i18n_namespaceObject.__)("Custom template created. You're in template mode now."), { type: "snackbar", actions: [ { label: (0,external_wp_i18n_namespaceObject.__)("Go back"), onClick: () => dispatch.setRenderingMode( select.getEditorSettings().defaultRenderingMode ) } ] } ); return savedTemplate; }; const showBlockTypes = (blockNames) => ({ registry }) => { const existingBlockNames = registry.select(external_wp_preferences_namespaceObject.store).get("core", "hiddenBlockTypes") ?? []; const newBlockNames = existingBlockNames.filter( (type) => !(Array.isArray(blockNames) ? blockNames : [blockNames]).includes(type) ); registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "hiddenBlockTypes", newBlockNames); }; const hideBlockTypes = (blockNames) => ({ registry }) => { const existingBlockNames = registry.select(external_wp_preferences_namespaceObject.store).get("core", "hiddenBlockTypes") ?? []; const mergedBlockNames = /* @__PURE__ */ new Set([ ...existingBlockNames, ...Array.isArray(blockNames) ? blockNames : [blockNames] ]); registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "hiddenBlockTypes", [...mergedBlockNames]); }; const saveDirtyEntities = ({ onSave, dirtyEntityRecords = [], entitiesToSkip = [], close } = {}) => ({ registry }) => { const PUBLISH_ON_SAVE_ENTITIES = [ { kind: "postType", name: "wp_navigation" } ]; const saveNoticeId = "site-editor-save-success"; const homeUrl = registry.select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "__unstableBase")?.home; registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(saveNoticeId); const entitiesToSave = dirtyEntityRecords.filter( ({ kind, name, key, property }) => { return !entitiesToSkip.some( (elt) => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property ); } ); close?.(entitiesToSave); const siteItemsToSave = []; const pendingSavedRecords = []; entitiesToSave.forEach(({ kind, name, key, property }) => { if ("root" === kind && "site" === name) { siteItemsToSave.push(property); } else { if (PUBLISH_ON_SAVE_ENTITIES.some( (typeToPublish) => typeToPublish.kind === kind && typeToPublish.name === name )) { registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord(kind, name, key, { status: "publish" }); } pendingSavedRecords.push( registry.dispatch(external_wp_coreData_namespaceObject.store).saveEditedEntityRecord(kind, name, key) ); } }); if (siteItemsToSave.length) { pendingSavedRecords.push( registry.dispatch(external_wp_coreData_namespaceObject.store).__experimentalSaveSpecifiedEntityEdits( "root", "site", void 0, siteItemsToSave ) ); } registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent(); Promise.all(pendingSavedRecords).then((values) => { return onSave ? onSave(values) : values; }).then((values) => { if (values.some((value) => typeof value === "undefined")) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)("Saving failed.")); } else { registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Site updated."), { type: "snackbar", id: saveNoticeId, actions: [ { label: (0,external_wp_i18n_namespaceObject.__)("View site"), url: homeUrl, openInNewTab: true } ] }); } }).catch( (error) => registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice( `${(0,external_wp_i18n_namespaceObject.__)("Saving failed.")} ${error}` ) ); }; const private_actions_revertTemplate = (template, { allowUndo = true } = {}) => async ({ registry }) => { const noticeId = "edit-site-template-reverted"; registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(noticeId); if (!isTemplateRevertable(template)) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)("This template is not revertable."), { type: "snackbar" }); return; } try { const templateEntityConfig = registry.select(external_wp_coreData_namespaceObject.store).getEntityConfig("postType", template.type); if (!templateEntityConfig) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice( (0,external_wp_i18n_namespaceObject.__)( "The editor has encountered an unexpected error. Please reload." ), { type: "snackbar" } ); return; } const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)( `${templateEntityConfig.baseURL}/${template.id}`, { context: "edit", source: template.origin } ); const fileTemplate = await external_wp_apiFetch_default()({ path: fileTemplatePath }); if (!fileTemplate) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice( (0,external_wp_i18n_namespaceObject.__)( "The editor has encountered an unexpected error. Please reload." ), { type: "snackbar" } ); return; } const serializeBlocks = ({ blocks: blocksForSerialization = [] }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); const edited = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( "postType", template.type, template.id ); registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord( "postType", template.type, template.id, { content: serializeBlocks, // Required to make the `undo` behave correctly. blocks: edited.blocks, // Required to revert the blocks in the editor. source: "custom" // required to avoid turning the editor into a dirty state }, { undoIgnore: true // Required to merge this edit with the last undo level. } ); const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate?.content?.raw); registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord("postType", template.type, fileTemplate.id, { content: serializeBlocks, blocks, source: "theme" }); if (allowUndo) { const undoRevert = () => { registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord( "postType", template.type, edited.id, { content: serializeBlocks, blocks: edited.blocks, source: "custom" } ); }; registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Template reset."), { type: "snackbar", id: noticeId, actions: [ { label: (0,external_wp_i18n_namespaceObject.__)("Undo"), onClick: undoRevert } ] }); } } catch (error) { const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("Template revert failed. Please reload."); registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { type: "snackbar" }); } }; const removeTemplates = (items) => async ({ registry }) => { const isResetting = items.every((item) => item?.has_theme_file); const promiseResult = await Promise.allSettled( items.map((item) => { return registry.dispatch(external_wp_coreData_namespaceObject.store).deleteEntityRecord( "postType", item.type, item.id, { force: true }, { throwOnError: true } ); }) ); if (promiseResult.every(({ status }) => status === "fulfilled")) { let successMessage; if (items.length === 1) { let title; if (typeof items[0].title === "string") { title = items[0].title; } else if (typeof items[0].title?.rendered === "string") { title = items[0].title?.rendered; } else if (typeof items[0].title?.raw === "string") { title = items[0].title?.raw; } successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The template/part's name. */ (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) ) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The template/part's name. */ (0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', "template part"), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) ); } else { successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)("Items reset.") : (0,external_wp_i18n_namespaceObject.__)("Items deleted."); } registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(successMessage, { type: "snackbar", id: "editor-template-deleted-success" }); } else { let errorMessage; if (promiseResult.length === 1) { if (promiseResult[0].reason?.message) { errorMessage = promiseResult[0].reason.message; } else { errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)("An error occurred while reverting the item.") : (0,external_wp_i18n_namespaceObject.__)("An error occurred while deleting the item."); } } else { const errorMessages = /* @__PURE__ */ new Set(); const failedPromises = promiseResult.filter( ({ status }) => status === "rejected" ); for (const failedPromise of failedPromises) { if (failedPromise.reason?.message) { errorMessages.add(failedPromise.reason.message); } } if (errorMessages.size === 0) { errorMessage = (0,external_wp_i18n_namespaceObject.__)( "An error occurred while deleting the items." ); } else if (errorMessages.size === 1) { errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */ (0,external_wp_i18n_namespaceObject.__)( "An error occurred while reverting the items: %s" ), [...errorMessages][0] ) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */ (0,external_wp_i18n_namespaceObject.__)( "An error occurred while deleting the items: %s" ), [...errorMessages][0] ); } else { errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */ (0,external_wp_i18n_namespaceObject.__)( "Some errors occurred while reverting the items: %s" ), [...errorMessages].join(",") ) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */ (0,external_wp_i18n_namespaceObject.__)( "Some errors occurred while deleting the items: %s" ), [...errorMessages].join(",") ); } } registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { type: "snackbar" }); } }; const setDefaultRenderingMode = (mode) => ({ select, registry }) => { const postType = select.getCurrentPostType(); const theme = registry.select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.stylesheet; const renderingModes = registry.select(external_wp_preferences_namespaceObject.store).get("core", "renderingModes")?.[theme] ?? {}; if (renderingModes[postType] === mode) { return; } const newModes = { [theme]: { ...renderingModes, [postType]: mode } }; registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "renderingModes", newModes); }; function setCanvasMinHeight(minHeight) { return { type: "SET_CANVAS_MIN_HEIGHT", minHeight }; } // EXTERNAL MODULE: ./node_modules/fast-deep-equal/index.js var fast_deep_equal = __webpack_require__(5215); var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal); ;// ./node_modules/@wordpress/icons/build-module/library/navigation.js var navigation_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/verse.js var verse_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" }) }); ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/private-selectors.js const private_selectors_EMPTY_ARRAY = []; function getEntityActions(state, kind, name) { return state.actions[kind]?.[name] ?? private_selectors_EMPTY_ARRAY; } function getEntityFields(state, kind, name) { return state.fields[kind]?.[name] ?? private_selectors_EMPTY_ARRAY; } function isEntityReady(state, kind, name) { return state.isReady[kind]?.[name]; } ;// ./node_modules/@wordpress/editor/build-module/store/private-selectors.js const EMPTY_INSERTION_POINT = { rootClientId: void 0, insertionIndex: void 0, filterValue: void 0 }; const RENDERING_MODES = ["post-only", "template-locked"]; const getInserter = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)( (state) => { if (typeof state.blockInserterPanel === "object") { return state.blockInserterPanel; } if (getRenderingMode(state) === "template-locked") { const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName( "core/post-content" ); if (postContentClientId) { return { rootClientId: postContentClientId, insertionIndex: void 0, filterValue: void 0 }; } } return EMPTY_INSERTION_POINT; }, (state) => { const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName( "core/post-content" ); return [ state.blockInserterPanel, getRenderingMode(state), postContentClientId ]; } ) ); function getListViewToggleRef(state) { return state.listViewToggleRef; } function getInserterSidebarToggleRef(state) { return state.inserterSidebarToggleRef; } const CARD_ICONS = { wp_block: symbol_default, wp_navigation: navigation_default, page: page_default, post: verse_default }; const getPostIcon = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, postType, options) => { { if (postType === "wp_template_part" || postType === "wp_template") { const templateAreas = select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || []; const areaData = templateAreas.find( (item) => options.area === item.area ); if (areaData?.icon) { return getTemplatePartIcon(areaData.icon); } return layout_default; } if (CARD_ICONS[postType]) { return CARD_ICONS[postType]; } const postTypeEntity = select(external_wp_coreData_namespaceObject.store).getPostType(postType); if (typeof postTypeEntity?.icon === "string" && postTypeEntity.icon.startsWith("dashicons-")) { return postTypeEntity.icon.slice(10); } return page_default; } } ); const hasPostMetaChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, postType, postId) => { const { type: currentPostType, id: currentPostId } = getCurrentPost(state); const edits = select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits( "postType", postType || currentPostType, postId || currentPostId ); if (!edits?.meta) { return false; } const originalPostMeta = select(external_wp_coreData_namespaceObject.store).getEntityRecord( "postType", postType || currentPostType, postId || currentPostId )?.meta; return !fast_deep_equal_default()( { ...originalPostMeta, footnotes: void 0 }, { ...edits.meta, footnotes: void 0 } ); } ); function private_selectors_getEntityActions(state, ...args) { return getEntityActions(state.dataviews, ...args); } function private_selectors_isEntityReady(state, ...args) { return isEntityReady(state.dataviews, ...args); } function private_selectors_getEntityFields(state, ...args) { return getEntityFields(state.dataviews, ...args); } const getPostBlocksByName = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)( (state, blockNames) => { blockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; const { getBlocksByName, getBlockParents, getBlockName } = select(external_wp_blockEditor_namespaceObject.store); return getBlocksByName(blockNames).filter( (clientId) => getBlockParents(clientId).every((parentClientId) => { const parentBlockName = getBlockName(parentClientId); return ( // Ignore descendents of the query block. parentBlockName !== "core/query" && // Enable only the top-most block. !blockNames.includes(parentBlockName) ); }) ); }, () => [select(external_wp_blockEditor_namespaceObject.store).getBlocks()] ) ); const getDefaultRenderingMode = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, postType) => { const { getPostType, getCurrentTheme, hasFinishedResolution } = select(external_wp_coreData_namespaceObject.store); const currentTheme = getCurrentTheme(); const postTypeEntity = getPostType(postType); if (!hasFinishedResolution("getPostType", [postType]) || !hasFinishedResolution("getCurrentTheme")) { return void 0; } const theme = currentTheme?.stylesheet; const defaultModePreference = select(external_wp_preferences_namespaceObject.store).get( "core", "renderingModes" )?.[theme]?.[postType]; const postTypeDefaultMode = Array.isArray( postTypeEntity?.supports?.editor ) ? postTypeEntity.supports.editor.find( (features) => "default-mode" in features )?.["default-mode"] : void 0; const defaultMode = defaultModePreference || postTypeDefaultMode; if (!RENDERING_MODES.includes(defaultMode)) { return "post-only"; } return defaultMode; } ); function getCanvasMinHeight(state) { return state.canvasMinHeight; } ;// ./node_modules/@wordpress/editor/build-module/store/index.js const storeConfig = { reducer: reducer_reducer_default, selectors: selectors_namespaceObject, actions: actions_namespaceObject }; const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { ...storeConfig }); (0,external_wp_data_namespaceObject.register)(store_store); unlock(store_store).registerPrivateActions(store_private_actions_namespaceObject); unlock(store_store).registerPrivateSelectors(store_private_selectors_namespaceObject); ;// ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js const createWithMetaAttributeSource = (metaAttributes) => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (BlockEdit) => ({ attributes, setAttributes, ...props }) => { const postType = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getCurrentPostType(), [] ); const [meta, setMeta] = (0,external_wp_coreData_namespaceObject.useEntityProp)( "postType", postType, "meta" ); const mergedAttributes = (0,external_wp_element_namespaceObject.useMemo)( () => ({ ...attributes, ...Object.fromEntries( Object.entries(metaAttributes).map( ([attributeKey, metaKey]) => [ attributeKey, meta[metaKey] ] ) ) }), [attributes, meta] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockEdit, { attributes: mergedAttributes, setAttributes: (nextAttributes) => { const nextMeta = Object.fromEntries( Object.entries(nextAttributes ?? {}).filter( // Filter to intersection of keys between the updated // attributes and those with an associated meta key. ([key]) => key in metaAttributes ).map(([attributeKey, value]) => [ // Rename the keys to the expected meta key name. metaAttributes[attributeKey], value ]) ); if (Object.entries(nextMeta).length) { setMeta(nextMeta); } setAttributes(nextAttributes); }, ...props } ); }, "withMetaAttributeSource" ); function shimAttributeSource(settings) { const metaAttributes = Object.fromEntries( Object.entries(settings.attributes ?? {}).filter(([, { source }]) => source === "meta").map(([attributeKey, { meta }]) => [attributeKey, meta]) ); if (Object.entries(metaAttributes).length) { settings.edit = createWithMetaAttributeSource(metaAttributes)( settings.edit ); } return settings; } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/editor/custom-sources-backwards-compatibility/shim-attribute-source", shimAttributeSource ); ;// ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js function getUserLabel(user) { const avatar = user.avatar_urls && user.avatar_urls[24] ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { className: "editor-autocompleters__user-avatar", alt: "", src: user.avatar_urls[24] } ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-autocompleters__no-avatar" }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ avatar, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-autocompleters__user-name", children: user.name }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-autocompleters__user-slug", children: user.slug }) ] }); } var user_default = { name: "users", className: "editor-autocompleters__user", triggerPrefix: "@", useItems(filterValue) { const users = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getUsers } = select(external_wp_coreData_namespaceObject.store); return getUsers({ context: "view", search: encodeURIComponent(filterValue) }); }, [filterValue] ); const options = (0,external_wp_element_namespaceObject.useMemo)( () => users ? users.map((user) => ({ key: `user-${user.slug}`, value: user, label: getUserLabel(user) })) : [], [users] ); return [options]; }, getOptionCompletion(user) { return `@${user.slug}`; } }; ;// ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js function setDefaultCompleters(completers = []) { completers.push({ ...user_default }); return completers; } (0,external_wp_hooks_namespaceObject.addFilter)( "editor.Autocomplete.completers", "editor/autocompleters/set-default-completers", setDefaultCompleters ); ;// ./node_modules/@wordpress/editor/build-module/hooks/media-upload.js (0,external_wp_hooks_namespaceObject.addFilter)( "editor.MediaUpload", "core/editor/components/media-upload", () => external_wp_mediaUtils_namespaceObject.MediaUpload ); ;// ./node_modules/@wordpress/editor/build-module/hooks/pattern-overrides.js const { PatternOverridesControls, ResetOverridesControl, PatternOverridesBlockControls, PATTERN_TYPES: pattern_overrides_PATTERN_TYPES, PARTIAL_SYNCING_SUPPORTED_BLOCKS, PATTERN_SYNC_TYPES } = unlock(external_wp_patterns_namespaceObject.privateApis); const withPatternOverrideControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (BlockEdit) => (props) => { const isSupportedBlock = !!PARTIAL_SYNCING_SUPPORTED_BLOCKS[props.name]; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"), props.isSelected && isSupportedBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ControlsWithStoreSubscription, { ...props }), isSupportedBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesBlockControls, {}) ] }); }, "withPatternOverrideControls" ); function ControlsWithStoreSubscription(props) { const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); const { hasPatternOverridesSource, isEditingSyncedPattern } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getCurrentPostType, getEditedPostAttribute } = select(store_store); return { // For editing link to the site editor if the theme and user permissions support it. hasPatternOverridesSource: !!(0,external_wp_blocks_namespaceObject.getBlockBindingsSource)( "core/pattern-overrides" ), isEditingSyncedPattern: getCurrentPostType() === pattern_overrides_PATTERN_TYPES.user && getEditedPostAttribute("meta")?.wp_pattern_sync_status !== PATTERN_SYNC_TYPES.unsynced && getEditedPostAttribute("wp_pattern_sync_status") !== PATTERN_SYNC_TYPES.unsynced }; }, [] ); const bindings = props.attributes.metadata?.bindings; const hasPatternBindings = !!bindings && Object.values(bindings).some( (binding) => binding.source === "core/pattern-overrides" ); const shouldShowPatternOverridesControls = isEditingSyncedPattern && blockEditingMode === "default"; const shouldShowResetOverridesControl = !isEditingSyncedPattern && !!props.attributes.metadata?.name && blockEditingMode !== "disabled" && hasPatternBindings; if (!hasPatternOverridesSource) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ shouldShowPatternOverridesControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesControls, { ...props }), shouldShowResetOverridesControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetOverridesControl, { ...props }) ] }); } (0,external_wp_hooks_namespaceObject.addFilter)( "editor.BlockEdit", "core/editor/with-pattern-override-controls", withPatternOverrideControls ); ;// ./node_modules/@wordpress/editor/build-module/hooks/navigation-link-view-button.js const SUPPORTED_BLOCKS = ["core/navigation-link", "core/navigation-submenu"]; function NavigationViewButton({ attributes }) { const { kind, id, type } = attributes; const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); const onNavigateToEntityRecord = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_blockEditor_namespaceObject.store).getSettings().onNavigateToEntityRecord, [] ); const onViewPage = (0,external_wp_element_namespaceObject.useCallback)(() => { if (kind === "post-type" && type === "page" && id && onNavigateToEntityRecord) { onNavigateToEntityRecord({ postId: id, postType: type }); } }, [kind, id, type, onNavigateToEntityRecord]); if (kind !== "post-type" || type !== "page" || !id || !onNavigateToEntityRecord || blockEditingMode !== "contentOnly") { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockToolbarLastItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { name: "view", title: (0,external_wp_i18n_namespaceObject.__)("View"), onClick: onViewPage, children: (0,external_wp_i18n_namespaceObject.__)("View") } ) }) }); } const withNavigationViewButton = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (BlockEdit) => (props) => { const isSupportedBlock = SUPPORTED_BLOCKS.includes(props.name); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"), props.isSelected && isSupportedBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationViewButton, { ...props }) ] }); }, "withNavigationViewButton" ); (0,external_wp_hooks_namespaceObject.addFilter)( "editor.BlockEdit", "core/editor/with-navigation-view-button", withNavigationViewButton ); ;// ./node_modules/@wordpress/editor/build-module/hooks/template-part-navigation-edit-button.js const NAVIGATION_BLOCK_NAME = "core/navigation"; const TEMPLATE_PART_BLOCK_NAME = "core/template-part"; const BLOCK_INSPECTOR_AREA = "edit-post/block"; function TemplatePartNavigationEditButton({ clientId }) { const { selectBlock, flashBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { hasNavigationBlocks, firstNavigationBlockId, isNavigationEditable } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getClientIdsOfDescendants, getBlockName, getBlockEditingMode } = select(external_wp_blockEditor_namespaceObject.store); const descendants = getClientIdsOfDescendants(clientId); const navigationBlocksInTemplatePart = descendants.filter( (blockId) => getBlockName(blockId) === NAVIGATION_BLOCK_NAME ); const _hasNavigationBlocks = navigationBlocksInTemplatePart.length > 0; const _firstNavigationBlockId = _hasNavigationBlocks ? navigationBlocksInTemplatePart[0] : null; return { hasNavigationBlocks: _hasNavigationBlocks, firstNavigationBlockId: _firstNavigationBlockId, // We can't use the useBlockEditingMode hook here because the current // context is the template part, not the navigation block. isNavigationEditable: getBlockEditingMode(_firstNavigationBlockId) !== "disabled" }; }, [clientId] ); const onEditNavigation = (0,external_wp_element_namespaceObject.useCallback)(() => { if (firstNavigationBlockId) { selectBlock(firstNavigationBlockId); flashBlock(firstNavigationBlockId, 500); enableComplementaryArea("core", BLOCK_INSPECTOR_AREA); } }, [ firstNavigationBlockId, selectBlock, flashBlock, enableComplementaryArea ]); if (!hasNavigationBlocks || !isNavigationEditable) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockToolbarLastItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { label: (0,external_wp_i18n_namespaceObject.__)("Edit navigation"), onClick: onEditNavigation, children: (0,external_wp_i18n_namespaceObject.__)("Edit navigation") } ) }) }); } const withTemplatePartNavigationEditButton = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (BlockEdit) => (props) => { const isTemplatePart = props.name === TEMPLATE_PART_BLOCK_NAME; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"), props.isSelected && isTemplatePart && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TemplatePartNavigationEditButton, { clientId: props.clientId } ) ] }); }, "withTemplatePartNavigationEditButton" ); (0,external_wp_hooks_namespaceObject.addFilter)( "editor.BlockEdit", "core/editor/with-template-part-navigation-edit-button", withTemplatePartNavigationEditButton ); ;// ./node_modules/@wordpress/editor/build-module/hooks/index.js ;// ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js ;// ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js class AutosaveMonitor extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); this.needsAutosave = !!(props.isDirty && props.isAutosaveable); } componentDidMount() { if (!this.props.disableIntervalChecks) { this.setAutosaveTimer(); } } componentDidUpdate(prevProps) { if (this.props.disableIntervalChecks) { if (this.props.editsReference !== prevProps.editsReference) { this.props.autosave(); } return; } if (this.props.interval !== prevProps.interval) { clearTimeout(this.timerId); this.setAutosaveTimer(); } if (!this.props.isDirty) { this.needsAutosave = false; return; } if (this.props.isAutosaving && !prevProps.isAutosaving) { this.needsAutosave = false; return; } if (this.props.editsReference !== prevProps.editsReference) { this.needsAutosave = true; } } componentWillUnmount() { clearTimeout(this.timerId); } setAutosaveTimer(timeout = this.props.interval * 1e3) { this.timerId = setTimeout(() => { this.autosaveTimerHandler(); }, timeout); } autosaveTimerHandler() { if (!this.props.isAutosaveable) { this.setAutosaveTimer(1e3); return; } if (this.needsAutosave) { this.needsAutosave = false; this.props.autosave(); } this.setAutosaveTimer(); } render() { return null; } } var autosave_monitor_default = (0,external_wp_compose_namespaceObject.compose)([ (0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => { const { getReferenceByDistinctEdits } = select(external_wp_coreData_namespaceObject.store); const { isEditedPostDirty, isEditedPostAutosaveable, isAutosavingPost, getEditorSettings } = select(store_store); const { interval = getEditorSettings().autosaveInterval } = ownProps; return { editsReference: getReferenceByDistinctEdits(), isDirty: isEditedPostDirty(), isAutosaveable: isEditedPostAutosaveable(), isAutosaving: isAutosavingPost(), interval }; }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({ autosave() { const { autosave = dispatch(store_store).autosave } = ownProps; autosave(); } })) ])(AutosaveMonitor); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js var chevron_right_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js var chevron_left_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) }); ;// external ["wp","dom"] const external_wp_dom_namespaceObject = window["wp"]["dom"]; ;// ./node_modules/@wordpress/editor/build-module/utils/pageTypeBadge.js function usePageTypeBadge(postId) { const { isFrontPage, isPostsPage } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { canUser, getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser("read", { kind: "root", name: "site" }) ? getEditedEntityRecord("root", "site") : void 0; const _postId = parseInt(postId, 10); return { isFrontPage: siteSettings?.page_on_front === _postId, isPostsPage: siteSettings?.page_for_posts === _postId }; }); if (isFrontPage) { return (0,external_wp_i18n_namespaceObject.__)("Homepage"); } else if (isPostsPage) { return (0,external_wp_i18n_namespaceObject.__)("Posts Page"); } return false; } ;// ./node_modules/@wordpress/editor/build-module/components/document-bar/index.js const MotionButton = external_wp_components_namespaceObject.__unstableMotion.create(external_wp_components_namespaceObject.Button); function DocumentBar(props) { const { postId, postType, postTypeLabel, documentTitle, isNotFound, templateTitle, onNavigateToPreviousEntityRecord, isTemplatePreview } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostType, getCurrentPostId, getEditorSettings, getRenderingMode } = select(store_store); const { getEditedEntityRecord, getPostType, getCurrentTheme, isResolving: isResolvingSelector } = select(external_wp_coreData_namespaceObject.store); const _postType = getCurrentPostType(); const _postId = getCurrentPostId(); const _document = getEditedEntityRecord( "postType", _postType, _postId ); const { default_template_types: templateTypes = [] } = getCurrentTheme() ?? {}; const _templateInfo = getTemplateInfo({ templateTypes, template: _document }); const _postTypeLabel = getPostType(_postType)?.labels?.singular_name; return { postId: _postId, postType: _postType, postTypeLabel: _postTypeLabel, documentTitle: _document.title, isNotFound: !_document && !isResolvingSelector( "getEditedEntityRecord", "postType", _postType, _postId ), templateTitle: _templateInfo.title, onNavigateToPreviousEntityRecord: getEditorSettings().onNavigateToPreviousEntityRecord, isTemplatePreview: getRenderingMode() === "template-locked" }; }, []); const { open: openCommandCenter } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const isTemplate = TEMPLATE_POST_TYPES.includes(postType); const hasBackButton = !!onNavigateToPreviousEntityRecord; const entityTitle = isTemplate ? templateTitle : documentTitle; const title = props.title || entityTitle; const icon = props.icon; const pageTypeBadge = usePageTypeBadge(postId); const mountedRef = (0,external_wp_element_namespaceObject.useRef)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { mountedRef.current = true; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: dist_clsx("editor-document-bar", { "has-back-button": hasBackButton }), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { children: hasBackButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( MotionButton, { className: "editor-document-bar__back", icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_small_default : chevron_left_small_default, onClick: (event) => { event.stopPropagation(); onNavigateToPreviousEntityRecord(); }, size: "compact", initial: mountedRef.current ? { opacity: 0, transform: "translateX(15%)" } : false, animate: { opacity: 1, transform: "translateX(0%)" }, exit: { opacity: 0, transform: "translateX(15%)" }, transition: isReducedMotion ? { duration: 0 } : void 0, children: (0,external_wp_i18n_namespaceObject.__)("Back") } ) }), !isTemplate && isTemplatePreview && !hasBackButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.BlockIcon, { icon: layout_default, className: "editor-document-bar__icon-layout" } ), isNotFound ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Document not found") }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Button, { className: "editor-document-bar__command", onClick: () => openCommandCenter(), size: "compact", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__unstableMotion.div, { className: "editor-document-bar__title", initial: mountedRef.current ? { opacity: 0, transform: hasBackButton ? "translateX(15%)" : "translateX(-15%)" } : false, animate: { opacity: 1, transform: "translateX(0%)" }, transition: isReducedMotion ? { duration: 0 } : void 0, children: [ icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalText, { size: "body", as: "h1", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-document-bar__post-title", children: title ? (0,external_wp_dom_namespaceObject.__unstableStripHTML)(title) : (0,external_wp_i18n_namespaceObject.__)("No title") }), pageTypeBadge && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-document-bar__post-type-label", children: `\xB7 ${pageTypeBadge}` }), postTypeLabel && !props.title && !pageTypeBadge && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-document-bar__post-type-label", children: `\xB7 ${(0,external_wp_htmlEntities_namespaceObject.decodeEntities)( postTypeLabel )}` }) ] }) ] }, hasBackButton ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-document-bar__shortcut", children: external_wp_keycodes_namespaceObject.displayShortcut.primary("k") }) ] } ) ] } ); } ;// external ["wp","richText"] const external_wp_richText_namespaceObject = window["wp"]["richText"]; ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js const TableOfContentsItem = ({ children, isValid, isDisabled, level, href, onSelect }) => { function handleClick(event) { if (isDisabled) { event.preventDefault(); return; } onSelect(); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "li", { className: dist_clsx( "document-outline__item", `is-${level.toLowerCase()}`, { "is-invalid": !isValid, "is-disabled": isDisabled } ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "a", { href, className: "document-outline__button", "aria-disabled": isDisabled, onClick: handleClick, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { className: "document-outline__emdash", "aria-hidden": "true" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { className: "document-outline__level", children: level }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "document-outline__item-content", children }) ] } ) } ); }; var item_default = TableOfContentsItem; ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js const emptyHeadingContent = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { children: (0,external_wp_i18n_namespaceObject.__)("(Empty heading)") }); const incorrectLevelContent = [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { children: (0,external_wp_i18n_namespaceObject.__)("(Incorrect heading level)") }, "incorrect-message") ]; const singleH1Headings = [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-h1"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { children: (0,external_wp_i18n_namespaceObject.__)("(Your theme may already use a H1 for the post title)") }, "incorrect-message-h1") ]; const multipleH1Headings = [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-multiple-h1"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { children: (0,external_wp_i18n_namespaceObject.__)("(Multiple H1 headings are not recommended)") }, "incorrect-message-multiple-h1") ]; function EmptyOutlineIllustration() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.SVG, { width: "138", height: "148", viewBox: "0 0 138 148", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { width: "138", height: "148", rx: "4", fill: "#F0F6FC" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { x1: "44", y1: "28", x2: "24", y2: "28", stroke: "#DDDDDD" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { x: "48", y: "16", width: "27", height: "23", rx: "4", fill: "#DDDDDD" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Path, { d: "M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z", fill: "black" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { x1: "55", y1: "59", x2: "24", y2: "59", stroke: "#DDDDDD" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { x: "59", y: "47", width: "29", height: "23", rx: "4", fill: "#DDDDDD" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Path, { d: "M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z", fill: "black" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { x1: "80", y1: "90", x2: "24", y2: "90", stroke: "#DDDDDD" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { x: "84", y: "78", width: "30", height: "23", rx: "4", fill: "#F0B849" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Path, { d: "M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z", fill: "black" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { x1: "66", y1: "121", x2: "24", y2: "121", stroke: "#DDDDDD" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { x: "70", y: "109", width: "29", height: "23", rx: "4", fill: "#DDDDDD" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Path, { d: "M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z", fill: "black" } ) ] } ); } const computeOutlineHeadings = (blocks = []) => { return blocks.filter((block) => block.name === "core/heading").map((block) => ({ ...block, level: block.attributes.level, isEmpty: isEmptyHeading(block) })); }; const isEmptyHeading = (heading) => !heading.attributes.content || heading.attributes.content.trim().length === 0; function DocumentOutline({ onSelect, hasOutlineItemsDisabled }) { const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { title, isTitleSupported } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedPostAttribute } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); const postType = getPostType(getEditedPostAttribute("type")); return { title: getEditedPostAttribute("title"), isTitleSupported: postType?.supports?.title ?? false }; }); const blocks = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getClientIdsWithDescendants, getBlock } = select(external_wp_blockEditor_namespaceObject.store); const clientIds = getClientIdsWithDescendants(); return clientIds.map((id) => getBlock(id)); }); const contentBlocks = (0,external_wp_data_namespaceObject.useSelect)((select) => { if (select(store_store).getRenderingMode() === "post-only") { return void 0; } const { getBlocksByName, getClientIdsOfDescendants } = select(external_wp_blockEditor_namespaceObject.store); const [postContentClientId] = getBlocksByName("core/post-content"); if (!postContentClientId) { return void 0; } return getClientIdsOfDescendants(postContentClientId); }, []); const prevHeadingLevelRef = (0,external_wp_element_namespaceObject.useRef)(1); const headings = (0,external_wp_element_namespaceObject.useMemo)( () => computeOutlineHeadings(blocks), [blocks] ); if (headings.length < 1) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-document-outline has-no-headings", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EmptyOutlineIllustration, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( "Navigate the structure of your document and address issues like empty or incorrect heading levels." ) }) ] }); } const titleNode = document.querySelector(".editor-post-title__input"); const hasTitle = isTitleSupported && title && titleNode; const countByLevel = headings.reduce( (acc, heading) => ({ ...acc, [heading.level]: (acc[heading.level] || 0) + 1 }), {} ); const hasMultipleH1 = countByLevel[1] > 1; function isContentBlock(clientId) { return Array.isArray(contentBlocks) ? contentBlocks.includes(clientId) : true; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "document-outline", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { children: [ hasTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( item_default, { level: (0,external_wp_i18n_namespaceObject.__)("Title"), isValid: true, onSelect, href: `#${titleNode.id}`, isDisabled: hasOutlineItemsDisabled, children: title } ), headings.map((item) => { const isIncorrectLevel = item.level > prevHeadingLevelRef.current + 1; const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle); prevHeadingLevelRef.current = item.level; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( item_default, { level: `H${item.level}`, isValid, isDisabled: hasOutlineItemsDisabled || !isContentBlock(item.clientId), href: `#block-${item.clientId}`, onSelect: () => { selectBlock(item.clientId); onSelect?.(); }, children: [ item.isEmpty ? emptyHeadingContent : (0,external_wp_richText_namespaceObject.getTextContent)( (0,external_wp_richText_namespaceObject.create)({ html: item.attributes.content }) ), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings ] }, item.clientId ); }) ] }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js function DocumentOutlineCheck({ children }) { const hasHeadings = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getGlobalBlockCount } = select(external_wp_blockEditor_namespaceObject.store); return getGlobalBlockCount("core/heading") > 0; }); if (!hasHeadings) { return null; } return children; } ;// ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js function EditorKeyboardShortcutsRegister() { const { registerShortcut } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { registerShortcut({ name: "core/editor/toggle-mode", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Switch between visual editor and code editor."), keyCombination: { modifier: "secondary", character: "m" } }); registerShortcut({ name: "core/editor/save", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Save your changes."), keyCombination: { modifier: "primary", character: "s" } }); registerShortcut({ name: "core/editor/undo", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Undo your last changes."), keyCombination: { modifier: "primary", character: "z" } }); registerShortcut({ name: "core/editor/redo", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Redo your last undo."), keyCombination: { modifier: "primaryShift", character: "z" }, // Disable on Apple OS because it conflicts with the browser's // history shortcut. It's a fine alias for both Windows and Linux. // Since there's no conflict for Ctrl+Shift+Z on both Windows and // Linux, we keep it as the default for consistency. aliases: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? [] : [ { modifier: "primary", character: "y" } ] }); registerShortcut({ name: "core/editor/toggle-list-view", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Show or hide the List View."), keyCombination: { modifier: "access", character: "o" } }); registerShortcut({ name: "core/editor/toggle-distraction-free", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Enter or exit distraction free mode."), keyCombination: { modifier: "primaryShift", character: "\\" } }); registerShortcut({ name: "core/editor/toggle-sidebar", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Show or hide the Settings panel."), keyCombination: { modifier: "primaryShift", character: "," } }); registerShortcut({ name: "core/editor/keyboard-shortcuts", category: "main", description: (0,external_wp_i18n_namespaceObject.__)("Display these keyboard shortcuts."), keyCombination: { modifier: "access", character: "h" } }); registerShortcut({ name: "core/editor/next-region", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Navigate to the next part of the editor."), keyCombination: { modifier: "ctrl", character: "`" }, aliases: [ { modifier: "access", character: "n" } ] }); registerShortcut({ name: "core/editor/previous-region", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Navigate to the previous part of the editor."), keyCombination: { modifier: "ctrlShift", character: "`" }, aliases: [ { modifier: "access", character: "p" }, { modifier: "ctrlShift", character: "~" } ] }); }, [registerShortcut]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, {}); } var register_shortcuts_default = EditorKeyboardShortcutsRegister; ;// ./node_modules/@wordpress/icons/build-module/library/redo.js var redo_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.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/undo.js var undo_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.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" }) }); ;// ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js function EditorHistoryRedo(props, ref) { const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift("z") : external_wp_keycodes_namespaceObject.displayShortcut.primary("y"); const hasRedo = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).hasEditorRedo(), [] ); const { redo } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...props, ref, icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? redo_default : undo_default, label: (0,external_wp_i18n_namespaceObject.__)("Redo"), shortcut, "aria-disabled": !hasRedo, onClick: hasRedo ? redo : void 0, className: "editor-history__redo" } ); } var redo_redo_default = (0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryRedo); ;// ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js function EditorHistoryUndo(props, ref) { const hasUndo = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).hasEditorUndo(), [] ); const { undo } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...props, ref, icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? undo_default : redo_default, label: (0,external_wp_i18n_namespaceObject.__)("Undo"), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary("z"), "aria-disabled": !hasUndo, onClick: hasUndo ? undo : void 0, className: "editor-history__undo" } ); } var undo_undo_default = (0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryUndo); ;// ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js function TemplateValidationNotice() { const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); const isValid = (0,external_wp_data_namespaceObject.useSelect)((select) => { return select(external_wp_blockEditor_namespaceObject.store).isValidTemplate(); }, []); const { setTemplateValidity, synchronizeTemplate } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); if (isValid) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Notice, { className: "editor-template-validation-notice", isDismissible: false, status: "warning", actions: [ { label: (0,external_wp_i18n_namespaceObject.__)("Keep it as is"), onClick: () => setTemplateValidity(true) }, { label: (0,external_wp_i18n_namespaceObject.__)("Reset the template"), onClick: () => setShowConfirmDialog(true) } ], children: (0,external_wp_i18n_namespaceObject.__)( "The content of your post doesn\u2019t match the template assigned to your post type." ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: showConfirmDialog, confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Reset"), onConfirm: () => { setShowConfirmDialog(false); synchronizeTemplate(); }, onCancel: () => setShowConfirmDialog(false), size: "medium", children: (0,external_wp_i18n_namespaceObject.__)( "Resetting the template may result in loss of content, do you want to continue?" ) } ) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js function EditorNotices() { const { notices } = (0,external_wp_data_namespaceObject.useSelect)( (select) => ({ notices: select(external_wp_notices_namespaceObject.store).getNotices() }), [] ); const { removeNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const dismissibleNotices = notices.filter( ({ isDismissible, type }) => isDismissible && type === "default" ); const nonDismissibleNotices = notices.filter( ({ isDismissible, type }) => !isDismissible && type === "default" ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.NoticeList, { notices: nonDismissibleNotices, className: "components-editor-notices__pinned" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.NoticeList, { notices: dismissibleNotices, className: "components-editor-notices__dismissible", onRemove: removeNotice, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateValidationNotice, {}) } ) ] }); } var editor_notices_default = EditorNotices; ;// ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js const MAX_VISIBLE_NOTICES = -3; function EditorSnackbars() { const notices = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_notices_namespaceObject.store).getNotices(), [] ); const { removeNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const snackbarNotices = notices.filter(({ type }) => type === "snackbar").slice(MAX_VISIBLE_NOTICES); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SnackbarList, { notices: snackbarNotices, className: "components-editor-notices__snackbar", onRemove: removeNotice } ); } ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js function EntityRecordItem({ record, checked, onChange }) { const { name, kind, title, key } = record; const { entityRecordTitle, hasPostMetaChanges } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if ("postType" !== kind || "wp_template" !== name) { return { entityRecordTitle: title, hasPostMetaChanges: unlock( select(store_store) ).hasPostMetaChanges(name, key) }; } const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( kind, name, key ); const { default_template_types: templateTypes = [] } = select(external_wp_coreData_namespaceObject.store).getCurrentTheme() ?? {}; return { entityRecordTitle: getTemplateInfo({ template, templateTypes }).title, hasPostMetaChanges: unlock( select(store_store) ).hasPostMetaChanges(name, key) }; }, [name, kind, title, key] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entityRecordTitle) || (0,external_wp_i18n_namespaceObject.__)("Untitled"), checked, onChange, className: "entities-saved-states__change-control" } ) }), hasPostMetaChanges && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "entities-saved-states__changes", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: (0,external_wp_i18n_namespaceObject.__)("Post Meta.") }) }) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js const { getGlobalStylesChanges, GlobalStylesContext: entity_type_list_GlobalStylesContext } = unlock( external_wp_blockEditor_namespaceObject.privateApis ); function getEntityDescription(entity, count) { switch (entity) { case "site": return 1 === count ? (0,external_wp_i18n_namespaceObject.__)("This change will affect your whole site.") : (0,external_wp_i18n_namespaceObject.__)("These changes will affect your whole site."); case "wp_template": return (0,external_wp_i18n_namespaceObject.__)( "This change will affect other parts of your site that use this template." ); case "page": case "post": return (0,external_wp_i18n_namespaceObject.__)("The following has been modified."); } } function GlobalStylesDescription({ record }) { const { user: currentEditorGlobalStyles } = (0,external_wp_element_namespaceObject.useContext)(entity_type_list_GlobalStylesContext); const savedRecord = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecord( record.kind, record.name, record.key ), [record.kind, record.name, record.key] ); const globalStylesChanges = getGlobalStylesChanges( currentEditorGlobalStyles, savedRecord, { maxResults: 10 } ); return globalStylesChanges.length ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "entities-saved-states__changes", children: globalStylesChanges.map((change) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: change }, change)) }) : null; } function EntityDescription({ record, count }) { if ("globalStyles" === record?.name) { return null; } const description = getEntityDescription(record?.name, count); return description ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { children: description }) : null; } function EntityTypeList({ list, unselectedEntities, setUnselectedEntities }) { const count = list.length; const firstRecord = list[0]; const entityConfig = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getEntityConfig( firstRecord.kind, firstRecord.name ), [firstRecord.kind, firstRecord.name] ); let entityLabel = entityConfig.label; if (firstRecord?.name === "wp_template_part") { entityLabel = 1 === count ? (0,external_wp_i18n_namespaceObject.__)("Template Part") : (0,external_wp_i18n_namespaceObject.__)("Template Parts"); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.PanelBody, { title: entityLabel, initialOpen: true, className: "entities-saved-states__panel-body", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityDescription, { record: firstRecord, count }), list.map((record) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EntityRecordItem, { record, checked: !unselectedEntities.some( (elt) => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property ), onChange: (value) => setUnselectedEntities(record, value) }, record.key || record.property ); }), "globalStyles" === firstRecord?.name && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesDescription, { record: firstRecord }) ] } ); } ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/hooks/use-is-dirty.js const useIsDirty = () => { const { editedEntities, siteEdits, siteEntityConfig } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { __experimentalGetDirtyEntityRecords, getEntityRecordEdits, getEntityConfig } = select(external_wp_coreData_namespaceObject.store); return { editedEntities: __experimentalGetDirtyEntityRecords(), siteEdits: getEntityRecordEdits("root", "site"), siteEntityConfig: getEntityConfig("root", "site") }; }, [] ); const dirtyEntityRecords = (0,external_wp_element_namespaceObject.useMemo)(() => { const editedEntitiesWithoutSite = editedEntities.filter( (record) => !(record.kind === "root" && record.name === "site") ); const siteEntityLabels = siteEntityConfig?.meta?.labels ?? {}; const editedSiteEntities = []; for (const property in siteEdits) { editedSiteEntities.push({ kind: "root", name: "site", title: siteEntityLabels[property] || property, property }); } return [...editedEntitiesWithoutSite, ...editedSiteEntities]; }, [editedEntities, siteEdits, siteEntityConfig]); const [unselectedEntities, _setUnselectedEntities] = (0,external_wp_element_namespaceObject.useState)([]); const setUnselectedEntities = ({ kind, name, key, property }, checked) => { if (checked) { _setUnselectedEntities( unselectedEntities.filter( (elt) => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property ) ); } else { _setUnselectedEntities([ ...unselectedEntities, { kind, name, key, property } ]); } }; const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0; return { dirtyEntityRecords, isDirty, setUnselectedEntities, unselectedEntities }; }; ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js function identity(values) { return values; } function EntitiesSavedStates({ close, renderDialog, variant }) { const isDirtyProps = useIsDirty(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EntitiesSavedStatesExtensible, { close, renderDialog, variant, ...isDirtyProps } ); } function EntitiesSavedStatesExtensible({ additionalPrompt = void 0, close, onSave = identity, saveEnabled: saveEnabledProp = void 0, saveLabel = (0,external_wp_i18n_namespaceObject.__)("Save"), renderDialog, dirtyEntityRecords, isDirty, setUnselectedEntities, unselectedEntities, variant = "default" }) { const saveButtonRef = (0,external_wp_element_namespaceObject.useRef)(); const { saveDirtyEntities } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); const partitionedSavables = dirtyEntityRecords.reduce((acc, record) => { const { name } = record; if (!acc[name]) { acc[name] = []; } acc[name].push(record); return acc; }, {}); const { site: siteSavables, wp_template: templateSavables, wp_template_part: templatePartSavables, ...contentSavables } = partitionedSavables; const sortedPartitionedSavables = [ siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables) ].filter(Array.isArray); const saveEnabled = saveEnabledProp ?? isDirty; const dismissPanel = (0,external_wp_element_namespaceObject.useCallback)(() => close(), [close]); const [saveDialogRef, saveDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ onClose: () => dismissPanel() }); const dialogLabelId = (0,external_wp_compose_namespaceObject.useInstanceId)( EntitiesSavedStatesExtensible, "entities-saved-states__panel-label" ); const dialogDescriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)( EntitiesSavedStatesExtensible, "entities-saved-states__panel-description" ); const selectItemsToSaveDescription = !!dirtyEntityRecords.length ? (0,external_wp_i18n_namespaceObject.__)("Select the items you want to save.") : void 0; const isInline = variant === "inline"; const actionButtons = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FlexItem, { isBlock: isInline ? false : true, as: external_wp_components_namespaceObject.Button, variant: isInline ? "tertiary" : "secondary", size: isInline ? void 0 : "compact", onClick: dismissPanel, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FlexItem, { isBlock: isInline ? false : true, as: external_wp_components_namespaceObject.Button, ref: saveButtonRef, variant: "primary", size: isInline ? void 0 : "compact", disabled: !saveEnabled, accessibleWhenDisabled: true, onClick: () => saveDirtyEntities({ onSave, dirtyEntityRecords, entitiesToSkip: unselectedEntities, close }), className: "editor-entities-saved-states__save-button", children: saveLabel } ) ] }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { ref: renderDialog ? saveDialogRef : void 0, ...renderDialog && saveDialogProps, className: dist_clsx("entities-saved-states__panel", { "is-inline": isInline }), role: renderDialog ? "dialog" : void 0, "aria-labelledby": renderDialog ? dialogLabelId : void 0, "aria-describedby": renderDialog ? dialogDescriptionId : void 0, children: [ !isInline && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { className: "entities-saved-states__panel-header", gap: 2, children: actionButtons }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "entities-saved-states__text-prompt", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "entities-saved-states__text-prompt--header-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "strong", { id: renderDialog ? dialogLabelId : void 0, className: "entities-saved-states__text-prompt--header", children: (0,external_wp_i18n_namespaceObject.__)("Are you ready to save?") } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { id: renderDialog ? dialogDescriptionId : void 0, children: [ additionalPrompt, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "entities-saved-states__text-prompt--changes-count", children: isDirty ? (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of site changes waiting to be saved. */ (0,external_wp_i18n_namespaceObject._n)( "There is <strong>%d site change</strong> waiting to be saved.", "There are <strong>%d site changes</strong> waiting to be saved.", dirtyEntityRecords.length ), dirtyEntityRecords.length ), { strong: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}) } ) : selectItemsToSaveDescription }) ] }) ] }), sortedPartitionedSavables.map((list) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EntityTypeList, { list, unselectedEntities, setUnselectedEntities }, list[0].name ); }), isInline && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Flex, { direction: "row", justify: "flex-end", className: "entities-saved-states__panel-footer", children: actionButtons } ) ] } ); } ;// ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js function getContent() { try { return (0,external_wp_data_namespaceObject.select)(store_store).getEditedPostContent(); } catch (error) { } } function CopyButton({ text, children, variant = "secondary" }) { const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant, ref, children }); } class ErrorBoundary extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); this.state = { error: null }; } componentDidCatch(error) { (0,external_wp_hooks_namespaceObject.doAction)("editor.ErrorBoundary.errorLogged", error); } static getDerivedStateFromError(error) { return { error }; } render() { const { error } = this.state; const { canCopyContent = false } = this.props; if (!error) { return this.props.children; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { className: "editor-error-boundary", alignment: "baseline", spacing: 4, justify: "space-between", expanded: false, wrap: true, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)("The editor has encountered an unexpected error.") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, children: [ canCopyContent && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, { text: getContent, children: (0,external_wp_i18n_namespaceObject.__)("Copy contents") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, { variant: "primary", text: error?.stack, children: (0,external_wp_i18n_namespaceObject.__)("Copy error") }) ] }) ] } ); } } var error_boundary_default = ErrorBoundary; ;// ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame; let hasStorageSupport; const hasSessionStorageSupport = () => { if (hasStorageSupport !== void 0) { return hasStorageSupport; } try { window.sessionStorage.setItem("__wpEditorTestSessionStorage", ""); window.sessionStorage.removeItem("__wpEditorTestSessionStorage"); hasStorageSupport = true; } catch { hasStorageSupport = false; } return hasStorageSupport; }; function useAutosaveNotice() { const { postId, isEditedPostNew, hasRemoteAutosave } = (0,external_wp_data_namespaceObject.useSelect)( (select) => ({ postId: select(store_store).getCurrentPostId(), isEditedPostNew: select(store_store).isEditedPostNew(), hasRemoteAutosave: !!select(store_store).getEditorSettings().autosave }), [] ); const { getEditedPostAttribute } = (0,external_wp_data_namespaceObject.useSelect)(store_store); const { createWarningNotice, removeNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { editPost, resetEditorBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); (0,external_wp_element_namespaceObject.useEffect)(() => { let localAutosave = localAutosaveGet(postId, isEditedPostNew); if (!localAutosave) { return; } try { localAutosave = JSON.parse(localAutosave); } catch { return; } const { post_title: title, content, excerpt } = localAutosave; const edits = { title, content, excerpt }; { const hasDifference = Object.keys(edits).some((key) => { return edits[key] !== getEditedPostAttribute(key); }); if (!hasDifference) { localAutosaveClear(postId, isEditedPostNew); return; } } if (hasRemoteAutosave) { return; } const id = "wpEditorAutosaveRestore"; createWarningNotice( (0,external_wp_i18n_namespaceObject.__)( "The backup of this post in your browser is different from the version below." ), { id, actions: [ { label: (0,external_wp_i18n_namespaceObject.__)("Restore the backup"), onClick() { const { content: editsContent, ...editsWithoutContent } = edits; editPost(editsWithoutContent); resetEditorBlocks((0,external_wp_blocks_namespaceObject.parse)(edits.content)); removeNotice(id); } } ] } ); }, [isEditedPostNew, postId]); } function useAutosavePurge() { const { postId, isEditedPostNew, isDirty, isAutosaving, didError } = (0,external_wp_data_namespaceObject.useSelect)( (select) => ({ postId: select(store_store).getCurrentPostId(), isEditedPostNew: select(store_store).isEditedPostNew(), isDirty: select(store_store).isEditedPostDirty(), isAutosaving: select(store_store).isAutosavingPost(), didError: select(store_store).didPostSaveRequestFail() }), [] ); const lastIsDirtyRef = (0,external_wp_element_namespaceObject.useRef)(isDirty); const lastIsAutosavingRef = (0,external_wp_element_namespaceObject.useRef)(isAutosaving); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!didError && (lastIsAutosavingRef.current && !isAutosaving || lastIsDirtyRef.current && !isDirty)) { localAutosaveClear(postId, isEditedPostNew); } lastIsDirtyRef.current = isDirty; lastIsAutosavingRef.current = isAutosaving; }, [isDirty, isAutosaving, didError]); const wasEditedPostNew = (0,external_wp_compose_namespaceObject.usePrevious)(isEditedPostNew); const prevPostId = (0,external_wp_compose_namespaceObject.usePrevious)(postId); (0,external_wp_element_namespaceObject.useEffect)(() => { if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) { localAutosaveClear(postId, true); } }, [isEditedPostNew, postId]); } function LocalAutosaveMonitor() { const { autosave } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const deferredAutosave = (0,external_wp_element_namespaceObject.useCallback)(() => { requestIdleCallback(() => autosave({ local: true })); }, []); useAutosaveNotice(); useAutosavePurge(); const localAutosaveInterval = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getEditorSettings().localAutosaveInterval, [] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( autosave_monitor_default, { interval: localAutosaveInterval, autosave: deferredAutosave } ); } var local_autosave_monitor_default = (0,external_wp_compose_namespaceObject.ifCondition)(hasSessionStorageSupport)(LocalAutosaveMonitor); ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js function PageAttributesCheck({ children }) { const supportsPageAttributes = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedPostAttribute } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); const postType = getPostType(getEditedPostAttribute("type")); return !!postType?.supports?.["page-attributes"]; }, []); if (!supportsPageAttributes) { return null; } return children; } var check_check_default = PageAttributesCheck; ;// ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js function checkSupport(supports = {}, key) { if (supports[key] !== void 0) { return !!supports[key]; } const [topKey, subKey] = key.split("."); const [subProperties] = Array.isArray(supports[topKey]) ? supports[topKey] : []; return Array.isArray(subProperties) ? subProperties.includes(subKey) : !!subProperties?.[subKey]; } function PostTypeSupportCheck({ children, supportKeys }) { const postType = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedPostAttribute } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); return getPostType(getEditedPostAttribute("type")); }, []); let isSupported = !!postType; if (postType) { isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some((key) => checkSupport(postType.supports, key)); } if (!isSupported) { return null; } return children; } var post_type_support_check_default = PostTypeSupportCheck; ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js function PageAttributesOrder() { const order = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getEditedPostAttribute("menu_order") ?? 0, [] ); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const [orderInput, setOrderInput] = (0,external_wp_element_namespaceObject.useState)(null); const setUpdatedOrder = (value2) => { setOrderInput(value2); const newOrder = Number(value2); if (Number.isInteger(newOrder) && value2.trim?.() !== "") { editPost({ menu_order: newOrder }); } }; const value = orderInput ?? order; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalNumberControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Order"), help: (0,external_wp_i18n_namespaceObject.__)("Set the page order."), value, onChange: setUpdatedOrder, hideLabelFromVision: true, onBlur: () => { setOrderInput(null); } } ) }) }); } function PageAttributesOrderWithChecks() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "page-attributes", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesOrder, {}) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-panel-row/index.js const PostPanelRow = (0,external_wp_element_namespaceObject.forwardRef)(({ className, label, children }, ref) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { className: dist_clsx("editor-post-panel__row", className), ref, children: [ label && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-panel__row-label", children: label }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-panel__row-control", children }) ] } ); }); var post_panel_row_default = PostPanelRow; ;// ./node_modules/@wordpress/editor/build-module/utils/terms.js function terms_buildTermsTree(flatTerms) { const flatTermsWithParentAndChildren = flatTerms.map((term) => { return { children: [], parent: void 0, ...term }; }); if (flatTermsWithParentAndChildren.some( ({ parent }) => parent === void 0 )) { return flatTermsWithParentAndChildren; } const termsByParent = flatTermsWithParentAndChildren.reduce( (acc, term) => { const { parent } = term; if (!acc[parent]) { acc[parent] = []; } acc[parent].push(term); return acc; }, {} ); const fillWithChildren = (terms) => { return terms.map((term) => { const children = termsByParent[term.id]; return { ...term, children: children && children.length ? fillWithChildren(children) : [] }; }); }; return fillWithChildren(termsByParent["0"] || []); } const unescapeString = (arg) => { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(arg); }; const unescapeTerm = (term) => { return { ...term, name: unescapeString(term.name) }; }; const unescapeTerms = (terms) => { return (terms ?? []).map(unescapeTerm); }; ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js function getTitle(post) { return post?.title?.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#${post.id} (${(0,external_wp_i18n_namespaceObject.__)("no title")})`; } const parent_getItemPriority = (name, searchValue) => { const normalizedName = remove_accents_default()(name || "").toLowerCase(); const normalizedSearch = remove_accents_default()(searchValue || "").toLowerCase(); if (normalizedName === normalizedSearch) { return 0; } if (normalizedName.startsWith(normalizedSearch)) { return normalizedName.length; } return Infinity; }; function parent_PageAttributesParent() { const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(false); const { isHierarchical, parentPostId, parentPostTitle, pageItems, isLoading } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getPostType, getEntityRecords, getEntityRecord, isResolving } = select(external_wp_coreData_namespaceObject.store); const { getCurrentPostId, getEditedPostAttribute } = select(store_store); const postTypeSlug = getEditedPostAttribute("type"); const pageId = getEditedPostAttribute("parent"); const pType = getPostType(postTypeSlug); const postId = getCurrentPostId(); const postIsHierarchical = pType?.hierarchical ?? false; const query = { per_page: 100, exclude: postId, parent_exclude: postId, orderby: "menu_order", order: "asc", _fields: "id,title,parent" }; if (!!fieldValue) { query.search = fieldValue; } const parentPost = pageId ? getEntityRecord("postType", postTypeSlug, pageId) : null; return { isHierarchical: postIsHierarchical, parentPostId: pageId, parentPostTitle: parentPost ? getTitle(parentPost) : "", pageItems: postIsHierarchical ? getEntityRecords("postType", postTypeSlug, query) : null, isLoading: postIsHierarchical ? isResolving("getEntityRecords", [ "postType", postTypeSlug, query ]) : false }; }, [fieldValue] ); const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { const getOptionsFromTree = (tree2, level = 0) => { const mappedNodes = tree2.map((treeNode) => [ { value: treeNode.id, label: "\u2014 ".repeat(level) + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(treeNode.name), rawName: treeNode.name }, ...getOptionsFromTree(treeNode.children || [], level + 1) ]); const sortedNodes = mappedNodes.sort(([a], [b]) => { const priorityA = parent_getItemPriority(a.rawName, fieldValue); const priorityB = parent_getItemPriority(b.rawName, fieldValue); return priorityA >= priorityB ? 1 : -1; }); return sortedNodes.flat(); }; if (!pageItems) { return []; } let tree = pageItems.map((item) => ({ id: item.id, parent: item.parent, name: getTitle(item) })); if (!fieldValue) { tree = terms_buildTermsTree(tree); } const opts = getOptionsFromTree(tree); const optsHasParent = opts.find( (item) => item.value === parentPostId ); if (parentPostTitle && !optsHasParent) { opts.unshift({ value: parentPostId, label: parentPostTitle }); } return opts; }, [pageItems, fieldValue, parentPostTitle, parentPostId]); if (!isHierarchical) { return null; } const handleKeydown = (inputValue) => { setFieldValue(inputValue); }; const handleChange = (selectedPostId) => { editPost({ parent: selectedPostId }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ComboboxControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, className: "editor-page-attributes__parent", label: (0,external_wp_i18n_namespaceObject.__)("Parent"), help: (0,external_wp_i18n_namespaceObject.__)("Choose a parent page."), value: parentPostId, options: parentOptions, onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300), onChange: handleChange, hideLabelFromVision: true, isLoading } ); } function PostParentToggle({ isOpen, onClick }) { const parentPost = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedPostAttribute } = select(store_store); const parentPostId = getEditedPostAttribute("parent"); if (!parentPostId) { return null; } const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const postTypeSlug = getEditedPostAttribute("type"); return getEntityRecord("postType", postTypeSlug, parentPostId); }, []); const parentTitle = (0,external_wp_element_namespaceObject.useMemo)( () => !parentPost ? (0,external_wp_i18n_namespaceObject.__)("None") : getTitle(parentPost), [parentPost] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", className: "editor-post-parent__panel-toggle", variant: "tertiary", "aria-expanded": isOpen, "aria-label": ( // translators: %s: Current post parent. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Change parent: %s"), parentTitle) ), onClick, children: parentTitle } ); } function ParentRow() { const homeUrl = (0,external_wp_data_namespaceObject.useSelect)((select) => { return select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "__unstableBase")?.home; }, []); const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: "left-start", offset: 36, shift: true }), [popoverAnchor] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Parent"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, className: "editor-post-parent__panel-dropdown", contentClassName: "editor-post-parent__panel-dialog", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostParentToggle, { isOpen, onClick: onToggle }), renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-parent", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)("Parent"), onClose } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The home URL of the WordPress installation without the scheme. */ (0,external_wp_i18n_namespaceObject.__)( 'Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %s<wbr />/services<wbr />/pricing.' ), (0,external_wp_url_namespaceObject.filterURLForDisplay)(homeUrl).replace( /([/.])/g, "<wbr />$1" ) ), { wbr: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("wbr", {}) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.__)( "They also show up as sub-items in the default navigation menu. <a>Learn more.</a>" ), { a: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)( "https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes" ) } ) } ) }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(parent_PageAttributesParent, {}) ] }) } ) }); } var parent_parent_default = parent_PageAttributesParent; ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/panel.js const PANEL_NAME = "page-attributes"; function AttributesPanel() { const { isEnabled, postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedPostAttribute, isEditorPanelEnabled } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); return { isEnabled: isEditorPanelEnabled(PANEL_NAME), postType: getPostType(getEditedPostAttribute("type")) }; }, []); if (!isEnabled || !postType) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ParentRow, {}); } function PageAttributesPanel() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AttributesPanel, {}) }); } ;// ./node_modules/@wordpress/icons/build-module/library/add-template.js var add_template_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, { fillRule: "evenodd", clipRule: "evenodd", d: "M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z" } ) }); ;// ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template-modal.js const DEFAULT_TITLE = (0,external_wp_i18n_namespaceObject.__)("Custom Template"); function CreateNewTemplateModal({ onClose }) { const { defaultBlockTemplate, onNavigateToEntityRecord } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEditorSettings, getCurrentTemplateId } = select(store_store); return { defaultBlockTemplate: getEditorSettings().defaultBlockTemplate, onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord, getTemplateId: getCurrentTemplateId }; } ); const { createTemplate } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(""); const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); const cancel = () => { setTitle(""); onClose(); }; const submit = async (event) => { event.preventDefault(); if (isBusy) { return; } setIsBusy(true); const newTemplateContent = defaultBlockTemplate ?? (0,external_wp_blocks_namespaceObject.serialize)([ (0,external_wp_blocks_namespaceObject.createBlock)( "core/group", { tagName: "header", layout: { inherit: true } }, [ (0,external_wp_blocks_namespaceObject.createBlock)("core/site-title"), (0,external_wp_blocks_namespaceObject.createBlock)("core/site-tagline") ] ), (0,external_wp_blocks_namespaceObject.createBlock)("core/separator"), (0,external_wp_blocks_namespaceObject.createBlock)( "core/group", { tagName: "main" }, [ (0,external_wp_blocks_namespaceObject.createBlock)( "core/group", { layout: { inherit: true } }, [(0,external_wp_blocks_namespaceObject.createBlock)("core/post-title")] ), (0,external_wp_blocks_namespaceObject.createBlock)("core/post-content", { layout: { inherit: true } }) ] ) ]); const newTemplate = await createTemplate({ slug: paramCase(title || DEFAULT_TITLE) || "wp-custom-template", content: newTemplateContent, title: title || DEFAULT_TITLE }); setIsBusy(false); onNavigateToEntityRecord({ postId: newTemplate.id, postType: "wp_template" }); cancel(); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Create custom template"), onRequestClose: cancel, focusOnMount: "firstContentElement", size: "small", overlayClassName: "editor-post-template__create-template-modal", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "form", { className: "editor-post-template__create-form", onSubmit: submit, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Name"), value: title, onChange: setTitle, placeholder: DEFAULT_TITLE, disabled: isBusy, help: (0,external_wp_i18n_namespaceObject.__)( // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.' ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: cancel, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", isBusy, "aria-disabled": isBusy, children: (0,external_wp_i18n_namespaceObject.__)("Create") } ) ] }) ] }) } ) } ); } ;// ./node_modules/@wordpress/editor/build-module/components/post-template/hooks.js function useEditedPostContext() { return (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostId, getCurrentPostType } = select(store_store); return { postId: getCurrentPostId(), postType: getCurrentPostType() }; }, []); } function useAllowSwitchingTemplates() { const { postType, postId } = useEditedPostContext(); return (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { canUser, getEntityRecord, getEntityRecords } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser("read", { kind: "root", name: "site" }) ? getEntityRecord("root", "site") : void 0; const isPostsPage = +postId === siteSettings?.page_for_posts; const isFrontPage = postType === "page" && +postId === siteSettings?.page_on_front; const templates = isFrontPage ? getEntityRecords("postType", "wp_template", { per_page: -1 }) : []; const hasFrontPage = isFrontPage && !!templates?.some(({ slug }) => slug === "front-page"); return !isPostsPage && !hasFrontPage; }, [postId, postType] ); } function useTemplates(postType) { return (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecords("postType", "wp_template", { per_page: -1, post_type: postType }), [postType] ); } function useAvailableTemplates(postType) { const currentTemplateSlug = useCurrentTemplateSlug(); const allowSwitchingTemplate = useAllowSwitchingTemplates(); const templates = useTemplates(postType); return (0,external_wp_element_namespaceObject.useMemo)( () => allowSwitchingTemplate && templates?.filter( (template) => template.is_custom && template.slug !== currentTemplateSlug && !!template.content.raw // Skip empty templates. ), [templates, currentTemplateSlug, allowSwitchingTemplate] ); } function useCurrentTemplateSlug() { const { postType, postId } = useEditedPostContext(); const templates = useTemplates(postType); const entityTemplate = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( "postType", postType, postId ); return post?.template; }, [postType, postId] ); if (!entityTemplate) { return; } return templates?.find((template) => template.slug === entityTemplate)?.slug; } ;// ./node_modules/@wordpress/editor/build-module/components/post-template/classic-theme.js function PostTemplateToggle({ isOpen, onClick }) { const templateTitle = (0,external_wp_data_namespaceObject.useSelect)((select) => { const templateSlug = select(store_store).getEditedPostAttribute("template"); const { supportsTemplateMode, availableTemplates } = select(store_store).getEditorSettings(); if (!supportsTemplateMode && availableTemplates[templateSlug]) { return availableTemplates[templateSlug]; } const template = select(external_wp_coreData_namespaceObject.store).canUser("create", { kind: "postType", name: "wp_template" }) && select(store_store).getCurrentTemplateId(); return template?.title || template?.slug || availableTemplates?.[templateSlug]; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", "aria-expanded": isOpen, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Template options"), onClick, children: templateTitle ?? (0,external_wp_i18n_namespaceObject.__)("Default template") } ); } function PostTemplateDropdownContent({ onClose }) { const allowSwitchingTemplate = useAllowSwitchingTemplates(); const { availableTemplates, fetchedTemplates, selectedTemplateSlug, canCreate, canEdit, currentTemplateId, onNavigateToEntityRecord, getEditorSettings } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { canUser, getEntityRecords } = select(external_wp_coreData_namespaceObject.store); const editorSettings = select(store_store).getEditorSettings(); const canCreateTemplates = canUser("create", { kind: "postType", name: "wp_template" }); const _currentTemplateId = select(store_store).getCurrentTemplateId(); return { availableTemplates: editorSettings.availableTemplates, fetchedTemplates: canCreateTemplates ? getEntityRecords("postType", "wp_template", { post_type: select(store_store).getCurrentPostType(), per_page: -1 }) : void 0, selectedTemplateSlug: select(store_store).getEditedPostAttribute("template"), canCreate: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode, canEdit: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode && !!_currentTemplateId, currentTemplateId: _currentTemplateId, onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord, getEditorSettings: select(store_store).getEditorSettings }; }, [allowSwitchingTemplate] ); const options = (0,external_wp_element_namespaceObject.useMemo)( () => Object.entries({ ...availableTemplates, ...Object.fromEntries( (fetchedTemplates ?? []).map(({ slug, title }) => [ slug, title.rendered ]) ) }).map(([slug, title]) => ({ value: slug, label: title })), [availableTemplates, fetchedTemplates] ); const selectedOption = options.find((option) => option.value === selectedTemplateSlug) ?? options.find((option) => !option.value); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-template__classic-theme-dropdown", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)("Template"), help: (0,external_wp_i18n_namespaceObject.__)( "Templates define the way content is displayed when viewing your site." ), actions: canCreate ? [ { icon: add_template_default, label: (0,external_wp_i18n_namespaceObject.__)("Add template"), onClick: () => setIsCreateModalOpen(true) } ] : [], onClose } ), !allowSwitchingTemplate ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "warning", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)("The posts page template cannot be changed.") }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SelectControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, hideLabelFromVision: true, label: (0,external_wp_i18n_namespaceObject.__)("Template"), value: selectedOption?.value ?? "", options, onChange: (slug) => editPost({ template: slug || "" }) } ), canEdit && onNavigateToEntityRecord && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", onClick: () => { onNavigateToEntityRecord({ postId: currentTemplateId, postType: "wp_template" }); onClose(); createSuccessNotice( (0,external_wp_i18n_namespaceObject.__)( "Editing template. Changes made here affect all posts and pages that use the template." ), { type: "snackbar", actions: [ { label: (0,external_wp_i18n_namespaceObject.__)("Go back"), onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord() } ] } ); }, children: (0,external_wp_i18n_namespaceObject.__)("Edit template") } ) }), isCreateModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CreateNewTemplateModal, { onClose: () => setIsCreateModalOpen(false) } ) ] }); } function ClassicThemeControl() { const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, className: "editor-post-template__dropdown", placement: "left-start", offset: 36, shift: true }), [popoverAnchor] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Template"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PostTemplateToggle, { isOpen, onClick: onToggle } ), renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplateDropdownContent, { onClose }) } ) }); } var classic_theme_default = ClassicThemeControl; ;// external ["wp","warning"] const external_wp_warning_namespaceObject = window["wp"]["warning"]; var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-panel.js const { PreferenceBaseOption } = unlock(external_wp_preferences_namespaceObject.privateApis); function EnablePanelOption(props) { const { toggleEditorPanelEnabled } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { isChecked, isRemoved } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { isEditorPanelEnabled, isEditorPanelRemoved } = select(store_store); return { isChecked: isEditorPanelEnabled(props.panelName), isRemoved: isEditorPanelRemoved(props.panelName) }; }, [props.panelName] ); if (isRemoved) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferenceBaseOption, { isChecked, onChange: () => toggleEditorPanelEnabled(props.panelName), ...props } ); } ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js const { Fill, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)( "EnablePluginDocumentSettingPanelOption" ); const EnablePluginDocumentSettingPanelOption = ({ label, panelName }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePanelOption, { label, panelName }) }); EnablePluginDocumentSettingPanelOption.Slot = Slot; var enable_plugin_document_setting_panel_default = EnablePluginDocumentSettingPanelOption; ;// ./node_modules/@wordpress/editor/build-module/components/plugin-document-setting-panel/index.js const { Fill: plugin_document_setting_panel_Fill, Slot: plugin_document_setting_panel_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("PluginDocumentSettingPanel"); const PluginDocumentSettingPanel = ({ name, className, title, icon, children }) => { const { name: pluginName } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); const panelName = `${pluginName}/${name}`; const { opened, isEnabled } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { isEditorPanelOpened, isEditorPanelEnabled } = select(store_store); return { opened: isEditorPanelOpened(panelName), isEnabled: isEditorPanelEnabled(panelName) }; }, [panelName] ); const { toggleEditorPanelOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); if (void 0 === name) { external_wp_warning_default()("PluginDocumentSettingPanel requires a name property."); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( enable_plugin_document_setting_panel_default, { label: title, panelName } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_document_setting_panel_Fill, { children: isEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.PanelBody, { className, title, icon, opened, onToggle: () => toggleEditorPanelOpened(panelName), children } ) }) ] }); }; PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot; var plugin_document_setting_panel_default = PluginDocumentSettingPanel; ;// ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js const isEverySelectedBlockAllowed = (selected, allowed) => selected.filter((id) => !allowed.includes(id)).length === 0; const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks); const PluginBlockSettingsMenuItem = ({ allowedBlocks, icon, label, onClick, small, role }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { children: ({ selectedBlocks, onClose }) => { if (!shouldRenderItem(selectedBlocks, allowedBlocks)) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: (0,external_wp_compose_namespaceObject.compose)(onClick, onClose), icon, label: small ? label : void 0, role, children: !small && label } ); } }); var plugin_block_settings_menu_item_default = PluginBlockSettingsMenuItem; ;// ./node_modules/@wordpress/editor/build-module/components/plugin-more-menu-item/index.js function PluginMoreMenuItem(props) { const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( action_item_default, { name: "core/plugin-more-menu", as: props.as ?? external_wp_components_namespaceObject.MenuItem, icon: props.icon || context.icon, ...props } ); } ;// ./node_modules/@wordpress/editor/build-module/components/plugin-post-publish-panel/index.js const { Fill: plugin_post_publish_panel_Fill, Slot: plugin_post_publish_panel_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("PluginPostPublishPanel"); const PluginPostPublishPanel = ({ children, className, title, initialOpen = false, icon }) => { const { icon: pluginIcon } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_publish_panel_Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.PanelBody, { className, initialOpen: initialOpen || !title, title, icon: icon ?? pluginIcon, children } ) }); }; PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot; var plugin_post_publish_panel_default = PluginPostPublishPanel; ;// ./node_modules/@wordpress/editor/build-module/components/plugin-post-status-info/index.js const { Fill: plugin_post_status_info_Fill, Slot: plugin_post_status_info_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("PluginPostStatusInfo"); const PluginPostStatusInfo = ({ children, className }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_status_info_Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { className, children }) }); PluginPostStatusInfo.Slot = plugin_post_status_info_Slot; var plugin_post_status_info_default = PluginPostStatusInfo; ;// ./node_modules/@wordpress/editor/build-module/components/plugin-pre-publish-panel/index.js const { Fill: plugin_pre_publish_panel_Fill, Slot: plugin_pre_publish_panel_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("PluginPrePublishPanel"); const PluginPrePublishPanel = ({ children, className, title, initialOpen = false, icon }) => { const { icon: pluginIcon } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_pre_publish_panel_Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.PanelBody, { className, initialOpen: initialOpen || !title, title, icon: icon ?? pluginIcon, children } ) }); }; PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot; var plugin_pre_publish_panel_default = PluginPrePublishPanel; ;// ./node_modules/@wordpress/editor/build-module/components/plugin-preview-menu-item/index.js function PluginPreviewMenuItem(props) { const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( action_item_default, { name: "core/plugin-preview-menu", as: props.as ?? external_wp_components_namespaceObject.MenuItem, icon: props.icon || context.icon, ...props } ); } ;// ./node_modules/@wordpress/editor/build-module/components/plugin-sidebar/index.js function PluginSidebar({ className, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( complementary_area_default, { panelClassName: className, className: "editor-sidebar", scope: "core", ...props } ); } ;// ./node_modules/@wordpress/editor/build-module/components/plugin-sidebar-more-menu-item/index.js function PluginSidebarMoreMenuItem(props) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ComplementaryAreaMoreMenuItem, { __unstableExplicitMenuItem: true, scope: "core", ...props } ); } ;// ./node_modules/@wordpress/editor/build-module/utils/search-templates.js function normalizeSearchInput(input = "") { input = remove_accents_default()(input); input = input.trim().toLowerCase(); return input; } function getTemplateSearchRank(template, searchValue) { const normalizedSearchValue = normalizeSearchInput(searchValue); const normalizedTitle = normalizeSearchInput(template.title); let rank = 0; if (normalizedSearchValue === normalizedTitle) { rank += 30; } else if (normalizedTitle.startsWith(normalizedSearchValue)) { rank += 20; } else { const searchTerms = normalizedSearchValue.split(" "); const hasMatchedTerms = searchTerms.every( (searchTerm) => normalizedTitle.includes(searchTerm) ); if (hasMatchedTerms) { rank += 10; } } return rank; } function searchTemplates(templates = [], searchValue = "") { if (!searchValue) { return templates; } const rankedTemplates = templates.map((template) => { return [template, getTemplateSearchRank(template, searchValue)]; }).filter(([, rank]) => rank > 0); rankedTemplates.sort(([, rank1], [, rank2]) => rank2 - rank1); return rankedTemplates.map(([template]) => template); } ;// ./node_modules/@wordpress/editor/build-module/components/post-template/swap-template-button.js function SwapTemplateButton({ onClick }) { const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false); const { postType, postId } = useEditedPostContext(); const availableTemplates = useAvailableTemplates(postType); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const onTemplateSelect = async (template) => { editEntityRecord( "postType", postType, postId, { template: template.name }, { undoIgnore: true } ); setShowModal(false); onClick(); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { disabled: !availableTemplates?.length, accessibleWhenDisabled: true, onClick: () => setShowModal(true), children: (0,external_wp_i18n_namespaceObject.__)("Change template") } ), showModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Choose a template"), onRequestClose: () => setShowModal(false), overlayClassName: "editor-post-template__swap-template-modal", isFullScreen: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-template__swap-template-modal-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TemplatesList, { postType, onSelect: onTemplateSelect } ) }) } ) ] }); } function TemplatesList({ postType, onSelect }) { const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)(""); const availableTemplates = useAvailableTemplates(postType); const templatesAsPatterns = (0,external_wp_element_namespaceObject.useMemo)( () => availableTemplates.map((template) => ({ name: template.slug, blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content.raw), title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title.rendered), id: template.id })), [availableTemplates] ); const filteredBlockTemplates = (0,external_wp_element_namespaceObject.useMemo)(() => { return searchTemplates(templatesAsPatterns, searchValue); }, [templatesAsPatterns, searchValue]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SearchControl, { __nextHasNoMarginBottom: true, onChange: setSearchValue, value: searchValue, label: (0,external_wp_i18n_namespaceObject.__)("Search"), placeholder: (0,external_wp_i18n_namespaceObject.__)("Search"), className: "editor-post-template__swap-template-search" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { label: (0,external_wp_i18n_namespaceObject.__)("Templates"), blockPatterns: filteredBlockTemplates, onClickPattern: onSelect } ) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-template/reset-default-template.js function ResetDefaultTemplate({ onClick }) { const currentTemplateSlug = useCurrentTemplateSlug(); const allowSwitchingTemplate = useAllowSwitchingTemplates(); const { postType, postId } = useEditedPostContext(); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); if (!currentTemplateSlug || !allowSwitchingTemplate) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { editEntityRecord( "postType", postType, postId, { template: "" }, { undoIgnore: true } ); onClick(); }, children: (0,external_wp_i18n_namespaceObject.__)("Use default template") } ); } ;// ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template.js function CreateNewTemplate() { const { canCreateTemplates } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { canUser } = select(external_wp_coreData_namespaceObject.store); return { canCreateTemplates: canUser("create", { kind: "postType", name: "wp_template" }) }; }, []); const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); const allowSwitchingTemplate = useAllowSwitchingTemplates(); if (!canCreateTemplates || !allowSwitchingTemplate) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { setIsCreateModalOpen(true); }, children: (0,external_wp_i18n_namespaceObject.__)("Create new template") } ), isCreateModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CreateNewTemplateModal, { onClose: () => { setIsCreateModalOpen(false); } } ) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-template/block-theme.js function BlockThemeControl({ id }) { const { isTemplateHidden, onNavigateToEntityRecord, getEditorSettings, hasGoBack } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getRenderingMode, getEditorSettings: _getEditorSettings } = unlock(select(store_store)); const editorSettings = _getEditorSettings(); return { isTemplateHidden: getRenderingMode() === "post-only", onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord, getEditorSettings: _getEditorSettings, hasGoBack: editorSettings.hasOwnProperty( "onNavigateToPreviousEntityRecord" ) }; }, []); const { get: getPreference } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store); const { editedRecord: template, hasResolved } = (0,external_wp_coreData_namespaceObject.useEntityRecord)( "postType", "wp_template", id ); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { setRenderingMode, setDefaultRenderingMode } = unlock( (0,external_wp_data_namespaceObject.useDispatch)(store_store) ); const canCreateTemplate = (0,external_wp_data_namespaceObject.useSelect)( (select) => !!select(external_wp_coreData_namespaceObject.store).canUser("create", { kind: "postType", name: "wp_template" }), [] ); const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, className: "editor-post-template__dropdown", placement: "left-start", offset: 36, shift: true }), [popoverAnchor] ); if (!hasResolved) { return null; } const notificationAction = hasGoBack ? [ { label: (0,external_wp_i18n_namespaceObject.__)("Go back"), onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord() } ] : void 0; const mayShowTemplateEditNotice = () => { if (!getPreference("core/edit-site", "welcomeGuideTemplate")) { createSuccessNotice( (0,external_wp_i18n_namespaceObject.__)( "Editing template. Changes made here affect all posts and pages that use the template." ), { type: "snackbar", actions: notificationAction } ); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Template"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { popoverProps, focusOnMount: true, toggleProps: { size: "compact", variant: "tertiary", tooltipPosition: "middle left" }, label: (0,external_wp_i18n_namespaceObject.__)("Template options"), text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title), icon: null, children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ canCreateTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { onNavigateToEntityRecord({ postId: template.id, postType: "wp_template" }); onClose(); mayShowTemplateEditNotice(); }, children: (0,external_wp_i18n_namespaceObject.__)("Edit template") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SwapTemplateButton, { onClick: onClose }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetDefaultTemplate, { onClick: onClose }), canCreateTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplate, {}) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: !isTemplateHidden ? check_default : void 0, isSelected: !isTemplateHidden, role: "menuitemcheckbox", onClick: () => { const newRenderingMode = isTemplateHidden ? "template-locked" : "post-only"; setRenderingMode(newRenderingMode); setDefaultRenderingMode(newRenderingMode); }, children: (0,external_wp_i18n_namespaceObject.__)("Show template") } ) }) ] }) } ) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-template/panel.js function PostTemplatePanel() { const { templateId, isBlockTheme } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentTemplateId, getEditorSettings } = select(store_store); return { templateId: getCurrentTemplateId(), isBlockTheme: getEditorSettings().__unstableIsBlockBasedTheme }; }, []); const isVisible = (0,external_wp_data_namespaceObject.useSelect)((select) => { const postTypeSlug = select(store_store).getCurrentPostType(); const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); if (!postType?.viewable) { return false; } const settings = select(store_store).getEditorSettings(); const hasTemplates = !!settings.availableTemplates && Object.keys(settings.availableTemplates).length > 0; if (hasTemplates) { return true; } if (!settings.supportsTemplateMode) { return false; } const canCreateTemplates = select(external_wp_coreData_namespaceObject.store).canUser("create", { kind: "postType", name: "wp_template" }) ?? false; return canCreateTemplates; }, []); const canViewTemplates = (0,external_wp_data_namespaceObject.useSelect)( (select) => { return isVisible ? select(external_wp_coreData_namespaceObject.store).canUser("read", { kind: "postType", name: "wp_template" }) : false; }, [isVisible] ); if ((!isBlockTheme || !canViewTemplates) && isVisible) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(classic_theme_default, {}); } if (isBlockTheme && !!templateId) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockThemeControl, { id: templateId }); } return null; } ;// ./node_modules/@wordpress/editor/build-module/components/post-author/constants.js const BASE_QUERY = { _fields: "id,name", context: "view" // Allows non-admins to perform requests. }; const AUTHORS_QUERY = { who: "authors", per_page: 100, ...BASE_QUERY }; ;// ./node_modules/@wordpress/editor/build-module/components/post-author/hook.js function useAuthorsQuery(search) { const { authorId, authors, postAuthor, isLoading } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getUser, getUsers, isResolving } = select(external_wp_coreData_namespaceObject.store); const { getEditedPostAttribute } = select(store_store); const _authorId = getEditedPostAttribute("author"); const query = { ...AUTHORS_QUERY }; if (search) { query.search = search; query.search_columns = ["name"]; } return { authorId: _authorId, authors: getUsers(query), postAuthor: getUser(_authorId, BASE_QUERY), isLoading: isResolving("getUsers", [query]) }; }, [search] ); const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { const fetchedAuthors = (authors ?? []).map((author) => { return { value: author.id, label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name) }; }); const foundAuthor = fetchedAuthors.findIndex( ({ value }) => postAuthor?.id === value ); let currentAuthor = []; if (foundAuthor < 0 && postAuthor) { currentAuthor = [ { value: postAuthor.id, label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor.name) } ]; } else if (foundAuthor < 0 && !postAuthor) { currentAuthor = [ { value: 0, label: (0,external_wp_i18n_namespaceObject.__)("(No author)") } ]; } return [...currentAuthor, ...fetchedAuthors]; }, [authors, postAuthor]); return { authorId, authorOptions, postAuthor, isLoading }; } ;// ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js function PostAuthorCombobox() { const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { authorId, authorOptions, isLoading } = useAuthorsQuery(fieldValue); const handleSelect = (postAuthorId) => { if (!postAuthorId) { return; } editPost({ author: postAuthorId }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ComboboxControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Author"), options: authorOptions, value: authorId, onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(setFieldValue, 300), onChange: handleSelect, allowReset: false, hideLabelFromVision: true, isLoading } ); } ;// ./node_modules/@wordpress/editor/build-module/components/post-author/select.js function PostAuthorSelect() { const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { authorId, authorOptions } = useAuthorsQuery(); const setAuthorId = (value) => { const author = Number(value); editPost({ author }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SelectControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, className: "post-author-selector", label: (0,external_wp_i18n_namespaceObject.__)("Author"), options: authorOptions, onChange: setAuthorId, value: authorId, hideLabelFromVision: true } ); } ;// ./node_modules/@wordpress/editor/build-module/components/post-author/index.js const minimumUsersForCombobox = 25; function PostAuthor() { const showCombobox = (0,external_wp_data_namespaceObject.useSelect)((select) => { const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY); return authors?.length >= minimumUsersForCombobox; }, []); if (showCombobox) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorCombobox, {}); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorSelect, {}); } var post_author_default = PostAuthor; ;// ./node_modules/@wordpress/editor/build-module/components/post-author/check.js function PostAuthorCheck({ children }) { const { hasAssignAuthorAction } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const post = select(store_store).getCurrentPost(); const canAssignAuthor = post?._links?.["wp:action-assign-author"] ? true : false; return { hasAssignAuthorAction: canAssignAuthor }; }, []); if (!hasAssignAuthorAction) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "author", children }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-author/panel.js function PostAuthorToggle({ isOpen, onClick }) { const { postAuthor } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const id = select(store_store).getEditedPostAttribute("author"); return { postAuthor: select(external_wp_coreData_namespaceObject.store).getUser(id, BASE_QUERY) }; }, []); const authorName = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor?.name) || (0,external_wp_i18n_namespaceObject.__)("(No author)"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", className: "editor-post-author__panel-toggle", variant: "tertiary", "aria-expanded": isOpen, "aria-label": ( // translators: %s: Author name. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Change author: %s"), authorName) ), onClick, children: authorName } ); } function panel_PostAuthor() { const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: "left-start", offset: 36, shift: true }), [popoverAnchor] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorCheck, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Author"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, contentClassName: "editor-post-author__panel-dialog", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PostAuthorToggle, { isOpen, onClick: onToggle } ), renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-author", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)("Author"), onClose } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_author_default, { onClose }) ] }) } ) }) }); } var panel_default = panel_PostAuthor; ;// ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js const COMMENT_OPTIONS = [ { label: (0,external_wp_i18n_namespaceObject._x)("Open", 'Adjective: e.g. "Comments are open"'), value: "open", description: (0,external_wp_i18n_namespaceObject.__)("Visitors can add new comments and replies.") }, { label: (0,external_wp_i18n_namespaceObject.__)("Closed"), value: "closed", description: [ (0,external_wp_i18n_namespaceObject.__)("Visitors cannot add new comments or replies."), (0,external_wp_i18n_namespaceObject.__)("Existing comments remain visible.") ].join(" ") } ]; function PostComments() { const commentStatus = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getEditedPostAttribute("comment_status") ?? "open", [] ); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const handleStatus = (newCommentStatus) => editPost({ comment_status: newCommentStatus }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.RadioControl, { className: "editor-change-status__options", hideLabelFromVision: true, label: (0,external_wp_i18n_namespaceObject.__)("Comment status"), options: COMMENT_OPTIONS, onChange: handleStatus, selected: commentStatus } ) }) }); } var post_comments_default = PostComments; ;// ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js function PostPingbacks() { const pingStatus = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getEditedPostAttribute("ping_status") ?? "open", [] ); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const onTogglePingback = () => editPost({ ping_status: pingStatus === "open" ? "closed" : "open" }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Enable pingbacks & trackbacks"), checked: pingStatus === "open", onChange: onTogglePingback, help: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)( "https://wordpress.org/documentation/article/trackbacks-and-pingbacks/" ), children: (0,external_wp_i18n_namespaceObject.__)("Learn more about pingbacks & trackbacks") } ) } ); } var post_pingbacks_default = PostPingbacks; ;// ./node_modules/@wordpress/editor/build-module/components/post-discussion/panel.js const panel_PANEL_NAME = "discussion-panel"; function ModalContents({ onClose }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-discussion", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)("Discussion"), onClose } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "comments", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_comments_default, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "trackbacks", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_pingbacks_default, {}) }) ] }) ] }); } function PostDiscussionToggle({ isOpen, onClick }) { const { commentStatus, pingStatus, commentsSupported, trackbacksSupported } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedPostAttribute } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); const postType = getPostType(getEditedPostAttribute("type")); return { commentStatus: getEditedPostAttribute("comment_status") ?? "open", pingStatus: getEditedPostAttribute("ping_status") ?? "open", commentsSupported: !!postType.supports.comments, trackbacksSupported: !!postType.supports.trackbacks }; }, []); let label; if (commentStatus === "open") { if (pingStatus === "open") { label = (0,external_wp_i18n_namespaceObject._x)("Open", 'Adjective: e.g. "Comments are open"'); } else { label = trackbacksSupported ? (0,external_wp_i18n_namespaceObject.__)("Comments only") : (0,external_wp_i18n_namespaceObject._x)("Open", 'Adjective: e.g. "Comments are open"'); } } else if (pingStatus === "open") { label = commentsSupported ? (0,external_wp_i18n_namespaceObject.__)("Pings only") : (0,external_wp_i18n_namespaceObject.__)("Pings enabled"); } else { label = (0,external_wp_i18n_namespaceObject.__)("Closed"); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", className: "editor-post-discussion__panel-toggle", variant: "tertiary", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Change discussion options"), "aria-expanded": isOpen, onClick, children: label } ); } function PostDiscussionPanel() { const { isEnabled } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { isEditorPanelEnabled } = select(store_store); return { isEnabled: isEditorPanelEnabled(panel_PANEL_NAME) }; }, []); const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: "left-start", offset: 36, shift: true }), [popoverAnchor] ); if (!isEnabled) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: ["comments", "trackbacks"], children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Discussion"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, className: "editor-post-discussion__panel-dropdown", contentClassName: "editor-post-discussion__panel-dialog", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PostDiscussionToggle, { isOpen, onClick: onToggle } ), renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ModalContents, { onClose }) } ) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js function PostExcerpt({ hideLabelFromVision = false, updateOnBlur = false }) { const { excerpt, shouldUseDescriptionLabel, usedAttribute } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getCurrentPostType, getEditedPostAttribute } = select(store_store); const postType = getCurrentPostType(); const _usedAttribute = [ "wp_template", "wp_template_part" ].includes(postType) ? "description" : "excerpt"; return { excerpt: getEditedPostAttribute(_usedAttribute), // There are special cases where we want to label the excerpt as a description. shouldUseDescriptionLabel: [ "wp_template", "wp_template_part", "wp_block" ].includes(postType), usedAttribute: _usedAttribute }; }, [] ); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const [localExcerpt, setLocalExcerpt] = (0,external_wp_element_namespaceObject.useState)( (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt) ); const updatePost = (value) => { editPost({ [usedAttribute]: value }); }; const label = shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)("Write a description (optional)") : (0,external_wp_i18n_namespaceObject.__)("Write an excerpt (optional)"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-excerpt", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextareaControl, { __nextHasNoMarginBottom: true, label, hideLabelFromVision, className: "editor-post-excerpt__textarea", onChange: updateOnBlur ? setLocalExcerpt : updatePost, onBlur: updateOnBlur ? () => updatePost(localExcerpt) : void 0, value: updateOnBlur ? localExcerpt : excerpt, help: !shouldUseDescriptionLabel ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)( "https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt" ), children: (0,external_wp_i18n_namespaceObject.__)("Learn more about manual excerpts") } ) : (0,external_wp_i18n_namespaceObject.__)("Write a description") } ) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js function PostExcerptCheck({ children }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "excerpt", children }); } var post_excerpt_check_check_default = PostExcerptCheck; ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/plugin.js const { Fill: plugin_Fill, Slot: plugin_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("PluginPostExcerpt"); const PluginPostExcerpt = ({ children, className }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { className, children }) }); }; PluginPostExcerpt.Slot = plugin_Slot; var plugin_default = PluginPostExcerpt; ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/panel.js const post_excerpt_panel_PANEL_NAME = "post-excerpt"; function ExcerptPanel() { const { isOpened, isEnabled, postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { isEditorPanelOpened, isEditorPanelEnabled, getCurrentPostType } = select(store_store); return { isOpened: isEditorPanelOpened(post_excerpt_panel_PANEL_NAME), isEnabled: isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME), postType: getCurrentPostType() }; }, []); const { toggleEditorPanelOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const toggleExcerptPanel = () => toggleEditorPanelOpened(post_excerpt_panel_PANEL_NAME); if (!isEnabled) { return null; } const shouldUseDescriptionLabel = [ "wp_template", "wp_template_part", "wp_block" ].includes(postType); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.PanelBody, { title: shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)("Description") : (0,external_wp_i18n_namespaceObject.__)("Excerpt"), opened: isOpened, onToggle: toggleExcerptPanel, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_default.Slot, { children: (fills) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostExcerpt, {}), fills ] }) }) } ); } function PostExcerptPanel() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ExcerptPanel, {}) }); } function PrivatePostExcerptPanel() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateExcerpt, {}) }); } function PrivateExcerpt() { const { shouldRender, excerpt, shouldBeUsedAsDescription, allowEditing } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostType, getCurrentPostId, getEditedPostAttribute, isEditorPanelEnabled } = select(store_store); const postType = getCurrentPostType(); const isTemplateOrTemplatePart = [ "wp_template", "wp_template_part" ].includes(postType); const isPattern = postType === "wp_block"; const _shouldBeUsedAsDescription = isTemplateOrTemplatePart || isPattern; const _usedAttribute = isTemplateOrTemplatePart ? "description" : "excerpt"; const _excerpt = getEditedPostAttribute(_usedAttribute); const template = isTemplateOrTemplatePart && select(external_wp_coreData_namespaceObject.store).getEntityRecord( "postType", postType, getCurrentPostId() ); const _shouldRender = isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME) || _shouldBeUsedAsDescription; return { excerpt: _excerpt, shouldRender: _shouldRender, shouldBeUsedAsDescription: _shouldBeUsedAsDescription, // If we should render, allow editing for all post types that are not used as description. // For the rest allow editing only for user generated entities. allowEditing: _shouldRender && (!_shouldBeUsedAsDescription || isPattern || template && template.source === TEMPLATE_ORIGINS.custom && !template.has_theme_file && template.is_custom) }; }, []); const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const label = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)("Description") : (0,external_wp_i18n_namespaceObject.__)("Excerpt"); const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, "aria-label": label, headerTitle: label, placement: "left-start", offset: 36, shift: true }), [popoverAnchor, label] ); if (!shouldRender) { return false; } const excerptText = !!excerpt && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { align: "left", numberOfLines: 4, truncate: allowEditing, children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt) }); if (!allowEditing) { return excerptText; } const excerptPlaceholder = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)("Add a description\u2026") : (0,external_wp_i18n_namespaceObject.__)("Add an excerpt\u2026"); const triggerEditLabel = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)("Edit description") : (0,external_wp_i18n_namespaceObject.__)("Edit excerpt"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [ excerptText, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { className: "editor-post-excerpt__dropdown", contentClassName: "editor-post-excerpt__dropdown__content", popoverProps, focusOnMount: true, ref: setPopoverAnchor, renderToggle: ({ onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, onClick: onToggle, variant: "link", children: excerptText ? triggerEditLabel : excerptPlaceholder } ), renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: label, onClose } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_default.Slot, { children: (fills) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PostExcerpt, { hideLabelFromVision: true, updateOnBlur: true } ), fills ] }) }) }) ] }) } ) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js function ThemeSupportCheck({ children, supportKeys }) { const { postType, themeSupports } = (0,external_wp_data_namespaceObject.useSelect)((select) => { return { postType: select(store_store).getEditedPostAttribute("type"), themeSupports: select(external_wp_coreData_namespaceObject.store).getThemeSupports() }; }, []); const isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some((key) => { const supported = themeSupports?.[key] ?? false; if ("post-thumbnails" === key && Array.isArray(supported)) { return supported.includes(postType); } return supported; }); if (!isSupported) { return null; } return children; } ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js function PostFeaturedImageCheck({ children }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ThemeSupportCheck, { supportKeys: "post-thumbnails", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "thumbnail", children }) }); } var post_featured_image_check_check_default = PostFeaturedImageCheck; ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js const ALLOWED_MEDIA_TYPES = ["image"]; const DEFAULT_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)("Featured image"); const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)("Add a featured image"); const instructions = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( "To edit the featured image, you need permission to upload media." ) }); function getMediaDetails(media, postId) { if (!media) { return {}; } const defaultSize = (0,external_wp_hooks_namespaceObject.applyFilters)( "editor.PostFeaturedImage.imageSize", "large", media.id, postId ); if (defaultSize in (media?.media_details?.sizes ?? {})) { return { mediaWidth: media.media_details.sizes[defaultSize].width, mediaHeight: media.media_details.sizes[defaultSize].height, mediaSourceUrl: media.media_details.sizes[defaultSize].source_url }; } const fallbackSize = (0,external_wp_hooks_namespaceObject.applyFilters)( "editor.PostFeaturedImage.imageSize", "thumbnail", media.id, postId ); if (fallbackSize in (media?.media_details?.sizes ?? {})) { return { mediaWidth: media.media_details.sizes[fallbackSize].width, mediaHeight: media.media_details.sizes[fallbackSize].height, mediaSourceUrl: media.media_details.sizes[fallbackSize].source_url }; } return { mediaWidth: media.media_details.width, mediaHeight: media.media_details.height, mediaSourceUrl: media.source_url }; } function PostFeaturedImage({ currentPostId, featuredImageId, onUpdateImage, onRemoveImage, media, postType, noticeUI, noticeOperations, isRequestingFeaturedImageMedia }) { const returnsFocusRef = (0,external_wp_element_namespaceObject.useRef)(false); const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false); const { getSettings } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const { mediaSourceUrl } = getMediaDetails(media, currentPostId); function onDropFiles(filesList) { getSettings().mediaUpload({ allowedTypes: ALLOWED_MEDIA_TYPES, filesList, onFileChange([image]) { if ((0,external_wp_blob_namespaceObject.isBlobURL)(image?.url)) { setIsLoading(true); return; } if (image) { onUpdateImage(image); } setIsLoading(false); }, onError(message) { noticeOperations.removeAllNotices(); noticeOperations.createErrorNotice(message); }, multiple: false }); } function getImageDescription(imageMedia) { if (imageMedia.alt_text) { return (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: The selected image alt text. (0,external_wp_i18n_namespaceObject.__)("Current image: %s"), imageMedia.alt_text ); } return (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: The selected image filename. (0,external_wp_i18n_namespaceObject.__)( "The current image has no alternative text. The file name is: %s" ), imageMedia.media_details.sizes?.full?.file || imageMedia.slug ); } function returnFocus(node) { if (returnsFocusRef.current && node) { node.focus(); returnsFocusRef.current = false; } } const isMissingMedia = !isRequestingFeaturedImageMedia && !!featuredImageId && !media; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(post_featured_image_check_check_default, { children: [ noticeUI, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-featured-image", children: [ media && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { id: `editor-post-featured-image-${featuredImageId}-describedby`, className: "hidden", children: getImageDescription(media) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, { fallback: instructions, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.MediaUpload, { title: postType?.labels?.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, onSelect: onUpdateImage, unstableFeaturedImageFlow: true, allowedTypes: ALLOWED_MEDIA_TYPES, modalClass: "editor-post-featured-image__media-modal", render: ({ open }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-featured-image__container", children: [ isMissingMedia ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Notice, { status: "warning", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)( "Could not retrieve the featured image data." ) } ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ref: returnFocus, className: !featuredImageId ? "editor-post-featured-image__toggle" : "editor-post-featured-image__preview", onClick: open, "aria-label": !featuredImageId ? null : (0,external_wp_i18n_namespaceObject.__)( "Edit or replace the featured image" ), "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`, "aria-haspopup": "dialog", disabled: isLoading, accessibleWhenDisabled: true, children: [ !!featuredImageId && media && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { className: "editor-post-featured-image__preview-image", src: mediaSourceUrl, alt: getImageDescription( media ) } ), (isLoading || isRequestingFeaturedImageMedia) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL) ] } ), !!featuredImageId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { className: dist_clsx( "editor-post-featured-image__actions", { "editor-post-featured-image__actions-missing-image": isMissingMedia, "editor-post-featured-image__actions-is-requesting-image": isRequestingFeaturedImageMedia } ), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "editor-post-featured-image__action", onClick: open, "aria-haspopup": "dialog", variant: isMissingMedia ? "secondary" : void 0, children: (0,external_wp_i18n_namespaceObject.__)("Replace") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "editor-post-featured-image__action", onClick: () => { onRemoveImage(); returnsFocusRef.current = true; }, variant: isMissingMedia ? "secondary" : void 0, isDestructive: isMissingMedia, children: (0,external_wp_i18n_namespaceObject.__)("Remove") } ) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { onFilesDrop: onDropFiles }) ] }), value: featuredImageId } ) }) ] }) ] }); } const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)((select) => { const { getEntityRecord, getPostType, hasFinishedResolution } = select(external_wp_coreData_namespaceObject.store); const { getCurrentPostId, getEditedPostAttribute } = select(store_store); const featuredImageId = getEditedPostAttribute("featured_media"); return { media: featuredImageId ? getEntityRecord("postType", "attachment", featuredImageId, { context: "view" }) : null, currentPostId: getCurrentPostId(), postType: getPostType(getEditedPostAttribute("type")), featuredImageId, isRequestingFeaturedImageMedia: !!featuredImageId && !hasFinishedResolution("getEntityRecord", [ "postType", "attachment", featuredImageId, { context: "view" } ]) }; }); const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)( (dispatch, { noticeOperations }, { select }) => { const { editPost } = dispatch(store_store); return { onUpdateImage(image) { editPost({ featured_media: image.id }); }, onDropImage(filesList) { select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload({ allowedTypes: ["image"], filesList, onFileChange([image]) { editPost({ featured_media: image.id }); }, onError(message) { noticeOperations.removeAllNotices(); noticeOperations.createErrorNotice(message); }, multiple: false }); }, onRemoveImage() { editPost({ featured_media: 0 }); } }; } ); var post_featured_image_default = (0,external_wp_compose_namespaceObject.compose)( external_wp_components_namespaceObject.withNotices, applyWithSelect, applyWithDispatch, (0,external_wp_components_namespaceObject.withFilters)("editor.PostFeaturedImage") )(PostFeaturedImage); ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/panel.js const post_featured_image_panel_PANEL_NAME = "featured-image"; function PostFeaturedImagePanel({ withPanelBody = true }) { const { postType, isEnabled, isOpened } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedPostAttribute, isEditorPanelEnabled, isEditorPanelOpened } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); return { postType: getPostType(getEditedPostAttribute("type")), isEnabled: isEditorPanelEnabled(post_featured_image_panel_PANEL_NAME), isOpened: isEditorPanelOpened(post_featured_image_panel_PANEL_NAME) }; }, []); const { toggleEditorPanelOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); if (!isEnabled) { return null; } if (!withPanelBody) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_default, {}) }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.PanelBody, { title: postType?.labels?.featured_image ?? (0,external_wp_i18n_namespaceObject.__)("Featured image"), opened: isOpened, onToggle: () => toggleEditorPanelOpened(post_featured_image_panel_PANEL_NAME), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_default, {}) } ) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-format/check.js function PostFormatCheck({ children }) { const disablePostFormats = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getEditorSettings().disablePostFormats, [] ); if (disablePostFormats) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "post-formats", children }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-format/index.js const POST_FORMATS = [ { id: "aside", caption: (0,external_wp_i18n_namespaceObject.__)("Aside") }, { id: "audio", caption: (0,external_wp_i18n_namespaceObject.__)("Audio") }, { id: "chat", caption: (0,external_wp_i18n_namespaceObject.__)("Chat") }, { id: "gallery", caption: (0,external_wp_i18n_namespaceObject.__)("Gallery") }, { id: "image", caption: (0,external_wp_i18n_namespaceObject.__)("Image") }, { id: "link", caption: (0,external_wp_i18n_namespaceObject.__)("Link") }, { id: "quote", caption: (0,external_wp_i18n_namespaceObject.__)("Quote") }, { id: "standard", caption: (0,external_wp_i18n_namespaceObject.__)("Standard") }, { id: "status", caption: (0,external_wp_i18n_namespaceObject.__)("Status") }, { id: "video", caption: (0,external_wp_i18n_namespaceObject.__)("Video") } ].sort((a, b) => { const normalizedA = a.caption.toUpperCase(); const normalizedB = b.caption.toUpperCase(); if (normalizedA < normalizedB) { return -1; } if (normalizedA > normalizedB) { return 1; } return 0; }); function PostFormat() { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostFormat); const postFormatSelectorId = `post-format-selector-${instanceId}`; const { postFormat, suggestedFormat, supportedFormats } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEditedPostAttribute, getSuggestedPostFormat } = select(store_store); const _postFormat = getEditedPostAttribute("format"); const themeSupports = select(external_wp_coreData_namespaceObject.store).getThemeSupports(); return { postFormat: _postFormat ?? "standard", suggestedFormat: getSuggestedPostFormat(), supportedFormats: themeSupports.formats }; }, [] ); const formats = POST_FORMATS.filter((format) => { return supportedFormats?.includes(format.id) || postFormat === format.id; }); const suggestion = formats.find( (format) => format.id === suggestedFormat ); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const onUpdatePostFormat = (format) => editPost({ format }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatCheck, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-format", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.RadioControl, { className: "editor-post-format__options", label: (0,external_wp_i18n_namespaceObject.__)("Post Format"), selected: postFormat, onChange: (format) => onUpdatePostFormat(format), id: postFormatSelectorId, options: formats.map((format) => ({ label: format.caption, value: format.id })), hideLabelFromVision: true } ), suggestion && suggestion.id !== postFormat && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "editor-post-format__suggestion", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", onClick: () => onUpdatePostFormat(suggestion.id), children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post format */ (0,external_wp_i18n_namespaceObject.__)("Apply suggested format: %s"), suggestion.caption ) } ) }) ] }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js function PostLastRevisionCheck({ children }) { const { lastRevisionId, revisionsCount } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } = select(store_store); return { lastRevisionId: getCurrentPostLastRevisionId(), revisionsCount: getCurrentPostRevisionsCount() }; }, []); if (!lastRevisionId || revisionsCount < 2) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "revisions", children }); } var post_last_revision_check_check_default = PostLastRevisionCheck; ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js function usePostLastRevisionInfo() { return (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } = select(store_store); return { lastRevisionId: getCurrentPostLastRevisionId(), revisionsCount: getCurrentPostRevisionsCount() }; }, []); } function PostLastRevision() { const { lastRevisionId, revisionsCount } = usePostLastRevisionInfo(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, href: (0,external_wp_url_namespaceObject.addQueryArgs)("revision.php", { revision: lastRevisionId }), className: "editor-post-last-revision__title", icon: backup_default, iconPosition: "right", text: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: number of revisions. */ (0,external_wp_i18n_namespaceObject.__)("Revisions (%s)"), revisionsCount ) } ) }); } function PrivatePostLastRevision() { const { lastRevisionId, revisionsCount } = usePostLastRevisionInfo(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Revisions"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { href: (0,external_wp_url_namespaceObject.addQueryArgs)("revision.php", { revision: lastRevisionId }), className: "editor-private-post-last-revision__button", text: revisionsCount, variant: "tertiary", size: "compact" } ) }) }); } var post_last_revision_default = PostLastRevision; ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/panel.js function PostLastRevisionPanel() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { className: "editor-post-last-revision__panel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_default, {}) }) }); } var panel_panel_default = PostLastRevisionPanel; ;// ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js function PostLockedModal() { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostLockedModal); const hookName = "core/editor/post-locked-modal-" + instanceId; const { autosave, updatePostLock } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { isLocked, isTakeover, user, postId, postLockUtils, activePostLock, postType, previewLink } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { isPostLocked, isPostLockTakeover, getPostLockUser, getCurrentPostId, getActivePostLock, getEditedPostAttribute, getEditedPostPreviewLink, getEditorSettings } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); return { isLocked: isPostLocked(), isTakeover: isPostLockTakeover(), user: getPostLockUser(), postId: getCurrentPostId(), postLockUtils: getEditorSettings().postLockUtils, activePostLock: getActivePostLock(), postType: getPostType(getEditedPostAttribute("type")), previewLink: getEditedPostPreviewLink() }; }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { function sendPostLock(data) { if (isLocked) { return; } data["wp-refresh-post-lock"] = { lock: activePostLock, post_id: postId }; } function receivePostLock(data) { if (!data["wp-refresh-post-lock"]) { return; } const received = data["wp-refresh-post-lock"]; if (received.lock_error) { autosave(); updatePostLock({ isLocked: true, isTakeover: true, user: { name: received.lock_error.name, avatar: received.lock_error.avatar_src_2x } }); } else if (received.new_lock) { updatePostLock({ isLocked: false, activePostLock: received.new_lock }); } } function releasePostLock() { if (isLocked || !activePostLock) { return; } const data = new window.FormData(); data.append("action", "wp-remove-post-lock"); data.append("_wpnonce", postLockUtils.unlockNonce); data.append("post_ID", postId); data.append("active_post_lock", activePostLock); if (window.navigator.sendBeacon) { window.navigator.sendBeacon(postLockUtils.ajaxUrl, data); } else { const xhr = new window.XMLHttpRequest(); xhr.open("POST", postLockUtils.ajaxUrl, false); xhr.send(data); } } (0,external_wp_hooks_namespaceObject.addAction)("heartbeat.send", hookName, sendPostLock); (0,external_wp_hooks_namespaceObject.addAction)("heartbeat.tick", hookName, receivePostLock); window.addEventListener("beforeunload", releasePostLock); return () => { (0,external_wp_hooks_namespaceObject.removeAction)("heartbeat.send", hookName); (0,external_wp_hooks_namespaceObject.removeAction)("heartbeat.tick", hookName); window.removeEventListener("beforeunload", releasePostLock); }; }, []); if (!isLocked) { return null; } const userDisplayName = user.name; const userAvatar = user.avatar; const unlockUrl = (0,external_wp_url_namespaceObject.addQueryArgs)("post.php", { "get-post-lock": "1", lockKey: true, post: postId, action: "edit", _wpnonce: postLockUtils.nonce }); const allPostsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)("edit.php", { post_type: postType?.slug }); const allPostsLabel = (0,external_wp_i18n_namespaceObject.__)("Exit editor"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: isTakeover ? (0,external_wp_i18n_namespaceObject.__)("Someone else has taken over this post") : (0,external_wp_i18n_namespaceObject.__)("This post is already being edited"), focusOnMount: true, shouldCloseOnClickOutside: false, shouldCloseOnEsc: false, isDismissible: false, className: "editor-post-locked-modal", size: "medium", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "top", spacing: 6, children: [ !!userAvatar && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { src: userAvatar, alt: (0,external_wp_i18n_namespaceObject.__)("Avatar"), className: "editor-post-locked-modal__avatar", width: 64, height: 64 } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ !!isTakeover && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_element_namespaceObject.createInterpolateElement)( userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: user's display name */ (0,external_wp_i18n_namespaceObject.__)( "<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don\u2019t worry, your changes up to this moment have been saved." ), userDisplayName ) : (0,external_wp_i18n_namespaceObject.__)( "Another user now has editing control of this post (<PreviewLink />). Don\u2019t worry, your changes up to this moment have been saved." ), { strong: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}), PreviewLink: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: previewLink, children: (0,external_wp_i18n_namespaceObject.__)("preview") }) } ) }), !isTakeover && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_element_namespaceObject.createInterpolateElement)( userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: user's display name */ (0,external_wp_i18n_namespaceObject.__)( "<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over." ), userDisplayName ) : (0,external_wp_i18n_namespaceObject.__)( "Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over." ), { strong: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}), PreviewLink: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: previewLink, children: (0,external_wp_i18n_namespaceObject.__)("preview") }) } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( "If you take over, the other user will lose editing control to the post, but their changes will be saved." ) }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { className: "editor-post-locked-modal__buttons", justify: "flex-end", children: [ !isTakeover && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", href: unlockUrl, children: (0,external_wp_i18n_namespaceObject.__)("Take over") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", href: allPostsUrl, children: allPostsLabel } ) ] } ) ] }) ] }) } ); } var post_locked_modal_default = false ? 0 : PostLockedModal; ;// ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js function PostPendingStatusCheck({ children }) { const { hasPublishAction, isPublished } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { isCurrentPostPublished, getCurrentPost } = select(store_store); return { hasPublishAction: getCurrentPost()._links?.["wp:action-publish"] ?? false, isPublished: isCurrentPostPublished() }; }, []); if (isPublished || !hasPublishAction) { return null; } return children; } var post_pending_status_check_check_default = PostPendingStatusCheck; ;// ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js function PostPendingStatus() { const status = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getEditedPostAttribute("status"), [] ); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const togglePendingStatus = () => { const updatedStatus = status === "pending" ? "draft" : "pending"; editPost({ status: updatedStatus }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_pending_status_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Pending review"), checked: status === "pending", onChange: togglePendingStatus } ) }); } var post_pending_status_default = PostPendingStatus; ;// ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js function writeInterstitialMessage(targetDocument) { let markup = (0,external_wp_element_namespaceObject.renderToString)( /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-preview-button__interstitial-message", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 96 96", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Path, { className: "outer", d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36", fill: "none" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Path, { className: "inner", d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z", fill: "none" } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("Generating preview\u2026") }) ] }) ); markup += ` <style> body { margin: 0; } .editor-post-preview-button__interstitial-message { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; width: 100vw; } @-webkit-keyframes paint { 0% { stroke-dashoffset: 0; } } @-moz-keyframes paint { 0% { stroke-dashoffset: 0; } } @-o-keyframes paint { 0% { stroke-dashoffset: 0; } } @keyframes paint { 0% { stroke-dashoffset: 0; } } .editor-post-preview-button__interstitial-message svg { width: 192px; height: 192px; stroke: #555d66; stroke-width: 0.75; } .editor-post-preview-button__interstitial-message svg .outer, .editor-post-preview-button__interstitial-message svg .inner { stroke-dasharray: 280; stroke-dashoffset: 280; -webkit-animation: paint 1.5s ease infinite alternate; -moz-animation: paint 1.5s ease infinite alternate; -o-animation: paint 1.5s ease infinite alternate; animation: paint 1.5s ease infinite alternate; } p { text-align: center; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; } </style> `; markup = (0,external_wp_hooks_namespaceObject.applyFilters)("editor.PostPreview.interstitialMarkup", markup); targetDocument.write(markup); targetDocument.title = (0,external_wp_i18n_namespaceObject.__)("Generating preview\u2026"); targetDocument.close(); } function PostPreviewButton({ className, textContent, forceIsAutosaveable, role, onPreview }) { const { postId, currentPostLink, previewLink, isSaveable, isViewable } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const editor = select(store_store); const core = select(external_wp_coreData_namespaceObject.store); const postType = core.getPostType( editor.getCurrentPostType("type") ); const canView = postType?.viewable ?? false; if (!canView) { return { isViewable: canView }; } return { postId: editor.getCurrentPostId(), currentPostLink: editor.getCurrentPostAttribute("link"), previewLink: editor.getEditedPostPreviewLink(), isSaveable: editor.isEditedPostSaveable(), isViewable: canView }; }, []); const { __unstableSaveForPreview } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); if (!isViewable) { return null; } const targetId = `wp-preview-${postId}`; const openPreviewWindow = async (event) => { event.preventDefault(); const previewWindow = window.open("", targetId); previewWindow.focus(); writeInterstitialMessage(previewWindow.document); const link = await __unstableSaveForPreview({ forceIsAutosaveable }); previewWindow.location = link; onPreview?.(); }; const href = previewLink || currentPostLink; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: !className ? "tertiary" : void 0, className: className || "editor-post-preview", href, target: targetId, accessibleWhenDisabled: true, disabled: !isSaveable, onClick: openPreviewWindow, role, size: "compact", children: textContent || /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ (0,external_wp_i18n_namespaceObject._x)("Preview", "imperative verb"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", /* translators: accessibility text */ children: (0,external_wp_i18n_namespaceObject.__)("(opens in a new tab)") }) ] }) } ); } ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js function PublishButtonLabel() { const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const { isPublished, isBeingScheduled, isSaving, isPublishing, hasPublishAction, isAutosaving, hasNonPostEntityChanges, postStatusHasChanged, postStatus } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { isCurrentPostPublished, isEditedPostBeingScheduled, isSavingPost, isPublishingPost, getCurrentPost, getCurrentPostType, isAutosavingPost, getPostEdits, getEditedPostAttribute } = select(store_store); return { isPublished: isCurrentPostPublished(), isBeingScheduled: isEditedPostBeingScheduled(), isSaving: isSavingPost(), isPublishing: isPublishingPost(), hasPublishAction: getCurrentPost()._links?.["wp:action-publish"] ?? false, postType: getCurrentPostType(), isAutosaving: isAutosavingPost(), hasNonPostEntityChanges: select(store_store).hasNonPostEntityChanges(), postStatusHasChanged: !!getPostEdits()?.status, postStatus: getEditedPostAttribute("status") }; }, []); if (isPublishing) { return (0,external_wp_i18n_namespaceObject.__)("Publishing\u2026"); } else if ((isPublished || isBeingScheduled) && isSaving && !isAutosaving) { return (0,external_wp_i18n_namespaceObject.__)("Saving\u2026"); } if (!hasPublishAction) { return isSmallerThanMediumViewport ? (0,external_wp_i18n_namespaceObject.__)("Publish") : (0,external_wp_i18n_namespaceObject.__)("Submit for Review"); } if (hasNonPostEntityChanges || isPublished || postStatusHasChanged && !["future", "publish"].includes(postStatus) || !postStatusHasChanged && postStatus === "future") { return (0,external_wp_i18n_namespaceObject.__)("Save"); } if (isBeingScheduled) { return (0,external_wp_i18n_namespaceObject.__)("Schedule"); } return (0,external_wp_i18n_namespaceObject.__)("Publish"); } ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js const post_publish_button_noop = () => { }; class PostPublishButton extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); this.createOnClick = this.createOnClick.bind(this); this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this); this.state = { entitiesSavedStatesCallback: false }; } createOnClick(callback) { return (...args) => { const { hasNonPostEntityChanges, setEntitiesSavedStatesCallback } = this.props; if (hasNonPostEntityChanges && setEntitiesSavedStatesCallback) { this.setState({ entitiesSavedStatesCallback: () => callback(...args) }); setEntitiesSavedStatesCallback( () => this.closeEntitiesSavedStates ); return post_publish_button_noop; } return callback(...args); }; } closeEntitiesSavedStates(savedEntities) { const { postType, postId } = this.props; const { entitiesSavedStatesCallback } = this.state; this.setState({ entitiesSavedStatesCallback: false }, () => { if (savedEntities && savedEntities.some( (elt) => elt.kind === "postType" && elt.name === postType && elt.key === postId )) { entitiesSavedStatesCallback(); } }); } render() { const { forceIsDirty, hasPublishAction, isBeingScheduled, isOpen, isPostSavingLocked, isPublishable, isPublished, isSaveable, isSaving, isAutoSaving, isToggle, savePostStatus, onSubmit = post_publish_button_noop, onToggle, visibility, hasNonPostEntityChanges, isSavingNonPostEntityChanges, postStatus, postStatusHasChanged } = this.props; const isButtonDisabled = (isSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges); const isToggleDisabled = (isPublished || isSaving || !isSaveable || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges); let publishStatus = "publish"; if (postStatusHasChanged) { publishStatus = postStatus; } else if (!hasPublishAction) { publishStatus = "pending"; } else if (visibility === "private") { publishStatus = "private"; } else if (isBeingScheduled) { publishStatus = "future"; } const onClickButton = () => { if (isButtonDisabled) { return; } onSubmit(); savePostStatus(publishStatus); }; const onClickToggle = () => { if (isToggleDisabled) { return; } onToggle(); }; const buttonProps = { "aria-disabled": isButtonDisabled, className: "editor-post-publish-button", isBusy: !isAutoSaving && isSaving, variant: "primary", onClick: this.createOnClick(onClickButton), "aria-haspopup": hasNonPostEntityChanges ? "dialog" : void 0 }; const toggleProps = { "aria-disabled": isToggleDisabled, "aria-expanded": isOpen, className: "editor-post-publish-panel__toggle", isBusy: isSaving && isPublished, variant: "primary", size: "compact", onClick: this.createOnClick(onClickToggle), "aria-haspopup": hasNonPostEntityChanges ? "dialog" : void 0 }; const componentProps = isToggle ? toggleProps : buttonProps; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { ...componentProps, className: `${componentProps.className} editor-post-publish-button__button`, size: "compact", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PublishButtonLabel, {}) } ) }); } } var post_publish_button_default = (0,external_wp_compose_namespaceObject.compose)([ (0,external_wp_data_namespaceObject.withSelect)((select) => { const { isSavingPost, isAutosavingPost, isEditedPostBeingScheduled, getEditedPostVisibility, isCurrentPostPublished, isEditedPostSaveable, isEditedPostPublishable, isPostSavingLocked, getCurrentPost, getCurrentPostType, getCurrentPostId, hasNonPostEntityChanges, isSavingNonPostEntityChanges, getEditedPostAttribute, getPostEdits } = select(store_store); return { isSaving: isSavingPost(), isAutoSaving: isAutosavingPost(), isBeingScheduled: isEditedPostBeingScheduled(), visibility: getEditedPostVisibility(), isSaveable: isEditedPostSaveable(), isPostSavingLocked: isPostSavingLocked(), isPublishable: isEditedPostPublishable(), isPublished: isCurrentPostPublished(), hasPublishAction: getCurrentPost()._links?.["wp:action-publish"] ?? false, postType: getCurrentPostType(), postId: getCurrentPostId(), postStatus: getEditedPostAttribute("status"), postStatusHasChanged: getPostEdits()?.status, hasNonPostEntityChanges: hasNonPostEntityChanges(), isSavingNonPostEntityChanges: isSavingNonPostEntityChanges() }; }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch) => { const { editPost, savePost } = dispatch(store_store); return { savePostStatus: (status) => { editPost({ status }, { undoIgnore: true }); savePost(); } }; }) ])(PostPublishButton); ;// ./node_modules/@wordpress/icons/build-module/library/wordpress.js var wordpress_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" }) }); ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js const VISIBILITY_OPTIONS = [ { label: (0,external_wp_i18n_namespaceObject.__)("Public"), value: "public", description: (0,external_wp_i18n_namespaceObject.__)("Visible to everyone.") }, { label: (0,external_wp_i18n_namespaceObject.__)("Private"), value: "private", description: (0,external_wp_i18n_namespaceObject.__)("Only visible to site admins and editors.") }, { label: (0,external_wp_i18n_namespaceObject.__)("Password protected"), value: "password", description: (0,external_wp_i18n_namespaceObject.__)("Only visible to those who know the password.") } ]; ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js function PostVisibility({ onClose }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostVisibility); const { status, visibility, password } = (0,external_wp_data_namespaceObject.useSelect)((select) => ({ status: select(store_store).getEditedPostAttribute("status"), visibility: select(store_store).getEditedPostVisibility(), password: select(store_store).getEditedPostAttribute("password") })); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const [hasPassword, setHasPassword] = (0,external_wp_element_namespaceObject.useState)(!!password); function updateVisibility(value) { const nextValues = { public: { status: visibility === "private" ? "draft" : status, password: "" }, private: { status: "private", password: "" }, password: { status: visibility === "private" ? "draft" : status, password: password || "" } }; editPost(nextValues[value]); setHasPassword(value === "password"); } const updatePassword = (value) => { editPost({ password: value }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-visibility", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)("Visibility"), help: (0,external_wp_i18n_namespaceObject.__)("Control how this post is viewed."), onClose } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.RadioControl, { label: (0,external_wp_i18n_namespaceObject.__)("Visibility"), hideLabelFromVision: true, options: VISIBILITY_OPTIONS, selected: hasPassword ? "password" : visibility, onChange: updateVisibility } ), hasPassword && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { label: (0,external_wp_i18n_namespaceObject.__)("Password"), onChange: updatePassword, value: password, placeholder: (0,external_wp_i18n_namespaceObject.__)("Use a secure password"), type: "text", id: `editor-post-visibility__password-input-${instanceId}`, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, maxLength: 255 } ) ] }) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js function PostVisibilityLabel() { return usePostVisibilityLabel(); } function usePostVisibilityLabel() { const visibility = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getEditedPostVisibility(), [] ); return VISIBILITY_OPTIONS.find((option) => option.value === visibility)?.label; } ;// ./node_modules/date-fns/toDate.mjs /** * @name toDate * @category Common Helpers * @summary Convert the given argument to an instance of Date. * * @description * Convert the given argument to an instance of Date. * * If the argument is an instance of Date, the function returns its clone. * * If the argument is a number, it is treated as a timestamp. * * If the argument is none of the above, the function returns Invalid Date. * * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`. * * @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). * * @param argument - The value to convert * * @returns The parsed date in the local time zone * * @example * // Clone the date: * const result = toDate(new Date(2014, 1, 11, 11, 30, 30)) * //=> Tue Feb 11 2014 11:30:30 * * @example * // Convert the timestamp to date: * const result = toDate(1392098430000) * //=> Tue Feb 11 2014 11:30:30 */ function toDate(argument) { const argStr = Object.prototype.toString.call(argument); // Clone the date if ( argument instanceof Date || (typeof argument === "object" && argStr === "[object Date]") ) { // Prevent the date to lose the milliseconds when passed to new Date() in IE10 return new argument.constructor(+argument); } else if ( typeof argument === "number" || argStr === "[object Number]" || typeof argument === "string" || argStr === "[object String]" ) { // TODO: Can we get rid of as? return new Date(argument); } else { // TODO: Can we get rid of as? return new Date(NaN); } } // Fallback for modularized imports: /* harmony default export */ const date_fns_toDate = ((/* unused pure expression or super */ null && (toDate))); ;// ./node_modules/date-fns/startOfMonth.mjs /** * @name startOfMonth * @category Month Helpers * @summary Return the start of a month for the given date. * * @description * Return the start of a month for the given date. * The result will be in the local timezone. * * @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). * * @param date - The original date * * @returns The start of a month * * @example * // The start of a month for 2 September 2014 11:55:00: * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0)) * //=> Mon Sep 01 2014 00:00:00 */ function startOfMonth(date) { const _date = toDate(date); _date.setDate(1); _date.setHours(0, 0, 0, 0); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfMonth = ((/* unused pure expression or super */ null && (startOfMonth))); ;// ./node_modules/date-fns/endOfMonth.mjs /** * @name endOfMonth * @category Month Helpers * @summary Return the end of a month for the given date. * * @description * Return the end of a month for the given date. * The result will be in the local timezone. * * @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). * * @param date - The original date * * @returns The end of a month * * @example * // The end of a month for 2 September 2014 11:55:00: * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0)) * //=> Tue Sep 30 2014 23:59:59.999 */ function endOfMonth(date) { const _date = toDate(date); const month = _date.getMonth(); _date.setFullYear(_date.getFullYear(), month + 1, 0); _date.setHours(23, 59, 59, 999); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_endOfMonth = ((/* unused pure expression or super */ null && (endOfMonth))); ;// ./node_modules/date-fns/constants.mjs /** * @module constants * @summary Useful constants * @description * Collection of useful date constants. * * The constants could be imported from `date-fns/constants`: * * ```ts * import { maxTime, minTime } from "./constants/date-fns/constants"; * * function isAllowedTime(time) { * return time <= maxTime && time >= minTime; * } * ``` */ /** * @constant * @name daysInWeek * @summary Days in 1 week. */ const daysInWeek = 7; /** * @constant * @name daysInYear * @summary Days in 1 year. * * @description * How many days in a year. * * One years equals 365.2425 days according to the formula: * * > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400. * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days */ const daysInYear = 365.2425; /** * @constant * @name maxTime * @summary Maximum allowed time. * * @example * import { maxTime } from "./constants/date-fns/constants"; * * const isValid = 8640000000000001 <= maxTime; * //=> false * * new Date(8640000000000001); * //=> Invalid Date */ const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000; /** * @constant * @name minTime * @summary Minimum allowed time. * * @example * import { minTime } from "./constants/date-fns/constants"; * * const isValid = -8640000000000001 >= minTime; * //=> false * * new Date(-8640000000000001) * //=> Invalid Date */ const minTime = -maxTime; /** * @constant * @name millisecondsInWeek * @summary Milliseconds in 1 week. */ const millisecondsInWeek = 604800000; /** * @constant * @name millisecondsInDay * @summary Milliseconds in 1 day. */ const millisecondsInDay = 86400000; /** * @constant * @name millisecondsInMinute * @summary Milliseconds in 1 minute */ const millisecondsInMinute = 60000; /** * @constant * @name millisecondsInHour * @summary Milliseconds in 1 hour */ const millisecondsInHour = 3600000; /** * @constant * @name millisecondsInSecond * @summary Milliseconds in 1 second */ const millisecondsInSecond = 1000; /** * @constant * @name minutesInYear * @summary Minutes in 1 year. */ const minutesInYear = 525600; /** * @constant * @name minutesInMonth * @summary Minutes in 1 month. */ const minutesInMonth = 43200; /** * @constant * @name minutesInDay * @summary Minutes in 1 day. */ const minutesInDay = 1440; /** * @constant * @name minutesInHour * @summary Minutes in 1 hour. */ const minutesInHour = 60; /** * @constant * @name monthsInQuarter * @summary Months in 1 quarter. */ const monthsInQuarter = 3; /** * @constant * @name monthsInYear * @summary Months in 1 year. */ const monthsInYear = 12; /** * @constant * @name quartersInYear * @summary Quarters in 1 year */ const quartersInYear = 4; /** * @constant * @name secondsInHour * @summary Seconds in 1 hour. */ const secondsInHour = 3600; /** * @constant * @name secondsInMinute * @summary Seconds in 1 minute. */ const secondsInMinute = 60; /** * @constant * @name secondsInDay * @summary Seconds in 1 day. */ const secondsInDay = secondsInHour * 24; /** * @constant * @name secondsInWeek * @summary Seconds in 1 week. */ const secondsInWeek = secondsInDay * 7; /** * @constant * @name secondsInYear * @summary Seconds in 1 year. */ const secondsInYear = secondsInDay * daysInYear; /** * @constant * @name secondsInMonth * @summary Seconds in 1 month */ const secondsInMonth = secondsInYear / 12; /** * @constant * @name secondsInQuarter * @summary Seconds in 1 quarter. */ const secondsInQuarter = secondsInMonth * 3; ;// ./node_modules/date-fns/parseISO.mjs /** * The {@link parseISO} function options. */ /** * @name parseISO * @category Common Helpers * @summary Parse ISO string * * @description * Parse the given string in ISO 8601 format and return an instance of Date. * * Function accepts complete ISO 8601 formats as well as partial implementations. * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601 * * If the argument isn't a string, the function cannot parse the string or * the values are invalid, it returns Invalid Date. * * @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). * * @param argument - The value to convert * @param options - An object with options * * @returns The parsed date in the local time zone * * @example * // Convert string '2014-02-11T11:30:30' to date: * const result = parseISO('2014-02-11T11:30:30') * //=> Tue Feb 11 2014 11:30:30 * * @example * // Convert string '+02014101' to date, * // if the additional number of digits in the extended year format is 1: * const result = parseISO('+02014101', { additionalDigits: 1 }) * //=> Fri Apr 11 2014 00:00:00 */ function parseISO(argument, options) { const additionalDigits = options?.additionalDigits ?? 2; const dateStrings = splitDateString(argument); let date; if (dateStrings.date) { const parseYearResult = parseYear(dateStrings.date, additionalDigits); date = parseDate(parseYearResult.restDateString, parseYearResult.year); } if (!date || isNaN(date.getTime())) { return new Date(NaN); } const timestamp = date.getTime(); let time = 0; let offset; if (dateStrings.time) { time = parseTime(dateStrings.time); if (isNaN(time)) { return new Date(NaN); } } if (dateStrings.timezone) { offset = parseTimezone(dateStrings.timezone); if (isNaN(offset)) { return new Date(NaN); } } else { const dirtyDate = new Date(timestamp + time); // JS parsed string assuming it's in UTC timezone // but we need it to be parsed in our timezone // so we use utc values to build date in our timezone. // Year values from 0 to 99 map to the years 1900 to 1999 // so set year explicitly with setFullYear. const result = new Date(0); result.setFullYear( dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate(), ); result.setHours( dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds(), ); return result; } return new Date(timestamp + time + offset); } const patterns = { dateTimeDelimiter: /[T ]/, timeZoneDelimiter: /[Z ]/i, timezone: /([Z+-].*)$/, }; const dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/; const timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/; const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/; function splitDateString(dateString) { const dateStrings = {}; const array = dateString.split(patterns.dateTimeDelimiter); let timeString; // The regex match should only return at maximum two array elements. // [date], [time], or [date, time]. if (array.length > 2) { return dateStrings; } if (/:/.test(array[0])) { timeString = array[0]; } else { dateStrings.date = array[0]; timeString = array[1]; if (patterns.timeZoneDelimiter.test(dateStrings.date)) { dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0]; timeString = dateString.substr( dateStrings.date.length, dateString.length, ); } } if (timeString) { const token = patterns.timezone.exec(timeString); if (token) { dateStrings.time = timeString.replace(token[1], ""); dateStrings.timezone = token[1]; } else { dateStrings.time = timeString; } } return dateStrings; } function parseYear(dateString, additionalDigits) { const regex = new RegExp( "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)", ); const captures = dateString.match(regex); // Invalid ISO-formatted year if (!captures) return { year: NaN, restDateString: "" }; const year = captures[1] ? parseInt(captures[1]) : null; const century = captures[2] ? parseInt(captures[2]) : null; // either year or century is null, not both return { year: century === null ? year : century * 100, restDateString: dateString.slice((captures[1] || captures[2]).length), }; } function parseDate(dateString, year) { // Invalid ISO-formatted year if (year === null) return new Date(NaN); const captures = dateString.match(dateRegex); // Invalid ISO-formatted string if (!captures) return new Date(NaN); const isWeekDate = !!captures[4]; const dayOfYear = parseDateUnit(captures[1]); const month = parseDateUnit(captures[2]) - 1; const day = parseDateUnit(captures[3]); const week = parseDateUnit(captures[4]); const dayOfWeek = parseDateUnit(captures[5]) - 1; if (isWeekDate) { if (!validateWeekDate(year, week, dayOfWeek)) { return new Date(NaN); } return dayOfISOWeekYear(year, week, dayOfWeek); } else { const date = new Date(0); if ( !validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear) ) { return new Date(NaN); } date.setUTCFullYear(year, month, Math.max(dayOfYear, day)); return date; } } function parseDateUnit(value) { return value ? parseInt(value) : 1; } function parseTime(timeString) { const captures = timeString.match(timeRegex); if (!captures) return NaN; // Invalid ISO-formatted time const hours = parseTimeUnit(captures[1]); const minutes = parseTimeUnit(captures[2]); const seconds = parseTimeUnit(captures[3]); if (!validateTime(hours, minutes, seconds)) { return NaN; } return ( hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000 ); } function parseTimeUnit(value) { return (value && parseFloat(value.replace(",", "."))) || 0; } function parseTimezone(timezoneString) { if (timezoneString === "Z") return 0; const captures = timezoneString.match(timezoneRegex); if (!captures) return 0; const sign = captures[1] === "+" ? -1 : 1; const hours = parseInt(captures[2]); const minutes = (captures[3] && parseInt(captures[3])) || 0; if (!validateTimezone(hours, minutes)) { return NaN; } return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute); } function dayOfISOWeekYear(isoWeekYear, week, day) { const date = new Date(0); date.setUTCFullYear(isoWeekYear, 0, 4); const fourthOfJanuaryDay = date.getUTCDay() || 7; const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay; date.setUTCDate(date.getUTCDate() + diff); return date; } // Validation functions // February is null to handle the leap year (using ||) const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; function isLeapYearIndex(year) { return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0); } function validateDate(year, month, date) { return ( month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28)) ); } function validateDayOfYearDate(year, dayOfYear) { return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365); } function validateWeekDate(_year, week, day) { return week >= 1 && week <= 53 && day >= 0 && day <= 6; } function validateTime(hours, minutes, seconds) { if (hours === 24) { return minutes === 0 && seconds === 0; } return ( seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25 ); } function validateTimezone(_hours, minutes) { return minutes >= 0 && minutes <= 59; } // Fallback for modularized imports: /* harmony default export */ const date_fns_parseISO = ((/* unused pure expression or super */ null && (parseISO))); ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js const { PrivatePublishDateTimePicker } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function PostSchedule(props) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivatePostSchedule, { ...props, showPopoverHeaderActions: true, isCompact: false } ); } function PrivatePostSchedule({ onClose, showPopoverHeaderActions, isCompact }) { const { postDate, postType } = (0,external_wp_data_namespaceObject.useSelect)( (select) => ({ postDate: select(store_store).getEditedPostAttribute("date"), postType: select(store_store).getCurrentPostType() }), [] ); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const onUpdateDate = (date) => editPost({ date }); const [previewedMonth, setPreviewedMonth] = (0,external_wp_element_namespaceObject.useState)( startOfMonth(new Date(postDate)) ); const eventsByPostType = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecords("postType", postType, { status: "publish,future", after: startOfMonth(previewedMonth).toISOString(), before: endOfMonth(previewedMonth).toISOString(), exclude: [select(store_store).getCurrentPostId()], per_page: 100, _fields: "id,date" }), [previewedMonth, postType] ); const events = (0,external_wp_element_namespaceObject.useMemo)( () => (eventsByPostType || []).map(({ date: eventDate }) => ({ date: new Date(eventDate) })), [eventsByPostType] ); const settings = (0,external_wp_date_namespaceObject.getSettings)(); const is12HourTime = /a(?!\\)/i.test( settings.formats.time.toLowerCase().replace(/\\\\/g, "").split("").reverse().join("") // Reverse the string and test for "a" not followed by a slash. ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivatePublishDateTimePicker, { currentDate: postDate, onChange: onUpdateDate, is12Hour: is12HourTime, dateOrder: ( /* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */ (0,external_wp_i18n_namespaceObject._x)("dmy", "date order") ), events, onMonthPreviewed: (date) => setPreviewedMonth(parseISO(date)), onClose, isCompact, showPopoverHeaderActions } ); } ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js function PostScheduleLabel(props) { return usePostScheduleLabel(props); } function usePostScheduleLabel({ full = false } = {}) { const { date, isFloating } = (0,external_wp_data_namespaceObject.useSelect)( (select) => ({ date: select(store_store).getEditedPostAttribute("date"), isFloating: select(store_store).isEditedPostDateFloating() }), [] ); return full ? getFullPostScheduleLabel(date) : getPostScheduleLabel(date, { isFloating }); } function getFullPostScheduleLabel(dateAttribute) { const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute); const timezoneAbbreviation = getTimezoneAbbreviation(); const formattedDate = (0,external_wp_date_namespaceObject.dateI18n)( // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate. (0,external_wp_i18n_namespaceObject._x)("F j, Y g:i\xA0a", "post schedule full date format"), date ); return (0,external_wp_i18n_namespaceObject.isRTL)() ? `${timezoneAbbreviation} ${formattedDate}` : `${formattedDate} ${timezoneAbbreviation}`; } function getPostScheduleLabel(dateAttribute, { isFloating = false, now = /* @__PURE__ */ new Date() } = {}) { if (!dateAttribute || isFloating) { return (0,external_wp_i18n_namespaceObject.__)("Immediately"); } if (!isTimezoneSameAsSiteTimezone(now)) { return getFullPostScheduleLabel(dateAttribute); } const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute); if (isSameDay(date, now)) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Time of day the post is scheduled for. (0,external_wp_i18n_namespaceObject.__)("Today at %s"), // translators: If using a space between 'g:i' and 'a', use a non-breaking space. (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)("g:i\xA0a", "post schedule time format"), date) ); } const tomorrow = new Date(now); tomorrow.setDate(tomorrow.getDate() + 1); if (isSameDay(date, tomorrow)) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Time of day the post is scheduled for. (0,external_wp_i18n_namespaceObject.__)("Tomorrow at %s"), // translators: If using a space between 'g:i' and 'a', use a non-breaking space. (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)("g:i\xA0a", "post schedule time format"), date) ); } if (date.getFullYear() === now.getFullYear()) { return (0,external_wp_date_namespaceObject.dateI18n)( // translators: If using a space between 'g:i' and 'a', use a non-breaking space. (0,external_wp_i18n_namespaceObject._x)("F j g:i\xA0a", "post schedule date format without year"), date ); } return (0,external_wp_date_namespaceObject.dateI18n)( // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate. (0,external_wp_i18n_namespaceObject._x)("F j, Y g:i\xA0a", "post schedule full date format"), date ); } function getTimezoneAbbreviation() { const { timezone } = (0,external_wp_date_namespaceObject.getSettings)(); if (timezone.abbr && isNaN(Number(timezone.abbr))) { return timezone.abbr; } const symbol = timezone.offset < 0 ? "" : "+"; return `UTC${symbol}${timezone.offsetFormatted}`; } function isTimezoneSameAsSiteTimezone(date) { const { timezone } = (0,external_wp_date_namespaceObject.getSettings)(); const siteOffset = Number(timezone.offset); const dateOffset = -1 * (date.getTimezoneOffset() / 60); return siteOffset === dateOffset; } function isSameDay(left, right) { return left.getDate() === right.getDate() && left.getMonth() === right.getMonth() && left.getFullYear() === right.getFullYear(); } ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js const MIN_MOST_USED_TERMS = 3; const DEFAULT_QUERY = { per_page: 10, orderby: "count", order: "desc", hide_empty: true, _fields: "id,name,count", context: "view" }; function MostUsedTerms({ onSelect, taxonomy }) { const { _terms, showTerms } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const mostUsedTerms = select(external_wp_coreData_namespaceObject.store).getEntityRecords( "taxonomy", taxonomy.slug, DEFAULT_QUERY ); return { _terms: mostUsedTerms, showTerms: mostUsedTerms?.length >= MIN_MOST_USED_TERMS }; }, [taxonomy.slug] ); if (!showTerms) { return null; } const terms = unescapeTerms(_terms); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-taxonomies__flat-term-most-used", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "h3", className: "editor-post-taxonomies__flat-term-most-used-label", children: taxonomy.labels.most_used } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "ul", { role: "list", className: "editor-post-taxonomies__flat-term-most-used-list", children: terms.map((term) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", onClick: () => onSelect(term), children: term.name } ) }, term.id)) } ) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js const flat_term_selector_EMPTY_ARRAY = []; const MAX_TERMS_SUGGESTIONS = 100; const flat_term_selector_DEFAULT_QUERY = { per_page: MAX_TERMS_SUGGESTIONS, _fields: "id,name", context: "view" }; const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase(); const termNamesToIds = (names, terms) => { return names.map( (termName) => terms.find((term) => isSameTermName(term.name, termName))?.id ).filter((id) => id !== void 0); }; const Wrapper = ({ children, __nextHasNoMarginBottom }) => __nextHasNoMarginBottom ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children }); function FlatTermSelector({ slug, __nextHasNoMarginBottom }) { const [values, setValues] = (0,external_wp_element_namespaceObject.useState)([]); const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(""); const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 500); if (!__nextHasNoMarginBottom) { external_wp_deprecated_default()( "Bottom margin styles for wp.editor.PostTaxonomiesFlatTermSelector", { since: "6.7", version: "7.0", hint: "Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version." } ); } const { terms, termIds, taxonomy, hasAssignAction, hasCreateAction, hasResolvedTerms } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getCurrentPost, getEditedPostAttribute } = select(store_store); const { getEntityRecords, getEntityRecord, hasFinishedResolution } = select(external_wp_coreData_namespaceObject.store); const post = getCurrentPost(); const _taxonomy = getEntityRecord("root", "taxonomy", slug); const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : flat_term_selector_EMPTY_ARRAY; const query = { ...flat_term_selector_DEFAULT_QUERY, include: _termIds?.join(","), per_page: -1 }; return { hasCreateAction: _taxonomy ? post._links?.["wp:action-create-" + _taxonomy.rest_base] ?? false : false, hasAssignAction: _taxonomy ? post._links?.["wp:action-assign-" + _taxonomy.rest_base] ?? false : false, taxonomy: _taxonomy, termIds: _termIds, terms: _termIds?.length ? getEntityRecords("taxonomy", slug, query) : flat_term_selector_EMPTY_ARRAY, hasResolvedTerms: hasFinishedResolution("getEntityRecords", [ "taxonomy", slug, query ]) }; }, [slug] ); const { searchResults } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEntityRecords } = select(external_wp_coreData_namespaceObject.store); return { searchResults: !!search ? getEntityRecords("taxonomy", slug, { ...flat_term_selector_DEFAULT_QUERY, search }) : flat_term_selector_EMPTY_ARRAY }; }, [search, slug] ); (0,external_wp_element_namespaceObject.useEffect)(() => { if (hasResolvedTerms) { const newValues = (terms ?? []).map( (term) => unescapeString(term.name) ); setValues(newValues); } }, [terms, hasResolvedTerms]); const suggestions = (0,external_wp_element_namespaceObject.useMemo)(() => { return (searchResults ?? []).map( (term) => unescapeString(term.name) ); }, [searchResults]); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); if (!hasAssignAction) { return null; } async function findOrCreateTerm(term) { try { const newTerm = await saveEntityRecord("taxonomy", slug, term, { throwOnError: true }); return unescapeTerm(newTerm); } catch (error) { if (error.code !== "term_exists") { throw error; } return { id: error.data.term_id, name: term.name }; } } function onUpdateTerms(newTermIds) { editPost({ [taxonomy.rest_base]: newTermIds }); } function onChange(termNames) { const availableTerms = [ ...terms ?? [], ...searchResults ?? [] ]; const uniqueTerms = termNames.reduce((acc, name) => { if (!acc.some((n) => n.toLowerCase() === name.toLowerCase())) { acc.push(name); } return acc; }, []); const newTermNames = uniqueTerms.filter( (termName) => !availableTerms.find( (term) => isSameTermName(term.name, termName) ) ); setValues(uniqueTerms); if (newTermNames.length === 0) { onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms)); return; } if (!hasCreateAction) { return; } Promise.all( newTermNames.map( (termName) => findOrCreateTerm({ name: termName }) ) ).then((newTerms) => { const newAvailableTerms = availableTerms.concat(newTerms); onUpdateTerms( termNamesToIds(uniqueTerms, newAvailableTerms) ); }).catch((error) => { createErrorNotice(error.message, { type: "snackbar" }); onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms)); }); } function appendTerm(newTerm) { if (termIds.includes(newTerm.id)) { return; } const newTermIds = [...termIds, newTerm.id]; const defaultName = slug === "post_tag" ? (0,external_wp_i18n_namespaceObject.__)("Tag") : (0,external_wp_i18n_namespaceObject.__)("Term"); const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */ (0,external_wp_i18n_namespaceObject._x)("%s added", "term"), taxonomy?.labels?.singular_name ?? defaultName ); (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, "assertive"); onUpdateTerms(newTermIds); } const newTermLabel = taxonomy?.labels?.add_new_item ?? (slug === "post_tag" ? (0,external_wp_i18n_namespaceObject.__)("Add Tag") : (0,external_wp_i18n_namespaceObject.__)("Add Term")); const singularName = taxonomy?.labels?.singular_name ?? (slug === "post_tag" ? (0,external_wp_i18n_namespaceObject.__)("Tag") : (0,external_wp_i18n_namespaceObject.__)("Term")); const termAddedLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */ (0,external_wp_i18n_namespaceObject._x)("%s added", "term"), singularName ); const termRemovedLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */ (0,external_wp_i18n_namespaceObject._x)("%s removed", "term"), singularName ); const removeTermLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */ (0,external_wp_i18n_namespaceObject._x)("Remove %s", "term"), singularName ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { __nextHasNoMarginBottom, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FormTokenField, { __next40pxDefaultSize: true, value: values, suggestions, onChange, onInputChange: debouncedSearch, maxSuggestions: MAX_TERMS_SUGGESTIONS, label: newTermLabel, messages: { added: termAddedLabel, removed: termRemovedLabel, remove: removeTermLabel }, __nextHasNoMarginBottom } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MostUsedTerms, { taxonomy, onSelect: appendTerm }) ] }); } var flat_term_selector_default = (0,external_wp_components_namespaceObject.withFilters)("editor.PostTaxonomyType")(FlatTermSelector); ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js const TagsPanel = () => { const tagLabels = (0,external_wp_data_namespaceObject.useSelect)((select) => { const taxonomy = select(external_wp_coreData_namespaceObject.store).getTaxonomy("post_tag"); return taxonomy?.labels; }, []); const addNewItem = tagLabels?.add_new_item ?? (0,external_wp_i18n_namespaceObject.__)("Add tag"); const tagLabel = tagLabels?.name ?? (0,external_wp_i18n_namespaceObject.__)("Tags"); const panelBodyTitle = [ (0,external_wp_i18n_namespaceObject.__)("Suggestion:"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-publish-panel__link", children: addNewItem }, "label") ]; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { initialOpen: false, title: panelBodyTitle, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s is the taxonomy name (e.g., "Tags"). (0,external_wp_i18n_namespaceObject.__)( "%s help users and search engines navigate your site and find your content. Add a few keywords to describe your post." ), tagLabel ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(flat_term_selector_default, { slug: "post_tag", __nextHasNoMarginBottom: true }) ] }); }; const MaybeTagsPanel = () => { const { postHasTags, siteHasTags, isPostTypeSupported } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const postType = select(store_store).getCurrentPostType(); const tagsTaxonomy = select(external_wp_coreData_namespaceObject.store).getEntityRecord( "root", "taxonomy", "post_tag" ); const _isPostTypeSupported = tagsTaxonomy?.types?.includes(postType); const areTagsFetched = tagsTaxonomy !== void 0; const tags = tagsTaxonomy && select(store_store).getEditedPostAttribute( tagsTaxonomy.rest_base ); const siteTags = _isPostTypeSupported ? !!select(external_wp_coreData_namespaceObject.store).getEntityRecords( "taxonomy", "post_tag", { per_page: 1 } )?.length : false; return { postHasTags: !!tags?.length, siteHasTags: siteTags, isPostTypeSupported: areTagsFetched && _isPostTypeSupported }; }, [] ); const [hadTagsWhenOpeningThePanel] = (0,external_wp_element_namespaceObject.useState)(postHasTags); if (!isPostTypeSupported || !siteHasTags) { return null; } if (!hadTagsWhenOpeningThePanel) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TagsPanel, {}); } return null; }; var maybe_tags_panel_default = MaybeTagsPanel; ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js const getSuggestion = (supportedFormats, suggestedPostFormat) => { const formats = POST_FORMATS.filter( (format) => supportedFormats?.includes(format.id) ); return formats.find((format) => format.id === suggestedPostFormat); }; const PostFormatSuggestion = ({ suggestedPostFormat, suggestionText, onUpdatePostFormat }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", onClick: () => onUpdatePostFormat(suggestedPostFormat), children: suggestionText } ); function PostFormatPanel() { const { currentPostFormat, suggestion } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedPostAttribute, getSuggestedPostFormat } = select(store_store); const supportedFormats = select(external_wp_coreData_namespaceObject.store).getThemeSupports().formats ?? []; return { currentPostFormat: getEditedPostAttribute("format"), suggestion: getSuggestion( supportedFormats, getSuggestedPostFormat() ) }; }, []); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const onUpdatePostFormat = (format) => editPost({ format }); const panelBodyTitle = [ (0,external_wp_i18n_namespaceObject.__)("Suggestion:"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-publish-panel__link", children: (0,external_wp_i18n_namespaceObject.__)("Use a post format") }, "label") ]; if (!suggestion || suggestion.id === currentPostFormat) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { initialOpen: false, title: panelBodyTitle, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( "Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PostFormatSuggestion, { onUpdatePostFormat, suggestedPostFormat: suggestion.id, suggestionText: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %1s: post format */ (0,external_wp_i18n_namespaceObject.__)('Apply the "%1$s" format.'), suggestion.caption ) } ) }) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js const { normalizeTextString } = unlock(external_wp_components_namespaceObject.privateApis); const { RECEIVE_INTERMEDIATE_RESULTS } = unlock(external_wp_coreData_namespaceObject.privateApis); const hierarchical_term_selector_DEFAULT_QUERY = { per_page: -1, orderby: "name", order: "asc", _fields: "id,name,parent", context: "view", [RECEIVE_INTERMEDIATE_RESULTS]: true }; const MIN_TERMS_COUNT_FOR_FILTER = 8; const hierarchical_term_selector_EMPTY_ARRAY = []; function sortBySelected(termsTree, terms) { const treeHasSelection = (termTree) => { if (terms.indexOf(termTree.id) !== -1) { return true; } if (void 0 === termTree.children) { return false; } return termTree.children.map(treeHasSelection).filter((child) => child).length > 0; }; const termOrChildIsSelected = (termA, termB) => { const termASelected = treeHasSelection(termA); const termBSelected = treeHasSelection(termB); if (termASelected === termBSelected) { return 0; } if (termASelected && !termBSelected) { return -1; } if (!termASelected && termBSelected) { return 1; } return 0; }; const newTermTree = [...termsTree]; newTermTree.sort(termOrChildIsSelected); return newTermTree; } function findTerm(terms, parent, name) { return terms.find((term) => { return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase(); }); } function getFilterMatcher(filterValue) { const matchTermsForFilter = (originalTerm) => { if ("" === filterValue) { return originalTerm; } const term = { ...originalTerm }; if (term.children.length > 0) { term.children = term.children.map(matchTermsForFilter).filter((child) => child); } if (-1 !== normalizeTextString(term.name).indexOf( normalizeTextString(filterValue) ) || term.children.length > 0) { return term; } return false; }; return matchTermsForFilter; } function HierarchicalTermSelector({ slug }) { const [adding, setAdding] = (0,external_wp_element_namespaceObject.useState)(false); const [formName, setFormName] = (0,external_wp_element_namespaceObject.useState)(""); const [formParent, setFormParent] = (0,external_wp_element_namespaceObject.useState)(""); const [showForm, setShowForm] = (0,external_wp_element_namespaceObject.useState)(false); const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(""); const [filteredTermsTree, setFilteredTermsTree] = (0,external_wp_element_namespaceObject.useState)([]); const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); const { hasCreateAction, hasAssignAction, terms, loading, availableTerms, taxonomy } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getCurrentPost, getEditedPostAttribute } = select(store_store); const { getEntityRecord, getEntityRecords, isResolving } = select(external_wp_coreData_namespaceObject.store); const _taxonomy = getEntityRecord("root", "taxonomy", slug); const post = getCurrentPost(); return { hasCreateAction: _taxonomy ? !!post._links?.["wp:action-create-" + _taxonomy.rest_base] : false, hasAssignAction: _taxonomy ? !!post._links?.["wp:action-assign-" + _taxonomy.rest_base] : false, terms: _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : hierarchical_term_selector_EMPTY_ARRAY, loading: isResolving("getEntityRecords", [ "taxonomy", slug, hierarchical_term_selector_DEFAULT_QUERY ]), availableTerms: getEntityRecords("taxonomy", slug, hierarchical_term_selector_DEFAULT_QUERY) || hierarchical_term_selector_EMPTY_ARRAY, taxonomy: _taxonomy }; }, [slug] ); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const availableTermsTree = (0,external_wp_element_namespaceObject.useMemo)( () => sortBySelected(terms_buildTermsTree(availableTerms), terms), // Remove `terms` from the dependency list to avoid reordering every time // checking or unchecking a term. [availableTerms] ); const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); if (!hasAssignAction) { return null; } const addTerm = (term) => { return saveEntityRecord("taxonomy", slug, term, { throwOnError: true }); }; const onUpdateTerms = (termIds) => { editPost({ [taxonomy.rest_base]: termIds }); }; const onChange = (termId) => { const hasTerm = terms.includes(termId); const newTerms = hasTerm ? terms.filter((id) => id !== termId) : [...terms, termId]; onUpdateTerms(newTerms); }; const onChangeFormName = (value) => { setFormName(value); }; const onChangeFormParent = (parentId) => { setFormParent(parentId); }; const onToggleForm = () => { setShowForm(!showForm); }; const onAddTerm = async (event) => { event.preventDefault(); if (formName === "" || adding) { return; } const existingTerm = findTerm(availableTerms, formParent, formName); if (existingTerm) { if (!terms.some((term) => term === existingTerm.id)) { onUpdateTerms([...terms, existingTerm.id]); } setFormName(""); setFormParent(""); return; } setAdding(true); let newTerm; try { newTerm = await addTerm({ name: formName, parent: formParent ? formParent : void 0 }); } catch (error) { createErrorNotice(error.message, { type: "snackbar" }); return; } const defaultName = slug === "category" ? (0,external_wp_i18n_namespaceObject.__)("Category") : (0,external_wp_i18n_namespaceObject.__)("Term"); const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */ (0,external_wp_i18n_namespaceObject._x)("%s added", "term"), taxonomy?.labels?.singular_name ?? defaultName ); (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, "assertive"); setAdding(false); setFormName(""); setFormParent(""); onUpdateTerms([...terms, newTerm.id]); }; const setFilter = (value) => { const newFilteredTermsTree = availableTermsTree.map(getFilterMatcher(value)).filter((term) => term); const getResultCount = (termsTree) => { let count = 0; for (let i = 0; i < termsTree.length; i++) { count++; if (void 0 !== termsTree[i].children) { count += getResultCount(termsTree[i].children); } } return count; }; setFilterValue(value); setFilteredTermsTree(newFilteredTermsTree); const resultCount = getResultCount(newFilteredTermsTree); const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", resultCount), resultCount ); debouncedSpeak(resultsFoundMessage, "assertive"); }; const renderTerms = (renderedTerms) => { return renderedTerms.map((term) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: "editor-post-taxonomies__hierarchical-terms-choice", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, checked: terms.indexOf(term.id) !== -1, onChange: () => { const termId = parseInt(term.id, 10); onChange(termId); }, label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(term.name) } ), !!term.children.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-taxonomies__hierarchical-terms-subchoices", children: renderTerms(term.children) }) ] }, term.id ); }); }; const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => taxonomy?.labels?.[labelProperty] ?? (slug === "category" ? fallbackIsCategory : fallbackIsNotCategory); const newTermButtonLabel = labelWithFallback( "add_new_item", (0,external_wp_i18n_namespaceObject.__)("Add Category"), (0,external_wp_i18n_namespaceObject.__)("Add Term") ); const newTermLabel = labelWithFallback( "new_item_name", (0,external_wp_i18n_namespaceObject.__)("Add Category"), (0,external_wp_i18n_namespaceObject.__)("Add Term") ); const parentSelectLabel = labelWithFallback( "parent_item", (0,external_wp_i18n_namespaceObject.__)("Parent Category"), (0,external_wp_i18n_namespaceObject.__)("Parent Term") ); const noParentOption = `\u2014 ${parentSelectLabel} \u2014`; const newTermSubmitLabel = newTermButtonLabel; const filterLabel = taxonomy?.labels?.search_items ?? (0,external_wp_i18n_namespaceObject.__)("Search Terms"); const groupLabel = taxonomy?.name ?? (0,external_wp_i18n_namespaceObject.__)("Terms"); const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { direction: "column", gap: "4", children: [ showFilter && !loading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SearchControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: filterLabel, placeholder: filterLabel, value: filterValue, onChange: setFilter } ), loading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Flex, { justify: "center", style: { // Match SearchControl height to prevent layout shift. height: "40px" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "editor-post-taxonomies__hierarchical-terms-list", tabIndex: "0", role: "group", "aria-label": groupLabel, children: renderTerms( "" !== filterValue ? filteredTermsTree : availableTermsTree ) } ), !loading && hasCreateAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, onClick: onToggleForm, className: "editor-post-taxonomies__hierarchical-terms-add", "aria-expanded": showForm, variant: "link", children: newTermButtonLabel } ) }), showForm && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onAddTerm, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { direction: "column", gap: "4", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, className: "editor-post-taxonomies__hierarchical-terms-input", label: newTermLabel, value: formName, onChange: onChangeFormName, required: true } ), !!availableTerms.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TreeSelect, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: parentSelectLabel, noOptionLabel: noParentOption, onChange: onChangeFormParent, selectedId: formParent, tree: availableTermsTree } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", type: "submit", className: "editor-post-taxonomies__hierarchical-terms-submit", children: newTermSubmitLabel } ) }) ] }) }) ] }); } var hierarchical_term_selector_default = (0,external_wp_components_namespaceObject.withFilters)("editor.PostTaxonomyType")( HierarchicalTermSelector ); ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-category-panel.js function MaybeCategoryPanel() { const { hasNoCategory, hasSiteCategories } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const postType = select(store_store).getCurrentPostType(); const { canUser, getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const categoriesTaxonomy = getEntityRecord( "root", "taxonomy", "category" ); const defaultCategoryId = canUser("read", { kind: "root", name: "site" }) ? getEntityRecord("root", "site")?.default_category : void 0; const defaultCategory = defaultCategoryId ? getEntityRecord("taxonomy", "category", defaultCategoryId) : void 0; const postTypeSupportsCategories = categoriesTaxonomy && categoriesTaxonomy.types.some((type) => type === postType); const categories = categoriesTaxonomy && select(store_store).getEditedPostAttribute( categoriesTaxonomy.rest_base ); const siteCategories = postTypeSupportsCategories ? !!select(external_wp_coreData_namespaceObject.store).getEntityRecords("taxonomy", "category", { exclude: [defaultCategoryId], per_page: 1 })?.length : false; const noCategory = !!categoriesTaxonomy && !!defaultCategory && postTypeSupportsCategories && (categories?.length === 0 || categories?.length === 1 && defaultCategory?.id === categories[0]); return { hasNoCategory: noCategory, hasSiteCategories: siteCategories }; }, []); const [shouldShowPanel, setShouldShowPanel] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { if (hasNoCategory) { setShouldShowPanel(true); } }, [hasNoCategory]); if (!shouldShowPanel || !hasSiteCategories) { return null; } const panelBodyTitle = [ (0,external_wp_i18n_namespaceObject.__)("Suggestion:"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-publish-panel__link", children: (0,external_wp_i18n_namespaceObject.__)("Assign a category") }, "label") ]; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { initialOpen: false, title: panelBodyTitle, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( "Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(hierarchical_term_selector_default, { slug: "category" }) ] }); } var maybe_category_panel_default = MaybeCategoryPanel; ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/media-util.js function generateUniqueBasenames(urls) { const basenames = /* @__PURE__ */ new Set(); return Object.fromEntries( urls.map((url) => { const filename = (0,external_wp_url_namespaceObject.getFilename)(url); let basename = ""; if (filename) { const parts = filename.split("."); if (parts.length > 1) { parts.pop(); } basename = parts.join("."); } if (!basename) { basename = esm_browser_v4(); } if (basenames.has(basename)) { basename = `${basename}-${esm_browser_v4()}`; } basenames.add(basename); return [url, basename]; }) ); } function fetchMedia(urls) { return Object.fromEntries( Object.entries(generateUniqueBasenames(urls)).map( ([url, basename]) => { const filePromise = window.fetch(url.includes("?") ? url : url + "?").then((response) => response.blob()).then((blob) => { return new File([blob], `${basename}.png`, { type: blob.type }); }); return [url, filePromise]; } ) ); } ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-upload-media.js function flattenBlocks(blocks) { const result = []; blocks.forEach((block) => { result.push(block); result.push(...flattenBlocks(block.innerBlocks)); }); return result; } function hasExternalMedia(block) { if (block.name === "core/image" || block.name === "core/cover") { return block.attributes.url && !block.attributes.id; } if (block.name === "core/media-text") { return block.attributes.mediaUrl && !block.attributes.mediaId; } return void 0; } function getMediaInfo(block) { if (block.name === "core/image" || block.name === "core/cover") { const { url, alt, id } = block.attributes; return { url, alt, id }; } if (block.name === "core/media-text") { const { mediaUrl: url, mediaAlt: alt, mediaId: id } = block.attributes; return { url, alt, id }; } return {}; } function Image({ clientId, alt, url }) { const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.img, { tabIndex: 0, role: "button", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Select image block."), onClick: () => { selectBlock(clientId); }, onKeyDown: (event) => { if (event.key === "Enter" || event.key === " ") { selectBlock(clientId); event.preventDefault(); } }, alt, src: url, animate: { opacity: 1 }, exit: { opacity: 0, scale: 0 }, style: { width: "32px", height: "32px", objectFit: "cover", borderRadius: "2px", cursor: "pointer" }, whileHover: { scale: 1.08 } }, clientId ); } function MaybeUploadMediaPanel() { const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false); const [isAnimating, setIsAnimating] = (0,external_wp_element_namespaceObject.useState)(false); const [hadUploadError, setHadUploadError] = (0,external_wp_element_namespaceObject.useState)(false); const { editorBlocks, mediaUpload } = (0,external_wp_data_namespaceObject.useSelect)( (select) => ({ editorBlocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks(), mediaUpload: select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload }), [] ); const blocksWithExternalMedia = flattenBlocks(editorBlocks).filter( (block) => hasExternalMedia(block) ); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); if (!mediaUpload || !blocksWithExternalMedia.length) { return null; } const panelBodyTitle = [ (0,external_wp_i18n_namespaceObject.__)("Suggestion:"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-publish-panel__link", children: (0,external_wp_i18n_namespaceObject.__)("External media") }, "label") ]; function updateBlockWithUploadedMedia(block, media) { if (block.name === "core/image" || block.name === "core/cover") { updateBlockAttributes(block.clientId, { id: media.id, url: media.url }); } if (block.name === "core/media-text") { updateBlockAttributes(block.clientId, { mediaId: media.id, mediaUrl: media.url }); } } function uploadImages() { setIsUploading(true); setHadUploadError(false); const mediaUrls = new Set( blocksWithExternalMedia.map((block) => { const { url } = getMediaInfo(block); return url; }) ); const uploadPromises = Object.fromEntries( Object.entries(fetchMedia([...mediaUrls])).map( ([url, filePromise]) => { const uploadPromise = filePromise.then( (blob) => new Promise((resolve, reject) => { mediaUpload({ filesList: [blob], onFileChange: ([media]) => { if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) { return; } resolve(media); }, onError() { reject(); } }); }) ); return [url, uploadPromise]; } ) ); Promise.allSettled( blocksWithExternalMedia.map((block) => { const { url } = getMediaInfo(block); return uploadPromises[url].then( (media) => updateBlockWithUploadedMedia(block, media) ).then(() => setIsAnimating(true)).catch(() => setHadUploadError(true)); }) ).finally(() => { setIsUploading(false); }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { initialOpen: true, title: panelBodyTitle, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( "Upload external images to the Media Library. Images from different domains may load slowly, display incorrectly, or be removed unexpectedly." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { style: { display: "inline-flex", flexWrap: "wrap", gap: "8px" }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableAnimatePresence, { onExitComplete: () => setIsAnimating(false), children: blocksWithExternalMedia.map((block) => { const { url, alt } = getMediaInfo(block); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Image, { clientId: block.clientId, url, alt }, block.clientId ); }) } ), isUploading || isAnimating ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", variant: "primary", onClick: uploadImages, children: (0,external_wp_i18n_namespaceObject._x)("Upload", "verb") } ) ] } ), hadUploadError && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("Upload failed, try again.") }) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js function PostPublishPanelPrepublish({ children }) { const { isBeingScheduled, isRequestingSiteIcon, hasPublishAction, siteIconUrl, siteTitle, siteHome } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPost, isEditedPostBeingScheduled } = select(store_store); const { getEntityRecord, isResolving } = select(external_wp_coreData_namespaceObject.store); const siteData = getEntityRecord("root", "__unstableBase", void 0) || {}; return { hasPublishAction: getCurrentPost()._links?.["wp:action-publish"] ?? false, isBeingScheduled: isEditedPostBeingScheduled(), isRequestingSiteIcon: isResolving("getEntityRecord", [ "root", "__unstableBase", void 0 ]), siteIconUrl: siteData.site_icon_url, siteTitle: siteData.name, siteHome: siteData.home && (0,external_wp_url_namespaceObject.filterURLForDisplay)(siteData.home) }; }, []); let siteIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { className: "components-site-icon", size: "36px", icon: wordpress_default }); if (siteIconUrl) { siteIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { alt: (0,external_wp_i18n_namespaceObject.__)("Site Icon"), className: "components-site-icon", src: siteIconUrl } ); } if (isRequestingSiteIcon) { siteIcon = null; } let prePublishTitle, prePublishBodyText; if (!hasPublishAction) { prePublishTitle = (0,external_wp_i18n_namespaceObject.__)("Are you ready to submit for review?"); prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)( "Your work will be reviewed and then approved." ); } else if (isBeingScheduled) { prePublishTitle = (0,external_wp_i18n_namespaceObject.__)("Are you ready to schedule?"); prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)( "Your work will be published at the specified date and time." ); } else { prePublishTitle = (0,external_wp_i18n_namespaceObject.__)("Are you ready to publish?"); prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)( "Double-check your settings before publishing." ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-publish-panel__prepublish", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { children: prePublishTitle }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: prePublishBodyText }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-site-card", children: [ siteIcon, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-site-info", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-site-name", children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) || (0,external_wp_i18n_namespaceObject.__)("(Untitled)") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-site-home", children: siteHome }) ] }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeUploadMediaPanel, {}), hasPublishAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.PanelBody, { initialOpen: false, title: [ (0,external_wp_i18n_namespaceObject.__)("Visibility:"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { className: "editor-post-publish-panel__link", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityLabel, {}) }, "label" ) ], children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibility, {}) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.PanelBody, { initialOpen: false, title: [ (0,external_wp_i18n_namespaceObject.__)("Publish:"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { className: "editor-post-publish-panel__link", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleLabel, {}) }, "label" ) ], children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedule, {}) } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatPanel, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(maybe_tags_panel_default, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(maybe_category_panel_default, {}), children ] }); } var prepublish_default = PostPublishPanelPrepublish; ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js const POSTNAME = "%postname%"; const PAGENAME = "%pagename%"; const getFuturePostUrl = (post) => { const { slug } = post; if (post.permalink_template.includes(POSTNAME)) { return post.permalink_template.replace(POSTNAME, slug); } if (post.permalink_template.includes(PAGENAME)) { return post.permalink_template.replace(PAGENAME, slug); } return post.permalink_template; }; function postpublish_CopyButton({ text }) { const [showCopyConfirmation, setShowCopyConfirmation] = (0,external_wp_element_namespaceObject.useState)(false); const timeoutIdRef = (0,external_wp_element_namespaceObject.useRef)(); const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, () => { setShowCopyConfirmation(true); if (timeoutIdRef.current) { clearTimeout(timeoutIdRef.current); } timeoutIdRef.current = setTimeout(() => { setShowCopyConfirmation(false); }, 4e3); }); (0,external_wp_element_namespaceObject.useEffect)(() => { return () => { if (timeoutIdRef.current) { clearTimeout(timeoutIdRef.current); } }; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", ref, children: showCopyConfirmation ? (0,external_wp_i18n_namespaceObject.__)("Copied!") : (0,external_wp_i18n_namespaceObject.__)("Copy") }); } function PostPublishPanelPostpublish({ focusOnMount, children }) { const { post, postType, isScheduled } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedPostAttribute, getCurrentPost, isCurrentPostScheduled } = select(store_store); const { getPostType } = select(external_wp_coreData_namespaceObject.store); return { post: getCurrentPost(), postType: getPostType(getEditedPostAttribute("type")), isScheduled: isCurrentPostScheduled() }; }, []); const postLabel = postType?.labels?.singular_name; const viewPostLabel = postType?.labels?.view_item; const addNewPostLabel = postType?.labels?.add_new_item; const link = post.status === "future" ? getFuturePostUrl(post) : post.link; const addLink = (0,external_wp_url_namespaceObject.addQueryArgs)("post-new.php", { post_type: post.type }); const postLinkRef = (0,external_wp_element_namespaceObject.useCallback)( (node) => { if (focusOnMount && node) { node.focus(); } }, [focusOnMount] ); const postPublishNonLinkHeader = isScheduled ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ (0,external_wp_i18n_namespaceObject.__)("is now scheduled. It will go live on"), " ", /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleLabel, {}), "." ] }) : (0,external_wp_i18n_namespaceObject.__)("is now live."); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "post-publish-panel__postpublish", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { className: "post-publish-panel__postpublish-header", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { ref: postLinkRef, href: link, children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title) || (0,external_wp_i18n_namespaceObject.__)("(no title)") }), " ", postPublishNonLinkHeader ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "post-publish-panel__postpublish-subheader", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { children: (0,external_wp_i18n_namespaceObject.__)("What\u2019s next?") }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "post-publish-panel__postpublish-post-address-container", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, className: "post-publish-panel__postpublish-post-address", readOnly: true, label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post type singular name */ (0,external_wp_i18n_namespaceObject.__)("%s address"), postLabel ), value: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(link), onFocus: (event) => event.target.select() } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "post-publish-panel__postpublish-post-address__copy-button-wrap", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(postpublish_CopyButton, { text: link }) }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "post-publish-panel__postpublish-buttons", children: [ !isScheduled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Button, { variant: "primary", href: link, __next40pxDefaultSize: true, icon: external_default, iconPosition: "right", target: "_blank", children: [ viewPostLabel, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", /* translators: accessibility text */ children: (0,external_wp_i18n_namespaceObject.__)("(opens in a new tab)") }) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: isScheduled ? "primary" : "secondary", __next40pxDefaultSize: true, href: addLink, children: addNewPostLabel } ) ] }) ] }), children ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js class PostPublishPanel extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); this.onSubmit = this.onSubmit.bind(this); this.cancelButtonNode = (0,external_wp_element_namespaceObject.createRef)(); } componentDidMount() { this.timeoutID = setTimeout(() => { this.cancelButtonNode.current.focus(); }, 0); } componentWillUnmount() { clearTimeout(this.timeoutID); } componentDidUpdate(prevProps) { if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty || this.props.currentPostId !== prevProps.currentPostId) { this.props.onClose(); } } onSubmit() { const { onClose, hasPublishAction, isPostTypeViewable } = this.props; if (!hasPublishAction || !isPostTypeViewable) { onClose(); } } render() { const { forceIsDirty, isBeingScheduled, isPublished, isPublishSidebarEnabled, isScheduled, isSaving, isSavingNonPostEntityChanges, onClose, onTogglePublishSidebar, PostPublishExtension, PrePublishExtension, currentPostId, ...additionalProps } = this.props; const { hasPublishAction, isDirty, isPostTypeViewable, ...propsForPanel } = additionalProps; const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled; const isPrePublish = !isPublishedOrScheduled && !isSaving; const isPostPublish = isPublishedOrScheduled && !isSaving; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-publish-panel", ...propsForPanel, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-publish-panel__header", children: isPostPublish ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", onClick: onClose, icon: close_small_default, label: (0,external_wp_i18n_namespaceObject.__)("Close panel") } ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-publish-panel__header-cancel-button", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { ref: this.cancelButtonNode, accessibleWhenDisabled: true, disabled: isSavingNonPostEntityChanges, onClick: onClose, variant: "secondary", size: "compact", children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-publish-panel__header-publish-button", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( post_publish_button_default, { onSubmit: this.onSubmit, forceIsDirty } ) }) ] }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-publish-panel__content", children: [ isPrePublish && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(prepublish_default, { children: PrePublishExtension && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrePublishExtension, {}) }), isPostPublish && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPublishPanelPostpublish, { focusOnMount: true, children: PostPublishExtension && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPublishExtension, {}) }), isSaving && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-publish-panel__footer", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Always show pre-publish checks."), checked: isPublishSidebarEnabled, onChange: onTogglePublishSidebar } ) }) ] }); } } var post_publish_panel_default = (0,external_wp_compose_namespaceObject.compose)([ (0,external_wp_data_namespaceObject.withSelect)((select) => { const { getPostType } = select(external_wp_coreData_namespaceObject.store); const { getCurrentPost, getCurrentPostId, getEditedPostAttribute, isCurrentPostPublished, isCurrentPostScheduled, isEditedPostBeingScheduled, isEditedPostDirty, isAutosavingPost, isSavingPost, isSavingNonPostEntityChanges } = select(store_store); const { isPublishSidebarEnabled } = select(store_store); const postType = getPostType(getEditedPostAttribute("type")); return { hasPublishAction: getCurrentPost()._links?.["wp:action-publish"] ?? false, isPostTypeViewable: postType?.viewable, isBeingScheduled: isEditedPostBeingScheduled(), isDirty: isEditedPostDirty(), isPublished: isCurrentPostPublished(), isPublishSidebarEnabled: isPublishSidebarEnabled(), isSaving: isSavingPost() && !isAutosavingPost(), isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(), isScheduled: isCurrentPostScheduled(), currentPostId: getCurrentPostId() }; }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { isPublishSidebarEnabled }) => { const { disablePublishSidebar, enablePublishSidebar } = dispatch(store_store); return { onTogglePublishSidebar: () => { if (isPublishSidebarEnabled) { disablePublishSidebar(); } else { enablePublishSidebar(); } } }; }), external_wp_components_namespaceObject.withFocusReturn, external_wp_components_namespaceObject.withConstrainedTabbing ])(PostPublishPanel); ;// ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js var cloud_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: "M17.3 10.1C17.3 7.60001 15.2 5.70001 12.5 5.70001C10.3 5.70001 8.4 7.10001 7.9 9.00001H7.7C5.7 9.00001 4 10.7 4 12.8C4 14.9 5.7 16.6 7.7 16.6H9.5V15.2H7.7C6.5 15.2 5.5 14.1 5.5 12.9C5.5 11.7 6.5 10.5 7.7 10.5H9L9.3 9.40001C9.7 8.10001 11 7.20001 12.5 7.20001C14.3 7.20001 15.8 8.50001 15.8 10.1V11.4L17.1 11.6C17.9 11.7 18.5 12.5 18.5 13.4C18.5 14.4 17.7 15.2 16.8 15.2H14.5V16.6H16.7C18.5 16.6 19.9 15.1 19.9 13.3C20 11.7 18.8 10.4 17.3 10.1Z M14.1245 14.2426L15.1852 13.182L12.0032 10L8.82007 13.1831L9.88072 14.2438L11.25 12.8745V18H12.75V12.8681L14.1245 14.2426Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/cloud.js var cloud_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: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z" }) }); ;// ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js function PostStickyCheck({ children }) { const { hasStickyAction, postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const post = select(store_store).getCurrentPost(); return { hasStickyAction: post._links?.["wp:action-sticky"] ?? false, postType: select(store_store).getCurrentPostType() }; }, []); if (postType !== "post" || !hasStickyAction) { return null; } return children; } ;// ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js function PostSticky() { const postSticky = (0,external_wp_data_namespaceObject.useSelect)((select) => { return select(store_store).getEditedPostAttribute("sticky") ?? false; }, []); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostStickyCheck, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { className: "editor-post-sticky__checkbox-control", label: (0,external_wp_i18n_namespaceObject.__)("Sticky"), help: (0,external_wp_i18n_namespaceObject.__)("Pin this post to the top of the blog."), checked: postSticky, onChange: () => editPost({ sticky: !postSticky }), __nextHasNoMarginBottom: true } ) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-status/index.js const postStatusesInfo = { "auto-draft": { label: (0,external_wp_i18n_namespaceObject.__)("Draft"), icon: drafts_default }, draft: { label: (0,external_wp_i18n_namespaceObject.__)("Draft"), icon: drafts_default }, pending: { label: (0,external_wp_i18n_namespaceObject.__)("Pending"), icon: pending_default }, private: { label: (0,external_wp_i18n_namespaceObject.__)("Private"), icon: not_allowed_default }, future: { label: (0,external_wp_i18n_namespaceObject.__)("Scheduled"), icon: scheduled_default }, publish: { label: (0,external_wp_i18n_namespaceObject.__)("Published"), icon: published_default } }; const STATUS_OPTIONS = [ { label: (0,external_wp_i18n_namespaceObject.__)("Draft"), value: "draft", description: (0,external_wp_i18n_namespaceObject.__)("Not ready to publish.") }, { label: (0,external_wp_i18n_namespaceObject.__)("Pending"), value: "pending", description: (0,external_wp_i18n_namespaceObject.__)("Waiting for review before publishing.") }, { label: (0,external_wp_i18n_namespaceObject.__)("Private"), value: "private", description: (0,external_wp_i18n_namespaceObject.__)("Only visible to site admins and editors.") }, { label: (0,external_wp_i18n_namespaceObject.__)("Scheduled"), value: "future", description: (0,external_wp_i18n_namespaceObject.__)("Publish automatically on a chosen date.") }, { label: (0,external_wp_i18n_namespaceObject.__)("Published"), value: "publish", description: (0,external_wp_i18n_namespaceObject.__)("Visible to everyone.") } ]; const DESIGN_POST_TYPES = [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE, NAVIGATION_POST_TYPE ]; function PostStatus() { const { status, date, password, postId, postType, canEdit } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEditedPostAttribute, getCurrentPostId, getCurrentPostType, getCurrentPost } = select(store_store); return { status: getEditedPostAttribute("status"), date: getEditedPostAttribute("date"), password: getEditedPostAttribute("password"), postId: getCurrentPostId(), postType: getCurrentPostType(), canEdit: getCurrentPost()._links?.["wp:action-publish"] ?? false }; }, [] ); const [showPassword, setShowPassword] = (0,external_wp_element_namespaceObject.useState)(!!password); const passwordInputId = (0,external_wp_compose_namespaceObject.useInstanceId)( PostStatus, "editor-change-status__password-input" ); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Status & visibility"), headerTitle: (0,external_wp_i18n_namespaceObject.__)("Status & visibility"), placement: "left-start", offset: 36, shift: true }), [popoverAnchor] ); if (DESIGN_POST_TYPES.includes(postType)) { return null; } const updatePost = ({ status: newStatus = status, password: newPassword = password, date: newDate = date }) => { editEntityRecord("postType", postType, postId, { status: newStatus, date: newDate, password: newPassword }); }; const handleTogglePassword = (value) => { setShowPassword(value); if (!value) { updatePost({ password: "" }); } }; const handleStatus = (value) => { let newDate = date; let newPassword = password; if (status === "future" && new Date(date) > /* @__PURE__ */ new Date()) { newDate = null; } if (value === "private" && password) { newPassword = ""; } updatePost({ status: value, date: newDate, password: newPassword }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Status"), ref: setPopoverAnchor, children: canEdit ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { className: "editor-post-status", contentClassName: "editor-change-status__content", popoverProps, focusOnMount: true, renderToggle: ({ onToggle, isOpen }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { className: "editor-post-status__toggle", variant: "tertiary", size: "compact", onClick: onToggle, icon: postStatusesInfo[status]?.icon, "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Current post status. (0,external_wp_i18n_namespaceObject.__)("Change status: %s"), postStatusesInfo[status]?.label ), "aria-expanded": isOpen, children: postStatusesInfo[status]?.label } ), renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)("Status & visibility"), onClose } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "form", { onSubmit: (event) => { event.preventDefault(); onClose(); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.RadioControl, { className: "editor-change-status__options", hideLabelFromVision: true, label: (0,external_wp_i18n_namespaceObject.__)("Status"), options: STATUS_OPTIONS, onChange: handleStatus, selected: status === "auto-draft" ? "draft" : status } ), status === "future" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-change-status__publish-date-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivatePostSchedule, { showPopoverHeaderActions: false, isCompact: true } ) }), status !== "private" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { as: "fieldset", spacing: 4, className: "editor-change-status__password-fieldset", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)( "Password protected" ), help: (0,external_wp_i18n_namespaceObject.__)( "Only visible to those who know the password." ), checked: showPassword, onChange: handleTogglePassword } ), showPassword && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-change-status__password-input", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { label: (0,external_wp_i18n_namespaceObject.__)( "Password" ), onChange: (value) => updatePost({ password: value }), value: password, placeholder: (0,external_wp_i18n_namespaceObject.__)( "Use a secure password" ), type: "text", id: passwordInputId, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, maxLength: 255 } ) }) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSticky, {}) ] }) } ) ] }) } ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-status is-read-only", children: postStatusesInfo[status]?.label }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js function PostSavedState({ forceIsDirty }) { const [forceSavedMessage, setForceSavedMessage] = (0,external_wp_element_namespaceObject.useState)(false); const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("small"); const { isAutosaving, isDirty, isNew, isPublished, isSaveable, isSaving, isScheduled, hasPublishAction, showIconLabels, postStatus, postStatusHasChanged } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { isEditedPostNew, isCurrentPostPublished, isCurrentPostScheduled, isEditedPostDirty, isSavingPost, isEditedPostSaveable, getCurrentPost, isAutosavingPost, getEditedPostAttribute, getPostEdits } = select(store_store); const { get } = select(external_wp_preferences_namespaceObject.store); return { isAutosaving: isAutosavingPost(), isDirty: forceIsDirty || isEditedPostDirty(), isNew: isEditedPostNew(), isPublished: isCurrentPostPublished(), isSaving: isSavingPost(), isSaveable: isEditedPostSaveable(), isScheduled: isCurrentPostScheduled(), hasPublishAction: getCurrentPost()?._links?.["wp:action-publish"] ?? false, showIconLabels: get("core", "showIconLabels"), postStatus: getEditedPostAttribute("status"), postStatusHasChanged: !!getPostEdits()?.status }; }, [forceIsDirty] ); const isPending = postStatus === "pending"; const { savePost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const wasSaving = (0,external_wp_compose_namespaceObject.usePrevious)(isSaving); (0,external_wp_element_namespaceObject.useEffect)(() => { let timeoutId; if (wasSaving && !isSaving) { setForceSavedMessage(true); timeoutId = setTimeout(() => { setForceSavedMessage(false); }, 1e3); } return () => clearTimeout(timeoutId); }, [isSaving]); if (!hasPublishAction && isPending) { return null; } const isIneligibleStatus = !["pending", "draft", "auto-draft"].includes(postStatus) && STATUS_OPTIONS.map(({ value }) => value).includes(postStatus); if (isPublished || isScheduled || isIneligibleStatus || postStatusHasChanged && ["pending", "draft"].includes(postStatus)) { return null; } const label = isPending ? (0,external_wp_i18n_namespaceObject.__)("Save as pending") : (0,external_wp_i18n_namespaceObject.__)("Save draft"); const shortLabel = (0,external_wp_i18n_namespaceObject.__)("Save"); const isSaved = forceSavedMessage || !isNew && !isDirty; const isSavedState = isSaving || isSaved; const isDisabled = isSaving || isSaved || !isSaveable; let text; if (isSaving) { text = isAutosaving ? (0,external_wp_i18n_namespaceObject.__)("Autosaving") : (0,external_wp_i18n_namespaceObject.__)("Saving"); } else if (isSaved) { text = (0,external_wp_i18n_namespaceObject.__)("Saved"); } else if (isLargeViewport) { text = label; } else if (showIconLabels) { text = shortLabel; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Button, { className: isSaveable || isSaving ? dist_clsx({ "editor-post-save-draft": !isSavedState, "editor-post-saved-state": isSavedState, "is-saving": isSaving, "is-autosaving": isAutosaving, "is-saved": isSaved, [(0,external_wp_components_namespaceObject.__unstableGetAnimateClassName)({ type: "loading" })]: isSaving }) : void 0, onClick: isDisabled ? void 0 : () => savePost(), shortcut: isDisabled ? void 0 : external_wp_keycodes_namespaceObject.displayShortcut.primary("s"), variant: "tertiary", size: "compact", icon: isLargeViewport ? void 0 : cloud_upload_default, label: text || label, "aria-disabled": isDisabled, children: [ isSavedState && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: isSaved ? check_default : cloud_default }), text ] } ); } ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js function PostScheduleCheck({ children }) { const hasPublishAction = (0,external_wp_data_namespaceObject.useSelect)((select) => { return select(store_store).getCurrentPost()._links?.["wp:action-publish"] ?? false; }, []); if (!hasPublishAction) { return null; } return children; } ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/panel.js const panel_DESIGN_POST_TYPES = [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE, NAVIGATION_POST_TYPE ]; function PostSchedulePanel() { const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const postType = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getCurrentPostType(), [] ); const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Change publish date"), placement: "left-start", offset: 36, shift: true }), [popoverAnchor] ); const label = usePostScheduleLabel(); const fullLabel = usePostScheduleLabel({ full: true }); if (panel_DESIGN_POST_TYPES.includes(postType)) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleCheck, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Publish"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, focusOnMount: true, className: "editor-post-schedule__panel-dropdown", contentClassName: "editor-post-schedule__dialog", renderToggle: ({ onToggle, isOpen }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", className: "editor-post-schedule__dialog-toggle", variant: "tertiary", tooltipPosition: "middle left", onClick: onToggle, "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Current post date. (0,external_wp_i18n_namespaceObject.__)("Change date: %s"), label ), label: fullLabel, showTooltip: label !== fullLabel, "aria-expanded": isOpen, children: label } ), renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedule, { onClose }) } ) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js function PostSwitchToDraftButton() { external_wp_deprecated_default()("wp.editor.PostSwitchToDraftButton", { since: "6.7", version: "6.9" }); const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); const { editPost, savePost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { isSaving, isPublished, isScheduled } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { isSavingPost, isCurrentPostPublished, isCurrentPostScheduled } = select(store_store); return { isSaving: isSavingPost(), isPublished: isCurrentPostPublished(), isScheduled: isCurrentPostScheduled() }; }, []); const isDisabled = isSaving || !isPublished && !isScheduled; let alertMessage; let confirmButtonText; if (isPublished) { alertMessage = (0,external_wp_i18n_namespaceObject.__)("Are you sure you want to unpublish this post?"); confirmButtonText = (0,external_wp_i18n_namespaceObject.__)("Unpublish"); } else if (isScheduled) { alertMessage = (0,external_wp_i18n_namespaceObject.__)("Are you sure you want to unschedule this post?"); confirmButtonText = (0,external_wp_i18n_namespaceObject.__)("Unschedule"); } const handleConfirm = () => { setShowConfirmDialog(false); editPost({ status: "draft" }); savePost(); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "editor-post-switch-to-draft", onClick: () => { if (!isDisabled) { setShowConfirmDialog(true); } }, "aria-disabled": isDisabled, variant: "secondary", style: { flexGrow: "1", justifyContent: "center" }, children: (0,external_wp_i18n_namespaceObject.__)("Switch to draft") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: showConfirmDialog, onConfirm: handleConfirm, onCancel: () => setShowConfirmDialog(false), confirmButtonText, children: alertMessage } ) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-sync-status/index.js function PostSyncStatus() { const { syncStatus, postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedPostAttribute } = select(store_store); const meta = getEditedPostAttribute("meta"); const currentSyncStatus = meta?.wp_pattern_sync_status === "unsynced" ? "unsynced" : getEditedPostAttribute("wp_pattern_sync_status"); return { syncStatus: currentSyncStatus, postType: getEditedPostAttribute("type") }; }); if (postType !== "wp_block") { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Sync status"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-sync-status__value", children: syncStatus === "unsynced" ? (0,external_wp_i18n_namespaceObject._x)("Not synced", "pattern (singular)") : (0,external_wp_i18n_namespaceObject._x)("Synced", "pattern (singular)") }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js const post_taxonomies_identity = (x) => x; function PostTaxonomies({ taxonomyWrapper = post_taxonomies_identity }) { const { postType, taxonomies } = (0,external_wp_data_namespaceObject.useSelect)((select) => { return { postType: select(store_store).getCurrentPostType(), taxonomies: select(external_wp_coreData_namespaceObject.store).getEntityRecords( "root", "taxonomy", { per_page: -1 } ) }; }, []); const visibleTaxonomies = (taxonomies ?? []).filter( (taxonomy) => ( // In some circumstances .visibility can end up as undefined so optional chaining operator required. // https://github.com/WordPress/gutenberg/issues/40326 taxonomy.types.includes(postType) && taxonomy.visibility?.show_ui ) ); return visibleTaxonomies.map((taxonomy) => { const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector_default : flat_term_selector_default; const taxonomyComponentProps = { slug: taxonomy.slug, ...taxonomy.hierarchical ? {} : { __nextHasNoMarginBottom: true } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children: taxonomyWrapper( /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TaxonomyComponent, { ...taxonomyComponentProps }), taxonomy ) }, `taxonomy-${taxonomy.slug}`); }); } var post_taxonomies_default = PostTaxonomies; ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js function PostTaxonomiesCheck({ children }) { const hasTaxonomies = (0,external_wp_data_namespaceObject.useSelect)((select) => { const postType = select(store_store).getCurrentPostType(); const taxonomies = select(external_wp_coreData_namespaceObject.store).getEntityRecords( "root", "taxonomy", { per_page: -1 } ); return taxonomies?.some( (taxonomy) => taxonomy.types.includes(postType) ); }, []); if (!hasTaxonomies) { return null; } return children; } ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/panel.js function TaxonomyPanel({ taxonomy, children }) { const slug = taxonomy?.slug; const panelName = slug ? `taxonomy-panel-${slug}` : ""; const { isEnabled, isOpened } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { isEditorPanelEnabled, isEditorPanelOpened } = select(store_store); return { isEnabled: slug ? isEditorPanelEnabled(panelName) : false, isOpened: slug ? isEditorPanelOpened(panelName) : false }; }, [panelName, slug] ); const { toggleEditorPanelOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); if (!isEnabled) { return null; } const taxonomyMenuName = taxonomy?.labels?.menu_name; if (!taxonomyMenuName) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.PanelBody, { title: taxonomyMenuName, opened: isOpened, onToggle: () => toggleEditorPanelOpened(panelName), children } ); } function panel_PostTaxonomies() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTaxonomiesCheck, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( post_taxonomies_default, { taxonomyWrapper: (content, taxonomy) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TaxonomyPanel, { taxonomy, children: content }); } } ) }); } // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js var lib = __webpack_require__(4132); ;// ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js function PostTextEditor() { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostTextEditor); const { content, blocks, type, id } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const { getCurrentPostType, getCurrentPostId } = select(store_store); const _type = getCurrentPostType(); const _id = getCurrentPostId(); const editedRecord = getEditedEntityRecord("postType", _type, _id); return { content: editedRecord?.content, blocks: editedRecord?.blocks, type: _type, id: _id }; }, []); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const value = (0,external_wp_element_namespaceObject.useMemo)(() => { if (content instanceof Function) { return content({ blocks }); } else if (blocks) { return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocks); } return content; }, [content, blocks]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.VisuallyHidden, { as: "label", htmlFor: `post-content-${instanceId}`, children: (0,external_wp_i18n_namespaceObject.__)("Type text or HTML") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( lib/* default */.A, { autoComplete: "off", dir: "auto", value, onChange: (event) => { editEntityRecord("postType", type, id, { content: event.target.value, blocks: void 0, selection: void 0 }); }, className: "editor-post-text-editor", id: `post-content-${instanceId}`, placeholder: (0,external_wp_i18n_namespaceObject.__)("Start writing with text or HTML") } ) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-title/constants.js const DEFAULT_CLASSNAMES = "wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text"; const REGEXP_NEWLINES = /[\r\n]+/g; ;// ./node_modules/@wordpress/editor/build-module/components/post-title/use-post-title-focus.js function usePostTitleFocus(forwardedRef) { const ref = (0,external_wp_element_namespaceObject.useRef)(); const { isCleanNewPost } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { isCleanNewPost: _isCleanNewPost } = select(store_store); return { isCleanNewPost: _isCleanNewPost() }; }, []); (0,external_wp_element_namespaceObject.useImperativeHandle)(forwardedRef, () => ({ focus: () => { ref?.current?.focus(); } })); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!ref.current) { return; } const { defaultView } = ref.current.ownerDocument; const { name, parent } = defaultView; const ownerDocument = name === "editor-canvas" ? parent.document : defaultView.document; const { activeElement, body } = ownerDocument; if (isCleanNewPost && (!activeElement || body === activeElement)) { ref.current.focus(); } }, [isCleanNewPost]); return { ref }; } ;// ./node_modules/@wordpress/editor/build-module/components/post-title/use-post-title.js function usePostTitle() { const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { title } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedPostAttribute } = select(store_store); return { title: getEditedPostAttribute("title") }; }, []); function updateTitle(newTitle) { editPost({ title: newTitle }); } return { title, setTitle: updateTitle }; } ;// ./node_modules/@wordpress/editor/build-module/components/post-title/index.js const PostTitle = (0,external_wp_element_namespaceObject.forwardRef)((_, forwardedRef) => { const { placeholder } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSettings } = select(external_wp_blockEditor_namespaceObject.store); const { titlePlaceholder } = getSettings(); return { placeholder: titlePlaceholder }; }, []); const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false); const { ref: focusRef } = usePostTitleFocus(forwardedRef); const { title, setTitle: onUpdate } = usePostTitle(); const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)({}); const { clearSelectedBlock, insertBlocks, insertDefaultBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)("Add title"); const { value, onChange, ref: richTextRef } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({ value: title, onChange(newValue) { onUpdate(newValue.replace(REGEXP_NEWLINES, " ")); }, placeholder: decodedPlaceholder, selectionStart: selection.start, selectionEnd: selection.end, onSelectionChange(newStart, newEnd) { setSelection((sel) => { const { start, end } = sel; if (start === newStart && end === newEnd) { return sel; } return { start: newStart, end: newEnd }; }); }, __unstableDisableFormats: false }); function onInsertBlockAfter(blocks) { insertBlocks(blocks, 0); } function onSelect() { setIsSelected(true); clearSelectedBlock(); } function onUnselect() { setIsSelected(false); setSelection({}); } function onEnterPress() { insertDefaultBlock(void 0, void 0, 0); } function onKeyDown(event) { if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { event.preventDefault(); onEnterPress(); } } function onPaste(event) { const clipboardData = event.clipboardData; let plainText = ""; let html = ""; try { plainText = clipboardData.getData("text/plain"); html = clipboardData.getData("text/html"); } catch (error) { return; } window.console.log("Received HTML:\n\n", html); window.console.log("Received plain text:\n\n", plainText); const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({ HTML: html, plainText }); event.preventDefault(); if (!content.length) { return; } if (typeof content !== "string") { const [firstBlock] = content; if (!title && (firstBlock.name === "core/heading" || firstBlock.name === "core/paragraph")) { const contentNoHTML = (0,external_wp_dom_namespaceObject.__unstableStripHTML)( firstBlock.attributes.content ); onUpdate(contentNoHTML); onInsertBlockAfter(content.slice(1)); } else { onInsertBlockAfter(content); } } else { const contentNoHTML = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(content); onChange((0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({ html: contentNoHTML }))); } } const className = dist_clsx(DEFAULT_CLASSNAMES, { "is-selected": isSelected }); return ( /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "h1", { ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([richTextRef, focusRef]), contentEditable: true, className, "aria-label": decodedPlaceholder, role: "textbox", "aria-multiline": "true", onFocus: onSelect, onBlur: onUnselect, onKeyDown, onPaste } ) ); }); var post_title_default = (0,external_wp_element_namespaceObject.forwardRef)((_, forwardedRef) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTitle, { ref: forwardedRef }) })); ;// ./node_modules/@wordpress/editor/build-module/components/post-title/post-title-raw.js function PostTitleRaw(_, forwardedRef) { const { placeholder } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSettings } = select(external_wp_blockEditor_namespaceObject.store); const { titlePlaceholder } = getSettings(); return { placeholder: titlePlaceholder }; }, []); const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false); const { title, setTitle: onUpdate } = usePostTitle(); const { ref: focusRef } = usePostTitleFocus(forwardedRef); function onChange(value) { onUpdate(value.replace(REGEXP_NEWLINES, " ")); } function onSelect() { setIsSelected(true); } function onUnselect() { setIsSelected(false); } const className = dist_clsx(DEFAULT_CLASSNAMES, { "is-selected": isSelected, "is-raw-text": true }); const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)("Add title"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextareaControl, { ref: focusRef, value: title, onChange, onFocus: onSelect, onBlur: onUnselect, label: placeholder, className, placeholder: decodedPlaceholder, hideLabelFromVision: true, autoComplete: "off", dir: "auto", rows: 1, __nextHasNoMarginBottom: true } ); } var post_title_raw_default = (0,external_wp_element_namespaceObject.forwardRef)(PostTitleRaw); ;// ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js function PostTrashCheck({ children }) { const { canTrashPost } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { isEditedPostNew, getCurrentPostId, getCurrentPostType } = select(store_store); const { canUser } = select(external_wp_coreData_namespaceObject.store); const postType = getCurrentPostType(); const postId = getCurrentPostId(); const isNew = isEditedPostNew(); const canUserDelete = !!postId ? canUser("delete", { kind: "postType", name: postType, id: postId }) : false; return { canTrashPost: (!isNew || postId) && canUserDelete && !GLOBAL_POST_TYPES.includes(postType) }; }, []); if (!canTrashPost) { return null; } return children; } ;// ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js function PostTrash({ onActionPerformed }) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { isNew, isDeleting, postId, title } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const store = select(store_store); return { isNew: store.isEditedPostNew(), isDeleting: store.isDeletingPost(), postId: store.getCurrentPostId(), title: store.getCurrentPostAttribute("title") }; }, []); const { trashPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); if (isNew || !postId) { return null; } const handleConfirm = async () => { setShowConfirmDialog(false); await trashPost(); const item = await registry.resolveSelect(store_store).getCurrentPost(); onActionPerformed?.("move-to-trash", [item]); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(PostTrashCheck, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "editor-post-trash", isDestructive: true, variant: "secondary", isBusy: isDeleting, "aria-disabled": isDeleting, onClick: isDeleting ? void 0 : () => setShowConfirmDialog(true), children: (0,external_wp_i18n_namespaceObject.__)("Move to trash") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: showConfirmDialog, onConfirm: handleConfirm, onCancel: () => setShowConfirmDialog(false), confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Move to trash"), size: "small", children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The item's title. (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to move "%s" to the trash?'), title ) } ) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-url/index.js function PostURL({ onClose }) { const { isEditable, postSlug, postLink, permalinkPrefix, permalinkSuffix, permalink } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const post = select(store_store).getCurrentPost(); const postTypeSlug = select(store_store).getCurrentPostType(); const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); const permalinkParts = select(store_store).getPermalinkParts(); const hasPublishAction = post?._links?.["wp:action-publish"] ?? false; return { isEditable: select(store_store).isPermalinkEditable() && hasPublishAction, postSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)( select(store_store).getEditedPostSlug() ), viewPostLabel: postType?.labels.view_item, postLink: post.link, permalinkPrefix: permalinkParts?.prefix, permalinkSuffix: permalinkParts?.suffix, permalink: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)( select(store_store).getPermalink() ) }; }, []); const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const [forceEmptyField, setForceEmptyField] = (0,external_wp_element_namespaceObject.useState)(false); const copyButtonRef = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(permalink, () => { createNotice("info", (0,external_wp_i18n_namespaceObject.__)("Copied Permalink to clipboard."), { isDismissible: true, type: "snackbar" }); }); const postUrlSlugDescriptionId = "editor-post-url__slug-description-" + (0,external_wp_compose_namespaceObject.useInstanceId)(PostURL); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-url", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)("Slug"), onClose } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ isEditable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "editor-post-url__intro", children: (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.__)( "<span>Customize the last part of the Permalink.</span> <a>Learn more.</a>" ), { span: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { id: postUrlSlugDescriptionId }), a: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)( "https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink" ) } ) } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ isEditable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalInputControl, { __next40pxDefaultSize: true, prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { children: "/" }), suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { icon: copy_small_default, ref: copyButtonRef, size: "small", label: "Copy" } ) }), label: (0,external_wp_i18n_namespaceObject.__)("Slug"), hideLabelFromVision: true, value: forceEmptyField ? "" : postSlug, autoComplete: "off", spellCheck: "false", type: "text", className: "editor-post-url__input", onChange: (newValue) => { editPost({ slug: newValue }); if (!newValue) { if (!forceEmptyField) { setForceEmptyField(true); } return; } if (forceEmptyField) { setForceEmptyField(false); } }, onBlur: (event) => { editPost({ slug: (0,external_wp_url_namespaceObject.cleanForSlug)( event.target.value ) }); if (forceEmptyField) { setForceEmptyField(false); } }, "aria-describedby": postUrlSlugDescriptionId } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { className: "editor-post-url__permalink", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-url__permalink-visual-label", children: (0,external_wp_i18n_namespaceObject.__)("Permalink:") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.ExternalLink, { className: "editor-post-url__link", href: postLink, target: "_blank", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-url__link-prefix", children: permalinkPrefix }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-url__link-slug", children: postSlug }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-url__link-suffix", children: permalinkSuffix }) ] } ) ] }) ] }), !isEditable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { className: "editor-post-url__link", href: postLink, target: "_blank", children: postLink } ) ] }) ] }) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-url/check.js function PostURLCheck({ children }) { const isVisible = (0,external_wp_data_namespaceObject.useSelect)((select) => { const postTypeSlug = select(store_store).getCurrentPostType(); const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); if (!postType?.viewable) { return false; } const post = select(store_store).getCurrentPost(); if (!post.link) { return false; } const permalinkParts = select(store_store).getPermalinkParts(); if (!permalinkParts) { return false; } return true; }, []); if (!isVisible) { return null; } return children; } ;// ./node_modules/@wordpress/editor/build-module/components/post-url/label.js function PostURLLabel() { return usePostURLLabel(); } function usePostURLLabel() { const postLink = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getPermalink(), [] ); return (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURIComponent)(postLink)); } ;// ./node_modules/@wordpress/editor/build-module/components/post-url/panel.js function PostURLPanel() { const { isFrontPage } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostId } = select(store_store); const { getEditedEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser("read", { kind: "root", name: "site" }) ? getEditedEntityRecord("root", "site") : void 0; const _id = getCurrentPostId(); return { isFrontPage: siteSettings?.page_on_front === _id }; }, []); const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: "left-start", offset: 36, shift: true }), [popoverAnchor] ); const label = isFrontPage ? (0,external_wp_i18n_namespaceObject.__)("Link") : (0,external_wp_i18n_namespaceObject.__)("Slug"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLCheck, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(post_panel_row_default, { label, ref: setPopoverAnchor, children: [ !isFrontPage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, className: "editor-post-url__panel-dropdown", contentClassName: "editor-post-url__panel-dialog", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PostURLToggle, { isOpen, onClick: onToggle } ), renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURL, { onClose }) } ), isFrontPage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FrontPageLink, {}) ] }) }); } function PostURLToggle({ isOpen, onClick }) { const { slug } = (0,external_wp_data_namespaceObject.useSelect)((select) => { return { slug: select(store_store).getEditedPostSlug() }; }, []); const decodedSlug = (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(slug); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", className: "editor-post-url__panel-toggle", variant: "tertiary", "aria-expanded": isOpen, "aria-label": ( // translators: %s: Current post link. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Change link: %s"), decodedSlug) ), onClick, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: decodedSlug }) } ); } function FrontPageLink() { const { postLink } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPost } = select(store_store); return { postLink: getCurrentPost()?.link }; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { className: "editor-post-url__front-page-link", href: postLink, target: "_blank", children: postLink } ); } ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js function PostVisibilityCheck({ render }) { const canEdit = (0,external_wp_data_namespaceObject.useSelect)((select) => { return select(store_store).getCurrentPost()._links?.["wp:action-publish"] ?? false; }); return render({ canEdit }); } ;// ./node_modules/@wordpress/icons/build-module/library/info.js var info_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, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" } ) }); ;// external ["wp","wordcount"] const external_wp_wordcount_namespaceObject = window["wp"]["wordcount"]; ;// ./node_modules/@wordpress/editor/build-module/components/word-count/index.js function WordCount() { const content = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getEditedPostAttribute("content"), [] ); const wordCountType = (0,external_wp_i18n_namespaceObject._x)("words", "Word count type. Do not translate!"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "word-count", children: (0,external_wp_wordcount_namespaceObject.count)(content, wordCountType) }); } ;// ./node_modules/@wordpress/editor/build-module/components/time-to-read/index.js const AVERAGE_READING_RATE = 189; function TimeToRead() { const content = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getEditedPostAttribute("content"), [] ); const wordCountType = (0,external_wp_i18n_namespaceObject._x)("words", "Word count type. Do not translate!"); const minutesToRead = Math.round( (0,external_wp_wordcount_namespaceObject.count)(content, wordCountType) / AVERAGE_READING_RATE ); const minutesToReadString = minutesToRead === 0 ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)("<span>< 1</span> minute"), { span: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}) }) : (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the number of minutes to read the post. */ (0,external_wp_i18n_namespaceObject._n)( "<span>%s</span> minute", "<span>%s</span> minutes", minutesToRead ), minutesToRead ), { span: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}) } ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "time-to-read", children: minutesToReadString }); } ;// ./node_modules/@wordpress/editor/build-module/components/character-count/index.js function CharacterCount() { const content = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getEditedPostAttribute("content"), [] ); return (0,external_wp_wordcount_namespaceObject.count)(content, "characters_including_spaces"); } ;// ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js function TableOfContentsPanel({ hasOutlineItemsDisabled, onRequestClose }) { const { headingCount, paragraphCount, numberOfBlocks } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getGlobalBlockCount } = select(external_wp_blockEditor_namespaceObject.store); return { headingCount: getGlobalBlockCount("core/heading"), paragraphCount: getGlobalBlockCount("core/paragraph"), numberOfBlocks: getGlobalBlockCount() }; }, [] ); return ( /* * Disable reason: The `list` ARIA role is redundant but * Safari+VoiceOver won't announce the list otherwise. */ /* eslint-disable jsx-a11y/no-redundant-roles */ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "table-of-contents__wrapper", role: "note", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Document Statistics"), tabIndex: "0", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { role: "list", className: "table-of-contents__counts", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [ (0,external_wp_i18n_namespaceObject.__)("Words"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WordCount, {}) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [ (0,external_wp_i18n_namespaceObject.__)("Characters"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "table-of-contents__number", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CharacterCount, {}) }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [ (0,external_wp_i18n_namespaceObject.__)("Time to read"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeToRead, {}) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [ (0,external_wp_i18n_namespaceObject.__)("Headings"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "table-of-contents__number", children: headingCount }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [ (0,external_wp_i18n_namespaceObject.__)("Paragraphs"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "table-of-contents__number", children: paragraphCount }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [ (0,external_wp_i18n_namespaceObject.__)("Blocks"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "table-of-contents__number", children: numberOfBlocks }) ] }) ] }) } ), headingCount > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("hr", {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "table-of-contents__title", children: (0,external_wp_i18n_namespaceObject.__)("Document Outline") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( DocumentOutline, { onSelect: onRequestClose, hasOutlineItemsDisabled } ) ] }) ] }) ); } var table_of_contents_panel_panel_default = TableOfContentsPanel; ;// ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js function TableOfContents({ hasOutlineItemsDisabled, repositionDropdown, ...props }, ref) { const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)( (select) => !!select(external_wp_blockEditor_namespaceObject.store).getBlockCount(), [] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps: { placement: repositionDropdown ? "right" : "bottom" }, className: "table-of-contents", contentClassName: "table-of-contents__popover", renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...props, ref, onClick: hasBlocks ? onToggle : void 0, icon: info_default, "aria-expanded": isOpen, "aria-haspopup": "true", label: (0,external_wp_i18n_namespaceObject.__)("Details"), tooltipPosition: "bottom", "aria-disabled": !hasBlocks } ), renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( table_of_contents_panel_panel_default, { onRequestClose: onClose, hasOutlineItemsDisabled } ) } ); } var table_of_contents_default = (0,external_wp_element_namespaceObject.forwardRef)(TableOfContents); ;// ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js function UnsavedChangesWarning() { const { __experimentalGetDirtyEntityRecords } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { const warnIfUnsavedChanges = (event) => { const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); if (dirtyEntityRecords.length > 0) { event.returnValue = (0,external_wp_i18n_namespaceObject.__)( "You have unsaved changes. If you proceed, they will be lost." ); return event.returnValue; } }; window.addEventListener("beforeunload", warnIfUnsavedChanges); return () => { window.removeEventListener("beforeunload", warnIfUnsavedChanges); }; }, [__experimentalGetDirtyEntityRecords]); return null; } ;// external ["wp","serverSideRender"] const external_wp_serverSideRender_namespaceObject = window["wp"]["serverSideRender"]; var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_namespaceObject); ;// ./node_modules/@wordpress/editor/build-module/components/deprecated.js function deprecateComponent(name, Wrapped, staticsToHoist = []) { const Component = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { external_wp_deprecated_default()("wp.editor." + name, { since: "5.3", alternative: "wp.blockEditor." + name, version: "6.2" }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapped, { ref, ...props }); }); staticsToHoist.forEach((staticName) => { Component[staticName] = deprecateComponent( name + "." + staticName, Wrapped[staticName] ); }); return Component; } function deprecateFunction(name, func) { return (...args) => { external_wp_deprecated_default()("wp.editor." + name, { since: "5.3", alternative: "wp.blockEditor." + name, version: "6.2" }); return func(...args); }; } const RichText = deprecateComponent("RichText", external_wp_blockEditor_namespaceObject.RichText, ["Content"]); RichText.isEmpty = deprecateFunction( "RichText.isEmpty", external_wp_blockEditor_namespaceObject.RichText.isEmpty ); const Autocomplete = deprecateComponent( "Autocomplete", external_wp_blockEditor_namespaceObject.Autocomplete ); const AlignmentToolbar = deprecateComponent( "AlignmentToolbar", external_wp_blockEditor_namespaceObject.AlignmentToolbar ); const BlockAlignmentToolbar = deprecateComponent( "BlockAlignmentToolbar", external_wp_blockEditor_namespaceObject.BlockAlignmentToolbar ); const BlockControls = deprecateComponent( "BlockControls", external_wp_blockEditor_namespaceObject.BlockControls, ["Slot"] ); const BlockEdit = deprecateComponent("BlockEdit", external_wp_blockEditor_namespaceObject.BlockEdit); const BlockEditorKeyboardShortcuts = deprecateComponent( "BlockEditorKeyboardShortcuts", external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts ); const BlockFormatControls = deprecateComponent( "BlockFormatControls", external_wp_blockEditor_namespaceObject.BlockFormatControls, ["Slot"] ); const BlockIcon = deprecateComponent("BlockIcon", external_wp_blockEditor_namespaceObject.BlockIcon); const BlockInspector = deprecateComponent( "BlockInspector", external_wp_blockEditor_namespaceObject.BlockInspector ); const BlockList = deprecateComponent("BlockList", external_wp_blockEditor_namespaceObject.BlockList); const BlockMover = deprecateComponent("BlockMover", external_wp_blockEditor_namespaceObject.BlockMover); const BlockNavigationDropdown = deprecateComponent( "BlockNavigationDropdown", external_wp_blockEditor_namespaceObject.BlockNavigationDropdown ); const BlockSelectionClearer = deprecateComponent( "BlockSelectionClearer", external_wp_blockEditor_namespaceObject.BlockSelectionClearer ); const BlockSettingsMenu = deprecateComponent( "BlockSettingsMenu", external_wp_blockEditor_namespaceObject.BlockSettingsMenu ); const BlockTitle = deprecateComponent("BlockTitle", external_wp_blockEditor_namespaceObject.BlockTitle); const BlockToolbar = deprecateComponent( "BlockToolbar", external_wp_blockEditor_namespaceObject.BlockToolbar ); const ColorPalette = deprecateComponent( "ColorPalette", external_wp_blockEditor_namespaceObject.ColorPalette ); const ContrastChecker = deprecateComponent( "ContrastChecker", external_wp_blockEditor_namespaceObject.ContrastChecker ); const CopyHandler = deprecateComponent("CopyHandler", external_wp_blockEditor_namespaceObject.CopyHandler); const DefaultBlockAppender = deprecateComponent( "DefaultBlockAppender", external_wp_blockEditor_namespaceObject.DefaultBlockAppender ); const FontSizePicker = deprecateComponent( "FontSizePicker", external_wp_blockEditor_namespaceObject.FontSizePicker ); const Inserter = deprecateComponent("Inserter", external_wp_blockEditor_namespaceObject.Inserter); const InnerBlocks = deprecateComponent("InnerBlocks", external_wp_blockEditor_namespaceObject.InnerBlocks, [ "ButtonBlockAppender", "DefaultBlockAppender", "Content" ]); const InspectorAdvancedControls = deprecateComponent( "InspectorAdvancedControls", external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, ["Slot"] ); const InspectorControls = deprecateComponent( "InspectorControls", external_wp_blockEditor_namespaceObject.InspectorControls, ["Slot"] ); const PanelColorSettings = deprecateComponent( "PanelColorSettings", external_wp_blockEditor_namespaceObject.PanelColorSettings ); const PlainText = deprecateComponent("PlainText", external_wp_blockEditor_namespaceObject.PlainText); const RichTextShortcut = deprecateComponent( "RichTextShortcut", external_wp_blockEditor_namespaceObject.RichTextShortcut ); const RichTextToolbarButton = deprecateComponent( "RichTextToolbarButton", external_wp_blockEditor_namespaceObject.RichTextToolbarButton ); const __unstableRichTextInputEvent = deprecateComponent( "__unstableRichTextInputEvent", external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent ); const MediaPlaceholder = deprecateComponent( "MediaPlaceholder", external_wp_blockEditor_namespaceObject.MediaPlaceholder ); const MediaUpload = deprecateComponent("MediaUpload", external_wp_blockEditor_namespaceObject.MediaUpload); const MediaUploadCheck = deprecateComponent( "MediaUploadCheck", external_wp_blockEditor_namespaceObject.MediaUploadCheck ); const MultiSelectScrollIntoView = deprecateComponent( "MultiSelectScrollIntoView", external_wp_blockEditor_namespaceObject.MultiSelectScrollIntoView ); const NavigableToolbar = deprecateComponent( "NavigableToolbar", external_wp_blockEditor_namespaceObject.NavigableToolbar ); const ObserveTyping = deprecateComponent( "ObserveTyping", external_wp_blockEditor_namespaceObject.ObserveTyping ); const SkipToSelectedBlock = deprecateComponent( "SkipToSelectedBlock", external_wp_blockEditor_namespaceObject.SkipToSelectedBlock ); const URLInput = deprecateComponent("URLInput", external_wp_blockEditor_namespaceObject.URLInput); const URLInputButton = deprecateComponent( "URLInputButton", external_wp_blockEditor_namespaceObject.URLInputButton ); const URLPopover = deprecateComponent("URLPopover", external_wp_blockEditor_namespaceObject.URLPopover); const Warning = deprecateComponent("Warning", external_wp_blockEditor_namespaceObject.Warning); const WritingFlow = deprecateComponent("WritingFlow", external_wp_blockEditor_namespaceObject.WritingFlow); const createCustomColorsHOC = deprecateFunction( "createCustomColorsHOC", external_wp_blockEditor_namespaceObject.createCustomColorsHOC ); const getColorClassName = deprecateFunction( "getColorClassName", external_wp_blockEditor_namespaceObject.getColorClassName ); const getColorObjectByAttributeValues = deprecateFunction( "getColorObjectByAttributeValues", external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues ); const getColorObjectByColorValue = deprecateFunction( "getColorObjectByColorValue", external_wp_blockEditor_namespaceObject.getColorObjectByColorValue ); const getFontSize = deprecateFunction("getFontSize", external_wp_blockEditor_namespaceObject.getFontSize); const getFontSizeClass = deprecateFunction( "getFontSizeClass", external_wp_blockEditor_namespaceObject.getFontSizeClass ); const withColorContext = deprecateFunction( "withColorContext", external_wp_blockEditor_namespaceObject.withColorContext ); const withColors = deprecateFunction("withColors", external_wp_blockEditor_namespaceObject.withColors); const withFontSizes = deprecateFunction( "withFontSizes", external_wp_blockEditor_namespaceObject.withFontSizes ); ;// ./node_modules/@wordpress/editor/build-module/components/index.js const VisualEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts; const TextEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts; ;// ./node_modules/@wordpress/editor/build-module/utils/url.js function cleanForSlug(string) { external_wp_deprecated_default()("wp.editor.cleanForSlug", { since: "12.7", plugin: "Gutenberg", alternative: "wp.url.cleanForSlug" }); return (0,external_wp_url_namespaceObject.cleanForSlug)(string); } ;// ./node_modules/@wordpress/editor/build-module/utils/index.js ;// ./node_modules/@wordpress/editor/build-module/components/editor-interface/content-slot-fill.js const EditorContentSlotFill = (0,external_wp_components_namespaceObject.createSlotFill)( Symbol("EditCanvasContainerSlot") ); var content_slot_fill_default = EditorContentSlotFill; ;// ./node_modules/@wordpress/editor/build-module/components/header/back-button.js const slotName = "__experimentalMainDashboardButton"; const useHasBackButton = () => { const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotName); return Boolean(fills && fills.length); }; const { Fill: back_button_Fill, Slot: back_button_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName); const BackButton = back_button_Fill; const BackButtonSlot = () => { const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotName); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( back_button_Slot, { bubblesVirtually: true, fillProps: { length: !fills ? 0 : fills.length } } ); }; BackButton.Slot = BackButtonSlot; var back_button_default = BackButton; ;// ./node_modules/@wordpress/icons/build-module/library/next.js var next_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/previous.js var previous_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" }) }); ;// ./node_modules/@wordpress/editor/build-module/components/collapsible-block-toolbar/index.js const { useHasBlockToolbar } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function CollapsibleBlockToolbar({ isCollapsed, onToggle }) { const { blockSelectionStart } = (0,external_wp_data_namespaceObject.useSelect)((select) => { return { blockSelectionStart: select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() }; }, []); const hasBlockToolbar = useHasBlockToolbar(); const hasBlockSelection = !!blockSelectionStart; (0,external_wp_element_namespaceObject.useEffect)(() => { if (blockSelectionStart) { onToggle(false); } }, [blockSelectionStart, onToggle]); if (!hasBlockToolbar) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx("editor-collapsible-block-toolbar", { "is-collapsed": isCollapsed || !hasBlockSelection }), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { hideDragHandle: true }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover.Slot, { name: "block-toolbar" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { className: "editor-collapsible-block-toolbar__toggle", icon: isCollapsed ? next_default : previous_default, onClick: () => { onToggle(!isCollapsed); }, label: isCollapsed ? (0,external_wp_i18n_namespaceObject.__)("Show block tools") : (0,external_wp_i18n_namespaceObject.__)("Hide block tools"), size: "compact" } ) ] }); } ;// ./node_modules/@wordpress/icons/build-module/library/plus.js var plus_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); ;// ./node_modules/@wordpress/editor/build-module/components/document-tools/index.js function DocumentTools({ className, disableBlockTools = false }) { const { setIsInserterOpened, setIsListViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { isDistractionFree, isInserterOpened, isListViewOpen, listViewShortcut, inserterSidebarToggleRef, listViewToggleRef, showIconLabels } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { get } = select(external_wp_preferences_namespaceObject.store); const { isListViewOpened, getEditorMode, getInserterSidebarToggleRef, getListViewToggleRef } = unlock(select(store_store)); const { getShortcutRepresentation } = select(external_wp_keyboardShortcuts_namespaceObject.store); return { isInserterOpened: select(store_store).isInserterOpened(), isListViewOpen: isListViewOpened(), listViewShortcut: getShortcutRepresentation( "core/editor/toggle-list-view" ), inserterSidebarToggleRef: getInserterSidebarToggleRef(), listViewToggleRef: getListViewToggleRef(), showIconLabels: get("core", "showIconLabels"), isDistractionFree: get("core", "distractionFree"), isVisualMode: getEditorMode() === "visual" }; }, []); const preventDefault = (event) => { if (isInserterOpened) { event.preventDefault(); } }; const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("wide"); const toolbarAriaLabel = (0,external_wp_i18n_namespaceObject.__)("Document tools"); const toggleListView = (0,external_wp_element_namespaceObject.useCallback)( () => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen] ); const toggleInserter = (0,external_wp_element_namespaceObject.useCallback)( () => setIsInserterOpened(!isInserterOpened), [isInserterOpened, setIsInserterOpened] ); const longLabel = (0,external_wp_i18n_namespaceObject._x)( "Block Inserter", "Generic label for block inserter button" ); const shortLabel = !isInserterOpened ? (0,external_wp_i18n_namespaceObject.__)("Add") : (0,external_wp_i18n_namespaceObject.__)("Close"); return ( // Some plugins expect and use the `edit-post-header-toolbar` CSS class to // find the toolbar and inject UI elements into it. This is not officially // supported, but we're keeping it in the list of class names for backwards // compatibility. /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.NavigableToolbar, { className: dist_clsx( "editor-document-tools", "edit-post-header-toolbar", className ), "aria-label": toolbarAriaLabel, variant: "unstyled", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-document-tools__left", children: [ !isDistractionFree && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { ref: inserterSidebarToggleRef, className: "editor-document-tools__inserter-toggle", variant: "primary", isPressed: isInserterOpened, onMouseDown: preventDefault, onClick: toggleInserter, disabled: disableBlockTools, icon: plus_default, label: showIconLabels ? shortLabel : longLabel, showTooltip: !showIconLabels, "aria-expanded": isInserterOpened } ), (isWideViewport || !showIconLabels) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarItem, { as: undo_undo_default, showTooltip: !showIconLabels, variant: showIconLabels ? "tertiary" : void 0, size: "compact" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarItem, { as: redo_redo_default, showTooltip: !showIconLabels, variant: showIconLabels ? "tertiary" : void 0, size: "compact" } ), !isDistractionFree && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { className: "editor-document-tools__document-overview-toggle", icon: list_view_default, disabled: disableBlockTools, isPressed: isListViewOpen, label: (0,external_wp_i18n_namespaceObject.__)("Document Overview"), onClick: toggleListView, shortcut: listViewShortcut, showTooltip: !showIconLabels, variant: showIconLabels ? "tertiary" : void 0, "aria-expanded": isListViewOpen, ref: listViewToggleRef } ) ] }) ] }) } ) ); } var document_tools_default = DocumentTools; ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js var more_vertical_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/copy-content-menu-item.js function CopyContentMenuItem() { const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { getCurrentPostId, getCurrentPostType } = (0,external_wp_data_namespaceObject.useSelect)(store_store); const { getEditedEntityRecord } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); function getText() { const record = getEditedEntityRecord( "postType", getCurrentPostType(), getCurrentPostId() ); if (!record) { return ""; } if (typeof record.content === "function") { return record.content(record); } else if (record.blocks) { return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); } else if (record.content) { return record.content; } } function onSuccess() { createNotice("info", (0,external_wp_i18n_namespaceObject.__)("All content copied."), { isDismissible: true, type: "snackbar" }); } const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ref, children: (0,external_wp_i18n_namespaceObject.__)("Copy all blocks") }); } ;// ./node_modules/@wordpress/editor/build-module/components/mode-switcher/index.js const MODES = [ { value: "visual", label: (0,external_wp_i18n_namespaceObject.__)("Visual editor") }, { value: "text", label: (0,external_wp_i18n_namespaceObject.__)("Code editor") } ]; function ModeSwitcher() { const { shortcut, isRichEditingEnabled, isCodeEditingEnabled, mode } = (0,external_wp_data_namespaceObject.useSelect)( (select) => ({ shortcut: select( external_wp_keyboardShortcuts_namespaceObject.store ).getShortcutRepresentation("core/editor/toggle-mode"), isRichEditingEnabled: select(store_store).getEditorSettings().richEditingEnabled, isCodeEditingEnabled: select(store_store).getEditorSettings().codeEditingEnabled, mode: select(store_store).getEditorMode() }), [] ); const { switchEditorMode } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); let selectedMode = mode; if (!isRichEditingEnabled && mode === "visual") { selectedMode = "text"; } if (!isCodeEditingEnabled && mode === "text") { selectedMode = "visual"; } const choices = MODES.map((choice) => { if (!isCodeEditingEnabled && choice.value === "text") { choice = { ...choice, disabled: true }; } if (!isRichEditingEnabled && choice.value === "visual") { choice = { ...choice, disabled: true, info: (0,external_wp_i18n_namespaceObject.__)( "You can enable the visual editor in your profile settings." ) }; } if (choice.value !== selectedMode && !choice.disabled) { return { ...choice, shortcut }; } return choice; }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Editor"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItemsChoice, { choices, value: selectedMode, onSelect: switchEditorMode } ) }); } var mode_switcher_default = ModeSwitcher; ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/tools-more-menu-group.js const { Fill: ToolsMoreMenuGroup, Slot: tools_more_menu_group_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("ToolsMoreMenuGroup"); ToolsMoreMenuGroup.Slot = ({ fillProps }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(tools_more_menu_group_Slot, { fillProps }); var tools_more_menu_group_default = ToolsMoreMenuGroup; ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/view-more-menu-group.js const { Fill: ViewMoreMenuGroup, Slot: view_more_menu_group_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)( external_wp_element_namespaceObject.Platform.OS === "web" ? Symbol("ViewMoreMenuGroup") : "ViewMoreMenuGroup" ); ViewMoreMenuGroup.Slot = ({ fillProps }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(view_more_menu_group_Slot, { fillProps }); var view_more_menu_group_default = ViewMoreMenuGroup; ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/index.js function MoreMenu() { const { openModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const { toggleDistractionFree } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_preferences_namespaceObject.store).get("core", "showIconLabels"), [] ); const turnOffDistractionFree = () => { setPreference("core", "distractionFree", false); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("Options"), popoverProps: { placement: "bottom-end", className: "more-menu-dropdown__content" }, toggleProps: { showTooltip: !showIconLabels, ...showIconLabels && { variant: "tertiary" }, tooltipPosition: "bottom", size: "compact" }, children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject._x)("View", "noun"), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core", name: "fixedToolbar", onToggle: turnOffDistractionFree, label: (0,external_wp_i18n_namespaceObject.__)("Top toolbar"), info: (0,external_wp_i18n_namespaceObject.__)( "Access all block and document tools in a single place" ), messageActivated: (0,external_wp_i18n_namespaceObject.__)( "Top toolbar activated." ), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)( "Top toolbar deactivated." ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core", name: "distractionFree", label: (0,external_wp_i18n_namespaceObject.__)("Distraction free"), info: (0,external_wp_i18n_namespaceObject.__)("Write with calmness"), handleToggling: false, onToggle: () => toggleDistractionFree({ createNotice: false }), messageActivated: (0,external_wp_i18n_namespaceObject.__)( "Distraction free mode activated." ), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)( "Distraction free mode deactivated." ), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift( "\\" ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core", name: "focusMode", label: (0,external_wp_i18n_namespaceObject.__)("Spotlight mode"), info: (0,external_wp_i18n_namespaceObject.__)("Focus on one block at a time"), messageActivated: (0,external_wp_i18n_namespaceObject.__)( "Spotlight mode activated." ), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)( "Spotlight mode deactivated." ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(view_more_menu_group_default.Slot, { fillProps: { onClose } }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(mode_switcher_default, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( action_item_default.Slot, { name: "core/plugin-more-menu", label: (0,external_wp_i18n_namespaceObject.__)("Panels"), fillProps: { onClick: onClose } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Tools"), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => openModal("editor/keyboard-shortcut-help"), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access("h"), children: (0,external_wp_i18n_namespaceObject.__)("Keyboard shortcuts") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyContentMenuItem, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.MenuItem, { icon: external_default, href: (0,external_wp_i18n_namespaceObject.__)( "https://wordpress.org/documentation/article/wordpress-block-editor/" ), target: "_blank", rel: "noopener noreferrer", children: [ (0,external_wp_i18n_namespaceObject.__)("Help"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", /* translators: accessibility text */ children: (0,external_wp_i18n_namespaceObject.__)("(opens in a new tab)") }) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( tools_more_menu_group_default.Slot, { fillProps: { onClose } } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => openModal("editor/preferences"), children: (0,external_wp_i18n_namespaceObject.__)("Preferences") } ) }) ] }) } ) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/post-publish-button-or-toggle.js const IS_TOGGLE = "toggle"; const IS_BUTTON = "button"; function PostPublishButtonOrToggle({ forceIsDirty, setEntitiesSavedStatesCallback }) { let component; const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const { togglePublishSidebar } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { hasPublishAction, isBeingScheduled, isPending, isPublished, isPublishSidebarEnabled, isPublishSidebarOpened, isScheduled, postStatus, postStatusHasChanged } = (0,external_wp_data_namespaceObject.useSelect)((select) => { return { hasPublishAction: !!select(store_store).getCurrentPost()?._links?.["wp:action-publish"], isBeingScheduled: select(store_store).isEditedPostBeingScheduled(), isPending: select(store_store).isCurrentPostPending(), isPublished: select(store_store).isCurrentPostPublished(), isPublishSidebarEnabled: select(store_store).isPublishSidebarEnabled(), isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(), isScheduled: select(store_store).isCurrentPostScheduled(), postStatus: select(store_store).getEditedPostAttribute("status"), postStatusHasChanged: select(store_store).getPostEdits()?.status }; }, []); if (isPublished || postStatusHasChanged && !["future", "publish"].includes(postStatus) || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) { component = IS_BUTTON; } else if (isSmallerThanMediumViewport || isPublishSidebarEnabled) { component = IS_TOGGLE; } else { component = IS_BUTTON; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( post_publish_button_default, { forceIsDirty, isOpen: isPublishSidebarOpened, isToggle: component === IS_TOGGLE, onToggle: togglePublishSidebar, setEntitiesSavedStatesCallback } ); } ;// ./node_modules/@wordpress/editor/build-module/components/post-view-link/index.js function PostViewLink() { const { hasLoaded, permalink, isPublished, label, showIconLabels } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const postTypeSlug = select(store_store).getCurrentPostType(); const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); const { get } = select(external_wp_preferences_namespaceObject.store); return { permalink: select(store_store).getPermalink(), isPublished: select(store_store).isCurrentPostPublished(), label: postType?.labels.view_item, hasLoaded: !!postType, showIconLabels: get("core", "showIconLabels") }; }, []); if (!isPublished || !permalink || !hasLoaded) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { icon: external_default, label: label || (0,external_wp_i18n_namespaceObject.__)("View post"), href: permalink, target: "_blank", showTooltip: !showIconLabels, size: "compact" } ); } ;// ./node_modules/@wordpress/icons/build-module/library/desktop.js var desktop_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.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/mobile.js var mobile_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/tablet.js var tablet_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: "M17 4H7c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12zm-7.5-.5h4V16h-4v1.5z" }) }); ;// ./node_modules/@wordpress/editor/build-module/components/preview-dropdown/index.js function PreviewDropdown({ forceIsAutosaveable, disabled }) { const { deviceType, homeUrl, isTemplate, isViewable, showIconLabels, isTemplateHidden, templateId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getDeviceType, getCurrentPostType, getCurrentTemplateId, getRenderingMode } = select(store_store); const { getEntityRecord, getPostType } = select(external_wp_coreData_namespaceObject.store); const { get } = select(external_wp_preferences_namespaceObject.store); const _currentPostType = getCurrentPostType(); return { deviceType: getDeviceType(), homeUrl: getEntityRecord("root", "__unstableBase")?.home, isTemplate: _currentPostType === "wp_template", isViewable: getPostType(_currentPostType)?.viewable ?? false, showIconLabels: get("core", "showIconLabels"), isTemplateHidden: getRenderingMode() === "post-only", templateId: getCurrentTemplateId() }; }, []); const { setDeviceType, setRenderingMode, setDefaultRenderingMode } = unlock( (0,external_wp_data_namespaceObject.useDispatch)(store_store) ); const { resetZoomLevel } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); const handleDevicePreviewChange = (newDeviceType) => { setDeviceType(newDeviceType); resetZoomLevel(); }; const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); if (isMobile) { return null; } const popoverProps = { placement: "bottom-end" }; const toggleProps = { className: "editor-preview-dropdown__toggle", iconPosition: "right", size: "compact", showTooltip: !showIconLabels, disabled, accessibleWhenDisabled: disabled }; const menuProps = { "aria-label": (0,external_wp_i18n_namespaceObject.__)("View options") }; const deviceIcons = { desktop: desktop_default, mobile: mobile_default, tablet: tablet_default }; const choices = [ { value: "Desktop", label: (0,external_wp_i18n_namespaceObject.__)("Desktop"), icon: desktop_default }, { value: "Tablet", label: (0,external_wp_i18n_namespaceObject.__)("Tablet"), icon: tablet_default }, { value: "Mobile", label: (0,external_wp_i18n_namespaceObject.__)("Mobile"), icon: mobile_default } ]; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { className: dist_clsx( "editor-preview-dropdown", `editor-preview-dropdown--${deviceType.toLowerCase()}` ), popoverProps, toggleProps, menuProps, icon: deviceIcons[deviceType.toLowerCase()], label: (0,external_wp_i18n_namespaceObject.__)("View"), disableOpenOnArrowDown: disabled, children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItemsChoice, { choices, value: deviceType, onSelect: handleDevicePreviewChange } ) }), isTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.MenuItem, { href: homeUrl, target: "_blank", icon: external_default, onClick: onClose, children: [ (0,external_wp_i18n_namespaceObject.__)("View site"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", /* translators: accessibility text */ children: (0,external_wp_i18n_namespaceObject.__)("(opens in a new tab)") }) ] } ) }), !isTemplate && !!templateId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: !isTemplateHidden ? check_default : void 0, isSelected: !isTemplateHidden, role: "menuitemcheckbox", onClick: () => { const newRenderingMode = isTemplateHidden ? "template-locked" : "post-only"; setRenderingMode(newRenderingMode); setDefaultRenderingMode(newRenderingMode); resetZoomLevel(); }, children: (0,external_wp_i18n_namespaceObject.__)("Show template") } ) }), isViewable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PostPreviewButton, { className: "editor-preview-dropdown__button-external", role: "menuitem", forceIsAutosaveable, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Preview in new tab"), textContent: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ (0,external_wp_i18n_namespaceObject.__)("Preview in new tab"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: external_default }) ] }), onPreview: onClose } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( action_item_default.Slot, { name: "core/plugin-preview-menu", fillProps: { onClick: onClose } } ) ] }) } ); } ;// ./node_modules/@wordpress/icons/build-module/library/square.js var square_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, { fill: "none", d: "M5.75 12.75V18.25H11.25M12.75 5.75H18.25V11.25", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "square" } ) }); ;// ./node_modules/@wordpress/editor/build-module/components/zoom-out-toggle/index.js const ZoomOutToggle = ({ disabled }) => { const { isZoomOut, showIconLabels, isDistractionFree } = (0,external_wp_data_namespaceObject.useSelect)( (select) => ({ isZoomOut: unlock(select(external_wp_blockEditor_namespaceObject.store)).isZoomOut(), showIconLabels: select(external_wp_preferences_namespaceObject.store).get( "core", "showIconLabels" ), isDistractionFree: select(external_wp_preferences_namespaceObject.store).get( "core", "distractionFree" ) }) ); const { resetZoomLevel, setZoomLevel } = unlock( (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store) ); const { registerShortcut, unregisterShortcut } = (0,external_wp_data_namespaceObject.useDispatch)( external_wp_keyboardShortcuts_namespaceObject.store ); (0,external_wp_element_namespaceObject.useEffect)(() => { registerShortcut({ name: "core/editor/zoom", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Enter or exit zoom out."), keyCombination: { // `primaryShift+0` (`ctrl+shift+0`) is the shortcut for switching // to input mode in Windows, so apply a different key combination. modifier: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? "primaryShift" : "secondary", character: "0" } }); return () => { unregisterShortcut("core/editor/zoom"); }; }, [registerShortcut, unregisterShortcut]); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)( "core/editor/zoom", () => { if (isZoomOut) { resetZoomLevel(); } else { setZoomLevel("auto-scaled"); } }, { isDisabled: isDistractionFree } ); const handleZoomOut = () => { if (isZoomOut) { resetZoomLevel(); } else { setZoomLevel("auto-scaled"); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { accessibleWhenDisabled: true, disabled, onClick: handleZoomOut, icon: square_default, label: (0,external_wp_i18n_namespaceObject.__)("Zoom Out"), isPressed: isZoomOut, size: "compact", showTooltip: !showIconLabels, className: "editor-zoom-out-toggle" } ); }; var zoom_out_toggle_default = ZoomOutToggle; ;// ./node_modules/@wordpress/editor/build-module/components/header/index.js const toolbarVariations = { distractionFreeDisabled: { y: "-50px" }, distractionFreeHover: { y: 0 }, distractionFreeHidden: { y: "-50px" }, visible: { y: 0 }, hidden: { y: 0 } }; const backButtonVariations = { distractionFreeDisabled: { x: "-100%" }, distractionFreeHover: { x: 0 }, distractionFreeHidden: { x: "-100%" }, visible: { x: 0 }, hidden: { x: 0 } }; function Header({ customSaveButton, forceIsDirty, forceDisableBlockTools, setEntitiesSavedStatesCallback, title }) { const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("large"); const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); const isTooNarrowForDocumentBar = (0,external_wp_compose_namespaceObject.useMediaQuery)("(max-width: 403px)"); const { postType, isTextEditor, isPublishSidebarOpened, showIconLabels, hasFixedToolbar, hasBlockSelection, hasSectionRootClientId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { get: getPreference } = select(external_wp_preferences_namespaceObject.store); const { getEditorMode, getCurrentPostType, isPublishSidebarOpened: _isPublishSidebarOpened } = select(store_store); const { getBlockSelectionStart, getSectionRootClientId } = unlock( select(external_wp_blockEditor_namespaceObject.store) ); return { postType: getCurrentPostType(), isTextEditor: getEditorMode() === "text", isPublishSidebarOpened: _isPublishSidebarOpened(), showIconLabels: getPreference("core", "showIconLabels"), hasFixedToolbar: getPreference("core", "fixedToolbar"), hasBlockSelection: !!getBlockSelectionStart(), hasSectionRootClientId: !!getSectionRootClientId() }; }, []); const canBeZoomedOut = ["post", "page", "wp_template"].includes(postType) && hasSectionRootClientId; const disablePreviewOption = [ NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE ].includes(postType) || forceDisableBlockTools; const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0,external_wp_element_namespaceObject.useState)(true); const hasCenter = !isTooNarrowForDocumentBar && (!hasFixedToolbar || hasFixedToolbar && (!hasBlockSelection || isBlockToolsCollapsed)); const hasBackButton = useHasBackButton(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-header edit-post-header", children: [ hasBackButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { className: "editor-header__back-button", variants: backButtonVariations, transition: { type: "tween" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(back_button_default.Slot, {}) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__unstableMotion.div, { variants: toolbarVariations, className: "editor-header__toolbar", transition: { type: "tween" }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( document_tools_default, { disableBlockTools: forceDisableBlockTools || isTextEditor } ), hasFixedToolbar && isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CollapsibleBlockToolbar, { isCollapsed: isBlockToolsCollapsed, onToggle: setIsBlockToolsCollapsed } ) ] } ), hasCenter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { className: "editor-header__center", variants: toolbarVariations, transition: { type: "tween" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentBar, { title }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__unstableMotion.div, { variants: toolbarVariations, transition: { type: "tween" }, className: "editor-header__settings", children: [ !customSaveButton && !isPublishSidebarOpened && /* * This button isn't completely hidden by the publish sidebar. * We can't hide the whole toolbar when the publish sidebar is open because * we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node. * We track that DOM node to return focus to the PostPublishButtonOrToggle * when the publish sidebar has been closed. */ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSavedState, { forceIsDirty }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostViewLink, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreviewDropdown, { forceIsAutosaveable: forceIsDirty, disabled: disablePreviewOption } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PostPreviewButton, { className: "editor-header__post-preview-button", forceIsAutosaveable: forceIsDirty } ), isWideViewport && canBeZoomedOut && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(zoom_out_toggle_default, { disabled: forceDisableBlockTools }), (isWideViewport || !showIconLabels) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items_default.Slot, { scope: "core" }), !customSaveButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PostPublishButtonOrToggle, { forceIsDirty, setEntitiesSavedStatesCallback } ), customSaveButton, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {}) ] } ) ] }); } var header_header_default = Header; ;// ./node_modules/@wordpress/editor/build-module/components/inserter-sidebar/index.js const { PrivateInserterLibrary } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function InserterSidebar() { const { blockSectionRootClientId, inserterSidebarToggleRef, inserter, showMostUsedBlocks, sidebarIsOpened } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getInserterSidebarToggleRef, getInserter, isPublishSidebarOpened } = unlock(select(store_store)); const { getBlockRootClientId, isZoomOut, getSectionRootClientId } = unlock(select(external_wp_blockEditor_namespaceObject.store)); const { get } = select(external_wp_preferences_namespaceObject.store); const { getActiveComplementaryArea } = select(store); const getBlockSectionRootClientId = () => { if (isZoomOut()) { const sectionRootClientId = getSectionRootClientId(); if (sectionRootClientId) { return sectionRootClientId; } } return getBlockRootClientId(); }; return { inserterSidebarToggleRef: getInserterSidebarToggleRef(), inserter: getInserter(), showMostUsedBlocks: get("core", "mostUsedBlocks"), blockSectionRootClientId: getBlockSectionRootClientId(), sidebarIsOpened: !!(getActiveComplementaryArea("core") || isPublishSidebarOpened()) }; }, []); const { setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const libraryRef = (0,external_wp_element_namespaceObject.useRef)(); const closeInserterSidebar = (0,external_wp_element_namespaceObject.useCallback)(() => { setIsInserterOpened(false); inserterSidebarToggleRef.current?.focus(); }, [inserterSidebarToggleRef, setIsInserterOpened]); const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)( (event) => { if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { event.preventDefault(); closeInserterSidebar(); } }, [closeInserterSidebar] ); const inserterContents = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-inserter-sidebar__content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivateInserterLibrary, { showMostUsedBlocks, showInserterHelpPanel: true, shouldFocusBlock: isMobileViewport, rootClientId: blockSectionRootClientId, onSelect: inserter.onSelect, __experimentalInitialTab: inserter.tab, __experimentalInitialCategory: inserter.category, __experimentalFilterValue: inserter.filterValue, onPatternCategorySelection: sidebarIsOpened ? () => disableComplementaryArea("core") : void 0, ref: libraryRef, onClose: closeInserterSidebar } ) }); return ( // eslint-disable-next-line jsx-a11y/no-static-element-interactions /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { onKeyDown: closeOnEscape, className: "editor-inserter-sidebar", children: inserterContents }) ); } ;// ./node_modules/@wordpress/editor/build-module/components/list-view-sidebar/list-view-outline.js function ListViewOutline() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-list-view-sidebar__outline", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Characters:") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CharacterCount, {}) }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Words:") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WordCount, {}) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Time to read:") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeToRead, {}) ] }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentOutline, {}) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/list-view-sidebar/index.js const { TabbedSidebar } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ListViewSidebar() { const { setIsListViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { getListViewToggleRef } = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store)); const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)("firstElement"); const closeListView = (0,external_wp_element_namespaceObject.useCallback)(() => { setIsListViewOpened(false); getListViewToggleRef().current?.focus(); }, [getListViewToggleRef, setIsListViewOpened]); const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)( (event) => { if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { event.preventDefault(); closeListView(); } }, [closeListView] ); const [dropZoneElement, setDropZoneElement] = (0,external_wp_element_namespaceObject.useState)(null); const [tab, setTab] = (0,external_wp_element_namespaceObject.useState)("list-view"); const sidebarRef = (0,external_wp_element_namespaceObject.useRef)(); const tabsRef = (0,external_wp_element_namespaceObject.useRef)(); const listViewRef = (0,external_wp_element_namespaceObject.useRef)(); const listViewContainerRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ focusOnMountRef, listViewRef, setDropZoneElement ]); function handleSidebarFocus(currentTab) { const tabPanelFocus = external_wp_dom_namespaceObject.focus.tabbable.find(tabsRef.current)[0]; if (currentTab === "list-view") { const listViewApplicationFocus = external_wp_dom_namespaceObject.focus.tabbable.find( listViewRef.current )[0]; const listViewFocusArea = sidebarRef.current.contains( listViewApplicationFocus ) ? listViewApplicationFocus : tabPanelFocus; listViewFocusArea.focus(); } else { tabPanelFocus.focus(); } } const handleToggleListViewShortcut = (0,external_wp_element_namespaceObject.useCallback)(() => { if (sidebarRef.current.contains( sidebarRef.current.ownerDocument.activeElement )) { closeListView(); } else { handleSidebarFocus(tab); } }, [closeListView, tab]); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/toggle-list-view", handleToggleListViewShortcut); return ( // eslint-disable-next-line jsx-a11y/no-static-element-interactions /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "editor-list-view-sidebar", onKeyDown: closeOnEscape, ref: sidebarRef, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TabbedSidebar, { tabs: [ { name: "list-view", title: (0,external_wp_i18n_namespaceObject._x)("List View", "Post overview"), panel: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-list-view-sidebar__list-view-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-list-view-sidebar__list-view-panel-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalListView, { dropZoneElement } ) }) }), panelRef: listViewContainerRef }, { name: "outline", title: (0,external_wp_i18n_namespaceObject._x)("Outline", "Post overview"), panel: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-list-view-sidebar__list-view-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewOutline, {}) }) } ], onClose: closeListView, onSelect: (tabName) => setTab(tabName), defaultTabId: "list-view", ref: tabsRef, closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close") } ) } ) ); } ;// ./node_modules/@wordpress/editor/build-module/components/save-publish-panels/index.js const { Fill: save_publish_panels_Fill, Slot: save_publish_panels_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("ActionsPanel"); const ActionsPanelFill = (/* unused pure expression or super */ null && (save_publish_panels_Fill)); function SavePublishPanels({ setEntitiesSavedStatesCallback, closeEntitiesSavedStates, isEntitiesSavedStatesOpen, forceIsDirtyPublishPanel }) { const { closePublishSidebar, togglePublishSidebar } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { publishSidebarOpened, isPublishable, isDirty, hasOtherEntitiesChanges } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { isPublishSidebarOpened, isEditedPostPublishable, isCurrentPostPublished, isEditedPostDirty, hasNonPostEntityChanges } = select(store_store); const _hasOtherEntitiesChanges = hasNonPostEntityChanges(); return { publishSidebarOpened: isPublishSidebarOpened(), isPublishable: !isCurrentPostPublished() && isEditedPostPublishable(), isDirty: _hasOtherEntitiesChanges || isEditedPostDirty(), hasOtherEntitiesChanges: _hasOtherEntitiesChanges }; }, []); const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)( () => setEntitiesSavedStatesCallback(true), [] ); let unmountableContent; if (publishSidebarOpened) { unmountableContent = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( post_publish_panel_default, { onClose: closePublishSidebar, forceIsDirty: forceIsDirtyPublishPanel, PrePublishExtension: plugin_pre_publish_panel_default.Slot, PostPublishExtension: plugin_post_publish_panel_default.Slot } ); } else if (isPublishable && !hasOtherEntitiesChanges) { unmountableContent = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-layout__toggle-publish-panel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", onClick: togglePublishSidebar, "aria-expanded": false, children: (0,external_wp_i18n_namespaceObject.__)("Open publish panel") } ) }); } else { unmountableContent = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-layout__toggle-entities-saved-states-panel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", onClick: openEntitiesSavedStates, "aria-expanded": false, "aria-haspopup": "dialog", disabled: !isDirty, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)("Open save panel") } ) }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ isEntitiesSavedStatesOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EntitiesSavedStates, { close: closeEntitiesSavedStates, renderDialog: true } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(save_publish_panels_Slot, { bubblesVirtually: true }), !isEntitiesSavedStatesOpen && unmountableContent ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/text-editor/index.js function TextEditor({ autoFocus = false }) { const { switchEditorMode } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { shortcut, isRichEditingEnabled } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditorSettings } = select(store_store); const { getShortcutRepresentation } = select(external_wp_keyboardShortcuts_namespaceObject.store); return { shortcut: getShortcutRepresentation("core/editor/toggle-mode"), isRichEditingEnabled: getEditorSettings().richEditingEnabled }; }, []); const titleRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { if (autoFocus) { return; } titleRef?.current?.focus(); }, [autoFocus]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-text-editor", children: [ isRichEditingEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-text-editor__toolbar", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { children: (0,external_wp_i18n_namespaceObject.__)("Editing code") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => switchEditorMode("visual"), shortcut, children: (0,external_wp_i18n_namespaceObject.__)("Exit code editor") } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-text-editor__body", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_title_raw_default, { ref: titleRef }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTextEditor, {}) ] }) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/edit-template-blocks-notification.js function EditTemplateBlocksNotification({ contentRef }) { const { onNavigateToEntityRecord, templateId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditorSettings, getCurrentTemplateId } = select(store_store); return { onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord, templateId: getCurrentTemplateId() }; }, []); const canEditTemplate = (0,external_wp_data_namespaceObject.useSelect)( (select) => !!select(external_wp_coreData_namespaceObject.store).canUser("create", { kind: "postType", name: "wp_template" }), [] ); const [isDialogOpen, setIsDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { const handleDblClick = (event) => { if (!canEditTemplate) { return; } if (!event.target.classList.contains("is-root-container") || event.target.dataset?.type === "core/template-part") { return; } if (!event.defaultPrevented) { event.preventDefault(); setIsDialogOpen(true); } }; const canvas = contentRef.current; canvas?.addEventListener("dblclick", handleDblClick); return () => { canvas?.removeEventListener("dblclick", handleDblClick); }; }, [contentRef, canEditTemplate]); if (!canEditTemplate) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: isDialogOpen, confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Edit template"), onConfirm: () => { setIsDialogOpen(false); onNavigateToEntityRecord({ postId: templateId, postType: "wp_template" }); }, onCancel: () => setIsDialogOpen(false), size: "medium", children: (0,external_wp_i18n_namespaceObject.__)( "You\u2019ve tried to select a block that is part of a template that may be used elsewhere on your site. Would you like to edit the template?" ) } ); } ;// ./node_modules/@wordpress/editor/build-module/components/resizable-editor/resize-handle.js const DELTA_DISTANCE = 20; function ResizeHandle({ direction, resizeWidthBy }) { function handleKeyDown(event) { const { keyCode } = event; if (keyCode !== external_wp_keycodes_namespaceObject.LEFT && keyCode !== external_wp_keycodes_namespaceObject.RIGHT) { return; } event.preventDefault(); if (direction === "left" && keyCode === external_wp_keycodes_namespaceObject.LEFT || direction === "right" && keyCode === external_wp_keycodes_namespaceObject.RIGHT) { resizeWidthBy(DELTA_DISTANCE); } else if (direction === "left" && keyCode === external_wp_keycodes_namespaceObject.RIGHT || direction === "right" && keyCode === external_wp_keycodes_namespaceObject.LEFT) { resizeWidthBy(-DELTA_DISTANCE); } } const resizeHandleVariants = { active: { opacity: 1, scaleY: 1.3 } }; const resizableHandleHelpId = `resizable-editor__resize-help-${direction}`; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__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)( external_wp_components_namespaceObject.__unstableMotion.button, { className: `editor-resizable-editor__resize-handle is-${direction}`, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Drag to resize"), "aria-describedby": resizableHandleHelpId, onKeyDown: handleKeyDown, variants: resizeHandleVariants, whileFocus: "active", whileHover: "active", whileTap: "active", role: "separator", "aria-orientation": "vertical" }, "handle" ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: resizableHandleHelpId, children: (0,external_wp_i18n_namespaceObject.__)("Use left and right arrow keys to resize the canvas.") }) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/resizable-editor/index.js const HANDLE_STYLES_OVERRIDE = { position: void 0, userSelect: void 0, cursor: void 0, width: void 0, height: void 0, top: void 0, right: void 0, bottom: void 0, left: void 0 }; function ResizableEditor({ className, enableResizing, height, children }) { const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)("100%"); const resizableRef = (0,external_wp_element_namespaceObject.useRef)(); const resizeWidthBy = (0,external_wp_element_namespaceObject.useCallback)((deltaPixels) => { if (resizableRef.current) { setWidth(resizableRef.current.offsetWidth + deltaPixels); } }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ResizableBox, { className: dist_clsx("editor-resizable-editor", className, { "is-resizable": enableResizing }), ref: (api) => { resizableRef.current = api?.resizable; }, size: { width: enableResizing ? width : "100%", height: enableResizing && height ? height : "100%" }, onResizeStop: (event, direction, element) => { setWidth(element.style.width); }, minWidth: 300, maxWidth: "100%", maxHeight: "100%", enable: { left: enableResizing, right: enableResizing }, showHandle: enableResizing, resizeRatio: 2, handleComponent: { left: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ResizeHandle, { direction: "left", resizeWidthBy } ), right: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ResizeHandle, { direction: "right", resizeWidthBy } ) }, handleClasses: void 0, handleStyles: { left: HANDLE_STYLES_OVERRIDE, right: HANDLE_STYLES_OVERRIDE }, children } ); } var resizable_editor_default = ResizableEditor; ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/use-select-nearest-editable-block.js const DISTANCE_THRESHOLD = 500; function use_select_nearest_editable_block_clamp(value, min, max) { return Math.min(Math.max(value, min), max); } function distanceFromRect(x, y, rect) { const dx = x - use_select_nearest_editable_block_clamp(x, rect.left, rect.right); const dy = y - use_select_nearest_editable_block_clamp(y, rect.top, rect.bottom); return Math.sqrt(dx * dx + dy * dy); } function useSelectNearestEditableBlock({ isEnabled = true } = {}) { const { getEnabledClientIdsTree, getBlockName, getBlockOrder } = unlock( (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store) ); const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); return (0,external_wp_compose_namespaceObject.useRefEffect)( (element) => { if (!isEnabled) { return; } const selectNearestEditableBlock = (x, y) => { const editableBlockClientIds = getEnabledClientIdsTree().flatMap(({ clientId }) => { const blockName = getBlockName(clientId); if (blockName === "core/template-part") { return []; } if (blockName === "core/post-content") { const innerBlocks = getBlockOrder(clientId); if (innerBlocks.length) { return innerBlocks; } } return [clientId]; }); let nearestDistance = Infinity, nearestClientId = null; for (const clientId of editableBlockClientIds) { const block = element.querySelector( `[data-block="${clientId}"]` ); if (!block) { continue; } const rect = block.getBoundingClientRect(); const distance = distanceFromRect(x, y, rect); if (distance < nearestDistance && distance < DISTANCE_THRESHOLD) { nearestDistance = distance; nearestClientId = clientId; } } if (nearestClientId) { selectBlock(nearestClientId); } }; const handleClick = (event) => { const shouldSelect = event.target === element || event.target.classList.contains("is-root-container"); if (shouldSelect) { selectNearestEditableBlock(event.clientX, event.clientY); } }; element.addEventListener("click", handleClick); return () => element.removeEventListener("click", handleClick); }, [isEnabled] ); } ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/use-zoom-out-mode-exit.js function useZoomOutModeExit() { const { getSettings, isZoomOut } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store)); const { resetZoomLevel } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); return (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { function onDoubleClick(event) { if (!isZoomOut()) { return; } if (!event.defaultPrevented) { event.preventDefault(); const { __experimentalSetIsInserterOpened } = getSettings(); if (typeof __experimentalSetIsInserterOpened === "function") { __experimentalSetIsInserterOpened(false); } resetZoomLevel(); } } node.addEventListener("dblclick", onDoubleClick); return () => { node.removeEventListener("dblclick", onDoubleClick); }; }, [getSettings, isZoomOut, resetZoomLevel] ); } ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/index.js const { LayoutStyle, useLayoutClasses, useLayoutStyles, ExperimentalBlockCanvas: BlockCanvas, useFlashEditableBlocks } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const visual_editor_DESIGN_POST_TYPES = [ PATTERN_POST_TYPE, TEMPLATE_POST_TYPE, NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE ]; function getPostContentAttributes(blocks) { for (let i = 0; i < blocks.length; i++) { if (blocks[i].name === "core/post-content") { return blocks[i].attributes; } if (blocks[i].innerBlocks.length) { const nestedPostContent = getPostContentAttributes( blocks[i].innerBlocks ); if (nestedPostContent) { return nestedPostContent; } } } } function checkForPostContentAtRootLevel(blocks) { for (let i = 0; i < blocks.length; i++) { if (blocks[i].name === "core/post-content") { return true; } } return false; } function VisualEditor({ // Ideally as we unify post and site editors, we won't need these props. autoFocus, styles, disableIframe = false, iframeProps, contentRef, className }) { const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("small", "<"); const { renderingMode, postContentAttributes, editedPostTemplate = {}, wrapperBlockName, wrapperUniqueId, deviceType, isFocusedEntity, isDesignPostType, postType, isPreview, canvasMinHeight } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostId, getCurrentPostType, getCurrentTemplateId, getEditorSettings, getRenderingMode, getDeviceType, getCanvasMinHeight } = unlock(select(store_store)); const { getPostType, getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const postTypeSlug = getCurrentPostType(); const _renderingMode = getRenderingMode(); let _wrapperBlockName; if (postTypeSlug === PATTERN_POST_TYPE) { _wrapperBlockName = "core/block"; } else if (_renderingMode === "post-only") { _wrapperBlockName = "core/post-content"; } const editorSettings = getEditorSettings(); const supportsTemplateMode = editorSettings.supportsTemplateMode; const postTypeObject = getPostType(postTypeSlug); const currentTemplateId = getCurrentTemplateId(); const template = currentTemplateId ? getEditedEntityRecord( "postType", TEMPLATE_POST_TYPE, currentTemplateId ) : void 0; return { renderingMode: _renderingMode, postContentAttributes: editorSettings.postContentAttributes, isDesignPostType: visual_editor_DESIGN_POST_TYPES.includes(postTypeSlug), // Post template fetch returns a 404 on classic themes, which // messes with e2e tests, so check it's a block theme first. editedPostTemplate: postTypeObject?.viewable && supportsTemplateMode ? template : void 0, wrapperBlockName: _wrapperBlockName, wrapperUniqueId: getCurrentPostId(), deviceType: getDeviceType(), isFocusedEntity: !!editorSettings.onNavigateToPreviousEntityRecord, postType: postTypeSlug, isPreview: editorSettings.isPreviewMode, canvasMinHeight: getCanvasMinHeight() }; }, []); const { isCleanNewPost } = (0,external_wp_data_namespaceObject.useSelect)(store_store); const { hasRootPaddingAwareAlignments, themeHasDisabledLayoutStyles, themeSupportsLayout, isZoomedOut } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSettings, isZoomOut: _isZoomOut } = unlock( select(external_wp_blockEditor_namespaceObject.store) ); const _settings = getSettings(); return { themeHasDisabledLayoutStyles: _settings.disableLayoutStyles, themeSupportsLayout: _settings.supportsLayout, hasRootPaddingAwareAlignments: _settings.__experimentalFeatures?.useRootPaddingAwareAlignments, isZoomedOut: _isZoomOut() }; }, []); const localRef = (0,external_wp_element_namespaceObject.useRef)(); const deviceStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType); const [globalLayoutSettings] = (0,external_wp_blockEditor_namespaceObject.useSettings)("layout"); const fallbackLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { if (renderingMode !== "post-only" || isDesignPostType) { return { type: "default" }; } if (themeSupportsLayout) { return { ...globalLayoutSettings, type: "constrained" }; } return { type: "default" }; }, [ renderingMode, themeSupportsLayout, globalLayoutSettings, isDesignPostType ]); const newestPostContentAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!editedPostTemplate?.content && !editedPostTemplate?.blocks && postContentAttributes) { return postContentAttributes; } if (editedPostTemplate?.blocks) { return getPostContentAttributes(editedPostTemplate?.blocks); } const parseableContent = typeof editedPostTemplate?.content === "string" ? editedPostTemplate?.content : ""; return getPostContentAttributes((0,external_wp_blocks_namespaceObject.parse)(parseableContent)) || {}; }, [ editedPostTemplate?.content, editedPostTemplate?.blocks, postContentAttributes ]); const hasPostContentAtRootLevel = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!editedPostTemplate?.content && !editedPostTemplate?.blocks) { return false; } if (editedPostTemplate?.blocks) { return checkForPostContentAtRootLevel(editedPostTemplate?.blocks); } const parseableContent = typeof editedPostTemplate?.content === "string" ? editedPostTemplate?.content : ""; return checkForPostContentAtRootLevel((0,external_wp_blocks_namespaceObject.parse)(parseableContent)) || false; }, [editedPostTemplate?.content, editedPostTemplate?.blocks]); const { layout = {}, align = "" } = newestPostContentAttributes || {}; const postContentLayoutClasses = useLayoutClasses( newestPostContentAttributes, "core/post-content" ); const blockListLayoutClass = dist_clsx( { "is-layout-flow": !themeSupportsLayout }, themeSupportsLayout && postContentLayoutClasses, align && `align${align}` ); const postContentLayoutStyles = useLayoutStyles( newestPostContentAttributes, "core/post-content", ".block-editor-block-list__layout.is-root-container" ); const postContentLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { return layout && (layout?.type === "constrained" || layout?.inherit || layout?.contentSize || layout?.wideSize) ? { ...globalLayoutSettings, ...layout, type: "constrained" } : { ...globalLayoutSettings, ...layout, type: "default" }; }, [ layout?.type, layout?.inherit, layout?.contentSize, layout?.wideSize, globalLayoutSettings ]); const blockListLayout = postContentAttributes ? postContentLayout : fallbackLayout; const postEditorLayout = blockListLayout?.type === "default" && !hasPostContentAtRootLevel ? fallbackLayout : blockListLayout; const observeTypingRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)(); const titleRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!autoFocus || !isCleanNewPost()) { return; } titleRef?.current?.focus(); }, [autoFocus, isCleanNewPost]); const alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;} .is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);} .is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;} .is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`; const enableResizing = [ NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE ].includes(postType) && // Disable in previews / view mode. !isPreview && // Disable resizing in mobile viewport. !isMobileViewport && // Disable resizing in zoomed-out mode. !isZoomedOut; const calculatedMinHeight = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!localRef.current) { return canvasMinHeight; } const { ownerDocument } = localRef.current; const scrollTop = ownerDocument.documentElement.scrollTop || ownerDocument.body.scrollTop; return canvasMinHeight + scrollTop; }, [canvasMinHeight]); const iframeStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { return [ ...styles ?? [], { // Ensures margins of children are contained so that the body background paints behind them. // Otherwise, the background of html (when zoomed out) would show there and appear broken. It's // important mostly for post-only views yet conceivably an issue in templated views too. css: `:where(.block-editor-iframe__body){display:flow-root;${calculatedMinHeight ? `min-height:${calculatedMinHeight}px;` : ""}}.is-root-container{display:flow-root;${// Some themes will have `min-height: 100vh` for the root container, // which isn't a requirement in auto resize mode. enableResizing ? "min-height:0!important;" : ""}} ${enableResizing ? `.block-editor-iframe__html{background:var(--wp-editor-canvas-background);display:flex;align-items:center;justify-content:center;min-height:100vh;}.block-editor-iframe__body{width:100%;}` : ""}` // The CSS above centers the body content vertically when resizing is enabled and applies a background // color to the iframe HTML element to match the background color of the editor canvas. } ]; }, [styles, enableResizing, calculatedMinHeight]); const typewriterRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseTypewriter)(); contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ localRef, contentRef, renderingMode === "post-only" ? typewriterRef : null, useFlashEditableBlocks({ isEnabled: renderingMode === "template-locked" }), useSelectNearestEditableBlock({ isEnabled: renderingMode === "template-locked" }), useZoomOutModeExit() ]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx( "editor-visual-editor", // this class is here for backward compatibility reasons. "edit-post-visual-editor", className, { "has-padding": isFocusedEntity || enableResizing, "is-resizable": enableResizing, "is-iframed": !disableIframe } ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(resizable_editor_default, { enableResizing, height: "100%", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( BlockCanvas, { shouldIframe: !disableIframe, contentRef, styles: iframeStyles, height: "100%", iframeProps: { ...iframeProps, style: { ...iframeProps?.style, ...deviceStyles } }, children: [ themeSupportsLayout && !themeHasDisabledLayoutStyles && renderingMode === "post-only" && !isDesignPostType && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( LayoutStyle, { selector: ".editor-visual-editor__post-title-wrapper", layout: fallbackLayout } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( LayoutStyle, { selector: ".block-editor-block-list__layout.is-root-container", layout: postEditorLayout } ), align && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, { css: alignCSS }), postContentLayoutStyles && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( LayoutStyle, { layout: postContentLayout, css: postContentLayoutStyles } ) ] }), renderingMode === "post-only" && !isDesignPostType && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx( "editor-visual-editor__post-title-wrapper", // The following class is only here for backward compatibility // some themes might be using it to style the post title. "edit-post-visual-editor__post-title-wrapper", { "has-global-padding": hasRootPaddingAwareAlignments } ), contentEditable: false, ref: observeTypingRef, style: { // This is using inline styles // so it's applied for both iframed and non iframed editors. marginTop: "4rem" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_title_default, { ref: titleRef }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_blockEditor_namespaceObject.RecursionProvider, { blockName: wrapperBlockName, uniqueId: wrapperUniqueId, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.BlockList, { className: dist_clsx( "is-" + deviceType.toLowerCase() + "-preview", renderingMode !== "post-only" || isDesignPostType ? "wp-site-blocks" : `${blockListLayoutClass} wp-block-post-content`, // Ensure root level blocks receive default/flow blockGap styling rules. { "has-global-padding": renderingMode === "post-only" && !isDesignPostType && hasRootPaddingAwareAlignments } ), layout: blockListLayout, dropZoneElement: ( // When iframed, pass in the html element of the iframe to // ensure the drop zone extends to the edges of the iframe. disableIframe ? localRef.current : localRef.current?.parentNode ), __unstableDisableDropZone: ( // In template preview mode, disable drop zones at the root of the template. renderingMode === "template-locked" ? true : false ) } ), renderingMode === "template-locked" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EditTemplateBlocksNotification, { contentRef: localRef } ) ] } ) ] } ) }) } ); } var visual_editor_default = VisualEditor; ;// ./node_modules/@wordpress/editor/build-module/components/editor-interface/index.js const interfaceLabels = { /* translators: accessibility text for the editor top bar landmark region. */ header: (0,external_wp_i18n_namespaceObject.__)("Editor top bar"), /* translators: accessibility text for the editor content landmark region. */ body: (0,external_wp_i18n_namespaceObject.__)("Editor content"), /* translators: accessibility text for the editor settings landmark region. */ sidebar: (0,external_wp_i18n_namespaceObject.__)("Editor settings"), /* translators: accessibility text for the editor publish landmark region. */ actions: (0,external_wp_i18n_namespaceObject.__)("Editor publish"), /* translators: accessibility text for the editor footer landmark region. */ footer: (0,external_wp_i18n_namespaceObject.__)("Editor footer") }; function EditorInterface({ className, styles, children, forceIsDirty, contentRef, disableIframe, autoFocus, customSaveButton, customSavePanel, forceDisableBlockTools, title, iframeProps }) { const { mode, isInserterOpened, isListViewOpened, isDistractionFree, isPreviewMode, showBlockBreadcrumbs, documentLabel } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { get } = select(external_wp_preferences_namespaceObject.store); const { getEditorSettings, getPostTypeLabel } = select(store_store); const editorSettings = getEditorSettings(); const postTypeLabel = getPostTypeLabel(); let _mode = select(store_store).getEditorMode(); if (!editorSettings.richEditingEnabled && _mode === "visual") { _mode = "text"; } if (!editorSettings.codeEditingEnabled && _mode === "text") { _mode = "visual"; } return { mode: _mode, isInserterOpened: select(store_store).isInserterOpened(), isListViewOpened: select(store_store).isListViewOpened(), isDistractionFree: get("core", "distractionFree"), isPreviewMode: editorSettings.isPreviewMode, showBlockBreadcrumbs: get("core", "showBlockBreadcrumbs"), documentLabel: ( // translators: Default label for the Document in the Block Breadcrumb. postTypeLabel || (0,external_wp_i18n_namespaceObject._x)("Document", "noun, breadcrumb") ) }; }, []); const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)("Document Overview") : (0,external_wp_i18n_namespaceObject.__)("Block Library"); const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0,external_wp_element_namespaceObject.useState)(false); const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)( (arg) => { if (typeof entitiesSavedStatesCallback === "function") { entitiesSavedStatesCallback(arg); } setEntitiesSavedStatesCallback(false); }, [entitiesSavedStatesCallback] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( interface_skeleton_default, { isDistractionFree, className: dist_clsx("editor-editor-interface", className, { "is-entity-save-view-open": !!entitiesSavedStatesCallback, "is-distraction-free": isDistractionFree && !isPreviewMode }), labels: { ...interfaceLabels, secondarySidebar: secondarySidebarLabel }, header: !isPreviewMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( header_header_default, { forceIsDirty, setEntitiesSavedStatesCallback, customSaveButton, forceDisableBlockTools, title } ), editorNotices: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_notices_default, {}), secondarySidebar: !isPreviewMode && mode === "visual" && (isInserterOpened && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InserterSidebar, {}) || isListViewOpened && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewSidebar, {})), sidebar: !isPreviewMode && !isDistractionFree && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_default.Slot, { scope: "core" }), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ !isDistractionFree && !isPreviewMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_notices_default, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(content_slot_fill_default.Slot, { children: ([editorCanvasView]) => editorCanvasView ? editorCanvasView : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ !isPreviewMode && mode === "text" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TextEditor, { autoFocus } ), !isPreviewMode && !isLargeViewport && mode === "visual" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { hideDragHandle: true }), (isPreviewMode || mode === "visual") && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( visual_editor_default, { styles, contentRef, disableIframe, autoFocus, iframeProps } ), children ] }) }) ] }), footer: !isPreviewMode && !isDistractionFree && isLargeViewport && showBlockBreadcrumbs && mode === "visual" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { rootLabelText: documentLabel }), actions: !isPreviewMode ? customSavePanel || /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SavePublishPanels, { closeEntitiesSavedStates, isEntitiesSavedStatesOpen: entitiesSavedStatesCallback, setEntitiesSavedStatesCallback, forceIsDirtyPublishPanel: forceIsDirty } ) : void 0 } ); } ;// ./node_modules/@wordpress/editor/build-module/components/pattern-overrides-panel/index.js const { OverridesPanel } = unlock(external_wp_patterns_namespaceObject.privateApis); function PatternOverridesPanel() { const supportsPatternOverridesPanel = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getCurrentPostType() === "wp_block", [] ); if (!supportsPatternOverridesPanel) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(OverridesPanel, {}); } ;// ./node_modules/@wordpress/editor/build-module/utils/get-item-title.js function get_item_title_getItemTitle(item) { if (typeof item.title === "string") { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title); } if (item.title && "rendered" in item.title) { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.rendered); } if (item.title && "raw" in item.title) { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.raw); } return ""; } ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/set-as-homepage.js const SetAsHomepageModal = ({ items, closeModal }) => { const [item] = items; const pageTitle = get_item_title_getItemTitle(item); const { showOnFront, currentHomePage, isSaving } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEntityRecord, isSavingEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteSettings = getEntityRecord("root", "site"); const currentHomePageItem = getEntityRecord( "postType", "page", siteSettings?.page_on_front ); return { showOnFront: siteSettings?.show_on_front, currentHomePage: currentHomePageItem, isSaving: isSavingEntityRecord("root", "site") }; } ); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); async function onSetPageAsHomepage(event) { event.preventDefault(); try { await saveEntityRecord("root", "site", { page_on_front: item.id, show_on_front: "page" }); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Homepage updated."), { type: "snackbar" }); } catch (error) { const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while setting the homepage."); createErrorNotice(errorMessage, { type: "snackbar" }); } finally { closeModal?.(); } } let modalWarning = ""; if ("posts" === showOnFront) { modalWarning = (0,external_wp_i18n_namespaceObject.__)( "This will replace the current homepage which is set to display latest posts." ); } else if (currentHomePage) { modalWarning = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: title of the current home page. (0,external_wp_i18n_namespaceObject.__)('This will replace the current homepage: "%s"'), get_item_title_getItemTitle(currentHomePage) ); } const modalText = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: title of the page to be set as the homepage, %2$s: homepage replacement warning message. (0,external_wp_i18n_namespaceObject.__)('Set "%1$s" as the site homepage? %2$s'), pageTitle, modalWarning ).trim(); const modalButtonLabel = (0,external_wp_i18n_namespaceObject.__)("Set homepage"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onSetPageAsHomepage, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: modalText }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { closeModal?.(); }, disabled: isSaving, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", disabled: isSaving, accessibleWhenDisabled: true, children: modalButtonLabel } ) ] }) ] }) }); }; const useSetAsHomepageAction = () => { const { pageOnFront, pageForPosts } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser("read", { kind: "root", name: "site" }) ? getEntityRecord("root", "site") : void 0; return { pageOnFront: siteSettings?.page_on_front, pageForPosts: siteSettings?.page_for_posts }; }); return (0,external_wp_element_namespaceObject.useMemo)( () => ({ id: "set-as-homepage", label: (0,external_wp_i18n_namespaceObject.__)("Set as homepage"), isEligible(post) { if (post.status !== "publish") { return false; } if (post.type !== "page") { return false; } if (pageOnFront === post.id) { return false; } if (pageForPosts === post.id) { return false; } return true; }, modalFocusOnMount: "firstContentElement", RenderModal: SetAsHomepageModal }), [pageForPosts, pageOnFront] ); }; ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/set-as-posts-page.js const SetAsPostsPageModal = ({ items, closeModal }) => { const [item] = items; const pageTitle = get_item_title_getItemTitle(item); const { currentPostsPage, isPageForPostsSet, isSaving } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEntityRecord, isSavingEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteSettings = getEntityRecord("root", "site"); const currentPostsPageItem = getEntityRecord( "postType", "page", siteSettings?.page_for_posts ); return { currentPostsPage: currentPostsPageItem, isPageForPostsSet: siteSettings?.page_for_posts !== 0, isSaving: isSavingEntityRecord("root", "site") }; } ); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); async function onSetPageAsPostsPage(event) { event.preventDefault(); try { await saveEntityRecord("root", "site", { page_for_posts: item.id, show_on_front: "page" }); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Posts page updated."), { type: "snackbar" }); } catch (error) { const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while setting the posts page."); createErrorNotice(errorMessage, { type: "snackbar" }); } finally { closeModal?.(); } } const modalWarning = isPageForPostsSet && currentPostsPage ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: title of the current posts page. (0,external_wp_i18n_namespaceObject.__)('This will replace the current posts page: "%s"'), get_item_title_getItemTitle(currentPostsPage) ) : (0,external_wp_i18n_namespaceObject.__)("This page will show the latest posts."); const modalText = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: title of the page to be set as the posts page, %2$s: posts page replacement warning message. (0,external_wp_i18n_namespaceObject.__)('Set "%1$s" as the posts page? %2$s'), pageTitle, modalWarning ); const modalButtonLabel = (0,external_wp_i18n_namespaceObject.__)("Set posts page"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onSetPageAsPostsPage, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: modalText }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { closeModal?.(); }, disabled: isSaving, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", disabled: isSaving, accessibleWhenDisabled: true, children: modalButtonLabel } ) ] }) ] }) }); }; const useSetAsPostsPageAction = () => { const { pageOnFront, pageForPosts } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser("read", { kind: "root", name: "site" }) ? getEntityRecord("root", "site") : void 0; return { pageOnFront: siteSettings?.page_on_front, pageForPosts: siteSettings?.page_for_posts }; }); return (0,external_wp_element_namespaceObject.useMemo)( () => ({ id: "set-as-posts-page", label: (0,external_wp_i18n_namespaceObject.__)("Set as posts page"), isEligible(post) { if (post.status !== "publish") { return false; } if (post.type !== "page") { return false; } if (pageOnFront === post.id) { return false; } if (pageForPosts === post.id) { return false; } return true; }, modalFocusOnMount: "firstContentElement", RenderModal: SetAsPostsPageModal }), [pageForPosts, pageOnFront] ); }; ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/actions.js function usePostActions({ postType, onActionPerformed, context }) { const { defaultActions } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEntityActions } = unlock(select(store_store)); return { defaultActions: getEntityActions("postType", postType) }; }, [postType] ); const shouldShowHomepageActions = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (postType !== "page") { return false; } const { getDefaultTemplateId, getEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); const canUpdateSettings = canUser("update", { kind: "root", name: "site" }); if (!canUpdateSettings) { return false; } const frontPageTemplateId = getDefaultTemplateId({ slug: "front-page" }); if (!frontPageTemplateId) { return true; } const frontPageTemplate = getEntityRecord( "postType", "wp_template", frontPageTemplateId ); if (!frontPageTemplate) { return true; } return frontPageTemplate.slug !== "front-page"; }, [postType] ); const setAsHomepageAction = useSetAsHomepageAction(); const setAsPostsPageAction = useSetAsPostsPageAction(); const { registerPostTypeSchema } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); (0,external_wp_element_namespaceObject.useEffect)(() => { registerPostTypeSchema(postType); }, [registerPostTypeSchema, postType]); return (0,external_wp_element_namespaceObject.useMemo)(() => { let actions = [...defaultActions]; if (shouldShowHomepageActions) { actions.push(setAsHomepageAction, setAsPostsPageAction); } actions = actions.sort( (a, b) => b.id === "move-to-trash" ? -1 : 0 ); actions = actions.filter((action) => { if (!action.context) { return true; } return action.context === context; }); if (onActionPerformed) { for (let i = 0; i < actions.length; ++i) { if (actions[i].callback) { const existingCallback = actions[i].callback; actions[i] = { ...actions[i], callback: (items, argsObject) => { existingCallback(items, { ...argsObject, onActionPerformed: (_items) => { if (argsObject?.onActionPerformed) { argsObject.onActionPerformed(_items); } onActionPerformed( actions[i].id, _items ); } }); } }; } if (actions[i].RenderModal) { const ExistingRenderModal = actions[i].RenderModal; actions[i] = { ...actions[i], RenderModal: (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ExistingRenderModal, { ...props, onActionPerformed: (_items) => { if (props.onActionPerformed) { props.onActionPerformed(_items); } onActionPerformed( actions[i].id, _items ); } } ); } }; } } } return actions; }, [ context, defaultActions, onActionPerformed, setAsHomepageAction, setAsPostsPageAction, shouldShowHomepageActions ]); } ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/index.js const { Menu, kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); function PostActions({ postType, postId, onActionPerformed }) { const [activeModalAction, setActiveModalAction] = (0,external_wp_element_namespaceObject.useState)(null); const { item, permissions } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEditedEntityRecord, getEntityRecordPermissions } = unlock(select(external_wp_coreData_namespaceObject.store)); return { item: getEditedEntityRecord("postType", postType, postId), permissions: getEntityRecordPermissions( "postType", postType, postId ) }; }, [postId, postType] ); const itemWithPermissions = (0,external_wp_element_namespaceObject.useMemo)(() => { return { ...item, permissions }; }, [item, permissions]); const allActions = usePostActions({ postType, onActionPerformed }); const actions = (0,external_wp_element_namespaceObject.useMemo)(() => { return allActions.filter((action) => { return !action.isEligible || action.isEligible(itemWithPermissions); }); }, [allActions, itemWithPermissions]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { placement: "bottom-end", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Menu.TriggerButton, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("Actions"), disabled: !actions.length, accessibleWhenDisabled: true, className: "editor-all-actions-button" } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ActionsDropdownMenuGroup, { actions, items: [itemWithPermissions], setActiveModalAction } ) }) ] }), !!activeModalAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ActionModal, { action: activeModalAction, items: [itemWithPermissions], closeModal: () => setActiveModalAction(null) } ) ] }); } function DropdownMenuItemTrigger({ action, onClick, items }) { const label = typeof action.label === "string" ? action.label : action.label(items); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Item, { onClick, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: label }) }); } function ActionModal({ action, items, closeModal }) { const label = typeof action.label === "string" ? action.label : action.label(items); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: action.modalHeader || label, __experimentalHideHeader: !!action.hideModalHeader, onRequestClose: closeModal ?? (() => { }), focusOnMount: "firstContentElement", size: "medium", overlayClassName: `editor-action-modal editor-action-modal__${kebabCase( action.id )}`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(action.RenderModal, { items, closeModal }) } ); } function ActionsDropdownMenuGroup({ actions, items, setActiveModalAction }) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Group, { children: actions.map((action) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( DropdownMenuItemTrigger, { action, onClick: () => { if ("RenderModal" in action) { setActiveModalAction(action); return; } action.callback(items, { registry }); }, items }, action.id ); }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-card-panel/index.js const { Badge: post_card_panel_Badge } = unlock(external_wp_components_namespaceObject.privateApis); function PostCardPanel({ postType, postId, onActionPerformed }) { const postIds = (0,external_wp_element_namespaceObject.useMemo)( () => Array.isArray(postId) ? postId : [postId], [postId] ); const { postTitle, icon, labels } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEditedEntityRecord, getCurrentTheme, getPostType } = select(external_wp_coreData_namespaceObject.store); const { getPostIcon } = unlock(select(store_store)); let _title = ""; const _record = getEditedEntityRecord( "postType", postType, postIds[0] ); if (postIds.length === 1) { const { default_template_types: templateTypes = [] } = getCurrentTheme() ?? {}; const _templateInfo = [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(postType) ? getTemplateInfo({ template: _record, templateTypes }) : {}; _title = _templateInfo?.title || _record?.title; } return { postTitle: _title, icon: getPostIcon(postType, { area: _record?.area }), labels: getPostType(postType)?.labels }; }, [postIds, postType] ); const pageTypeBadge = usePageTypeBadge(postId); let title = (0,external_wp_i18n_namespaceObject.__)("No title"); if (labels?.name && postIds.length > 1) { title = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$d number of selected items %2$s: Name of the plural post type e.g: "Posts". (0,external_wp_i18n_namespaceObject.__)("%1$d %2$s"), postIds.length, labels?.name ); } else if (postTitle) { title = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(postTitle); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, className: "editor-post-card-panel", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, className: "editor-post-card-panel__header", align: "flex-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { className: "editor-post-card-panel__icon", icon }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalText, { numberOfLines: 2, truncate: true, className: "editor-post-card-panel__title", as: "h2", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-card-panel__title-name", children: title }), pageTypeBadge && postIds.length === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_card_panel_Badge, { children: pageTypeBadge }) ] } ), postIds.length === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PostActions, { postType, postId: postIds[0], onActionPerformed } ) ] } ), postIds.length > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "editor-post-card-panel__description", children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the plural post type e.g: "Posts". (0,external_wp_i18n_namespaceObject.__)("Changes will be applied to all selected %s."), labels?.name.toLowerCase() ) }) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-content-information/index.js const post_content_information_AVERAGE_READING_RATE = 189; function PostContentInformation() { const { postContent } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedPostAttribute, getCurrentPostType, getCurrentPostId } = select(store_store); const { canUser } = select(external_wp_coreData_namespaceObject.store); const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser("read", { kind: "root", name: "site" }) ? getEntityRecord("root", "site") : void 0; const postType = getCurrentPostType(); const _id = getCurrentPostId(); const isPostsPage = +_id === siteSettings?.page_for_posts; const showPostContentInfo = !isPostsPage && ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes( postType ); return { postContent: showPostContentInfo && getEditedPostAttribute("content") }; }, []); const wordCountType = (0,external_wp_i18n_namespaceObject._x)("words", "Word count type. Do not translate!"); const wordsCounted = (0,external_wp_element_namespaceObject.useMemo)( () => postContent ? (0,external_wp_wordcount_namespaceObject.count)(postContent, wordCountType) : 0, [postContent, wordCountType] ); if (!wordsCounted) { return null; } const readingTime = Math.round(wordsCounted / post_content_information_AVERAGE_READING_RATE); const wordsCountText = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the number of words in the post. (0,external_wp_i18n_namespaceObject._n)("%s word", "%s words", wordsCounted), wordsCounted.toLocaleString() ); const minutesText = readingTime <= 1 ? (0,external_wp_i18n_namespaceObject.__)("1 minute") : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the number of minutes to read the post. */ (0,external_wp_i18n_namespaceObject._n)("%s minute", "%s minutes", readingTime), readingTime.toLocaleString() ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-content-information", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */ (0,external_wp_i18n_namespaceObject.__)("%1$s, %2$s read time."), wordsCountText, minutesText ) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-format/panel.js function panel_PostFormat() { const { postFormat } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedPostAttribute } = select(store_store); const _postFormat = getEditedPostAttribute("format"); return { postFormat: _postFormat ?? "standard" }; }, []); const activeFormat = POST_FORMATS.find( (format) => format.id === postFormat ); const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: "left-start", offset: 36, shift: true }), [popoverAnchor] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatCheck, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Format"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, contentClassName: "editor-post-format__dialog", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", variant: "tertiary", "aria-expanded": isOpen, "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Current post format. (0,external_wp_i18n_namespaceObject.__)("Change format: %s"), activeFormat?.caption ), onClick: onToggle, children: activeFormat?.caption } ), renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-format__dialog-content", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)("Format"), onClose } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormat, {}) ] }) } ) }) }); } var post_format_panel_panel_default = panel_PostFormat; ;// ./node_modules/@wordpress/editor/build-module/components/post-last-edited-panel/index.js function PostLastEditedPanel() { const modified = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getEditedPostAttribute("modified"), [] ); const lastEditedText = modified && (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Human-readable time difference, e.g. "2 days ago". (0,external_wp_i18n_namespaceObject.__)("Last edited %s."), (0,external_wp_date_namespaceObject.humanTimeDiff)(modified) ); if (!lastEditedText) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-last-edited-panel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: lastEditedText }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-panel-section/index.js function PostPanelSection({ className, children }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: dist_clsx("editor-post-panel__section", className), children }); } var post_panel_section_default = PostPanelSection; ;// ./node_modules/@wordpress/editor/build-module/components/blog-title/index.js const blog_title_EMPTY_OBJECT = {}; function BlogTitle() { const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { postsPageTitle, postsPageId, isTemplate, postSlug } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEntityRecord, getEditedEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser("read", { kind: "root", name: "site" }) ? getEntityRecord("root", "site") : void 0; const _postsPageRecord = siteSettings?.page_for_posts ? getEditedEntityRecord( "postType", "page", siteSettings?.page_for_posts ) : blog_title_EMPTY_OBJECT; const { getEditedPostAttribute, getCurrentPostType } = select(store_store); return { postsPageId: _postsPageRecord?.id, postsPageTitle: _postsPageRecord?.title, isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, postSlug: getEditedPostAttribute("slug") }; }, [] ); const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: "left-start", offset: 36, shift: true }), [popoverAnchor] ); if (!isTemplate || !["home", "index"].includes(postSlug) || !postsPageId) { return null; } const setPostsPageTitle = (newValue) => { editEntityRecord("postType", "page", postsPageId, { title: newValue }); }; const decodedTitle = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postsPageTitle); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Blog title"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, contentClassName: "editor-blog-title-dropdown__content", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", variant: "tertiary", "aria-expanded": isOpen, "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Current post link. (0,external_wp_i18n_namespaceObject.__)("Change blog title: %s"), decodedTitle ), onClick: onToggle, children: decodedTitle } ), renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)("Blog title"), onClose } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalInputControl, { placeholder: (0,external_wp_i18n_namespaceObject.__)("No title"), size: "__unstable-large", value: postsPageTitle, onChange: (0,external_wp_compose_namespaceObject.debounce)(setPostsPageTitle, 300), label: (0,external_wp_i18n_namespaceObject.__)("Blog title"), help: (0,external_wp_i18n_namespaceObject.__)( "Set the Posts Page title. Appears in search results, and when the page is shared on social media." ), hideLabelFromVision: true } ) ] }) } ) }); } ;// ./node_modules/@wordpress/editor/build-module/components/posts-per-page/index.js function PostsPerPage() { const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { postsPerPage, isTemplate, postSlug } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedPostAttribute, getCurrentPostType } = select(store_store); const { getEditedEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser("read", { kind: "root", name: "site" }) ? getEditedEntityRecord("root", "site") : void 0; return { isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, postSlug: getEditedPostAttribute("slug"), postsPerPage: siteSettings?.posts_per_page || 1 }; }, []); const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: "left-start", offset: 36, shift: true }), [popoverAnchor] ); if (!isTemplate || !["home", "index"].includes(postSlug)) { return null; } const setPostsPerPage = (newValue) => { editEntityRecord("root", "site", void 0, { posts_per_page: newValue }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Posts per page"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, contentClassName: "editor-posts-per-page-dropdown__content", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", variant: "tertiary", "aria-expanded": isOpen, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Change posts per page"), onClick: onToggle, children: postsPerPage } ), renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)("Posts per page"), onClose } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalNumberControl, { placeholder: 0, value: postsPerPage, size: "__unstable-large", spinControls: "custom", step: "1", min: "1", onChange: setPostsPerPage, label: (0,external_wp_i18n_namespaceObject.__)("Posts per page"), help: (0,external_wp_i18n_namespaceObject.__)( "Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting." ), hideLabelFromVision: true } ) ] }) } ) }); } ;// ./node_modules/@wordpress/editor/build-module/components/site-discussion/index.js const site_discussion_COMMENT_OPTIONS = [ { label: (0,external_wp_i18n_namespaceObject._x)("Open", 'Adjective: e.g. "Comments are open"'), value: "open", description: (0,external_wp_i18n_namespaceObject.__)("Visitors can add new comments and replies.") }, { label: (0,external_wp_i18n_namespaceObject.__)("Closed"), value: "", description: [ (0,external_wp_i18n_namespaceObject.__)("Visitors cannot add new comments or replies."), (0,external_wp_i18n_namespaceObject.__)("Existing comments remain visible.") ].join(" ") } ]; function SiteDiscussion() { const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { allowCommentsOnNewPosts, isTemplate, postSlug } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEditedPostAttribute, getCurrentPostType } = select(store_store); const { getEditedEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser("read", { kind: "root", name: "site" }) ? getEditedEntityRecord("root", "site") : void 0; return { isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, postSlug: getEditedPostAttribute("slug"), allowCommentsOnNewPosts: siteSettings?.default_comment_status || "" }; }, [] ); const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ // Anchor the popover to the middle of the entire row so that it doesn't // move around when the label changes. anchor: popoverAnchor, placement: "left-start", offset: 36, shift: true }), [popoverAnchor] ); if (!isTemplate || !["home", "index"].includes(postSlug)) { return null; } const setAllowCommentsOnNewPosts = (newValue) => { editEntityRecord("root", "site", void 0, { default_comment_status: newValue ? "open" : null }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Discussion"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, contentClassName: "editor-site-discussion-dropdown__content", focusOnMount: true, renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", variant: "tertiary", "aria-expanded": isOpen, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Change discussion settings"), onClick: onToggle, children: allowCommentsOnNewPosts ? (0,external_wp_i18n_namespaceObject.__)("Comments open") : (0,external_wp_i18n_namespaceObject.__)("Comments closed") } ), renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { title: (0,external_wp_i18n_namespaceObject.__)("Discussion"), onClose } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)( "Changes will apply to new posts only. Individual posts may override these settings." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.RadioControl, { className: "editor-site-discussion__options", hideLabelFromVision: true, label: (0,external_wp_i18n_namespaceObject.__)("Comment status"), options: site_discussion_COMMENT_OPTIONS, onChange: setAllowCommentsOnNewPosts, selected: allowCommentsOnNewPosts } ) ] }) ] }) } ) }); } ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/post-summary.js const post_summary_PANEL_NAME = "post-status"; function PostSummary({ onActionPerformed }) { const { isRemovedPostStatusPanel, postType, postId } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { isEditorPanelRemoved, getCurrentPostType, getCurrentPostId } = select(store_store); return { isRemovedPostStatusPanel: isEditorPanelRemoved(post_summary_PANEL_NAME), postType: getCurrentPostType(), postId: getCurrentPostId() }; }, [] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_section_default, { className: "editor-post-summary", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_status_info_default.Slot, { children: (fills) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PostCardPanel, { postType, postId, onActionPerformed } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFeaturedImagePanel, { withPanelBody: false }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostExcerptPanel, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostContentInformation, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostLastEditedPanel, {}) ] }), !isRemovedPostStatusPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostStatus, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedulePanel, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLPanel, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(panel_default, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplatePanel, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostDiscussionPanel, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostLastRevision, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesPanel, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSyncStatus, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlogTitle, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsPerPage, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteDiscussion, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_format_panel_panel_default, {}), fills ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PostTrash, { onActionPerformed } ) ] }) ] }) }) }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-transform-panel/hooks.js const { EXCLUDED_PATTERN_SOURCES, PATTERN_TYPES: hooks_PATTERN_TYPES } = unlock(external_wp_patterns_namespaceObject.privateApis); function injectThemeAttributeInBlockTemplateContent(block, currentThemeStylesheet) { block.innerBlocks = block.innerBlocks.map((innerBlock) => { return injectThemeAttributeInBlockTemplateContent( innerBlock, currentThemeStylesheet ); }); if (block.name === "core/template-part" && block.attributes.theme === void 0) { block.attributes.theme = currentThemeStylesheet; } return block; } function filterPatterns(patterns, template) { const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex((item) => currentItem.name === item.name); const filterOutExcludedPatternSources = (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source); const filterCompatiblePatterns = (pattern) => pattern.templateTypes?.includes(template.slug) || pattern.blockTypes?.includes("core/template-part/" + template.area); return patterns.filter((pattern, index, items) => { return filterOutDuplicatesByName(pattern, index, items) && filterOutExcludedPatternSources(pattern) && filterCompatiblePatterns(pattern); }); } function preparePatterns(patterns, currentThemeStylesheet) { return patterns.map((pattern) => ({ ...pattern, keywords: pattern.keywords || [], type: hooks_PATTERN_TYPES.theme, blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { __unstableSkipMigrationLogs: true }).map( (block) => injectThemeAttributeInBlockTemplateContent( block, currentThemeStylesheet ) ) })); } function useAvailablePatterns({ area, name, slug }) { const { blockPatterns, restBlockPatterns, currentThemeStylesheet } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditorSettings } = select(store_store); const settings = getEditorSettings(); return { blockPatterns: settings.__experimentalAdditionalBlockPatterns ?? settings.__experimentalBlockPatterns, restBlockPatterns: select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), currentThemeStylesheet: select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet }; }, []); return (0,external_wp_element_namespaceObject.useMemo)(() => { const mergedPatterns = [ ...blockPatterns || [], ...restBlockPatterns || [] ]; const filteredPatterns = filterPatterns(mergedPatterns, { area, name, slug }); return preparePatterns(filteredPatterns, currentThemeStylesheet); }, [ area, name, slug, blockPatterns, restBlockPatterns, currentThemeStylesheet ]); } ;// ./node_modules/@wordpress/editor/build-module/components/post-transform-panel/index.js function post_transform_panel_TemplatesList({ availableTemplates, onSelect }) { if (!availableTemplates || availableTemplates?.length === 0) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { label: (0,external_wp_i18n_namespaceObject.__)("Templates"), blockPatterns: availableTemplates, onClickPattern: onSelect, showTitlesAsTooltip: true } ); } function PostTransform() { const { area, name, slug, postType, postId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostType, getCurrentPostId } = select(store_store); const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const type = getCurrentPostType(); const id = getCurrentPostId(); const record = getEditedEntityRecord("postType", type, id); return { area: record?.area, name: record?.name, slug: record?.slug, postType: type, postId: id }; }, []); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const availablePatterns = useAvailablePatterns({ area, name, slug }); const onTemplateSelect = async (selectedTemplate) => { await editEntityRecord("postType", postType, postId, { blocks: selectedTemplate.blocks, content: (0,external_wp_blocks_namespaceObject.serialize)(selectedTemplate.blocks) }); }; if (!availablePatterns?.length) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Design"), initialOpen: postType === TEMPLATE_PART_POST_TYPE, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( post_transform_panel_TemplatesList, { availableTemplates: availablePatterns, onSelect: onTemplateSelect } ) } ); } function PostTransformPanel() { const { postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostType } = select(store_store); return { postType: getCurrentPostType() }; }, []); if (![TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE].includes(postType)) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTransform, {}); } ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/constants.js const sidebars = { document: "edit-post/document", block: "edit-post/block" }; ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/header.js const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis); const SidebarHeader = (_, ref) => { const { documentLabel } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getPostTypeLabel } = select(store_store); return { documentLabel: ( // translators: Default label for the Document sidebar tab, not selected. getPostTypeLabel() || (0,external_wp_i18n_namespaceObject._x)("Document", "noun, panel") ) }; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.TabList, { ref, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Tabs.Tab, { tabId: sidebars.document, "data-tab-id": sidebars.document, children: documentLabel } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Tabs.Tab, { tabId: sidebars.block, "data-tab-id": sidebars.block, children: (0,external_wp_i18n_namespaceObject.__)("Block") } ) ] }); }; var sidebar_header_header_default = (0,external_wp_element_namespaceObject.forwardRef)(SidebarHeader); ;// ./node_modules/@wordpress/editor/build-module/components/template-content-panel/index.js const { BlockQuickNavigation } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const template_content_panel_POST_CONTENT_BLOCK_TYPES = [ "core/post-title", "core/post-featured-image", "core/post-content" ]; const TEMPLATE_PART_BLOCK = "core/template-part"; function TemplateContentPanel() { const postContentBlockTypes = (0,external_wp_element_namespaceObject.useMemo)( () => (0,external_wp_hooks_namespaceObject.applyFilters)( "editor.postContentBlockTypes", template_content_panel_POST_CONTENT_BLOCK_TYPES ), [] ); const { clientIds, postType, renderingMode } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getCurrentPostType, getPostBlocksByName, getRenderingMode } = unlock(select(store_store)); const _postType = getCurrentPostType(); return { postType: _postType, clientIds: getPostBlocksByName( TEMPLATE_POST_TYPE === _postType ? TEMPLATE_PART_BLOCK : postContentBlockTypes ), renderingMode: getRenderingMode() }; }, [postContentBlockTypes] ); const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (renderingMode === "post-only" && postType !== TEMPLATE_POST_TYPE || clientIds.length === 0) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Content"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockQuickNavigation, { clientIds, onSelect: () => { enableComplementaryArea("core", "edit-post/document"); } } ) }); } ;// ./node_modules/@wordpress/editor/build-module/components/template-part-content-panel/index.js const { BlockQuickNavigation: template_part_content_panel_BlockQuickNavigation } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function TemplatePartContentPanelInner() { const blockTypes = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getBlockTypes } = select(external_wp_blocks_namespaceObject.store); return getBlockTypes(); }, []); const themeBlockNames = (0,external_wp_element_namespaceObject.useMemo)(() => { return blockTypes.filter((blockType) => { return blockType.category === "theme"; }).map(({ name }) => name); }, [blockTypes]); const themeBlocks = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlocksByName } = select(external_wp_blockEditor_namespaceObject.store); return getBlocksByName(themeBlockNames); }, [themeBlockNames] ); if (themeBlocks.length === 0) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Content"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(template_part_content_panel_BlockQuickNavigation, { clientIds: themeBlocks }) }); } function TemplatePartContentPanel() { const postType = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostType } = select(store_store); return getCurrentPostType(); }, []); if (postType !== TEMPLATE_PART_POST_TYPE) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartContentPanelInner, {}); } ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-auto-switch-editor-sidebars.js function useAutoSwitchEditorSidebars() { const { hasBlockSelection } = (0,external_wp_data_namespaceObject.useSelect)((select) => { return { hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() }; }, []); const { getActiveComplementaryArea } = (0,external_wp_data_namespaceObject.useSelect)(store); const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { get: getPreference } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { const activeGeneralSidebar = getActiveComplementaryArea("core"); const isEditorSidebarOpened = [ "edit-post/document", "edit-post/block" ].includes(activeGeneralSidebar); const isDistractionFree = getPreference("core", "distractionFree"); if (!isEditorSidebarOpened || isDistractionFree) { return; } if (hasBlockSelection) { enableComplementaryArea("core", "edit-post/block"); } else { enableComplementaryArea("core", "edit-post/document"); } }, [ hasBlockSelection, getActiveComplementaryArea, enableComplementaryArea, getPreference ]); } var use_auto_switch_editor_sidebars_default = useAutoSwitchEditorSidebars; ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/index.js const { Tabs: sidebar_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({ web: true, native: false }); const SidebarContent = ({ tabName, keyboardShortcut, onActionPerformed, extraPanels }) => { const tabListRef = (0,external_wp_element_namespaceObject.useRef)(null); const tabsContextValue = (0,external_wp_element_namespaceObject.useContext)(sidebar_Tabs.Context); (0,external_wp_element_namespaceObject.useEffect)(() => { const tabsElements = Array.from( tabListRef.current?.querySelectorAll('[role="tab"]') || [] ); const selectedTabElement = tabsElements.find( // We are purposefully using a custom `data-tab-id` attribute here // because we don't want rely on any assumptions about `Tabs` // component internals. (element) => element.getAttribute("data-tab-id") === tabName ); const activeElement = selectedTabElement?.ownerDocument.activeElement; const tabsHasFocus = tabsElements.some((element) => { return activeElement && activeElement.id === element.id; }); if (tabsHasFocus && selectedTabElement && selectedTabElement.id !== activeElement?.id) { selectedTabElement?.focus(); } }, [tabName]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PluginSidebar, { identifier: tabName, header: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs.Context.Provider, { value: tabsContextValue, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_header_header_default, { ref: tabListRef }) }), closeLabel: (0,external_wp_i18n_namespaceObject.__)("Close Settings"), className: "editor-sidebar__panel", headerClassName: "editor-sidebar__panel-tabs", title: ( /* translators: button label text should, if possible, be under 16 characters. */ (0,external_wp_i18n_namespaceObject._x)("Settings", "panel button label") ), toggleShortcut: keyboardShortcut, icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left_default : drawer_right_default, isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(sidebar_Tabs.Context.Provider, { value: tabsContextValue, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(sidebar_Tabs.TabPanel, { tabId: sidebars.document, focusable: false, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSummary, { onActionPerformed }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_document_setting_panel_default.Slot, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateContentPanel, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartContentPanel, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTransformPanel, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(panel_PostTaxonomies, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesPanel, {}), extraPanels ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs.TabPanel, { tabId: sidebars.block, focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockInspector, {}) }) ] }) } ); }; const Sidebar = ({ extraPanels, onActionPerformed }) => { use_auto_switch_editor_sidebars_default(); const { tabName, keyboardShortcut, showSummary } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const shortcut = select( external_wp_keyboardShortcuts_namespaceObject.store ).getShortcutRepresentation("core/editor/toggle-sidebar"); const sidebar = select(store).getActiveComplementaryArea("core"); const _isEditorSidebarOpened = [ sidebars.block, sidebars.document ].includes(sidebar); let _tabName = sidebar; if (!_isEditorSidebarOpened) { _tabName = !!select( external_wp_blockEditor_namespaceObject.store ).getBlockSelectionStart() ? sidebars.block : sidebars.document; } return { tabName: _tabName, keyboardShortcut: shortcut, showSummary: ![ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE ].includes(select(store_store).getCurrentPostType()) }; }, [] ); const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); const onTabSelect = (0,external_wp_element_namespaceObject.useCallback)( (newSelectedTabId) => { if (!!newSelectedTabId) { enableComplementaryArea("core", newSelectedTabId); } }, [enableComplementaryArea] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( sidebar_Tabs, { selectedTabId: tabName, onSelect: onTabSelect, selectOnMove: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarContent, { tabName, keyboardShortcut, showSummary, onActionPerformed, extraPanels } ) } ); }; var sidebar_sidebar_default = Sidebar; ;// ./node_modules/@wordpress/icons/build-module/library/comment.js var comment_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: "M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z" }) }); ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/constants.js const collabHistorySidebarName = "edit-post/collab-history-sidebar"; const collabSidebarName = "edit-post/collab-sidebar"; const SIDEBARS = [collabHistorySidebarName, collabSidebarName]; ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/utils.js function sanitizeCommentString(str) { return str.trim(); } function utils_noop() { } const AVATAR_BORDER_COLORS = [ "#3858E9", // Blueberry "#9fB1FF", // Blueberry 2 "#1D35B4", // Dark Blueberry "#1A1919", // Charcoal 0 "#E26F56", // Pomegranate "#33F078", // Acid Green "#FFF972", // Lemon "#7A00DF" // Purple ]; function getAvatarBorderColor(userId) { return AVATAR_BORDER_COLORS[userId % AVATAR_BORDER_COLORS.length]; } function getCommentExcerpt(text, excerptLength = 10) { if (!text) { return ""; } const wordCountType = (0,external_wp_i18n_namespaceObject._x)("words", "Word count type. Do not translate!"); const rawText = text.trim(); let trimmedExcerpt = ""; if (wordCountType === "words") { trimmedExcerpt = rawText.split(" ", excerptLength).join(" "); } else if (wordCountType === "characters_excluding_spaces") { const textWithSpaces = rawText.split("", excerptLength).join(""); const numberOfSpaces = textWithSpaces.length - textWithSpaces.replaceAll(" ", "").length; trimmedExcerpt = rawText.split("", excerptLength + numberOfSpaces).join(""); } else if (wordCountType === "characters_including_spaces") { trimmedExcerpt = rawText.split("", excerptLength).join(""); } const isTrimmed = trimmedExcerpt !== rawText; return isTrimmed ? trimmedExcerpt + "\u2026" : trimmedExcerpt; } function focusCommentThread(commentId, container, additionalSelector) { if (!container) { return; } const threadSelector = commentId ? `[role=treeitem][id="comment-thread-${commentId}"]` : "[role=treeitem]:not([id])"; const selector = additionalSelector ? `${threadSelector} ${additionalSelector}` : threadSelector; return new Promise((resolve) => { if (container.querySelector(selector)) { return resolve(container.querySelector(selector)); } let timer = null; const observer = new window.MutationObserver(() => { if (container.querySelector(selector)) { clearTimeout(timer); observer.disconnect(); resolve(container.querySelector(selector)); } }); observer.observe(container, { childList: true, subtree: true }); timer = setTimeout(() => { observer.disconnect(); resolve(null); }, 3e3); }).then((element) => element?.focus()); } ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-author-info.js function CommentAuthorInfo({ avatar, name, date, userId }) { const hasAvatar = !!avatar; const dateSettings = (0,external_wp_date_namespaceObject.getSettings)(); const { currentUserAvatar, currentUserName, currentUserId, dateFormat = dateSettings.formats.date } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { canUser, getCurrentUser, getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser("read", { kind: "root", name: "site" }) ? getEntityRecord("root", "site") : void 0; if (hasAvatar) { return { dateFormat: siteSettings?.date_format }; } const { getSettings } = select(external_wp_blockEditor_namespaceObject.store); const { __experimentalDiscussionSettings } = getSettings(); const defaultAvatar = __experimentalDiscussionSettings?.avatarURL; const userData = getCurrentUser(); return { currentUserAvatar: userData?.avatar_urls?.[48] ?? defaultAvatar, currentUserName: userData?.name, currentUserId: userData?.id, dateFormat: siteSettings?.date_format }; }, [hasAvatar] ); const commentDate = (0,external_wp_date_namespaceObject.getDate)(date); const commentDateTime = (0,external_wp_date_namespaceObject.dateI18n)("c", commentDate); const shouldShowHumanTimeDiff = Math.floor((/* @__PURE__ */ new Date() - commentDate) / (1e3 * 60 * 60 * 24)) < 30; const commentDateText = shouldShowHumanTimeDiff ? (0,external_wp_date_namespaceObject.humanTimeDiff)(commentDate) : (0,external_wp_date_namespaceObject.dateI18n)(dateFormat, commentDate); const tooltipText = (0,external_wp_date_namespaceObject.dateI18n)( // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate. (0,external_wp_i18n_namespaceObject._x)("F j, Y g:i\xA0a", "Note date full date format"), date ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { src: avatar || currentUserAvatar, className: "editor-collab-sidebar-panel__user-avatar", alt: (0,external_wp_i18n_namespaceObject.__)("User avatar"), width: 32, height: 32, style: { borderColor: getAvatarBorderColor( userId ?? currentUserId ) } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "0", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-collab-sidebar-panel__user-name", children: name ?? currentUserName }), date && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: tooltipText, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "time", { dateTime: commentDateTime, className: "editor-collab-sidebar-panel__user-time", children: commentDateText } ) }) ] }) ] }); } var comment_author_info_default = CommentAuthorInfo; ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-form.js function CommentForm({ onSubmit, onCancel, thread, submitButtonText, labelText, reflowComments = utils_noop }) { const [inputComment, setInputComment] = (0,external_wp_element_namespaceObject.useState)( thread?.content?.raw ?? "" ); const debouncedCommentUpdated = (0,external_wp_compose_namespaceObject.useDebounce)(reflowComments, 100); const updateComment = (value) => { setInputComment(value); }; const inputId = (0,external_wp_compose_namespaceObject.useInstanceId)(CommentForm, "comment-input"); const isDisabled = inputComment === thread?.content?.raw || !sanitizeCommentString(inputComment).length; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { className: "editor-collab-sidebar-panel__comment-form", spacing: "4", as: "form", onSubmit: (event) => { event.preventDefault(); onSubmit(inputComment); setInputComment(""); }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "label", htmlFor: inputId, children: labelText ?? (0,external_wp_i18n_namespaceObject.__)("Note") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( lib/* default */.A, { id: inputId, value: inputComment ?? "", onChange: (comment) => { updateComment(comment.target.value); debouncedCommentUpdated(); }, rows: 1, maxRows: 20, onKeyDown: (event) => { if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, "Enter") && !isDisabled) { event.target.parentNode.requestSubmit(); } } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: "2", justify: "flex-end", wrap: true, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", variant: "tertiary", onClick: onCancel, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { children: (0,external_wp_i18n_namespaceObject.__)("Cancel") }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", accessibleWhenDisabled: true, variant: "primary", type: "submit", disabled: isDisabled, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { children: submitButtonText }) } ) ] }) ] } ); } var comment_form_default = CommentForm; ;// ./node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs const floating_ui_utils_sides = (/* unused pure expression or super */ null && (['top', 'right', 'bottom', 'left'])); const alignments = (/* unused pure expression or super */ null && (['start', 'end'])); const floating_ui_utils_placements = /*#__PURE__*/(/* unused pure expression or super */ null && (floating_ui_utils_sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []))); const floating_ui_utils_min = Math.min; const floating_ui_utils_max = Math.max; const round = Math.round; const floor = Math.floor; const createCoords = v => ({ x: v, y: v }); const oppositeSideMap = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; const oppositeAlignmentMap = { start: 'end', end: 'start' }; function floating_ui_utils_clamp(start, value, end) { return floating_ui_utils_max(start, floating_ui_utils_min(value, end)); } function floating_ui_utils_evaluate(value, param) { return typeof value === 'function' ? value(param) : value; } function floating_ui_utils_getSide(placement) { return placement.split('-')[0]; } function floating_ui_utils_getAlignment(placement) { return placement.split('-')[1]; } function floating_ui_utils_getOppositeAxis(axis) { return axis === 'x' ? 'y' : 'x'; } function floating_ui_utils_getAxisLength(axis) { return axis === 'y' ? 'height' : 'width'; } function floating_ui_utils_getSideAxis(placement) { return ['top', 'bottom'].includes(floating_ui_utils_getSide(placement)) ? 'y' : 'x'; } function floating_ui_utils_getAlignmentAxis(placement) { return floating_ui_utils_getOppositeAxis(floating_ui_utils_getSideAxis(placement)); } function floating_ui_utils_getAlignmentSides(placement, rects, rtl) { if (rtl === void 0) { rtl = false; } const alignment = floating_ui_utils_getAlignment(placement); const alignmentAxis = floating_ui_utils_getAlignmentAxis(placement); const length = floating_ui_utils_getAxisLength(alignmentAxis); let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top'; if (rects.reference[length] > rects.floating[length]) { mainAlignmentSide = floating_ui_utils_getOppositePlacement(mainAlignmentSide); } return [mainAlignmentSide, floating_ui_utils_getOppositePlacement(mainAlignmentSide)]; } function floating_ui_utils_getExpandedPlacements(placement) { const oppositePlacement = floating_ui_utils_getOppositePlacement(placement); return [floating_ui_utils_getOppositeAlignmentPlacement(placement), oppositePlacement, floating_ui_utils_getOppositeAlignmentPlacement(oppositePlacement)]; } function floating_ui_utils_getOppositeAlignmentPlacement(placement) { return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]); } function getSideList(side, isStart, rtl) { const lr = ['left', 'right']; const rl = ['right', 'left']; const tb = ['top', 'bottom']; const bt = ['bottom', 'top']; switch (side) { case 'top': case 'bottom': if (rtl) return isStart ? rl : lr; return isStart ? lr : rl; case 'left': case 'right': return isStart ? tb : bt; default: return []; } } function floating_ui_utils_getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { const alignment = floating_ui_utils_getAlignment(placement); let list = getSideList(floating_ui_utils_getSide(placement), direction === 'start', rtl); if (alignment) { list = list.map(side => side + "-" + alignment); if (flipAlignment) { list = list.concat(list.map(floating_ui_utils_getOppositeAlignmentPlacement)); } } return list; } function floating_ui_utils_getOppositePlacement(placement) { return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]); } function expandPaddingObject(padding) { return { top: 0, right: 0, bottom: 0, left: 0, ...padding }; } function floating_ui_utils_getPaddingObject(padding) { return typeof padding !== 'number' ? expandPaddingObject(padding) : { top: padding, right: padding, bottom: padding, left: padding }; } function floating_ui_utils_rectToClientRect(rect) { return { ...rect, top: rect.y, left: rect.x, right: rect.x + rect.width, bottom: rect.y + rect.height }; } ;// ./node_modules/@floating-ui/core/dist/floating-ui.core.mjs function computeCoordsFromPlacement(_ref, placement, rtl) { let { reference, floating } = _ref; const sideAxis = floating_ui_utils_getSideAxis(placement); const alignmentAxis = floating_ui_utils_getAlignmentAxis(placement); const alignLength = floating_ui_utils_getAxisLength(alignmentAxis); const side = floating_ui_utils_getSide(placement); const isVertical = sideAxis === 'y'; const commonX = reference.x + reference.width / 2 - floating.width / 2; const commonY = reference.y + reference.height / 2 - floating.height / 2; const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; let coords; switch (side) { case 'top': coords = { x: commonX, y: reference.y - floating.height }; break; case 'bottom': coords = { x: commonX, y: reference.y + reference.height }; break; case 'right': coords = { x: reference.x + reference.width, y: commonY }; break; case 'left': coords = { x: reference.x - floating.width, y: commonY }; break; default: coords = { x: reference.x, y: reference.y }; } switch (floating_ui_utils_getAlignment(placement)) { case 'start': coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); break; case 'end': coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); break; } return coords; } /** * Computes the `x` and `y` coordinates that will place the floating element * next to a reference element when it is given a certain positioning strategy. * * This export does not have any `platform` interface logic. You will need to * write one for the platform you are using Floating UI with. */ const computePosition = async (reference, floating, config) => { const { placement = 'bottom', strategy = 'absolute', middleware = [], platform } = config; const validMiddleware = middleware.filter(Boolean); const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating)); let rects = await platform.getElementRects({ reference, floating, strategy }); let { x, y } = computeCoordsFromPlacement(rects, placement, rtl); let statefulPlacement = placement; let middlewareData = {}; let resetCount = 0; for (let i = 0; i < validMiddleware.length; i++) { const { name, fn } = validMiddleware[i]; const { x: nextX, y: nextY, data, reset } = await fn({ x, y, initialPlacement: placement, placement: statefulPlacement, strategy, middlewareData, rects, platform, elements: { reference, floating } }); x = nextX != null ? nextX : x; y = nextY != null ? nextY : y; middlewareData = { ...middlewareData, [name]: { ...middlewareData[name], ...data } }; if (reset && resetCount <= 50) { resetCount++; if (typeof reset === 'object') { if (reset.placement) { statefulPlacement = reset.placement; } if (reset.rects) { rects = reset.rects === true ? await platform.getElementRects({ reference, floating, strategy }) : reset.rects; } ({ x, y } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); } i = -1; continue; } } return { x, y, placement: statefulPlacement, strategy, middlewareData }; }; /** * Resolves with an object of overflow side offsets that determine how much the * element is overflowing a given clipping boundary on each side. * - positive = overflowing the boundary by that number of pixels * - negative = how many pixels left before it will overflow * - 0 = lies flush with the boundary * @see https://floating-ui.com/docs/detectOverflow */ async function detectOverflow(state, options) { var _await$platform$isEle; if (options === void 0) { options = {}; } const { x, y, platform, rects, elements, strategy } = state; const { boundary = 'clippingAncestors', rootBoundary = 'viewport', elementContext = 'floating', altBoundary = false, padding = 0 } = evaluate(options, state); const paddingObject = getPaddingObject(padding); const altContext = elementContext === 'floating' ? 'reference' : 'floating'; const element = elements[altBoundary ? altContext : elementContext]; const clippingClientRect = rectToClientRect(await platform.getClippingRect({ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))), boundary, rootBoundary, strategy })); const rect = elementContext === 'floating' ? { ...rects.floating, x, y } : rects.reference; const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)); const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || { x: 1, y: 1 } : { x: 1, y: 1 }; const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({ rect, offsetParent, strategy }) : rect); return { top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x }; } /** * Provides data to position an inner element of the floating element so that it * appears centered to the reference element. * @see https://floating-ui.com/docs/arrow */ const arrow = options => ({ name: 'arrow', options, async fn(state) { const { x, y, placement, rects, platform, elements, middlewareData } = state; // Since `element` is required, we don't Partial<> the type. const { element, padding = 0 } = evaluate(options, state) || {}; if (element == null) { return {}; } const paddingObject = getPaddingObject(padding); const coords = { x, y }; const axis = getAlignmentAxis(placement); const length = getAxisLength(axis); const arrowDimensions = await platform.getDimensions(element); const isYAxis = axis === 'y'; const minProp = isYAxis ? 'top' : 'left'; const maxProp = isYAxis ? 'bottom' : 'right'; const clientProp = isYAxis ? 'clientHeight' : 'clientWidth'; const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; const startDiff = coords[axis] - rects.reference[axis]; const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element)); let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0; // DOM platform can return `window` as the `offsetParent`. if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) { clientSize = elements.floating[clientProp] || rects.floating[length]; } const centerToReference = endDiff / 2 - startDiff / 2; // If the padding is large enough that it causes the arrow to no longer be // centered, modify the padding so that it is centered. const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; const minPadding = min(paddingObject[minProp], largestPossiblePadding); const maxPadding = min(paddingObject[maxProp], largestPossiblePadding); // Make sure the arrow doesn't overflow the floating element if the center // point is outside the floating element's bounds. const min$1 = minPadding; const max = clientSize - arrowDimensions[length] - maxPadding; const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; const offset = clamp(min$1, center, max); // If the reference is small enough that the arrow's padding causes it to // to point to nothing for an aligned placement, adjust the offset of the // floating element itself. To ensure `shift()` continues to take action, // a single reset is performed when this is true. const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0; return { [axis]: coords[axis] + alignmentOffset, data: { [axis]: offset, centerOffset: center - offset - alignmentOffset, ...(shouldAddOffset && { alignmentOffset }) }, reset: shouldAddOffset }; } }); function getPlacementList(alignment, autoAlignment, allowedPlacements) { const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement); return allowedPlacementsSortedByAlignment.filter(placement => { if (alignment) { return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false); } return true; }); } /** * Optimizes the visibility of the floating element by choosing the placement * that has the most space available automatically, without needing to specify a * preferred placement. Alternative to `flip`. * @see https://floating-ui.com/docs/autoPlacement */ const autoPlacement = function (options) { if (options === void 0) { options = {}; } return { name: 'autoPlacement', options, async fn(state) { var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE; const { rects, middlewareData, placement, platform, elements } = state; const { crossAxis = false, alignment, allowedPlacements = placements, autoAlignment = true, ...detectOverflowOptions } = evaluate(options, state); const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements; const overflow = await detectOverflow(state, detectOverflowOptions); const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0; const currentPlacement = placements$1[currentIndex]; if (currentPlacement == null) { return {}; } const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))); // Make `computeCoords` start from the right place. if (placement !== currentPlacement) { return { reset: { placement: placements$1[0] } }; } const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]]; const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), { placement: currentPlacement, overflows: currentOverflows }]; const nextPlacement = placements$1[currentIndex + 1]; // There are more placements to check. if (nextPlacement) { return { data: { index: currentIndex + 1, overflows: allOverflows }, reset: { placement: nextPlacement } }; } const placementsSortedByMostSpace = allOverflows.map(d => { const alignment = getAlignment(d.placement); return [d.placement, alignment && crossAxis ? // Check along the mainAxis and main crossAxis side. d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) : // Check only the mainAxis. d.overflows[0], d.overflows]; }).sort((a, b) => a[1] - b[1]); const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0, // Aligned placements should not check their opposite crossAxis // side. getAlignment(d[0]) ? 2 : 3).every(v => v <= 0)); const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0]; if (resetPlacement !== placement) { return { data: { index: currentIndex + 1, overflows: allOverflows }, reset: { placement: resetPlacement } }; } return {}; } }; }; /** * Optimizes the visibility of the floating element by flipping the `placement` * in order to keep it in view when the preferred placement(s) will overflow the * clipping boundary. Alternative to `autoPlacement`. * @see https://floating-ui.com/docs/flip */ const flip = function (options) { if (options === void 0) { options = {}; } return { name: 'flip', options, async fn(state) { var _middlewareData$arrow, _middlewareData$flip; const { placement, middlewareData, rects, initialPlacement, platform, elements } = state; const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = 'bestFit', fallbackAxisSideDirection = 'none', flipAlignment = true, ...detectOverflowOptions } = evaluate(options, state); // If a reset by the arrow was caused due to an alignment offset being // added, we should skip any logic now since `flip()` has already done its // work. // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { return {}; } const side = getSide(placement); const isBasePlacement = getSide(initialPlacement) === initialPlacement; const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') { fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); } const placements = [initialPlacement, ...fallbackPlacements]; const overflow = await detectOverflow(state, detectOverflowOptions); const overflows = []; let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; if (checkMainAxis) { overflows.push(overflow[side]); } if (checkCrossAxis) { const sides = getAlignmentSides(placement, rects, rtl); overflows.push(overflow[sides[0]], overflow[sides[1]]); } overflowsData = [...overflowsData, { placement, overflows }]; // One or more sides is overflowing. if (!overflows.every(side => side <= 0)) { var _middlewareData$flip2, _overflowsData$filter; const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; const nextPlacement = placements[nextIndex]; if (nextPlacement) { // Try next placement and re-run the lifecycle. return { data: { index: nextIndex, overflows: overflowsData }, reset: { placement: nextPlacement } }; } // First, find the candidates that fit on the mainAxis side of overflow, // then find the placement that fits the best on the main crossAxis side. let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; // Otherwise fallback. if (!resetPlacement) { switch (fallbackStrategy) { case 'bestFit': { var _overflowsData$map$so; const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0]; if (placement) { resetPlacement = placement; } break; } case 'initialPlacement': resetPlacement = initialPlacement; break; } } if (placement !== resetPlacement) { return { reset: { placement: resetPlacement } }; } } return {}; } }; }; function getSideOffsets(overflow, rect) { return { top: overflow.top - rect.height, right: overflow.right - rect.width, bottom: overflow.bottom - rect.height, left: overflow.left - rect.width }; } function isAnySideFullyClipped(overflow) { return sides.some(side => overflow[side] >= 0); } /** * Provides data to hide the floating element in applicable situations, such as * when it is not in the same clipping context as the reference element. * @see https://floating-ui.com/docs/hide */ const hide = function (options) { if (options === void 0) { options = {}; } return { name: 'hide', options, async fn(state) { const { rects } = state; const { strategy = 'referenceHidden', ...detectOverflowOptions } = evaluate(options, state); switch (strategy) { case 'referenceHidden': { const overflow = await detectOverflow(state, { ...detectOverflowOptions, elementContext: 'reference' }); const offsets = getSideOffsets(overflow, rects.reference); return { data: { referenceHiddenOffsets: offsets, referenceHidden: isAnySideFullyClipped(offsets) } }; } case 'escaped': { const overflow = await detectOverflow(state, { ...detectOverflowOptions, altBoundary: true }); const offsets = getSideOffsets(overflow, rects.floating); return { data: { escapedOffsets: offsets, escaped: isAnySideFullyClipped(offsets) } }; } default: { return {}; } } } }; }; function getBoundingRect(rects) { const minX = min(...rects.map(rect => rect.left)); const minY = min(...rects.map(rect => rect.top)); const maxX = max(...rects.map(rect => rect.right)); const maxY = max(...rects.map(rect => rect.bottom)); return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; } function getRectsByLine(rects) { const sortedRects = rects.slice().sort((a, b) => a.y - b.y); const groups = []; let prevRect = null; for (let i = 0; i < sortedRects.length; i++) { const rect = sortedRects[i]; if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) { groups.push([rect]); } else { groups[groups.length - 1].push(rect); } prevRect = rect; } return groups.map(rect => rectToClientRect(getBoundingRect(rect))); } /** * Provides improved positioning for inline reference elements that can span * over multiple lines, such as hyperlinks or range selections. * @see https://floating-ui.com/docs/inline */ const inline = function (options) { if (options === void 0) { options = {}; } return { name: 'inline', options, async fn(state) { const { placement, elements, rects, platform, strategy } = state; // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a // ClientRect's bounds, despite the event listener being triggered. A // padding of 2 seems to handle this issue. const { padding = 2, x, y } = evaluate(options, state); const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []); const clientRects = getRectsByLine(nativeClientRects); const fallback = rectToClientRect(getBoundingRect(nativeClientRects)); const paddingObject = getPaddingObject(padding); function getBoundingClientRect() { // There are two rects and they are disjoined. if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) { // Find the first rect in which the point is fully inside. return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback; } // There are 2 or more connected rects. if (clientRects.length >= 2) { if (getSideAxis(placement) === 'y') { const firstRect = clientRects[0]; const lastRect = clientRects[clientRects.length - 1]; const isTop = getSide(placement) === 'top'; const top = firstRect.top; const bottom = lastRect.bottom; const left = isTop ? firstRect.left : lastRect.left; const right = isTop ? firstRect.right : lastRect.right; const width = right - left; const height = bottom - top; return { top, bottom, left, right, width, height, x: left, y: top }; } const isLeftSide = getSide(placement) === 'left'; const maxRight = max(...clientRects.map(rect => rect.right)); const minLeft = min(...clientRects.map(rect => rect.left)); const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight); const top = measureRects[0].top; const bottom = measureRects[measureRects.length - 1].bottom; const left = minLeft; const right = maxRight; const width = right - left; const height = bottom - top; return { top, bottom, left, right, width, height, x: left, y: top }; } return fallback; } const resetRects = await platform.getElementRects({ reference: { getBoundingClientRect }, floating: elements.floating, strategy }); if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) { return { reset: { rects: resetRects } }; } return {}; } }; }; // For type backwards-compatibility, the `OffsetOptions` type was also // Derivable. async function convertValueToCoords(state, options) { const { placement, platform, elements } = state; const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); const side = floating_ui_utils_getSide(placement); const alignment = floating_ui_utils_getAlignment(placement); const isVertical = floating_ui_utils_getSideAxis(placement) === 'y'; const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1; const crossAxisMulti = rtl && isVertical ? -1 : 1; const rawValue = floating_ui_utils_evaluate(options, state); // eslint-disable-next-line prefer-const let { mainAxis, crossAxis, alignmentAxis } = typeof rawValue === 'number' ? { mainAxis: rawValue, crossAxis: 0, alignmentAxis: null } : { mainAxis: 0, crossAxis: 0, alignmentAxis: null, ...rawValue }; if (alignment && typeof alignmentAxis === 'number') { crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis; } return isVertical ? { x: crossAxis * crossAxisMulti, y: mainAxis * mainAxisMulti } : { x: mainAxis * mainAxisMulti, y: crossAxis * crossAxisMulti }; } /** * Modifies the placement by translating the floating element along the * specified axes. * A number (shorthand for `mainAxis` or distance), or an axes configuration * object may be passed. * @see https://floating-ui.com/docs/offset */ const offset = function (options) { if (options === void 0) { options = 0; } return { name: 'offset', options, async fn(state) { const { x, y } = state; const diffCoords = await convertValueToCoords(state, options); return { x: x + diffCoords.x, y: y + diffCoords.y, data: diffCoords }; } }; }; /** * Optimizes the visibility of the floating element by shifting it in order to * keep it in view when it will overflow the clipping boundary. * @see https://floating-ui.com/docs/shift */ const shift = function (options) { if (options === void 0) { options = {}; } return { name: 'shift', options, async fn(state) { const { x, y, placement } = state; const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter = { fn: _ref => { let { x, y } = _ref; return { x, y }; } }, ...detectOverflowOptions } = evaluate(options, state); const coords = { x, y }; const overflow = await detectOverflow(state, detectOverflowOptions); const crossAxis = getSideAxis(getSide(placement)); const mainAxis = getOppositeAxis(crossAxis); let mainAxisCoord = coords[mainAxis]; let crossAxisCoord = coords[crossAxis]; if (checkMainAxis) { const minSide = mainAxis === 'y' ? 'top' : 'left'; const maxSide = mainAxis === 'y' ? 'bottom' : 'right'; const min = mainAxisCoord + overflow[minSide]; const max = mainAxisCoord - overflow[maxSide]; mainAxisCoord = clamp(min, mainAxisCoord, max); } if (checkCrossAxis) { const minSide = crossAxis === 'y' ? 'top' : 'left'; const maxSide = crossAxis === 'y' ? 'bottom' : 'right'; const min = crossAxisCoord + overflow[minSide]; const max = crossAxisCoord - overflow[maxSide]; crossAxisCoord = clamp(min, crossAxisCoord, max); } const limitedCoords = limiter.fn({ ...state, [mainAxis]: mainAxisCoord, [crossAxis]: crossAxisCoord }); return { ...limitedCoords, data: { x: limitedCoords.x - x, y: limitedCoords.y - y } }; } }; }; /** * Built-in `limiter` that will stop `shift()` at a certain point. */ const limitShift = function (options) { if (options === void 0) { options = {}; } return { options, fn(state) { const { x, y, placement, rects, middlewareData } = state; const { offset = 0, mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true } = evaluate(options, state); const coords = { x, y }; const crossAxis = getSideAxis(placement); const mainAxis = getOppositeAxis(crossAxis); let mainAxisCoord = coords[mainAxis]; let crossAxisCoord = coords[crossAxis]; const rawOffset = evaluate(offset, state); const computedOffset = typeof rawOffset === 'number' ? { mainAxis: rawOffset, crossAxis: 0 } : { mainAxis: 0, crossAxis: 0, ...rawOffset }; if (checkMainAxis) { const len = mainAxis === 'y' ? 'height' : 'width'; const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; if (mainAxisCoord < limitMin) { mainAxisCoord = limitMin; } else if (mainAxisCoord > limitMax) { mainAxisCoord = limitMax; } } if (checkCrossAxis) { var _middlewareData$offse, _middlewareData$offse2; const len = mainAxis === 'y' ? 'width' : 'height'; const isOriginSide = ['top', 'left'].includes(getSide(placement)); const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis); const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0); if (crossAxisCoord < limitMin) { crossAxisCoord = limitMin; } else if (crossAxisCoord > limitMax) { crossAxisCoord = limitMax; } } return { [mainAxis]: mainAxisCoord, [crossAxis]: crossAxisCoord }; } }; }; /** * Provides data that allows you to change the size of the floating element — * for instance, prevent it from overflowing the clipping boundary or match the * width of the reference element. * @see https://floating-ui.com/docs/size */ const size = function (options) { if (options === void 0) { options = {}; } return { name: 'size', options, async fn(state) { const { placement, rects, platform, elements } = state; const { apply = () => {}, ...detectOverflowOptions } = evaluate(options, state); const overflow = await detectOverflow(state, detectOverflowOptions); const side = getSide(placement); const alignment = getAlignment(placement); const isYAxis = getSideAxis(placement) === 'y'; const { width, height } = rects.floating; let heightSide; let widthSide; if (side === 'top' || side === 'bottom') { heightSide = side; widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right'; } else { widthSide = side; heightSide = alignment === 'end' ? 'top' : 'bottom'; } const overflowAvailableHeight = height - overflow[heightSide]; const overflowAvailableWidth = width - overflow[widthSide]; const noShift = !state.middlewareData.shift; let availableHeight = overflowAvailableHeight; let availableWidth = overflowAvailableWidth; if (isYAxis) { const maximumClippingWidth = width - overflow.left - overflow.right; availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth; } else { const maximumClippingHeight = height - overflow.top - overflow.bottom; availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight; } if (noShift && !alignment) { const xMin = max(overflow.left, 0); const xMax = max(overflow.right, 0); const yMin = max(overflow.top, 0); const yMax = max(overflow.bottom, 0); if (isYAxis) { availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); } else { availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); } } await apply({ ...state, availableWidth, availableHeight }); const nextDimensions = await platform.getDimensions(elements.floating); if (width !== nextDimensions.width || height !== nextDimensions.height) { return { reset: { rects: true } }; } return {}; } }; }; ;// ./node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs /** * Custom positioning reference element. * @see https://floating-ui.com/docs/virtual-elements */ const dist_floating_ui_utils_sides = (/* unused pure expression or super */ null && (['top', 'right', 'bottom', 'left'])); const floating_ui_utils_alignments = (/* unused pure expression or super */ null && (['start', 'end'])); const dist_floating_ui_utils_placements = /*#__PURE__*/(/* unused pure expression or super */ null && (dist_floating_ui_utils_sides.reduce((acc, side) => acc.concat(side, side + "-" + floating_ui_utils_alignments[0], side + "-" + floating_ui_utils_alignments[1]), []))); const dist_floating_ui_utils_min = Math.min; const dist_floating_ui_utils_max = Math.max; const floating_ui_utils_round = Math.round; const floating_ui_utils_floor = Math.floor; const floating_ui_utils_createCoords = v => ({ x: v, y: v }); const floating_ui_utils_oppositeSideMap = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; const floating_ui_utils_oppositeAlignmentMap = { start: 'end', end: 'start' }; function dist_floating_ui_utils_clamp(start, value, end) { return dist_floating_ui_utils_max(start, dist_floating_ui_utils_min(value, end)); } function dist_floating_ui_utils_evaluate(value, param) { return typeof value === 'function' ? value(param) : value; } function dist_floating_ui_utils_getSide(placement) { return placement.split('-')[0]; } function dist_floating_ui_utils_getAlignment(placement) { return placement.split('-')[1]; } function dist_floating_ui_utils_getOppositeAxis(axis) { return axis === 'x' ? 'y' : 'x'; } function dist_floating_ui_utils_getAxisLength(axis) { return axis === 'y' ? 'height' : 'width'; } function dist_floating_ui_utils_getSideAxis(placement) { return ['top', 'bottom'].includes(dist_floating_ui_utils_getSide(placement)) ? 'y' : 'x'; } function dist_floating_ui_utils_getAlignmentAxis(placement) { return dist_floating_ui_utils_getOppositeAxis(dist_floating_ui_utils_getSideAxis(placement)); } function dist_floating_ui_utils_getAlignmentSides(placement, rects, rtl) { if (rtl === void 0) { rtl = false; } const alignment = dist_floating_ui_utils_getAlignment(placement); const alignmentAxis = dist_floating_ui_utils_getAlignmentAxis(placement); const length = dist_floating_ui_utils_getAxisLength(alignmentAxis); let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top'; if (rects.reference[length] > rects.floating[length]) { mainAlignmentSide = dist_floating_ui_utils_getOppositePlacement(mainAlignmentSide); } return [mainAlignmentSide, dist_floating_ui_utils_getOppositePlacement(mainAlignmentSide)]; } function dist_floating_ui_utils_getExpandedPlacements(placement) { const oppositePlacement = dist_floating_ui_utils_getOppositePlacement(placement); return [dist_floating_ui_utils_getOppositeAlignmentPlacement(placement), oppositePlacement, dist_floating_ui_utils_getOppositeAlignmentPlacement(oppositePlacement)]; } function dist_floating_ui_utils_getOppositeAlignmentPlacement(placement) { return placement.replace(/start|end/g, alignment => floating_ui_utils_oppositeAlignmentMap[alignment]); } function floating_ui_utils_getSideList(side, isStart, rtl) { const lr = ['left', 'right']; const rl = ['right', 'left']; const tb = ['top', 'bottom']; const bt = ['bottom', 'top']; switch (side) { case 'top': case 'bottom': if (rtl) return isStart ? rl : lr; return isStart ? lr : rl; case 'left': case 'right': return isStart ? tb : bt; default: return []; } } function dist_floating_ui_utils_getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { const alignment = dist_floating_ui_utils_getAlignment(placement); let list = floating_ui_utils_getSideList(dist_floating_ui_utils_getSide(placement), direction === 'start', rtl); if (alignment) { list = list.map(side => side + "-" + alignment); if (flipAlignment) { list = list.concat(list.map(dist_floating_ui_utils_getOppositeAlignmentPlacement)); } } return list; } function dist_floating_ui_utils_getOppositePlacement(placement) { return placement.replace(/left|right|bottom|top/g, side => floating_ui_utils_oppositeSideMap[side]); } function floating_ui_utils_expandPaddingObject(padding) { return { top: 0, right: 0, bottom: 0, left: 0, ...padding }; } function dist_floating_ui_utils_getPaddingObject(padding) { return typeof padding !== 'number' ? floating_ui_utils_expandPaddingObject(padding) : { top: padding, right: padding, bottom: padding, left: padding }; } function dist_floating_ui_utils_rectToClientRect(rect) { const { x, y, width, height } = rect; return { width, height, top: y, left: x, right: x + width, bottom: y + height, x, y }; } ;// ./node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs function hasWindow() { return typeof window !== 'undefined'; } function getNodeName(node) { if (isNode(node)) { return (node.nodeName || '').toLowerCase(); } // Mocked nodes in testing environments may not be instances of Node. By // returning `#document` an infinite loop won't occur. // https://github.com/floating-ui/floating-ui/issues/2317 return '#document'; } function getWindow(node) { var _node$ownerDocument; return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; } function getDocumentElement(node) { var _ref; return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; } function isNode(value) { if (!hasWindow()) { return false; } return value instanceof Node || value instanceof getWindow(value).Node; } function isElement(value) { if (!hasWindow()) { return false; } return value instanceof Element || value instanceof getWindow(value).Element; } function isHTMLElement(value) { if (!hasWindow()) { return false; } return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; } function isShadowRoot(value) { if (!hasWindow() || typeof ShadowRoot === 'undefined') { return false; } return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; } function isOverflowElement(element) { const { overflow, overflowX, overflowY, display } = getComputedStyle(element); return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display); } function isTableElement(element) { return ['table', 'td', 'th'].includes(getNodeName(element)); } function isTopLayer(element) { return [':popover-open', ':modal'].some(selector => { try { return element.matches(selector); } catch (e) { return false; } }); } function isContainingBlock(elementOrCss) { const webkit = isWebKit(); const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block // https://drafts.csswg.org/css-transforms-2/#individual-transforms return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value)); } function getContainingBlock(element) { let currentNode = getParentNode(element); while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { if (isContainingBlock(currentNode)) { return currentNode; } else if (isTopLayer(currentNode)) { return null; } currentNode = getParentNode(currentNode); } return null; } function isWebKit() { if (typeof CSS === 'undefined' || !CSS.supports) return false; return CSS.supports('-webkit-backdrop-filter', 'none'); } function isLastTraversableNode(node) { return ['html', 'body', '#document'].includes(getNodeName(node)); } function getComputedStyle(element) { return getWindow(element).getComputedStyle(element); } function getNodeScroll(element) { if (isElement(element)) { return { scrollLeft: element.scrollLeft, scrollTop: element.scrollTop }; } return { scrollLeft: element.scrollX, scrollTop: element.scrollY }; } function getParentNode(node) { if (getNodeName(node) === 'html') { return node; } const result = // Step into the shadow DOM of the parent of a slotted node. node.assignedSlot || // DOM Element detected. node.parentNode || // ShadowRoot detected. isShadowRoot(node) && node.host || // Fallback. getDocumentElement(node); return isShadowRoot(result) ? result.host : result; } function getNearestOverflowAncestor(node) { const parentNode = getParentNode(node); if (isLastTraversableNode(parentNode)) { return node.ownerDocument ? node.ownerDocument.body : node.body; } if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { return parentNode; } return getNearestOverflowAncestor(parentNode); } function getOverflowAncestors(node, list, traverseIframes) { var _node$ownerDocument2; if (list === void 0) { list = []; } if (traverseIframes === void 0) { traverseIframes = true; } const scrollableAncestor = getNearestOverflowAncestor(node); const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); const win = getWindow(scrollableAncestor); if (isBody) { const frameElement = getFrameElement(win); return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); } return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); } function getFrameElement(win) { return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; } ;// ./node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs function getCssDimensions(element) { const css = getComputedStyle(element); // In testing environments, the `width` and `height` properties are empty // strings for SVG elements, returning NaN. Fallback to `0` in this case. let width = parseFloat(css.width) || 0; let height = parseFloat(css.height) || 0; const hasOffset = isHTMLElement(element); const offsetWidth = hasOffset ? element.offsetWidth : width; const offsetHeight = hasOffset ? element.offsetHeight : height; const shouldFallback = floating_ui_utils_round(width) !== offsetWidth || floating_ui_utils_round(height) !== offsetHeight; if (shouldFallback) { width = offsetWidth; height = offsetHeight; } return { width, height, $: shouldFallback }; } function unwrapElement(element) { return !isElement(element) ? element.contextElement : element; } function getScale(element) { const domElement = unwrapElement(element); if (!isHTMLElement(domElement)) { return floating_ui_utils_createCoords(1); } const rect = domElement.getBoundingClientRect(); const { width, height, $ } = getCssDimensions(domElement); let x = ($ ? floating_ui_utils_round(rect.width) : rect.width) / width; let y = ($ ? floating_ui_utils_round(rect.height) : rect.height) / height; // 0, NaN, or Infinity should always fallback to 1. if (!x || !Number.isFinite(x)) { x = 1; } if (!y || !Number.isFinite(y)) { y = 1; } return { x, y }; } const noOffsets = /*#__PURE__*/floating_ui_utils_createCoords(0); function getVisualOffsets(element) { const win = getWindow(element); if (!isWebKit() || !win.visualViewport) { return noOffsets; } return { x: win.visualViewport.offsetLeft, y: win.visualViewport.offsetTop }; } function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { if (isFixed === void 0) { isFixed = false; } if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { return false; } return isFixed; } function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { if (includeScale === void 0) { includeScale = false; } if (isFixedStrategy === void 0) { isFixedStrategy = false; } const clientRect = element.getBoundingClientRect(); const domElement = unwrapElement(element); let scale = floating_ui_utils_createCoords(1); if (includeScale) { if (offsetParent) { if (isElement(offsetParent)) { scale = getScale(offsetParent); } } else { scale = getScale(element); } } const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : floating_ui_utils_createCoords(0); let x = (clientRect.left + visualOffsets.x) / scale.x; let y = (clientRect.top + visualOffsets.y) / scale.y; let width = clientRect.width / scale.x; let height = clientRect.height / scale.y; if (domElement) { const win = getWindow(domElement); const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; let currentWin = win; let currentIFrame = currentWin.frameElement; while (currentIFrame && offsetParent && offsetWin !== currentWin) { const iframeScale = getScale(currentIFrame); const iframeRect = currentIFrame.getBoundingClientRect(); const css = getComputedStyle(currentIFrame); const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; x *= iframeScale.x; y *= iframeScale.y; width *= iframeScale.x; height *= iframeScale.y; x += left; y += top; currentWin = getWindow(currentIFrame); currentIFrame = currentWin.frameElement; } } return floating_ui_utils_rectToClientRect({ width, height, x, y }); } const topLayerSelectors = [':popover-open', ':modal']; function floating_ui_dom_isTopLayer(floating) { return topLayerSelectors.some(selector => { try { return floating.matches(selector); } catch (e) { return false; } }); } function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { let { elements, rect, offsetParent, strategy } = _ref; const isFixed = strategy === 'fixed'; const documentElement = getDocumentElement(offsetParent); const topLayer = elements ? floating_ui_dom_isTopLayer(elements.floating) : false; if (offsetParent === documentElement || topLayer && isFixed) { return rect; } let scroll = { scrollLeft: 0, scrollTop: 0 }; let scale = floating_ui_utils_createCoords(1); const offsets = floating_ui_utils_createCoords(0); const isOffsetParentAnElement = isHTMLElement(offsetParent); if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) { scroll = getNodeScroll(offsetParent); } if (isHTMLElement(offsetParent)) { const offsetRect = getBoundingClientRect(offsetParent); scale = getScale(offsetParent); offsets.x = offsetRect.x + offsetParent.clientLeft; offsets.y = offsetRect.y + offsetParent.clientTop; } } return { width: rect.width * scale.x, height: rect.height * scale.y, x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x, y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y }; } function getClientRects(element) { return Array.from(element.getClientRects()); } function getWindowScrollBarX(element) { // If <html> has a CSS width greater than the viewport, then this will be // incorrect for RTL. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft; } // Gets the entire size of the scrollable document area, even extending outside // of the `<html>` and `<body>` rect bounds if horizontally scrollable. function getDocumentRect(element) { const html = getDocumentElement(element); const scroll = getNodeScroll(element); const body = element.ownerDocument.body; const width = dist_floating_ui_utils_max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); const height = dist_floating_ui_utils_max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); let x = -scroll.scrollLeft + getWindowScrollBarX(element); const y = -scroll.scrollTop; if (getComputedStyle(body).direction === 'rtl') { x += dist_floating_ui_utils_max(html.clientWidth, body.clientWidth) - width; } return { width, height, x, y }; } function getViewportRect(element, strategy) { const win = getWindow(element); const html = getDocumentElement(element); const visualViewport = win.visualViewport; let width = html.clientWidth; let height = html.clientHeight; let x = 0; let y = 0; if (visualViewport) { width = visualViewport.width; height = visualViewport.height; const visualViewportBased = isWebKit(); if (!visualViewportBased || visualViewportBased && strategy === 'fixed') { x = visualViewport.offsetLeft; y = visualViewport.offsetTop; } } return { width, height, x, y }; } // Returns the inner client rect, subtracting scrollbars if present. function getInnerBoundingClientRect(element, strategy) { const clientRect = getBoundingClientRect(element, true, strategy === 'fixed'); const top = clientRect.top + element.clientTop; const left = clientRect.left + element.clientLeft; const scale = isHTMLElement(element) ? getScale(element) : floating_ui_utils_createCoords(1); const width = element.clientWidth * scale.x; const height = element.clientHeight * scale.y; const x = left * scale.x; const y = top * scale.y; return { width, height, x, y }; } function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { let rect; if (clippingAncestor === 'viewport') { rect = getViewportRect(element, strategy); } else if (clippingAncestor === 'document') { rect = getDocumentRect(getDocumentElement(element)); } else if (isElement(clippingAncestor)) { rect = getInnerBoundingClientRect(clippingAncestor, strategy); } else { const visualOffsets = getVisualOffsets(element); rect = { ...clippingAncestor, x: clippingAncestor.x - visualOffsets.x, y: clippingAncestor.y - visualOffsets.y }; } return floating_ui_utils_rectToClientRect(rect); } function hasFixedPositionAncestor(element, stopNode) { const parentNode = getParentNode(element); if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { return false; } return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode); } // A "clipping ancestor" is an `overflow` element with the characteristic of // clipping (or hiding) child elements. This returns all clipping ancestors // of the given element up the tree. function getClippingElementAncestors(element, cache) { const cachedResult = cache.get(element); if (cachedResult) { return cachedResult; } let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body'); let currentContainingBlockComputedStyle = null; const elementIsFixed = getComputedStyle(element).position === 'fixed'; let currentNode = elementIsFixed ? getParentNode(element) : element; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { const computedStyle = getComputedStyle(currentNode); const currentNodeIsContaining = isContainingBlock(currentNode); if (!currentNodeIsContaining && computedStyle.position === 'fixed') { currentContainingBlockComputedStyle = null; } const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); if (shouldDropCurrentNode) { // Drop non-containing blocks. result = result.filter(ancestor => ancestor !== currentNode); } else { // Record last containing block for next iteration. currentContainingBlockComputedStyle = computedStyle; } currentNode = getParentNode(currentNode); } cache.set(element, result); return result; } // Gets the maximum area that the element is visible in due to any number of // clipping ancestors. function getClippingRect(_ref) { let { element, boundary, rootBoundary, strategy } = _ref; const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary); const clippingAncestors = [...elementClippingAncestors, rootBoundary]; const firstClippingAncestor = clippingAncestors[0]; const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy); accRect.top = dist_floating_ui_utils_max(rect.top, accRect.top); accRect.right = dist_floating_ui_utils_min(rect.right, accRect.right); accRect.bottom = dist_floating_ui_utils_min(rect.bottom, accRect.bottom); accRect.left = dist_floating_ui_utils_max(rect.left, accRect.left); return accRect; }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy)); return { width: clippingRect.right - clippingRect.left, height: clippingRect.bottom - clippingRect.top, x: clippingRect.left, y: clippingRect.top }; } function getDimensions(element) { const { width, height } = getCssDimensions(element); return { width, height }; } function getRectRelativeToOffsetParent(element, offsetParent, strategy) { const isOffsetParentAnElement = isHTMLElement(offsetParent); const documentElement = getDocumentElement(offsetParent); const isFixed = strategy === 'fixed'; const rect = getBoundingClientRect(element, true, isFixed, offsetParent); let scroll = { scrollLeft: 0, scrollTop: 0 }; const offsets = floating_ui_utils_createCoords(0); if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) { scroll = getNodeScroll(offsetParent); } if (isOffsetParentAnElement) { const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); offsets.x = offsetRect.x + offsetParent.clientLeft; offsets.y = offsetRect.y + offsetParent.clientTop; } else if (documentElement) { offsets.x = getWindowScrollBarX(documentElement); } } const x = rect.left + scroll.scrollLeft - offsets.x; const y = rect.top + scroll.scrollTop - offsets.y; return { x, y, width: rect.width, height: rect.height }; } function getTrueOffsetParent(element, polyfill) { if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') { return null; } if (polyfill) { return polyfill(element); } return element.offsetParent; } // Gets the closest ancestor positioned element. Handles some edge cases, // such as table ancestors and cross browser bugs. function getOffsetParent(element, polyfill) { const window = getWindow(element); if (!isHTMLElement(element) || floating_ui_dom_isTopLayer(element)) { return window; } let offsetParent = getTrueOffsetParent(element, polyfill); while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') { offsetParent = getTrueOffsetParent(offsetParent, polyfill); } if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) { return window; } return offsetParent || getContainingBlock(element) || window; } const getElementRects = async function (data) { const getOffsetParentFn = this.getOffsetParent || getOffsetParent; const getDimensionsFn = this.getDimensions; return { reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), floating: { x: 0, y: 0, ...(await getDimensionsFn(data.floating)) } }; }; function isRTL(element) { return getComputedStyle(element).direction === 'rtl'; } const platform = { convertOffsetParentRelativeRectToViewportRelativeRect, getDocumentElement: getDocumentElement, getClippingRect, getOffsetParent, getElementRects, getClientRects, getDimensions, getScale, isElement: isElement, isRTL }; // https://samthor.au/2021/observing-dom/ function observeMove(element, onMove) { let io = null; let timeoutId; const root = getDocumentElement(element); function cleanup() { var _io; clearTimeout(timeoutId); (_io = io) == null || _io.disconnect(); io = null; } function refresh(skip, threshold) { if (skip === void 0) { skip = false; } if (threshold === void 0) { threshold = 1; } cleanup(); const { left, top, width, height } = element.getBoundingClientRect(); if (!skip) { onMove(); } if (!width || !height) { return; } const insetTop = floating_ui_utils_floor(top); const insetRight = floating_ui_utils_floor(root.clientWidth - (left + width)); const insetBottom = floating_ui_utils_floor(root.clientHeight - (top + height)); const insetLeft = floating_ui_utils_floor(left); const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; const options = { rootMargin, threshold: dist_floating_ui_utils_max(0, dist_floating_ui_utils_min(1, threshold)) || 1 }; let isFirstUpdate = true; function handleObserve(entries) { const ratio = entries[0].intersectionRatio; if (ratio !== threshold) { if (!isFirstUpdate) { return refresh(); } if (!ratio) { timeoutId = setTimeout(() => { refresh(false, 1e-7); }, 100); } else { refresh(false, ratio); } } isFirstUpdate = false; } // Older browsers don't support a `document` as the root and will throw an // error. try { io = new IntersectionObserver(handleObserve, { ...options, // Handle <iframe>s root: root.ownerDocument }); } catch (e) { io = new IntersectionObserver(handleObserve, options); } io.observe(element); } refresh(true); return cleanup; } /** * Automatically updates the position of the floating element when necessary. * Should only be called when the floating element is mounted on the DOM or * visible on the screen. * @returns cleanup function that should be invoked when the floating element is * removed from the DOM or hidden from the screen. * @see https://floating-ui.com/docs/autoUpdate */ function autoUpdate(reference, floating, update, options) { if (options === void 0) { options = {}; } const { ancestorScroll = true, ancestorResize = true, elementResize = typeof ResizeObserver === 'function', layoutShift = typeof IntersectionObserver === 'function', animationFrame = false } = options; const referenceEl = unwrapElement(reference); const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : []; ancestors.forEach(ancestor => { ancestorScroll && ancestor.addEventListener('scroll', update, { passive: true }); ancestorResize && ancestor.addEventListener('resize', update); }); const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null; let reobserveFrame = -1; let resizeObserver = null; if (elementResize) { resizeObserver = new ResizeObserver(_ref => { let [firstEntry] = _ref; if (firstEntry && firstEntry.target === referenceEl && resizeObserver) { // Prevent update loops when using the `size` middleware. // https://github.com/floating-ui/floating-ui/issues/1740 resizeObserver.unobserve(floating); cancelAnimationFrame(reobserveFrame); reobserveFrame = requestAnimationFrame(() => { var _resizeObserver; (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); }); } update(); }); if (referenceEl && !animationFrame) { resizeObserver.observe(referenceEl); } resizeObserver.observe(floating); } let frameId; let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; if (animationFrame) { frameLoop(); } function frameLoop() { const nextRefRect = getBoundingClientRect(reference); if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) { update(); } prevRefRect = nextRefRect; frameId = requestAnimationFrame(frameLoop); } update(); return () => { var _resizeObserver2; ancestors.forEach(ancestor => { ancestorScroll && ancestor.removeEventListener('scroll', update); ancestorResize && ancestor.removeEventListener('resize', update); }); cleanupIo == null || cleanupIo(); (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); resizeObserver = null; if (animationFrame) { cancelAnimationFrame(frameId); } }; } /** * Optimizes the visibility of the floating element by choosing the placement * that has the most space available automatically, without needing to specify a * preferred placement. Alternative to `flip`. * @see https://floating-ui.com/docs/autoPlacement */ const floating_ui_dom_autoPlacement = (/* unused pure expression or super */ null && (autoPlacement$1)); /** * Optimizes the visibility of the floating element by shifting it in order to * keep it in view when it will overflow the clipping boundary. * @see https://floating-ui.com/docs/shift */ const floating_ui_dom_shift = (/* unused pure expression or super */ null && (shift$1)); /** * Optimizes the visibility of the floating element by flipping the `placement` * in order to keep it in view when the preferred placement(s) will overflow the * clipping boundary. Alternative to `autoPlacement`. * @see https://floating-ui.com/docs/flip */ const floating_ui_dom_flip = (/* unused pure expression or super */ null && (flip$1)); /** * Provides data that allows you to change the size of the floating element — * for instance, prevent it from overflowing the clipping boundary or match the * width of the reference element. * @see https://floating-ui.com/docs/size */ const floating_ui_dom_size = (/* unused pure expression or super */ null && (size$1)); /** * Provides data to hide the floating element in applicable situations, such as * when it is not in the same clipping context as the reference element. * @see https://floating-ui.com/docs/hide */ const floating_ui_dom_hide = (/* unused pure expression or super */ null && (hide$1)); /** * Provides data to position an inner element of the floating element so that it * appears centered to the reference element. * @see https://floating-ui.com/docs/arrow */ const floating_ui_dom_arrow = (/* unused pure expression or super */ null && (arrow$1)); /** * Provides improved positioning for inline reference elements that can span * over multiple lines, such as hyperlinks or range selections. * @see https://floating-ui.com/docs/inline */ const floating_ui_dom_inline = (/* unused pure expression or super */ null && (inline$1)); /** * Built-in `limiter` that will stop `shift()` at a certain point. */ const floating_ui_dom_limitShift = (/* unused pure expression or super */ null && (limitShift$1)); /** * Computes the `x` and `y` coordinates that will place the floating element * next to a given reference element. */ const floating_ui_dom_computePosition = (reference, floating, options) => { // This caches the expensive `getClippingElementAncestors` function so that // multiple lifecycle resets re-use the same result. It only lives for a // single call. If other functions become expensive, we can add them as well. const cache = new Map(); const mergedOptions = { platform, ...options }; const platformWithCache = { ...mergedOptions.platform, _c: cache }; return computePosition(reference, floating, { ...mergedOptions, platform: platformWithCache }); }; // EXTERNAL MODULE: external "React" var external_React_ = __webpack_require__(1609); ;// external "ReactDOM" const external_ReactDOM_namespaceObject = window["ReactDOM"]; ;// ./node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs /** * Provides data to position an inner element of the floating element so that it * appears centered to the reference element. * This wraps the core `arrow` middleware to allow React refs as the element. * @see https://floating-ui.com/docs/arrow */ const floating_ui_react_dom_arrow = options => { function isRef(value) { return {}.hasOwnProperty.call(value, 'current'); } return { name: 'arrow', options, fn(state) { const { element, padding } = typeof options === 'function' ? options(state) : options; if (element && isRef(element)) { if (element.current != null) { return arrow$1({ element: element.current, padding }).fn(state); } return {}; } if (element) { return arrow$1({ element, padding }).fn(state); } return {}; } }; }; var index = typeof document !== 'undefined' ? external_React_.useLayoutEffect : external_React_.useEffect; // Fork of `fast-deep-equal` that only does the comparisons we need and compares // functions function deepEqual(a, b) { if (a === b) { return true; } if (typeof a !== typeof b) { return false; } if (typeof a === 'function' && a.toString() === b.toString()) { return true; } let length; let i; let keys; if (a && b && typeof a === 'object') { if (Array.isArray(a)) { length = a.length; if (length !== b.length) return false; for (i = length; i-- !== 0;) { if (!deepEqual(a[i], b[i])) { return false; } } return true; } keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) { return false; } for (i = length; i-- !== 0;) { if (!{}.hasOwnProperty.call(b, keys[i])) { return false; } } for (i = length; i-- !== 0;) { const key = keys[i]; if (key === '_owner' && a.$$typeof) { continue; } if (!deepEqual(a[key], b[key])) { return false; } } return true; } // biome-ignore lint/suspicious/noSelfCompare: in source return a !== a && b !== b; } function getDPR(element) { if (typeof window === 'undefined') { return 1; } const win = element.ownerDocument.defaultView || window; return win.devicePixelRatio || 1; } function roundByDPR(element, value) { const dpr = getDPR(element); return Math.round(value * dpr) / dpr; } function useLatestRef(value) { const ref = external_React_.useRef(value); index(() => { ref.current = value; }); return ref; } /** * Provides data to position a floating element. * @see https://floating-ui.com/docs/useFloating */ function useFloating(options) { if (options === void 0) { options = {}; } const { placement = 'bottom', strategy = 'absolute', middleware = [], platform, elements: { reference: externalReference, floating: externalFloating } = {}, transform = true, whileElementsMounted, open } = options; const [data, setData] = external_React_.useState({ x: 0, y: 0, strategy, placement, middlewareData: {}, isPositioned: false }); const [latestMiddleware, setLatestMiddleware] = external_React_.useState(middleware); if (!deepEqual(latestMiddleware, middleware)) { setLatestMiddleware(middleware); } const [_reference, _setReference] = external_React_.useState(null); const [_floating, _setFloating] = external_React_.useState(null); const setReference = external_React_.useCallback(node => { if (node !== referenceRef.current) { referenceRef.current = node; _setReference(node); } }, []); const setFloating = external_React_.useCallback(node => { if (node !== floatingRef.current) { floatingRef.current = node; _setFloating(node); } }, []); const referenceEl = externalReference || _reference; const floatingEl = externalFloating || _floating; const referenceRef = external_React_.useRef(null); const floatingRef = external_React_.useRef(null); const dataRef = external_React_.useRef(data); const hasWhileElementsMounted = whileElementsMounted != null; const whileElementsMountedRef = useLatestRef(whileElementsMounted); const platformRef = useLatestRef(platform); const update = external_React_.useCallback(() => { if (!referenceRef.current || !floatingRef.current) { return; } const config = { placement, strategy, middleware: latestMiddleware }; if (platformRef.current) { config.platform = platformRef.current; } floating_ui_dom_computePosition(referenceRef.current, floatingRef.current, config).then(data => { const fullData = { ...data, isPositioned: true }; if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { dataRef.current = fullData; external_ReactDOM_namespaceObject.flushSync(() => { setData(fullData); }); } }); }, [latestMiddleware, placement, strategy, platformRef]); index(() => { if (open === false && dataRef.current.isPositioned) { dataRef.current.isPositioned = false; setData(data => ({ ...data, isPositioned: false })); } }, [open]); const isMountedRef = external_React_.useRef(false); index(() => { isMountedRef.current = true; return () => { isMountedRef.current = false; }; }, []); // biome-ignore lint/correctness/useExhaustiveDependencies: `hasWhileElementsMounted` is intentionally included. index(() => { if (referenceEl) referenceRef.current = referenceEl; if (floatingEl) floatingRef.current = floatingEl; if (referenceEl && floatingEl) { if (whileElementsMountedRef.current) { return whileElementsMountedRef.current(referenceEl, floatingEl, update); } update(); } }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]); const refs = external_React_.useMemo(() => ({ reference: referenceRef, floating: floatingRef, setReference, setFloating }), [setReference, setFloating]); const elements = external_React_.useMemo(() => ({ reference: referenceEl, floating: floatingEl }), [referenceEl, floatingEl]); const floatingStyles = external_React_.useMemo(() => { const initialStyles = { position: strategy, left: 0, top: 0 }; if (!elements.floating) { return initialStyles; } const x = roundByDPR(elements.floating, data.x); const y = roundByDPR(elements.floating, data.y); if (transform) { return { ...initialStyles, transform: "translate(" + x + "px, " + y + "px)", ...(getDPR(elements.floating) >= 1.5 && { willChange: 'transform' }) }; } return { position: strategy, left: x, top: y }; }, [strategy, transform, elements.floating, data.x, data.y]); return external_React_.useMemo(() => ({ ...data, update, refs, elements, floatingStyles }), [data, update, refs, elements, floatingStyles]); } ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/hooks.js const { useBlockElementRef, cleanEmptyObject: hooks_cleanEmptyObject } = unlock( external_wp_blockEditor_namespaceObject.privateApis ); function useBlockComments(postId) { const [commentLastUpdated, reflowComments] = (0,external_wp_element_namespaceObject.useReducer)( () => Date.now(), 0 ); const queryArgs = { post: postId, type: "note", status: "all", per_page: -1 }; const { records: threads } = (0,external_wp_coreData_namespaceObject.useEntityRecords)( "root", "comment", queryArgs, { enabled: !!postId && typeof postId === "number" } ); const { getBlockAttributes } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const { clientIds } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getClientIdsWithDescendants } = select(external_wp_blockEditor_namespaceObject.store); return { clientIds: getClientIdsWithDescendants() }; }, []); const { resultComments, unresolvedSortedThreads } = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!threads || threads.length === 0) { return { resultComments: [], unresolvedSortedThreads: [] }; } const blocksWithComments = clientIds.reduce((results, clientId) => { const commentId = getBlockAttributes(clientId)?.metadata?.noteId; if (commentId) { results[clientId] = commentId; } return results; }, {}); const compare = {}; const result = []; threads.forEach((item) => { const itemBlock = Object.keys(blocksWithComments).find( (key) => blocksWithComments[key] === item.id ); compare[item.id] = { ...item, reply: [], blockClientId: item.parent === 0 ? itemBlock : null }; }); threads.forEach((item) => { if (item.parent === 0) { result.push(compare[item.id]); } else if (compare[item.parent]) { compare[item.parent].reply.push(compare[item.id]); } }); if (0 === result?.length) { return { resultComments: [], unresolvedSortedThreads: [] }; } const updatedResult = result.map((item) => ({ ...item, reply: [...item.reply].reverse() })); const threadIdMap = new Map( updatedResult.map((thread) => [String(thread.id), thread]) ); const mappedIds = new Set( Object.values(blocksWithComments).map((id) => String(id)) ); const unresolvedSortedComments = Object.values(blocksWithComments).map((commentId) => threadIdMap.get(String(commentId))).filter( (thread) => thread !== void 0 && thread.status === "hold" ); const resolvedSortedComments = Object.values(blocksWithComments).map((commentId) => threadIdMap.get(String(commentId))).filter( (thread) => thread !== void 0 && thread.status === "approved" ); const orphanedComments = updatedResult.filter( (thread) => !mappedIds.has(String(thread.id)) ); const allSortedComments = [ ...unresolvedSortedComments, ...resolvedSortedComments, ...orphanedComments ]; return { resultComments: allSortedComments, unresolvedSortedThreads: unresolvedSortedComments }; }, [clientIds, threads, getBlockAttributes]); return { resultComments, unresolvedSortedThreads, reflowComments, commentLastUpdated }; } function useBlockCommentsActions(reflowComments = utils_noop) { const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { saveEntityRecord, deleteEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { getCurrentPostId } = (0,external_wp_data_namespaceObject.useSelect)(store_store); const { getBlockAttributes, getSelectedBlockClientId } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const onError = (error) => { const errorMessage = error.message && error.code !== "unknown_error" ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(error.message) : (0,external_wp_i18n_namespaceObject.__)("An error occurred while performing an update."); createNotice("error", errorMessage, { type: "snackbar", isDismissible: true }); }; const onCreate = async ({ content, parent }) => { try { const savedRecord = await saveEntityRecord( "root", "comment", { post: getCurrentPostId(), content, status: "hold", type: "note", parent: parent || 0 }, { throwOnError: true } ); if (!parent && savedRecord?.id) { const clientId = getSelectedBlockClientId(); const metadata = getBlockAttributes(clientId)?.metadata; updateBlockAttributes(clientId, { metadata: { ...metadata, noteId: savedRecord.id } }); } createNotice( "snackbar", parent ? (0,external_wp_i18n_namespaceObject.__)("Reply added.") : (0,external_wp_i18n_namespaceObject.__)("Note added."), { type: "snackbar", isDismissible: true } ); setTimeout(reflowComments, 300); return savedRecord; } catch (error) { reflowComments(); onError(error); } }; const onEdit = async ({ id, content, status }) => { const messageType = status ? status : "updated"; const messages = { approved: (0,external_wp_i18n_namespaceObject.__)("Note marked as resolved."), hold: (0,external_wp_i18n_namespaceObject.__)("Note reopened."), updated: (0,external_wp_i18n_namespaceObject.__)("Note updated.") }; try { if (status === "approved" || status === "hold") { await saveEntityRecord( "root", "comment", { id, status }, { throwOnError: true } ); const newCommentData = { post: getCurrentPostId(), content: content || "", // Empty content for resolve, content for reopen. type: "note", status, parent: id, meta: { _wp_note_status: status === "approved" ? "resolved" : "reopen" } }; await saveEntityRecord("root", "comment", newCommentData, { throwOnError: true }); } else { const updateData = { id, content, status }; await saveEntityRecord("root", "comment", updateData, { throwOnError: true }); } createNotice( "snackbar", messages[messageType] ?? (0,external_wp_i18n_namespaceObject.__)("Note updated."), { type: "snackbar", isDismissible: true } ); reflowComments(); } catch (error) { reflowComments(); onError(error); } }; const onDelete = async (comment) => { try { await deleteEntityRecord( "root", "comment", comment.id, void 0, { throwOnError: true } ); if (!comment.parent) { const clientId = getSelectedBlockClientId(); const metadata = getBlockAttributes(clientId)?.metadata; updateBlockAttributes(clientId, { metadata: hooks_cleanEmptyObject({ ...metadata, noteId: void 0 }) }); } createNotice("snackbar", (0,external_wp_i18n_namespaceObject.__)("Note deleted."), { type: "snackbar", isDismissible: true }); reflowComments(); } catch (error) { reflowComments(); onError(error); } }; return { onCreate, onEdit, onDelete }; } function useEnableFloatingSidebar(enabled = false) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!enabled) { return; } const { getActiveComplementaryArea } = registry.select(store); const { disableComplementaryArea, enableComplementaryArea } = registry.dispatch(store); const unsubscribe = registry.subscribe(() => { if (getActiveComplementaryArea("core") === null) { enableComplementaryArea("core", collabSidebarName); } }); return () => { unsubscribe(); if (getActiveComplementaryArea("core") === collabSidebarName) { disableComplementaryArea("core", collabSidebarName); } }; }, [enabled, registry]); } function useFloatingThread({ thread, calculatedOffset, setHeights, selectedThread, setBlockRef, commentLastUpdated }) { const blockRef = (0,external_wp_element_namespaceObject.useRef)(); useBlockElementRef(thread.blockClientId, blockRef); const blockMode = (0,external_wp_data_namespaceObject.useSelect)( (select) => { return thread.blockClientId ? select(external_wp_blockEditor_namespaceObject.store).getBlockMode( thread.blockClientId ) : null; }, [thread.blockClientId] ); const updateHeight = (0,external_wp_element_namespaceObject.useCallback)( (id, newHeight) => { setHeights((prev) => { if (prev[id] !== newHeight) { return { ...prev, [id]: newHeight }; } return prev; }); }, [setHeights] ); const { y, refs } = useFloating({ placement: "right-start", middleware: [ offset({ crossAxis: calculatedOffset || -16 }) ], whileElementsMounted: autoUpdate }); (0,external_wp_element_namespaceObject.useEffect)(() => { if (blockRef.current) { refs.setReference(blockRef.current); } }, [blockRef, refs, commentLastUpdated, blockMode]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (refs.floating?.current) { setBlockRef(thread.id, blockRef.current); } }, [thread.id, refs.floating, setBlockRef]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (refs.floating?.current) { const newHeight = refs.floating.current.scrollHeight; updateHeight(thread.id, newHeight); } }, [ thread.id, updateHeight, refs.floating, selectedThread, commentLastUpdated ]); return { blockRef, y, refs }; } ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/add-comment.js const { useBlockElement } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function AddComment({ onSubmit, newNoteFormState, setNewNoteFormState, commentSidebarRef, reflowComments = utils_noop, isFloating = false, y, refs }) { const { clientId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSelectedBlockClientId } = select(external_wp_blockEditor_namespaceObject.store); return { clientId: getSelectedBlockClientId() }; }, []); const blockElement = useBlockElement(clientId); const { toggleBlockSpotlight } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); const unselectThread = () => { setNewNoteFormState("closed"); blockElement?.focus(); toggleBlockSpotlight(clientId, false); }; if (newNoteFormState !== "open" || !clientId) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { className: dist_clsx( "editor-collab-sidebar-panel__thread is-selected", { "is-floating": isFloating } ), spacing: "3", tabIndex: 0, "aria-label": (0,external_wp_i18n_namespaceObject.__)("New note"), role: "treeitem", ref: isFloating ? refs.setFloating : void 0, style: isFloating ? ( // Delay showing the floating note box until a Y position is known to prevent blink. { top: y, opacity: !y ? 0 : void 0 } ) : void 0, onBlur: (event) => { if (event.currentTarget.contains(event.relatedTarget)) { return; } toggleBlockSpotlight(clientId, false); setNewNoteFormState("closed"); }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: "3", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_author_info_default, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( comment_form_default, { onSubmit: async (inputComment) => { const { id } = await onSubmit({ content: inputComment }); focusCommentThread(id, commentSidebarRef.current); setNewNoteFormState("creating"); }, onCancel: unselectThread, reflowComments, submitButtonText: (0,external_wp_i18n_namespaceObject.__)("Add note"), labelText: (0,external_wp_i18n_namespaceObject.__)("New note") } ) ] } ); } ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comments.js const { useBlockElement: comments_useBlockElement } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { Menu: comments_Menu } = unlock(external_wp_components_namespaceObject.privateApis); function Comments({ threads: noteThreads, onEditComment, onAddReply, onCommentDelete, newNoteFormState, setNewNoteFormState, commentSidebarRef, reflowComments, isFloating = false, commentLastUpdated }) { const [heights, setHeights] = (0,external_wp_element_namespaceObject.useState)({}); const [selectedThread, setSelectedThread] = (0,external_wp_element_namespaceObject.useState)(null); const [boardOffsets, setBoardOffsets] = (0,external_wp_element_namespaceObject.useState)({}); const [blockRefs, setBlockRefs] = (0,external_wp_element_namespaceObject.useState)({}); const { setCanvasMinHeight } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); const { selectBlock, toggleBlockSpotlight } = unlock( (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store) ); const { blockCommentId, selectedBlockClientId, orderedBlockIds, blockMode } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getBlockAttributes, getSelectedBlockClientId, getClientIdsWithDescendants, getBlockMode } = select(external_wp_blockEditor_namespaceObject.store); const clientId = getSelectedBlockClientId(); return { blockCommentId: clientId ? getBlockAttributes(clientId)?.metadata?.noteId : null, selectedBlockClientId: clientId, orderedBlockIds: getClientIdsWithDescendants(), blockMode: clientId ? getBlockMode(clientId) : null }; }, []); const relatedBlockElement = comments_useBlockElement(selectedBlockClientId); const threads = (0,external_wp_element_namespaceObject.useMemo)(() => { const t = [...noteThreads]; const orderedThreads = []; if (isFloating && newNoteFormState === "open") { const newNoteThread = { id: "new-note-thread", blockClientId: selectedBlockClientId, content: { rendered: "" } }; orderedBlockIds.forEach((blockId) => { if (blockId === selectedBlockClientId) { orderedThreads.push(newNoteThread); } else { const threadForBlock = t.find( (thread) => thread.blockClientId === blockId ); if (threadForBlock) { orderedThreads.push(threadForBlock); } } }); return orderedThreads; } return t; }, [ noteThreads, isFloating, newNoteFormState, selectedBlockClientId, orderedBlockIds ]); const handleDelete = async (comment) => { const currentIndex = threads.findIndex((t) => t.id === comment.id); const nextThread = threads[currentIndex + 1]; const prevThread = threads[currentIndex - 1]; await onCommentDelete(comment); if (comment.parent !== 0) { setSelectedThread(comment.parent); focusCommentThread(comment.parent, commentSidebarRef.current); return; } if (nextThread) { setSelectedThread(nextThread.id); focusCommentThread(nextThread.id, commentSidebarRef.current); } else if (prevThread) { setSelectedThread(prevThread.id); focusCommentThread(prevThread.id, commentSidebarRef.current); } else { setSelectedThread(null); setNewNoteFormState("closed"); relatedBlockElement?.focus(); } }; (0,external_wp_element_namespaceObject.useEffect)(() => { setSelectedThread( newNoteFormState === "open" ? "new-note-thread" : blockCommentId ); }, [blockCommentId, newNoteFormState]); const setBlockRef = (0,external_wp_element_namespaceObject.useCallback)((id, blockRef) => { setBlockRefs((prev) => ({ ...prev, [id]: blockRef })); }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { const calculateAllOffsets = () => { const offsets = {}; if (!isFloating) { return { offsets, minHeight: 0 }; } const selectedThreadIndex = threads.findIndex( (t) => t.id === selectedThread ); const breakIndex = selectedThreadIndex === -1 ? 0 : selectedThreadIndex; const selectedThreadData = threads[breakIndex]; if (!selectedThreadData || !blockRefs[selectedThreadData.id]) { return { offsets, minHeight: 0 }; } let blockElement = blockRefs[selectedThreadData.id]; let blockRect = blockElement?.getBoundingClientRect(); const selectedThreadTop = blockRect?.top || 0; const selectedThreadHeight = heights[selectedThreadData.id] || 0; offsets[selectedThreadData.id] = -16; let previousThreadData = { threadTop: selectedThreadTop - 16, threadHeight: selectedThreadHeight }; for (let i = breakIndex + 1; i < threads.length; i++) { const thread = threads[i]; if (!blockRefs[thread.id]) { continue; } blockElement = blockRefs[thread.id]; blockRect = blockElement?.getBoundingClientRect(); const threadTop = blockRect?.top || 0; const threadHeight = heights[thread.id] || 0; let additionalOffset = -16; const previousBottom = previousThreadData.threadTop + previousThreadData.threadHeight; if (threadTop < previousBottom + 16) { additionalOffset = previousBottom - threadTop + 20; } offsets[thread.id] = additionalOffset; previousThreadData = { threadTop: threadTop + additionalOffset, threadHeight }; } let nextThreadData = { threadTop: selectedThreadTop - 16 }; for (let i = selectedThreadIndex - 1; i >= 0; i--) { const thread = threads[i]; if (!blockRefs[thread.id]) { continue; } blockElement = blockRefs[thread.id]; blockRect = blockElement?.getBoundingClientRect(); const threadTop = blockRect?.top || 0; const threadHeight = heights[thread.id] || 0; let additionalOffset = -16; const threadBottom = threadTop + threadHeight; if (threadBottom > nextThreadData.threadTop) { additionalOffset = nextThreadData.threadTop - threadTop - threadHeight - 20; } offsets[thread.id] = additionalOffset; nextThreadData = { threadTop: threadTop + additionalOffset }; } let editorMinHeight = 0; const lastThread = threads[threads.length - 1]; if (blockRefs[lastThread.id]) { const lastBlockElement = blockRefs[lastThread.id]; const lastBlockRect = lastBlockElement?.getBoundingClientRect(); const lastThreadTop = lastBlockRect?.top || 0; const lastThreadHeight = heights[lastThread.id] || 0; const lastThreadOffset = offsets[lastThread.id] || 0; editorMinHeight = lastThreadTop + lastThreadHeight + lastThreadOffset + 32; } return { offsets, minHeight: editorMinHeight }; }; const { offsets: newOffsets, minHeight } = calculateAllOffsets(); if (Object.keys(newOffsets).length > 0) { setBoardOffsets(newOffsets); } setCanvasMinHeight(minHeight); }, [ heights, blockRefs, isFloating, threads, selectedThread, setCanvasMinHeight, blockMode ]); const handleThreadNavigation = (event, thread, isSelected) => { if (event.defaultPrevented) { return; } const currentIndex = threads.findIndex((t) => t.id === thread.id); if ((event.key === "Enter" || event.key === "ArrowRight") && event.currentTarget === event.target && !isSelected) { setNewNoteFormState("closed"); setSelectedThread(thread.id); if (!!thread.blockClientId) { selectBlock(thread.blockClientId, null); toggleBlockSpotlight(thread.blockClientId, true); } } else if ((event.key === "Enter" || event.key === "ArrowLeft") && event.currentTarget === event.target && isSelected || event.key === "Escape") { setSelectedThread(null); setNewNoteFormState("closed"); if (thread.blockClientId) { toggleBlockSpotlight(thread.blockClientId, false); } focusCommentThread(thread.id, commentSidebarRef.current); } else if (event.key === "ArrowDown" && currentIndex < threads.length - 1 && event.currentTarget === event.target) { const nextThread = threads[currentIndex + 1]; focusCommentThread(nextThread.id, commentSidebarRef.current); } else if (event.key === "ArrowUp" && currentIndex > 0 && event.currentTarget === event.target) { const prevThread = threads[currentIndex - 1]; focusCommentThread(prevThread.id, commentSidebarRef.current); } else if (event.key === "Home" && event.currentTarget === event.target) { focusCommentThread(threads[0].id, commentSidebarRef.current); } else if (event.key === "End" && event.currentTarget === event.target) { focusCommentThread( threads[threads.length - 1].id, commentSidebarRef.current ); } }; const hasThreads = Array.isArray(threads) && threads.length > 0; if (!hasThreads && !isFloating) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AddComment, { onSubmit: onAddReply, newNoteFormState, setNewNoteFormState, commentSidebarRef } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ !isFloating && newNoteFormState === "open" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AddComment, { onSubmit: onAddReply, newNoteFormState, setNewNoteFormState, commentSidebarRef } ), threads.map((thread) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Thread, { thread, onAddReply, onCommentDelete: handleDelete, onEditComment, isSelected: selectedThread === thread.id, setSelectedThread, setNewNoteFormState, commentSidebarRef, reflowComments, isFloating, calculatedOffset: boardOffsets[thread.id] ?? 0, setHeights, setBlockRef, selectedThread, commentLastUpdated, newNoteFormState, onKeyDown: (event) => handleThreadNavigation( event, thread, selectedThread === thread.id ) }, thread.id )) ] }); } function Thread({ thread, onEditComment, onAddReply, onCommentDelete, isSelected, setNewNoteFormState, commentSidebarRef, reflowComments, isFloating, calculatedOffset, setHeights, setBlockRef, setSelectedThread, selectedThread, commentLastUpdated, newNoteFormState, onKeyDown }) { const { toggleBlockHighlight, selectBlock, toggleBlockSpotlight } = unlock( (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store) ); const relatedBlockElement = comments_useBlockElement(thread.blockClientId); const debouncedToggleBlockHighlight = (0,external_wp_compose_namespaceObject.useDebounce)( toggleBlockHighlight, 50 ); const { y, refs } = useFloatingThread({ thread, calculatedOffset, setHeights, setBlockRef, selectedThread, commentLastUpdated }); const isKeyboardTabbingRef = (0,external_wp_element_namespaceObject.useRef)(false); const onMouseEnter = () => { debouncedToggleBlockHighlight(thread.blockClientId, true); }; const onMouseLeave = () => { debouncedToggleBlockHighlight(thread.blockClientId, false); }; const onFocus = () => { toggleBlockHighlight(thread.blockClientId, true); }; const onBlur = (event) => { const isNoteFocused = event.relatedTarget?.closest( ".editor-collab-sidebar-panel__thread" ); const isDialogFocused = event.relatedTarget?.closest('[role="dialog"]'); const isTabbing = isKeyboardTabbingRef.current; if (isNoteFocused && !isTabbing) { return; } if (isDialogFocused) { return; } if (isTabbing && event.currentTarget.contains(event.relatedTarget)) { return; } toggleBlockHighlight(thread.blockClientId, false); unselectThread(); }; const handleCommentSelect = () => { setNewNoteFormState("closed"); setSelectedThread(thread.id); toggleBlockSpotlight(thread.blockClientId, true); if (!!thread.blockClientId) { selectBlock(thread.blockClientId, null); } }; const unselectThread = () => { setSelectedThread(null); setNewNoteFormState("closed"); toggleBlockSpotlight(thread.blockClientId, false); }; const allReplies = thread?.reply || []; const lastReply = allReplies.length > 0 ? allReplies[allReplies.length - 1] : void 0; const restReplies = allReplies.length > 0 ? allReplies.slice(0, -1) : []; const commentExcerpt = getCommentExcerpt( (0,external_wp_dom_namespaceObject.__unstableStripHTML)(thread.content?.rendered), 10 ); const ariaLabel = !!thread.blockClientId ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: note excerpt (0,external_wp_i18n_namespaceObject.__)("Note: %s"), commentExcerpt ) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: note excerpt (0,external_wp_i18n_namespaceObject.__)("Original block deleted. Note: %s"), commentExcerpt ); if (thread.id === "new-note-thread" && newNoteFormState === "open" && isFloating) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AddComment, { onSubmit: onAddReply, newNoteFormState, setNewNoteFormState, commentSidebarRef, reflowComments, isFloating, y, refs } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { className: dist_clsx("editor-collab-sidebar-panel__thread", { "is-selected": isSelected, "is-floating": isFloating }), id: `comment-thread-${thread.id}`, spacing: "3", onClick: handleCommentSelect, onMouseEnter, onMouseLeave, onFocus, onBlur, onKeyUp: (event) => { if (event.key === "Tab") { isKeyboardTabbingRef.current = false; } }, onKeyDown: (event) => { if (event.key === "Tab") { isKeyboardTabbingRef.current = true; } else { onKeyDown(event); } }, tabIndex: 0, role: "treeitem", "aria-label": ariaLabel, "aria-expanded": isSelected, ref: isFloating ? refs.setFloating : void 0, style: isFloating ? { top: y } : void 0, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { className: "editor-collab-sidebar-panel__skip-to-comment", variant: "secondary", size: "compact", onClick: () => { focusCommentThread( thread.id, commentSidebarRef.current, "textarea" ); }, children: (0,external_wp_i18n_namespaceObject.__)("Add new reply") } ), !thread.blockClientId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", weight: 500, variant: "muted", children: (0,external_wp_i18n_namespaceObject.__)("Original block deleted.") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CommentBoard, { thread, isExpanded: isSelected, onEdit: (params = {}) => { onEditComment(params); if (params.status === "approved") { unselectThread(); if (isFloating) { relatedBlockElement?.focus(); } else { focusCommentThread( thread.id, commentSidebarRef.current ); } } }, onDelete: onCommentDelete, reflowComments } ), isSelected && allReplies.map((reply) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CommentBoard, { thread: reply, parent: thread, isExpanded: isSelected, onEdit: onEditComment, onDelete: onCommentDelete, reflowComments }, reply.id )), !isSelected && restReplies.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { className: "editor-collab-sidebar-panel__more-reply-separator", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", variant: "tertiary", className: "editor-collab-sidebar-panel__more-reply-button", onClick: () => { setSelectedThread(thread.id); focusCommentThread( thread.id, commentSidebarRef.current ); }, children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: number of replies. (0,external_wp_i18n_namespaceObject._n)( "%s more reply", "%s more replies", restReplies.length ), restReplies.length ) } ) }), !isSelected && lastReply && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CommentBoard, { thread: lastReply, parent: thread, isExpanded: isSelected, onEdit: onEditComment, onDelete: onCommentDelete, reflowComments } ), isSelected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "2", role: "treeitem", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_author_info_default, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "2", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( comment_form_default, { onSubmit: (inputComment) => { if ("approved" === thread.status) { onEditComment({ id: thread.id, status: "hold", content: inputComment }); } else { onAddReply({ content: inputComment, parent: thread.id }); } }, onCancel: (event) => { event.stopPropagation(); unselectThread(); focusCommentThread( thread.id, commentSidebarRef.current ); }, submitButtonText: "approved" === thread.status ? (0,external_wp_i18n_namespaceObject.__)("Reopen & Reply") : (0,external_wp_i18n_namespaceObject.__)("Reply"), rows: "approved" === thread.status ? 2 : 4, labelText: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: note identifier, %2$s: author name (0,external_wp_i18n_namespaceObject.__)("Reply to note %1$s by %2$s"), thread.id, thread.author_name ), reflowComments } ) }) ] }), !!thread.blockClientId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { className: "editor-collab-sidebar-panel__skip-to-block", variant: "secondary", size: "compact", onClick: (event) => { event.stopPropagation(); relatedBlockElement?.focus(); }, children: (0,external_wp_i18n_namespaceObject.__)("Back to block") } ) ] } ); } const CommentBoard = ({ thread, parent, isExpanded, onEdit, onDelete, reflowComments }) => { const [actionState, setActionState] = (0,external_wp_element_namespaceObject.useState)(false); const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); const actionButtonRef = (0,external_wp_element_namespaceObject.useRef)(null); const handleConfirmDelete = () => { onDelete(thread); setActionState(false); setShowConfirmDialog(false); }; const handleCancel = () => { setActionState(false); setShowConfirmDialog(false); actionButtonRef.current?.focus(); }; const isResolutionComment = thread.type === "note" && thread.meta && (thread.meta._wp_note_status === "resolved" || thread.meta._wp_note_status === "reopen"); const actions = [ { id: "edit", title: (0,external_wp_i18n_namespaceObject.__)("Edit"), isEligible: ({ status }) => status !== "approved", onClick: () => { setActionState("edit"); } }, { id: "reopen", title: (0,external_wp_i18n_namespaceObject._x)("Reopen", "Reopen note"), isEligible: ({ status }) => status === "approved", onClick: () => { onEdit({ id: thread.id, status: "hold" }); } }, { id: "delete", title: (0,external_wp_i18n_namespaceObject.__)("Delete"), isEligible: () => true, onClick: () => { setActionState("delete"); setShowConfirmDialog(true); } } ]; const canResolve = thread.parent === 0; const moreActions = parent?.status !== "approved" ? actions.filter((item) => item.isEligible(thread)) : []; const deleteConfirmMessage = ( // When deleting a top level note, descendants will also be deleted. thread.parent === 0 ? (0,external_wp_i18n_namespaceObject.__)( "Are you sure you want to delete this note? This will also delete all of this note's replies." ) : (0,external_wp_i18n_namespaceObject.__)("Are you sure you want to delete this reply?") ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { spacing: "2", role: thread.parent !== 0 ? "treeitem" : void 0, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( comment_author_info_default, { avatar: thread?.author_avatar_urls?.[48], name: thread?.author_name, date: thread?.date, userId: thread?.author } ), isExpanded && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FlexItem, { className: "editor-collab-sidebar-panel__comment-status", onClick: (event) => { event.stopPropagation(); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: "0", children: [ canResolve && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { label: (0,external_wp_i18n_namespaceObject._x)( "Resolve", "Mark note as resolved" ), size: "small", icon: published_default, disabled: thread.status === "approved", accessibleWhenDisabled: thread.status === "approved", onClick: () => { onEdit({ id: thread.id, status: "approved" }); } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(comments_Menu, { placement: "bottom-end", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( comments_Menu.TriggerButton, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { ref: actionButtonRef, size: "small", icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("Actions"), disabled: !moreActions.length, accessibleWhenDisabled: true } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( comments_Menu.Popover, { modal: false, children: moreActions.map((action) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( comments_Menu.Item, { onClick: () => action.onClick(), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(comments_Menu.ItemLabel, { children: action.title }) }, action.id )) } ) ] }) ] }) } ) ] }), "edit" === actionState ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( comment_form_default, { onSubmit: (value) => { onEdit({ id: thread.id, content: value }); setActionState(false); actionButtonRef.current?.focus(); }, onCancel: () => handleCancel(), thread, submitButtonText: (0,external_wp_i18n_namespaceObject._x)("Update", "verb"), labelText: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: note identifier, %2$s: author name. (0,external_wp_i18n_namespaceObject.__)("Edit note %1$s by %2$s"), thread.id, thread.author_name ), reflowComments } ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_element_namespaceObject.RawHTML, { className: dist_clsx( "editor-collab-sidebar-panel__user-comment", { "editor-collab-sidebar-panel__resolution-text": isResolutionComment } ), children: isResolutionComment ? (() => { const actionText = thread.meta._wp_note_status === "resolved" ? (0,external_wp_i18n_namespaceObject.__)("Marked as resolved") : (0,external_wp_i18n_namespaceObject.__)("Reopened"); const content = thread?.content?.raw; if (content && typeof content === "string" && content.trim() !== "") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: action label ("Marked as resolved" or "Reopened"); %2$s: note text. (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"), actionText, content ); } return actionText; })() : thread?.content?.rendered } ), "delete" === actionState && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: showConfirmDialog, onConfirm: handleConfirmDelete, onCancel: handleCancel, confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"), children: deleteConfirmMessage } ) ] } ); }; var comments_default = (/* unused pure expression or super */ null && (Comments)); ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-menu-item.js const { CommentIconSlotFill } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const AddCommentMenuItem = ({ clientId, onClick, isDistractionFree }) => { const block = (0,external_wp_data_namespaceObject.useSelect)( (select) => { return select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId); }, [clientId] ); if (!block?.isValid || block?.name === (0,external_wp_blocks_namespaceObject.getUnregisteredTypeHandlerName)()) { return null; } const isDisabled = isDistractionFree || block?.name === "core/freeform"; let infoText; if (isDistractionFree) { infoText = (0,external_wp_i18n_namespaceObject.__)("Notes are disabled in distraction free mode."); } else if (block?.name === "core/freeform") { infoText = (0,external_wp_i18n_namespaceObject.__)("Convert to blocks to add notes."); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: comment_default, onClick, "aria-haspopup": "dialog", disabled: isDisabled, info: infoText, children: (0,external_wp_i18n_namespaceObject.__)("Add note") } ); }; const AddCommentMenuItemFill = ({ onClick, isDistractionFree }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CommentIconSlotFill.Fill, { children: ({ clientId, onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AddCommentMenuItem, { clientId, isDistractionFree, onClick: () => { onClick(); onClose(); } } ) }); }; var comment_menu_item_default = AddCommentMenuItemFill; ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-indicator-toolbar.js const { CommentIconToolbarSlotFill } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const CommentAvatarIndicator = ({ onClick, thread }) => { const threadParticipants = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!thread) { return []; } const participantsMap = /* @__PURE__ */ new Map(); const allComments = [thread, ...thread.reply]; allComments.sort((a, b) => new Date(a.date) - new Date(b.date)); allComments.forEach((comment) => { if (comment.author_name && comment.author_avatar_urls) { if (!participantsMap.has(comment.author)) { participantsMap.set(comment.author, { name: comment.author_name, avatar: comment.author_avatar_urls?.["48"] || comment.author_avatar_urls?.["96"], id: comment.author, date: comment.date }); } } }); return Array.from(participantsMap.values()); }, [thread]); if (!threadParticipants.length) { return null; } const maxAvatars = 3; const isOverflow = threadParticipants.length > maxAvatars; const visibleParticipants = isOverflow ? threadParticipants.slice(0, maxAvatars - 1) : threadParticipants; const overflowCount = Math.max( 0, threadParticipants.length - visibleParticipants.length ); const threadHasMoreParticipants = threadParticipants.length > 100; const overflowText = threadHasMoreParticipants && overflowCount > 0 ? (0,external_wp_i18n_namespaceObject.__)("100+") : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Number of participants. (0,external_wp_i18n_namespaceObject.__)("+%s"), overflowCount ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CommentIconToolbarSlotFill.Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { className: "comment-avatar-indicator", label: (0,external_wp_i18n_namespaceObject.__)("View notes"), onClick, showTooltip: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: "1", children: [ visibleParticipants.map((participant) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { src: participant.avatar, alt: participant.name, className: "comment-avatar", style: { borderColor: getAvatarBorderColor( participant.id ) } }, participant.id )), overflowCount > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { weight: 500, children: overflowText }) ] }) } ) }); }; var comment_indicator_toolbar_default = CommentAvatarIndicator; ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/index.js function NotesSidebarContent({ newNoteFormState, setNewNoteFormState, styles, comments, commentSidebarRef, reflowComments, commentLastUpdated, isFloating = false }) { const { onCreate, onEdit, onDelete } = useBlockCommentsActions(reflowComments); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalVStack, { className: "editor-collab-sidebar-panel", style: styles, role: "tree", spacing: "3", justify: "flex-start", ref: (node) => { if (node) { commentSidebarRef.current = node; } }, "aria-label": isFloating ? (0,external_wp_i18n_namespaceObject.__)("Unresolved notes") : (0,external_wp_i18n_namespaceObject.__)("All notes"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Comments, { threads: comments, onEditComment: onEdit, onAddReply: onCreate, onCommentDelete: onDelete, newNoteFormState, setNewNoteFormState, commentSidebarRef, reflowComments, commentLastUpdated, isFloating } ) } ); } function NotesSidebar({ postId, mode }) { const [newNoteFormState, setNewNoteFormState] = (0,external_wp_element_namespaceObject.useState)("closed"); const { getActiveComplementaryArea } = (0,external_wp_data_namespaceObject.useSelect)(store); const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { toggleBlockSpotlight } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); const commentSidebarRef = (0,external_wp_element_namespaceObject.useRef)(null); const showFloatingSidebar = isLargeViewport && mode === "post-only"; const { clientId, blockCommentId, isDistractionFree } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockAttributes, getSelectedBlockClientId, getSettings } = select(external_wp_blockEditor_namespaceObject.store); const _clientId = getSelectedBlockClientId(); return { clientId: _clientId, blockCommentId: _clientId ? getBlockAttributes(_clientId)?.metadata?.noteId : null, isDistractionFree: getSettings().isDistractionFree }; }, [] ); const { resultComments, unresolvedSortedThreads, reflowComments, commentLastUpdated } = useBlockComments(postId); useEnableFloatingSidebar( showFloatingSidebar && (unresolvedSortedThreads.length > 0 || newNoteFormState !== "closed") ); const { merged: GlobalStyles } = useGlobalStylesContext(); const backgroundColor = GlobalStyles?.styles?.color?.background; const currentThread = blockCommentId ? resultComments.find((thread) => thread.id === blockCommentId) : null; const showAllNotesSidebar = resultComments.length > 0 || !showFloatingSidebar; async function openTheSidebar() { const prevArea = await getActiveComplementaryArea("core"); const activeNotesArea = SIDEBARS.find((name) => name === prevArea); if (currentThread?.status === "approved") { enableComplementaryArea("core", collabHistorySidebarName); } else if (!activeNotesArea || !showAllNotesSidebar) { enableComplementaryArea( "core", showFloatingSidebar ? collabSidebarName : collabHistorySidebarName ); } const currentArea = await getActiveComplementaryArea("core"); if (!SIDEBARS.includes(currentArea)) { return; } setNewNoteFormState(!currentThread ? "open" : "closed"); focusCommentThread( currentThread?.id, commentSidebarRef.current, // Focus a comment thread when there's a selected block with a comment. !currentThread ? "textarea" : void 0 ); toggleBlockSpotlight(clientId, true); } if (isDistractionFree) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_menu_item_default, { isDistractionFree: true }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ !!currentThread && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( comment_indicator_toolbar_default, { thread: currentThread, onClick: openTheSidebar } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_menu_item_default, { onClick: openTheSidebar }), showAllNotesSidebar && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PluginSidebar, { identifier: collabHistorySidebarName, name: collabHistorySidebarName, title: (0,external_wp_i18n_namespaceObject.__)("All notes"), header: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "interface-complementary-area-header__title", children: (0,external_wp_i18n_namespaceObject.__)("All notes") }), icon: comment_default, closeLabel: (0,external_wp_i18n_namespaceObject.__)("Close Notes"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( NotesSidebarContent, { comments: resultComments, newNoteFormState, setNewNoteFormState, commentSidebarRef, reflowComments, commentLastUpdated } ) } ), isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PluginSidebar, { isPinnable: false, header: false, identifier: collabSidebarName, className: "editor-collab-sidebar", headerClassName: "editor-collab-sidebar__header", backgroundColor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( NotesSidebarContent, { comments: unresolvedSortedThreads, newNoteFormState, setNewNoteFormState, commentSidebarRef, reflowComments, commentLastUpdated, styles: { backgroundColor }, isFloating: true } ) } ) ] }); } function NotesSidebarContainer() { const { postId, mode, editorMode } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCurrentPostId, getRenderingMode, getEditorMode } = select(store_store); return { postId: getCurrentPostId(), mode: getRenderingMode(), editorMode: getEditorMode() }; }, []); if (!postId || typeof postId !== "number") { return null; } if (editorMode === "text") { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "editor.notes", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NotesSidebar, { postId, mode }) }); } ;// ./node_modules/@wordpress/editor/build-module/components/editor/index.js function Editor({ postType, postId, templateId, settings, children, initialEdits, // This could be part of the settings. onActionPerformed, // The following abstractions are not ideal but necessary // to account for site editor and post editor differences for now. extraContent, extraSidebarPanels, ...props }) { const { post, template, hasLoadedPost, error } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEntityRecord, getResolutionError, hasFinishedResolution } = select(external_wp_coreData_namespaceObject.store); const postArgs = ["postType", postType, postId]; return { post: getEntityRecord(...postArgs), template: templateId ? getEntityRecord( "postType", TEMPLATE_POST_TYPE, templateId ) : void 0, hasLoadedPost: hasFinishedResolution( "getEntityRecord", postArgs ), error: getResolutionError("getEntityRecord", postArgs)?.message }; }, [postType, postId, templateId] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ hasLoadedPost && !post && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Notice, { status: !!error ? "error" : "warning", isDismissible: false, children: !error ? (0,external_wp_i18n_namespaceObject.__)( "You attempted to edit an item that doesn't exist. Perhaps it was deleted?" ) : error } ), !!post && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( ExperimentalEditorProvider, { post, __unstableTemplate: template, settings, initialEdits, useSubRegistry: false, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorInterface, { ...props, children: extraContent }), children, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( sidebar_sidebar_default, { onActionPerformed, extraPanels: extraSidebarPanels } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NotesSidebarContainer, {}) ] } ) ] }); } var editor_default = Editor; ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-publish-sidebar.js const { PreferenceBaseOption: enable_publish_sidebar_PreferenceBaseOption } = unlock(external_wp_preferences_namespaceObject.privateApis); function EnablePublishSidebarOption(props) { const isChecked = (0,external_wp_data_namespaceObject.useSelect)((select) => { return select(store_store).isPublishSidebarEnabled(); }, []); const { enablePublishSidebar, disablePublishSidebar } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( enable_publish_sidebar_PreferenceBaseOption, { isChecked, onChange: (isEnabled) => isEnabled ? enablePublishSidebar() : disablePublishSidebar(), ...props } ); } ;// ./node_modules/@wordpress/editor/build-module/components/block-visibility/index.js const { BlockManager } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const block_visibility_EMPTY_ARRAY = []; function BlockVisibility() { const { showBlockTypes, hideBlockTypes } = unlock( (0,external_wp_data_namespaceObject.useDispatch)(store_store) ); const { blockTypes, allowedBlockTypes: _allowedBlockTypes, hiddenBlockTypes: _hiddenBlockTypes } = (0,external_wp_data_namespaceObject.useSelect)((select) => { return { blockTypes: select(external_wp_blocks_namespaceObject.store).getBlockTypes(), allowedBlockTypes: select(store_store).getEditorSettings().allowedBlockTypes, hiddenBlockTypes: select(external_wp_preferences_namespaceObject.store).get("core", "hiddenBlockTypes") ?? block_visibility_EMPTY_ARRAY }; }, []); const allowedBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { if (_allowedBlockTypes === true) { return blockTypes; } return blockTypes.filter(({ name }) => { return _allowedBlockTypes?.includes(name); }); }, [_allowedBlockTypes, blockTypes]); const filteredBlockTypes = allowedBlockTypes.filter( (blockType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "inserter", true) && (!blockType.parent || blockType.parent.includes("core/post-content")) ); const hiddenBlockTypes = _hiddenBlockTypes.filter((hiddenBlock) => { return filteredBlockTypes.some( (registeredBlock) => registeredBlock.name === hiddenBlock ); }); const selectedBlockTypes = filteredBlockTypes.filter( (blockType) => !hiddenBlockTypes.includes(blockType.name) ); const numberOfHiddenBlocks = filteredBlockTypes.length - selectedBlockTypes.length; function enableAllBlockTypes() { onChangeSelectedBlockTypes(filteredBlockTypes); } const onChangeSelectedBlockTypes = (newSelectedBlockTypes) => { if (selectedBlockTypes.length > newSelectedBlockTypes.length) { const blockTypesToHide = selectedBlockTypes.filter( (blockType) => !newSelectedBlockTypes.find( ({ name }) => name === blockType.name ) ); hideBlockTypes(blockTypesToHide.map(({ name }) => name)); } else if (selectedBlockTypes.length < newSelectedBlockTypes.length) { const blockTypesToShow = newSelectedBlockTypes.filter( (blockType) => !selectedBlockTypes.find( ({ name }) => name === blockType.name ) ); showBlockTypes(blockTypesToShow.map(({ name }) => name)); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-block-visibility", children: [ !!numberOfHiddenBlocks && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-block-visibility__disabled-blocks-count", children: [ (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of blocks. */ (0,external_wp_i18n_namespaceObject._n)( "%d block is hidden.", "%d blocks are hidden.", numberOfHiddenBlocks ), numberOfHiddenBlocks ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", onClick: enableAllBlockTypes, children: (0,external_wp_i18n_namespaceObject.__)("Reset") } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockManager, { blockTypes: filteredBlockTypes, selectedBlockTypes, onChange: onChangeSelectedBlockTypes, showSelectAll: false } ) ] }); } ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/index.js const { PreferencesModal, PreferencesModalTabs, PreferencesModalSection, PreferenceToggleControl } = unlock(external_wp_preferences_namespaceObject.privateApis); function EditorPreferencesModal({ extraSections = {} }) { const isActive = (0,external_wp_data_namespaceObject.useSelect)((select) => { return select(store).isModalActive("editor/preferences"); }, []); const { closeModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (!isActive) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, { closeModal, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalContents, { extraSections }) }); } function PreferencesModalContents({ extraSections = {} }) { const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); const showBlockBreadcrumbsOption = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEditorSettings } = select(store_store); const { get } = select(external_wp_preferences_namespaceObject.store); const isRichEditingEnabled = getEditorSettings().richEditingEnabled; const isDistractionFreeEnabled = get("core", "distractionFree"); return !isDistractionFreeEnabled && isLargeViewport && isRichEditingEnabled; }, [isLargeViewport] ); const { setIsListViewOpened, setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const sections = (0,external_wp_element_namespaceObject.useMemo)( () => [ { name: "general", tabLabel: (0,external_wp_i18n_namespaceObject.__)("General"), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)("Interface"), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferenceToggleControl, { scope: "core", featureName: "showListViewByDefault", help: (0,external_wp_i18n_namespaceObject.__)( "Opens the List View panel by default." ), label: (0,external_wp_i18n_namespaceObject.__)("Always open List View") } ), showBlockBreadcrumbsOption && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferenceToggleControl, { scope: "core", featureName: "showBlockBreadcrumbs", help: (0,external_wp_i18n_namespaceObject.__)( "Display the block hierarchy trail at the bottom of the editor." ), label: (0,external_wp_i18n_namespaceObject.__)("Show block breadcrumbs") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferenceToggleControl, { scope: "core", featureName: "allowRightClickOverrides", help: (0,external_wp_i18n_namespaceObject.__)( "Allows contextual List View menus via right-click, overriding browser defaults." ), label: (0,external_wp_i18n_namespaceObject.__)( "Allow right-click contextual menus" ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferenceToggleControl, { scope: "core", featureName: "enableChoosePatternModal", help: (0,external_wp_i18n_namespaceObject.__)( "Pick from starter content when creating a new page." ), label: (0,external_wp_i18n_namespaceObject.__)("Show starter patterns") } ) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)("Document settings"), description: (0,external_wp_i18n_namespaceObject.__)( "Select what settings are shown in the document panel." ), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_plugin_document_setting_panel_default.Slot, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( post_taxonomies_default, { taxonomyWrapper: (content, taxonomy) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EnablePanelOption, { label: taxonomy.labels.menu_name, panelName: `taxonomy-panel-${taxonomy.slug}` } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EnablePanelOption, { label: (0,external_wp_i18n_namespaceObject.__)("Featured image"), panelName: "featured-image" } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EnablePanelOption, { label: (0,external_wp_i18n_namespaceObject.__)("Excerpt"), panelName: "post-excerpt" } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( post_type_support_check_default, { supportKeys: ["comments", "trackbacks"], children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EnablePanelOption, { label: (0,external_wp_i18n_namespaceObject.__)("Discussion"), panelName: "discussion-panel" } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EnablePanelOption, { label: (0,external_wp_i18n_namespaceObject.__)("Page attributes"), panelName: "page-attributes" } ) }) ] } ), isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)("Publishing"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EnablePublishSidebarOption, { help: (0,external_wp_i18n_namespaceObject.__)( "Review settings, such as visibility and tags." ), label: (0,external_wp_i18n_namespaceObject.__)( "Enable pre-publish checks" ) } ) } ), extraSections?.general ] }) }, { name: "appearance", tabLabel: (0,external_wp_i18n_namespaceObject.__)("Appearance"), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)("Appearance"), description: (0,external_wp_i18n_namespaceObject.__)( "Customize the editor interface to suit your needs." ), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferenceToggleControl, { scope: "core", featureName: "fixedToolbar", onToggle: () => setPreference( "core", "distractionFree", false ), help: (0,external_wp_i18n_namespaceObject.__)( "Access all block and document tools in a single place." ), label: (0,external_wp_i18n_namespaceObject.__)("Top toolbar") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferenceToggleControl, { scope: "core", featureName: "distractionFree", onToggle: () => { setPreference( "core", "fixedToolbar", true ); setIsInserterOpened(false); setIsListViewOpened(false); }, help: (0,external_wp_i18n_namespaceObject.__)( "Reduce visual distractions by hiding the toolbar and other elements to focus on writing." ), label: (0,external_wp_i18n_namespaceObject.__)("Distraction free") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferenceToggleControl, { scope: "core", featureName: "focusMode", help: (0,external_wp_i18n_namespaceObject.__)( "Highlights the current block and fades other content." ), label: (0,external_wp_i18n_namespaceObject.__)("Spotlight mode") } ), extraSections?.appearance ] } ) }, { name: "accessibility", tabLabel: (0,external_wp_i18n_namespaceObject.__)("Accessibility"), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)("Navigation"), description: (0,external_wp_i18n_namespaceObject.__)( "Optimize the editing experience for enhanced control." ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferenceToggleControl, { scope: "core", featureName: "keepCaretInsideBlock", help: (0,external_wp_i18n_namespaceObject.__)( "Keeps the text cursor within blocks while navigating with arrow keys, preventing it from moving to other blocks and enhancing accessibility for keyboard users." ), label: (0,external_wp_i18n_namespaceObject.__)( "Contain text cursor inside block" ) } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)("Interface"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferenceToggleControl, { scope: "core", featureName: "showIconLabels", label: (0,external_wp_i18n_namespaceObject.__)("Show button text labels"), help: (0,external_wp_i18n_namespaceObject.__)( "Show text instead of icons on buttons across the interface." ) } ) } ) ] }) }, { name: "blocks", tabLabel: (0,external_wp_i18n_namespaceObject.__)("Blocks"), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)("Inserter"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferenceToggleControl, { scope: "core", featureName: "mostUsedBlocks", help: (0,external_wp_i18n_namespaceObject.__)( "Adds a category with the most frequently used blocks in the inserter." ), label: (0,external_wp_i18n_namespaceObject.__)("Show most used blocks") } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)("Manage block visibility"), description: (0,external_wp_i18n_namespaceObject.__)( "Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later." ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockVisibility, {}) } ) ] }) }, window.__experimentalMediaProcessing && { name: "media", tabLabel: (0,external_wp_i18n_namespaceObject.__)("Media"), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)("General"), description: (0,external_wp_i18n_namespaceObject.__)( "Customize options related to the media upload flow." ), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferenceToggleControl, { scope: "core/media", featureName: "optimizeOnUpload", help: (0,external_wp_i18n_namespaceObject.__)( "Compress media items before uploading to the server." ), label: (0,external_wp_i18n_namespaceObject.__)("Pre-upload compression") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreferenceToggleControl, { scope: "core/media", featureName: "requireApproval", help: (0,external_wp_i18n_namespaceObject.__)( "Require approval step when optimizing existing media." ), label: (0,external_wp_i18n_namespaceObject.__)("Approval step") } ) ] } ) }) } ].filter(Boolean), [ showBlockBreadcrumbsOption, extraSections, setIsInserterOpened, setIsListViewOpened, setPreference, isLargeViewport ] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalTabs, { sections }); } ;// ./node_modules/@wordpress/editor/build-module/components/post-fields/index.js function usePostFields({ postType }) { const { registerPostTypeSchema } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); (0,external_wp_element_namespaceObject.useEffect)(() => { registerPostTypeSchema(postType); }, [registerPostTypeSchema, postType]); const { fields } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEntityFields } = unlock(select(store_store)); return { fields: getEntityFields("postType", postType) }; }, [postType] ); return fields; } var post_fields_default = usePostFields; ;// ./node_modules/@wordpress/editor/build-module/bindings/pattern-overrides.js const CONTENT = "content"; var pattern_overrides_default = { name: "core/pattern-overrides", getValues({ select, clientId, context, bindings }) { const patternOverridesContent = context["pattern/overrides"]; const { getBlockAttributes } = select(external_wp_blockEditor_namespaceObject.store); const currentBlockAttributes = getBlockAttributes(clientId); const overridesValues = {}; for (const attributeName of Object.keys(bindings)) { const overridableValue = patternOverridesContent?.[currentBlockAttributes?.metadata?.name]?.[attributeName]; if (overridableValue === void 0) { overridesValues[attributeName] = currentBlockAttributes[attributeName]; continue; } else { overridesValues[attributeName] = overridableValue === "" ? void 0 : overridableValue; } } return overridesValues; }, setValues({ select, dispatch, clientId, bindings }) { const { getBlockAttributes, getBlockParentsByBlockName, getBlocks } = select(external_wp_blockEditor_namespaceObject.store); const currentBlockAttributes = getBlockAttributes(clientId); const blockName = currentBlockAttributes?.metadata?.name; if (!blockName) { return; } const [patternClientId] = getBlockParentsByBlockName( clientId, "core/block", true ); const attributes = Object.entries(bindings).reduce( (attrs, [key, { newValue }]) => { attrs[key] = newValue; return attrs; }, {} ); if (!patternClientId) { const syncBlocksWithSameName = (blocks) => { for (const block of blocks) { if (block.attributes?.metadata?.name === blockName) { dispatch(external_wp_blockEditor_namespaceObject.store).updateBlockAttributes( block.clientId, attributes ); } syncBlocksWithSameName(block.innerBlocks); } }; syncBlocksWithSameName(getBlocks()); return; } const currentBindingValue = getBlockAttributes(patternClientId)?.[CONTENT]; dispatch(external_wp_blockEditor_namespaceObject.store).updateBlockAttributes(patternClientId, { [CONTENT]: { ...currentBindingValue, [blockName]: { ...currentBindingValue?.[blockName], ...Object.entries(attributes).reduce( (acc, [key, value]) => { acc[key] = value === void 0 ? "" : value; return acc; }, {} ) } } }); }, canUserEditValue: () => true }; ;// ./node_modules/@wordpress/editor/build-module/bindings/post-data.js const NAVIGATION_BLOCK_TYPES = [ "core/navigation-link", "core/navigation-submenu" ]; const postDataFields = [ { label: (0,external_wp_i18n_namespaceObject.__)("Post Date"), args: { field: "date" }, type: "string" }, { label: (0,external_wp_i18n_namespaceObject.__)("Post Modified Date"), args: { field: "modified" }, type: "string" }, { label: (0,external_wp_i18n_namespaceObject.__)("Post Link"), args: { field: "link" }, type: "string" } ]; var post_data_default = { name: "core/post-data", getValues({ select, context, bindings, clientId }) { const allowedFields = postDataFields.map( (field) => field.args.field ); const { getBlockAttributes, getBlockName } = select(external_wp_blockEditor_namespaceObject.store); const blockName = getBlockName?.(clientId); const isNavigationBlock = NAVIGATION_BLOCK_TYPES.includes(blockName); let postId, postType; if (isNavigationBlock) { const blockAttributes = getBlockAttributes?.(clientId); postId = blockAttributes?.id; postType = blockAttributes?.type; } else { postId = context?.postId; postType = context?.postType; } const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const entityDataValues = getEditedEntityRecord( "postType", postType, postId ); const newValues = {}; for (const [attributeName, binding] of Object.entries(bindings)) { if (!allowedFields.includes(binding.args.field)) { newValues[attributeName] = {}; continue; } newValues[attributeName] = entityDataValues?.[binding.args.field] ?? postDataFields.find( (field) => field.args.field === binding.args.field ).label; } return newValues; }, setValues({ dispatch, context, bindings, clientId, select }) { const { getBlockName } = select(external_wp_blockEditor_namespaceObject.store); const blockName = getBlockName?.(clientId); if (NAVIGATION_BLOCK_TYPES.includes(blockName)) { return false; } const newData = {}; Object.values(bindings).forEach(({ args, newValue }) => { newData[args.field] = newValue; }); dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord( "postType", context?.postType, context?.postId, newData ); }, canUserEditValue({ select, context }) { const { getBlockName, getSelectedBlockClientId } = select(external_wp_blockEditor_namespaceObject.store); const clientId = getSelectedBlockClientId(); const blockName = getBlockName?.(clientId); if (NAVIGATION_BLOCK_TYPES.includes(blockName)) { return false; } if (context?.query || context?.queryId) { return false; } if (!context?.postType) { return false; } const canUserEdit = select(external_wp_coreData_namespaceObject.store).canUser("update", { kind: "postType", name: context?.postType, id: context?.postId }); if (!canUserEdit) { return false; } return true; }, getFieldsList({ select }) { const selectedBlock = select(external_wp_blockEditor_namespaceObject.store).getSelectedBlock(); if (selectedBlock?.name !== "core/post-date") { return []; } if (NAVIGATION_BLOCK_TYPES.includes(selectedBlock?.name)) { return []; } return postDataFields; } }; ;// ./node_modules/@wordpress/editor/build-module/bindings/post-meta.js function getPostMetaFields(select, context) { const { getRegisteredPostMeta } = unlock(select(external_wp_coreData_namespaceObject.store)); const registeredFields = getRegisteredPostMeta(context?.postType); const metaFields = []; Object.entries(registeredFields).forEach(([key, props]) => { if (key === "footnotes" || key.charAt(0) === "_") { return; } metaFields.push({ label: props.title || key, args: { key }, default: props.default, type: props.type }); }); return metaFields; } function getValue({ select, context, args }) { const metaFields = getPostMetaFields(select, context); const metaField = metaFields.find( (field) => field.args.key === args.key ); if (!metaField) { return args.key; } if (!context?.postId) { return metaField.default || metaField.label || args.key; } const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); const entityMetaValues = getEditedEntityRecord( "postType", context?.postType, context?.postId ).meta; return entityMetaValues?.[args.key] ?? metaField?.label ?? args.key; } var post_meta_default = { name: "core/post-meta", getValues({ select, context, bindings }) { const newValues = {}; for (const [attributeName, binding] of Object.entries(bindings)) { newValues[attributeName] = getValue({ select, context, args: binding.args }); } return newValues; }, setValues({ dispatch, context, bindings }) { const newMeta = {}; Object.values(bindings).forEach(({ args, newValue }) => { newMeta[args.key] = newValue; }); dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord( "postType", context?.postType, context?.postId, { meta: newMeta } ); }, canUserEditValue({ select, context, args }) { if (context?.query || context?.queryId) { return false; } if (!context?.postType) { return false; } const metaFields = getPostMetaFields(select, context); const hasMatchingMetaField = metaFields.some( (field) => field.args.key === args.key ); if (!hasMatchingMetaField) { return false; } const areCustomFieldsEnabled = select(store_store).getEditorSettings().enableCustomFields; if (areCustomFieldsEnabled) { return false; } const canUserEdit = select(external_wp_coreData_namespaceObject.store).canUser("update", { kind: "postType", name: context?.postType, id: context?.postId }); if (!canUserEdit) { return false; } return true; }, getFieldsList({ select, context }) { const metaFields = getPostMetaFields(select, context); return metaFields.map( ({ default: defaultProp, ...otherProps }) => ({ ...otherProps }) ); } }; ;// ./node_modules/@wordpress/editor/build-module/bindings/term-data.js const term_data_NAVIGATION_BLOCK_TYPES = [ "core/navigation-link", "core/navigation-submenu" ]; function createDataFields(termDataValues, idValue) { return { id: { label: (0,external_wp_i18n_namespaceObject.__)("Term ID"), value: idValue, type: "string" }, name: { label: (0,external_wp_i18n_namespaceObject.__)("Name"), value: termDataValues?.name, type: "string" }, slug: { label: (0,external_wp_i18n_namespaceObject.__)("Slug"), value: termDataValues?.slug, type: "string" }, link: { label: (0,external_wp_i18n_namespaceObject.__)("Link"), value: termDataValues?.link, type: "string" }, description: { label: (0,external_wp_i18n_namespaceObject.__)("Description"), value: termDataValues?.description, type: "string" }, parent: { label: (0,external_wp_i18n_namespaceObject.__)("Parent ID"), value: termDataValues?.parent, type: "string" }, count: { label: (0,external_wp_i18n_namespaceObject.__)("Count"), value: `(${termDataValues?.count ?? 0})`, type: "string" } }; } function getTermDataFields(select, context, clientId) { const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const { getBlockAttributes, getBlockName } = select(external_wp_blockEditor_namespaceObject.store); let termDataValues, dataFields; const blockName = getBlockName?.(clientId); const isNavigationBlock = term_data_NAVIGATION_BLOCK_TYPES.includes(blockName); let termId, taxonomy; if (isNavigationBlock) { const blockAttributes = getBlockAttributes?.(clientId); termId = blockAttributes?.id; const typeFromAttributes = blockAttributes?.type; taxonomy = typeFromAttributes === "tag" ? "post_tag" : typeFromAttributes; } else { termId = context?.termId; taxonomy = context?.taxonomy; } if (taxonomy && termId) { termDataValues = getEntityRecord("taxonomy", taxonomy, termId); if (!termDataValues && context?.termData) { termDataValues = context.termData; } if (termDataValues) { dataFields = createDataFields(termDataValues, termId); } } else if (context?.termData) { termDataValues = context.termData; dataFields = createDataFields( termDataValues, termDataValues?.term_id ); } if (!dataFields || !Object.keys(dataFields).length) { return null; } return dataFields; } var term_data_default = { name: "core/term-data", usesContext: ["taxonomy", "termId", "termData"], getValues({ select, context, bindings, clientId }) { const dataFields = getTermDataFields(select, context, clientId); const newValues = {}; for (const [attributeName, source] of Object.entries(bindings)) { const fieldKey = source.args.field; const { value: fieldValue, label: fieldLabel } = dataFields?.[fieldKey] || {}; newValues[attributeName] = fieldValue ?? fieldLabel ?? fieldKey; } return newValues; }, // eslint-disable-next-line no-unused-vars setValues({ dispatch, context, bindings }) { return false; }, canUserEditValue({ select, context, args }) { const { getBlockName, getSelectedBlockClientId } = select(external_wp_blockEditor_namespaceObject.store); const clientId = getSelectedBlockClientId(); const blockName = getBlockName?.(clientId); if (term_data_NAVIGATION_BLOCK_TYPES.includes(blockName)) { return false; } if (context?.termQuery) { return false; } if (!context?.taxonomy || !context?.termId) { return false; } const fieldValue = getTermDataFields(select, context, void 0)?.[args.field]?.value; if (fieldValue === void 0) { return false; } return false; }, getFieldsList({ select, context }) { const clientId = select(external_wp_blockEditor_namespaceObject.store).getSelectedBlockClientId(); const termDataFields = getTermDataFields(select, context, clientId); if (!termDataFields) { return []; } return Object.entries(termDataFields).map(([key, field]) => ({ label: field.label, type: field.type, args: { field: key } })); } }; ;// ./node_modules/@wordpress/editor/build-module/bindings/api.js function registerCoreBlockBindingsSources() { (0,external_wp_blocks_namespaceObject.registerBlockBindingsSource)(pattern_overrides_default); (0,external_wp_blocks_namespaceObject.registerBlockBindingsSource)(post_data_default); (0,external_wp_blocks_namespaceObject.registerBlockBindingsSource)(post_meta_default); (0,external_wp_blocks_namespaceObject.registerBlockBindingsSource)(term_data_default); } ;// ./node_modules/@wordpress/editor/build-module/private-apis.js const { store: interfaceStore, ...remainingInterfaceApis } = build_module_namespaceObject; const privateApis = {}; lock(privateApis, { CreateTemplatePartModal: CreateTemplatePartModal, patternTitleField: pattern_title_default, templateTitleField: template_title_default, BackButton: back_button_default, EntitiesSavedStatesExtensible: EntitiesSavedStatesExtensible, Editor: editor_default, EditorContentSlotFill: content_slot_fill_default, GlobalStylesProvider: GlobalStylesProvider, mergeBaseAndUserConfigs: mergeBaseAndUserConfigs, PluginPostExcerpt: plugin_default, PostCardPanel: PostCardPanel, PreferencesModal: EditorPreferencesModal, usePostActions: usePostActions, usePostFields: post_fields_default, ToolsMoreMenuGroup: tools_more_menu_group_default, ViewMoreMenuGroup: view_more_menu_group_default, ResizableEditor: resizable_editor_default, registerCoreBlockBindingsSources: registerCoreBlockBindingsSources, getTemplateInfo: getTemplateInfo, // This is a temporary private API while we're updating the site editor to use EditorProvider. interfaceStore, ...remainingInterfaceApis }); ;// ./node_modules/@wordpress/editor/build-module/dataviews/api.js function api_registerEntityAction(kind, name, config) { const { registerEntityAction: _registerEntityAction } = unlock( (0,external_wp_data_namespaceObject.dispatch)(store_store) ); if (false) {} } function api_unregisterEntityAction(kind, name, actionId) { const { unregisterEntityAction: _unregisterEntityAction } = unlock( (0,external_wp_data_namespaceObject.dispatch)(store_store) ); if (false) {} } function api_registerEntityField(kind, name, config) { const { registerEntityField: _registerEntityField } = unlock( (0,external_wp_data_namespaceObject.dispatch)(store_store) ); if (false) {} } function api_unregisterEntityField(kind, name, fieldId) { const { unregisterEntityField: _unregisterEntityField } = unlock( (0,external_wp_data_namespaceObject.dispatch)(store_store) ); if (false) {} } ;// ./node_modules/@wordpress/editor/build-module/index.js })(); (window.wp = window.wp || {}).editor = __webpack_exports__; /******/ })() ; html-entities.min.js 0000644 00000001430 15151622574 0010460 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};let n;function o(e){if("string"!=typeof e||-1===e.indexOf("&"))return e;void 0===n&&(n=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),n.innerHTML=e;const t=n.textContent??"";return n.innerHTML="",t}e.r(t),e.d(t,{decodeEntities:()=>o}),(window.wp=window.wp||{}).htmlEntities=t})(); edit-widgets.js 0000644 00000460600 15151622574 0007511 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { initialize: () => (/* binding */ initialize), initializeEditor: () => (/* binding */ initializeEditor), reinitializeEditor: () => (/* binding */ reinitializeEditor), store: () => (/* reexport */ store_store) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { closeModal: () => (closeModal), disableComplementaryArea: () => (disableComplementaryArea), enableComplementaryArea: () => (enableComplementaryArea), openModal: () => (openModal), pinItem: () => (pinItem), setDefaultComplementaryArea: () => (setDefaultComplementaryArea), setFeatureDefaults: () => (setFeatureDefaults), setFeatureValue: () => (setFeatureValue), toggleFeature: () => (toggleFeature), unpinItem: () => (unpinItem) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { getActiveComplementaryArea: () => (getActiveComplementaryArea), isComplementaryAreaLoading: () => (isComplementaryAreaLoading), isFeatureActive: () => (isFeatureActive), isItemPinned: () => (isItemPinned), isModalActive: () => (isModalActive) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/actions.js var store_actions_namespaceObject = {}; __webpack_require__.r(store_actions_namespaceObject); __webpack_require__.d(store_actions_namespaceObject, { closeGeneralSidebar: () => (closeGeneralSidebar), lockWidgetSaving: () => (lockWidgetSaving), moveBlockToWidgetArea: () => (moveBlockToWidgetArea), persistStubPost: () => (persistStubPost), saveEditedWidgetAreas: () => (saveEditedWidgetAreas), saveWidgetArea: () => (saveWidgetArea), saveWidgetAreas: () => (saveWidgetAreas), setIsInserterOpened: () => (setIsInserterOpened), setIsListViewOpened: () => (setIsListViewOpened), setIsWidgetAreaOpen: () => (setIsWidgetAreaOpen), setWidgetAreasOpenState: () => (setWidgetAreasOpenState), setWidgetIdForClientId: () => (setWidgetIdForClientId), unlockWidgetSaving: () => (unlockWidgetSaving) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/resolvers.js var resolvers_namespaceObject = {}; __webpack_require__.r(resolvers_namespaceObject); __webpack_require__.d(resolvers_namespaceObject, { getWidgetAreas: () => (getWidgetAreas), getWidgets: () => (getWidgets) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/selectors.js var store_selectors_namespaceObject = {}; __webpack_require__.r(store_selectors_namespaceObject); __webpack_require__.d(store_selectors_namespaceObject, { __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint), canInsertBlockInWidgetArea: () => (canInsertBlockInWidgetArea), getEditedWidgetAreas: () => (getEditedWidgetAreas), getIsWidgetAreaOpen: () => (getIsWidgetAreaOpen), getParentWidgetAreaBlock: () => (getParentWidgetAreaBlock), getReferenceWidgetBlocks: () => (getReferenceWidgetBlocks), getWidget: () => (getWidget), getWidgetAreaForWidgetId: () => (getWidgetAreaForWidgetId), getWidgetAreas: () => (selectors_getWidgetAreas), getWidgets: () => (selectors_getWidgets), isInserterOpened: () => (isInserterOpened), isListViewOpened: () => (isListViewOpened), isSavingWidgetAreas: () => (isSavingWidgetAreas), isWidgetSavingLocked: () => (isWidgetSavingLocked) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/private-selectors.js var private_selectors_namespaceObject = {}; __webpack_require__.r(private_selectors_namespaceObject); __webpack_require__.d(private_selectors_namespaceObject, { getInserterSidebarToggleRef: () => (getInserterSidebarToggleRef), getListViewToggleRef: () => (getListViewToggleRef) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/index.js var widget_area_namespaceObject = {}; __webpack_require__.r(widget_area_namespaceObject); __webpack_require__.d(widget_area_namespaceObject, { metadata: () => (block_namespaceObject), name: () => (widget_area_name), settings: () => (settings) }); ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","blockLibrary"] const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; ;// external ["wp","coreData"] const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; ;// external ["wp","widgets"] const external_wp_widgets_namespaceObject = window["wp"]["widgets"]; ;// external ["wp","preferences"] const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; ;// external ["wp","apiFetch"] const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// ./node_modules/@wordpress/edit-widgets/build-module/store/reducer.js function widgetAreasOpenState(state = {}, action) { const { type } = action; switch (type) { case "SET_WIDGET_AREAS_OPEN_STATE": { return action.widgetAreasOpenState; } case "SET_IS_WIDGET_AREA_OPEN": { const { clientId, isOpen } = action; return { ...state, [clientId]: isOpen }; } default: { return state; } } } function blockInserterPanel(state = false, action) { switch (action.type) { case "SET_IS_LIST_VIEW_OPENED": return action.isOpen ? false : state; case "SET_IS_INSERTER_OPENED": return action.value; } return state; } function listViewPanel(state = false, action) { switch (action.type) { case "SET_IS_INSERTER_OPENED": return action.value ? false : state; case "SET_IS_LIST_VIEW_OPENED": return action.isOpen; } return state; } function listViewToggleRef(state = { current: null }) { return state; } function inserterSidebarToggleRef(state = { current: null }) { return state; } function widgetSavingLock(state = {}, action) { switch (action.type) { case "LOCK_WIDGET_SAVING": return { ...state, [action.lockName]: true }; case "UNLOCK_WIDGET_SAVING": { const { [action.lockName]: removedLockName, ...restState } = state; return restState; } } return state; } var reducer_default = (0,external_wp_data_namespaceObject.combineReducers)({ blockInserterPanel, inserterSidebarToggleRef, listViewPanel, listViewToggleRef, widgetAreasOpenState, widgetSavingLock }); ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// external ["wp","notices"] const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// ./node_modules/clsx/dist/clsx.mjs function 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=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=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// ./node_modules/@wordpress/icons/build-module/library/check.js var check_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/star-filled.js var star_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: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/star-empty.js var star_empty_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, { fillRule: "evenodd", d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z", clipRule: "evenodd" } ) }); ;// external ["wp","viewport"] const external_wp_viewport_namespaceObject = window["wp"]["viewport"]; ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","plugins"] const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js var close_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); ;// ./node_modules/@wordpress/interface/build-module/store/deprecated.js function normalizeComplementaryAreaScope(scope) { if (["core/edit-post", "core/edit-site"].includes(scope)) { external_wp_deprecated_default()(`${scope} interface scope`, { alternative: "core interface scope", hint: "core/edit-post and core/edit-site are merging.", version: "6.6" }); return "core"; } return scope; } function normalizeComplementaryAreaName(scope, name) { if (scope === "core" && name === "edit-site/template") { external_wp_deprecated_default()(`edit-site/template sidebar`, { alternative: "edit-post/document", version: "6.6" }); return "edit-post/document"; } if (scope === "core" && name === "edit-site/block-inspector") { external_wp_deprecated_default()(`edit-site/block-inspector sidebar`, { alternative: "edit-post/block", version: "6.6" }); return "edit-post/block"; } return name; } ;// ./node_modules/@wordpress/interface/build-module/store/actions.js const setDefaultComplementaryArea = (scope, area) => { scope = normalizeComplementaryAreaScope(scope); area = normalizeComplementaryAreaName(scope, area); return { type: "SET_DEFAULT_COMPLEMENTARY_AREA", scope, area }; }; const enableComplementaryArea = (scope, area) => ({ registry, dispatch }) => { if (!area) { return; } scope = normalizeComplementaryAreaScope(scope); area = normalizeComplementaryAreaName(scope, area); const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, "isComplementaryAreaVisible"); if (!isComplementaryAreaVisible) { registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, "isComplementaryAreaVisible", true); } dispatch({ type: "ENABLE_COMPLEMENTARY_AREA", scope, area }); }; const disableComplementaryArea = (scope) => ({ registry }) => { scope = normalizeComplementaryAreaScope(scope); const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, "isComplementaryAreaVisible"); if (isComplementaryAreaVisible) { registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, "isComplementaryAreaVisible", false); } }; const pinItem = (scope, item) => ({ registry }) => { if (!item) { return; } scope = normalizeComplementaryAreaScope(scope); item = normalizeComplementaryAreaName(scope, item); const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, "pinnedItems"); if (pinnedItems?.[item] === true) { return; } registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, "pinnedItems", { ...pinnedItems, [item]: true }); }; const unpinItem = (scope, item) => ({ registry }) => { if (!item) { return; } scope = normalizeComplementaryAreaScope(scope); item = normalizeComplementaryAreaName(scope, item); const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, "pinnedItems"); registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, "pinnedItems", { ...pinnedItems, [item]: false }); }; function toggleFeature(scope, featureName) { return function({ registry }) { external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, { since: "6.0", alternative: `dispatch( 'core/preferences' ).toggle` }); registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName); }; } function setFeatureValue(scope, featureName, value) { return function({ registry }) { external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, { since: "6.0", alternative: `dispatch( 'core/preferences' ).set` }); registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value); }; } function setFeatureDefaults(scope, defaults) { return function({ registry }) { external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, { since: "6.0", alternative: `dispatch( 'core/preferences' ).setDefaults` }); registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults); }; } function openModal(name) { return { type: "OPEN_MODAL", name }; } function closeModal() { return { type: "CLOSE_MODAL" }; } ;// ./node_modules/@wordpress/interface/build-module/store/selectors.js const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, scope) => { scope = normalizeComplementaryAreaScope(scope); const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get( scope, "isComplementaryAreaVisible" ); if (isComplementaryAreaVisible === void 0) { return void 0; } if (isComplementaryAreaVisible === false) { return null; } return state?.complementaryAreas?.[scope]; } ); const isComplementaryAreaLoading = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, scope) => { scope = normalizeComplementaryAreaScope(scope); const isVisible = select(external_wp_preferences_namespaceObject.store).get( scope, "isComplementaryAreaVisible" ); const identifier = state?.complementaryAreas?.[scope]; return isVisible && identifier === void 0; } ); const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, scope, item) => { scope = normalizeComplementaryAreaScope(scope); item = normalizeComplementaryAreaName(scope, item); const pinnedItems = select(external_wp_preferences_namespaceObject.store).get( scope, "pinnedItems" ); return pinnedItems?.[item] ?? true; } ); const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, scope, featureName) => { external_wp_deprecated_default()( `select( 'core/interface' ).isFeatureActive( scope, featureName )`, { since: "6.0", alternative: `select( 'core/preferences' ).get( scope, featureName )` } ); return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName); } ); function isModalActive(state, modalName) { return state.activeModal === modalName; } ;// ./node_modules/@wordpress/interface/build-module/store/reducer.js function complementaryAreas(state = {}, action) { switch (action.type) { case "SET_DEFAULT_COMPLEMENTARY_AREA": { const { scope, area } = action; if (state[scope]) { return state; } return { ...state, [scope]: area }; } case "ENABLE_COMPLEMENTARY_AREA": { const { scope, area } = action; return { ...state, [scope]: area }; } } return state; } function activeModal(state = null, action) { switch (action.type) { case "OPEN_MODAL": return action.name; case "CLOSE_MODAL": return null; } return state; } var reducer_reducer_default = (0,external_wp_data_namespaceObject.combineReducers)({ complementaryAreas, activeModal }); ;// ./node_modules/@wordpress/interface/build-module/store/constants.js const STORE_NAME = "core/interface"; ;// ./node_modules/@wordpress/interface/build-module/store/index.js const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { reducer: reducer_reducer_default, actions: actions_namespaceObject, selectors: selectors_namespaceObject }); (0,external_wp_data_namespaceObject.register)(store); ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js function roleSupportsCheckedState(role) { return [ "checkbox", "option", "radio", "switch", "menuitemcheckbox", "menuitemradio", "treeitem" ].includes(role); } function ComplementaryAreaToggle({ as = external_wp_components_namespaceObject.Button, scope, identifier: identifierProp, icon: iconProp, selectedIcon, name, shortcut, ...props }) { const ComponentToUse = as; const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); const icon = iconProp || context.icon; const identifier = identifierProp || `${context.name}/${name}`; const isSelected = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).getActiveComplementaryArea(scope) === identifier, [identifier, scope] ); const { enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ComponentToUse, { icon: selectedIcon && isSelected ? selectedIcon : icon, "aria-controls": identifier.replace("/", ":"), "aria-checked": roleSupportsCheckedState(props.role) ? isSelected : void 0, onClick: () => { if (isSelected) { disableComplementaryArea(scope); } else { enableComplementaryArea(scope, identifier); } }, shortcut, ...props } ); } ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js const ComplementaryAreaHeader = ({ children, className, toggleButtonProps }) => { const toggleButton = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaToggle, { icon: close_small_default, ...toggleButtonProps }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: dist_clsx( "components-panel__header", "interface-complementary-area-header", className ), tabIndex: -1, children: [ children, toggleButton ] } ); }; var complementary_area_header_default = ComplementaryAreaHeader; ;// ./node_modules/@wordpress/interface/build-module/components/action-item/index.js const noop = () => { }; function ActionItemSlot({ name, as: Component = external_wp_components_namespaceObject.MenuGroup, fillProps = {}, bubblesVirtually, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Slot, { name, bubblesVirtually, fillProps, children: (fills) => { if (!external_wp_element_namespaceObject.Children.toArray(fills).length) { return null; } const initializedByPlugins = []; external_wp_element_namespaceObject.Children.forEach( fills, ({ props: { __unstableExplicitMenuItem, __unstableTarget } }) => { if (__unstableTarget && __unstableExplicitMenuItem) { initializedByPlugins.push(__unstableTarget); } } ); const children = external_wp_element_namespaceObject.Children.map(fills, (child) => { if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes( child.props.__unstableTarget )) { return null; } return child; }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...props, children }); } } ); } function ActionItem({ name, as: Component = external_wp_components_namespaceObject.Button, onClick, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name, children: ({ onClick: fpOnClick }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Component, { onClick: onClick || fpOnClick ? (...args) => { (onClick || noop)(...args); (fpOnClick || noop)(...args); } : void 0, ...props } ); } }); } ActionItem.Slot = ActionItemSlot; var action_item_default = ActionItem; ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js const PluginsMenuItem = ({ // Menu item is marked with unstable prop for backward compatibility. // They are removed so they don't leak to DOM elements. // @see https://github.com/WordPress/gutenberg/issues/14457 __unstableExplicitMenuItem, __unstableTarget, ...restProps }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ...restProps }); function ComplementaryAreaMoreMenuItem({ scope, target, __unstableExplicitMenuItem, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ComplementaryAreaToggle, { as: (toggleProps) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( action_item_default, { __unstableExplicitMenuItem, __unstableTarget: `${scope}/${target}`, as: PluginsMenuItem, name: `${scope}/plugin-more-menu`, ...toggleProps } ); }, role: "menuitemcheckbox", selectedIcon: check_default, name: target, scope, ...props } ); } ;// ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js function PinnedItems({ scope, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: `PinnedItems/${scope}`, ...props }); } function PinnedItemsSlot({ scope, className, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: `PinnedItems/${scope}`, ...props, children: (fills) => fills?.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx( className, "interface-pinned-items" ), children: fills } ) }); } PinnedItems.Slot = PinnedItemsSlot; var pinned_items_default = PinnedItems; ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js const ANIMATION_DURATION = 0.3; function ComplementaryAreaSlot({ scope, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: `ComplementaryArea/${scope}`, ...props }); } const SIDEBAR_WIDTH = 280; const variants = { open: { width: SIDEBAR_WIDTH }, closed: { width: 0 }, mobileOpen: { width: "100vw" } }; function ComplementaryAreaFill({ activeArea, isActive, scope, children, className, id }) { const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const previousActiveArea = (0,external_wp_compose_namespaceObject.usePrevious)(activeArea); const previousIsActive = (0,external_wp_compose_namespaceObject.usePrevious)(isActive); const [, setState] = (0,external_wp_element_namespaceObject.useState)({}); (0,external_wp_element_namespaceObject.useEffect)(() => { setState({}); }, [isActive]); const transition = { type: "tween", duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION, ease: [0.6, 0, 0.4, 1] }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: `ComplementaryArea/${scope}`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: (previousIsActive || isActive) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { variants, initial: "closed", animate: isMobileViewport ? "mobileOpen" : "open", exit: "closed", transition, className: "interface-complementary-area__fill", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { id, className, style: { width: isMobileViewport ? "100vw" : SIDEBAR_WIDTH }, children } ) } ) }) }); } function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { const previousIsSmallRef = (0,external_wp_element_namespaceObject.useRef)(false); const shouldOpenWhenNotSmallRef = (0,external_wp_element_namespaceObject.useRef)(false); const { enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isActive && isSmall && !previousIsSmallRef.current) { disableComplementaryArea(scope); shouldOpenWhenNotSmallRef.current = true; } else if ( // If there is a flag indicating the complementary area should be // enabled when we go from small to big window size and we are going // from a small to big window size. shouldOpenWhenNotSmallRef.current && !isSmall && previousIsSmallRef.current ) { shouldOpenWhenNotSmallRef.current = false; enableComplementaryArea(scope, identifier); } else if ( // If the flag is indicating the current complementary should be // reopened but another complementary area becomes active, remove // the flag. shouldOpenWhenNotSmallRef.current && activeArea && activeArea !== identifier ) { shouldOpenWhenNotSmallRef.current = false; } if (isSmall !== previousIsSmallRef.current) { previousIsSmallRef.current = isSmall; } }, [ isActive, isSmall, scope, identifier, activeArea, disableComplementaryArea, enableComplementaryArea ]); } function ComplementaryArea({ children, className, closeLabel = (0,external_wp_i18n_namespaceObject.__)("Close plugin"), identifier: identifierProp, header, headerClassName, icon: iconProp, isPinnable = true, panelClassName, scope, name, title, toggleShortcut, isActiveByDefault }) { const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); const icon = iconProp || context.icon; const identifier = identifierProp || `${context.name}/${name}`; const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false); const { isLoading, isActive, isPinned, activeArea, isSmall, isLarge, showIconLabels } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getActiveComplementaryArea, isComplementaryAreaLoading, isItemPinned } = select(store); const { get } = select(external_wp_preferences_namespaceObject.store); const _activeArea = getActiveComplementaryArea(scope); return { isLoading: isComplementaryAreaLoading(scope), isActive: _activeArea === identifier, isPinned: isItemPinned(scope, identifier), activeArea: _activeArea, isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch("< medium"), isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch("large"), showIconLabels: get("core", "showIconLabels") }; }, [identifier, scope] ); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); useAdjustComplementaryListener( scope, identifier, activeArea, isActive, isSmall ); const { enableComplementaryArea, disableComplementaryArea, pinItem, unpinItem } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isActiveByDefault && activeArea === void 0 && !isSmall) { enableComplementaryArea(scope, identifier); } else if (activeArea === void 0 && isSmall) { disableComplementaryArea(scope, identifier); } setIsReady(true); }, [ activeArea, isActiveByDefault, scope, identifier, isSmall, enableComplementaryArea, disableComplementaryArea ]); if (!isReady) { return; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ isPinnable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items_default, { scope, children: isPinned && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ComplementaryAreaToggle, { scope, identifier, isPressed: isActive && (!showIconLabels || isLarge), "aria-expanded": isActive, "aria-disabled": isLoading, label: title, icon: showIconLabels ? check_default : icon, showTooltip: !showIconLabels, variant: showIconLabels ? "tertiary" : void 0, size: "compact", shortcut: toggleShortcut } ) }), name && isPinnable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ComplementaryAreaMoreMenuItem, { target: name, scope, icon, identifier, children: title } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( ComplementaryAreaFill, { activeArea, isActive, className: dist_clsx("interface-complementary-area", className), scope, id: identifier.replace("/", ":"), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( complementary_area_header_default, { className: headerClassName, closeLabel, onClose: () => disableComplementaryArea(scope), toggleButtonProps: { label: closeLabel, size: "compact", shortcut: toggleShortcut, scope, identifier }, children: header || /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "interface-complementary-area-header__title", children: title }), isPinnable && !isMobileViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { className: "interface-complementary-area__pin-unpin-item", icon: isPinned ? star_filled_default : star_empty_default, label: isPinned ? (0,external_wp_i18n_namespaceObject.__)("Unpin from toolbar") : (0,external_wp_i18n_namespaceObject.__)("Pin to toolbar"), onClick: () => (isPinned ? unpinItem : pinItem)( scope, identifier ), isPressed: isPinned, "aria-expanded": isPinned, size: "compact" } ) ] }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Panel, { className: panelClassName, children }) ] } ) ] }); } ComplementaryArea.Slot = ComplementaryAreaSlot; var complementary_area_default = ComplementaryArea; ;// ./node_modules/@wordpress/admin-ui/build-module/navigable-region/index.js const NavigableRegion = (0,external_wp_element_namespaceObject.forwardRef)( ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Tag, { ref, className: dist_clsx("admin-ui-navigable-region", className), "aria-label": ariaLabel, role: "region", tabIndex: "-1", ...props, children } ); } ); NavigableRegion.displayName = "NavigableRegion"; var navigable_region_default = NavigableRegion; ;// ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js const interface_skeleton_ANIMATION_DURATION = 0.25; const commonTransition = { type: "tween", duration: interface_skeleton_ANIMATION_DURATION, ease: [0.6, 0, 0.4, 1] }; function useHTMLClass(className) { (0,external_wp_element_namespaceObject.useEffect)(() => { const element = document && document.querySelector(`html:not(.${className})`); if (!element) { return; } element.classList.toggle(className); return () => { element.classList.toggle(className); }; }, [className]); } const headerVariants = { hidden: { opacity: 1, marginTop: -60 }, visible: { opacity: 1, marginTop: 0 }, distractionFreeHover: { opacity: 1, marginTop: 0, transition: { ...commonTransition, delay: 0.2, delayChildren: 0.2 } }, distractionFreeHidden: { opacity: 0, marginTop: -60 }, distractionFreeDisabled: { opacity: 0, marginTop: 0, transition: { ...commonTransition, delay: 0.8, delayChildren: 0.8 } } }; function InterfaceSkeleton({ isDistractionFree, footer, header, editorNotices, sidebar, secondarySidebar, content, actions, labels, className }, ref) { const [secondarySidebarResizeListener, secondarySidebarSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const defaultTransition = { type: "tween", duration: disableMotion ? 0 : interface_skeleton_ANIMATION_DURATION, ease: [0.6, 0, 0.4, 1] }; useHTMLClass("interface-interface-skeleton__html-container"); const defaultLabels = { /* translators: accessibility text for the top bar landmark region. */ header: (0,external_wp_i18n_namespaceObject._x)("Header", "header landmark area"), /* translators: accessibility text for the content landmark region. */ body: (0,external_wp_i18n_namespaceObject.__)("Content"), /* translators: accessibility text for the secondary sidebar landmark region. */ secondarySidebar: (0,external_wp_i18n_namespaceObject.__)("Block Library"), /* translators: accessibility text for the settings landmark region. */ sidebar: (0,external_wp_i18n_namespaceObject._x)("Settings", "settings landmark area"), /* translators: accessibility text for the publish landmark region. */ actions: (0,external_wp_i18n_namespaceObject.__)("Publish"), /* translators: accessibility text for the footer landmark region. */ footer: (0,external_wp_i18n_namespaceObject.__)("Footer") }; const mergedLabels = { ...defaultLabels, ...labels }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { ref, className: dist_clsx( className, "interface-interface-skeleton", !!footer && "has-footer" ), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "interface-interface-skeleton__editor", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: !!header && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( navigable_region_default, { as: external_wp_components_namespaceObject.__unstableMotion.div, className: "interface-interface-skeleton__header", "aria-label": mergedLabels.header, initial: isDistractionFree && !isMobileViewport ? "distractionFreeHidden" : "hidden", whileHover: isDistractionFree && !isMobileViewport ? "distractionFreeHover" : "visible", animate: isDistractionFree && !isMobileViewport ? "distractionFreeDisabled" : "visible", exit: isDistractionFree && !isMobileViewport ? "distractionFreeHidden" : "hidden", variants: headerVariants, transition: defaultTransition, children: header } ) }), isDistractionFree && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "interface-interface-skeleton__header", children: editorNotices }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "interface-interface-skeleton__body", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: !!secondarySidebar && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( navigable_region_default, { className: "interface-interface-skeleton__secondary-sidebar", ariaLabel: mergedLabels.secondarySidebar, as: external_wp_components_namespaceObject.__unstableMotion.div, initial: "closed", animate: "open", exit: "closed", variants: { open: { width: secondarySidebarSize.width }, closed: { width: 0 } }, transition: defaultTransition, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__unstableMotion.div, { style: { position: "absolute", width: isMobileViewport ? "100vw" : "fit-content", height: "100%", left: 0 }, variants: { open: { x: 0 }, closed: { x: "-100%" } }, transition: defaultTransition, children: [ secondarySidebarResizeListener, secondarySidebar ] } ) } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( navigable_region_default, { className: "interface-interface-skeleton__content", ariaLabel: mergedLabels.body, children: content } ), !!sidebar && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( navigable_region_default, { className: "interface-interface-skeleton__sidebar", ariaLabel: mergedLabels.sidebar, children: sidebar } ), !!actions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( navigable_region_default, { className: "interface-interface-skeleton__actions", ariaLabel: mergedLabels.actions, children: actions } ) ] }) ] }), !!footer && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( navigable_region_default, { className: "interface-interface-skeleton__footer", ariaLabel: mergedLabels.footer, children: footer } ) ] } ); } var interface_skeleton_default = (0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton); ;// ./node_modules/@wordpress/interface/build-module/components/index.js ;// ./node_modules/@wordpress/interface/build-module/index.js ;// external ["wp","blockEditor"] const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; ;// ./node_modules/@wordpress/edit-widgets/build-module/store/transformers.js function transformWidgetToBlock(widget) { if (widget.id_base === "block") { const parsedBlocks = (0,external_wp_blocks_namespaceObject.parse)(widget.instance.raw.content, { __unstableSkipAutop: true }); if (!parsedBlocks.length) { return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)( (0,external_wp_blocks_namespaceObject.createBlock)("core/paragraph", {}, []), widget.id ); } return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)(parsedBlocks[0], widget.id); } let attributes; if (widget._embedded.about[0].is_multi) { attributes = { idBase: widget.id_base, instance: widget.instance }; } else { attributes = { id: widget.id }; } return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)( (0,external_wp_blocks_namespaceObject.createBlock)("core/legacy-widget", attributes, []), widget.id ); } function transformBlockToWidget(block, relatedWidget = {}) { let widget; const isValidLegacyWidgetBlock = block.name === "core/legacy-widget" && (block.attributes.id || block.attributes.instance); if (isValidLegacyWidgetBlock) { widget = { ...relatedWidget, id: block.attributes.id ?? relatedWidget.id, id_base: block.attributes.idBase ?? relatedWidget.id_base, instance: block.attributes.instance ?? relatedWidget.instance }; } else { widget = { ...relatedWidget, id_base: "block", instance: { raw: { content: (0,external_wp_blocks_namespaceObject.serialize)(block) } } }; } delete widget.rendered; delete widget.rendered_form; return widget; } ;// ./node_modules/@wordpress/edit-widgets/build-module/store/utils.js const KIND = "root"; const WIDGET_AREA_ENTITY_TYPE = "sidebar"; const POST_TYPE = "postType"; const buildWidgetAreaPostId = (widgetAreaId) => `widget-area-${widgetAreaId}`; const buildWidgetAreasPostId = () => `widget-areas`; function buildWidgetAreasQuery() { return { per_page: -1 }; } function buildWidgetsQuery() { return { per_page: -1, _embed: "about" }; } const createStubPost = (id, blocks) => ({ id, slug: id, status: "draft", type: "page", blocks, meta: { widgetAreaId: id } }); ;// ./node_modules/@wordpress/edit-widgets/build-module/store/constants.js const constants_STORE_NAME = "core/edit-widgets"; ;// ./node_modules/@wordpress/edit-widgets/build-module/store/actions.js const persistStubPost = (id, blocks) => ({ registry }) => { const stubPost = createStubPost(id, blocks); registry.dispatch(external_wp_coreData_namespaceObject.store).receiveEntityRecords( KIND, POST_TYPE, stubPost, { id: stubPost.id }, false ); return stubPost; }; const saveEditedWidgetAreas = () => async ({ select, dispatch, registry }) => { const editedWidgetAreas = select.getEditedWidgetAreas(); if (!editedWidgetAreas?.length) { return; } try { await dispatch.saveWidgetAreas(editedWidgetAreas); registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Widgets saved."), { type: "snackbar" }); } catch (e) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice( /* translators: %s: The error message. */ (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("There was an error. %s"), e.message), { type: "snackbar" } ); } }; const saveWidgetAreas = (widgetAreas) => async ({ dispatch, registry }) => { try { for (const widgetArea of widgetAreas) { await dispatch.saveWidgetArea(widgetArea.id); } } finally { await registry.dispatch(external_wp_coreData_namespaceObject.store).finishResolution( "getEntityRecord", KIND, WIDGET_AREA_ENTITY_TYPE, buildWidgetAreasQuery() ); } }; const saveWidgetArea = (widgetAreaId) => async ({ dispatch, select, registry }) => { const widgets = select.getWidgets(); const post = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( KIND, POST_TYPE, buildWidgetAreaPostId(widgetAreaId) ); const areaWidgets = Object.values(widgets).filter( ({ sidebar }) => sidebar === widgetAreaId ); const usedReferenceWidgets = []; const widgetsBlocks = post.blocks.filter((block) => { const { id } = block.attributes; if (block.name === "core/legacy-widget" && id) { if (usedReferenceWidgets.includes(id)) { return false; } usedReferenceWidgets.push(id); } return true; }); const deletedWidgets = []; for (const widget of areaWidgets) { const widgetsNewArea = select.getWidgetAreaForWidgetId(widget.id); if (!widgetsNewArea) { deletedWidgets.push(widget); } } const batchMeta = []; const batchTasks = []; const sidebarWidgetsIds = []; for (let i = 0; i < widgetsBlocks.length; i++) { const block = widgetsBlocks[i]; const widgetId = (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block); const oldWidget = widgets[widgetId]; const widget = transformBlockToWidget(block, oldWidget); sidebarWidgetsIds.push(widgetId); if (oldWidget) { registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord( "root", "widget", widgetId, { ...widget, sidebar: widgetAreaId }, { undoIgnore: true } ); const hasEdits = registry.select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord("root", "widget", widgetId); if (!hasEdits) { continue; } batchTasks.push( ({ saveEditedEntityRecord }) => saveEditedEntityRecord("root", "widget", widgetId) ); } else { batchTasks.push( ({ saveEntityRecord }) => saveEntityRecord("root", "widget", { ...widget, sidebar: widgetAreaId }) ); } batchMeta.push({ block, position: i, clientId: block.clientId }); } for (const widget of deletedWidgets) { batchTasks.push( ({ deleteEntityRecord }) => deleteEntityRecord("root", "widget", widget.id, { force: true }) ); } const records = await registry.dispatch(external_wp_coreData_namespaceObject.store).__experimentalBatch(batchTasks); const preservedRecords = records.filter( (record) => !record.hasOwnProperty("deleted") ); const failedWidgetNames = []; for (let i = 0; i < preservedRecords.length; i++) { const widget = preservedRecords[i]; const { block, position } = batchMeta[i]; post.blocks[position].attributes.__internalWidgetId = widget.id; const error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError("root", "widget", widget.id); if (error) { failedWidgetNames.push(block.attributes?.name || block?.name); } if (!sidebarWidgetsIds[position]) { sidebarWidgetsIds[position] = widget.id; } } if (failedWidgetNames.length) { throw new Error( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: List of widget names */ (0,external_wp_i18n_namespaceObject.__)("Could not save the following widgets: %s."), failedWidgetNames.join(", ") ) ); } registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord( KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId, { widgets: sidebarWidgetsIds }, { undoIgnore: true } ); dispatch(trySaveWidgetArea(widgetAreaId)); registry.dispatch(external_wp_coreData_namespaceObject.store).receiveEntityRecords(KIND, POST_TYPE, post, void 0); }; const trySaveWidgetArea = (widgetAreaId) => ({ registry }) => { registry.dispatch(external_wp_coreData_namespaceObject.store).saveEditedEntityRecord( KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId, { throwOnError: true } ); }; function setWidgetIdForClientId(clientId, widgetId) { return { type: "SET_WIDGET_ID_FOR_CLIENT_ID", clientId, widgetId }; } function setWidgetAreasOpenState(widgetAreasOpenState) { return { type: "SET_WIDGET_AREAS_OPEN_STATE", widgetAreasOpenState }; } function setIsWidgetAreaOpen(clientId, isOpen) { return { type: "SET_IS_WIDGET_AREA_OPEN", clientId, isOpen }; } function setIsInserterOpened(value) { return { type: "SET_IS_INSERTER_OPENED", value }; } function setIsListViewOpened(isOpen) { return { type: "SET_IS_LIST_VIEW_OPENED", isOpen }; } const closeGeneralSidebar = () => ({ registry }) => { registry.dispatch(store).disableComplementaryArea(constants_STORE_NAME); }; const moveBlockToWidgetArea = (clientId, widgetAreaId) => async ({ dispatch, select, registry }) => { const sourceRootClientId = registry.select(external_wp_blockEditor_namespaceObject.store).getBlockRootClientId(clientId); const widgetAreas = registry.select(external_wp_blockEditor_namespaceObject.store).getBlocks(); const destinationWidgetAreaBlock = widgetAreas.find( ({ attributes }) => attributes.id === widgetAreaId ); const destinationRootClientId = destinationWidgetAreaBlock.clientId; const destinationInnerBlocksClientIds = registry.select(external_wp_blockEditor_namespaceObject.store).getBlockOrder(destinationRootClientId); const destinationIndex = destinationInnerBlocksClientIds.length; const isDestinationWidgetAreaOpen = select.getIsWidgetAreaOpen( destinationRootClientId ); if (!isDestinationWidgetAreaOpen) { dispatch.setIsWidgetAreaOpen(destinationRootClientId, true); } registry.dispatch(external_wp_blockEditor_namespaceObject.store).moveBlocksToPosition( [clientId], sourceRootClientId, destinationRootClientId, destinationIndex ); }; function unlockWidgetSaving(lockName) { return { type: "UNLOCK_WIDGET_SAVING", lockName }; } function lockWidgetSaving(lockName) { return { type: "LOCK_WIDGET_SAVING", lockName }; } ;// ./node_modules/@wordpress/edit-widgets/build-module/store/resolvers.js const getWidgetAreas = () => async ({ dispatch, registry }) => { const query = buildWidgetAreasQuery(); const widgetAreas = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecords(KIND, WIDGET_AREA_ENTITY_TYPE, query); const widgetAreaBlocks = []; const sortedWidgetAreas = widgetAreas.sort((a, b) => { if (a.id === "wp_inactive_widgets") { return 1; } if (b.id === "wp_inactive_widgets") { return -1; } return 0; }); for (const widgetArea of sortedWidgetAreas) { widgetAreaBlocks.push( (0,external_wp_blocks_namespaceObject.createBlock)("core/widget-area", { id: widgetArea.id, name: widgetArea.name }) ); if (!widgetArea.widgets.length) { dispatch( persistStubPost( buildWidgetAreaPostId(widgetArea.id), [] ) ); } } const widgetAreasOpenState = {}; widgetAreaBlocks.forEach((widgetAreaBlock, index) => { widgetAreasOpenState[widgetAreaBlock.clientId] = index === 0; }); dispatch(setWidgetAreasOpenState(widgetAreasOpenState)); dispatch( persistStubPost(buildWidgetAreasPostId(), widgetAreaBlocks) ); }; const getWidgets = () => async ({ dispatch, registry }) => { const query = buildWidgetsQuery(); const widgets = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecords("root", "widget", query); const groupedBySidebar = {}; for (const widget of widgets) { const block = transformWidgetToBlock(widget); groupedBySidebar[widget.sidebar] = groupedBySidebar[widget.sidebar] || []; groupedBySidebar[widget.sidebar].push(block); } for (const sidebarId in groupedBySidebar) { if (groupedBySidebar.hasOwnProperty(sidebarId)) { dispatch( persistStubPost( buildWidgetAreaPostId(sidebarId), groupedBySidebar[sidebarId] ) ); } } }; ;// ./node_modules/@wordpress/edit-widgets/build-module/store/selectors.js const EMPTY_INSERTION_POINT = { rootClientId: void 0, insertionIndex: void 0 }; const selectors_getWidgets = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)( () => { const widgets = select(external_wp_coreData_namespaceObject.store).getEntityRecords( "root", "widget", buildWidgetsQuery() ); return ( // Key widgets by their ID. widgets?.reduce( (allWidgets, widget) => ({ ...allWidgets, [widget.id]: widget }), {} ) ?? {} ); }, () => [ select(external_wp_coreData_namespaceObject.store).getEntityRecords( "root", "widget", buildWidgetsQuery() ) ] ) ); const getWidget = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, id) => { const widgets = select(constants_STORE_NAME).getWidgets(); return widgets[id]; } ); const selectors_getWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)((select) => () => { const query = buildWidgetAreasQuery(); return select(external_wp_coreData_namespaceObject.store).getEntityRecords( KIND, WIDGET_AREA_ENTITY_TYPE, query ); }); const getWidgetAreaForWidgetId = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, widgetId) => { const widgetAreas = select(constants_STORE_NAME).getWidgetAreas(); return widgetAreas.find((widgetArea) => { const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( KIND, POST_TYPE, buildWidgetAreaPostId(widgetArea.id) ); const blockWidgetIds = post.blocks.map( (block) => (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block) ); return blockWidgetIds.includes(widgetId); }); } ); const getParentWidgetAreaBlock = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, clientId) => { const { getBlock, getBlockName, getBlockParents } = select(external_wp_blockEditor_namespaceObject.store); const blockParents = getBlockParents(clientId); const widgetAreaClientId = blockParents.find( (parentClientId) => getBlockName(parentClientId) === "core/widget-area" ); return getBlock(widgetAreaClientId); } ); const getEditedWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, ids) => { let widgetAreas = select(constants_STORE_NAME).getWidgetAreas(); if (!widgetAreas) { return []; } if (ids) { widgetAreas = widgetAreas.filter( ({ id }) => ids.includes(id) ); } return widgetAreas.filter( ({ id }) => select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord( KIND, POST_TYPE, buildWidgetAreaPostId(id) ) ).map( ({ id }) => select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( KIND, WIDGET_AREA_ENTITY_TYPE, id ) ); } ); const getReferenceWidgetBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, referenceWidgetName = null) => { const results = []; const widgetAreas = select(constants_STORE_NAME).getWidgetAreas(); for (const _widgetArea of widgetAreas) { const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( KIND, POST_TYPE, buildWidgetAreaPostId(_widgetArea.id) ); for (const block of post.blocks) { if (block.name === "core/legacy-widget" && (!referenceWidgetName || block.attributes?.referenceWidgetName === referenceWidgetName)) { results.push(block); } } } return results; } ); const isSavingWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)((select) => () => { const widgetAreasIds = select(constants_STORE_NAME).getWidgetAreas()?.map(({ id }) => id); if (!widgetAreasIds) { return false; } for (const id of widgetAreasIds) { const isSaving = select(external_wp_coreData_namespaceObject.store).isSavingEntityRecord( KIND, WIDGET_AREA_ENTITY_TYPE, id ); if (isSaving) { return true; } } const widgetIds = [ ...Object.keys(select(constants_STORE_NAME).getWidgets()), void 0 // account for new widgets without an ID ]; for (const id of widgetIds) { const isSaving = select(external_wp_coreData_namespaceObject.store).isSavingEntityRecord( "root", "widget", id ); if (isSaving) { return true; } } return false; }); const getIsWidgetAreaOpen = (state, clientId) => { const { widgetAreasOpenState } = state; return !!widgetAreasOpenState[clientId]; }; function isInserterOpened(state) { return !!state.blockInserterPanel; } function __experimentalGetInsertionPoint(state) { if (typeof state.blockInserterPanel === "boolean") { return EMPTY_INSERTION_POINT; } return state.blockInserterPanel; } const canInsertBlockInWidgetArea = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, blockName) => { const widgetAreas = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); const [firstWidgetArea] = widgetAreas; return select(external_wp_blockEditor_namespaceObject.store).canInsertBlockType( blockName, firstWidgetArea.clientId ); } ); function isListViewOpened(state) { return state.listViewPanel; } function isWidgetSavingLocked(state) { return Object.keys(state.widgetSavingLock).length > 0; } ;// ./node_modules/@wordpress/edit-widgets/build-module/store/private-selectors.js function getListViewToggleRef(state) { return state.listViewToggleRef; } function getInserterSidebarToggleRef(state) { return state.inserterSidebarToggleRef; } ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/edit-widgets/build-module/lock-unlock.js const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/edit-widgets" ); ;// ./node_modules/@wordpress/edit-widgets/build-module/store/index.js const storeConfig = { reducer: reducer_default, selectors: store_selectors_namespaceObject, resolvers: resolvers_namespaceObject, actions: store_actions_namespaceObject }; const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, storeConfig); (0,external_wp_data_namespaceObject.register)(store_store); external_wp_apiFetch_default().use(function(options, next) { if (options.path?.indexOf("/wp/v2/types/widget-area") === 0) { return Promise.resolve({}); } return next(options); }); unlock(store_store).registerPrivateSelectors(private_selectors_namespaceObject); ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// ./node_modules/@wordpress/edit-widgets/build-module/filters/move-to-widget-area.js const withMoveToWidgetAreaToolbarItem = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (BlockEdit) => (props) => { const { clientId, name: blockName } = props; const { widgetAreas, currentWidgetAreaId, canInsertBlockInWidgetArea } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (blockName === "core/widget-area") { return {}; } const selectors = select(store_store); const widgetAreaBlock = selectors.getParentWidgetAreaBlock(clientId); return { widgetAreas: selectors.getWidgetAreas(), currentWidgetAreaId: widgetAreaBlock?.attributes?.id, canInsertBlockInWidgetArea: selectors.canInsertBlockInWidgetArea(blockName) }; }, [clientId, blockName] ); const { moveBlockToWidgetArea } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const hasMultipleWidgetAreas = widgetAreas?.length > 1; const isMoveToWidgetAreaVisible = blockName !== "core/widget-area" && hasMultipleWidgetAreas && canInsertBlockInWidgetArea; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"), isMoveToWidgetAreaVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_widgets_namespaceObject.MoveToWidgetArea, { widgetAreas, currentWidgetAreaId, onSelect: (widgetAreaId) => { moveBlockToWidgetArea( props.clientId, widgetAreaId ); } } ) }) ] }); }, "withMoveToWidgetAreaToolbarItem" ); (0,external_wp_hooks_namespaceObject.addFilter)( "editor.BlockEdit", "core/edit-widgets/block-edit", withMoveToWidgetAreaToolbarItem ); ;// external ["wp","mediaUtils"] const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; ;// ./node_modules/@wordpress/edit-widgets/build-module/filters/replace-media-upload.js const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpload; (0,external_wp_hooks_namespaceObject.addFilter)( "editor.MediaUpload", "core/edit-widgets/replace-media-upload", replaceMediaUpload ); ;// ./node_modules/@wordpress/edit-widgets/build-module/filters/index.js ;// ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/block.json const block_namespaceObject = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"core/widget-area","title":"Widget Area","category":"widgets","attributes":{"id":{"type":"string"},"name":{"type":"string"}},"supports":{"html":false,"inserter":false,"customClassName":false,"reusable":false,"__experimentalToolbar":false,"__experimentalParentSelector":false,"__experimentalDisableBlockOverlay":true},"editorStyle":"wp-block-widget-area-editor","style":"wp-block-widget-area"}'); ;// ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/use-is-dragging-within.js const useIsDraggingWithin = (elementRef) => { const [isDraggingWithin, setIsDraggingWithin] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { const { ownerDocument } = elementRef.current; function handleDragStart(event) { handleDragEnter(event); } function handleDragEnd() { setIsDraggingWithin(false); } function handleDragEnter(event) { if (elementRef.current.contains(event.target)) { setIsDraggingWithin(true); } else { setIsDraggingWithin(false); } } ownerDocument.addEventListener("dragstart", handleDragStart); ownerDocument.addEventListener("dragend", handleDragEnd); ownerDocument.addEventListener("dragenter", handleDragEnter); return () => { ownerDocument.removeEventListener("dragstart", handleDragStart); ownerDocument.removeEventListener("dragend", handleDragEnd); ownerDocument.removeEventListener("dragenter", handleDragEnter); }; }, []); return isDraggingWithin; }; var use_is_dragging_within_default = useIsDraggingWithin; ;// ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/inner-blocks.js function WidgetAreaInnerBlocks({ id }) { const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)( "root", "postType" ); const innerBlocksRef = (0,external_wp_element_namespaceObject.useRef)(); const isDraggingWithinInnerBlocks = use_is_dragging_within_default(innerBlocksRef); const shouldHighlightDropZone = isDraggingWithinInnerBlocks; const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)( { ref: innerBlocksRef }, { value: blocks, onInput, onChange, templateLock: false, renderAppender: external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender } ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { "data-widget-area-id": id, className: dist_clsx( "wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper", { "wp-block-widget-area__highlight-drop-zone": shouldHighlightDropZone } ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps }) } ); } ;// ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/index.js function WidgetAreaEdit({ clientId, attributes: { id, name } }) { const isOpen = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getIsWidgetAreaOpen(clientId), [clientId] ); const { setIsWidgetAreaOpen } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const wrapper = (0,external_wp_element_namespaceObject.useRef)(); const setOpen = (0,external_wp_element_namespaceObject.useCallback)( (openState) => setIsWidgetAreaOpen(clientId, openState), [clientId] ); const isDragging = useIsDragging(wrapper); const isDraggingWithin = use_is_dragging_within_default(wrapper); const [openedWhileDragging, setOpenedWhileDragging] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isDragging) { setOpenedWhileDragging(false); return; } if (isDraggingWithin && !isOpen) { setOpen(true); setOpenedWhileDragging(true); } else if (!isDraggingWithin && isOpen && openedWhileDragging) { setOpen(false); } }, [isOpen, isDragging, isDraggingWithin, openedWhileDragging]); const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...blockProps, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Panel, { ref: wrapper, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.PanelBody, { title: name, opened: isOpen, onToggle: () => { setIsWidgetAreaOpen(clientId, !isOpen); }, scrollAfterOpen: !isDragging, children: ({ opened }) => ( // This is required to ensure LegacyWidget blocks are not // unmounted when the panel is collapsed. Unmounting legacy // widgets may have unintended consequences (e.g. TinyMCE // not being properly reinitialized) /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableDisclosureContent, { className: "wp-block-widget-area__panel-body-content", visible: opened, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_coreData_namespaceObject.EntityProvider, { kind: "root", type: "postType", id: `widget-area-${id}`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WidgetAreaInnerBlocks, { id }) } ) } ) ) } ) }) }); } const useIsDragging = (elementRef) => { const [isDragging, setIsDragging] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { const { ownerDocument } = elementRef.current; function handleDragStart() { setIsDragging(true); } function handleDragEnd() { setIsDragging(false); } ownerDocument.addEventListener("dragstart", handleDragStart); ownerDocument.addEventListener("dragend", handleDragEnd); return () => { ownerDocument.removeEventListener("dragstart", handleDragStart); ownerDocument.removeEventListener("dragend", handleDragEnd); }; }, []); return isDragging; }; ;// ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/index.js const { name: widget_area_name } = block_namespaceObject; const settings = { title: (0,external_wp_i18n_namespaceObject.__)("Widget Area"), description: (0,external_wp_i18n_namespaceObject.__)("A widget area container."), __experimentalLabel: ({ name: label }) => label, edit: WidgetAreaEdit }; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/error-boundary/index.js function CopyButton({ text, children }) { const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", ref, children }); } function ErrorBoundaryWarning({ message, error }) { const actions = [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, { text: error.stack, children: (0,external_wp_i18n_namespaceObject.__)("Copy Error") }, "copy-error") ]; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, { className: "edit-widgets-error-boundary", actions, children: message }); } class ErrorBoundary extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); this.state = { error: null }; } componentDidCatch(error) { (0,external_wp_hooks_namespaceObject.doAction)("editor.ErrorBoundary.errorLogged", error); } static getDerivedStateFromError(error) { return { error }; } render() { if (!this.state.error) { return this.props.children; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ErrorBoundaryWarning, { message: (0,external_wp_i18n_namespaceObject.__)( "The editor has encountered an unexpected error." ), error: this.state.error } ); } } ;// external ["wp","patterns"] const external_wp_patterns_namespaceObject = window["wp"]["patterns"]; ;// external ["wp","keyboardShortcuts"] const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcuts/index.js function KeyboardShortcuts() { const { redo, undo } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { saveEditedWidgetAreas } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/edit-widgets/undo", (event) => { undo(); event.preventDefault(); }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/edit-widgets/redo", (event) => { redo(); event.preventDefault(); }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/edit-widgets/save", (event) => { event.preventDefault(); saveEditedWidgetAreas(); }); return null; } function KeyboardShortcutsRegister() { const { registerShortcut } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { registerShortcut({ name: "core/edit-widgets/undo", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Undo your last changes."), keyCombination: { modifier: "primary", character: "z" } }); registerShortcut({ name: "core/edit-widgets/redo", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Redo your last undo."), keyCombination: { modifier: "primaryShift", character: "z" }, // Disable on Apple OS because it conflicts with the browser's // history shortcut. It's a fine alias for both Windows and Linux. // Since there's no conflict for Ctrl+Shift+Z on both Windows and // Linux, we keep it as the default for consistency. aliases: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? [] : [ { modifier: "primary", character: "y" } ] }); registerShortcut({ name: "core/edit-widgets/save", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Save your changes."), keyCombination: { modifier: "primary", character: "s" } }); registerShortcut({ name: "core/edit-widgets/keyboard-shortcuts", category: "main", description: (0,external_wp_i18n_namespaceObject.__)("Display these keyboard shortcuts."), keyCombination: { modifier: "access", character: "h" } }); registerShortcut({ name: "core/edit-widgets/next-region", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Navigate to the next part of the editor."), keyCombination: { modifier: "ctrl", character: "`" }, aliases: [ { modifier: "access", character: "n" } ] }); registerShortcut({ name: "core/edit-widgets/previous-region", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Navigate to the previous part of the editor."), keyCombination: { modifier: "ctrlShift", character: "`" }, aliases: [ { modifier: "access", character: "p" }, { modifier: "ctrlShift", character: "~" } ] }); }, [registerShortcut]); return null; } KeyboardShortcuts.Register = KeyboardShortcutsRegister; var keyboard_shortcuts_default = KeyboardShortcuts; ;// ./node_modules/@wordpress/edit-widgets/build-module/hooks/use-last-selected-widget-area.js const useLastSelectedWidgetArea = () => (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getBlockSelectionEnd, getBlockName } = select(external_wp_blockEditor_namespaceObject.store); const selectionEndClientId = getBlockSelectionEnd(); if (getBlockName(selectionEndClientId) === "core/widget-area") { return selectionEndClientId; } const { getParentWidgetAreaBlock } = select(store_store); const widgetAreaBlock = getParentWidgetAreaBlock(selectionEndClientId); const widgetAreaBlockClientId = widgetAreaBlock?.clientId; if (widgetAreaBlockClientId) { return widgetAreaBlockClientId; } const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const widgetAreasPost = getEntityRecord( KIND, POST_TYPE, buildWidgetAreasPostId() ); return widgetAreasPost?.blocks[0]?.clientId; }, []); var use_last_selected_widget_area_default = useLastSelectedWidgetArea; ;// ./node_modules/@wordpress/edit-widgets/build-module/constants.js const ALLOW_REUSABLE_BLOCKS = false; const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/widget-areas-block-editor-provider/index.js const { ExperimentalBlockEditorProvider } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { PatternsMenuItems } = unlock(external_wp_patterns_namespaceObject.privateApis); const { BlockKeyboardShortcuts } = unlock(external_wp_blockLibrary_namespaceObject.privateApis); const EMPTY_ARRAY = []; function WidgetAreasBlockEditorProvider({ blockEditorSettings, children, ...props }) { const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); const { hasUploadPermissions, reusableBlocks, isFixedToolbarActive, keepCaretInsideBlock, pageOnFront, pageForPosts } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { canUser, getEntityRecord, getEntityRecords } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser("read", { kind: "root", name: "site" }) ? getEntityRecord("root", "site") : void 0; return { hasUploadPermissions: canUser("create", { kind: "postType", name: "attachment" }) ?? true, reusableBlocks: ALLOW_REUSABLE_BLOCKS ? getEntityRecords("postType", "wp_block") : EMPTY_ARRAY, isFixedToolbarActive: !!select(external_wp_preferences_namespaceObject.store).get( "core/edit-widgets", "fixedToolbar" ), keepCaretInsideBlock: !!select(external_wp_preferences_namespaceObject.store).get( "core/edit-widgets", "keepCaretInsideBlock" ), pageOnFront: siteSettings?.page_on_front, pageForPosts: siteSettings?.page_for_posts }; }, []); const { setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const settings = (0,external_wp_element_namespaceObject.useMemo)(() => { let mediaUploadBlockEditor; if (hasUploadPermissions) { mediaUploadBlockEditor = ({ onError, ...argumentsObject }) => { (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes, onError: ({ message }) => onError(message), ...argumentsObject }); }; } return { ...blockEditorSettings, __experimentalReusableBlocks: reusableBlocks, hasFixedToolbar: isFixedToolbarActive || !isLargeViewport, keepCaretInsideBlock, mediaUpload: mediaUploadBlockEditor, templateLock: "all", __experimentalSetIsInserterOpened: setIsInserterOpened, pageOnFront, pageForPosts, editorTool: "edit" }; }, [ hasUploadPermissions, blockEditorSettings, isFixedToolbarActive, isLargeViewport, keepCaretInsideBlock, reusableBlocks, setIsInserterOpened, pageOnFront, pageForPosts ]); const widgetAreaId = use_last_selected_widget_area_default(); const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)( KIND, POST_TYPE, { id: buildWidgetAreasPostId() } ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SlotFillProvider, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcuts_default.Register, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockKeyboardShortcuts, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( ExperimentalBlockEditorProvider, { value: blocks, onInput, onChange, settings, useSubRegistry: false, ...props, children: [ children, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsMenuItems, { rootClientId: widgetAreaId }) ] } ) ] }); } ;// ./node_modules/@wordpress/icons/build-module/library/drawer-left.js var drawer_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, { fillRule: "evenodd", clipRule: "evenodd", 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-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/drawer-right.js var drawer_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/block-default.js var block_default_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 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" }) }); ;// external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; ;// external ["wp","dom"] const external_wp_dom_namespaceObject = window["wp"]["dom"]; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/sidebar/widget-areas.js function WidgetAreas({ selectedWidgetAreaId }) { const widgetAreas = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getWidgetAreas(), [] ); const selectedWidgetArea = (0,external_wp_element_namespaceObject.useMemo)( () => selectedWidgetAreaId && widgetAreas?.find( (widgetArea) => widgetArea.id === selectedWidgetAreaId ), [selectedWidgetAreaId, widgetAreas] ); let description; if (!selectedWidgetArea) { description = (0,external_wp_i18n_namespaceObject.__)( // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts "Widget Areas are global parts in your site\u2019s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer." ); } else if (selectedWidgetAreaId === "wp_inactive_widgets") { description = (0,external_wp_i18n_namespaceObject.__)( "Blocks in this Widget Area will not be displayed in your site." ); } else { description = selectedWidgetArea.description; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-widgets-widget-areas", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-widget-areas__top-container", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: block_default_default }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "p", { dangerouslySetInnerHTML: { __html: (0,external_wp_dom_namespaceObject.safeHTML)(description) } } ), widgetAreas?.length === 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( "Your theme does not contain any Widget Areas." ) }), !selectedWidgetArea && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, href: (0,external_wp_url_namespaceObject.addQueryArgs)("customize.php", { "autofocus[panel]": "widgets", return: window.location.pathname }), variant: "tertiary", children: (0,external_wp_i18n_namespaceObject.__)("Manage with live preview") } ) ] }) ] }) }); } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/sidebar/index.js const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({ web: true, native: false }); const BLOCK_INSPECTOR_IDENTIFIER = "edit-widgets/block-inspector"; const WIDGET_AREAS_IDENTIFIER = "edit-widgets/block-areas"; const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis); function SidebarHeader({ selectedWidgetAreaBlock }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.TabList, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: WIDGET_AREAS_IDENTIFIER, children: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : (0,external_wp_i18n_namespaceObject.__)("Widget Areas") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: BLOCK_INSPECTOR_IDENTIFIER, children: (0,external_wp_i18n_namespaceObject.__)("Block") }) ] }); } function SidebarContent({ hasSelectedNonAreaBlock, currentArea, isGeneralSidebarOpen, selectedWidgetAreaBlock }) { const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (hasSelectedNonAreaBlock && currentArea === WIDGET_AREAS_IDENTIFIER && isGeneralSidebarOpen) { enableComplementaryArea( "core/edit-widgets", BLOCK_INSPECTOR_IDENTIFIER ); } if (!hasSelectedNonAreaBlock && currentArea === BLOCK_INSPECTOR_IDENTIFIER && isGeneralSidebarOpen) { enableComplementaryArea( "core/edit-widgets", WIDGET_AREAS_IDENTIFIER ); } }, [hasSelectedNonAreaBlock, enableComplementaryArea]); const tabsContextValue = (0,external_wp_element_namespaceObject.useContext)(Tabs.Context); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( complementary_area_default, { className: "edit-widgets-sidebar", header: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Context.Provider, { value: tabsContextValue, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarHeader, { selectedWidgetAreaBlock } ) }), headerClassName: "edit-widgets-sidebar__panel-tabs", title: (0,external_wp_i18n_namespaceObject.__)("Settings"), closeLabel: (0,external_wp_i18n_namespaceObject.__)("Close Settings"), scope: "core/edit-widgets", identifier: currentArea, icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left_default : drawer_right_default, isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.Context.Provider, { value: tabsContextValue, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Tabs.TabPanel, { tabId: WIDGET_AREAS_IDENTIFIER, focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WidgetAreas, { selectedWidgetAreaId: selectedWidgetAreaBlock?.attributes.id } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Tabs.TabPanel, { tabId: BLOCK_INSPECTOR_IDENTIFIER, focusable: false, children: hasSelectedNonAreaBlock ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockInspector, {}) : ( // Pretend that Widget Areas are part of the UI by not // showing the Block Inspector when one is selected. /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-inspector__no-blocks", children: (0,external_wp_i18n_namespaceObject.__)("No block selected.") }) ) } ) ] }) } ); } function Sidebar() { const { currentArea, hasSelectedNonAreaBlock, isGeneralSidebarOpen, selectedWidgetAreaBlock } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSelectedBlock, getBlock, getBlockParentsByBlockName } = select(external_wp_blockEditor_namespaceObject.store); const { getActiveComplementaryArea } = select(store); const selectedBlock = getSelectedBlock(); const activeArea = getActiveComplementaryArea(store_store.name); let currentSelection = activeArea; if (!currentSelection) { if (selectedBlock) { currentSelection = BLOCK_INSPECTOR_IDENTIFIER; } else { currentSelection = WIDGET_AREAS_IDENTIFIER; } } let widgetAreaBlock; if (selectedBlock) { if (selectedBlock.name === "core/widget-area") { widgetAreaBlock = selectedBlock; } else { widgetAreaBlock = getBlock( getBlockParentsByBlockName( selectedBlock.clientId, "core/widget-area" )[0] ); } } return { currentArea: currentSelection, hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== "core/widget-area"), isGeneralSidebarOpen: !!activeArea, selectedWidgetAreaBlock: widgetAreaBlock }; }, []); const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); const onTabSelect = (0,external_wp_element_namespaceObject.useCallback)( (newSelectedTabId) => { if (!!newSelectedTabId) { enableComplementaryArea( store_store.name, newSelectedTabId ); } }, [enableComplementaryArea] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Tabs, { selectedTabId: isGeneralSidebarOpen ? currentArea : null, onSelect: onTabSelect, selectOnMove: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarContent, { hasSelectedNonAreaBlock, currentArea, isGeneralSidebarOpen, selectedWidgetAreaBlock } ) } ); } ;// ./node_modules/@wordpress/icons/build-module/library/plus.js var plus_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/list-view.js var list_view_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 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/undo.js var undo_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.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/redo.js var redo_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.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" }) }); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/header/undo-redo/undo.js function UndoButton(props, ref) { const hasUndo = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).hasUndo(), [] ); const { undo } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { ...props, ref, icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? undo_default : redo_default, label: (0,external_wp_i18n_namespaceObject.__)("Undo"), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary("z"), "aria-disabled": !hasUndo, onClick: hasUndo ? undo : void 0, size: "compact" } ); } var undo_undo_default = (0,external_wp_element_namespaceObject.forwardRef)(UndoButton); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/header/undo-redo/redo.js function RedoButton(props, ref) { const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift("z") : external_wp_keycodes_namespaceObject.displayShortcut.primary("y"); const hasRedo = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).hasRedo(), [] ); const { redo } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { ...props, ref, icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? redo_default : undo_default, label: (0,external_wp_i18n_namespaceObject.__)("Redo"), shortcut, "aria-disabled": !hasRedo, onClick: hasRedo ? redo : void 0, size: "compact" } ); } var redo_redo_default = (0,external_wp_element_namespaceObject.forwardRef)(RedoButton); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/header/document-tools/index.js function DocumentTools() { const isMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); const { isInserterOpen, isListViewOpen, inserterSidebarToggleRef, listViewToggleRef } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { isInserterOpened, getInserterSidebarToggleRef, isListViewOpened, getListViewToggleRef } = unlock(select(store_store)); return { isInserterOpen: isInserterOpened(), isListViewOpen: isListViewOpened(), inserterSidebarToggleRef: getInserterSidebarToggleRef(), listViewToggleRef: getListViewToggleRef() }; }, []); const { setIsInserterOpened, setIsListViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const toggleListView = (0,external_wp_element_namespaceObject.useCallback)( () => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen] ); const toggleInserterSidebar = (0,external_wp_element_namespaceObject.useCallback)( () => setIsInserterOpened(!isInserterOpen), [setIsInserterOpened, isInserterOpen] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_blockEditor_namespaceObject.NavigableToolbar, { className: "edit-widgets-header-toolbar", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Document tools"), variant: "unstyled", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarItem, { ref: inserterSidebarToggleRef, as: external_wp_components_namespaceObject.Button, className: "edit-widgets-header-toolbar__inserter-toggle", variant: "primary", isPressed: isInserterOpen, onMouseDown: (event) => { event.preventDefault(); }, onClick: toggleInserterSidebar, icon: plus_default, label: (0,external_wp_i18n_namespaceObject._x)( "Block Inserter", "Generic label for block inserter button" ), size: "compact" } ), isMediumViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { as: undo_undo_default }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { as: redo_redo_default }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarItem, { as: external_wp_components_namespaceObject.Button, className: "edit-widgets-header-toolbar__list-view-toggle", icon: list_view_default, isPressed: isListViewOpen, label: (0,external_wp_i18n_namespaceObject.__)("List View"), onClick: toggleListView, ref: listViewToggleRef, size: "compact" } ) ] }) ] } ); } var document_tools_default = DocumentTools; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/save-button/index.js function SaveButton() { const { hasEditedWidgetAreaIds, isSaving, isWidgetSaveLocked } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getEditedWidgetAreas, isSavingWidgetAreas, isWidgetSavingLocked } = select(store_store); return { hasEditedWidgetAreaIds: getEditedWidgetAreas()?.length > 0, isSaving: isSavingWidgetAreas(), isWidgetSaveLocked: isWidgetSavingLocked() }; }, [] ); const { saveEditedWidgetAreas } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const isDisabled = isWidgetSaveLocked || isSaving || !hasEditedWidgetAreaIds; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "primary", isBusy: isSaving, "aria-disabled": isDisabled, onClick: isDisabled ? void 0 : saveEditedWidgetAreas, size: "compact", children: isSaving ? (0,external_wp_i18n_namespaceObject.__)("Saving\u2026") : (0,external_wp_i18n_namespaceObject.__)("Update") } ); } var save_button_default = SaveButton; ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js var more_vertical_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/external.js var external_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.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" }) }); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/config.js const textFormattingShortcuts = [ { keyCombination: { modifier: "primary", character: "b" }, description: (0,external_wp_i18n_namespaceObject.__)("Make the selected text bold.") }, { keyCombination: { modifier: "primary", character: "i" }, description: (0,external_wp_i18n_namespaceObject.__)("Make the selected text italic.") }, { keyCombination: { modifier: "primary", character: "k" }, description: (0,external_wp_i18n_namespaceObject.__)("Convert the selected text into a link.") }, { keyCombination: { modifier: "primaryShift", character: "k" }, description: (0,external_wp_i18n_namespaceObject.__)("Remove a link.") }, { keyCombination: { character: "[[" }, description: (0,external_wp_i18n_namespaceObject.__)("Insert a link to a post or page.") }, { keyCombination: { modifier: "primary", character: "u" }, description: (0,external_wp_i18n_namespaceObject.__)("Underline the selected text.") }, { keyCombination: { modifier: "access", character: "d" }, description: (0,external_wp_i18n_namespaceObject.__)("Strikethrough the selected text.") }, { keyCombination: { modifier: "access", character: "x" }, description: (0,external_wp_i18n_namespaceObject.__)("Make the selected text inline code.") }, { keyCombination: { modifier: "access", character: "0" }, aliases: [ { modifier: "access", character: "7" } ], description: (0,external_wp_i18n_namespaceObject.__)("Convert the current heading to a paragraph.") }, { keyCombination: { modifier: "access", character: "1-6" }, description: (0,external_wp_i18n_namespaceObject.__)( "Convert the current paragraph or heading to a heading of level 1 to 6." ) }, { keyCombination: { modifier: "primaryShift", character: "SPACE" }, description: (0,external_wp_i18n_namespaceObject.__)("Add non breaking space.") } ]; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.js function KeyCombination({ keyCombination, forceAriaLabel }) { const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier]( keyCombination.character ) : keyCombination.character; const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier]( keyCombination.character ) : keyCombination.character; const shortcuts = Array.isArray(shortcut) ? shortcut : [shortcut]; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "kbd", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination", "aria-label": forceAriaLabel || ariaLabel, children: shortcuts.map((character, index) => { if (character === "+") { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children: character }, index); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "kbd", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key", children: character }, index ); }) } ); } function Shortcut({ description, keyCombination, aliases = [], ariaLabel }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-description", children: description }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-term", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( KeyCombination, { keyCombination, forceAriaLabel: ariaLabel } ), aliases.map((alias, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( KeyCombination, { keyCombination: alias, forceAriaLabel: ariaLabel }, index )) ] }) ] }); } var shortcut_default = Shortcut; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js function DynamicShortcut({ name }) { const { keyCombination, description, aliases } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getShortcutKeyCombination, getShortcutDescription, getShortcutAliases } = select(external_wp_keyboardShortcuts_namespaceObject.store); return { keyCombination: getShortcutKeyCombination(name), aliases: getShortcutAliases(name), description: getShortcutDescription(name) }; }, [name] ); if (!keyCombination) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( shortcut_default, { keyCombination, description, aliases } ); } var dynamic_shortcut_default = DynamicShortcut; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/index.js const ShortcutList = ({ shortcuts }) => ( /* * Disable reason: The `list` ARIA role is redundant but * Safari+VoiceOver won't announce the list otherwise. */ /* eslint-disable jsx-a11y/no-redundant-roles */ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "ul", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-list", role: "list", children: shortcuts.map((shortcut, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "li", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut", children: typeof shortcut === "string" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dynamic_shortcut_default, { name: shortcut }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shortcut_default, { ...shortcut }) }, index )) } ) ); const ShortcutSection = ({ title, shortcuts, className }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "section", { className: dist_clsx( "edit-widgets-keyboard-shortcut-help-modal__section", className ), children: [ !!title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "edit-widgets-keyboard-shortcut-help-modal__section-title", children: title }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutList, { shortcuts }) ] } ); const ShortcutCategorySection = ({ title, categoryName, additionalShortcuts = [] }) => { const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)( (select) => { return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts( categoryName ); }, [categoryName] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShortcutSection, { title, shortcuts: categoryShortcuts.concat(additionalShortcuts) } ); }; function KeyboardShortcutHelpModal({ isModalActive, toggleModal }) { (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/edit-widgets/keyboard-shortcuts", toggleModal, { bindGlobal: true }); if (!isModalActive) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Modal, { className: "edit-widgets-keyboard-shortcut-help-modal", title: (0,external_wp_i18n_namespaceObject.__)("Keyboard shortcuts"), onRequestClose: toggleModal, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShortcutSection, { className: "edit-widgets-keyboard-shortcut-help-modal__main-shortcuts", shortcuts: ["core/edit-widgets/keyboard-shortcuts"] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)("Global shortcuts"), categoryName: "global" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)("Selection shortcuts"), categoryName: "selection" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)("Block shortcuts"), categoryName: "block", additionalShortcuts: [ { keyCombination: { character: "/" }, description: (0,external_wp_i18n_namespaceObject.__)( "Change the block type after adding a new paragraph." ), /* translators: The forward-slash character. e.g. '/'. */ ariaLabel: (0,external_wp_i18n_namespaceObject.__)("Forward-slash") } ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShortcutSection, { title: (0,external_wp_i18n_namespaceObject.__)("Text formatting"), shortcuts: textFormattingShortcuts } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)("List View shortcuts"), categoryName: "list-view" } ) ] } ); } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/more-menu/tools-more-menu-group.js const { Fill: ToolsMoreMenuGroup, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)( "EditWidgetsToolsMoreMenuGroup" ); ToolsMoreMenuGroup.Slot = ({ fillProps }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { fillProps, children: (fills) => fills.length > 0 && fills }); var tools_more_menu_group_default = ToolsMoreMenuGroup; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/more-menu/index.js function MoreMenu() { const [ isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible ] = (0,external_wp_element_namespaceObject.useState)(false); const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)( "core/edit-widgets/keyboard-shortcuts", toggleKeyboardShortcutsModal ); const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("Options"), popoverProps: { placement: "bottom-end", className: "more-menu-dropdown__content" }, toggleProps: { tooltipPosition: "bottom", size: "compact" }, children: (onClose) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject._x)("View", "noun"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core/edit-widgets", name: "fixedToolbar", label: (0,external_wp_i18n_namespaceObject.__)("Top toolbar"), info: (0,external_wp_i18n_namespaceObject.__)( "Access all block and document tools in a single place" ), messageActivated: (0,external_wp_i18n_namespaceObject.__)( "Top toolbar activated" ), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)( "Top toolbar deactivated" ) } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Tools"), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { setIsKeyboardShortcutsModalVisible(true); }, shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access("h"), children: (0,external_wp_i18n_namespaceObject.__)("Keyboard shortcuts") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core/edit-widgets", name: "welcomeGuide", label: (0,external_wp_i18n_namespaceObject.__)("Welcome Guide") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.MenuItem, { role: "menuitem", icon: external_default, href: (0,external_wp_i18n_namespaceObject.__)( "https://wordpress.org/documentation/article/block-based-widgets-editor/" ), target: "_blank", rel: "noopener noreferrer", children: [ (0,external_wp_i18n_namespaceObject.__)("Help"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", /* translators: accessibility text */ children: (0,external_wp_i18n_namespaceObject.__)("(opens in a new tab)") }) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( tools_more_menu_group_default.Slot, { fillProps: { onClose } } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Preferences"), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core/edit-widgets", name: "keepCaretInsideBlock", label: (0,external_wp_i18n_namespaceObject.__)( "Contain text cursor inside block" ), info: (0,external_wp_i18n_namespaceObject.__)( "Aids screen readers by stopping text caret from leaving blocks." ), messageActivated: (0,external_wp_i18n_namespaceObject.__)( "Contain text cursor inside block activated" ), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)( "Contain text cursor inside block deactivated" ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core/edit-widgets", name: "themeStyles", info: (0,external_wp_i18n_namespaceObject.__)( "Make the editor look like your theme." ), label: (0,external_wp_i18n_namespaceObject.__)("Use theme styles") } ), isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core/edit-widgets", name: "showBlockBreadcrumbs", label: (0,external_wp_i18n_namespaceObject.__)("Display block breadcrumbs"), info: (0,external_wp_i18n_namespaceObject.__)( "Shows block breadcrumbs at the bottom of the editor." ), messageActivated: (0,external_wp_i18n_namespaceObject.__)( "Display block breadcrumbs activated" ), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)( "Display block breadcrumbs deactivated" ) } ) ] }) ] }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( KeyboardShortcutHelpModal, { isModalActive: isKeyboardShortcutsModalActive, toggleModal: toggleKeyboardShortcutsModal } ) ] }); } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/header/index.js function Header() { const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); const blockToolbarRef = (0,external_wp_element_namespaceObject.useRef)(); const { hasFixedToolbar } = (0,external_wp_data_namespaceObject.useSelect)( (select) => ({ hasFixedToolbar: !!select(external_wp_preferences_namespaceObject.store).get( "core/edit-widgets", "fixedToolbar" ) }), [] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-header", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-header__navigable-toolbar-wrapper", children: [ isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-widgets-header__title", children: (0,external_wp_i18n_namespaceObject.__)("Widgets") }), !isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.VisuallyHidden, { as: "h1", className: "edit-widgets-header__title", children: (0,external_wp_i18n_namespaceObject.__)("Widgets") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(document_tools_default, {}), hasFixedToolbar && isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "selected-block-tools-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { hideDragHandle: true }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Popover.Slot, { ref: blockToolbarRef, name: "block-toolbar" } ) ] }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-header__actions", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items_default.Slot, { scope: "core/edit-widgets" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(save_button_default, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {}) ] }) ] }) }); } var header_default = Header; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/notices/index.js const MAX_VISIBLE_NOTICES = -3; function Notices() { const { removeNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { notices } = (0,external_wp_data_namespaceObject.useSelect)((select) => { return { notices: select(external_wp_notices_namespaceObject.store).getNotices() }; }, []); const dismissibleNotices = notices.filter( ({ isDismissible, type }) => isDismissible && type === "default" ); const nonDismissibleNotices = notices.filter( ({ isDismissible, type }) => !isDismissible && type === "default" ); const snackbarNotices = notices.filter(({ type }) => type === "snackbar").slice(MAX_VISIBLE_NOTICES); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.NoticeList, { notices: nonDismissibleNotices, className: "edit-widgets-notices__pinned" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.NoticeList, { notices: dismissibleNotices, className: "edit-widgets-notices__dismissible", onRemove: removeNotice } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SnackbarList, { notices: snackbarNotices, className: "edit-widgets-notices__snackbar", onRemove: removeNotice } ) ] }); } var notices_default = Notices; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/widget-areas-block-editor-content/index.js function WidgetAreasBlockEditorContent({ blockEditorSettings }) { const hasThemeStyles = (0,external_wp_data_namespaceObject.useSelect)( (select) => !!select(external_wp_preferences_namespaceObject.store).get( "core/edit-widgets", "themeStyles" ), [] ); const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); const styles = (0,external_wp_element_namespaceObject.useMemo)(() => { return hasThemeStyles ? blockEditorSettings.styles : []; }, [blockEditorSettings, hasThemeStyles]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-block-editor", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(notices_default, {}), !isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { hideDragHandle: true }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockTools, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcuts_default, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { styles, scope: ":where(.editor-styles-wrapper)" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSelectionClearer, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.WritingFlow, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { className: "edit-widgets-main-block-list" }) }) }) ] }) ] }); } ;// ./node_modules/@wordpress/edit-widgets/build-module/hooks/use-widget-library-insertion-point.js const useWidgetLibraryInsertionPoint = () => { const firstRootId = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const widgetAreasPost = getEntityRecord( KIND, POST_TYPE, buildWidgetAreasPostId() ); return widgetAreasPost?.blocks[0]?.clientId; }, []); return (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockRootClientId, getBlockSelectionEnd, getBlockOrder, getBlockIndex } = select(external_wp_blockEditor_namespaceObject.store); const insertionPoint = select(store_store).__experimentalGetInsertionPoint(); if (insertionPoint.rootClientId) { return insertionPoint; } const clientId = getBlockSelectionEnd() || firstRootId; const rootClientId = getBlockRootClientId(clientId); if (clientId && rootClientId === "") { return { rootClientId: clientId, insertionIndex: getBlockOrder(clientId).length }; } return { rootClientId, insertionIndex: getBlockIndex(clientId) + 1 }; }, [firstRootId] ); }; var use_widget_library_insertion_point_default = useWidgetLibraryInsertionPoint; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/secondary-sidebar/inserter-sidebar.js function InserterSidebar() { const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const { rootClientId, insertionIndex } = use_widget_library_insertion_point_default(); const { setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const closeInserter = (0,external_wp_element_namespaceObject.useCallback)(() => { return setIsInserterOpened(false); }, [setIsInserterOpened]); const libraryRef = (0,external_wp_element_namespaceObject.useRef)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-widgets-layout__inserter-panel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-widgets-layout__inserter-panel-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.__experimentalLibrary, { showInserterHelpPanel: true, shouldFocusBlock: isMobileViewport, rootClientId, __experimentalInsertionIndex: insertionIndex, ref: libraryRef, onClose: closeInserter } ) }) }); } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/secondary-sidebar/list-view-sidebar.js function ListViewSidebar() { const { setIsListViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { getListViewToggleRef } = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store)); const [dropZoneElement, setDropZoneElement] = (0,external_wp_element_namespaceObject.useState)(null); const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)("firstElement"); const closeListView = (0,external_wp_element_namespaceObject.useCallback)(() => { setIsListViewOpened(false); getListViewToggleRef().current?.focus(); }, [getListViewToggleRef, setIsListViewOpened]); const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)( (event) => { if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { event.preventDefault(); closeListView(); } }, [closeListView] ); return ( // eslint-disable-next-line jsx-a11y/no-static-element-interactions /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: "edit-widgets-editor__list-view-panel", onKeyDown: closeOnEscape, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-editor__list-view-panel-header", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { children: (0,external_wp_i18n_namespaceObject.__)("List View") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { icon: close_small_default, label: (0,external_wp_i18n_namespaceObject.__)("Close"), onClick: closeListView, size: "compact" } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "edit-widgets-editor__list-view-panel-content", ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([focusOnMountRef, setDropZoneElement]), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalListView, { dropZoneElement }) } ) ] } ) ); } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/secondary-sidebar/index.js function SecondarySidebar() { const { isInserterOpen, isListViewOpen } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { isInserterOpened, isListViewOpened } = select(store_store); return { isInserterOpen: isInserterOpened(), isListViewOpen: isListViewOpened() }; }, []); if (isInserterOpen) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InserterSidebar, {}); } if (isListViewOpen) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewSidebar, {}); } return null; } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/layout/interface.js const interfaceLabels = { /* translators: accessibility text for the widgets screen top bar landmark region. */ header: (0,external_wp_i18n_namespaceObject.__)("Widgets top bar"), /* translators: accessibility text for the widgets screen content landmark region. */ body: (0,external_wp_i18n_namespaceObject.__)("Widgets and blocks"), /* translators: accessibility text for the widgets screen settings landmark region. */ sidebar: (0,external_wp_i18n_namespaceObject.__)("Widgets settings"), /* translators: accessibility text for the widgets screen footer landmark region. */ footer: (0,external_wp_i18n_namespaceObject.__)("Widgets footer") }; function Interface({ blockEditorSettings }) { const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("huge", ">="); const { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { hasBlockBreadCrumbsEnabled, hasSidebarEnabled, isInserterOpened, isListViewOpened } = (0,external_wp_data_namespaceObject.useSelect)( (select) => ({ hasSidebarEnabled: !!select( store ).getActiveComplementaryArea(store_store.name), isInserterOpened: !!select(store_store).isInserterOpened(), isListViewOpened: !!select(store_store).isListViewOpened(), hasBlockBreadCrumbsEnabled: !!select(external_wp_preferences_namespaceObject.store).get( "core/edit-widgets", "showBlockBreadcrumbs" ) }), [] ); (0,external_wp_element_namespaceObject.useEffect)(() => { if (hasSidebarEnabled && !isHugeViewport) { setIsInserterOpened(false); setIsListViewOpened(false); } }, [hasSidebarEnabled, isHugeViewport]); (0,external_wp_element_namespaceObject.useEffect)(() => { if ((isInserterOpened || isListViewOpened) && !isHugeViewport) { closeGeneralSidebar(); } }, [isInserterOpened, isListViewOpened, isHugeViewport]); const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)("List View") : (0,external_wp_i18n_namespaceObject.__)("Block Library"); const hasSecondarySidebar = isListViewOpened || isInserterOpened; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( interface_skeleton_default, { labels: { ...interfaceLabels, secondarySidebar: secondarySidebarLabel }, header: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(header_default, {}), secondarySidebar: hasSecondarySidebar && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SecondarySidebar, {}), sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_default.Slot, { scope: "core/edit-widgets" }), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WidgetAreasBlockEditorContent, { blockEditorSettings } ) }), footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-widgets-layout__footer", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { rootLabelText: (0,external_wp_i18n_namespaceObject.__)("Widgets") }) }) } ); } var interface_default = Interface; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/layout/unsaved-changes-warning.js function UnsavedChangesWarning() { const isDirty = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getEditedWidgetAreas } = select(store_store); const editedWidgetAreas = getEditedWidgetAreas(); return editedWidgetAreas?.length > 0; }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { const warnIfUnsavedChanges = (event) => { if (isDirty) { event.returnValue = (0,external_wp_i18n_namespaceObject.__)( "You have unsaved changes. If you proceed, they will be lost." ); return event.returnValue; } }; window.addEventListener("beforeunload", warnIfUnsavedChanges); return () => { window.removeEventListener("beforeunload", warnIfUnsavedChanges); }; }, [isDirty]); return null; } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/welcome-guide/index.js function WelcomeGuide() { const isActive = (0,external_wp_data_namespaceObject.useSelect)( (select) => !!select(external_wp_preferences_namespaceObject.store).get( "core/edit-widgets", "welcomeGuide" ), [] ); const { toggle } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const widgetAreas = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store_store).getWidgetAreas({ per_page: -1 }), [] ); if (!isActive) { return null; } const isEntirelyBlockWidgets = widgetAreas?.every( (widgetArea) => widgetArea.id === "wp_inactive_widgets" || widgetArea.widgets.every( (widgetId) => widgetId.startsWith("block-") ) ); const numWidgetAreas = widgetAreas?.filter( (widgetArea) => widgetArea.id !== "wp_inactive_widgets" ).length ?? 0; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Guide, { className: "edit-widgets-welcome-guide", contentLabel: (0,external_wp_i18n_namespaceObject.__)("Welcome to block Widgets"), finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Get started"), onFinish: () => toggle("core/edit-widgets", "welcomeGuide"), pages: [ { image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" } ), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Welcome to block Widgets") }), isEntirelyBlockWidgets ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: Number of block areas in the current theme. (0,external_wp_i18n_namespaceObject._n)( "Your theme provides %s \u201Cblock\u201D area for you to add and edit content.\xA0Try adding a search bar, social icons, or other types of blocks here and see how they\u2019ll look on your site.", "Your theme provides %s different \u201Cblock\u201D areas for you to add and edit content.\xA0Try adding a search bar, social icons, or other types of blocks here and see how they\u2019ll look on your site.", numWidgetAreas ), numWidgetAreas ) }) }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( "You can now add any block to your site\u2019s widget areas. Don\u2019t worry, all of your favorite widgets still work flawlessly." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { className: "edit-widgets-welcome-guide__text", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { children: (0,external_wp_i18n_namespaceObject.__)( "Want to stick with the old widgets?" ) }), " ", /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)( "https://wordpress.org/plugins/classic-widgets/" ), children: (0,external_wp_i18n_namespaceObject.__)( "Get the Classic Widgets plugin." ) } ) ] }) ] }) ] }) }, { image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" } ), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Customize each block") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( "Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected." ) }) ] }) }, { image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" } ), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Explore all blocks") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.__)( "All of the blocks available to you live in the block library. You\u2019ll find it wherever you see the <InserterIconImage /> icon." ), { InserterIconImage: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { className: "edit-widgets-welcome-guide__inserter-icon", alt: (0,external_wp_i18n_namespaceObject.__)("inserter"), src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A" } ) } ) }) ] }) }, { image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" } ), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Learn more") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.__)( "New to the block editor? Want to learn more about using it? <a>Here's a detailed guide.</a>" ), { a: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)( "https://wordpress.org/documentation/article/wordpress-block-editor/" ) } ) } ) }) ] }) } ] } ); } function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("picture", { className: "edit-widgets-welcome-guide__image", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "source", { srcSet: nonAnimatedSrc, media: "(prefers-reduced-motion: reduce)" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" }) ] }); } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/layout/index.js function Layout({ blockEditorSettings }) { const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); function onPluginAreaError(name) { createErrorNotice( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: plugin name */ (0,external_wp_i18n_namespaceObject.__)( 'The "%s" plugin has encountered an error and cannot be rendered.' ), name ) ); } const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: navigateRegionsProps.className, ...navigateRegionsProps, ref: navigateRegionsProps.ref, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( WidgetAreasBlockEditorProvider, { blockEditorSettings, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(interface_default, { blockEditorSettings }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Sidebar, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_plugins_namespaceObject.PluginArea, { onError: onPluginAreaError }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(UnsavedChangesWarning, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuide, {}) ] } ) } ) }); } var layout_default = Layout; ;// ./node_modules/@wordpress/edit-widgets/build-module/index.js const disabledBlocks = [ "core/more", "core/freeform", "core/template-part", ...ALLOW_REUSABLE_BLOCKS ? [] : ["core/block"] ]; function initializeEditor(id, settings) { const target = document.getElementById(id); const root = (0,external_wp_element_namespaceObject.createRoot)(target); const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter((block) => { return !(disabledBlocks.includes(block.name) || block.name.startsWith("core/post") || block.name.startsWith("core/query") || block.name.startsWith("core/site") || block.name.startsWith("core/navigation")); }); (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults("core/edit-widgets", { fixedToolbar: false, welcomeGuide: true, showBlockBreadcrumbs: true, themeStyles: true }); (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)(); if (false) {} (0,external_wp_widgets_namespaceObject.registerLegacyWidgetVariations)(settings); registerBlock(widget_area_namespaceObject); (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)(); settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings); (0,external_wp_blocks_namespaceObject.setFreeformContentHandlerName)("core/html"); root.render( /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(layout_default, { blockEditorSettings: settings }) }) ); return root; } const initialize = initializeEditor; function reinitializeEditor() { external_wp_deprecated_default()("wp.editWidgets.reinitializeEditor", { since: "6.2", version: "6.3" }); } const registerBlock = (block) => { if (!block) { return; } const { metadata, settings, name } = block; if (metadata) { (0,external_wp_blocks_namespaceObject.unstable__bootstrapServerSideBlockDefinitions)({ [name]: metadata }); } (0,external_wp_blocks_namespaceObject.registerBlockType)(name, settings); }; (window.wp = window.wp || {}).editWidgets = __webpack_exports__; /******/ })() ; dom.js 0000644 00000104271 15151622574 0005676 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { __unstableStripHTML: () => (/* reexport */ stripHTML), computeCaretRect: () => (/* reexport */ computeCaretRect), documentHasSelection: () => (/* reexport */ documentHasSelection), documentHasTextSelection: () => (/* reexport */ documentHasTextSelection), documentHasUncollapsedSelection: () => (/* reexport */ documentHasUncollapsedSelection), focus: () => (/* binding */ build_module_focus), getFilesFromDataTransfer: () => (/* reexport */ getFilesFromDataTransfer), getOffsetParent: () => (/* reexport */ getOffsetParent), getPhrasingContentSchema: () => (/* reexport */ getPhrasingContentSchema), getRectangleFromRange: () => (/* reexport */ getRectangleFromRange), getScrollContainer: () => (/* reexport */ getScrollContainer), insertAfter: () => (/* reexport */ insertAfter), isEmpty: () => (/* reexport */ isEmpty), isEntirelySelected: () => (/* reexport */ isEntirelySelected), isFormElement: () => (/* reexport */ isFormElement), isHorizontalEdge: () => (/* reexport */ isHorizontalEdge), isNumberInput: () => (/* reexport */ isNumberInput), isPhrasingContent: () => (/* reexport */ isPhrasingContent), isRTL: () => (/* reexport */ isRTL), isSelectionForward: () => (/* reexport */ isSelectionForward), isTextContent: () => (/* reexport */ isTextContent), isTextField: () => (/* reexport */ isTextField), isVerticalEdge: () => (/* reexport */ isVerticalEdge), placeCaretAtHorizontalEdge: () => (/* reexport */ placeCaretAtHorizontalEdge), placeCaretAtVerticalEdge: () => (/* reexport */ placeCaretAtVerticalEdge), remove: () => (/* reexport */ remove), removeInvalidHTML: () => (/* reexport */ removeInvalidHTML), replace: () => (/* reexport */ replace), replaceTag: () => (/* reexport */ replaceTag), safeHTML: () => (/* reexport */ safeHTML), unwrap: () => (/* reexport */ unwrap), wrap: () => (/* reexport */ wrap) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/dom/build-module/focusable.js var focusable_namespaceObject = {}; __webpack_require__.r(focusable_namespaceObject); __webpack_require__.d(focusable_namespaceObject, { find: () => (find) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/dom/build-module/tabbable.js var tabbable_namespaceObject = {}; __webpack_require__.r(tabbable_namespaceObject); __webpack_require__.d(tabbable_namespaceObject, { find: () => (tabbable_find), findNext: () => (findNext), findPrevious: () => (findPrevious), isTabbableIndex: () => (isTabbableIndex) }); ;// ./node_modules/@wordpress/dom/build-module/focusable.js function buildSelector(sequential) { return [ sequential ? '[tabindex]:not([tabindex^="-"])' : "[tabindex]", "a[href]", "button:not([disabled])", 'input:not([type="hidden"]):not([disabled])', "select:not([disabled])", "textarea:not([disabled])", 'iframe:not([tabindex^="-"])', "object", "embed", "summary", "area[href]", "[contenteditable]:not([contenteditable=false])" ].join(","); } function isVisible(element) { return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0; } function isValidFocusableArea(element) { const map = element.closest("map[name]"); if (!map) { return false; } const img = element.ownerDocument.querySelector( 'img[usemap="#' + map.name + '"]' ); return !!img && isVisible(img); } function find(context, { sequential = false } = {}) { const elements = context.querySelectorAll(buildSelector(sequential)); return Array.from(elements).filter((element) => { if (!isVisible(element)) { return false; } const { nodeName } = element; if ("AREA" === nodeName) { return isValidFocusableArea( /** @type {HTMLAreaElement} */ element ); } return true; }); } ;// ./node_modules/@wordpress/dom/build-module/tabbable.js function getTabIndex(element) { const tabIndex = element.getAttribute("tabindex"); return tabIndex === null ? 0 : parseInt(tabIndex, 10); } function isTabbableIndex(element) { return getTabIndex(element) !== -1; } function createStatefulCollapseRadioGroup() { const CHOSEN_RADIO_BY_NAME = {}; return function collapseRadioGroup(result, element) { const { nodeName, type, checked, name } = element; if (nodeName !== "INPUT" || type !== "radio" || !name) { return result.concat(element); } const hasChosen = CHOSEN_RADIO_BY_NAME.hasOwnProperty(name); const isChosen = checked || !hasChosen; if (!isChosen) { return result; } if (hasChosen) { const hadChosenElement = CHOSEN_RADIO_BY_NAME[name]; result = result.filter((e) => e !== hadChosenElement); } CHOSEN_RADIO_BY_NAME[name] = element; return result.concat(element); }; } function mapElementToObjectTabbable(element, index) { return { element, index }; } function mapObjectTabbableToElement(object) { return object.element; } function compareObjectTabbables(a, b) { const aTabIndex = getTabIndex(a.element); const bTabIndex = getTabIndex(b.element); if (aTabIndex === bTabIndex) { return a.index - b.index; } return aTabIndex - bTabIndex; } function filterTabbable(focusables) { return focusables.filter(isTabbableIndex).map(mapElementToObjectTabbable).sort(compareObjectTabbables).map(mapObjectTabbableToElement).reduce(createStatefulCollapseRadioGroup(), []); } function tabbable_find(context) { return filterTabbable(find(context)); } function findPrevious(element) { return filterTabbable(find(element.ownerDocument.body)).reverse().find( (focusable) => ( // eslint-disable-next-line no-bitwise element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_PRECEDING ) ); } function findNext(element) { return filterTabbable(find(element.ownerDocument.body)).find( (focusable) => ( // eslint-disable-next-line no-bitwise element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_FOLLOWING ) ); } ;// ./node_modules/@wordpress/dom/build-module/utils/assert-is-defined.js function assertIsDefined(val, name) { if (false) {} } ;// ./node_modules/@wordpress/dom/build-module/dom/get-rectangle-from-range.js function getRectangleFromRange(range) { if (!range.collapsed) { const rects2 = Array.from(range.getClientRects()); if (rects2.length === 1) { return rects2[0]; } const filteredRects = rects2.filter(({ width }) => width > 1); if (filteredRects.length === 0) { return range.getBoundingClientRect(); } if (filteredRects.length === 1) { return filteredRects[0]; } let { top: furthestTop, bottom: furthestBottom, left: furthestLeft, right: furthestRight } = filteredRects[0]; for (const { top, bottom, left, right } of filteredRects) { if (top < furthestTop) { furthestTop = top; } if (bottom > furthestBottom) { furthestBottom = bottom; } if (left < furthestLeft) { furthestLeft = left; } if (right > furthestRight) { furthestRight = right; } } return new window.DOMRect( furthestLeft, furthestTop, furthestRight - furthestLeft, furthestBottom - furthestTop ); } const { startContainer } = range; const { ownerDocument } = startContainer; if (startContainer.nodeName === "BR") { const { parentNode } = startContainer; assertIsDefined(parentNode, "parentNode"); const index = ( /** @type {Node[]} */ Array.from(parentNode.childNodes).indexOf(startContainer) ); assertIsDefined(ownerDocument, "ownerDocument"); range = ownerDocument.createRange(); range.setStart(parentNode, index); range.setEnd(parentNode, index); } const rects = range.getClientRects(); if (rects.length > 1) { return null; } let rect = rects[0]; if (!rect || rect.height === 0) { assertIsDefined(ownerDocument, "ownerDocument"); const padNode = ownerDocument.createTextNode("\u200B"); range = range.cloneRange(); range.insertNode(padNode); rect = range.getClientRects()[0]; assertIsDefined(padNode.parentNode, "padNode.parentNode"); padNode.parentNode.removeChild(padNode); } return rect; } ;// ./node_modules/@wordpress/dom/build-module/dom/compute-caret-rect.js function computeCaretRect(win) { const selection = win.getSelection(); assertIsDefined(selection, "selection"); const range = selection.rangeCount ? selection.getRangeAt(0) : null; if (!range) { return null; } return getRectangleFromRange(range); } ;// ./node_modules/@wordpress/dom/build-module/dom/document-has-text-selection.js function documentHasTextSelection(doc) { assertIsDefined(doc.defaultView, "doc.defaultView"); const selection = doc.defaultView.getSelection(); assertIsDefined(selection, "selection"); const range = selection.rangeCount ? selection.getRangeAt(0) : null; return !!range && !range.collapsed; } ;// ./node_modules/@wordpress/dom/build-module/dom/is-html-input-element.js function isHTMLInputElement(node) { return node?.nodeName === "INPUT"; } ;// ./node_modules/@wordpress/dom/build-module/dom/is-text-field.js function isTextField(node) { const nonTextInputs = [ "button", "checkbox", "hidden", "file", "radio", "image", "range", "reset", "submit", "number", "email", "time" ]; return isHTMLInputElement(node) && node.type && !nonTextInputs.includes(node.type) || node.nodeName === "TEXTAREA" || /** @type {HTMLElement} */ node.contentEditable === "true"; } ;// ./node_modules/@wordpress/dom/build-module/dom/input-field-has-uncollapsed-selection.js function inputFieldHasUncollapsedSelection(element) { if (!isHTMLInputElement(element) && !isTextField(element)) { return false; } try { const { selectionStart, selectionEnd } = ( /** @type {HTMLInputElement | HTMLTextAreaElement} */ element ); return ( // `null` means the input type doesn't implement selection, thus we // cannot determine whether the selection is collapsed, so we // default to true. selectionStart === null || // when not null, compare the two points selectionStart !== selectionEnd ); } catch (error) { return true; } } ;// ./node_modules/@wordpress/dom/build-module/dom/document-has-uncollapsed-selection.js function documentHasUncollapsedSelection(doc) { return documentHasTextSelection(doc) || !!doc.activeElement && inputFieldHasUncollapsedSelection(doc.activeElement); } ;// ./node_modules/@wordpress/dom/build-module/dom/document-has-selection.js function documentHasSelection(doc) { return !!doc.activeElement && (isHTMLInputElement(doc.activeElement) || isTextField(doc.activeElement) || documentHasTextSelection(doc)); } ;// ./node_modules/@wordpress/dom/build-module/dom/get-computed-style.js function getComputedStyle(element) { assertIsDefined( element.ownerDocument.defaultView, "element.ownerDocument.defaultView" ); return element.ownerDocument.defaultView.getComputedStyle(element); } ;// ./node_modules/@wordpress/dom/build-module/dom/get-scroll-container.js function getScrollContainer(node, direction = "vertical") { if (!node) { return void 0; } if (direction === "vertical" || direction === "all") { if (node.scrollHeight > node.clientHeight) { const { overflowY } = getComputedStyle(node); if (/(auto|scroll)/.test(overflowY)) { return node; } } } if (direction === "horizontal" || direction === "all") { if (node.scrollWidth > node.clientWidth) { const { overflowX } = getComputedStyle(node); if (/(auto|scroll)/.test(overflowX)) { return node; } } } if (node.ownerDocument === node.parentNode) { return node; } return getScrollContainer( /** @type {Element} */ node.parentNode, direction ); } ;// ./node_modules/@wordpress/dom/build-module/dom/get-offset-parent.js function getOffsetParent(node) { let closestElement; while (closestElement = /** @type {Node} */ node.parentNode) { if (closestElement.nodeType === closestElement.ELEMENT_NODE) { break; } } if (!closestElement) { return null; } if (getComputedStyle( /** @type {Element} */ closestElement ).position !== "static") { return closestElement; } return ( /** @type {Node & { offsetParent: Node }} */ closestElement.offsetParent ); } ;// ./node_modules/@wordpress/dom/build-module/dom/is-input-or-text-area.js function isInputOrTextArea(element) { return element.tagName === "INPUT" || element.tagName === "TEXTAREA"; } ;// ./node_modules/@wordpress/dom/build-module/dom/is-entirely-selected.js function isEntirelySelected(element) { if (isInputOrTextArea(element)) { return element.selectionStart === 0 && element.value.length === element.selectionEnd; } if (!element.isContentEditable) { return true; } const { ownerDocument } = element; const { defaultView } = ownerDocument; assertIsDefined(defaultView, "defaultView"); const selection = defaultView.getSelection(); assertIsDefined(selection, "selection"); const range = selection.rangeCount ? selection.getRangeAt(0) : null; if (!range) { return true; } const { startContainer, endContainer, startOffset, endOffset } = range; if (startContainer === element && endContainer === element && startOffset === 0 && endOffset === element.childNodes.length) { return true; } const lastChild = element.lastChild; assertIsDefined(lastChild, "lastChild"); const endContainerContentLength = endContainer.nodeType === endContainer.TEXT_NODE ? ( /** @type {Text} */ endContainer.data.length ) : endContainer.childNodes.length; return isDeepChild(startContainer, element, "firstChild") && isDeepChild(endContainer, element, "lastChild") && startOffset === 0 && endOffset === endContainerContentLength; } function isDeepChild(query, container, propName) { let candidate = container; do { if (query === candidate) { return true; } candidate = candidate[propName]; } while (candidate); return false; } ;// ./node_modules/@wordpress/dom/build-module/dom/is-form-element.js function isFormElement(element) { if (!element) { return false; } const { tagName } = element; const checkForInputTextarea = isInputOrTextArea(element); return checkForInputTextarea || tagName === "BUTTON" || tagName === "SELECT"; } ;// ./node_modules/@wordpress/dom/build-module/dom/is-rtl.js function isRTL(element) { return getComputedStyle(element).direction === "rtl"; } ;// ./node_modules/@wordpress/dom/build-module/dom/get-range-height.js function getRangeHeight(range) { const rects = Array.from(range.getClientRects()); if (!rects.length) { return; } const highestTop = Math.min(...rects.map(({ top }) => top)); const lowestBottom = Math.max(...rects.map(({ bottom }) => bottom)); return lowestBottom - highestTop; } ;// ./node_modules/@wordpress/dom/build-module/dom/is-selection-forward.js function isSelectionForward(selection) { const { anchorNode, focusNode, anchorOffset, focusOffset } = selection; assertIsDefined(anchorNode, "anchorNode"); assertIsDefined(focusNode, "focusNode"); const position = anchorNode.compareDocumentPosition(focusNode); if (position & anchorNode.DOCUMENT_POSITION_PRECEDING) { return false; } if (position & anchorNode.DOCUMENT_POSITION_FOLLOWING) { return true; } if (position === 0) { return anchorOffset <= focusOffset; } return true; } ;// ./node_modules/@wordpress/dom/build-module/dom/caret-range-from-point.js function caretRangeFromPoint(doc, x, y) { if (doc.caretRangeFromPoint) { return doc.caretRangeFromPoint(x, y); } if (!doc.caretPositionFromPoint) { return null; } const point = doc.caretPositionFromPoint(x, y); if (!point) { return null; } const range = doc.createRange(); range.setStart(point.offsetNode, point.offset); range.collapse(true); return range; } ;// ./node_modules/@wordpress/dom/build-module/dom/hidden-caret-range-from-point.js function hiddenCaretRangeFromPoint(doc, x, y, container) { const originalZIndex = container.style.zIndex; const originalPosition = container.style.position; const { position = "static" } = getComputedStyle(container); if (position === "static") { container.style.position = "relative"; } container.style.zIndex = "10000"; const range = caretRangeFromPoint(doc, x, y); container.style.zIndex = originalZIndex; container.style.position = originalPosition; return range; } ;// ./node_modules/@wordpress/dom/build-module/dom/scroll-if-no-range.js function scrollIfNoRange(container, alignToTop, callback) { let range = callback(); if (!range || !range.startContainer || !container.contains(range.startContainer)) { container.scrollIntoView(alignToTop); range = callback(); if (!range || !range.startContainer || !container.contains(range.startContainer)) { return null; } } return range; } ;// ./node_modules/@wordpress/dom/build-module/dom/is-edge.js function isEdge(container, isReverse, onlyVertical = false) { if (isInputOrTextArea(container) && typeof container.selectionStart === "number") { if (container.selectionStart !== container.selectionEnd) { return false; } if (isReverse) { return container.selectionStart === 0; } return container.value.length === container.selectionStart; } if (!container.isContentEditable) { return true; } const { ownerDocument } = container; const { defaultView } = ownerDocument; assertIsDefined(defaultView, "defaultView"); const selection = defaultView.getSelection(); if (!selection || !selection.rangeCount) { return false; } const range = selection.getRangeAt(0); const collapsedRange = range.cloneRange(); const isForward = isSelectionForward(selection); const isCollapsed = selection.isCollapsed; if (!isCollapsed) { collapsedRange.collapse(!isForward); } const collapsedRangeRect = getRectangleFromRange(collapsedRange); const rangeRect = getRectangleFromRange(range); if (!collapsedRangeRect || !rangeRect) { return false; } const rangeHeight = getRangeHeight(range); if (!isCollapsed && rangeHeight && rangeHeight > collapsedRangeRect.height && isForward === isReverse) { return false; } const isReverseDir = isRTL(container) ? !isReverse : isReverse; const containerRect = container.getBoundingClientRect(); const x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1; const y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1; const testRange = scrollIfNoRange( container, isReverse, () => hiddenCaretRangeFromPoint(ownerDocument, x, y, container) ); if (!testRange) { return false; } const testRect = getRectangleFromRange(testRange); if (!testRect) { return false; } const verticalSide = isReverse ? "top" : "bottom"; const horizontalSide = isReverseDir ? "left" : "right"; const verticalDiff = testRect[verticalSide] - rangeRect[verticalSide]; const horizontalDiff = testRect[horizontalSide] - collapsedRangeRect[horizontalSide]; const hasVerticalDiff = Math.abs(verticalDiff) <= 1; const hasHorizontalDiff = Math.abs(horizontalDiff) <= 1; return onlyVertical ? hasVerticalDiff : hasVerticalDiff && hasHorizontalDiff; } ;// ./node_modules/@wordpress/dom/build-module/dom/is-horizontal-edge.js function isHorizontalEdge(container, isReverse) { return isEdge(container, isReverse); } ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); ;// ./node_modules/@wordpress/dom/build-module/dom/is-number-input.js function isNumberInput(node) { external_wp_deprecated_default()("wp.dom.isNumberInput", { since: "6.1", version: "6.5" }); return isHTMLInputElement(node) && node.type === "number" && !isNaN(node.valueAsNumber); } ;// ./node_modules/@wordpress/dom/build-module/dom/is-vertical-edge.js function isVerticalEdge(container, isReverse) { return isEdge(container, isReverse, true); } ;// ./node_modules/@wordpress/dom/build-module/dom/place-caret-at-edge.js function getRange(container, isReverse, x) { const { ownerDocument } = container; const isReverseDir = isRTL(container) ? !isReverse : isReverse; const containerRect = container.getBoundingClientRect(); if (x === void 0) { x = isReverse ? containerRect.right - 1 : containerRect.left + 1; } else if (x <= containerRect.left) { x = containerRect.left + 1; } else if (x >= containerRect.right) { x = containerRect.right - 1; } const y = isReverseDir ? containerRect.bottom - 1 : containerRect.top + 1; return hiddenCaretRangeFromPoint(ownerDocument, x, y, container); } function placeCaretAtEdge(container, isReverse, x) { if (!container) { return; } container.focus(); if (isInputOrTextArea(container)) { if (typeof container.selectionStart !== "number") { return; } if (isReverse) { container.selectionStart = container.value.length; container.selectionEnd = container.value.length; } else { container.selectionStart = 0; container.selectionEnd = 0; } return; } if (!container.isContentEditable) { return; } const range = scrollIfNoRange( container, isReverse, () => getRange(container, isReverse, x) ); if (!range) { return; } const { ownerDocument } = container; const { defaultView } = ownerDocument; assertIsDefined(defaultView, "defaultView"); const selection = defaultView.getSelection(); assertIsDefined(selection, "selection"); selection.removeAllRanges(); selection.addRange(range); } ;// ./node_modules/@wordpress/dom/build-module/dom/place-caret-at-horizontal-edge.js function placeCaretAtHorizontalEdge(container, isReverse) { return placeCaretAtEdge(container, isReverse, void 0); } ;// ./node_modules/@wordpress/dom/build-module/dom/place-caret-at-vertical-edge.js function placeCaretAtVerticalEdge(container, isReverse, rect) { return placeCaretAtEdge(container, isReverse, rect?.left); } ;// ./node_modules/@wordpress/dom/build-module/dom/insert-after.js function insertAfter(newNode, referenceNode) { assertIsDefined(referenceNode.parentNode, "referenceNode.parentNode"); referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); } ;// ./node_modules/@wordpress/dom/build-module/dom/remove.js function remove(node) { assertIsDefined(node.parentNode, "node.parentNode"); node.parentNode.removeChild(node); } ;// ./node_modules/@wordpress/dom/build-module/dom/replace.js function replace(processedNode, newNode) { assertIsDefined(processedNode.parentNode, "processedNode.parentNode"); insertAfter(newNode, processedNode.parentNode); remove(processedNode); } ;// ./node_modules/@wordpress/dom/build-module/dom/unwrap.js function unwrap(node) { const parent = node.parentNode; assertIsDefined(parent, "node.parentNode"); while (node.firstChild) { parent.insertBefore(node.firstChild, node); } parent.removeChild(node); } ;// ./node_modules/@wordpress/dom/build-module/dom/replace-tag.js function replaceTag(node, tagName) { const newNode = node.ownerDocument.createElement(tagName); while (node.firstChild) { newNode.appendChild(node.firstChild); } assertIsDefined(node.parentNode, "node.parentNode"); node.parentNode.replaceChild(newNode, node); return newNode; } ;// ./node_modules/@wordpress/dom/build-module/dom/wrap.js function wrap(newNode, referenceNode) { assertIsDefined(referenceNode.parentNode, "referenceNode.parentNode"); referenceNode.parentNode.insertBefore(newNode, referenceNode); newNode.appendChild(referenceNode); } ;// ./node_modules/@wordpress/dom/build-module/dom/safe-html.js function safeHTML(html) { const { body } = document.implementation.createHTMLDocument(""); body.innerHTML = html; const elements = body.getElementsByTagName("*"); let elementIndex = elements.length; while (elementIndex--) { const element = elements[elementIndex]; if (element.tagName === "SCRIPT") { remove(element); } else { let attributeIndex = element.attributes.length; while (attributeIndex--) { const { name: key } = element.attributes[attributeIndex]; if (key.startsWith("on")) { element.removeAttribute(key); } } } } return body.innerHTML; } ;// ./node_modules/@wordpress/dom/build-module/dom/strip-html.js function stripHTML(html) { html = safeHTML(html); const doc = document.implementation.createHTMLDocument(""); doc.body.innerHTML = html; return doc.body.textContent || ""; } ;// ./node_modules/@wordpress/dom/build-module/dom/is-empty.js function isEmpty(element) { switch (element.nodeType) { case element.TEXT_NODE: return /^[ \f\n\r\t\v\u00a0]*$/.test(element.nodeValue || ""); case element.ELEMENT_NODE: if (element.hasAttributes()) { return false; } else if (!element.hasChildNodes()) { return true; } return ( /** @type {Element[]} */ Array.from(element.childNodes).every(isEmpty) ); default: return true; } } ;// ./node_modules/@wordpress/dom/build-module/phrasing-content.js const textContentSchema = { strong: {}, em: {}, s: {}, del: {}, ins: {}, a: { attributes: ["href", "target", "rel", "id"] }, code: {}, abbr: { attributes: ["title"] }, sub: {}, sup: {}, br: {}, small: {}, // To do: fix blockquote. // cite: {}, q: { attributes: ["cite"] }, dfn: { attributes: ["title"] }, data: { attributes: ["value"] }, time: { attributes: ["datetime"] }, var: {}, samp: {}, kbd: {}, i: {}, b: {}, u: {}, mark: {}, ruby: {}, rt: {}, rp: {}, bdi: { attributes: ["dir"] }, bdo: { attributes: ["dir"] }, wbr: {}, "#text": {} }; const excludedElements = ["#text", "br"]; Object.keys(textContentSchema).filter((element) => !excludedElements.includes(element)).forEach((tag) => { const { [tag]: removedTag, ...restSchema } = textContentSchema; textContentSchema[tag].children = restSchema; }); const embeddedContentSchema = { audio: { attributes: [ "src", "preload", "autoplay", "mediagroup", "loop", "muted" ] }, canvas: { attributes: ["width", "height"] }, embed: { attributes: ["src", "type", "width", "height"] }, img: { attributes: [ "alt", "src", "srcset", "usemap", "ismap", "width", "height" ] }, object: { attributes: [ "data", "type", "name", "usemap", "form", "width", "height" ] }, video: { attributes: [ "src", "poster", "preload", "playsinline", "autoplay", "mediagroup", "loop", "muted", "controls", "width", "height" ] }, math: { attributes: ["display", "xmlns"], children: "*" } }; const phrasingContentSchema = { ...textContentSchema, ...embeddedContentSchema }; function getPhrasingContentSchema(context) { if (context !== "paste") { return phrasingContentSchema; } const { u, // Used to mark misspelling. Shouldn't be pasted. abbr, // Invisible. data, // Invisible. time, // Invisible. wbr, // Invisible. bdi, // Invisible. bdo, // Invisible. ...remainingContentSchema } = { ...phrasingContentSchema, // We shouldn't paste potentially sensitive information which is not // visible to the user when pasted, so strip the attributes. ins: { children: phrasingContentSchema.ins.children }, del: { children: phrasingContentSchema.del.children } }; return remainingContentSchema; } function isPhrasingContent(node) { const tag = node.nodeName.toLowerCase(); return getPhrasingContentSchema().hasOwnProperty(tag) || tag === "span"; } function isTextContent(node) { const tag = node.nodeName.toLowerCase(); return textContentSchema.hasOwnProperty(tag) || tag === "span"; } ;// ./node_modules/@wordpress/dom/build-module/dom/is-element.js function isElement(node) { return !!node && node.nodeType === node.ELEMENT_NODE; } ;// ./node_modules/@wordpress/dom/build-module/dom/clean-node-list.js const noop = () => { }; function cleanNodeList(nodeList, doc, schema, inline) { Array.from(nodeList).forEach( (node) => { const tag = node.nodeName.toLowerCase(); if (schema.hasOwnProperty(tag) && (!schema[tag].isMatch || schema[tag].isMatch?.(node))) { if (isElement(node)) { const { attributes = [], classes = [], children, require: require2 = [], allowEmpty } = schema[tag]; if (children && !allowEmpty && isEmpty(node)) { remove(node); return; } if (node.hasAttributes()) { Array.from(node.attributes).forEach(({ name }) => { if (name !== "class" && !attributes.includes(name)) { node.removeAttribute(name); } }); if (node.classList && node.classList.length) { const mattchers = classes.map((item) => { if (item === "*") { return () => true; } else if (typeof item === "string") { return (className) => className === item; } else if (item instanceof RegExp) { return (className) => item.test(className); } return noop; }); Array.from(node.classList).forEach((name) => { if (!mattchers.some( (isMatch) => isMatch(name) )) { node.classList.remove(name); } }); if (!node.classList.length) { node.removeAttribute("class"); } } } if (node.hasChildNodes()) { if (children === "*") { return; } if (children) { if (require2.length && !node.querySelector(require2.join(","))) { cleanNodeList( node.childNodes, doc, schema, inline ); unwrap(node); } else if (node.parentNode && node.parentNode.nodeName === "BODY" && isPhrasingContent(node)) { cleanNodeList( node.childNodes, doc, schema, inline ); if (Array.from(node.childNodes).some( (child) => !isPhrasingContent(child) )) { unwrap(node); } } else { cleanNodeList( node.childNodes, doc, children, inline ); } } else { while (node.firstChild) { remove(node.firstChild); } } } } } else { cleanNodeList(node.childNodes, doc, schema, inline); if (inline && !isPhrasingContent(node) && node.nextElementSibling) { insertAfter(doc.createElement("br"), node); } unwrap(node); } } ); } ;// ./node_modules/@wordpress/dom/build-module/dom/remove-invalid-html.js function removeInvalidHTML(HTML, schema, inline) { const doc = document.implementation.createHTMLDocument(""); doc.body.innerHTML = HTML; cleanNodeList(doc.body.childNodes, doc, schema, inline); return doc.body.innerHTML; } ;// ./node_modules/@wordpress/dom/build-module/dom/index.js ;// ./node_modules/@wordpress/dom/build-module/data-transfer.js function getFilesFromDataTransfer(dataTransfer) { const files = Array.from(dataTransfer.files); Array.from(dataTransfer.items).forEach((item) => { const file = item.getAsFile(); if (file && !files.find( ({ name, type, size }) => name === file.name && type === file.type && size === file.size )) { files.push(file); } }); return files; } ;// ./node_modules/@wordpress/dom/build-module/index.js const build_module_focus = { focusable: focusable_namespaceObject, tabbable: tabbable_namespaceObject }; (window.wp = window.wp || {}).dom = __webpack_exports__; /******/ })() ; commands.js 0000644 00000527324 15151622574 0006730 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({}); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/create fake namespace object */ /******/ (() => { /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__); /******/ var leafPrototypes; /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 16: return value when it's Promise-like /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = this(value); /******/ if(mode & 8) return value; /******/ if(typeof value === 'object' && value) { /******/ if((mode & 4) && value.__esModule) return value; /******/ if((mode & 16) && typeof value.then === 'function') return value; /******/ } /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ var def = {}; /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); /******/ } /******/ def['default'] = () => (value); /******/ __webpack_require__.d(ns, def); /******/ return ns; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/nonce */ /******/ (() => { /******/ __webpack_require__.nc = undefined; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { CommandMenu: () => (/* reexport */ CommandMenu), privateApis: () => (/* reexport */ privateApis), store: () => (/* reexport */ store), useCommand: () => (/* reexport */ useCommand), useCommandLoader: () => (/* reexport */ useCommandLoader), useCommands: () => (/* reexport */ useCommands) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/commands/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { close: () => (actions_close), open: () => (actions_open), registerCommand: () => (registerCommand), registerCommandLoader: () => (registerCommandLoader), unregisterCommand: () => (unregisterCommand), unregisterCommandLoader: () => (unregisterCommandLoader) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/commands/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { getCommandLoaders: () => (getCommandLoaders), getCommands: () => (getCommands), getContext: () => (getContext), isOpen: () => (selectors_isOpen) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/commands/build-module/store/private-actions.js var private_actions_namespaceObject = {}; __webpack_require__.r(private_actions_namespaceObject); __webpack_require__.d(private_actions_namespaceObject, { setContext: () => (setContext) }); ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/cmdk/dist/chunk-NZJY6EH4.mjs var U=1,Y=.9,H=.8,J=.17,p=.1,u=.999,$=.9999;var k=.99,m=/[\\\/_+.#"@\[\(\{&]/,B=/[\\\/_+.#"@\[\(\{&]/g,K=/[\s-]/,X=/[\s-]/g;function G(_,C,h,P,A,f,O){if(f===C.length)return A===_.length?U:k;var T=`${A},${f}`;if(O[T]!==void 0)return O[T];for(var L=P.charAt(f),c=h.indexOf(L,A),S=0,E,N,R,M;c>=0;)E=G(_,C,h,P,c+1,f+1,O),E>S&&(c===A?E*=U:m.test(_.charAt(c-1))?(E*=H,R=_.slice(A,c-1).match(B),R&&A>0&&(E*=Math.pow(u,R.length))):K.test(_.charAt(c-1))?(E*=Y,M=_.slice(A,c-1).match(X),M&&A>0&&(E*=Math.pow(u,M.length))):(E*=J,A>0&&(E*=Math.pow(u,c-A))),_.charAt(c)!==C.charAt(f)&&(E*=$)),(E<p&&h.charAt(c-1)===P.charAt(f+1)||P.charAt(f+1)===P.charAt(f)&&h.charAt(c-1)!==P.charAt(f))&&(N=G(_,C,h,P,c+1,f+2,O),N*p>E&&(E=N*p)),E>S&&(S=E),c=h.indexOf(L,c+1);return O[T]=S,S}function D(_){return _.toLowerCase().replace(X," ")}function W(_,C,h){return _=h&&h.length>0?`${_+" "+h.join(" ")}`:_,G(_,C,D(_),D(C),0,0,{})} ;// ./node_modules/@babel/runtime/helpers/esm/extends.js function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } ;// external "React" const external_React_namespaceObject = window["React"]; var external_React_namespaceObject_0 = /*#__PURE__*/__webpack_require__.t(external_React_namespaceObject, 2); ;// ./node_modules/@radix-ui/primitive/dist/index.mjs function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented: checkForDefaultPrevented = true } = {}) { return function handleEvent(event) { originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event); if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event); }; } ;// ./node_modules/@radix-ui/react-compose-refs/dist/index.mjs /** * Set a given ref to a given value * This utility takes care of different types of refs: callback refs and RefObject(s) */ function $6ed0406888f73fc4$var$setRef(ref, value) { if (typeof ref === 'function') ref(value); else if (ref !== null && ref !== undefined) ref.current = value; } /** * A utility to compose multiple refs together * Accepts callback refs and RefObject(s) */ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) { return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node) ) ; } /** * A custom hook that composes multiple refs * Accepts callback refs and RefObject(s) */ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) { // eslint-disable-next-line react-hooks/exhaustive-deps return (0,external_React_namespaceObject.useCallback)($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs); } ;// ./node_modules/@radix-ui/react-context/dist/index.mjs function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) { const Context = /*#__PURE__*/ (0,external_React_namespaceObject.createContext)(defaultContext); function Provider(props) { const { children: children , ...context } = props; // Only re-memoize when prop values change // eslint-disable-next-line react-hooks/exhaustive-deps const value = (0,external_React_namespaceObject.useMemo)(()=>context , Object.values(context)); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(Context.Provider, { value: value }, children); } function useContext(consumerName) { const context = (0,external_React_namespaceObject.useContext)(Context); if (context) return context; if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context. throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``); } Provider.displayName = rootComponentName + 'Provider'; return [ Provider, useContext ]; } /* ------------------------------------------------------------------------------------------------- * createContextScope * -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) { let defaultContexts = []; /* ----------------------------------------------------------------------------------------------- * createContext * ---------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) { const BaseContext = /*#__PURE__*/ (0,external_React_namespaceObject.createContext)(defaultContext); const index = defaultContexts.length; defaultContexts = [ ...defaultContexts, defaultContext ]; function Provider(props) { const { scope: scope , children: children , ...context } = props; const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext; // Only re-memoize when prop values change // eslint-disable-next-line react-hooks/exhaustive-deps const value = (0,external_React_namespaceObject.useMemo)(()=>context , Object.values(context)); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(Context.Provider, { value: value }, children); } function useContext(consumerName, scope) { const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext; const context = (0,external_React_namespaceObject.useContext)(Context); if (context) return context; if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context. throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``); } Provider.displayName = rootComponentName + 'Provider'; return [ Provider, useContext ]; } /* ----------------------------------------------------------------------------------------------- * createScope * ---------------------------------------------------------------------------------------------*/ const createScope = ()=>{ const scopeContexts = defaultContexts.map((defaultContext)=>{ return /*#__PURE__*/ (0,external_React_namespaceObject.createContext)(defaultContext); }); return function useScope(scope) { const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts; return (0,external_React_namespaceObject.useMemo)(()=>({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }) , [ scope, contexts ]); }; }; createScope.scopeName = scopeName; return [ $c512c27ab02ef895$export$fd42f52fd3ae1109, $c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps) ]; } /* ------------------------------------------------------------------------------------------------- * composeContextScopes * -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$var$composeContextScopes(...scopes) { const baseScope = scopes[0]; if (scopes.length === 1) return baseScope; const createScope1 = ()=>{ const scopeHooks = scopes.map((createScope)=>({ useScope: createScope(), scopeName: createScope.scopeName }) ); return function useComposedScopes(overrideScopes) { const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope: useScope , scopeName: scopeName })=>{ // We are calling a hook inside a callback which React warns against to avoid inconsistent // renders, however, scoping doesn't have render side effects so we ignore the rule. // eslint-disable-next-line react-hooks/rules-of-hooks const scopeProps = useScope(overrideScopes); const currentScope = scopeProps[`__scope${scopeName}`]; return { ...nextScopes, ...currentScope }; }, {}); return (0,external_React_namespaceObject.useMemo)(()=>({ [`__scope${baseScope.scopeName}`]: nextScopes1 }) , [ nextScopes1 ]); }; }; createScope1.scopeName = baseScope.scopeName; return createScope1; } ;// ./node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs /** * On the server, React emits a warning when calling `useLayoutEffect`. * This is because neither `useLayoutEffect` nor `useEffect` run on the server. * We use this safe version which suppresses the warning by replacing it with a noop on the server. * * See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect */ const $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? external_React_namespaceObject.useLayoutEffect : ()=>{}; ;// ./node_modules/@radix-ui/react-id/dist/index.mjs const $1746a345f3d73bb7$var$useReactId = external_React_namespaceObject_0['useId'.toString()] || (()=>undefined ); let $1746a345f3d73bb7$var$count = 0; function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) { const [id, setId] = external_React_namespaceObject.useState($1746a345f3d73bb7$var$useReactId()); // React versions older than 18 will have client-side ids only. $9f79659886946c16$export$e5c5a5f917a5871c(()=>{ if (!deterministicId) setId((reactId)=>reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++) ); }, [ deterministicId ]); return deterministicId || (id ? `radix-${id}` : ''); } ;// ./node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs /** * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a * prop or avoid re-executing effects when passed as a dependency */ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) { const callbackRef = (0,external_React_namespaceObject.useRef)(callback); (0,external_React_namespaceObject.useEffect)(()=>{ callbackRef.current = callback; }); // https://github.com/facebook/react/issues/19240 return (0,external_React_namespaceObject.useMemo)(()=>(...args)=>{ var _callbackRef$current; return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args); } , []); } ;// ./node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: prop , defaultProp: defaultProp , onChange: onChange = ()=>{} }) { const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp: defaultProp, onChange: onChange }); const isControlled = prop !== undefined; const value1 = isControlled ? prop : uncontrolledProp; const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange); const setValue = (0,external_React_namespaceObject.useCallback)((nextValue)=>{ if (isControlled) { const setter = nextValue; const value = typeof nextValue === 'function' ? setter(prop) : nextValue; if (value !== prop) handleChange(value); } else setUncontrolledProp(nextValue); }, [ isControlled, prop, setUncontrolledProp, handleChange ]); return [ value1, setValue ]; } function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp: defaultProp , onChange: onChange }) { const uncontrolledState = (0,external_React_namespaceObject.useState)(defaultProp); const [value] = uncontrolledState; const prevValueRef = (0,external_React_namespaceObject.useRef)(value); const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange); (0,external_React_namespaceObject.useEffect)(()=>{ if (prevValueRef.current !== value) { handleChange(value); prevValueRef.current = value; } }, [ value, prevValueRef, handleChange ]); return uncontrolledState; } ;// external "ReactDOM" const external_ReactDOM_namespaceObject = window["ReactDOM"]; ;// ./node_modules/@radix-ui/react-slot/dist/index.mjs /* ------------------------------------------------------------------------------------------------- * Slot * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const { children: children , ...slotProps } = props; const childrenArray = external_React_namespaceObject.Children.toArray(children); const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable); if (slottable) { // the new element to render is the one passed as a child of `Slottable` const newElement = slottable.props.children; const newChildren = childrenArray.map((child)=>{ if (child === slottable) { // because the new element will be the one rendered, we are only interested // in grabbing its children (`newElement.props.children`) if (external_React_namespaceObject.Children.count(newElement) > 1) return external_React_namespaceObject.Children.only(null); return /*#__PURE__*/ (0,external_React_namespaceObject.isValidElement)(newElement) ? newElement.props.children : null; } else return child; }); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, { ref: forwardedRef }), /*#__PURE__*/ (0,external_React_namespaceObject.isValidElement)(newElement) ? /*#__PURE__*/ (0,external_React_namespaceObject.cloneElement)(newElement, undefined, newChildren) : null); } return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, { ref: forwardedRef }), children); }); $5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = 'Slot'; /* ------------------------------------------------------------------------------------------------- * SlotClone * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$var$SlotClone = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const { children: children , ...slotProps } = props; if (/*#__PURE__*/ (0,external_React_namespaceObject.isValidElement)(children)) return /*#__PURE__*/ (0,external_React_namespaceObject.cloneElement)(children, { ...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props), ref: forwardedRef ? $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref) : children.ref }); return external_React_namespaceObject.Children.count(children) > 1 ? external_React_namespaceObject.Children.only(null) : null; }); $5e63c961fc1ce211$var$SlotClone.displayName = 'SlotClone'; /* ------------------------------------------------------------------------------------------------- * Slottable * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children: children })=>{ return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, children); }; /* ---------------------------------------------------------------------------------------------- */ function $5e63c961fc1ce211$var$isSlottable(child) { return /*#__PURE__*/ (0,external_React_namespaceObject.isValidElement)(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45; } function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) { // all child props should override const overrideProps = { ...childProps }; for(const propName in childProps){ const slotPropValue = slotProps[propName]; const childPropValue = childProps[propName]; const isHandler = /^on[A-Z]/.test(propName); if (isHandler) { // if the handler exists on both, we compose them if (slotPropValue && childPropValue) overrideProps[propName] = (...args)=>{ childPropValue(...args); slotPropValue(...args); }; else if (slotPropValue) overrideProps[propName] = slotPropValue; } else if (propName === 'style') overrideProps[propName] = { ...slotPropValue, ...childPropValue }; else if (propName === 'className') overrideProps[propName] = [ slotPropValue, childPropValue ].filter(Boolean).join(' '); } return { ...slotProps, ...overrideProps }; } const $5e63c961fc1ce211$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($5e63c961fc1ce211$export$8c6ed5c666ac1360)); ;// ./node_modules/@radix-ui/react-primitive/dist/index.mjs const $8927f6f2acc4f386$var$NODES = [ 'a', 'button', 'div', 'form', 'h2', 'h3', 'img', 'input', 'label', 'li', 'nav', 'ol', 'p', 'span', 'svg', 'ul' ]; // Temporary while we await merge of this fix: // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396 // prettier-ignore /* ------------------------------------------------------------------------------------------------- * Primitive * -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{ const Node = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const { asChild: asChild , ...primitiveProps } = props; const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node; (0,external_React_namespaceObject.useEffect)(()=>{ window[Symbol.for('radix-ui')] = true; }, []); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(Comp, _extends({}, primitiveProps, { ref: forwardedRef })); }); Node.displayName = `Primitive.${node}`; return { ...primitive, [node]: Node }; }, {}); /* ------------------------------------------------------------------------------------------------- * Utils * -----------------------------------------------------------------------------------------------*/ /** * Flush custom event dispatch * https://github.com/radix-ui/primitives/pull/1378 * * React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types. * * Internally, React prioritises events in the following order: * - discrete * - continuous * - default * * https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350 * * `discrete` is an important distinction as updates within these events are applied immediately. * React however, is not able to infer the priority of custom event types due to how they are detected internally. * Because of this, it's possible for updates from custom events to be unexpectedly batched when * dispatched by another `discrete` event. * * In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch. * This utility should be used when dispatching a custom event from within another `discrete` event, this utility * is not nessesary when dispatching known event types, or if dispatching a custom type inside a non-discrete event. * For example: * * dispatching a known click 👎 * target.dispatchEvent(new Event(‘click’)) * * dispatching a custom type within a non-discrete event 👎 * onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))} * * dispatching a custom type within a `discrete` event 👍 * onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))} * * Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use * this utility with them. This is because it's possible for those handlers to be called implicitly during render * e.g. when focus is within a component as it is unmounted, or when managing focus on mount. */ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) { if (target) (0,external_ReactDOM_namespaceObject.flushSync)(()=>target.dispatchEvent(event) ); } /* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($8927f6f2acc4f386$export$250ffa63cdc0d034)); ;// ./node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs /** * Listens for when the escape key is down */ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) { const onEscapeKeyDown = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEscapeKeyDownProp); (0,external_React_namespaceObject.useEffect)(()=>{ const handleKeyDown = (event)=>{ if (event.key === 'Escape') onEscapeKeyDown(event); }; ownerDocument.addEventListener('keydown', handleKeyDown); return ()=>ownerDocument.removeEventListener('keydown', handleKeyDown) ; }, [ onEscapeKeyDown, ownerDocument ]); } ;// ./node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs /* ------------------------------------------------------------------------------------------------- * DismissableLayer * -----------------------------------------------------------------------------------------------*/ const $5cb92bef7577960e$var$DISMISSABLE_LAYER_NAME = 'DismissableLayer'; const $5cb92bef7577960e$var$CONTEXT_UPDATE = 'dismissableLayer.update'; const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside'; const $5cb92bef7577960e$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside'; let $5cb92bef7577960e$var$originalBodyPointerEvents; const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ (0,external_React_namespaceObject.createContext)({ layers: new Set(), layersWithOutsidePointerEventsDisabled: new Set(), branches: new Set() }); const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ var _node$ownerDocument; const { disableOutsidePointerEvents: disableOutsidePointerEvents = false , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , ...layerProps } = props; const context = (0,external_React_namespaceObject.useContext)($5cb92bef7577960e$var$DismissableLayerContext); const [node1, setNode] = (0,external_React_namespaceObject.useState)(null); const ownerDocument = (_node$ownerDocument = node1 === null || node1 === void 0 ? void 0 : node1.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document; const [, force] = (0,external_React_namespaceObject.useState)({}); const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setNode(node) ); const layers = Array.from(context.layers); const [highestLayerWithOutsidePointerEventsDisabled] = [ ...context.layersWithOutsidePointerEventsDisabled ].slice(-1); // prettier-ignore const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore const index = node1 ? layers.indexOf(node1) : -1; const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0; const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex; const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event)=>{ const target = event.target; const isPointerDownOnBranch = [ ...context.branches ].some((branch)=>branch.contains(target) ); if (!isPointerEventsEnabled || isPointerDownOnBranch) return; onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event); onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event); if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss(); }, ownerDocument); const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event)=>{ const target = event.target; const isFocusInBranch = [ ...context.branches ].some((branch)=>branch.contains(target) ); if (isFocusInBranch) return; onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event); onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event); if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss(); }, ownerDocument); $addc16e1bbe58fd0$export$3a72a57244d6e765((event)=>{ const isHighestLayer = index === context.layers.size - 1; if (!isHighestLayer) return; onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event); if (!event.defaultPrevented && onDismiss) { event.preventDefault(); onDismiss(); } }, ownerDocument); (0,external_React_namespaceObject.useEffect)(()=>{ if (!node1) return; if (disableOutsidePointerEvents) { if (context.layersWithOutsidePointerEventsDisabled.size === 0) { $5cb92bef7577960e$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents; ownerDocument.body.style.pointerEvents = 'none'; } context.layersWithOutsidePointerEventsDisabled.add(node1); } context.layers.add(node1); $5cb92bef7577960e$var$dispatchUpdate(); return ()=>{ if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents; }; }, [ node1, ownerDocument, disableOutsidePointerEvents, context ]); /** * We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect * because a change to `disableOutsidePointerEvents` would remove this layer from the stack * and add it to the end again so the layering order wouldn't be _creation order_. * We only want them to be removed from context stacks when unmounted. */ (0,external_React_namespaceObject.useEffect)(()=>{ return ()=>{ if (!node1) return; context.layers.delete(node1); context.layersWithOutsidePointerEventsDisabled.delete(node1); $5cb92bef7577960e$var$dispatchUpdate(); }; }, [ node1, context ]); (0,external_React_namespaceObject.useEffect)(()=>{ const handleUpdate = ()=>force({}) ; document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate); return ()=>document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate) ; }, []); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, layerProps, { ref: composedRefs, style: { pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? 'auto' : 'none' : undefined, ...props.style }, onFocusCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture), onBlurCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture), onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture) })); }); /*#__PURE__*/ Object.assign($5cb92bef7577960e$export$177fb62ff3ec1f22, { displayName: $5cb92bef7577960e$var$DISMISSABLE_LAYER_NAME }); /* ------------------------------------------------------------------------------------------------- * DismissableLayerBranch * -----------------------------------------------------------------------------------------------*/ const $5cb92bef7577960e$var$BRANCH_NAME = 'DismissableLayerBranch'; const $5cb92bef7577960e$export$4d5eb2109db14228 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const context = (0,external_React_namespaceObject.useContext)($5cb92bef7577960e$var$DismissableLayerContext); const ref = (0,external_React_namespaceObject.useRef)(null); const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref); (0,external_React_namespaceObject.useEffect)(()=>{ const node = ref.current; if (node) { context.branches.add(node); return ()=>{ context.branches.delete(node); }; } }, [ context.branches ]); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, props, { ref: composedRefs })); }); /*#__PURE__*/ Object.assign($5cb92bef7577960e$export$4d5eb2109db14228, { displayName: $5cb92bef7577960e$var$BRANCH_NAME }); /* -----------------------------------------------------------------------------------------------*/ /** * Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup` * to mimic layer dismissing behaviour present in OS. * Returns props to pass to the node we want to check for outside events. */ function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) { const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside); const isPointerInsideReactTreeRef = (0,external_React_namespaceObject.useRef)(false); const handleClickRef = (0,external_React_namespaceObject.useRef)(()=>{}); (0,external_React_namespaceObject.useEffect)(()=>{ const handlePointerDown = (event)=>{ if (event.target && !isPointerInsideReactTreeRef.current) { const eventDetail = { originalEvent: event }; function handleAndDispatchPointerDownOutsideEvent() { $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, { discrete: true }); } /** * On touch devices, we need to wait for a click event because browsers implement * a ~350ms delay between the time the user stops touching the display and when the * browser executres events. We need to ensure we don't reactivate pointer-events within * this timeframe otherwise the browser may execute events that should have been prevented. * * Additionally, this also lets us deal automatically with cancellations when a click event * isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc. * * This is why we also continuously remove the previous listener, because we cannot be * certain that it was raised, and therefore cleaned-up. */ if (event.pointerType === 'touch') { ownerDocument.removeEventListener('click', handleClickRef.current); handleClickRef.current = handleAndDispatchPointerDownOutsideEvent; ownerDocument.addEventListener('click', handleClickRef.current, { once: true }); } else handleAndDispatchPointerDownOutsideEvent(); } else // We need to remove the event listener in case the outside click has been canceled. // See: https://github.com/radix-ui/primitives/issues/2171 ownerDocument.removeEventListener('click', handleClickRef.current); isPointerInsideReactTreeRef.current = false; }; /** * if this hook executes in a component that mounts via a `pointerdown` event, the event * would bubble up to the document and trigger a `pointerDownOutside` event. We avoid * this by delaying the event listener registration on the document. * This is not React specific, but rather how the DOM works, ie: * ``` * button.addEventListener('pointerdown', () => { * console.log('I will log'); * document.addEventListener('pointerdown', () => { * console.log('I will also log'); * }) * }); */ const timerId = window.setTimeout(()=>{ ownerDocument.addEventListener('pointerdown', handlePointerDown); }, 0); return ()=>{ window.clearTimeout(timerId); ownerDocument.removeEventListener('pointerdown', handlePointerDown); ownerDocument.removeEventListener('click', handleClickRef.current); }; }, [ ownerDocument, handlePointerDownOutside ]); return { // ensures we check React component tree (not just DOM tree) onPointerDownCapture: ()=>isPointerInsideReactTreeRef.current = true }; } /** * Listens for when focus happens outside a react subtree. * Returns props to pass to the root (node) of the subtree we want to check. */ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) { const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside); const isFocusInsideReactTreeRef = (0,external_React_namespaceObject.useRef)(false); (0,external_React_namespaceObject.useEffect)(()=>{ const handleFocus = (event)=>{ if (event.target && !isFocusInsideReactTreeRef.current) { const eventDetail = { originalEvent: event }; $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, { discrete: false }); } }; ownerDocument.addEventListener('focusin', handleFocus); return ()=>ownerDocument.removeEventListener('focusin', handleFocus) ; }, [ ownerDocument, handleFocusOutside ]); return { onFocusCapture: ()=>isFocusInsideReactTreeRef.current = true , onBlurCapture: ()=>isFocusInsideReactTreeRef.current = false }; } function $5cb92bef7577960e$var$dispatchUpdate() { const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE); document.dispatchEvent(event); } function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detail, { discrete: discrete }) { const target = detail.originalEvent.target; const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail: detail }); if (handler) target.addEventListener(name, handler, { once: true }); if (discrete) $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event); else target.dispatchEvent(event); } const $5cb92bef7577960e$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($5cb92bef7577960e$export$177fb62ff3ec1f22)); const $5cb92bef7577960e$export$aecb2ddcb55c95be = (/* unused pure expression or super */ null && ($5cb92bef7577960e$export$4d5eb2109db14228)); ;// ./node_modules/@radix-ui/react-focus-scope/dist/index.mjs const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount'; const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount'; const $d3863c46a17e8a28$var$EVENT_OPTIONS = { bubbles: false, cancelable: true }; /* ------------------------------------------------------------------------------------------------- * FocusScope * -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$FOCUS_SCOPE_NAME = 'FocusScope'; const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props; const [container1, setContainer] = (0,external_React_namespaceObject.useState)(null); const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp); const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp); const lastFocusedElementRef = (0,external_React_namespaceObject.useRef)(null); const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContainer(node) ); const focusScope = (0,external_React_namespaceObject.useRef)({ paused: false, pause () { this.paused = true; }, resume () { this.paused = false; } }).current; // Takes care of trapping focus if focus is moved outside programmatically for example (0,external_React_namespaceObject.useEffect)(()=>{ if (trapped) { function handleFocusIn(event) { if (focusScope.paused || !container1) return; const target = event.target; if (container1.contains(target)) lastFocusedElementRef.current = target; else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, { select: true }); } function handleFocusOut(event) { if (focusScope.paused || !container1) return; const relatedTarget = event.relatedTarget; // A `focusout` event with a `null` `relatedTarget` will happen in at least two cases: // // 1. When the user switches app/tabs/windows/the browser itself loses focus. // 2. In Google Chrome, when the focused element is removed from the DOM. // // We let the browser do its thing here because: // // 1. The browser already keeps a memory of what's focused for when the page gets refocused. // 2. In Google Chrome, if we try to focus the deleted focused element (as per below), it // throws the CPU to 100%, so we avoid doing anything for this reason here too. if (relatedTarget === null) return; // If the focus has moved to an actual legitimate element (`relatedTarget !== null`) // that is outside the container, we move focus to the last valid focused element inside. if (!container1.contains(relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, { select: true }); } // When the focused element gets removed from the DOM, browsers move focus // back to the document.body. In this case, we move focus to the container // to keep focus trapped correctly. function handleMutations(mutations) { const focusedElement = document.activeElement; if (focusedElement !== document.body) return; for (const mutation of mutations)if (mutation.removedNodes.length > 0) $d3863c46a17e8a28$var$focus(container1); } document.addEventListener('focusin', handleFocusIn); document.addEventListener('focusout', handleFocusOut); const mutationObserver = new MutationObserver(handleMutations); if (container1) mutationObserver.observe(container1, { childList: true, subtree: true }); return ()=>{ document.removeEventListener('focusin', handleFocusIn); document.removeEventListener('focusout', handleFocusOut); mutationObserver.disconnect(); }; } }, [ trapped, container1, focusScope.paused ]); (0,external_React_namespaceObject.useEffect)(()=>{ if (container1) { $d3863c46a17e8a28$var$focusScopesStack.add(focusScope); const previouslyFocusedElement = document.activeElement; const hasFocusedCandidate = container1.contains(previouslyFocusedElement); if (!hasFocusedCandidate) { const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS); container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); container1.dispatchEvent(mountEvent); if (!mountEvent.defaultPrevented) { $d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), { select: true }); if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1); } } return ()=>{ container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount. // We need to delay the focus a little to get around it for now. // See: https://github.com/facebook/react/issues/17894 setTimeout(()=>{ const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS); container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus); container1.dispatchEvent(unmountEvent); if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, { select: true }); // we need to remove the listener after we `dispatchEvent` container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus); $d3863c46a17e8a28$var$focusScopesStack.remove(focusScope); }, 0); }; } }, [ container1, onMountAutoFocus, onUnmountAutoFocus, focusScope ]); // Takes care of looping focus (when tabbing whilst at the edges) const handleKeyDown = (0,external_React_namespaceObject.useCallback)((event)=>{ if (!loop && !trapped) return; if (focusScope.paused) return; const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey; const focusedElement = document.activeElement; if (isTabKey && focusedElement) { const container = event.currentTarget; const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container); const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges if (!hasTabbableElementsInside) { if (focusedElement === container) event.preventDefault(); } else { if (!event.shiftKey && focusedElement === last) { event.preventDefault(); if (loop) $d3863c46a17e8a28$var$focus(first, { select: true }); } else if (event.shiftKey && focusedElement === first) { event.preventDefault(); if (loop) $d3863c46a17e8a28$var$focus(last, { select: true }); } } } }, [ loop, trapped, focusScope.paused ]); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({ tabIndex: -1 }, scopeProps, { ref: composedRefs, onKeyDown: handleKeyDown })); }); /*#__PURE__*/ Object.assign($d3863c46a17e8a28$export$20e40289641fbbb6, { displayName: $d3863c46a17e8a28$var$FOCUS_SCOPE_NAME }); /* ------------------------------------------------------------------------------------------------- * Utils * -----------------------------------------------------------------------------------------------*/ /** * Attempts focusing the first element in a list of candidates. * Stops when focus has actually moved. */ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) { const previouslyFocusedElement = document.activeElement; for (const candidate of candidates){ $d3863c46a17e8a28$var$focus(candidate, { select: select }); if (document.activeElement !== previouslyFocusedElement) return; } } /** * Returns the first and last tabbable elements inside a container. */ function $d3863c46a17e8a28$var$getTabbableEdges(container) { const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container); const first = $d3863c46a17e8a28$var$findVisible(candidates, container); const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container); return [ first, last ]; } /** * Returns a list of potential tabbable candidates. * * NOTE: This is only a close approximation. For example it doesn't take into account cases like when * elements are not visible. This cannot be worked out easily by just reading a property, but rather * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately. * * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1 */ function $d3863c46a17e8a28$var$getTabbableCandidates(container) { const nodes = []; const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { acceptNode: (node)=>{ const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden'; if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the // runtime's understanding of tabbability, so this automatically accounts // for any kind of element that could be tabbed to. return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; } }); while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it // hinders accessibility to have tab order different from visual order. return nodes; } /** * Returns the first visible element in a list. * NOTE: Only checks visibility up to the `container`. */ function $d3863c46a17e8a28$var$findVisible(elements, container) { for (const element of elements){ // we stop checking if it's hidden at the `container` level (excluding) if (!$d3863c46a17e8a28$var$isHidden(element, { upTo: container })) return element; } } function $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) { if (getComputedStyle(node).visibility === 'hidden') return true; while(node){ // we stop at `upTo` (excluding it) if (upTo !== undefined && node === upTo) return false; if (getComputedStyle(node).display === 'none') return true; node = node.parentElement; } return false; } function $d3863c46a17e8a28$var$isSelectableInput(element) { return element instanceof HTMLInputElement && 'select' in element; } function $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) { // only focus if that element is focusable if (element && element.focus) { const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users element.focus({ preventScroll: true }); // only select if its not the same element, it supports selection and we need to select if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select(); } } /* ------------------------------------------------------------------------------------------------- * FocusScope stack * -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack(); function $d3863c46a17e8a28$var$createFocusScopesStack() { /** A stack of focus scopes, with the active one at the top */ let stack = []; return { add (focusScope) { // pause the currently active focus scope (at the top of the stack) const activeFocusScope = stack[0]; if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause(); // remove in case it already exists (because we'll re-add it at the top of the stack) stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope); stack.unshift(focusScope); }, remove (focusScope) { var _stack$; stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope); (_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume(); } }; } function $d3863c46a17e8a28$var$arrayRemove(array, item) { const updatedArray = [ ...array ]; const index = updatedArray.indexOf(item); if (index !== -1) updatedArray.splice(index, 1); return updatedArray; } function $d3863c46a17e8a28$var$removeLinks(items) { return items.filter((item)=>item.tagName !== 'A' ); } const $d3863c46a17e8a28$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($d3863c46a17e8a28$export$20e40289641fbbb6)); ;// ./node_modules/@radix-ui/react-portal/dist/index.mjs /* ------------------------------------------------------------------------------------------------- * Portal * -----------------------------------------------------------------------------------------------*/ const $f1701beae083dbae$var$PORTAL_NAME = 'Portal'; const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ var _globalThis$document; const { container: container = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body , ...portalProps } = props; return container ? /*#__PURE__*/ external_ReactDOM_namespaceObject.createPortal(/*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, portalProps, { ref: forwardedRef })), container) : null; }); /*#__PURE__*/ Object.assign($f1701beae083dbae$export$602eac185826482c, { displayName: $f1701beae083dbae$var$PORTAL_NAME }); /* -----------------------------------------------------------------------------------------------*/ const $f1701beae083dbae$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($f1701beae083dbae$export$602eac185826482c)); ;// ./node_modules/@radix-ui/react-presence/dist/index.mjs function $fe963b355347cc68$export$3e6543de14f8614f(initialState, machine) { return (0,external_React_namespaceObject.useReducer)((state, event)=>{ const nextState = machine[state][event]; return nextState !== null && nextState !== void 0 ? nextState : state; }, initialState); } const $921a889cee6df7e8$export$99c2b779aa4e8b8b = (props)=>{ const { present: present , children: children } = props; const presence = $921a889cee6df7e8$var$usePresence(present); const child = typeof children === 'function' ? children({ present: presence.isPresent }) : external_React_namespaceObject.Children.only(children); const ref = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(presence.ref, child.ref); const forceMount = typeof children === 'function'; return forceMount || presence.isPresent ? /*#__PURE__*/ (0,external_React_namespaceObject.cloneElement)(child, { ref: ref }) : null; }; $921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = 'Presence'; /* ------------------------------------------------------------------------------------------------- * usePresence * -----------------------------------------------------------------------------------------------*/ function $921a889cee6df7e8$var$usePresence(present) { const [node1, setNode] = (0,external_React_namespaceObject.useState)(); const stylesRef = (0,external_React_namespaceObject.useRef)({}); const prevPresentRef = (0,external_React_namespaceObject.useRef)(present); const prevAnimationNameRef = (0,external_React_namespaceObject.useRef)('none'); const initialState = present ? 'mounted' : 'unmounted'; const [state, send] = $fe963b355347cc68$export$3e6543de14f8614f(initialState, { mounted: { UNMOUNT: 'unmounted', ANIMATION_OUT: 'unmountSuspended' }, unmountSuspended: { MOUNT: 'mounted', ANIMATION_END: 'unmounted' }, unmounted: { MOUNT: 'mounted' } }); (0,external_React_namespaceObject.useEffect)(()=>{ const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current); prevAnimationNameRef.current = state === 'mounted' ? currentAnimationName : 'none'; }, [ state ]); $9f79659886946c16$export$e5c5a5f917a5871c(()=>{ const styles = stylesRef.current; const wasPresent = prevPresentRef.current; const hasPresentChanged = wasPresent !== present; if (hasPresentChanged) { const prevAnimationName = prevAnimationNameRef.current; const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(styles); if (present) send('MOUNT'); else if (currentAnimationName === 'none' || (styles === null || styles === void 0 ? void 0 : styles.display) === 'none') // If there is no exit animation or the element is hidden, animations won't run // so we unmount instantly send('UNMOUNT'); else { /** * When `present` changes to `false`, we check changes to animation-name to * determine whether an animation has started. We chose this approach (reading * computed styles) because there is no `animationrun` event and `animationstart` * fires after `animation-delay` has expired which would be too late. */ const isAnimating = prevAnimationName !== currentAnimationName; if (wasPresent && isAnimating) send('ANIMATION_OUT'); else send('UNMOUNT'); } prevPresentRef.current = present; } }, [ present, send ]); $9f79659886946c16$export$e5c5a5f917a5871c(()=>{ if (node1) { /** * Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel` * event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we * make sure we only trigger ANIMATION_END for the currently active animation. */ const handleAnimationEnd = (event)=>{ const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current); const isCurrentAnimation = currentAnimationName.includes(event.animationName); if (event.target === node1 && isCurrentAnimation) // With React 18 concurrency this update is applied // a frame after the animation ends, creating a flash of visible content. // By manually flushing we ensure they sync within a frame, removing the flash. (0,external_ReactDOM_namespaceObject.flushSync)(()=>send('ANIMATION_END') ); }; const handleAnimationStart = (event)=>{ if (event.target === node1) // if animation occurred, store its name as the previous animation. prevAnimationNameRef.current = $921a889cee6df7e8$var$getAnimationName(stylesRef.current); }; node1.addEventListener('animationstart', handleAnimationStart); node1.addEventListener('animationcancel', handleAnimationEnd); node1.addEventListener('animationend', handleAnimationEnd); return ()=>{ node1.removeEventListener('animationstart', handleAnimationStart); node1.removeEventListener('animationcancel', handleAnimationEnd); node1.removeEventListener('animationend', handleAnimationEnd); }; } else // Transition to the unmounted state if the node is removed prematurely. // We avoid doing so during cleanup as the node may change but still exist. send('ANIMATION_END'); }, [ node1, send ]); return { isPresent: [ 'mounted', 'unmountSuspended' ].includes(state), ref: (0,external_React_namespaceObject.useCallback)((node)=>{ if (node) stylesRef.current = getComputedStyle(node); setNode(node); }, []) }; } /* -----------------------------------------------------------------------------------------------*/ function $921a889cee6df7e8$var$getAnimationName(styles) { return (styles === null || styles === void 0 ? void 0 : styles.animationName) || 'none'; } ;// ./node_modules/@radix-ui/react-focus-guards/dist/index.mjs /** Number of components which have requested interest to have focus guards */ let $3db38b7d1fb3fe6a$var$count = 0; function $3db38b7d1fb3fe6a$export$ac5b58043b79449b(props) { $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c(); return props.children; } /** * Injects a pair of focus guards at the edges of the whole DOM tree * to ensure `focusin` & `focusout` events can be caught consistently. */ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() { (0,external_React_namespaceObject.useEffect)(()=>{ var _edgeGuards$, _edgeGuards$2; const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]'); document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard()); document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard()); $3db38b7d1fb3fe6a$var$count++; return ()=>{ if ($3db38b7d1fb3fe6a$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach((node)=>node.remove() ); $3db38b7d1fb3fe6a$var$count--; }; }, []); } function $3db38b7d1fb3fe6a$var$createFocusGuard() { const element = document.createElement('span'); element.setAttribute('data-radix-focus-guard', ''); element.tabIndex = 0; element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none'; return element; } const $3db38b7d1fb3fe6a$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($3db38b7d1fb3fe6a$export$ac5b58043b79449b)); ;// ./node_modules/tslib/tslib.es6.mjs /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { 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); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { 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; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 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]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 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; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; 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); 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); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 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"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 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"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* harmony default export */ const tslib_es6 = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); ;// ./node_modules/react-remove-scroll-bar/dist/es2015/constants.js var zeroRightClassName = 'right-scroll-bar-position'; var fullWidthClassName = 'width-before-scroll-bar'; var noScrollbarsClassName = 'with-scroll-bars-hidden'; /** * Name of a CSS variable containing the amount of "hidden" scrollbar * ! might be undefined ! use will fallback! */ var removedBarSizeVariable = '--removed-body-scroll-bar-size'; ;// ./node_modules/use-callback-ref/dist/es2015/assignRef.js /** * Assigns a value for a given ref, no matter of the ref format * @param {RefObject} ref - a callback function or ref object * @param value - a new value * * @see https://github.com/theKashey/use-callback-ref#assignref * @example * const refObject = useRef(); * const refFn = (ref) => {....} * * assignRef(refObject, "refValue"); * assignRef(refFn, "refValue"); */ function assignRef(ref, value) { if (typeof ref === 'function') { ref(value); } else if (ref) { ref.current = value; } return ref; } ;// ./node_modules/use-callback-ref/dist/es2015/useRef.js /** * creates a MutableRef with ref change callback * @param initialValue - initial ref value * @param {Function} callback - a callback to run when value changes * * @example * const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue); * ref.current = 1; * // prints 0 -> 1 * * @see https://reactjs.org/docs/hooks-reference.html#useref * @see https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref * @returns {MutableRefObject} */ function useCallbackRef(initialValue, callback) { var ref = (0,external_React_namespaceObject.useState)(function () { return ({ // value value: initialValue, // last callback callback: callback, // "memoized" public interface facade: { get current() { return ref.value; }, set current(value) { var last = ref.value; if (last !== value) { ref.value = value; ref.callback(value, last); } }, }, }); })[0]; // update callback ref.callback = callback; return ref.facade; } ;// ./node_modules/use-callback-ref/dist/es2015/useMergeRef.js var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? external_React_namespaceObject.useLayoutEffect : external_React_namespaceObject.useEffect; var currentValues = new WeakMap(); /** * Merges two or more refs together providing a single interface to set their value * @param {RefObject|Ref} refs * @returns {MutableRefObject} - a new ref, which translates all changes to {refs} * * @see {@link mergeRefs} a version without buit-in memoization * @see https://github.com/theKashey/use-callback-ref#usemergerefs * @example * const Component = React.forwardRef((props, ref) => { * const ownRef = useRef(); * const domRef = useMergeRefs([ref, ownRef]); // 👈 merge together * return <div ref={domRef}>...</div> * } */ function useMergeRefs(refs, defaultValue) { var callbackRef = useCallbackRef(defaultValue || null, function (newValue) { return refs.forEach(function (ref) { return assignRef(ref, newValue); }); }); // handle refs changes - added or removed useIsomorphicLayoutEffect(function () { var oldValue = currentValues.get(callbackRef); if (oldValue) { var prevRefs_1 = new Set(oldValue); var nextRefs_1 = new Set(refs); var current_1 = callbackRef.current; prevRefs_1.forEach(function (ref) { if (!nextRefs_1.has(ref)) { assignRef(ref, null); } }); nextRefs_1.forEach(function (ref) { if (!prevRefs_1.has(ref)) { assignRef(ref, current_1); } }); } currentValues.set(callbackRef, refs); }, [refs]); return callbackRef; } ;// ./node_modules/use-sidecar/dist/es2015/medium.js function ItoI(a) { return a; } function innerCreateMedium(defaults, middleware) { if (middleware === void 0) { middleware = ItoI; } var buffer = []; var assigned = false; var medium = { read: function () { if (assigned) { throw new Error('Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.'); } if (buffer.length) { return buffer[buffer.length - 1]; } return defaults; }, useMedium: function (data) { var item = middleware(data, assigned); buffer.push(item); return function () { buffer = buffer.filter(function (x) { return x !== item; }); }; }, assignSyncMedium: function (cb) { assigned = true; while (buffer.length) { var cbs = buffer; buffer = []; cbs.forEach(cb); } buffer = { push: function (x) { return cb(x); }, filter: function () { return buffer; }, }; }, assignMedium: function (cb) { assigned = true; var pendingQueue = []; if (buffer.length) { var cbs = buffer; buffer = []; cbs.forEach(cb); pendingQueue = buffer; } var executeQueue = function () { var cbs = pendingQueue; pendingQueue = []; cbs.forEach(cb); }; var cycle = function () { return Promise.resolve().then(executeQueue); }; cycle(); buffer = { push: function (x) { pendingQueue.push(x); cycle(); }, filter: function (filter) { pendingQueue = pendingQueue.filter(filter); return buffer; }, }; }, }; return medium; } function createMedium(defaults, middleware) { if (middleware === void 0) { middleware = ItoI; } return innerCreateMedium(defaults, middleware); } // eslint-disable-next-line @typescript-eslint/ban-types function createSidecarMedium(options) { if (options === void 0) { options = {}; } var medium = innerCreateMedium(null); medium.options = __assign({ async: true, ssr: false }, options); return medium; } ;// ./node_modules/react-remove-scroll/dist/es2015/medium.js var effectCar = createSidecarMedium(); ;// ./node_modules/react-remove-scroll/dist/es2015/UI.js var nothing = function () { return; }; /** * Removes scrollbar from the page and contain the scroll within the Lock */ var RemoveScroll = external_React_namespaceObject.forwardRef(function (props, parentRef) { var ref = external_React_namespaceObject.useRef(null); var _a = external_React_namespaceObject.useState({ onScrollCapture: nothing, onWheelCapture: nothing, onTouchMoveCapture: nothing, }), callbacks = _a[0], setCallbacks = _a[1]; var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as"]); var SideCar = sideCar; var containerRef = useMergeRefs([ref, parentRef]); var containerProps = __assign(__assign({}, rest), callbacks); return (external_React_namespaceObject.createElement(external_React_namespaceObject.Fragment, null, enabled && (external_React_namespaceObject.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref })), forwardProps ? (external_React_namespaceObject.cloneElement(external_React_namespaceObject.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef }))) : (external_React_namespaceObject.createElement(Container, __assign({}, containerProps, { className: className, ref: containerRef }), children)))); }); RemoveScroll.defaultProps = { enabled: true, removeScrollBar: true, inert: false, }; RemoveScroll.classNames = { fullWidth: fullWidthClassName, zeroRight: zeroRightClassName, }; ;// ./node_modules/use-sidecar/dist/es2015/exports.js var SideCar = function (_a) { var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]); if (!sideCar) { throw new Error('Sidecar: please provide `sideCar` property to import the right car'); } var Target = sideCar.read(); if (!Target) { throw new Error('Sidecar medium not found'); } return external_React_namespaceObject.createElement(Target, __assign({}, rest)); }; SideCar.isSideCarExport = true; function exportSidecar(medium, exported) { medium.useMedium(exported); return SideCar; } ;// ./node_modules/get-nonce/dist/es2015/index.js var currentNonce; var setNonce = function (nonce) { currentNonce = nonce; }; var getNonce = function () { if (currentNonce) { return currentNonce; } if (true) { return __webpack_require__.nc; } return undefined; }; ;// ./node_modules/react-style-singleton/dist/es2015/singleton.js function makeStyleTag() { if (!document) return null; var tag = document.createElement('style'); tag.type = 'text/css'; var nonce = getNonce(); if (nonce) { tag.setAttribute('nonce', nonce); } return tag; } function injectStyles(tag, css) { // @ts-ignore if (tag.styleSheet) { // @ts-ignore tag.styleSheet.cssText = css; } else { tag.appendChild(document.createTextNode(css)); } } function insertStyleTag(tag) { var head = document.head || document.getElementsByTagName('head')[0]; head.appendChild(tag); } var stylesheetSingleton = function () { var counter = 0; var stylesheet = null; return { add: function (style) { if (counter == 0) { if ((stylesheet = makeStyleTag())) { injectStyles(stylesheet, style); insertStyleTag(stylesheet); } } counter++; }, remove: function () { counter--; if (!counter && stylesheet) { stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet); stylesheet = null; } }, }; }; ;// ./node_modules/react-style-singleton/dist/es2015/hook.js /** * creates a hook to control style singleton * @see {@link styleSingleton} for a safer component version * @example * ```tsx * const useStyle = styleHookSingleton(); * /// * useStyle('body { overflow: hidden}'); */ var styleHookSingleton = function () { var sheet = stylesheetSingleton(); return function (styles, isDynamic) { external_React_namespaceObject.useEffect(function () { sheet.add(styles); return function () { sheet.remove(); }; }, [styles && isDynamic]); }; }; ;// ./node_modules/react-style-singleton/dist/es2015/component.js /** * create a Component to add styles on demand * - styles are added when first instance is mounted * - styles are removed when the last instance is unmounted * - changing styles in runtime does nothing unless dynamic is set. But with multiple components that can lead to the undefined behavior */ var styleSingleton = function () { var useStyle = styleHookSingleton(); var Sheet = function (_a) { var styles = _a.styles, dynamic = _a.dynamic; useStyle(styles, dynamic); return null; }; return Sheet; }; ;// ./node_modules/react-style-singleton/dist/es2015/index.js ;// ./node_modules/react-remove-scroll-bar/dist/es2015/utils.js var zeroGap = { left: 0, top: 0, right: 0, gap: 0, }; var parse = function (x) { return parseInt(x || '', 10) || 0; }; var getOffset = function (gapMode) { var cs = window.getComputedStyle(document.body); var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft']; var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop']; var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight']; return [parse(left), parse(top), parse(right)]; }; var getGapWidth = function (gapMode) { if (gapMode === void 0) { gapMode = 'margin'; } if (typeof window === 'undefined') { return zeroGap; } var offsets = getOffset(gapMode); var documentWidth = document.documentElement.clientWidth; var windowWidth = window.innerWidth; return { left: offsets[0], top: offsets[1], right: offsets[2], gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]), }; }; ;// ./node_modules/react-remove-scroll-bar/dist/es2015/component.js var Style = styleSingleton(); var lockAttribute = 'data-scroll-locked'; // important tip - once we measure scrollBar width and remove them // we could not repeat this operation // thus we are using style-singleton - only the first "yet correct" style will be applied. var getStyles = function (_a, allowRelative, gapMode, important) { var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap; if (gapMode === void 0) { gapMode = 'margin'; } return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([ allowRelative && "position: relative ".concat(important, ";"), gapMode === 'margin' && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "), gapMode === 'padding' && "padding-right: ".concat(gap, "px ").concat(important, ";"), ] .filter(Boolean) .join(''), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n"); }; var getCurrentUseCounter = function () { var counter = parseInt(document.body.getAttribute(lockAttribute) || '0', 10); return isFinite(counter) ? counter : 0; }; var useLockAttribute = function () { external_React_namespaceObject.useEffect(function () { document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString()); return function () { var newCounter = getCurrentUseCounter() - 1; if (newCounter <= 0) { document.body.removeAttribute(lockAttribute); } else { document.body.setAttribute(lockAttribute, newCounter.toString()); } }; }, []); }; /** * Removes page scrollbar and blocks page scroll when mounted */ var RemoveScrollBar = function (_a) { var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? 'margin' : _b; useLockAttribute(); /* gap will be measured on every component mount however it will be used only by the "first" invocation due to singleton nature of <Style */ var gap = external_React_namespaceObject.useMemo(function () { return getGapWidth(gapMode); }, [gapMode]); return external_React_namespaceObject.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? '!important' : '') }); }; ;// ./node_modules/react-remove-scroll-bar/dist/es2015/index.js ;// ./node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js var passiveSupported = false; if (typeof window !== 'undefined') { try { var options = Object.defineProperty({}, 'passive', { get: function () { passiveSupported = true; return true; }, }); // @ts-ignore window.addEventListener('test', options, options); // @ts-ignore window.removeEventListener('test', options, options); } catch (err) { passiveSupported = false; } } var nonPassive = passiveSupported ? { passive: false } : false; ;// ./node_modules/react-remove-scroll/dist/es2015/handleScroll.js var alwaysContainsScroll = function (node) { // textarea will always _contain_ scroll inside self. It only can be hidden return node.tagName === 'TEXTAREA'; }; var elementCanBeScrolled = function (node, overflow) { var styles = window.getComputedStyle(node); return ( // not-not-scrollable styles[overflow] !== 'hidden' && // contains scroll inside self !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === 'visible')); }; var elementCouldBeVScrolled = function (node) { return elementCanBeScrolled(node, 'overflowY'); }; var elementCouldBeHScrolled = function (node) { return elementCanBeScrolled(node, 'overflowX'); }; var locationCouldBeScrolled = function (axis, node) { var current = node; do { // Skip over shadow root if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) { current = current.host; } var isScrollable = elementCouldBeScrolled(axis, current); if (isScrollable) { var _a = getScrollVariables(axis, current), s = _a[1], d = _a[2]; if (s > d) { return true; } } current = current.parentNode; } while (current && current !== document.body); return false; }; var getVScrollVariables = function (_a) { var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight; return [ scrollTop, scrollHeight, clientHeight, ]; }; var getHScrollVariables = function (_a) { var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth; return [ scrollLeft, scrollWidth, clientWidth, ]; }; var elementCouldBeScrolled = function (axis, node) { return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node); }; var getScrollVariables = function (axis, node) { return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node); }; var getDirectionFactor = function (axis, direction) { /** * If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position, * and then increasingly negative as you scroll towards the end of the content. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft */ return axis === 'h' && direction === 'rtl' ? -1 : 1; }; var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) { var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction); var delta = directionFactor * sourceDelta; // find scrollable target var target = event.target; var targetInLock = endTarget.contains(target); var shouldCancelScroll = false; var isDeltaPositive = delta > 0; var availableScroll = 0; var availableScrollTop = 0; do { var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2]; var elementScroll = scroll_1 - capacity - directionFactor * position; if (position || elementScroll) { if (elementCouldBeScrolled(axis, target)) { availableScroll += elementScroll; availableScrollTop += position; } } target = target.parentNode; } while ( // portaled content (!targetInLock && target !== document.body) || // self content (targetInLock && (endTarget.contains(target) || endTarget === target))); if (isDeltaPositive && ((noOverscroll && availableScroll === 0) || (!noOverscroll && delta > availableScroll))) { shouldCancelScroll = true; } else if (!isDeltaPositive && ((noOverscroll && availableScrollTop === 0) || (!noOverscroll && -delta > availableScrollTop))) { shouldCancelScroll = true; } return shouldCancelScroll; }; ;// ./node_modules/react-remove-scroll/dist/es2015/SideEffect.js var getTouchXY = function (event) { return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0]; }; var getDeltaXY = function (event) { return [event.deltaX, event.deltaY]; }; var extractRef = function (ref) { return ref && 'current' in ref ? ref.current : ref; }; var deltaCompare = function (x, y) { return x[0] === y[0] && x[1] === y[1]; }; var generateStyle = function (id) { return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n"); }; var idCounter = 0; var lockStack = []; function RemoveScrollSideCar(props) { var shouldPreventQueue = external_React_namespaceObject.useRef([]); var touchStartRef = external_React_namespaceObject.useRef([0, 0]); var activeAxis = external_React_namespaceObject.useRef(); var id = external_React_namespaceObject.useState(idCounter++)[0]; var Style = external_React_namespaceObject.useState(function () { return styleSingleton(); })[0]; var lastProps = external_React_namespaceObject.useRef(props); external_React_namespaceObject.useEffect(function () { lastProps.current = props; }, [props]); external_React_namespaceObject.useEffect(function () { if (props.inert) { document.body.classList.add("block-interactivity-".concat(id)); var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean); allow_1.forEach(function (el) { return el.classList.add("allow-interactivity-".concat(id)); }); return function () { document.body.classList.remove("block-interactivity-".concat(id)); allow_1.forEach(function (el) { return el.classList.remove("allow-interactivity-".concat(id)); }); }; } return; }, [props.inert, props.lockRef.current, props.shards]); var shouldCancelEvent = external_React_namespaceObject.useCallback(function (event, parent) { if ('touches' in event && event.touches.length === 2) { return !lastProps.current.allowPinchZoom; } var touch = getTouchXY(event); var touchStart = touchStartRef.current; var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0]; var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1]; var currentAxis; var target = event.target; var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v'; // allow horizontal touch move on Range inputs. They will not cause any scroll if ('touches' in event && moveDirection === 'h' && target.type === 'range') { return false; } var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target); if (!canBeScrolledInMainDirection) { return true; } if (canBeScrolledInMainDirection) { currentAxis = moveDirection; } else { currentAxis = moveDirection === 'v' ? 'h' : 'v'; canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target); // other axis might be not scrollable } if (!canBeScrolledInMainDirection) { return false; } if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) { activeAxis.current = currentAxis; } if (!currentAxis) { return true; } var cancelingAxis = activeAxis.current || currentAxis; return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true); }, []); var shouldPrevent = external_React_namespaceObject.useCallback(function (_event) { var event = _event; if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) { // not the last active return; } var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event); var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && e.target === event.target && deltaCompare(e.delta, delta); })[0]; // self event, and should be canceled if (sourceEvent && sourceEvent.should) { if (event.cancelable) { event.preventDefault(); } return; } // outside or shard event if (!sourceEvent) { var shardNodes = (lastProps.current.shards || []) .map(extractRef) .filter(Boolean) .filter(function (node) { return node.contains(event.target); }); var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation; if (shouldStop) { if (event.cancelable) { event.preventDefault(); } } } }, []); var shouldCancel = external_React_namespaceObject.useCallback(function (name, delta, target, should) { var event = { name: name, delta: delta, target: target, should: should }; shouldPreventQueue.current.push(event); setTimeout(function () { shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; }); }, 1); }, []); var scrollTouchStart = external_React_namespaceObject.useCallback(function (event) { touchStartRef.current = getTouchXY(event); activeAxis.current = undefined; }, []); var scrollWheel = external_React_namespaceObject.useCallback(function (event) { shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current)); }, []); var scrollTouchMove = external_React_namespaceObject.useCallback(function (event) { shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current)); }, []); external_React_namespaceObject.useEffect(function () { lockStack.push(Style); props.setCallbacks({ onScrollCapture: scrollWheel, onWheelCapture: scrollWheel, onTouchMoveCapture: scrollTouchMove, }); document.addEventListener('wheel', shouldPrevent, nonPassive); document.addEventListener('touchmove', shouldPrevent, nonPassive); document.addEventListener('touchstart', scrollTouchStart, nonPassive); return function () { lockStack = lockStack.filter(function (inst) { return inst !== Style; }); document.removeEventListener('wheel', shouldPrevent, nonPassive); document.removeEventListener('touchmove', shouldPrevent, nonPassive); document.removeEventListener('touchstart', scrollTouchStart, nonPassive); }; }, []); var removeScrollBar = props.removeScrollBar, inert = props.inert; return (external_React_namespaceObject.createElement(external_React_namespaceObject.Fragment, null, inert ? external_React_namespaceObject.createElement(Style, { styles: generateStyle(id) }) : null, removeScrollBar ? external_React_namespaceObject.createElement(RemoveScrollBar, { gapMode: "margin" }) : null)); } ;// ./node_modules/react-remove-scroll/dist/es2015/sidecar.js /* harmony default export */ const sidecar = (exportSidecar(effectCar, RemoveScrollSideCar)); ;// ./node_modules/react-remove-scroll/dist/es2015/Combination.js var ReactRemoveScroll = external_React_namespaceObject.forwardRef(function (props, ref) { return (external_React_namespaceObject.createElement(RemoveScroll, __assign({}, props, { ref: ref, sideCar: sidecar }))); }); ReactRemoveScroll.classNames = RemoveScroll.classNames; /* harmony default export */ const Combination = (ReactRemoveScroll); ;// ./node_modules/aria-hidden/dist/es2015/index.js var getDefaultParent = function (originalTarget) { if (typeof document === 'undefined') { return null; } var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget; return sampleTarget.ownerDocument.body; }; var counterMap = new WeakMap(); var uncontrolledNodes = new WeakMap(); var markerMap = {}; var lockCount = 0; var unwrapHost = function (node) { return node && (node.host || unwrapHost(node.parentNode)); }; var correctTargets = function (parent, targets) { return targets .map(function (target) { if (parent.contains(target)) { return target; } var correctedTarget = unwrapHost(target); if (correctedTarget && parent.contains(correctedTarget)) { return correctedTarget; } console.error('aria-hidden', target, 'in not contained inside', parent, '. Doing nothing'); return null; }) .filter(function (x) { return Boolean(x); }); }; /** * Marks everything except given node(or nodes) as aria-hidden * @param {Element | Element[]} originalTarget - elements to keep on the page * @param [parentNode] - top element, defaults to document.body * @param {String} [markerName] - a special attribute to mark every node * @param {String} [controlAttribute] - html Attribute to control * @return {Undo} undo command */ var applyAttributeToOthers = function (originalTarget, parentNode, markerName, controlAttribute) { var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]); if (!markerMap[markerName]) { markerMap[markerName] = new WeakMap(); } var markerCounter = markerMap[markerName]; var hiddenNodes = []; var elementsToKeep = new Set(); var elementsToStop = new Set(targets); var keep = function (el) { if (!el || elementsToKeep.has(el)) { return; } elementsToKeep.add(el); keep(el.parentNode); }; targets.forEach(keep); var deep = function (parent) { if (!parent || elementsToStop.has(parent)) { return; } Array.prototype.forEach.call(parent.children, function (node) { if (elementsToKeep.has(node)) { deep(node); } else { try { var attr = node.getAttribute(controlAttribute); var alreadyHidden = attr !== null && attr !== 'false'; var counterValue = (counterMap.get(node) || 0) + 1; var markerValue = (markerCounter.get(node) || 0) + 1; counterMap.set(node, counterValue); markerCounter.set(node, markerValue); hiddenNodes.push(node); if (counterValue === 1 && alreadyHidden) { uncontrolledNodes.set(node, true); } if (markerValue === 1) { node.setAttribute(markerName, 'true'); } if (!alreadyHidden) { node.setAttribute(controlAttribute, 'true'); } } catch (e) { console.error('aria-hidden: cannot operate on ', node, e); } } }); }; deep(parentNode); elementsToKeep.clear(); lockCount++; return function () { hiddenNodes.forEach(function (node) { var counterValue = counterMap.get(node) - 1; var markerValue = markerCounter.get(node) - 1; counterMap.set(node, counterValue); markerCounter.set(node, markerValue); if (!counterValue) { if (!uncontrolledNodes.has(node)) { node.removeAttribute(controlAttribute); } uncontrolledNodes.delete(node); } if (!markerValue) { node.removeAttribute(markerName); } }); lockCount--; if (!lockCount) { // clear counterMap = new WeakMap(); counterMap = new WeakMap(); uncontrolledNodes = new WeakMap(); markerMap = {}; } }; }; /** * Marks everything except given node(or nodes) as aria-hidden * @param {Element | Element[]} originalTarget - elements to keep on the page * @param [parentNode] - top element, defaults to document.body * @param {String} [markerName] - a special attribute to mark every node * @return {Undo} undo command */ var hideOthers = function (originalTarget, parentNode, markerName) { if (markerName === void 0) { markerName = 'data-aria-hidden'; } var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]); var activeParentNode = parentNode || getDefaultParent(originalTarget); if (!activeParentNode) { return function () { return null; }; } // we should not hide ariaLive elements - https://github.com/theKashey/aria-hidden/issues/10 targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll('[aria-live]'))); return applyAttributeToOthers(targets, activeParentNode, markerName, 'aria-hidden'); }; /** * Marks everything except given node(or nodes) as inert * @param {Element | Element[]} originalTarget - elements to keep on the page * @param [parentNode] - top element, defaults to document.body * @param {String} [markerName] - a special attribute to mark every node * @return {Undo} undo command */ var inertOthers = function (originalTarget, parentNode, markerName) { if (markerName === void 0) { markerName = 'data-inert-ed'; } var activeParentNode = parentNode || getDefaultParent(originalTarget); if (!activeParentNode) { return function () { return null; }; } return applyAttributeToOthers(originalTarget, activeParentNode, markerName, 'inert'); }; /** * @returns if current browser supports inert */ var supportsInert = function () { return typeof HTMLElement !== 'undefined' && HTMLElement.prototype.hasOwnProperty('inert'); }; /** * Automatic function to "suppress" DOM elements - _hide_ or _inert_ in the best possible way * @param {Element | Element[]} originalTarget - elements to keep on the page * @param [parentNode] - top element, defaults to document.body * @param {String} [markerName] - a special attribute to mark every node * @return {Undo} undo command */ var suppressOthers = function (originalTarget, parentNode, markerName) { if (markerName === void 0) { markerName = 'data-suppressed'; } return (supportsInert() ? inertOthers : hideOthers)(originalTarget, parentNode, markerName); }; ;// ./node_modules/@radix-ui/react-dialog/dist/index.mjs /* ------------------------------------------------------------------------------------------------- * Dialog * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DIALOG_NAME = 'Dialog'; const [$5d3850c4d0b4e6c7$var$createDialogContext, $5d3850c4d0b4e6c7$export$cc702773b8ea3e41] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($5d3850c4d0b4e6c7$var$DIALOG_NAME); const [$5d3850c4d0b4e6c7$var$DialogProvider, $5d3850c4d0b4e6c7$var$useDialogContext] = $5d3850c4d0b4e6c7$var$createDialogContext($5d3850c4d0b4e6c7$var$DIALOG_NAME); const $5d3850c4d0b4e6c7$export$3ddf2d174ce01153 = (props)=>{ const { __scopeDialog: __scopeDialog , children: children , open: openProp , defaultOpen: defaultOpen , onOpenChange: onOpenChange , modal: modal = true } = props; const triggerRef = (0,external_React_namespaceObject.useRef)(null); const contentRef = (0,external_React_namespaceObject.useRef)(null); const [open = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: openProp, defaultProp: defaultOpen, onChange: onOpenChange }); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogProvider, { scope: __scopeDialog, triggerRef: triggerRef, contentRef: contentRef, contentId: $1746a345f3d73bb7$export$f680877a34711e37(), titleId: $1746a345f3d73bb7$export$f680877a34711e37(), descriptionId: $1746a345f3d73bb7$export$f680877a34711e37(), open: open, onOpenChange: setOpen, onOpenToggle: (0,external_React_namespaceObject.useCallback)(()=>setOpen((prevOpen)=>!prevOpen ) , [ setOpen ]), modal: modal }, children); }; /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$3ddf2d174ce01153, { displayName: $5d3850c4d0b4e6c7$var$DIALOG_NAME }); /* ------------------------------------------------------------------------------------------------- * DialogTrigger * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$TRIGGER_NAME = 'DialogTrigger'; const $5d3850c4d0b4e6c7$export$2e1e1122cf0cba88 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const { __scopeDialog: __scopeDialog , ...triggerProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$TRIGGER_NAME, __scopeDialog); const composedTriggerRef = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.triggerRef); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({ type: "button", "aria-haspopup": "dialog", "aria-expanded": context.open, "aria-controls": context.contentId, "data-state": $5d3850c4d0b4e6c7$var$getState(context.open) }, triggerProps, { ref: composedTriggerRef, onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, context.onOpenToggle) })); }); /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$2e1e1122cf0cba88, { displayName: $5d3850c4d0b4e6c7$var$TRIGGER_NAME }); /* ------------------------------------------------------------------------------------------------- * DialogPortal * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$PORTAL_NAME = 'DialogPortal'; const [$5d3850c4d0b4e6c7$var$PortalProvider, $5d3850c4d0b4e6c7$var$usePortalContext] = $5d3850c4d0b4e6c7$var$createDialogContext($5d3850c4d0b4e6c7$var$PORTAL_NAME, { forceMount: undefined }); const $5d3850c4d0b4e6c7$export$dad7c95542bacce0 = (props)=>{ const { __scopeDialog: __scopeDialog , forceMount: forceMount , children: children , container: container } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$PORTAL_NAME, __scopeDialog); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$PortalProvider, { scope: __scopeDialog, forceMount: forceMount }, external_React_namespaceObject.Children.map(children, (child)=>/*#__PURE__*/ (0,external_React_namespaceObject.createElement)($921a889cee6df7e8$export$99c2b779aa4e8b8b, { present: forceMount || context.open }, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($f1701beae083dbae$export$602eac185826482c, { asChild: true, container: container }, child)) )); }; /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$dad7c95542bacce0, { displayName: $5d3850c4d0b4e6c7$var$PORTAL_NAME }); /* ------------------------------------------------------------------------------------------------- * DialogOverlay * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$OVERLAY_NAME = 'DialogOverlay'; const $5d3850c4d0b4e6c7$export$bd1d06c79be19e17 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const portalContext = $5d3850c4d0b4e6c7$var$usePortalContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, props.__scopeDialog); const { forceMount: forceMount = portalContext.forceMount , ...overlayProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, props.__scopeDialog); return context.modal ? /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($921a889cee6df7e8$export$99c2b779aa4e8b8b, { present: forceMount || context.open }, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogOverlayImpl, _extends({}, overlayProps, { ref: forwardedRef }))) : null; }); /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$bd1d06c79be19e17, { displayName: $5d3850c4d0b4e6c7$var$OVERLAY_NAME }); const $5d3850c4d0b4e6c7$var$DialogOverlayImpl = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const { __scopeDialog: __scopeDialog , ...overlayProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, __scopeDialog); return(/*#__PURE__*/ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll` // ie. when `Overlay` and `Content` are siblings (0,external_React_namespaceObject.createElement)(Combination, { as: $5e63c961fc1ce211$export$8c6ed5c666ac1360, allowPinchZoom: true, shards: [ context.contentRef ] }, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({ "data-state": $5d3850c4d0b4e6c7$var$getState(context.open) }, overlayProps, { ref: forwardedRef // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay. , style: { pointerEvents: 'auto', ...overlayProps.style } })))); }); /* ------------------------------------------------------------------------------------------------- * DialogContent * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$CONTENT_NAME = 'DialogContent'; const $5d3850c4d0b4e6c7$export$b6d9565de1e068cf = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const portalContext = $5d3850c4d0b4e6c7$var$usePortalContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog); const { forceMount: forceMount = portalContext.forceMount , ...contentProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($921a889cee6df7e8$export$99c2b779aa4e8b8b, { present: forceMount || context.open }, context.modal ? /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogContentModal, _extends({}, contentProps, { ref: forwardedRef })) : /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogContentNonModal, _extends({}, contentProps, { ref: forwardedRef }))); }); /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$b6d9565de1e068cf, { displayName: $5d3850c4d0b4e6c7$var$CONTENT_NAME }); /* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DialogContentModal = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog); const contentRef = (0,external_React_namespaceObject.useRef)(null); const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.contentRef, contentRef); // aria-hide everything except the content (better supported equivalent to setting aria-modal) (0,external_React_namespaceObject.useEffect)(()=>{ const content = contentRef.current; if (content) return hideOthers(content); }, []); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogContentImpl, _extends({}, props, { ref: composedRefs // we make sure focus isn't trapped once `DialogContent` has been closed , trapFocus: context.open, disableOutsidePointerEvents: true, onCloseAutoFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onCloseAutoFocus, (event)=>{ var _context$triggerRef$c; event.preventDefault(); (_context$triggerRef$c = context.triggerRef.current) === null || _context$triggerRef$c === void 0 || _context$triggerRef$c.focus(); }), onPointerDownOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownOutside, (event)=>{ const originalEvent = event.detail.originalEvent; const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true; const isRightClick = originalEvent.button === 2 || ctrlLeftClick; // If the event is a right-click, we shouldn't close because // it is effectively as if we right-clicked the `Overlay`. if (isRightClick) event.preventDefault(); }) // When focus is trapped, a `focusout` event may still happen. , onFocusOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusOutside, (event)=>event.preventDefault() ) })); }); /* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DialogContentNonModal = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog); const hasInteractedOutsideRef = (0,external_React_namespaceObject.useRef)(false); const hasPointerDownOutsideRef = (0,external_React_namespaceObject.useRef)(false); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogContentImpl, _extends({}, props, { ref: forwardedRef, trapFocus: false, disableOutsidePointerEvents: false, onCloseAutoFocus: (event)=>{ var _props$onCloseAutoFoc; (_props$onCloseAutoFoc = props.onCloseAutoFocus) === null || _props$onCloseAutoFoc === void 0 || _props$onCloseAutoFoc.call(props, event); if (!event.defaultPrevented) { var _context$triggerRef$c2; if (!hasInteractedOutsideRef.current) (_context$triggerRef$c2 = context.triggerRef.current) === null || _context$triggerRef$c2 === void 0 || _context$triggerRef$c2.focus(); // Always prevent auto focus because we either focus manually or want user agent focus event.preventDefault(); } hasInteractedOutsideRef.current = false; hasPointerDownOutsideRef.current = false; }, onInteractOutside: (event)=>{ var _props$onInteractOuts, _context$triggerRef$c3; (_props$onInteractOuts = props.onInteractOutside) === null || _props$onInteractOuts === void 0 || _props$onInteractOuts.call(props, event); if (!event.defaultPrevented) { hasInteractedOutsideRef.current = true; if (event.detail.originalEvent.type === 'pointerdown') hasPointerDownOutsideRef.current = true; } // Prevent dismissing when clicking the trigger. // As the trigger is already setup to close, without doing so would // cause it to close and immediately open. const target = event.target; const targetIsTrigger = (_context$triggerRef$c3 = context.triggerRef.current) === null || _context$triggerRef$c3 === void 0 ? void 0 : _context$triggerRef$c3.contains(target); if (targetIsTrigger) event.preventDefault(); // On Safari if the trigger is inside a container with tabIndex={0}, when clicked // we will get the pointer down outside event on the trigger, but then a subsequent // focus outside event on the container, we ignore any focus outside event when we've // already had a pointer down outside event. if (event.detail.originalEvent.type === 'focusin' && hasPointerDownOutsideRef.current) event.preventDefault(); } })); }); /* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DialogContentImpl = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const { __scopeDialog: __scopeDialog , trapFocus: trapFocus , onOpenAutoFocus: onOpenAutoFocus , onCloseAutoFocus: onCloseAutoFocus , ...contentProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, __scopeDialog); const contentRef = (0,external_React_namespaceObject.useRef)(null); const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentRef); // Make sure the whole tree has focus guards as our `Dialog` will be // the last element in the DOM (beacuse of the `Portal`) $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c(); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($d3863c46a17e8a28$export$20e40289641fbbb6, { asChild: true, loop: true, trapped: trapFocus, onMountAutoFocus: onOpenAutoFocus, onUnmountAutoFocus: onCloseAutoFocus }, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5cb92bef7577960e$export$177fb62ff3ec1f22, _extends({ role: "dialog", id: context.contentId, "aria-describedby": context.descriptionId, "aria-labelledby": context.titleId, "data-state": $5d3850c4d0b4e6c7$var$getState(context.open) }, contentProps, { ref: composedRefs, onDismiss: ()=>context.onOpenChange(false) }))), false); }); /* ------------------------------------------------------------------------------------------------- * DialogTitle * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$TITLE_NAME = 'DialogTitle'; const $5d3850c4d0b4e6c7$export$16f7638e4a34b909 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const { __scopeDialog: __scopeDialog , ...titleProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$TITLE_NAME, __scopeDialog); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.h2, _extends({ id: context.titleId }, titleProps, { ref: forwardedRef })); }); /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$16f7638e4a34b909, { displayName: $5d3850c4d0b4e6c7$var$TITLE_NAME }); /* ------------------------------------------------------------------------------------------------- * DialogDescription * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DESCRIPTION_NAME = 'DialogDescription'; const $5d3850c4d0b4e6c7$export$94e94c2ec2c954d5 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const { __scopeDialog: __scopeDialog , ...descriptionProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$DESCRIPTION_NAME, __scopeDialog); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.p, _extends({ id: context.descriptionId }, descriptionProps, { ref: forwardedRef })); }); /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$94e94c2ec2c954d5, { displayName: $5d3850c4d0b4e6c7$var$DESCRIPTION_NAME }); /* ------------------------------------------------------------------------------------------------- * DialogClose * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$CLOSE_NAME = 'DialogClose'; const $5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{ const { __scopeDialog: __scopeDialog , ...closeProps } = props; const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CLOSE_NAME, __scopeDialog); return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({ type: "button" }, closeProps, { ref: forwardedRef, onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, ()=>context.onOpenChange(false) ) })); }); /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac, { displayName: $5d3850c4d0b4e6c7$var$CLOSE_NAME }); /* -----------------------------------------------------------------------------------------------*/ function $5d3850c4d0b4e6c7$var$getState(open) { return open ? 'open' : 'closed'; } const $5d3850c4d0b4e6c7$var$TITLE_WARNING_NAME = 'DialogTitleWarning'; const [$5d3850c4d0b4e6c7$export$69b62a49393917d6, $5d3850c4d0b4e6c7$var$useWarningContext] = $c512c27ab02ef895$export$fd42f52fd3ae1109($5d3850c4d0b4e6c7$var$TITLE_WARNING_NAME, { contentName: $5d3850c4d0b4e6c7$var$CONTENT_NAME, titleName: $5d3850c4d0b4e6c7$var$TITLE_NAME, docsSlug: 'dialog' }); const $5d3850c4d0b4e6c7$var$TitleWarning = ({ titleId: titleId })=>{ const titleWarningContext = $5d3850c4d0b4e6c7$var$useWarningContext($5d3850c4d0b4e6c7$var$TITLE_WARNING_NAME); const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`; $67UHm$useEffect(()=>{ if (titleId) { const hasTitle = document.getElementById(titleId); if (!hasTitle) throw new Error(MESSAGE); } }, [ MESSAGE, titleId ]); return null; }; const $5d3850c4d0b4e6c7$var$DESCRIPTION_WARNING_NAME = 'DialogDescriptionWarning'; const $5d3850c4d0b4e6c7$var$DescriptionWarning = ({ contentRef: contentRef , descriptionId: descriptionId })=>{ const descriptionWarningContext = $5d3850c4d0b4e6c7$var$useWarningContext($5d3850c4d0b4e6c7$var$DESCRIPTION_WARNING_NAME); const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`; $67UHm$useEffect(()=>{ var _contentRef$current; const describedById = (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.getAttribute('aria-describedby'); // if we have an id and the user hasn't set aria-describedby={undefined} if (descriptionId && describedById) { const hasDescription = document.getElementById(descriptionId); if (!hasDescription) console.warn(MESSAGE); } }, [ MESSAGE, contentRef, descriptionId ]); return null; }; const $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9 = $5d3850c4d0b4e6c7$export$3ddf2d174ce01153; const $5d3850c4d0b4e6c7$export$41fb9f06171c75f4 = (/* unused pure expression or super */ null && ($5d3850c4d0b4e6c7$export$2e1e1122cf0cba88)); const $5d3850c4d0b4e6c7$export$602eac185826482c = $5d3850c4d0b4e6c7$export$dad7c95542bacce0; const $5d3850c4d0b4e6c7$export$c6fdb837b070b4ff = $5d3850c4d0b4e6c7$export$bd1d06c79be19e17; const $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2 = $5d3850c4d0b4e6c7$export$b6d9565de1e068cf; const $5d3850c4d0b4e6c7$export$f99233281efd08a0 = (/* unused pure expression or super */ null && ($5d3850c4d0b4e6c7$export$16f7638e4a34b909)); const $5d3850c4d0b4e6c7$export$393edc798c47379d = (/* unused pure expression or super */ null && ($5d3850c4d0b4e6c7$export$94e94c2ec2c954d5)); const $5d3850c4d0b4e6c7$export$f39c2d165cd861fe = (/* unused pure expression or super */ null && ($5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac)); ;// ./node_modules/cmdk/dist/index.mjs var V='[cmdk-group=""]',dist_X='[cmdk-group-items=""]',ge='[cmdk-group-heading=""]',dist_Y='[cmdk-item=""]',le=`${dist_Y}:not([aria-disabled="true"])`,Q="cmdk-item-select",M="data-value",Re=(r,o,n)=>W(r,o,n),ue=external_React_namespaceObject.createContext(void 0),dist_G=()=>external_React_namespaceObject.useContext(ue),de=external_React_namespaceObject.createContext(void 0),Z=()=>external_React_namespaceObject.useContext(de),fe=external_React_namespaceObject.createContext(void 0),me=external_React_namespaceObject.forwardRef((r,o)=>{let n=dist_k(()=>{var e,s;return{search:"",value:(s=(e=r.value)!=null?e:r.defaultValue)!=null?s:"",filtered:{count:0,items:new Map,groups:new Set}}}),u=dist_k(()=>new Set),c=dist_k(()=>new Map),d=dist_k(()=>new Map),f=dist_k(()=>new Set),p=pe(r),{label:v,children:b,value:l,onValueChange:y,filter:S,shouldFilter:C,loop:L,disablePointerSelection:ee=!1,vimBindings:j=!0,...H}=r,te=external_React_namespaceObject.useId(),$=external_React_namespaceObject.useId(),K=external_React_namespaceObject.useId(),x=external_React_namespaceObject.useRef(null),g=Me();T(()=>{if(l!==void 0){let e=l.trim();n.current.value=e,h.emit()}},[l]),T(()=>{g(6,re)},[]);let h=external_React_namespaceObject.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>n.current,setState:(e,s,i)=>{var a,m,R;if(!Object.is(n.current[e],s)){if(n.current[e]=s,e==="search")z(),q(),g(1,U);else if(e==="value"&&(i||g(5,re),((a=p.current)==null?void 0:a.value)!==void 0)){let E=s!=null?s:"";(R=(m=p.current).onValueChange)==null||R.call(m,E);return}h.emit()}},emit:()=>{f.current.forEach(e=>e())}}),[]),B=external_React_namespaceObject.useMemo(()=>({value:(e,s,i)=>{var a;s!==((a=d.current.get(e))==null?void 0:a.value)&&(d.current.set(e,{value:s,keywords:i}),n.current.filtered.items.set(e,ne(s,i)),g(2,()=>{q(),h.emit()}))},item:(e,s)=>(u.current.add(e),s&&(c.current.has(s)?c.current.get(s).add(e):c.current.set(s,new Set([e]))),g(3,()=>{z(),q(),n.current.value||U(),h.emit()}),()=>{d.current.delete(e),u.current.delete(e),n.current.filtered.items.delete(e);let i=O();g(4,()=>{z(),(i==null?void 0:i.getAttribute("id"))===e&&U(),h.emit()})}),group:e=>(c.current.has(e)||c.current.set(e,new Set),()=>{d.current.delete(e),c.current.delete(e)}),filter:()=>p.current.shouldFilter,label:v||r["aria-label"],disablePointerSelection:ee,listId:te,inputId:K,labelId:$,listInnerRef:x}),[]);function ne(e,s){var a,m;let i=(m=(a=p.current)==null?void 0:a.filter)!=null?m:Re;return e?i(e,n.current.search,s):0}function q(){if(!n.current.search||p.current.shouldFilter===!1)return;let e=n.current.filtered.items,s=[];n.current.filtered.groups.forEach(a=>{let m=c.current.get(a),R=0;m.forEach(E=>{let P=e.get(E);R=Math.max(P,R)}),s.push([a,R])});let i=x.current;A().sort((a,m)=>{var P,_;let R=a.getAttribute("id"),E=m.getAttribute("id");return((P=e.get(E))!=null?P:0)-((_=e.get(R))!=null?_:0)}).forEach(a=>{let m=a.closest(dist_X);m?m.appendChild(a.parentElement===m?a:a.closest(`${dist_X} > *`)):i.appendChild(a.parentElement===i?a:a.closest(`${dist_X} > *`))}),s.sort((a,m)=>m[1]-a[1]).forEach(a=>{let m=x.current.querySelector(`${V}[${M}="${encodeURIComponent(a[0])}"]`);m==null||m.parentElement.appendChild(m)})}function U(){let e=A().find(i=>i.getAttribute("aria-disabled")!=="true"),s=e==null?void 0:e.getAttribute(M);h.setState("value",s||void 0)}function z(){var s,i,a,m;if(!n.current.search||p.current.shouldFilter===!1){n.current.filtered.count=u.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let R of u.current){let E=(i=(s=d.current.get(R))==null?void 0:s.value)!=null?i:"",P=(m=(a=d.current.get(R))==null?void 0:a.keywords)!=null?m:[],_=ne(E,P);n.current.filtered.items.set(R,_),_>0&&e++}for(let[R,E]of c.current)for(let P of E)if(n.current.filtered.items.get(P)>0){n.current.filtered.groups.add(R);break}n.current.filtered.count=e}function re(){var s,i,a;let e=O();e&&(((s=e.parentElement)==null?void 0:s.firstChild)===e&&((a=(i=e.closest(V))==null?void 0:i.querySelector(ge))==null||a.scrollIntoView({block:"nearest"})),e.scrollIntoView({block:"nearest"}))}function O(){var e;return(e=x.current)==null?void 0:e.querySelector(`${dist_Y}[aria-selected="true"]`)}function A(){var e;return Array.from((e=x.current)==null?void 0:e.querySelectorAll(le))}function W(e){let i=A()[e];i&&h.setState("value",i.getAttribute(M))}function J(e){var R;let s=O(),i=A(),a=i.findIndex(E=>E===s),m=i[a+e];(R=p.current)!=null&&R.loop&&(m=a+e<0?i[i.length-1]:a+e===i.length?i[0]:i[a+e]),m&&h.setState("value",m.getAttribute(M))}function oe(e){let s=O(),i=s==null?void 0:s.closest(V),a;for(;i&&!a;)i=e>0?we(i,V):Ie(i,V),a=i==null?void 0:i.querySelector(le);a?h.setState("value",a.getAttribute(M)):J(e)}let ie=()=>W(A().length-1),ae=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?oe(1):J(1)},se=e=>{e.preventDefault(),e.metaKey?W(0):e.altKey?oe(-1):J(-1)};return external_React_namespaceObject.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div,{ref:o,tabIndex:-1,...H,"cmdk-root":"",onKeyDown:e=>{var s;if((s=H.onKeyDown)==null||s.call(H,e),!e.defaultPrevented)switch(e.key){case"n":case"j":{j&&e.ctrlKey&&ae(e);break}case"ArrowDown":{ae(e);break}case"p":case"k":{j&&e.ctrlKey&&se(e);break}case"ArrowUp":{se(e);break}case"Home":{e.preventDefault(),W(0);break}case"End":{e.preventDefault(),ie();break}case"Enter":if(!e.nativeEvent.isComposing&&e.keyCode!==229){e.preventDefault();let i=O();if(i){let a=new Event(Q);i.dispatchEvent(a)}}}}},external_React_namespaceObject.createElement("label",{"cmdk-label":"",htmlFor:B.inputId,id:B.labelId,style:De},v),F(r,e=>external_React_namespaceObject.createElement(de.Provider,{value:h},external_React_namespaceObject.createElement(ue.Provider,{value:B},e))))}),be=external_React_namespaceObject.forwardRef((r,o)=>{var K,x;let n=external_React_namespaceObject.useId(),u=external_React_namespaceObject.useRef(null),c=external_React_namespaceObject.useContext(fe),d=dist_G(),f=pe(r),p=(x=(K=f.current)==null?void 0:K.forceMount)!=null?x:c==null?void 0:c.forceMount;T(()=>{if(!p)return d.item(n,c==null?void 0:c.id)},[p]);let v=ve(n,u,[r.value,r.children,u],r.keywords),b=Z(),l=dist_D(g=>g.value&&g.value===v.current),y=dist_D(g=>p||d.filter()===!1?!0:g.search?g.filtered.items.get(n)>0:!0);external_React_namespaceObject.useEffect(()=>{let g=u.current;if(!(!g||r.disabled))return g.addEventListener(Q,S),()=>g.removeEventListener(Q,S)},[y,r.onSelect,r.disabled]);function S(){var g,h;C(),(h=(g=f.current).onSelect)==null||h.call(g,v.current)}function C(){b.setState("value",v.current,!0)}if(!y)return null;let{disabled:L,value:ee,onSelect:j,forceMount:H,keywords:te,...$}=r;return external_React_namespaceObject.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div,{ref:N([u,o]),...$,id:n,"cmdk-item":"",role:"option","aria-disabled":!!L,"aria-selected":!!l,"data-disabled":!!L,"data-selected":!!l,onPointerMove:L||d.disablePointerSelection?void 0:C,onClick:L?void 0:S},r.children)}),he=external_React_namespaceObject.forwardRef((r,o)=>{let{heading:n,children:u,forceMount:c,...d}=r,f=external_React_namespaceObject.useId(),p=external_React_namespaceObject.useRef(null),v=external_React_namespaceObject.useRef(null),b=external_React_namespaceObject.useId(),l=dist_G(),y=dist_D(C=>c||l.filter()===!1?!0:C.search?C.filtered.groups.has(f):!0);T(()=>l.group(f),[]),ve(f,p,[r.value,r.heading,v]);let S=external_React_namespaceObject.useMemo(()=>({id:f,forceMount:c}),[c]);return external_React_namespaceObject.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div,{ref:N([p,o]),...d,"cmdk-group":"",role:"presentation",hidden:y?void 0:!0},n&&external_React_namespaceObject.createElement("div",{ref:v,"cmdk-group-heading":"","aria-hidden":!0,id:b},n),F(r,C=>external_React_namespaceObject.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?b:void 0},external_React_namespaceObject.createElement(fe.Provider,{value:S},C))))}),ye=external_React_namespaceObject.forwardRef((r,o)=>{let{alwaysRender:n,...u}=r,c=external_React_namespaceObject.useRef(null),d=dist_D(f=>!f.search);return!n&&!d?null:external_React_namespaceObject.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div,{ref:N([c,o]),...u,"cmdk-separator":"",role:"separator"})}),Ee=external_React_namespaceObject.forwardRef((r,o)=>{let{onValueChange:n,...u}=r,c=r.value!=null,d=Z(),f=dist_D(l=>l.search),p=dist_D(l=>l.value),v=dist_G(),b=external_React_namespaceObject.useMemo(()=>{var y;let l=(y=v.listInnerRef.current)==null?void 0:y.querySelector(`${dist_Y}[${M}="${encodeURIComponent(p)}"]`);return l==null?void 0:l.getAttribute("id")},[]);return external_React_namespaceObject.useEffect(()=>{r.value!=null&&d.setState("search",r.value)},[r.value]),external_React_namespaceObject.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.input,{ref:o,...u,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":v.listId,"aria-labelledby":v.labelId,"aria-activedescendant":b,id:v.inputId,type:"text",value:c?r.value:f,onChange:l=>{c||d.setState("search",l.target.value),n==null||n(l.target.value)}})}),Se=external_React_namespaceObject.forwardRef((r,o)=>{let{children:n,label:u="Suggestions",...c}=r,d=external_React_namespaceObject.useRef(null),f=external_React_namespaceObject.useRef(null),p=dist_G();return external_React_namespaceObject.useEffect(()=>{if(f.current&&d.current){let v=f.current,b=d.current,l,y=new ResizeObserver(()=>{l=requestAnimationFrame(()=>{let S=v.offsetHeight;b.style.setProperty("--cmdk-list-height",S.toFixed(1)+"px")})});return y.observe(v),()=>{cancelAnimationFrame(l),y.unobserve(v)}}},[]),external_React_namespaceObject.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div,{ref:N([d,o]),...c,"cmdk-list":"",role:"listbox","aria-label":u,id:p.listId},F(r,v=>external_React_namespaceObject.createElement("div",{ref:N([f,p.listInnerRef]),"cmdk-list-sizer":""},v)))}),Ce=external_React_namespaceObject.forwardRef((r,o)=>{let{open:n,onOpenChange:u,overlayClassName:c,contentClassName:d,container:f,...p}=r;return external_React_namespaceObject.createElement($5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9,{open:n,onOpenChange:u},external_React_namespaceObject.createElement($5d3850c4d0b4e6c7$export$602eac185826482c,{container:f},external_React_namespaceObject.createElement($5d3850c4d0b4e6c7$export$c6fdb837b070b4ff,{"cmdk-overlay":"",className:c}),external_React_namespaceObject.createElement($5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2,{"aria-label":r.label,"cmdk-dialog":"",className:d},external_React_namespaceObject.createElement(me,{ref:o,...p}))))}),xe=external_React_namespaceObject.forwardRef((r,o)=>dist_D(u=>u.filtered.count===0)?external_React_namespaceObject.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div,{ref:o,...r,"cmdk-empty":"",role:"presentation"}):null),Pe=external_React_namespaceObject.forwardRef((r,o)=>{let{progress:n,children:u,label:c="Loading...",...d}=r;return external_React_namespaceObject.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div,{ref:o,...d,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":c},F(r,f=>external_React_namespaceObject.createElement("div",{"aria-hidden":!0},f)))}),He=Object.assign(me,{List:Se,Item:be,Input:Ee,Group:he,Separator:ye,Dialog:Ce,Empty:xe,Loading:Pe});function we(r,o){let n=r.nextElementSibling;for(;n;){if(n.matches(o))return n;n=n.nextElementSibling}}function Ie(r,o){let n=r.previousElementSibling;for(;n;){if(n.matches(o))return n;n=n.previousElementSibling}}function pe(r){let o=external_React_namespaceObject.useRef(r);return T(()=>{o.current=r}),o}var T=typeof window=="undefined"?external_React_namespaceObject.useEffect:external_React_namespaceObject.useLayoutEffect;function dist_k(r){let o=external_React_namespaceObject.useRef();return o.current===void 0&&(o.current=r()),o}function N(r){return o=>{r.forEach(n=>{typeof n=="function"?n(o):n!=null&&(n.current=o)})}}function dist_D(r){let o=Z(),n=()=>r(o.snapshot());return external_React_namespaceObject.useSyncExternalStore(o.subscribe,n,n)}function ve(r,o,n,u=[]){let c=external_React_namespaceObject.useRef(),d=dist_G();return T(()=>{var v;let f=(()=>{var b;for(let l of n){if(typeof l=="string")return l.trim();if(typeof l=="object"&&"current"in l)return l.current?(b=l.current.textContent)==null?void 0:b.trim():c.current}})(),p=u.map(b=>b.trim());d.value(r,f,p),(v=o.current)==null||v.setAttribute(M,f),c.current=f}),c}var Me=()=>{let[r,o]=external_React_namespaceObject.useState(),n=dist_k(()=>new Map);return T(()=>{n.current.forEach(u=>u()),n.current=new Map},[r]),(u,c)=>{n.current.set(u,c),o({})}};function Te(r){let o=r.type;return typeof o=="function"?o(r.props):"render"in o?o.render(r.props):r}function F({asChild:r,children:o},n){return r&&external_React_namespaceObject.isValidElement(o)?external_React_namespaceObject.cloneElement(Te(o),{ref:o.ref},n(o.props.children)):n(o)}var De={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"}; ;// ./node_modules/clsx/dist/clsx.mjs function 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=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=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// external ["wp","keyboardShortcuts"] const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; ;// ./node_modules/@wordpress/icons/build-module/icon/index.js var icon_default = (0,external_wp_element_namespaceObject.forwardRef)( ({ icon, size = 24, ...props }, ref) => { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { width: size, height: size, ...props, ref }); } ); ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// ./node_modules/@wordpress/icons/build-module/library/search.js var search_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) }); ;// ./node_modules/@wordpress/commands/build-module/store/reducer.js function commands(state = {}, action) { switch (action.type) { case "REGISTER_COMMAND": return { ...state, [action.name]: { name: action.name, label: action.label, searchLabel: action.searchLabel, context: action.context, callback: action.callback, icon: action.icon, keywords: action.keywords } }; case "UNREGISTER_COMMAND": { const { [action.name]: _, ...remainingState } = state; return remainingState; } } return state; } function commandLoaders(state = {}, action) { switch (action.type) { case "REGISTER_COMMAND_LOADER": return { ...state, [action.name]: { name: action.name, context: action.context, hook: action.hook } }; case "UNREGISTER_COMMAND_LOADER": { const { [action.name]: _, ...remainingState } = state; return remainingState; } } return state; } function isOpen(state = false, action) { switch (action.type) { case "OPEN": return true; case "CLOSE": return false; } return state; } function context(state = "root", action) { switch (action.type) { case "SET_CONTEXT": return action.context; } return state; } const reducer = (0,external_wp_data_namespaceObject.combineReducers)({ commands, commandLoaders, isOpen, context }); var reducer_default = reducer; ;// ./node_modules/@wordpress/commands/build-module/store/actions.js function registerCommand(config) { return { type: "REGISTER_COMMAND", ...config }; } function unregisterCommand(name) { return { type: "UNREGISTER_COMMAND", name }; } function registerCommandLoader(config) { return { type: "REGISTER_COMMAND_LOADER", ...config }; } function unregisterCommandLoader(name) { return { type: "UNREGISTER_COMMAND_LOADER", name }; } function actions_open() { return { type: "OPEN" }; } function actions_close() { return { type: "CLOSE" }; } ;// ./node_modules/@wordpress/commands/build-module/store/selectors.js const getCommands = (0,external_wp_data_namespaceObject.createSelector)( (state, contextual = false) => Object.values(state.commands).filter((command) => { const isContextual = command.context && command.context === state.context; return contextual ? isContextual : !isContextual; }), (state) => [state.commands, state.context] ); const getCommandLoaders = (0,external_wp_data_namespaceObject.createSelector)( (state, contextual = false) => Object.values(state.commandLoaders).filter((loader) => { const isContextual = loader.context && loader.context === state.context; return contextual ? isContextual : !isContextual; }), (state) => [state.commandLoaders, state.context] ); function selectors_isOpen(state) { return state.isOpen; } function getContext(state) { return state.context; } ;// ./node_modules/@wordpress/commands/build-module/store/private-actions.js function setContext(context) { return { type: "SET_CONTEXT", context }; } ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/commands/build-module/lock-unlock.js const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/commands" ); ;// ./node_modules/@wordpress/commands/build-module/store/index.js const STORE_NAME = "core/commands"; const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { reducer: reducer_default, actions: actions_namespaceObject, selectors: selectors_namespaceObject }); (0,external_wp_data_namespaceObject.register)(store); unlock(store).registerPrivateActions(private_actions_namespaceObject); ;// ./node_modules/@wordpress/commands/build-module/components/command-menu.js const inputLabel = (0,external_wp_i18n_namespaceObject.__)("Search commands and settings"); function CommandMenuLoader({ name, search, hook, setLoader, close }) { const { isLoading, commands = [] } = hook({ search }) ?? {}; (0,external_wp_element_namespaceObject.useEffect)(() => { setLoader(name, isLoading); }, [setLoader, name, isLoading]); if (!commands.length) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: commands.map((command) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( He.Item, { value: command.searchLabel ?? command.label, keywords: command.keywords, onSelect: () => command.callback({ close }), id: command.name, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", className: dist_clsx("commands-command-menu__item", { "has-icon": command.icon }), children: [ command.icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: command.icon }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextHighlight, { text: command.label, highlight: search } ) }) ] } ) }, command.name )) }); } function CommandMenuLoaderWrapper({ hook, search, setLoader, close }) { const currentLoaderRef = (0,external_wp_element_namespaceObject.useRef)(hook); const [key, setKey] = (0,external_wp_element_namespaceObject.useState)(0); (0,external_wp_element_namespaceObject.useEffect)(() => { if (currentLoaderRef.current !== hook) { currentLoaderRef.current = hook; setKey((prevKey) => prevKey + 1); } }, [hook]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CommandMenuLoader, { hook: currentLoaderRef.current, search, setLoader, close }, key ); } function CommandMenuGroup({ isContextual, search, setLoader, close }) { const { commands, loaders } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getCommands, getCommandLoaders } = select(store); return { commands: getCommands(isContextual), loaders: getCommandLoaders(isContextual) }; }, [isContextual] ); if (!commands.length && !loaders.length) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(He.Group, { children: [ commands.map((command) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( He.Item, { value: command.searchLabel ?? command.label, keywords: command.keywords, onSelect: () => command.callback({ close }), id: command.name, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", className: dist_clsx("commands-command-menu__item", { "has-icon": command.icon }), children: [ command.icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: command.icon }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextHighlight, { text: command.label, highlight: search } ) }) ] } ) }, command.name )), loaders.map((loader) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CommandMenuLoaderWrapper, { hook: loader.hook, search, setLoader, close }, loader.name )) ] }); } function CommandInput({ isOpen, search, setSearch }) { const commandMenuInput = (0,external_wp_element_namespaceObject.useRef)(); const _value = dist_D((state) => state.value); const selectedItemId = (0,external_wp_element_namespaceObject.useMemo)(() => { const item = document.querySelector( `[cmdk-item=""][data-value="${_value}"]` ); return item?.getAttribute("id"); }, [_value]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isOpen) { commandMenuInput.current.focus(); } }, [isOpen]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( He.Input, { ref: commandMenuInput, value: search, onValueChange: setSearch, placeholder: inputLabel, "aria-activedescendant": selectedItemId, icon: search } ); } function CommandMenu() { const { registerShortcut } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(""); const isOpen = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).isOpen(), [] ); const { open, close } = (0,external_wp_data_namespaceObject.useDispatch)(store); const [loaders, setLoaders] = (0,external_wp_element_namespaceObject.useState)({}); (0,external_wp_element_namespaceObject.useEffect)(() => { registerShortcut({ name: "core/commands", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Open the command palette."), keyCombination: { modifier: "primary", character: "k" } }); }, [registerShortcut]); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)( "core/commands", /** @type {import('react').KeyboardEventHandler} */ (event) => { if (event.defaultPrevented) { return; } event.preventDefault(); if (isOpen) { close(); } else { open(); } }, { bindGlobal: true } ); const setLoader = (0,external_wp_element_namespaceObject.useCallback)( (name, value) => setLoaders((current) => ({ ...current, [name]: value })), [] ); const closeAndReset = () => { setSearch(""); close(); }; if (!isOpen) { return false; } const onKeyDown = (event) => { if ( // Ignore keydowns from IMEs event.nativeEvent.isComposing || // Workaround for Mac Safari where the final Enter/Backspace of an IME composition // is `isComposing=false`, even though it's technically still part of the composition. // These can only be detected by keyCode. event.keyCode === 229 ) { event.preventDefault(); } }; const isLoading = Object.values(loaders).some(Boolean); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { className: "commands-command-menu", overlayClassName: "commands-command-menu__overlay", onRequestClose: closeAndReset, __experimentalHideHeader: true, contentLabel: (0,external_wp_i18n_namespaceObject.__)("Command palette"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "commands-command-menu__container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(He, { label: inputLabel, onKeyDown, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "commands-command-menu__header", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( icon_default, { className: "commands-command-menu__header-search-icon", icon: search_default } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CommandInput, { search, setSearch, isOpen } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(He.List, { label: (0,external_wp_i18n_namespaceObject.__)("Command suggestions"), children: [ search && !isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(He.Empty, { children: (0,external_wp_i18n_namespaceObject.__)("No results found.") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CommandMenuGroup, { search, setLoader, close: closeAndReset, isContextual: true } ), search && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CommandMenuGroup, { search, setLoader, close: closeAndReset } ) ] }) ] }) }) } ); } ;// ./node_modules/@wordpress/commands/build-module/hooks/use-command-context.js function useCommandContext(context) { const { getContext } = (0,external_wp_data_namespaceObject.useSelect)(store); const initialContext = (0,external_wp_element_namespaceObject.useRef)(getContext()); const { setContext } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); (0,external_wp_element_namespaceObject.useEffect)(() => { setContext(context); }, [context, setContext]); (0,external_wp_element_namespaceObject.useEffect)(() => { const initialContextRef = initialContext.current; return () => setContext(initialContextRef); }, [setContext]); } ;// ./node_modules/@wordpress/commands/build-module/private-apis.js const privateApis = {}; lock(privateApis, { useCommandContext: useCommandContext }); ;// ./node_modules/@wordpress/commands/build-module/hooks/use-command.js function useCommand(command) { const { registerCommand, unregisterCommand } = (0,external_wp_data_namespaceObject.useDispatch)(store); const currentCallbackRef = (0,external_wp_element_namespaceObject.useRef)(command.callback); (0,external_wp_element_namespaceObject.useEffect)(() => { currentCallbackRef.current = command.callback; }, [command.callback]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (command.disabled) { return; } registerCommand({ name: command.name, context: command.context, label: command.label, searchLabel: command.searchLabel, icon: command.icon, keywords: command.keywords, callback: (...args) => currentCallbackRef.current(...args) }); return () => { unregisterCommand(command.name); }; }, [ command.name, command.label, command.searchLabel, command.icon, command.context, command.keywords, command.disabled, registerCommand, unregisterCommand ]); } function useCommands(commands) { const { registerCommand, unregisterCommand } = (0,external_wp_data_namespaceObject.useDispatch)(store); const currentCallbacksRef = (0,external_wp_element_namespaceObject.useRef)({}); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!commands) { return; } commands.forEach((command) => { if (command.callback) { currentCallbacksRef.current[command.name] = command.callback; } }); }, [commands]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!commands) { return; } commands.forEach((command) => { if (command.disabled) { return; } registerCommand({ name: command.name, context: command.context, label: command.label, searchLabel: command.searchLabel, icon: command.icon, keywords: command.keywords, callback: (...args) => { const callback = currentCallbacksRef.current[command.name]; if (callback) { callback(...args); } } }); }); return () => { commands.forEach((command) => { unregisterCommand(command.name); }); }; }, [commands, registerCommand, unregisterCommand]); } ;// ./node_modules/@wordpress/commands/build-module/hooks/use-command-loader.js function useCommandLoader(loader) { const { registerCommandLoader, unregisterCommandLoader } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (loader.disabled) { return; } registerCommandLoader({ name: loader.name, hook: loader.hook, context: loader.context }); return () => { unregisterCommandLoader(loader.name); }; }, [ loader.name, loader.hook, loader.context, loader.disabled, registerCommandLoader, unregisterCommandLoader ]); } ;// ./node_modules/@wordpress/commands/build-module/index.js (window.wp = window.wp || {}).commands = __webpack_exports__; /******/ })() ; warning.min.js 0000644 00000000457 15151622574 0007347 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{default:()=>o});function o(e){}(window.wp=window.wp||{}).warning=t.default})(); commands.min.js 0000644 00000141411 15151622574 0007477 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e,t,n={},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var a=r[e]={exports:{}};return n[e](a,a.exports,o),a.exports}t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var a=Object.create(null);o.r(a);var c={};e=e||[null,t({}),t([]),t(t)];for(var u=2&r&&n;"object"==typeof u&&!~e.indexOf(u);u=t(u))Object.getOwnPropertyNames(u).forEach((e=>c[e]=()=>n[e]));return c.default=()=>n,o.d(a,c),a},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nc=void 0;var a={};o.r(a),o.d(a,{CommandMenu:()=>Vn,privateApis:()=>qn,store:()=>Fn,useCommand:()=>zn,useCommandLoader:()=>Hn,useCommands:()=>Gn});var c={};o.r(c),o.d(c,{close:()=>Nn,open:()=>An,registerCommand:()=>xn,registerCommandLoader:()=>On,unregisterCommand:()=>kn,unregisterCommandLoader:()=>Rn});var u={};o.r(u),o.d(u,{getCommandLoaders:()=>Mn,getCommands:()=>Ln,getContext:()=>Tn,isOpen:()=>_n});var i={};o.r(i),o.d(i,{setContext:()=>Dn});const l=window.ReactJSXRuntime;var s=.999,d=/[\\\/_+.#"@\[\(\{&]/,f=/[\\\/_+.#"@\[\(\{&]/g,m=/[\s-]/,v=/[\s-]/g;function p(e,t,n,r,o,a,c){if(a===t.length)return o===e.length?1:.99;var u=`${o},${a}`;if(void 0!==c[u])return c[u];for(var i,l,h,g,b=r.charAt(a),E=n.indexOf(b,o),y=0;E>=0;)(i=p(e,t,n,r,E+1,a+1,c))>y&&(E===o?i*=1:d.test(e.charAt(E-1))?(i*=.8,(h=e.slice(o,E-1).match(f))&&o>0&&(i*=Math.pow(s,h.length))):m.test(e.charAt(E-1))?(i*=.9,(g=e.slice(o,E-1).match(v))&&o>0&&(i*=Math.pow(s,g.length))):(i*=.17,o>0&&(i*=Math.pow(s,E-o))),e.charAt(E)!==t.charAt(a)&&(i*=.9999)),(i<.1&&n.charAt(E-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(E-1)!==r.charAt(a))&&(.1*(l=p(e,t,n,r,E+1,a+2,c))>i&&(i=.1*l)),i>y&&(y=i),E=n.indexOf(b,E+1);return c[u]=y,y}function h(e){return e.toLowerCase().replace(v," ")}function g(e,t,n){return p(e=n&&n.length>0?""+(e+" "+n.join(" ")):e,t,h(e),h(t),0,0,{})}function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},b.apply(null,arguments)}const E=window.React;var y=o.t(E,2);function w(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(null==e||e(r),!1===n||!r.defaultPrevented)return null==t?void 0:t(r)}}function C(...e){return t=>e.forEach((e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t)))}function S(...e){return(0,E.useCallback)(C(...e),e)}function x(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return(0,E.useMemo)((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}const k=Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)?E.useLayoutEffect:()=>{},O=y["useId".toString()]||(()=>{});let R=0;function A(e){const[t,n]=E.useState(O());return k((()=>{e||n((e=>null!=e?e:String(R++)))}),[e]),e||(t?`radix-${t}`:"")}function N(e){const t=(0,E.useRef)(e);return(0,E.useEffect)((()=>{t.current=e})),(0,E.useMemo)((()=>(...e)=>{var n;return null===(n=t.current)||void 0===n?void 0:n.call(t,...e)}),[])}function L({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=function({defaultProp:e,onChange:t}){const n=(0,E.useState)(e),[r]=n,o=(0,E.useRef)(r),a=N(t);return(0,E.useEffect)((()=>{o.current!==r&&(a(r),o.current=r)}),[r,o,a]),n}({defaultProp:t,onChange:n}),a=void 0!==e,c=a?e:r,u=N(n);return[c,(0,E.useCallback)((t=>{if(a){const n="function"==typeof t?t(e):t;n!==e&&u(n)}else o(t)}),[a,e,o,u])]}const M=window.ReactDOM,_=(0,E.forwardRef)(((e,t)=>{const{children:n,...r}=e,o=E.Children.toArray(n),a=o.find(P);if(a){const e=a.props.children,n=o.map((t=>t===a?E.Children.count(e)>1?E.Children.only(null):(0,E.isValidElement)(e)?e.props.children:null:t));return(0,E.createElement)(T,b({},r,{ref:t}),(0,E.isValidElement)(e)?(0,E.cloneElement)(e,void 0,n):null)}return(0,E.createElement)(T,b({},r,{ref:t}),n)}));_.displayName="Slot";const T=(0,E.forwardRef)(((e,t)=>{const{children:n,...r}=e;return(0,E.isValidElement)(n)?(0,E.cloneElement)(n,{...I(r,n.props),ref:t?C(t,n.ref):n.ref}):E.Children.count(n)>1?E.Children.only(null):null}));T.displayName="SlotClone";const D=({children:e})=>(0,E.createElement)(E.Fragment,null,e);function P(e){return(0,E.isValidElement)(e)&&e.type===D}function I(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{a(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}const j=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((e,t)=>{const n=(0,E.forwardRef)(((e,n)=>{const{asChild:r,...o}=e,a=r?_:t;return(0,E.useEffect)((()=>{window[Symbol.for("radix-ui")]=!0}),[]),(0,E.createElement)(a,b({},o,{ref:n}))}));return n.displayName=`Primitive.${t}`,{...e,[t]:n}}),{});const F="dismissableLayer.update",W="dismissableLayer.pointerDownOutside",U="dismissableLayer.focusOutside";let $;const B=(0,E.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),K=(0,E.forwardRef)(((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:c,onInteractOutside:u,onDismiss:i,...l}=e,s=(0,E.useContext)(B),[d,f]=(0,E.useState)(null),m=null!==(n=null==d?void 0:d.ownerDocument)&&void 0!==n?n:null===globalThis||void 0===globalThis?void 0:globalThis.document,[,v]=(0,E.useState)({}),p=S(t,(e=>f(e))),h=Array.from(s.layers),[g]=[...s.layersWithOutsidePointerEventsDisabled].slice(-1),y=h.indexOf(g),C=d?h.indexOf(d):-1,x=s.layersWithOutsidePointerEventsDisabled.size>0,k=C>=y,O=function(e,t=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const n=N(e),r=(0,E.useRef)(!1),o=(0,E.useRef)((()=>{}));return(0,E.useEffect)((()=>{const e=e=>{if(e.target&&!r.current){const a={originalEvent:e};function c(){q(W,n,a,{discrete:!0})}"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}}),[t,n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...s.branches].some((e=>e.contains(t)));k&&!n&&(null==a||a(e),null==u||u(e),e.defaultPrevented||null==i||i())}),m),R=function(e,t=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const n=N(e),r=(0,E.useRef)(!1);return(0,E.useEffect)((()=>{const e=e=>{if(e.target&&!r.current){q(U,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...s.branches].some((e=>e.contains(t)))||(null==c||c(e),null==u||u(e),e.defaultPrevented||null==i||i())}),m);return function(e,t=(null===globalThis||void 0===globalThis?void 0:globalThis.document)){const n=N(e);(0,E.useEffect)((()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e),()=>t.removeEventListener("keydown",e)}),[n,t])}((e=>{C===s.layers.size-1&&(null==o||o(e),!e.defaultPrevented&&i&&(e.preventDefault(),i()))}),m),(0,E.useEffect)((()=>{if(d)return r&&(0===s.layersWithOutsidePointerEventsDisabled.size&&($=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),s.layersWithOutsidePointerEventsDisabled.add(d)),s.layers.add(d),V(),()=>{r&&1===s.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=$)}}),[d,m,r,s]),(0,E.useEffect)((()=>()=>{d&&(s.layers.delete(d),s.layersWithOutsidePointerEventsDisabled.delete(d),V())}),[d,s]),(0,E.useEffect)((()=>{const e=()=>v({});return document.addEventListener(F,e),()=>document.removeEventListener(F,e)}),[]),(0,E.createElement)(j.div,b({},l,{ref:p,style:{pointerEvents:x?k?"auto":"none":void 0,...e.style},onFocusCapture:w(e.onFocusCapture,R.onFocusCapture),onBlurCapture:w(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:w(e.onPointerDownCapture,O.onPointerDownCapture)}))}));function V(){const e=new CustomEvent(F);document.dispatchEvent(e)}function q(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&(0,M.flushSync)((()=>e.dispatchEvent(t)))}(o,a):o.dispatchEvent(a)}const z="focusScope.autoFocusOnMount",G="focusScope.autoFocusOnUnmount",H={bubbles:!1,cancelable:!0},X=(0,E.forwardRef)(((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...c}=e,[u,i]=(0,E.useState)(null),l=N(o),s=N(a),d=(0,E.useRef)(null),f=S(t,(e=>i(e))),m=(0,E.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,E.useEffect)((()=>{if(r){function e(e){if(m.paused||!u)return;const t=e.target;u.contains(t)?d.current=t:Q(d.current,{select:!0})}function t(e){if(m.paused||!u)return;const t=e.relatedTarget;null!==t&&(u.contains(t)||Q(d.current,{select:!0}))}function n(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Q(u)}document.addEventListener("focusin",e),document.addEventListener("focusout",t);const o=new MutationObserver(n);return u&&o.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),o.disconnect()}}}),[r,u,m.paused]),(0,E.useEffect)((()=>{if(u){ee.add(m);const t=document.activeElement;if(!u.contains(t)){const n=new CustomEvent(z,H);u.addEventListener(z,l),u.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Q(r,{select:t}),document.activeElement!==n)return}((e=Y(u),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&Q(u))}return()=>{u.removeEventListener(z,l),setTimeout((()=>{const e=new CustomEvent(G,H);u.addEventListener(G,s),u.dispatchEvent(e),e.defaultPrevented||Q(null!=t?t:document.body,{select:!0}),u.removeEventListener(G,s),ee.remove(m)}),0)}}var e}),[u,l,s,m]);const v=(0,E.useCallback)((e=>{if(!n&&!r)return;if(m.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,o=document.activeElement;if(t&&o){const t=e.currentTarget,[r,a]=function(e){const t=Y(e),n=Z(t,e),r=Z(t.reverse(),e);return[n,r]}(t);r&&a?e.shiftKey||o!==a?e.shiftKey&&o===r&&(e.preventDefault(),n&&Q(a,{select:!0})):(e.preventDefault(),n&&Q(r,{select:!0})):o===t&&e.preventDefault()}}),[n,r,m.paused]);return(0,E.createElement)(j.div,b({tabIndex:-1},c,{ref:f,onKeyDown:v}))}));function Y(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Z(e,t){for(const n of e)if(!J(n,{upTo:t}))return n}function J(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Q(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}const ee=function(){let e=[];return{add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=te(e,t),e.unshift(t)},remove(t){var n;e=te(e,t),null===(n=e[0])||void 0===n||n.resume()}}}();function te(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}const ne=(0,E.forwardRef)(((e,t)=>{var n;const{container:r=(null===globalThis||void 0===globalThis||null===(n=globalThis.document)||void 0===n?void 0:n.body),...o}=e;return r?M.createPortal((0,E.createElement)(j.div,b({},o,{ref:t})),r):null}));const re=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=(0,E.useState)(),r=(0,E.useRef)({}),o=(0,E.useRef)(e),a=(0,E.useRef)("none"),c=e?"mounted":"unmounted",[u,i]=function(e,t){return(0,E.useReducer)(((e,n)=>{const r=t[e][n];return null!=r?r:e}),e)}(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,E.useEffect)((()=>{const e=oe(r.current);a.current="mounted"===u?e:"none"}),[u]),k((()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,c=oe(t);if(e)i("MOUNT");else if("none"===c||"none"===(null==t?void 0:t.display))i("UNMOUNT");else{i(n&&r!==c?"ANIMATION_OUT":"UNMOUNT")}o.current=e}}),[e,i]),k((()=>{if(t){const e=e=>{const n=oe(r.current).includes(e.animationName);e.target===t&&n&&(0,M.flushSync)((()=>i("ANIMATION_END")))},n=e=>{e.target===t&&(a.current=oe(r.current))};return t.addEventListener("animationstart",n),t.addEventListener("animationcancel",e),t.addEventListener("animationend",e),()=>{t.removeEventListener("animationstart",n),t.removeEventListener("animationcancel",e),t.removeEventListener("animationend",e)}}i("ANIMATION_END")}),[t,i]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:(0,E.useCallback)((e=>{e&&(r.current=getComputedStyle(e)),n(e)}),[])}}(t),o="function"==typeof n?n({present:r.isPresent}):E.Children.only(n),a=S(r.ref,o.ref);return"function"==typeof n||r.isPresent?(0,E.cloneElement)(o,{ref:a}):null};function oe(e){return(null==e?void 0:e.animationName)||"none"}re.displayName="Presence";let ae=0;function ce(){(0,E.useEffect)((()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",null!==(e=n[0])&&void 0!==e?e:ue()),document.body.insertAdjacentElement("beforeend",null!==(t=n[1])&&void 0!==t?t:ue()),ae++,()=>{1===ae&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),ae--}}),[])}function ue(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var ie=function(){return ie=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ie.apply(this,arguments)};function le(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}Object.create;function se(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}Object.create;"function"==typeof SuppressedError&&SuppressedError;var de="right-scroll-bar-position",fe="width-before-scroll-bar";function me(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var ve="undefined"!=typeof window?E.useLayoutEffect:E.useEffect,pe=new WeakMap;function he(e,t){var n,r,o,a=(n=t||null,r=function(t){return e.forEach((function(e){return me(e,t)}))},(o=(0,E.useState)((function(){return{value:n,callback:r,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}}))[0]).callback=r,o.facade);return ve((function(){var t=pe.get(a);if(t){var n=new Set(t),r=new Set(e),o=a.current;n.forEach((function(e){r.has(e)||me(e,null)})),r.forEach((function(e){n.has(e)||me(e,o)}))}pe.set(a,e)}),[e]),a}function ge(e){return e}function be(e,t){void 0===t&&(t=ge);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var o=t(e,r);return n.push(o),function(){n=n.filter((function(e){return e!==o}))}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var o=n;n=[],o.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},c=function(){return Promise.resolve().then(a)};c(),n={push:function(e){t.push(e),c()},filter:function(e){return t=t.filter(e),n}}}}}var Ee=function(e){void 0===e&&(e={});var t=be(null);return t.options=ie({async:!0,ssr:!1},e),t}(),ye=function(){},we=E.forwardRef((function(e,t){var n=E.useRef(null),r=E.useState({onScrollCapture:ye,onWheelCapture:ye,onTouchMoveCapture:ye}),o=r[0],a=r[1],c=e.forwardProps,u=e.children,i=e.className,l=e.removeScrollBar,s=e.enabled,d=e.shards,f=e.sideCar,m=e.noIsolation,v=e.inert,p=e.allowPinchZoom,h=e.as,g=void 0===h?"div":h,b=le(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),y=f,w=he([n,t]),C=ie(ie({},b),o);return E.createElement(E.Fragment,null,s&&E.createElement(y,{sideCar:Ee,removeScrollBar:l,shards:d,noIsolation:m,inert:v,setCallbacks:a,allowPinchZoom:!!p,lockRef:n}),c?E.cloneElement(E.Children.only(u),ie(ie({},C),{ref:w})):E.createElement(g,ie({},C,{className:i,ref:w}),u))}));we.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},we.classNames={fullWidth:fe,zeroRight:de};var Ce,Se=function(e){var t=e.sideCar,n=le(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return E.createElement(r,ie({},n))};Se.isSideCarExport=!0;function xe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Ce||o.nc;return t&&e.setAttribute("nonce",t),e}var ke=function(){var e=0,t=null;return{add:function(n){var r,o;0==e&&(t=xe())&&(o=n,(r=t).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Oe=function(){var e,t=(e=ke(),function(t,n){E.useEffect((function(){return e.add(t),function(){e.remove()}}),[t&&n])});return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}},Re={left:0,top:0,right:0,gap:0},Ae=function(e){return parseInt(e||"",10)||0},Ne=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Re;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[Ae(n),Ae(r),Ae(o)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Le=Oe(),Me="data-scroll-locked",_e=function(e,t,n,r){var o=e.left,a=e.top,c=e.right,u=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(u,"px ").concat(r,";\n }\n body[").concat(Me,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(a,"px;\n padding-right: ").concat(c,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(u,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(de," {\n right: ").concat(u,"px ").concat(r,";\n }\n \n .").concat(fe," {\n margin-right: ").concat(u,"px ").concat(r,";\n }\n \n .").concat(de," .").concat(de," {\n right: 0 ").concat(r,";\n }\n \n .").concat(fe," .").concat(fe," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(Me,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(u,"px;\n }\n")},Te=function(){var e=parseInt(document.body.getAttribute(Me)||"0",10);return isFinite(e)?e:0},De=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r;E.useEffect((function(){return document.body.setAttribute(Me,(Te()+1).toString()),function(){var e=Te()-1;e<=0?document.body.removeAttribute(Me):document.body.setAttribute(Me,e.toString())}}),[]);var a=E.useMemo((function(){return Ne(o)}),[o]);return E.createElement(Le,{styles:_e(a,!t,o,n?"":"!important")})},Pe=!1;if("undefined"!=typeof window)try{var Ie=Object.defineProperty({},"passive",{get:function(){return Pe=!0,!0}});window.addEventListener("test",Ie,Ie),window.removeEventListener("test",Ie,Ie)}catch(e){Pe=!1}var je=!!Pe&&{passive:!1},Fe=function(e,t){var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},We=function(e,t){var n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),Ue(e,n)){var r=$e(e,n);if(r[1]>r[2])return!0}n=n.parentNode}while(n&&n!==document.body);return!1},Ue=function(e,t){return"v"===e?function(e){return Fe(e,"overflowY")}(t):function(e){return Fe(e,"overflowX")}(t)},$e=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},Be=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ke=function(e){return[e.deltaX,e.deltaY]},Ve=function(e){return e&&"current"in e?e.current:e},qe=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},ze=0,Ge=[];const He=(Xe=function(e){var t=E.useRef([]),n=E.useRef([0,0]),r=E.useRef(),o=E.useState(ze++)[0],a=E.useState((function(){return Oe()}))[0],c=E.useRef(e);E.useEffect((function(){c.current=e}),[e]),E.useEffect((function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=se([e.lockRef.current],(e.shards||[]).map(Ve),!0).filter(Boolean);return t.forEach((function(e){return e.classList.add("allow-interactivity-".concat(o))})),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach((function(e){return e.classList.remove("allow-interactivity-".concat(o))}))}}}),[e.inert,e.lockRef.current,e.shards]);var u=E.useCallback((function(e,t){if("touches"in e&&2===e.touches.length)return!c.current.allowPinchZoom;var o,a=Be(e),u=n.current,i="deltaX"in e?e.deltaX:u[0]-a[0],l="deltaY"in e?e.deltaY:u[1]-a[1],s=e.target,d=Math.abs(i)>Math.abs(l)?"h":"v";if("touches"in e&&"h"===d&&"range"===s.type)return!1;var f=We(d,s);if(!f)return!0;if(f?o=d:(o="v"===d?"h":"v",f=We(d,s)),!f)return!1;if(!r.current&&"changedTouches"in e&&(i||l)&&(r.current=o),!o)return!0;var m=r.current||o;return function(e,t,n,r,o){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),c=a*r,u=n.target,i=t.contains(u),l=!1,s=c>0,d=0,f=0;do{var m=$e(e,u),v=m[0],p=m[1]-m[2]-a*v;(v||p)&&Ue(e,u)&&(d+=p,f+=v),u=u.parentNode}while(!i&&u!==document.body||i&&(t.contains(u)||t===u));return(s&&(o&&0===d||!o&&c>d)||!s&&(o&&0===f||!o&&-c>f))&&(l=!0),l}(m,t,e,"h"===m?i:l,!0)}),[]),i=E.useCallback((function(e){var n=e;if(Ge.length&&Ge[Ge.length-1]===a){var r="deltaY"in n?Ke(n):Be(n),o=t.current.filter((function(e){return e.name===n.type&&e.target===n.target&&(t=e.delta,o=r,t[0]===o[0]&&t[1]===o[1]);var t,o}))[0];if(o&&o.should)n.cancelable&&n.preventDefault();else if(!o){var i=(c.current.shards||[]).map(Ve).filter(Boolean).filter((function(e){return e.contains(n.target)}));(i.length>0?u(n,i[0]):!c.current.noIsolation)&&n.cancelable&&n.preventDefault()}}}),[]),l=E.useCallback((function(e,n,r,o){var a={name:e,delta:n,target:r,should:o};t.current.push(a),setTimeout((function(){t.current=t.current.filter((function(e){return e!==a}))}),1)}),[]),s=E.useCallback((function(e){n.current=Be(e),r.current=void 0}),[]),d=E.useCallback((function(t){l(t.type,Ke(t),t.target,u(t,e.lockRef.current))}),[]),f=E.useCallback((function(t){l(t.type,Be(t),t.target,u(t,e.lockRef.current))}),[]);E.useEffect((function(){return Ge.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",i,je),document.addEventListener("touchmove",i,je),document.addEventListener("touchstart",s,je),function(){Ge=Ge.filter((function(e){return e!==a})),document.removeEventListener("wheel",i,je),document.removeEventListener("touchmove",i,je),document.removeEventListener("touchstart",s,je)}}),[]);var m=e.removeScrollBar,v=e.inert;return E.createElement(E.Fragment,null,v?E.createElement(a,{styles:qe(o)}):null,m?E.createElement(De,{gapMode:"margin"}):null)},Ee.useMedium(Xe),Se);var Xe,Ye=E.forwardRef((function(e,t){return E.createElement(we,ie({},e,{ref:t,sideCar:He}))}));Ye.classNames=we.classNames;const Ze=Ye;var Je=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Qe=new WeakMap,et=new WeakMap,tt={},nt=0,rt=function(e){return e&&(e.host||rt(e.parentNode))},ot=function(e,t,n,r){var o=function(e,t){return t.map((function(t){if(e.contains(t))return t;var n=rt(t);return n&&e.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)})).filter((function(e){return Boolean(e)}))}(t,Array.isArray(e)?e:[e]);tt[n]||(tt[n]=new WeakMap);var a=tt[n],c=[],u=new Set,i=new Set(o),l=function(e){e&&!u.has(e)&&(u.add(e),l(e.parentNode))};o.forEach(l);var s=function(e){e&&!i.has(e)&&Array.prototype.forEach.call(e.children,(function(e){if(u.has(e))s(e);else try{var t=e.getAttribute(r),o=null!==t&&"false"!==t,i=(Qe.get(e)||0)+1,l=(a.get(e)||0)+1;Qe.set(e,i),a.set(e,l),c.push(e),1===i&&o&&et.set(e,!0),1===l&&e.setAttribute(n,"true"),o||e.setAttribute(r,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}}))};return s(t),u.clear(),nt++,function(){c.forEach((function(e){var t=Qe.get(e)-1,o=a.get(e)-1;Qe.set(e,t),a.set(e,o),t||(et.has(e)||e.removeAttribute(r),et.delete(e)),o||e.removeAttribute(n)})),--nt||(Qe=new WeakMap,Qe=new WeakMap,et=new WeakMap,tt={})}},at=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||Je(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),ot(r,o,n,"aria-hidden")):function(){return null}};const ct="Dialog",[ut,it]=function(e,t=[]){let n=[];const r=()=>{const t=n.map((e=>(0,E.createContext)(e)));return function(n){const r=(null==n?void 0:n[e])||t;return(0,E.useMemo)((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return r.scopeName=e,[function(t,r){const o=(0,E.createContext)(r),a=n.length;function c(t){const{scope:n,children:r,...c}=t,u=(null==n?void 0:n[e][a])||o,i=(0,E.useMemo)((()=>c),Object.values(c));return(0,E.createElement)(u.Provider,{value:i},r)}return n=[...n,r],c.displayName=t+"Provider",[c,function(n,c){const u=(null==c?void 0:c[e][a])||o,i=(0,E.useContext)(u);if(i)return i;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},x(r,...t)]}(ct),[lt,st]=ut(ct),dt=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:c=!0}=e,u=(0,E.useRef)(null),i=(0,E.useRef)(null),[l=!1,s]=L({prop:r,defaultProp:o,onChange:a});return(0,E.createElement)(lt,{scope:t,triggerRef:u,contentRef:i,contentId:A(),titleId:A(),descriptionId:A(),open:l,onOpenChange:s,onOpenToggle:(0,E.useCallback)((()=>s((e=>!e))),[s]),modal:c},n)},ft="DialogPortal",[mt,vt]=ut(ft,{forceMount:void 0}),pt=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=st(ft,t);return(0,E.createElement)(mt,{scope:t,forceMount:n},E.Children.map(r,(e=>(0,E.createElement)(re,{present:n||a.open},(0,E.createElement)(ne,{asChild:!0,container:o},e)))))},ht="DialogOverlay",gt=(0,E.forwardRef)(((e,t)=>{const n=vt(ht,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=st(ht,e.__scopeDialog);return a.modal?(0,E.createElement)(re,{present:r||a.open},(0,E.createElement)(bt,b({},o,{ref:t}))):null})),bt=(0,E.forwardRef)(((e,t)=>{const{__scopeDialog:n,...r}=e,o=st(ht,n);return(0,E.createElement)(Ze,{as:_,allowPinchZoom:!0,shards:[o.contentRef]},(0,E.createElement)(j.div,b({"data-state":kt(o.open)},r,{ref:t,style:{pointerEvents:"auto",...r.style}})))})),Et="DialogContent",yt=(0,E.forwardRef)(((e,t)=>{const n=vt(Et,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=st(Et,e.__scopeDialog);return(0,E.createElement)(re,{present:r||a.open},a.modal?(0,E.createElement)(wt,b({},o,{ref:t})):(0,E.createElement)(Ct,b({},o,{ref:t})))})),wt=(0,E.forwardRef)(((e,t)=>{const n=st(Et,e.__scopeDialog),r=(0,E.useRef)(null),o=S(t,n.contentRef,r);return(0,E.useEffect)((()=>{const e=r.current;if(e)return at(e)}),[]),(0,E.createElement)(St,b({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:w(e.onCloseAutoFocus,(e=>{var t;e.preventDefault(),null===(t=n.triggerRef.current)||void 0===t||t.focus()})),onPointerDownOutside:w(e.onPointerDownOutside,(e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()})),onFocusOutside:w(e.onFocusOutside,(e=>e.preventDefault()))}))})),Ct=(0,E.forwardRef)(((e,t)=>{const n=st(Et,e.__scopeDialog),r=(0,E.useRef)(!1),o=(0,E.useRef)(!1);return(0,E.createElement)(St,b({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var a,c;(null===(a=e.onCloseAutoFocus)||void 0===a||a.call(e,t),t.defaultPrevented)||(r.current||null===(c=n.triggerRef.current)||void 0===c||c.focus(),t.preventDefault());r.current=!1,o.current=!1},onInteractOutside:t=>{var a,c;null===(a=e.onInteractOutside)||void 0===a||a.call(e,t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(o.current=!0));const u=t.target;(null===(c=n.triggerRef.current)||void 0===c?void 0:c.contains(u))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&o.current&&t.preventDefault()}}))})),St=(0,E.forwardRef)(((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...c}=e,u=st(Et,n),i=S(t,(0,E.useRef)(null));return ce(),(0,E.createElement)(E.Fragment,null,(0,E.createElement)(X,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a},(0,E.createElement)(K,b({role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":kt(u.open)},c,{ref:i,onDismiss:()=>u.onOpenChange(!1)}))),!1)})),xt="DialogTitle";function kt(e){return e?"open":"closed"}const Ot="DialogTitleWarning",[Rt,At]=function(e,t){const n=(0,E.createContext)(t);function r(e){const{children:t,...r}=e,o=(0,E.useMemo)((()=>r),Object.values(r));return(0,E.createElement)(n.Provider,{value:o},t)}return r.displayName=e+"Provider",[r,function(r){const o=(0,E.useContext)(n);if(o)return o;if(void 0!==t)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}]}(Ot,{contentName:Et,titleName:xt,docsSlug:"dialog"}),Nt=dt,Lt=pt,Mt=gt,_t=yt;var Tt='[cmdk-group=""]',Dt='[cmdk-group-items=""]',Pt='[cmdk-item=""]',It=`${Pt}:not([aria-disabled="true"])`,jt="cmdk-item-select",Ft="data-value",Wt=(e,t,n)=>g(e,t,n),Ut=E.createContext(void 0),$t=()=>E.useContext(Ut),Bt=E.createContext(void 0),Kt=()=>E.useContext(Bt),Vt=E.createContext(void 0),qt=E.forwardRef(((e,t)=>{let n=an((()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",filtered:{count:0,items:new Map,groups:new Set}}})),r=an((()=>new Set)),o=an((()=>new Map)),a=an((()=>new Map)),c=an((()=>new Set)),u=rn(e),{label:i,children:l,value:s,onValueChange:d,filter:f,shouldFilter:m,loop:v,disablePointerSelection:p=!1,vimBindings:h=!0,...g}=e,b=E.useId(),y=E.useId(),w=E.useId(),C=E.useRef(null),S=sn();on((()=>{if(void 0!==s){let e=s.trim();n.current.value=e,x.emit()}}),[s]),on((()=>{S(6,L)}),[]);let x=E.useMemo((()=>({subscribe:e=>(c.current.add(e),()=>c.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var o,a,c;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)N(),R(),S(1,A);else if("value"===e&&(r||S(5,L),void 0!==(null==(o=u.current)?void 0:o.value))){let e=null!=t?t:"";return void(null==(c=(a=u.current).onValueChange)||c.call(a,e))}x.emit()}},emit:()=>{c.current.forEach((e=>e()))}})),[]),k=E.useMemo((()=>({value:(e,t,r)=>{var o;t!==(null==(o=a.current.get(e))?void 0:o.value)&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,O(t,r)),S(2,(()=>{R(),x.emit()})))},item:(e,t)=>(r.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),S(3,(()=>{N(),R(),n.current.value||A(),x.emit()})),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=M();S(4,(()=>{N(),(null==t?void 0:t.getAttribute("id"))===e&&A(),x.emit()}))}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{a.current.delete(e),o.current.delete(e)}),filter:()=>u.current.shouldFilter,label:i||e["aria-label"],disablePointerSelection:p,listId:b,inputId:w,labelId:y,listInnerRef:C})),[]);function O(e,t){var r,o;let a=null!=(o=null==(r=u.current)?void 0:r.filter)?o:Wt;return e?a(e,n.current.search,t):0}function R(){if(!n.current.search||!1===u.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach((n=>{let r=o.current.get(n),a=0;r.forEach((t=>{let n=e.get(t);a=Math.max(n,a)})),t.push([n,a])}));let r=C.current;_().sort(((t,n)=>{var r,o;let a=t.getAttribute("id"),c=n.getAttribute("id");return(null!=(r=e.get(c))?r:0)-(null!=(o=e.get(a))?o:0)})).forEach((e=>{let t=e.closest(Dt);t?t.appendChild(e.parentElement===t?e:e.closest(`${Dt} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Dt} > *`))})),t.sort(((e,t)=>t[1]-e[1])).forEach((e=>{let t=C.current.querySelector(`${Tt}[${Ft}="${encodeURIComponent(e[0])}"]`);null==t||t.parentElement.appendChild(t)}))}function A(){let e=_().find((e=>"true"!==e.getAttribute("aria-disabled"))),t=null==e?void 0:e.getAttribute(Ft);x.setState("value",t||void 0)}function N(){var e,t,c,i;if(!n.current.search||!1===u.current.shouldFilter)return void(n.current.filtered.count=r.current.size);n.current.filtered.groups=new Set;let l=0;for(let o of r.current){let r=O(null!=(t=null==(e=a.current.get(o))?void 0:e.value)?t:"",null!=(i=null==(c=a.current.get(o))?void 0:c.keywords)?i:[]);n.current.filtered.items.set(o,r),r>0&&l++}for(let[e,t]of o.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=l}function L(){var e,t,n;let r=M();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(Tt))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function M(){var e;return null==(e=C.current)?void 0:e.querySelector(`${Pt}[aria-selected="true"]`)}function _(){var e;return Array.from(null==(e=C.current)?void 0:e.querySelectorAll(It))}function T(e){let t=_()[e];t&&x.setState("value",t.getAttribute(Ft))}function D(e){var t;let n=M(),r=_(),o=r.findIndex((e=>e===n)),a=r[o+e];null!=(t=u.current)&&t.loop&&(a=o+e<0?r[r.length-1]:o+e===r.length?r[0]:r[o+e]),a&&x.setState("value",a.getAttribute(Ft))}function P(e){let t,n=M(),r=null==n?void 0:n.closest(Tt);for(;r&&!t;)r=e>0?tn(r,Tt):nn(r,Tt),t=null==r?void 0:r.querySelector(It);t?x.setState("value",t.getAttribute(Ft)):D(e)}let I=()=>T(_().length-1),F=e=>{e.preventDefault(),e.metaKey?I():e.altKey?P(1):D(1)},W=e=>{e.preventDefault(),e.metaKey?T(0):e.altKey?P(-1):D(-1)};return E.createElement(j.div,{ref:t,tabIndex:-1,...g,"cmdk-root":"",onKeyDown:e=>{var t;if(null==(t=g.onKeyDown)||t.call(g,e),!e.defaultPrevented)switch(e.key){case"n":case"j":h&&e.ctrlKey&&F(e);break;case"ArrowDown":F(e);break;case"p":case"k":h&&e.ctrlKey&&W(e);break;case"ArrowUp":W(e);break;case"Home":e.preventDefault(),T(0);break;case"End":e.preventDefault(),I();break;case"Enter":if(!e.nativeEvent.isComposing&&229!==e.keyCode){e.preventDefault();let t=M();if(t){let e=new Event(jt);t.dispatchEvent(e)}}}}},E.createElement("label",{"cmdk-label":"",htmlFor:k.inputId,id:k.labelId,style:fn},i),dn(e,(e=>E.createElement(Bt.Provider,{value:x},E.createElement(Ut.Provider,{value:k},e)))))})),zt=E.forwardRef(((e,t)=>{var n,r;let o=E.useId(),a=E.useRef(null),c=E.useContext(Vt),u=$t(),i=rn(e),l=null!=(r=null==(n=i.current)?void 0:n.forceMount)?r:null==c?void 0:c.forceMount;on((()=>{if(!l)return u.item(o,null==c?void 0:c.id)}),[l]);let s=ln(o,a,[e.value,e.children,a],e.keywords),d=Kt(),f=un((e=>e.value&&e.value===s.current)),m=un((e=>!(!l&&!1!==u.filter())||(!e.search||e.filtered.items.get(o)>0)));function v(){var e,t;p(),null==(t=(e=i.current).onSelect)||t.call(e,s.current)}function p(){d.setState("value",s.current,!0)}if(E.useEffect((()=>{let t=a.current;if(t&&!e.disabled)return t.addEventListener(jt,v),()=>t.removeEventListener(jt,v)}),[m,e.onSelect,e.disabled]),!m)return null;let{disabled:h,value:g,onSelect:b,forceMount:y,keywords:w,...C}=e;return E.createElement(j.div,{ref:cn([a,t]),...C,id:o,"cmdk-item":"",role:"option","aria-disabled":!!h,"aria-selected":!!f,"data-disabled":!!h,"data-selected":!!f,onPointerMove:h||u.disablePointerSelection?void 0:p,onClick:h?void 0:v},e.children)})),Gt=E.forwardRef(((e,t)=>{let{heading:n,children:r,forceMount:o,...a}=e,c=E.useId(),u=E.useRef(null),i=E.useRef(null),l=E.useId(),s=$t(),d=un((e=>!(!o&&!1!==s.filter())||(!e.search||e.filtered.groups.has(c))));on((()=>s.group(c)),[]),ln(c,u,[e.value,e.heading,i]);let f=E.useMemo((()=>({id:c,forceMount:o})),[o]);return E.createElement(j.div,{ref:cn([u,t]),...a,"cmdk-group":"",role:"presentation",hidden:!d||void 0},n&&E.createElement("div",{ref:i,"cmdk-group-heading":"","aria-hidden":!0,id:l},n),dn(e,(e=>E.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?l:void 0},E.createElement(Vt.Provider,{value:f},e)))))})),Ht=E.forwardRef(((e,t)=>{let{alwaysRender:n,...r}=e,o=E.useRef(null),a=un((e=>!e.search));return n||a?E.createElement(j.div,{ref:cn([o,t]),...r,"cmdk-separator":"",role:"separator"}):null})),Xt=E.forwardRef(((e,t)=>{let{onValueChange:n,...r}=e,o=null!=e.value,a=Kt(),c=un((e=>e.search)),u=un((e=>e.value)),i=$t(),l=E.useMemo((()=>{var e;let t=null==(e=i.listInnerRef.current)?void 0:e.querySelector(`${Pt}[${Ft}="${encodeURIComponent(u)}"]`);return null==t?void 0:t.getAttribute("id")}),[]);return E.useEffect((()=>{null!=e.value&&a.setState("search",e.value)}),[e.value]),E.createElement(j.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":i.listId,"aria-labelledby":i.labelId,"aria-activedescendant":l,id:i.inputId,type:"text",value:o?e.value:c,onChange:e=>{o||a.setState("search",e.target.value),null==n||n(e.target.value)}})})),Yt=E.forwardRef(((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,a=E.useRef(null),c=E.useRef(null),u=$t();return E.useEffect((()=>{if(c.current&&a.current){let e,t=c.current,n=a.current,r=new ResizeObserver((()=>{e=requestAnimationFrame((()=>{let e=t.offsetHeight;n.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")}))}));return r.observe(t),()=>{cancelAnimationFrame(e),r.unobserve(t)}}}),[]),E.createElement(j.div,{ref:cn([a,t]),...o,"cmdk-list":"",role:"listbox","aria-label":r,id:u.listId},dn(e,(e=>E.createElement("div",{ref:cn([c,u.listInnerRef]),"cmdk-list-sizer":""},e))))})),Zt=E.forwardRef(((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:a,container:c,...u}=e;return E.createElement(Nt,{open:n,onOpenChange:r},E.createElement(Lt,{container:c},E.createElement(Mt,{"cmdk-overlay":"",className:o}),E.createElement(_t,{"aria-label":e.label,"cmdk-dialog":"",className:a},E.createElement(qt,{ref:t,...u}))))})),Jt=E.forwardRef(((e,t)=>un((e=>0===e.filtered.count))?E.createElement(j.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null)),Qt=E.forwardRef(((e,t)=>{let{progress:n,children:r,label:o="Loading...",...a}=e;return E.createElement(j.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},dn(e,(e=>E.createElement("div",{"aria-hidden":!0},e))))})),en=Object.assign(qt,{List:Yt,Item:zt,Input:Xt,Group:Gt,Separator:Ht,Dialog:Zt,Empty:Jt,Loading:Qt});function tn(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function nn(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function rn(e){let t=E.useRef(e);return on((()=>{t.current=e})),t}var on="undefined"==typeof window?E.useEffect:E.useLayoutEffect;function an(e){let t=E.useRef();return void 0===t.current&&(t.current=e()),t}function cn(e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}function un(e){let t=Kt(),n=()=>e(t.snapshot());return E.useSyncExternalStore(t.subscribe,n,n)}function ln(e,t,n,r=[]){let o=E.useRef(),a=$t();return on((()=>{var c;let u=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():o.current}})(),i=r.map((e=>e.trim()));a.value(e,u,i),null==(c=t.current)||c.setAttribute(Ft,u),o.current=u})),o}var sn=()=>{let[e,t]=E.useState(),n=an((()=>new Map));return on((()=>{n.current.forEach((e=>e())),n.current=new Map}),[e]),(e,r)=>{n.current.set(e,r),t({})}};function dn({asChild:e,children:t},n){return e&&E.isValidElement(t)?E.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},n(t.props.children)):n(t)}var fn={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function mn(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=mn(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}const vn=function(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=mn(e))&&(r&&(r+=" "),r+=t);return r},pn=window.wp.data,hn=window.wp.element,gn=window.wp.i18n,bn=window.wp.components,En=window.wp.keyboardShortcuts;var yn=(0,hn.forwardRef)((({icon:e,size:t=24,...n},r)=>(0,hn.cloneElement)(e,{width:t,height:t,...n,ref:r})));const wn=window.wp.primitives;var Cn=(0,l.jsx)(wn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,l.jsx)(wn.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"})});var Sn=(0,pn.combineReducers)({commands:function(e={},t){switch(t.type){case"REGISTER_COMMAND":return{...e,[t.name]:{name:t.name,label:t.label,searchLabel:t.searchLabel,context:t.context,callback:t.callback,icon:t.icon,keywords:t.keywords}};case"UNREGISTER_COMMAND":{const{[t.name]:n,...r}=e;return r}}return e},commandLoaders:function(e={},t){switch(t.type){case"REGISTER_COMMAND_LOADER":return{...e,[t.name]:{name:t.name,context:t.context,hook:t.hook}};case"UNREGISTER_COMMAND_LOADER":{const{[t.name]:n,...r}=e;return r}}return e},isOpen:function(e=!1,t){switch(t.type){case"OPEN":return!0;case"CLOSE":return!1}return e},context:function(e="root",t){return"SET_CONTEXT"===t.type?t.context:e}});function xn(e){return{type:"REGISTER_COMMAND",...e}}function kn(e){return{type:"UNREGISTER_COMMAND",name:e}}function On(e){return{type:"REGISTER_COMMAND_LOADER",...e}}function Rn(e){return{type:"UNREGISTER_COMMAND_LOADER",name:e}}function An(){return{type:"OPEN"}}function Nn(){return{type:"CLOSE"}}const Ln=(0,pn.createSelector)(((e,t=!1)=>Object.values(e.commands).filter((n=>{const r=n.context&&n.context===e.context;return t?r:!r}))),(e=>[e.commands,e.context])),Mn=(0,pn.createSelector)(((e,t=!1)=>Object.values(e.commandLoaders).filter((n=>{const r=n.context&&n.context===e.context;return t?r:!r}))),(e=>[e.commandLoaders,e.context]));function _n(e){return e.isOpen}function Tn(e){return e.context}function Dn(e){return{type:"SET_CONTEXT",context:e}}const Pn=window.wp.privateApis,{lock:In,unlock:jn}=(0,Pn.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/commands"),Fn=(0,pn.createReduxStore)("core/commands",{reducer:Sn,actions:c,selectors:u});(0,pn.register)(Fn),jn(Fn).registerPrivateActions(i);const Wn=(0,gn.__)("Search commands and settings");function Un({name:e,search:t,hook:n,setLoader:r,close:o}){const{isLoading:a,commands:c=[]}=n({search:t})??{};return(0,hn.useEffect)((()=>{r(e,a)}),[r,e,a]),c.length?(0,l.jsx)(l.Fragment,{children:c.map((e=>(0,l.jsx)(en.Item,{value:e.searchLabel??e.label,keywords:e.keywords,onSelect:()=>e.callback({close:o}),id:e.name,children:(0,l.jsxs)(bn.__experimentalHStack,{alignment:"left",className:vn("commands-command-menu__item",{"has-icon":e.icon}),children:[e.icon&&(0,l.jsx)(yn,{icon:e.icon}),(0,l.jsx)("span",{children:(0,l.jsx)(bn.TextHighlight,{text:e.label,highlight:t})})]})},e.name)))}):null}function $n({hook:e,search:t,setLoader:n,close:r}){const o=(0,hn.useRef)(e),[a,c]=(0,hn.useState)(0);return(0,hn.useEffect)((()=>{o.current!==e&&(o.current=e,c((e=>e+1)))}),[e]),(0,l.jsx)(Un,{hook:o.current,search:t,setLoader:n,close:r},a)}function Bn({isContextual:e,search:t,setLoader:n,close:r}){const{commands:o,loaders:a}=(0,pn.useSelect)((t=>{const{getCommands:n,getCommandLoaders:r}=t(Fn);return{commands:n(e),loaders:r(e)}}),[e]);return o.length||a.length?(0,l.jsxs)(en.Group,{children:[o.map((e=>(0,l.jsx)(en.Item,{value:e.searchLabel??e.label,keywords:e.keywords,onSelect:()=>e.callback({close:r}),id:e.name,children:(0,l.jsxs)(bn.__experimentalHStack,{alignment:"left",className:vn("commands-command-menu__item",{"has-icon":e.icon}),children:[e.icon&&(0,l.jsx)(yn,{icon:e.icon}),(0,l.jsx)("span",{children:(0,l.jsx)(bn.TextHighlight,{text:e.label,highlight:t})})]})},e.name))),a.map((e=>(0,l.jsx)($n,{hook:e.hook,search:t,setLoader:n,close:r},e.name)))]}):null}function Kn({isOpen:e,search:t,setSearch:n}){const r=(0,hn.useRef)(),o=un((e=>e.value)),a=(0,hn.useMemo)((()=>{const e=document.querySelector(`[cmdk-item=""][data-value="${o}"]`);return e?.getAttribute("id")}),[o]);return(0,hn.useEffect)((()=>{e&&r.current.focus()}),[e]),(0,l.jsx)(en.Input,{ref:r,value:t,onValueChange:n,placeholder:Wn,"aria-activedescendant":a,icon:t})}function Vn(){const{registerShortcut:e}=(0,pn.useDispatch)(En.store),[t,n]=(0,hn.useState)(""),r=(0,pn.useSelect)((e=>e(Fn).isOpen()),[]),{open:o,close:a}=(0,pn.useDispatch)(Fn),[c,u]=(0,hn.useState)({});(0,hn.useEffect)((()=>{e({name:"core/commands",category:"global",description:(0,gn.__)("Open the command palette."),keyCombination:{modifier:"primary",character:"k"}})}),[e]),(0,En.useShortcut)("core/commands",(e=>{e.defaultPrevented||(e.preventDefault(),r?a():o())}),{bindGlobal:!0});const i=(0,hn.useCallback)(((e,t)=>u((n=>({...n,[e]:t})))),[]),s=()=>{n(""),a()};if(!r)return!1;const d=Object.values(c).some(Boolean);return(0,l.jsx)(bn.Modal,{className:"commands-command-menu",overlayClassName:"commands-command-menu__overlay",onRequestClose:s,__experimentalHideHeader:!0,contentLabel:(0,gn.__)("Command palette"),children:(0,l.jsx)("div",{className:"commands-command-menu__container",children:(0,l.jsxs)(en,{label:Wn,onKeyDown:e=>{(e.nativeEvent.isComposing||229===e.keyCode)&&e.preventDefault()},children:[(0,l.jsxs)("div",{className:"commands-command-menu__header",children:[(0,l.jsx)(yn,{className:"commands-command-menu__header-search-icon",icon:Cn}),(0,l.jsx)(Kn,{search:t,setSearch:n,isOpen:r})]}),(0,l.jsxs)(en.List,{label:(0,gn.__)("Command suggestions"),children:[t&&!d&&(0,l.jsx)(en.Empty,{children:(0,gn.__)("No results found.")}),(0,l.jsx)(Bn,{search:t,setLoader:i,close:s,isContextual:!0}),t&&(0,l.jsx)(Bn,{search:t,setLoader:i,close:s})]})]})})})}const qn={};function zn(e){const{registerCommand:t,unregisterCommand:n}=(0,pn.useDispatch)(Fn),r=(0,hn.useRef)(e.callback);(0,hn.useEffect)((()=>{r.current=e.callback}),[e.callback]),(0,hn.useEffect)((()=>{if(!e.disabled)return t({name:e.name,context:e.context,label:e.label,searchLabel:e.searchLabel,icon:e.icon,keywords:e.keywords,callback:(...e)=>r.current(...e)}),()=>{n(e.name)}}),[e.name,e.label,e.searchLabel,e.icon,e.context,e.keywords,e.disabled,t,n])}function Gn(e){const{registerCommand:t,unregisterCommand:n}=(0,pn.useDispatch)(Fn),r=(0,hn.useRef)({});(0,hn.useEffect)((()=>{e&&e.forEach((e=>{e.callback&&(r.current[e.name]=e.callback)}))}),[e]),(0,hn.useEffect)((()=>{if(e)return e.forEach((e=>{e.disabled||t({name:e.name,context:e.context,label:e.label,searchLabel:e.searchLabel,icon:e.icon,keywords:e.keywords,callback:(...t)=>{const n=r.current[e.name];n&&n(...t)}})})),()=>{e.forEach((e=>{n(e.name)}))}}),[e,t,n])}function Hn(e){const{registerCommandLoader:t,unregisterCommandLoader:n}=(0,pn.useDispatch)(Fn);(0,hn.useEffect)((()=>{if(!e.disabled)return t({name:e.name,hook:e.hook,context:e.context}),()=>{n(e.name)}}),[e.name,e.hook,e.context,e.disabled,t,n])}In(qn,{useCommandContext:function(e){const{getContext:t}=(0,pn.useSelect)(Fn),n=(0,hn.useRef)(t()),{setContext:r}=jn((0,pn.useDispatch)(Fn));(0,hn.useEffect)((()=>{r(e)}),[e,r]),(0,hn.useEffect)((()=>{const e=n.current;return()=>r(e)}),[r])}}),(window.wp=window.wp||{}).commands=a})(); block-editor.js 0000644 00010721533 15151622574 0007504 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 197: /***/ (() => { /* (ignored) */ /***/ }), /***/ 271: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Container = __webpack_require__(683) let LazyResult, Processor class Document extends Container { constructor(defaults) { // type needs to be passed to super, otherwise child roots won't be normalized correctly super({ type: 'document', ...defaults }) if (!this.nodes) { this.nodes = [] } } toResult(opts = {}) { let lazy = new LazyResult(new Processor(), this, opts) return lazy.stringify() } } Document.registerLazyResult = dependant => { LazyResult = dependant } Document.registerProcessor = dependant => { Processor = dependant } module.exports = Document Document.default = Document /***/ }), /***/ 346: /***/ ((module) => { "use strict"; const DEFAULT_RAW = { after: '\n', beforeClose: '\n', beforeComment: '\n', beforeDecl: '\n', beforeOpen: ' ', beforeRule: '\n', colon: ': ', commentLeft: ' ', commentRight: ' ', emptyBody: '', indent: ' ', semicolon: false } function capitalize(str) { return str[0].toUpperCase() + str.slice(1) } class Stringifier { constructor(builder) { this.builder = builder } atrule(node, semicolon) { let name = '@' + node.name let params = node.params ? this.rawValue(node, 'params') : '' if (typeof node.raws.afterName !== 'undefined') { name += node.raws.afterName } else if (params) { name += ' ' } if (node.nodes) { this.block(node, name + params) } else { let end = (node.raws.between || '') + (semicolon ? ';' : '') this.builder(name + params + end, node) } } beforeAfter(node, detect) { let value if (node.type === 'decl') { value = this.raw(node, null, 'beforeDecl') } else if (node.type === 'comment') { value = this.raw(node, null, 'beforeComment') } else if (detect === 'before') { value = this.raw(node, null, 'beforeRule') } else { value = this.raw(node, null, 'beforeClose') } let buf = node.parent let depth = 0 while (buf && buf.type !== 'root') { depth += 1 buf = buf.parent } if (value.includes('\n')) { let indent = this.raw(node, null, 'indent') if (indent.length) { for (let step = 0; step < depth; step++) value += indent } } return value } block(node, start) { let between = this.raw(node, 'between', 'beforeOpen') this.builder(start + between + '{', node, 'start') let after if (node.nodes && node.nodes.length) { this.body(node) after = this.raw(node, 'after') } else { after = this.raw(node, 'after', 'emptyBody') } if (after) this.builder(after) this.builder('}', node, 'end') } body(node) { let last = node.nodes.length - 1 while (last > 0) { if (node.nodes[last].type !== 'comment') break last -= 1 } let semicolon = this.raw(node, 'semicolon') for (let i = 0; i < node.nodes.length; i++) { let child = node.nodes[i] let before = this.raw(child, 'before') if (before) this.builder(before) this.stringify(child, last !== i || semicolon) } } comment(node) { let left = this.raw(node, 'left', 'commentLeft') let right = this.raw(node, 'right', 'commentRight') this.builder('/*' + left + node.text + right + '*/', node) } decl(node, semicolon) { let between = this.raw(node, 'between', 'colon') let string = node.prop + between + this.rawValue(node, 'value') if (node.important) { string += node.raws.important || ' !important' } if (semicolon) string += ';' this.builder(string, node) } document(node) { this.body(node) } raw(node, own, detect) { let value if (!detect) detect = own // Already had if (own) { value = node.raws[own] if (typeof value !== 'undefined') return value } let parent = node.parent if (detect === 'before') { // Hack for first rule in CSS if (!parent || (parent.type === 'root' && parent.first === node)) { return '' } // `root` nodes in `document` should use only their own raws if (parent && parent.type === 'document') { return '' } } // Floating child without parent if (!parent) return DEFAULT_RAW[detect] // Detect style by other nodes let root = node.root() if (!root.rawCache) root.rawCache = {} if (typeof root.rawCache[detect] !== 'undefined') { return root.rawCache[detect] } if (detect === 'before' || detect === 'after') { return this.beforeAfter(node, detect) } else { let method = 'raw' + capitalize(detect) if (this[method]) { value = this[method](root, node) } else { root.walk(i => { value = i.raws[own] if (typeof value !== 'undefined') return false }) } } if (typeof value === 'undefined') value = DEFAULT_RAW[detect] root.rawCache[detect] = value return value } rawBeforeClose(root) { let value root.walk(i => { if (i.nodes && i.nodes.length > 0) { if (typeof i.raws.after !== 'undefined') { value = i.raws.after if (value.includes('\n')) { value = value.replace(/[^\n]+$/, '') } return false } } }) if (value) value = value.replace(/\S/g, '') return value } rawBeforeComment(root, node) { let value root.walkComments(i => { if (typeof i.raws.before !== 'undefined') { value = i.raws.before if (value.includes('\n')) { value = value.replace(/[^\n]+$/, '') } return false } }) if (typeof value === 'undefined') { value = this.raw(node, null, 'beforeDecl') } else if (value) { value = value.replace(/\S/g, '') } return value } rawBeforeDecl(root, node) { let value root.walkDecls(i => { if (typeof i.raws.before !== 'undefined') { value = i.raws.before if (value.includes('\n')) { value = value.replace(/[^\n]+$/, '') } return false } }) if (typeof value === 'undefined') { value = this.raw(node, null, 'beforeRule') } else if (value) { value = value.replace(/\S/g, '') } return value } rawBeforeOpen(root) { let value root.walk(i => { if (i.type !== 'decl') { value = i.raws.between if (typeof value !== 'undefined') return false } }) return value } rawBeforeRule(root) { let value root.walk(i => { if (i.nodes && (i.parent !== root || root.first !== i)) { if (typeof i.raws.before !== 'undefined') { value = i.raws.before if (value.includes('\n')) { value = value.replace(/[^\n]+$/, '') } return false } } }) if (value) value = value.replace(/\S/g, '') return value } rawColon(root) { let value root.walkDecls(i => { if (typeof i.raws.between !== 'undefined') { value = i.raws.between.replace(/[^\s:]/g, '') return false } }) return value } rawEmptyBody(root) { let value root.walk(i => { if (i.nodes && i.nodes.length === 0) { value = i.raws.after if (typeof value !== 'undefined') return false } }) return value } rawIndent(root) { if (root.raws.indent) return root.raws.indent let value root.walk(i => { let p = i.parent if (p && p !== root && p.parent && p.parent === root) { if (typeof i.raws.before !== 'undefined') { let parts = i.raws.before.split('\n') value = parts[parts.length - 1] value = value.replace(/\S/g, '') return false } } }) return value } rawSemicolon(root) { let value root.walk(i => { if (i.nodes && i.nodes.length && i.last.type === 'decl') { value = i.raws.semicolon if (typeof value !== 'undefined') return false } }) return value } rawValue(node, prop) { let value = node[prop] let raw = node.raws[prop] if (raw && raw.value === value) { return raw.raw } return value } root(node) { this.body(node) if (node.raws.after) this.builder(node.raws.after) } rule(node) { this.block(node, this.rawValue(node, 'selector')) if (node.raws.ownSemicolon) { this.builder(node.raws.ownSemicolon, node, 'end') } } stringify(node, semicolon) { /* c8 ignore start */ if (!this[node.type]) { throw new Error( 'Unknown AST node type ' + node.type + '. ' + 'Maybe you need to change PostCSS stringifier.' ) } /* c8 ignore stop */ this[node.type](node, semicolon) } } module.exports = Stringifier Stringifier.default = Stringifier /***/ }), /***/ 356: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let pico = __webpack_require__(2775) let terminalHighlight = __webpack_require__(9746) class CssSyntaxError extends Error { constructor(message, line, column, source, file, plugin) { super(message) this.name = 'CssSyntaxError' this.reason = message if (file) { this.file = file } if (source) { this.source = source } if (plugin) { this.plugin = plugin } if (typeof line !== 'undefined' && typeof column !== 'undefined') { if (typeof line === 'number') { this.line = line this.column = column } else { this.line = line.line this.column = line.column this.endLine = column.line this.endColumn = column.column } } this.setMessage() if (Error.captureStackTrace) { Error.captureStackTrace(this, CssSyntaxError) } } setMessage() { this.message = this.plugin ? this.plugin + ': ' : '' this.message += this.file ? this.file : '<css input>' if (typeof this.line !== 'undefined') { this.message += ':' + this.line + ':' + this.column } this.message += ': ' + this.reason } showSourceCode(color) { if (!this.source) return '' let css = this.source if (color == null) color = pico.isColorSupported let aside = text => text let mark = text => text let highlight = text => text if (color) { let { bold, gray, red } = pico.createColors(true) mark = text => bold(red(text)) aside = text => gray(text) if (terminalHighlight) { highlight = text => terminalHighlight(text) } } let lines = css.split(/\r?\n/) let start = Math.max(this.line - 3, 0) let end = Math.min(this.line + 2, lines.length) let maxWidth = String(end).length return lines .slice(start, end) .map((line, index) => { let number = start + 1 + index let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ' if (number === this.line) { if (line.length > 160) { let padding = 20 let subLineStart = Math.max(0, this.column - padding) let subLineEnd = Math.max( this.column + padding, this.endColumn + padding ) let subLine = line.slice(subLineStart, subLineEnd) let spacing = aside(gutter.replace(/\d/g, ' ')) + line .slice(0, Math.min(this.column - 1, padding - 1)) .replace(/[^\t]/g, ' ') return ( mark('>') + aside(gutter) + highlight(subLine) + '\n ' + spacing + mark('^') ) } let spacing = aside(gutter.replace(/\d/g, ' ')) + line.slice(0, this.column - 1).replace(/[^\t]/g, ' ') return ( mark('>') + aside(gutter) + highlight(line) + '\n ' + spacing + mark('^') ) } return ' ' + aside(gutter) + highlight(line) }) .join('\n') } toString() { let code = this.showSourceCode() if (code) { code = '\n\n' + code + '\n' } return this.name + ': ' + this.message + code } } module.exports = CssSyntaxError CssSyntaxError.default = CssSyntaxError /***/ }), /***/ 448: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Container = __webpack_require__(683) let Document = __webpack_require__(271) let MapGenerator = __webpack_require__(1670) let parse = __webpack_require__(4295) let Result = __webpack_require__(9055) let Root = __webpack_require__(9434) let stringify = __webpack_require__(633) let { isClean, my } = __webpack_require__(1381) let warnOnce = __webpack_require__(3122) const TYPE_TO_CLASS_NAME = { atrule: 'AtRule', comment: 'Comment', decl: 'Declaration', document: 'Document', root: 'Root', rule: 'Rule' } const PLUGIN_PROPS = { AtRule: true, AtRuleExit: true, Comment: true, CommentExit: true, Declaration: true, DeclarationExit: true, Document: true, DocumentExit: true, Once: true, OnceExit: true, postcssPlugin: true, prepare: true, Root: true, RootExit: true, Rule: true, RuleExit: true } const NOT_VISITORS = { Once: true, postcssPlugin: true, prepare: true } const CHILDREN = 0 function isPromise(obj) { return typeof obj === 'object' && typeof obj.then === 'function' } function getEvents(node) { let key = false let type = TYPE_TO_CLASS_NAME[node.type] if (node.type === 'decl') { key = node.prop.toLowerCase() } else if (node.type === 'atrule') { key = node.name.toLowerCase() } if (key && node.append) { return [ type, type + '-' + key, CHILDREN, type + 'Exit', type + 'Exit-' + key ] } else if (key) { return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key] } else if (node.append) { return [type, CHILDREN, type + 'Exit'] } else { return [type, type + 'Exit'] } } function toStack(node) { let events if (node.type === 'document') { events = ['Document', CHILDREN, 'DocumentExit'] } else if (node.type === 'root') { events = ['Root', CHILDREN, 'RootExit'] } else { events = getEvents(node) } return { eventIndex: 0, events, iterator: 0, node, visitorIndex: 0, visitors: [] } } function cleanMarks(node) { node[isClean] = false if (node.nodes) node.nodes.forEach(i => cleanMarks(i)) return node } let postcss = {} class LazyResult { get content() { return this.stringify().content } get css() { return this.stringify().css } get map() { return this.stringify().map } get messages() { return this.sync().messages } get opts() { return this.result.opts } get processor() { return this.result.processor } get root() { return this.sync().root } get [Symbol.toStringTag]() { return 'LazyResult' } constructor(processor, css, opts) { this.stringified = false this.processed = false let root if ( typeof css === 'object' && css !== null && (css.type === 'root' || css.type === 'document') ) { root = cleanMarks(css) } else if (css instanceof LazyResult || css instanceof Result) { root = cleanMarks(css.root) if (css.map) { if (typeof opts.map === 'undefined') opts.map = {} if (!opts.map.inline) opts.map.inline = false opts.map.prev = css.map } } else { let parser = parse if (opts.syntax) parser = opts.syntax.parse if (opts.parser) parser = opts.parser if (parser.parse) parser = parser.parse try { root = parser(css, opts) } catch (error) { this.processed = true this.error = error } if (root && !root[my]) { /* c8 ignore next 2 */ Container.rebuild(root) } } this.result = new Result(processor, root, opts) this.helpers = { ...postcss, postcss, result: this.result } this.plugins = this.processor.plugins.map(plugin => { if (typeof plugin === 'object' && plugin.prepare) { return { ...plugin, ...plugin.prepare(this.result) } } else { return plugin } }) } async() { if (this.error) return Promise.reject(this.error) if (this.processed) return Promise.resolve(this.result) if (!this.processing) { this.processing = this.runAsync() } return this.processing } catch(onRejected) { return this.async().catch(onRejected) } finally(onFinally) { return this.async().then(onFinally, onFinally) } getAsyncError() { throw new Error('Use process(css).then(cb) to work with async plugins') } handleError(error, node) { let plugin = this.result.lastPlugin try { if (node) node.addToError(error) this.error = error if (error.name === 'CssSyntaxError' && !error.plugin) { error.plugin = plugin.postcssPlugin error.setMessage() } else if (plugin.postcssVersion) { if (false) {} } } catch (err) { /* c8 ignore next 3 */ // eslint-disable-next-line no-console if (console && console.error) console.error(err) } return error } prepareVisitors() { this.listeners = {} let add = (plugin, type, cb) => { if (!this.listeners[type]) this.listeners[type] = [] this.listeners[type].push([plugin, cb]) } for (let plugin of this.plugins) { if (typeof plugin === 'object') { for (let event in plugin) { if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) { throw new Error( `Unknown event ${event} in ${plugin.postcssPlugin}. ` + `Try to update PostCSS (${this.processor.version} now).` ) } if (!NOT_VISITORS[event]) { if (typeof plugin[event] === 'object') { for (let filter in plugin[event]) { if (filter === '*') { add(plugin, event, plugin[event][filter]) } else { add( plugin, event + '-' + filter.toLowerCase(), plugin[event][filter] ) } } } else if (typeof plugin[event] === 'function') { add(plugin, event, plugin[event]) } } } } } this.hasListener = Object.keys(this.listeners).length > 0 } async runAsync() { this.plugin = 0 for (let i = 0; i < this.plugins.length; i++) { let plugin = this.plugins[i] let promise = this.runOnRoot(plugin) if (isPromise(promise)) { try { await promise } catch (error) { throw this.handleError(error) } } } this.prepareVisitors() if (this.hasListener) { let root = this.result.root while (!root[isClean]) { root[isClean] = true let stack = [toStack(root)] while (stack.length > 0) { let promise = this.visitTick(stack) if (isPromise(promise)) { try { await promise } catch (e) { let node = stack[stack.length - 1].node throw this.handleError(e, node) } } } } if (this.listeners.OnceExit) { for (let [plugin, visitor] of this.listeners.OnceExit) { this.result.lastPlugin = plugin try { if (root.type === 'document') { let roots = root.nodes.map(subRoot => visitor(subRoot, this.helpers) ) await Promise.all(roots) } else { await visitor(root, this.helpers) } } catch (e) { throw this.handleError(e) } } } } this.processed = true return this.stringify() } runOnRoot(plugin) { this.result.lastPlugin = plugin try { if (typeof plugin === 'object' && plugin.Once) { if (this.result.root.type === 'document') { let roots = this.result.root.nodes.map(root => plugin.Once(root, this.helpers) ) if (isPromise(roots[0])) { return Promise.all(roots) } return roots } return plugin.Once(this.result.root, this.helpers) } else if (typeof plugin === 'function') { return plugin(this.result.root, this.result) } } catch (error) { throw this.handleError(error) } } stringify() { if (this.error) throw this.error if (this.stringified) return this.result this.stringified = true this.sync() let opts = this.result.opts let str = stringify if (opts.syntax) str = opts.syntax.stringify if (opts.stringifier) str = opts.stringifier if (str.stringify) str = str.stringify let map = new MapGenerator(str, this.result.root, this.result.opts) let data = map.generate() this.result.css = data[0] this.result.map = data[1] return this.result } sync() { if (this.error) throw this.error if (this.processed) return this.result this.processed = true if (this.processing) { throw this.getAsyncError() } for (let plugin of this.plugins) { let promise = this.runOnRoot(plugin) if (isPromise(promise)) { throw this.getAsyncError() } } this.prepareVisitors() if (this.hasListener) { let root = this.result.root while (!root[isClean]) { root[isClean] = true this.walkSync(root) } if (this.listeners.OnceExit) { if (root.type === 'document') { for (let subRoot of root.nodes) { this.visitSync(this.listeners.OnceExit, subRoot) } } else { this.visitSync(this.listeners.OnceExit, root) } } } return this.result } then(onFulfilled, onRejected) { if (false) {} return this.async().then(onFulfilled, onRejected) } toString() { return this.css } visitSync(visitors, node) { for (let [plugin, visitor] of visitors) { this.result.lastPlugin = plugin let promise try { promise = visitor(node, this.helpers) } catch (e) { throw this.handleError(e, node.proxyOf) } if (node.type !== 'root' && node.type !== 'document' && !node.parent) { return true } if (isPromise(promise)) { throw this.getAsyncError() } } } visitTick(stack) { let visit = stack[stack.length - 1] let { node, visitors } = visit if (node.type !== 'root' && node.type !== 'document' && !node.parent) { stack.pop() return } if (visitors.length > 0 && visit.visitorIndex < visitors.length) { let [plugin, visitor] = visitors[visit.visitorIndex] visit.visitorIndex += 1 if (visit.visitorIndex === visitors.length) { visit.visitors = [] visit.visitorIndex = 0 } this.result.lastPlugin = plugin try { return visitor(node.toProxy(), this.helpers) } catch (e) { throw this.handleError(e, node) } } if (visit.iterator !== 0) { let iterator = visit.iterator let child while ((child = node.nodes[node.indexes[iterator]])) { node.indexes[iterator] += 1 if (!child[isClean]) { child[isClean] = true stack.push(toStack(child)) return } } visit.iterator = 0 delete node.indexes[iterator] } let events = visit.events while (visit.eventIndex < events.length) { let event = events[visit.eventIndex] visit.eventIndex += 1 if (event === CHILDREN) { if (node.nodes && node.nodes.length) { node[isClean] = true visit.iterator = node.getIterator() } return } else if (this.listeners[event]) { visit.visitors = this.listeners[event] return } } stack.pop() } walkSync(node) { node[isClean] = true let events = getEvents(node) for (let event of events) { if (event === CHILDREN) { if (node.nodes) { node.each(child => { if (!child[isClean]) this.walkSync(child) }) } } else { let visitors = this.listeners[event] if (visitors) { if (this.visitSync(visitors, node.toProxy())) return } } } } warnings() { return this.sync().warnings() } } LazyResult.registerPostcss = dependant => { postcss = dependant } module.exports = LazyResult LazyResult.default = LazyResult Root.registerLazyResult(LazyResult) Document.registerLazyResult(LazyResult) /***/ }), /***/ 461: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { // Load in dependencies var computedStyle = __webpack_require__(6109); /** * Calculate the `line-height` of a given node * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. * @returns {Number} `line-height` of the element in pixels */ function lineHeight(node) { // Grab the line-height via style var lnHeightStr = computedStyle(node, 'line-height'); var lnHeight = parseFloat(lnHeightStr, 10); // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') if (lnHeightStr === lnHeight + '') { // Save the old lineHeight style and update the em unit to the element var _lnHeightStyle = node.style.lineHeight; node.style.lineHeight = lnHeightStr + 'em'; // Calculate the em based height lnHeightStr = computedStyle(node, 'line-height'); lnHeight = parseFloat(lnHeightStr, 10); // Revert the lineHeight style if (_lnHeightStyle) { node.style.lineHeight = _lnHeightStyle; } else { delete node.style.lineHeight; } } // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) // DEV: `em` units are converted to `pt` in IE6 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length if (lnHeightStr.indexOf('pt') !== -1) { lnHeight *= 4; lnHeight /= 3; // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) } else if (lnHeightStr.indexOf('mm') !== -1) { lnHeight *= 96; lnHeight /= 25.4; // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) } else if (lnHeightStr.indexOf('cm') !== -1) { lnHeight *= 96; lnHeight /= 2.54; // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) } else if (lnHeightStr.indexOf('in') !== -1) { lnHeight *= 96; // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) } else if (lnHeightStr.indexOf('pc') !== -1) { lnHeight *= 16; } // Continue our computation lnHeight = Math.round(lnHeight); // If the line-height is "normal", calculate by font-size if (lnHeightStr === 'normal') { // Create a temporary node var nodeName = node.nodeName; var _node = document.createElement(nodeName); _node.innerHTML = ' '; // If we have a text area, reset it to only 1 row // https://github.com/twolfson/line-height/issues/4 if (nodeName.toUpperCase() === 'TEXTAREA') { _node.setAttribute('rows', '1'); } // Set the font-size of the element var fontSizeStr = computedStyle(node, 'font-size'); _node.style.fontSize = fontSizeStr; // Remove default padding/border which can affect offset height // https://github.com/twolfson/line-height/issues/4 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight _node.style.padding = '0px'; _node.style.border = '0px'; // Append it to the body var body = document.body; body.appendChild(_node); // Assume the line height of the element is the height var height = _node.offsetHeight; lnHeight = height; // Remove our child from the DOM body.removeChild(_node); } // Return the calculated height return lnHeight; } // Export lineHeight module.exports = lineHeight; /***/ }), /***/ 628: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var ReactPropTypesSecret = __webpack_require__(4067); function emptyFunction() {} function emptyFunctionWithReset() {} emptyFunctionWithReset.resetWarningCache = emptyFunction; module.exports = function() { function shim(props, propName, componentName, location, propFullName, secret) { if (secret === ReactPropTypesSecret) { // It is still safe when called from React. return; } var err = new Error( 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); err.name = 'Invariant Violation'; throw err; }; shim.isRequired = shim; function getShim() { return shim; }; // Important! // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. var ReactPropTypes = { array: shim, bigint: shim, bool: shim, func: shim, number: shim, object: shim, string: shim, symbol: shim, any: shim, arrayOf: getShim, element: shim, elementType: shim, instanceOf: getShim, node: shim, objectOf: getShim, oneOf: getShim, oneOfType: getShim, shape: getShim, exact: getShim, checkPropTypes: emptyFunctionWithReset, resetWarningCache: emptyFunction }; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; /***/ }), /***/ 633: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Stringifier = __webpack_require__(346) function stringify(node, builder) { let str = new Stringifier(builder) str.stringify(node) } module.exports = stringify stringify.default = stringify /***/ }), /***/ 683: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Comment = __webpack_require__(6589) let Declaration = __webpack_require__(1516) let Node = __webpack_require__(7490) let { isClean, my } = __webpack_require__(1381) let AtRule, parse, Root, Rule function cleanSource(nodes) { return nodes.map(i => { if (i.nodes) i.nodes = cleanSource(i.nodes) delete i.source return i }) } function markTreeDirty(node) { node[isClean] = false if (node.proxyOf.nodes) { for (let i of node.proxyOf.nodes) { markTreeDirty(i) } } } class Container extends Node { get first() { if (!this.proxyOf.nodes) return undefined return this.proxyOf.nodes[0] } get last() { if (!this.proxyOf.nodes) return undefined return this.proxyOf.nodes[this.proxyOf.nodes.length - 1] } append(...children) { for (let child of children) { let nodes = this.normalize(child, this.last) for (let node of nodes) this.proxyOf.nodes.push(node) } this.markDirty() return this } cleanRaws(keepBetween) { super.cleanRaws(keepBetween) if (this.nodes) { for (let node of this.nodes) node.cleanRaws(keepBetween) } } each(callback) { if (!this.proxyOf.nodes) return undefined let iterator = this.getIterator() let index, result while (this.indexes[iterator] < this.proxyOf.nodes.length) { index = this.indexes[iterator] result = callback(this.proxyOf.nodes[index], index) if (result === false) break this.indexes[iterator] += 1 } delete this.indexes[iterator] return result } every(condition) { return this.nodes.every(condition) } getIterator() { if (!this.lastEach) this.lastEach = 0 if (!this.indexes) this.indexes = {} this.lastEach += 1 let iterator = this.lastEach this.indexes[iterator] = 0 return iterator } getProxyProcessor() { return { get(node, prop) { if (prop === 'proxyOf') { return node } else if (!node[prop]) { return node[prop] } else if ( prop === 'each' || (typeof prop === 'string' && prop.startsWith('walk')) ) { return (...args) => { return node[prop]( ...args.map(i => { if (typeof i === 'function') { return (child, index) => i(child.toProxy(), index) } else { return i } }) ) } } else if (prop === 'every' || prop === 'some') { return cb => { return node[prop]((child, ...other) => cb(child.toProxy(), ...other) ) } } else if (prop === 'root') { return () => node.root().toProxy() } else if (prop === 'nodes') { return node.nodes.map(i => i.toProxy()) } else if (prop === 'first' || prop === 'last') { return node[prop].toProxy() } else { return node[prop] } }, set(node, prop, value) { if (node[prop] === value) return true node[prop] = value if (prop === 'name' || prop === 'params' || prop === 'selector') { node.markDirty() } return true } } } index(child) { if (typeof child === 'number') return child if (child.proxyOf) child = child.proxyOf return this.proxyOf.nodes.indexOf(child) } insertAfter(exist, add) { let existIndex = this.index(exist) let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse() existIndex = this.index(exist) for (let node of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node) let index for (let id in this.indexes) { index = this.indexes[id] if (existIndex < index) { this.indexes[id] = index + nodes.length } } this.markDirty() return this } insertBefore(exist, add) { let existIndex = this.index(exist) let type = existIndex === 0 ? 'prepend' : false let nodes = this.normalize( add, this.proxyOf.nodes[existIndex], type ).reverse() existIndex = this.index(exist) for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node) let index for (let id in this.indexes) { index = this.indexes[id] if (existIndex <= index) { this.indexes[id] = index + nodes.length } } this.markDirty() return this } normalize(nodes, sample) { if (typeof nodes === 'string') { nodes = cleanSource(parse(nodes).nodes) } else if (typeof nodes === 'undefined') { nodes = [] } else if (Array.isArray(nodes)) { nodes = nodes.slice(0) for (let i of nodes) { if (i.parent) i.parent.removeChild(i, 'ignore') } } else if (nodes.type === 'root' && this.type !== 'document') { nodes = nodes.nodes.slice(0) for (let i of nodes) { if (i.parent) i.parent.removeChild(i, 'ignore') } } else if (nodes.type) { nodes = [nodes] } else if (nodes.prop) { if (typeof nodes.value === 'undefined') { throw new Error('Value field is missed in node creation') } else if (typeof nodes.value !== 'string') { nodes.value = String(nodes.value) } nodes = [new Declaration(nodes)] } else if (nodes.selector || nodes.selectors) { nodes = [new Rule(nodes)] } else if (nodes.name) { nodes = [new AtRule(nodes)] } else if (nodes.text) { nodes = [new Comment(nodes)] } else { throw new Error('Unknown node type in node creation') } let processed = nodes.map(i => { /* c8 ignore next */ if (!i[my]) Container.rebuild(i) i = i.proxyOf if (i.parent) i.parent.removeChild(i) if (i[isClean]) markTreeDirty(i) if (!i.raws) i.raws = {} if (typeof i.raws.before === 'undefined') { if (sample && typeof sample.raws.before !== 'undefined') { i.raws.before = sample.raws.before.replace(/\S/g, '') } } i.parent = this.proxyOf return i }) return processed } prepend(...children) { children = children.reverse() for (let child of children) { let nodes = this.normalize(child, this.first, 'prepend').reverse() for (let node of nodes) this.proxyOf.nodes.unshift(node) for (let id in this.indexes) { this.indexes[id] = this.indexes[id] + nodes.length } } this.markDirty() return this } push(child) { child.parent = this this.proxyOf.nodes.push(child) return this } removeAll() { for (let node of this.proxyOf.nodes) node.parent = undefined this.proxyOf.nodes = [] this.markDirty() return this } removeChild(child) { child = this.index(child) this.proxyOf.nodes[child].parent = undefined this.proxyOf.nodes.splice(child, 1) let index for (let id in this.indexes) { index = this.indexes[id] if (index >= child) { this.indexes[id] = index - 1 } } this.markDirty() return this } replaceValues(pattern, opts, callback) { if (!callback) { callback = opts opts = {} } this.walkDecls(decl => { if (opts.props && !opts.props.includes(decl.prop)) return if (opts.fast && !decl.value.includes(opts.fast)) return decl.value = decl.value.replace(pattern, callback) }) this.markDirty() return this } some(condition) { return this.nodes.some(condition) } walk(callback) { return this.each((child, i) => { let result try { result = callback(child, i) } catch (e) { throw child.addToError(e) } if (result !== false && child.walk) { result = child.walk(callback) } return result }) } walkAtRules(name, callback) { if (!callback) { callback = name return this.walk((child, i) => { if (child.type === 'atrule') { return callback(child, i) } }) } if (name instanceof RegExp) { return this.walk((child, i) => { if (child.type === 'atrule' && name.test(child.name)) { return callback(child, i) } }) } return this.walk((child, i) => { if (child.type === 'atrule' && child.name === name) { return callback(child, i) } }) } walkComments(callback) { return this.walk((child, i) => { if (child.type === 'comment') { return callback(child, i) } }) } walkDecls(prop, callback) { if (!callback) { callback = prop return this.walk((child, i) => { if (child.type === 'decl') { return callback(child, i) } }) } if (prop instanceof RegExp) { return this.walk((child, i) => { if (child.type === 'decl' && prop.test(child.prop)) { return callback(child, i) } }) } return this.walk((child, i) => { if (child.type === 'decl' && child.prop === prop) { return callback(child, i) } }) } walkRules(selector, callback) { if (!callback) { callback = selector return this.walk((child, i) => { if (child.type === 'rule') { return callback(child, i) } }) } if (selector instanceof RegExp) { return this.walk((child, i) => { if (child.type === 'rule' && selector.test(child.selector)) { return callback(child, i) } }) } return this.walk((child, i) => { if (child.type === 'rule' && child.selector === selector) { return callback(child, i) } }) } } Container.registerParse = dependant => { parse = dependant } Container.registerRule = dependant => { Rule = dependant } Container.registerAtRule = dependant => { AtRule = dependant } Container.registerRoot = dependant => { Root = dependant } module.exports = Container Container.default = Container /* c8 ignore start */ Container.rebuild = node => { if (node.type === 'atrule') { Object.setPrototypeOf(node, AtRule.prototype) } else if (node.type === 'rule') { Object.setPrototypeOf(node, Rule.prototype) } else if (node.type === 'decl') { Object.setPrototypeOf(node, Declaration.prototype) } else if (node.type === 'comment') { Object.setPrototypeOf(node, Comment.prototype) } else if (node.type === 'root') { Object.setPrototypeOf(node, Root.prototype) } node[my] = true if (node.nodes) { node.nodes.forEach(child => { Container.rebuild(child) }) } } /* c8 ignore stop */ /***/ }), /***/ 1087: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule isEventSupported */ var ExecutionEnvironment = __webpack_require__(8202); var useHasFeature; if (ExecutionEnvironment.canUseDOM) { useHasFeature = document.implementation && document.implementation.hasFeature && // always returns true in newer browsers as per the standard. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature document.implementation.hasFeature('', '') !== true; } /** * Checks if an event is supported in the current execution environment. * * NOTE: This will not work correctly for non-generic events such as `change`, * `reset`, `load`, `error`, and `select`. * * Borrows from Modernizr. * * @param {string} eventNameSuffix Event name, e.g. "click". * @param {?boolean} capture Check if the capture phase is supported. * @return {boolean} True if the event is supported. * @internal * @license Modernizr 3.0.0pre (Custom Build) | MIT */ function isEventSupported(eventNameSuffix, capture) { if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { return false; } var eventName = 'on' + eventNameSuffix; var isSupported = eventName in document; if (!isSupported) { var element = document.createElement('div'); element.setAttribute(eventName, 'return;'); isSupported = typeof element[eventName] === 'function'; } if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { // This is the only way to test support for the `wheel` event in IE9+. isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); } return isSupported; } module.exports = isEventSupported; /***/ }), /***/ 1326: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Container = __webpack_require__(683) class AtRule extends Container { constructor(defaults) { super(defaults) this.type = 'atrule' } append(...children) { if (!this.proxyOf.nodes) this.nodes = [] return super.append(...children) } prepend(...children) { if (!this.proxyOf.nodes) this.nodes = [] return super.prepend(...children) } } module.exports = AtRule AtRule.default = AtRule Container.registerAtRule(AtRule) /***/ }), /***/ 1381: /***/ ((module) => { "use strict"; module.exports.isClean = Symbol('isClean') module.exports.my = Symbol('my') /***/ }), /***/ 1443: /***/ ((module) => { module.exports = function postcssPrefixSelector(options) { const prefix = options.prefix; const prefixWithSpace = /\s+$/.test(prefix) ? prefix : `${prefix} `; const ignoreFiles = options.ignoreFiles ? [].concat(options.ignoreFiles) : []; const includeFiles = options.includeFiles ? [].concat(options.includeFiles) : []; return function (root) { if ( ignoreFiles.length && root.source.input.file && isFileInArray(root.source.input.file, ignoreFiles) ) { return; } if ( includeFiles.length && root.source.input.file && !isFileInArray(root.source.input.file, includeFiles) ) { return; } root.walkRules((rule) => { const keyframeRules = [ 'keyframes', '-webkit-keyframes', '-moz-keyframes', '-o-keyframes', '-ms-keyframes', ]; if (rule.parent && keyframeRules.includes(rule.parent.name)) { return; } rule.selectors = rule.selectors.map((selector) => { if (options.exclude && excludeSelector(selector, options.exclude)) { return selector; } if (options.transform) { return options.transform( prefix, selector, prefixWithSpace + selector, root.source.input.file, rule ); } return prefixWithSpace + selector; }); }); }; }; function isFileInArray(file, arr) { return arr.some((ruleOrString) => { if (ruleOrString instanceof RegExp) { return ruleOrString.test(file); } return file.includes(ruleOrString); }); } function excludeSelector(selector, excludeArr) { return excludeArr.some((excludeRule) => { if (excludeRule instanceof RegExp) { return excludeRule.test(selector); } return selector === excludeRule; }); } /***/ }), /***/ 1516: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Node = __webpack_require__(7490) class Declaration extends Node { get variable() { return this.prop.startsWith('--') || this.prop[0] === '$' } constructor(defaults) { if ( defaults && typeof defaults.value !== 'undefined' && typeof defaults.value !== 'string' ) { defaults = { ...defaults, value: String(defaults.value) } } super(defaults) this.type = 'decl' } } module.exports = Declaration Declaration.default = Declaration /***/ }), /***/ 1524: /***/ ((module) => { var minus = "-".charCodeAt(0); var plus = "+".charCodeAt(0); var dot = ".".charCodeAt(0); var exp = "e".charCodeAt(0); var EXP = "E".charCodeAt(0); // Check if three code points would start a number // https://www.w3.org/TR/css-syntax-3/#starts-with-a-number function likeNumber(value) { var code = value.charCodeAt(0); var nextCode; if (code === plus || code === minus) { nextCode = value.charCodeAt(1); if (nextCode >= 48 && nextCode <= 57) { return true; } var nextNextCode = value.charCodeAt(2); if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) { return true; } return false; } if (code === dot) { nextCode = value.charCodeAt(1); if (nextCode >= 48 && nextCode <= 57) { return true; } return false; } if (code >= 48 && code <= 57) { return true; } return false; } // Consume a number // https://www.w3.org/TR/css-syntax-3/#consume-number module.exports = function(value) { var pos = 0; var length = value.length; var code; var nextCode; var nextNextCode; if (length === 0 || !likeNumber(value)) { return false; } code = value.charCodeAt(pos); if (code === plus || code === minus) { pos++; } while (pos < length) { code = value.charCodeAt(pos); if (code < 48 || code > 57) { break; } pos += 1; } code = value.charCodeAt(pos); nextCode = value.charCodeAt(pos + 1); if (code === dot && nextCode >= 48 && nextCode <= 57) { pos += 2; while (pos < length) { code = value.charCodeAt(pos); if (code < 48 || code > 57) { break; } pos += 1; } } code = value.charCodeAt(pos); nextCode = value.charCodeAt(pos + 1); nextNextCode = value.charCodeAt(pos + 2); if ( (code === exp || code === EXP) && ((nextCode >= 48 && nextCode <= 57) || ((nextCode === plus || nextCode === minus) && nextNextCode >= 48 && nextNextCode <= 57)) ) { pos += nextCode === plus || nextCode === minus ? 3 : 2; while (pos < length) { code = value.charCodeAt(pos); if (code < 48 || code > 57) { break; } pos += 1; } } return { number: value.slice(0, pos), unit: value.slice(pos) }; }; /***/ }), /***/ 1544: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var parse = __webpack_require__(8491); var walk = __webpack_require__(3815); var stringify = __webpack_require__(4725); function ValueParser(value) { if (this instanceof ValueParser) { this.nodes = parse(value); return this; } return new ValueParser(value); } ValueParser.prototype.toString = function() { return Array.isArray(this.nodes) ? stringify(this.nodes) : ""; }; ValueParser.prototype.walk = function(cb, bubble) { walk(this.nodes, cb, bubble); return this; }; ValueParser.unit = __webpack_require__(1524); ValueParser.walk = walk; ValueParser.stringify = stringify; module.exports = ValueParser; /***/ }), /***/ 1609: /***/ ((module) => { "use strict"; module.exports = window["React"]; /***/ }), /***/ 1670: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let { dirname, relative, resolve, sep } = __webpack_require__(197) let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866) let { pathToFileURL } = __webpack_require__(2739) let Input = __webpack_require__(5380) let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) let pathAvailable = Boolean(dirname && resolve && relative && sep) class MapGenerator { constructor(stringify, root, opts, cssString) { this.stringify = stringify this.mapOpts = opts.map || {} this.root = root this.opts = opts this.css = cssString this.originalCSS = cssString this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute this.memoizedFileURLs = new Map() this.memoizedPaths = new Map() this.memoizedURLs = new Map() } addAnnotation() { let content if (this.isInline()) { content = 'data:application/json;base64,' + this.toBase64(this.map.toString()) } else if (typeof this.mapOpts.annotation === 'string') { content = this.mapOpts.annotation } else if (typeof this.mapOpts.annotation === 'function') { content = this.mapOpts.annotation(this.opts.to, this.root) } else { content = this.outputFile() + '.map' } let eol = '\n' if (this.css.includes('\r\n')) eol = '\r\n' this.css += eol + '/*# sourceMappingURL=' + content + ' */' } applyPrevMaps() { for (let prev of this.previous()) { let from = this.toUrl(this.path(prev.file)) let root = prev.root || dirname(prev.file) let map if (this.mapOpts.sourcesContent === false) { map = new SourceMapConsumer(prev.text) if (map.sourcesContent) { map.sourcesContent = null } } else { map = prev.consumer() } this.map.applySourceMap(map, from, this.toUrl(this.path(root))) } } clearAnnotation() { if (this.mapOpts.annotation === false) return if (this.root) { let node for (let i = this.root.nodes.length - 1; i >= 0; i--) { node = this.root.nodes[i] if (node.type !== 'comment') continue if (node.text.startsWith('# sourceMappingURL=')) { this.root.removeChild(i) } } } else if (this.css) { this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, '') } } generate() { this.clearAnnotation() if (pathAvailable && sourceMapAvailable && this.isMap()) { return this.generateMap() } else { let result = '' this.stringify(this.root, i => { result += i }) return [result] } } generateMap() { if (this.root) { this.generateString() } else if (this.previous().length === 1) { let prev = this.previous()[0].consumer() prev.file = this.outputFile() this.map = SourceMapGenerator.fromSourceMap(prev, { ignoreInvalidMapping: true }) } else { this.map = new SourceMapGenerator({ file: this.outputFile(), ignoreInvalidMapping: true }) this.map.addMapping({ generated: { column: 0, line: 1 }, original: { column: 0, line: 1 }, source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : '<no source>' }) } if (this.isSourcesContent()) this.setSourcesContent() if (this.root && this.previous().length > 0) this.applyPrevMaps() if (this.isAnnotation()) this.addAnnotation() if (this.isInline()) { return [this.css] } else { return [this.css, this.map] } } generateString() { this.css = '' this.map = new SourceMapGenerator({ file: this.outputFile(), ignoreInvalidMapping: true }) let line = 1 let column = 1 let noSource = '<no source>' let mapping = { generated: { column: 0, line: 0 }, original: { column: 0, line: 0 }, source: '' } let last, lines this.stringify(this.root, (str, node, type) => { this.css += str if (node && type !== 'end') { mapping.generated.line = line mapping.generated.column = column - 1 if (node.source && node.source.start) { mapping.source = this.sourcePath(node) mapping.original.line = node.source.start.line mapping.original.column = node.source.start.column - 1 this.map.addMapping(mapping) } else { mapping.source = noSource mapping.original.line = 1 mapping.original.column = 0 this.map.addMapping(mapping) } } lines = str.match(/\n/g) if (lines) { line += lines.length last = str.lastIndexOf('\n') column = str.length - last } else { column += str.length } if (node && type !== 'start') { let p = node.parent || { raws: {} } let childless = node.type === 'decl' || (node.type === 'atrule' && !node.nodes) if (!childless || node !== p.last || p.raws.semicolon) { if (node.source && node.source.end) { mapping.source = this.sourcePath(node) mapping.original.line = node.source.end.line mapping.original.column = node.source.end.column - 1 mapping.generated.line = line mapping.generated.column = column - 2 this.map.addMapping(mapping) } else { mapping.source = noSource mapping.original.line = 1 mapping.original.column = 0 mapping.generated.line = line mapping.generated.column = column - 1 this.map.addMapping(mapping) } } } }) } isAnnotation() { if (this.isInline()) { return true } if (typeof this.mapOpts.annotation !== 'undefined') { return this.mapOpts.annotation } if (this.previous().length) { return this.previous().some(i => i.annotation) } return true } isInline() { if (typeof this.mapOpts.inline !== 'undefined') { return this.mapOpts.inline } let annotation = this.mapOpts.annotation if (typeof annotation !== 'undefined' && annotation !== true) { return false } if (this.previous().length) { return this.previous().some(i => i.inline) } return true } isMap() { if (typeof this.opts.map !== 'undefined') { return !!this.opts.map } return this.previous().length > 0 } isSourcesContent() { if (typeof this.mapOpts.sourcesContent !== 'undefined') { return this.mapOpts.sourcesContent } if (this.previous().length) { return this.previous().some(i => i.withContent()) } return true } outputFile() { if (this.opts.to) { return this.path(this.opts.to) } else if (this.opts.from) { return this.path(this.opts.from) } else { return 'to.css' } } path(file) { if (this.mapOpts.absolute) return file if (file.charCodeAt(0) === 60 /* `<` */) return file if (/^\w+:\/\//.test(file)) return file let cached = this.memoizedPaths.get(file) if (cached) return cached let from = this.opts.to ? dirname(this.opts.to) : '.' if (typeof this.mapOpts.annotation === 'string') { from = dirname(resolve(from, this.mapOpts.annotation)) } let path = relative(from, file) this.memoizedPaths.set(file, path) return path } previous() { if (!this.previousMaps) { this.previousMaps = [] if (this.root) { this.root.walk(node => { if (node.source && node.source.input.map) { let map = node.source.input.map if (!this.previousMaps.includes(map)) { this.previousMaps.push(map) } } }) } else { let input = new Input(this.originalCSS, this.opts) if (input.map) this.previousMaps.push(input.map) } } return this.previousMaps } setSourcesContent() { let already = {} if (this.root) { this.root.walk(node => { if (node.source) { let from = node.source.input.from if (from && !already[from]) { already[from] = true let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from)) this.map.setSourceContent(fromUrl, node.source.input.css) } } }) } else if (this.css) { let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : '<no source>' this.map.setSourceContent(from, this.css) } } sourcePath(node) { if (this.mapOpts.from) { return this.toUrl(this.mapOpts.from) } else if (this.usesFileUrls) { return this.toFileUrl(node.source.input.from) } else { return this.toUrl(this.path(node.source.input.from)) } } toBase64(str) { if (Buffer) { return Buffer.from(str).toString('base64') } else { return window.btoa(unescape(encodeURIComponent(str))) } } toFileUrl(path) { let cached = this.memoizedFileURLs.get(path) if (cached) return cached if (pathToFileURL) { let fileURL = pathToFileURL(path).toString() this.memoizedFileURLs.set(path, fileURL) return fileURL } else { throw new Error( '`map.absolute` option is not available in this PostCSS build' ) } } toUrl(path) { let cached = this.memoizedURLs.get(path) if (cached) return cached if (sep === '\\') { path = path.replace(/\\/g, '/') } let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent) this.memoizedURLs.set(path, url) return url } } module.exports = MapGenerator /***/ }), /***/ 1866: /***/ (() => { /* (ignored) */ /***/ }), /***/ 2213: /***/ ((module) => { /** * Copyright 2004-present Facebook. All Rights Reserved. * * @providesModule UserAgent_DEPRECATED */ /** * Provides entirely client-side User Agent and OS detection. You should prefer * the non-deprecated UserAgent module when possible, which exposes our * authoritative server-side PHP-based detection to the client. * * Usage is straightforward: * * if (UserAgent_DEPRECATED.ie()) { * // IE * } * * You can also do version checks: * * if (UserAgent_DEPRECATED.ie() >= 7) { * // IE7 or better * } * * The browser functions will return NaN if the browser does not match, so * you can also do version compares the other way: * * if (UserAgent_DEPRECATED.ie() < 7) { * // IE6 or worse * } * * Note that the version is a float and may include a minor version number, * so you should always use range operators to perform comparisons, not * strict equality. * * **Note:** You should **strongly** prefer capability detection to browser * version detection where it's reasonable: * * http://www.quirksmode.org/js/support.html * * Further, we have a large number of mature wrapper functions and classes * which abstract away many browser irregularities. Check the documentation, * grep for things, or ask on javascript@lists.facebook.com before writing yet * another copy of "event || window.event". * */ var _populated = false; // Browsers var _ie, _firefox, _opera, _webkit, _chrome; // Actual IE browser for compatibility mode var _ie_real_version; // Platforms var _osx, _windows, _linux, _android; // Architectures var _win64; // Devices var _iphone, _ipad, _native; var _mobile; function _populate() { if (_populated) { return; } _populated = true; // To work around buggy JS libraries that can't handle multi-digit // version numbers, Opera 10's user agent string claims it's Opera // 9, then later includes a Version/X.Y field: // // Opera/9.80 (foo) Presto/2.2.15 Version/10.10 var uas = navigator.userAgent; var agent = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(uas); var os = /(Mac OS X)|(Windows)|(Linux)/.exec(uas); _iphone = /\b(iPhone|iP[ao]d)/.exec(uas); _ipad = /\b(iP[ao]d)/.exec(uas); _android = /Android/i.exec(uas); _native = /FBAN\/\w+;/i.exec(uas); _mobile = /Mobile/i.exec(uas); // Note that the IE team blog would have you believe you should be checking // for 'Win64; x64'. But MSDN then reveals that you can actually be coming // from either x64 or ia64; so ultimately, you should just check for Win64 // as in indicator of whether you're in 64-bit IE. 32-bit IE on 64-bit // Windows will send 'WOW64' instead. _win64 = !!(/Win64/.exec(uas)); if (agent) { _ie = agent[1] ? parseFloat(agent[1]) : ( agent[5] ? parseFloat(agent[5]) : NaN); // IE compatibility mode if (_ie && document && document.documentMode) { _ie = document.documentMode; } // grab the "true" ie version from the trident token if available var trident = /(?:Trident\/(\d+.\d+))/.exec(uas); _ie_real_version = trident ? parseFloat(trident[1]) + 4 : _ie; _firefox = agent[2] ? parseFloat(agent[2]) : NaN; _opera = agent[3] ? parseFloat(agent[3]) : NaN; _webkit = agent[4] ? parseFloat(agent[4]) : NaN; if (_webkit) { // We do not add the regexp to the above test, because it will always // match 'safari' only since 'AppleWebKit' appears before 'Chrome' in // the userAgent string. agent = /(?:Chrome\/(\d+\.\d+))/.exec(uas); _chrome = agent && agent[1] ? parseFloat(agent[1]) : NaN; } else { _chrome = NaN; } } else { _ie = _firefox = _opera = _chrome = _webkit = NaN; } if (os) { if (os[1]) { // Detect OS X version. If no version number matches, set _osx to true. // Version examples: 10, 10_6_1, 10.7 // Parses version number as a float, taking only first two sets of // digits. If only one set of digits is found, returns just the major // version number. var ver = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(uas); _osx = ver ? parseFloat(ver[1].replace('_', '.')) : true; } else { _osx = false; } _windows = !!os[2]; _linux = !!os[3]; } else { _osx = _windows = _linux = false; } } var UserAgent_DEPRECATED = { /** * Check if the UA is Internet Explorer. * * * @return float|NaN Version number (if match) or NaN. */ ie: function() { return _populate() || _ie; }, /** * Check if we're in Internet Explorer compatibility mode. * * @return bool true if in compatibility mode, false if * not compatibility mode or not ie */ ieCompatibilityMode: function() { return _populate() || (_ie_real_version > _ie); }, /** * Whether the browser is 64-bit IE. Really, this is kind of weak sauce; we * only need this because Skype can't handle 64-bit IE yet. We need to remove * this when we don't need it -- tracked by #601957. */ ie64: function() { return UserAgent_DEPRECATED.ie() && _win64; }, /** * Check if the UA is Firefox. * * * @return float|NaN Version number (if match) or NaN. */ firefox: function() { return _populate() || _firefox; }, /** * Check if the UA is Opera. * * * @return float|NaN Version number (if match) or NaN. */ opera: function() { return _populate() || _opera; }, /** * Check if the UA is WebKit. * * * @return float|NaN Version number (if match) or NaN. */ webkit: function() { return _populate() || _webkit; }, /** * For Push * WILL BE REMOVED VERY SOON. Use UserAgent_DEPRECATED.webkit */ safari: function() { return UserAgent_DEPRECATED.webkit(); }, /** * Check if the UA is a Chrome browser. * * * @return float|NaN Version number (if match) or NaN. */ chrome : function() { return _populate() || _chrome; }, /** * Check if the user is running Windows. * * @return bool `true' if the user's OS is Windows. */ windows: function() { return _populate() || _windows; }, /** * Check if the user is running Mac OS X. * * @return float|bool Returns a float if a version number is detected, * otherwise true/false. */ osx: function() { return _populate() || _osx; }, /** * Check if the user is running Linux. * * @return bool `true' if the user's OS is some flavor of Linux. */ linux: function() { return _populate() || _linux; }, /** * Check if the user is running on an iPhone or iPod platform. * * @return bool `true' if the user is running some flavor of the * iPhone OS. */ iphone: function() { return _populate() || _iphone; }, mobile: function() { return _populate() || (_iphone || _ipad || _android || _mobile); }, nativeApp: function() { // webviews inside of the native apps return _populate() || _native; }, android: function() { return _populate() || _android; }, ipad: function() { return _populate() || _ipad; } }; module.exports = UserAgent_DEPRECATED; /***/ }), /***/ 2327: /***/ ((module) => { "use strict"; const SINGLE_QUOTE = "'".charCodeAt(0) const DOUBLE_QUOTE = '"'.charCodeAt(0) const BACKSLASH = '\\'.charCodeAt(0) const SLASH = '/'.charCodeAt(0) const NEWLINE = '\n'.charCodeAt(0) const SPACE = ' '.charCodeAt(0) const FEED = '\f'.charCodeAt(0) const TAB = '\t'.charCodeAt(0) const CR = '\r'.charCodeAt(0) const OPEN_SQUARE = '['.charCodeAt(0) const CLOSE_SQUARE = ']'.charCodeAt(0) const OPEN_PARENTHESES = '('.charCodeAt(0) const CLOSE_PARENTHESES = ')'.charCodeAt(0) const OPEN_CURLY = '{'.charCodeAt(0) const CLOSE_CURLY = '}'.charCodeAt(0) const SEMICOLON = ';'.charCodeAt(0) const ASTERISK = '*'.charCodeAt(0) const COLON = ':'.charCodeAt(0) const AT = '@'.charCodeAt(0) const RE_AT_END = /[\t\n\f\r "#'()/;[\\\]{}]/g const RE_WORD_END = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g const RE_BAD_BRACKET = /.[\r\n"'(/\\]/ const RE_HEX_ESCAPE = /[\da-f]/i module.exports = function tokenizer(input, options = {}) { let css = input.css.valueOf() let ignore = options.ignoreErrors let code, content, escape, next, quote let currentToken, escaped, escapePos, n, prev let length = css.length let pos = 0 let buffer = [] let returned = [] function position() { return pos } function unclosed(what) { throw input.error('Unclosed ' + what, pos) } function endOfFile() { return returned.length === 0 && pos >= length } function nextToken(opts) { if (returned.length) return returned.pop() if (pos >= length) return let ignoreUnclosed = opts ? opts.ignoreUnclosed : false code = css.charCodeAt(pos) switch (code) { case NEWLINE: case SPACE: case TAB: case CR: case FEED: { next = pos do { next += 1 code = css.charCodeAt(next) } while ( code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED ) currentToken = ['space', css.slice(pos, next)] pos = next - 1 break } case OPEN_SQUARE: case CLOSE_SQUARE: case OPEN_CURLY: case CLOSE_CURLY: case COLON: case SEMICOLON: case CLOSE_PARENTHESES: { let controlChar = String.fromCharCode(code) currentToken = [controlChar, controlChar, pos] break } case OPEN_PARENTHESES: { prev = buffer.length ? buffer.pop()[1] : '' n = css.charCodeAt(pos + 1) if ( prev === 'url' && n !== SINGLE_QUOTE && n !== DOUBLE_QUOTE && n !== SPACE && n !== NEWLINE && n !== TAB && n !== FEED && n !== CR ) { next = pos do { escaped = false next = css.indexOf(')', next + 1) if (next === -1) { if (ignore || ignoreUnclosed) { next = pos break } else { unclosed('bracket') } } escapePos = next while (css.charCodeAt(escapePos - 1) === BACKSLASH) { escapePos -= 1 escaped = !escaped } } while (escaped) currentToken = ['brackets', css.slice(pos, next + 1), pos, next] pos = next } else { next = css.indexOf(')', pos + 1) content = css.slice(pos, next + 1) if (next === -1 || RE_BAD_BRACKET.test(content)) { currentToken = ['(', '(', pos] } else { currentToken = ['brackets', content, pos, next] pos = next } } break } case SINGLE_QUOTE: case DOUBLE_QUOTE: { quote = code === SINGLE_QUOTE ? "'" : '"' next = pos do { escaped = false next = css.indexOf(quote, next + 1) if (next === -1) { if (ignore || ignoreUnclosed) { next = pos + 1 break } else { unclosed('string') } } escapePos = next while (css.charCodeAt(escapePos - 1) === BACKSLASH) { escapePos -= 1 escaped = !escaped } } while (escaped) currentToken = ['string', css.slice(pos, next + 1), pos, next] pos = next break } case AT: { RE_AT_END.lastIndex = pos + 1 RE_AT_END.test(css) if (RE_AT_END.lastIndex === 0) { next = css.length - 1 } else { next = RE_AT_END.lastIndex - 2 } currentToken = ['at-word', css.slice(pos, next + 1), pos, next] pos = next break } case BACKSLASH: { next = pos escape = true while (css.charCodeAt(next + 1) === BACKSLASH) { next += 1 escape = !escape } code = css.charCodeAt(next + 1) if ( escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED ) { next += 1 if (RE_HEX_ESCAPE.test(css.charAt(next))) { while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) { next += 1 } if (css.charCodeAt(next + 1) === SPACE) { next += 1 } } } currentToken = ['word', css.slice(pos, next + 1), pos, next] pos = next break } default: { if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) { next = css.indexOf('*/', pos + 2) + 1 if (next === 0) { if (ignore || ignoreUnclosed) { next = css.length } else { unclosed('comment') } } currentToken = ['comment', css.slice(pos, next + 1), pos, next] pos = next } else { RE_WORD_END.lastIndex = pos + 1 RE_WORD_END.test(css) if (RE_WORD_END.lastIndex === 0) { next = css.length - 1 } else { next = RE_WORD_END.lastIndex - 2 } currentToken = ['word', css.slice(pos, next + 1), pos, next] buffer.push(currentToken) pos = next } break } } pos++ return currentToken } function back(token) { returned.push(token) } return { back, endOfFile, nextToken, position } } /***/ }), /***/ 2739: /***/ (() => { /* (ignored) */ /***/ }), /***/ 2775: /***/ ((module) => { var x=String; var create=function() {return {isColorSupported:false,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x,blackBright:x,redBright:x,greenBright:x,yellowBright:x,blueBright:x,magentaBright:x,cyanBright:x,whiteBright:x,bgBlackBright:x,bgRedBright:x,bgGreenBright:x,bgYellowBright:x,bgBlueBright:x,bgMagentaBright:x,bgCyanBright:x,bgWhiteBright:x}}; module.exports=create(); module.exports.createColors = create; /***/ }), /***/ 3122: /***/ ((module) => { "use strict"; /* eslint-disable no-console */ let printed = {} module.exports = function warnOnce(message) { if (printed[message]) return printed[message] = true if (typeof console !== 'undefined' && console.warn) { console.warn(message) } } /***/ }), /***/ 3815: /***/ ((module) => { module.exports = function walk(nodes, cb, bubble) { var i, max, node, result; for (i = 0, max = nodes.length; i < max; i += 1) { node = nodes[i]; if (!bubble) { result = cb(node, i, nodes); } if ( result !== false && node.type === "function" && Array.isArray(node.nodes) ) { walk(node.nodes, cb, bubble); } if (bubble) { cb(node, i, nodes); } } }; /***/ }), /***/ 3937: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let AtRule = __webpack_require__(1326) let Comment = __webpack_require__(6589) let Declaration = __webpack_require__(1516) let Root = __webpack_require__(9434) let Rule = __webpack_require__(4092) let tokenizer = __webpack_require__(2327) const SAFE_COMMENT_NEIGHBOR = { empty: true, space: true } function findLastWithPosition(tokens) { for (let i = tokens.length - 1; i >= 0; i--) { let token = tokens[i] let pos = token[3] || token[2] if (pos) return pos } } class Parser { constructor(input) { this.input = input this.root = new Root() this.current = this.root this.spaces = '' this.semicolon = false this.createTokenizer() this.root.source = { input, start: { column: 1, line: 1, offset: 0 } } } atrule(token) { let node = new AtRule() node.name = token[1].slice(1) if (node.name === '') { this.unnamedAtrule(node, token) } this.init(node, token[2]) let type let prev let shift let last = false let open = false let params = [] let brackets = [] while (!this.tokenizer.endOfFile()) { token = this.tokenizer.nextToken() type = token[0] if (type === '(' || type === '[') { brackets.push(type === '(' ? ')' : ']') } else if (type === '{' && brackets.length > 0) { brackets.push('}') } else if (type === brackets[brackets.length - 1]) { brackets.pop() } if (brackets.length === 0) { if (type === ';') { node.source.end = this.getPosition(token[2]) node.source.end.offset++ this.semicolon = true break } else if (type === '{') { open = true break } else if (type === '}') { if (params.length > 0) { shift = params.length - 1 prev = params[shift] while (prev && prev[0] === 'space') { prev = params[--shift] } if (prev) { node.source.end = this.getPosition(prev[3] || prev[2]) node.source.end.offset++ } } this.end(token) break } else { params.push(token) } } else { params.push(token) } if (this.tokenizer.endOfFile()) { last = true break } } node.raws.between = this.spacesAndCommentsFromEnd(params) if (params.length) { node.raws.afterName = this.spacesAndCommentsFromStart(params) this.raw(node, 'params', params) if (last) { token = params[params.length - 1] node.source.end = this.getPosition(token[3] || token[2]) node.source.end.offset++ this.spaces = node.raws.between node.raws.between = '' } } else { node.raws.afterName = '' node.params = '' } if (open) { node.nodes = [] this.current = node } } checkMissedSemicolon(tokens) { let colon = this.colon(tokens) if (colon === false) return let founded = 0 let token for (let j = colon - 1; j >= 0; j--) { token = tokens[j] if (token[0] !== 'space') { founded += 1 if (founded === 2) break } } // If the token is a word, e.g. `!important`, `red` or any other valid property's value. // Then we need to return the colon after that word token. [3] is the "end" colon of that word. // And because we need it after that one we do +1 to get the next one. throw this.input.error( 'Missed semicolon', token[0] === 'word' ? token[3] + 1 : token[2] ) } colon(tokens) { let brackets = 0 let prev, token, type for (let [i, element] of tokens.entries()) { token = element type = token[0] if (type === '(') { brackets += 1 } if (type === ')') { brackets -= 1 } if (brackets === 0 && type === ':') { if (!prev) { this.doubleColon(token) } else if (prev[0] === 'word' && prev[1] === 'progid') { continue } else { return i } } prev = token } return false } comment(token) { let node = new Comment() this.init(node, token[2]) node.source.end = this.getPosition(token[3] || token[2]) node.source.end.offset++ let text = token[1].slice(2, -2) if (/^\s*$/.test(text)) { node.text = '' node.raws.left = text node.raws.right = '' } else { let match = text.match(/^(\s*)([^]*\S)(\s*)$/) node.text = match[2] node.raws.left = match[1] node.raws.right = match[3] } } createTokenizer() { this.tokenizer = tokenizer(this.input) } decl(tokens, customProperty) { let node = new Declaration() this.init(node, tokens[0][2]) let last = tokens[tokens.length - 1] if (last[0] === ';') { this.semicolon = true tokens.pop() } node.source.end = this.getPosition( last[3] || last[2] || findLastWithPosition(tokens) ) node.source.end.offset++ while (tokens[0][0] !== 'word') { if (tokens.length === 1) this.unknownWord(tokens) node.raws.before += tokens.shift()[1] } node.source.start = this.getPosition(tokens[0][2]) node.prop = '' while (tokens.length) { let type = tokens[0][0] if (type === ':' || type === 'space' || type === 'comment') { break } node.prop += tokens.shift()[1] } node.raws.between = '' let token while (tokens.length) { token = tokens.shift() if (token[0] === ':') { node.raws.between += token[1] break } else { if (token[0] === 'word' && /\w/.test(token[1])) { this.unknownWord([token]) } node.raws.between += token[1] } } if (node.prop[0] === '_' || node.prop[0] === '*') { node.raws.before += node.prop[0] node.prop = node.prop.slice(1) } let firstSpaces = [] let next while (tokens.length) { next = tokens[0][0] if (next !== 'space' && next !== 'comment') break firstSpaces.push(tokens.shift()) } this.precheckMissedSemicolon(tokens) for (let i = tokens.length - 1; i >= 0; i--) { token = tokens[i] if (token[1].toLowerCase() === '!important') { node.important = true let string = this.stringFrom(tokens, i) string = this.spacesFromEnd(tokens) + string if (string !== ' !important') node.raws.important = string break } else if (token[1].toLowerCase() === 'important') { let cache = tokens.slice(0) let str = '' for (let j = i; j > 0; j--) { let type = cache[j][0] if (str.trim().startsWith('!') && type !== 'space') { break } str = cache.pop()[1] + str } if (str.trim().startsWith('!')) { node.important = true node.raws.important = str tokens = cache } } if (token[0] !== 'space' && token[0] !== 'comment') { break } } let hasWord = tokens.some(i => i[0] !== 'space' && i[0] !== 'comment') if (hasWord) { node.raws.between += firstSpaces.map(i => i[1]).join('') firstSpaces = [] } this.raw(node, 'value', firstSpaces.concat(tokens), customProperty) if (node.value.includes(':') && !customProperty) { this.checkMissedSemicolon(tokens) } } doubleColon(token) { throw this.input.error( 'Double colon', { offset: token[2] }, { offset: token[2] + token[1].length } ) } emptyRule(token) { let node = new Rule() this.init(node, token[2]) node.selector = '' node.raws.between = '' this.current = node } end(token) { if (this.current.nodes && this.current.nodes.length) { this.current.raws.semicolon = this.semicolon } this.semicolon = false this.current.raws.after = (this.current.raws.after || '') + this.spaces this.spaces = '' if (this.current.parent) { this.current.source.end = this.getPosition(token[2]) this.current.source.end.offset++ this.current = this.current.parent } else { this.unexpectedClose(token) } } endFile() { if (this.current.parent) this.unclosedBlock() if (this.current.nodes && this.current.nodes.length) { this.current.raws.semicolon = this.semicolon } this.current.raws.after = (this.current.raws.after || '') + this.spaces this.root.source.end = this.getPosition(this.tokenizer.position()) } freeSemicolon(token) { this.spaces += token[1] if (this.current.nodes) { let prev = this.current.nodes[this.current.nodes.length - 1] if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) { prev.raws.ownSemicolon = this.spaces this.spaces = '' prev.source.end = this.getPosition(token[2]) prev.source.end.offset += prev.raws.ownSemicolon.length } } } // Helpers getPosition(offset) { let pos = this.input.fromOffset(offset) return { column: pos.col, line: pos.line, offset } } init(node, offset) { this.current.push(node) node.source = { input: this.input, start: this.getPosition(offset) } node.raws.before = this.spaces this.spaces = '' if (node.type !== 'comment') this.semicolon = false } other(start) { let end = false let type = null let colon = false let bracket = null let brackets = [] let customProperty = start[1].startsWith('--') let tokens = [] let token = start while (token) { type = token[0] tokens.push(token) if (type === '(' || type === '[') { if (!bracket) bracket = token brackets.push(type === '(' ? ')' : ']') } else if (customProperty && colon && type === '{') { if (!bracket) bracket = token brackets.push('}') } else if (brackets.length === 0) { if (type === ';') { if (colon) { this.decl(tokens, customProperty) return } else { break } } else if (type === '{') { this.rule(tokens) return } else if (type === '}') { this.tokenizer.back(tokens.pop()) end = true break } else if (type === ':') { colon = true } } else if (type === brackets[brackets.length - 1]) { brackets.pop() if (brackets.length === 0) bracket = null } token = this.tokenizer.nextToken() } if (this.tokenizer.endOfFile()) end = true if (brackets.length > 0) this.unclosedBracket(bracket) if (end && colon) { if (!customProperty) { while (tokens.length) { token = tokens[tokens.length - 1][0] if (token !== 'space' && token !== 'comment') break this.tokenizer.back(tokens.pop()) } } this.decl(tokens, customProperty) } else { this.unknownWord(tokens) } } parse() { let token while (!this.tokenizer.endOfFile()) { token = this.tokenizer.nextToken() switch (token[0]) { case 'space': this.spaces += token[1] break case ';': this.freeSemicolon(token) break case '}': this.end(token) break case 'comment': this.comment(token) break case 'at-word': this.atrule(token) break case '{': this.emptyRule(token) break default: this.other(token) break } } this.endFile() } precheckMissedSemicolon(/* tokens */) { // Hook for Safe Parser } raw(node, prop, tokens, customProperty) { let token, type let length = tokens.length let value = '' let clean = true let next, prev for (let i = 0; i < length; i += 1) { token = tokens[i] type = token[0] if (type === 'space' && i === length - 1 && !customProperty) { clean = false } else if (type === 'comment') { prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty' next = tokens[i + 1] ? tokens[i + 1][0] : 'empty' if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) { if (value.slice(-1) === ',') { clean = false } else { value += token[1] } } else { clean = false } } else { value += token[1] } } if (!clean) { let raw = tokens.reduce((all, i) => all + i[1], '') node.raws[prop] = { raw, value } } node[prop] = value } rule(tokens) { tokens.pop() let node = new Rule() this.init(node, tokens[0][2]) node.raws.between = this.spacesAndCommentsFromEnd(tokens) this.raw(node, 'selector', tokens) this.current = node } spacesAndCommentsFromEnd(tokens) { let lastTokenType let spaces = '' while (tokens.length) { lastTokenType = tokens[tokens.length - 1][0] if (lastTokenType !== 'space' && lastTokenType !== 'comment') break spaces = tokens.pop()[1] + spaces } return spaces } // Errors spacesAndCommentsFromStart(tokens) { let next let spaces = '' while (tokens.length) { next = tokens[0][0] if (next !== 'space' && next !== 'comment') break spaces += tokens.shift()[1] } return spaces } spacesFromEnd(tokens) { let lastTokenType let spaces = '' while (tokens.length) { lastTokenType = tokens[tokens.length - 1][0] if (lastTokenType !== 'space') break spaces = tokens.pop()[1] + spaces } return spaces } stringFrom(tokens, from) { let result = '' for (let i = from; i < tokens.length; i++) { result += tokens[i][1] } tokens.splice(from, tokens.length - from) return result } unclosedBlock() { let pos = this.current.source.start throw this.input.error('Unclosed block', pos.line, pos.column) } unclosedBracket(bracket) { throw this.input.error( 'Unclosed bracket', { offset: bracket[2] }, { offset: bracket[2] + 1 } ) } unexpectedClose(token) { throw this.input.error( 'Unexpected }', { offset: token[2] }, { offset: token[2] + 1 } ) } unknownWord(tokens) { throw this.input.error( 'Unknown word ' + tokens[0][1], { offset: tokens[0][2] }, { offset: tokens[0][2] + tokens[0][1].length } ) } unnamedAtrule(node, token) { throw this.input.error( 'At-rule without name', { offset: token[2] }, { offset: token[2] + token[1].length } ) } } module.exports = Parser /***/ }), /***/ 4067: /***/ ((module) => { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; /***/ }), /***/ 4092: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Container = __webpack_require__(683) let list = __webpack_require__(7374) class Rule extends Container { get selectors() { return list.comma(this.selector) } set selectors(values) { let match = this.selector ? this.selector.match(/,\s*/) : null let sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen') this.selector = values.join(sep) } constructor(defaults) { super(defaults) this.type = 'rule' if (!this.nodes) this.nodes = [] } } module.exports = Rule Rule.default = Rule Container.registerRule(Rule) /***/ }), /***/ 4132: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; var __webpack_unused_export__; __webpack_unused_export__ = true; var TextareaAutosize_1 = __webpack_require__(4462); exports.A = TextareaAutosize_1.TextareaAutosize; /***/ }), /***/ 4295: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Container = __webpack_require__(683) let Input = __webpack_require__(5380) let Parser = __webpack_require__(3937) function parse(css, opts) { let input = new Input(css, opts) let parser = new Parser(input) try { parser.parse() } catch (e) { if (false) {} throw e } return parser.root } module.exports = parse parse.default = parse Container.registerParse(parse) /***/ }), /***/ 4306: /***/ (function(module, exports) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! autosize 4.0.4 license: MIT http://www.jacklmoore.com/autosize */ (function (global, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { var mod; } })(this, function (module, exports) { 'use strict'; var map = typeof Map === "function" ? new Map() : function () { var keys = []; var values = []; return { has: function has(key) { return keys.indexOf(key) > -1; }, get: function get(key) { return values[keys.indexOf(key)]; }, set: function set(key, value) { if (keys.indexOf(key) === -1) { keys.push(key); values.push(value); } }, delete: function _delete(key) { var index = keys.indexOf(key); if (index > -1) { keys.splice(index, 1); values.splice(index, 1); } } }; }(); var createEvent = function createEvent(name) { return new Event(name, { bubbles: true }); }; try { new Event('test'); } catch (e) { // IE does not support `new Event()` createEvent = function createEvent(name) { var evt = document.createEvent('Event'); evt.initEvent(name, true, false); return evt; }; } function assign(ta) { if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; var heightOffset = null; var clientWidth = null; var cachedHeight = null; function init() { var style = window.getComputedStyle(ta, null); if (style.resize === 'vertical') { ta.style.resize = 'none'; } else if (style.resize === 'both') { ta.style.resize = 'horizontal'; } if (style.boxSizing === 'content-box') { heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); } else { heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); } // Fix when a textarea is not on document body and heightOffset is Not a Number if (isNaN(heightOffset)) { heightOffset = 0; } update(); } function changeOverflow(value) { { // Chrome/Safari-specific fix: // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space // made available by removing the scrollbar. The following forces the necessary text reflow. var width = ta.style.width; ta.style.width = '0px'; // Force reflow: /* jshint ignore:start */ ta.offsetWidth; /* jshint ignore:end */ ta.style.width = width; } ta.style.overflowY = value; } function getParentOverflows(el) { var arr = []; while (el && el.parentNode && el.parentNode instanceof Element) { if (el.parentNode.scrollTop) { arr.push({ node: el.parentNode, scrollTop: el.parentNode.scrollTop }); } el = el.parentNode; } return arr; } function resize() { if (ta.scrollHeight === 0) { // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. return; } var overflows = getParentOverflows(ta); var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) ta.style.height = ''; ta.style.height = ta.scrollHeight + heightOffset + 'px'; // used to check if an update is actually necessary on window.resize clientWidth = ta.clientWidth; // prevents scroll-position jumping overflows.forEach(function (el) { el.node.scrollTop = el.scrollTop; }); if (docTop) { document.documentElement.scrollTop = docTop; } } function update() { resize(); var styleHeight = Math.round(parseFloat(ta.style.height)); var computed = window.getComputedStyle(ta, null); // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; // The actual height not matching the style height (set via the resize method) indicates that // the max-height has been exceeded, in which case the overflow should be allowed. if (actualHeight < styleHeight) { if (computed.overflowY === 'hidden') { changeOverflow('scroll'); resize(); actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; } } else { // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. if (computed.overflowY !== 'hidden') { changeOverflow('hidden'); resize(); actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; } } if (cachedHeight !== actualHeight) { cachedHeight = actualHeight; var evt = createEvent('autosize:resized'); try { ta.dispatchEvent(evt); } catch (err) { // Firefox will throw an error on dispatchEvent for a detached element // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 } } } var pageResize = function pageResize() { if (ta.clientWidth !== clientWidth) { update(); } }; var destroy = function (style) { window.removeEventListener('resize', pageResize, false); ta.removeEventListener('input', update, false); ta.removeEventListener('keyup', update, false); ta.removeEventListener('autosize:destroy', destroy, false); ta.removeEventListener('autosize:update', update, false); Object.keys(style).forEach(function (key) { ta.style[key] = style[key]; }); map.delete(ta); }.bind(ta, { height: ta.style.height, resize: ta.style.resize, overflowY: ta.style.overflowY, overflowX: ta.style.overflowX, wordWrap: ta.style.wordWrap }); ta.addEventListener('autosize:destroy', destroy, false); // IE9 does not fire onpropertychange or oninput for deletions, // so binding to onkeyup to catch most of those events. // There is no way that I know of to detect something like 'cut' in IE9. if ('onpropertychange' in ta && 'oninput' in ta) { ta.addEventListener('keyup', update, false); } window.addEventListener('resize', pageResize, false); ta.addEventListener('input', update, false); ta.addEventListener('autosize:update', update, false); ta.style.overflowX = 'hidden'; ta.style.wordWrap = 'break-word'; map.set(ta, { destroy: destroy, update: update }); init(); } function destroy(ta) { var methods = map.get(ta); if (methods) { methods.destroy(); } } function update(ta) { var methods = map.get(ta); if (methods) { methods.update(); } } var autosize = null; // Do nothing in Node.js environment and IE8 (or lower) if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { autosize = function autosize(el) { return el; }; autosize.destroy = function (el) { return el; }; autosize.update = function (el) { return el; }; } else { autosize = function autosize(el, options) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], function (x) { return assign(x, options); }); } return el; }; autosize.destroy = function (el) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], destroy); } return el; }; autosize.update = function (el) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], update); } return el; }; } exports.default = autosize; module.exports = exports['default']; }); /***/ }), /***/ 4462: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; }; exports.__esModule = true; var React = __webpack_require__(1609); var PropTypes = __webpack_require__(5826); var autosize = __webpack_require__(4306); var _getLineHeight = __webpack_require__(461); var getLineHeight = _getLineHeight; var RESIZED = "autosize:resized"; /** * A light replacement for built-in textarea component * which automaticaly adjusts its height to match the content */ var TextareaAutosizeClass = /** @class */ (function (_super) { __extends(TextareaAutosizeClass, _super); function TextareaAutosizeClass() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.state = { lineHeight: null }; _this.textarea = null; _this.onResize = function (e) { if (_this.props.onResize) { _this.props.onResize(e); } }; _this.updateLineHeight = function () { if (_this.textarea) { _this.setState({ lineHeight: getLineHeight(_this.textarea) }); } }; _this.onChange = function (e) { var onChange = _this.props.onChange; _this.currentValue = e.currentTarget.value; onChange && onChange(e); }; return _this; } TextareaAutosizeClass.prototype.componentDidMount = function () { var _this = this; var _a = this.props, maxRows = _a.maxRows, async = _a.async; if (typeof maxRows === "number") { this.updateLineHeight(); } if (typeof maxRows === "number" || async) { /* the defer is needed to: - force "autosize" to activate the scrollbar when this.props.maxRows is passed - support StyledComponents (see #71) */ setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); } else { this.textarea && autosize(this.textarea); } if (this.textarea) { this.textarea.addEventListener(RESIZED, this.onResize); } }; TextareaAutosizeClass.prototype.componentWillUnmount = function () { if (this.textarea) { this.textarea.removeEventListener(RESIZED, this.onResize); autosize.destroy(this.textarea); } }; TextareaAutosizeClass.prototype.render = function () { var _this = this; var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight; var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { _this.textarea = element; if (typeof _this.props.innerRef === 'function') { _this.props.innerRef(element); } else if (_this.props.innerRef) { _this.props.innerRef.current = element; } } }), children)); }; TextareaAutosizeClass.prototype.componentDidUpdate = function () { this.textarea && autosize.update(this.textarea); }; TextareaAutosizeClass.defaultProps = { rows: 1, async: false }; TextareaAutosizeClass.propTypes = { rows: PropTypes.number, maxRows: PropTypes.number, onResize: PropTypes.func, innerRef: PropTypes.any, async: PropTypes.bool }; return TextareaAutosizeClass; }(React.Component)); exports.TextareaAutosize = React.forwardRef(function (props, ref) { return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); }); /***/ }), /***/ 4725: /***/ ((module) => { function stringifyNode(node, custom) { var type = node.type; var value = node.value; var buf; var customResult; if (custom && (customResult = custom(node)) !== undefined) { return customResult; } else if (type === "word" || type === "space") { return value; } else if (type === "string") { buf = node.quote || ""; return buf + value + (node.unclosed ? "" : buf); } else if (type === "comment") { return "/*" + value + (node.unclosed ? "" : "*/"); } else if (type === "div") { return (node.before || "") + value + (node.after || ""); } else if (Array.isArray(node.nodes)) { buf = stringify(node.nodes, custom); if (type !== "function") { return buf; } return ( value + "(" + (node.before || "") + buf + (node.after || "") + (node.unclosed ? "" : ")") ); } return value; } function stringify(nodes, custom) { var result, i; if (Array.isArray(nodes)) { result = ""; for (i = nodes.length - 1; ~i; i -= 1) { result = stringifyNode(nodes[i], custom) + result; } return result; } return stringifyNode(nodes, custom); } module.exports = stringify; /***/ }), /***/ 5042: /***/ ((module) => { // This alphabet uses `A-Za-z0-9_-` symbols. // The order of characters is optimized for better gzip and brotli compression. // References to the same file (works both for gzip and brotli): // `'use`, `andom`, and `rict'` // References to the brotli default dictionary: // `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf` let urlAlphabet = 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' let customAlphabet = (alphabet, defaultSize = 21) => { return (size = defaultSize) => { let id = '' // A compact alternative for `for (var i = 0; i < step; i++)`. let i = size | 0 while (i--) { // `| 0` is more compact and faster than `Math.floor()`. id += alphabet[(Math.random() * alphabet.length) | 0] } return id } } let nanoid = (size = 21) => { let id = '' // A compact alternative for `for (var i = 0; i < step; i++)`. let i = size | 0 while (i--) { // `| 0` is more compact and faster than `Math.floor()`. id += urlAlphabet[(Math.random() * 64) | 0] } return id } module.exports = { nanoid, customAlphabet } /***/ }), /***/ 5215: /***/ ((module) => { "use strict"; // do not edit .js files directly - edit src/index.jst module.exports = function equal(a, b) { if (a === b) return true; if (a && b && typeof a == 'object' && typeof b == 'object') { if (a.constructor !== b.constructor) return false; var length, i, keys; if (Array.isArray(a)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false; return true; } if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; for (i = length; i-- !== 0;) { var key = keys[i]; if (!equal(a[key], b[key])) return false; } return true; } // true if both NaN, false otherwise return a!==a && b!==b; }; /***/ }), /***/ 5380: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let { nanoid } = __webpack_require__(5042) let { isAbsolute, resolve } = __webpack_require__(197) let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866) let { fileURLToPath, pathToFileURL } = __webpack_require__(2739) let CssSyntaxError = __webpack_require__(356) let PreviousMap = __webpack_require__(5696) let terminalHighlight = __webpack_require__(9746) let lineToIndexCache = Symbol('lineToIndexCache') let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) let pathAvailable = Boolean(resolve && isAbsolute) function getLineToIndex(input) { if (input[lineToIndexCache]) return input[lineToIndexCache] let lines = input.css.split('\n') let lineToIndex = new Array(lines.length) let prevIndex = 0 for (let i = 0, l = lines.length; i < l; i++) { lineToIndex[i] = prevIndex prevIndex += lines[i].length + 1 } input[lineToIndexCache] = lineToIndex return lineToIndex } class Input { get from() { return this.file || this.id } constructor(css, opts = {}) { if ( css === null || typeof css === 'undefined' || (typeof css === 'object' && !css.toString) ) { throw new Error(`PostCSS received ${css} instead of CSS string`) } this.css = css.toString() if (this.css[0] === '\uFEFF' || this.css[0] === '\uFFFE') { this.hasBOM = true this.css = this.css.slice(1) } else { this.hasBOM = false } this.document = this.css if (opts.document) this.document = opts.document.toString() if (opts.from) { if ( !pathAvailable || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from) ) { this.file = opts.from } else { this.file = resolve(opts.from) } } if (pathAvailable && sourceMapAvailable) { let map = new PreviousMap(this.css, opts) if (map.text) { this.map = map let file = map.consumer().file if (!this.file && file) this.file = this.mapResolve(file) } } if (!this.file) { this.id = '<input css ' + nanoid(6) + '>' } if (this.map) this.map.file = this.from } error(message, line, column, opts = {}) { let endColumn, endLine, endOffset, offset, result if (line && typeof line === 'object') { let start = line let end = column if (typeof start.offset === 'number') { offset = start.offset let pos = this.fromOffset(offset) line = pos.line column = pos.col } else { line = start.line column = start.column offset = this.fromLineAndColumn(line, column) } if (typeof end.offset === 'number') { endOffset = end.offset let pos = this.fromOffset(endOffset) endLine = pos.line endColumn = pos.col } else { endLine = end.line endColumn = end.column endOffset = this.fromLineAndColumn(end.line, end.column) } } else if (!column) { offset = line let pos = this.fromOffset(offset) line = pos.line column = pos.col } else { offset = this.fromLineAndColumn(line, column) } let origin = this.origin(line, column, endLine, endColumn) if (origin) { result = new CssSyntaxError( message, origin.endLine === undefined ? origin.line : { column: origin.column, line: origin.line }, origin.endLine === undefined ? origin.column : { column: origin.endColumn, line: origin.endLine }, origin.source, origin.file, opts.plugin ) } else { result = new CssSyntaxError( message, endLine === undefined ? line : { column, line }, endLine === undefined ? column : { column: endColumn, line: endLine }, this.css, this.file, opts.plugin ) } result.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css } if (this.file) { if (pathToFileURL) { result.input.url = pathToFileURL(this.file).toString() } result.input.file = this.file } return result } fromLineAndColumn(line, column) { let lineToIndex = getLineToIndex(this) let index = lineToIndex[line - 1] return index + column - 1 } fromOffset(offset) { let lineToIndex = getLineToIndex(this) let lastLine = lineToIndex[lineToIndex.length - 1] let min = 0 if (offset >= lastLine) { min = lineToIndex.length - 1 } else { let max = lineToIndex.length - 2 let mid while (min < max) { mid = min + ((max - min) >> 1) if (offset < lineToIndex[mid]) { max = mid - 1 } else if (offset >= lineToIndex[mid + 1]) { min = mid + 1 } else { min = mid break } } } return { col: offset - lineToIndex[min] + 1, line: min + 1 } } mapResolve(file) { if (/^\w+:\/\//.test(file)) { return file } return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file) } origin(line, column, endLine, endColumn) { if (!this.map) return false let consumer = this.map.consumer() let from = consumer.originalPositionFor({ column, line }) if (!from.source) return false let to if (typeof endLine === 'number') { to = consumer.originalPositionFor({ column: endColumn, line: endLine }) } let fromUrl if (isAbsolute(from.source)) { fromUrl = pathToFileURL(from.source) } else { fromUrl = new URL( from.source, this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile) ) } let result = { column: from.column, endColumn: to && to.column, endLine: to && to.line, line: from.line, url: fromUrl.toString() } if (fromUrl.protocol === 'file:') { if (fileURLToPath) { result.file = fileURLToPath(fromUrl) } else { /* c8 ignore next 2 */ throw new Error(`file: protocol is not available in this PostCSS build`) } } let source = consumer.sourceContentFor(from.source) if (source) result.source = source return result } toJSON() { let json = {} for (let name of ['hasBOM', 'css', 'file', 'id']) { if (this[name] != null) { json[name] = this[name] } } if (this.map) { json.map = { ...this.map } if (json.map.consumerCache) { json.map.consumerCache = undefined } } return json } } module.exports = Input Input.default = Input if (terminalHighlight && terminalHighlight.registerInput) { terminalHighlight.registerInput(Input) } /***/ }), /***/ 5404: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { const CSSValueParser = __webpack_require__(1544) /** * @type {import('postcss').PluginCreator} */ module.exports = (opts) => { const DEFAULTS = { skipHostRelativeUrls: true, } const config = Object.assign(DEFAULTS, opts) return { postcssPlugin: 'rebaseUrl', Declaration(decl) { // The faster way to find Declaration node const parsedValue = CSSValueParser(decl.value) let valueChanged = false parsedValue.walk(node => { if (node.type !== 'function' || node.value !== 'url') { return } const urlVal = node.nodes[0].value // bases relative URLs with rootUrl const basedUrl = new URL(urlVal, opts.rootUrl) // skip host-relative, already normalized URLs (e.g. `/images/image.jpg`, without `..`s) if ((basedUrl.pathname === urlVal) && config.skipHostRelativeUrls) { return false // skip this value } node.nodes[0].value = basedUrl.toString() valueChanged = true return false // do not walk deeper }) if (valueChanged) { decl.value = CSSValueParser.stringify(parsedValue) } } } } module.exports.postcss = true /***/ }), /***/ 5417: /***/ ((__unused_webpack_module, exports) => { "use strict"; /*istanbul ignore start*/ Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = Diff; /*istanbul ignore end*/ function Diff() {} Diff.prototype = { /*istanbul ignore start*/ /*istanbul ignore end*/ diff: function diff(oldString, newString) { /*istanbul ignore start*/ var /*istanbul ignore end*/ options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var callback = options.callback; if (typeof options === 'function') { callback = options; options = {}; } this.options = options; var self = this; function done(value) { if (callback) { setTimeout(function () { callback(undefined, value); }, 0); return true; } else { return value; } } // Allow subclasses to massage the input prior to running oldString = this.castInput(oldString); newString = this.castInput(newString); oldString = this.removeEmpty(this.tokenize(oldString)); newString = this.removeEmpty(this.tokenize(newString)); var newLen = newString.length, oldLen = oldString.length; var editLength = 1; var maxEditLength = newLen + oldLen; var bestPath = [{ newPos: -1, components: [] }]; // Seed editLength = 0, i.e. the content starts with the same values var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { // Identity per the equality and tokenizer return done([{ value: this.join(newString), count: newString.length }]); } // Main worker method. checks all permutations of a given edit length for acceptance. function execEditLength() { for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { var basePath = /*istanbul ignore start*/ void 0 /*istanbul ignore end*/ ; var addPath = bestPath[diagonalPath - 1], removePath = bestPath[diagonalPath + 1], _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; if (addPath) { // No one else is going to attempt to use this value, clear it bestPath[diagonalPath - 1] = undefined; } var canAdd = addPath && addPath.newPos + 1 < newLen, canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; if (!canAdd && !canRemove) { // If this path is a terminal then prune bestPath[diagonalPath] = undefined; continue; } // Select the diagonal that we want to branch from. We select the prior // path whose position in the new string is the farthest from the origin // and does not pass the bounds of the diff graph if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { basePath = clonePath(removePath); self.pushComponent(basePath.components, undefined, true); } else { basePath = addPath; // No need to clone, we've pulled it from the list basePath.newPos++; self.pushComponent(basePath.components, true, undefined); } _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); } else { // Otherwise track this path as a potential candidate and continue. bestPath[diagonalPath] = basePath; } } editLength++; } // Performs the length of edit iteration. Is a bit fugly as this has to support the // sync and async mode which is never fun. Loops over execEditLength until a value // is produced. if (callback) { (function exec() { setTimeout(function () { // This should not happen, but we want to be safe. /* istanbul ignore next */ if (editLength > maxEditLength) { return callback(); } if (!execEditLength()) { exec(); } }, 0); })(); } else { while (editLength <= maxEditLength) { var ret = execEditLength(); if (ret) { return ret; } } } }, /*istanbul ignore start*/ /*istanbul ignore end*/ pushComponent: function pushComponent(components, added, removed) { var last = components[components.length - 1]; if (last && last.added === added && last.removed === removed) { // We need to clone here as the component clone operation is just // as shallow array clone components[components.length - 1] = { count: last.count + 1, added: added, removed: removed }; } else { components.push({ count: 1, added: added, removed: removed }); } }, /*istanbul ignore start*/ /*istanbul ignore end*/ extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { var newLen = newString.length, oldLen = oldString.length, newPos = basePath.newPos, oldPos = newPos - diagonalPath, commonCount = 0; while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { newPos++; oldPos++; commonCount++; } if (commonCount) { basePath.components.push({ count: commonCount }); } basePath.newPos = newPos; return oldPos; }, /*istanbul ignore start*/ /*istanbul ignore end*/ equals: function equals(left, right) { if (this.options.comparator) { return this.options.comparator(left, right); } else { return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); } }, /*istanbul ignore start*/ /*istanbul ignore end*/ removeEmpty: function removeEmpty(array) { var ret = []; for (var i = 0; i < array.length; i++) { if (array[i]) { ret.push(array[i]); } } return ret; }, /*istanbul ignore start*/ /*istanbul ignore end*/ castInput: function castInput(value) { return value; }, /*istanbul ignore start*/ /*istanbul ignore end*/ tokenize: function tokenize(value) { return value.split(''); }, /*istanbul ignore start*/ /*istanbul ignore end*/ join: function join(chars) { return chars.join(''); } }; function buildValues(diff, components, newString, oldString, useLongestToken) { var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0; for (; componentPos < componentLen; componentPos++) { var component = components[componentPos]; if (!component.removed) { if (!component.added && useLongestToken) { var value = newString.slice(newPos, newPos + component.count); value = value.map(function (value, i) { var oldValue = oldString[oldPos + i]; return oldValue.length > value.length ? oldValue : value; }); component.value = diff.join(value); } else { component.value = diff.join(newString.slice(newPos, newPos + component.count)); } newPos += component.count; // Common case if (!component.added) { oldPos += component.count; } } else { component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); oldPos += component.count; // Reverse add and remove so removes are output first to match common convention // The diffing algorithm is tied to add then remove output and this is the simplest // route to get the desired output with minimal overhead. if (componentPos && components[componentPos - 1].added) { var tmp = components[componentPos - 1]; components[componentPos - 1] = components[componentPos]; components[componentPos] = tmp; } } } // Special case handle for when one terminal is ignored (i.e. whitespace). // For this case we merge the terminal into the prior string and drop the change. // This is only available for string mode. var lastComponent = components[componentLen - 1]; if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { components[componentLen - 2].value += lastComponent.value; components.pop(); } return components; } function clonePath(path) { return { newPos: path.newPos, components: path.components.slice(0) }; } /***/ }), /***/ 5696: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let { existsSync, readFileSync } = __webpack_require__(9977) let { dirname, join } = __webpack_require__(197) let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866) function fromBase64(str) { if (Buffer) { return Buffer.from(str, 'base64').toString() } else { /* c8 ignore next 2 */ return window.atob(str) } } class PreviousMap { constructor(css, opts) { if (opts.map === false) return this.loadAnnotation(css) this.inline = this.startWith(this.annotation, 'data:') let prev = opts.map ? opts.map.prev : undefined let text = this.loadMap(opts.from, prev) if (!this.mapFile && opts.from) { this.mapFile = opts.from } if (this.mapFile) this.root = dirname(this.mapFile) if (text) this.text = text } consumer() { if (!this.consumerCache) { this.consumerCache = new SourceMapConsumer(this.text) } return this.consumerCache } decodeInline(text) { let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/ let baseUri = /^data:application\/json;base64,/ let charsetUri = /^data:application\/json;charset=utf-?8,/ let uri = /^data:application\/json,/ let uriMatch = text.match(charsetUri) || text.match(uri) if (uriMatch) { return decodeURIComponent(text.substr(uriMatch[0].length)) } let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri) if (baseUriMatch) { return fromBase64(text.substr(baseUriMatch[0].length)) } let encoding = text.match(/data:application\/json;([^,]+),/)[1] throw new Error('Unsupported source map encoding ' + encoding) } getAnnotationURL(sourceMapString) { return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim() } isMap(map) { if (typeof map !== 'object') return false return ( typeof map.mappings === 'string' || typeof map._mappings === 'string' || Array.isArray(map.sections) ) } loadAnnotation(css) { let comments = css.match(/\/\*\s*# sourceMappingURL=/g) if (!comments) return // sourceMappingURLs from comments, strings, etc. let start = css.lastIndexOf(comments.pop()) let end = css.indexOf('*/', start) if (start > -1 && end > -1) { // Locate the last sourceMappingURL to avoid pickin this.annotation = this.getAnnotationURL(css.substring(start, end)) } } loadFile(path) { this.root = dirname(path) if (existsSync(path)) { this.mapFile = path return readFileSync(path, 'utf-8').toString().trim() } } loadMap(file, prev) { if (prev === false) return false if (prev) { if (typeof prev === 'string') { return prev } else if (typeof prev === 'function') { let prevPath = prev(file) if (prevPath) { let map = this.loadFile(prevPath) if (!map) { throw new Error( 'Unable to load previous source map: ' + prevPath.toString() ) } return map } } else if (prev instanceof SourceMapConsumer) { return SourceMapGenerator.fromSourceMap(prev).toString() } else if (prev instanceof SourceMapGenerator) { return prev.toString() } else if (this.isMap(prev)) { return JSON.stringify(prev) } else { throw new Error( 'Unsupported previous source map format: ' + prev.toString() ) } } else if (this.inline) { return this.decodeInline(this.annotation) } else if (this.annotation) { let map = this.annotation if (file) map = join(dirname(file), map) return this.loadFile(map) } } startWith(string, start) { if (!string) return false return string.substr(0, start.length) === start } withContent() { return !!( this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0 ) } } module.exports = PreviousMap PreviousMap.default = PreviousMap /***/ }), /***/ 5776: /***/ ((module) => { "use strict"; class Warning { constructor(text, opts = {}) { this.type = 'warning' this.text = text if (opts.node && opts.node.source) { let range = opts.node.rangeBy(opts) this.line = range.start.line this.column = range.start.column this.endLine = range.end.line this.endColumn = range.end.column } for (let opt in opts) this[opt] = opts[opt] } toString() { if (this.node) { return this.node.error(this.text, { index: this.index, plugin: this.plugin, word: this.word }).message } if (this.plugin) { return this.plugin + ': ' + this.text } return this.text } } module.exports = Warning Warning.default = Warning /***/ }), /***/ 5826: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ if (false) { var throwOnDirectAccess, ReactIs; } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod module.exports = __webpack_require__(628)(); } /***/ }), /***/ 6109: /***/ ((module) => { // This code has been refactored for 140 bytes // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js var computedStyle = function (el, prop, getComputedStyle) { getComputedStyle = window.getComputedStyle; // In one fell swoop return ( // If we have getComputedStyle getComputedStyle ? // Query it // TODO: From CSS-Query notes, we might need (node, null) for FF getComputedStyle(el) : // Otherwise, we are in IE and use currentStyle el.currentStyle )[ // Switch to camelCase for CSSOM // DEV: Grabbed from jQuery // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 prop.replace(/-(\w)/gi, function (word, letter) { return letter.toUpperCase(); }) ]; }; module.exports = computedStyle; /***/ }), /***/ 6589: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Node = __webpack_require__(7490) class Comment extends Node { constructor(defaults) { super(defaults) this.type = 'comment' } } module.exports = Comment Comment.default = Comment /***/ }), /***/ 7191: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule normalizeWheel * @typechecks */ var UserAgent_DEPRECATED = __webpack_require__(2213); var isEventSupported = __webpack_require__(1087); // Reasonable defaults var PIXEL_STEP = 10; var LINE_HEIGHT = 40; var PAGE_HEIGHT = 800; /** * Mouse wheel (and 2-finger trackpad) support on the web sucks. It is * complicated, thus this doc is long and (hopefully) detailed enough to answer * your questions. * * If you need to react to the mouse wheel in a predictable way, this code is * like your bestest friend. * hugs * * * As of today, there are 4 DOM event types you can listen to: * * 'wheel' -- Chrome(31+), FF(17+), IE(9+) * 'mousewheel' -- Chrome, IE(6+), Opera, Safari * 'MozMousePixelScroll' -- FF(3.5 only!) (2010-2013) -- don't bother! * 'DOMMouseScroll' -- FF(0.9.7+) since 2003 * * So what to do? The is the best: * * normalizeWheel.getEventType(); * * In your event callback, use this code to get sane interpretation of the * deltas. This code will return an object with properties: * * spinX -- normalized spin speed (use for zoom) - x plane * spinY -- " - y plane * pixelX -- normalized distance (to pixels) - x plane * pixelY -- " - y plane * * Wheel values are provided by the browser assuming you are using the wheel to * scroll a web page by a number of lines or pixels (or pages). Values can vary * significantly on different platforms and browsers, forgetting that you can * scroll at different speeds. Some devices (like trackpads) emit more events * at smaller increments with fine granularity, and some emit massive jumps with * linear speed or acceleration. * * This code does its best to normalize the deltas for you: * * - spin is trying to normalize how far the wheel was spun (or trackpad * dragged). This is super useful for zoom support where you want to * throw away the chunky scroll steps on the PC and make those equal to * the slow and smooth tiny steps on the Mac. Key data: This code tries to * resolve a single slow step on a wheel to 1. * * - pixel is normalizing the desired scroll delta in pixel units. You'll * get the crazy differences between browsers, but at least it'll be in * pixels! * * - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This * should translate to positive value zooming IN, negative zooming OUT. * This matches the newer 'wheel' event. * * Why are there spinX, spinY (or pixels)? * * - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn * with a mouse. It results in side-scrolling in the browser by default. * * - spinY is what you expect -- it's the classic axis of a mouse wheel. * * - I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and * probably is by browsers in conjunction with fancy 3D controllers .. but * you know. * * Implementation info: * * Examples of 'wheel' event if you scroll slowly (down) by one step with an * average mouse: * * OS X + Chrome (mouse) - 4 pixel delta (wheelDelta -120) * OS X + Safari (mouse) - N/A pixel delta (wheelDelta -12) * OS X + Firefox (mouse) - 0.1 line delta (wheelDelta N/A) * Win8 + Chrome (mouse) - 100 pixel delta (wheelDelta -120) * Win8 + Firefox (mouse) - 3 line delta (wheelDelta -120) * * On the trackpad: * * OS X + Chrome (trackpad) - 2 pixel delta (wheelDelta -6) * OS X + Firefox (trackpad) - 1 pixel delta (wheelDelta N/A) * * On other/older browsers.. it's more complicated as there can be multiple and * also missing delta values. * * The 'wheel' event is more standard: * * http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents * * The basics is that it includes a unit, deltaMode (pixels, lines, pages), and * deltaX, deltaY and deltaZ. Some browsers provide other values to maintain * backward compatibility with older events. Those other values help us * better normalize spin speed. Example of what the browsers provide: * * | event.wheelDelta | event.detail * ------------------+------------------+-------------- * Safari v5/OS X | -120 | 0 * Safari v5/Win7 | -120 | 0 * Chrome v17/OS X | -120 | 0 * Chrome v17/Win7 | -120 | 0 * IE9/Win7 | -120 | undefined * Firefox v4/OS X | undefined | 1 * Firefox v4/Win7 | undefined | 3 * */ function normalizeWheel(/*object*/ event) /*object*/ { var sX = 0, sY = 0, // spinX, spinY pX = 0, pY = 0; // pixelX, pixelY // Legacy if ('detail' in event) { sY = event.detail; } if ('wheelDelta' in event) { sY = -event.wheelDelta / 120; } if ('wheelDeltaY' in event) { sY = -event.wheelDeltaY / 120; } if ('wheelDeltaX' in event) { sX = -event.wheelDeltaX / 120; } // side scrolling on FF with DOMMouseScroll if ( 'axis' in event && event.axis === event.HORIZONTAL_AXIS ) { sX = sY; sY = 0; } pX = sX * PIXEL_STEP; pY = sY * PIXEL_STEP; if ('deltaY' in event) { pY = event.deltaY; } if ('deltaX' in event) { pX = event.deltaX; } if ((pX || pY) && event.deltaMode) { if (event.deltaMode == 1) { // delta in LINE units pX *= LINE_HEIGHT; pY *= LINE_HEIGHT; } else { // delta in PAGE units pX *= PAGE_HEIGHT; pY *= PAGE_HEIGHT; } } // Fall-back if spin cannot be determined if (pX && !sX) { sX = (pX < 1) ? -1 : 1; } if (pY && !sY) { sY = (pY < 1) ? -1 : 1; } return { spinX : sX, spinY : sY, pixelX : pX, pixelY : pY }; } /** * The best combination if you prefer spinX + spinY normalization. It favors * the older DOMMouseScroll for Firefox, as FF does not include wheelDelta with * 'wheel' event, making spin speed determination impossible. */ normalizeWheel.getEventType = function() /*string*/ { return (UserAgent_DEPRECATED.firefox()) ? 'DOMMouseScroll' : (isEventSupported('wheel')) ? 'wheel' : 'mousewheel'; }; module.exports = normalizeWheel; /***/ }), /***/ 7374: /***/ ((module) => { "use strict"; let list = { comma(string) { return list.split(string, [','], true) }, space(string) { let spaces = [' ', '\n', '\t'] return list.split(string, spaces) }, split(string, separators, last) { let array = [] let current = '' let split = false let func = 0 let inQuote = false let prevQuote = '' let escape = false for (let letter of string) { if (escape) { escape = false } else if (letter === '\\') { escape = true } else if (inQuote) { if (letter === prevQuote) { inQuote = false } } else if (letter === '"' || letter === "'") { inQuote = true prevQuote = letter } else if (letter === '(') { func += 1 } else if (letter === ')') { if (func > 0) func -= 1 } else if (func === 0) { if (separators.includes(letter)) split = true } if (split) { if (current !== '') array.push(current.trim()) current = '' split = false } else { current += letter } } if (last || current !== '') array.push(current.trim()) return array } } module.exports = list list.default = list /***/ }), /***/ 7490: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let CssSyntaxError = __webpack_require__(356) let Stringifier = __webpack_require__(346) let stringify = __webpack_require__(633) let { isClean, my } = __webpack_require__(1381) function cloneNode(obj, parent) { let cloned = new obj.constructor() for (let i in obj) { if (!Object.prototype.hasOwnProperty.call(obj, i)) { /* c8 ignore next 2 */ continue } if (i === 'proxyCache') continue let value = obj[i] let type = typeof value if (i === 'parent' && type === 'object') { if (parent) cloned[i] = parent } else if (i === 'source') { cloned[i] = value } else if (Array.isArray(value)) { cloned[i] = value.map(j => cloneNode(j, cloned)) } else { if (type === 'object' && value !== null) value = cloneNode(value) cloned[i] = value } } return cloned } function sourceOffset(inputCSS, position) { // Not all custom syntaxes support `offset` in `source.start` and `source.end` if (position && typeof position.offset !== 'undefined') { return position.offset } let column = 1 let line = 1 let offset = 0 for (let i = 0; i < inputCSS.length; i++) { if (line === position.line && column === position.column) { offset = i break } if (inputCSS[i] === '\n') { column = 1 line += 1 } else { column += 1 } } return offset } class Node { get proxyOf() { return this } constructor(defaults = {}) { this.raws = {} this[isClean] = false this[my] = true for (let name in defaults) { if (name === 'nodes') { this.nodes = [] for (let node of defaults[name]) { if (typeof node.clone === 'function') { this.append(node.clone()) } else { this.append(node) } } } else { this[name] = defaults[name] } } } addToError(error) { error.postcssNode = this if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) { let s = this.source error.stack = error.stack.replace( /\n\s{4}at /, `$&${s.input.from}:${s.start.line}:${s.start.column}$&` ) } return error } after(add) { this.parent.insertAfter(this, add) return this } assign(overrides = {}) { for (let name in overrides) { this[name] = overrides[name] } return this } before(add) { this.parent.insertBefore(this, add) return this } cleanRaws(keepBetween) { delete this.raws.before delete this.raws.after if (!keepBetween) delete this.raws.between } clone(overrides = {}) { let cloned = cloneNode(this) for (let name in overrides) { cloned[name] = overrides[name] } return cloned } cloneAfter(overrides = {}) { let cloned = this.clone(overrides) this.parent.insertAfter(this, cloned) return cloned } cloneBefore(overrides = {}) { let cloned = this.clone(overrides) this.parent.insertBefore(this, cloned) return cloned } error(message, opts = {}) { if (this.source) { let { end, start } = this.rangeBy(opts) return this.source.input.error( message, { column: start.column, line: start.line }, { column: end.column, line: end.line }, opts ) } return new CssSyntaxError(message) } getProxyProcessor() { return { get(node, prop) { if (prop === 'proxyOf') { return node } else if (prop === 'root') { return () => node.root().toProxy() } else { return node[prop] } }, set(node, prop, value) { if (node[prop] === value) return true node[prop] = value if ( prop === 'prop' || prop === 'value' || prop === 'name' || prop === 'params' || prop === 'important' || /* c8 ignore next */ prop === 'text' ) { node.markDirty() } return true } } } /* c8 ignore next 3 */ markClean() { this[isClean] = true } markDirty() { if (this[isClean]) { this[isClean] = false let next = this while ((next = next.parent)) { next[isClean] = false } } } next() { if (!this.parent) return undefined let index = this.parent.index(this) return this.parent.nodes[index + 1] } positionBy(opts = {}) { let pos = this.source.start if (opts.index) { pos = this.positionInside(opts.index) } else if (opts.word) { let inputString = 'document' in this.source.input ? this.source.input.document : this.source.input.css let stringRepresentation = inputString.slice( sourceOffset(inputString, this.source.start), sourceOffset(inputString, this.source.end) ) let index = stringRepresentation.indexOf(opts.word) if (index !== -1) pos = this.positionInside(index) } return pos } positionInside(index) { let column = this.source.start.column let line = this.source.start.line let inputString = 'document' in this.source.input ? this.source.input.document : this.source.input.css let offset = sourceOffset(inputString, this.source.start) let end = offset + index for (let i = offset; i < end; i++) { if (inputString[i] === '\n') { column = 1 line += 1 } else { column += 1 } } return { column, line, offset: end } } prev() { if (!this.parent) return undefined let index = this.parent.index(this) return this.parent.nodes[index - 1] } rangeBy(opts = {}) { let inputString = 'document' in this.source.input ? this.source.input.document : this.source.input.css let start = { column: this.source.start.column, line: this.source.start.line, offset: sourceOffset(inputString, this.source.start) } let end = this.source.end ? { column: this.source.end.column + 1, line: this.source.end.line, offset: typeof this.source.end.offset === 'number' ? // `source.end.offset` is exclusive, so we don't need to add 1 this.source.end.offset : // Since line/column in this.source.end is inclusive, // the `sourceOffset(... , this.source.end)` returns an inclusive offset. // So, we add 1 to convert it to exclusive. sourceOffset(inputString, this.source.end) + 1 } : { column: start.column + 1, line: start.line, offset: start.offset + 1 } if (opts.word) { let stringRepresentation = inputString.slice( sourceOffset(inputString, this.source.start), sourceOffset(inputString, this.source.end) ) let index = stringRepresentation.indexOf(opts.word) if (index !== -1) { start = this.positionInside(index) end = this.positionInside(index + opts.word.length) } } else { if (opts.start) { start = { column: opts.start.column, line: opts.start.line, offset: sourceOffset(inputString, opts.start) } } else if (opts.index) { start = this.positionInside(opts.index) } if (opts.end) { end = { column: opts.end.column, line: opts.end.line, offset: sourceOffset(inputString, opts.end) } } else if (typeof opts.endIndex === 'number') { end = this.positionInside(opts.endIndex) } else if (opts.index) { end = this.positionInside(opts.index + 1) } } if ( end.line < start.line || (end.line === start.line && end.column <= start.column) ) { end = { column: start.column + 1, line: start.line, offset: start.offset + 1 } } return { end, start } } raw(prop, defaultType) { let str = new Stringifier() return str.raw(this, prop, defaultType) } remove() { if (this.parent) { this.parent.removeChild(this) } this.parent = undefined return this } replaceWith(...nodes) { if (this.parent) { let bookmark = this let foundSelf = false for (let node of nodes) { if (node === this) { foundSelf = true } else if (foundSelf) { this.parent.insertAfter(bookmark, node) bookmark = node } else { this.parent.insertBefore(bookmark, node) } } if (!foundSelf) { this.remove() } } return this } root() { let result = this while (result.parent && result.parent.type !== 'document') { result = result.parent } return result } toJSON(_, inputs) { let fixed = {} let emitInputs = inputs == null inputs = inputs || new Map() let inputsNextIndex = 0 for (let name in this) { if (!Object.prototype.hasOwnProperty.call(this, name)) { /* c8 ignore next 2 */ continue } if (name === 'parent' || name === 'proxyCache') continue let value = this[name] if (Array.isArray(value)) { fixed[name] = value.map(i => { if (typeof i === 'object' && i.toJSON) { return i.toJSON(null, inputs) } else { return i } }) } else if (typeof value === 'object' && value.toJSON) { fixed[name] = value.toJSON(null, inputs) } else if (name === 'source') { if (value == null) continue let inputId = inputs.get(value.input) if (inputId == null) { inputId = inputsNextIndex inputs.set(value.input, inputsNextIndex) inputsNextIndex++ } fixed[name] = { end: value.end, inputId, start: value.start } } else { fixed[name] = value } } if (emitInputs) { fixed.inputs = [...inputs.keys()].map(input => input.toJSON()) } return fixed } toProxy() { if (!this.proxyCache) { this.proxyCache = new Proxy(this, this.getProxyProcessor()) } return this.proxyCache } toString(stringifier = stringify) { if (stringifier.stringify) stringifier = stringifier.stringify let result = '' stringifier(this, i => { result += i }) return result } warn(result, text, opts = {}) { let data = { node: this } for (let i in opts) data[i] = opts[i] return result.warn(text, data) } } module.exports = Node Node.default = Node /***/ }), /***/ 7520: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { module.exports = __webpack_require__(7191); /***/ }), /***/ 7661: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let MapGenerator = __webpack_require__(1670) let parse = __webpack_require__(4295) const Result = __webpack_require__(9055) let stringify = __webpack_require__(633) let warnOnce = __webpack_require__(3122) class NoWorkResult { get content() { return this.result.css } get css() { return this.result.css } get map() { return this.result.map } get messages() { return [] } get opts() { return this.result.opts } get processor() { return this.result.processor } get root() { if (this._root) { return this._root } let root let parser = parse try { root = parser(this._css, this._opts) } catch (error) { this.error = error } if (this.error) { throw this.error } else { this._root = root return root } } get [Symbol.toStringTag]() { return 'NoWorkResult' } constructor(processor, css, opts) { css = css.toString() this.stringified = false this._processor = processor this._css = css this._opts = opts this._map = undefined let root let str = stringify this.result = new Result(this._processor, root, this._opts) this.result.css = css let self = this Object.defineProperty(this.result, 'root', { get() { return self.root } }) let map = new MapGenerator(str, root, this._opts, css) if (map.isMap()) { let [generatedCSS, generatedMap] = map.generate() if (generatedCSS) { this.result.css = generatedCSS } if (generatedMap) { this.result.map = generatedMap } } else { map.clearAnnotation() this.result.css = map.css } } async() { if (this.error) return Promise.reject(this.error) return Promise.resolve(this.result) } catch(onRejected) { return this.async().catch(onRejected) } finally(onFinally) { return this.async().then(onFinally, onFinally) } sync() { if (this.error) throw this.error return this.result } then(onFulfilled, onRejected) { if (false) {} return this.async().then(onFulfilled, onRejected) } toString() { return this._css } warnings() { return [] } } module.exports = NoWorkResult NoWorkResult.default = NoWorkResult /***/ }), /***/ 7734: /***/ ((module) => { "use strict"; // do not edit .js files directly - edit src/index.jst var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; module.exports = function equal(a, b) { if (a === b) return true; if (a && b && typeof a == 'object' && typeof b == 'object') { if (a.constructor !== b.constructor) return false; var length, i, keys; if (Array.isArray(a)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false; return true; } if ((a instanceof Map) && (b instanceof Map)) { if (a.size !== b.size) return false; for (i of a.entries()) if (!b.has(i[0])) return false; for (i of a.entries()) if (!equal(i[1], b.get(i[0]))) return false; return true; } if ((a instanceof Set) && (b instanceof Set)) { if (a.size !== b.size) return false; for (i of a.entries()) if (!b.has(i[0])) return false; return true; } if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false; return true; } if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; for (i = length; i-- !== 0;) { var key = keys[i]; if (!equal(a[key], b[key])) return false; } return true; } // true if both NaN, false otherwise return a!==a && b!==b; }; /***/ }), /***/ 8021: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; var __webpack_unused_export__; /*istanbul ignore start*/ __webpack_unused_export__ = ({ value: true }); exports.JJ = diffChars; __webpack_unused_export__ = void 0; /*istanbul ignore end*/ var /*istanbul ignore start*/ _base = _interopRequireDefault(__webpack_require__(5417)) /*istanbul ignore end*/ ; /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /*istanbul ignore end*/ var characterDiff = new /*istanbul ignore start*/ _base /*istanbul ignore end*/ . /*istanbul ignore start*/ default /*istanbul ignore end*/ (); /*istanbul ignore start*/ __webpack_unused_export__ = characterDiff; /*istanbul ignore end*/ function diffChars(oldStr, newStr, options) { return characterDiff.diff(oldStr, newStr, options); } /***/ }), /***/ 8202: /***/ ((module) => { "use strict"; /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ExecutionEnvironment */ /*jslint evil: true */ var canUseDOM = !!( typeof window !== 'undefined' && window.document && window.document.createElement ); /** * Simple, lightweight module assisting with the detection and context of * Worker. Helps avoid circular dependencies and allows code to reason about * whether or not they are in a Worker, even if they never include the main * `ReactWorker` dependency. */ var ExecutionEnvironment = { canUseDOM: canUseDOM, canUseWorkers: typeof Worker !== 'undefined', canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), canUseViewport: canUseDOM && !!window.screen, isInWorker: !canUseDOM // For now, this is true - might change in the future. }; module.exports = ExecutionEnvironment; /***/ }), /***/ 8491: /***/ ((module) => { var openParentheses = "(".charCodeAt(0); var closeParentheses = ")".charCodeAt(0); var singleQuote = "'".charCodeAt(0); var doubleQuote = '"'.charCodeAt(0); var backslash = "\\".charCodeAt(0); var slash = "/".charCodeAt(0); var comma = ",".charCodeAt(0); var colon = ":".charCodeAt(0); var star = "*".charCodeAt(0); var uLower = "u".charCodeAt(0); var uUpper = "U".charCodeAt(0); var plus = "+".charCodeAt(0); var isUnicodeRange = /^[a-f0-9?-]+$/i; module.exports = function(input) { var tokens = []; var value = input; var next, quote, prev, token, escape, escapePos, whitespacePos, parenthesesOpenPos; var pos = 0; var code = value.charCodeAt(pos); var max = value.length; var stack = [{ nodes: tokens }]; var balanced = 0; var parent; var name = ""; var before = ""; var after = ""; while (pos < max) { // Whitespaces if (code <= 32) { next = pos; do { next += 1; code = value.charCodeAt(next); } while (code <= 32); token = value.slice(pos, next); prev = tokens[tokens.length - 1]; if (code === closeParentheses && balanced) { after = token; } else if (prev && prev.type === "div") { prev.after = token; prev.sourceEndIndex += token.length; } else if ( code === comma || code === colon || (code === slash && value.charCodeAt(next + 1) !== star && (!parent || (parent && parent.type === "function" && parent.value !== "calc"))) ) { before = token; } else { tokens.push({ type: "space", sourceIndex: pos, sourceEndIndex: next, value: token }); } pos = next; // Quotes } else if (code === singleQuote || code === doubleQuote) { next = pos; quote = code === singleQuote ? "'" : '"'; token = { type: "string", sourceIndex: pos, quote: quote }; do { escape = false; next = value.indexOf(quote, next + 1); if (~next) { escapePos = next; while (value.charCodeAt(escapePos - 1) === backslash) { escapePos -= 1; escape = !escape; } } else { value += quote; next = value.length - 1; token.unclosed = true; } } while (escape); token.value = value.slice(pos + 1, next); token.sourceEndIndex = token.unclosed ? next : next + 1; tokens.push(token); pos = next + 1; code = value.charCodeAt(pos); // Comments } else if (code === slash && value.charCodeAt(pos + 1) === star) { next = value.indexOf("*/", pos); token = { type: "comment", sourceIndex: pos, sourceEndIndex: next + 2 }; if (next === -1) { token.unclosed = true; next = value.length; token.sourceEndIndex = next; } token.value = value.slice(pos + 2, next); tokens.push(token); pos = next + 2; code = value.charCodeAt(pos); // Operation within calc } else if ( (code === slash || code === star) && parent && parent.type === "function" && parent.value === "calc" ) { token = value[pos]; tokens.push({ type: "word", sourceIndex: pos - before.length, sourceEndIndex: pos + token.length, value: token }); pos += 1; code = value.charCodeAt(pos); // Dividers } else if (code === slash || code === comma || code === colon) { token = value[pos]; tokens.push({ type: "div", sourceIndex: pos - before.length, sourceEndIndex: pos + token.length, value: token, before: before, after: "" }); before = ""; pos += 1; code = value.charCodeAt(pos); // Open parentheses } else if (openParentheses === code) { // Whitespaces after open parentheses next = pos; do { next += 1; code = value.charCodeAt(next); } while (code <= 32); parenthesesOpenPos = pos; token = { type: "function", sourceIndex: pos - name.length, value: name, before: value.slice(parenthesesOpenPos + 1, next) }; pos = next; if (name === "url" && code !== singleQuote && code !== doubleQuote) { next -= 1; do { escape = false; next = value.indexOf(")", next + 1); if (~next) { escapePos = next; while (value.charCodeAt(escapePos - 1) === backslash) { escapePos -= 1; escape = !escape; } } else { value += ")"; next = value.length - 1; token.unclosed = true; } } while (escape); // Whitespaces before closed whitespacePos = next; do { whitespacePos -= 1; code = value.charCodeAt(whitespacePos); } while (code <= 32); if (parenthesesOpenPos < whitespacePos) { if (pos !== whitespacePos + 1) { token.nodes = [ { type: "word", sourceIndex: pos, sourceEndIndex: whitespacePos + 1, value: value.slice(pos, whitespacePos + 1) } ]; } else { token.nodes = []; } if (token.unclosed && whitespacePos + 1 !== next) { token.after = ""; token.nodes.push({ type: "space", sourceIndex: whitespacePos + 1, sourceEndIndex: next, value: value.slice(whitespacePos + 1, next) }); } else { token.after = value.slice(whitespacePos + 1, next); token.sourceEndIndex = next; } } else { token.after = ""; token.nodes = []; } pos = next + 1; token.sourceEndIndex = token.unclosed ? next : pos; code = value.charCodeAt(pos); tokens.push(token); } else { balanced += 1; token.after = ""; token.sourceEndIndex = pos + 1; tokens.push(token); stack.push(token); tokens = token.nodes = []; parent = token; } name = ""; // Close parentheses } else if (closeParentheses === code && balanced) { pos += 1; code = value.charCodeAt(pos); parent.after = after; parent.sourceEndIndex += after.length; after = ""; balanced -= 1; stack[stack.length - 1].sourceEndIndex = pos; stack.pop(); parent = stack[balanced]; tokens = parent.nodes; // Words } else { next = pos; do { if (code === backslash) { next += 1; } next += 1; code = value.charCodeAt(next); } while ( next < max && !( code <= 32 || code === singleQuote || code === doubleQuote || code === comma || code === colon || code === slash || code === openParentheses || (code === star && parent && parent.type === "function" && parent.value === "calc") || (code === slash && parent.type === "function" && parent.value === "calc") || (code === closeParentheses && balanced) ) ); token = value.slice(pos, next); if (openParentheses === code) { name = token; } else if ( (uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) && plus === token.charCodeAt(1) && isUnicodeRange.test(token.slice(2)) ) { tokens.push({ type: "unicode-range", sourceIndex: pos, sourceEndIndex: next, value: token }); } else { tokens.push({ type: "word", sourceIndex: pos, sourceEndIndex: next, value: token }); } pos = next; } } for (pos = stack.length - 1; pos; pos -= 1) { stack[pos].unclosed = true; stack[pos].sourceEndIndex = value.length; } return stack[0].nodes; }; /***/ }), /***/ 9055: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Warning = __webpack_require__(5776) class Result { get content() { return this.css } constructor(processor, root, opts) { this.processor = processor this.messages = [] this.root = root this.opts = opts this.css = '' this.map = undefined } toString() { return this.css } warn(text, opts = {}) { if (!opts.plugin) { if (this.lastPlugin && this.lastPlugin.postcssPlugin) { opts.plugin = this.lastPlugin.postcssPlugin } } let warning = new Warning(text, opts) this.messages.push(warning) return warning } warnings() { return this.messages.filter(i => i.type === 'warning') } } module.exports = Result Result.default = Result /***/ }), /***/ 9434: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Container = __webpack_require__(683) let LazyResult, Processor class Root extends Container { constructor(defaults) { super(defaults) this.type = 'root' if (!this.nodes) this.nodes = [] } normalize(child, sample, type) { let nodes = super.normalize(child) if (sample) { if (type === 'prepend') { if (this.nodes.length > 1) { sample.raws.before = this.nodes[1].raws.before } else { delete sample.raws.before } } else if (this.first !== sample) { for (let node of nodes) { node.raws.before = sample.raws.before } } } return nodes } removeChild(child, ignore) { let index = this.index(child) if (!ignore && index === 0 && this.nodes.length > 1) { this.nodes[1].raws.before = this.nodes[index].raws.before } return super.removeChild(child) } toResult(opts = {}) { let lazy = new LazyResult(new Processor(), this, opts) return lazy.stringify() } } Root.registerLazyResult = dependant => { LazyResult = dependant } Root.registerProcessor = dependant => { Processor = dependant } module.exports = Root Root.default = Root Container.registerRoot(Root) /***/ }), /***/ 9656: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; let Document = __webpack_require__(271) let LazyResult = __webpack_require__(448) let NoWorkResult = __webpack_require__(7661) let Root = __webpack_require__(9434) class Processor { constructor(plugins = []) { this.version = '8.5.6' this.plugins = this.normalize(plugins) } normalize(plugins) { let normalized = [] for (let i of plugins) { if (i.postcss === true) { i = i() } else if (i.postcss) { i = i.postcss } if (typeof i === 'object' && Array.isArray(i.plugins)) { normalized = normalized.concat(i.plugins) } else if (typeof i === 'object' && i.postcssPlugin) { normalized.push(i) } else if (typeof i === 'function') { normalized.push(i) } else if (typeof i === 'object' && (i.parse || i.stringify)) { if (false) {} } else { throw new Error(i + ' is not a PostCSS plugin') } } return normalized } process(css, opts = {}) { if ( !this.plugins.length && !opts.parser && !opts.stringifier && !opts.syntax ) { return new NoWorkResult(this, css, opts) } else { return new LazyResult(this, css, opts) } } use(plugin) { this.plugins = this.plugins.concat(this.normalize([plugin])) return this } } module.exports = Processor Processor.default = Processor Root.registerProcessor(Processor) Document.registerProcessor(Processor) /***/ }), /***/ 9681: /***/ ((module) => { var characterMap = { "À": "A", "Á": "A", "Â": "A", "Ã": "A", "Ä": "A", "Å": "A", "Ấ": "A", "Ắ": "A", "Ẳ": "A", "Ẵ": "A", "Ặ": "A", "Æ": "AE", "Ầ": "A", "Ằ": "A", "Ȃ": "A", "Ả": "A", "Ạ": "A", "Ẩ": "A", "Ẫ": "A", "Ậ": "A", "Ç": "C", "Ḉ": "C", "È": "E", "É": "E", "Ê": "E", "Ë": "E", "Ế": "E", "Ḗ": "E", "Ề": "E", "Ḕ": "E", "Ḝ": "E", "Ȇ": "E", "Ẻ": "E", "Ẽ": "E", "Ẹ": "E", "Ể": "E", "Ễ": "E", "Ệ": "E", "Ì": "I", "Í": "I", "Î": "I", "Ï": "I", "Ḯ": "I", "Ȋ": "I", "Ỉ": "I", "Ị": "I", "Ð": "D", "Ñ": "N", "Ò": "O", "Ó": "O", "Ô": "O", "Õ": "O", "Ö": "O", "Ø": "O", "Ố": "O", "Ṍ": "O", "Ṓ": "O", "Ȏ": "O", "Ỏ": "O", "Ọ": "O", "Ổ": "O", "Ỗ": "O", "Ộ": "O", "Ờ": "O", "Ở": "O", "Ỡ": "O", "Ớ": "O", "Ợ": "O", "Ù": "U", "Ú": "U", "Û": "U", "Ü": "U", "Ủ": "U", "Ụ": "U", "Ử": "U", "Ữ": "U", "Ự": "U", "Ý": "Y", "à": "a", "á": "a", "â": "a", "ã": "a", "ä": "a", "å": "a", "ấ": "a", "ắ": "a", "ẳ": "a", "ẵ": "a", "ặ": "a", "æ": "ae", "ầ": "a", "ằ": "a", "ȃ": "a", "ả": "a", "ạ": "a", "ẩ": "a", "ẫ": "a", "ậ": "a", "ç": "c", "ḉ": "c", "è": "e", "é": "e", "ê": "e", "ë": "e", "ế": "e", "ḗ": "e", "ề": "e", "ḕ": "e", "ḝ": "e", "ȇ": "e", "ẻ": "e", "ẽ": "e", "ẹ": "e", "ể": "e", "ễ": "e", "ệ": "e", "ì": "i", "í": "i", "î": "i", "ï": "i", "ḯ": "i", "ȋ": "i", "ỉ": "i", "ị": "i", "ð": "d", "ñ": "n", "ò": "o", "ó": "o", "ô": "o", "õ": "o", "ö": "o", "ø": "o", "ố": "o", "ṍ": "o", "ṓ": "o", "ȏ": "o", "ỏ": "o", "ọ": "o", "ổ": "o", "ỗ": "o", "ộ": "o", "ờ": "o", "ở": "o", "ỡ": "o", "ớ": "o", "ợ": "o", "ù": "u", "ú": "u", "û": "u", "ü": "u", "ủ": "u", "ụ": "u", "ử": "u", "ữ": "u", "ự": "u", "ý": "y", "ÿ": "y", "Ā": "A", "ā": "a", "Ă": "A", "ă": "a", "Ą": "A", "ą": "a", "Ć": "C", "ć": "c", "Ĉ": "C", "ĉ": "c", "Ċ": "C", "ċ": "c", "Č": "C", "č": "c", "C̆": "C", "c̆": "c", "Ď": "D", "ď": "d", "Đ": "D", "đ": "d", "Ē": "E", "ē": "e", "Ĕ": "E", "ĕ": "e", "Ė": "E", "ė": "e", "Ę": "E", "ę": "e", "Ě": "E", "ě": "e", "Ĝ": "G", "Ǵ": "G", "ĝ": "g", "ǵ": "g", "Ğ": "G", "ğ": "g", "Ġ": "G", "ġ": "g", "Ģ": "G", "ģ": "g", "Ĥ": "H", "ĥ": "h", "Ħ": "H", "ħ": "h", "Ḫ": "H", "ḫ": "h", "Ĩ": "I", "ĩ": "i", "Ī": "I", "ī": "i", "Ĭ": "I", "ĭ": "i", "Į": "I", "į": "i", "İ": "I", "ı": "i", "IJ": "IJ", "ij": "ij", "Ĵ": "J", "ĵ": "j", "Ķ": "K", "ķ": "k", "Ḱ": "K", "ḱ": "k", "K̆": "K", "k̆": "k", "Ĺ": "L", "ĺ": "l", "Ļ": "L", "ļ": "l", "Ľ": "L", "ľ": "l", "Ŀ": "L", "ŀ": "l", "Ł": "l", "ł": "l", "Ḿ": "M", "ḿ": "m", "M̆": "M", "m̆": "m", "Ń": "N", "ń": "n", "Ņ": "N", "ņ": "n", "Ň": "N", "ň": "n", "ʼn": "n", "N̆": "N", "n̆": "n", "Ō": "O", "ō": "o", "Ŏ": "O", "ŏ": "o", "Ő": "O", "ő": "o", "Œ": "OE", "œ": "oe", "P̆": "P", "p̆": "p", "Ŕ": "R", "ŕ": "r", "Ŗ": "R", "ŗ": "r", "Ř": "R", "ř": "r", "R̆": "R", "r̆": "r", "Ȓ": "R", "ȓ": "r", "Ś": "S", "ś": "s", "Ŝ": "S", "ŝ": "s", "Ş": "S", "Ș": "S", "ș": "s", "ş": "s", "Š": "S", "š": "s", "Ţ": "T", "ţ": "t", "ț": "t", "Ț": "T", "Ť": "T", "ť": "t", "Ŧ": "T", "ŧ": "t", "T̆": "T", "t̆": "t", "Ũ": "U", "ũ": "u", "Ū": "U", "ū": "u", "Ŭ": "U", "ŭ": "u", "Ů": "U", "ů": "u", "Ű": "U", "ű": "u", "Ų": "U", "ų": "u", "Ȗ": "U", "ȗ": "u", "V̆": "V", "v̆": "v", "Ŵ": "W", "ŵ": "w", "Ẃ": "W", "ẃ": "w", "X̆": "X", "x̆": "x", "Ŷ": "Y", "ŷ": "y", "Ÿ": "Y", "Y̆": "Y", "y̆": "y", "Ź": "Z", "ź": "z", "Ż": "Z", "ż": "z", "Ž": "Z", "ž": "z", "ſ": "s", "ƒ": "f", "Ơ": "O", "ơ": "o", "Ư": "U", "ư": "u", "Ǎ": "A", "ǎ": "a", "Ǐ": "I", "ǐ": "i", "Ǒ": "O", "ǒ": "o", "Ǔ": "U", "ǔ": "u", "Ǖ": "U", "ǖ": "u", "Ǘ": "U", "ǘ": "u", "Ǚ": "U", "ǚ": "u", "Ǜ": "U", "ǜ": "u", "Ứ": "U", "ứ": "u", "Ṹ": "U", "ṹ": "u", "Ǻ": "A", "ǻ": "a", "Ǽ": "AE", "ǽ": "ae", "Ǿ": "O", "ǿ": "o", "Þ": "TH", "þ": "th", "Ṕ": "P", "ṕ": "p", "Ṥ": "S", "ṥ": "s", "X́": "X", "x́": "x", "Ѓ": "Г", "ѓ": "г", "Ќ": "К", "ќ": "к", "A̋": "A", "a̋": "a", "E̋": "E", "e̋": "e", "I̋": "I", "i̋": "i", "Ǹ": "N", "ǹ": "n", "Ồ": "O", "ồ": "o", "Ṑ": "O", "ṑ": "o", "Ừ": "U", "ừ": "u", "Ẁ": "W", "ẁ": "w", "Ỳ": "Y", "ỳ": "y", "Ȁ": "A", "ȁ": "a", "Ȅ": "E", "ȅ": "e", "Ȉ": "I", "ȉ": "i", "Ȍ": "O", "ȍ": "o", "Ȑ": "R", "ȑ": "r", "Ȕ": "U", "ȕ": "u", "B̌": "B", "b̌": "b", "Č̣": "C", "č̣": "c", "Ê̌": "E", "ê̌": "e", "F̌": "F", "f̌": "f", "Ǧ": "G", "ǧ": "g", "Ȟ": "H", "ȟ": "h", "J̌": "J", "ǰ": "j", "Ǩ": "K", "ǩ": "k", "M̌": "M", "m̌": "m", "P̌": "P", "p̌": "p", "Q̌": "Q", "q̌": "q", "Ř̩": "R", "ř̩": "r", "Ṧ": "S", "ṧ": "s", "V̌": "V", "v̌": "v", "W̌": "W", "w̌": "w", "X̌": "X", "x̌": "x", "Y̌": "Y", "y̌": "y", "A̧": "A", "a̧": "a", "B̧": "B", "b̧": "b", "Ḑ": "D", "ḑ": "d", "Ȩ": "E", "ȩ": "e", "Ɛ̧": "E", "ɛ̧": "e", "Ḩ": "H", "ḩ": "h", "I̧": "I", "i̧": "i", "Ɨ̧": "I", "ɨ̧": "i", "M̧": "M", "m̧": "m", "O̧": "O", "o̧": "o", "Q̧": "Q", "q̧": "q", "U̧": "U", "u̧": "u", "X̧": "X", "x̧": "x", "Z̧": "Z", "z̧": "z", "й":"и", "Й":"И", "ё":"е", "Ё":"Е", }; var chars = Object.keys(characterMap).join('|'); var allAccents = new RegExp(chars, 'g'); var firstAccent = new RegExp(chars, ''); function matcher(match) { return characterMap[match]; } var removeAccents = function(string) { return string.replace(allAccents, matcher); }; var hasAccents = function(string) { return !!string.match(firstAccent); }; module.exports = removeAccents; module.exports.has = hasAccents; module.exports.remove = removeAccents; /***/ }), /***/ 9746: /***/ (() => { /* (ignored) */ /***/ }), /***/ 9977: /***/ (() => { /* (ignored) */ /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. (() => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { AlignmentControl: () => (/* reexport */ AlignmentControl), AlignmentToolbar: () => (/* reexport */ AlignmentToolbar), Autocomplete: () => (/* reexport */ autocomplete_default), BlockAlignmentControl: () => (/* reexport */ BlockAlignmentControl), BlockAlignmentToolbar: () => (/* reexport */ BlockAlignmentToolbar), BlockBreadcrumb: () => (/* reexport */ block_breadcrumb_default), BlockCanvas: () => (/* reexport */ block_canvas_default), BlockColorsStyleSelector: () => (/* reexport */ color_style_selector_default), BlockContextProvider: () => (/* reexport */ BlockContextProvider), BlockControls: () => (/* reexport */ block_controls_default), BlockEdit: () => (/* reexport */ BlockEdit), BlockEditorKeyboardShortcuts: () => (/* reexport */ keyboard_shortcuts_default), BlockEditorProvider: () => (/* reexport */ provider_provider_default), BlockFormatControls: () => (/* reexport */ BlockFormatControls), BlockIcon: () => (/* reexport */ block_icon_default), BlockInspector: () => (/* reexport */ block_inspector_default), BlockList: () => (/* reexport */ BlockList), BlockMover: () => (/* reexport */ block_mover_default), BlockNavigationDropdown: () => (/* reexport */ dropdown_default), BlockPopover: () => (/* reexport */ block_popover_default), BlockPreview: () => (/* reexport */ block_preview_default), BlockSelectionClearer: () => (/* reexport */ BlockSelectionClearer), BlockSettingsMenu: () => (/* reexport */ block_settings_menu_default), BlockSettingsMenuControls: () => (/* reexport */ block_settings_menu_controls_default), BlockStyles: () => (/* reexport */ block_styles_default), BlockTitle: () => (/* reexport */ BlockTitle), BlockToolbar: () => (/* reexport */ BlockToolbar), BlockTools: () => (/* reexport */ BlockTools), BlockVerticalAlignmentControl: () => (/* reexport */ BlockVerticalAlignmentControl), BlockVerticalAlignmentToolbar: () => (/* reexport */ BlockVerticalAlignmentToolbar), ButtonBlockAppender: () => (/* reexport */ button_block_appender_default), ButtonBlockerAppender: () => (/* reexport */ ButtonBlockerAppender), ColorPalette: () => (/* reexport */ color_palette_default), ColorPaletteControl: () => (/* reexport */ ColorPaletteControl), ContrastChecker: () => (/* reexport */ contrast_checker_default), CopyHandler: () => (/* reexport */ CopyHandler), DefaultBlockAppender: () => (/* reexport */ DefaultBlockAppender), FontSizePicker: () => (/* reexport */ font_size_picker_default), HeadingLevelDropdown: () => (/* reexport */ HeadingLevelDropdown), HeightControl: () => (/* reexport */ HeightControl), InnerBlocks: () => (/* reexport */ inner_blocks_default), Inserter: () => (/* reexport */ inserter_default), InspectorAdvancedControls: () => (/* reexport */ InspectorAdvancedControls), InspectorControls: () => (/* reexport */ inspector_controls_default), JustifyContentControl: () => (/* reexport */ JustifyContentControl), JustifyToolbar: () => (/* reexport */ JustifyToolbar), LineHeightControl: () => (/* reexport */ line_height_control_default), LinkControl: () => (/* reexport */ link_control_default), MediaPlaceholder: () => (/* reexport */ media_placeholder_default), MediaReplaceFlow: () => (/* reexport */ media_replace_flow_default), MediaUpload: () => (/* reexport */ media_upload_default), MediaUploadCheck: () => (/* reexport */ check_default), MultiSelectScrollIntoView: () => (/* reexport */ MultiSelectScrollIntoView), NavigableToolbar: () => (/* reexport */ NavigableToolbar), ObserveTyping: () => (/* reexport */ observe_typing_default), PanelColorSettings: () => (/* reexport */ panel_color_settings_default), PlainText: () => (/* reexport */ plain_text_default), RecursionProvider: () => (/* reexport */ RecursionProvider), RichText: () => (/* reexport */ rich_text_default), RichTextShortcut: () => (/* reexport */ RichTextShortcut), RichTextToolbarButton: () => (/* reexport */ RichTextToolbarButton), SETTINGS_DEFAULTS: () => (/* reexport */ SETTINGS_DEFAULTS), SkipToSelectedBlock: () => (/* reexport */ SkipToSelectedBlock), ToolSelector: () => (/* reexport */ tool_selector_default), Typewriter: () => (/* reexport */ typewriter_default), URLInput: () => (/* reexport */ url_input_default), URLInputButton: () => (/* reexport */ button_default), URLPopover: () => (/* reexport */ url_popover_default), Warning: () => (/* reexport */ warning_default), WritingFlow: () => (/* reexport */ writing_flow_default), __experimentalBlockAlignmentMatrixControl: () => (/* reexport */ block_alignment_matrix_control_default), __experimentalBlockFullHeightAligmentControl: () => (/* reexport */ block_full_height_alignment_control_default), __experimentalBlockPatternSetup: () => (/* reexport */ block_pattern_setup_default), __experimentalBlockPatternsList: () => (/* reexport */ block_patterns_list_default), __experimentalBlockVariationPicker: () => (/* reexport */ block_variation_picker_default), __experimentalBlockVariationTransforms: () => (/* reexport */ block_variation_transforms_default), __experimentalBorderRadiusControl: () => (/* reexport */ BorderRadiusControl), __experimentalColorGradientControl: () => (/* reexport */ control_default), __experimentalColorGradientSettingsDropdown: () => (/* reexport */ ColorGradientSettingsDropdown), __experimentalDateFormatPicker: () => (/* reexport */ DateFormatPicker), __experimentalDuotoneControl: () => (/* reexport */ duotone_control_default), __experimentalFontAppearanceControl: () => (/* reexport */ FontAppearanceControl), __experimentalFontFamilyControl: () => (/* reexport */ FontFamilyControl), __experimentalGetBorderClassesAndStyles: () => (/* reexport */ getBorderClassesAndStyles), __experimentalGetColorClassesAndStyles: () => (/* reexport */ getColorClassesAndStyles), __experimentalGetElementClassName: () => (/* reexport */ __experimentalGetElementClassName), __experimentalGetGapCSSValue: () => (/* reexport */ getGapCSSValue), __experimentalGetGradientClass: () => (/* reexport */ __experimentalGetGradientClass), __experimentalGetGradientObjectByGradientValue: () => (/* reexport */ __experimentalGetGradientObjectByGradientValue), __experimentalGetShadowClassesAndStyles: () => (/* reexport */ getShadowClassesAndStyles), __experimentalGetSpacingClassesAndStyles: () => (/* reexport */ getSpacingClassesAndStyles), __experimentalImageEditor: () => (/* reexport */ ImageEditor), __experimentalImageSizeControl: () => (/* reexport */ ImageSizeControl), __experimentalImageURLInputUI: () => (/* reexport */ ImageURLInputUI), __experimentalInspectorPopoverHeader: () => (/* reexport */ InspectorPopoverHeader), __experimentalLetterSpacingControl: () => (/* reexport */ LetterSpacingControl), __experimentalLibrary: () => (/* reexport */ library_default), __experimentalLinkControl: () => (/* reexport */ DeprecatedExperimentalLinkControl), __experimentalLinkControlSearchInput: () => (/* reexport */ __experimentalLinkControlSearchInput), __experimentalLinkControlSearchItem: () => (/* reexport */ __experimentalLinkControlSearchItem), __experimentalLinkControlSearchResults: () => (/* reexport */ __experimentalLinkControlSearchResults), __experimentalListView: () => (/* reexport */ list_view_list_view_default), __experimentalPanelColorGradientSettings: () => (/* reexport */ panel_color_gradient_settings_default), __experimentalPreviewOptions: () => (/* reexport */ PreviewOptions), __experimentalPublishDateTimePicker: () => (/* reexport */ publish_date_time_picker_default), __experimentalRecursionProvider: () => (/* reexport */ DeprecatedExperimentalRecursionProvider), __experimentalResponsiveBlockControl: () => (/* reexport */ responsive_block_control_default), __experimentalSpacingSizesControl: () => (/* reexport */ SpacingSizesControl), __experimentalTextDecorationControl: () => (/* reexport */ TextDecorationControl), __experimentalTextTransformControl: () => (/* reexport */ TextTransformControl), __experimentalUnitControl: () => (/* reexport */ UnitControl), __experimentalUseBlockOverlayActive: () => (/* reexport */ useBlockOverlayActive), __experimentalUseBlockPreview: () => (/* reexport */ useBlockPreview), __experimentalUseBorderProps: () => (/* reexport */ useBorderProps), __experimentalUseColorProps: () => (/* reexport */ useColorProps), __experimentalUseCustomSides: () => (/* reexport */ useCustomSides), __experimentalUseGradient: () => (/* reexport */ __experimentalUseGradient), __experimentalUseHasRecursion: () => (/* reexport */ DeprecatedExperimentalUseHasRecursion), __experimentalUseMultipleOriginColorsAndGradients: () => (/* reexport */ useMultipleOriginColorsAndGradients), __experimentalUseResizeCanvas: () => (/* reexport */ useResizeCanvas), __experimentalWritingModeControl: () => (/* reexport */ WritingModeControl), __unstableBlockNameContext: () => (/* reexport */ block_name_context_default), __unstableBlockSettingsMenuFirstItem: () => (/* reexport */ block_settings_menu_first_item_default), __unstableBlockToolbarLastItem: () => (/* reexport */ block_toolbar_last_item_default), __unstableEditorStyles: () => (/* reexport */ editor_styles_default), __unstableIframe: () => (/* reexport */ iframe_default), __unstableInserterMenuExtension: () => (/* reexport */ inserter_menu_extension_default), __unstableRichTextInputEvent: () => (/* reexport */ __unstableRichTextInputEvent), __unstableUseBlockSelectionClearer: () => (/* reexport */ useBlockSelectionClearer), __unstableUseClipboardHandler: () => (/* reexport */ __unstableUseClipboardHandler), __unstableUseMouseMoveTypingReset: () => (/* reexport */ useMouseMoveTypingReset), __unstableUseTypewriter: () => (/* reexport */ useTypewriter), __unstableUseTypingObserver: () => (/* reexport */ useTypingObserver), createCustomColorsHOC: () => (/* reexport */ createCustomColorsHOC), getColorClassName: () => (/* reexport */ getColorClassName), getColorObjectByAttributeValues: () => (/* reexport */ getColorObjectByAttributeValues), getColorObjectByColorValue: () => (/* reexport */ getColorObjectByColorValue), getComputedFluidTypographyValue: () => (/* reexport */ getComputedFluidTypographyValue), getCustomValueFromPreset: () => (/* reexport */ getCustomValueFromPreset), getFontSize: () => (/* reexport */ utils_getFontSize), getFontSizeClass: () => (/* reexport */ getFontSizeClass), getFontSizeObjectByValue: () => (/* reexport */ utils_getFontSizeObjectByValue), getGradientSlugByValue: () => (/* reexport */ getGradientSlugByValue), getGradientValueBySlug: () => (/* reexport */ getGradientValueBySlug), getPxFromCssUnit: () => (/* reexport */ get_px_from_css_unit_default), getSpacingPresetCssVar: () => (/* reexport */ getSpacingPresetCssVar), getTypographyClassesAndStyles: () => (/* reexport */ getTypographyClassesAndStyles), isValueSpacingPreset: () => (/* reexport */ isValueSpacingPreset), privateApis: () => (/* reexport */ privateApis), store: () => (/* reexport */ store), storeConfig: () => (/* reexport */ storeConfig), transformStyles: () => (/* reexport */ transform_styles_default), useBlockBindingsUtils: () => (/* reexport */ useBlockBindingsUtils), useBlockCommands: () => (/* reexport */ useBlockCommands), useBlockDisplayInformation: () => (/* reexport */ useBlockDisplayInformation), useBlockEditContext: () => (/* reexport */ useBlockEditContext), useBlockEditingMode: () => (/* reexport */ useBlockEditingMode), useBlockProps: () => (/* reexport */ use_block_props_useBlockProps), useCachedTruthy: () => (/* reexport */ useCachedTruthy), useHasRecursion: () => (/* reexport */ useHasRecursion), useInnerBlocksProps: () => (/* reexport */ useInnerBlocksProps), useSetting: () => (/* reexport */ useSetting), useSettings: () => (/* reexport */ use_settings_useSettings), useStyleOverride: () => (/* reexport */ useStyleOverride), withColorContext: () => (/* reexport */ with_color_context_default), withColors: () => (/* reexport */ withColors), withFontSizes: () => (/* reexport */ with_font_sizes_default) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js var private_selectors_namespaceObject = {}; __webpack_require__.r(private_selectors_namespaceObject); __webpack_require__.d(private_selectors_namespaceObject, { getAllPatterns: () => (getAllPatterns), getBlockRemovalRules: () => (getBlockRemovalRules), getBlockSettings: () => (getBlockSettings), getBlockStyles: () => (getBlockStyles), getBlockWithoutAttributes: () => (getBlockWithoutAttributes), getClosestAllowedInsertionPoint: () => (getClosestAllowedInsertionPoint), getClosestAllowedInsertionPointForPattern: () => (getClosestAllowedInsertionPointForPattern), getContentLockingParent: () => (getContentLockingParent), getEnabledBlockParents: () => (getEnabledBlockParents), getEnabledClientIdsTree: () => (getEnabledClientIdsTree), getExpandedBlock: () => (getExpandedBlock), getInserterMediaCategories: () => (getInserterMediaCategories), getInsertionPoint: () => (getInsertionPoint), getLastFocus: () => (getLastFocus), getLastInsertedBlocksClientIds: () => (getLastInsertedBlocksClientIds), getOpenedBlockSettingsMenu: () => (getOpenedBlockSettingsMenu), getParentSectionBlock: () => (getParentSectionBlock), getPatternBySlug: () => (getPatternBySlug), getRegisteredInserterMediaCategories: () => (getRegisteredInserterMediaCategories), getRemovalPromptData: () => (getRemovalPromptData), getReusableBlocks: () => (getReusableBlocks), getSectionRootClientId: () => (getSectionRootClientId), getStyleOverrides: () => (getStyleOverrides), getTemporarilyEditingAsBlocks: () => (getTemporarilyEditingAsBlocks), getTemporarilyEditingFocusModeToRevert: () => (getTemporarilyEditingFocusModeToRevert), getZoomLevel: () => (getZoomLevel), hasAllowedPatterns: () => (hasAllowedPatterns), hasBlockSpotlight: () => (private_selectors_hasBlockSpotlight), isBlockHidden: () => (isBlockHidden), isBlockInterfaceHidden: () => (private_selectors_isBlockInterfaceHidden), isBlockSubtreeDisabled: () => (isBlockSubtreeDisabled), isContainerInsertableToInContentOnlyMode: () => (isContainerInsertableToInContentOnlyMode), isDragging: () => (private_selectors_isDragging), isSectionBlock: () => (isSectionBlock), isZoomOut: () => (isZoomOut) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { __experimentalGetActiveBlockIdByBlockNames: () => (__experimentalGetActiveBlockIdByBlockNames), __experimentalGetAllowedBlocks: () => (__experimentalGetAllowedBlocks), __experimentalGetAllowedPatterns: () => (__experimentalGetAllowedPatterns), __experimentalGetBlockListSettingsForBlocks: () => (__experimentalGetBlockListSettingsForBlocks), __experimentalGetDirectInsertBlock: () => (__experimentalGetDirectInsertBlock), __experimentalGetGlobalBlocksByName: () => (__experimentalGetGlobalBlocksByName), __experimentalGetLastBlockAttributeChanges: () => (__experimentalGetLastBlockAttributeChanges), __experimentalGetParsedPattern: () => (__experimentalGetParsedPattern), __experimentalGetPatternTransformItems: () => (__experimentalGetPatternTransformItems), __experimentalGetPatternsByBlockTypes: () => (__experimentalGetPatternsByBlockTypes), __experimentalGetReusableBlockTitle: () => (__experimentalGetReusableBlockTitle), __unstableGetBlockWithoutInnerBlocks: () => (__unstableGetBlockWithoutInnerBlocks), __unstableGetClientIdWithClientIdsTree: () => (__unstableGetClientIdWithClientIdsTree), __unstableGetClientIdsTree: () => (__unstableGetClientIdsTree), __unstableGetContentLockingParent: () => (__unstableGetContentLockingParent), __unstableGetSelectedBlocksWithPartialSelection: () => (__unstableGetSelectedBlocksWithPartialSelection), __unstableGetTemporarilyEditingAsBlocks: () => (__unstableGetTemporarilyEditingAsBlocks), __unstableGetTemporarilyEditingFocusModeToRevert: () => (__unstableGetTemporarilyEditingFocusModeToRevert), __unstableGetVisibleBlocks: () => (__unstableGetVisibleBlocks), __unstableHasActiveBlockOverlayActive: () => (__unstableHasActiveBlockOverlayActive), __unstableIsFullySelected: () => (__unstableIsFullySelected), __unstableIsLastBlockChangeIgnored: () => (__unstableIsLastBlockChangeIgnored), __unstableIsSelectionCollapsed: () => (__unstableIsSelectionCollapsed), __unstableIsSelectionMergeable: () => (__unstableIsSelectionMergeable), __unstableIsWithinBlockOverlay: () => (__unstableIsWithinBlockOverlay), __unstableSelectionHasUnmergeableBlock: () => (__unstableSelectionHasUnmergeableBlock), areInnerBlocksControlled: () => (areInnerBlocksControlled), canEditBlock: () => (canEditBlock), canInsertBlockType: () => (canInsertBlockType), canInsertBlocks: () => (canInsertBlocks), canLockBlockType: () => (canLockBlockType), canMoveBlock: () => (canMoveBlock), canMoveBlocks: () => (canMoveBlocks), canRemoveBlock: () => (canRemoveBlock), canRemoveBlocks: () => (canRemoveBlocks), didAutomaticChange: () => (didAutomaticChange), getAdjacentBlockClientId: () => (getAdjacentBlockClientId), getAllowedBlocks: () => (getAllowedBlocks), getBlock: () => (getBlock), getBlockAttributes: () => (getBlockAttributes), getBlockCount: () => (getBlockCount), getBlockEditingMode: () => (getBlockEditingMode), getBlockHierarchyRootClientId: () => (getBlockHierarchyRootClientId), getBlockIndex: () => (getBlockIndex), getBlockInsertionPoint: () => (getBlockInsertionPoint), getBlockListSettings: () => (getBlockListSettings), getBlockMode: () => (getBlockMode), getBlockName: () => (getBlockName), getBlockNamesByClientId: () => (getBlockNamesByClientId), getBlockOrder: () => (getBlockOrder), getBlockParents: () => (getBlockParents), getBlockParentsByBlockName: () => (getBlockParentsByBlockName), getBlockRootClientId: () => (getBlockRootClientId), getBlockSelectionEnd: () => (getBlockSelectionEnd), getBlockSelectionStart: () => (getBlockSelectionStart), getBlockTransformItems: () => (getBlockTransformItems), getBlocks: () => (getBlocks), getBlocksByClientId: () => (getBlocksByClientId), getBlocksByName: () => (getBlocksByName), getClientIdsOfDescendants: () => (getClientIdsOfDescendants), getClientIdsWithDescendants: () => (getClientIdsWithDescendants), getDirectInsertBlock: () => (getDirectInsertBlock), getDraggedBlockClientIds: () => (getDraggedBlockClientIds), getFirstMultiSelectedBlockClientId: () => (getFirstMultiSelectedBlockClientId), getGlobalBlockCount: () => (getGlobalBlockCount), getHoveredBlockClientId: () => (getHoveredBlockClientId), getInserterItems: () => (getInserterItems), getLastMultiSelectedBlockClientId: () => (getLastMultiSelectedBlockClientId), getLowestCommonAncestorWithSelectedBlock: () => (getLowestCommonAncestorWithSelectedBlock), getMultiSelectedBlockClientIds: () => (getMultiSelectedBlockClientIds), getMultiSelectedBlocks: () => (getMultiSelectedBlocks), getMultiSelectedBlocksEndClientId: () => (getMultiSelectedBlocksEndClientId), getMultiSelectedBlocksStartClientId: () => (getMultiSelectedBlocksStartClientId), getNextBlockClientId: () => (getNextBlockClientId), getPatternsByBlockTypes: () => (getPatternsByBlockTypes), getPreviousBlockClientId: () => (getPreviousBlockClientId), getSelectedBlock: () => (getSelectedBlock), getSelectedBlockClientId: () => (getSelectedBlockClientId), getSelectedBlockClientIds: () => (getSelectedBlockClientIds), getSelectedBlockCount: () => (getSelectedBlockCount), getSelectedBlocksInitialCaretPosition: () => (getSelectedBlocksInitialCaretPosition), getSelectionEnd: () => (getSelectionEnd), getSelectionStart: () => (getSelectionStart), getSettings: () => (getSettings), getTemplate: () => (getTemplate), getTemplateLock: () => (getTemplateLock), hasBlockMovingClientId: () => (hasBlockMovingClientId), hasDraggedInnerBlock: () => (hasDraggedInnerBlock), hasInserterItems: () => (hasInserterItems), hasMultiSelection: () => (hasMultiSelection), hasSelectedBlock: () => (hasSelectedBlock), hasSelectedInnerBlock: () => (hasSelectedInnerBlock), isAncestorBeingDragged: () => (isAncestorBeingDragged), isAncestorMultiSelected: () => (isAncestorMultiSelected), isBlockBeingDragged: () => (isBlockBeingDragged), isBlockHighlighted: () => (isBlockHighlighted), isBlockInsertionPointVisible: () => (isBlockInsertionPointVisible), isBlockMultiSelected: () => (isBlockMultiSelected), isBlockSelected: () => (isBlockSelected), isBlockValid: () => (isBlockValid), isBlockVisible: () => (isBlockVisible), isBlockWithinSelection: () => (isBlockWithinSelection), isCaretWithinFormattedText: () => (isCaretWithinFormattedText), isDraggingBlocks: () => (isDraggingBlocks), isFirstMultiSelectedBlock: () => (isFirstMultiSelectedBlock), isGroupable: () => (isGroupable), isLastBlockChangePersistent: () => (isLastBlockChangePersistent), isMultiSelecting: () => (selectors_isMultiSelecting), isSelectionEnabled: () => (selectors_isSelectionEnabled), isTyping: () => (selectors_isTyping), isUngroupable: () => (isUngroupable), isValidTemplate: () => (isValidTemplate), wasBlockJustInserted: () => (wasBlockJustInserted) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/private-actions.js var private_actions_namespaceObject = {}; __webpack_require__.r(private_actions_namespaceObject); __webpack_require__.d(private_actions_namespaceObject, { __experimentalUpdateSettings: () => (__experimentalUpdateSettings), clearBlockRemovalPrompt: () => (clearBlockRemovalPrompt), deleteStyleOverride: () => (deleteStyleOverride), ensureDefaultBlock: () => (ensureDefaultBlock), expandBlock: () => (expandBlock), hideBlockInterface: () => (hideBlockInterface), modifyContentLockBlock: () => (modifyContentLockBlock), privateRemoveBlocks: () => (privateRemoveBlocks), resetZoomLevel: () => (resetZoomLevel), setBlockRemovalRules: () => (setBlockRemovalRules), setInsertionPoint: () => (setInsertionPoint), setLastFocus: () => (setLastFocus), setOpenedBlockSettingsMenu: () => (setOpenedBlockSettingsMenu), setStyleOverride: () => (setStyleOverride), setZoomLevel: () => (setZoomLevel), showBlockInterface: () => (showBlockInterface), startDragging: () => (startDragging), stopDragging: () => (stopDragging), stopEditingAsBlocks: () => (stopEditingAsBlocks), toggleBlockSpotlight: () => (toggleBlockSpotlight) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { __unstableDeleteSelection: () => (__unstableDeleteSelection), __unstableExpandSelection: () => (__unstableExpandSelection), __unstableMarkAutomaticChange: () => (__unstableMarkAutomaticChange), __unstableMarkLastChangeAsPersistent: () => (__unstableMarkLastChangeAsPersistent), __unstableMarkNextChangeAsNotPersistent: () => (__unstableMarkNextChangeAsNotPersistent), __unstableSaveReusableBlock: () => (__unstableSaveReusableBlock), __unstableSetEditorMode: () => (__unstableSetEditorMode), __unstableSetTemporarilyEditingAsBlocks: () => (__unstableSetTemporarilyEditingAsBlocks), __unstableSplitSelection: () => (__unstableSplitSelection), clearSelectedBlock: () => (clearSelectedBlock), duplicateBlocks: () => (duplicateBlocks), enterFormattedText: () => (enterFormattedText), exitFormattedText: () => (exitFormattedText), flashBlock: () => (flashBlock), hideInsertionPoint: () => (hideInsertionPoint), hoverBlock: () => (hoverBlock), insertAfterBlock: () => (insertAfterBlock), insertBeforeBlock: () => (insertBeforeBlock), insertBlock: () => (insertBlock), insertBlocks: () => (insertBlocks), insertDefaultBlock: () => (insertDefaultBlock), mergeBlocks: () => (mergeBlocks), moveBlockToPosition: () => (moveBlockToPosition), moveBlocksDown: () => (moveBlocksDown), moveBlocksToPosition: () => (moveBlocksToPosition), moveBlocksUp: () => (moveBlocksUp), multiSelect: () => (multiSelect), receiveBlocks: () => (receiveBlocks), registerInserterMediaCategory: () => (registerInserterMediaCategory), removeBlock: () => (removeBlock), removeBlocks: () => (removeBlocks), replaceBlock: () => (replaceBlock), replaceBlocks: () => (replaceBlocks), replaceInnerBlocks: () => (replaceInnerBlocks), resetBlocks: () => (resetBlocks), resetSelection: () => (resetSelection), selectBlock: () => (selectBlock), selectNextBlock: () => (selectNextBlock), selectPreviousBlock: () => (selectPreviousBlock), selectionChange: () => (selectionChange), setBlockEditingMode: () => (setBlockEditingMode), setBlockMovingClientId: () => (setBlockMovingClientId), setBlockVisibility: () => (setBlockVisibility), setHasControlledInnerBlocks: () => (setHasControlledInnerBlocks), setTemplateValidity: () => (setTemplateValidity), showInsertionPoint: () => (showInsertionPoint), startDraggingBlocks: () => (startDraggingBlocks), startMultiSelect: () => (startMultiSelect), startTyping: () => (startTyping), stopDraggingBlocks: () => (stopDraggingBlocks), stopMultiSelect: () => (stopMultiSelect), stopTyping: () => (stopTyping), synchronizeTemplate: () => (synchronizeTemplate), toggleBlockHighlight: () => (toggleBlockHighlight), toggleBlockMode: () => (toggleBlockMode), toggleSelection: () => (toggleSelection), unsetBlockEditingMode: () => (unsetBlockEditingMode), updateBlock: () => (updateBlock), updateBlockAttributes: () => (updateBlockAttributes), updateBlockListSettings: () => (updateBlockListSettings), updateSettings: () => (updateSettings), validateBlocksToTemplate: () => (validateBlocksToTemplate) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/selectors.js var store_selectors_namespaceObject = {}; __webpack_require__.r(store_selectors_namespaceObject); __webpack_require__.d(store_selectors_namespaceObject, { getItems: () => (getItems), getSettings: () => (selectors_getSettings), isUploading: () => (isUploading), isUploadingById: () => (isUploadingById), isUploadingByUrl: () => (isUploadingByUrl) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/private-selectors.js var store_private_selectors_namespaceObject = {}; __webpack_require__.r(store_private_selectors_namespaceObject); __webpack_require__.d(store_private_selectors_namespaceObject, { getAllItems: () => (getAllItems), getBlobUrls: () => (getBlobUrls), getItem: () => (getItem), getPausedUploadForPost: () => (getPausedUploadForPost), isBatchUploaded: () => (isBatchUploaded), isPaused: () => (isPaused), isUploadingToPost: () => (isUploadingToPost) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/actions.js var store_actions_namespaceObject = {}; __webpack_require__.r(store_actions_namespaceObject); __webpack_require__.d(store_actions_namespaceObject, { addItems: () => (addItems), cancelItem: () => (cancelItem) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/private-actions.js var store_private_actions_namespaceObject = {}; __webpack_require__.r(store_private_actions_namespaceObject); __webpack_require__.d(store_private_actions_namespaceObject, { addItem: () => (addItem), finishOperation: () => (finishOperation), pauseQueue: () => (pauseQueue), prepareItem: () => (prepareItem), processItem: () => (processItem), removeItem: () => (removeItem), resumeQueue: () => (resumeQueue), revokeBlobUrls: () => (revokeBlobUrls), updateSettings: () => (private_actions_updateSettings), uploadItem: () => (uploadItem) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/index.js var global_styles_namespaceObject = {}; __webpack_require__.r(global_styles_namespaceObject); __webpack_require__.d(global_styles_namespaceObject, { AdvancedPanel: () => (AdvancedPanel), BackgroundPanel: () => (background_panel_BackgroundImagePanel), BorderPanel: () => (BorderPanel), ColorPanel: () => (ColorPanel), DimensionsPanel: () => (DimensionsPanel), FiltersPanel: () => (FiltersPanel), GlobalStylesContext: () => (GlobalStylesContext), ImageSettingsPanel: () => (ImageSettingsPanel), TypographyPanel: () => (TypographyPanel), areGlobalStyleConfigsEqual: () => (areGlobalStyleConfigsEqual), getBlockCSSSelector: () => (getBlockCSSSelector), getBlockSelectors: () => (getBlockSelectors), getGlobalStylesChanges: () => (getGlobalStylesChanges), getLayoutStyles: () => (getLayoutStyles), toStyles: () => (toStyles), useGlobalSetting: () => (useGlobalSetting), useGlobalStyle: () => (useGlobalStyle), useGlobalStylesOutput: () => (useGlobalStylesOutput), useGlobalStylesOutputWithConfig: () => (useGlobalStylesOutputWithConfig), useGlobalStylesReset: () => (useGlobalStylesReset), useHasBackgroundPanel: () => (useHasBackgroundPanel), useHasBorderPanel: () => (useHasBorderPanel), useHasBorderPanelControls: () => (useHasBorderPanelControls), useHasColorPanel: () => (useHasColorPanel), useHasDimensionsPanel: () => (useHasDimensionsPanel), useHasFiltersPanel: () => (useHasFiltersPanel), useHasImageSettingsPanel: () => (useHasImageSettingsPanel), useHasTypographyPanel: () => (useHasTypographyPanel), useSettingsForBlockElement: () => (useSettingsForBlockElement) }); ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/context.js const mayDisplayControlsKey = Symbol("mayDisplayControls"); const mayDisplayParentControlsKey = Symbol("mayDisplayParentControls"); const blockEditingModeKey = Symbol("blockEditingMode"); const blockBindingsKey = Symbol("blockBindings"); const isPreviewModeKey = Symbol("isPreviewMode"); const DEFAULT_BLOCK_EDIT_CONTEXT = { name: "", isSelected: false }; const Context = (0,external_wp_element_namespaceObject.createContext)(DEFAULT_BLOCK_EDIT_CONTEXT); Context.displayName = "BlockEditContext"; const { Provider } = Context; function useBlockEditContext() { return (0,external_wp_element_namespaceObject.useContext)(Context); } ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); // EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js var es6 = __webpack_require__(7734); var es6_default = /*#__PURE__*/__webpack_require__.n(es6); ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// ./node_modules/@wordpress/block-editor/build-module/store/defaults.js const PREFERENCES_DEFAULTS = { insertUsage: {} }; const SETTINGS_DEFAULTS = { alignWide: false, supportsLayout: true, // colors setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. // The setting is only kept for backward compatibility purposes. colors: [ { name: (0,external_wp_i18n_namespaceObject.__)("Black"), slug: "black", color: "#000000" }, { name: (0,external_wp_i18n_namespaceObject.__)("Cyan bluish gray"), slug: "cyan-bluish-gray", color: "#abb8c3" }, { name: (0,external_wp_i18n_namespaceObject.__)("White"), slug: "white", color: "#ffffff" }, { name: (0,external_wp_i18n_namespaceObject.__)("Pale pink"), slug: "pale-pink", color: "#f78da7" }, { name: (0,external_wp_i18n_namespaceObject.__)("Vivid red"), slug: "vivid-red", color: "#cf2e2e" }, { name: (0,external_wp_i18n_namespaceObject.__)("Luminous vivid orange"), slug: "luminous-vivid-orange", color: "#ff6900" }, { name: (0,external_wp_i18n_namespaceObject.__)("Luminous vivid amber"), slug: "luminous-vivid-amber", color: "#fcb900" }, { name: (0,external_wp_i18n_namespaceObject.__)("Light green cyan"), slug: "light-green-cyan", color: "#7bdcb5" }, { name: (0,external_wp_i18n_namespaceObject.__)("Vivid green cyan"), slug: "vivid-green-cyan", color: "#00d084" }, { name: (0,external_wp_i18n_namespaceObject.__)("Pale cyan blue"), slug: "pale-cyan-blue", color: "#8ed1fc" }, { name: (0,external_wp_i18n_namespaceObject.__)("Vivid cyan blue"), slug: "vivid-cyan-blue", color: "#0693e3" }, { name: (0,external_wp_i18n_namespaceObject.__)("Vivid purple"), slug: "vivid-purple", color: "#9b51e0" } ], // fontSizes setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. // The setting is only kept for backward compatibility purposes. fontSizes: [ { name: (0,external_wp_i18n_namespaceObject._x)("Small", "font size name"), size: 13, slug: "small" }, { name: (0,external_wp_i18n_namespaceObject._x)("Normal", "font size name"), size: 16, slug: "normal" }, { name: (0,external_wp_i18n_namespaceObject._x)("Medium", "font size name"), size: 20, slug: "medium" }, { name: (0,external_wp_i18n_namespaceObject._x)("Large", "font size name"), size: 36, slug: "large" }, { name: (0,external_wp_i18n_namespaceObject._x)("Huge", "font size name"), size: 42, slug: "huge" } ], // Image default size slug. imageDefaultSize: "large", imageSizes: [ { slug: "thumbnail", name: (0,external_wp_i18n_namespaceObject.__)("Thumbnail") }, { slug: "medium", name: (0,external_wp_i18n_namespaceObject.__)("Medium") }, { slug: "large", name: (0,external_wp_i18n_namespaceObject.__)("Large") }, { slug: "full", name: (0,external_wp_i18n_namespaceObject.__)("Full Size") } ], // Allow plugin to disable Image Editor if need be. imageEditing: true, // This is current max width of the block inner area // It's used to constraint image resizing and this value could be overridden later by themes maxWidth: 580, // Allowed block types for the editor, defaulting to true (all supported). allowedBlockTypes: true, // Maximum upload size in bytes allowed for the site. maxUploadFileSize: 0, // List of allowed mime types and file extensions. allowedMimeTypes: null, // Allows to disable block locking interface. canLockBlocks: true, // Allows to disable Openverse media category in the inserter. enableOpenverseMediaCategory: true, clearBlockSelection: true, __experimentalCanUserUseUnfilteredHTML: false, __experimentalBlockDirectory: false, __mobileEnablePageTemplates: false, __experimentalBlockPatterns: [], __experimentalBlockPatternCategories: [], isPreviewMode: false, // These settings will be completely revamped in the future. // The goal is to evolve this into an API which will instruct // the block inspector to animate transitions between what it // displays based on the relationship between the selected block // and its parent, and only enable it if the parent is controlling // its children blocks. blockInspectorAnimation: { animationParent: "core/navigation", "core/navigation": { enterDirection: "leftToRight" }, "core/navigation-submenu": { enterDirection: "rightToLeft" }, "core/navigation-link": { enterDirection: "rightToLeft" }, "core/search": { enterDirection: "rightToLeft" }, "core/social-links": { enterDirection: "rightToLeft" }, "core/page-list": { enterDirection: "rightToLeft" }, "core/spacer": { enterDirection: "rightToLeft" }, "core/home-link": { enterDirection: "rightToLeft" }, "core/site-title": { enterDirection: "rightToLeft" }, "core/site-logo": { enterDirection: "rightToLeft" } }, generateAnchors: false, // gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. // The setting is only kept for backward compatibility purposes. gradients: [ { name: (0,external_wp_i18n_namespaceObject.__)("Vivid cyan blue to vivid purple"), gradient: "linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)", slug: "vivid-cyan-blue-to-vivid-purple" }, { name: (0,external_wp_i18n_namespaceObject.__)("Light green cyan to vivid green cyan"), gradient: "linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)", slug: "light-green-cyan-to-vivid-green-cyan" }, { name: (0,external_wp_i18n_namespaceObject.__)("Luminous vivid amber to luminous vivid orange"), gradient: "linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%)", slug: "luminous-vivid-amber-to-luminous-vivid-orange" }, { name: (0,external_wp_i18n_namespaceObject.__)("Luminous vivid orange to vivid red"), gradient: "linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%)", slug: "luminous-vivid-orange-to-vivid-red" }, { name: (0,external_wp_i18n_namespaceObject.__)("Very light gray to cyan bluish gray"), gradient: "linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%)", slug: "very-light-gray-to-cyan-bluish-gray" }, { name: (0,external_wp_i18n_namespaceObject.__)("Cool to warm spectrum"), gradient: "linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)", slug: "cool-to-warm-spectrum" }, { name: (0,external_wp_i18n_namespaceObject.__)("Blush light purple"), gradient: "linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)", slug: "blush-light-purple" }, { name: (0,external_wp_i18n_namespaceObject.__)("Blush bordeaux"), gradient: "linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%)", slug: "blush-bordeaux" }, { name: (0,external_wp_i18n_namespaceObject.__)("Luminous dusk"), gradient: "linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)", slug: "luminous-dusk" }, { name: (0,external_wp_i18n_namespaceObject.__)("Pale ocean"), gradient: "linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%)", slug: "pale-ocean" }, { name: (0,external_wp_i18n_namespaceObject.__)("Electric grass"), gradient: "linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)", slug: "electric-grass" }, { name: (0,external_wp_i18n_namespaceObject.__)("Midnight"), gradient: "linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)", slug: "midnight" } ], __unstableResolvedAssets: { styles: [], scripts: [] } }; ;// ./node_modules/@wordpress/block-editor/build-module/store/array.js function insertAt(array, elements, index) { return [ ...array.slice(0, index), ...Array.isArray(elements) ? elements : [elements], ...array.slice(index) ]; } function moveTo(array, from, to, count = 1) { const withoutMovedElements = [...array]; withoutMovedElements.splice(from, count); return insertAt( withoutMovedElements, array.slice(from, from + count), to ); } ;// ./node_modules/@wordpress/block-editor/build-module/store/private-keys.js const globalStylesDataKey = Symbol("globalStylesDataKey"); const globalStylesLinksDataKey = Symbol("globalStylesLinks"); const selectBlockPatternsKey = Symbol("selectBlockPatternsKey"); const reusableBlocksSelectKey = Symbol("reusableBlocksSelect"); const sectionRootClientIdKey = Symbol("sectionRootClientIdKey"); const mediaEditKey = Symbol("mediaEditKey"); ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/block-editor/build-module/lock-unlock.js const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/block-editor" ); ;// ./node_modules/@wordpress/block-editor/build-module/store/reducer.js const { isContentBlock } = unlock(external_wp_blocks_namespaceObject.privateApis); const identity = (x) => x; function mapBlockOrder(blocks2, rootClientId = "") { const result = /* @__PURE__ */ new Map(); const current = []; result.set(rootClientId, current); blocks2.forEach((block) => { const { clientId, innerBlocks } = block; current.push(clientId); mapBlockOrder(innerBlocks, clientId).forEach( (order, subClientId) => { result.set(subClientId, order); } ); }); return result; } function mapBlockParents(blocks2, rootClientId = "") { const result = []; const stack = [[rootClientId, blocks2]]; while (stack.length) { const [parent, currentBlocks] = stack.shift(); currentBlocks.forEach(({ innerBlocks, ...block }) => { result.push([block.clientId, parent]); if (innerBlocks?.length) { stack.push([block.clientId, innerBlocks]); } }); } return result; } function flattenBlocks(blocks2, transform = identity) { const result = []; const stack = [...blocks2]; while (stack.length) { const { innerBlocks, ...block } = stack.shift(); stack.push(...innerBlocks); result.push([block.clientId, transform(block)]); } return result; } function getFlattenedClientIds(blocks2) { const result = {}; const stack = [...blocks2]; while (stack.length) { const { innerBlocks, ...block } = stack.shift(); stack.push(...innerBlocks); result[block.clientId] = true; } return result; } function getFlattenedBlocksWithoutAttributes(blocks2) { return flattenBlocks(blocks2, (block) => { const { attributes, ...restBlock } = block; return restBlock; }); } function getFlattenedBlockAttributes(blocks2) { return flattenBlocks(blocks2, (block) => block.attributes); } function hasSameKeys(a, b) { return es6_default()(Object.keys(a), Object.keys(b)); } function isUpdatingSameBlockAttribute(action, lastAction) { return action.type === "UPDATE_BLOCK_ATTRIBUTES" && lastAction !== void 0 && lastAction.type === "UPDATE_BLOCK_ATTRIBUTES" && es6_default()(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes); } function updateBlockTreeForBlocks(state, blocks2) { const treeToUpdate = state.tree; const stack = [...blocks2]; const flattenedBlocks = [...blocks2]; while (stack.length) { const block = stack.shift(); stack.push(...block.innerBlocks); flattenedBlocks.push(...block.innerBlocks); } for (const block of flattenedBlocks) { treeToUpdate.set(block.clientId, {}); } for (const block of flattenedBlocks) { treeToUpdate.set( block.clientId, Object.assign(treeToUpdate.get(block.clientId), { ...state.byClientId.get(block.clientId), attributes: state.attributes.get(block.clientId), innerBlocks: block.innerBlocks.map( (subBlock) => treeToUpdate.get(subBlock.clientId) ) }) ); } } function updateParentInnerBlocksInTree(state, updatedClientIds, updateChildrenOfUpdatedClientIds = false) { const treeToUpdate = state.tree; const uncontrolledParents = /* @__PURE__ */ new Set([]); const controlledParents = /* @__PURE__ */ new Set(); for (const clientId of updatedClientIds) { let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents.get(clientId); do { if (state.controlledInnerBlocks[current]) { controlledParents.add(current); break; } else { uncontrolledParents.add(current); current = state.parents.get(current); } } while (current !== void 0); } for (const clientId of uncontrolledParents) { treeToUpdate.set(clientId, { ...treeToUpdate.get(clientId) }); } for (const clientId of uncontrolledParents) { treeToUpdate.get(clientId).innerBlocks = (state.order.get(clientId) || []).map((subClientId) => treeToUpdate.get(subClientId)); } for (const clientId of controlledParents) { treeToUpdate.set("controlled||" + clientId, { innerBlocks: (state.order.get(clientId) || []).map( (subClientId) => treeToUpdate.get(subClientId) ) }); } } const withBlockTree = (reducer) => (state = {}, action) => { const newState = reducer(state, action); if (newState === state) { return state; } newState.tree = state.tree ? state.tree : /* @__PURE__ */ new Map(); switch (action.type) { case "RECEIVE_BLOCKS": case "INSERT_BLOCKS": { newState.tree = new Map(newState.tree); updateBlockTreeForBlocks(newState, action.blocks); updateParentInnerBlocksInTree( newState, action.rootClientId ? [action.rootClientId] : [""], true ); break; } case "UPDATE_BLOCK": newState.tree = new Map(newState.tree); newState.tree.set(action.clientId, { ...newState.tree.get(action.clientId), ...newState.byClientId.get(action.clientId), attributes: newState.attributes.get(action.clientId) }); updateParentInnerBlocksInTree( newState, [action.clientId], false ); break; case "SYNC_DERIVED_BLOCK_ATTRIBUTES": case "UPDATE_BLOCK_ATTRIBUTES": { newState.tree = new Map(newState.tree); action.clientIds.forEach((clientId) => { newState.tree.set(clientId, { ...newState.tree.get(clientId), attributes: newState.attributes.get(clientId) }); }); updateParentInnerBlocksInTree( newState, action.clientIds, false ); break; } case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": { const inserterClientIds = getFlattenedClientIds( action.blocks ); newState.tree = new Map(newState.tree); action.replacedClientIds.forEach((clientId) => { newState.tree.delete(clientId); if (!inserterClientIds[clientId]) { newState.tree.delete("controlled||" + clientId); } }); updateBlockTreeForBlocks(newState, action.blocks); updateParentInnerBlocksInTree( newState, action.blocks.map((b) => b.clientId), false ); const parentsOfRemovedBlocks2 = []; for (const clientId of action.clientIds) { const parentId = state.parents.get(clientId); if (parentId !== void 0 && (parentId === "" || newState.byClientId.get(parentId))) { parentsOfRemovedBlocks2.push(parentId); } } updateParentInnerBlocksInTree( newState, parentsOfRemovedBlocks2, true ); break; } case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN": const parentsOfRemovedBlocks = []; for (const clientId of action.clientIds) { const parentId = state.parents.get(clientId); if (parentId !== void 0 && (parentId === "" || newState.byClientId.get(parentId))) { parentsOfRemovedBlocks.push(parentId); } } newState.tree = new Map(newState.tree); action.removedClientIds.forEach((clientId) => { newState.tree.delete(clientId); newState.tree.delete("controlled||" + clientId); }); updateParentInnerBlocksInTree( newState, parentsOfRemovedBlocks, true ); break; case "MOVE_BLOCKS_TO_POSITION": { const updatedBlockUids = []; if (action.fromRootClientId) { updatedBlockUids.push(action.fromRootClientId); } else { updatedBlockUids.push(""); } if (action.toRootClientId) { updatedBlockUids.push(action.toRootClientId); } newState.tree = new Map(newState.tree); updateParentInnerBlocksInTree( newState, updatedBlockUids, true ); break; } case "MOVE_BLOCKS_UP": case "MOVE_BLOCKS_DOWN": { const updatedBlockUids = [ action.rootClientId ? action.rootClientId : "" ]; newState.tree = new Map(newState.tree); updateParentInnerBlocksInTree( newState, updatedBlockUids, true ); break; } case "SAVE_REUSABLE_BLOCK_SUCCESS": { const updatedBlockUids = []; newState.attributes.forEach((attributes, clientId) => { if (newState.byClientId.get(clientId).name === "core/block" && attributes.ref === action.updatedId) { updatedBlockUids.push(clientId); } }); newState.tree = new Map(newState.tree); updatedBlockUids.forEach((clientId) => { newState.tree.set(clientId, { ...newState.byClientId.get(clientId), attributes: newState.attributes.get(clientId), innerBlocks: newState.tree.get(clientId).innerBlocks }); }); updateParentInnerBlocksInTree( newState, updatedBlockUids, false ); } } return newState; }; function withPersistentBlockChange(reducer) { let lastAction; let markNextChangeAsNotPersistent = false; let explicitPersistent; return (state, action) => { let nextState = reducer(state, action); let nextIsPersistentChange; if (action.type === "SET_EXPLICIT_PERSISTENT") { explicitPersistent = action.isPersistentChange; nextIsPersistentChange = state.isPersistentChange ?? true; } if (explicitPersistent !== void 0) { nextIsPersistentChange = explicitPersistent; return nextIsPersistentChange === nextState.isPersistentChange ? nextState : { ...nextState, isPersistentChange: nextIsPersistentChange }; } const isExplicitPersistentChange = action.type === "MARK_LAST_CHANGE_AS_PERSISTENT" || markNextChangeAsNotPersistent; if (state === nextState && !isExplicitPersistentChange) { markNextChangeAsNotPersistent = action.type === "MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"; nextIsPersistentChange = state?.isPersistentChange ?? true; if (state.isPersistentChange === nextIsPersistentChange) { return state; } return { ...nextState, isPersistentChange: nextIsPersistentChange }; } nextState = { ...nextState, isPersistentChange: isExplicitPersistentChange ? !markNextChangeAsNotPersistent : !isUpdatingSameBlockAttribute(action, lastAction) }; lastAction = action; markNextChangeAsNotPersistent = action.type === "MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"; return nextState; }; } function withIgnoredBlockChange(reducer) { const IGNORED_ACTION_TYPES = /* @__PURE__ */ new Set(["RECEIVE_BLOCKS"]); return (state, action) => { const nextState = reducer(state, action); if (nextState !== state) { nextState.isIgnoredChange = IGNORED_ACTION_TYPES.has(action.type); } return nextState; }; } const withInnerBlocksRemoveCascade = (reducer) => (state, action) => { const getAllChildren = (clientIds) => { let result = clientIds; for (let i = 0; i < result.length; i++) { if (!state.order.get(result[i]) || action.keepControlledInnerBlocks && action.keepControlledInnerBlocks[result[i]]) { continue; } if (result === clientIds) { result = [...result]; } result.push(...state.order.get(result[i])); } return result; }; if (state) { switch (action.type) { case "REMOVE_BLOCKS": action = { ...action, type: "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN", removedClientIds: getAllChildren(action.clientIds) }; break; case "REPLACE_BLOCKS": action = { ...action, type: "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN", replacedClientIds: getAllChildren(action.clientIds) }; break; } } return reducer(state, action); }; const withBlockReset = (reducer) => (state, action) => { if (action.type === "RESET_BLOCKS") { const newState = { ...state, byClientId: new Map( getFlattenedBlocksWithoutAttributes(action.blocks) ), attributes: new Map(getFlattenedBlockAttributes(action.blocks)), order: mapBlockOrder(action.blocks), parents: new Map(mapBlockParents(action.blocks)), controlledInnerBlocks: {} }; newState.tree = new Map(state?.tree); updateBlockTreeForBlocks(newState, action.blocks); newState.tree.set("", { innerBlocks: action.blocks.map( (subBlock) => newState.tree.get(subBlock.clientId) ) }); return newState; } return reducer(state, action); }; const withReplaceInnerBlocks = (reducer) => (state, action) => { if (action.type !== "REPLACE_INNER_BLOCKS") { return reducer(state, action); } const nestedControllers = {}; if (Object.keys(state.controlledInnerBlocks).length) { const stack = [...action.blocks]; while (stack.length) { const { innerBlocks, ...block } = stack.shift(); stack.push(...innerBlocks); if (!!state.controlledInnerBlocks[block.clientId]) { nestedControllers[block.clientId] = true; } } } let stateAfterBlocksRemoval = state; if (state.order.get(action.rootClientId)) { stateAfterBlocksRemoval = reducer(stateAfterBlocksRemoval, { type: "REMOVE_BLOCKS", keepControlledInnerBlocks: nestedControllers, clientIds: state.order.get(action.rootClientId) }); } let stateAfterInsert = stateAfterBlocksRemoval; if (action.blocks.length) { stateAfterInsert = reducer(stateAfterInsert, { ...action, type: "INSERT_BLOCKS", index: 0 }); const stateAfterInsertOrder = new Map(stateAfterInsert.order); Object.keys(nestedControllers).forEach((key) => { if (state.order.get(key)) { stateAfterInsertOrder.set(key, state.order.get(key)); } }); stateAfterInsert.order = stateAfterInsertOrder; stateAfterInsert.tree = new Map(stateAfterInsert.tree); Object.keys(nestedControllers).forEach((_key) => { const key = `controlled||${_key}`; if (state.tree.has(key)) { stateAfterInsert.tree.set(key, state.tree.get(key)); } }); } return stateAfterInsert; }; const withSaveReusableBlock = (reducer) => (state, action) => { if (state && action.type === "SAVE_REUSABLE_BLOCK_SUCCESS") { const { id, updatedId } = action; if (id === updatedId) { return state; } state = { ...state }; state.attributes = new Map(state.attributes); state.attributes.forEach((attributes, clientId) => { const { name } = state.byClientId.get(clientId); if (name === "core/block" && attributes.ref === id) { state.attributes.set(clientId, { ...attributes, ref: updatedId }); } }); } return reducer(state, action); }; const withResetControlledBlocks = (reducer) => (state, action) => { if (action.type === "SET_HAS_CONTROLLED_INNER_BLOCKS") { const tempState = reducer(state, { type: "REPLACE_INNER_BLOCKS", rootClientId: action.clientId, blocks: [] }); return reducer(tempState, action); } return reducer(state, action); }; const blocks = (0,external_wp_compose_namespaceObject.pipe)( external_wp_data_namespaceObject.combineReducers, withSaveReusableBlock, // Needs to be before withBlockCache. withBlockTree, // Needs to be before withInnerBlocksRemoveCascade. withInnerBlocksRemoveCascade, withReplaceInnerBlocks, // Needs to be after withInnerBlocksRemoveCascade. withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetControlledBlocks )({ // The state is using a Map instead of a plain object for performance reasons. // You can run the "./test/performance.js" unit test to check the impact // code changes can have on this reducer. byClientId(state = /* @__PURE__ */ new Map(), action) { switch (action.type) { case "RECEIVE_BLOCKS": case "INSERT_BLOCKS": { const newState = new Map(state); getFlattenedBlocksWithoutAttributes(action.blocks).forEach( ([key, value]) => { newState.set(key, value); } ); return newState; } case "UPDATE_BLOCK": { if (!state.has(action.clientId)) { return state; } const { attributes, ...changes } = action.updates; if (Object.values(changes).length === 0) { return state; } const newState = new Map(state); newState.set(action.clientId, { ...state.get(action.clientId), ...changes }); return newState; } case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": { if (!action.blocks) { return state; } const newState = new Map(state); action.replacedClientIds.forEach((clientId) => { newState.delete(clientId); }); getFlattenedBlocksWithoutAttributes(action.blocks).forEach( ([key, value]) => { newState.set(key, value); } ); return newState; } case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN": { const newState = new Map(state); action.removedClientIds.forEach((clientId) => { newState.delete(clientId); }); return newState; } } return state; }, // The state is using a Map instead of a plain object for performance reasons. // You can run the "./test/performance.js" unit test to check the impact // code changes can have on this reducer. attributes(state = /* @__PURE__ */ new Map(), action) { switch (action.type) { case "RECEIVE_BLOCKS": case "INSERT_BLOCKS": { const newState = new Map(state); getFlattenedBlockAttributes(action.blocks).forEach( ([key, value]) => { newState.set(key, value); } ); return newState; } case "UPDATE_BLOCK": { if (!state.get(action.clientId) || !action.updates.attributes) { return state; } const newState = new Map(state); newState.set(action.clientId, { ...state.get(action.clientId), ...action.updates.attributes }); return newState; } case "SYNC_DERIVED_BLOCK_ATTRIBUTES": case "UPDATE_BLOCK_ATTRIBUTES": { if (action.clientIds.every((id) => !state.get(id))) { return state; } let hasChange = false; const newState = new Map(state); for (const clientId of action.clientIds) { const updatedAttributeEntries = Object.entries( !!action.options?.uniqueByBlock ? action.attributes[clientId] : action.attributes ?? {} ); if (updatedAttributeEntries.length === 0) { continue; } let hasUpdatedAttributes = false; const existingAttributes = state.get(clientId); const newAttributes = {}; updatedAttributeEntries.forEach(([key, value]) => { if (existingAttributes[key] !== value) { hasUpdatedAttributes = true; newAttributes[key] = value; } }); hasChange = hasChange || hasUpdatedAttributes; if (hasUpdatedAttributes) { newState.set(clientId, { ...existingAttributes, ...newAttributes }); } } return hasChange ? newState : state; } case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": { if (!action.blocks) { return state; } const newState = new Map(state); action.replacedClientIds.forEach((clientId) => { newState.delete(clientId); }); getFlattenedBlockAttributes(action.blocks).forEach( ([key, value]) => { newState.set(key, value); } ); return newState; } case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN": { const newState = new Map(state); action.removedClientIds.forEach((clientId) => { newState.delete(clientId); }); return newState; } } return state; }, // The state is using a Map instead of a plain object for performance reasons. // You can run the "./test/performance.js" unit test to check the impact // code changes can have on this reducer. order(state = /* @__PURE__ */ new Map(), action) { switch (action.type) { case "RECEIVE_BLOCKS": { const blockOrder = mapBlockOrder(action.blocks); const newState = new Map(state); blockOrder.forEach((order, clientId) => { if (clientId !== "") { newState.set(clientId, order); } }); newState.set( "", (state.get("") ?? []).concat(blockOrder[""]) ); return newState; } case "INSERT_BLOCKS": { const { rootClientId = "" } = action; const subState = state.get(rootClientId) || []; const mappedBlocks = mapBlockOrder( action.blocks, rootClientId ); const { index = subState.length } = action; const newState = new Map(state); mappedBlocks.forEach((order, clientId) => { newState.set(clientId, order); }); newState.set( rootClientId, insertAt( subState, mappedBlocks.get(rootClientId), index ) ); return newState; } case "MOVE_BLOCKS_TO_POSITION": { const { fromRootClientId = "", toRootClientId = "", clientIds } = action; const { index = state.get(toRootClientId).length } = action; if (fromRootClientId === toRootClientId) { const subState = state.get(toRootClientId); const fromIndex = subState.indexOf(clientIds[0]); const newState2 = new Map(state); newState2.set( toRootClientId, moveTo( state.get(toRootClientId), fromIndex, index, clientIds.length ) ); return newState2; } const newState = new Map(state); newState.set( fromRootClientId, state.get(fromRootClientId)?.filter((id) => !clientIds.includes(id)) ?? [] ); newState.set( toRootClientId, insertAt(state.get(toRootClientId), clientIds, index) ); return newState; } case "MOVE_BLOCKS_UP": { const { clientIds, rootClientId = "" } = action; const firstClientId = clientIds[0]; const subState = state.get(rootClientId); if (!subState.length || firstClientId === subState[0]) { return state; } const firstIndex = subState.indexOf(firstClientId); const newState = new Map(state); newState.set( rootClientId, moveTo( subState, firstIndex, firstIndex - 1, clientIds.length ) ); return newState; } case "MOVE_BLOCKS_DOWN": { const { clientIds, rootClientId = "" } = action; const firstClientId = clientIds[0]; const lastClientId = clientIds[clientIds.length - 1]; const subState = state.get(rootClientId); if (!subState.length || lastClientId === subState[subState.length - 1]) { return state; } const firstIndex = subState.indexOf(firstClientId); const newState = new Map(state); newState.set( rootClientId, moveTo( subState, firstIndex, firstIndex + 1, clientIds.length ) ); return newState; } case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": { const { clientIds } = action; if (!action.blocks) { return state; } const mappedBlocks = mapBlockOrder(action.blocks); const newState = new Map(state); action.replacedClientIds.forEach((clientId) => { newState.delete(clientId); }); mappedBlocks.forEach((order, clientId) => { if (clientId !== "") { newState.set(clientId, order); } }); newState.forEach((order, clientId) => { const newSubOrder = Object.values(order).reduce( (result, subClientId) => { if (subClientId === clientIds[0]) { return [...result, ...mappedBlocks.get("")]; } if (clientIds.indexOf(subClientId) === -1) { result.push(subClientId); } return result; }, [] ); newState.set(clientId, newSubOrder); }); return newState; } case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN": { const newState = new Map(state); action.removedClientIds.forEach((clientId) => { newState.delete(clientId); }); newState.forEach((order, clientId) => { const newSubOrder = order?.filter( (id) => !action.removedClientIds.includes(id) ) ?? []; if (newSubOrder.length !== order.length) { newState.set(clientId, newSubOrder); } }); return newState; } } return state; }, // While technically redundant data as the inverse of `order`, it serves as // an optimization for the selectors which derive the ancestry of a block. parents(state = /* @__PURE__ */ new Map(), action) { switch (action.type) { case "RECEIVE_BLOCKS": { const newState = new Map(state); mapBlockParents(action.blocks).forEach( ([key, value]) => { newState.set(key, value); } ); return newState; } case "INSERT_BLOCKS": { const newState = new Map(state); mapBlockParents( action.blocks, action.rootClientId || "" ).forEach(([key, value]) => { newState.set(key, value); }); return newState; } case "MOVE_BLOCKS_TO_POSITION": { const newState = new Map(state); action.clientIds.forEach((id) => { newState.set(id, action.toRootClientId || ""); }); return newState; } case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": { const newState = new Map(state); action.replacedClientIds.forEach((clientId) => { newState.delete(clientId); }); mapBlockParents( action.blocks, state.get(action.clientIds[0]) ).forEach(([key, value]) => { newState.set(key, value); }); return newState; } case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN": { const newState = new Map(state); action.removedClientIds.forEach((clientId) => { newState.delete(clientId); }); return newState; } } return state; }, controlledInnerBlocks(state = {}, { type, clientId, hasControlledInnerBlocks }) { if (type === "SET_HAS_CONTROLLED_INNER_BLOCKS") { return { ...state, [clientId]: hasControlledInnerBlocks }; } return state; } }); function isBlockInterfaceHidden(state = false, action) { switch (action.type) { case "HIDE_BLOCK_INTERFACE": return true; case "SHOW_BLOCK_INTERFACE": return false; } return state; } function isTyping(state = false, action) { switch (action.type) { case "START_TYPING": return true; case "STOP_TYPING": return false; } return state; } function isDragging(state = false, action) { switch (action.type) { case "START_DRAGGING": return true; case "STOP_DRAGGING": return false; } return state; } function draggedBlocks(state = [], action) { switch (action.type) { case "START_DRAGGING_BLOCKS": return action.clientIds; case "STOP_DRAGGING_BLOCKS": return []; } return state; } function blockVisibility(state = {}, action) { if (action.type === "SET_BLOCK_VISIBILITY") { return { ...state, ...action.updates }; } return state; } function selectionHelper(state = {}, action) { switch (action.type) { case "CLEAR_SELECTED_BLOCK": { if (state.clientId) { return {}; } return state; } case "SELECT_BLOCK": if (action.clientId === state.clientId) { return state; } return { clientId: action.clientId }; case "REPLACE_INNER_BLOCKS": case "INSERT_BLOCKS": { if (!action.updateSelection || !action.blocks.length) { return state; } return { clientId: action.blocks[0].clientId }; } case "REMOVE_BLOCKS": if (!action.clientIds || !action.clientIds.length || action.clientIds.indexOf(state.clientId) === -1) { return state; } return {}; case "REPLACE_BLOCKS": { if (action.clientIds.indexOf(state.clientId) === -1) { return state; } const blockToSelect = action.blocks[action.indexToSelect] || action.blocks[action.blocks.length - 1]; if (!blockToSelect) { return {}; } if (blockToSelect.clientId === state.clientId) { return state; } return { clientId: blockToSelect.clientId }; } } return state; } function selection(state = {}, action) { switch (action.type) { case "SELECTION_CHANGE": if (action.clientId) { return { selectionStart: { clientId: action.clientId, attributeKey: action.attributeKey, offset: action.startOffset }, selectionEnd: { clientId: action.clientId, attributeKey: action.attributeKey, offset: action.endOffset } }; } return { selectionStart: action.start || state.selectionStart, selectionEnd: action.end || state.selectionEnd }; case "RESET_SELECTION": const { selectionStart: selectionStart2, selectionEnd: selectionEnd2 } = action; return { selectionStart: selectionStart2, selectionEnd: selectionEnd2 }; case "MULTI_SELECT": const { start, end } = action; if (start === state.selectionStart?.clientId && end === state.selectionEnd?.clientId) { return state; } return { selectionStart: { clientId: start }, selectionEnd: { clientId: end } }; case "RESET_BLOCKS": const startClientId = state?.selectionStart?.clientId; const endClientId = state?.selectionEnd?.clientId; if (!startClientId && !endClientId) { return state; } if (!action.blocks.some( (block) => block.clientId === startClientId )) { return { selectionStart: {}, selectionEnd: {} }; } if (!action.blocks.some( (block) => block.clientId === endClientId )) { return { ...state, selectionEnd: state.selectionStart }; } } const selectionStart = selectionHelper(state.selectionStart, action); const selectionEnd = selectionHelper(state.selectionEnd, action); if (selectionStart === state.selectionStart && selectionEnd === state.selectionEnd) { return state; } return { selectionStart, selectionEnd }; } function isMultiSelecting(state = false, action) { switch (action.type) { case "START_MULTI_SELECT": return true; case "STOP_MULTI_SELECT": return false; } return state; } function isSelectionEnabled(state = true, action) { switch (action.type) { case "TOGGLE_SELECTION": return action.isSelectionEnabled; } return state; } function removalPromptData(state = false, action) { switch (action.type) { case "DISPLAY_BLOCK_REMOVAL_PROMPT": const { clientIds, selectPrevious, message } = action; return { clientIds, selectPrevious, message }; case "CLEAR_BLOCK_REMOVAL_PROMPT": return false; } return state; } function blockRemovalRules(state = false, action) { switch (action.type) { case "SET_BLOCK_REMOVAL_RULES": return action.rules; } return state; } function initialPosition(state = null, action) { if (action.type === "REPLACE_BLOCKS" && action.initialPosition !== void 0) { return action.initialPosition; } else if ([ "MULTI_SELECT", "SELECT_BLOCK", "RESET_SELECTION", "INSERT_BLOCKS", "REPLACE_INNER_BLOCKS" ].includes(action.type)) { return action.initialPosition; } return state; } function blocksMode(state = {}, action) { if (action.type === "TOGGLE_BLOCK_MODE") { const { clientId } = action; return { ...state, [clientId]: state[clientId] && state[clientId] === "html" ? "visual" : "html" }; } return state; } function insertionCue(state = null, action) { switch (action.type) { case "SHOW_INSERTION_POINT": { const { rootClientId, index, __unstableWithInserter, operation, nearestSide } = action; const nextState = { rootClientId, index, __unstableWithInserter, operation, nearestSide }; return es6_default()(state, nextState) ? state : nextState; } case "HIDE_INSERTION_POINT": return null; } return state; } function template(state = { isValid: true }, action) { switch (action.type) { case "SET_TEMPLATE_VALIDITY": return { ...state, isValid: action.isValid }; } return state; } function settings(state = SETTINGS_DEFAULTS, action) { switch (action.type) { case "UPDATE_SETTINGS": { const updatedSettings = action.reset ? { ...SETTINGS_DEFAULTS, ...action.settings } : { ...state, ...action.settings }; Object.defineProperty(updatedSettings, "__unstableIsPreviewMode", { get() { external_wp_deprecated_default()("__unstableIsPreviewMode", { since: "6.8", alternative: "isPreviewMode" }); return this.isPreviewMode; } }); return updatedSettings; } } return state; } function preferences(state = PREFERENCES_DEFAULTS, action) { switch (action.type) { case "INSERT_BLOCKS": case "REPLACE_BLOCKS": { const nextInsertUsage = action.blocks.reduce( (prevUsage, block) => { const { attributes, name: blockName } = block; let id = blockName; const match = (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getActiveBlockVariation( blockName, attributes ); if (match?.name) { id += "/" + match.name; } if (blockName === "core/block") { id += "/" + attributes.ref; } return { ...prevUsage, [id]: { time: action.time, count: prevUsage[id] ? prevUsage[id].count + 1 : 1 } }; }, state.insertUsage ); return { ...state, insertUsage: nextInsertUsage }; } } return state; } const blockListSettings = (state = {}, action) => { switch (action.type) { // Even if the replaced blocks have the same client ID, our logic // should correct the state. case "REPLACE_BLOCKS": case "REMOVE_BLOCKS": { return Object.fromEntries( Object.entries(state).filter( ([id]) => !action.clientIds.includes(id) ) ); } case "UPDATE_BLOCK_LIST_SETTINGS": { const updates = typeof action.clientId === "string" ? { [action.clientId]: action.settings } : action.clientId; for (const clientId in updates) { if (!updates[clientId]) { if (!state[clientId]) { delete updates[clientId]; } } else if (es6_default()(state[clientId], updates[clientId])) { delete updates[clientId]; } } if (Object.keys(updates).length === 0) { return state; } const merged = { ...state, ...updates }; for (const clientId in updates) { if (!updates[clientId]) { delete merged[clientId]; } } return merged; } } return state; }; function lastBlockAttributesChange(state = null, action) { switch (action.type) { case "UPDATE_BLOCK": if (!action.updates.attributes) { break; } return { [action.clientId]: action.updates.attributes }; case "UPDATE_BLOCK_ATTRIBUTES": return action.clientIds.reduce( (accumulator, id) => ({ ...accumulator, [id]: !!action.options?.uniqueByBlock ? action.attributes[id] : action.attributes }), {} ); } return state; } function highlightedBlock(state, action) { switch (action.type) { case "TOGGLE_BLOCK_HIGHLIGHT": const { clientId, isHighlighted } = action; if (isHighlighted) { return clientId; } else if (state === clientId) { return null; } return state; case "SELECT_BLOCK": if (action.clientId !== state) { return null; } } return state; } function hasBlockSpotlight(state, action) { switch (action.type) { case "TOGGLE_BLOCK_SPOTLIGHT": const { clientId, hasBlockSpotlight: _hasBlockSpotlight } = action; if (_hasBlockSpotlight) { return clientId; } else if (state === clientId) { return null; } return state; case "SELECT_BLOCK": if (action.clientId !== state) { return null; } return state; case "SELECTION_CHANGE": if (action.start?.clientId !== state || action.end?.clientId !== state) { return null; } return state; case "CLEAR_SELECTED_BLOCK": return null; } return state; } function expandedBlock(state = null, action) { switch (action.type) { case "SET_BLOCK_EXPANDED_IN_LIST_VIEW": return action.clientId; case "SELECT_BLOCK": if (action.clientId !== state) { return null; } } return state; } function lastBlockInserted(state = {}, action) { switch (action.type) { case "INSERT_BLOCKS": case "REPLACE_BLOCKS": if (!action.blocks.length) { return state; } const clientIds = action.blocks.map((block) => { return block.clientId; }); const source = action.meta?.source; return { clientIds, source }; case "RESET_BLOCKS": return {}; } return state; } function temporarilyEditingAsBlocks(state = "", action) { if (action.type === "SET_TEMPORARILY_EDITING_AS_BLOCKS") { return action.temporarilyEditingAsBlocks; } return state; } function temporarilyEditingFocusModeRevert(state = "", action) { if (action.type === "SET_TEMPORARILY_EDITING_AS_BLOCKS") { return action.focusModeToRevert; } return state; } function blockEditingModes(state = /* @__PURE__ */ new Map(), action) { switch (action.type) { case "SET_BLOCK_EDITING_MODE": if (state.get(action.clientId) === action.mode) { return state; } return new Map(state).set(action.clientId, action.mode); case "UNSET_BLOCK_EDITING_MODE": { if (!state.has(action.clientId)) { return state; } const newState = new Map(state); newState.delete(action.clientId); return newState; } case "RESET_BLOCKS": { return state.has("") ? (/* @__PURE__ */ new Map()).set("", state.get("")) : state; } } return state; } function openedBlockSettingsMenu(state = null, action) { if ("SET_OPENED_BLOCK_SETTINGS_MENU" === action.type) { return action?.clientId ?? null; } return state; } function styleOverrides(state = /* @__PURE__ */ new Map(), action) { switch (action.type) { case "SET_STYLE_OVERRIDE": return new Map(state).set(action.id, action.style); case "DELETE_STYLE_OVERRIDE": { const newState = new Map(state); newState.delete(action.id); return newState; } } return state; } function registeredInserterMediaCategories(state = [], action) { switch (action.type) { case "REGISTER_INSERTER_MEDIA_CATEGORY": return [...state, action.category]; } return state; } function lastFocus(state = false, action) { switch (action.type) { case "LAST_FOCUS": return action.lastFocus; } return state; } function zoomLevel(state = 100, action) { switch (action.type) { case "SET_ZOOM_LEVEL": return action.zoom; case "RESET_ZOOM_LEVEL": return 100; } return state; } function insertionPoint(state = null, action) { switch (action.type) { case "SET_INSERTION_POINT": return action.value; case "SELECT_BLOCK": return null; } return state; } const combinedReducers = (0,external_wp_data_namespaceObject.combineReducers)({ blocks, isDragging, isTyping, isBlockInterfaceHidden, draggedBlocks, selection, isMultiSelecting, isSelectionEnabled, initialPosition, blocksMode, blockListSettings, insertionPoint, insertionCue, template, settings, preferences, lastBlockAttributesChange, lastFocus, expandedBlock, highlightedBlock, lastBlockInserted, temporarilyEditingAsBlocks, temporarilyEditingFocusModeRevert, blockVisibility, blockEditingModes, styleOverrides, removalPromptData, blockRemovalRules, openedBlockSettingsMenu, registeredInserterMediaCategories, zoomLevel, hasBlockSpotlight }); function getBlockTreeBlock(state, clientId) { if (clientId === "") { const rootBlock = state.blocks.tree.get(clientId); if (!rootBlock) { return; } return { clientId: "", ...rootBlock }; } if (!state.blocks.controlledInnerBlocks[clientId]) { return state.blocks.tree.get(clientId); } const controlledTree = state.blocks.tree.get(`controlled||${clientId}`); const regularTree = state.blocks.tree.get(clientId); return { ...regularTree, innerBlocks: controlledTree?.innerBlocks }; } function traverseBlockTree(state, clientId, callback) { const tree = getBlockTreeBlock(state, clientId); if (!tree) { return; } callback(tree); if (!tree?.innerBlocks?.length) { return; } for (const innerBlock of tree?.innerBlocks) { traverseBlockTree(state, innerBlock.clientId, callback); } } function findParentInClientIdsList(state, clientId, clientIds) { if (!clientIds.length) { return; } let parent = state.blocks.parents.get(clientId); while (parent !== void 0) { if (clientIds.includes(parent)) { return parent; } parent = state.blocks.parents.get(parent); } } function hasBindings(block) { return block?.attributes?.metadata?.bindings && Object.keys(block?.attributes?.metadata?.bindings).length; } function getDerivedBlockEditingModesForTree(state, treeClientId = "") { const isZoomedOut = state?.zoomLevel < 100 || state?.zoomLevel === "auto-scaled"; const derivedBlockEditingModes = /* @__PURE__ */ new Map(); const sectionRootClientId = state.settings?.[sectionRootClientIdKey]; const sectionClientIds = state.blocks.order.get(sectionRootClientId); const hasDisabledBlocks = Array.from(state.blockEditingModes).some( ([, mode]) => mode === "disabled" ); const templatePartClientIds = []; const syncedPatternClientIds = []; Object.keys(state.blocks.controlledInnerBlocks).forEach((clientId) => { const block = state.blocks.byClientId?.get(clientId); if (block?.name === "core/template-part") { templatePartClientIds.push(clientId); } if (block?.name === "core/block") { syncedPatternClientIds.push(clientId); } }); const contentOnlyTemplateLockedClientIds = Object.keys( state.blockListSettings ).filter( (clientId) => state.blockListSettings[clientId]?.templateLock === "contentOnly" ); const unsyncedPatternClientIds = !!window?.__experimentalContentOnlyPatternInsertion ? Array.from(state.blocks.attributes.keys()).filter( (clientId) => state.blocks.attributes.get(clientId)?.metadata?.patternName ) : []; const contentOnlyParents = [ ...contentOnlyTemplateLockedClientIds, ...unsyncedPatternClientIds, ...window?.__experimentalContentOnlyPatternInsertion ? templatePartClientIds : [] ]; traverseBlockTree(state, treeClientId, (block) => { const { clientId, name: blockName } = block; if (state.blockEditingModes.has(clientId)) { return; } if (hasDisabledBlocks) { let ancestorBlockEditingMode; let parent = state.blocks.parents.get(clientId); while (parent !== void 0) { if (state.blockEditingModes.has(parent)) { ancestorBlockEditingMode = state.blockEditingModes.get(parent); } if (ancestorBlockEditingMode) { break; } parent = state.blocks.parents.get(parent); } if (ancestorBlockEditingMode === "disabled") { derivedBlockEditingModes.set(clientId, "disabled"); return; } } if (isZoomedOut) { if (clientId === sectionRootClientId) { derivedBlockEditingModes.set(clientId, "contentOnly"); return; } if (!sectionClientIds?.length) { derivedBlockEditingModes.set(clientId, "disabled"); return; } if (sectionClientIds.includes(clientId)) { derivedBlockEditingModes.set(clientId, "contentOnly"); return; } derivedBlockEditingModes.set(clientId, "disabled"); return; } if (syncedPatternClientIds.length) { if (syncedPatternClientIds.includes(clientId)) { if (findParentInClientIdsList( state, clientId, syncedPatternClientIds )) { derivedBlockEditingModes.set(clientId, "disabled"); return; } return; } const parentPatternClientId = findParentInClientIdsList( state, clientId, syncedPatternClientIds ); if (parentPatternClientId) { if (findParentInClientIdsList( state, parentPatternClientId, syncedPatternClientIds )) { derivedBlockEditingModes.set(clientId, "disabled"); return; } if (hasBindings(block)) { derivedBlockEditingModes.set(clientId, "contentOnly"); return; } derivedBlockEditingModes.set(clientId, "disabled"); } } if (contentOnlyParents.length) { const hasContentOnlyParent = !!findParentInClientIdsList( state, clientId, contentOnlyParents ); if (hasContentOnlyParent) { if (isContentBlock(blockName)) { derivedBlockEditingModes.set(clientId, "contentOnly"); } else { derivedBlockEditingModes.set(clientId, "disabled"); } } } }); return derivedBlockEditingModes; } function getDerivedBlockEditingModesUpdates({ prevState, nextState, addedBlocks, removedClientIds }) { const prevDerivedBlockEditingModes = prevState.derivedBlockEditingModes; let nextDerivedBlockEditingModes; removedClientIds?.forEach((clientId) => { traverseBlockTree(prevState, clientId, (block) => { if (prevDerivedBlockEditingModes.has(block.clientId)) { if (!nextDerivedBlockEditingModes) { nextDerivedBlockEditingModes = new Map( prevDerivedBlockEditingModes ); } nextDerivedBlockEditingModes.delete(block.clientId); } }); }); addedBlocks?.forEach((addedBlock) => { const updates = getDerivedBlockEditingModesForTree( nextState, addedBlock.clientId ); if (updates.size) { if (!nextDerivedBlockEditingModes) { nextDerivedBlockEditingModes = new Map([ ...prevDerivedBlockEditingModes?.size ? prevDerivedBlockEditingModes : [], ...updates ]); } else { nextDerivedBlockEditingModes = new Map([ ...nextDerivedBlockEditingModes?.size ? nextDerivedBlockEditingModes : [], ...updates ]); } } }); return nextDerivedBlockEditingModes; } function withDerivedBlockEditingModes(reducer) { return (state, action) => { const nextState = reducer(state, action); if (action.type !== "SET_EDITOR_MODE" && nextState === state) { return state; } switch (action.type) { case "REMOVE_BLOCKS": { const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, removedClientIds: action.clientIds }); if (nextDerivedBlockEditingModes) { return { ...nextState, derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes }; } break; } case "RECEIVE_BLOCKS": case "INSERT_BLOCKS": { const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, addedBlocks: action.blocks }); if (nextDerivedBlockEditingModes) { return { ...nextState, derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes }; } break; } case "UPDATE_BLOCK_ATTRIBUTES": { const addedBlocks = []; const removedClientIds = []; for (const clientId of action?.clientIds) { const attributes = action.options?.uniqueByBlock ? action.attributes[clientId] : action.attributes; if (!attributes) { break; } if ( // patternName is switching from falsy to truthy, indicating // this block is becoming an unsynced pattern. attributes.metadata?.patternName && !state.blocks.attributes.get(clientId)?.metadata?.patternName ) { addedBlocks.push( nextState.blocks.tree.get(clientId) ); } else if ( // patternName is switching from truthy to falsy, this block is becoming // a regular block but was an unsynced pattern. // Check that `metadata` is part of the included attributes, as // `updateBlockAttributes` merges attributes, if it isn't present // the previous `metadata` would be retained. attributes.metadata && !attributes.metadata?.patternName && state.blocks.attributes.get(clientId)?.metadata?.patternName ) { removedClientIds.push(clientId); } } if (!addedBlocks?.length && !removedClientIds?.length) { break; } const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, addedBlocks, removedClientIds }); if (nextDerivedBlockEditingModes) { return { ...nextState, derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes }; } break; } case "UPDATE_BLOCK_LIST_SETTINGS": { const addedBlocks = []; const removedClientIds = []; const updates = typeof action.clientId === "string" ? { [action.clientId]: action.settings } : action.clientId; for (const clientId in updates) { const isNewContentOnlyBlock = state.blockListSettings[clientId]?.templateLock !== "contentOnly" && nextState.blockListSettings[clientId]?.templateLock === "contentOnly"; const wasContentOnlyBlock = state.blockListSettings[clientId]?.templateLock === "contentOnly" && nextState.blockListSettings[clientId]?.templateLock !== "contentOnly"; if (isNewContentOnlyBlock) { addedBlocks.push( nextState.blocks.tree.get(clientId) ); } else if (wasContentOnlyBlock) { removedClientIds.push(clientId); } } if (!addedBlocks.length && !removedClientIds.length) { break; } const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, addedBlocks, removedClientIds }); if (nextDerivedBlockEditingModes) { return { ...nextState, derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes }; } break; } case "SET_BLOCK_EDITING_MODE": case "UNSET_BLOCK_EDITING_MODE": case "SET_HAS_CONTROLLED_INNER_BLOCKS": { const updatedBlock = getBlockTreeBlock( nextState, action.clientId ); if (!updatedBlock) { break; } const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, removedClientIds: [action.clientId], addedBlocks: [updatedBlock] }); if (nextDerivedBlockEditingModes) { return { ...nextState, derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes }; } break; } case "REPLACE_BLOCKS": { const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, addedBlocks: action.blocks, removedClientIds: action.clientIds }); if (nextDerivedBlockEditingModes) { return { ...nextState, derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes }; } break; } case "REPLACE_INNER_BLOCKS": { const removedClientIds = state.blocks.order.get( action.rootClientId ); const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, addedBlocks: action.blocks, removedClientIds }); if (nextDerivedBlockEditingModes) { return { ...nextState, derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes }; } break; } case "MOVE_BLOCKS_TO_POSITION": { const addedBlocks = action.clientIds.map((clientId) => { return nextState.blocks.byClientId.get(clientId); }); const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ prevState: state, nextState, addedBlocks, removedClientIds: action.clientIds }); if (nextDerivedBlockEditingModes) { return { ...nextState, derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes }; } break; } case "UPDATE_SETTINGS": { if (state?.settings?.[sectionRootClientIdKey] !== nextState?.settings?.[sectionRootClientIdKey]) { return { ...nextState, derivedBlockEditingModes: getDerivedBlockEditingModesForTree(nextState) }; } break; } case "RESET_BLOCKS": case "SET_EDITOR_MODE": case "RESET_ZOOM_LEVEL": case "SET_ZOOM_LEVEL": { return { ...nextState, derivedBlockEditingModes: getDerivedBlockEditingModesForTree(nextState) }; } } nextState.derivedBlockEditingModes = state?.derivedBlockEditingModes ?? /* @__PURE__ */ new Map(); return nextState; }; } function withAutomaticChangeReset(reducer) { return (state, action) => { const nextState = reducer(state, action); if (!state) { return nextState; } nextState.automaticChangeStatus = state.automaticChangeStatus; if (action.type === "MARK_AUTOMATIC_CHANGE") { return { ...nextState, automaticChangeStatus: "pending" }; } if (action.type === "MARK_AUTOMATIC_CHANGE_FINAL" && state.automaticChangeStatus === "pending") { return { ...nextState, automaticChangeStatus: "final" }; } if (nextState.blocks === state.blocks && nextState.selection === state.selection) { return nextState; } if (nextState.automaticChangeStatus !== "final" && nextState.selection !== state.selection) { return nextState; } return { ...nextState, automaticChangeStatus: void 0 }; }; } var reducer_default = (0,external_wp_compose_namespaceObject.pipe)( withDerivedBlockEditingModes, withAutomaticChangeReset )(combinedReducers); ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js var symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); ;// external ["wp","richText"] const external_wp_richText_namespaceObject = window["wp"]["richText"]; ;// external ["wp","blockSerializationDefaultParser"] const external_wp_blockSerializationDefaultParser_namespaceObject = window["wp"]["blockSerializationDefaultParser"]; ;// ./node_modules/@wordpress/block-editor/build-module/store/constants.js const STORE_NAME = "core/block-editor"; ;// ./node_modules/@wordpress/block-editor/build-module/utils/object.js function setImmutably(object, path, value) { path = Array.isArray(path) ? [...path] : [path]; object = Array.isArray(object) ? [...object] : { ...object }; const leaf = path.pop(); let prev = object; for (const key of path) { const lvl = prev[key]; prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { ...lvl }; } prev[leaf] = value; return object; } const getValueFromObjectPath = (object, path, defaultValue) => { const arrayPath = Array.isArray(path) ? path : path.split("."); let value = object; arrayPath.forEach((fieldName) => { value = value?.[fieldName]; }); return value ?? defaultValue; }; function uniqByProperty(array, property) { const seen = /* @__PURE__ */ new Set(); return array.filter((item) => { const value = item[property]; return seen.has(value) ? false : seen.add(value); }); } ;// ./node_modules/@wordpress/block-editor/build-module/store/get-block-settings.js const blockedPaths = [ "color", "border", "dimensions", "typography", "spacing" ]; const deprecatedFlags = { "color.palette": (settings) => settings.colors, "color.gradients": (settings) => settings.gradients, "color.custom": (settings) => settings.disableCustomColors === void 0 ? void 0 : !settings.disableCustomColors, "color.customGradient": (settings) => settings.disableCustomGradients === void 0 ? void 0 : !settings.disableCustomGradients, "typography.fontSizes": (settings) => settings.fontSizes, "typography.customFontSize": (settings) => settings.disableCustomFontSizes === void 0 ? void 0 : !settings.disableCustomFontSizes, "typography.lineHeight": (settings) => settings.enableCustomLineHeight, "spacing.units": (settings) => { if (settings.enableCustomUnits === void 0) { return; } if (settings.enableCustomUnits === true) { return ["px", "em", "rem", "vh", "vw", "%"]; } return settings.enableCustomUnits; }, "spacing.padding": (settings) => settings.enableCustomSpacing }; const prefixedFlags = { /* * These were only available in the plugin * and can be removed when the minimum WordPress version * for the plugin is 5.9. */ "border.customColor": "border.color", "border.customStyle": "border.style", "border.customWidth": "border.width", "typography.customFontStyle": "typography.fontStyle", "typography.customFontWeight": "typography.fontWeight", "typography.customLetterSpacing": "typography.letterSpacing", "typography.customTextDecorations": "typography.textDecoration", "typography.customTextTransforms": "typography.textTransform", /* * These were part of WordPress 5.8 and we need to keep them. */ "border.customRadius": "border.radius", "spacing.customMargin": "spacing.margin", "spacing.customPadding": "spacing.padding", "typography.customLineHeight": "typography.lineHeight" }; const removeCustomPrefixes = (path) => { return prefixedFlags[path] || path; }; function getBlockSettings(state, clientId, ...paths) { const blockName = getBlockName(state, clientId); const candidates = []; if (clientId) { let id = clientId; do { const name = getBlockName(state, id); if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "__experimentalSettings", false)) { candidates.push(id); } } while (id = state.blocks.parents.get(id)); } return paths.map((path) => { if (blockedPaths.includes(path)) { console.warn( "Top level useSetting paths are disabled. Please use a subpath to query the information needed." ); return void 0; } let result = (0,external_wp_hooks_namespaceObject.applyFilters)( "blockEditor.useSetting.before", void 0, path, clientId, blockName ); if (void 0 !== result) { return result; } const normalizedPath = removeCustomPrefixes(path); for (const candidateClientId of candidates) { const candidateAtts = getBlockAttributes( state, candidateClientId ); result = getValueFromObjectPath( candidateAtts.settings?.blocks?.[blockName], normalizedPath ) ?? getValueFromObjectPath( candidateAtts.settings, normalizedPath ); if (result !== void 0) { break; } } const settings = getSettings(state); if (result === void 0 && blockName) { result = getValueFromObjectPath( settings.__experimentalFeatures?.blocks?.[blockName], normalizedPath ); } if (result === void 0) { result = getValueFromObjectPath( settings.__experimentalFeatures, normalizedPath ); } if (result !== void 0) { if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_OVERRIDE[normalizedPath]) { return result.custom ?? result.theme ?? result.default; } return result; } const deprecatedSettingsValue = deprecatedFlags[normalizedPath]?.(settings); if (deprecatedSettingsValue !== void 0) { return deprecatedSettingsValue; } return normalizedPath === "typography.dropCap" ? true : void 0; }); } ;// ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js const { isContentBlock: private_selectors_isContentBlock } = unlock(external_wp_blocks_namespaceObject.privateApis); function private_selectors_isBlockInterfaceHidden(state) { return state.isBlockInterfaceHidden; } function getLastInsertedBlocksClientIds(state) { return state?.lastBlockInserted?.clientIds; } function getBlockWithoutAttributes(state, clientId) { return state.blocks.byClientId.get(clientId); } const isBlockSubtreeDisabled = (state, clientId) => { const isChildSubtreeDisabled = (childClientId) => { return getBlockEditingMode(state, childClientId) === "disabled" && getBlockOrder(state, childClientId).every( isChildSubtreeDisabled ); }; return getBlockOrder(state, clientId).every(isChildSubtreeDisabled); }; function isContainerInsertableToInContentOnlyMode(state, blockName, rootClientId) { const isBlockContentBlock = private_selectors_isContentBlock(blockName); const rootBlockName = getBlockName(state, rootClientId); const isContainerContentBlock = private_selectors_isContentBlock(rootBlockName); const isRootBlockMain = getSectionRootClientId(state) === rootClientId; return isRootBlockMain || isContainerContentBlock && isBlockContentBlock; } function getEnabledClientIdsTreeUnmemoized(state, rootClientId) { const blockOrder = getBlockOrder(state, rootClientId); const result = []; for (const clientId of blockOrder) { const innerBlocks = getEnabledClientIdsTreeUnmemoized( state, clientId ); if (getBlockEditingMode(state, clientId) !== "disabled") { result.push({ clientId, innerBlocks }); } else { result.push(...innerBlocks); } } return result; } const getEnabledClientIdsTree = (0,external_wp_data_namespaceObject.createRegistrySelector)( () => (0,external_wp_data_namespaceObject.createSelector)(getEnabledClientIdsTreeUnmemoized, (state) => [ state.blocks.order, state.derivedBlockEditingModes, state.blockEditingModes ]) ); const getEnabledBlockParents = (0,external_wp_data_namespaceObject.createSelector)( (state, clientId, ascending = false) => { return getBlockParents(state, clientId, ascending).filter( (parent) => getBlockEditingMode(state, parent) !== "disabled" ); }, (state) => [ state.blocks.parents, state.blockEditingModes, state.settings.templateLock, state.blockListSettings ] ); function getRemovalPromptData(state) { return state.removalPromptData; } function getBlockRemovalRules(state) { return state.blockRemovalRules; } function getOpenedBlockSettingsMenu(state) { return state.openedBlockSettingsMenu; } const getStyleOverrides = (0,external_wp_data_namespaceObject.createSelector)( (state) => { const clientIds = getClientIdsWithDescendants(state); const clientIdMap = clientIds.reduce((acc, clientId, index) => { acc[clientId] = index; return acc; }, {}); return [...state.styleOverrides].sort((overrideA, overrideB) => { const [, { clientId: clientIdA }] = overrideA; const [, { clientId: clientIdB }] = overrideB; const aIndex = clientIdMap[clientIdA] ?? -1; const bIndex = clientIdMap[clientIdB] ?? -1; return aIndex - bIndex; }); }, (state) => [state.blocks.order, state.styleOverrides] ); function getRegisteredInserterMediaCategories(state) { return state.registeredInserterMediaCategories; } const getInserterMediaCategories = (0,external_wp_data_namespaceObject.createSelector)( (state) => { const { settings: { inserterMediaCategories, allowedMimeTypes, enableOpenverseMediaCategory }, registeredInserterMediaCategories } = state; if (!inserterMediaCategories && !registeredInserterMediaCategories.length || !allowedMimeTypes) { return; } const coreInserterMediaCategoriesNames = inserterMediaCategories?.map(({ name }) => name) || []; const mergedCategories = [ ...inserterMediaCategories || [], ...(registeredInserterMediaCategories || []).filter( ({ name }) => !coreInserterMediaCategoriesNames.includes(name) ) ]; return mergedCategories.filter((category) => { if (!enableOpenverseMediaCategory && category.name === "openverse") { return false; } return Object.values(allowedMimeTypes).some( (mimeType) => mimeType.startsWith(`${category.mediaType}/`) ); }); }, (state) => [ state.settings.inserterMediaCategories, state.settings.allowedMimeTypes, state.settings.enableOpenverseMediaCategory, state.registeredInserterMediaCategories ] ); const hasAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)( (state, rootClientId = null) => { const { getAllPatterns: getAllPatterns2 } = unlock(select(STORE_NAME)); const patterns = getAllPatterns2(); const { allowedBlockTypes } = getSettings(state); return patterns.some((pattern) => { const { inserter = true } = pattern; if (!inserter) { return false; } const grammar = getGrammar(pattern); return checkAllowListRecursive(grammar, allowedBlockTypes) && grammar.every( ({ name: blockName }) => canInsertBlockType(state, blockName, rootClientId) ); }); }, (state, rootClientId) => [ ...getAllPatternsDependants(select)(state), ...getInsertBlockTypeDependants(select)(state, rootClientId) ] ) ); const getPatternBySlug = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)( (state, patternName) => { if (patternName?.startsWith("core/block/")) { const _id = parseInt( patternName.slice("core/block/".length), 10 ); const block = unlock(select(STORE_NAME)).getReusableBlocks().find(({ id }) => id === _id); if (!block) { return null; } return mapUserPattern( block, state.settings.__experimentalUserPatternCategories ); } return [ // This setting is left for back compat. ...state.settings.__experimentalBlockPatterns ?? [], ...state.settings[selectBlockPatternsKey]?.(select) ?? [] ].find(({ name }) => name === patternName); }, (state, patternName) => patternName?.startsWith("core/block/") ? [ unlock(select(STORE_NAME)).getReusableBlocks(), state.settings.__experimentalReusableBlocks ] : [ state.settings.__experimentalBlockPatterns, state.settings[selectBlockPatternsKey]?.(select) ] ) ); const getAllPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)((state) => { return [ ...unlock(select(STORE_NAME)).getReusableBlocks().map( (userPattern) => mapUserPattern( userPattern, state.settings.__experimentalUserPatternCategories ) ), // This setting is left for back compat. ...state.settings.__experimentalBlockPatterns ?? [], ...state.settings[selectBlockPatternsKey]?.(select) ?? [] ].filter( (x, index, arr) => index === arr.findIndex((y) => x.name === y.name) ); }, getAllPatternsDependants(select)) ); const EMPTY_ARRAY = []; const getReusableBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state) => { const reusableBlocksSelect = state.settings[reusableBlocksSelectKey]; return (reusableBlocksSelect ? reusableBlocksSelect(select) : state.settings.__experimentalReusableBlocks) ?? EMPTY_ARRAY; } ); function getLastFocus(state) { return state.lastFocus; } function private_selectors_isDragging(state) { return state.isDragging; } function getExpandedBlock(state) { return state.expandedBlock; } const getContentLockingParent = (state, clientId) => { let current = clientId; let result; while (!result && (current = state.blocks.parents.get(current))) { if (getTemplateLock(state, current) === "contentOnly") { result = current; } } return result; }; const getParentSectionBlock = (state, clientId) => { let current = clientId; let result; while (!result && (current = state.blocks.parents.get(current))) { if (isSectionBlock(state, current)) { result = current; } } return result; }; function isSectionBlock(state, clientId) { const blockName = getBlockName(state, clientId); if (blockName === "core/block" || getTemplateLock(state, clientId) === "contentOnly") { return true; } const attributes = getBlockAttributes(state, clientId); const isTemplatePart = blockName === "core/template-part"; if ((attributes?.metadata?.patternName || isTemplatePart) && !!window?.__experimentalContentOnlyPatternInsertion) { return true; } return false; } function getTemporarilyEditingAsBlocks(state) { return state.temporarilyEditingAsBlocks; } function getTemporarilyEditingFocusModeToRevert(state) { return state.temporarilyEditingFocusModeRevert; } const getBlockStyles = (0,external_wp_data_namespaceObject.createSelector)( (state, clientIds) => clientIds.reduce((styles, clientId) => { styles[clientId] = state.blocks.attributes.get(clientId)?.style; return styles; }, {}), (state, clientIds) => [ ...clientIds.map( (clientId) => state.blocks.attributes.get(clientId)?.style ) ] ); function getSectionRootClientId(state) { return state.settings?.[sectionRootClientIdKey]; } function isZoomOut(state) { return state.zoomLevel === "auto-scaled" || state.zoomLevel < 100; } function getZoomLevel(state) { return state.zoomLevel; } function getClosestAllowedInsertionPoint(state, name, clientId = "") { const blockNames = Array.isArray(name) ? name : [name]; const areBlockNamesAllowedInClientId = (id) => blockNames.every( (currentName) => canInsertBlockType(state, currentName, id) ); if (!clientId) { if (areBlockNamesAllowedInClientId(clientId)) { return clientId; } const sectionRootClientId = getSectionRootClientId(state); if (sectionRootClientId && areBlockNamesAllowedInClientId(sectionRootClientId)) { return sectionRootClientId; } return null; } let current = clientId; while (current !== null && !areBlockNamesAllowedInClientId(current)) { const parentClientId = getBlockRootClientId(state, current); current = parentClientId; } return current; } function getClosestAllowedInsertionPointForPattern(state, pattern, clientId) { const { allowedBlockTypes } = getSettings(state); const isAllowed = checkAllowListRecursive( getGrammar(pattern), allowedBlockTypes ); if (!isAllowed) { return null; } const names = getGrammar(pattern).map(({ blockName: name }) => name); return getClosestAllowedInsertionPoint(state, names, clientId); } function getInsertionPoint(state) { return state.insertionPoint; } const isBlockHidden = (state, clientId) => { const blockName = getBlockName(state, clientId); if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(state, blockName, "visibility", true)) { return false; } const attributes = state.blocks.attributes.get(clientId); return attributes?.metadata?.blockVisibility === false; }; function private_selectors_hasBlockSpotlight(state) { return !!state.hasBlockSpotlight; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/utils.js const INSERTER_PATTERN_TYPES = { user: "user", theme: "theme", directory: "directory" }; const INSERTER_SYNC_TYPES = { full: "fully", unsynced: "unsynced" }; const allPatternsCategory = { name: "allPatterns", label: (0,external_wp_i18n_namespaceObject._x)("All", "patterns") }; const myPatternsCategory = { name: "myPatterns", label: (0,external_wp_i18n_namespaceObject.__)("My patterns") }; const starterPatternsCategory = { name: "core/starter-content", label: (0,external_wp_i18n_namespaceObject.__)("Starter content") }; function isPatternFiltered(pattern, sourceFilter, syncFilter) { const isUserPattern = pattern.name.startsWith("core/block"); const isDirectoryPattern = pattern.source === "core" || pattern.source?.startsWith("pattern-directory"); if (sourceFilter === INSERTER_PATTERN_TYPES.theme && (isUserPattern || isDirectoryPattern)) { return true; } if (sourceFilter === INSERTER_PATTERN_TYPES.directory && (isUserPattern || !isDirectoryPattern)) { return true; } if (sourceFilter === INSERTER_PATTERN_TYPES.user && pattern.type !== INSERTER_PATTERN_TYPES.user) { return true; } if (syncFilter === INSERTER_SYNC_TYPES.full && pattern.syncStatus !== "") { return true; } if (syncFilter === INSERTER_SYNC_TYPES.unsynced && pattern.syncStatus !== "unsynced" && isUserPattern) { return true; } return false; } ;// ./node_modules/@wordpress/block-editor/build-module/store/utils.js const isFiltered = Symbol("isFiltered"); const parsedPatternCache = /* @__PURE__ */ new WeakMap(); const grammarMapCache = /* @__PURE__ */ new WeakMap(); function mapUserPattern(userPattern, __experimentalUserPatternCategories = []) { return { name: `core/block/${userPattern.id}`, id: userPattern.id, type: INSERTER_PATTERN_TYPES.user, title: userPattern.title?.raw, categories: userPattern.wp_pattern_category?.map((catId) => { const category = __experimentalUserPatternCategories.find( ({ id }) => id === catId ); return category ? category.slug : catId; }), content: userPattern.content?.raw, syncStatus: userPattern.wp_pattern_sync_status }; } function parsePattern(pattern) { const blocks = (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { __unstableSkipMigrationLogs: true }); if (blocks.length === 1) { blocks[0].attributes = { ...blocks[0].attributes, metadata: { ...blocks[0].attributes.metadata || {}, categories: pattern.categories, patternName: pattern.name, name: blocks[0].attributes.metadata?.name || pattern.title } }; } return { ...pattern, blocks }; } function getParsedPattern(pattern) { let parsedPattern = parsedPatternCache.get(pattern); if (!parsedPattern) { parsedPattern = parsePattern(pattern); parsedPatternCache.set(pattern, parsedPattern); } return parsedPattern; } function getGrammar(pattern) { let grammarMap = grammarMapCache.get(pattern); if (!grammarMap) { grammarMap = (0,external_wp_blockSerializationDefaultParser_namespaceObject.parse)(pattern.content); grammarMap = grammarMap.filter((block) => block.blockName !== null); grammarMapCache.set(pattern, grammarMap); } return grammarMap; } const checkAllowList = (list, item, defaultResult = null) => { if (typeof list === "boolean") { return list; } if (Array.isArray(list)) { if (list.includes("core/post-content") && item === null) { return true; } return list.includes(item); } return defaultResult; }; const checkAllowListRecursive = (blocks, allowedBlockTypes) => { if (typeof allowedBlockTypes === "boolean") { return allowedBlockTypes; } const blocksQueue = [...blocks]; while (blocksQueue.length > 0) { const block = blocksQueue.shift(); const isAllowed = checkAllowList( allowedBlockTypes, block.name || block.blockName, true ); if (!isAllowed) { return false; } block.innerBlocks?.forEach((innerBlock) => { blocksQueue.push(innerBlock); }); } return true; }; const getAllPatternsDependants = (select) => (state) => { return [ state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings[selectBlockPatternsKey]?.(select), state.blockPatterns, unlock(select(STORE_NAME)).getReusableBlocks() ]; }; const getInsertBlockTypeDependants = () => (state, rootClientId) => { return [ state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), state.settings.allowedBlockTypes, state.settings.templateLock, getBlockEditingMode(state, rootClientId), getSectionRootClientId(state), isSectionBlock(state, rootClientId) ]; }; ;// ./node_modules/@wordpress/block-editor/build-module/utils/sorting.js const comparator = (field, items, order) => { return (a, b) => { let cmpA, cmpB; if (typeof field === "function") { cmpA = field(a); cmpB = field(b); } else { cmpA = a[field]; cmpB = b[field]; } if (cmpA > cmpB) { return order === "asc" ? 1 : -1; } else if (cmpB > cmpA) { return order === "asc" ? -1 : 1; } const orderA = items.findIndex((item) => item === a); const orderB = items.findIndex((item) => item === b); if (orderA > orderB) { return 1; } else if (orderB > orderA) { return -1; } return 0; }; }; function orderBy(items, field, order = "asc") { return items.concat().sort(comparator(field, items, order)); } ;// ./node_modules/@wordpress/block-editor/build-module/store/selectors.js const { isContentBlock: selectors_isContentBlock } = unlock(external_wp_blocks_namespaceObject.privateApis); const MILLISECONDS_PER_HOUR = 3600 * 1e3; const MILLISECONDS_PER_DAY = 24 * 3600 * 1e3; const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1e3; const selectors_EMPTY_ARRAY = []; const EMPTY_SET = /* @__PURE__ */ new Set(); const DEFAULT_INSERTER_OPTIONS = { [isFiltered]: true }; function getBlockName(state, clientId) { const block = state.blocks.byClientId.get(clientId); const socialLinkName = "core/social-link"; if (external_wp_element_namespaceObject.Platform.OS !== "web" && block?.name === socialLinkName) { const attributes = state.blocks.attributes.get(clientId); const { service } = attributes ?? {}; return service ? `${socialLinkName}-${service}` : socialLinkName; } return block ? block.name : null; } function isBlockValid(state, clientId) { const block = state.blocks.byClientId.get(clientId); return !!block && block.isValid; } function getBlockAttributes(state, clientId) { const block = state.blocks.byClientId.get(clientId); if (!block) { return null; } return state.blocks.attributes.get(clientId); } function getBlock(state, clientId) { if (!state.blocks.byClientId.has(clientId)) { return null; } return state.blocks.tree.get(clientId); } const __unstableGetBlockWithoutInnerBlocks = (0,external_wp_data_namespaceObject.createSelector)( (state, clientId) => { const block = state.blocks.byClientId.get(clientId); if (!block) { return null; } return { ...block, attributes: getBlockAttributes(state, clientId) }; }, (state, clientId) => [ state.blocks.byClientId.get(clientId), state.blocks.attributes.get(clientId) ] ); function getBlocks(state, rootClientId) { const treeKey = !rootClientId || !areInnerBlocksControlled(state, rootClientId) ? rootClientId || "" : "controlled||" + rootClientId; return state.blocks.tree.get(treeKey)?.innerBlocks || selectors_EMPTY_ARRAY; } const __unstableGetClientIdWithClientIdsTree = (0,external_wp_data_namespaceObject.createSelector)( (state, clientId) => { external_wp_deprecated_default()( "wp.data.select( 'core/block-editor' ).__unstableGetClientIdWithClientIdsTree", { since: "6.3", version: "6.5" } ); return { clientId, innerBlocks: __unstableGetClientIdsTree(state, clientId) }; }, (state) => [state.blocks.order] ); const __unstableGetClientIdsTree = (0,external_wp_data_namespaceObject.createSelector)( (state, rootClientId = "") => { external_wp_deprecated_default()( "wp.data.select( 'core/block-editor' ).__unstableGetClientIdsTree", { since: "6.3", version: "6.5" } ); return getBlockOrder(state, rootClientId).map( (clientId) => __unstableGetClientIdWithClientIdsTree(state, clientId) ); }, (state) => [state.blocks.order] ); const getClientIdsOfDescendants = (0,external_wp_data_namespaceObject.createSelector)( (state, rootIds) => { rootIds = Array.isArray(rootIds) ? [...rootIds] : [rootIds]; const ids = []; for (const rootId of rootIds) { const order = state.blocks.order.get(rootId); if (order) { ids.push(...order); } } let index = 0; while (index < ids.length) { const id = ids[index]; const order = state.blocks.order.get(id); if (order) { ids.splice(index + 1, 0, ...order); } index++; } return ids; }, (state) => [state.blocks.order] ); const getClientIdsWithDescendants = (state) => getClientIdsOfDescendants(state, ""); const getGlobalBlockCount = (0,external_wp_data_namespaceObject.createSelector)( (state, blockName) => { const clientIds = getClientIdsWithDescendants(state); if (!blockName) { return clientIds.length; } let count = 0; for (const clientId of clientIds) { const block = state.blocks.byClientId.get(clientId); if (block.name === blockName) { count++; } } return count; }, (state) => [state.blocks.order, state.blocks.byClientId] ); const getBlocksByName = (0,external_wp_data_namespaceObject.createSelector)( (state, blockName) => { if (!blockName) { return selectors_EMPTY_ARRAY; } const blockNames = Array.isArray(blockName) ? blockName : [blockName]; const clientIds = getClientIdsWithDescendants(state); const foundBlocks = clientIds.filter((clientId) => { const block = state.blocks.byClientId.get(clientId); return blockNames.includes(block.name); }); return foundBlocks.length > 0 ? foundBlocks : selectors_EMPTY_ARRAY; }, (state) => [state.blocks.order, state.blocks.byClientId] ); function __experimentalGetGlobalBlocksByName(state, blockName) { external_wp_deprecated_default()( "wp.data.select( 'core/block-editor' ).__experimentalGetGlobalBlocksByName", { since: "6.5", alternative: `wp.data.select( 'core/block-editor' ).getBlocksByName` } ); return getBlocksByName(state, blockName); } const getBlocksByClientId = (0,external_wp_data_namespaceObject.createSelector)( (state, clientIds) => (Array.isArray(clientIds) ? clientIds : [clientIds]).map( (clientId) => getBlock(state, clientId) ), (state, clientIds) => (Array.isArray(clientIds) ? clientIds : [clientIds]).map( (clientId) => state.blocks.tree.get(clientId) ) ); const getBlockNamesByClientId = (0,external_wp_data_namespaceObject.createSelector)( (state, clientIds) => getBlocksByClientId(state, clientIds).filter(Boolean).map((block) => block.name), (state, clientIds) => getBlocksByClientId(state, clientIds) ); function getBlockCount(state, rootClientId) { return getBlockOrder(state, rootClientId).length; } function getSelectionStart(state) { return state.selection.selectionStart; } function getSelectionEnd(state) { return state.selection.selectionEnd; } function getBlockSelectionStart(state) { return state.selection.selectionStart.clientId; } function getBlockSelectionEnd(state) { return state.selection.selectionEnd.clientId; } function getSelectedBlockCount(state) { const multiSelectedBlockCount = getMultiSelectedBlockClientIds(state).length; if (multiSelectedBlockCount) { return multiSelectedBlockCount; } return state.selection.selectionStart.clientId ? 1 : 0; } function hasSelectedBlock(state) { const { selectionStart, selectionEnd } = state.selection; return !!selectionStart.clientId && selectionStart.clientId === selectionEnd.clientId; } function getSelectedBlockClientId(state) { const { selectionStart, selectionEnd } = state.selection; const { clientId } = selectionStart; if (!clientId || clientId !== selectionEnd.clientId) { return null; } return clientId; } function getSelectedBlock(state) { const clientId = getSelectedBlockClientId(state); return clientId ? getBlock(state, clientId) : null; } function getBlockRootClientId(state, clientId) { return state.blocks.parents.get(clientId) ?? null; } const getBlockParents = (0,external_wp_data_namespaceObject.createSelector)( (state, clientId, ascending = false) => { const parents = []; let current = clientId; while (current = state.blocks.parents.get(current)) { parents.push(current); } if (!parents.length) { return selectors_EMPTY_ARRAY; } return ascending ? parents : parents.reverse(); }, (state) => [state.blocks.parents] ); const getBlockParentsByBlockName = (0,external_wp_data_namespaceObject.createSelector)( (state, clientId, blockName, ascending = false) => { const parents = getBlockParents(state, clientId, ascending); const hasName = Array.isArray(blockName) ? (name) => blockName.includes(name) : (name) => blockName === name; return parents.filter((id) => hasName(getBlockName(state, id))); }, (state) => [state.blocks.parents] ); function getBlockHierarchyRootClientId(state, clientId) { let current = clientId; let parent; do { parent = current; current = state.blocks.parents.get(current); } while (current); return parent; } function getLowestCommonAncestorWithSelectedBlock(state, clientId) { const selectedId = getSelectedBlockClientId(state); const clientParents = [...getBlockParents(state, clientId), clientId]; const selectedParents = [ ...getBlockParents(state, selectedId), selectedId ]; let lowestCommonAncestor; const maxDepth = Math.min(clientParents.length, selectedParents.length); for (let index = 0; index < maxDepth; index++) { if (clientParents[index] === selectedParents[index]) { lowestCommonAncestor = clientParents[index]; } else { break; } } return lowestCommonAncestor; } function getAdjacentBlockClientId(state, startClientId, modifier = 1) { if (startClientId === void 0) { startClientId = getSelectedBlockClientId(state); } if (startClientId === void 0) { if (modifier < 0) { startClientId = getFirstMultiSelectedBlockClientId(state); } else { startClientId = getLastMultiSelectedBlockClientId(state); } } if (!startClientId) { return null; } const rootClientId = getBlockRootClientId(state, startClientId); if (rootClientId === null) { return null; } const { order } = state.blocks; const orderSet = order.get(rootClientId); const index = orderSet.indexOf(startClientId); const nextIndex = index + 1 * modifier; if (nextIndex < 0) { return null; } if (nextIndex === orderSet.length) { return null; } return orderSet[nextIndex]; } function getPreviousBlockClientId(state, startClientId) { return getAdjacentBlockClientId(state, startClientId, -1); } function getNextBlockClientId(state, startClientId) { return getAdjacentBlockClientId(state, startClientId, 1); } function getSelectedBlocksInitialCaretPosition(state) { return state.initialPosition; } const getSelectedBlockClientIds = (0,external_wp_data_namespaceObject.createSelector)( (state) => { const { selectionStart, selectionEnd } = state.selection; if (!selectionStart.clientId || !selectionEnd.clientId) { return selectors_EMPTY_ARRAY; } if (selectionStart.clientId === selectionEnd.clientId) { return [selectionStart.clientId]; } const rootClientId = getBlockRootClientId( state, selectionStart.clientId ); if (rootClientId === null) { return selectors_EMPTY_ARRAY; } const blockOrder = getBlockOrder(state, rootClientId); const startIndex = blockOrder.indexOf(selectionStart.clientId); const endIndex = blockOrder.indexOf(selectionEnd.clientId); if (startIndex > endIndex) { return blockOrder.slice(endIndex, startIndex + 1); } return blockOrder.slice(startIndex, endIndex + 1); }, (state) => [ state.blocks.order, state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId ] ); function getMultiSelectedBlockClientIds(state) { const { selectionStart, selectionEnd } = state.selection; if (selectionStart.clientId === selectionEnd.clientId) { return selectors_EMPTY_ARRAY; } return getSelectedBlockClientIds(state); } const getMultiSelectedBlocks = (0,external_wp_data_namespaceObject.createSelector)( (state) => { const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state); if (!multiSelectedBlockClientIds.length) { return selectors_EMPTY_ARRAY; } return multiSelectedBlockClientIds.map( (clientId) => getBlock(state, clientId) ); }, (state) => [ ...getSelectedBlockClientIds.getDependants(state), state.blocks.byClientId, state.blocks.order, state.blocks.attributes ] ); function getFirstMultiSelectedBlockClientId(state) { return getMultiSelectedBlockClientIds(state)[0] || null; } function getLastMultiSelectedBlockClientId(state) { const selectedClientIds = getMultiSelectedBlockClientIds(state); return selectedClientIds[selectedClientIds.length - 1] || null; } function isFirstMultiSelectedBlock(state, clientId) { return getFirstMultiSelectedBlockClientId(state) === clientId; } function isBlockMultiSelected(state, clientId) { return getMultiSelectedBlockClientIds(state).indexOf(clientId) !== -1; } const isAncestorMultiSelected = (0,external_wp_data_namespaceObject.createSelector)( (state, clientId) => { let ancestorClientId = clientId; let isMultiSelected = false; while (ancestorClientId && !isMultiSelected) { ancestorClientId = getBlockRootClientId(state, ancestorClientId); isMultiSelected = isBlockMultiSelected(state, ancestorClientId); } return isMultiSelected; }, (state) => [ state.blocks.order, state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId ] ); function getMultiSelectedBlocksStartClientId(state) { const { selectionStart, selectionEnd } = state.selection; if (selectionStart.clientId === selectionEnd.clientId) { return null; } return selectionStart.clientId || null; } function getMultiSelectedBlocksEndClientId(state) { const { selectionStart, selectionEnd } = state.selection; if (selectionStart.clientId === selectionEnd.clientId) { return null; } return selectionEnd.clientId || null; } function __unstableIsFullySelected(state) { const selectionAnchor = getSelectionStart(state); const selectionFocus = getSelectionEnd(state); return !selectionAnchor.attributeKey && !selectionFocus.attributeKey && typeof selectionAnchor.offset === "undefined" && typeof selectionFocus.offset === "undefined"; } function __unstableIsSelectionCollapsed(state) { const selectionAnchor = getSelectionStart(state); const selectionFocus = getSelectionEnd(state); return !!selectionAnchor && !!selectionFocus && selectionAnchor.clientId === selectionFocus.clientId && selectionAnchor.attributeKey === selectionFocus.attributeKey && selectionAnchor.offset === selectionFocus.offset; } function __unstableSelectionHasUnmergeableBlock(state) { return getSelectedBlockClientIds(state).some((clientId) => { const blockName = getBlockName(state, clientId); const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); return !blockType.merge; }); } function __unstableIsSelectionMergeable(state, isForward) { const selectionAnchor = getSelectionStart(state); const selectionFocus = getSelectionEnd(state); if (selectionAnchor.clientId === selectionFocus.clientId) { return false; } if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === "undefined" || typeof selectionFocus.offset === "undefined") { return false; } const anchorRootClientId = getBlockRootClientId( state, selectionAnchor.clientId ); const focusRootClientId = getBlockRootClientId( state, selectionFocus.clientId ); if (anchorRootClientId !== focusRootClientId) { return false; } const blockOrder = getBlockOrder(state, anchorRootClientId); const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); const focusIndex = blockOrder.indexOf(selectionFocus.clientId); let selectionStart, selectionEnd; if (anchorIndex > focusIndex) { selectionStart = selectionFocus; selectionEnd = selectionAnchor; } else { selectionStart = selectionAnchor; selectionEnd = selectionFocus; } const targetBlockClientId = isForward ? selectionEnd.clientId : selectionStart.clientId; const blockToMergeClientId = isForward ? selectionStart.clientId : selectionEnd.clientId; const targetBlockName = getBlockName(state, targetBlockClientId); const targetBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlockName); if (!targetBlockType.merge) { return false; } const blockToMerge = getBlock(state, blockToMergeClientId); if (blockToMerge.name === targetBlockName) { return true; } const blocksToMerge = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blockToMerge, targetBlockName); return blocksToMerge && blocksToMerge.length; } const __unstableGetSelectedBlocksWithPartialSelection = (state) => { const selectionAnchor = getSelectionStart(state); const selectionFocus = getSelectionEnd(state); if (selectionAnchor.clientId === selectionFocus.clientId) { return selectors_EMPTY_ARRAY; } if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === "undefined" || typeof selectionFocus.offset === "undefined") { return selectors_EMPTY_ARRAY; } const anchorRootClientId = getBlockRootClientId( state, selectionAnchor.clientId ); const focusRootClientId = getBlockRootClientId( state, selectionFocus.clientId ); if (anchorRootClientId !== focusRootClientId) { return selectors_EMPTY_ARRAY; } const blockOrder = getBlockOrder(state, anchorRootClientId); const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); const focusIndex = blockOrder.indexOf(selectionFocus.clientId); const [selectionStart, selectionEnd] = anchorIndex > focusIndex ? [selectionFocus, selectionAnchor] : [selectionAnchor, selectionFocus]; const blockA = getBlock(state, selectionStart.clientId); const blockB = getBlock(state, selectionEnd.clientId); const htmlA = blockA.attributes[selectionStart.attributeKey]; const htmlB = blockB.attributes[selectionEnd.attributeKey]; let valueA = (0,external_wp_richText_namespaceObject.create)({ html: htmlA }); let valueB = (0,external_wp_richText_namespaceObject.create)({ html: htmlB }); valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, 0, selectionStart.offset); valueB = (0,external_wp_richText_namespaceObject.remove)(valueB, selectionEnd.offset, valueB.text.length); return [ { ...blockA, attributes: { ...blockA.attributes, [selectionStart.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueA }) } }, { ...blockB, attributes: { ...blockB.attributes, [selectionEnd.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueB }) } } ]; }; function getBlockOrder(state, rootClientId) { return state.blocks.order.get(rootClientId || "") || selectors_EMPTY_ARRAY; } function getBlockIndex(state, clientId) { const rootClientId = getBlockRootClientId(state, clientId); return getBlockOrder(state, rootClientId).indexOf(clientId); } function isBlockSelected(state, clientId) { const { selectionStart, selectionEnd } = state.selection; if (selectionStart.clientId !== selectionEnd.clientId) { return false; } return selectionStart.clientId === clientId; } function hasSelectedInnerBlock(state, clientId, deep = false) { const selectedBlockClientIds = getSelectedBlockClientIds(state); if (!selectedBlockClientIds.length) { return false; } if (deep) { return selectedBlockClientIds.some( (id) => ( // Pass true because we don't care about order and it's more // performant. getBlockParents(state, id, true).includes(clientId) ) ); } return selectedBlockClientIds.some( (id) => getBlockRootClientId(state, id) === clientId ); } function hasDraggedInnerBlock(state, clientId, deep = false) { return getBlockOrder(state, clientId).some( (innerClientId) => isBlockBeingDragged(state, innerClientId) || deep && hasDraggedInnerBlock(state, innerClientId, deep) ); } function isBlockWithinSelection(state, clientId) { if (!clientId) { return false; } const clientIds = getMultiSelectedBlockClientIds(state); const index = clientIds.indexOf(clientId); return index > -1 && index < clientIds.length - 1; } function hasMultiSelection(state) { const { selectionStart, selectionEnd } = state.selection; return selectionStart.clientId !== selectionEnd.clientId; } function selectors_isMultiSelecting(state) { return state.isMultiSelecting; } function selectors_isSelectionEnabled(state) { return state.isSelectionEnabled; } function getBlockMode(state, clientId) { return state.blocksMode[clientId] || "visual"; } function selectors_isTyping(state) { return state.isTyping; } function isDraggingBlocks(state) { return !!state.draggedBlocks.length; } function getDraggedBlockClientIds(state) { return state.draggedBlocks; } function isBlockBeingDragged(state, clientId) { return state.draggedBlocks.includes(clientId); } function isAncestorBeingDragged(state, clientId) { if (!isDraggingBlocks(state)) { return false; } const parents = getBlockParents(state, clientId); return parents.some( (parentClientId) => isBlockBeingDragged(state, parentClientId) ); } function isCaretWithinFormattedText() { external_wp_deprecated_default()( 'wp.data.select( "core/block-editor" ).isCaretWithinFormattedText', { since: "6.1", version: "6.3" } ); return false; } const getBlockInsertionPoint = (0,external_wp_data_namespaceObject.createSelector)( (state) => { let rootClientId, index; const { insertionCue, selection: { selectionEnd } } = state; if (insertionCue !== null) { return insertionCue; } const { clientId } = selectionEnd; if (clientId) { rootClientId = getBlockRootClientId(state, clientId) || void 0; index = getBlockIndex(state, selectionEnd.clientId) + 1; } else { index = getBlockOrder(state).length; } return { rootClientId, index }; }, (state) => [ state.insertionCue, state.selection.selectionEnd.clientId, state.blocks.parents, state.blocks.order ] ); function isBlockInsertionPointVisible(state) { return state.insertionCue !== null; } function isValidTemplate(state) { return state.template.isValid; } function getTemplate(state) { return state.settings.template; } function getTemplateLock(state, rootClientId) { if (!rootClientId) { return state.settings.templateLock ?? false; } return getBlockListSettings(state, rootClientId)?.templateLock ?? false; } const isBlockVisibleInTheInserter = (state, blockNameOrType, rootClientId = null) => { let blockType; let blockName; if (blockNameOrType && "object" === typeof blockNameOrType) { blockType = blockNameOrType; blockName = blockNameOrType.name; } else { blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockNameOrType); blockName = blockNameOrType; } if (!blockType) { return false; } const { allowedBlockTypes } = getSettings(state); const isBlockAllowedInEditor = checkAllowList( allowedBlockTypes, blockName, true ); if (!isBlockAllowedInEditor) { return false; } const parents = (Array.isArray(blockType.parent) ? blockType.parent : []).concat(Array.isArray(blockType.ancestor) ? blockType.ancestor : []); if (parents.length > 0) { if (parents.includes("core/post-content")) { return true; } let current = rootClientId; let hasParent = false; do { if (parents.includes(getBlockName(state, current))) { hasParent = true; break; } current = state.blocks.parents.get(current); } while (current); return hasParent; } return true; }; const canInsertBlockTypeUnmemoized = (state, blockName, rootClientId = null) => { if (!isBlockVisibleInTheInserter(state, blockName, rootClientId)) { return false; } let blockType; if (blockName && "object" === typeof blockName) { blockType = blockName; blockName = blockType.name; } else { blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); } if (getTemplateLock(state, rootClientId)) { return false; } const blockEditingMode = getBlockEditingMode(state, rootClientId ?? ""); if (blockEditingMode === "disabled") { return false; } const parentBlockListSettings = getBlockListSettings(state, rootClientId); if (rootClientId && parentBlockListSettings === void 0) { return false; } const isContentRoleBlock = selectors_isContentBlock(blockName); const isParentSectionBlock = !!isSectionBlock(state, rootClientId); const isBlockWithinSection = !!getParentSectionBlock( state, rootClientId ); if ((isParentSectionBlock || isBlockWithinSection) && !isContentRoleBlock) { return false; } if ((isParentSectionBlock || blockEditingMode === "contentOnly") && !isContainerInsertableToInContentOnlyMode( state, blockName, rootClientId )) { return false; } const parentName = getBlockName(state, rootClientId); const parentBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(parentName); const parentAllowedChildBlocks = parentBlockType?.allowedBlocks; let hasParentAllowedBlock = checkAllowList( parentAllowedChildBlocks, blockName ); if (hasParentAllowedBlock !== false) { const parentAllowedBlocks = parentBlockListSettings?.allowedBlocks; const hasParentListAllowedBlock = checkAllowList( parentAllowedBlocks, blockName ); if (hasParentListAllowedBlock !== null) { hasParentAllowedBlock = hasParentListAllowedBlock; } } const blockAllowedParentBlocks = blockType.parent; const hasBlockAllowedParent = checkAllowList( blockAllowedParentBlocks, parentName ); let hasBlockAllowedAncestor = true; const blockAllowedAncestorBlocks = blockType.ancestor; if (blockAllowedAncestorBlocks) { const ancestors = [ rootClientId, ...getBlockParents(state, rootClientId) ]; hasBlockAllowedAncestor = ancestors.some( (ancestorClientId) => checkAllowList( blockAllowedAncestorBlocks, getBlockName(state, ancestorClientId) ) ); } const canInsert = hasBlockAllowedAncestor && (hasParentAllowedBlock === null && hasBlockAllowedParent === null || hasParentAllowedBlock === true || hasBlockAllowedParent === true); if (!canInsert) { return canInsert; } return (0,external_wp_hooks_namespaceObject.applyFilters)( "blockEditor.__unstableCanInsertBlockType", canInsert, blockType, rootClientId, { // Pass bound selectors of the current registry. If we're in a nested // context, the data will differ from the one selected from the root // registry. getBlock: getBlock.bind(null, state), getBlockParentsByBlockName: getBlockParentsByBlockName.bind( null, state ) } ); }; const canInsertBlockType = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)( canInsertBlockTypeUnmemoized, (state, blockName, rootClientId) => getInsertBlockTypeDependants(select)(state, rootClientId) ) ); function canInsertBlocks(state, clientIds, rootClientId = null) { return clientIds.every( (id) => canInsertBlockType(state, getBlockName(state, id), rootClientId) ); } function canRemoveBlock(state, clientId) { const attributes = getBlockAttributes(state, clientId); if (attributes === null) { return true; } if (attributes.lock?.remove !== void 0) { return !attributes.lock.remove; } const rootClientId = getBlockRootClientId(state, clientId); if (getTemplateLock(state, rootClientId)) { return false; } const isBlockWithinSection = !!getParentSectionBlock(state, clientId); const isContentRoleBlock = selectors_isContentBlock( getBlockName(state, clientId) ); if (isBlockWithinSection && !isContentRoleBlock) { return false; } const isParentSectionBlock = !!isSectionBlock(state, rootClientId); const rootBlockEditingMode = getBlockEditingMode(state, rootClientId); if ((isParentSectionBlock || rootBlockEditingMode === "contentOnly") && !isContainerInsertableToInContentOnlyMode( state, getBlockName(state, clientId), rootClientId )) { return false; } return rootBlockEditingMode !== "disabled"; } function canRemoveBlocks(state, clientIds) { return clientIds.every((clientId) => canRemoveBlock(state, clientId)); } function canMoveBlock(state, clientId) { const attributes = getBlockAttributes(state, clientId); if (attributes === null) { return true; } if (attributes.lock?.move !== void 0) { return !attributes.lock.move; } const rootClientId = getBlockRootClientId(state, clientId); const templateLock = getTemplateLock(state, rootClientId); if (templateLock === "all" || templateLock === "contentOnly") { return false; } const isBlockWithinSection = !!getParentSectionBlock(state, clientId); const isContentRoleBlock = selectors_isContentBlock( getBlockName(state, clientId) ); if (isBlockWithinSection && !isContentRoleBlock) { return false; } const isParentSectionBlock = !!isSectionBlock(state, rootClientId); const rootBlockEditingMode = getBlockEditingMode(state, rootClientId); if ((isParentSectionBlock || rootBlockEditingMode === "contentOnly") && !isContainerInsertableToInContentOnlyMode( state, getBlockName(state, clientId), rootClientId )) { return false; } return getBlockEditingMode(state, rootClientId) !== "disabled"; } function canMoveBlocks(state, clientIds) { return clientIds.every((clientId) => canMoveBlock(state, clientId)); } function canEditBlock(state, clientId) { const attributes = getBlockAttributes(state, clientId); if (attributes === null) { return true; } const { lock } = attributes; return !lock?.edit; } function canLockBlockType(state, nameOrType) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, "lock", true)) { return false; } return !!state.settings?.canLockBlocks; } function getInsertUsage(state, id) { return state.preferences.insertUsage?.[id] ?? null; } const canIncludeBlockTypeInInserter = (state, blockType, rootClientId) => { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "inserter", true)) { return false; } return canInsertBlockTypeUnmemoized(state, blockType.name, rootClientId); }; const getItemFromVariation = (state, item) => (variation) => { const variationId = `${item.id}/${variation.name}`; const { time, count = 0 } = getInsertUsage(state, variationId) || {}; return { ...item, id: variationId, icon: variation.icon || item.icon, title: variation.title || item.title, description: variation.description || item.description, category: variation.category || item.category, // If `example` is explicitly undefined for the variation, the preview will not be shown. example: variation.hasOwnProperty("example") ? variation.example : item.example, initialAttributes: { ...item.initialAttributes, ...variation.attributes }, innerBlocks: variation.innerBlocks, keywords: variation.keywords || item.keywords, frecency: calculateFrecency(time, count) }; }; const calculateFrecency = (time, count) => { if (!time) { return count; } const duration = Date.now() - time; switch (true) { case duration < MILLISECONDS_PER_HOUR: return count * 4; case duration < MILLISECONDS_PER_DAY: return count * 2; case duration < MILLISECONDS_PER_WEEK: return count / 2; default: return count / 4; } }; const buildBlockTypeItem = (state, { buildScope = "inserter" }) => (blockType) => { const id = blockType.name; let isDisabled = false; if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType.name, "multiple", true)) { isDisabled = getBlocksByClientId( state, getClientIdsWithDescendants(state) ).some(({ name }) => name === blockType.name); } const { time, count = 0 } = getInsertUsage(state, id) || {}; const blockItemBase = { id, name: blockType.name, title: blockType.title, icon: blockType.icon, isDisabled, frecency: calculateFrecency(time, count) }; if (buildScope === "transform") { return blockItemBase; } const inserterVariations = (0,external_wp_blocks_namespaceObject.getBlockVariations)( blockType.name, "inserter" ); return { ...blockItemBase, initialAttributes: {}, description: blockType.description, category: blockType.category, keywords: blockType.keywords, parent: blockType.parent, ancestor: blockType.ancestor, variations: inserterVariations, example: blockType.example, utility: 1 // Deprecated. }; }; const getInserterItems = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)( (state, rootClientId = null, options = DEFAULT_INSERTER_OPTIONS) => { const buildReusableBlockInserterItem = (reusableBlock) => { const icon = !reusableBlock.wp_pattern_sync_status ? { src: symbol_default, foreground: "var(--wp-block-synced-color)" } : symbol_default; const userPattern = mapUserPattern(reusableBlock); const { time, count = 0 } = getInsertUsage(state, userPattern.name) || {}; const frecency = calculateFrecency(time, count); return { id: userPattern.name, name: "core/block", initialAttributes: { ref: reusableBlock.id }, title: userPattern.title, icon, category: "reusable", keywords: ["reusable"], isDisabled: false, utility: 1, // Deprecated. frecency, content: userPattern.content, get blocks() { return getParsedPattern(userPattern).blocks; }, syncStatus: userPattern.syncStatus }; }; const patternInserterItems = canInsertBlockTypeUnmemoized( state, "core/block", rootClientId ) ? unlock(select(STORE_NAME)).getReusableBlocks().map(buildReusableBlockInserterItem) : []; const buildBlockTypeInserterItem = buildBlockTypeItem(state, { buildScope: "inserter" }); let blockTypeInserterItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter( (blockType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "inserter", true) ).map(buildBlockTypeInserterItem); if (options[isFiltered] !== false) { blockTypeInserterItems = blockTypeInserterItems.filter( (blockType) => canIncludeBlockTypeInInserter( state, blockType, rootClientId ) ); } else { blockTypeInserterItems = blockTypeInserterItems.filter( (blockType) => isBlockVisibleInTheInserter( state, blockType, rootClientId ) ).map((blockType) => ({ ...blockType, isAllowedInCurrentRoot: canIncludeBlockTypeInInserter( state, blockType, rootClientId ) })); } const stretchVariations = []; const items = blockTypeInserterItems.reduce( (accumulator, item) => { const { variations = [] } = item; if (!variations.some(({ isDefault }) => isDefault)) { accumulator.push(item); } if (variations.length) { const variationMapper = getItemFromVariation( state, item ); variations.map(variationMapper).forEach((variation) => { if (variation.id === "core/paragraph/stretchy-paragraph" || variation.id === "core/heading/stretchy-heading") { stretchVariations.push(variation); } else { accumulator.push(variation); } }); } return accumulator; }, [] ); items.push(...stretchVariations); const groupByType = (blocks, block) => { const { core, noncore } = blocks; const type = block.name.startsWith("core/") ? core : noncore; type.push(block); return blocks; }; const { core: coreItems, noncore: nonCoreItems } = items.reduce( groupByType, { core: [], noncore: [] } ); const sortedBlockTypes = [...coreItems, ...nonCoreItems]; return [...sortedBlockTypes, ...patternInserterItems]; }, (state, rootClientId) => [ (0,external_wp_blocks_namespaceObject.getBlockTypes)(), unlock(select(STORE_NAME)).getReusableBlocks(), state.blocks.order, state.preferences.insertUsage, ...getInsertBlockTypeDependants(select)(state, rootClientId) ] ) ); const getBlockTransformItems = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)( (state, blocks, rootClientId = null) => { const normalizedBlocks = Array.isArray(blocks) ? blocks : [blocks]; const buildBlockTypeTransformItem = buildBlockTypeItem(state, { buildScope: "transform" }); const blockTypeTransformItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter( (blockType) => canIncludeBlockTypeInInserter( state, blockType, rootClientId ) ).map(buildBlockTypeTransformItem); const itemsByName = Object.fromEntries( Object.entries(blockTypeTransformItems).map( ([, value]) => [value.name, value] ) ); const possibleTransforms = (0,external_wp_blocks_namespaceObject.getPossibleBlockTransformations)( normalizedBlocks ).reduce((accumulator, block) => { if (itemsByName[block?.name]) { accumulator.push(itemsByName[block.name]); } return accumulator; }, []); return orderBy( possibleTransforms, (block) => itemsByName[block.name].frecency, "desc" ); }, (state, blocks, rootClientId) => [ (0,external_wp_blocks_namespaceObject.getBlockTypes)(), state.preferences.insertUsage, ...getInsertBlockTypeDependants(select)(state, rootClientId) ] ) ); const hasInserterItems = (state, rootClientId = null) => { const hasBlockType = (0,external_wp_blocks_namespaceObject.getBlockTypes)().some( (blockType) => canIncludeBlockTypeInInserter(state, blockType, rootClientId) ); if (hasBlockType) { return true; } const hasReusableBlock = canInsertBlockTypeUnmemoized( state, "core/block", rootClientId ); return hasReusableBlock; }; const getAllowedBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)( (state, rootClientId = null) => { if (!rootClientId) { return; } const blockTypes = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter( (blockType) => canIncludeBlockTypeInInserter(state, blockType, rootClientId) ); const hasReusableBlock = canInsertBlockTypeUnmemoized( state, "core/block", rootClientId ); if (hasReusableBlock) { blockTypes.push("core/block"); } return blockTypes; }, (state, rootClientId) => [ (0,external_wp_blocks_namespaceObject.getBlockTypes)(), ...getInsertBlockTypeDependants(select)(state, rootClientId) ] ) ); const __experimentalGetAllowedBlocks = (0,external_wp_data_namespaceObject.createSelector)( (state, rootClientId = null) => { external_wp_deprecated_default()( 'wp.data.select( "core/block-editor" ).__experimentalGetAllowedBlocks', { alternative: 'wp.data.select( "core/block-editor" ).getAllowedBlocks', since: "6.2", version: "6.4" } ); return getAllowedBlocks(state, rootClientId); }, (state, rootClientId) => getAllowedBlocks.getDependants(state, rootClientId) ); function getDirectInsertBlock(state, rootClientId = null) { if (!rootClientId) { return; } const { defaultBlock, directInsert } = state.blockListSettings[rootClientId] ?? {}; if (!defaultBlock || !directInsert) { return; } return defaultBlock; } function __experimentalGetDirectInsertBlock(state, rootClientId = null) { external_wp_deprecated_default()( 'wp.data.select( "core/block-editor" ).__experimentalGetDirectInsertBlock', { alternative: 'wp.data.select( "core/block-editor" ).getDirectInsertBlock', since: "6.3", version: "6.4" } ); return getDirectInsertBlock(state, rootClientId); } const __experimentalGetParsedPattern = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, patternName) => { const pattern = unlock(select(STORE_NAME)).getPatternBySlug( patternName ); return pattern ? getParsedPattern(pattern) : null; } ); const getAllowedPatternsDependants = (select) => (state, rootClientId) => [ ...getAllPatternsDependants(select)(state), ...getInsertBlockTypeDependants(select)(state, rootClientId) ]; const patternsWithParsedBlocks = /* @__PURE__ */ new WeakMap(); function enhancePatternWithParsedBlocks(pattern) { let enhancedPattern = patternsWithParsedBlocks.get(pattern); if (!enhancedPattern) { enhancedPattern = { ...pattern, get blocks() { return getParsedPattern(pattern).blocks; } }; patternsWithParsedBlocks.set(pattern, enhancedPattern); } return enhancedPattern; } const __experimentalGetAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => { return (0,external_wp_data_namespaceObject.createSelector)( (state, rootClientId = null, options = DEFAULT_INSERTER_OPTIONS) => { const { getAllPatterns } = unlock(select(STORE_NAME)); const patterns = getAllPatterns(); const { allowedBlockTypes } = getSettings(state); const parsedPatterns = patterns.filter(({ inserter = true }) => !!inserter).map(enhancePatternWithParsedBlocks); const availableParsedPatterns = parsedPatterns.filter( (pattern) => checkAllowListRecursive( getGrammar(pattern), allowedBlockTypes ) ); const patternsAllowed = availableParsedPatterns.filter( (pattern) => getGrammar(pattern).every( ({ blockName: name }) => options[isFiltered] !== false ? canInsertBlockType( state, name, rootClientId ) : isBlockVisibleInTheInserter( state, name, rootClientId ) ) ); return patternsAllowed; }, getAllowedPatternsDependants(select) ); } ); const getPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)( (state, blockNames, rootClientId = null) => { if (!blockNames) { return selectors_EMPTY_ARRAY; } const patterns = select(STORE_NAME).__experimentalGetAllowedPatterns( rootClientId ); const normalizedBlockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; const filteredPatterns = patterns.filter( (pattern) => pattern?.blockTypes?.some?.( (blockName) => normalizedBlockNames.includes(blockName) ) ); if (filteredPatterns.length === 0) { return selectors_EMPTY_ARRAY; } return filteredPatterns; }, (state, blockNames, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId) ) ); const __experimentalGetPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => { external_wp_deprecated_default()( 'wp.data.select( "core/block-editor" ).__experimentalGetPatternsByBlockTypes', { alternative: 'wp.data.select( "core/block-editor" ).getPatternsByBlockTypes', since: "6.2", version: "6.4" } ); return select(STORE_NAME).getPatternsByBlockTypes; } ); const __experimentalGetPatternTransformItems = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)( (state, blocks, rootClientId = null) => { if (!blocks) { return selectors_EMPTY_ARRAY; } if (blocks.some( ({ clientId, innerBlocks }) => innerBlocks.length || areInnerBlocksControlled(state, clientId) )) { return selectors_EMPTY_ARRAY; } const selectedBlockNames = Array.from( new Set(blocks.map(({ name }) => name)) ); return select(STORE_NAME).getPatternsByBlockTypes( selectedBlockNames, rootClientId ); }, (state, blocks, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId) ) ); function getBlockListSettings(state, clientId) { return state.blockListSettings[clientId]; } function getSettings(state) { return state.settings; } function isLastBlockChangePersistent(state) { return state.blocks.isPersistentChange; } const __experimentalGetBlockListSettingsForBlocks = (0,external_wp_data_namespaceObject.createSelector)( (state, clientIds = []) => { return clientIds.reduce((blockListSettingsForBlocks, clientId) => { if (!state.blockListSettings[clientId]) { return blockListSettingsForBlocks; } return { ...blockListSettingsForBlocks, [clientId]: state.blockListSettings[clientId] }; }, {}); }, (state) => [state.blockListSettings] ); const __experimentalGetReusableBlockTitle = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (0,external_wp_data_namespaceObject.createSelector)( (state, ref) => { external_wp_deprecated_default()( "wp.data.select( 'core/block-editor' ).__experimentalGetReusableBlockTitle", { since: "6.6", version: "6.8" } ); const reusableBlock = unlock(select(STORE_NAME)).getReusableBlocks().find((block) => block.id === ref); if (!reusableBlock) { return null; } return reusableBlock.title?.raw; }, () => [unlock(select(STORE_NAME)).getReusableBlocks()] ) ); function __unstableIsLastBlockChangeIgnored(state) { return state.blocks.isIgnoredChange; } function __experimentalGetLastBlockAttributeChanges(state) { return state.lastBlockAttributesChange; } function hasBlockMovingClientId() { external_wp_deprecated_default()( 'wp.data.select( "core/block-editor" ).hasBlockMovingClientId', { since: "6.7", hint: "Block moving mode feature has been removed" } ); return false; } function didAutomaticChange(state) { return !!state.automaticChangeStatus; } function isBlockHighlighted(state, clientId) { return state.highlightedBlock === clientId; } function areInnerBlocksControlled(state, clientId) { return !!state.blocks.controlledInnerBlocks[clientId]; } const __experimentalGetActiveBlockIdByBlockNames = (0,external_wp_data_namespaceObject.createSelector)( (state, validBlockNames) => { if (!validBlockNames.length) { return null; } const selectedBlockClientId = getSelectedBlockClientId(state); if (validBlockNames.includes( getBlockName(state, selectedBlockClientId) )) { return selectedBlockClientId; } const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state); const entityAreaParents = getBlockParentsByBlockName( state, selectedBlockClientId || multiSelectedBlockClientIds[0], validBlockNames ); if (entityAreaParents) { return entityAreaParents[entityAreaParents.length - 1]; } return null; }, (state, validBlockNames) => [ state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId, validBlockNames ] ); function wasBlockJustInserted(state, clientId, source) { const { lastBlockInserted } = state; return lastBlockInserted.clientIds?.includes(clientId) && lastBlockInserted.source === source; } function isBlockVisible(state, clientId) { return state.blockVisibility?.[clientId] ?? true; } function getHoveredBlockClientId() { external_wp_deprecated_default()( "wp.data.select( 'core/block-editor' ).getHoveredBlockClientId", { since: "6.9", version: "7.1" } ); return void 0; } const __unstableGetVisibleBlocks = (0,external_wp_data_namespaceObject.createSelector)( (state) => { const visibleBlocks = new Set( Object.keys(state.blockVisibility).filter( (key) => state.blockVisibility[key] ) ); if (visibleBlocks.size === 0) { return EMPTY_SET; } return visibleBlocks; }, (state) => [state.blockVisibility] ); function __unstableHasActiveBlockOverlayActive(state, clientId) { if (getBlockEditingMode(state, clientId) !== "default") { return false; } if (!canEditBlock(state, clientId)) { return true; } if (isZoomOut(state)) { const sectionRootClientId = getSectionRootClientId(state); if (sectionRootClientId) { const sectionClientIds = getBlockOrder( state, sectionRootClientId ); if (sectionClientIds?.includes(clientId)) { return true; } } else if (clientId && !getBlockRootClientId(state, clientId)) { return true; } } const blockSupportDisable = (0,external_wp_blocks_namespaceObject.hasBlockSupport)( getBlockName(state, clientId), "__experimentalDisableBlockOverlay", false ); const shouldEnableIfUnselected = blockSupportDisable ? false : areInnerBlocksControlled(state, clientId); return shouldEnableIfUnselected && !isBlockSelected(state, clientId) && !hasSelectedInnerBlock(state, clientId, true); } function __unstableIsWithinBlockOverlay(state, clientId) { let parent = state.blocks.parents.get(clientId); while (!!parent) { if (__unstableHasActiveBlockOverlayActive(state, parent)) { return true; } parent = state.blocks.parents.get(parent); } return false; } function getBlockEditingMode(state, clientId = "") { if (clientId === null) { clientId = ""; } if (state.derivedBlockEditingModes?.has(clientId)) { return state.derivedBlockEditingModes.get(clientId); } if (state.blockEditingModes.has(clientId)) { return state.blockEditingModes.get(clientId); } return "default"; } const isUngroupable = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, clientId = "") => { const _clientId = clientId || getSelectedBlockClientId(state); if (!_clientId) { return false; } const { getGroupingBlockName } = select(external_wp_blocks_namespaceObject.store); const block = getBlock(state, _clientId); const groupingBlockName = getGroupingBlockName(); const _isUngroupable = block && (block.name === groupingBlockName || (0,external_wp_blocks_namespaceObject.getBlockType)(block.name)?.transforms?.ungroup) && !!block.innerBlocks.length; return _isUngroupable && canRemoveBlock(state, _clientId); } ); const isGroupable = (0,external_wp_data_namespaceObject.createRegistrySelector)( (select) => (state, clientIds = selectors_EMPTY_ARRAY) => { const { getGroupingBlockName } = select(external_wp_blocks_namespaceObject.store); const groupingBlockName = getGroupingBlockName(); const _clientIds = clientIds?.length ? clientIds : getSelectedBlockClientIds(state); const rootClientId = _clientIds?.length ? getBlockRootClientId(state, _clientIds[0]) : void 0; const groupingBlockAvailable = canInsertBlockType( state, groupingBlockName, rootClientId ); const _isGroupable = groupingBlockAvailable && _clientIds.length; return _isGroupable && canRemoveBlocks(state, _clientIds); } ); const __unstableGetContentLockingParent = (state, clientId) => { external_wp_deprecated_default()( "wp.data.select( 'core/block-editor' ).__unstableGetContentLockingParent", { since: "6.1", version: "6.7" } ); return getContentLockingParent(state, clientId); }; function __unstableGetTemporarilyEditingAsBlocks(state) { external_wp_deprecated_default()( "wp.data.select( 'core/block-editor' ).__unstableGetTemporarilyEditingAsBlocks", { since: "6.1", version: "6.7" } ); return getTemporarilyEditingAsBlocks(state); } function __unstableGetTemporarilyEditingFocusModeToRevert(state) { external_wp_deprecated_default()( "wp.data.select( 'core/block-editor' ).__unstableGetTemporarilyEditingFocusModeToRevert", { since: "6.5", version: "6.7" } ); return getTemporarilyEditingFocusModeToRevert(state); } ;// external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// ./node_modules/@wordpress/block-editor/build-module/store/private-actions.js const castArray = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray]; const privateSettings = [ "inserterMediaCategories", "blockInspectorAnimation", "mediaSideload" ]; function __experimentalUpdateSettings(settings, { stripExperimentalSettings = false, reset = false } = {}) { let incomingSettings = settings; if (Object.hasOwn(incomingSettings, "__unstableIsPreviewMode")) { external_wp_deprecated_default()( "__unstableIsPreviewMode argument in wp.data.dispatch('core/block-editor').updateSettings", { since: "6.8", alternative: "isPreviewMode" } ); incomingSettings = { ...incomingSettings }; incomingSettings.isPreviewMode = incomingSettings.__unstableIsPreviewMode; delete incomingSettings.__unstableIsPreviewMode; } let cleanSettings = incomingSettings; if (stripExperimentalSettings && external_wp_element_namespaceObject.Platform.OS === "web") { cleanSettings = {}; for (const key in incomingSettings) { if (!privateSettings.includes(key)) { cleanSettings[key] = incomingSettings[key]; } } } return { type: "UPDATE_SETTINGS", settings: cleanSettings, reset }; } function hideBlockInterface() { return { type: "HIDE_BLOCK_INTERFACE" }; } function showBlockInterface() { return { type: "SHOW_BLOCK_INTERFACE" }; } const privateRemoveBlocks = (clientIds, selectPrevious = true, forceRemove = false) => ({ select, dispatch, registry }) => { if (!clientIds || !clientIds.length) { return; } clientIds = castArray(clientIds); const canRemoveBlocks = select.canRemoveBlocks(clientIds); if (!canRemoveBlocks) { return; } const rules = !forceRemove && select.getBlockRemovalRules(); if (rules) { let flattenBlocks2 = function(blocks) { const result = []; const stack = [...blocks]; while (stack.length) { const { innerBlocks, ...block } = stack.shift(); stack.push(...innerBlocks); result.push(block); } return result; }; var flattenBlocks = flattenBlocks2; const blockList = clientIds.map(select.getBlock); const flattenedBlocks = flattenBlocks2(blockList); let message; for (const rule of rules) { message = rule.callback(flattenedBlocks); if (message) { dispatch( displayBlockRemovalPrompt( clientIds, selectPrevious, message ) ); return; } } } if (selectPrevious) { dispatch.selectPreviousBlock(clientIds[0], selectPrevious); } registry.batch(() => { dispatch({ type: "REMOVE_BLOCKS", clientIds }); dispatch(ensureDefaultBlock()); }); }; const ensureDefaultBlock = () => ({ select, dispatch }) => { const count = select.getBlockCount(); if (count > 0) { return; } const { __unstableHasCustomAppender } = select.getSettings(); if (__unstableHasCustomAppender) { return; } dispatch.insertDefaultBlock(); }; function displayBlockRemovalPrompt(clientIds, selectPrevious, message) { return { type: "DISPLAY_BLOCK_REMOVAL_PROMPT", clientIds, selectPrevious, message }; } function clearBlockRemovalPrompt() { return { type: "CLEAR_BLOCK_REMOVAL_PROMPT" }; } function setBlockRemovalRules(rules = false) { return { type: "SET_BLOCK_REMOVAL_RULES", rules }; } function setOpenedBlockSettingsMenu(clientId) { return { type: "SET_OPENED_BLOCK_SETTINGS_MENU", clientId }; } function setStyleOverride(id, style) { return { type: "SET_STYLE_OVERRIDE", id, style }; } function deleteStyleOverride(id) { return { type: "DELETE_STYLE_OVERRIDE", id }; } function setLastFocus(lastFocus = null) { return { type: "LAST_FOCUS", lastFocus }; } function stopEditingAsBlocks(clientId) { return ({ select, dispatch, registry }) => { const focusModeToRevert = unlock( registry.select(store) ).getTemporarilyEditingFocusModeToRevert(); dispatch.__unstableMarkNextChangeAsNotPersistent(); dispatch.updateBlockAttributes(clientId, { templateLock: "contentOnly" }); dispatch.updateBlockListSettings(clientId, { ...select.getBlockListSettings(clientId), templateLock: "contentOnly" }); dispatch.updateSettings({ focusMode: focusModeToRevert }); dispatch.__unstableSetTemporarilyEditingAsBlocks(); }; } function startDragging() { return { type: "START_DRAGGING" }; } function stopDragging() { return { type: "STOP_DRAGGING" }; } function expandBlock(clientId) { return { type: "SET_BLOCK_EXPANDED_IN_LIST_VIEW", clientId }; } function setInsertionPoint(value) { return { type: "SET_INSERTION_POINT", value }; } const modifyContentLockBlock = (clientId) => ({ select, dispatch }) => { dispatch.selectBlock(clientId); dispatch.__unstableMarkNextChangeAsNotPersistent(); dispatch.updateBlockAttributes(clientId, { templateLock: void 0 }); dispatch.updateBlockListSettings(clientId, { ...select.getBlockListSettings(clientId), templateLock: false }); const focusModeToRevert = select.getSettings().focusMode; dispatch.updateSettings({ focusMode: true }); dispatch.__unstableSetTemporarilyEditingAsBlocks( clientId, focusModeToRevert ); }; const setZoomLevel = (zoom = 100) => ({ select, dispatch }) => { if (zoom !== 100) { const firstSelectedClientId = select.getBlockSelectionStart(); const sectionRootClientId = select.getSectionRootClientId(); if (firstSelectedClientId) { let sectionClientId; if (sectionRootClientId) { const sectionClientIds = select.getBlockOrder(sectionRootClientId); if (sectionClientIds?.includes(firstSelectedClientId)) { sectionClientId = firstSelectedClientId; } else { sectionClientId = select.getBlockParents(firstSelectedClientId).find( (parent) => sectionClientIds.includes(parent) ); } } else { sectionClientId = select.getBlockHierarchyRootClientId( firstSelectedClientId ); } if (sectionClientId) { dispatch.selectBlock(sectionClientId); } else { dispatch.clearSelectedBlock(); } (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("You are currently in zoom-out mode.")); } } dispatch({ type: "SET_ZOOM_LEVEL", zoom }); }; function resetZoomLevel() { return { type: "RESET_ZOOM_LEVEL" }; } function toggleBlockSpotlight(clientId, hasBlockSpotlight) { return { type: "TOGGLE_BLOCK_SPOTLIGHT", clientId, hasBlockSpotlight }; } ;// external ["wp","notices"] const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// external ["wp","preferences"] const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; ;// ./node_modules/@wordpress/block-editor/build-module/utils/selection.js const START_OF_SELECTED_AREA = "\x86"; function retrieveSelectedAttribute(blockAttributes) { if (!blockAttributes) { return; } return Object.keys(blockAttributes).find((name) => { const value = blockAttributes[name]; return (typeof value === "string" || value instanceof external_wp_richText_namespaceObject.RichTextData) && // To do: refactor this to use rich text's selection instead, so we // no longer have to use on this hack inserting a special character. value.toString().indexOf(START_OF_SELECTED_AREA) !== -1; }); } function findRichTextAttributeKey(blockType) { for (const [key, value] of Object.entries(blockType.attributes)) { if (value.source === "rich-text" || value.source === "html") { return key; } } } ;// ./node_modules/@wordpress/block-editor/build-module/store/actions.js const actions_castArray = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray]; const resetBlocks = (blocks) => ({ dispatch }) => { dispatch({ type: "RESET_BLOCKS", blocks }); dispatch(validateBlocksToTemplate(blocks)); }; const validateBlocksToTemplate = (blocks) => ({ select, dispatch }) => { const template = select.getTemplate(); const templateLock = select.getTemplateLock(); const isBlocksValidToTemplate = !template || templateLock !== "all" || (0,external_wp_blocks_namespaceObject.doBlocksMatchTemplate)(blocks, template); const isValidTemplate = select.isValidTemplate(); if (isBlocksValidToTemplate !== isValidTemplate) { dispatch.setTemplateValidity(isBlocksValidToTemplate); return isBlocksValidToTemplate; } }; function resetSelection(selectionStart, selectionEnd, initialPosition) { return { type: "RESET_SELECTION", selectionStart, selectionEnd, initialPosition }; } function receiveBlocks(blocks) { external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).receiveBlocks', { since: "5.9", alternative: "resetBlocks or insertBlocks" }); return { type: "RECEIVE_BLOCKS", blocks }; } function updateBlockAttributes(clientIds, attributes, options = { uniqueByBlock: false }) { if (typeof options === "boolean") { options = { uniqueByBlock: options }; } return { type: "UPDATE_BLOCK_ATTRIBUTES", clientIds: actions_castArray(clientIds), attributes, options }; } function updateBlock(clientId, updates) { return { type: "UPDATE_BLOCK", clientId, updates }; } function selectBlock(clientId, initialPosition = 0) { return { type: "SELECT_BLOCK", initialPosition, clientId }; } function hoverBlock() { external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).hoverBlock', { since: "6.9", version: "7.1" }); return { type: "DO_NOTHING" }; } const selectPreviousBlock = (clientId, fallbackToParent = false) => ({ select, dispatch }) => { const previousBlockClientId = select.getPreviousBlockClientId(clientId); if (previousBlockClientId) { dispatch.selectBlock(previousBlockClientId, -1); } else if (fallbackToParent) { const firstParentClientId = select.getBlockRootClientId(clientId); if (firstParentClientId) { dispatch.selectBlock(firstParentClientId, -1); } } }; const selectNextBlock = (clientId) => ({ select, dispatch }) => { const nextBlockClientId = select.getNextBlockClientId(clientId); if (nextBlockClientId) { dispatch.selectBlock(nextBlockClientId); } }; function startMultiSelect() { return { type: "START_MULTI_SELECT" }; } function stopMultiSelect() { return { type: "STOP_MULTI_SELECT" }; } const multiSelect = (start, end, __experimentalInitialPosition = 0) => ({ select, dispatch }) => { const startBlockRootClientId = select.getBlockRootClientId(start); const endBlockRootClientId = select.getBlockRootClientId(end); if (startBlockRootClientId !== endBlockRootClientId) { return; } dispatch({ type: "MULTI_SELECT", start, end, initialPosition: __experimentalInitialPosition }); const blockCount = select.getSelectedBlockCount(); (0,external_wp_a11y_namespaceObject.speak)( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: number of selected blocks */ (0,external_wp_i18n_namespaceObject._n)("%s block selected.", "%s blocks selected.", blockCount), blockCount ), "assertive" ); }; function clearSelectedBlock() { return { type: "CLEAR_SELECTED_BLOCK" }; } function toggleSelection(isSelectionEnabled = true) { return { type: "TOGGLE_SELECTION", isSelectionEnabled }; } const replaceBlocks = (clientIds, blocks, indexToSelect, initialPosition = 0, meta) => ({ select, dispatch, registry }) => { clientIds = actions_castArray(clientIds); blocks = actions_castArray(blocks); const rootClientId = select.getBlockRootClientId(clientIds[0]); for (let index = 0; index < blocks.length; index++) { const block = blocks[index]; const canInsertBlock = select.canInsertBlockType( block.name, rootClientId ); if (!canInsertBlock) { return; } } registry.batch(() => { dispatch({ type: "REPLACE_BLOCKS", clientIds, blocks, time: Date.now(), indexToSelect, initialPosition, meta }); dispatch.ensureDefaultBlock(); }); }; function replaceBlock(clientId, block) { return replaceBlocks(clientId, block); } const createOnMove = (type) => (clientIds, rootClientId) => ({ select, dispatch }) => { const canMoveBlocks = select.canMoveBlocks(clientIds); if (!canMoveBlocks) { return; } dispatch({ type, clientIds: actions_castArray(clientIds), rootClientId }); }; const moveBlocksDown = createOnMove("MOVE_BLOCKS_DOWN"); const moveBlocksUp = createOnMove("MOVE_BLOCKS_UP"); const moveBlocksToPosition = (clientIds, fromRootClientId = "", toRootClientId = "", index) => ({ select, dispatch }) => { const canMoveBlocks = select.canMoveBlocks(clientIds); if (!canMoveBlocks) { return; } if (fromRootClientId !== toRootClientId) { const canRemoveBlocks = select.canRemoveBlocks(clientIds); if (!canRemoveBlocks) { return; } const canInsertBlocks = select.canInsertBlocks( clientIds, toRootClientId ); if (!canInsertBlocks) { return; } } dispatch({ type: "MOVE_BLOCKS_TO_POSITION", fromRootClientId, toRootClientId, clientIds, index }); }; function moveBlockToPosition(clientId, fromRootClientId = "", toRootClientId = "", index) { return moveBlocksToPosition( [clientId], fromRootClientId, toRootClientId, index ); } function insertBlock(block, index, rootClientId, updateSelection, meta) { return insertBlocks( [block], index, rootClientId, updateSelection, 0, meta ); } const insertBlocks = (blocks, index, rootClientId, updateSelection = true, initialPosition = 0, meta) => ({ select, dispatch }) => { if (initialPosition !== null && typeof initialPosition === "object") { meta = initialPosition; initialPosition = 0; external_wp_deprecated_default()( "meta argument in wp.data.dispatch('core/block-editor')", { since: "5.8", hint: "The meta argument is now the 6th argument of the function" } ); } blocks = actions_castArray(blocks); const allowedBlocks = []; for (const block of blocks) { const isValid = select.canInsertBlockType( block.name, rootClientId ); if (isValid) { allowedBlocks.push(block); } } if (allowedBlocks.length) { dispatch({ type: "INSERT_BLOCKS", blocks: allowedBlocks, index, rootClientId, time: Date.now(), updateSelection, initialPosition: updateSelection ? initialPosition : null, meta }); } }; function showInsertionPoint(rootClientId, index, __unstableOptions = {}) { const { __unstableWithInserter, operation, nearestSide } = __unstableOptions; return { type: "SHOW_INSERTION_POINT", rootClientId, index, __unstableWithInserter, operation, nearestSide }; } const hideInsertionPoint = () => ({ select, dispatch }) => { if (!select.isBlockInsertionPointVisible()) { return; } dispatch({ type: "HIDE_INSERTION_POINT" }); }; function setTemplateValidity(isValid) { return { type: "SET_TEMPLATE_VALIDITY", isValid }; } const synchronizeTemplate = () => ({ select, dispatch }) => { dispatch({ type: "SYNCHRONIZE_TEMPLATE" }); const blocks = select.getBlocks(); const template = select.getTemplate(); const updatedBlockList = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)( blocks, template ); dispatch.resetBlocks(updatedBlockList); }; const __unstableDeleteSelection = (isForward) => ({ registry, select, dispatch }) => { const selectionAnchor = select.getSelectionStart(); const selectionFocus = select.getSelectionEnd(); if (selectionAnchor.clientId === selectionFocus.clientId) { return; } if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === "undefined" || typeof selectionFocus.offset === "undefined") { return false; } const anchorRootClientId = select.getBlockRootClientId( selectionAnchor.clientId ); const focusRootClientId = select.getBlockRootClientId( selectionFocus.clientId ); if (anchorRootClientId !== focusRootClientId) { return; } const blockOrder = select.getBlockOrder(anchorRootClientId); const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); const focusIndex = blockOrder.indexOf(selectionFocus.clientId); let selectionStart, selectionEnd; if (anchorIndex > focusIndex) { selectionStart = selectionFocus; selectionEnd = selectionAnchor; } else { selectionStart = selectionAnchor; selectionEnd = selectionFocus; } const targetSelection = isForward ? selectionEnd : selectionStart; const targetBlock = select.getBlock(targetSelection.clientId); const targetBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlock.name); if (!targetBlockType.merge) { return; } const selectionA = selectionStart; const selectionB = selectionEnd; const blockA = select.getBlock(selectionA.clientId); const blockB = select.getBlock(selectionB.clientId); const htmlA = blockA.attributes[selectionA.attributeKey]; const htmlB = blockB.attributes[selectionB.attributeKey]; let valueA = (0,external_wp_richText_namespaceObject.create)({ html: htmlA }); let valueB = (0,external_wp_richText_namespaceObject.create)({ html: htmlB }); valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, selectionA.offset, valueA.text.length); valueB = (0,external_wp_richText_namespaceObject.insert)(valueB, START_OF_SELECTED_AREA, 0, selectionB.offset); const cloneA = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockA, { [selectionA.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueA }) }); const cloneB = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockB, { [selectionB.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueB }) }); const followingBlock = isForward ? cloneA : cloneB; const blocksWithTheSameType = blockA.name === blockB.name ? [followingBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(followingBlock, targetBlockType.name); if (!blocksWithTheSameType || !blocksWithTheSameType.length) { return; } let updatedAttributes; if (isForward) { const blockToMerge = blocksWithTheSameType.pop(); updatedAttributes = targetBlockType.merge( blockToMerge.attributes, cloneB.attributes ); } else { const blockToMerge = blocksWithTheSameType.shift(); updatedAttributes = targetBlockType.merge( cloneA.attributes, blockToMerge.attributes ); } const newAttributeKey = retrieveSelectedAttribute(updatedAttributes); const convertedHtml = updatedAttributes[newAttributeKey]; const convertedValue = (0,external_wp_richText_namespaceObject.create)({ html: convertedHtml }); const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA); const newValue = (0,external_wp_richText_namespaceObject.remove)(convertedValue, newOffset, newOffset + 1); const newHtml = (0,external_wp_richText_namespaceObject.toHTMLString)({ value: newValue }); updatedAttributes[newAttributeKey] = newHtml; const selectedBlockClientIds = select.getSelectedBlockClientIds(); const replacement = [ ...isForward ? blocksWithTheSameType : [], { // Preserve the original client ID. ...targetBlock, attributes: { ...targetBlock.attributes, ...updatedAttributes } }, ...isForward ? [] : blocksWithTheSameType ]; registry.batch(() => { dispatch.selectionChange( targetBlock.clientId, newAttributeKey, newOffset, newOffset ); dispatch.replaceBlocks( selectedBlockClientIds, replacement, 0, // If we don't pass the `indexToSelect` it will default to the last block. select.getSelectedBlocksInitialCaretPosition() ); }); }; const __unstableSplitSelection = (blocks = []) => ({ registry, select, dispatch }) => { const selectionAnchor = select.getSelectionStart(); const selectionFocus = select.getSelectionEnd(); const anchorRootClientId = select.getBlockRootClientId( selectionAnchor.clientId ); const focusRootClientId = select.getBlockRootClientId( selectionFocus.clientId ); if (anchorRootClientId !== focusRootClientId) { return; } const blockOrder = select.getBlockOrder(anchorRootClientId); const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); const focusIndex = blockOrder.indexOf(selectionFocus.clientId); let selectionStart, selectionEnd; if (anchorIndex > focusIndex) { selectionStart = selectionFocus; selectionEnd = selectionAnchor; } else { selectionStart = selectionAnchor; selectionEnd = selectionFocus; } const selectionA = selectionStart; const selectionB = selectionEnd; const blockA = select.getBlock(selectionA.clientId); const blockB = select.getBlock(selectionB.clientId); const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name); const attributeKeyA = typeof selectionA.attributeKey === "string" ? selectionA.attributeKey : findRichTextAttributeKey(blockAType); const attributeKeyB = typeof selectionB.attributeKey === "string" ? selectionB.attributeKey : findRichTextAttributeKey(blockBType); const blockAttributes = select.getBlockAttributes( selectionA.clientId ); const bindings = blockAttributes?.metadata?.bindings; if (bindings?.[attributeKeyA]) { if (blocks.length) { const { createWarningNotice } = registry.dispatch(external_wp_notices_namespaceObject.store); createWarningNotice( (0,external_wp_i18n_namespaceObject.__)( "Blocks can't be inserted into other blocks with bindings" ), { type: "snackbar" } ); return; } dispatch.insertAfterBlock(selectionA.clientId); return; } if (!attributeKeyA || !attributeKeyB || typeof selectionAnchor.offset === "undefined" || typeof selectionFocus.offset === "undefined") { return; } if (selectionA.clientId === selectionB.clientId && attributeKeyA === attributeKeyB && selectionA.offset === selectionB.offset) { if (blocks.length) { if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockA)) { dispatch.replaceBlocks( [selectionA.clientId], blocks, blocks.length - 1, -1 ); return; } } else if (!select.getBlockOrder(selectionA.clientId).length) { let createEmpty2 = function() { const defaultBlockName2 = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); return select.canInsertBlockType( defaultBlockName2, anchorRootClientId ) ? (0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName2) : (0,external_wp_blocks_namespaceObject.createBlock)( select.getBlockName(selectionA.clientId) ); }; var createEmpty = createEmpty2; const length = blockAttributes[attributeKeyA].length; if (selectionA.offset === 0 && length) { dispatch.insertBlocks( [createEmpty2()], select.getBlockIndex(selectionA.clientId), anchorRootClientId, false ); return; } if (selectionA.offset === length) { dispatch.insertBlocks( [createEmpty2()], select.getBlockIndex(selectionA.clientId) + 1, anchorRootClientId ); return; } } } const htmlA = blockA.attributes[attributeKeyA]; const htmlB = blockB.attributes[attributeKeyB]; let valueA = (0,external_wp_richText_namespaceObject.create)({ html: htmlA }); let valueB = (0,external_wp_richText_namespaceObject.create)({ html: htmlB }); valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, selectionA.offset, valueA.text.length); valueB = (0,external_wp_richText_namespaceObject.remove)(valueB, 0, selectionB.offset); let head = { // Preserve the original client ID. ...blockA, // If both start and end are the same, should only copy innerBlocks // once. innerBlocks: blockA.clientId === blockB.clientId ? [] : blockA.innerBlocks, attributes: { ...blockA.attributes, [attributeKeyA]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueA }) } }; let tail = { ...blockB, // Only preserve the original client ID if the end is different. clientId: blockA.clientId === blockB.clientId ? (0,external_wp_blocks_namespaceObject.createBlock)(blockB.name).clientId : blockB.clientId, attributes: { ...blockB.attributes, [attributeKeyB]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueB }) } }; const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); if ( // A block is only split when the selection is within the same // block. blockA.clientId === blockB.clientId && defaultBlockName && tail.name !== defaultBlockName && select.canInsertBlockType(defaultBlockName, anchorRootClientId) ) { const switched = (0,external_wp_blocks_namespaceObject.switchToBlockType)(tail, defaultBlockName); if (switched?.length === 1) { tail = switched[0]; } } if (!blocks.length) { dispatch.replaceBlocks(select.getSelectedBlockClientIds(), [ head, tail ]); return; } let selection; const output = []; const clonedBlocks = [...blocks]; const firstBlock = clonedBlocks.shift(); const headType = (0,external_wp_blocks_namespaceObject.getBlockType)(head.name); const firstBlocks = headType.merge && firstBlock.name === headType.name ? [firstBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(firstBlock, headType.name); if (firstBlocks?.length) { const first = firstBlocks.shift(); head = { ...head, attributes: { ...head.attributes, ...headType.merge(head.attributes, first.attributes) } }; output.push(head); selection = { clientId: head.clientId, attributeKey: attributeKeyA, offset: (0,external_wp_richText_namespaceObject.create)({ html: head.attributes[attributeKeyA] }).text.length }; clonedBlocks.unshift(...firstBlocks); } else { if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(head)) { output.push(head); } output.push(firstBlock); } const lastBlock = clonedBlocks.pop(); const tailType = (0,external_wp_blocks_namespaceObject.getBlockType)(tail.name); if (clonedBlocks.length) { output.push(...clonedBlocks); } if (lastBlock) { const lastBlocks = tailType.merge && tailType.name === lastBlock.name ? [lastBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(lastBlock, tailType.name); if (lastBlocks?.length) { const last = lastBlocks.pop(); output.push({ ...tail, attributes: { ...tail.attributes, ...tailType.merge(last.attributes, tail.attributes) } }); output.push(...lastBlocks); selection = { clientId: tail.clientId, attributeKey: attributeKeyB, offset: (0,external_wp_richText_namespaceObject.create)({ html: last.attributes[attributeKeyB] }).text.length }; } else { output.push(lastBlock); if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(tail)) { output.push(tail); } } } else if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(tail)) { output.push(tail); } registry.batch(() => { dispatch.replaceBlocks( select.getSelectedBlockClientIds(), output, output.length - 1, 0 ); if (selection) { dispatch.selectionChange( selection.clientId, selection.attributeKey, selection.offset, selection.offset ); } }); }; const __unstableExpandSelection = () => ({ select, dispatch }) => { const selectionAnchor = select.getSelectionStart(); const selectionFocus = select.getSelectionEnd(); dispatch.selectionChange({ start: { clientId: selectionAnchor.clientId }, end: { clientId: selectionFocus.clientId } }); }; const mergeBlocks = (firstBlockClientId, secondBlockClientId) => ({ registry, select, dispatch }) => { const clientIdA = firstBlockClientId; const clientIdB = secondBlockClientId; const blockA = select.getBlock(clientIdA); const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); if (!blockAType || select.getBlockEditingMode(clientIdA) === "disabled" || select.getBlockEditingMode(clientIdB) === "disabled") { return; } const blockB = select.getBlock(clientIdB); if (!blockAType.merge && (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockA.name, "__experimentalOnMerge")) { const blocksWithTheSameType2 = (0,external_wp_blocks_namespaceObject.switchToBlockType)( blockB, blockAType.name ); if (blocksWithTheSameType2?.length !== 1) { dispatch.selectBlock(blockA.clientId); return; } const [blockWithSameType] = blocksWithTheSameType2; if (blockWithSameType.innerBlocks.length < 1) { dispatch.selectBlock(blockA.clientId); return; } registry.batch(() => { dispatch.insertBlocks( blockWithSameType.innerBlocks, void 0, clientIdA ); dispatch.removeBlock(clientIdB); dispatch.selectBlock( blockWithSameType.innerBlocks[0].clientId ); const nextBlockClientId = select.getNextBlockClientId(clientIdA); if (nextBlockClientId && select.getBlockName(clientIdA) === select.getBlockName(nextBlockClientId)) { const rootAttributes = select.getBlockAttributes(clientIdA); const previousRootAttributes = select.getBlockAttributes(nextBlockClientId); if (Object.keys(rootAttributes).every( (key) => rootAttributes[key] === previousRootAttributes[key] )) { dispatch.moveBlocksToPosition( select.getBlockOrder(nextBlockClientId), nextBlockClientId, clientIdA ); dispatch.removeBlock(nextBlockClientId, false); } } }); return; } if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockA)) { dispatch.removeBlock( clientIdA, select.isBlockSelected(clientIdA) ); return; } if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockB)) { dispatch.removeBlock( clientIdB, select.isBlockSelected(clientIdB) ); return; } if (!blockAType.merge) { if ((0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(blockB, "content")) { dispatch.removeBlock( clientIdB, select.isBlockSelected(clientIdB) ); } else { dispatch.selectBlock(blockA.clientId); } return; } const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name); const { clientId, attributeKey, offset } = select.getSelectionStart(); const selectedBlockType = clientId === clientIdA ? blockAType : blockBType; const attributeDefinition = selectedBlockType.attributes[attributeKey]; const canRestoreTextSelection = (clientId === clientIdA || clientId === clientIdB) && attributeKey !== void 0 && offset !== void 0 && // We cannot restore text selection if the RichText identifier // is not a defined block attribute key. This can be the case if the // fallback instance ID is used to store selection (and no RichText // identifier is set), or when the identifier is wrong. !!attributeDefinition; if (!attributeDefinition) { if (typeof attributeKey === "number") { window.console.error( `RichText needs an identifier prop that is the block attribute key of the attribute it controls. Its type is expected to be a string, but was ${typeof attributeKey}` ); } else { window.console.error( "The RichText identifier prop does not match any attributes defined by the block." ); } } const cloneA = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockA); const cloneB = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockB); if (canRestoreTextSelection) { const selectedBlock = clientId === clientIdA ? cloneA : cloneB; const html = selectedBlock.attributes[attributeKey]; const value = (0,external_wp_richText_namespaceObject.insert)( (0,external_wp_richText_namespaceObject.create)({ html }), START_OF_SELECTED_AREA, offset, offset ); selectedBlock.attributes[attributeKey] = (0,external_wp_richText_namespaceObject.toHTMLString)({ value }); } const blocksWithTheSameType = blockA.name === blockB.name ? [cloneB] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(cloneB, blockA.name); if (!blocksWithTheSameType || !blocksWithTheSameType.length) { return; } const updatedAttributes = blockAType.merge( cloneA.attributes, blocksWithTheSameType[0].attributes ); if (canRestoreTextSelection) { const newAttributeKey = retrieveSelectedAttribute(updatedAttributes); const convertedHtml = updatedAttributes[newAttributeKey]; const convertedValue = (0,external_wp_richText_namespaceObject.create)({ html: convertedHtml }); const newOffset = convertedValue.text.indexOf( START_OF_SELECTED_AREA ); const newValue = (0,external_wp_richText_namespaceObject.remove)(convertedValue, newOffset, newOffset + 1); const newHtml = (0,external_wp_richText_namespaceObject.toHTMLString)({ value: newValue }); updatedAttributes[newAttributeKey] = newHtml; dispatch.selectionChange( blockA.clientId, newAttributeKey, newOffset, newOffset ); } dispatch.replaceBlocks( [blockA.clientId, blockB.clientId], [ { ...blockA, attributes: { ...blockA.attributes, ...updatedAttributes } }, ...blocksWithTheSameType.slice(1) ], 0 // If we don't pass the `indexToSelect` it will default to the last block. ); }; const removeBlocks = (clientIds, selectPrevious = true) => privateRemoveBlocks(clientIds, selectPrevious); function removeBlock(clientId, selectPrevious) { return removeBlocks([clientId], selectPrevious); } function replaceInnerBlocks(rootClientId, blocks, updateSelection = false, initialPosition = 0) { return { type: "REPLACE_INNER_BLOCKS", rootClientId, blocks, updateSelection, initialPosition: updateSelection ? initialPosition : null, time: Date.now() }; } function toggleBlockMode(clientId) { return { type: "TOGGLE_BLOCK_MODE", clientId }; } function startTyping() { return { type: "START_TYPING" }; } function stopTyping() { return { type: "STOP_TYPING" }; } function startDraggingBlocks(clientIds = []) { return { type: "START_DRAGGING_BLOCKS", clientIds }; } function stopDraggingBlocks() { return { type: "STOP_DRAGGING_BLOCKS" }; } function enterFormattedText() { external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).enterFormattedText', { since: "6.1", version: "6.3" }); return { type: "DO_NOTHING" }; } function exitFormattedText() { external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).exitFormattedText', { since: "6.1", version: "6.3" }); return { type: "DO_NOTHING" }; } function selectionChange(clientId, attributeKey, startOffset, endOffset) { if (typeof clientId === "string") { return { type: "SELECTION_CHANGE", clientId, attributeKey, startOffset, endOffset }; } return { type: "SELECTION_CHANGE", ...clientId }; } const insertDefaultBlock = (attributes, rootClientId, index) => ({ dispatch }) => { const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); if (!defaultBlockName) { return; } const block = (0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName, attributes); return dispatch.insertBlock(block, index, rootClientId); }; function updateBlockListSettings(clientId, settings) { return { type: "UPDATE_BLOCK_LIST_SETTINGS", clientId, settings }; } function updateSettings(settings) { return __experimentalUpdateSettings(settings, { stripExperimentalSettings: true }); } function __unstableSaveReusableBlock(id, updatedId) { return { type: "SAVE_REUSABLE_BLOCK_SUCCESS", id, updatedId }; } function __unstableMarkLastChangeAsPersistent() { return { type: "MARK_LAST_CHANGE_AS_PERSISTENT" }; } function __unstableMarkNextChangeAsNotPersistent() { return { type: "MARK_NEXT_CHANGE_AS_NOT_PERSISTENT" }; } const __unstableMarkAutomaticChange = () => ({ dispatch }) => { dispatch({ type: "MARK_AUTOMATIC_CHANGE" }); const { requestIdleCallback = (cb) => setTimeout(cb, 100) } = window; requestIdleCallback(() => { dispatch({ type: "MARK_AUTOMATIC_CHANGE_FINAL" }); }); }; const __unstableSetEditorMode = (mode) => ({ registry }) => { registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "editorTool", mode); if (mode === "navigation") { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("You are currently in Write mode.")); } else if (mode === "edit") { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("You are currently in Design mode.")); } }; function setBlockMovingClientId() { external_wp_deprecated_default()( 'wp.data.dispatch( "core/block-editor" ).setBlockMovingClientId', { since: "6.7", hint: "Block moving mode feature has been removed" } ); return { type: "DO_NOTHING" }; } const duplicateBlocks = (clientIds, updateSelection = true) => ({ select, dispatch }) => { if (!clientIds || !clientIds.length) { return; } const blocks = select.getBlocksByClientId(clientIds); if (blocks.some((block) => !block)) { return; } const blockNames = blocks.map((block) => block.name); if (blockNames.some( (blockName) => !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "multiple", true) )) { return; } const rootClientId = select.getBlockRootClientId(clientIds[0]); const clientIdsArray = actions_castArray(clientIds); const lastSelectedIndex = select.getBlockIndex( clientIdsArray[clientIdsArray.length - 1] ); const clonedBlocks = blocks.map( (block) => (0,external_wp_blocks_namespaceObject.__experimentalCloneSanitizedBlock)(block) ); dispatch.insertBlocks( clonedBlocks, lastSelectedIndex + 1, rootClientId, updateSelection ); if (clonedBlocks.length > 1 && updateSelection) { dispatch.multiSelect( clonedBlocks[0].clientId, clonedBlocks[clonedBlocks.length - 1].clientId ); } return clonedBlocks.map((block) => block.clientId); }; const insertBeforeBlock = (clientId) => ({ select, dispatch }) => { if (!clientId) { return; } const rootClientId = select.getBlockRootClientId(clientId); const isLocked = select.getTemplateLock(rootClientId); if (isLocked) { return; } const blockIndex = select.getBlockIndex(clientId); const directInsertBlock = rootClientId ? select.getDirectInsertBlock(rootClientId) : null; if (!directInsertBlock) { return dispatch.insertDefaultBlock({}, rootClientId, blockIndex); } const copiedAttributes = {}; if (directInsertBlock.attributesToCopy) { const attributes = select.getBlockAttributes(clientId); directInsertBlock.attributesToCopy.forEach((key) => { if (attributes[key]) { copiedAttributes[key] = attributes[key]; } }); } const block = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, { ...directInsertBlock.attributes, ...copiedAttributes }); return dispatch.insertBlock(block, blockIndex, rootClientId); }; const insertAfterBlock = (clientId) => ({ select, dispatch }) => { if (!clientId) { return; } const rootClientId = select.getBlockRootClientId(clientId); const isLocked = select.getTemplateLock(rootClientId); if (isLocked) { return; } const blockIndex = select.getBlockIndex(clientId); const directInsertBlock = rootClientId ? select.getDirectInsertBlock(rootClientId) : null; if (!directInsertBlock) { return dispatch.insertDefaultBlock( {}, rootClientId, blockIndex + 1 ); } const copiedAttributes = {}; if (directInsertBlock.attributesToCopy) { const attributes = select.getBlockAttributes(clientId); directInsertBlock.attributesToCopy.forEach((key) => { if (attributes[key]) { copiedAttributes[key] = attributes[key]; } }); } const block = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, { ...directInsertBlock.attributes, ...copiedAttributes }); return dispatch.insertBlock(block, blockIndex + 1, rootClientId); }; function toggleBlockHighlight(clientId, isHighlighted) { return { type: "TOGGLE_BLOCK_HIGHLIGHT", clientId, isHighlighted }; } const flashBlock = (clientId, timeout = 150) => async ({ dispatch }) => { dispatch(toggleBlockHighlight(clientId, true)); await new Promise((resolve) => setTimeout(resolve, timeout)); dispatch(toggleBlockHighlight(clientId, false)); }; function setHasControlledInnerBlocks(clientId, hasControlledInnerBlocks) { return { type: "SET_HAS_CONTROLLED_INNER_BLOCKS", hasControlledInnerBlocks, clientId }; } function setBlockVisibility(updates) { return { type: "SET_BLOCK_VISIBILITY", updates }; } function __unstableSetTemporarilyEditingAsBlocks(temporarilyEditingAsBlocks, focusModeToRevert) { return { type: "SET_TEMPORARILY_EDITING_AS_BLOCKS", temporarilyEditingAsBlocks, focusModeToRevert }; } const registerInserterMediaCategory = (category) => ({ select, dispatch }) => { if (!category || typeof category !== "object") { console.error( "Category should be an `InserterMediaCategory` object." ); return; } if (!category.name) { console.error( "Category should have a `name` that should be unique among all media categories." ); return; } if (!category.labels?.name) { console.error("Category should have a `labels.name`."); return; } if (!["image", "audio", "video"].includes(category.mediaType)) { console.error( "Category should have `mediaType` property that is one of `image|audio|video`." ); return; } if (!category.fetch || typeof category.fetch !== "function") { console.error( "Category should have a `fetch` function defined with the following signature `(InserterMediaRequest) => Promise<InserterMediaItem[]>`." ); return; } const registeredInserterMediaCategories = select.getRegisteredInserterMediaCategories(); if (registeredInserterMediaCategories.some( ({ name }) => name === category.name )) { console.error( `A category is already registered with the same name: "${category.name}".` ); return; } if (registeredInserterMediaCategories.some( ({ labels: { name } = {} }) => name === category.labels?.name )) { console.error( `A category is already registered with the same labels.name: "${category.labels.name}".` ); return; } dispatch({ type: "REGISTER_INSERTER_MEDIA_CATEGORY", category: { ...category, isExternalResource: true } }); }; function setBlockEditingMode(clientId = "", mode) { return { type: "SET_BLOCK_EDITING_MODE", clientId, mode }; } function unsetBlockEditingMode(clientId = "") { return { type: "UNSET_BLOCK_EDITING_MODE", clientId }; } ;// ./node_modules/@wordpress/block-editor/build-module/store/index.js const storeConfig = { reducer: reducer_default, selectors: selectors_namespaceObject, actions: actions_namespaceObject }; const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { ...storeConfig, persist: ["preferences"] }); const registeredStore = (0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, { ...storeConfig, persist: ["preferences"] }); unlock(registeredStore).registerPrivateActions(private_actions_namespaceObject); unlock(registeredStore).registerPrivateSelectors(private_selectors_namespaceObject); unlock(store).registerPrivateActions(private_actions_namespaceObject); unlock(store).registerPrivateSelectors(private_selectors_namespaceObject); ;// ./node_modules/@wordpress/block-editor/build-module/components/use-settings/index.js function use_settings_useSettings(...paths) { const { clientId = null } = useBlockEditContext(); return (0,external_wp_data_namespaceObject.useSelect)( (select) => unlock(select(store)).getBlockSettings( clientId, ...paths ), [clientId, ...paths] ); } function useSetting(path) { external_wp_deprecated_default()("wp.blockEditor.useSetting", { since: "6.5", alternative: "wp.blockEditor.useSettings", note: "The new useSettings function can retrieve multiple settings at once, with better performance." }); const [value] = use_settings_useSettings(path); return value; } ;// external ["wp","styleEngine"] const external_wp_styleEngine_namespaceObject = window["wp"]["styleEngine"]; ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/fluid-utils.js const DEFAULT_MAXIMUM_VIEWPORT_WIDTH = "1600px"; const DEFAULT_MINIMUM_VIEWPORT_WIDTH = "320px"; const DEFAULT_SCALE_FACTOR = 1; const DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN = 0.25; const DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX = 0.75; const DEFAULT_MINIMUM_FONT_SIZE_LIMIT = "14px"; function getComputedFluidTypographyValue({ minimumFontSize, maximumFontSize, fontSize, minimumViewportWidth = DEFAULT_MINIMUM_VIEWPORT_WIDTH, maximumViewportWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH, scaleFactor = DEFAULT_SCALE_FACTOR, minimumFontSizeLimit }) { minimumFontSizeLimit = !!getTypographyValueAndUnit(minimumFontSizeLimit) ? minimumFontSizeLimit : DEFAULT_MINIMUM_FONT_SIZE_LIMIT; if (fontSize) { const fontSizeParsed = getTypographyValueAndUnit(fontSize); if (!fontSizeParsed?.unit) { return null; } const minimumFontSizeLimitParsed = getTypographyValueAndUnit( minimumFontSizeLimit, { coerceTo: fontSizeParsed.unit } ); if (!!minimumFontSizeLimitParsed?.value && !minimumFontSize && !maximumFontSize) { if (fontSizeParsed?.value <= minimumFontSizeLimitParsed?.value) { return null; } } if (!maximumFontSize) { maximumFontSize = `${fontSizeParsed.value}${fontSizeParsed.unit}`; } if (!minimumFontSize) { const fontSizeValueInPx = fontSizeParsed.unit === "px" ? fontSizeParsed.value : fontSizeParsed.value * 16; const minimumFontSizeFactor = Math.min( Math.max( 1 - 0.075 * Math.log2(fontSizeValueInPx), DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN ), DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX ); const calculatedMinimumFontSize = roundToPrecision( fontSizeParsed.value * minimumFontSizeFactor, 3 ); if (!!minimumFontSizeLimitParsed?.value && calculatedMinimumFontSize < minimumFontSizeLimitParsed?.value) { minimumFontSize = `${minimumFontSizeLimitParsed.value}${minimumFontSizeLimitParsed.unit}`; } else { minimumFontSize = `${calculatedMinimumFontSize}${fontSizeParsed.unit}`; } } } const minimumFontSizeParsed = getTypographyValueAndUnit(minimumFontSize); const fontSizeUnit = minimumFontSizeParsed?.unit || "rem"; const maximumFontSizeParsed = getTypographyValueAndUnit(maximumFontSize, { coerceTo: fontSizeUnit }); if (!minimumFontSizeParsed || !maximumFontSizeParsed) { return null; } const minimumFontSizeRem = getTypographyValueAndUnit(minimumFontSize, { coerceTo: "rem" }); const maximumViewportWidthParsed = getTypographyValueAndUnit( maximumViewportWidth, { coerceTo: fontSizeUnit } ); const minimumViewportWidthParsed = getTypographyValueAndUnit( minimumViewportWidth, { coerceTo: fontSizeUnit } ); if (!maximumViewportWidthParsed || !minimumViewportWidthParsed || !minimumFontSizeRem) { return null; } const linearDenominator = maximumViewportWidthParsed.value - minimumViewportWidthParsed.value; if (!linearDenominator) { return null; } const minViewportWidthOffsetValue = roundToPrecision( minimumViewportWidthParsed.value / 100, 3 ); const viewportWidthOffset = roundToPrecision(minViewportWidthOffsetValue, 3) + fontSizeUnit; const linearFactor = 100 * ((maximumFontSizeParsed.value - minimumFontSizeParsed.value) / linearDenominator); const linearFactorScaled = roundToPrecision( (linearFactor || 1) * scaleFactor, 3 ); const fluidTargetFontSize = `${minimumFontSizeRem.value}${minimumFontSizeRem.unit} + ((1vw - ${viewportWidthOffset}) * ${linearFactorScaled})`; return `clamp(${minimumFontSize}, ${fluidTargetFontSize}, ${maximumFontSize})`; } function getTypographyValueAndUnit(rawValue, options = {}) { if (typeof rawValue !== "string" && typeof rawValue !== "number") { return null; } if (isFinite(rawValue)) { rawValue = `${rawValue}px`; } const { coerceTo, rootSizeValue, acceptableUnits } = { coerceTo: "", // Default browser font size. Later we could inject some JS to compute this `getComputedStyle( document.querySelector( "html" ) ).fontSize`. rootSizeValue: 16, acceptableUnits: ["rem", "px", "em"], ...options }; const acceptableUnitsGroup = acceptableUnits?.join("|"); const regexUnits = new RegExp( `^(\\d*\\.?\\d+)(${acceptableUnitsGroup}){1,1}$` ); const matches = rawValue.match(regexUnits); if (!matches || matches.length < 3) { return null; } let [, value, unit] = matches; let returnValue = parseFloat(value); if ("px" === coerceTo && ("em" === unit || "rem" === unit)) { returnValue = returnValue * rootSizeValue; unit = coerceTo; } if ("px" === unit && ("em" === coerceTo || "rem" === coerceTo)) { returnValue = returnValue / rootSizeValue; unit = coerceTo; } if (("em" === coerceTo || "rem" === coerceTo) && ("em" === unit || "rem" === unit)) { unit = coerceTo; } return { value: roundToPrecision(returnValue, 3), unit }; } function roundToPrecision(value, digits = 3) { const base = Math.pow(10, digits); return Number.isFinite(value) ? parseFloat(Math.round(value * base) / base) : void 0; } ;// ./node_modules/@wordpress/block-editor/build-module/utils/format-font-style.js function formatFontStyle(fontStyle) { if (!fontStyle) { return {}; } if (typeof fontStyle === "object") { return fontStyle; } let name; switch (fontStyle) { case "normal": name = (0,external_wp_i18n_namespaceObject._x)("Regular", "font style"); break; case "italic": name = (0,external_wp_i18n_namespaceObject._x)("Italic", "font style"); break; case "oblique": name = (0,external_wp_i18n_namespaceObject._x)("Oblique", "font style"); break; default: name = fontStyle; break; } return { name, value: fontStyle }; } ;// ./node_modules/@wordpress/block-editor/build-module/utils/format-font-weight.js function formatFontWeight(fontWeight) { if (!fontWeight) { return {}; } if (typeof fontWeight === "object") { return fontWeight; } let name; switch (fontWeight) { case "normal": case "400": name = (0,external_wp_i18n_namespaceObject._x)("Regular", "font weight"); break; case "bold": case "700": name = (0,external_wp_i18n_namespaceObject._x)("Bold", "font weight"); break; case "100": name = (0,external_wp_i18n_namespaceObject._x)("Thin", "font weight"); break; case "200": name = (0,external_wp_i18n_namespaceObject._x)("Extra Light", "font weight"); break; case "300": name = (0,external_wp_i18n_namespaceObject._x)("Light", "font weight"); break; case "500": name = (0,external_wp_i18n_namespaceObject._x)("Medium", "font weight"); break; case "600": name = (0,external_wp_i18n_namespaceObject._x)("Semi Bold", "font weight"); break; case "800": name = (0,external_wp_i18n_namespaceObject._x)("Extra Bold", "font weight"); break; case "900": name = (0,external_wp_i18n_namespaceObject._x)("Black", "font weight"); break; case "1000": name = (0,external_wp_i18n_namespaceObject._x)("Extra Black", "font weight"); break; default: name = fontWeight; break; } return { name, value: fontWeight }; } ;// ./node_modules/@wordpress/block-editor/build-module/utils/get-font-styles-and-weights.js const FONT_STYLES = [ { name: (0,external_wp_i18n_namespaceObject._x)("Regular", "font style"), value: "normal" }, { name: (0,external_wp_i18n_namespaceObject._x)("Italic", "font style"), value: "italic" } ]; const FONT_WEIGHTS = [ { name: (0,external_wp_i18n_namespaceObject._x)("Thin", "font weight"), value: "100" }, { name: (0,external_wp_i18n_namespaceObject._x)("Extra Light", "font weight"), value: "200" }, { name: (0,external_wp_i18n_namespaceObject._x)("Light", "font weight"), value: "300" }, { name: (0,external_wp_i18n_namespaceObject._x)("Regular", "font weight"), value: "400" }, { name: (0,external_wp_i18n_namespaceObject._x)("Medium", "font weight"), value: "500" }, { name: (0,external_wp_i18n_namespaceObject._x)("Semi Bold", "font weight"), value: "600" }, { name: (0,external_wp_i18n_namespaceObject._x)("Bold", "font weight"), value: "700" }, { name: (0,external_wp_i18n_namespaceObject._x)("Extra Bold", "font weight"), value: "800" }, { name: (0,external_wp_i18n_namespaceObject._x)("Black", "font weight"), value: "900" }, { name: (0,external_wp_i18n_namespaceObject._x)("Extra Black", "font weight"), value: "1000" } ]; function getFontStylesAndWeights(fontFamilyFaces) { let fontStyles = []; let fontWeights = []; const combinedStyleAndWeightOptions = []; const isSystemFont = !fontFamilyFaces || fontFamilyFaces?.length === 0; let isVariableFont = false; fontFamilyFaces?.forEach((face) => { if ("string" === typeof face.fontWeight && /\s/.test(face.fontWeight.trim())) { isVariableFont = true; let [startValue, endValue] = face.fontWeight.split(" "); startValue = parseInt(startValue.slice(0, 1)); if (endValue === "1000") { endValue = 10; } else { endValue = parseInt(endValue.slice(0, 1)); } for (let i = startValue; i <= endValue; i++) { const fontWeightValue = `${i.toString()}00`; if (!fontWeights.some( (weight) => weight.value === fontWeightValue )) { fontWeights.push(formatFontWeight(fontWeightValue)); } } } const fontWeight = formatFontWeight( "number" === typeof face.fontWeight ? face.fontWeight.toString() : face.fontWeight ); const fontStyle = formatFontStyle(face.fontStyle); if (fontStyle && Object.keys(fontStyle).length) { if (!fontStyles.some( (style) => style.value === fontStyle.value )) { fontStyles.push(fontStyle); } } if (fontWeight && Object.keys(fontWeight).length) { if (!fontWeights.some( (weight) => weight.value === fontWeight.value )) { if (!isVariableFont) { fontWeights.push(fontWeight); } } } }); if (!fontWeights.some((weight) => weight.value >= "600")) { fontWeights.push({ name: (0,external_wp_i18n_namespaceObject._x)("Bold", "font weight"), value: "700" }); } if (!fontStyles.some((style) => style.value === "italic")) { fontStyles.push({ name: (0,external_wp_i18n_namespaceObject._x)("Italic", "font style"), value: "italic" }); } if (isSystemFont) { fontStyles = FONT_STYLES; fontWeights = FONT_WEIGHTS; } fontStyles = fontStyles.length === 0 ? FONT_STYLES : fontStyles; fontWeights = fontWeights.length === 0 ? FONT_WEIGHTS : fontWeights; fontStyles.forEach(({ name: styleName, value: styleValue }) => { fontWeights.forEach(({ name: weightName, value: weightValue }) => { const optionName = styleValue === "normal" ? weightName : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Font weight name. 2: Font style name. */ (0,external_wp_i18n_namespaceObject._x)("%1$s %2$s", "font"), weightName, styleName ); combinedStyleAndWeightOptions.push({ key: `${styleValue}-${weightValue}`, name: optionName, style: { fontStyle: styleValue, fontWeight: weightValue } }); }); }); return { fontStyles, fontWeights, combinedStyleAndWeightOptions, isSystemFont, isVariableFont }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/typography-utils.js function getTypographyFontSizeValue(preset, settings) { const { size: defaultSize } = preset; if (!defaultSize || "0" === defaultSize || false === preset?.fluid) { return defaultSize; } if (!isFluidTypographyEnabled(settings?.typography) && !isFluidTypographyEnabled(preset)) { return defaultSize; } let fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings); fluidTypographySettings = typeof fluidTypographySettings?.fluid === "object" ? fluidTypographySettings?.fluid : {}; const fluidFontSizeValue = getComputedFluidTypographyValue({ minimumFontSize: preset?.fluid?.min, maximumFontSize: preset?.fluid?.max, fontSize: defaultSize, minimumFontSizeLimit: fluidTypographySettings?.minFontSize, maximumViewportWidth: fluidTypographySettings?.maxViewportWidth, minimumViewportWidth: fluidTypographySettings?.minViewportWidth }); if (!!fluidFontSizeValue) { return fluidFontSizeValue; } return defaultSize; } function isFluidTypographyEnabled(typographySettings) { const fluidSettings = typographySettings?.fluid; return true === fluidSettings || fluidSettings && typeof fluidSettings === "object" && Object.keys(fluidSettings).length > 0; } function getFluidTypographyOptionsFromSettings(settings) { const typographySettings = settings?.typography; const layoutSettings = settings?.layout; const defaultMaxViewportWidth = getTypographyValueAndUnit( layoutSettings?.wideSize ) ? layoutSettings?.wideSize : null; return isFluidTypographyEnabled(typographySettings) && defaultMaxViewportWidth ? { fluid: { maxViewportWidth: defaultMaxViewportWidth, ...typographySettings.fluid } } : { fluid: typographySettings?.fluid }; } function getMergedFontFamiliesAndFontFamilyFaces(settings, selectedFontFamily) { const fontFamiliesFromSettings = settings?.typography?.fontFamilies; const fontFamilies = ["default", "theme", "custom"].flatMap( (key) => fontFamiliesFromSettings?.[key] ?? [] ); const fontFamilyFaces = fontFamilies.find( (family) => family.fontFamily === selectedFontFamily )?.fontFace ?? []; return { fontFamilies, fontFamilyFaces }; } function findNearestFontWeight(availableFontWeights, newFontWeightValue) { newFontWeightValue = "number" === typeof newFontWeightValue ? newFontWeightValue.toString() : newFontWeightValue; if (!newFontWeightValue || typeof newFontWeightValue !== "string") { return ""; } if (!availableFontWeights || availableFontWeights.length === 0) { return newFontWeightValue; } const nearestFontWeight = availableFontWeights?.reduce( (nearest, { value: fw }) => { const currentDiff = Math.abs( parseInt(fw) - parseInt(newFontWeightValue) ); const nearestDiff = Math.abs( parseInt(nearest) - parseInt(newFontWeightValue) ); return currentDiff < nearestDiff ? fw : nearest; }, availableFontWeights[0]?.value ); return nearestFontWeight; } function findNearestFontStyle(availableFontStyles, newFontStyleValue) { if (typeof newFontStyleValue !== "string" || !newFontStyleValue) { return ""; } const validStyles = ["normal", "italic", "oblique"]; if (!validStyles.includes(newFontStyleValue)) { return ""; } if (!availableFontStyles || availableFontStyles.length === 0 || availableFontStyles.find( (style) => style.value === newFontStyleValue )) { return newFontStyleValue; } if (newFontStyleValue === "oblique" && !availableFontStyles.find((style) => style.value === "oblique")) { return "italic"; } return ""; } function findNearestStyleAndWeight(fontFamilyFaces, fontStyle, fontWeight) { let nearestFontStyle = fontStyle; let nearestFontWeight = fontWeight; const { fontStyles, fontWeights, combinedStyleAndWeightOptions } = getFontStylesAndWeights(fontFamilyFaces); const hasFontStyle = fontStyles?.some( ({ value: fs }) => fs === fontStyle ); const hasFontWeight = fontWeights?.some( ({ value: fw }) => fw?.toString() === fontWeight?.toString() ); if (!hasFontStyle) { nearestFontStyle = fontStyle ? findNearestFontStyle(fontStyles, fontStyle) : combinedStyleAndWeightOptions?.find( (option) => option.style.fontWeight === findNearestFontWeight(fontWeights, fontWeight) )?.style?.fontStyle; } if (!hasFontWeight) { nearestFontWeight = fontWeight ? findNearestFontWeight(fontWeights, fontWeight) : combinedStyleAndWeightOptions?.find( (option) => option.style.fontStyle === (nearestFontStyle || fontStyle) )?.style?.fontWeight; } return { nearestFontStyle, nearestFontWeight }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/utils.js const ROOT_BLOCK_SELECTOR = "body"; const ROOT_CSS_PROPERTIES_SELECTOR = ":root"; const PRESET_METADATA = [ { path: ["color", "palette"], valueKey: "color", cssVarInfix: "color", classes: [ { classSuffix: "color", propertyName: "color" }, { classSuffix: "background-color", propertyName: "background-color" }, { classSuffix: "border-color", propertyName: "border-color" } ] }, { path: ["color", "gradients"], valueKey: "gradient", cssVarInfix: "gradient", classes: [ { classSuffix: "gradient-background", propertyName: "background" } ] }, { path: ["color", "duotone"], valueKey: "colors", cssVarInfix: "duotone", valueFunc: ({ slug }) => `url( '#wp-duotone-${slug}' )`, classes: [] }, { path: ["shadow", "presets"], valueKey: "shadow", cssVarInfix: "shadow", classes: [] }, { path: ["typography", "fontSizes"], valueFunc: (preset, settings) => getTypographyFontSizeValue(preset, settings), valueKey: "size", cssVarInfix: "font-size", classes: [{ classSuffix: "font-size", propertyName: "font-size" }] }, { path: ["typography", "fontFamilies"], valueKey: "fontFamily", cssVarInfix: "font-family", classes: [ { classSuffix: "font-family", propertyName: "font-family" } ] }, { path: ["spacing", "spacingSizes"], valueKey: "size", cssVarInfix: "spacing", classes: [] }, { path: ["border", "radiusSizes"], valueKey: "size", cssVarInfix: "border-radius", classes: [] } ]; const STYLE_PATH_TO_CSS_VAR_INFIX = { "color.background": "color", "color.text": "color", "filter.duotone": "duotone", "elements.link.color.text": "color", "elements.link.:hover.color.text": "color", "elements.link.typography.fontFamily": "font-family", "elements.link.typography.fontSize": "font-size", "elements.button.color.text": "color", "elements.button.color.background": "color", "elements.caption.color.text": "color", "elements.button.typography.fontFamily": "font-family", "elements.button.typography.fontSize": "font-size", "elements.heading.color": "color", "elements.heading.color.background": "color", "elements.heading.typography.fontFamily": "font-family", "elements.heading.gradient": "gradient", "elements.heading.color.gradient": "gradient", "elements.h1.color": "color", "elements.h1.color.background": "color", "elements.h1.typography.fontFamily": "font-family", "elements.h1.color.gradient": "gradient", "elements.h2.color": "color", "elements.h2.color.background": "color", "elements.h2.typography.fontFamily": "font-family", "elements.h2.color.gradient": "gradient", "elements.h3.color": "color", "elements.h3.color.background": "color", "elements.h3.typography.fontFamily": "font-family", "elements.h3.color.gradient": "gradient", "elements.h4.color": "color", "elements.h4.color.background": "color", "elements.h4.typography.fontFamily": "font-family", "elements.h4.color.gradient": "gradient", "elements.h5.color": "color", "elements.h5.color.background": "color", "elements.h5.typography.fontFamily": "font-family", "elements.h5.color.gradient": "gradient", "elements.h6.color": "color", "elements.h6.color.background": "color", "elements.h6.typography.fontFamily": "font-family", "elements.h6.color.gradient": "gradient", "color.gradient": "gradient", shadow: "shadow", "typography.fontSize": "font-size", "typography.fontFamily": "font-family" }; const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = { "color.background": "backgroundColor", "color.text": "textColor", "color.gradient": "gradient", "typography.fontSize": "fontSize", "typography.fontFamily": "fontFamily" }; function useToolsPanelDropdownMenuProps() { const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); return !isMobile ? { popoverProps: { placement: "left-start", // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px) offset: 259 } } : {}; } function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) { const orderedPresetsByOrigin = [ getValueFromObjectPath(features, [ "blocks", blockName, ...presetPath ]), getValueFromObjectPath(features, presetPath) ]; for (const presetByOrigin of orderedPresetsByOrigin) { if (presetByOrigin) { const origins = ["custom", "theme", "default"]; for (const origin of origins) { const presets = presetByOrigin[origin]; if (presets) { const presetObject = presets.find( (preset) => preset[presetProperty] === presetValueValue ); if (presetObject) { if (presetProperty === "slug") { return presetObject; } const highestPresetObjectWithSameSlug = findInPresetsBy( features, blockName, presetPath, "slug", presetObject.slug ); if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) { return presetObject; } return void 0; } } } } } } function getPresetVariableFromValue(features, blockName, variableStylePath, presetPropertyValue) { if (!presetPropertyValue) { return presetPropertyValue; } const cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[variableStylePath]; const metadata = PRESET_METADATA.find( (data) => data.cssVarInfix === cssVarInfix ); if (!metadata) { return presetPropertyValue; } const { valueKey, path } = metadata; const presetObject = findInPresetsBy( features, blockName, path, valueKey, presetPropertyValue ); if (!presetObject) { return presetPropertyValue; } return `var:preset|${cssVarInfix}|${presetObject.slug}`; } function getValueFromPresetVariable(features, blockName, variable, [presetType, slug]) { const metadata = PRESET_METADATA.find( (data) => data.cssVarInfix === presetType ); if (!metadata) { return variable; } const presetObject = findInPresetsBy( features.settings, blockName, metadata.path, "slug", slug ); if (presetObject) { const { valueKey } = metadata; const result = presetObject[valueKey]; return getValueFromVariable(features, blockName, result); } return variable; } function getValueFromCustomVariable(features, blockName, variable, path) { const result = getValueFromObjectPath(features.settings, [ "blocks", blockName, "custom", ...path ]) ?? getValueFromObjectPath(features.settings, ["custom", ...path]); if (!result) { return variable; } return getValueFromVariable(features, blockName, result); } function getValueFromVariable(features, blockName, variable) { if (!variable || typeof variable !== "string") { if (typeof variable?.ref === "string") { variable = getValueFromObjectPath(features, variable.ref); if (!variable || !!variable?.ref) { return variable; } } else { return variable; } } const USER_VALUE_PREFIX = "var:"; const THEME_VALUE_PREFIX = "var(--wp--"; const THEME_VALUE_SUFFIX = ")"; let parsedVar; if (variable.startsWith(USER_VALUE_PREFIX)) { parsedVar = variable.slice(USER_VALUE_PREFIX.length).split("|"); } else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) { parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split("--"); } else { return variable; } const [type, ...path] = parsedVar; if (type === "preset") { return getValueFromPresetVariable( features, blockName, variable, path ); } if (type === "custom") { return getValueFromCustomVariable( features, blockName, variable, path ); } return variable; } function scopeSelector(scope, selector) { if (!scope || !selector) { return selector; } const scopes = scope.split(","); const selectors = selector.split(","); const selectorsScoped = []; scopes.forEach((outer) => { selectors.forEach((inner) => { selectorsScoped.push(`${outer.trim()} ${inner.trim()}`); }); }); return selectorsScoped.join(", "); } function scopeFeatureSelectors(scope, selectors) { if (!scope || !selectors) { return; } const featureSelectors = {}; Object.entries(selectors).forEach(([feature, selector]) => { if (typeof selector === "string") { featureSelectors[feature] = scopeSelector(scope, selector); } if (typeof selector === "object") { featureSelectors[feature] = {}; Object.entries(selector).forEach( ([subfeature, subfeatureSelector]) => { featureSelectors[feature][subfeature] = scopeSelector( scope, subfeatureSelector ); } ); } }); return featureSelectors; } function appendToSelector(selector, toAppend) { if (!selector.includes(",")) { return selector + toAppend; } const selectors = selector.split(","); const newSelectors = selectors.map((sel) => sel + toAppend); return newSelectors.join(","); } function areGlobalStyleConfigsEqual(original, variation) { if (typeof original !== "object" || typeof variation !== "object") { return original === variation; } return es6_default()(original?.styles, variation?.styles) && es6_default()(original?.settings, variation?.settings); } function getBlockStyleVariationSelector(variation, blockSelector) { const variationClass = `.is-style-${variation}`; if (!blockSelector) { return variationClass; } const ancestorRegex = /((?::\([^)]+\))?\s*)([^\s:]+)/; const addVariationClass = (_match, group1, group2) => { return group1 + group2 + variationClass; }; const result = blockSelector.split(",").map((part) => part.replace(ancestorRegex, addVariationClass)); return result.join(","); } function getResolvedThemeFilePath(file, themeFileURIs) { if (!file || !themeFileURIs || !Array.isArray(themeFileURIs)) { return file; } const uri = themeFileURIs.find( (themeFileUri) => themeFileUri?.name === file ); if (!uri?.href) { return file; } return uri?.href; } function getResolvedRefValue(ruleValue, tree) { if (!ruleValue || !tree) { return ruleValue; } if (typeof ruleValue !== "string" && ruleValue?.ref) { const resolvedRuleValue = (0,external_wp_styleEngine_namespaceObject.getCSSValueFromRawStyle)( getValueFromObjectPath(tree, ruleValue.ref) ); if (resolvedRuleValue?.ref) { return void 0; } if (resolvedRuleValue === void 0) { return ruleValue; } return resolvedRuleValue; } return ruleValue; } function getResolvedValue(ruleValue, tree) { if (!ruleValue || !tree) { return ruleValue; } const resolvedValue = getResolvedRefValue(ruleValue, tree); if (resolvedValue?.url) { resolvedValue.url = getResolvedThemeFilePath( resolvedValue.url, tree?._links?.["wp:theme-file"] ); } return resolvedValue; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/context.js const DEFAULT_GLOBAL_STYLES_CONTEXT = { user: {}, base: {}, merged: {}, setUserConfig: () => { } }; const GlobalStylesContext = (0,external_wp_element_namespaceObject.createContext)( DEFAULT_GLOBAL_STYLES_CONTEXT ); GlobalStylesContext.displayName = "GlobalStylesContext"; ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/hooks.js const EMPTY_CONFIG = { settings: {}, styles: {} }; const VALID_SETTINGS = [ "appearanceTools", "useRootPaddingAwareAlignments", "background.backgroundImage", "background.backgroundRepeat", "background.backgroundSize", "background.backgroundPosition", "border.color", "border.radius", "border.style", "border.width", "border.radiusSizes", "shadow.presets", "shadow.defaultPresets", "color.background", "color.button", "color.caption", "color.custom", "color.customDuotone", "color.customGradient", "color.defaultDuotone", "color.defaultGradients", "color.defaultPalette", "color.duotone", "color.gradients", "color.heading", "color.link", "color.palette", "color.text", "custom", "dimensions.aspectRatio", "dimensions.minHeight", "layout.contentSize", "layout.definitions", "layout.wideSize", "lightbox.enabled", "lightbox.allowEditing", "position.fixed", "position.sticky", "spacing.customSpacingSize", "spacing.defaultSpacingSizes", "spacing.spacingSizes", "spacing.spacingScale", "spacing.blockGap", "spacing.margin", "spacing.padding", "spacing.units", "typography.fluid", "typography.customFontSize", "typography.defaultFontSizes", "typography.dropCap", "typography.fontFamilies", "typography.fontSizes", "typography.fontStyle", "typography.fontWeight", "typography.letterSpacing", "typography.lineHeight", "typography.textAlign", "typography.textColumns", "typography.textDecoration", "typography.textTransform", "typography.writingMode" ]; const useGlobalStylesReset = () => { const { user, setUserConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); const config = { settings: user.settings, styles: user.styles }; const canReset = !!config && !es6_default()(config, EMPTY_CONFIG); return [ canReset, (0,external_wp_element_namespaceObject.useCallback)(() => setUserConfig(EMPTY_CONFIG), [setUserConfig]) ]; }; function useGlobalSetting(propertyPath, blockName, source = "all") { const { setUserConfig, ...configs } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); const appendedBlockPath = blockName ? ".blocks." + blockName : ""; const appendedPropertyPath = propertyPath ? "." + propertyPath : ""; const contextualPath = `settings${appendedBlockPath}${appendedPropertyPath}`; const globalPath = `settings${appendedPropertyPath}`; const sourceKey = source === "all" ? "merged" : source; const settingValue = (0,external_wp_element_namespaceObject.useMemo)(() => { const configToUse = configs[sourceKey]; if (!configToUse) { throw "Unsupported source"; } if (propertyPath) { return getValueFromObjectPath(configToUse, contextualPath) ?? getValueFromObjectPath(configToUse, globalPath); } let result = {}; VALID_SETTINGS.forEach((setting) => { const value = getValueFromObjectPath( configToUse, `settings${appendedBlockPath}.${setting}` ) ?? getValueFromObjectPath(configToUse, `settings.${setting}`); if (value !== void 0) { result = setImmutably(result, setting.split("."), value); } }); return result; }, [ configs, sourceKey, propertyPath, contextualPath, globalPath, appendedBlockPath ]); const setSetting = (newValue) => { setUserConfig( (currentConfig) => setImmutably(currentConfig, contextualPath.split("."), newValue) ); }; return [settingValue, setSetting]; } function useGlobalStyle(path, blockName, source = "all", { shouldDecodeEncode = true } = {}) { const { merged: mergedConfig, base: baseConfig, user: userConfig, setUserConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); const appendedPath = path ? "." + path : ""; const finalPath = !blockName ? `styles${appendedPath}` : `styles.blocks.${blockName}${appendedPath}`; const setStyle = (newValue) => { setUserConfig( (currentConfig) => setImmutably( currentConfig, finalPath.split("."), shouldDecodeEncode ? getPresetVariableFromValue( mergedConfig.settings, blockName, path, newValue ) : newValue ) ); }; let rawResult, result; switch (source) { case "all": rawResult = getValueFromObjectPath(mergedConfig, finalPath); result = shouldDecodeEncode ? getValueFromVariable(mergedConfig, blockName, rawResult) : rawResult; break; case "user": rawResult = getValueFromObjectPath(userConfig, finalPath); result = shouldDecodeEncode ? getValueFromVariable(mergedConfig, blockName, rawResult) : rawResult; break; case "base": rawResult = getValueFromObjectPath(baseConfig, finalPath); result = shouldDecodeEncode ? getValueFromVariable(baseConfig, blockName, rawResult) : rawResult; break; default: throw "Unsupported source"; } return [result, setStyle]; } function useSettingsForBlockElement(parentSettings, blockName, element) { const { supportedStyles, supports } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { return { supportedStyles: unlock( select(external_wp_blocks_namespaceObject.store) ).getSupportedStyles(blockName, element), supports: select(external_wp_blocks_namespaceObject.store).getBlockType(blockName)?.supports }; }, [blockName, element] ); return (0,external_wp_element_namespaceObject.useMemo)(() => { const updatedSettings = { ...parentSettings }; if (!supportedStyles.includes("fontSize")) { updatedSettings.typography = { ...updatedSettings.typography, fontSizes: {}, customFontSize: false, defaultFontSizes: false }; } if (!supportedStyles.includes("fontFamily")) { updatedSettings.typography = { ...updatedSettings.typography, fontFamilies: {} }; } updatedSettings.color = { ...updatedSettings.color, text: updatedSettings.color?.text && supportedStyles.includes("color"), background: updatedSettings.color?.background && (supportedStyles.includes("background") || supportedStyles.includes("backgroundColor")), button: updatedSettings.color?.button && supportedStyles.includes("buttonColor"), heading: updatedSettings.color?.heading && supportedStyles.includes("headingColor"), link: updatedSettings.color?.link && supportedStyles.includes("linkColor"), caption: updatedSettings.color?.caption && supportedStyles.includes("captionColor") }; if (!supportedStyles.includes("background")) { updatedSettings.color.gradients = []; updatedSettings.color.customGradient = false; } if (!supportedStyles.includes("filter")) { updatedSettings.color.defaultDuotone = false; updatedSettings.color.customDuotone = false; } [ "lineHeight", "fontStyle", "fontWeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "writingMode" ].forEach((key) => { if (!supportedStyles.includes(key)) { updatedSettings.typography = { ...updatedSettings.typography, [key]: false }; } }); if (!supportedStyles.includes("columnCount")) { updatedSettings.typography = { ...updatedSettings.typography, textColumns: false }; } ["contentSize", "wideSize"].forEach((key) => { if (!supportedStyles.includes(key)) { updatedSettings.layout = { ...updatedSettings.layout, [key]: false }; } }); ["padding", "margin", "blockGap"].forEach((key) => { if (!supportedStyles.includes(key)) { updatedSettings.spacing = { ...updatedSettings.spacing, [key]: false }; } const sides = Array.isArray(supports?.spacing?.[key]) ? supports?.spacing?.[key] : supports?.spacing?.[key]?.sides; if (sides?.length && updatedSettings.spacing?.[key]) { updatedSettings.spacing = { ...updatedSettings.spacing, [key]: { ...updatedSettings.spacing?.[key], sides } }; } }); ["aspectRatio", "minHeight"].forEach((key) => { if (!supportedStyles.includes(key)) { updatedSettings.dimensions = { ...updatedSettings.dimensions, [key]: false }; } }); ["radius", "color", "style", "width"].forEach((key) => { if (!supportedStyles.includes( "border" + key.charAt(0).toUpperCase() + key.slice(1) )) { updatedSettings.border = { ...updatedSettings.border, [key]: false }; } }); ["backgroundImage", "backgroundSize"].forEach((key) => { if (!supportedStyles.includes(key)) { updatedSettings.background = { ...updatedSettings.background, [key]: false }; } }); updatedSettings.shadow = supportedStyles.includes("shadow") ? updatedSettings.shadow : false; if (element) { updatedSettings.typography.textAlign = false; } return updatedSettings; }, [parentSettings, supportedStyles, supports, element]); } function useColorsPerOrigin(settings) { const customColors = settings?.color?.palette?.custom; const themeColors = settings?.color?.palette?.theme; const defaultColors = settings?.color?.palette?.default; const shouldDisplayDefaultColors = settings?.color?.defaultPalette; return (0,external_wp_element_namespaceObject.useMemo)(() => { const result = []; if (themeColors && themeColors.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Theme", "Indicates this palette comes from the theme." ), colors: themeColors }); } if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Default", "Indicates this palette comes from WordPress." ), colors: defaultColors }); } if (customColors && customColors.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Custom", "Indicates this palette is created by the user." ), colors: customColors }); } return result; }, [ customColors, themeColors, defaultColors, shouldDisplayDefaultColors ]); } function useGradientsPerOrigin(settings) { const customGradients = settings?.color?.gradients?.custom; const themeGradients = settings?.color?.gradients?.theme; const defaultGradients = settings?.color?.gradients?.default; const shouldDisplayDefaultGradients = settings?.color?.defaultGradients; return (0,external_wp_element_namespaceObject.useMemo)(() => { const result = []; if (themeGradients && themeGradients.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Theme", "Indicates this palette comes from the theme." ), gradients: themeGradients }); } if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Default", "Indicates this palette comes from WordPress." ), gradients: defaultGradients }); } if (customGradients && customGradients.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Custom", "Indicates this palette is created by the user." ), gradients: customGradients }); } return result; }, [ customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients ]); } ;// ./node_modules/clsx/dist/clsx.mjs function 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=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=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/utils.js const utils_cleanEmptyObject = (object) => { if (object === null || typeof object !== "object" || Array.isArray(object)) { return object; } const cleanedNestedObjects = Object.entries(object).map(([key, value]) => [key, utils_cleanEmptyObject(value)]).filter(([, value]) => value !== void 0); return !cleanedNestedObjects.length ? void 0 : Object.fromEntries(cleanedNestedObjects); }; function transformStyles(activeSupports, migrationPaths, result, source, index, results) { if (Object.values(activeSupports ?? {}).every( (isActive) => !isActive )) { return result; } if (results.length === 1 && result.innerBlocks.length === source.length) { return result; } let referenceBlockAttributes = source[0]?.attributes; if (results.length > 1 && source.length > 1) { if (source[index]) { referenceBlockAttributes = source[index]?.attributes; } else { return result; } } let returnBlock = result; Object.entries(activeSupports).forEach(([support, isActive]) => { if (isActive) { migrationPaths[support].forEach((path) => { const styleValue = getValueFromObjectPath( referenceBlockAttributes, path ); if (styleValue) { returnBlock = { ...returnBlock, attributes: setImmutably( returnBlock.attributes, path, styleValue ) }; } }); } }); return returnBlock; } function shouldSkipSerialization(blockNameOrType, featureSet, feature) { const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, featureSet); const skipSerialization = support?.__experimentalSkipSerialization; if (Array.isArray(skipSerialization)) { return skipSerialization.includes(feature); } return skipSerialization; } const pendingStyleOverrides = /* @__PURE__ */ new WeakMap(); function useStyleOverride({ id, css }) { return usePrivateStyleOverride({ id, css }); } function usePrivateStyleOverride({ id, css, assets, __unstableType, variation, clientId } = {}) { const { setStyleOverride, deleteStyleOverride } = unlock( (0,external_wp_data_namespaceObject.useDispatch)(store) ); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const fallbackId = (0,external_wp_element_namespaceObject.useId)(); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!css && !assets) { return; } const _id = id || fallbackId; const override = { id, css, assets, __unstableType, variation, clientId }; if (!pendingStyleOverrides.get(registry)) { pendingStyleOverrides.set(registry, []); } pendingStyleOverrides.get(registry).push([_id, override]); window.queueMicrotask(() => { if (pendingStyleOverrides.get(registry)?.length) { registry.batch(() => { pendingStyleOverrides.get(registry).forEach((args) => { setStyleOverride(...args); }); pendingStyleOverrides.set(registry, []); }); } }); return () => { const isPending = pendingStyleOverrides.get(registry)?.find(([currentId]) => currentId === _id); if (isPending) { pendingStyleOverrides.set( registry, pendingStyleOverrides.get(registry).filter(([currentId]) => currentId !== _id) ); } else { deleteStyleOverride(_id); } }; }, [ id, css, clientId, assets, __unstableType, fallbackId, setStyleOverride, deleteStyleOverride, registry ]); } function useBlockSettings(name, parentLayout) { const [ backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, defaultFontSizesEnabled, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textAlign, textColumns, textDecoration, writingMode, textTransform, letterSpacing, padding, margin, blockGap, defaultSpacingSizesEnabled, customSpacingSize, userSpacingSizes, defaultSpacingSizes, themeSpacingSizes, units, aspectRatio, minHeight, layout, borderColor, borderRadius, borderStyle, borderWidth, borderRadiusSizes, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow ] = use_settings_useSettings( "background.backgroundImage", "background.backgroundSize", "typography.fontFamilies.custom", "typography.fontFamilies.default", "typography.fontFamilies.theme", "typography.defaultFontSizes", "typography.fontSizes.custom", "typography.fontSizes.default", "typography.fontSizes.theme", "typography.customFontSize", "typography.fontStyle", "typography.fontWeight", "typography.lineHeight", "typography.textAlign", "typography.textColumns", "typography.textDecoration", "typography.writingMode", "typography.textTransform", "typography.letterSpacing", "spacing.padding", "spacing.margin", "spacing.blockGap", "spacing.defaultSpacingSizes", "spacing.customSpacingSize", "spacing.spacingSizes.custom", "spacing.spacingSizes.default", "spacing.spacingSizes.theme", "spacing.units", "dimensions.aspectRatio", "dimensions.minHeight", "layout", "border.color", "border.radius", "border.style", "border.width", "border.radiusSizes", "color.custom", "color.palette.custom", "color.customDuotone", "color.palette.theme", "color.palette.default", "color.defaultPalette", "color.defaultDuotone", "color.duotone.custom", "color.duotone.theme", "color.duotone.default", "color.gradients.custom", "color.gradients.theme", "color.gradients.default", "color.defaultGradients", "color.customGradient", "color.background", "color.link", "color.text", "color.heading", "color.button", "shadow" ); const rawSettings = (0,external_wp_element_namespaceObject.useMemo)(() => { return { background: { backgroundImage, backgroundSize }, color: { palette: { custom: customColors, theme: themeColors, default: defaultColors }, gradients: { custom: userGradientPalette, theme: themeGradientPalette, default: defaultGradientPalette }, duotone: { custom: userDuotonePalette, theme: themeDuotonePalette, default: defaultDuotonePalette }, defaultGradients, defaultPalette, defaultDuotone, custom: customColorsEnabled, customGradient: areCustomGradientsEnabled, customDuotone, background: isBackgroundEnabled, link: isLinkEnabled, heading: isHeadingEnabled, button: isButtonEnabled, text: isTextEnabled }, typography: { fontFamilies: { custom: customFontFamilies, default: defaultFontFamilies, theme: themeFontFamilies }, fontSizes: { custom: customFontSizes, default: defaultFontSizes, theme: themeFontSizes }, customFontSize, defaultFontSizes: defaultFontSizesEnabled, fontStyle, fontWeight, lineHeight, textAlign, textColumns, textDecoration, textTransform, letterSpacing, writingMode }, spacing: { spacingSizes: { custom: userSpacingSizes, default: defaultSpacingSizes, theme: themeSpacingSizes }, customSpacingSize, defaultSpacingSizes: defaultSpacingSizesEnabled, padding, margin, blockGap, units }, border: { color: borderColor, radius: borderRadius, style: borderStyle, width: borderWidth, radiusSizes: borderRadiusSizes }, dimensions: { aspectRatio, minHeight }, layout, parentLayout, shadow }; }, [ backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, defaultFontSizesEnabled, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textAlign, textColumns, textDecoration, textTransform, letterSpacing, writingMode, padding, margin, blockGap, defaultSpacingSizesEnabled, customSpacingSize, userSpacingSizes, defaultSpacingSizes, themeSpacingSizes, units, aspectRatio, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, borderRadiusSizes, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow ]); return useSettingsForBlockElement(rawSettings, name); } function createBlockEditFilter(features) { features = features.map((settings) => { return { ...settings, Edit: (0,external_wp_element_namespaceObject.memo)(settings.edit) }; }); const withBlockEditHooks = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (OriginalBlockEdit) => (props) => { const context = useBlockEditContext(); return [ ...features.map((feature, i) => { const { Edit, hasSupport, attributeKeys = [], shareWithChildBlocks } = feature; const shouldDisplayControls = context[mayDisplayControlsKey] || context[mayDisplayParentControlsKey] && shareWithChildBlocks; if (!shouldDisplayControls || !hasSupport(props.name)) { return null; } const neededProps = {}; for (const key of attributeKeys) { if (props.attributes[key]) { neededProps[key] = props.attributes[key]; } } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Edit, { name: props.name, isSelected: props.isSelected, clientId: props.clientId, setAttributes: props.setAttributes, __unstableParentLayout: props.__unstableParentLayout, ...neededProps }, i ); }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalBlockEdit, { ...props }, "edit") ]; }, "withBlockEditHooks" ); (0,external_wp_hooks_namespaceObject.addFilter)("editor.BlockEdit", "core/editor/hooks", withBlockEditHooks); } function BlockProps({ index, useBlockProps: hook, setAllWrapperProps, ...props }) { const wrapperProps = hook(props); const setWrapperProps = (next) => setAllWrapperProps((prev) => { const nextAll = [...prev]; nextAll[index] = next; return nextAll; }); (0,external_wp_element_namespaceObject.useEffect)(() => { setWrapperProps(wrapperProps); return () => { setWrapperProps(void 0); }; }); return null; } const BlockPropsPure = (0,external_wp_element_namespaceObject.memo)(BlockProps); function createBlockListBlockFilter(features) { const withBlockListBlockHooks = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (BlockListBlock) => (props) => { const [allWrapperProps, setAllWrapperProps] = (0,external_wp_element_namespaceObject.useState)( Array(features.length).fill(void 0) ); return [ ...features.map((feature, i) => { const { hasSupport, attributeKeys = [], useBlockProps, isMatch } = feature; const neededProps = {}; for (const key of attributeKeys) { if (props.attributes[key]) { neededProps[key] = props.attributes[key]; } } if ( // Skip rendering if none of the needed attributes are // set. !Object.keys(neededProps).length || !hasSupport(props.name) || isMatch && !isMatch(neededProps) ) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockPropsPure, { index: i, useBlockProps, setAllWrapperProps, name: props.name, clientId: props.clientId, ...neededProps }, i ); }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockListBlock, { ...props, wrapperProps: allWrapperProps.filter(Boolean).reduce((acc, wrapperProps) => { return { ...acc, ...wrapperProps, className: dist_clsx( acc.className, wrapperProps.className ), style: { ...acc.style, ...wrapperProps.style } }; }, props.wrapperProps || {}) }, "edit" ) ]; }, "withBlockListBlockHooks" ); (0,external_wp_hooks_namespaceObject.addFilter)( "editor.BlockListBlock", "core/editor/hooks", withBlockListBlockHooks ); } function createBlockSaveFilter(features) { function extraPropsFromHooks(props, name, attributes) { return features.reduce((accu, feature) => { const { hasSupport, attributeKeys = [], addSaveProps } = feature; const neededAttributes = {}; for (const key of attributeKeys) { if (attributes[key]) { neededAttributes[key] = attributes[key]; } } if ( // Skip rendering if none of the needed attributes are // set. !Object.keys(neededAttributes).length || !hasSupport(name) ) { return accu; } return addSaveProps(accu, name, neededAttributes); }, props); } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.getSaveContent.extraProps", "core/editor/hooks", extraPropsFromHooks, 0 ); (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.getSaveContent.extraProps", "core/editor/hooks", (props) => { if (props.hasOwnProperty("className") && !props.className) { delete props.className; } return props; } ); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/compat.js function migrateLightBlockWrapper(settings) { const { apiVersion = 1 } = settings; if (apiVersion < 2 && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "lightBlockWrapper", false)) { settings.apiVersion = 2; } return settings; } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/compat/migrateLightBlockWrapper", migrateLightBlockWrapper ); ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/groups.js const BlockControlsDefault = (0,external_wp_components_namespaceObject.createSlotFill)("BlockControls"); const BlockControlsBlock = (0,external_wp_components_namespaceObject.createSlotFill)("BlockControlsBlock"); const BlockControlsInline = (0,external_wp_components_namespaceObject.createSlotFill)("BlockFormatControls"); const BlockControlsOther = (0,external_wp_components_namespaceObject.createSlotFill)("BlockControlsOther"); const BlockControlsParent = (0,external_wp_components_namespaceObject.createSlotFill)("BlockControlsParent"); const groups = { default: BlockControlsDefault, block: BlockControlsBlock, inline: BlockControlsInline, other: BlockControlsOther, parent: BlockControlsParent }; var groups_default = groups; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/hook.js function useBlockControlsFill(group, shareWithChildBlocks) { const context = useBlockEditContext(); if (context[mayDisplayControlsKey]) { return groups_default[group]?.Fill; } if (context[mayDisplayParentControlsKey] && shareWithChildBlocks) { return groups_default.parent.Fill; } return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/fill.js function BlockControlsFill({ group = "default", controls, children, __experimentalShareWithChildBlocks = false }) { const Fill = useBlockControlsFill( group, __experimentalShareWithChildBlocks ); if (!Fill) { return null; } const innerMarkup = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ group === "default" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { controls }), children ] }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children: (fillProps) => { const { forwardedContext = [] } = fillProps; return forwardedContext.reduce( (inner, [Provider, props]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { ...props, children: inner }), innerMarkup ); } }) }); } ;// external ["wp","warning"] const external_wp_warning_namespaceObject = window["wp"]["warning"]; var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/slot.js const { ComponentsContext } = unlock(external_wp_components_namespaceObject.privateApis); function BlockControlsSlot({ group = "default", ...props }) { const toolbarState = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolbarContext); const contextState = (0,external_wp_element_namespaceObject.useContext)(ComponentsContext); const fillProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ forwardedContext: [ [external_wp_components_namespaceObject.__experimentalToolbarContext.Provider, { value: toolbarState }], [ComponentsContext.Provider, { value: contextState }] ] }), [toolbarState, contextState] ); const slotFill = groups_default[group]; const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotFill.name); if (!slotFill) { external_wp_warning_default()(`Unknown BlockControls group "${group}" provided.`); return null; } if (!fills?.length) { return null; } const { Slot } = slotFill; const slot = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, bubblesVirtually: true, fillProps }); if (group === "default") { return slot; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: slot }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/index.js const BlockControls = BlockControlsFill; BlockControls.Slot = BlockControlsSlot; const BlockFormatControls = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockControlsFill, { group: "inline", ...props }); }; BlockFormatControls.Slot = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockControlsSlot, { group: "inline", ...props }); }; var block_controls_default = BlockControls; ;// ./node_modules/@wordpress/icons/build-module/library/justify-left.js var justify_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: "M9 9v6h11V9H9zM4 20h1.5V4H4v16z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/justify-center.js var justify_center_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.5 15v5H11v-5H4V9h7V4h1.5v5h7v6h-7Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/justify-right.js var justify_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: "M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/justify-space-between.js var justify_space_between_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: "M9 15h6V9H9v6zm-5 5h1.5V4H4v16zM18.5 4v16H20V4h-1.5z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/justify-stretch.js var justify_stretch_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 4H5.5V20H4V4ZM7 10L17 10V14L7 14V10ZM20 4H18.5V20H20V4Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/arrow-right.js var arrow_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/arrow-down.js var arrow_down_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/layouts/definitions.js const LAYOUT_DEFINITIONS = { default: { name: "default", slug: "flow", className: "is-layout-flow", baseStyles: [ { selector: " > .alignleft", rules: { float: "left", "margin-inline-start": "0", "margin-inline-end": "2em" } }, { selector: " > .alignright", rules: { float: "right", "margin-inline-start": "2em", "margin-inline-end": "0" } }, { selector: " > .aligncenter", rules: { "margin-left": "auto !important", "margin-right": "auto !important" } } ], spacingStyles: [ { selector: " > :first-child", rules: { "margin-block-start": "0" } }, { selector: " > :last-child", rules: { "margin-block-end": "0" } }, { selector: " > *", rules: { "margin-block-start": null, "margin-block-end": "0" } } ] }, constrained: { name: "constrained", slug: "constrained", className: "is-layout-constrained", baseStyles: [ { selector: " > .alignleft", rules: { float: "left", "margin-inline-start": "0", "margin-inline-end": "2em" } }, { selector: " > .alignright", rules: { float: "right", "margin-inline-start": "2em", "margin-inline-end": "0" } }, { selector: " > .aligncenter", rules: { "margin-left": "auto !important", "margin-right": "auto !important" } }, { selector: " > :where(:not(.alignleft):not(.alignright):not(.alignfull))", rules: { "max-width": "var(--wp--style--global--content-size)", "margin-left": "auto !important", "margin-right": "auto !important" } }, { selector: " > .alignwide", rules: { "max-width": "var(--wp--style--global--wide-size)" } } ], spacingStyles: [ { selector: " > :first-child", rules: { "margin-block-start": "0" } }, { selector: " > :last-child", rules: { "margin-block-end": "0" } }, { selector: " > *", rules: { "margin-block-start": null, "margin-block-end": "0" } } ] }, flex: { name: "flex", slug: "flex", className: "is-layout-flex", displayMode: "flex", baseStyles: [ { selector: "", rules: { "flex-wrap": "wrap", "align-items": "center" } }, { selector: " > :is(*, div)", // :is(*, div) instead of just * increases the specificity by 001. rules: { margin: "0" } } ], spacingStyles: [ { selector: "", rules: { gap: null } } ] }, grid: { name: "grid", slug: "grid", className: "is-layout-grid", displayMode: "grid", baseStyles: [ { selector: " > :is(*, div)", // :is(*, div) instead of just * increases the specificity by 001. rules: { margin: "0" } } ], spacingStyles: [ { selector: "", rules: { gap: null } } ] } }; ;// ./node_modules/@wordpress/block-editor/build-module/layouts/utils.js function appendSelectors(selectors, append = "") { return selectors.split(",").map( (subselector) => `${subselector}${append ? ` ${append}` : ""}` ).join(","); } function getBlockGapCSS(selector, layoutDefinitions = LAYOUT_DEFINITIONS, layoutType, blockGapValue) { let output = ""; if (layoutDefinitions?.[layoutType]?.spacingStyles?.length && blockGapValue) { layoutDefinitions[layoutType].spacingStyles.forEach((gapStyle) => { output += `${appendSelectors( selector, gapStyle.selector.trim() )} { `; output += Object.entries(gapStyle.rules).map( ([cssProperty, value]) => `${cssProperty}: ${value ? value : blockGapValue}` ).join("; "); output += "; }"; }); } return output; } function getAlignmentsInfo(layout) { const { contentSize, wideSize, type = "default" } = layout; const alignmentInfo = {}; const sizeRegex = /^(?!0)\d+(px|em|rem|vw|vh|%|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)?$/i; if (sizeRegex.test(contentSize) && type === "constrained") { alignmentInfo.none = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Max %s wide"), contentSize); } if (sizeRegex.test(wideSize)) { alignmentInfo.wide = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Max %s wide"), wideSize); } return alignmentInfo; } ;// ./node_modules/@wordpress/icons/build-module/library/sides-all.js var sides_all_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.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/sides-horizontal.js var sides_horizontal_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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", style: { opacity: 0.25 } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m4.5 7.5v9h1.5v-9z" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m18 7.5v9h1.5v-9z" }) ] }); ;// ./node_modules/@wordpress/icons/build-module/library/sides-vertical.js var sides_vertical_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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", style: { opacity: 0.25 } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9z" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 19.5h9v-1.5h-9z" }) ] }); ;// ./node_modules/@wordpress/icons/build-module/library/sides-top.js var sides_top_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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", style: { opacity: 0.25 } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 6h-9v-1.5h9z" }) ] }); ;// ./node_modules/@wordpress/icons/build-module/library/sides-right.js var sides_right_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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", style: { opacity: 0.25 } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m18 16.5v-9h1.5v9z" }) ] }); ;// ./node_modules/@wordpress/icons/build-module/library/sides-bottom.js var sides_bottom_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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", style: { opacity: 0.25 } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 19.5h-9v-1.5h9z" }) ] }); ;// ./node_modules/@wordpress/icons/build-module/library/sides-left.js var sides_left_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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", style: { opacity: 0.25 } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m4.5 16.5v-9h1.5v9z" }) ] }); ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/utils.js const RANGE_CONTROL_MAX_SIZE = 8; const ALL_SIDES = ["top", "right", "bottom", "left"]; const DEFAULT_VALUES = { top: void 0, right: void 0, bottom: void 0, left: void 0 }; const ICONS = { custom: sides_all_default, axial: sides_all_default, horizontal: sides_horizontal_default, vertical: sides_vertical_default, top: sides_top_default, right: sides_right_default, bottom: sides_bottom_default, left: sides_left_default }; const LABELS = { default: (0,external_wp_i18n_namespaceObject.__)("Spacing control"), top: (0,external_wp_i18n_namespaceObject.__)("Top"), bottom: (0,external_wp_i18n_namespaceObject.__)("Bottom"), left: (0,external_wp_i18n_namespaceObject.__)("Left"), right: (0,external_wp_i18n_namespaceObject.__)("Right"), mixed: (0,external_wp_i18n_namespaceObject.__)("Mixed"), vertical: (0,external_wp_i18n_namespaceObject.__)("Vertical"), horizontal: (0,external_wp_i18n_namespaceObject.__)("Horizontal"), axial: (0,external_wp_i18n_namespaceObject.__)("Horizontal & vertical"), custom: (0,external_wp_i18n_namespaceObject.__)("Custom") }; const VIEWS = { axial: "axial", top: "top", right: "right", bottom: "bottom", left: "left", custom: "custom" }; function isValueSpacingPreset(value) { if (!value?.includes) { return false; } return value === "0" || value.includes("var:preset|spacing|"); } function getCustomValueFromPreset(value, spacingSizes) { if (!isValueSpacingPreset(value)) { return value; } const slug = getSpacingPresetSlug(value); const spacingSize = spacingSizes.find( (size) => String(size.slug) === slug ); return spacingSize?.size; } function getPresetValueFromCustomValue(value, spacingSizes) { if (!value || isValueSpacingPreset(value) || value === "0") { return value; } const spacingMatch = spacingSizes.find( (size) => String(size.size) === String(value) ); if (spacingMatch?.slug) { return `var:preset|spacing|${spacingMatch.slug}`; } return value; } function getSpacingPresetCssVar(value) { if (!value) { return; } const slug = value.match(/var:preset\|spacing\|(.+)/); if (!slug) { return value; } return `var(--wp--preset--spacing--${slug[1]})`; } function getSpacingPresetSlug(value) { if (!value) { return; } if (value === "0" || value === "default") { return value; } const slug = value.match(/var:preset\|spacing\|(.+)/); return slug ? slug[1] : void 0; } function getSliderValueFromPreset(presetValue, spacingSizes) { if (presetValue === void 0) { return 0; } const slug = parseFloat(presetValue, 10) === 0 ? "0" : getSpacingPresetSlug(presetValue); const sliderValue = spacingSizes.findIndex((spacingSize) => { return String(spacingSize.slug) === slug; }); return sliderValue !== -1 ? sliderValue : NaN; } function hasAxisSupport(sides, axis) { if (!sides || !sides.length) { return false; } const hasHorizontalSupport = sides.includes("horizontal") || sides.includes("left") && sides.includes("right"); const hasVerticalSupport = sides.includes("vertical") || sides.includes("top") && sides.includes("bottom"); if (axis === "horizontal") { return hasHorizontalSupport; } if (axis === "vertical") { return hasVerticalSupport; } return hasHorizontalSupport || hasVerticalSupport; } function hasBalancedSidesSupport(sides = []) { const counts = { top: 0, right: 0, bottom: 0, left: 0 }; sides.forEach((side) => counts[side] += 1); return (counts.top + counts.bottom) % 2 === 0 && (counts.left + counts.right) % 2 === 0; } function getInitialView(values = {}, sides) { const { top, right, bottom, left } = values; const sideValues = [top, right, bottom, left].filter(Boolean); const hasMatchingAxialValues = top === bottom && left === right && (!!top || !!left); const hasNoValuesAndBalancedSides = !sideValues.length && hasBalancedSidesSupport(sides); const hasOnlyAxialSides = sides?.includes("horizontal") && sides?.includes("vertical") && sides?.length === 2; if (hasAxisSupport(sides) && (hasMatchingAxialValues || hasNoValuesAndBalancedSides)) { return VIEWS.axial; } if (hasOnlyAxialSides && sideValues.length === 1) { let side; Object.entries(values).some(([key, value]) => { side = key; return value !== void 0; }); return side; } if (sides?.length === 1 && !sideValues.length) { return sides[0]; } return VIEWS.custom; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/gap.js function getGapBoxControlValueFromStyle(blockGapValue) { if (!blockGapValue) { return null; } const isValueString = typeof blockGapValue === "string"; return { top: isValueString ? blockGapValue : blockGapValue?.top, left: isValueString ? blockGapValue : blockGapValue?.left }; } function getGapCSSValue(blockGapValue, defaultValue = "0") { const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue); if (!blockGapBoxControlValue) { return null; } const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue; const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue; return row === column ? row : `${row} ${column}`; } ;// ./node_modules/@wordpress/icons/build-module/library/justify-top.js var justify_top_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: "M9 20h6V9H9v11zM4 4v1.5h16V4H4z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/justify-center-vertical.js var justify_center_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: "M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/justify-bottom.js var justify_bottom_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 4H9v11h6V4zM4 18.5V20h16v-1.5H4z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/justify-stretch-vertical.js var justify_stretch_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: "M4 4L20 4L20 5.5L4 5.5L4 4ZM10 7L14 7L14 17L10 17L10 7ZM20 18.5L4 18.5L4 20L20 20L20 18.5Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/justify-space-between-vertical.js var justify_space_between_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: "M7 4H17V8L7 8V4ZM7 16L17 16V20L7 20V16ZM20 11.25H4V12.75H20V11.25Z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/ui.js const BLOCK_ALIGNMENTS_CONTROLS = { top: { icon: justify_top_default, title: (0,external_wp_i18n_namespaceObject._x)("Align top", "Block vertical alignment setting") }, center: { icon: justify_center_vertical_default, title: (0,external_wp_i18n_namespaceObject._x)("Align middle", "Block vertical alignment setting") }, bottom: { icon: justify_bottom_default, title: (0,external_wp_i18n_namespaceObject._x)("Align bottom", "Block vertical alignment setting") }, stretch: { icon: justify_stretch_vertical_default, title: (0,external_wp_i18n_namespaceObject._x)("Stretch to fill", "Block vertical alignment setting") }, "space-between": { icon: justify_space_between_vertical_default, title: (0,external_wp_i18n_namespaceObject._x)("Space between", "Block vertical alignment setting") } }; const DEFAULT_CONTROLS = ["top", "center", "bottom"]; const DEFAULT_CONTROL = "top"; function BlockVerticalAlignmentUI({ value, onChange, controls = DEFAULT_CONTROLS, isCollapsed = true, isToolbar }) { function applyOrUnset(align) { return () => onChange(value === align ? void 0 : align); } const activeAlignment = BLOCK_ALIGNMENTS_CONTROLS[value]; const defaultAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[DEFAULT_CONTROL]; const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; const extraProps = isToolbar ? { isCollapsed } : {}; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( UIComponent, { icon: activeAlignment ? activeAlignment.icon : defaultAlignmentControl.icon, label: (0,external_wp_i18n_namespaceObject._x)( "Change vertical alignment", "Block vertical alignment setting label" ), controls: controls.map((control) => { return { ...BLOCK_ALIGNMENTS_CONTROLS[control], isActive: value === control, role: isCollapsed ? "menuitemradio" : void 0, onClick: applyOrUnset(control) }; }), ...extraProps } ); } var ui_default = BlockVerticalAlignmentUI; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/index.js const BlockVerticalAlignmentControl = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_default, { ...props, isToolbar: false }); }; const BlockVerticalAlignmentToolbar = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_default, { ...props, isToolbar: true }); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/ui.js const icons = { left: justify_left_default, center: justify_center_default, right: justify_right_default, "space-between": justify_space_between_default, stretch: justify_stretch_default }; function JustifyContentUI({ allowedControls = ["left", "center", "right", "space-between"], isCollapsed = true, onChange, value, popoverProps, isToolbar }) { const handleClick = (next) => { if (next === value) { onChange(void 0); } else { onChange(next); } }; const icon = value ? icons[value] : icons.left; const allControls = [ { name: "left", icon: justify_left_default, title: (0,external_wp_i18n_namespaceObject.__)("Justify items left"), isActive: "left" === value, onClick: () => handleClick("left") }, { name: "center", icon: justify_center_default, title: (0,external_wp_i18n_namespaceObject.__)("Justify items center"), isActive: "center" === value, onClick: () => handleClick("center") }, { name: "right", icon: justify_right_default, title: (0,external_wp_i18n_namespaceObject.__)("Justify items right"), isActive: "right" === value, onClick: () => handleClick("right") }, { name: "space-between", icon: justify_space_between_default, title: (0,external_wp_i18n_namespaceObject.__)("Space between items"), isActive: "space-between" === value, onClick: () => handleClick("space-between") }, { name: "stretch", icon: justify_stretch_default, title: (0,external_wp_i18n_namespaceObject.__)("Stretch items"), isActive: "stretch" === value, onClick: () => handleClick("stretch") } ]; const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; const extraProps = isToolbar ? { isCollapsed } : {}; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( UIComponent, { icon, popoverProps, label: (0,external_wp_i18n_namespaceObject.__)("Change items justification"), controls: allControls.filter( (elem) => allowedControls.includes(elem.name) ), ...extraProps } ); } var ui_ui_default = JustifyContentUI; ;// ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/index.js const JustifyContentControl = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_ui_default, { ...props, isToolbar: false }); }; const JustifyToolbar = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_ui_default, { ...props, isToolbar: true }); }; ;// ./node_modules/@wordpress/block-editor/build-module/layouts/flex.js const justifyContentMap = { left: "flex-start", right: "flex-end", center: "center", "space-between": "space-between" }; const alignItemsMap = { left: "flex-start", right: "flex-end", center: "center", stretch: "stretch" }; const verticalAlignmentMap = { top: "flex-start", center: "center", bottom: "flex-end", stretch: "stretch", "space-between": "space-between" }; const defaultAlignments = { horizontal: "center", vertical: "top" }; const flexWrapOptions = ["wrap", "nowrap"]; var flex_default = { name: "flex", label: (0,external_wp_i18n_namespaceObject.__)("Flex"), inspectorControls: function FlexLayoutInspectorControls({ layout = {}, onChange, layoutBlockSupport = {} }) { const { allowOrientation = true, allowJustification = true } = layoutBlockSupport; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [ allowJustification && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FlexLayoutJustifyContentControl, { layout, onChange } ) }), allowOrientation && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( OrientationControl, { layout, onChange } ) }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexWrapControl, { layout, onChange }) ] }); }, toolBarControls: function FlexLayoutToolbarControls({ layout = {}, onChange, layoutBlockSupport }) { const { allowVerticalAlignment = true, allowJustification = true } = layoutBlockSupport; if (!allowJustification && !allowVerticalAlignment) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_controls_default, { group: "block", __experimentalShareWithChildBlocks: true, children: [ allowJustification && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FlexLayoutJustifyContentControl, { layout, onChange, isToolbar: true } ), allowVerticalAlignment && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FlexLayoutVerticalAlignmentControl, { layout, onChange } ) ] }); }, getLayoutStyle: function getLayoutStyle({ selector, layout, style, blockName, hasBlockGapSupport, layoutDefinitions = LAYOUT_DEFINITIONS }) { const { orientation = "horizontal" } = layout; const blockGapValue = style?.spacing?.blockGap && !shouldSkipSerialization(blockName, "spacing", "blockGap") ? getGapCSSValue(style?.spacing?.blockGap, "0.5em") : void 0; const justifyContent = justifyContentMap[layout.justifyContent]; const flexWrap = flexWrapOptions.includes(layout.flexWrap) ? layout.flexWrap : "wrap"; const verticalAlignment = verticalAlignmentMap[layout.verticalAlignment]; const alignItems = alignItemsMap[layout.justifyContent] || alignItemsMap.left; let output = ""; const rules = []; if (flexWrap && flexWrap !== "wrap") { rules.push(`flex-wrap: ${flexWrap}`); } if (orientation === "horizontal") { if (verticalAlignment) { rules.push(`align-items: ${verticalAlignment}`); } if (justifyContent) { rules.push(`justify-content: ${justifyContent}`); } } else { if (verticalAlignment) { rules.push(`justify-content: ${verticalAlignment}`); } rules.push("flex-direction: column"); rules.push(`align-items: ${alignItems}`); } if (rules.length) { output = `${appendSelectors(selector)} { ${rules.join("; ")}; }`; } if (hasBlockGapSupport && blockGapValue) { output += getBlockGapCSS( selector, layoutDefinitions, "flex", blockGapValue ); } return output; }, getOrientation(layout) { const { orientation = "horizontal" } = layout; return orientation; }, getAlignments() { return []; } }; function FlexLayoutVerticalAlignmentControl({ layout, onChange }) { const { orientation = "horizontal" } = layout; const defaultVerticalAlignment = orientation === "horizontal" ? defaultAlignments.horizontal : defaultAlignments.vertical; const { verticalAlignment = defaultVerticalAlignment } = layout; const onVerticalAlignmentChange = (value) => { onChange({ ...layout, verticalAlignment: value }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockVerticalAlignmentControl, { onChange: onVerticalAlignmentChange, value: verticalAlignment, controls: orientation === "horizontal" ? ["top", "center", "bottom", "stretch"] : ["top", "center", "bottom", "space-between"] } ); } const POPOVER_PROPS = { placement: "bottom-start" }; function FlexLayoutJustifyContentControl({ layout, onChange, isToolbar = false }) { const { justifyContent = "left", orientation = "horizontal" } = layout; const onJustificationChange = (value) => { onChange({ ...layout, justifyContent: value }); }; const allowedControls = ["left", "center", "right"]; if (orientation === "horizontal") { allowedControls.push("space-between"); } else { allowedControls.push("stretch"); } if (isToolbar) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( JustifyContentControl, { allowedControls, value: justifyContent, onChange: onJustificationChange, popoverProps: POPOVER_PROPS } ); } const justificationOptions = [ { value: "left", icon: justify_left_default, label: (0,external_wp_i18n_namespaceObject.__)("Justify items left") }, { value: "center", icon: justify_center_default, label: (0,external_wp_i18n_namespaceObject.__)("Justify items center") }, { value: "right", icon: justify_right_default, label: (0,external_wp_i18n_namespaceObject.__)("Justify items right") } ]; if (orientation === "horizontal") { justificationOptions.push({ value: "space-between", icon: justify_space_between_default, label: (0,external_wp_i18n_namespaceObject.__)("Space between items") }); } else { justificationOptions.push({ value: "stretch", icon: justify_stretch_default, label: (0,external_wp_i18n_namespaceObject.__)("Stretch items") }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Justification"), value: justifyContent, onChange: onJustificationChange, className: "block-editor-hooks__flex-layout-justification-controls", children: justificationOptions.map(({ value, icon, label }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { value, icon, label }, value ); }) } ); } function FlexWrapControl({ layout, onChange }) { const { flexWrap = "wrap" } = layout; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Allow to wrap to multiple lines"), onChange: (value) => { onChange({ ...layout, flexWrap: value ? "wrap" : "nowrap" }); }, checked: flexWrap === "wrap" } ); } function OrientationControl({ layout, onChange }) { const { orientation = "horizontal", verticalAlignment, justifyContent } = layout; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, className: "block-editor-hooks__flex-layout-orientation-controls", label: (0,external_wp_i18n_namespaceObject.__)("Orientation"), value: orientation, onChange: (value) => { let newVerticalAlignment = verticalAlignment; let newJustification = justifyContent; if (value === "horizontal") { if (verticalAlignment === "space-between") { newVerticalAlignment = "center"; } if (justifyContent === "stretch") { newJustification = "left"; } } else { if (verticalAlignment === "stretch") { newVerticalAlignment = "top"; } if (justifyContent === "space-between") { newJustification = "left"; } } return onChange({ ...layout, orientation: value, verticalAlignment: newVerticalAlignment, justifyContent: newJustification }); }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { icon: arrow_right_default, value: "horizontal", label: (0,external_wp_i18n_namespaceObject.__)("Horizontal") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { icon: arrow_down_default, value: "vertical", label: (0,external_wp_i18n_namespaceObject.__)("Vertical") } ) ] } ); } ;// ./node_modules/@wordpress/block-editor/build-module/layouts/flow.js var flow_default = { name: "default", label: (0,external_wp_i18n_namespaceObject.__)("Flow"), inspectorControls: function DefaultLayoutInspectorControls() { return null; }, toolBarControls: function DefaultLayoutToolbarControls() { return null; }, getLayoutStyle: function getLayoutStyle({ selector, style, blockName, hasBlockGapSupport, layoutDefinitions = LAYOUT_DEFINITIONS }) { const blockGapStyleValue = getGapCSSValue(style?.spacing?.blockGap); let blockGapValue = ""; if (!shouldSkipSerialization(blockName, "spacing", "blockGap")) { if (blockGapStyleValue?.top) { blockGapValue = getGapCSSValue(blockGapStyleValue?.top); } else if (typeof blockGapStyleValue === "string") { blockGapValue = getGapCSSValue(blockGapStyleValue); } } let output = ""; if (hasBlockGapSupport && blockGapValue) { output += getBlockGapCSS( selector, layoutDefinitions, "default", blockGapValue ); } return output; }, getOrientation() { return "vertical"; }, getAlignments(layout, isBlockBasedTheme) { const alignmentInfo = getAlignmentsInfo(layout); if (layout.alignments !== void 0) { if (!layout.alignments.includes("none")) { layout.alignments.unshift("none"); } return layout.alignments.map((alignment) => ({ name: alignment, info: alignmentInfo[alignment] })); } const alignments = [ { name: "left" }, { name: "center" }, { name: "right" } ]; if (!isBlockBasedTheme) { const { contentSize, wideSize } = layout; if (contentSize) { alignments.unshift({ name: "full" }); } if (wideSize) { alignments.unshift({ name: "wide", info: alignmentInfo.wide }); } } alignments.unshift({ name: "none", info: alignmentInfo.none }); return alignments; } }; ;// ./node_modules/@wordpress/icons/build-module/icon/index.js var icon_default = (0,external_wp_element_namespaceObject.forwardRef)( ({ icon, size = 24, ...props }, ref) => { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { width: size, height: size, ...props, ref }); } ); ;// ./node_modules/@wordpress/icons/build-module/library/align-none.js var align_none_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 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM5 9h14v6H5V9Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/stretch-wide.js var stretch_wide_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.5H8V4h8v1.5ZM16 20H8v-1.5h8V20ZM5 9h14v6H5V9Z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/layouts/constrained.js var constrained_default = { name: "constrained", label: (0,external_wp_i18n_namespaceObject.__)("Constrained"), inspectorControls: function DefaultLayoutInspectorControls({ layout, onChange, layoutBlockSupport = {} }) { const { wideSize, contentSize, justifyContent = "center" } = layout; const { allowJustification = true, allowCustomContentAndWideSize = true } = layoutBlockSupport; const onJustificationChange = (value) => { onChange({ ...layout, justifyContent: value }); }; const justificationOptions = [ { value: "left", icon: justify_left_default, label: (0,external_wp_i18n_namespaceObject.__)("Justify items left") }, { value: "center", icon: justify_center_default, label: (0,external_wp_i18n_namespaceObject.__)("Justify items center") }, { value: "right", icon: justify_right_default, label: (0,external_wp_i18n_namespaceObject.__)("Justify items right") } ]; const [availableUnits] = use_settings_useSettings("spacing.units"); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || ["%", "px", "em", "rem", "vw"] }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, className: "block-editor-hooks__layout-constrained", children: [ allowCustomContentAndWideSize && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Content width"), labelPosition: "top", value: contentSize || wideSize || "", onChange: (nextWidth) => { nextWidth = 0 > parseFloat(nextWidth) ? "0" : nextWidth; onChange({ ...layout, contentSize: nextWidth }); }, units, prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: align_none_default }) }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Wide width"), labelPosition: "top", value: wideSize || contentSize || "", onChange: (nextWidth) => { nextWidth = 0 > parseFloat(nextWidth) ? "0" : nextWidth; onChange({ ...layout, wideSize: nextWidth }); }, units, prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: stretch_wide_default }) }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-hooks__layout-constrained-helptext", children: (0,external_wp_i18n_namespaceObject.__)( "Customize the width for all elements that are assigned to the center or wide columns." ) }) ] }), allowJustification && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Justification"), value: justifyContent, onChange: onJustificationChange, children: justificationOptions.map( ({ value, icon, label }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { value, icon, label }, value ); } ) } ) ] } ); }, toolBarControls: function DefaultLayoutToolbarControls({ layout = {}, onChange, layoutBlockSupport }) { const { allowJustification = true } = layoutBlockSupport; if (!allowJustification) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "block", __experimentalShareWithChildBlocks: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( DefaultLayoutJustifyContentControl, { layout, onChange } ) }); }, getLayoutStyle: function getLayoutStyle({ selector, layout = {}, style, blockName, hasBlockGapSupport, layoutDefinitions = LAYOUT_DEFINITIONS }) { const { contentSize, wideSize, justifyContent } = layout; const blockGapStyleValue = getGapCSSValue(style?.spacing?.blockGap); let blockGapValue = ""; if (!shouldSkipSerialization(blockName, "spacing", "blockGap")) { if (blockGapStyleValue?.top) { blockGapValue = getGapCSSValue(blockGapStyleValue?.top); } else if (typeof blockGapStyleValue === "string") { blockGapValue = getGapCSSValue(blockGapStyleValue); } } const marginLeft = justifyContent === "left" ? "0 !important" : "auto !important"; const marginRight = justifyContent === "right" ? "0 !important" : "auto !important"; let output = !!contentSize || !!wideSize ? ` ${appendSelectors( selector, "> :where(:not(.alignleft):not(.alignright):not(.alignfull))" )} { max-width: ${contentSize ?? wideSize}; margin-left: ${marginLeft}; margin-right: ${marginRight}; } ${appendSelectors(selector, "> .alignwide")} { max-width: ${wideSize ?? contentSize}; } ${appendSelectors(selector, "> .alignfull")} { max-width: none; } ` : ""; if (justifyContent === "left") { output += `${appendSelectors( selector, "> :where(:not(.alignleft):not(.alignright):not(.alignfull))" )} { margin-left: ${marginLeft}; }`; } else if (justifyContent === "right") { output += `${appendSelectors( selector, "> :where(:not(.alignleft):not(.alignright):not(.alignfull))" )} { margin-right: ${marginRight}; }`; } if (style?.spacing?.padding) { const paddingValues = (0,external_wp_styleEngine_namespaceObject.getCSSRules)(style); paddingValues.forEach((rule) => { if (rule.key === "paddingRight") { const paddingRightValue = rule.value === "0" ? "0px" : rule.value; output += ` ${appendSelectors(selector, "> .alignfull")} { margin-right: calc(${paddingRightValue} * -1); } `; } else if (rule.key === "paddingLeft") { const paddingLeftValue = rule.value === "0" ? "0px" : rule.value; output += ` ${appendSelectors(selector, "> .alignfull")} { margin-left: calc(${paddingLeftValue} * -1); } `; } }); } if (hasBlockGapSupport && blockGapValue) { output += getBlockGapCSS( selector, layoutDefinitions, "constrained", blockGapValue ); } return output; }, getOrientation() { return "vertical"; }, getAlignments(layout) { const alignmentInfo = getAlignmentsInfo(layout); if (layout.alignments !== void 0) { if (!layout.alignments.includes("none")) { layout.alignments.unshift("none"); } return layout.alignments.map((alignment) => ({ name: alignment, info: alignmentInfo[alignment] })); } const { contentSize, wideSize } = layout; const alignments = [ { name: "left" }, { name: "center" }, { name: "right" } ]; if (contentSize) { alignments.unshift({ name: "full" }); } if (wideSize) { alignments.unshift({ name: "wide", info: alignmentInfo.wide }); } alignments.unshift({ name: "none", info: alignmentInfo.none }); return alignments; } }; const constrained_POPOVER_PROPS = { placement: "bottom-start" }; function DefaultLayoutJustifyContentControl({ layout, onChange }) { const { justifyContent = "center" } = layout; const onJustificationChange = (value) => { onChange({ ...layout, justifyContent: value }); }; const allowedControls = ["left", "center", "right"]; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( JustifyContentControl, { allowedControls, value: justifyContent, onChange: onJustificationChange, popoverProps: constrained_POPOVER_PROPS } ); } ;// ./node_modules/@wordpress/block-editor/build-module/layouts/grid.js const RANGE_CONTROL_MAX_VALUES = { px: 600, "%": 100, vw: 100, vh: 100, em: 38, rem: 38, svw: 100, lvw: 100, dvw: 100, svh: 100, lvh: 100, dvh: 100, vi: 100, svi: 100, lvi: 100, dvi: 100, vb: 100, svb: 100, lvb: 100, dvb: 100, vmin: 100, svmin: 100, lvmin: 100, dvmin: 100, vmax: 100, svmax: 100, lvmax: 100, dvmax: 100 }; const units = [ { value: "px", label: "px", default: 0 }, { value: "rem", label: "rem", default: 0 }, { value: "em", label: "em", default: 0 } ]; var grid_default = { name: "grid", label: (0,external_wp_i18n_namespaceObject.__)("Grid"), inspectorControls: function GridLayoutInspectorControls({ layout = {}, onChange, layoutBlockSupport = {} }) { const { allowSizingOnChildren = false } = layoutBlockSupport; const showColumnsControl = window.__experimentalEnableGridInteractivity || !!layout?.columnCount; const showMinWidthControl = window.__experimentalEnableGridInteractivity || !layout?.columnCount; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridLayoutTypeControl, { layout, onChange } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ showColumnsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridLayoutColumnsAndRowsControl, { layout, onChange, allowSizingOnChildren } ), showMinWidthControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridLayoutMinimumWidthControl, { layout, onChange } ) ] }) ] }); }, toolBarControls: function GridLayoutToolbarControls() { return null; }, getLayoutStyle: function getLayoutStyle({ selector, layout, style, blockName, hasBlockGapSupport, layoutDefinitions = LAYOUT_DEFINITIONS }) { const { minimumColumnWidth = null, columnCount = null, rowCount = null } = layout; if (false) {} const blockGapValue = style?.spacing?.blockGap && !shouldSkipSerialization(blockName, "spacing", "blockGap") ? getGapCSSValue(style?.spacing?.blockGap, "0.5em") : void 0; let output = ""; const rules = []; if (minimumColumnWidth && columnCount > 0) { const maxValue = `max(${minimumColumnWidth}, ( 100% - (${blockGapValue || "1.2rem"}*${columnCount - 1}) ) / ${columnCount})`; rules.push( `grid-template-columns: repeat(auto-fill, minmax(${maxValue}, 1fr))`, `container-type: inline-size` ); if (rowCount) { rules.push( `grid-template-rows: repeat(${rowCount}, minmax(1rem, auto))` ); } } else if (columnCount) { rules.push( `grid-template-columns: repeat(${columnCount}, minmax(0, 1fr))` ); if (rowCount) { rules.push( `grid-template-rows: repeat(${rowCount}, minmax(1rem, auto))` ); } } else { rules.push( `grid-template-columns: repeat(auto-fill, minmax(min(${minimumColumnWidth || "12rem"}, 100%), 1fr))`, "container-type: inline-size" ); } if (rules.length) { output = `${appendSelectors(selector)} { ${rules.join( "; " )}; }`; } if (hasBlockGapSupport && blockGapValue) { output += getBlockGapCSS( selector, layoutDefinitions, "grid", blockGapValue ); } return output; }, getOrientation() { return "horizontal"; }, getAlignments() { return []; } }; function GridLayoutMinimumWidthControl({ layout, onChange }) { const { minimumColumnWidth, columnCount, isManualPlacement } = layout; const defaultValue = isManualPlacement || columnCount ? null : "12rem"; const value = minimumColumnWidth || defaultValue; const [quantity, unit = "rem"] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value); const handleSliderChange = (next) => { onChange({ ...layout, minimumColumnWidth: [next, unit].join("") }); }; const handleUnitChange = (newUnit) => { let newValue; if (["em", "rem"].includes(newUnit) && unit === "px") { newValue = (quantity / 16).toFixed(2) + newUnit; } else if (["em", "rem"].includes(unit) && newUnit === "px") { newValue = Math.round(quantity * 16) + newUnit; } onChange({ ...layout, minimumColumnWidth: newValue }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-hooks__grid-layout-minimum-width-control", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Minimum column width") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { gap: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { size: "__unstable-large", onChange: (newValue) => { onChange({ ...layout, minimumColumnWidth: newValue === "" ? void 0 : newValue }); }, onUnitChange: handleUnitChange, value, units, min: 0, label: (0,external_wp_i18n_namespaceObject.__)("Minimum column width"), hideLabelFromVision: true } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, onChange: handleSliderChange, value: quantity || 0, min: 0, max: RANGE_CONTROL_MAX_VALUES[unit] || 600, withInputField: false, label: (0,external_wp_i18n_namespaceObject.__)("Minimum column width"), hideLabelFromVision: true } ) }) ] }) ] }); } function GridLayoutColumnsAndRowsControl({ layout, onChange, allowSizingOnChildren }) { const defaultColumnCount = window.__experimentalEnableGridInteractivity ? void 0 : 3; const { columnCount = defaultColumnCount, rowCount, isManualPlacement } = layout; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-hooks__grid-layout-columns-and-rows-controls", children: [ (!window.__experimentalEnableGridInteractivity || !isManualPlacement) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Columns") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { gap: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalNumberControl, { size: "__unstable-large", onChange: (value) => { if (window.__experimentalEnableGridInteractivity) { const defaultNewColumnCount = isManualPlacement ? 1 : void 0; const newColumnCount = value === "" || value === "0" ? defaultNewColumnCount : parseInt(value, 10); onChange({ ...layout, columnCount: newColumnCount }); } else { const newColumnCount = value === "" || value === "0" ? 1 : parseInt(value, 10); onChange({ ...layout, columnCount: newColumnCount }); } }, value: columnCount, min: 1, label: (0,external_wp_i18n_namespaceObject.__)("Columns"), hideLabelFromVision: !window.__experimentalEnableGridInteractivity || !isManualPlacement } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: window.__experimentalEnableGridInteractivity && allowSizingOnChildren && isManualPlacement ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalNumberControl, { size: "__unstable-large", onChange: (value) => { const newRowCount = value === "" || value === "0" ? 1 : parseInt(value, 10); onChange({ ...layout, rowCount: newRowCount }); }, value: rowCount, min: 1, label: (0,external_wp_i18n_namespaceObject.__)("Rows") } ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, value: columnCount ?? 1, onChange: (value) => onChange({ ...layout, columnCount: value === "" || value === "0" ? 1 : value }), min: 1, max: 16, withInputField: false, label: (0,external_wp_i18n_namespaceObject.__)("Columns"), hideLabelFromVision: true } ) }) ] }) ] }) }); } function GridLayoutTypeControl({ layout, onChange }) { const { columnCount, rowCount, minimumColumnWidth, isManualPlacement } = layout; const [tempColumnCount, setTempColumnCount] = (0,external_wp_element_namespaceObject.useState)( columnCount || 3 ); const [tempRowCount, setTempRowCount] = (0,external_wp_element_namespaceObject.useState)(rowCount); const [tempMinimumColumnWidth, setTempMinimumColumnWidth] = (0,external_wp_element_namespaceObject.useState)( minimumColumnWidth || "12rem" ); const gridPlacement = isManualPlacement || !!columnCount && !window.__experimentalEnableGridInteractivity ? "manual" : "auto"; const onChangeType = (value) => { if (value === "manual") { setTempMinimumColumnWidth(minimumColumnWidth || "12rem"); } else { setTempColumnCount(columnCount || 3); setTempRowCount(rowCount); } onChange({ ...layout, columnCount: value === "manual" ? tempColumnCount : null, rowCount: value === "manual" && window.__experimentalEnableGridInteractivity ? tempRowCount : void 0, isManualPlacement: value === "manual" && window.__experimentalEnableGridInteractivity ? true : void 0, minimumColumnWidth: value === "auto" ? tempMinimumColumnWidth : null }); }; const helpText = gridPlacement === "manual" ? (0,external_wp_i18n_namespaceObject.__)( "Grid items can be manually placed in any position on the grid." ) : (0,external_wp_i18n_namespaceObject.__)( "Grid items are placed automatically depending on their order." ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Grid item position"), value: gridPlacement, onChange: onChangeType, isBlock: true, help: window.__experimentalEnableGridInteractivity ? helpText : void 0, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "auto", label: (0,external_wp_i18n_namespaceObject.__)("Auto") }, "auto" ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "manual", label: (0,external_wp_i18n_namespaceObject.__)("Manual") }, "manual" ) ] } ); } ;// ./node_modules/@wordpress/block-editor/build-module/layouts/index.js const layoutTypes = [flow_default, flex_default, constrained_default, grid_default]; function getLayoutType(name = "default") { return layoutTypes.find((layoutType) => layoutType.name === name); } function getLayoutTypes() { return layoutTypes; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/layout.js const defaultLayout = { type: "default" }; const Layout = (0,external_wp_element_namespaceObject.createContext)(defaultLayout); Layout.displayName = "BlockLayoutContext"; const LayoutProvider = Layout.Provider; function useLayout() { return (0,external_wp_element_namespaceObject.useContext)(Layout); } function LayoutStyle({ layout = {}, css, ...props }) { const layoutType = getLayoutType(layout.type); const [blockGapSupport] = use_settings_useSettings("spacing.blockGap"); const hasBlockGapSupport = blockGapSupport !== null; if (layoutType) { if (css) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { children: css }); } const layoutStyle = layoutType.getLayoutStyle?.({ hasBlockGapSupport, layout, ...props }); if (layoutStyle) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { children: layoutStyle }); } } return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/use-available-alignments.js const use_available_alignments_EMPTY_ARRAY = []; const use_available_alignments_DEFAULT_CONTROLS = ["none", "left", "center", "right", "wide", "full"]; const WIDE_CONTROLS = ["wide", "full"]; function useAvailableAlignments(controls = use_available_alignments_DEFAULT_CONTROLS) { if (!controls.includes("none")) { controls = ["none", ...controls]; } const isNoneOnly = controls.length === 1 && controls[0] === "none"; const [wideControlsEnabled, themeSupportsLayout, isBlockBasedTheme] = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (isNoneOnly) { return [false, false, false]; } const settings = select(store).getSettings(); return [ settings.alignWide ?? false, settings.supportsLayout, settings.__unstableIsBlockBasedTheme ]; }, [isNoneOnly] ); const layout = useLayout(); if (isNoneOnly) { return use_available_alignments_EMPTY_ARRAY; } const layoutType = getLayoutType(layout?.type); if (themeSupportsLayout) { const layoutAlignments = layoutType.getAlignments( layout, isBlockBasedTheme ); const alignments2 = layoutAlignments.filter( (alignment) => controls.includes(alignment.name) ); if (alignments2.length === 1 && alignments2[0].name === "none") { return use_available_alignments_EMPTY_ARRAY; } return alignments2; } if (layoutType.name !== "default" && layoutType.name !== "constrained") { return use_available_alignments_EMPTY_ARRAY; } const alignments = controls.filter((control) => { if (layout.alignments) { return layout.alignments.includes(control); } if (!wideControlsEnabled && WIDE_CONTROLS.includes(control)) { return false; } return use_available_alignments_DEFAULT_CONTROLS.includes(control); }).map((name) => ({ name })); if (alignments.length === 1 && alignments[0].name === "none") { return use_available_alignments_EMPTY_ARRAY; } return alignments; } ;// ./node_modules/@wordpress/icons/build-module/library/position-left.js var position_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: "M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/position-center.js var position_center_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 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/position-right.js var position_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: "M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/stretch-full-width.js var stretch_full_width_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 4h14v11H5V4Zm11 16H8v-1.5h8V20Z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/constants.js const constants_BLOCK_ALIGNMENTS_CONTROLS = { none: { icon: align_none_default, title: (0,external_wp_i18n_namespaceObject._x)("None", "Alignment option") }, left: { icon: position_left_default, title: (0,external_wp_i18n_namespaceObject.__)("Align left") }, center: { icon: position_center_default, title: (0,external_wp_i18n_namespaceObject.__)("Align center") }, right: { icon: position_right_default, title: (0,external_wp_i18n_namespaceObject.__)("Align right") }, wide: { icon: stretch_wide_default, title: (0,external_wp_i18n_namespaceObject.__)("Wide width") }, full: { icon: stretch_full_width_default, title: (0,external_wp_i18n_namespaceObject.__)("Full width") } }; const constants_DEFAULT_CONTROL = "none"; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/ui.js function BlockAlignmentUI({ value, onChange, controls, isToolbar, isCollapsed = true }) { const enabledControls = useAvailableAlignments(controls); const hasEnabledControls = !!enabledControls.length; if (!hasEnabledControls) { return null; } function onChangeAlignment(align) { onChange([value, "none"].includes(align) ? void 0 : align); } const activeAlignmentControl = constants_BLOCK_ALIGNMENTS_CONTROLS[value]; const defaultAlignmentControl = constants_BLOCK_ALIGNMENTS_CONTROLS[constants_DEFAULT_CONTROL]; const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; const commonProps = { icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon, label: (0,external_wp_i18n_namespaceObject.__)("Align") }; const extraProps = isToolbar ? { isCollapsed, controls: enabledControls.map(({ name: controlName }) => { return { ...constants_BLOCK_ALIGNMENTS_CONTROLS[controlName], isActive: value === controlName || !value && controlName === "none", role: isCollapsed ? "menuitemradio" : void 0, onClick: () => onChangeAlignment(controlName) }; }) } : { toggleProps: { description: (0,external_wp_i18n_namespaceObject.__)("Change alignment") }, children: ({ onClose }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { className: "block-editor-block-alignment-control__menu-group", children: enabledControls.map( ({ name: controlName, info }) => { const { icon, title } = constants_BLOCK_ALIGNMENTS_CONTROLS[controlName]; const isSelected = controlName === value || !value && controlName === "none"; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon, iconPosition: "left", className: dist_clsx( "components-dropdown-menu__menu-item", { "is-active": isSelected } ), isSelected, onClick: () => { onChangeAlignment( controlName ); onClose(); }, role: "menuitemradio", info, children: title }, controlName ); } ) }) }); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(UIComponent, { ...commonProps, ...extraProps }); } var block_alignment_control_ui_ui_default = BlockAlignmentUI; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/index.js const BlockAlignmentControl = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_alignment_control_ui_ui_default, { ...props, isToolbar: false }); }; const BlockAlignmentToolbar = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_alignment_control_ui_ui_default, { ...props, isToolbar: true }); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-editing-mode/index.js function useBlockEditingMode(mode) { const context = useBlockEditContext(); const { clientId = "" } = context; const { setBlockEditingMode, unsetBlockEditingMode } = (0,external_wp_data_namespaceObject.useDispatch)(store); const globalBlockEditingMode = (0,external_wp_data_namespaceObject.useSelect)( (select) => ( // Avoid adding the subscription if not needed! clientId ? null : select(store).getBlockEditingMode() ), [clientId] ); (0,external_wp_element_namespaceObject.useEffect)(() => { if (mode) { setBlockEditingMode(clientId, mode); } return () => { if (mode) { unsetBlockEditingMode(clientId); } }; }, [clientId, mode, setBlockEditingMode, unsetBlockEditingMode]); return clientId ? context[blockEditingModeKey] : globalBlockEditingMode; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/align.js const ALL_ALIGNMENTS = ["left", "center", "right", "wide", "full"]; const WIDE_ALIGNMENTS = ["wide", "full"]; function getValidAlignments(blockAlign, hasWideBlockSupport = true, hasWideEnabled = true) { let validAlignments; if (Array.isArray(blockAlign)) { validAlignments = ALL_ALIGNMENTS.filter( (value) => blockAlign.includes(value) ); } else if (blockAlign === true) { validAlignments = [...ALL_ALIGNMENTS]; } else { validAlignments = []; } if (!hasWideEnabled || blockAlign === true && !hasWideBlockSupport) { return validAlignments.filter( (alignment) => !WIDE_ALIGNMENTS.includes(alignment) ); } return validAlignments; } function addAttribute(settings) { if ("type" in (settings.attributes?.align ?? {})) { return settings; } if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "align")) { settings.attributes = { ...settings.attributes, align: { type: "string", // Allow for '' since it is used by the `updateAlignment` function // in toolbar controls for special cases with defined default values. enum: [...ALL_ALIGNMENTS, ""] } }; } return settings; } function BlockEditAlignmentToolbarControlsPure({ name: blockName, align, setAttributes }) { const blockAllowedAlignments = getValidAlignments( (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, "align"), (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "alignWide", true) ); const validAlignments = useAvailableAlignments( blockAllowedAlignments ).map(({ name }) => name); const blockEditingMode = useBlockEditingMode(); if (!validAlignments.length || blockEditingMode !== "default") { return null; } const updateAlignment = (nextAlign) => { if (!nextAlign) { const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); const blockDefaultAlign = blockType?.attributes?.align?.default; if (blockDefaultAlign) { nextAlign = ""; } } setAttributes({ align: nextAlign }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "block", __experimentalShareWithChildBlocks: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockAlignmentControl, { value: align, onChange: updateAlignment, controls: validAlignments } ) }); } var align_default = { shareWithChildBlocks: true, edit: BlockEditAlignmentToolbarControlsPure, useBlockProps, addSaveProps: addAssignedAlign, attributeKeys: ["align"], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "align", false); } }; function useBlockProps({ name, align }) { const blockAllowedAlignments = getValidAlignments( (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "align"), (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "alignWide", true) ); const validAlignments = useAvailableAlignments(blockAllowedAlignments); if (validAlignments.some((alignment) => alignment.name === align)) { return { "data-align": align }; } return {}; } function addAssignedAlign(props, blockType, attributes) { const { align } = attributes; const blockAlign = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, "align"); const hasWideBlockSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "alignWide", true); const isAlignValid = getValidAlignments( blockAlign, hasWideBlockSupport ).includes(align); if (isAlignValid) { props.className = dist_clsx(`align${align}`, props.className); } return props; } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/editor/align/addAttribute", addAttribute ); ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/groups.js const InspectorControlsDefault = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControls"); const InspectorControlsAdvanced = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorAdvancedControls"); const InspectorControlsBindings = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsBindings"); const InspectorControlsBackground = (0,external_wp_components_namespaceObject.createSlotFill)( "InspectorControlsBackground" ); const InspectorControlsBorder = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsBorder"); const InspectorControlsColor = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsColor"); const InspectorControlsFilter = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsFilter"); const InspectorControlsDimensions = (0,external_wp_components_namespaceObject.createSlotFill)( "InspectorControlsDimensions" ); const InspectorControlsPosition = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsPosition"); const InspectorControlsTypography = (0,external_wp_components_namespaceObject.createSlotFill)( "InspectorControlsTypography" ); const InspectorControlsListView = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsListView"); const InspectorControlsStyles = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsStyles"); const InspectorControlsEffects = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsEffects"); const groups_groups = { default: InspectorControlsDefault, advanced: InspectorControlsAdvanced, background: InspectorControlsBackground, bindings: InspectorControlsBindings, border: InspectorControlsBorder, color: InspectorControlsColor, dimensions: InspectorControlsDimensions, effects: InspectorControlsEffects, filter: InspectorControlsFilter, list: InspectorControlsListView, position: InspectorControlsPosition, settings: InspectorControlsDefault, // Alias for default. styles: InspectorControlsStyles, typography: InspectorControlsTypography }; var groups_groups_default = groups_groups; const PrivateInspectorControlsAllowedBlocks = (0,external_wp_components_namespaceObject.createSlotFill)( Symbol("PrivateInspectorControlsAllowedBlocks") ); ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/fill.js function InspectorControlsFill({ children, group = "default", __experimentalGroup, resetAllFilter }) { if (__experimentalGroup) { external_wp_deprecated_default()( "`__experimentalGroup` property in `InspectorControlsFill`", { since: "6.2", version: "6.4", alternative: "`group`" } ); group = __experimentalGroup; } const context = useBlockEditContext(); const Fill = groups_groups_default[group]?.Fill; if (!Fill) { external_wp_warning_default()(`Unknown InspectorControls group "${group}" provided.`); return null; } if (!context[mayDisplayControlsKey]) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children: (fillProps) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ToolsPanelInspectorControl, { fillProps, children, resetAllFilter } ); } }) }); } function RegisterResetAll({ resetAllFilter, children }) { const { registerResetAllFilter, deregisterResetAllFilter } = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolsPanelContext); (0,external_wp_element_namespaceObject.useEffect)(() => { if (resetAllFilter && registerResetAllFilter && deregisterResetAllFilter) { registerResetAllFilter(resetAllFilter); return () => { deregisterResetAllFilter(resetAllFilter); }; } }, [resetAllFilter, registerResetAllFilter, deregisterResetAllFilter]); return children; } function ToolsPanelInspectorControl({ children, resetAllFilter, fillProps }) { const { forwardedContext = [] } = fillProps; const innerMarkup = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RegisterResetAll, { resetAllFilter, children }); return forwardedContext.reduce( (inner, [Provider, props]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { ...props, children: inner }), innerMarkup ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/block-support-tools-panel.js function BlockSupportToolsPanel({ children, group, label }) { const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { getBlockAttributes, getMultiSelectedBlockClientIds, getSelectedBlockClientId, hasMultiSelection } = (0,external_wp_data_namespaceObject.useSelect)(store); const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const panelId = getSelectedBlockClientId(); const resetAll = (0,external_wp_element_namespaceObject.useCallback)( (resetFilters = []) => { const newAttributes = {}; const clientIds = hasMultiSelection() ? getMultiSelectedBlockClientIds() : [panelId]; clientIds.forEach((clientId) => { const { style } = getBlockAttributes(clientId); let newBlockAttributes = { style }; resetFilters.forEach((resetFilter) => { newBlockAttributes = { ...newBlockAttributes, ...resetFilter(newBlockAttributes) }; }); newBlockAttributes = { ...newBlockAttributes, style: utils_cleanEmptyObject(newBlockAttributes.style) }; newAttributes[clientId] = newBlockAttributes; }); updateBlockAttributes(clientIds, newAttributes, true); }, [ getBlockAttributes, getMultiSelectedBlockClientIds, hasMultiSelection, panelId, updateBlockAttributes ] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanel, { className: `${group}-block-support-panel`, label, resetAll, panelId, hasInnerWrapper: true, shouldRenderPlaceholderItems: true, __experimentalFirstVisibleItemClass: "first", __experimentalLastVisibleItemClass: "last", dropdownMenuProps, children }, panelId ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/block-support-slot-container.js function BlockSupportSlotContainer({ Slot, fillProps, ...props }) { const toolsPanelContext = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolsPanelContext); const computedFillProps = (0,external_wp_element_namespaceObject.useMemo)( () => ({ ...fillProps ?? {}, forwardedContext: [ ...fillProps?.forwardedContext ?? [], [external_wp_components_namespaceObject.__experimentalToolsPanelContext.Provider, { value: toolsPanelContext }] ] }), [toolsPanelContext, fillProps] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, fillProps: computedFillProps, bubblesVirtually: true }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/slot.js function InspectorControlsSlot({ __experimentalGroup, group = "default", label, fillProps, ...props }) { if (__experimentalGroup) { external_wp_deprecated_default()( "`__experimentalGroup` property in `InspectorControlsSlot`", { since: "6.2", version: "6.4", alternative: "`group`" } ); group = __experimentalGroup; } const slotFill = groups_groups_default[group]; const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotFill?.name); if (!slotFill) { external_wp_warning_default()(`Unknown InspectorControls group "${group}" provided.`); return null; } if (!fills?.length) { return null; } const { Slot } = slotFill; if (label) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockSupportToolsPanel, { group, label, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockSupportSlotContainer, { ...props, fillProps, Slot } ) }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, fillProps, bubblesVirtually: true }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/index.js const InspectorControls = InspectorControlsFill; InspectorControls.Slot = InspectorControlsSlot; const InspectorAdvancedControls = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsFill, { ...props, group: "advanced" }); }; InspectorAdvancedControls.Slot = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsSlot, { ...props, group: "advanced" }); }; InspectorAdvancedControls.slotName = "InspectorAdvancedControls"; var inspector_controls_default = InspectorControls; ;// ./node_modules/@wordpress/icons/build-module/library/reset.js var reset_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 11.5h10V13H7z" }) }); ;// external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; ;// external ["wp","dom"] const external_wp_dom_namespaceObject = window["wp"]["dom"]; ;// external ["wp","blob"] const external_wp_blob_namespaceObject = window["wp"]["blob"]; ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// ./node_modules/@wordpress/icons/build-module/library/media.js var 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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7 6.5 4 2.5-4 2.5z" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) ] }); ;// ./node_modules/@wordpress/icons/build-module/library/upload.js var upload_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/post-featured-image.js var post_featured_image_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 3H5c-.6 0-1 .4-1 1v7c0 .5.4 1 1 1h14c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1zM5.5 10.5v-.4l1.8-1.3 1.3.8c.3.2.7.2.9-.1L11 8.1l2.4 2.4H5.5zm13 0h-2.9l-4-4c-.3-.3-.8-.3-1.1 0L8.9 8l-1.2-.8c-.3-.2-.6-.2-.9 0l-1.3 1V4.5h13v6zM4 20h9v-1.5H4V20zm0-4h16v-1.5H4V16z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/media-upload/index.js const MediaUpload = () => null; var media_upload_default = (0,external_wp_components_namespaceObject.withFilters)("editor.MediaUpload")(MediaUpload); ;// ./node_modules/@wordpress/block-editor/build-module/components/media-upload/check.js function MediaUploadCheck({ fallback = null, children }) { const hasUploadPermissions = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSettings } = select(store); return !!getSettings().mediaUpload; }, []); return hasUploadPermissions ? children : fallback; } var check_default = MediaUploadCheck; ;// external ["wp","isShallowEqual"] const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); ;// ./node_modules/@wordpress/icons/build-module/library/link-off.js var link_off_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: "M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/keyboard-return.js var keyboard_return_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.734 16.106 2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.158 1.093-1.028-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js var chevron_left_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js var chevron_right_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings-drawer.js function LinkSettingsDrawer({ children, settingsOpen, setSettingsOpen }) { const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const MaybeAnimatePresence = prefersReducedMotion ? external_wp_element_namespaceObject.Fragment : external_wp_components_namespaceObject.__unstableAnimatePresence; const MaybeMotionDiv = prefersReducedMotion ? "div" : external_wp_components_namespaceObject.__unstableMotion.div; const id = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkSettingsDrawer); const settingsDrawerId = `link-control-settings-drawer-${id}`; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "block-editor-link-control__drawer-toggle", "aria-expanded": settingsOpen, onClick: () => setSettingsOpen(!settingsOpen), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small_default : chevron_right_small_default, "aria-controls": settingsDrawerId, children: (0,external_wp_i18n_namespaceObject._x)("Advanced", "Additional link settings") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeAnimatePresence, { children: settingsOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( MaybeMotionDiv, { className: "block-editor-link-control__drawer", hidden: !settingsOpen, id: settingsDrawerId, initial: "collapsed", animate: "open", exit: "collapsed", variants: { open: { opacity: 1, height: "auto" }, collapsed: { opacity: 0, height: 0 } }, transition: { duration: 0.1 }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-link-control__drawer-inner", children }) } ) }) ] }); } var settings_drawer_default = LinkSettingsDrawer; // EXTERNAL MODULE: external "React" var external_React_ = __webpack_require__(1609); ;// ./node_modules/@wordpress/block-editor/build-module/components/url-input/index.js function isFunction(maybeFunc) { return typeof maybeFunc === "function"; } class URLInput extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); this.onChange = this.onChange.bind(this); this.onFocus = this.onFocus.bind(this); this.onKeyDown = this.onKeyDown.bind(this); this.selectLink = this.selectLink.bind(this); this.handleOnClick = this.handleOnClick.bind(this); this.bindSuggestionNode = this.bindSuggestionNode.bind(this); this.autocompleteRef = props.autocompleteRef || (0,external_wp_element_namespaceObject.createRef)(); this.inputRef = props.inputRef || (0,external_wp_element_namespaceObject.createRef)(); this.updateSuggestions = (0,external_wp_compose_namespaceObject.debounce)( this.updateSuggestions.bind(this), 200 ); this.suggestionNodes = []; this.suggestionsRequest = null; this.state = { suggestions: [], showSuggestions: false, suggestionsValue: null, selectedSuggestion: null, suggestionsListboxId: "", suggestionOptionIdPrefix: "" }; } componentDidUpdate(prevProps) { const { showSuggestions, selectedSuggestion } = this.state; const { value, __experimentalShowInitialSuggestions = false } = this.props; if (showSuggestions && selectedSuggestion !== null && this.suggestionNodes[selectedSuggestion]) { this.suggestionNodes[selectedSuggestion].scrollIntoView({ behavior: "instant", block: "nearest", inline: "nearest" }); } if (prevProps.value !== value && !this.props.disableSuggestions) { if (value?.length) { this.updateSuggestions(value); } else if (__experimentalShowInitialSuggestions) { this.updateSuggestions(); } } } componentDidMount() { if (this.shouldShowInitialSuggestions()) { this.updateSuggestions(); } } componentWillUnmount() { this.suggestionsRequest?.cancel?.(); this.suggestionsRequest = null; } bindSuggestionNode(index) { return (ref) => { this.suggestionNodes[index] = ref; }; } shouldShowInitialSuggestions() { const { __experimentalShowInitialSuggestions = false, value } = this.props; return __experimentalShowInitialSuggestions && !(value && value.length); } updateSuggestions(value = "") { const { __experimentalFetchLinkSuggestions: fetchLinkSuggestions, __experimentalHandleURLSuggestions: handleURLSuggestions } = this.props; if (!fetchLinkSuggestions) { return; } const isInitialSuggestions = !value?.length; value = value.trim(); if (!isInitialSuggestions && (value.length < 2 || !handleURLSuggestions && (0,external_wp_url_namespaceObject.isURL)(value))) { this.suggestionsRequest?.cancel?.(); this.suggestionsRequest = null; this.setState({ suggestions: [], showSuggestions: false, suggestionsValue: value, selectedSuggestion: null, loading: false }); return; } this.setState({ selectedSuggestion: null, loading: true }); const request = fetchLinkSuggestions(value, { isInitialSuggestions }); request.then((suggestions) => { if (this.suggestionsRequest !== request) { return; } this.setState({ suggestions, suggestionsValue: value, loading: false, showSuggestions: !!suggestions.length }); if (!!suggestions.length) { this.props.debouncedSpeak( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)( "%d result found, use up and down arrow keys to navigate.", "%d results found, use up and down arrow keys to navigate.", suggestions.length ), suggestions.length ), "assertive" ); } else { this.props.debouncedSpeak( (0,external_wp_i18n_namespaceObject.__)("No results."), "assertive" ); } }).catch(() => { if (this.suggestionsRequest !== request) { return; } this.setState({ loading: false }); }).finally(() => { if (this.suggestionsRequest === request) { this.suggestionsRequest = null; } }); this.suggestionsRequest = request; } onChange(newValue) { this.props.onChange(newValue); } onFocus() { const { suggestions } = this.state; const { disableSuggestions, value } = this.props; if (value && !disableSuggestions && !(suggestions && suggestions.length) && this.suggestionsRequest === null) { this.updateSuggestions(value); } } onKeyDown(event) { this.props.onKeyDown?.(event); const { showSuggestions, selectedSuggestion, suggestions, loading } = this.state; if (!showSuggestions || !suggestions.length || loading) { switch (event.keyCode) { // When UP is pressed, if the caret is at the start of the text, move it to the 0 // position. case external_wp_keycodes_namespaceObject.UP: { if (0 !== event.target.selectionStart) { event.preventDefault(); event.target.setSelectionRange(0, 0); } break; } // When DOWN is pressed, if the caret is not at the end of the text, move it to the // last position. case external_wp_keycodes_namespaceObject.DOWN: { if (this.props.value.length !== event.target.selectionStart) { event.preventDefault(); event.target.setSelectionRange( this.props.value.length, this.props.value.length ); } break; } // Submitting while loading should trigger onSubmit. case external_wp_keycodes_namespaceObject.ENTER: { if (this.props.onSubmit) { event.preventDefault(); this.props.onSubmit(null, event); } break; } } return; } const suggestion = this.state.suggestions[this.state.selectedSuggestion]; switch (event.keyCode) { case external_wp_keycodes_namespaceObject.UP: { event.preventDefault(); const previousIndex = !selectedSuggestion ? suggestions.length - 1 : selectedSuggestion - 1; this.setState({ selectedSuggestion: previousIndex }); break; } case external_wp_keycodes_namespaceObject.DOWN: { event.preventDefault(); const nextIndex = selectedSuggestion === null || selectedSuggestion === suggestions.length - 1 ? 0 : selectedSuggestion + 1; this.setState({ selectedSuggestion: nextIndex }); break; } case external_wp_keycodes_namespaceObject.TAB: { if (this.state.selectedSuggestion !== null) { this.selectLink(suggestion); this.props.speak((0,external_wp_i18n_namespaceObject.__)("Link selected.")); } break; } case external_wp_keycodes_namespaceObject.ENTER: { event.preventDefault(); if (this.state.selectedSuggestion !== null) { this.selectLink(suggestion); if (this.props.onSubmit) { this.props.onSubmit(suggestion, event); } } else if (this.props.onSubmit) { this.props.onSubmit(null, event); } break; } } } selectLink(suggestion) { this.props.onChange(suggestion.url, suggestion); this.setState({ selectedSuggestion: null, showSuggestions: false }); } handleOnClick(suggestion) { this.selectLink(suggestion); this.inputRef.current.focus(); } static getDerivedStateFromProps({ value, instanceId, disableSuggestions, __experimentalShowInitialSuggestions = false }, { showSuggestions }) { let shouldShowSuggestions = showSuggestions; const hasValue = value && value.length; if (!__experimentalShowInitialSuggestions && !hasValue) { shouldShowSuggestions = false; } if (disableSuggestions === true) { shouldShowSuggestions = false; } return { showSuggestions: shouldShowSuggestions, suggestionsListboxId: `block-editor-url-input-suggestions-${instanceId}`, suggestionOptionIdPrefix: `block-editor-url-input-suggestion-${instanceId}` }; } render() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ this.renderControl(), this.renderSuggestions() ] }); } renderControl() { const { label = null, className, isFullWidth, instanceId, placeholder = (0,external_wp_i18n_namespaceObject.__)("Paste URL or type to search"), __experimentalRenderControl: renderControl, value = "", hideLabelFromVision = false, help = null, disabled = false } = this.props; const { loading, showSuggestions, selectedSuggestion, suggestionsListboxId, suggestionOptionIdPrefix } = this.state; const inputId = `url-input-control-${instanceId}`; const controlProps = { id: inputId, // Passes attribute to label for the for attribute label, className: dist_clsx("block-editor-url-input", className, { "is-full-width": isFullWidth }), hideLabelFromVision }; const inputProps = { id: inputId, value, required: true, type: "text", onChange: disabled ? () => { } : this.onChange, // Disable onChange when disabled onFocus: disabled ? () => { } : this.onFocus, // Disable onFocus when disabled placeholder, onKeyDown: disabled ? () => { } : this.onKeyDown, // Disable onKeyDown when disabled role: "combobox", "aria-label": label ? void 0 : (0,external_wp_i18n_namespaceObject.__)("URL"), // Ensure input always has an accessible label "aria-expanded": showSuggestions, "aria-autocomplete": "list", "aria-owns": suggestionsListboxId, "aria-activedescendant": selectedSuggestion !== null ? `${suggestionOptionIdPrefix}-${selectedSuggestion}` : void 0, ref: this.inputRef, disabled, suffix: this.props.suffix, help }; if (renderControl) { return renderControl(controlProps, inputProps, loading); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, ...controlProps, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { ...inputProps, __next40pxDefaultSize: true }), loading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) ] }); } renderSuggestions() { const { className, __experimentalRenderSuggestions: renderSuggestions } = this.props; const { showSuggestions, suggestions, suggestionsValue, selectedSuggestion, suggestionsListboxId, suggestionOptionIdPrefix, loading } = this.state; if (!showSuggestions || suggestions.length === 0) { return null; } const suggestionsListProps = { id: suggestionsListboxId, ref: this.autocompleteRef, role: "listbox" }; const buildSuggestionItemProps = (suggestion, index) => { return { role: "option", tabIndex: "-1", id: `${suggestionOptionIdPrefix}-${index}`, ref: this.bindSuggestionNode(index), "aria-selected": index === selectedSuggestion ? true : void 0 }; }; if (isFunction(renderSuggestions)) { return renderSuggestions({ suggestions, selectedSuggestion, suggestionsListProps, buildSuggestionItemProps, isLoading: loading, handleSuggestionClick: this.handleOnClick, isInitialSuggestions: !suggestionsValue?.length, currentInputValue: suggestionsValue }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { placement: "bottom", focusOnMount: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { ...suggestionsListProps, className: dist_clsx("block-editor-url-input__suggestions", { [`${className}__suggestions`]: className }), children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0,external_React_.createElement)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...buildSuggestionItemProps(suggestion, index), key: suggestion.id, className: dist_clsx( "block-editor-url-input__suggestion", { "is-selected": index === selectedSuggestion } ), onClick: () => this.handleOnClick(suggestion) }, suggestion.title )) } ) }); } } var url_input_default = (0,external_wp_compose_namespaceObject.compose)( external_wp_compose_namespaceObject.withSafeTimeout, external_wp_components_namespaceObject.withSpokenMessages, external_wp_compose_namespaceObject.withInstanceId, (0,external_wp_data_namespaceObject.withSelect)((select, props) => { if (isFunction(props.__experimentalFetchLinkSuggestions)) { return; } const { getSettings } = select(store); return { __experimentalFetchLinkSuggestions: getSettings().__experimentalFetchLinkSuggestions }; }) )(URLInput); ;// ./node_modules/@wordpress/icons/build-module/library/plus.js var plus_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-create-button.js const LinkControlSearchCreate = ({ searchTerm, onClick, itemProps, buttonText }) => { if (!searchTerm) { return null; } let text; if (buttonText) { text = typeof buttonText === "function" ? buttonText(searchTerm) : buttonText; } else { text = (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: search term. */ (0,external_wp_i18n_namespaceObject.__)("Create: <mark>%s</mark>"), searchTerm ), { mark: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("mark", {}) } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { ...itemProps, iconPosition: "left", icon: plus_default, className: "block-editor-link-control__search-item", onClick, children: text } ); }; var search_create_button_default = LinkControlSearchCreate; ;// ./node_modules/@wordpress/icons/build-module/library/post-list.js var post_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: "M18 5.5H6a.5.5 0 0 0-.5.5v12a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5V6a.5.5 0 0 0-.5-.5ZM6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm1 5h1.5v1.5H7V9Zm1.5 4.5H7V15h1.5v-1.5ZM10 9h7v1.5h-7V9Zm7 4.5h-7V15h7v-1.5Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/page.js var page_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ /* @__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" }), /* @__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" }) ] }); ;// ./node_modules/@wordpress/icons/build-module/library/tag.js var tag_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/category.js var category_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { 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", fillRule: "evenodd", clipRule: "evenodd" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/file.js var file_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/globe.js var globe_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8Zm6.5 8c0 .6 0 1.2-.2 1.8h-2.7c0-.6.2-1.1.2-1.8s0-1.2-.2-1.8h2.7c.2.6.2 1.1.2 1.8Zm-.9-3.2h-2.4c-.3-.9-.7-1.8-1.1-2.4-.1-.2-.2-.4-.3-.5 1.6.5 3 1.6 3.8 3ZM12.8 17c-.3.5-.6 1-.8 1.3-.2-.3-.5-.8-.8-1.3-.3-.5-.6-1.1-.8-1.7h3.3c-.2.6-.5 1.2-.8 1.7Zm-2.9-3.2c-.1-.6-.2-1.1-.2-1.8s0-1.2.2-1.8H14c.1.6.2 1.1.2 1.8s0 1.2-.2 1.8H9.9ZM11.2 7c.3-.5.6-1 .8-1.3.2.3.5.8.8 1.3.3.5.6 1.1.8 1.7h-3.3c.2-.6.5-1.2.8-1.7Zm-1-1.2c-.1.2-.2.3-.3.5-.4.7-.8 1.5-1.1 2.4H6.4c.8-1.4 2.2-2.5 3.8-3Zm-1.8 8H5.7c-.2-.6-.2-1.1-.2-1.8s0-1.2.2-1.8h2.7c0 .6-.2 1.1-.2 1.8s0 1.2.2 1.8Zm-2 1.4h2.4c.3.9.7 1.8 1.1 2.4.1.2.2.4.3.5-1.6-.5-3-1.6-3.8-3Zm7.4 3c.1-.2.2-.3.3-.5.4-.7.8-1.5 1.1-2.4h2.4c-.8 1.4-2.2 2.5-3.8 3Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/home.js var home_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/verse.js var verse_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-item.js const TYPES = { post: { icon: post_list_default, label: (0,external_wp_i18n_namespaceObject.__)("Post") }, page: { icon: page_default, label: (0,external_wp_i18n_namespaceObject.__)("Page") }, post_tag: { icon: tag_default, label: (0,external_wp_i18n_namespaceObject.__)("Tag") }, category: { icon: category_default, label: (0,external_wp_i18n_namespaceObject.__)("Category") }, attachment: { icon: file_default, label: (0,external_wp_i18n_namespaceObject.__)("Attachment") } }; function SearchItemIcon({ isURL, suggestion }) { let icon = null; if (isURL) { icon = globe_default; } else if (suggestion.type in TYPES) { icon = TYPES[suggestion.type].icon; if (suggestion.type === "page") { if (suggestion.isFrontPage) { icon = home_default; } if (suggestion.isBlogHome) { icon = verse_default; } } } if (icon) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( icon_default, { className: "block-editor-link-control__search-item-icon", icon } ); } return null; } function addLeadingSlash(url) { const trimmedURL = url?.trim(); if (!trimmedURL?.length) { return url; } return url?.replace(/^\/?/, "/"); } function removeTrailingSlash(url) { const trimmedURL = url?.trim(); if (!trimmedURL?.length) { return url; } return url?.replace(/\/$/, ""); } const partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs); const defaultTo = (d) => (v) => { return v === null || v === void 0 || v !== v ? d : v; }; function getURLForDisplay(url) { if (!url) { return url; } return (0,external_wp_compose_namespaceObject.pipe)( external_wp_url_namespaceObject.safeDecodeURI, external_wp_url_namespaceObject.getPath, defaultTo(""), partialRight(external_wp_url_namespaceObject.filterURLForDisplay, 24), removeTrailingSlash, addLeadingSlash )(url); } const LinkControlSearchItem = ({ itemProps, suggestion, searchTerm, onClick, isURL = false, shouldShowType = false }) => { const info = isURL ? (0,external_wp_i18n_namespaceObject.__)("Press ENTER to add this link") : getURLForDisplay(suggestion.url); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { ...itemProps, info, iconPosition: "left", icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SearchItemIcon, { suggestion, isURL }), onClick, shortcut: shouldShowType && getVisualTypeName(suggestion), className: "block-editor-link-control__search-item", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextHighlight, { text: (0,external_wp_dom_namespaceObject.__unstableStripHTML)(suggestion.title), highlight: searchTerm } ) } ); }; function getVisualTypeName(suggestion) { if (suggestion.isFrontPage) { return (0,external_wp_i18n_namespaceObject.__)("Front page"); } if (suggestion.isBlogHome) { return (0,external_wp_i18n_namespaceObject.__)("Blog home"); } if (suggestion.type in TYPES) { return TYPES[suggestion.type].label; } return suggestion.type; } var search_item_default = LinkControlSearchItem; const __experimentalLinkControlSearchItem = (props) => { external_wp_deprecated_default()("wp.blockEditor.__experimentalLinkControlSearchItem", { since: "6.8" }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControlSearchItem, { ...props }); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/constants.js const CREATE_TYPE = "__CREATE__"; const TEL_TYPE = "tel"; const URL_TYPE = "link"; const MAILTO_TYPE = "mailto"; const INTERNAL_TYPE = "internal"; const LINK_ENTRY_TYPES = [ URL_TYPE, MAILTO_TYPE, TEL_TYPE, INTERNAL_TYPE ]; const DEFAULT_LINK_SETTINGS = [ { id: "opensInNewTab", title: (0,external_wp_i18n_namespaceObject.__)("Open in new tab") } ]; ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-results.js function LinkControlSearchResults({ withCreateSuggestion, currentInputValue, handleSuggestionClick, suggestionsListProps, buildSuggestionItemProps, suggestions, selectedSuggestion, isLoading, isInitialSuggestions, createSuggestionButtonText, suggestionsQuery }) { const resultsListClasses = dist_clsx( "block-editor-link-control__search-results", { "is-loading": isLoading } ); const isSingleDirectEntryResult = suggestions.length === 1 && LINK_ENTRY_TYPES.includes(suggestions[0].type); const shouldShowCreateSuggestion = withCreateSuggestion && !isSingleDirectEntryResult && !isInitialSuggestions; const shouldShowSuggestionsTypes = !suggestionsQuery?.type; const labelText = isInitialSuggestions ? (0,external_wp_i18n_namespaceObject.__)("Suggestions") : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: search term. */ (0,external_wp_i18n_namespaceObject.__)('Search results for "%s"'), currentInputValue ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-link-control__search-results-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { ...suggestionsListProps, className: resultsListClasses, "aria-label": labelText, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: suggestions.map((suggestion, index) => { if (shouldShowCreateSuggestion && CREATE_TYPE === suggestion.type) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( search_create_button_default, { searchTerm: currentInputValue, buttonText: createSuggestionButtonText, onClick: () => handleSuggestionClick(suggestion), itemProps: buildSuggestionItemProps( suggestion, index ), isSelected: index === selectedSuggestion }, suggestion.type ); } if (CREATE_TYPE === suggestion.type) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( search_item_default, { itemProps: buildSuggestionItemProps( suggestion, index ), suggestion, index, onClick: () => { handleSuggestionClick(suggestion); }, isSelected: index === selectedSuggestion, isURL: LINK_ENTRY_TYPES.includes( suggestion.type ), searchTerm: currentInputValue, shouldShowType: shouldShowSuggestionsTypes, isFrontPage: suggestion?.isFrontPage, isBlogHome: suggestion?.isBlogHome }, `${suggestion.id}-${suggestion.type}` ); }) }) } ) }); } var search_results_default = LinkControlSearchResults; const __experimentalLinkControlSearchResults = (props) => { external_wp_deprecated_default()("wp.blockEditor.__experimentalLinkControlSearchResults", { since: "6.8" }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControlSearchResults, { ...props }); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/is-url-like.js function isURLLike(val) { const hasSpaces = val.includes(" "); if (hasSpaces) { return false; } const protocol = (0,external_wp_url_namespaceObject.getProtocol)(val); const protocolIsValid = (0,external_wp_url_namespaceObject.isValidProtocol)(protocol); const mayBeTLD = hasPossibleTLD(val); const isWWW = val?.startsWith("www."); const isInternal = val?.startsWith("#") && (0,external_wp_url_namespaceObject.isValidFragment)(val); return protocolIsValid || isWWW || isInternal || mayBeTLD; } function hasPossibleTLD(url, maxLength = 6) { const cleanedURL = url.split(/[?#]/)[0]; const regex = new RegExp( `(?<=\\S)\\.(?:[a-zA-Z_]{2,${maxLength}})(?:\\/|$)` ); return regex.test(cleanedURL); } ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-search-handler.js const handleNoop = () => Promise.resolve([]); const handleDirectEntry = (val) => { let type = URL_TYPE; const protocol = (0,external_wp_url_namespaceObject.getProtocol)(val) || ""; if (protocol.includes("mailto")) { type = MAILTO_TYPE; } if (protocol.includes("tel")) { type = TEL_TYPE; } if (val?.startsWith("#")) { type = INTERNAL_TYPE; } return Promise.resolve([ { id: val, title: val, url: type === "URL" ? (0,external_wp_url_namespaceObject.prependHTTP)(val) : val, type } ]); }; const handleEntitySearch = async (val, suggestionsQuery, fetchSearchSuggestions, withCreateSuggestion, pageOnFront, pageForPosts) => { const { isInitialSuggestions } = suggestionsQuery; const results = await fetchSearchSuggestions(val, suggestionsQuery); results.map((result) => { if (Number(result.id) === pageOnFront) { result.isFrontPage = true; return result; } else if (Number(result.id) === pageForPosts) { result.isBlogHome = true; return result; } return result; }); if (isInitialSuggestions) { return results; } return isURLLike(val) || !withCreateSuggestion ? results : results.concat({ // the `id` prop is intentionally omitted here because it // is never exposed as part of the component's public API. // see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316. title: val, // Must match the existing `<input>`s text value. url: val, // Must match the existing `<input>`s text value. type: CREATE_TYPE }); }; function useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion) { const { fetchSearchSuggestions, pageOnFront, pageForPosts } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getSettings } = select(store); return { pageOnFront: getSettings().pageOnFront, pageForPosts: getSettings().pageForPosts, fetchSearchSuggestions: getSettings().__experimentalFetchLinkSuggestions }; }, [] ); const directEntryHandler = allowDirectEntry ? handleDirectEntry : handleNoop; return (0,external_wp_element_namespaceObject.useCallback)( (val, { isInitialSuggestions }) => { return isURLLike(val) ? directEntryHandler(val, { isInitialSuggestions }) : handleEntitySearch( val, { ...suggestionsQuery, isInitialSuggestions }, fetchSearchSuggestions, withCreateSuggestion, pageOnFront, pageForPosts ); }, [ directEntryHandler, fetchSearchSuggestions, pageOnFront, pageForPosts, suggestionsQuery, withCreateSuggestion ] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-input.js const noopSearchHandler = () => Promise.resolve([]); const noop = () => { }; const LinkControlSearchInput = (0,external_wp_element_namespaceObject.forwardRef)( ({ value, children, currentLink = {}, className = null, placeholder = null, withCreateSuggestion = false, onCreateSuggestion = noop, onChange = noop, onSelect = noop, showSuggestions = true, renderSuggestions = (props) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(search_results_default, { ...props }), fetchSuggestions = null, allowDirectEntry = true, showInitialSuggestions = false, suggestionsQuery = {}, withURLSuggestion = true, createSuggestionButtonText, hideLabelFromVision = false, suffix, isEntity = false }, ref) => { const genericSearchHandler = useSearchHandler( suggestionsQuery, allowDirectEntry, withCreateSuggestion, withURLSuggestion ); const searchHandler = showSuggestions ? fetchSuggestions || genericSearchHandler : noopSearchHandler; const [focusedSuggestion, setFocusedSuggestion] = (0,external_wp_element_namespaceObject.useState)(); const onInputChange = (selection, suggestion) => { onChange(selection); setFocusedSuggestion(suggestion); }; const handleRenderSuggestions = (props) => renderSuggestions({ ...props, withCreateSuggestion, createSuggestionButtonText, suggestionsQuery, handleSuggestionClick: (suggestion) => { if (props.handleSuggestionClick) { props.handleSuggestionClick(suggestion); } onSuggestionSelected(suggestion); } }); const onSuggestionSelected = async (selectedSuggestion) => { let suggestion = selectedSuggestion; if (CREATE_TYPE === selectedSuggestion.type) { try { suggestion = await onCreateSuggestion( selectedSuggestion.title ); if (suggestion?.url) { onSelect(suggestion); } } catch (e) { } return; } if (allowDirectEntry || suggestion && Object.keys(suggestion).length >= 1) { const { id, url, ...restLinkProps } = currentLink ?? {}; onSelect( // Some direct entries don't have types or IDs, and we still need to clear the previous ones. { ...restLinkProps, ...suggestion }, suggestion ); } }; const _placeholder = placeholder ?? (0,external_wp_i18n_namespaceObject.__)("Search or type URL"); const label = hideLabelFromVision && placeholder !== "" ? _placeholder : (0,external_wp_i18n_namespaceObject.__)("Link"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-link-control__search-input-container", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( url_input_default, { disableSuggestions: currentLink?.url === value, label, hideLabelFromVision, className, value, onChange: onInputChange, placeholder: _placeholder, __experimentalRenderSuggestions: showSuggestions ? handleRenderSuggestions : null, __experimentalFetchLinkSuggestions: searchHandler, __experimentalHandleURLSuggestions: true, __experimentalShowInitialSuggestions: showInitialSuggestions, onSubmit: (suggestion, event) => { const hasSuggestion = suggestion || focusedSuggestion; if (!hasSuggestion && !value?.trim()?.length) { event.preventDefault(); } else { onSuggestionSelected( hasSuggestion || { url: value } ); } }, inputRef: ref, suffix, disabled: isEntity } ), children ] }); } ); var search_input_default = LinkControlSearchInput; const __experimentalLinkControlSearchInput = (props) => { external_wp_deprecated_default()("wp.blockEditor.__experimentalLinkControlSearchInput", { since: "6.8" }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControlSearchInput, { ...props }); }; ;// ./node_modules/@wordpress/icons/build-module/library/info.js var info_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, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/pencil.js var pencil_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/copy-small.js var copy_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, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z" } ) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/viewer-slot.js const { Slot: ViewerSlot, Fill: ViewerFill } = (0,external_wp_components_namespaceObject.createSlotFill)( "BlockEditorLinkControlViewer" ); var viewer_slot_default = (/* unused pure expression or super */ null && (ViewerSlot)); ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-rich-url-data.js function reducer(state, action) { switch (action.type) { case "RESOLVED": return { ...state, isFetching: false, richData: action.richData }; case "ERROR": return { ...state, isFetching: false, richData: null }; case "LOADING": return { ...state, isFetching: true }; default: throw new Error(`Unexpected action type ${action.type}`); } } function useRemoteUrlData(url) { const [state, dispatch] = (0,external_wp_element_namespaceObject.useReducer)(reducer, { richData: null, isFetching: false }); const { fetchRichUrlData } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSettings } = select(store); return { fetchRichUrlData: getSettings().__experimentalFetchRichUrlData }; }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { if (url?.length && fetchRichUrlData && typeof AbortController !== "undefined") { dispatch({ type: "LOADING" }); const controller = new window.AbortController(); const signal = controller.signal; fetchRichUrlData(url, { signal }).then((urlData) => { dispatch({ type: "RESOLVED", richData: urlData }); }).catch(() => { if (!signal.aborted) { dispatch({ type: "ERROR" }); } }); return () => { controller.abort(); }; } }, [url]); return state; } var use_rich_url_data_default = useRemoteUrlData; ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/link-preview.js function filterTitleForDisplay(title) { return title.replace(/^[a-z\-.\+]+[0-9]*:(\/\/)?/i, "").replace(/^www\./i, ""); } function LinkPreview({ value, onEditClick, hasRichPreviews = false, hasUnlinkControl = false, onRemove }) { const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_preferences_namespaceObject.store).get("core", "showIconLabels"), [] ); const showRichPreviews = hasRichPreviews ? value?.url : null; const { richData, isFetching } = use_rich_url_data_default(showRichPreviews); const hasRichData = richData && Object.keys(richData).length; const displayURL = value && (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(value.url), 24) || ""; const isEmptyURL = !value?.url?.length; const displayTitle = !isEmptyURL && (0,external_wp_dom_namespaceObject.__unstableStripHTML)(richData?.title || value?.title || displayURL); const isUrlRedundant = !value?.url || filterTitleForDisplay(displayTitle) === displayURL; let icon; if (richData?.icon) { icon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: richData?.icon, alt: "" }); } else if (isEmptyURL) { icon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: info_default, size: 32 }); } else { icon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: globe_default }); } const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(value.url, () => { createNotice("info", (0,external_wp_i18n_namespaceObject.__)("Link copied to clipboard."), { isDismissible: true, type: "snackbar" }); }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { role: "group", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Manage link"), className: dist_clsx("block-editor-link-control__search-item", { "is-current": true, "is-rich": hasRichData, "is-fetching": !!isFetching, "is-preview": true, "is-error": isEmptyURL, "is-url-title": displayTitle === displayURL }), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-link-control__search-item-top", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "span", { className: "block-editor-link-control__search-item-header", role: "figure", "aria-label": ( /* translators: Accessibility text for the link preview when editing a link. */ (0,external_wp_i18n_namespaceObject.__)("Link information") ), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { className: dist_clsx( "block-editor-link-control__search-item-icon", { "is-image": richData?.icon } ), children: icon } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-link-control__search-item-details", children: !isEmptyURL ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { className: "block-editor-link-control__search-item-title", href: value.url, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { numberOfLines: 1, children: displayTitle }) } ), !isUrlRedundant && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-link-control__search-item-info", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { numberOfLines: 1, children: displayURL }) }) ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-link-control__search-item-error-notice", children: (0,external_wp_i18n_namespaceObject.__)("Link is empty") }) }) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { icon: pencil_default, label: (0,external_wp_i18n_namespaceObject.__)("Edit link"), onClick: onEditClick, size: "compact", showTooltip: !showIconLabels } ), hasUnlinkControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { icon: link_off_default, label: (0,external_wp_i18n_namespaceObject.__)("Remove link"), onClick: onRemove, size: "compact", showTooltip: !showIconLabels } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { icon: copy_small_default, label: (0,external_wp_i18n_namespaceObject.__)("Copy link"), ref, accessibleWhenDisabled: true, disabled: isEmptyURL, size: "compact", showTooltip: !showIconLabels } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewerSlot, { fillProps: value }) ] }) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings.js const settings_noop = () => { }; const LinkControlSettings = ({ value, onChange = settings_noop, settings }) => { if (!settings || !settings.length) { return null; } const handleSettingChange = (setting) => (newValue) => { onChange({ ...value, [setting.id]: newValue }); }; const theSettings = settings.map((setting) => { if ("render" in setting) { if (typeof setting.render === "function") { const renderedContent = setting.render( setting, value, onChange ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "block-editor-link-control__setting", children: renderedContent }, setting.id ); } return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, className: "block-editor-link-control__setting", label: setting.title, onChange: handleSettingChange(setting), checked: value ? !!value[setting.id] : false, help: setting?.help }, setting.id ); }).filter(Boolean); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-link-control__settings", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Currently selected link settings") }), theSettings ] }); }; var settings_default = LinkControlSettings; ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-create-page.js function useCreatePage(handleCreatePage) { const cancelableCreateSuggestion = (0,external_wp_element_namespaceObject.useRef)(); const [isCreatingPage, setIsCreatingPage] = (0,external_wp_element_namespaceObject.useState)(false); const [errorMessage, setErrorMessage] = (0,external_wp_element_namespaceObject.useState)(null); const createPage = async function(suggestionTitle) { setIsCreatingPage(true); setErrorMessage(null); try { cancelableCreateSuggestion.current = makeCancelable( // Using Promise.resolve to allow createSuggestion to return a // non-Promise based value. Promise.resolve(handleCreatePage(suggestionTitle)) ); return await cancelableCreateSuggestion.current.promise; } catch (error) { if (error && error.isCanceled) { return; } setErrorMessage( error.message || (0,external_wp_i18n_namespaceObject.__)( "An unknown error occurred during creation. Please try again." ) ); throw error; } finally { setIsCreatingPage(false); } }; (0,external_wp_element_namespaceObject.useEffect)(() => { return () => { if (cancelableCreateSuggestion.current) { cancelableCreateSuggestion.current.cancel(); } }; }, []); return { createPage, isCreatingPage, errorMessage }; } const makeCancelable = (promise) => { let hasCanceled_ = false; const wrappedPromise = new Promise((resolve, reject) => { promise.then( (val) => hasCanceled_ ? reject({ isCanceled: true }) : resolve(val), (error) => hasCanceled_ ? reject({ isCanceled: true }) : reject(error) ); }); return { promise: wrappedPromise, cancel() { hasCanceled_ = true; } }; }; // EXTERNAL MODULE: ./node_modules/fast-deep-equal/index.js var fast_deep_equal = __webpack_require__(5215); var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal); ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-internal-value.js function useInternalValue(value) { const [internalValue, setInternalValue] = (0,external_wp_element_namespaceObject.useState)(value || {}); const [previousValue, setPreviousValue] = (0,external_wp_element_namespaceObject.useState)(value); if (!fast_deep_equal_default()(value, previousValue)) { setPreviousValue(value); setInternalValue(value); } const setInternalURLInputValue = (nextValue) => { setInternalValue({ ...internalValue, url: nextValue }); }; const setInternalTextInputValue = (nextValue) => { setInternalValue({ ...internalValue, title: nextValue }); }; const createSetInternalSettingValueHandler = (settingsKeys) => (nextValue) => { const settingsUpdates = Object.keys(nextValue).reduce( (acc, key) => { if (settingsKeys.includes(key)) { acc[key] = nextValue[key]; } return acc; }, {} ); setInternalValue({ ...internalValue, ...settingsUpdates }); }; return [ internalValue, setInternalValue, setInternalURLInputValue, setInternalTextInputValue, createSetInternalSettingValueHandler ]; } ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/index.js const link_control_noop = () => { }; const PREFERENCE_SCOPE = "core/block-editor"; const PREFERENCE_KEY = "linkControlSettingsDrawer"; function LinkControl({ searchInputPlaceholder, value, settings = DEFAULT_LINK_SETTINGS, onChange = link_control_noop, onRemove, onCancel, noDirectEntry = false, showSuggestions = true, showInitialSuggestions, forceIsEditingLink, createSuggestion, withCreateSuggestion, inputValue: propInputValue = "", suggestionsQuery = {}, noURLSuggestion = false, createSuggestionButtonText, hasRichPreviews = false, hasTextControl = false, renderControlBottom = null, handleEntities = false }) { if (withCreateSuggestion === void 0 && createSuggestion) { withCreateSuggestion = true; } const [settingsOpen, setSettingsOpen] = (0,external_wp_element_namespaceObject.useState)(false); const { advancedSettingsPreference } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const prefsStore = select(external_wp_preferences_namespaceObject.store); return { advancedSettingsPreference: prefsStore.get(PREFERENCE_SCOPE, PREFERENCE_KEY) ?? false }; }, []); const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const setSettingsOpenWithPreference = (prefVal) => { if (setPreference) { setPreference(PREFERENCE_SCOPE, PREFERENCE_KEY, prefVal); } setSettingsOpen(prefVal); }; const isSettingsOpen = advancedSettingsPreference || settingsOpen; const isMountingRef = (0,external_wp_element_namespaceObject.useRef)(true); const wrapperNode = (0,external_wp_element_namespaceObject.useRef)(); const textInputRef = (0,external_wp_element_namespaceObject.useRef)(); const searchInputRef = (0,external_wp_element_namespaceObject.useRef)(); const isEndingEditWithFocusRef = (0,external_wp_element_namespaceObject.useRef)(false); const settingsKeys = settings.map(({ id }) => id); const [ internalControlValue, setInternalControlValue, setInternalURLInputValue, setInternalTextInputValue, createSetInternalSettingValueHandler ] = useInternalValue(value); const isEntity = handleEntities && !!internalControlValue?.id; const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkControl, "link-control"); const helpTextId = isEntity ? `${baseId}__help` : null; const valueHasChanges = value && !(0,external_wp_isShallowEqual_namespaceObject.isShallowEqualObjects)(internalControlValue, value); const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)( forceIsEditingLink !== void 0 ? forceIsEditingLink : !value || !value.url ); const { createPage, isCreatingPage, errorMessage } = useCreatePage(createSuggestion); (0,external_wp_element_namespaceObject.useEffect)(() => { if (forceIsEditingLink === void 0) { return; } setIsEditingLink(forceIsEditingLink); }, [forceIsEditingLink]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isMountingRef.current) { return; } const nextFocusTarget = external_wp_dom_namespaceObject.focus.focusable.find(wrapperNode.current)[0] || wrapperNode.current; nextFocusTarget.focus(); isEndingEditWithFocusRef.current = false; }, [isEditingLink, isCreatingPage]); (0,external_wp_element_namespaceObject.useEffect)(() => { isMountingRef.current = false; return () => { isMountingRef.current = true; }; }, []); const hasLinkValue = value?.url?.trim()?.length > 0; const stopEditing = () => { isEndingEditWithFocusRef.current = !!wrapperNode.current?.contains( wrapperNode.current.ownerDocument.activeElement ); setIsEditingLink(false); }; const handleSelectSuggestion = (updatedValue) => { const nonSettingsChanges = Object.keys(updatedValue).reduce( (acc, key) => { if (!settingsKeys.includes(key)) { acc[key] = updatedValue[key]; } return acc; }, {} ); onChange({ ...internalControlValue, ...nonSettingsChanges, // As title is not a setting, it must be manually applied // in such a way as to preserve the users changes over // any "title" value provided by the "suggestion". title: internalControlValue?.title || updatedValue?.title }); stopEditing(); }; const handleSubmit = () => { if (valueHasChanges) { onChange({ ...value, ...internalControlValue, url: currentUrlInputValue }); } stopEditing(); }; const handleSubmitWithEnter = (event) => { const { keyCode } = event; if (keyCode === external_wp_keycodes_namespaceObject.ENTER && !currentInputIsEmpty) { event.preventDefault(); handleSubmit(); } }; const resetInternalValues = () => { setInternalControlValue(value); }; const handleCancel = (event) => { event.preventDefault(); event.stopPropagation(); resetInternalValues(); if (hasLinkValue) { stopEditing(); } else { onRemove?.(); } onCancel?.(); }; const [shouldFocusSearchInput, setShouldFocusSearchInput] = (0,external_wp_element_namespaceObject.useState)(false); const handleUnlink = () => { const { id, kind, type, ...restValue } = internalControlValue; setInternalControlValue({ ...restValue, id: void 0, kind: void 0, type: void 0, url: void 0 }); setShouldFocusSearchInput(true); }; (0,external_wp_element_namespaceObject.useEffect)(() => { if (shouldFocusSearchInput) { searchInputRef.current?.focus(); setShouldFocusSearchInput(false); } }, [shouldFocusSearchInput]); const currentUrlInputValue = propInputValue || internalControlValue?.url || ""; const currentInputIsEmpty = !currentUrlInputValue?.trim()?.length; const shownUnlinkControl = onRemove && value && !isEditingLink && !isCreatingPage; const showActions = isEditingLink && hasLinkValue; const showTextControl = hasLinkValue && hasTextControl; const isEditing = (isEditingLink || !value) && !isCreatingPage; const isDisabled = !valueHasChanges || currentInputIsEmpty; const showSettings = !!settings?.length && isEditingLink && hasLinkValue; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { tabIndex: -1, ref: wrapperNode, className: "block-editor-link-control", children: [ isCreatingPage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-link-control__loading", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), " ", (0,external_wp_i18n_namespaceObject.__)("Creating"), "\u2026" ] }), isEditing && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: dist_clsx({ "block-editor-link-control__search-input-wrapper": true, "has-text-control": showTextControl, "has-actions": showActions }), children: [ showTextControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, ref: textInputRef, className: "block-editor-link-control__field block-editor-link-control__text-content", label: (0,external_wp_i18n_namespaceObject.__)("Text"), value: internalControlValue?.title, onChange: setInternalTextInputValue, onKeyDown: handleSubmitWithEnter, __next40pxDefaultSize: true } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( search_input_default, { ref: searchInputRef, currentLink: value, className: "block-editor-link-control__field block-editor-link-control__search-input", placeholder: searchInputPlaceholder, value: currentUrlInputValue, withCreateSuggestion, onCreateSuggestion: createPage, onChange: setInternalURLInputValue, onSelect: handleSelectSuggestion, showInitialSuggestions, allowDirectEntry: !noDirectEntry, showSuggestions, suggestionsQuery, withURLSuggestion: !noURLSuggestion, createSuggestionButtonText, hideLabelFromVision: !showTextControl, isEntity, suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SearchSuffixControl, { isEntity, showActions, isDisabled, onUnlink: handleUnlink, onSubmit: handleSubmit, helpTextId } ) } ), isEntity && helpTextId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "p", { id: helpTextId, className: "block-editor-link-control__help", children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: entity type (e.g., page, post) */ (0,external_wp_i18n_namespaceObject.__)("Synced with the selected %s."), internalControlValue?.type || "item" ) } ) ] } ), errorMessage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Notice, { className: "block-editor-link-control__search-error", status: "error", isDismissible: false, children: errorMessage } ) ] }), value && !isEditingLink && !isCreatingPage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( LinkPreview, { value, onEditClick: () => setIsEditingLink(true), hasRichPreviews, hasUnlinkControl: shownUnlinkControl, onRemove: () => { onRemove(); setIsEditingLink(true); } }, value?.url ), showSettings && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-link-control__tools", children: !currentInputIsEmpty && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( settings_drawer_default, { settingsOpen: isSettingsOpen, setSettingsOpen: setSettingsOpenWithPreference, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( settings_default, { value: internalControlValue, settings, onChange: createSetInternalSettingValueHandler( settingsKeys ) } ) } ) }), showActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", className: "block-editor-link-control__search-actions", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: handleCancel, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: isDisabled ? link_control_noop : handleSubmit, className: "block-editor-link-control__search-submit", "aria-disabled": isDisabled, children: (0,external_wp_i18n_namespaceObject.__)("Apply") } ) ] } ), !isCreatingPage && renderControlBottom && renderControlBottom() ] } ); } function SearchSuffixControl({ isEntity, showActions, isDisabled, onUnlink, onSubmit, helpTextId }) { if (isEntity) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { icon: link_off_default, onClick: onUnlink, "aria-describedby": helpTextId, showTooltip: true, label: (0,external_wp_i18n_namespaceObject.__)("Unsync and edit"), __next40pxDefaultSize: true } ); } if (showActions) { return void 0; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { onClick: isDisabled ? link_control_noop : onSubmit, label: (0,external_wp_i18n_namespaceObject.__)("Submit"), icon: keyboard_return_default, className: "block-editor-link-control__search-submit", "aria-disabled": isDisabled, size: "small" } ) }); } LinkControl.ViewerFill = ViewerFill; LinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS; const DeprecatedExperimentalLinkControl = (props) => { external_wp_deprecated_default()("wp.blockEditor.__experimentalLinkControl", { since: "6.8", alternative: "wp.blockEditor.LinkControl" }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControl, { ...props }); }; DeprecatedExperimentalLinkControl.ViewerFill = LinkControl.ViewerFill; DeprecatedExperimentalLinkControl.DEFAULT_LINK_SETTINGS = LinkControl.DEFAULT_LINK_SETTINGS; var link_control_default = LinkControl; ;// ./node_modules/@wordpress/block-editor/build-module/components/media-replace-flow/index.js const media_replace_flow_noop = () => { }; let uniqueId = 0; const MediaReplaceFlow = ({ mediaURL, mediaId, mediaIds, allowedTypes, accept, onError, onSelect, onSelectURL, onReset, onToggleFeaturedImage, useFeaturedImage, onFilesUpload = media_replace_flow_noop, name = (0,external_wp_i18n_namespaceObject.__)("Replace"), createNotice, removeNotice, children, multiple = false, addToGallery, handleUpload = true, popoverProps, renderToggle }) => { const { getSettings } = (0,external_wp_data_namespaceObject.useSelect)(store); const errorNoticeID = `block-editor/media-replace-flow/error-notice/${++uniqueId}`; const onUploadError = (message) => { const safeMessage = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(message); if (onError) { onError(safeMessage); return; } setTimeout(() => { createNotice("error", safeMessage, { speak: true, id: errorNoticeID, isDismissible: true }); }, 1e3); }; const selectMedia = (media, closeMenu) => { if (useFeaturedImage && onToggleFeaturedImage) { onToggleFeaturedImage(); } closeMenu(); onSelect(media); (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("The media file has been replaced")); removeNotice(errorNoticeID); }; const uploadFiles = (event, closeMenu) => { const files = event.target.files; if (!handleUpload) { closeMenu(); return onSelect(files); } onFilesUpload(files); getSettings().mediaUpload({ allowedTypes, filesList: files, onFileChange: ([media]) => { selectMedia(media, closeMenu); }, onError: onUploadError }); }; const openOnArrowDown = (event) => { if (event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { event.preventDefault(); event.target.click(); } }; const onlyAllowsImages = () => { if (!allowedTypes || allowedTypes.length === 0) { return false; } return allowedTypes.every( (allowedType) => allowedType === "image" || allowedType.startsWith("image/") ); }; const gallery = multiple && onlyAllowsImages(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, contentClassName: "block-editor-media-replace-flow__options", renderToggle: ({ isOpen, onToggle }) => { if (renderToggle) { return renderToggle({ "aria-expanded": isOpen, "aria-haspopup": "true", onClick: onToggle, onKeyDown: openOnArrowDown, children: name }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { "aria-expanded": isOpen, "aria-haspopup": "true", onClick: onToggle, onKeyDown: openOnArrowDown, children: name } ); }, renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.NavigableMenu, { className: "block-editor-media-replace-flow__media-upload-menu", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(check_default, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( media_upload_default, { gallery, addToGallery, multiple, value: multiple ? mediaIds : mediaId, onSelect: (media) => selectMedia(media, onClose), allowedTypes, render: ({ open }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: media_default, onClick: open, children: (0,external_wp_i18n_namespaceObject.__)("Open Media Library") } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FormFileUpload, { onChange: (event) => { uploadFiles(event, onClose); }, accept, multiple: !!multiple, render: ({ openFileDialog }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: upload_default, onClick: () => { openFileDialog(); }, children: (0,external_wp_i18n_namespaceObject._x)("Upload", "verb") } ); } } ) ] }), onToggleFeaturedImage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: post_featured_image_default, onClick: onToggleFeaturedImage, isPressed: useFeaturedImage, children: (0,external_wp_i18n_namespaceObject.__)("Use featured image") } ), mediaURL && onReset && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { onReset(); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)("Reset") } ), typeof children === "function" ? children({ onClose }) : children ] }), onSelectURL && // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { className: "block-editor-media-flow__url-input", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-media-replace-flow__image-url-label", children: (0,external_wp_i18n_namespaceObject.__)("Current media URL:") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( link_control_default, { value: { url: mediaURL }, settings: [], showSuggestions: false, onChange: ({ url }) => { onSelectURL(url); }, searchInputPlaceholder: (0,external_wp_i18n_namespaceObject.__)( "Paste or type URL" ) } ) ] }) ] }) } ); }; var media_replace_flow_default = (0,external_wp_compose_namespaceObject.compose)([ (0,external_wp_data_namespaceObject.withDispatch)((dispatch) => { const { createNotice, removeNotice } = dispatch(external_wp_notices_namespaceObject.store); return { createNotice, removeNotice }; }), (0,external_wp_components_namespaceObject.withFilters)("editor.MediaReplaceFlow") ])(MediaReplaceFlow); ;// ./node_modules/@wordpress/block-editor/build-module/components/background-image-control/index.js const IMAGE_BACKGROUND_TYPE = "image"; const BACKGROUND_POPOVER_PROPS = { placement: "left-start", offset: 36, shift: true, className: "block-editor-global-styles-background-panel__popover" }; const background_image_control_noop = () => { }; const focusToggleButton = (containerRef) => { window.requestAnimationFrame(() => { const [toggleButton] = external_wp_dom_namespaceObject.focus.tabbable.find(containerRef?.current); if (!toggleButton) { return; } toggleButton.focus(); }); }; function backgroundSizeHelpText(value) { if (value === "cover" || value === void 0) { return (0,external_wp_i18n_namespaceObject.__)("Image covers the space evenly."); } if (value === "contain") { return (0,external_wp_i18n_namespaceObject.__)("Image is contained without distortion."); } return (0,external_wp_i18n_namespaceObject.__)("Image has a fixed width."); } const coordsToBackgroundPosition = (value) => { if (!value || isNaN(value.x) && isNaN(value.y)) { return void 0; } const x = isNaN(value.x) ? 0.5 : value.x; const y = isNaN(value.y) ? 0.5 : value.y; return `${x * 100}% ${y * 100}%`; }; const backgroundPositionToCoords = (value) => { if (!value) { return { x: void 0, y: void 0 }; } let [x, y] = value.split(" ").map((v) => parseFloat(v) / 100); x = isNaN(x) ? void 0 : x; y = isNaN(y) ? x : y; return { x, y }; }; function InspectorImagePreviewItem({ as = "span", imgUrl, toggleProps = {}, filename, label, onToggleCallback = background_image_control_noop }) { const { isOpen, ...restToggleProps } = toggleProps; (0,external_wp_element_namespaceObject.useEffect)(() => { if (typeof isOpen !== "undefined") { onToggleCallback(isOpen); } }, [isOpen, onToggleCallback]); const renderPreviewContent = () => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", as: "span", className: "block-editor-global-styles-background-panel__inspector-preview-inner", children: [ imgUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { className: "block-editor-global-styles-background-panel__inspector-image-indicator-wrapper", "aria-hidden": true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { className: "block-editor-global-styles-background-panel__inspector-image-indicator", style: { backgroundImage: `url(${imgUrl})` } } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { as: "span", style: imgUrl ? {} : { flexGrow: 1 }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalTruncate, { numberOfLines: 1, className: "block-editor-global-styles-background-panel__inspector-media-replace-title", children: label } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", children: imgUrl ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: file name */ (0,external_wp_i18n_namespaceObject.__)("Background image: %s"), filename || label ) : (0,external_wp_i18n_namespaceObject.__)("No background image selected") }) ] }) ] } ); }; return as === "button" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...restToggleProps, children: renderPreviewContent() }) : renderPreviewContent(); } function BackgroundControlsPanel({ label, filename, url: imgUrl, children, onToggle: onToggleCallback = background_image_control_noop, hasImageValue, onReset, containerRef }) { if (!hasImageValue) { return; } const imgLabel = label || (0,external_wp_url_namespaceObject.getFilename)(imgUrl) || (0,external_wp_i18n_namespaceObject.__)("Add background image"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps: BACKGROUND_POPOVER_PROPS, renderToggle: ({ onToggle, isOpen }) => { const toggleProps = { onClick: onToggle, className: "block-editor-global-styles-background-panel__dropdown-toggle", "aria-expanded": isOpen, "aria-label": (0,external_wp_i18n_namespaceObject.__)( "Background size, position and repeat options." ), isOpen }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( InspectorImagePreviewItem, { imgUrl, filename, label: imgLabel, toggleProps, as: "button", onToggleCallback } ), onReset && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Reset"), className: "block-editor-global-styles-background-panel__reset", size: "small", icon: reset_default, onClick: () => { onReset(); if (isOpen) { onToggle(); } focusToggleButton(containerRef); } } ) ] }); }, renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { className: "block-editor-global-styles-background-panel__dropdown-content-wrapper", paddingSize: "medium", children } ) } ); } function LoadingSpinner() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { className: "block-editor-global-styles-background-panel__loading", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }); } function BackgroundImageControls({ onChange, style, inheritedValue, onRemoveImage = background_image_control_noop, onResetImage = background_image_control_noop, displayInPanel, defaultValues, containerRef }) { const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false); const { getSettings } = (0,external_wp_data_namespaceObject.useSelect)(store); const { id, title, url } = style?.background?.backgroundImage || { ...inheritedValue?.background?.backgroundImage }; const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const onUploadError = (message) => { createErrorNotice(message, { type: "snackbar" }); setIsUploading(false); }; const resetBackgroundImage = () => onChange( setImmutably( style, ["background", "backgroundImage"], void 0 ) ); const onSelectMedia = (media) => { if (!media || !media.url) { resetBackgroundImage(); setIsUploading(false); return; } if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) { setIsUploading(true); return; } if (media.media_type && media.media_type !== IMAGE_BACKGROUND_TYPE || !media.media_type && media.type && media.type !== IMAGE_BACKGROUND_TYPE) { onUploadError( (0,external_wp_i18n_namespaceObject.__)("Only images can be used as a background image.") ); return; } const sizeValue = style?.background?.backgroundSize || defaultValues?.backgroundSize; const positionValue = style?.background?.backgroundPosition; onChange( setImmutably(style, ["background"], { ...style?.background, backgroundImage: { url: media.url, id: media.id, source: "file", title: media.title || void 0 }, backgroundPosition: ( /* * A background image uploaded and set in the editor receives a default background position of '50% 0', * when the background image size is the equivalent of "Tile". * This is to increase the chance that the image's focus point is visible. * This is in-editor only to assist with the user experience. */ !positionValue && ("auto" === sizeValue || !sizeValue) ? "50% 0" : positionValue ), backgroundSize: sizeValue }) ); setIsUploading(false); focusToggleButton(containerRef); }; const onFilesDrop = (filesList) => { getSettings().mediaUpload({ allowedTypes: [IMAGE_BACKGROUND_TYPE], filesList, onFileChange([image]) { onSelectMedia(image); }, onError: onUploadError, multiple: false }); }; const hasValue = hasBackgroundImageValue(style); const onRemove = () => onChange( setImmutably(style, ["background"], { backgroundImage: "none" }) ); const canRemove = !hasValue && hasBackgroundImageValue(inheritedValue); const imgLabel = title || (0,external_wp_url_namespaceObject.getFilename)(url) || (0,external_wp_i18n_namespaceObject.__)("Add background image"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-global-styles-background-panel__image-tools-panel-item", children: [ isUploading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LoadingSpinner, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( media_replace_flow_default, { mediaId: id, mediaURL: url, allowedTypes: [IMAGE_BACKGROUND_TYPE], accept: "image/*", onSelect: onSelectMedia, popoverProps: { className: dist_clsx({ "block-editor-global-styles-background-panel__media-replace-popover": displayInPanel }) }, name: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( InspectorImagePreviewItem, { imgUrl: url, filename: title, label: imgLabel } ), renderToggle: (props) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...props, __next40pxDefaultSize: true }), onError: onUploadError, onReset: () => { focusToggleButton(containerRef); onResetImage(); }, children: canRemove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { focusToggleButton(containerRef); onRemove(); onRemoveImage(); }, children: (0,external_wp_i18n_namespaceObject.__)("Remove") } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropZone, { onFilesDrop, label: (0,external_wp_i18n_namespaceObject.__)("Drop to upload") } ) ] }); } function BackgroundSizeControls({ onChange, style, inheritedValue, defaultValues }) { const sizeValue = style?.background?.backgroundSize || inheritedValue?.background?.backgroundSize; const repeatValue = style?.background?.backgroundRepeat || inheritedValue?.background?.backgroundRepeat; const imageValue = style?.background?.backgroundImage?.url || inheritedValue?.background?.backgroundImage?.url; const isUploadedImage = style?.background?.backgroundImage?.id; const positionValue = style?.background?.backgroundPosition || inheritedValue?.background?.backgroundPosition; const attachmentValue = style?.background?.backgroundAttachment || inheritedValue?.background?.backgroundAttachment; let currentValueForToggle = !sizeValue && isUploadedImage ? defaultValues?.backgroundSize : sizeValue || "auto"; currentValueForToggle = !["cover", "contain", "auto"].includes( currentValueForToggle ) ? "auto" : currentValueForToggle; const repeatCheckedValue = !(repeatValue === "no-repeat" || currentValueForToggle === "cover" && repeatValue === void 0); const updateBackgroundSize = (next) => { let nextRepeat = repeatValue; let nextPosition = positionValue; if (next === "contain") { nextRepeat = "no-repeat"; nextPosition = void 0; } if (next === "cover") { nextRepeat = void 0; nextPosition = void 0; } if ((currentValueForToggle === "cover" || currentValueForToggle === "contain") && next === "auto") { nextRepeat = void 0; if (!!style?.background?.backgroundImage?.id) { nextPosition = "50% 0"; } } if (!next && currentValueForToggle === "auto") { next = "auto"; } onChange( setImmutably(style, ["background"], { ...style?.background, backgroundPosition: nextPosition, backgroundRepeat: nextRepeat, backgroundSize: next }) ); }; const updateBackgroundPosition = (next) => { onChange( setImmutably( style, ["background", "backgroundPosition"], coordsToBackgroundPosition(next) ) ); }; const toggleIsRepeated = () => onChange( setImmutably( style, ["background", "backgroundRepeat"], repeatCheckedValue === true ? "no-repeat" : "repeat" ) ); const toggleScrollWithPage = () => onChange( setImmutably( style, ["background", "backgroundAttachment"], attachmentValue === "fixed" ? "scroll" : "fixed" ) ); const backgroundPositionValue = !positionValue && isUploadedImage && "contain" === sizeValue ? defaultValues?.backgroundPosition : positionValue; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, className: "single-column", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FocalPointPicker, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Focal point"), url: imageValue, value: backgroundPositionToCoords(backgroundPositionValue), onChange: updateBackgroundPosition } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Fixed background"), checked: attachmentValue === "fixed", onChange: toggleScrollWithPage } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, size: "__unstable-large", label: (0,external_wp_i18n_namespaceObject.__)("Size"), value: currentValueForToggle, onChange: updateBackgroundSize, isBlock: true, help: backgroundSizeHelpText( sizeValue || defaultValues?.backgroundSize ), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "cover", label: (0,external_wp_i18n_namespaceObject._x)( "Cover", "Size option for background image control" ) }, "cover" ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "contain", label: (0,external_wp_i18n_namespaceObject._x)( "Contain", "Size option for background image control" ) }, "contain" ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "auto", label: (0,external_wp_i18n_namespaceObject._x)( "Tile", "Size option for background image control" ) }, "tile" ) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", spacing: 2, as: "span", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { "aria-label": (0,external_wp_i18n_namespaceObject.__)("Background image width"), onChange: updateBackgroundSize, value: sizeValue, size: "__unstable-large", __unstableInputWidth: "100px", min: 0, placeholder: (0,external_wp_i18n_namespaceObject.__)("Auto"), disabled: currentValueForToggle !== "auto" || currentValueForToggle === void 0 } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Repeat"), checked: repeatCheckedValue, onChange: toggleIsRepeated, disabled: currentValueForToggle === "cover" } ) ] }) ] }); } function BackgroundImagePanel({ value, onChange, inheritedValue = value, settings, defaultValues = {} }) { const { globalStyles, _links } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSettings } = select(store); const _settings = getSettings(); return { globalStyles: _settings[globalStylesDataKey], _links: _settings[globalStylesLinksDataKey] }; }, []); const resolvedInheritedValue = (0,external_wp_element_namespaceObject.useMemo)(() => { const resolvedValues = { background: {} }; if (!inheritedValue?.background) { return inheritedValue; } Object.entries(inheritedValue?.background).forEach( ([key, backgroundValue]) => { resolvedValues.background[key] = getResolvedValue( backgroundValue, { styles: globalStyles, _links } ); } ); return resolvedValues; }, [globalStyles, _links, inheritedValue]); const resetBackground = () => onChange(setImmutably(value, ["background"], {})); const { title, url } = value?.background?.backgroundImage || { ...resolvedInheritedValue?.background?.backgroundImage }; const hasImageValue = hasBackgroundImageValue(value) || hasBackgroundImageValue(resolvedInheritedValue); const imageValue = value?.background?.backgroundImage || inheritedValue?.background?.backgroundImage; const shouldShowBackgroundImageControls = hasImageValue && "none" !== imageValue && (settings?.background?.backgroundSize || settings?.background?.backgroundPosition || settings?.background?.backgroundRepeat); const [isDropDownOpen, setIsDropDownOpen] = (0,external_wp_element_namespaceObject.useState)(false); const containerRef = (0,external_wp_element_namespaceObject.useRef)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { ref: containerRef, className: dist_clsx( "block-editor-global-styles-background-panel__inspector-media-replace-container", { "is-open": isDropDownOpen } ), children: shouldShowBackgroundImageControls ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BackgroundControlsPanel, { label: title, filename: title, url, onToggle: setIsDropDownOpen, hasImageValue, onReset: resetBackground, containerRef, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, className: "single-column", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BackgroundImageControls, { onChange, style: value, inheritedValue: resolvedInheritedValue, displayInPanel: true, onResetImage: () => { setIsDropDownOpen(false); resetBackground(); }, onRemoveImage: () => setIsDropDownOpen(false), defaultValues, containerRef } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BackgroundSizeControls, { onChange, style: value, defaultValues, inheritedValue: resolvedInheritedValue } ) ] }) } ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BackgroundImageControls, { onChange, style: value, inheritedValue: resolvedInheritedValue, defaultValues, onResetImage: () => { setIsDropDownOpen(false); resetBackground(); }, onRemoveImage: () => setIsDropDownOpen(false), containerRef } ) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/background-panel.js const background_panel_DEFAULT_CONTROLS = { backgroundImage: true }; function useHasBackgroundPanel(settings) { return external_wp_element_namespaceObject.Platform.OS === "web" && settings?.background?.backgroundImage; } function hasBackgroundSizeValue(style) { return style?.background?.backgroundPosition !== void 0 || style?.background?.backgroundSize !== void 0; } function hasBackgroundImageValue(style) { return !!style?.background?.backgroundImage?.id || // Supports url() string values in theme.json. "string" === typeof style?.background?.backgroundImage || !!style?.background?.backgroundImage?.url; } function BackgroundToolsPanel({ resetAllFilter, onChange, value, panelId, children, headerLabel }) { const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanel, { label: headerLabel, resetAll, panelId, dropdownMenuProps, children } ); } function background_panel_BackgroundImagePanel({ as: Wrapper = BackgroundToolsPanel, value, onChange, inheritedValue, settings, panelId, defaultControls = background_panel_DEFAULT_CONTROLS, defaultValues = {}, headerLabel = (0,external_wp_i18n_namespaceObject.__)("Background image") }) { const showBackgroundImageControl = useHasBackgroundPanel(settings); const resetBackground = () => onChange(setImmutably(value, ["background"], {})); const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => { return { ...previousValue, background: {} }; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Wrapper, { resetAllFilter, value, onChange, panelId, headerLabel, children: showBackgroundImageControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => !!value?.background, label: (0,external_wp_i18n_namespaceObject.__)("Image"), onDeselect: resetBackground, isShownByDefault: defaultControls.backgroundImage, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BackgroundImagePanel, { value, onChange, settings, inheritedValue, defaultControls, defaultValues } ) } ) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/background.js const BACKGROUND_SUPPORT_KEY = "background"; const BACKGROUND_BLOCK_DEFAULT_VALUES = { backgroundSize: "cover", backgroundPosition: "50% 50%" // used only when backgroundSize is 'contain'. }; function hasBackgroundSupport(blockName, feature = "any") { const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, BACKGROUND_SUPPORT_KEY); if (support === true) { return true; } if (feature === "any") { return !!support?.backgroundImage || !!support?.backgroundSize || !!support?.backgroundRepeat; } return !!support?.[feature]; } function setBackgroundStyleDefaults(backgroundStyle) { if (!backgroundStyle || !backgroundStyle?.backgroundImage?.url) { return; } let backgroundStylesWithDefaults; if (!backgroundStyle?.backgroundSize) { backgroundStylesWithDefaults = { backgroundSize: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundSize }; } if ("contain" === backgroundStyle?.backgroundSize && !backgroundStyle?.backgroundPosition) { backgroundStylesWithDefaults = { backgroundPosition: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundPosition }; } return backgroundStylesWithDefaults; } function background_useBlockProps({ name, style }) { if (!hasBackgroundSupport(name) || !style?.background?.backgroundImage) { return; } const backgroundStyles = setBackgroundStyleDefaults(style?.background); if (!backgroundStyles) { return; } return { style: { ...backgroundStyles } }; } function getBackgroundImageClasses(style) { return hasBackgroundImageValue(style) ? "has-background" : ""; } function BackgroundInspectorControl({ children }) { const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((attributes) => { return { ...attributes, style: { ...attributes.style, background: void 0 } }; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "background", resetAllFilter, children }); } function background_BackgroundImagePanel({ clientId, name, setAttributes, settings }) { const { style, inheritedValue } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockAttributes, getSettings } = select(store); const _settings = getSettings(); return { style: getBlockAttributes(clientId)?.style, /* * To ensure we pass down the right inherited values: * @TODO 1. Pass inherited value down to all block style controls, * See: packages/block-editor/src/hooks/style.js * @TODO 2. Add support for block style variations, * See implementation: packages/block-editor/src/hooks/block-style-variation.js */ inheritedValue: _settings[globalStylesDataKey]?.blocks?.[name] }; }, [clientId, name] ); if (!useHasBackgroundPanel(settings) || !hasBackgroundSupport(name, "backgroundImage")) { return null; } const onChange = (newStyle) => { setAttributes({ style: utils_cleanEmptyObject(newStyle) }); }; const updatedSettings = { ...settings, background: { ...settings.background, backgroundSize: settings?.background?.backgroundSize && hasBackgroundSupport(name, "backgroundSize") } }; const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ BACKGROUND_SUPPORT_KEY, "defaultControls" ]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( background_panel_BackgroundImagePanel, { inheritedValue, as: BackgroundInspectorControl, panelId: clientId, defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES, settings: updatedSettings, onChange, defaultControls, value: style } ); } var background_default = { useBlockProps: background_useBlockProps, attributeKeys: ["style"], hasSupport: hasBackgroundSupport }; ;// ./node_modules/@wordpress/block-editor/build-module/hooks/lock.js function lock_addAttribute(settings) { if ("type" in (settings.attributes?.lock ?? {})) { return settings; } settings.attributes = { ...settings.attributes, lock: { type: "object" } }; return settings; } (0,external_wp_hooks_namespaceObject.addFilter)("blocks.registerBlockType", "core/lock/addAttribute", lock_addAttribute); ;// ./node_modules/@wordpress/icons/build-module/library/block-default.js var block_default_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 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-icon/index.js function BlockIcon({ icon, showColors = false, className, context }) { if (icon?.src === "block-default") { icon = { src: block_default_default }; } const renderedIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: icon && icon.src ? icon.src : icon, context }); const style = showColors ? { backgroundColor: icon && icon.background, color: icon && icon.foreground } : {}; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { style, className: dist_clsx("block-editor-block-icon", className, { "has-colors": showColors }), children: renderedIcon } ); } var block_icon_default = (0,external_wp_element_namespaceObject.memo)(BlockIcon); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-manager/checklist.js function BlockTypesChecklist({ blockTypes, value, onItemChange }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "block-editor-block-manager__checklist", children: blockTypes.map((blockType) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "li", { className: "block-editor-block-manager__checklist-item", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: blockType.title, checked: value.includes(blockType.name), onChange: (...args) => onItemChange(blockType, ...args) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: blockType.icon }) ] }, blockType.name )) }); } var checklist_default = BlockTypesChecklist; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-manager/category.js function BlockManagerCategory({ title, blockTypes, selectedBlockTypes, onChange }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockManagerCategory); const toggleVisible = (0,external_wp_element_namespaceObject.useCallback)( (blockType, nextIsChecked) => { if (nextIsChecked) { onChange([...selectedBlockTypes, blockType]); } else { onChange( selectedBlockTypes.filter( ({ name }) => name !== blockType.name ) ); } }, [selectedBlockTypes, onChange] ); const toggleAllVisible = (0,external_wp_element_namespaceObject.useCallback)( (nextIsChecked) => { if (nextIsChecked) { onChange([ ...selectedBlockTypes, ...blockTypes.filter( (blockType) => !selectedBlockTypes.find( ({ name }) => name === blockType.name ) ) ]); } else { onChange( selectedBlockTypes.filter( (selectedBlockType) => !blockTypes.find( ({ name }) => name === selectedBlockType.name ) ) ); } }, [blockTypes, selectedBlockTypes, onChange] ); if (!blockTypes.length) { return null; } const checkedBlockNames = blockTypes.map(({ name }) => name).filter( (type) => (selectedBlockTypes ?? []).some( (selectedBlockType) => selectedBlockType.name === type ) ); const titleId = "block-editor-block-manager__category-title-" + instanceId; const isAllChecked = checkedBlockNames.length === blockTypes.length; const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { role: "group", "aria-labelledby": titleId, className: "block-editor-block-manager__category", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, checked: isAllChecked, onChange: toggleAllVisible, className: "block-editor-block-manager__category-title", indeterminate: isIndeterminate, label: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { id: titleId, children: title }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( checklist_default, { blockTypes, value: checkedBlockNames, onItemChange: toggleVisible } ) ] } ); } var category_category_default = BlockManagerCategory; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-manager/index.js function BlockManager({ blockTypes, selectedBlockTypes, onChange, showSelectAll = true }) { const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(""); const { categories, isMatchingSearchTerm } = (0,external_wp_data_namespaceObject.useSelect)((select) => { return { categories: select(external_wp_blocks_namespaceObject.store).getCategories(), isMatchingSearchTerm: select(external_wp_blocks_namespaceObject.store).isMatchingSearchTerm }; }, []); const filteredBlockTypes = blockTypes.filter((blockType) => { return !search || isMatchingSearchTerm(blockType, search); }); const isIndeterminate = selectedBlockTypes.length > 0 && selectedBlockTypes.length !== blockTypes.length; const isAllChecked = blockTypes.length > 0 && selectedBlockTypes.length === blockTypes.length; (0,external_wp_element_namespaceObject.useEffect)(() => { if (!search) { return; } const count = filteredBlockTypes.length; const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", count), count ); debouncedSpeak(resultsFoundMessage); }, [filteredBlockTypes?.length, search, debouncedSpeak]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-block-manager__content", spacing: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SearchControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Search for a block"), placeholder: (0,external_wp_i18n_namespaceObject.__)("Search for a block"), value: search, onChange: (nextSearch) => setSearch(nextSearch), className: "block-editor-block-manager__search" } ), showSelectAll && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { className: "block-editor-block-manager__select-all", label: (0,external_wp_i18n_namespaceObject.__)("Select all"), checked: isAllChecked, onChange: () => { if (isAllChecked) { onChange([]); } else { onChange(blockTypes); } }, indeterminate: isIndeterminate, __nextHasNoMarginBottom: true } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { tabIndex: "0", role: "region", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Available block types"), className: "block-editor-block-manager__results", children: [ filteredBlockTypes.length === 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-block-manager__no-results", children: (0,external_wp_i18n_namespaceObject.__)("No blocks found.") }), categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( category_category_default, { title: category.title, blockTypes: filteredBlockTypes.filter( (blockType) => blockType.category === category.slug ), selectedBlockTypes, onChange }, category.slug )), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( category_category_default, { title: (0,external_wp_i18n_namespaceObject.__)("Uncategorized"), blockTypes: filteredBlockTypes.filter( ({ category }) => !category ), selectedBlockTypes, onChange } ) ] } ) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-allowed-blocks/modal.js function BlockAllowedBlocksModal({ clientId, blockTypes, selectedBlockTypes, onClose }) { const [currentSelectedBlockTypes, setCurrentSelectedBlockTypes] = (0,external_wp_element_namespaceObject.useState)(selectedBlockTypes); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const handleSubmit = () => { const isFullySelected = currentSelectedBlockTypes.length === blockTypes.length; const newBlockNames = currentSelectedBlockTypes.map( ({ name }) => name ); updateBlockAttributes(clientId, { allowedBlocks: isFullySelected ? void 0 : newBlockNames }); onClose(); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Manage allowed blocks"), onRequestClose: onClose, overlayClassName: "block-editor-block-allowed-blocks-modal", focusOnMount: "firstContentElement", size: "medium", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { as: "form", onSubmit: (e) => { e.preventDefault(); handleSubmit(); }, spacing: "4", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)( "Select which blocks can be added inside this container." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockManager, { blockTypes, selectedBlockTypes: currentSelectedBlockTypes, onChange: (newSelectedBlockTypes) => { setCurrentSelectedBlockTypes(newSelectedBlockTypes); } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Flex, { className: "block-editor-block-allowed-blocks-modal__actions", justify: "flex-end", expanded: false, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: onClose, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "primary", type: "submit", __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)("Apply") } ) }) ] } ) ] } ) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-allowed-blocks/allowed-blocks-control.js function BlockAllowedBlocksControl({ clientId }) { const [isBlockControlOpened, setIsBlockControlOpened] = (0,external_wp_element_namespaceObject.useState)(false); const { blockTypes, selectedBlockNames } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockAttributes } = select(store); return { blockTypes: select(external_wp_blocks_namespaceObject.store).getBlockTypes(), selectedBlockNames: getBlockAttributes(clientId)?.allowedBlocks }; }, [clientId] ); const filteredBlockTypes = blockTypes.filter( (blockType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "inserter", true) && (!blockType.parent || blockType.parent.includes("core/post-content")) ); if (!filteredBlockTypes) { return null; } const selectedBlockTypes = selectedBlockNames === void 0 ? filteredBlockTypes : filteredBlockTypes.filter( (blockType) => selectedBlockNames.includes(blockType.name) ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-allowed-blocks-control", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.BaseControl, { help: (0,external_wp_i18n_namespaceObject.__)( "Specify which blocks are allowed inside this container." ), __nextHasNoMarginBottom: true, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Allowed Blocks") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", onClick: () => { setIsBlockControlOpened(true); }, className: "block-editor-block-allowed-blocks-control__button", children: (0,external_wp_i18n_namespaceObject.__)("Manage allowed blocks") } ) ] } ), isBlockControlOpened && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockAllowedBlocksModal, { clientId, blockTypes: filteredBlockTypes, selectedBlockTypes, onClose: () => setIsBlockControlOpened(false) } ) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/allowed-blocks.js function BlockEditAllowedBlocksControlPure({ clientId }) { const isContentOnly = (0,external_wp_data_namespaceObject.useSelect)( (select) => { return select(store).getBlockEditingMode(clientId) === "contentOnly"; }, [clientId] ); if (isContentOnly) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInspectorControlsAllowedBlocks.Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockAllowedBlocksControl, { clientId }) }); } var allowed_blocks_default = { edit: BlockEditAllowedBlocksControlPure, attributeKeys: ["allowedBlocks"], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "allowedBlocks"); } }; function allowed_blocks_addAttribute(settings) { if (settings?.attributes?.allowedBlocks?.type) { return settings; } if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "allowedBlocks")) { settings.attributes = { ...settings.attributes, allowedBlocks: { type: "array" } }; } return settings; } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/allowedBlocks/attribute", allowed_blocks_addAttribute ); function addTransforms(result, source, index, results) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, "allowedBlocks")) { return result; } if (source.length !== 1 && results.length === 1 && result.innerBlocks.length === source.length) { return result; } if (results.length === 1 && source.length > 1 || results.length > 1 && source.length === 1) { return result; } if (results.length > 1 && source.length > 1 && results.length !== source.length) { return result; } if (result.attributes.allowedBlocks) { return result; } const sourceAllowedBlocks = source[index]?.attributes?.allowedBlocks; if (!sourceAllowedBlocks) { return result; } const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(result.name); const destinationAllowedBlocks = blockType?.allowedBlocks || []; if (!destinationAllowedBlocks.length) { return { ...result, attributes: { ...result.attributes, allowedBlocks: sourceAllowedBlocks } }; } const filteredSourceAllowedBlocks = sourceAllowedBlocks.filter( (block) => destinationAllowedBlocks.includes(block) ); return { ...result, attributes: { ...result.attributes, allowedBlocks: filteredSourceAllowedBlocks } }; } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.switchToBlockType.transformedBlock", "core/allowedBlocks/addTransforms", addTransforms ); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/anchor.js const ANCHOR_REGEX = /[\s#]/g; const ANCHOR_SCHEMA = { type: "string", source: "attribute", attribute: "id", selector: "*" }; function anchor_addAttribute(settings) { if ("type" in (settings.attributes?.anchor ?? {})) { return settings; } if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "anchor")) { settings.attributes = { ...settings.attributes, anchor: ANCHOR_SCHEMA }; } return settings; } function BlockEditAnchorControlPure({ anchor, setAttributes }) { const blockEditingMode = useBlockEditingMode(); if (blockEditingMode !== "default") { return null; } const isWeb = external_wp_element_namespaceObject.Platform.OS === "web"; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "advanced", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, className: "html-anchor-control", label: (0,external_wp_i18n_namespaceObject.__)("HTML anchor"), help: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ (0,external_wp_i18n_namespaceObject.__)( "Enter a word or two \u2014 without spaces \u2014 to make a unique web address just for this block, called an \u201Canchor\u201D. Then, you\u2019ll be able to link directly to this section of your page." ), isWeb && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ " ", /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)( "https://wordpress.org/documentation/article/page-jumps/" ), children: (0,external_wp_i18n_namespaceObject.__)("Learn more about anchors") } ) ] }) ] }), value: anchor || "", placeholder: !isWeb ? (0,external_wp_i18n_namespaceObject.__)("Add an anchor") : null, onChange: (nextValue) => { nextValue = nextValue.replace(ANCHOR_REGEX, "-"); setAttributes({ anchor: nextValue }); }, autoCapitalize: "none", autoComplete: "off" } ) }); } var anchor_default = { addSaveProps, edit: BlockEditAnchorControlPure, attributeKeys: ["anchor"], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "anchor"); } }; function addSaveProps(extraProps, blockType, attributes) { if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "anchor")) { extraProps.id = attributes.anchor === "" ? null : attributes.anchor; } return extraProps; } (0,external_wp_hooks_namespaceObject.addFilter)("blocks.registerBlockType", "core/anchor/attribute", anchor_addAttribute); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/aria-label.js function aria_label_addAttribute(settings) { if (settings?.attributes?.ariaLabel?.type) { return settings; } if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "ariaLabel")) { settings.attributes = { ...settings.attributes, ariaLabel: { type: "string" } }; } return settings; } function aria_label_addSaveProps(extraProps, blockType, attributes) { if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "ariaLabel")) { extraProps["aria-label"] = attributes.ariaLabel === "" ? null : attributes.ariaLabel; } return extraProps; } var aria_label_default = { addSaveProps: aria_label_addSaveProps, attributeKeys: ["ariaLabel"], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "ariaLabel"); } }; (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/ariaLabel/attribute", aria_label_addAttribute ); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/custom-class-name.js function custom_class_name_addAttribute(settings) { if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "customClassName", true)) { settings.attributes = { ...settings.attributes, className: { type: "string" } }; } return settings; } function CustomClassNameControlsPure({ className, setAttributes }) { const blockEditingMode = useBlockEditingMode(); if (blockEditingMode !== "default") { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "advanced", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, autoComplete: "off", label: (0,external_wp_i18n_namespaceObject.__)("Additional CSS class(es)"), value: className || "", onChange: (nextValue) => { setAttributes({ className: nextValue !== "" ? nextValue : void 0 }); }, help: (0,external_wp_i18n_namespaceObject.__)("Separate multiple classes with spaces.") } ) }); } var custom_class_name_default = { edit: CustomClassNameControlsPure, addSaveProps: custom_class_name_addSaveProps, attributeKeys: ["className"], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "customClassName", true); } }; function custom_class_name_addSaveProps(extraProps, blockType, attributes) { if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "customClassName", true) && attributes.className) { extraProps.className = dist_clsx( extraProps.className, attributes.className ); } return extraProps; } function custom_class_name_addTransforms(result, source, index, results) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, "customClassName", true)) { return result; } if (results.length === 1 && result.innerBlocks.length === source.length) { return result; } if (results.length === 1 && source.length > 1 || results.length > 1 && source.length === 1) { return result; } if (source[index]) { const originClassName = source[index]?.attributes.className; if (originClassName && result.attributes.className === void 0) { return { ...result, attributes: { ...result.attributes, className: originClassName } }; } } return result; } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/editor/custom-class-name/attribute", custom_class_name_addAttribute ); (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.switchToBlockType.transformedBlock", "core/customClassName/addTransforms", custom_class_name_addTransforms ); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/generated-class-name.js function addGeneratedClassName(extraProps, blockType) { if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "className", true)) { if (typeof extraProps.className === "string") { extraProps.className = [ .../* @__PURE__ */ new Set([ (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name), ...extraProps.className.split(" ") ]) ].join(" ").trim(); } else { extraProps.className = (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name); } } return extraProps; } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.getSaveContent.extraProps", "core/generated-class-name/save-props", addGeneratedClassName ); ;// ./node_modules/colord/index.mjs var colord_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,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)||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)*(colord_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()})}; ;// ./node_modules/colord/plugins/names.mjs /* harmony default export */ function names(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u<t&&(t=u,b=g)}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"])} ;// ./node_modules/colord/plugins/a11y.mjs var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}} ;// ./node_modules/@wordpress/block-editor/build-module/components/colors/utils.js k([names, a11y]); const { kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); const getColorObjectByAttributeValues = (colors, definedColor, customColor) => { if (definedColor) { const colorObj = colors?.find( (color) => color.slug === definedColor ); if (colorObj) { return colorObj; } } return { color: customColor }; }; const getColorObjectByColorValue = (colors, colorValue) => { return colors?.find((color) => color.color === colorValue); }; function getColorClassName(colorContextName, colorSlug) { if (!colorContextName || !colorSlug) { return void 0; } return `has-${kebabCase(colorSlug)}-${colorContextName}`; } function getMostReadableColor(colors, colorValue) { const colordColor = w(colorValue); const getColorContrast = ({ color }) => colordColor.contrast(color); const maxContrast = Math.max(...colors.map(getColorContrast)); return colors.find((color) => getColorContrast(color) === maxContrast).color; } ;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js function useMultipleOriginColorsAndGradients() { const [ enableCustomColors, customColors, themeColors, defaultColors, shouldDisplayDefaultColors, enableCustomGradients, customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients ] = use_settings_useSettings( "color.custom", "color.palette.custom", "color.palette.theme", "color.palette.default", "color.defaultPalette", "color.customGradient", "color.gradients.custom", "color.gradients.theme", "color.gradients.default", "color.defaultGradients" ); const colorGradientSettings = { disableCustomColors: !enableCustomColors, disableCustomGradients: !enableCustomGradients }; colorGradientSettings.colors = (0,external_wp_element_namespaceObject.useMemo)(() => { const result = []; if (themeColors && themeColors.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Theme", "Indicates this palette comes from the theme." ), slug: "theme", colors: themeColors }); } if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Default", "Indicates this palette comes from WordPress." ), slug: "default", colors: defaultColors }); } if (customColors && customColors.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Custom", "Indicates this palette is created by the user." ), slug: "custom", colors: customColors }); } return result; }, [ customColors, themeColors, defaultColors, shouldDisplayDefaultColors ]); colorGradientSettings.gradients = (0,external_wp_element_namespaceObject.useMemo)(() => { const result = []; if (themeGradients && themeGradients.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Theme", "Indicates this palette comes from the theme." ), slug: "theme", gradients: themeGradients }); } if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Default", "Indicates this palette comes from WordPress." ), slug: "default", gradients: defaultGradients }); } if (customGradients && customGradients.length) { result.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Custom", "Indicates this palette is created by the user." ), slug: "custom", gradients: customGradients }); } return result; }, [ customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients ]); colorGradientSettings.hasColorsOrGradients = !!colorGradientSettings.colors.length || !!colorGradientSettings.gradients.length; return colorGradientSettings; } ;// ./node_modules/@wordpress/icons/build-module/library/link.js var link_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/linked-button.js function LinkedButton({ isLinked, ...props }) { const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)("Unlink radii") : (0,external_wp_i18n_namespaceObject.__)("Link radii"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { ...props, className: "components-border-radius-control__linked-button", size: "small", icon: isLinked ? link_default : link_off_default, iconSize: 24, label } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/utils.js function mode(inputArray) { const arr = [...inputArray]; return arr.sort( (a, b) => inputArray.filter((v) => v === b).length - inputArray.filter((v) => v === a).length ).shift(); } function getAllUnit(selectedUnits = {}) { const { flat, ...cornerUnits } = selectedUnits; return flat || mode(Object.values(cornerUnits).filter(Boolean)) || "px"; } function getAllValue(values = {}) { if (typeof values === "string") { return values; } const parsedQuantitiesAndUnits = Object.values(values).map((value2) => { const newValue = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value2); if (typeof value2 === "string" && newValue[0] === void 0) { return [value2, ""]; } return newValue; }); const allValues = parsedQuantitiesAndUnits.map( (value2) => value2[0] ?? "" ); const allUnits = parsedQuantitiesAndUnits.map((value2) => value2[1]); const value = allValues.every((v) => v === allValues[0]) ? allValues[0] : ""; const unit = mode(allUnits); const allValue = value === 0 || value ? `${value}${unit || ""}` : void 0; return allValue; } function hasMixedValues(values = {}) { if (typeof values === "string") { return false; } if (!values || typeof values !== "object") { return false; } const cornerValues = Object.values(values); if (cornerValues.length === 0) { return false; } const firstValue = cornerValues[0]; const allSame = cornerValues.every((value) => value === firstValue); return !allSame; } function hasDefinedValues(values) { if (!values) { return false; } if (typeof values === "string") { return true; } const filteredValues = Object.values(values).filter((value) => { return !!value || value === 0; }); return !!filteredValues.length; } function isValuePreset(value) { if (!value?.includes) { return false; } return value === "0" || value.includes("var:preset|border-radius|"); } function getPresetSlug(value) { if (!value) { return; } if (value === "0" || value === "default") { return value; } const slug = value.match(/var:preset\|border-radius\|(.+)/); return slug ? slug[1] : void 0; } function utils_getSliderValueFromPreset(presetValue, presets) { if (presetValue === void 0) { return 0; } const slug = parseFloat(presetValue, 10) === 0 ? "0" : getPresetSlug(presetValue); const sliderValue = presets.findIndex((size) => { return String(size.slug) === slug; }); return sliderValue !== -1 ? sliderValue : NaN; } function utils_getCustomValueFromPreset(value, presets) { if (!isValuePreset(value)) { return value; } const slug = parseFloat(value, 10) === 0 ? "0" : getPresetSlug(value); const radiusSize = presets.find((size) => String(size.slug) === slug); return radiusSize?.size; } function getPresetValueFromControlValue(controlValue, controlType, presets) { const size = parseInt(controlValue, 10); if (controlType === "selectList") { if (size === 0) { return void 0; } } else if (size === 0) { return "0"; } return `var:preset|border-radius|${presets[controlValue]?.slug}`; } function utils_getPresetValueFromCustomValue(value, presets) { if (!value || isValuePreset(value) || value === "0") { return value; } const spacingMatch = presets.find( (size) => String(size.size) === String(value) ); if (spacingMatch?.slug) { return `var:preset|border-radius|${spacingMatch.slug}`; } return value; } function convertPresetsToCustomValues(values, presets) { if (!values || typeof values !== "object") { return values; } const converted = {}; Object.keys(values).forEach((key) => { const value = values[key]; if (isValuePreset(value)) { const customValue = utils_getCustomValueFromPreset(value, presets); converted[key] = customValue !== void 0 ? customValue : value; } else { converted[key] = value; } }); return converted; } ;// ./node_modules/@wordpress/icons/build-module/library/settings.js var settings_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: [ /* @__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" }), /* @__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" }) ] }); ;// ./node_modules/@wordpress/icons/build-module/library/corner-all.js var corner_all_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, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.75 6A.25.25 0 0 1 6 5.75h3v-1.5H6A1.75 1.75 0 0 0 4.25 6v3h1.5V6ZM18 18.25h-3v1.5h3A1.75 1.75 0 0 0 19.75 18v-3h-1.5v3a.25.25 0 0 1-.25.25ZM18.25 9V6a.25.25 0 0 0-.25-.25h-3v-1.5h3c.966 0 1.75.784 1.75 1.75v3h-1.5Zm-12.5 9v-3h-1.5v3c0 .966.784 1.75 1.75 1.75h3v-1.5H6a.25.25 0 0 1-.25-.25Z" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/corner-top-left.js var corner_top_left_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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.G, { opacity: ".25", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.75 6A.25.25 0 0 1 6 5.75h3v-1.5H6A1.75 1.75 0 0 0 4.25 6v3h1.5V6ZM18 18.25h-3v1.5h3A1.75 1.75 0 0 0 19.75 18v-3h-1.5v3a.25.25 0 0 1-.25.25ZM18.25 9V6a.25.25 0 0 0-.25-.25h-3v-1.5h3c.966 0 1.75.784 1.75 1.75v3h-1.5ZM5.75 18v-3h-1.5v3c0 .966.784 1.75 1.75 1.75h3v-1.5H6a.25.25 0 0 1-.25-.25Z" }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M6 5.75a.25.25 0 0 0-.25.25v3h-1.5V6c0-.966.784-1.75 1.75-1.75h3v1.5H6Z" } ) ] }); ;// ./node_modules/@wordpress/icons/build-module/library/corner-top-right.js var corner_top_right_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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.G, { opacity: ".25", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.75 6A.25.25 0 0 1 6 5.75h3v-1.5H6A1.75 1.75 0 0 0 4.25 6v3h1.5V6ZM18 18.25h-3v1.5h3A1.75 1.75 0 0 0 19.75 18v-3h-1.5v3a.25.25 0 0 1-.25.25ZM18.25 9V6a.25.25 0 0 0-.25-.25h-3v-1.5h3c.966 0 1.75.784 1.75 1.75v3h-1.5ZM5.75 18v-3h-1.5v3c0 .966.784 1.75 1.75 1.75h3v-1.5H6a.25.25 0 0 1-.25-.25Z" }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M18.25 9V6a.25.25 0 0 0-.25-.25h-3v-1.5h3c.966 0 1.75.784 1.75 1.75v3h-1.5Z" } ) ] }); ;// ./node_modules/@wordpress/icons/build-module/library/corner-bottom-left.js var corner_bottom_left_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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.G, { opacity: ".25", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.75 6A.25.25 0 0 1 6 5.75h3v-1.5H6A1.75 1.75 0 0 0 4.25 6v3h1.5V6ZM18 18.25h-3v1.5h3A1.75 1.75 0 0 0 19.75 18v-3h-1.5v3a.25.25 0 0 1-.25.25ZM18.25 9V6a.25.25 0 0 0-.25-.25h-3v-1.5h3c.966 0 1.75.784 1.75 1.75v3h-1.5ZM5.75 18v-3h-1.5v3c0 .966.784 1.75 1.75 1.75h3v-1.5H6a.25.25 0 0 1-.25-.25Z" }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.75 15v3c0 .138.112.25.25.25h3v1.5H6A1.75 1.75 0 0 1 4.25 18v-3h1.5Z" } ) ] }); ;// ./node_modules/@wordpress/icons/build-module/library/corner-bottom-right.js var corner_bottom_right_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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.G, { opacity: ".25", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.75 6A.25.25 0 0 1 6 5.75h3v-1.5H6A1.75 1.75 0 0 0 4.25 6v3h1.5V6ZM18 18.25h-3v1.5h3A1.75 1.75 0 0 0 19.75 18v-3h-1.5v3a.25.25 0 0 1-.25.25ZM18.25 9V6a.25.25 0 0 0-.25-.25h-3v-1.5h3c.966 0 1.75.784 1.75 1.75v3h-1.5ZM5.75 18v-3h-1.5v3c0 .966.784 1.75 1.75 1.75h3v-1.5H6a.25.25 0 0 1-.25-.25Z" }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M15 18.25h3a.25.25 0 0 0 .25-.25v-3h1.5v3A1.75 1.75 0 0 1 18 19.75h-3v-1.5Z" } ) ] }); ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/constants.js const constants_DEFAULT_VALUES = { topLeft: void 0, topRight: void 0, bottomLeft: void 0, bottomRight: void 0 }; const constants_RANGE_CONTROL_MAX_SIZE = 8; const constants_EMPTY_ARRAY = []; const CORNERS = { all: (0,external_wp_i18n_namespaceObject.__)("Border radius"), topLeft: (0,external_wp_i18n_namespaceObject.__)("Top left"), topRight: (0,external_wp_i18n_namespaceObject.__)("Top right"), bottomLeft: (0,external_wp_i18n_namespaceObject.__)("Bottom left"), bottomRight: (0,external_wp_i18n_namespaceObject.__)("Bottom right") }; const constants_ICONS = { all: corner_all_default, topLeft: corner_top_left_default, topRight: corner_top_right_default, bottomLeft: corner_bottom_left_default, bottomRight: corner_bottom_right_default }; const MIN_BORDER_RADIUS_VALUE = 0; const MAX_BORDER_RADIUS_VALUES = { px: 100, em: 20, rem: 20 }; ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/single-input-control.js function SingleInputControl({ corner, onChange, selectedUnits, setSelectedUnits, values: valuesProp, units, presets }) { const changeCornerValue = (validatedValue) => { if (corner === "all") { onChange({ topLeft: validatedValue, topRight: validatedValue, bottomLeft: validatedValue, bottomRight: validatedValue }); } else { onChange({ ...values, [corner]: validatedValue }); } }; const onChangeValue = (next) => { if (!onChange) { return; } const isNumeric = !isNaN(parseFloat(next)); const nextValue = isNumeric ? next : void 0; changeCornerValue(nextValue); }; const onChangeUnit = (next) => { const newUnits = { ...selectedUnits }; if (corner === "all") { newUnits.flat = next; newUnits.topLeft = next; newUnits.topRight = next; newUnits.bottomLeft = next; newUnits.bottomRight = next; } else { newUnits[corner] = next; } setSelectedUnits(newUnits); }; const values = typeof valuesProp !== "string" ? valuesProp : { topLeft: valuesProp, topRight: valuesProp, bottomLeft: valuesProp, bottomRight: valuesProp }; let value; if (corner === "all") { const convertedValues = convertPresetsToCustomValues(values, presets); const customValue = getAllValue(convertedValues); value = utils_getPresetValueFromCustomValue(customValue, presets); } else { value = utils_getPresetValueFromCustomValue(values[corner], presets); } const resolvedPresetValue = isValuePreset(value) ? utils_getCustomValueFromPreset(value, presets) : value; const [parsedQuantity, parsedUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(resolvedPresetValue); const computedUnit = value ? parsedUnit : selectedUnits[corner] || selectedUnits.flat || "px"; const unitConfig = units && units.find((item) => item.value === computedUnit); const step = unitConfig?.step || 1; const [showCustomValueControl, setShowCustomValueControl] = (0,external_wp_element_namespaceObject.useState)( value !== void 0 && !isValuePreset(value) ); const showRangeControl = presets.length <= constants_RANGE_CONTROL_MAX_SIZE; const presetIndex = utils_getSliderValueFromPreset(value, presets); const rangeTooltip = (newValue) => value === void 0 ? void 0 : presets[newValue]?.name; const marks = presets.slice(1, presets.length - 1).map((_newValue, index) => ({ value: index + 1, label: void 0 })); const hasPresets = marks.length > 0; let options = []; if (!showRangeControl) { options = [ ...presets, { name: (0,external_wp_i18n_namespaceObject.__)("Custom"), slug: "custom", size: resolvedPresetValue } ].map((size, index) => ({ key: index, name: size.name })); } const icon = constants_ICONS[corner]; const handleSliderChange = (next) => { const val = next !== void 0 ? `${next}${computedUnit}` : void 0; changeCornerValue(val); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Icon, { className: "components-border-radius-control__icon", icon, size: 24 } ), (!hasPresets || showCustomValueControl) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-border-radius-control__input-controls-wrapper", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: CORNERS[corner], placement: "top", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-border-radius-control__tooltip-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { className: "components-border-radius-control__unit-control", "aria-label": CORNERS[corner], value: [parsedQuantity, computedUnit].join( "" ), onChange: onChangeValue, onUnitChange: onChangeUnit, size: "__unstable-large", min: MIN_BORDER_RADIUS_VALUE, units } ) }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Border radius"), hideLabelFromVision: true, className: "components-border-radius-control__range-control", value: parsedQuantity ?? "", min: MIN_BORDER_RADIUS_VALUE, max: MAX_BORDER_RADIUS_VALUES[computedUnit], initialPosition: 0, withInputField: false, onChange: handleSliderChange, step, __nextHasNoMarginBottom: true } ) ] }), hasPresets && showRangeControl && !showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, className: "components-border-radius-control__range-control", value: presetIndex, onChange: (newSize) => { changeCornerValue( getPresetValueFromControlValue( newSize, "range", presets ) ); }, withInputField: false, "aria-valuenow": presetIndex, "aria-valuetext": presets[presetIndex]?.name, renderTooltipContent: rangeTooltip, min: 0, max: presets.length - 1, marks, label: CORNERS[corner], hideLabelFromVision: true, __nextHasNoMarginBottom: true } ), !showRangeControl && !showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CustomSelectControl, { className: "components-border-radius-control__custom-select-control", value: options.find( (option) => option.key === presetIndex ) || options[options.length - 1], onChange: (selection) => { if (selection.selectedItem.key === options.length - 1) { setShowCustomValueControl(true); } else { changeCornerValue( getPresetValueFromControlValue( selection.selectedItem.key, "selectList", presets ) ); } }, options, label: CORNERS[corner], hideLabelFromVision: true, size: "__unstable-large" } ), hasPresets && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)("Use border radius preset") : (0,external_wp_i18n_namespaceObject.__)("Set custom border radius"), icon: settings_settings_default, onClick: () => { setShowCustomValueControl(!showCustomValueControl); }, isPressed: showCustomValueControl, size: "small", className: "components-border-radius-control__custom-toggle", iconSize: 24 } ) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/index.js function useBorderRadiusSizes(presets) { const defaultSizes = presets?.default ?? constants_EMPTY_ARRAY; const customSizes = presets?.custom ?? constants_EMPTY_ARRAY; const themeSizes = presets?.theme ?? constants_EMPTY_ARRAY; return (0,external_wp_element_namespaceObject.useMemo)(() => { const sizes = [ { name: (0,external_wp_i18n_namespaceObject.__)("None"), slug: "0", size: 0 }, ...customSizes, ...themeSizes, ...defaultSizes ]; return sizes.length > constants_RANGE_CONTROL_MAX_SIZE ? [ { name: (0,external_wp_i18n_namespaceObject.__)("Default"), slug: "default", size: void 0 }, ...sizes ] : sizes; }, [customSizes, themeSizes, defaultSizes]); } function BorderRadiusControl({ onChange, values, presets }) { const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)( !hasDefinedValues(values) || !hasMixedValues(values) ); const options = useBorderRadiusSizes(presets); const [selectedUnits, setSelectedUnits] = (0,external_wp_element_namespaceObject.useState)({ flat: typeof values === "string" ? (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values)[1] : void 0, topLeft: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.topLeft)[1], topRight: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.topRight)[1], bottomLeft: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.bottomLeft)[1], bottomRight: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)( values?.bottomRight )[1] }); const [availableUnits] = use_settings_useSettings("spacing.units"); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || ["px", "em", "rem"] }); const toggleLinked = () => setIsLinked(!isLinked); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "components-border-radius-control", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "components-border-radius-control__header", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Radius") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkedButton, { onClick: toggleLinked, isLinked }) ] }), isLinked ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SingleInputControl, { onChange, selectedUnits, setSelectedUnits, values, units, corner: "all", presets: options } ) }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { children: [ "topLeft", "topRight", "bottomLeft", "bottomRight" ].map((corner) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SingleInputControl, { onChange, selectedUnits, setSelectedUnits, values: values || constants_DEFAULT_VALUES, units, corner, presets: options }, corner )) }) ] }); } ;// ./node_modules/@wordpress/icons/build-module/library/check.js var check_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" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/shadow.js var shadow_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/shadow-panel-components.js const shadow_panel_components_EMPTY_ARRAY = []; function ShadowPopoverContainer({ shadow, onShadowChange, settings }) { const shadows = useShadowPresets(settings); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-global-styles__shadow-popover-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 5, children: (0,external_wp_i18n_namespaceObject.__)("Drop shadow") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShadowPresets, { presets: shadows, activeShadow: shadow, onSelect: onShadowChange } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-global-styles__clear-shadow", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => onShadowChange(void 0), disabled: !shadow, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)("Clear") } ) }) ] }) }); } function ShadowPresets({ presets, activeShadow, onSelect }) { return !presets ? null : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite, { role: "listbox", className: "block-editor-global-styles__shadow__list", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Drop shadows"), children: presets.map(({ name, slug, shadow }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShadowIndicator, { label: name, isActive: shadow === activeShadow, type: slug === "unset" ? "unset" : "preset", onSelect: () => onSelect(shadow === activeShadow ? void 0 : shadow), shadow }, slug )) } ); } function ShadowIndicator({ type, label, isActive, onSelect, shadow }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: label, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite.Item, { role: "option", "aria-label": label, "aria-selected": isActive, className: dist_clsx("block-editor-global-styles__shadow__item", { "is-active": isActive }), render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "button", { className: dist_clsx( "block-editor-global-styles__shadow-indicator", { unset: type === "unset" } ), onClick: onSelect, style: { boxShadow: shadow }, "aria-label": label, children: isActive && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: check_check_default }) } ) } ) }); } function ShadowPopover({ shadow, onShadowChange, settings }) { const popoverProps = { placement: "left-start", offset: 36, shift: true }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, className: "block-editor-global-styles__shadow-dropdown", renderToggle: renderShadowToggle(shadow, onShadowChange), renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "medium", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShadowPopoverContainer, { shadow, onShadowChange, settings } ) }) } ); } function renderShadowToggle(shadow, onShadowChange) { return ({ onToggle, isOpen }) => { const shadowButtonRef = (0,external_wp_element_namespaceObject.useRef)(void 0); const toggleProps = { onClick: onToggle, className: dist_clsx( "block-editor-global-styles__shadow-dropdown-toggle", { "is-open": isOpen } ), "aria-expanded": isOpen, ref: shadowButtonRef }; const removeButtonProps = { onClick: () => { if (isOpen) { onToggle(); } onShadowChange(void 0); shadowButtonRef.current?.focus(); }, className: dist_clsx( "block-editor-global-styles__shadow-editor__remove-button", { "is-open": isOpen } ), label: (0,external_wp_i18n_namespaceObject.__)("Remove") }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...toggleProps, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( icon_default, { className: "block-editor-global-styles__toggle-icon", icon: shadow_default, size: 24 } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Drop shadow") }) ] }) }), !!shadow && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, size: "small", icon: reset_default, ...removeButtonProps } ) ] }); }; } function useShadowPresets(settings) { return (0,external_wp_element_namespaceObject.useMemo)(() => { if (!settings?.shadow) { return shadow_panel_components_EMPTY_ARRAY; } const defaultPresetsEnabled = settings?.shadow?.defaultPresets; const { default: defaultShadows, theme: themeShadows, custom: customShadows } = settings?.shadow?.presets ?? {}; const unsetShadow = { name: (0,external_wp_i18n_namespaceObject.__)("Unset"), slug: "unset", shadow: "none" }; const shadowPresets = [ ...defaultPresetsEnabled && defaultShadows || shadow_panel_components_EMPTY_ARRAY, ...themeShadows || shadow_panel_components_EMPTY_ARRAY, ...customShadows || shadow_panel_components_EMPTY_ARRAY ]; if (shadowPresets.length) { shadowPresets.unshift(unsetShadow); } return shadowPresets; }, [settings]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/border-panel.js function useHasBorderPanel(settings) { const controls = Object.values(useHasBorderPanelControls(settings)); return controls.some(Boolean); } function useHasBorderPanelControls(settings) { const controls = { hasBorderColor: useHasBorderColorControl(settings), hasBorderRadius: useHasBorderRadiusControl(settings), hasBorderStyle: useHasBorderStyleControl(settings), hasBorderWidth: useHasBorderWidthControl(settings), hasShadow: useHasShadowControl(settings) }; return controls; } function useHasBorderColorControl(settings) { return settings?.border?.color; } function useHasBorderRadiusControl(settings) { return settings?.border?.radius; } function useHasBorderStyleControl(settings) { return settings?.border?.style; } function useHasBorderWidthControl(settings) { return settings?.border?.width; } function useHasShadowControl(settings) { const shadows = useShadowPresets(settings); return !!settings?.shadow && shadows.length > 0; } function BorderToolsPanel({ resetAllFilter, onChange, value, panelId, children, label }) { const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanel, { label, resetAll, panelId, dropdownMenuProps, children } ); } const border_panel_DEFAULT_CONTROLS = { radius: true, color: true, width: true, shadow: true }; function BorderPanel({ as: Wrapper = BorderToolsPanel, value, onChange, inheritedValue = value, settings, panelId, name, defaultControls = border_panel_DEFAULT_CONTROLS }) { const colors = useColorsPerOrigin(settings); const decodeValue = (0,external_wp_element_namespaceObject.useCallback)( (rawValue) => getValueFromVariable({ settings }, "", rawValue), [settings] ); const encodeColorValue = (colorValue) => { const allColors = colors.flatMap( ({ colors: originColors }) => originColors ); const colorObject = allColors.find( ({ color }) => color === colorValue ); return colorObject ? "var:preset|color|" + colorObject.slug : colorValue; }; const border = (0,external_wp_element_namespaceObject.useMemo)(() => { if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(inheritedValue?.border)) { const borderValue = { ...inheritedValue?.border }; ["top", "right", "bottom", "left"].forEach((side) => { borderValue[side] = { ...borderValue[side], color: decodeValue(borderValue[side]?.color) }; }); return borderValue; } return { ...inheritedValue?.border, color: inheritedValue?.border?.color ? decodeValue(inheritedValue?.border?.color) : void 0 }; }, [inheritedValue?.border, decodeValue]); const setBorder = (newBorder) => onChange({ ...value, border: newBorder }); const showBorderColor = useHasBorderColorControl(settings); const showBorderStyle = useHasBorderStyleControl(settings); const showBorderWidth = useHasBorderWidthControl(settings); const showBorderRadius = useHasBorderRadiusControl(settings); const borderRadiusValues = (0,external_wp_element_namespaceObject.useMemo)(() => { if (typeof inheritedValue?.border?.radius !== "object") { return decodeValue(inheritedValue?.border?.radius); } return { topLeft: decodeValue(inheritedValue?.border?.radius?.topLeft), topRight: decodeValue(inheritedValue?.border?.radius?.topRight), bottomLeft: decodeValue( inheritedValue?.border?.radius?.bottomLeft ), bottomRight: decodeValue( inheritedValue?.border?.radius?.bottomRight ) }; }, [inheritedValue?.border?.radius, decodeValue]); const setBorderRadius = (newBorderRadius) => setBorder({ ...border, radius: newBorderRadius }); const hasBorderRadius = () => { const borderValues = value?.border?.radius; if (typeof borderValues === "object") { return Object.entries(borderValues).some(Boolean); } return !!borderValues; }; const hasShadowControl = useHasShadowControl(settings); const shadow = decodeValue(inheritedValue?.shadow); const shadowPresets = settings?.shadow?.presets ?? {}; const mergedShadowPresets = shadowPresets.custom ?? shadowPresets.theme ?? shadowPresets.default ?? []; const setShadow = (newValue) => { const slug = mergedShadowPresets?.find( ({ shadow: shadowName }) => shadowName === newValue )?.slug; onChange( setImmutably( value, ["shadow"], slug ? `var:preset|shadow|${slug}` : newValue || void 0 ) ); }; const hasShadow = () => !!value?.shadow; const resetShadow = () => setShadow(void 0); const resetBorder = () => { if (hasBorderRadius()) { return setBorder({ radius: value?.border?.radius }); } setBorder(void 0); }; const onBorderChange = (newBorder) => { const updatedBorder = { ...newBorder }; if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(updatedBorder)) { ["top", "right", "bottom", "left"].forEach((side) => { if (updatedBorder[side]) { updatedBorder[side] = { ...updatedBorder[side], color: encodeColorValue(updatedBorder[side]?.color) }; } }); } else if (updatedBorder) { updatedBorder.color = encodeColorValue(updatedBorder.color); } setBorder({ radius: border?.radius, ...updatedBorder }); }; const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => { return { ...previousValue, border: void 0, shadow: void 0 }; }, []); const showBorderByDefault = defaultControls?.color || defaultControls?.width; const hasBorderControl = showBorderColor || showBorderStyle || showBorderWidth || showBorderRadius; const label = useBorderPanelLabel({ blockName: name, hasShadowControl, hasBorderControl }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( Wrapper, { resetAllFilter, value, onChange, panelId, label, children: [ (showBorderWidth || showBorderColor) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => (0,external_wp_components_namespaceObject.__experimentalIsDefinedBorder)(value?.border), label: (0,external_wp_i18n_namespaceObject.__)("Border"), onDeselect: () => resetBorder(), isShownByDefault: showBorderByDefault, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.BorderBoxControl, { colors, enableAlpha: true, enableStyle: showBorderStyle, onChange: onBorderChange, popoverOffset: 40, popoverPlacement: "left-start", value: border, __experimentalIsRenderedInSidebar: true, size: "__unstable-large", hideLabelFromVision: !hasShadowControl, label: (0,external_wp_i18n_namespaceObject.__)("Border") } ) } ), showBorderRadius && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: hasBorderRadius, label: (0,external_wp_i18n_namespaceObject.__)("Radius"), onDeselect: () => setBorderRadius(void 0), isShownByDefault: defaultControls.radius, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BorderRadiusControl, { presets: settings?.border?.radiusSizes, values: borderRadiusValues, onChange: (newValue) => { setBorderRadius(newValue || void 0); } } ) } ), hasShadowControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)("Shadow"), hasValue: hasShadow, onDeselect: resetShadow, isShownByDefault: defaultControls.shadow, panelId, children: [ hasBorderControl ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Shadow") }) : null, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShadowPopover, { shadow, onShadowChange: setShadow, settings } ) ] } ) ] } ); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/border.js const BORDER_SUPPORT_KEY = "__experimentalBorder"; const SHADOW_SUPPORT_KEY = "shadow"; const getColorByProperty = (colors, property, value) => { let matchedColor; colors.some( (origin) => origin.colors.some((color) => { if (color[property] === value) { matchedColor = color; return true; } return false; }) ); return matchedColor; }; const getMultiOriginColor = ({ colors, namedColor, customColor }) => { if (namedColor) { const colorObject2 = getColorByProperty(colors, "slug", namedColor); if (colorObject2) { return colorObject2; } } if (!customColor) { return { color: void 0 }; } const colorObject = getColorByProperty(colors, "color", customColor); return colorObject ? colorObject : { color: customColor }; }; function getColorSlugFromVariable(value) { const namedColor = /var:preset\|color\|(.+)/.exec(value); if (namedColor && namedColor[1]) { return namedColor[1]; } return null; } function styleToAttributes(style) { if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(style?.border)) { return { style, borderColor: void 0 }; } const borderColorValue = style?.border?.color; const borderColorSlug = borderColorValue?.startsWith("var:preset|color|") ? borderColorValue.substring("var:preset|color|".length) : void 0; const updatedStyle = { ...style }; updatedStyle.border = { ...updatedStyle.border, color: borderColorSlug ? void 0 : borderColorValue }; return { style: utils_cleanEmptyObject(updatedStyle), borderColor: borderColorSlug }; } function attributesToStyle(attributes) { if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(attributes.style?.border)) { return attributes.style; } return { ...attributes.style, border: { ...attributes.style?.border, color: attributes.borderColor ? "var:preset|color|" + attributes.borderColor : attributes.style?.border?.color } }; } function BordersInspectorControl({ label, children, resetAllFilter }) { const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)( (attributes) => { const existingStyle = attributesToStyle(attributes); const updatedStyle = resetAllFilter(existingStyle); return { ...attributes, ...styleToAttributes(updatedStyle) }; }, [resetAllFilter] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inspector_controls_default, { group: "border", resetAllFilter: attributesResetAllFilter, label, children } ); } function border_BorderPanel({ clientId, name, setAttributes, settings }) { const isEnabled = useHasBorderPanel(settings); function selector(select) { const { style: style2, borderColor: borderColor2 } = select(store).getBlockAttributes(clientId) || {}; return { style: style2, borderColor: borderColor2 }; } const { style, borderColor } = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId]); const value = (0,external_wp_element_namespaceObject.useMemo)(() => { return attributesToStyle({ style, borderColor }); }, [style, borderColor]); const onChange = (newStyle) => { setAttributes(styleToAttributes(newStyle)); }; if (!isEnabled) { return null; } const defaultControls = { ...(0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ BORDER_SUPPORT_KEY, "__experimentalDefaultControls" ]), ...(0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ SHADOW_SUPPORT_KEY, "__experimentalDefaultControls" ]) }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BorderPanel, { as: BordersInspectorControl, panelId: clientId, settings, value, onChange, defaultControls } ); } function hasBorderSupport(blockName, feature = "any") { if (external_wp_element_namespaceObject.Platform.OS !== "web") { return false; } const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, BORDER_SUPPORT_KEY); if (support === true) { return true; } if (feature === "any") { return !!(support?.color || support?.radius || support?.width || support?.style); } return !!support?.[feature]; } function hasShadowSupport(blockName) { return hasBlockSupport(blockName, SHADOW_SUPPORT_KEY); } function useBorderPanelLabel({ blockName, hasBorderControl, hasShadowControl } = {}) { const settings = useBlockSettings(blockName); const controls = useHasBorderPanelControls(settings); if (!hasBorderControl && !hasShadowControl && blockName) { hasBorderControl = controls?.hasBorderColor || controls?.hasBorderStyle || controls?.hasBorderWidth || controls?.hasBorderRadius; hasShadowControl = controls?.hasShadow; } if (hasBorderControl && hasShadowControl) { return (0,external_wp_i18n_namespaceObject.__)("Border & Shadow"); } if (hasShadowControl) { return (0,external_wp_i18n_namespaceObject.__)("Shadow"); } return (0,external_wp_i18n_namespaceObject.__)("Border"); } function removeBorderAttribute(style, attribute) { return cleanEmptyObject({ ...style, border: { ...style?.border, [attribute]: void 0 } }); } function addAttributes(settings) { if (!hasBorderSupport(settings, "color")) { return settings; } if (settings.attributes.borderColor) { return settings; } return { ...settings, attributes: { ...settings.attributes, borderColor: { type: "string" } } }; } function border_addSaveProps(props, blockNameOrType, attributes) { if (!hasBorderSupport(blockNameOrType, "color") || shouldSkipSerialization(blockNameOrType, BORDER_SUPPORT_KEY, "color")) { return props; } const borderClasses = getBorderClasses(attributes); const newClassName = dist_clsx(props.className, borderClasses); props.className = newClassName ? newClassName : void 0; return props; } function getBorderClasses(attributes) { const { borderColor, style } = attributes; const borderColorClass = getColorClassName("border-color", borderColor); return dist_clsx({ "has-border-color": borderColor || style?.border?.color, [borderColorClass]: !!borderColorClass }); } function border_useBlockProps({ name, borderColor, style }) { const { colors } = useMultipleOriginColorsAndGradients(); if (!hasBorderSupport(name, "color") || shouldSkipSerialization(name, BORDER_SUPPORT_KEY, "color")) { return {}; } const { color: borderColorValue } = getMultiOriginColor({ colors, namedColor: borderColor }); const { color: borderTopColor } = getMultiOriginColor({ colors, namedColor: getColorSlugFromVariable(style?.border?.top?.color) }); const { color: borderRightColor } = getMultiOriginColor({ colors, namedColor: getColorSlugFromVariable(style?.border?.right?.color) }); const { color: borderBottomColor } = getMultiOriginColor({ colors, namedColor: getColorSlugFromVariable(style?.border?.bottom?.color) }); const { color: borderLeftColor } = getMultiOriginColor({ colors, namedColor: getColorSlugFromVariable(style?.border?.left?.color) }); const extraStyles = { borderTopColor: borderTopColor || borderColorValue, borderRightColor: borderRightColor || borderColorValue, borderBottomColor: borderBottomColor || borderColorValue, borderLeftColor: borderLeftColor || borderColorValue }; return border_addSaveProps( { style: utils_cleanEmptyObject(extraStyles) || {} }, name, { borderColor, style } ); } var border_default = { useBlockProps: border_useBlockProps, addSaveProps: border_addSaveProps, attributeKeys: ["borderColor", "style"], hasSupport(name) { return hasBorderSupport(name, "color"); } }; (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/border/addAttributes", addAttributes ); ;// ./node_modules/@wordpress/block-editor/build-module/components/gradients/use-gradient.js function __experimentalGetGradientClass(gradientSlug) { if (!gradientSlug) { return void 0; } return `has-${gradientSlug}-gradient-background`; } function getGradientValueBySlug(gradients, slug) { const gradient = gradients?.find((g) => g.slug === slug); return gradient && gradient.gradient; } function __experimentalGetGradientObjectByGradientValue(gradients, value) { const gradient = gradients?.find((g) => g.gradient === value); return gradient; } function getGradientSlugByValue(gradients, value) { const gradient = __experimentalGetGradientObjectByGradientValue( gradients, value ); return gradient && gradient.slug; } function __experimentalUseGradient({ gradientAttribute = "gradient", customGradientAttribute = "customGradient" } = {}) { const { clientId } = useBlockEditContext(); const [ userGradientPalette, themeGradientPalette, defaultGradientPalette ] = use_settings_useSettings( "color.gradients.custom", "color.gradients.theme", "color.gradients.default" ); const allGradients = (0,external_wp_element_namespaceObject.useMemo)( () => [ ...userGradientPalette || [], ...themeGradientPalette || [], ...defaultGradientPalette || [] ], [userGradientPalette, themeGradientPalette, defaultGradientPalette] ); const { gradient, customGradient } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockAttributes } = select(store); const attributes = getBlockAttributes(clientId) || {}; return { customGradient: attributes[customGradientAttribute], gradient: attributes[gradientAttribute] }; }, [clientId, gradientAttribute, customGradientAttribute] ); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const setGradient = (0,external_wp_element_namespaceObject.useCallback)( (newGradientValue) => { const slug = getGradientSlugByValue( allGradients, newGradientValue ); if (slug) { updateBlockAttributes(clientId, { [gradientAttribute]: slug, [customGradientAttribute]: void 0 }); return; } updateBlockAttributes(clientId, { [gradientAttribute]: void 0, [customGradientAttribute]: newGradientValue }); }, [allGradients, clientId, updateBlockAttributes] ); const gradientClass = __experimentalGetGradientClass(gradient); let gradientValue; if (gradient) { gradientValue = getGradientValueBySlug(allGradients, gradient); } else { gradientValue = customGradient; } return { gradientClass, gradientValue, setGradient }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/control.js const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis); const colorsAndGradientKeys = [ "colors", "disableCustomColors", "gradients", "disableCustomGradients" ]; const TAB_IDS = { color: "color", gradient: "gradient" }; function ColorGradientControlInner({ colors, gradients, disableCustomColors, disableCustomGradients, __experimentalIsRenderedInSidebar, className, label, onColorChange, onGradientChange, colorValue, gradientValue, clearable, showTitle = true, enableAlpha, headingLevel }) { const canChooseAColor = onColorChange && (colors && colors.length > 0 || !disableCustomColors); const canChooseAGradient = onGradientChange && (gradients && gradients.length > 0 || !disableCustomGradients); if (!canChooseAColor && !canChooseAGradient) { return null; } const tabPanels = { [TAB_IDS.color]: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ColorPalette, { value: colorValue, onChange: canChooseAGradient ? (newColor) => { onColorChange(newColor); onGradientChange(); } : onColorChange, ...{ colors, disableCustomColors }, __experimentalIsRenderedInSidebar, clearable, enableAlpha, headingLevel } ), [TAB_IDS.gradient]: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.GradientPicker, { value: gradientValue, onChange: canChooseAColor ? (newGradient) => { onGradientChange(newGradient); onColorChange(); } : onGradientChange, ...{ gradients, disableCustomGradients }, __experimentalIsRenderedInSidebar, clearable, headingLevel } ) }; const renderPanelType = (type) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-color-gradient-control__panel", children: tabPanels[type] }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, className: dist_clsx( "block-editor-color-gradient-control", className ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("fieldset", { className: "block-editor-color-gradient-control__fieldset", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [ showTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("legend", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-color-gradient-control__color-indicator", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: label }) }) }), canChooseAColor && canChooseAGradient && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( Tabs, { defaultTabId: gradientValue ? TAB_IDS.gradient : !!canChooseAColor && TAB_IDS.color, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.TabList, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: TAB_IDS.color, children: (0,external_wp_i18n_namespaceObject.__)("Color") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: TAB_IDS.gradient, children: (0,external_wp_i18n_namespaceObject.__)("Gradient") }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Tabs.TabPanel, { tabId: TAB_IDS.color, className: "block-editor-color-gradient-control__panel", focusable: false, children: tabPanels.color } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Tabs.TabPanel, { tabId: TAB_IDS.gradient, className: "block-editor-color-gradient-control__panel", focusable: false, children: tabPanels.gradient } ) ] } ) }), !canChooseAGradient && renderPanelType(TAB_IDS.color), !canChooseAColor && renderPanelType(TAB_IDS.gradient) ] }) }) } ); } function ColorGradientControlSelect(props) { const [colors, gradients, customColors, customGradients] = use_settings_useSettings( "color.palette", "color.gradients", "color.custom", "color.customGradient" ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ColorGradientControlInner, { colors, gradients, disableCustomColors: !customColors, disableCustomGradients: !customGradients, ...props } ); } function ColorGradientControl(props) { if (colorsAndGradientKeys.every((key) => props.hasOwnProperty(key))) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorGradientControlInner, { ...props }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorGradientControlSelect, { ...props }); } var control_default = ColorGradientControl; ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/color-panel.js function useHasColorPanel(settings) { const hasTextPanel = useHasTextPanel(settings); const hasBackgroundPanel = useHasBackgroundColorPanel(settings); const hasLinkPanel = useHasLinkPanel(settings); const hasHeadingPanel = useHasHeadingPanel(settings); const hasButtonPanel = useHasButtonPanel(settings); const hasCaptionPanel = useHasCaptionPanel(settings); return hasTextPanel || hasBackgroundPanel || hasLinkPanel || hasHeadingPanel || hasButtonPanel || hasCaptionPanel; } function useHasTextPanel(settings) { const colors = useColorsPerOrigin(settings); return settings?.color?.text && (colors?.length > 0 || settings?.color?.custom); } function useHasLinkPanel(settings) { const colors = useColorsPerOrigin(settings); return settings?.color?.link && (colors?.length > 0 || settings?.color?.custom); } function useHasCaptionPanel(settings) { const colors = useColorsPerOrigin(settings); return settings?.color?.caption && (colors?.length > 0 || settings?.color?.custom); } function useHasHeadingPanel(settings) { const colors = useColorsPerOrigin(settings); const gradients = useGradientsPerOrigin(settings); return settings?.color?.heading && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient); } function useHasButtonPanel(settings) { const colors = useColorsPerOrigin(settings); const gradients = useGradientsPerOrigin(settings); return settings?.color?.button && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient); } function useHasBackgroundColorPanel(settings) { const colors = useColorsPerOrigin(settings); const gradients = useGradientsPerOrigin(settings); return settings?.color?.background && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient); } function ColorToolsPanel({ resetAllFilter, onChange, value, panelId, children }) { const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject.__)("Elements"), resetAll, panelId, hasInnerWrapper: true, headingLevel: 3, className: "color-block-support-panel", __experimentalFirstVisibleItemClass: "first", __experimentalLastVisibleItemClass: "last", dropdownMenuProps, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "color-block-support-panel__inner-wrapper", children }) } ); } const color_panel_DEFAULT_CONTROLS = { text: true, background: true, link: true, heading: true, button: true, caption: true }; const popoverProps = { placement: "left-start", offset: 36, shift: true }; const { Tabs: color_panel_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); const LabeledColorIndicators = ({ indicators, label }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { isLayered: false, offset: -8, children: indicators.map((indicator, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { expanded: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { colorValue: indicator }) }, index)) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "block-editor-panel-color-gradient-settings__color-name", children: label }) ] }); function ColorPanelTab({ isGradient, inheritedValue, userValue, setValue, colorGradientControlSettings }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( control_default, { ...colorGradientControlSettings, showTitle: false, enableAlpha: true, __experimentalIsRenderedInSidebar: true, colorValue: isGradient ? void 0 : inheritedValue, gradientValue: isGradient ? inheritedValue : void 0, onColorChange: isGradient ? void 0 : setValue, onGradientChange: isGradient ? setValue : void 0, clearable: inheritedValue === userValue, headingLevel: 3 } ); } function ColorPanelDropdown({ label, hasValue, resetValue, isShownByDefault, indicators, tabs, colorGradientControlSettings, panelId }) { const currentTab = tabs.find((tab) => tab.userValue !== void 0); const { key: firstTabKey, ...firstTab } = tabs[0] ?? {}; const colorGradientDropdownButtonRef = (0,external_wp_element_namespaceObject.useRef)(void 0); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "block-editor-tools-panel-color-gradient-settings__item", hasValue, label, onDeselect: resetValue, isShownByDefault, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, className: "block-editor-tools-panel-color-gradient-settings__dropdown", renderToggle: ({ onToggle, isOpen }) => { const toggleProps = { onClick: onToggle, className: dist_clsx( "block-editor-panel-color-gradient-settings__dropdown", { "is-open": isOpen } ), "aria-expanded": isOpen, ref: colorGradientDropdownButtonRef }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...toggleProps, __next40pxDefaultSize: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( LabeledColorIndicators, { indicators, label } ) }), hasValue() && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Reset"), className: "block-editor-panel-color-gradient-settings__reset", size: "small", icon: reset_default, onClick: () => { resetValue(); if (isOpen) { onToggle(); } colorGradientDropdownButtonRef.current?.focus(); } } ) ] }); }, renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-panel-color-gradient-settings__dropdown-content", children: [ tabs.length === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ColorPanelTab, { ...firstTab, colorGradientControlSettings }, firstTabKey ), tabs.length > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(color_panel_Tabs, { defaultTabId: currentTab?.key, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(color_panel_Tabs.TabList, { children: tabs.map((tab) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( color_panel_Tabs.Tab, { tabId: tab.key, children: tab.label }, tab.key )) }), tabs.map((tab) => { const { key: tabKey, ...restTabProps } = tab; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( color_panel_Tabs.TabPanel, { tabId: tabKey, focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ColorPanelTab, { ...restTabProps, colorGradientControlSettings }, tabKey ) }, tabKey ); }) ] }) ] }) }) } ) } ); } function ColorPanel({ as: Wrapper = ColorToolsPanel, value, onChange, inheritedValue = value, settings, panelId, defaultControls = color_panel_DEFAULT_CONTROLS, children }) { const colors = useColorsPerOrigin(settings); const gradients = useGradientsPerOrigin(settings); const areCustomSolidsEnabled = settings?.color?.custom; const areCustomGradientsEnabled = settings?.color?.customGradient; const hasSolidColors = colors.length > 0 || areCustomSolidsEnabled; const hasGradientColors = gradients.length > 0 || areCustomGradientsEnabled; const decodeValue = (rawValue) => getValueFromVariable({ settings }, "", rawValue); const encodeColorValue = (colorValue) => { const allColors = colors.flatMap( ({ colors: originColors }) => originColors ); const colorObject = allColors.find( ({ color }) => color === colorValue ); return colorObject ? "var:preset|color|" + colorObject.slug : colorValue; }; const encodeGradientValue = (gradientValue) => { const allGradients = gradients.flatMap( ({ gradients: originGradients }) => originGradients ); const gradientObject = allGradients.find( ({ gradient: gradient2 }) => gradient2 === gradientValue ); return gradientObject ? "var:preset|gradient|" + gradientObject.slug : gradientValue; }; const showBackgroundPanel = useHasBackgroundColorPanel(settings); const backgroundColor = decodeValue(inheritedValue?.color?.background); const userBackgroundColor = decodeValue(value?.color?.background); const gradient = decodeValue(inheritedValue?.color?.gradient); const userGradient = decodeValue(value?.color?.gradient); const hasBackground = () => !!userBackgroundColor || !!userGradient; const setBackgroundColor = (newColor) => { const newValue = setImmutably( value, ["color", "background"], encodeColorValue(newColor) ); newValue.color.gradient = void 0; onChange(newValue); }; const setGradient = (newGradient) => { const newValue = setImmutably( value, ["color", "gradient"], encodeGradientValue(newGradient) ); newValue.color.background = void 0; onChange(newValue); }; const resetBackground = () => { const newValue = setImmutably( value, ["color", "background"], void 0 ); newValue.color.gradient = void 0; onChange(newValue); }; const showLinkPanel = useHasLinkPanel(settings); const linkColor = decodeValue( inheritedValue?.elements?.link?.color?.text ); const userLinkColor = decodeValue(value?.elements?.link?.color?.text); const setLinkColor = (newColor) => { onChange( setImmutably( value, ["elements", "link", "color", "text"], encodeColorValue(newColor) ) ); }; const hoverLinkColor = decodeValue( inheritedValue?.elements?.link?.[":hover"]?.color?.text ); const userHoverLinkColor = decodeValue( value?.elements?.link?.[":hover"]?.color?.text ); const setHoverLinkColor = (newColor) => { onChange( setImmutably( value, ["elements", "link", ":hover", "color", "text"], encodeColorValue(newColor) ) ); }; const hasLink = () => !!userLinkColor || !!userHoverLinkColor; const resetLink = () => { let newValue = setImmutably( value, ["elements", "link", ":hover", "color", "text"], void 0 ); newValue = setImmutably( newValue, ["elements", "link", "color", "text"], void 0 ); onChange(newValue); }; const showTextPanel = useHasTextPanel(settings); const textColor = decodeValue(inheritedValue?.color?.text); const userTextColor = decodeValue(value?.color?.text); const hasTextColor = () => !!userTextColor; const setTextColor = (newColor) => { let changedObject = setImmutably( value, ["color", "text"], encodeColorValue(newColor) ); if (textColor === linkColor) { changedObject = setImmutably( changedObject, ["elements", "link", "color", "text"], encodeColorValue(newColor) ); } onChange(changedObject); }; const resetTextColor = () => setTextColor(void 0); const elements = [ { name: "caption", label: (0,external_wp_i18n_namespaceObject.__)("Captions"), showPanel: useHasCaptionPanel(settings) }, { name: "button", label: (0,external_wp_i18n_namespaceObject.__)("Button"), showPanel: useHasButtonPanel(settings) }, { name: "heading", label: (0,external_wp_i18n_namespaceObject.__)("Heading"), showPanel: useHasHeadingPanel(settings) }, { name: "h1", label: (0,external_wp_i18n_namespaceObject.__)("H1"), showPanel: useHasHeadingPanel(settings) }, { name: "h2", label: (0,external_wp_i18n_namespaceObject.__)("H2"), showPanel: useHasHeadingPanel(settings) }, { name: "h3", label: (0,external_wp_i18n_namespaceObject.__)("H3"), showPanel: useHasHeadingPanel(settings) }, { name: "h4", label: (0,external_wp_i18n_namespaceObject.__)("H4"), showPanel: useHasHeadingPanel(settings) }, { name: "h5", label: (0,external_wp_i18n_namespaceObject.__)("H5"), showPanel: useHasHeadingPanel(settings) }, { name: "h6", label: (0,external_wp_i18n_namespaceObject.__)("H6"), showPanel: useHasHeadingPanel(settings) } ]; const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => { return { ...previousValue, color: void 0, elements: { ...previousValue?.elements, link: { ...previousValue?.elements?.link, color: void 0, ":hover": { color: void 0 } }, ...elements.reduce((acc, element) => { return { ...acc, [element.name]: { ...previousValue?.elements?.[element.name], color: void 0 } }; }, {}) } }; }, []); const items = [ showTextPanel && { key: "text", label: (0,external_wp_i18n_namespaceObject.__)("Text"), hasValue: hasTextColor, resetValue: resetTextColor, isShownByDefault: defaultControls.text, indicators: [textColor], tabs: [ { key: "text", label: (0,external_wp_i18n_namespaceObject.__)("Text"), inheritedValue: textColor, setValue: setTextColor, userValue: userTextColor } ] }, showBackgroundPanel && { key: "background", label: (0,external_wp_i18n_namespaceObject.__)("Background"), hasValue: hasBackground, resetValue: resetBackground, isShownByDefault: defaultControls.background, indicators: [gradient ?? backgroundColor], tabs: [ hasSolidColors && { key: "background", label: (0,external_wp_i18n_namespaceObject.__)("Color"), inheritedValue: backgroundColor, setValue: setBackgroundColor, userValue: userBackgroundColor }, hasGradientColors && { key: "gradient", label: (0,external_wp_i18n_namespaceObject.__)("Gradient"), inheritedValue: gradient, setValue: setGradient, userValue: userGradient, isGradient: true } ].filter(Boolean) }, showLinkPanel && { key: "link", label: (0,external_wp_i18n_namespaceObject.__)("Link"), hasValue: hasLink, resetValue: resetLink, isShownByDefault: defaultControls.link, indicators: [linkColor, hoverLinkColor], tabs: [ { key: "link", label: (0,external_wp_i18n_namespaceObject.__)("Default"), inheritedValue: linkColor, setValue: setLinkColor, userValue: userLinkColor }, { key: "hover", label: (0,external_wp_i18n_namespaceObject.__)("Hover"), inheritedValue: hoverLinkColor, setValue: setHoverLinkColor, userValue: userHoverLinkColor } ] } ].filter(Boolean); elements.forEach(({ name, label, showPanel }) => { if (!showPanel) { return; } const elementBackgroundColor = decodeValue( inheritedValue?.elements?.[name]?.color?.background ); const elementGradient = decodeValue( inheritedValue?.elements?.[name]?.color?.gradient ); const elementTextColor = decodeValue( inheritedValue?.elements?.[name]?.color?.text ); const elementBackgroundUserColor = decodeValue( value?.elements?.[name]?.color?.background ); const elementGradientUserColor = decodeValue( value?.elements?.[name]?.color?.gradient ); const elementTextUserColor = decodeValue( value?.elements?.[name]?.color?.text ); const hasElement = () => !!(elementTextUserColor || elementBackgroundUserColor || elementGradientUserColor); const resetElement = () => { const newValue = setImmutably( value, ["elements", name, "color", "background"], void 0 ); newValue.elements[name].color.gradient = void 0; newValue.elements[name].color.text = void 0; onChange(newValue); }; const setElementTextColor = (newTextColor) => { onChange( setImmutably( value, ["elements", name, "color", "text"], encodeColorValue(newTextColor) ) ); }; const setElementBackgroundColor = (newBackgroundColor) => { const newValue = setImmutably( value, ["elements", name, "color", "background"], encodeColorValue(newBackgroundColor) ); newValue.elements[name].color.gradient = void 0; onChange(newValue); }; const setElementGradient = (newGradient) => { const newValue = setImmutably( value, ["elements", name, "color", "gradient"], encodeGradientValue(newGradient) ); newValue.elements[name].color.background = void 0; onChange(newValue); }; const supportsTextColor = true; const supportsBackground = name !== "caption"; items.push({ key: name, label, hasValue: hasElement, resetValue: resetElement, isShownByDefault: defaultControls[name], indicators: supportsTextColor && supportsBackground ? [ elementTextColor, elementGradient ?? elementBackgroundColor ] : [ supportsTextColor ? elementTextColor : elementGradient ?? elementBackgroundColor ], tabs: [ hasSolidColors && supportsTextColor && { key: "text", label: (0,external_wp_i18n_namespaceObject.__)("Text"), inheritedValue: elementTextColor, setValue: setElementTextColor, userValue: elementTextUserColor }, hasSolidColors && supportsBackground && { key: "background", label: (0,external_wp_i18n_namespaceObject.__)("Background"), inheritedValue: elementBackgroundColor, setValue: setElementBackgroundColor, userValue: elementBackgroundUserColor }, hasGradientColors && supportsBackground && { key: "gradient", label: (0,external_wp_i18n_namespaceObject.__)("Gradient"), inheritedValue: elementGradient, setValue: setElementGradient, userValue: elementGradientUserColor, isGradient: true } ].filter(Boolean) }); }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( Wrapper, { resetAllFilter, value, onChange, panelId, children: [ items.map((item) => { const { key, ...restItem } = item; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ColorPanelDropdown, { ...restItem, colorGradientControlSettings: { colors, disableCustomColors: !areCustomSolidsEnabled, gradients, disableCustomGradients: !areCustomGradientsEnabled }, panelId }, key ); }), children ] } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/contrast-checker/index.js k([names, a11y]); function ContrastChecker({ backgroundColor, fallbackBackgroundColor, fallbackTextColor, fallbackLinkColor, fontSize, // Font size value in pixels. isLargeText, textColor, linkColor, enableAlphaChecker = false }) { const currentBackgroundColor = backgroundColor || fallbackBackgroundColor; if (!currentBackgroundColor) { return null; } const currentTextColor = textColor || fallbackTextColor; const currentLinkColor = linkColor || fallbackLinkColor; if (!currentTextColor && !currentLinkColor) { return null; } const textColors = [ { color: currentTextColor, description: (0,external_wp_i18n_namespaceObject.__)("text color") }, { color: currentLinkColor, description: (0,external_wp_i18n_namespaceObject.__)("link color") } ]; const colordBackgroundColor = w(currentBackgroundColor); const backgroundColorHasTransparency = colordBackgroundColor.alpha() < 1; const backgroundColorBrightness = colordBackgroundColor.brightness(); const isReadableOptions = { level: "AA", size: isLargeText || isLargeText !== false && fontSize >= 24 ? "large" : "small" }; let message = ""; let speakMessage = ""; for (const item of textColors) { if (!item.color) { continue; } const colordTextColor = w(item.color); const isColordTextReadable = colordTextColor.isReadable( colordBackgroundColor, isReadableOptions ); const textHasTransparency = colordTextColor.alpha() < 1; if (!isColordTextReadable) { if (backgroundColorHasTransparency || textHasTransparency) { continue; } message = backgroundColorBrightness < colordTextColor.brightness() ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s is a type of text color, e.g., "text color" or "link color". (0,external_wp_i18n_namespaceObject.__)( "This color combination may be hard for people to read. Try using a darker background color and/or a brighter %s." ), item.description ) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s is a type of text color, e.g., "text color" or "link color". (0,external_wp_i18n_namespaceObject.__)( "This color combination may be hard for people to read. Try using a brighter background color and/or a darker %s." ), item.description ); speakMessage = (0,external_wp_i18n_namespaceObject.__)( "This color combination may be hard for people to read." ); break; } if (textHasTransparency && enableAlphaChecker) { message = (0,external_wp_i18n_namespaceObject.__)("Transparent text may be hard for people to read."); speakMessage = (0,external_wp_i18n_namespaceObject.__)( "Transparent text may be hard for people to read." ); } } if (!message) { return null; } (0,external_wp_a11y_namespaceObject.speak)(speakMessage); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-contrast-checker", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Notice, { spokenMessage: null, status: "warning", isDismissible: false, children: message } ) }); } var contrast_checker_default = ContrastChecker; ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/block-refs-provider.js const BlockRefs = (0,external_wp_element_namespaceObject.createContext)({ refsMap: (0,external_wp_compose_namespaceObject.observableMap)() }); BlockRefs.displayName = "BlockRefsContext"; function BlockRefsProvider({ children }) { const value = (0,external_wp_element_namespaceObject.useMemo)(() => ({ refsMap: (0,external_wp_compose_namespaceObject.observableMap)() }), []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRefs.Provider, { value, children }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-refs.js function useBlockRefProvider(clientId) { const { refsMap } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); return (0,external_wp_compose_namespaceObject.useRefEffect)( (element) => { refsMap.set(clientId, element); return () => refsMap.delete(clientId); }, [clientId] ); } function assignRef(ref, value) { if (typeof ref === "function") { ref(value); } else if (ref) { ref.current = value; } } function useBlockElementRef(clientId, ref) { const { refsMap } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { assignRef(ref, refsMap.get(clientId)); const unsubscribe = refsMap.subscribe( clientId, () => assignRef(ref, refsMap.get(clientId)) ); return () => { unsubscribe(); assignRef(ref, null); }; }, [refsMap, clientId, ref]); } function useBlockElement(clientId) { const [blockElement, setBlockElement] = (0,external_wp_element_namespaceObject.useState)(null); useBlockElementRef(clientId, setBlockElement); return blockElement; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/contrast-checker.js function getComputedValue(node, property) { return node.ownerDocument.defaultView.getComputedStyle(node).getPropertyValue(property); } function getBlockElementColors(blockEl) { if (!blockEl) { return {}; } const firstLinkElement = blockEl.querySelector("a"); const linkColor = !!firstLinkElement?.innerText ? getComputedValue(firstLinkElement, "color") : void 0; const textColor = getComputedValue(blockEl, "color"); let backgroundColorNode = blockEl; let backgroundColor = getComputedValue( backgroundColorNode, "background-color" ); while (backgroundColor === "rgba(0, 0, 0, 0)" && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === backgroundColorNode.parentNode.ELEMENT_NODE) { backgroundColorNode = backgroundColorNode.parentNode; backgroundColor = getComputedValue( backgroundColorNode, "background-color" ); } return { textColor, backgroundColor, linkColor }; } function contrast_checker_reducer(prevColors, newColors) { const hasChanged = Object.keys(newColors).some( (key) => prevColors[key] !== newColors[key] ); return hasChanged ? newColors : prevColors; } function BlockColorContrastChecker({ clientId }) { const blockEl = useBlockElement(clientId); const [colors, setColors] = (0,external_wp_element_namespaceObject.useReducer)(contrast_checker_reducer, {}); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!blockEl) { return; } function updateColors() { setColors(getBlockElementColors(blockEl)); } window.requestAnimationFrame( () => window.requestAnimationFrame(updateColors) ); }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( contrast_checker_default, { backgroundColor: colors.backgroundColor, textColor: colors.textColor, linkColor: colors.linkColor, enableAlphaChecker: true } ); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/color.js const COLOR_SUPPORT_KEY = "color"; const hasColorSupport = (blockNameOrType) => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, COLOR_SUPPORT_KEY); return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false); }; const hasLinkColorSupport = (blockType) => { if (external_wp_element_namespaceObject.Platform.OS !== "web") { return false; } const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY); return colorSupport !== null && typeof colorSupport === "object" && !!colorSupport.link; }; const hasGradientSupport = (blockNameOrType) => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, COLOR_SUPPORT_KEY); return colorSupport !== null && typeof colorSupport === "object" && !!colorSupport.gradients; }; const hasBackgroundColorSupport = (blockType) => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY); return colorSupport && colorSupport.background !== false; }; const hasTextColorSupport = (blockType) => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY); return colorSupport && colorSupport.text !== false; }; function color_addAttributes(settings) { if (!hasColorSupport(settings)) { return settings; } if (!settings.attributes.backgroundColor) { Object.assign(settings.attributes, { backgroundColor: { type: "string" } }); } if (!settings.attributes.textColor) { Object.assign(settings.attributes, { textColor: { type: "string" } }); } if (hasGradientSupport(settings) && !settings.attributes.gradient) { Object.assign(settings.attributes, { gradient: { type: "string" } }); } return settings; } function color_addSaveProps(props, blockNameOrType, attributes) { if (!hasColorSupport(blockNameOrType) || shouldSkipSerialization(blockNameOrType, COLOR_SUPPORT_KEY)) { return props; } const hasGradient = hasGradientSupport(blockNameOrType); const { backgroundColor, textColor, gradient, style } = attributes; const shouldSerialize = (feature) => !shouldSkipSerialization( blockNameOrType, COLOR_SUPPORT_KEY, feature ); const textClass = shouldSerialize("text") ? getColorClassName("color", textColor) : void 0; const gradientClass = shouldSerialize("gradients") ? __experimentalGetGradientClass(gradient) : void 0; const backgroundClass = shouldSerialize("background") ? getColorClassName("background-color", backgroundColor) : void 0; const serializeHasBackground = shouldSerialize("background") || shouldSerialize("gradients"); const hasBackground = backgroundColor || style?.color?.background || hasGradient && (gradient || style?.color?.gradient); const newClassName = dist_clsx(props.className, textClass, gradientClass, { // Don't apply the background class if there's a custom gradient. [backgroundClass]: (!hasGradient || !style?.color?.gradient) && !!backgroundClass, "has-text-color": shouldSerialize("text") && (textColor || style?.color?.text), "has-background": serializeHasBackground && hasBackground, "has-link-color": shouldSerialize("link") && style?.elements?.link?.color }); props.className = newClassName ? newClassName : void 0; return props; } function color_styleToAttributes(style) { const textColorValue = style?.color?.text; const textColorSlug = textColorValue?.startsWith("var:preset|color|") ? textColorValue.substring("var:preset|color|".length) : void 0; const backgroundColorValue = style?.color?.background; const backgroundColorSlug = backgroundColorValue?.startsWith( "var:preset|color|" ) ? backgroundColorValue.substring("var:preset|color|".length) : void 0; const gradientValue = style?.color?.gradient; const gradientSlug = gradientValue?.startsWith("var:preset|gradient|") ? gradientValue.substring("var:preset|gradient|".length) : void 0; const updatedStyle = { ...style }; updatedStyle.color = { ...updatedStyle.color, text: textColorSlug ? void 0 : textColorValue, background: backgroundColorSlug ? void 0 : backgroundColorValue, gradient: gradientSlug ? void 0 : gradientValue }; return { style: utils_cleanEmptyObject(updatedStyle), textColor: textColorSlug, backgroundColor: backgroundColorSlug, gradient: gradientSlug }; } function color_attributesToStyle(attributes) { return { ...attributes.style, color: { ...attributes.style?.color, text: attributes.textColor ? "var:preset|color|" + attributes.textColor : attributes.style?.color?.text, background: attributes.backgroundColor ? "var:preset|color|" + attributes.backgroundColor : attributes.style?.color?.background, gradient: attributes.gradient ? "var:preset|gradient|" + attributes.gradient : attributes.style?.color?.gradient } }; } function ColorInspectorControl({ children, resetAllFilter }) { const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)( (attributes) => { const existingStyle = color_attributesToStyle(attributes); const updatedStyle = resetAllFilter(existingStyle); return { ...attributes, ...color_styleToAttributes(updatedStyle) }; }, [resetAllFilter] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inspector_controls_default, { group: "color", resetAllFilter: attributesResetAllFilter, children } ); } function ColorEdit({ clientId, name, setAttributes, settings }) { const isEnabled = useHasColorPanel(settings); function selector(select) { const { style: style2, textColor: textColor2, backgroundColor: backgroundColor2, gradient: gradient2 } = select(store).getBlockAttributes(clientId) || {}; return { style: style2, textColor: textColor2, backgroundColor: backgroundColor2, gradient: gradient2 }; } const { style, textColor, backgroundColor, gradient } = (0,external_wp_data_namespaceObject.useSelect)( selector, [clientId] ); const value = (0,external_wp_element_namespaceObject.useMemo)(() => { return color_attributesToStyle({ style, textColor, backgroundColor, gradient }); }, [style, textColor, backgroundColor, gradient]); const onChange = (newStyle) => { setAttributes(color_styleToAttributes(newStyle)); }; if (!isEnabled) { return null; } const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ COLOR_SUPPORT_KEY, "__experimentalDefaultControls" ]); const enableContrastChecking = external_wp_element_namespaceObject.Platform.OS === "web" && !value?.color?.gradient && (settings?.color?.text || settings?.color?.link) && // Contrast checking is enabled by default. // Deactivating it requires `enableContrastChecker` to have // an explicit value of `false`. false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ COLOR_SUPPORT_KEY, "enableContrastChecker" ]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ColorPanel, { as: ColorInspectorControl, panelId: clientId, settings, value, onChange, defaultControls, enableContrastChecker: false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ COLOR_SUPPORT_KEY, "enableContrastChecker" ]), children: enableContrastChecking && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockColorContrastChecker, { clientId }) } ); } function color_useBlockProps({ name, backgroundColor, textColor, gradient, style }) { const [userPalette, themePalette, defaultPalette] = use_settings_useSettings( "color.palette.custom", "color.palette.theme", "color.palette.default" ); const colors = (0,external_wp_element_namespaceObject.useMemo)( () => [ ...userPalette || [], ...themePalette || [], ...defaultPalette || [] ], [userPalette, themePalette, defaultPalette] ); if (!hasColorSupport(name) || shouldSkipSerialization(name, COLOR_SUPPORT_KEY)) { return {}; } const extraStyles = {}; if (textColor && !shouldSkipSerialization(name, COLOR_SUPPORT_KEY, "text")) { extraStyles.color = getColorObjectByAttributeValues( colors, textColor )?.color; } if (backgroundColor && !shouldSkipSerialization(name, COLOR_SUPPORT_KEY, "background")) { extraStyles.backgroundColor = getColorObjectByAttributeValues( colors, backgroundColor )?.color; } const saveProps = color_addSaveProps({ style: extraStyles }, name, { textColor, backgroundColor, gradient, style }); const hasBackgroundValue = backgroundColor || style?.color?.background || gradient || style?.color?.gradient; return { ...saveProps, className: dist_clsx( saveProps.className, // Add background image classes in the editor, if not already handled by background color values. !hasBackgroundValue && getBackgroundImageClasses(style) ) }; } var color_default = { useBlockProps: color_useBlockProps, addSaveProps: color_addSaveProps, attributeKeys: ["backgroundColor", "textColor", "gradient", "style"], hasSupport: hasColorSupport }; const MIGRATION_PATHS = { linkColor: [["style", "elements", "link", "color", "text"]], textColor: [["textColor"], ["style", "color", "text"]], backgroundColor: [ ["backgroundColor"], ["style", "color", "background"] ], gradient: [["gradient"], ["style", "color", "gradient"]] }; function color_addTransforms(result, source, index, results) { const destinationBlockType = result.name; const activeSupports = { linkColor: hasLinkColorSupport(destinationBlockType), textColor: hasTextColorSupport(destinationBlockType), backgroundColor: hasBackgroundColorSupport(destinationBlockType), gradient: hasGradientSupport(destinationBlockType) }; return transformStyles( activeSupports, MIGRATION_PATHS, result, source, index, results ); } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/color/addAttribute", color_addAttributes ); (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.switchToBlockType.transformedBlock", "core/color/addTransforms", color_addTransforms ); ;// ./node_modules/@wordpress/block-editor/build-module/components/font-family/index.js function FontFamilyControl({ /** Start opting into the larger default height that will become the default size in a future version. */ __next40pxDefaultSize = false, /** Start opting into the new margin-free styles that will become the default in a future version. */ __nextHasNoMarginBottom = false, value = "", onChange, fontFamilies, className, ...props }) { const [blockLevelFontFamilies] = use_settings_useSettings("typography.fontFamilies"); if (!fontFamilies) { fontFamilies = blockLevelFontFamilies; } if (!fontFamilies || fontFamilies.length === 0) { return null; } const options = [ { key: "", name: (0,external_wp_i18n_namespaceObject.__)("Default") }, ...fontFamilies.map(({ fontFamily, name }) => ({ key: fontFamily, name: name || fontFamily, style: { fontFamily } })) ]; if (!__nextHasNoMarginBottom) { external_wp_deprecated_default()( "Bottom margin styles for wp.blockEditor.FontFamilyControl", { since: "6.7", version: "7.0", hint: "Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version" } ); } if (!__next40pxDefaultSize && (props.size === void 0 || props.size === "default")) { external_wp_deprecated_default()( `36px default size for wp.blockEditor.__experimentalFontFamilyControl`, { since: "6.8", version: "7.1", hint: "Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version." } ); } const selectedValue = options.find((option) => option.key === value) ?? ""; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CustomSelectControl, { __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Font"), value: selectedValue, onChange: ({ selectedItem }) => onChange(selectedItem.key), options, className: dist_clsx("block-editor-font-family-control", className, { "is-next-has-no-margin-bottom": __nextHasNoMarginBottom }), ...props } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/font-appearance-control/index.js const getFontAppearanceLabel = (hasFontStyles, hasFontWeights) => { if (!hasFontStyles) { return (0,external_wp_i18n_namespaceObject.__)("Font weight"); } if (!hasFontWeights) { return (0,external_wp_i18n_namespaceObject.__)("Font style"); } return (0,external_wp_i18n_namespaceObject.__)("Appearance"); }; function FontAppearanceControl(props) { const { /** Start opting into the larger default height that will become the default size in a future version. */ __next40pxDefaultSize = false, onChange, hasFontStyles = true, hasFontWeights = true, fontFamilyFaces, value: { fontStyle, fontWeight }, ...otherProps } = props; const hasStylesOrWeights = hasFontStyles || hasFontWeights; const label = getFontAppearanceLabel(hasFontStyles, hasFontWeights); const defaultOption = { key: "default", name: (0,external_wp_i18n_namespaceObject.__)("Default"), style: { fontStyle: void 0, fontWeight: void 0 } }; const { fontStyles, fontWeights, combinedStyleAndWeightOptions } = getFontStylesAndWeights(fontFamilyFaces); const combineOptions = () => { const combinedOptions = [defaultOption]; if (combinedStyleAndWeightOptions) { combinedOptions.push(...combinedStyleAndWeightOptions); } return combinedOptions; }; const styleOptions = () => { const combinedOptions = [defaultOption]; fontStyles.forEach(({ name, value }) => { combinedOptions.push({ key: value, name, style: { fontStyle: value, fontWeight: void 0 } }); }); return combinedOptions; }; const weightOptions = () => { const combinedOptions = [defaultOption]; fontWeights.forEach(({ name, value }) => { combinedOptions.push({ key: value, name, style: { fontStyle: void 0, fontWeight: value } }); }); return combinedOptions; }; const selectOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { if (hasFontStyles && hasFontWeights) { return combineOptions(); } return hasFontStyles ? styleOptions() : weightOptions(); }, [ props.options, fontStyles, fontWeights, combinedStyleAndWeightOptions ]); const currentSelection = selectOptions.find( (option) => option.style.fontStyle === fontStyle && option.style.fontWeight === fontWeight ) || selectOptions[0]; const getDescribedBy = () => { if (!currentSelection) { return (0,external_wp_i18n_namespaceObject.__)("No selected font appearance"); } if (!hasFontStyles) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font weight. (0,external_wp_i18n_namespaceObject.__)("Currently selected font weight: %s"), currentSelection.name ); } if (!hasFontWeights) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font style. (0,external_wp_i18n_namespaceObject.__)("Currently selected font style: %s"), currentSelection.name ); } return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font appearance. (0,external_wp_i18n_namespaceObject.__)("Currently selected font appearance: %s"), currentSelection.name ); }; if (!__next40pxDefaultSize && (otherProps.size === void 0 || otherProps.size === "default")) { external_wp_deprecated_default()( `36px default size for wp.blockEditor.__experimentalFontAppearanceControl`, { since: "6.8", version: "7.1", hint: "Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version." } ); } return hasStylesOrWeights && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CustomSelectControl, { ...otherProps, className: "components-font-appearance-control", __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize: true, label, describedBy: getDescribedBy(), options: selectOptions, value: currentSelection, onChange: ({ selectedItem }) => onChange(selectedItem.style) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/utils.js const BASE_DEFAULT_VALUE = 1.5; const STEP = 0.01; const SPIN_FACTOR = 10; const RESET_VALUE = ""; function isLineHeightDefined(lineHeight) { return lineHeight !== void 0 && lineHeight !== RESET_VALUE; } ;// ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/index.js const line_height_control_LineHeightControl = ({ /** Start opting into the larger default height that will become the default size in a future version. */ __next40pxDefaultSize = false, value: lineHeight, onChange, __unstableInputWidth = "60px", ...otherProps }) => { const isDefined = isLineHeightDefined(lineHeight); const adjustNextValue = (nextValue, wasTypedOrPasted) => { if (isDefined) { return nextValue; } const spin = STEP * SPIN_FACTOR; switch (`${nextValue}`) { case `${spin}`: return BASE_DEFAULT_VALUE + spin; case "0": { if (wasTypedOrPasted) { return nextValue; } return BASE_DEFAULT_VALUE - spin; } case "": return BASE_DEFAULT_VALUE; default: return nextValue; } }; const stateReducer = (state, action) => { const wasTypedOrPasted = ["insertText", "insertFromPaste"].includes( action.payload.event.nativeEvent?.inputType ); const value2 = adjustNextValue(state.value, wasTypedOrPasted); return { ...state, value: value2 }; }; const value = isDefined ? lineHeight : RESET_VALUE; const handleOnChange = (nextValue, { event }) => { if (nextValue === "") { onChange(); return; } if (event.type === "click") { onChange(adjustNextValue(`${nextValue}`, false)); return; } onChange(`${nextValue}`); }; if (!__next40pxDefaultSize && (otherProps.size === void 0 || otherProps.size === "default")) { external_wp_deprecated_default()(`36px default size for wp.blockEditor.LineHeightControl`, { since: "6.8", version: "7.1", hint: "Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version." }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-line-height-control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalNumberControl, { ...otherProps, __shouldNotWarnDeprecated36pxSize: true, __next40pxDefaultSize, __unstableInputWidth, __unstableStateReducer: stateReducer, onChange: handleOnChange, label: (0,external_wp_i18n_namespaceObject.__)("Line height"), placeholder: BASE_DEFAULT_VALUE, step: STEP, spinFactor: SPIN_FACTOR, value, min: 0, spinControls: "custom" } ) }); }; var line_height_control_default = line_height_control_LineHeightControl; ;// ./node_modules/@wordpress/block-editor/build-module/components/letter-spacing-control/index.js function LetterSpacingControl({ __next40pxDefaultSize = false, value, onChange, __unstableInputWidth = "60px", ...otherProps }) { const [availableUnits] = use_settings_useSettings("spacing.units"); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || ["px", "em", "rem"], defaultValues: { px: 2, em: 0.2, rem: 0.2 } }); if (!__next40pxDefaultSize && (otherProps.size === void 0 || otherProps.size === "default")) { external_wp_deprecated_default()( `36px default size for wp.blockEditor.__experimentalLetterSpacingControl`, { since: "6.8", version: "7.1", hint: "Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version." } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { __next40pxDefaultSize, __shouldNotWarnDeprecated36pxSize: true, ...otherProps, label: (0,external_wp_i18n_namespaceObject.__)("Letter spacing"), value, __unstableInputWidth, units, onChange } ); } ;// ./node_modules/@wordpress/icons/build-module/library/align-left.js var align_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: "M13 5.5H4V4h9v1.5Zm7 7H4V11h16v1.5Zm-7 7H4V18h9v1.5Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/align-center.js var align_center_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.5 5.5h9V4h-9v1.5Zm-3.5 7h16V11H4v1.5Zm3.5 7h9V18h-9v1.5Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/align-right.js var align_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: "M11.111 5.5H20V4h-8.889v1.5ZM4 12.5h16V11H4v1.5Zm7.111 7H20V18h-8.889v1.5Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/align-justify.js var align_justify_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 12.8h16v-1.5H4v1.5zm0 7h12.4v-1.5H4v1.5zM4 4.3v1.5h16V4.3H4z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/text-alignment-control/index.js const TEXT_ALIGNMENT_OPTIONS = [ { label: (0,external_wp_i18n_namespaceObject.__)("Align text left"), value: "left", icon: align_left_default }, { label: (0,external_wp_i18n_namespaceObject.__)("Align text center"), value: "center", icon: align_center_default }, { label: (0,external_wp_i18n_namespaceObject.__)("Align text right"), value: "right", icon: align_right_default }, { label: (0,external_wp_i18n_namespaceObject.__)("Justify text"), value: "justify", icon: align_justify_default } ]; const DEFAULT_OPTIONS = ["left", "center", "right"]; function TextAlignmentControl({ className, value, onChange, options = DEFAULT_OPTIONS }) { const validOptions = (0,external_wp_element_namespaceObject.useMemo)( () => TEXT_ALIGNMENT_OPTIONS.filter( (option) => options.includes(option.value) ), [options] ); if (!validOptions.length) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { isDeselectable: true, __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Text alignment"), className: dist_clsx( "block-editor-text-alignment-control", className ), value, onChange: (newValue) => { onChange(newValue === value ? void 0 : newValue); }, children: validOptions.map((option) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { value: option.value, icon: option.icon, label: option.label }, option.value ); }) } ); } ;// ./node_modules/@wordpress/icons/build-module/library/format-uppercase.js var format_uppercase_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.1 6.8L2.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H6.1zm-.8 6.8L7 8.9l1.7 4.7H5.3zm15.1-.7c-.4-.5-.9-.8-1.6-1 .4-.2.7-.5.8-.9.2-.4.3-.9.3-1.4 0-.9-.3-1.6-.8-2-.6-.5-1.3-.7-2.4-.7h-3.5V18h4.2c1.1 0 2-.3 2.6-.8.6-.6 1-1.4 1-2.4-.1-.8-.3-1.4-.6-1.9zm-5.7-4.7h1.8c.6 0 1.1.1 1.4.4.3.2.5.7.5 1.3 0 .6-.2 1.1-.5 1.3-.3.2-.8.4-1.4.4h-1.8V8.2zm4 8c-.4.3-.9.5-1.5.5h-2.6v-3.8h2.6c1.4 0 2 .6 2 1.9.1.6-.1 1-.5 1.4z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/format-lowercase.js var format_lowercase_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 16.8c-.1-.1-.2-.3-.3-.5v-2.6c0-.9-.1-1.7-.3-2.2-.2-.5-.5-.9-.9-1.2-.4-.2-.9-.3-1.6-.3-.5 0-1 .1-1.5.2s-.9.3-1.2.6l.2 1.2c.4-.3.7-.4 1.1-.5.3-.1.7-.2 1-.2.6 0 1 .1 1.3.4.3.2.4.7.4 1.4-1.2 0-2.3.2-3.3.7s-1.4 1.1-1.4 2.1c0 .7.2 1.2.7 1.6.4.4 1 .6 1.8.6.9 0 1.7-.4 2.4-1.2.1.3.2.5.4.7.1.2.3.3.6.4.3.1.6.1 1.1.1h.1l.2-1.2h-.1c-.4.1-.6 0-.7-.1zM9.2 16c-.2.3-.5.6-.9.8-.3.1-.7.2-1.1.2-.4 0-.7-.1-.9-.3-.2-.2-.3-.5-.3-.9 0-.6.2-1 .7-1.3.5-.3 1.3-.4 2.5-.5v2zm10.6-3.9c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2s-.2 1.4-.6 2z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/format-capitalize.js var format_capitalize_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.1 6.8L3.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H7.1zm-.8 6.8L8 8.9l1.7 4.7H6.3zm14.5-1.5c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2 .1.8-.2 1.4-.6 2z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/text-transform-control/index.js const TEXT_TRANSFORMS = [ { label: (0,external_wp_i18n_namespaceObject.__)("None"), value: "none", icon: reset_default }, { label: (0,external_wp_i18n_namespaceObject.__)("Uppercase"), value: "uppercase", icon: format_uppercase_default }, { label: (0,external_wp_i18n_namespaceObject.__)("Lowercase"), value: "lowercase", icon: format_lowercase_default }, { label: (0,external_wp_i18n_namespaceObject.__)("Capitalize"), value: "capitalize", icon: format_capitalize_default } ]; function TextTransformControl({ className, value, onChange }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { isDeselectable: true, __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Letter case"), className: dist_clsx( "block-editor-text-transform-control", className ), value, onChange: (newValue) => { onChange(newValue === value ? void 0 : newValue); }, children: TEXT_TRANSFORMS.map((option) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { value: option.value, icon: option.icon, label: option.label }, option.value ); }) } ); } ;// ./node_modules/@wordpress/icons/build-module/library/format-underline.js var format_underline_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 18v1h10v-1H7zm5-2c1.5 0 2.6-.4 3.4-1.2.8-.8 1.1-2 1.1-3.5V5H15v5.8c0 1.2-.2 2.1-.6 2.8-.4.7-1.2 1-2.4 1s-2-.3-2.4-1c-.4-.7-.6-1.6-.6-2.8V5H7.5v6.2c0 1.5.4 2.7 1.1 3.5.8.9 1.9 1.3 3.4 1.3z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/format-strikethrough.js var format_strikethrough_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: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/text-decoration-control/index.js const TEXT_DECORATIONS = [ { label: (0,external_wp_i18n_namespaceObject.__)("None"), value: "none", icon: reset_default }, { label: (0,external_wp_i18n_namespaceObject.__)("Underline"), value: "underline", icon: format_underline_default }, { label: (0,external_wp_i18n_namespaceObject.__)("Strikethrough"), value: "line-through", icon: format_strikethrough_default } ]; function TextDecorationControl({ value, onChange, className }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { isDeselectable: true, __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Decoration"), className: dist_clsx( "block-editor-text-decoration-control", className ), value, onChange: (newValue) => { onChange(newValue === value ? void 0 : newValue); }, children: TEXT_DECORATIONS.map((option) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { value: option.value, icon: option.icon, label: option.label }, option.value ); }) } ); } ;// ./node_modules/@wordpress/icons/build-module/library/text-horizontal.js var text_horizontal_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.2 14.4h3.9L13 17h1.7L11 6.5H9.3L5.6 17h1.7l.9-2.6zm2-5.5 1.4 4H8.8l1.4-4zm7.4 7.5-1.3.8.8 1.4H5.5V20h14.3l-2.2-3.6z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/text-vertical.js var text_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: "M7 5.6v1.7l2.6.9v3.9L7 13v1.7L17.5 11V9.3L7 5.6zm4.2 6V8.8l4 1.4-4 1.4zm-5.7 5.6V5.5H4v14.3l3.6-2.2-.8-1.3-1.3.9z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-mode-control/index.js const WRITING_MODES = [ { label: (0,external_wp_i18n_namespaceObject.__)("Horizontal"), value: "horizontal-tb", icon: text_horizontal_default }, { label: (0,external_wp_i18n_namespaceObject.__)("Vertical"), value: (0,external_wp_i18n_namespaceObject.isRTL)() ? "vertical-lr" : "vertical-rl", icon: text_vertical_default } ]; function WritingModeControl({ className, value, onChange }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { isDeselectable: true, __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Orientation"), className: dist_clsx("block-editor-writing-mode-control", className), value, onChange: (newValue) => { onChange(newValue === value ? void 0 : newValue); }, children: WRITING_MODES.map((option) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { value: option.value, icon: option.icon, label: option.label }, option.value ); }) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/typography-panel.js const MIN_TEXT_COLUMNS = 1; const MAX_TEXT_COLUMNS = 6; function useHasTypographyPanel(settings) { const hasFontFamily = useHasFontFamilyControl(settings); const hasLineHeight = useHasLineHeightControl(settings); const hasFontAppearance = useHasAppearanceControl(settings); const hasLetterSpacing = useHasLetterSpacingControl(settings); const hasTextAlign = useHasTextAlignmentControl(settings); const hasTextTransform = useHasTextTransformControl(settings); const hasTextDecoration = useHasTextDecorationControl(settings); const hasWritingMode = useHasWritingModeControl(settings); const hasTextColumns = useHasTextColumnsControl(settings); const hasFontSize = useHasFontSizeControl(settings); return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || hasTextAlign || hasTextTransform || hasFontSize || hasTextDecoration || hasWritingMode || hasTextColumns; } function useHasFontSizeControl(settings) { return settings?.typography?.defaultFontSizes !== false && settings?.typography?.fontSizes?.default?.length || settings?.typography?.fontSizes?.theme?.length || settings?.typography?.fontSizes?.custom?.length || settings?.typography?.customFontSize; } function useHasFontFamilyControl(settings) { return ["default", "theme", "custom"].some( (key) => settings?.typography?.fontFamilies?.[key]?.length ); } function useHasLineHeightControl(settings) { return settings?.typography?.lineHeight; } function useHasAppearanceControl(settings) { return settings?.typography?.fontStyle || settings?.typography?.fontWeight; } function useAppearanceControlLabel(settings) { if (!settings?.typography?.fontStyle) { return (0,external_wp_i18n_namespaceObject.__)("Font weight"); } if (!settings?.typography?.fontWeight) { return (0,external_wp_i18n_namespaceObject.__)("Font style"); } return (0,external_wp_i18n_namespaceObject.__)("Appearance"); } function useHasLetterSpacingControl(settings) { return settings?.typography?.letterSpacing; } function useHasTextTransformControl(settings) { return settings?.typography?.textTransform; } function useHasTextAlignmentControl(settings) { return settings?.typography?.textAlign; } function useHasTextDecorationControl(settings) { return settings?.typography?.textDecoration; } function useHasWritingModeControl(settings) { return settings?.typography?.writingMode; } function useHasTextColumnsControl(settings) { return settings?.typography?.textColumns; } function getMergedFontSizes(settings) { const fontSizes = settings?.typography?.fontSizes; const defaultFontSizesEnabled = !!settings?.typography?.defaultFontSizes; return [ ...fontSizes?.custom ?? [], ...fontSizes?.theme ?? [], ...defaultFontSizesEnabled ? fontSizes?.default ?? [] : [] ]; } function TypographyToolsPanel({ resetAllFilter, onChange, value, panelId, children }) { const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject.__)("Typography"), resetAll, panelId, dropdownMenuProps, children } ); } const typography_panel_DEFAULT_CONTROLS = { fontFamily: true, fontSize: true, fontAppearance: true, lineHeight: true, letterSpacing: true, textAlign: true, textTransform: true, textDecoration: true, writingMode: true, textColumns: true }; function TypographyPanel({ as: Wrapper = TypographyToolsPanel, value, onChange, inheritedValue = value, settings, panelId, defaultControls = typography_panel_DEFAULT_CONTROLS, fitText = false }) { const decodeValue = (rawValue) => getValueFromVariable({ settings }, "", rawValue); const hasFontFamilyEnabled = useHasFontFamilyControl(settings); const fontFamily = decodeValue(inheritedValue?.typography?.fontFamily); const { fontFamilies, fontFamilyFaces } = (0,external_wp_element_namespaceObject.useMemo)(() => { return getMergedFontFamiliesAndFontFamilyFaces(settings, fontFamily); }, [settings, fontFamily]); const setFontFamily = (newValue) => { const slug = fontFamilies?.find( ({ fontFamily: f }) => f === newValue )?.slug; let updatedValue = setImmutably( value, ["typography", "fontFamily"], slug ? `var:preset|font-family|${slug}` : newValue || void 0 ); const newFontFamilyFaces = fontFamilies?.find(({ fontFamily: f }) => f === newValue)?.fontFace ?? []; const { fontStyles, fontWeights } = getFontStylesAndWeights(newFontFamilyFaces); const hasFontStyle = fontStyles?.some( ({ value: fs }) => fs === fontStyle ); const hasFontWeight = fontWeights?.some( ({ value: fw }) => fw?.toString() === fontWeight?.toString() ); if (!hasFontStyle || !hasFontWeight) { const { nearestFontStyle, nearestFontWeight } = findNearestStyleAndWeight( newFontFamilyFaces, fontStyle, fontWeight ); if (nearestFontStyle || nearestFontWeight) { updatedValue = { ...updatedValue, typography: { ...updatedValue?.typography, fontStyle: nearestFontStyle || void 0, fontWeight: nearestFontWeight || void 0 } }; } else if (fontStyle || fontWeight) { updatedValue = { ...updatedValue, typography: { ...updatedValue?.typography, fontStyle: void 0, fontWeight: void 0 } }; } } onChange(updatedValue); }; const hasFontFamily = () => !!value?.typography?.fontFamily; const resetFontFamily = () => setFontFamily(void 0); const hasFontSizeEnabled = useHasFontSizeControl(settings); const disableCustomFontSizes = !settings?.typography?.customFontSize; const mergedFontSizes = getMergedFontSizes(settings); const fontSize = decodeValue(inheritedValue?.typography?.fontSize); const currentFontSizeSlug = (() => { const rawValue = inheritedValue?.typography?.fontSize; if (!rawValue || typeof rawValue !== "string") { return void 0; } if (rawValue.startsWith("var:preset|font-size|")) { return rawValue.replace("var:preset|font-size|", ""); } const cssVarMatch = rawValue.match( /^var\(--wp--preset--font-size--([^)]+)\)$/ ); if (cssVarMatch) { return cssVarMatch[1]; } return void 0; })(); const setFontSize = (newValue, metadata) => { const actualValue = !!metadata?.slug ? `var:preset|font-size|${metadata?.slug}` : newValue; onChange( setImmutably( value, ["typography", "fontSize"], actualValue || void 0 ) ); }; const hasFontSize = () => !!value?.typography?.fontSize; const resetFontSize = () => setFontSize(void 0); const hasAppearanceControl = useHasAppearanceControl(settings); const appearanceControlLabel = useAppearanceControlLabel(settings); const hasFontStyles = settings?.typography?.fontStyle; const hasFontWeights = settings?.typography?.fontWeight; const fontStyle = decodeValue(inheritedValue?.typography?.fontStyle); const fontWeight = decodeValue(inheritedValue?.typography?.fontWeight); const setFontAppearance = (0,external_wp_element_namespaceObject.useCallback)( ({ fontStyle: newFontStyle, fontWeight: newFontWeight }) => { if (newFontStyle !== fontStyle || newFontWeight !== fontWeight) { onChange({ ...value, typography: { ...value?.typography, fontStyle: newFontStyle || void 0, fontWeight: newFontWeight || void 0 } }); } }, [fontStyle, fontWeight, onChange, value] ); const hasFontAppearance = () => !!value?.typography?.fontStyle || !!value?.typography?.fontWeight; const resetFontAppearance = (0,external_wp_element_namespaceObject.useCallback)(() => { setFontAppearance({}); }, [setFontAppearance]); const hasLineHeightEnabled = useHasLineHeightControl(settings); const lineHeight = decodeValue(inheritedValue?.typography?.lineHeight); const setLineHeight = (newValue) => { onChange( setImmutably( value, ["typography", "lineHeight"], newValue || void 0 ) ); }; const hasLineHeight = () => value?.typography?.lineHeight !== void 0; const resetLineHeight = () => setLineHeight(void 0); const hasLetterSpacingControl = useHasLetterSpacingControl(settings); const letterSpacing = decodeValue( inheritedValue?.typography?.letterSpacing ); const setLetterSpacing = (newValue) => { onChange( setImmutably( value, ["typography", "letterSpacing"], newValue || void 0 ) ); }; const hasLetterSpacing = () => !!value?.typography?.letterSpacing; const resetLetterSpacing = () => setLetterSpacing(void 0); const hasTextColumnsControl = useHasTextColumnsControl(settings); const textColumns = decodeValue(inheritedValue?.typography?.textColumns); const setTextColumns = (newValue) => { onChange( setImmutably( value, ["typography", "textColumns"], newValue || void 0 ) ); }; const hasTextColumns = () => !!value?.typography?.textColumns; const resetTextColumns = () => setTextColumns(void 0); const hasTextTransformControl = useHasTextTransformControl(settings); const textTransform = decodeValue( inheritedValue?.typography?.textTransform ); const setTextTransform = (newValue) => { onChange( setImmutably( value, ["typography", "textTransform"], newValue || void 0 ) ); }; const hasTextTransform = () => !!value?.typography?.textTransform; const resetTextTransform = () => setTextTransform(void 0); const hasTextDecorationControl = useHasTextDecorationControl(settings); const textDecoration = decodeValue( inheritedValue?.typography?.textDecoration ); const setTextDecoration = (newValue) => { onChange( setImmutably( value, ["typography", "textDecoration"], newValue || void 0 ) ); }; const hasTextDecoration = () => !!value?.typography?.textDecoration; const resetTextDecoration = () => setTextDecoration(void 0); const hasWritingModeControl = useHasWritingModeControl(settings); const writingMode = decodeValue(inheritedValue?.typography?.writingMode); const setWritingMode = (newValue) => { onChange( setImmutably( value, ["typography", "writingMode"], newValue || void 0 ) ); }; const hasWritingMode = () => !!value?.typography?.writingMode; const resetWritingMode = () => setWritingMode(void 0); const hasTextAlignmentControl = useHasTextAlignmentControl(settings); const textAlign = decodeValue(inheritedValue?.typography?.textAlign); const setTextAlign = (newValue) => { onChange( setImmutably( value, ["typography", "textAlign"], newValue || void 0 ) ); }; const hasTextAlign = () => !!value?.typography?.textAlign; const resetTextAlign = () => setTextAlign(void 0); const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => { return { ...previousValue, typography: {} }; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( Wrapper, { resetAllFilter, value, onChange, panelId, children: [ hasFontFamilyEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)("Font"), hasValue: hasFontFamily, onDeselect: resetFontFamily, isShownByDefault: defaultControls.fontFamily, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FontFamilyControl, { fontFamilies, value: fontFamily, onChange: setFontFamily, size: "__unstable-large", __nextHasNoMarginBottom: true } ) } ), hasFontSizeEnabled && !fitText && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)("Size"), hasValue: hasFontSize, onDeselect: resetFontSize, isShownByDefault: defaultControls.fontSize, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FontSizePicker, { value: currentFontSizeSlug || fontSize, valueMode: currentFontSizeSlug ? "slug" : "literal", onChange: setFontSize, fontSizes: mergedFontSizes, disableCustomFontSizes, withReset: false, withSlider: true, size: "__unstable-large" } ) } ), hasAppearanceControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "single-column", label: appearanceControlLabel, hasValue: hasFontAppearance, onDeselect: resetFontAppearance, isShownByDefault: defaultControls.fontAppearance, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FontAppearanceControl, { value: { fontStyle, fontWeight }, onChange: setFontAppearance, hasFontStyles, hasFontWeights, fontFamilyFaces, size: "__unstable-large" } ) } ), hasLineHeightEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "single-column", label: (0,external_wp_i18n_namespaceObject.__)("Line height"), hasValue: hasLineHeight, onDeselect: resetLineHeight, isShownByDefault: defaultControls.lineHeight, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( line_height_control_default, { __unstableInputWidth: "auto", value: lineHeight, onChange: setLineHeight, size: "__unstable-large" } ) } ), hasLetterSpacingControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "single-column", label: (0,external_wp_i18n_namespaceObject.__)("Letter spacing"), hasValue: hasLetterSpacing, onDeselect: resetLetterSpacing, isShownByDefault: defaultControls.letterSpacing, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( LetterSpacingControl, { value: letterSpacing, onChange: setLetterSpacing, size: "__unstable-large", __unstableInputWidth: "auto" } ) } ), hasTextColumnsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "single-column", label: (0,external_wp_i18n_namespaceObject.__)("Columns"), hasValue: hasTextColumns, onDeselect: resetTextColumns, isShownByDefault: defaultControls.textColumns, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalNumberControl, { label: (0,external_wp_i18n_namespaceObject.__)("Columns"), max: MAX_TEXT_COLUMNS, min: MIN_TEXT_COLUMNS, onChange: setTextColumns, size: "__unstable-large", spinControls: "custom", value: textColumns, initialPosition: 1 } ) } ), hasTextDecorationControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "single-column", label: (0,external_wp_i18n_namespaceObject.__)("Decoration"), hasValue: hasTextDecoration, onDeselect: resetTextDecoration, isShownByDefault: defaultControls.textDecoration, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TextDecorationControl, { value: textDecoration, onChange: setTextDecoration, size: "__unstable-large", __unstableInputWidth: "auto" } ) } ), hasWritingModeControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "single-column", label: (0,external_wp_i18n_namespaceObject.__)("Orientation"), hasValue: hasWritingMode, onDeselect: resetWritingMode, isShownByDefault: defaultControls.writingMode, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WritingModeControl, { value: writingMode, onChange: setWritingMode, size: "__unstable-large", __nextHasNoMarginBottom: true } ) } ), hasTextTransformControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)("Letter case"), hasValue: hasTextTransform, onDeselect: resetTextTransform, isShownByDefault: defaultControls.textTransform, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TextTransformControl, { value: textTransform, onChange: setTextTransform, showNone: true, isBlock: true, size: "__unstable-large", __nextHasNoMarginBottom: true } ) } ), hasTextAlignmentControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)("Text alignment"), hasValue: hasTextAlign, onDeselect: resetTextAlign, isShownByDefault: defaultControls.textAlign, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TextAlignmentControl, { value: textAlign, onChange: setTextAlign, size: "__unstable-large", __nextHasNoMarginBottom: true } ) } ) ] } ); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/line-height.js const LINE_HEIGHT_SUPPORT_KEY = "typography.lineHeight"; function LineHeightEdit(props) { const { attributes: { style }, setAttributes } = props; const onChange = (newLineHeightValue) => { const newStyle = { ...style, typography: { ...style?.typography, lineHeight: newLineHeightValue } }; setAttributes({ style: cleanEmptyObject(newStyle) }); }; return /* @__PURE__ */ jsx( LineHeightControl, { __unstableInputWidth: "100%", value: style?.typography?.lineHeight, onChange, size: "__unstable-large" } ); } function useIsLineHeightDisabled({ name: blockName } = {}) { const [isEnabled] = useSettings("typography.lineHeight"); return !isEnabled || !hasBlockSupport(blockName, LINE_HEIGHT_SUPPORT_KEY); } ;// external ["wp","tokenList"] const external_wp_tokenList_namespaceObject = window["wp"]["tokenList"]; var external_wp_tokenList_default = /*#__PURE__*/__webpack_require__.n(external_wp_tokenList_namespaceObject); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/font-family.js const FONT_FAMILY_SUPPORT_KEY = "typography.__experimentalFontFamily"; const { kebabCase: font_family_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); function font_family_addAttributes(settings) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FONT_FAMILY_SUPPORT_KEY)) { return settings; } if (!settings.attributes.fontFamily) { Object.assign(settings.attributes, { fontFamily: { type: "string" } }); } return settings; } function font_family_addSaveProps(props, blockType, attributes) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, FONT_FAMILY_SUPPORT_KEY)) { return props; } if (shouldSkipSerialization( blockType, TYPOGRAPHY_SUPPORT_KEY, "fontFamily" )) { return props; } if (!attributes?.fontFamily) { return props; } const classes = new (external_wp_tokenList_default())(props.className); classes.add(`has-${font_family_kebabCase(attributes?.fontFamily)}-font-family`); const newClassName = classes.value; props.className = newClassName ? newClassName : void 0; return props; } function font_family_useBlockProps({ name, fontFamily }) { return font_family_addSaveProps({}, name, { fontFamily }); } var font_family_default = { useBlockProps: font_family_useBlockProps, addSaveProps: font_family_addSaveProps, attributeKeys: ["fontFamily"], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_FAMILY_SUPPORT_KEY); } }; function resetFontFamily({ setAttributes }) { setAttributes({ fontFamily: void 0 }); } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/fontFamily/addAttribute", font_family_addAttributes ); ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/utils.js const { kebabCase: utils_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); const utils_getFontSize = (fontSizes, fontSizeAttribute, customFontSizeAttribute) => { if (fontSizeAttribute) { const fontSizeObject = fontSizes?.find( ({ slug }) => slug === fontSizeAttribute ); if (fontSizeObject) { return fontSizeObject; } } return { size: customFontSizeAttribute }; }; function utils_getFontSizeObjectByValue(fontSizes, value) { const fontSizeObject = fontSizes?.find(({ size }) => size === value); if (fontSizeObject) { return fontSizeObject; } return { size: value }; } function getFontSizeClass(fontSizeSlug) { if (!fontSizeSlug) { return; } return `has-${utils_kebabCase(fontSizeSlug)}-font-size`; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/font-size.js const FONT_SIZE_SUPPORT_KEY = "typography.fontSize"; function font_size_addAttributes(settings) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FONT_SIZE_SUPPORT_KEY)) { return settings; } if (!settings.attributes.fontSize) { Object.assign(settings.attributes, { fontSize: { type: "string" } }); } return settings; } function font_size_addSaveProps(props, blockNameOrType, attributes) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockNameOrType, FONT_SIZE_SUPPORT_KEY)) { return props; } if (shouldSkipSerialization( blockNameOrType, TYPOGRAPHY_SUPPORT_KEY, "fontSize" )) { return props; } const classes = new (external_wp_tokenList_default())(props.className); classes.add(getFontSizeClass(attributes.fontSize)); const newClassName = classes.value; props.className = newClassName ? newClassName : void 0; return props; } function FontSizeEdit(props) { const { attributes: { fontSize, style, fitText }, setAttributes } = props; const [fontSizes] = useSettings("typography.fontSizes"); if (fitText) { return null; } const onChange = (value, selectedItem) => { const fontSizeSlug = selectedItem?.slug || getFontSizeObjectByValue(fontSizes, value).slug; setAttributes({ style: cleanEmptyObject({ ...style, typography: { ...style?.typography, fontSize: fontSizeSlug ? void 0 : value } }), fontSize: fontSizeSlug }); }; const fontSizeObject = getFontSize( fontSizes, fontSize, style?.typography?.fontSize ); const fontSizeValue = fontSizeObject?.size || style?.typography?.fontSize || fontSize; return /* @__PURE__ */ jsx( FontSizePicker, { onChange, value: fontSize || fontSizeValue, valueMode: fontSize ? "slug" : "literal", withReset: false, withSlider: true, size: "__unstable-large" } ); } function useIsFontSizeDisabled({ name: blockName } = {}) { const [fontSizes] = useSettings("typography.fontSizes"); const hasFontSizes = !!fontSizes?.length; return !hasBlockSupport(blockName, FONT_SIZE_SUPPORT_KEY) || !hasFontSizes; } function font_size_useBlockProps({ name, fontSize, style }) { const [fontSizes, fluidTypographySettings, layoutSettings] = use_settings_useSettings( "typography.fontSizes", "typography.fluid", "layout" ); if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_SIZE_SUPPORT_KEY) || shouldSkipSerialization(name, TYPOGRAPHY_SUPPORT_KEY, "fontSize") || !fontSize && !style?.typography?.fontSize) { return; } let props; if (style?.typography?.fontSize) { props = { style: { fontSize: getTypographyFontSizeValue( { size: style.typography.fontSize }, { typography: { fluid: fluidTypographySettings }, layout: layoutSettings } ) } }; } if (fontSize) { props = { style: { fontSize: utils_getFontSize( fontSizes, fontSize, style?.typography?.fontSize ).size } }; } if (!props) { return; } return font_size_addSaveProps(props, name, { fontSize }); } var font_size_default = { useBlockProps: font_size_useBlockProps, addSaveProps: font_size_addSaveProps, attributeKeys: ["fontSize", "style", "fitText"], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_SIZE_SUPPORT_KEY); } }; const font_size_MIGRATION_PATHS = { fontSize: [["fontSize"], ["style", "typography", "fontSize"]] }; function font_size_addTransforms(result, source, index, results) { const destinationBlockType = result.name; const activeSupports = { fontSize: (0,external_wp_blocks_namespaceObject.hasBlockSupport)( destinationBlockType, FONT_SIZE_SUPPORT_KEY ) }; return transformStyles( activeSupports, font_size_MIGRATION_PATHS, result, source, index, results ); } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/font/addAttribute", font_size_addAttributes ); (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.switchToBlockType.transformedBlock", "core/font-size/addTransforms", font_size_addTransforms ); ;// ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/ui.js const DEFAULT_ALIGNMENT_CONTROLS = [ { icon: align_left_default, title: (0,external_wp_i18n_namespaceObject.__)("Align text left"), align: "left" }, { icon: align_center_default, title: (0,external_wp_i18n_namespaceObject.__)("Align text center"), align: "center" }, { icon: align_right_default, title: (0,external_wp_i18n_namespaceObject.__)("Align text right"), align: "right" } ]; const ui_POPOVER_PROPS = { placement: "bottom-start" }; function AlignmentUI({ value, onChange, alignmentControls = DEFAULT_ALIGNMENT_CONTROLS, label = (0,external_wp_i18n_namespaceObject.__)("Align text"), description = (0,external_wp_i18n_namespaceObject.__)("Change text alignment"), isCollapsed = true, isToolbar }) { function applyOrUnset(align) { return () => onChange(value === align ? void 0 : align); } const activeAlignment = alignmentControls.find( (control) => control.align === value ); function setIcon() { if (activeAlignment) { return activeAlignment.icon; } return (0,external_wp_i18n_namespaceObject.isRTL)() ? align_right_default : align_left_default; } const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; const extraProps = isToolbar ? { isCollapsed } : { toggleProps: { description }, popoverProps: ui_POPOVER_PROPS }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( UIComponent, { icon: setIcon(), label, controls: alignmentControls.map((control) => { const { align } = control; const isActive = value === align; return { ...control, isActive, role: isCollapsed ? "menuitemradio" : void 0, onClick: applyOrUnset(align) }; }), ...extraProps } ); } var alignment_control_ui_ui_default = AlignmentUI; ;// ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/index.js const AlignmentControl = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(alignment_control_ui_ui_default, { ...props, isToolbar: false }); }; const AlignmentToolbar = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(alignment_control_ui_ui_default, { ...props, isToolbar: true }); }; ;// ./node_modules/@wordpress/block-editor/build-module/hooks/text-align.js const TEXT_ALIGN_SUPPORT_KEY = "typography.textAlign"; const text_align_TEXT_ALIGNMENT_OPTIONS = [ { icon: align_left_default, title: (0,external_wp_i18n_namespaceObject.__)("Align text left"), align: "left" }, { icon: align_center_default, title: (0,external_wp_i18n_namespaceObject.__)("Align text center"), align: "center" }, { icon: align_right_default, title: (0,external_wp_i18n_namespaceObject.__)("Align text right"), align: "right" } ]; const VALID_TEXT_ALIGNMENTS = ["left", "center", "right"]; const NO_TEXT_ALIGNMENTS = []; function getValidTextAlignments(blockTextAlign) { if (Array.isArray(blockTextAlign)) { return VALID_TEXT_ALIGNMENTS.filter( (textAlign) => blockTextAlign.includes(textAlign) ); } return blockTextAlign === true ? VALID_TEXT_ALIGNMENTS : NO_TEXT_ALIGNMENTS; } function BlockEditTextAlignmentToolbarControlsPure({ style, name: blockName, setAttributes }) { const settings = useBlockSettings(blockName); const hasTextAlignControl = settings?.typography?.textAlign; const blockEditingMode = useBlockEditingMode(); if (!hasTextAlignControl || blockEditingMode !== "default") { return null; } const validTextAlignments = getValidTextAlignments( (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, TEXT_ALIGN_SUPPORT_KEY) ); if (!validTextAlignments.length) { return null; } const textAlignmentControls = text_align_TEXT_ALIGNMENT_OPTIONS.filter( (control) => validTextAlignments.includes(control.align) ); const onChange = (newTextAlignValue) => { const newStyle = { ...style, typography: { ...style?.typography, textAlign: newTextAlignValue } }; setAttributes({ style: utils_cleanEmptyObject(newStyle) }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "block", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AlignmentControl, { value: style?.typography?.textAlign, onChange, alignmentControls: textAlignmentControls } ) }); } var text_align_default = { edit: BlockEditTextAlignmentToolbarControlsPure, useBlockProps: text_align_useBlockProps, addSaveProps: addAssignedTextAlign, attributeKeys: ["style"], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, TEXT_ALIGN_SUPPORT_KEY, false); } }; function text_align_useBlockProps({ name, style }) { if (!style?.typography?.textAlign) { return null; } const validTextAlignments = getValidTextAlignments( (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, TEXT_ALIGN_SUPPORT_KEY) ); if (!validTextAlignments.length) { return null; } if (shouldSkipSerialization(name, TYPOGRAPHY_SUPPORT_KEY, "textAlign")) { return null; } const textAlign = style.typography.textAlign; const className = dist_clsx({ [`has-text-align-${textAlign}`]: textAlign }); return { className }; } function addAssignedTextAlign(props, blockType, attributes) { if (!attributes?.style?.typography?.textAlign) { return props; } const { textAlign } = attributes.style.typography; const blockTextAlign = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, TEXT_ALIGN_SUPPORT_KEY); const isTextAlignValid = getValidTextAlignments(blockTextAlign).includes(textAlign); if (isTextAlignValid && !shouldSkipSerialization( blockType, TYPOGRAPHY_SUPPORT_KEY, "textAlign" )) { props.className = dist_clsx( `has-text-align-${textAlign}`, props.className ); } return props; } ;// ./node_modules/@wordpress/block-editor/build-module/utils/fit-text-utils.js function findOptimalFontSize(textElement, applyFontSize) { const alreadyHasScrollableHeight = textElement.scrollHeight > textElement.clientHeight; let minSize = 5; let maxSize = 2400; let bestSize = minSize; const computedStyle = window.getComputedStyle(textElement); let paddingLeft = parseFloat(computedStyle.paddingLeft) || 0; let paddingRight = parseFloat(computedStyle.paddingRight) || 0; const range = document.createRange(); range.selectNodeContents(textElement); let referenceElement = textElement; const parentElement = textElement.parentElement; if (parentElement) { const parentElementComputedStyle = window.getComputedStyle(parentElement); if (parentElementComputedStyle?.display === "flex") { referenceElement = parentElement; paddingLeft += parseFloat(parentElementComputedStyle.paddingLeft) || 0; paddingRight += parseFloat(parentElementComputedStyle.paddingRight) || 0; } } let maxclientHeight = referenceElement.clientHeight; while (minSize <= maxSize) { const midSize = Math.floor((minSize + maxSize) / 2); applyFontSize(midSize); const rect = range.getBoundingClientRect(); const textWidth = rect.width; const fitsWidth = textElement.scrollWidth <= referenceElement.clientWidth && textWidth <= referenceElement.clientWidth - paddingLeft - paddingRight; const fitsHeight = alreadyHasScrollableHeight || textElement.scrollHeight <= referenceElement.clientHeight || textElement.scrollHeight <= maxclientHeight; if (referenceElement.clientHeight > maxclientHeight) { maxclientHeight = referenceElement.clientHeight; } if (fitsWidth && fitsHeight) { bestSize = midSize; minSize = midSize + 1; } else { maxSize = midSize - 1; } } range.detach(); return bestSize; } function optimizeFitText(textElement, applyFontSize) { if (!textElement) { return; } applyFontSize(0); const optimalSize = findOptimalFontSize(textElement, applyFontSize); applyFontSize(optimalSize); return optimalSize; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/fit-text.js const EMPTY_OBJECT = {}; const FIT_TEXT_SUPPORT_KEY = "typography.fitText"; function fit_text_addAttributes(settings) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FIT_TEXT_SUPPORT_KEY)) { return settings; } if (settings.attributes?.fitText) { return settings; } return { ...settings, attributes: { ...settings.attributes, fitText: { type: "boolean" } } }; } function useFitText({ fitText, name, clientId }) { const hasFitTextSupport2 = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FIT_TEXT_SUPPORT_KEY); const blockElement = useBlockElement(clientId); const { blockAttributes, parentId, blockMode } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (!clientId || !hasFitTextSupport2 || !fitText) { return EMPTY_OBJECT; } const _blockMode = select(store).getBlockMode(clientId); if (_blockMode === "html") { return { blockMode: _blockMode }; } return { blockAttributes: select(store).getBlockAttributes(clientId), parentId: select(store).getBlockRootClientId(clientId), blockMode: _blockMode }; }, [clientId, hasFitTextSupport2, fitText] ); const applyFitText = (0,external_wp_element_namespaceObject.useCallback)(() => { if (!blockElement || !hasFitTextSupport2 || !fitText) { return; } const styleId = `fit-text-${clientId}`; let styleElement = blockElement.ownerDocument.getElementById(styleId); if (!styleElement) { styleElement = blockElement.ownerDocument.createElement("style"); styleElement.id = styleId; blockElement.ownerDocument.head.appendChild(styleElement); } const blockSelector = `#block-${clientId}`; const applyFontSize = (fontSize) => { if (fontSize === 0) { styleElement.textContent = ""; } else { styleElement.textContent = `${blockSelector} { font-size: ${fontSize}px !important; }`; } }; optimizeFitText(blockElement, applyFontSize); }, [blockElement, clientId, hasFitTextSupport2, fitText]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!fitText || !blockElement || !clientId || !hasFitTextSupport2 || blockMode === "html") { return; } const currentElement = blockElement; const previousVisibility = currentElement.style.visibility; let hideFrameId = null; let calculateFrameId = null; let showTimeoutId = null; hideFrameId = window.requestAnimationFrame(() => { currentElement.style.visibility = "hidden"; calculateFrameId = window.requestAnimationFrame(() => { applyFitText(); showTimeoutId = setTimeout(() => { currentElement.style.visibility = previousVisibility; }, 10); }); }); let resizeObserver; if (window.ResizeObserver && currentElement.parentElement) { resizeObserver = new window.ResizeObserver(applyFitText); resizeObserver.observe(currentElement.parentElement); resizeObserver.observe(currentElement); } return () => { if (hideFrameId !== null) { window.cancelAnimationFrame(hideFrameId); } if (calculateFrameId !== null) { window.cancelAnimationFrame(calculateFrameId); } if (showTimeoutId !== null) { clearTimeout(showTimeoutId); } if (resizeObserver) { resizeObserver.disconnect(); } const styleId = `fit-text-${clientId}`; const styleElement = currentElement.ownerDocument.getElementById(styleId); if (styleElement) { styleElement.remove(); } }; }, [ fitText, clientId, parentId, applyFitText, blockElement, hasFitTextSupport2, blockMode ]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (fitText && blockElement && hasFitTextSupport2 && blockMode !== "html") { const frameId = window.requestAnimationFrame(() => { if (blockElement) { applyFitText(); } }); return () => window.cancelAnimationFrame(frameId); } }, [ blockAttributes, fitText, applyFitText, blockElement, hasFitTextSupport2, blockMode ]); } function fit_text_addSaveProps(props, blockType, attributes) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, FIT_TEXT_SUPPORT_KEY)) { return props; } const { fitText } = attributes; if (!fitText) { return props; } const className = props.className ? `${props.className} has-fit-text` : "has-fit-text"; return { ...props, className }; } function fit_text_useBlockProps({ name, fitText, clientId }) { useFitText({ fitText, name, clientId }); if (!fitText || !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FIT_TEXT_SUPPORT_KEY)) { return {}; } return { className: "has-fit-text" }; } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/fit-text/addAttribute", fit_text_addAttributes ); const hasFitTextSupport = (blockNameOrType) => { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockNameOrType, FIT_TEXT_SUPPORT_KEY); }; var fit_text_default = { useBlockProps: fit_text_useBlockProps, addSaveProps: fit_text_addSaveProps, attributeKeys: ["fitText"], hasSupport: hasFitTextSupport, edit: () => null }; ;// ./node_modules/@wordpress/block-editor/build-module/hooks/typography.js function omit(object, keys) { return Object.fromEntries( Object.entries(object).filter(([key]) => !keys.includes(key)) ); } const LETTER_SPACING_SUPPORT_KEY = "typography.__experimentalLetterSpacing"; const TEXT_TRANSFORM_SUPPORT_KEY = "typography.__experimentalTextTransform"; const TEXT_DECORATION_SUPPORT_KEY = "typography.__experimentalTextDecoration"; const TEXT_COLUMNS_SUPPORT_KEY = "typography.textColumns"; const FONT_STYLE_SUPPORT_KEY = "typography.__experimentalFontStyle"; const FONT_WEIGHT_SUPPORT_KEY = "typography.__experimentalFontWeight"; const WRITING_MODE_SUPPORT_KEY = "typography.__experimentalWritingMode"; const TYPOGRAPHY_SUPPORT_KEY = "typography"; const TYPOGRAPHY_SUPPORT_KEYS = [ LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_ALIGN_SUPPORT_KEY, TEXT_COLUMNS_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, WRITING_MODE_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY, FIT_TEXT_SUPPORT_KEY ]; function typography_styleToAttributes(style) { const updatedStyle = { ...omit(style, ["fontFamily"]) }; const fontSizeValue = style?.typography?.fontSize; const fontFamilyValue = style?.typography?.fontFamily; const fontSizeSlug = typeof fontSizeValue === "string" && fontSizeValue?.startsWith("var:preset|font-size|") ? fontSizeValue.substring("var:preset|font-size|".length) : void 0; const fontFamilySlug = fontFamilyValue?.startsWith( "var:preset|font-family|" ) ? fontFamilyValue.substring("var:preset|font-family|".length) : void 0; updatedStyle.typography = { ...omit(updatedStyle.typography, ["fontFamily"]), fontSize: fontSizeSlug ? void 0 : fontSizeValue }; return { style: utils_cleanEmptyObject(updatedStyle), fontFamily: fontFamilySlug, fontSize: fontSizeSlug }; } function typography_attributesToStyle(attributes) { return { ...attributes.style, typography: { ...attributes.style?.typography, fontFamily: attributes.fontFamily ? "var:preset|font-family|" + attributes.fontFamily : void 0, fontSize: attributes.fontSize ? "var:preset|font-size|" + attributes.fontSize : attributes.style?.typography?.fontSize } }; } function TypographyInspectorControl({ children, resetAllFilter }) { const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)( (attributes) => { const existingStyle = typography_attributesToStyle(attributes); const updatedStyle = resetAllFilter(existingStyle); return { ...attributes, ...typography_styleToAttributes(updatedStyle) }; }, [resetAllFilter] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inspector_controls_default, { group: "typography", resetAllFilter: attributesResetAllFilter, children } ); } function typography_TypographyPanel({ clientId, name, setAttributes, settings }) { function selector(select) { const { style: style2, fontFamily: fontFamily2, fontSize: fontSize2, fitText: fitText2 } = select(store).getBlockAttributes(clientId) || {}; return { style: style2, fontFamily: fontFamily2, fontSize: fontSize2, fitText: fitText2 }; } const { style, fontFamily, fontSize, fitText } = (0,external_wp_data_namespaceObject.useSelect)(selector, [ clientId ]); const isEnabled = useHasTypographyPanel(settings); const value = (0,external_wp_element_namespaceObject.useMemo)( () => typography_attributesToStyle({ style, fontFamily, fontSize }), [style, fontSize, fontFamily] ); const onChange = (newStyle) => { setAttributes(typography_styleToAttributes(newStyle)); }; if (!isEnabled) { return null; } const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ TYPOGRAPHY_SUPPORT_KEY, "__experimentalDefaultControls" ]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TypographyPanel, { as: TypographyInspectorControl, panelId: clientId, settings, value, onChange, defaultControls, fitText } ); } const hasTypographySupport = (blockName) => { return TYPOGRAPHY_SUPPORT_KEYS.some( (key) => hasBlockSupport(blockName, key) ); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js const use_spacing_sizes_EMPTY_ARRAY = []; const compare = new Intl.Collator("und", { numeric: true }).compare; function useSpacingSizes() { const [ customSpacingSizes, themeSpacingSizes, defaultSpacingSizes, defaultSpacingSizesEnabled ] = use_settings_useSettings( "spacing.spacingSizes.custom", "spacing.spacingSizes.theme", "spacing.spacingSizes.default", "spacing.defaultSpacingSizes" ); const customSizes = customSpacingSizes ?? use_spacing_sizes_EMPTY_ARRAY; const themeSizes = themeSpacingSizes ?? use_spacing_sizes_EMPTY_ARRAY; const defaultSizes = defaultSpacingSizes && defaultSpacingSizesEnabled !== false ? defaultSpacingSizes : use_spacing_sizes_EMPTY_ARRAY; return (0,external_wp_element_namespaceObject.useMemo)(() => { const sizes = [ { name: (0,external_wp_i18n_namespaceObject.__)("None"), slug: "0", size: 0 }, ...customSizes, ...themeSizes, ...defaultSizes ]; if (sizes.every(({ slug }) => /^[0-9]/.test(slug))) { sizes.sort((a, b) => compare(a.slug, b.slug)); } return sizes.length > RANGE_CONTROL_MAX_SIZE ? [ { name: (0,external_wp_i18n_namespaceObject.__)("Default"), slug: "default", size: void 0 }, ...sizes ] : sizes; }, [customSizes, themeSizes, defaultSizes]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js const CUSTOM_VALUE_SETTINGS = { px: { max: 300, steps: 1 }, "%": { max: 100, steps: 1 }, vw: { max: 100, steps: 1 }, vh: { max: 100, steps: 1 }, em: { max: 10, steps: 0.1 }, rm: { max: 10, steps: 0.1 }, svw: { max: 100, steps: 1 }, lvw: { max: 100, steps: 1 }, dvw: { max: 100, steps: 1 }, svh: { max: 100, steps: 1 }, lvh: { max: 100, steps: 1 }, dvh: { max: 100, steps: 1 }, vi: { max: 100, steps: 1 }, svi: { max: 100, steps: 1 }, lvi: { max: 100, steps: 1 }, dvi: { max: 100, steps: 1 }, vb: { max: 100, steps: 1 }, svb: { max: 100, steps: 1 }, lvb: { max: 100, steps: 1 }, dvb: { max: 100, steps: 1 }, vmin: { max: 100, steps: 1 }, svmin: { max: 100, steps: 1 }, lvmin: { max: 100, steps: 1 }, dvmin: { max: 100, steps: 1 }, vmax: { max: 100, steps: 1 }, svmax: { max: 100, steps: 1 }, lvmax: { max: 100, steps: 1 }, dvmax: { max: 100, steps: 1 } }; function SpacingInputControl({ icon, isMixed = false, minimumCustomValue, onChange, onMouseOut, onMouseOver, showSideInLabel = true, side, spacingSizes, type, value }) { value = getPresetValueFromCustomValue(value, spacingSizes); let selectListSizes = spacingSizes; const showRangeControl = spacingSizes.length <= RANGE_CONTROL_MAX_SIZE; const disableCustomSpacingSizes = (0,external_wp_data_namespaceObject.useSelect)((select) => { const editorSettings = select(store).getSettings(); return editorSettings?.disableCustomSpacingSizes; }); const [showCustomValueControl, setShowCustomValueControl] = (0,external_wp_element_namespaceObject.useState)( !disableCustomSpacingSizes && value !== void 0 && !isValueSpacingPreset(value) ); const [minValue, setMinValue] = (0,external_wp_element_namespaceObject.useState)(minimumCustomValue); const previousValue = (0,external_wp_compose_namespaceObject.usePrevious)(value); if (!!value && previousValue !== value && !isValueSpacingPreset(value) && showCustomValueControl !== true) { setShowCustomValueControl(true); } const [availableUnits] = use_settings_useSettings("spacing.units"); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || ["px", "em", "rem"] }); let currentValue = null; const showCustomValueInSelectList = !showRangeControl && !showCustomValueControl && value !== void 0 && (!isValueSpacingPreset(value) || isValueSpacingPreset(value) && isMixed); if (showCustomValueInSelectList) { selectListSizes = [ ...spacingSizes, { name: !isMixed ? ( // translators: %s: A custom measurement, e.g. a number followed by a unit like 12px. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Custom (%s)"), value) ) : (0,external_wp_i18n_namespaceObject.__)("Mixed"), slug: "custom", size: value } ]; currentValue = selectListSizes.length - 1; } else if (!isMixed) { currentValue = !showCustomValueControl ? getSliderValueFromPreset(value, spacingSizes) : getCustomValueFromPreset(value, spacingSizes); } const selectedUnit = (0,external_wp_element_namespaceObject.useMemo)( () => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(currentValue), [currentValue] )[1] || units[0]?.value; const setInitialValue = () => { if (value === void 0) { onChange("0"); } }; const customTooltipContent = (newValue) => value === void 0 ? void 0 : spacingSizes[newValue]?.name; const customRangeValue = parseFloat(currentValue, 10); const getNewCustomValue = (newSize) => { const isNumeric = !isNaN(parseFloat(newSize)); const nextValue = isNumeric ? newSize : void 0; return nextValue; }; const getNewPresetValue = (newSize, controlType) => { const size = parseInt(newSize, 10); if (controlType === "selectList") { if (size === 0) { return void 0; } if (size === 1) { return "0"; } } else if (size === 0) { return "0"; } return `var:preset|spacing|${spacingSizes[newSize]?.slug}`; }; const handleCustomValueSliderChange = (next) => { onChange([next, selectedUnit].join("")); }; const allPlaceholder = isMixed ? (0,external_wp_i18n_namespaceObject.__)("Mixed") : null; const options = selectListSizes.map((size, index) => ({ key: index, name: size.name })); const marks = spacingSizes.slice(1, spacingSizes.length - 1).map((_newValue, index) => ({ value: index + 1, label: void 0 })); const sideLabel = ALL_SIDES.includes(side) && showSideInLabel ? LABELS[side] : ""; const typeLabel = showSideInLabel ? type?.toLowerCase() : type; const ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The side of the block being modified (top, bottom, left etc.). 2. Type of spacing being modified (padding, margin, etc). (0,external_wp_i18n_namespaceObject._x)("%1$s %2$s", "spacing"), sideLabel, typeLabel ).trim(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "spacing-sizes-control__wrapper", children: [ icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Icon, { className: "spacing-sizes-control__icon", icon, size: 24 } ), showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { onMouseOver, onMouseOut, onFocus: onMouseOver, onBlur: onMouseOut, onChange: (newSize) => onChange(getNewCustomValue(newSize)), value: currentValue, units, min: minValue, placeholder: allPlaceholder, disableUnits: isMixed, label: ariaLabel, hideLabelFromVision: true, className: "spacing-sizes-control__custom-value-input", size: "__unstable-large", onDragStart: () => { if (value?.charAt(0) === "-") { setMinValue(0); } }, onDrag: () => { if (value?.charAt(0) === "-") { setMinValue(0); } }, onDragEnd: () => { setMinValue(minimumCustomValue); } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, onMouseOver, onMouseOut, onFocus: onMouseOver, onBlur: onMouseOut, value: customRangeValue, min: 0, max: CUSTOM_VALUE_SETTINGS[selectedUnit]?.max ?? 10, step: CUSTOM_VALUE_SETTINGS[selectedUnit]?.steps ?? 0.1, withInputField: false, onChange: handleCustomValueSliderChange, className: "spacing-sizes-control__custom-value-range", __nextHasNoMarginBottom: true, label: ariaLabel, hideLabelFromVision: true } ) ] }), showRangeControl && !showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, onMouseOver, onMouseOut, className: "spacing-sizes-control__range-control", value: currentValue, onChange: (newSize) => onChange(getNewPresetValue(newSize)), onMouseDown: (event) => { if (event?.nativeEvent?.offsetX < 35) { setInitialValue(); } }, withInputField: false, "aria-valuenow": currentValue, "aria-valuetext": spacingSizes[currentValue]?.name, renderTooltipContent: customTooltipContent, min: 0, max: spacingSizes.length - 1, marks, label: ariaLabel, hideLabelFromVision: true, __nextHasNoMarginBottom: true, onFocus: onMouseOver, onBlur: onMouseOut } ), !showRangeControl && !showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CustomSelectControl, { className: "spacing-sizes-control__custom-select-control", value: ( // passing empty string as a fallback to continue using the // component in controlled mode options.find( (option) => option.key === currentValue ) || "" ), onChange: (selection) => { onChange( getNewPresetValue( selection.selectedItem.key, "selectList" ) ); }, options, label: ariaLabel, hideLabelFromVision: true, size: "__unstable-large", onMouseOver, onMouseOut, onFocus: onMouseOver, onBlur: onMouseOut } ), !disableCustomSpacingSizes && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)("Use size preset") : (0,external_wp_i18n_namespaceObject.__)("Set custom size"), icon: settings_settings_default, onClick: () => { setShowCustomValueControl(!showCustomValueControl); }, isPressed: showCustomValueControl, size: "small", className: "spacing-sizes-control__custom-toggle", iconSize: 24 } ) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/axial.js const groupedSides = ["vertical", "horizontal"]; function AxialInputControls({ minimumCustomValue, onChange, onMouseOut, onMouseOver, sides, spacingSizes, type, values }) { const createHandleOnChange = (side) => (next) => { if (!onChange) { return; } const nextValues = { ...Object.keys(values).reduce((acc, key) => { acc[key] = getPresetValueFromCustomValue( values[key], spacingSizes ); return acc; }, {}) }; if (side === "vertical") { nextValues.top = next; nextValues.bottom = next; } if (side === "horizontal") { nextValues.left = next; nextValues.right = next; } onChange(nextValues); }; const filteredSides = sides?.length ? groupedSides.filter((side) => hasAxisSupport(sides, side)) : groupedSides; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: filteredSides.map((side) => { const axisValue = side === "vertical" ? values.top : values.left; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SpacingInputControl, { icon: ICONS[side], label: LABELS[side], minimumCustomValue, onChange: createHandleOnChange(side), onMouseOut, onMouseOver, side, spacingSizes, type, value: axisValue, withInputField: false }, `spacing-sizes-control-${side}` ); }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/separated.js function SeparatedInputControls({ minimumCustomValue, onChange, onMouseOut, onMouseOver, sides, spacingSizes, type, values }) { const filteredSides = sides?.length ? ALL_SIDES.filter((side) => sides.includes(side)) : ALL_SIDES; const createHandleOnChange = (side) => (next) => { const nextValues = { ...Object.keys(values).reduce((acc, key) => { acc[key] = getPresetValueFromCustomValue( values[key], spacingSizes ); return acc; }, {}) }; nextValues[side] = next; onChange(nextValues); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: filteredSides.map((side) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SpacingInputControl, { icon: ICONS[side], label: LABELS[side], minimumCustomValue, onChange: createHandleOnChange(side), onMouseOut, onMouseOver, side, spacingSizes, type, value: values[side], withInputField: false }, `spacing-sizes-control-${side}` ); }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/single.js function single_SingleInputControl({ minimumCustomValue, onChange, onMouseOut, onMouseOver, showSideInLabel, side, spacingSizes, type, values }) { const createHandleOnChange = (currentSide) => (next) => { const nextValues = { ...Object.keys(values).reduce((acc, key) => { acc[key] = getPresetValueFromCustomValue( values[key], spacingSizes ); return acc; }, {}) }; nextValues[currentSide] = next; onChange(nextValues); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SpacingInputControl, { label: LABELS[side], minimumCustomValue, onChange: createHandleOnChange(side), onMouseOut, onMouseOver, showSideInLabel, side, spacingSizes, type, value: values[side], withInputField: false } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/linked-button.js function linked_button_LinkedButton({ isLinked, ...props }) { const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)("Unlink sides") : (0,external_wp_i18n_namespaceObject.__)("Link sides"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { ...props, size: "small", icon: isLinked ? link_default : link_off_default, iconSize: 24, label } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/index.js function SpacingSizesControl({ inputProps, label: labelProp, minimumCustomValue = 0, onChange, onMouseOut, onMouseOver, showSideInLabel = true, sides = ALL_SIDES, useSelect, values }) { const spacingSizes = useSpacingSizes(); const inputValues = values || DEFAULT_VALUES; const hasOneSide = sides?.length === 1; const hasOnlyAxialSides = sides?.includes("horizontal") && sides?.includes("vertical") && sides?.length === 2; const [view, setView] = (0,external_wp_element_namespaceObject.useState)(getInitialView(inputValues, sides)); const toggleLinked = () => { setView(view === VIEWS.axial ? VIEWS.custom : VIEWS.axial); }; const handleOnChange = (nextValue) => { const newValues = { ...values, ...nextValue }; onChange(newValues); }; const inputControlProps = { ...inputProps, minimumCustomValue, onChange: handleOnChange, onMouseOut, onMouseOver, sides, spacingSizes, type: labelProp, useSelect, values: inputValues }; const renderControls = () => { if (view === VIEWS.axial) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AxialInputControls, { ...inputControlProps }); } if (view === VIEWS.custom) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SeparatedInputControls, { ...inputControlProps }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( single_SingleInputControl, { side: view, ...inputControlProps, showSideInLabel } ); }; const sideLabel = ALL_SIDES.includes(view) && showSideInLabel ? LABELS[view] : ""; const label = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The side of the block being modified (top, bottom, left etc.). 2. Type of spacing being modified (padding, margin, etc). (0,external_wp_i18n_namespaceObject._x)("%1$s %2$s", "spacing"), labelProp, sideLabel ).trim(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "spacing-sizes-control", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "spacing-sizes-control__header", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", className: "spacing-sizes-control__label", children: label } ), !hasOneSide && !hasOnlyAxialSides && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( linked_button_LinkedButton, { label: labelProp, onClick: toggleLinked, isLinked: view === VIEWS.axial } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0.5, children: renderControls() }) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/height-control/index.js const RANGE_CONTROL_CUSTOM_SETTINGS = { px: { max: 1e3, step: 1 }, "%": { max: 100, step: 1 }, vw: { max: 100, step: 1 }, vh: { max: 100, step: 1 }, em: { max: 50, step: 0.1 }, rem: { max: 50, step: 0.1 }, svw: { max: 100, step: 1 }, lvw: { max: 100, step: 1 }, dvw: { max: 100, step: 1 }, svh: { max: 100, step: 1 }, lvh: { max: 100, step: 1 }, dvh: { max: 100, step: 1 }, vi: { max: 100, step: 1 }, svi: { max: 100, step: 1 }, lvi: { max: 100, step: 1 }, dvi: { max: 100, step: 1 }, vb: { max: 100, step: 1 }, svb: { max: 100, step: 1 }, lvb: { max: 100, step: 1 }, dvb: { max: 100, step: 1 }, vmin: { max: 100, step: 1 }, svmin: { max: 100, step: 1 }, lvmin: { max: 100, step: 1 }, dvmin: { max: 100, step: 1 }, vmax: { max: 100, step: 1 }, svmax: { max: 100, step: 1 }, lvmax: { max: 100, step: 1 }, dvmax: { max: 100, step: 1 } }; function HeightControl({ label = (0,external_wp_i18n_namespaceObject.__)("Height"), onChange, value }) { const customRangeValue = parseFloat(value); const [availableUnits] = use_settings_useSettings("spacing.units"); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || [ "%", "px", "em", "rem", "vh", "vw" ] }); const selectedUnit = (0,external_wp_element_namespaceObject.useMemo)( () => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value), [value] )[1] || units[0]?.value || "px"; const handleSliderChange = (next) => { onChange([next, selectedUnit].join("")); }; const handleUnitChange = (newUnit) => { const [currentValue, currentUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value); if (["em", "rem"].includes(newUnit) && currentUnit === "px") { onChange((currentValue / 16).toFixed(2) + newUnit); } else if (["em", "rem"].includes(currentUnit) && newUnit === "px") { onChange(Math.round(currentValue * 16) + newUnit); } else if ([ "%", "vw", "svw", "lvw", "dvw", "vh", "svh", "lvh", "dvh", "vi", "svi", "lvi", "dvi", "vb", "svb", "lvb", "dvb", "vmin", "svmin", "lvmin", "dvmin", "vmax", "svmax", "lvmax", "dvmax" ].includes(newUnit) && currentValue > 100) { onChange(100 + newUnit); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-height-control", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: label }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { value, units, onChange, onUnitChange: handleUnitChange, min: 0, size: "__unstable-large", label, hideLabelFromVision: true } ) }), /* @__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)( external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, value: customRangeValue, min: 0, max: RANGE_CONTROL_CUSTOM_SETTINGS[selectedUnit]?.max ?? 100, step: RANGE_CONTROL_CUSTOM_SETTINGS[selectedUnit]?.step ?? 0.1, withInputField: false, onChange: handleSliderChange, __nextHasNoMarginBottom: true, label, hideLabelFromVision: true } ) }) }) ] }) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/use-get-number-of-blocks-before-cell.js function useGetNumberOfBlocksBeforeCell(gridClientId, numColumns) { const { getBlockOrder, getBlockAttributes } = (0,external_wp_data_namespaceObject.useSelect)(store); const getNumberOfBlocksBeforeCell = (column, row) => { const targetIndex = (row - 1) * numColumns + column - 1; let count = 0; for (const clientId of getBlockOrder(gridClientId)) { const { columnStart, rowStart } = getBlockAttributes(clientId).style?.layout ?? {}; const cellIndex = (rowStart - 1) * numColumns + columnStart - 1; if (cellIndex < targetIndex) { count++; } } return count; }; return getNumberOfBlocksBeforeCell; } ;// ./node_modules/@wordpress/block-editor/build-module/components/child-layout-control/index.js function helpText(selfStretch, parentLayout) { const { orientation = "horizontal" } = parentLayout; if (selfStretch === "fill") { return (0,external_wp_i18n_namespaceObject.__)("Stretch to fill available space."); } if (selfStretch === "fixed" && orientation === "horizontal") { return (0,external_wp_i18n_namespaceObject.__)("Specify a fixed width."); } else if (selfStretch === "fixed") { return (0,external_wp_i18n_namespaceObject.__)("Specify a fixed height."); } return (0,external_wp_i18n_namespaceObject.__)("Fit contents."); } function ChildLayoutControl({ value: childLayout = {}, onChange, parentLayout, isShownByDefault, panelId }) { const { type: parentType, default: { type: defaultParentType = "default" } = {} } = parentLayout ?? {}; const parentLayoutType = parentType || defaultParentType; if (parentLayoutType === "flex") { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FlexControls, { childLayout, onChange, parentLayout, isShownByDefault, panelId } ); } else if (parentLayoutType === "grid") { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridControls, { childLayout, onChange, parentLayout, isShownByDefault, panelId } ); } return null; } function FlexControls({ childLayout, onChange, parentLayout, isShownByDefault, panelId }) { const { selfStretch, flexSize } = childLayout; const { orientation = "horizontal" } = parentLayout ?? {}; const hasFlexValue = () => !!selfStretch; const flexResetLabel = orientation === "horizontal" ? (0,external_wp_i18n_namespaceObject.__)("Width") : (0,external_wp_i18n_namespaceObject.__)("Height"); const [availableUnits] = use_settings_useSettings("spacing.units"); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || [ "%", "px", "em", "rem", "vh", "vw" ] }); const resetFlex = () => { onChange({ selfStretch: void 0, flexSize: void 0 }); }; (0,external_wp_element_namespaceObject.useEffect)(() => { if (selfStretch === "fixed" && !flexSize) { onChange({ ...childLayout, selfStretch: "fit" }); } }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { as: external_wp_components_namespaceObject.__experimentalToolsPanelItem, spacing: 2, hasValue: hasFlexValue, label: flexResetLabel, onDeselect: resetFlex, isShownByDefault, panelId, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, size: "__unstable-large", label: childLayoutOrientation(parentLayout), value: selfStretch || "fit", help: helpText(selfStretch, parentLayout), onChange: (value) => { const newFlexSize = value !== "fixed" ? null : flexSize; onChange({ selfStretch: value, flexSize: newFlexSize }); }, isBlock: true, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "fit", label: (0,external_wp_i18n_namespaceObject._x)( "Fit", "Intrinsic block width in flex layout" ) }, "fit" ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "fill", label: (0,external_wp_i18n_namespaceObject._x)( "Grow", "Block with expanding width in flex layout" ) }, "fill" ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "fixed", label: (0,external_wp_i18n_namespaceObject._x)( "Fixed", "Block with fixed width in flex layout" ) }, "fixed" ) ] } ), selfStretch === "fixed" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { size: "__unstable-large", units, onChange: (value) => { onChange({ selfStretch, flexSize: value }); }, value: flexSize, min: 0, label: flexResetLabel, hideLabelFromVision: true } ) ] } ); } function childLayoutOrientation(parentLayout) { const { orientation = "horizontal" } = parentLayout; return orientation === "horizontal" ? (0,external_wp_i18n_namespaceObject.__)("Width") : (0,external_wp_i18n_namespaceObject.__)("Height"); } function GridControls({ childLayout, onChange, parentLayout, isShownByDefault, panelId }) { const { columnStart, rowStart, columnSpan, rowSpan } = childLayout; const { columnCount, rowCount } = parentLayout ?? {}; const rootClientId = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).getBlockRootClientId(panelId) ); const { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell( rootClientId, columnCount || 3 ); const hasStartValue = () => !!columnStart || !!rowStart; const hasSpanValue = () => !!columnSpan || !!rowSpan; const resetGridStarts = () => { onChange({ columnStart: void 0, rowStart: void 0 }); }; const resetGridSpans = () => { onChange({ columnSpan: void 0, rowSpan: void 0 }); }; const maxColumnSpan = columnCount ? columnCount - (columnStart ?? 1) + 1 : void 0; const maxRowSpan = window.__experimentalEnableGridInteractivity && rowCount ? rowCount - (rowStart ?? 1) + 1 : void 0; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Flex, { as: external_wp_components_namespaceObject.__experimentalToolsPanelItem, hasValue: hasSpanValue, label: (0,external_wp_i18n_namespaceObject.__)("Grid span"), onDeselect: resetGridSpans, isShownByDefault, panelId, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: { width: "50%" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalInputControl, { size: "__unstable-large", label: (0,external_wp_i18n_namespaceObject.__)("Column span"), type: "number", onChange: (value) => { const newColumnSpan = value === "" ? 1 : parseInt(value, 10); const constrainedValue = maxColumnSpan ? Math.min(newColumnSpan, maxColumnSpan) : newColumnSpan; onChange({ columnStart, rowStart, rowSpan, columnSpan: constrainedValue }); }, value: columnSpan ?? 1, min: 1, max: maxColumnSpan } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: { width: "50%" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalInputControl, { size: "__unstable-large", label: (0,external_wp_i18n_namespaceObject.__)("Row span"), type: "number", onChange: (value) => { const newRowSpan = value === "" ? 1 : parseInt(value, 10); const constrainedValue = maxRowSpan ? Math.min(newRowSpan, maxRowSpan) : newRowSpan; onChange({ columnStart, rowStart, columnSpan, rowSpan: constrainedValue }); }, value: rowSpan ?? 1, min: 1, max: maxRowSpan } ) }) ] } ), window.__experimentalEnableGridInteractivity && // Use Flex with an explicit width on the FlexItem instead of HStack to // work around an issue in webkit where inputs with a max attribute are // sized incorrectly. /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Flex, { as: external_wp_components_namespaceObject.__experimentalToolsPanelItem, hasValue: hasStartValue, label: (0,external_wp_i18n_namespaceObject.__)("Grid placement"), onDeselect: resetGridStarts, isShownByDefault: false, panelId, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: { width: "50%" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalInputControl, { size: "__unstable-large", label: (0,external_wp_i18n_namespaceObject.__)("Column"), type: "number", onChange: (value) => { const newColumnStart = value === "" ? 1 : parseInt(value, 10); onChange({ columnStart: newColumnStart, rowStart, columnSpan, rowSpan }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition( [panelId], rootClientId, rootClientId, getNumberOfBlocksBeforeCell( newColumnStart, rowStart ) ); }, value: columnStart ?? 1, min: 1, max: columnCount ? columnCount - (columnSpan ?? 1) + 1 : void 0 } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: { width: "50%" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalInputControl, { size: "__unstable-large", label: (0,external_wp_i18n_namespaceObject.__)("Row"), type: "number", onChange: (value) => { const newRowStart = value === "" ? 1 : parseInt(value, 10); onChange({ columnStart, rowStart: newRowStart, columnSpan, rowSpan }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition( [panelId], rootClientId, rootClientId, getNumberOfBlocksBeforeCell( columnStart, newRowStart ) ); }, value: rowStart ?? 1, min: 1, max: rowCount ? rowCount - (rowSpan ?? 1) + 1 : void 0 } ) }) ] } ) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/aspect-ratio-tool.js function AspectRatioTool({ panelId, value, onChange = () => { }, options, defaultValue = "auto", hasValue, isShownByDefault = true }) { const displayValue = value ?? "auto"; const [defaultRatios, themeRatios, showDefaultRatios] = use_settings_useSettings( "dimensions.aspectRatios.default", "dimensions.aspectRatios.theme", "dimensions.defaultAspectRatios" ); const themeOptions = themeRatios?.map(({ name, ratio }) => ({ label: name, value: ratio })); const defaultOptions = defaultRatios?.map(({ name, ratio }) => ({ label: name, value: ratio })); const aspectRatioOptions = [ { label: (0,external_wp_i18n_namespaceObject._x)( "Original", "Aspect ratio option for dimensions control" ), value: "auto" }, ...showDefaultRatios ? defaultOptions : [], ...themeOptions ? themeOptions : [], { label: (0,external_wp_i18n_namespaceObject._x)("Custom", "Aspect ratio option for dimensions control"), value: "custom", disabled: true, hidden: true } ]; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: hasValue ? hasValue : () => displayValue !== defaultValue, label: (0,external_wp_i18n_namespaceObject.__)("Aspect ratio"), onDeselect: () => onChange(void 0), isShownByDefault, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SelectControl, { label: (0,external_wp_i18n_namespaceObject.__)("Aspect ratio"), value: displayValue, options: options ?? aspectRatioOptions, onChange, size: "__unstable-large", __nextHasNoMarginBottom: true } ) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/dimensions-panel.js const AXIAL_SIDES = ["horizontal", "vertical"]; function useHasDimensionsPanel(settings) { const hasContentSize = useHasContentSize(settings); const hasWideSize = useHasWideSize(settings); const hasPadding = useHasPadding(settings); const hasMargin = useHasMargin(settings); const hasGap = useHasGap(settings); const hasMinHeight = useHasMinHeight(settings); const hasAspectRatio = useHasAspectRatio(settings); const hasChildLayout = useHasChildLayout(settings); return external_wp_element_namespaceObject.Platform.OS === "web" && (hasContentSize || hasWideSize || hasPadding || hasMargin || hasGap || hasMinHeight || hasAspectRatio || hasChildLayout); } function useHasContentSize(settings) { return settings?.layout?.contentSize; } function useHasWideSize(settings) { return settings?.layout?.wideSize; } function useHasPadding(settings) { return settings?.spacing?.padding; } function useHasMargin(settings) { return settings?.spacing?.margin; } function useHasGap(settings) { return settings?.spacing?.blockGap; } function useHasMinHeight(settings) { return settings?.dimensions?.minHeight; } function useHasAspectRatio(settings) { return settings?.dimensions?.aspectRatio; } function useHasChildLayout(settings) { const { type: parentLayoutType = "default", default: { type: defaultParentLayoutType = "default" } = {}, allowSizingOnChildren = false } = settings?.parentLayout ?? {}; const support = (defaultParentLayoutType === "flex" || parentLayoutType === "flex" || defaultParentLayoutType === "grid" || parentLayoutType === "grid") && allowSizingOnChildren; return !!settings?.layout && support; } function useHasSpacingPresets(settings) { const { defaultSpacingSizes, spacingSizes } = settings?.spacing || {}; return defaultSpacingSizes !== false && spacingSizes?.default?.length > 0 || spacingSizes?.theme?.length > 0 || spacingSizes?.custom?.length > 0; } function filterValuesBySides(values, sides) { if (!sides || !values) { return values; } const filteredValues = {}; sides.forEach((side) => { if (side === "vertical") { filteredValues.top = values.top; filteredValues.bottom = values.bottom; } if (side === "horizontal") { filteredValues.left = values.left; filteredValues.right = values.right; } filteredValues[side] = values?.[side]; }); return filteredValues; } function splitStyleValue(value) { if (value && typeof value === "string") { return { top: value, right: value, bottom: value, left: value }; } return value; } function splitGapValue(value, isAxialGap) { if (!value) { return value; } if (typeof value === "string") { return isAxialGap ? { top: value, right: value, bottom: value, left: value } : { top: value }; } return { ...value, right: value?.left, bottom: value?.top }; } function DimensionsToolsPanel({ resetAllFilter, onChange, value, panelId, children }) { const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject.__)("Dimensions"), resetAll, panelId, dropdownMenuProps, children } ); } const dimensions_panel_DEFAULT_CONTROLS = { contentSize: true, wideSize: true, padding: true, margin: true, blockGap: true, minHeight: true, aspectRatio: true, childLayout: true }; function DimensionsPanel({ as: Wrapper = DimensionsToolsPanel, value, onChange, inheritedValue = value, settings, panelId, defaultControls = dimensions_panel_DEFAULT_CONTROLS, onVisualize = () => { }, // Special case because the layout controls are not part of the dimensions panel // in global styles but not in block inspector. includeLayoutControls = false }) { const { dimensions, spacing } = settings; const decodeValue = (rawValue) => { if (rawValue && typeof rawValue === "object") { return Object.keys(rawValue).reduce((acc, key) => { acc[key] = getValueFromVariable( { settings: { dimensions, spacing } }, "", rawValue[key] ); return acc; }, {}); } return getValueFromVariable( { settings: { dimensions, spacing } }, "", rawValue ); }; const showSpacingPresetsControl = useHasSpacingPresets(settings); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: settings?.spacing?.units || [ "%", "px", "em", "rem", "vw" ] }); const minimumMargin = -Infinity; const [minMarginValue, setMinMarginValue] = (0,external_wp_element_namespaceObject.useState)(minimumMargin); const showContentSizeControl = useHasContentSize(settings) && includeLayoutControls; const contentSizeValue = decodeValue(inheritedValue?.layout?.contentSize); const setContentSizeValue = (newValue) => { onChange( setImmutably( value, ["layout", "contentSize"], newValue || void 0 ) ); }; const hasUserSetContentSizeValue = () => !!value?.layout?.contentSize; const resetContentSizeValue = () => setContentSizeValue(void 0); const showWideSizeControl = useHasWideSize(settings) && includeLayoutControls; const wideSizeValue = decodeValue(inheritedValue?.layout?.wideSize); const setWideSizeValue = (newValue) => { onChange( setImmutably( value, ["layout", "wideSize"], newValue || void 0 ) ); }; const hasUserSetWideSizeValue = () => !!value?.layout?.wideSize; const resetWideSizeValue = () => setWideSizeValue(void 0); const showPaddingControl = useHasPadding(settings); const rawPadding = decodeValue(inheritedValue?.spacing?.padding); const paddingValues = splitStyleValue(rawPadding); const paddingSides = Array.isArray(settings?.spacing?.padding) ? settings?.spacing?.padding : settings?.spacing?.padding?.sides; const isAxialPadding = paddingSides && paddingSides.some((side) => AXIAL_SIDES.includes(side)); const setPaddingValues = (newPaddingValues) => { const padding = filterValuesBySides(newPaddingValues, paddingSides); onChange(setImmutably(value, ["spacing", "padding"], padding)); }; const hasPaddingValue = () => !!value?.spacing?.padding && Object.keys(value?.spacing?.padding).length; const resetPaddingValue = () => setPaddingValues(void 0); const onMouseOverPadding = () => onVisualize("padding"); const showMarginControl = useHasMargin(settings); const rawMargin = decodeValue(inheritedValue?.spacing?.margin); const marginValues = splitStyleValue(rawMargin); const marginSides = Array.isArray(settings?.spacing?.margin) ? settings?.spacing?.margin : settings?.spacing?.margin?.sides; const isAxialMargin = marginSides && marginSides.some((side) => AXIAL_SIDES.includes(side)); const setMarginValues = (newMarginValues) => { const margin = filterValuesBySides(newMarginValues, marginSides); onChange(setImmutably(value, ["spacing", "margin"], margin)); }; const hasMarginValue = () => !!value?.spacing?.margin && Object.keys(value?.spacing?.margin).length; const resetMarginValue = () => setMarginValues(void 0); const onMouseOverMargin = () => onVisualize("margin"); const showGapControl = useHasGap(settings); const gapSides = Array.isArray(settings?.spacing?.blockGap) ? settings?.spacing?.blockGap : settings?.spacing?.blockGap?.sides; const isAxialGap = gapSides && gapSides.some((side) => AXIAL_SIDES.includes(side)); const gapValue = decodeValue(inheritedValue?.spacing?.blockGap); const gapValues = splitGapValue(gapValue, isAxialGap); const setGapValue = (newGapValue) => { onChange( setImmutably(value, ["spacing", "blockGap"], newGapValue) ); }; const setGapValues = (nextBoxGapValue) => { if (!nextBoxGapValue) { setGapValue(null); } if (!isAxialGap && nextBoxGapValue?.hasOwnProperty("top")) { setGapValue(nextBoxGapValue.top); } else { setGapValue({ top: nextBoxGapValue?.top, left: nextBoxGapValue?.left }); } }; const resetGapValue = () => setGapValue(void 0); const hasGapValue = () => !!value?.spacing?.blockGap; const showMinHeightControl = useHasMinHeight(settings); const minHeightValue = decodeValue(inheritedValue?.dimensions?.minHeight); const setMinHeightValue = (newValue) => { const tempValue = setImmutably( value, ["dimensions", "minHeight"], newValue ); onChange( setImmutably( tempValue, ["dimensions", "aspectRatio"], void 0 ) ); }; const resetMinHeightValue = () => { setMinHeightValue(void 0); }; const hasMinHeightValue = () => !!value?.dimensions?.minHeight; const showAspectRatioControl = useHasAspectRatio(settings); const aspectRatioValue = decodeValue( inheritedValue?.dimensions?.aspectRatio ); const setAspectRatioValue = (newValue) => { const tempValue = setImmutably( value, ["dimensions", "aspectRatio"], newValue ); onChange( setImmutably(tempValue, ["dimensions", "minHeight"], void 0) ); }; const hasAspectRatioValue = () => !!value?.dimensions?.aspectRatio; const showChildLayoutControl = useHasChildLayout(settings); const childLayout = inheritedValue?.layout; const setChildLayout = (newChildLayout) => { onChange({ ...value, layout: { ...newChildLayout } }); }; const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => { return { ...previousValue, layout: utils_cleanEmptyObject({ ...previousValue?.layout, contentSize: void 0, wideSize: void 0, selfStretch: void 0, flexSize: void 0, columnStart: void 0, rowStart: void 0, columnSpan: void 0, rowSpan: void 0 }), spacing: { ...previousValue?.spacing, padding: void 0, margin: void 0, blockGap: void 0 }, dimensions: { ...previousValue?.dimensions, minHeight: void 0, aspectRatio: void 0 } }; }, []); const onMouseLeaveControls = () => onVisualize(false); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( Wrapper, { resetAllFilter, value, onChange, panelId, children: [ (showContentSizeControl || showWideSizeControl) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "span-columns", children: (0,external_wp_i18n_namespaceObject.__)("Set the width of the main content area.") }), showContentSizeControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)("Content width"), hasValue: hasUserSetContentSizeValue, onDeselect: resetContentSizeValue, isShownByDefault: defaultControls.contentSize ?? dimensions_panel_DEFAULT_CONTROLS.contentSize, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Content width"), labelPosition: "top", value: contentSizeValue || "", onChange: (nextContentSize) => { setContentSizeValue(nextContentSize); }, units, prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: align_none_default }) }) } ) } ), showWideSizeControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)("Wide width"), hasValue: hasUserSetWideSizeValue, onDeselect: resetWideSizeValue, isShownByDefault: defaultControls.wideSize ?? dimensions_panel_DEFAULT_CONTROLS.wideSize, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Wide width"), labelPosition: "top", value: wideSizeValue || "", onChange: (nextWideSize) => { setWideSizeValue(nextWideSize); }, units, prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: stretch_wide_default }) }) } ) } ), showPaddingControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: hasPaddingValue, label: (0,external_wp_i18n_namespaceObject.__)("Padding"), onDeselect: resetPaddingValue, isShownByDefault: defaultControls.padding ?? dimensions_panel_DEFAULT_CONTROLS.padding, className: dist_clsx({ "tools-panel-item-spacing": showSpacingPresetsControl }), panelId, children: [ !showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.BoxControl, { __next40pxDefaultSize: true, values: paddingValues, onChange: setPaddingValues, label: (0,external_wp_i18n_namespaceObject.__)("Padding"), sides: paddingSides, units, allowReset: false, splitOnAxis: isAxialPadding, inputProps: { onMouseOver: onMouseOverPadding, onMouseOut: onMouseLeaveControls } } ), showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SpacingSizesControl, { values: paddingValues, onChange: setPaddingValues, label: (0,external_wp_i18n_namespaceObject.__)("Padding"), sides: paddingSides, units, allowReset: false, onMouseOver: onMouseOverPadding, onMouseOut: onMouseLeaveControls } ) ] } ), showMarginControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: hasMarginValue, label: (0,external_wp_i18n_namespaceObject.__)("Margin"), onDeselect: resetMarginValue, isShownByDefault: defaultControls.margin ?? dimensions_panel_DEFAULT_CONTROLS.margin, className: dist_clsx({ "tools-panel-item-spacing": showSpacingPresetsControl }), panelId, children: [ !showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.BoxControl, { __next40pxDefaultSize: true, values: marginValues, onChange: setMarginValues, inputProps: { min: minMarginValue, onDragStart: () => { setMinMarginValue(0); }, onDragEnd: () => { setMinMarginValue(minimumMargin); }, onMouseOver: onMouseOverMargin, onMouseOut: onMouseLeaveControls }, label: (0,external_wp_i18n_namespaceObject.__)("Margin"), sides: marginSides, units, allowReset: false, splitOnAxis: isAxialMargin } ), showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SpacingSizesControl, { values: marginValues, onChange: setMarginValues, minimumCustomValue: -Infinity, label: (0,external_wp_i18n_namespaceObject.__)("Margin"), sides: marginSides, units, allowReset: false, onMouseOver: onMouseOverMargin, onMouseOut: onMouseLeaveControls } ) ] } ), showGapControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: hasGapValue, label: (0,external_wp_i18n_namespaceObject.__)("Block spacing"), onDeselect: resetGapValue, isShownByDefault: defaultControls.blockGap ?? dimensions_panel_DEFAULT_CONTROLS.blockGap, className: dist_clsx({ "tools-panel-item-spacing": showSpacingPresetsControl, "single-column": ( // If UnitControl is used, should be single-column. !showSpacingPresetsControl && !isAxialGap ) }), panelId, children: [ !showSpacingPresetsControl && (isAxialGap ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.BoxControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Block spacing"), min: 0, onChange: setGapValues, units, sides: gapSides, values: gapValues, allowReset: false, splitOnAxis: isAxialGap } ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Block spacing"), min: 0, onChange: setGapValue, units, value: gapValue } )), showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SpacingSizesControl, { label: (0,external_wp_i18n_namespaceObject.__)("Block spacing"), min: 0, onChange: setGapValues, showSideInLabel: false, sides: isAxialGap ? gapSides : ["top"], values: gapValues, allowReset: false } ) ] } ), showChildLayoutControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ChildLayoutControl, { value: childLayout, onChange: setChildLayout, parentLayout: settings?.parentLayout, panelId, isShownByDefault: defaultControls.childLayout ?? dimensions_panel_DEFAULT_CONTROLS.childLayout } ), showMinHeightControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: hasMinHeightValue, label: (0,external_wp_i18n_namespaceObject.__)("Minimum height"), onDeselect: resetMinHeightValue, isShownByDefault: defaultControls.minHeight ?? dimensions_panel_DEFAULT_CONTROLS.minHeight, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( HeightControl, { label: (0,external_wp_i18n_namespaceObject.__)("Minimum height"), value: minHeightValue, onChange: setMinHeightValue } ) } ), showAspectRatioControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AspectRatioTool, { hasValue: hasAspectRatioValue, value: aspectRatioValue, onChange: setAspectRatioValue, panelId, isShownByDefault: defaultControls.aspectRatio ?? dimensions_panel_DEFAULT_CONTROLS.aspectRatio } ) ] } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/use-popover-scroll.js const scrollContainerCache = /* @__PURE__ */ new WeakMap(); function usePopoverScroll(contentRef) { const effect = (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { function onWheel(event) { const { deltaX, deltaY, target } = event; const contentEl = contentRef.current; let scrollContainer = scrollContainerCache.get(contentEl); if (!scrollContainer) { scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(contentEl); scrollContainerCache.set(contentEl, scrollContainer); } const eventScrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(target); if (!node.contains(eventScrollContainer)) { scrollContainer.scrollBy(deltaX, deltaY); } } const options = { passive: true }; node.addEventListener("wheel", onWheel, options); return () => { node.removeEventListener("wheel", onWheel, options); }; }, [contentRef] ); return contentRef ? effect : null; } var use_popover_scroll_default = usePopoverScroll; ;// ./node_modules/@wordpress/block-editor/build-module/utils/dom.js const BLOCK_SELECTOR = ".block-editor-block-list__block"; const APPENDER_SELECTOR = ".block-list-appender"; const BLOCK_APPENDER_CLASS = ".block-editor-button-block-appender"; function isInSameBlock(a, b) { return a.closest(BLOCK_SELECTOR) === b.closest(BLOCK_SELECTOR); } function isInsideRootBlock(blockElement, element) { const parentBlock = element.closest( [BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS].join(",") ); return parentBlock === blockElement; } function getBlockClientId(node) { while (node && node.nodeType !== node.ELEMENT_NODE) { node = node.parentNode; } if (!node) { return; } const elementNode = ( /** @type {Element} */ node ); const blockNode = elementNode.closest(BLOCK_SELECTOR); if (!blockNode) { return; } return blockNode.id.slice("block-".length); } function rectUnion(rect1, rect2) { const left = Math.min(rect1.left, rect2.left); const right = Math.max(rect1.right, rect2.right); const bottom = Math.max(rect1.bottom, rect2.bottom); const top = Math.min(rect1.top, rect2.top); return new window.DOMRectReadOnly(left, top, right - left, bottom - top); } function isElementVisible(element) { const viewport = element.ownerDocument.defaultView; if (!viewport) { return false; } if (element.classList.contains("components-visually-hidden")) { return false; } const bounds = element.getBoundingClientRect(); if (bounds.width === 0 || bounds.height === 0) { return false; } if (element.checkVisibility) { return element.checkVisibility?.({ opacityProperty: true, contentVisibilityAuto: true, visibilityProperty: true }); } const style = viewport.getComputedStyle(element); if (style.display === "none" || style.visibility === "hidden" || style.opacity === "0") { return false; } return true; } function isScrollable(element) { const style = window.getComputedStyle(element); return style.overflowX === "auto" || style.overflowX === "scroll" || style.overflowY === "auto" || style.overflowY === "scroll"; } const WITH_OVERFLOW_ELEMENT_BLOCKS = ["core/navigation"]; function getElementBounds(element) { const viewport = element.ownerDocument.defaultView; if (!viewport) { return new window.DOMRectReadOnly(); } let bounds = element.getBoundingClientRect(); const dataType = element.getAttribute("data-type"); if (dataType && WITH_OVERFLOW_ELEMENT_BLOCKS.includes(dataType)) { const stack = [element]; let currentElement; while (currentElement = stack.pop()) { if (!isScrollable(currentElement)) { for (const child of currentElement.children) { if (isElementVisible(child)) { const childBounds = child.getBoundingClientRect(); bounds = rectUnion(bounds, childBounds); stack.push(child); } } } } } const left = Math.max(bounds.left, 0); const right = Math.min(bounds.right, viewport.innerWidth); bounds = new window.DOMRectReadOnly( left, bounds.top, right - left, bounds.height ); return bounds; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/index.js const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER; function BlockPopover({ clientId, bottomClientId, children, __unstablePopoverSlot, __unstableContentRef, shift = true, ...props }, ref) { const selectedElement = useBlockElement(clientId); const lastSelectedElement = useBlockElement(bottomClientId ?? clientId); const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([ ref, use_popover_scroll_default(__unstableContentRef) ]); const [ popoverDimensionsRecomputeCounter, forceRecomputePopoverDimensions ] = (0,external_wp_element_namespaceObject.useReducer)( // Module is there to make sure that the counter doesn't overflow. (s) => (s + 1) % MAX_POPOVER_RECOMPUTE_COUNTER, 0 ); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!selectedElement) { return; } const observer = new window.MutationObserver( forceRecomputePopoverDimensions ); observer.observe(selectedElement, { attributes: true }); return () => { observer.disconnect(); }; }, [selectedElement]); const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => { if ( // popoverDimensionsRecomputeCounter is by definition always equal or greater // than 0. This check is only there to satisfy the correctness of the // exhaustive-deps rule for the `useMemo` hook. popoverDimensionsRecomputeCounter < 0 || !selectedElement || bottomClientId && !lastSelectedElement ) { return void 0; } return { getBoundingClientRect() { return lastSelectedElement ? rectUnion( getElementBounds(selectedElement), getElementBounds(lastSelectedElement) ) : getElementBounds(selectedElement); }, contextElement: selectedElement }; }, [ popoverDimensionsRecomputeCounter, selectedElement, bottomClientId, lastSelectedElement ]); if (!selectedElement || bottomClientId && !lastSelectedElement) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Popover, { ref: mergedRefs, animate: false, focusOnMount: false, anchor: popoverAnchor, __unstableSlotName: __unstablePopoverSlot, inline: !__unstablePopoverSlot, placement: "top-start", resize: false, flip: false, shift, ...props, className: dist_clsx("block-editor-block-popover", props.className), variant: "unstyled", children } ); } const PrivateBlockPopover = (0,external_wp_element_namespaceObject.forwardRef)(BlockPopover); const PublicBlockPopover = ({ clientId, bottomClientId, children, ...props }, ref) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivateBlockPopover, { ...props, bottomClientId, clientId, __unstableContentRef: void 0, __unstablePopoverSlot: void 0, ref, children } ); var block_popover_default = (0,external_wp_element_namespaceObject.forwardRef)(PublicBlockPopover); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/cover.js function BlockPopoverCover({ clientId, bottomClientId, children, shift = false, additionalStyles, ...props }, ref) { bottomClientId ??= clientId; const selectedElement = useBlockElement(clientId); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivateBlockPopover, { ref, clientId, bottomClientId, shift, ...props, children: selectedElement && clientId === bottomClientId ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CoverContainer, { selectedElement, additionalStyles, children } ) : children } ); } function CoverContainer({ selectedElement, additionalStyles = {}, children }) { const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(selectedElement.offsetWidth); const [height, setHeight] = (0,external_wp_element_namespaceObject.useState)(selectedElement.offsetHeight); (0,external_wp_element_namespaceObject.useEffect)(() => { const observer = new window.ResizeObserver(() => { setWidth(selectedElement.offsetWidth); setHeight(selectedElement.offsetHeight); }); observer.observe(selectedElement, { box: "border-box" }); return () => observer.disconnect(); }, [selectedElement]); const style = (0,external_wp_element_namespaceObject.useMemo)(() => { return { position: "absolute", width, height, ...additionalStyles }; }, [width, height, additionalStyles]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style, children }); } var cover_default = (0,external_wp_element_namespaceObject.forwardRef)(BlockPopoverCover); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/spacing-visualizer.js function SpacingVisualizer({ clientId, value, computeStyle, forceShow }) { const blockElement = useBlockElement(clientId); const [style, updateStyle] = (0,external_wp_element_namespaceObject.useReducer)( () => computeStyle(blockElement) ); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!blockElement) { return; } const observer = new window.MutationObserver(updateStyle); observer.observe(blockElement, { attributes: true, attributeFilter: ["style", "class"] }); return () => { observer.disconnect(); }; }, [blockElement]); const previousValueRef = (0,external_wp_element_namespaceObject.useRef)(value); const [isActive, setIsActive] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { if (external_wp_isShallowEqual_default()(value, previousValueRef.current) || forceShow) { return; } setIsActive(true); previousValueRef.current = value; const timeout = setTimeout(() => { setIsActive(false); }, 400); return () => { setIsActive(false); clearTimeout(timeout); }; }, [value, forceShow]); if (!isActive && !forceShow) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( cover_default, { clientId, __unstablePopoverSlot: "block-toolbar", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor__spacing-visualizer", style }) } ); } function getComputedCSS(element, property) { return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property); } function MarginVisualizer({ clientId, value, forceShow }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SpacingVisualizer, { clientId, value: value?.spacing?.margin, computeStyle: (blockElement) => { const top = getComputedCSS(blockElement, "margin-top"); const right = getComputedCSS(blockElement, "margin-right"); const bottom = getComputedCSS(blockElement, "margin-bottom"); const left = getComputedCSS(blockElement, "margin-left"); return { borderTopWidth: top, borderRightWidth: right, borderBottomWidth: bottom, borderLeftWidth: left, top: top ? `-${top}` : 0, right: right ? `-${right}` : 0, bottom: bottom ? `-${bottom}` : 0, left: left ? `-${left}` : 0 }; }, forceShow } ); } function PaddingVisualizer({ clientId, value, forceShow }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SpacingVisualizer, { clientId, value: value?.spacing?.padding, computeStyle: (blockElement) => ({ borderTopWidth: getComputedCSS(blockElement, "padding-top"), borderRightWidth: getComputedCSS( blockElement, "padding-right" ), borderBottomWidth: getComputedCSS( blockElement, "padding-bottom" ), borderLeftWidth: getComputedCSS(blockElement, "padding-left") }), forceShow } ); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/dimensions.js const DIMENSIONS_SUPPORT_KEY = "dimensions"; const SPACING_SUPPORT_KEY = "spacing"; const dimensions_ALL_SIDES = (/* unused pure expression or super */ null && (["top", "right", "bottom", "left"])); const dimensions_AXIAL_SIDES = (/* unused pure expression or super */ null && (["vertical", "horizontal"])); function useVisualizer() { const [property, setProperty] = (0,external_wp_element_namespaceObject.useState)(false); const { hideBlockInterface, showBlockInterface } = unlock( (0,external_wp_data_namespaceObject.useDispatch)(store) ); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!property) { showBlockInterface(); } else { hideBlockInterface(); } }, [property, showBlockInterface, hideBlockInterface]); return [property, setProperty]; } function DimensionsInspectorControl({ children, resetAllFilter }) { const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)( (attributes) => { const existingStyle = attributes.style; const updatedStyle = resetAllFilter(existingStyle); return { ...attributes, style: updatedStyle }; }, [resetAllFilter] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inspector_controls_default, { group: "dimensions", resetAllFilter: attributesResetAllFilter, children } ); } function dimensions_DimensionsPanel({ clientId, name, setAttributes, settings }) { const isEnabled = useHasDimensionsPanel(settings); const value = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).getBlockAttributes(clientId)?.style, [clientId] ); const [visualizedProperty, setVisualizedProperty] = useVisualizer(); const onChange = (newStyle) => { setAttributes({ style: utils_cleanEmptyObject(newStyle) }); }; if (!isEnabled) { return null; } const defaultDimensionsControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ DIMENSIONS_SUPPORT_KEY, "__experimentalDefaultControls" ]); const defaultSpacingControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ SPACING_SUPPORT_KEY, "__experimentalDefaultControls" ]); const defaultControls = { ...defaultDimensionsControls, ...defaultSpacingControls }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( DimensionsPanel, { as: DimensionsInspectorControl, panelId: clientId, settings, value, onChange, defaultControls, onVisualize: setVisualizedProperty } ), !!settings?.spacing?.padding && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PaddingVisualizer, { forceShow: visualizedProperty === "padding", clientId, value } ), !!settings?.spacing?.margin && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( MarginVisualizer, { forceShow: visualizedProperty === "margin", clientId, value } ) ] }); } function hasDimensionsSupport(blockName, feature = "any") { if (external_wp_element_namespaceObject.Platform.OS !== "web") { return false; } const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, DIMENSIONS_SUPPORT_KEY); if (support === true) { return true; } if (feature === "any") { return !!(support?.aspectRatio || !!support?.minHeight); } return !!support?.[feature]; } var dimensions_default = { useBlockProps: dimensions_useBlockProps, attributeKeys: ["minHeight", "style"], hasSupport(name) { return hasDimensionsSupport(name, "aspectRatio"); } }; function dimensions_useBlockProps({ name, minHeight, style }) { if (!hasDimensionsSupport(name, "aspectRatio") || shouldSkipSerialization(name, DIMENSIONS_SUPPORT_KEY, "aspectRatio")) { return {}; } const className = dist_clsx({ "has-aspect-ratio": !!style?.dimensions?.aspectRatio }); const inlineStyleOverrides = {}; if (style?.dimensions?.aspectRatio) { inlineStyleOverrides.minHeight = "unset"; } else if (minHeight || style?.dimensions?.minHeight) { inlineStyleOverrides.aspectRatio = "unset"; } return { className, style: inlineStyleOverrides }; } function useCustomSides() { external_wp_deprecated_default()("wp.blockEditor.__experimentalUseCustomSides", { since: "6.3", version: "6.4" }); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/style.js const styleSupportKeys = [ ...TYPOGRAPHY_SUPPORT_KEYS, BORDER_SUPPORT_KEY, COLOR_SUPPORT_KEY, DIMENSIONS_SUPPORT_KEY, BACKGROUND_SUPPORT_KEY, SPACING_SUPPORT_KEY, SHADOW_SUPPORT_KEY ]; const hasStyleSupport = (nameOrType) => styleSupportKeys.some((key) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, key)); function getInlineStyles(styles = {}) { const output = {}; (0,external_wp_styleEngine_namespaceObject.getCSSRules)(styles).forEach((rule) => { output[rule.key] = rule.value; }); return output; } function style_addAttribute(settings) { if (!hasStyleSupport(settings)) { return settings; } if (!settings.attributes.style) { Object.assign(settings.attributes, { style: { type: "object" } }); } return settings; } const skipSerializationPathsEdit = { [`${BORDER_SUPPORT_KEY}.__experimentalSkipSerialization`]: ["border"], [`${COLOR_SUPPORT_KEY}.__experimentalSkipSerialization`]: [ COLOR_SUPPORT_KEY ], [`${TYPOGRAPHY_SUPPORT_KEY}.__experimentalSkipSerialization`]: [ TYPOGRAPHY_SUPPORT_KEY ], [`${DIMENSIONS_SUPPORT_KEY}.__experimentalSkipSerialization`]: [ DIMENSIONS_SUPPORT_KEY ], [`${SPACING_SUPPORT_KEY}.__experimentalSkipSerialization`]: [ SPACING_SUPPORT_KEY ], [`${SHADOW_SUPPORT_KEY}.__experimentalSkipSerialization`]: [ SHADOW_SUPPORT_KEY ] }; const skipSerializationPathsSave = { ...skipSerializationPathsEdit, [`${DIMENSIONS_SUPPORT_KEY}.aspectRatio`]: [ `${DIMENSIONS_SUPPORT_KEY}.aspectRatio` ], // Skip serialization of aspect ratio in save mode. [`${BACKGROUND_SUPPORT_KEY}`]: [BACKGROUND_SUPPORT_KEY] // Skip serialization of background support in save mode. }; const skipSerializationPathsSaveChecks = { [`${DIMENSIONS_SUPPORT_KEY}.aspectRatio`]: true, [`${BACKGROUND_SUPPORT_KEY}`]: true }; const renamedFeatures = { gradients: "gradient" }; function omitStyle(style, paths, preserveReference = false) { if (!style) { return style; } let newStyle = style; if (!preserveReference) { newStyle = JSON.parse(JSON.stringify(style)); } if (!Array.isArray(paths)) { paths = [paths]; } paths.forEach((path) => { if (!Array.isArray(path)) { path = path.split("."); } if (path.length > 1) { const [firstSubpath, ...restPath] = path; omitStyle(newStyle[firstSubpath], [restPath], true); } else if (path.length === 1) { delete newStyle[path[0]]; } }); return newStyle; } function style_addSaveProps(props, blockNameOrType, attributes, skipPaths = skipSerializationPathsSave) { if (!hasStyleSupport(blockNameOrType)) { return props; } let { style } = attributes; Object.entries(skipPaths).forEach(([indicator, path]) => { const skipSerialization = skipSerializationPathsSaveChecks[indicator] || (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, indicator); if (skipSerialization === true) { style = omitStyle(style, path); } if (Array.isArray(skipSerialization)) { skipSerialization.forEach((featureName) => { const feature = renamedFeatures[featureName] || featureName; style = omitStyle(style, [[...path, feature]]); }); } }); props.style = { ...getInlineStyles(style), ...props.style }; return props; } function BlockStyleControls({ clientId, name, setAttributes, __unstableParentLayout }) { const settings = useBlockSettings(name, __unstableParentLayout); const blockEditingMode = useBlockEditingMode(); const passedProps = { clientId, name, setAttributes, settings: { ...settings, typography: { ...settings.typography, // The text alignment UI for individual blocks is rendered in // the block toolbar, so disable it here. textAlign: false } } }; if (blockEditingMode !== "default") { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorEdit, { ...passedProps }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(background_BackgroundImagePanel, { ...passedProps }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_TypographyPanel, { ...passedProps }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(border_BorderPanel, { ...passedProps }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dimensions_DimensionsPanel, { ...passedProps }) ] }); } var style_default = { edit: BlockStyleControls, hasSupport: hasStyleSupport, addSaveProps: style_addSaveProps, attributeKeys: ["style"], useBlockProps: style_useBlockProps }; const elementTypes = [ { elementType: "button" }, { elementType: "link", pseudo: [":hover"] }, { elementType: "heading", elements: ["h1", "h2", "h3", "h4", "h5", "h6"] } ]; const STYLE_BLOCK_PROPS_REFERENCE = {}; function style_useBlockProps({ name, style }) { const blockElementsContainerIdentifier = (0,external_wp_compose_namespaceObject.useInstanceId)( STYLE_BLOCK_PROPS_REFERENCE, "wp-elements" ); const baseElementSelector = `.${blockElementsContainerIdentifier}`; const blockElementStyles = style?.elements; const styles = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!blockElementStyles) { return; } const elementCSSRules = []; elementTypes.forEach(({ elementType, pseudo, elements }) => { const skipSerialization = shouldSkipSerialization( name, COLOR_SUPPORT_KEY, elementType ); if (skipSerialization) { return; } const elementStyles = blockElementStyles?.[elementType]; if (elementStyles) { const selector = scopeSelector( baseElementSelector, external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementType] ); elementCSSRules.push( (0,external_wp_styleEngine_namespaceObject.compileCSS)(elementStyles, { selector }) ); if (pseudo) { pseudo.forEach((pseudoSelector) => { if (elementStyles[pseudoSelector]) { elementCSSRules.push( (0,external_wp_styleEngine_namespaceObject.compileCSS)(elementStyles[pseudoSelector], { selector: scopeSelector( baseElementSelector, `${external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementType]}${pseudoSelector}` ) }) ); } }); } } if (elements) { elements.forEach((element) => { if (blockElementStyles[element]) { elementCSSRules.push( (0,external_wp_styleEngine_namespaceObject.compileCSS)(blockElementStyles[element], { selector: scopeSelector( baseElementSelector, external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element] ) }) ); } }); } }); return elementCSSRules.length > 0 ? elementCSSRules.join("") : void 0; }, [baseElementSelector, blockElementStyles, name]); useStyleOverride({ css: styles }); return style_addSaveProps( { className: blockElementsContainerIdentifier }, name, { style }, skipSerializationPathsEdit ); } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/style/addAttribute", style_addAttribute ); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/settings.js const hasSettingsSupport = (blockType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "__experimentalSettings", false); function settings_addAttribute(settings) { if (!hasSettingsSupport(settings)) { return settings; } if (!settings?.attributes?.settings) { settings.attributes = { ...settings.attributes, settings: { type: "object" } }; } return settings; } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/settings/addAttribute", settings_addAttribute ); ;// ./node_modules/@wordpress/icons/build-module/library/filter.js var filter_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 4 4 19h16L12 4zm0 3.2 5.5 10.3H12V7.2z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/duotone-control/index.js function DuotoneControl({ id: idProp, colorPalette, duotonePalette, disableCustomColors, disableCustomDuotone, value, onChange }) { let toolbarIcon; if (value === "unset") { toolbarIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { className: "block-editor-duotone-control__unset-indicator" }); } else if (value) { toolbarIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotoneSwatch, { values: value }); } else { toolbarIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: filter_default }); } const actionLabel = (0,external_wp_i18n_namespaceObject.__)("Apply duotone filter"); const id = (0,external_wp_compose_namespaceObject.useInstanceId)(DuotoneControl, "duotone-control", idProp); const descriptionId = `${id}__description`; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps: { className: "block-editor-duotone-control__popover", headerTitle: (0,external_wp_i18n_namespaceObject.__)("Duotone") }, renderToggle: ({ isOpen, onToggle }) => { const openOnArrowDown = (event) => { if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { event.preventDefault(); onToggle(); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { showTooltip: true, onClick: onToggle, "aria-haspopup": "true", "aria-expanded": isOpen, onKeyDown: openOnArrowDown, label: actionLabel, icon: toolbarIcon } ); }, renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Duotone"), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( "Create a two-tone color effect without losing your original image." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DuotonePicker, { "aria-label": actionLabel, "aria-describedby": descriptionId, colorPalette, duotonePalette, disableCustomColors, disableCustomDuotone, value, onChange } ) ] }) } ); } var duotone_control_default = DuotoneControl; ;// ./node_modules/@wordpress/block-editor/build-module/components/duotone/utils.js function getValuesFromColors(colors = []) { const values = { r: [], g: [], b: [], a: [] }; colors.forEach((color) => { const rgbColor = w(color).toRgb(); values.r.push(rgbColor.r / 255); values.g.push(rgbColor.g / 255); values.b.push(rgbColor.b / 255); values.a.push(rgbColor.a); }); return values; } function getDuotoneUnsetStylesheet(selector) { return `${selector}{filter:none}`; } function getDuotoneStylesheet(selector, id) { return `${selector}{filter:url(#${id})}`; } function getDuotoneFilter(id, colors) { const values = getValuesFromColors(colors); return ` <svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 0 0" width="0" height="0" focusable="false" role="none" aria-hidden="true" style="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;" > <defs> <filter id="${id}"> <!-- Use sRGB instead of linearRGB so transparency looks correct. Use perceptual brightness to convert to grayscale. --> <feColorMatrix color-interpolation-filters="sRGB" type="matrix" values=" .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 "></feColorMatrix> <!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. --> <feComponentTransfer color-interpolation-filters="sRGB"> <feFuncR type="table" tableValues="${values.r.join(" ")}"></feFuncR> <feFuncG type="table" tableValues="${values.g.join(" ")}"></feFuncG> <feFuncB type="table" tableValues="${values.b.join(" ")}"></feFuncB> <feFuncA type="table" tableValues="${values.a.join(" ")}"></feFuncA> </feComponentTransfer> <!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. --> <feComposite in2="SourceGraphic" operator="in"></feComposite> </filter> </defs> </svg>`; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/get-block-css-selector.js function getBlockCSSSelector(blockType, target = "root", options = {}) { if (!target) { return null; } const { fallback = false } = options; const { name, selectors, supports } = blockType; const hasSelectors = selectors && Object.keys(selectors).length > 0; const path = Array.isArray(target) ? target.join(".") : target; let rootSelector = null; if (hasSelectors && selectors.root) { rootSelector = selectors?.root; } else if (supports?.__experimentalSelector) { rootSelector = supports.__experimentalSelector; } else { rootSelector = ".wp-block-" + name.replace("core/", "").replace("/", "-"); } if (path === "root") { return rootSelector; } const pathArray = Array.isArray(target) ? target : target.split("."); if (pathArray.length === 1) { const fallbackSelector = fallback ? rootSelector : null; if (hasSelectors) { const featureSelector2 = getValueFromObjectPath(selectors, `${path}.root`, null) || getValueFromObjectPath(selectors, path, null); return featureSelector2 || fallbackSelector; } const featureSelector = getValueFromObjectPath( supports, `${path}.__experimentalSelector`, null ); if (!featureSelector) { return fallbackSelector; } return scopeSelector(rootSelector, featureSelector); } let subfeatureSelector; if (hasSelectors) { subfeatureSelector = getValueFromObjectPath(selectors, path, null); } if (subfeatureSelector) { return subfeatureSelector; } if (fallback) { return getBlockCSSSelector(blockType, pathArray[0], options); } return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/filters-panel.js const filters_panel_EMPTY_ARRAY = []; function useMultiOriginColorPresets(settings, { presetSetting, defaultSetting }) { const disableDefault = !settings?.color?.[defaultSetting]; const userPresets = settings?.color?.[presetSetting]?.custom || filters_panel_EMPTY_ARRAY; const themePresets = settings?.color?.[presetSetting]?.theme || filters_panel_EMPTY_ARRAY; const defaultPresets = settings?.color?.[presetSetting]?.default || filters_panel_EMPTY_ARRAY; return (0,external_wp_element_namespaceObject.useMemo)( () => [ ...userPresets, ...themePresets, ...disableDefault ? filters_panel_EMPTY_ARRAY : defaultPresets ], [disableDefault, userPresets, themePresets, defaultPresets] ); } function useHasFiltersPanel(settings) { return useHasDuotoneControl(settings); } function useHasDuotoneControl(settings) { return settings.color.customDuotone || settings.color.defaultDuotone || settings.color.duotone.length > 0; } function FiltersToolsPanel({ resetAllFilter, onChange, value, panelId, children }) { const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject._x)("Filters", "Name for applying graphical effects"), resetAll, panelId, dropdownMenuProps, children } ); } const filters_panel_DEFAULT_CONTROLS = { duotone: true }; const filters_panel_popoverProps = { placement: "left-start", offset: 36, shift: true, className: "block-editor-duotone-control__popover", headerTitle: (0,external_wp_i18n_namespaceObject.__)("Duotone") }; const LabeledColorIndicator = ({ indicator, label }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { isLayered: false, offset: -8, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { expanded: false, children: indicator === "unset" || !indicator ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { className: "block-editor-duotone-control__unset-indicator" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotoneSwatch, { values: indicator }) }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { title: label, children: label }) ] }); const renderToggle = (duotone, resetDuotone) => ({ onToggle, isOpen }) => { const duotoneButtonRef = (0,external_wp_element_namespaceObject.useRef)(void 0); const toggleProps = { onClick: onToggle, className: dist_clsx( "block-editor-global-styles-filters-panel__dropdown-toggle", { "is-open": isOpen } ), "aria-expanded": isOpen, ref: duotoneButtonRef }; const removeButtonProps = { onClick: () => { if (isOpen) { onToggle(); } resetDuotone(); duotoneButtonRef.current?.focus(); }, className: "block-editor-panel-duotone-settings__reset", label: (0,external_wp_i18n_namespaceObject.__)("Reset") }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...toggleProps, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( LabeledColorIndicator, { indicator: duotone, label: (0,external_wp_i18n_namespaceObject.__)("Duotone") } ) }), duotone && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", icon: reset_default, ...removeButtonProps } ) ] }); }; function FiltersPanel({ as: Wrapper = FiltersToolsPanel, value, onChange, inheritedValue = value, settings, panelId, defaultControls = filters_panel_DEFAULT_CONTROLS }) { const decodeValue = (rawValue) => getValueFromVariable({ settings }, "", rawValue); const hasDuotoneEnabled = useHasDuotoneControl(settings); const duotonePalette = useMultiOriginColorPresets(settings, { presetSetting: "duotone", defaultSetting: "defaultDuotone" }); const colorPalette = useMultiOriginColorPresets(settings, { presetSetting: "palette", defaultSetting: "defaultPalette" }); const duotone = decodeValue(inheritedValue?.filter?.duotone); const setDuotone = (newValue) => { const duotonePreset = duotonePalette.find(({ colors }) => { return colors === newValue; }); const duotoneValue = duotonePreset ? `var:preset|duotone|${duotonePreset.slug}` : newValue; onChange( setImmutably(value, ["filter", "duotone"], duotoneValue) ); }; const hasDuotone = () => !!value?.filter?.duotone; const resetDuotone = () => setDuotone(void 0); const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => { return { ...previousValue, filter: { ...previousValue.filter, duotone: void 0 } }; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Wrapper, { resetAllFilter, value, onChange, panelId, children: hasDuotoneEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)("Duotone"), hasValue: hasDuotone, onDeselect: resetDuotone, isShownByDefault: defaultControls.duotone, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps: filters_panel_popoverProps, className: "block-editor-global-styles-filters-panel__dropdown", renderToggle: renderToggle(duotone, resetDuotone), renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "small", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Duotone"), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( "Create a two-tone color effect without losing your original image." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DuotonePicker, { colorPalette, duotonePalette, disableCustomColors: true, disableCustomDuotone: true, value: duotone, onChange: setDuotone } ) ] }) }) } ) } ) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/duotone.js const duotone_EMPTY_ARRAY = []; const isSafari = window?.navigator.userAgent && window.navigator.userAgent.includes("Safari") && !window.navigator.userAgent.includes("Chrome") && !window.navigator.userAgent.includes("Chromium"); k([names]); function useMultiOriginPresets({ presetSetting, defaultSetting }) { const [enableDefault, userPresets, themePresets, defaultPresets] = use_settings_useSettings( defaultSetting, `${presetSetting}.custom`, `${presetSetting}.theme`, `${presetSetting}.default` ); return (0,external_wp_element_namespaceObject.useMemo)( () => [ ...userPresets || duotone_EMPTY_ARRAY, ...themePresets || duotone_EMPTY_ARRAY, ...enableDefault && defaultPresets || duotone_EMPTY_ARRAY ], [enableDefault, userPresets, themePresets, defaultPresets] ); } function getColorsFromDuotonePreset(duotone, duotonePalette) { if (!duotone) { return; } const preset = duotonePalette?.find(({ slug }) => { return duotone === `var:preset|duotone|${slug}`; }); return preset ? preset.colors : void 0; } function getDuotonePresetFromColors(colors, duotonePalette) { if (!colors || !Array.isArray(colors)) { return; } const preset = duotonePalette?.find((duotonePreset) => { return duotonePreset?.colors?.every( (val, index) => val === colors[index] ); }); return preset ? `var:preset|duotone|${preset.slug}` : void 0; } function DuotonePanelPure({ style, setAttributes, name }) { const duotoneStyle = style?.color?.duotone; const settings = useBlockSettings(name); const blockEditingMode = useBlockEditingMode(); const duotonePalette = useMultiOriginPresets({ presetSetting: "color.duotone", defaultSetting: "color.defaultDuotone" }); const colorPalette = useMultiOriginPresets({ presetSetting: "color.palette", defaultSetting: "color.defaultPalette" }); const [enableCustomColors, enableCustomDuotone] = use_settings_useSettings( "color.custom", "color.customDuotone" ); const disableCustomColors = !enableCustomColors; const disableCustomDuotone = !enableCustomDuotone || colorPalette?.length === 0 && disableCustomColors; if (duotonePalette?.length === 0 && disableCustomDuotone) { return null; } if (blockEditingMode !== "default") { return null; } const duotonePresetOrColors = duotoneStyle === "unset" || Array.isArray(duotoneStyle) ? duotoneStyle : getColorsFromDuotonePreset(duotoneStyle, duotonePalette); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "filter", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FiltersPanel, { value: { filter: { duotone: duotonePresetOrColors } }, onChange: (newDuotone) => { const newStyle = { ...style, color: { ...newDuotone?.filter } }; setAttributes({ style: utils_cleanEmptyObject(newStyle) }); }, settings } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "block", __experimentalShareWithChildBlocks: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( duotone_control_default, { duotonePalette, colorPalette, disableCustomDuotone, disableCustomColors, value: duotonePresetOrColors, onChange: (newDuotone) => { const maybePreset = getDuotonePresetFromColors( newDuotone, duotonePalette ); const newStyle = { ...style, color: { ...style?.color, duotone: maybePreset ?? newDuotone // use preset or fallback to custom colors. } }; setAttributes({ style: utils_cleanEmptyObject(newStyle) }); }, settings } ) }) ] }); } var duotone_default = { shareWithChildBlocks: true, edit: DuotonePanelPure, useBlockProps: duotone_useBlockProps, attributeKeys: ["style"], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "filter.duotone"); } }; function addDuotoneAttributes(settings) { if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "filter.duotone")) { return settings; } if (!settings.attributes.style) { Object.assign(settings.attributes, { style: { type: "object" } }); } return settings; } function useDuotoneStyles({ clientId, id: filterId, selector: duotoneSelector, attribute: duotoneAttr }) { const duotonePalette = useMultiOriginPresets({ presetSetting: "color.duotone", defaultSetting: "color.defaultDuotone" }); const isCustom = Array.isArray(duotoneAttr); const duotonePreset = isCustom ? void 0 : getColorsFromDuotonePreset(duotoneAttr, duotonePalette); const isPreset = typeof duotoneAttr === "string" && duotonePreset; const isCSS = typeof duotoneAttr === "string" && !isPreset; let colors = null; if (isPreset) { colors = duotonePreset; } else if (isCSS) { colors = duotoneAttr; } else if (isCustom) { colors = duotoneAttr; } const selectors = duotoneSelector.split(","); const selectorsScoped = selectors.map((selectorPart) => { return `.${filterId}${selectorPart.trim()}`; }); const selector = selectorsScoped.join(", "); const isValidFilter = Array.isArray(colors) || colors === "unset"; usePrivateStyleOverride( isValidFilter ? { css: colors !== "unset" ? getDuotoneStylesheet(selector, filterId) : getDuotoneUnsetStylesheet(selector), __unstableType: "presets" } : void 0 ); usePrivateStyleOverride( isValidFilter ? { assets: colors !== "unset" ? getDuotoneFilter(filterId, colors) : "", __unstableType: "svgs" } : void 0 ); const blockElement = useBlockElement(clientId); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isValidFilter) { return; } if (blockElement && isSafari) { const display = blockElement.style.display; blockElement.style.setProperty("display", "inline-block"); blockElement.offsetHeight; blockElement.style.setProperty("display", display); } }, [isValidFilter, blockElement, colors]); } const DUOTONE_BLOCK_PROPS_REFERENCE = {}; function duotone_useBlockProps({ clientId, name, style }) { const id = (0,external_wp_compose_namespaceObject.useInstanceId)(DUOTONE_BLOCK_PROPS_REFERENCE); const selector = (0,external_wp_element_namespaceObject.useMemo)(() => { const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); if (blockType) { const duotoneSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)( blockType, "filter.duotone", false ); if (!duotoneSupport) { return null; } const experimentalDuotone = (0,external_wp_blocks_namespaceObject.getBlockSupport)( blockType, "color.__experimentalDuotone", false ); if (experimentalDuotone) { const rootSelector = getBlockCSSSelector(blockType); return typeof experimentalDuotone === "string" ? scopeSelector(rootSelector, experimentalDuotone) : rootSelector; } return getBlockCSSSelector(blockType, "filter.duotone", { fallback: true }); } }, [name]); const attribute = style?.color?.duotone; const filterClass = `wp-duotone-${id}`; const shouldRender = selector && attribute; useDuotoneStyles({ clientId, id: filterClass, selector, attribute }); return { className: shouldRender ? filterClass : "" }; } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/editor/duotone/add-attributes", addDuotoneAttributes ); ;// ./node_modules/@wordpress/block-editor/build-module/components/use-block-display-information/index.js function getPositionTypeLabel(attributes) { const positionType = attributes?.style?.position?.type; if (positionType === "sticky") { return (0,external_wp_i18n_namespaceObject.__)("Sticky"); } if (positionType === "fixed") { return (0,external_wp_i18n_namespaceObject.__)("Fixed"); } return null; } function useBlockDisplayInformation(clientId) { return (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (!clientId) { return null; } const { getBlockName, getBlockAttributes } = select(store); const { getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const blockName = getBlockName(clientId); const blockType = getBlockType(blockName); if (!blockType) { return null; } const attributes = getBlockAttributes(clientId); const match = getActiveBlockVariation(blockName, attributes); const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType) || (0,external_wp_blocks_namespaceObject.isTemplatePart)(blockType); const syncedTitle = isSynced ? (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, attributes) : void 0; const title = syncedTitle || blockType.title; const positionLabel = getPositionTypeLabel(attributes); const blockTypeInfo = { isSynced, title, icon: blockType.icon, description: blockType.description, anchor: attributes?.anchor, positionLabel, positionType: attributes?.style?.position?.type, name: attributes?.metadata?.name }; if (!match) { return blockTypeInfo; } return { isSynced, title: match.title || blockType.title, icon: match.icon || blockType.icon, description: match.description || blockType.description, anchor: attributes?.anchor, positionLabel, positionType: attributes?.style?.position?.type, name: attributes?.metadata?.name }; }, [clientId] ); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/position.js const POSITION_SUPPORT_KEY = "position"; const DEFAULT_OPTION = { key: "default", value: "", name: (0,external_wp_i18n_namespaceObject.__)("Default") }; const STICKY_OPTION = { key: "sticky", value: "sticky", name: (0,external_wp_i18n_namespaceObject._x)("Sticky", "Name for the value of the CSS position property"), hint: (0,external_wp_i18n_namespaceObject.__)( "The block will stick to the top of the window instead of scrolling." ) }; const FIXED_OPTION = { key: "fixed", value: "fixed", name: (0,external_wp_i18n_namespaceObject._x)("Fixed", "Name for the value of the CSS position property"), hint: (0,external_wp_i18n_namespaceObject.__)("The block will not move when the page is scrolled.") }; const POSITION_SIDES = ["top", "right", "bottom", "left"]; const VALID_POSITION_TYPES = ["sticky", "fixed"]; function getPositionCSS({ selector, style }) { let output = ""; const { type: positionType } = style?.position || {}; if (!VALID_POSITION_TYPES.includes(positionType)) { return output; } output += `${selector} {`; output += `position: ${positionType};`; POSITION_SIDES.forEach((side) => { if (style?.position?.[side] !== void 0) { output += `${side}: ${style.position[side]};`; } }); if (positionType === "sticky" || positionType === "fixed") { output += `z-index: 10`; } output += `}`; return output; } function hasStickyPositionSupport(blockType) { const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY); return !!(true === support || support?.sticky); } function hasFixedPositionSupport(blockType) { const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY); return !!(true === support || support?.fixed); } function hasPositionSupport(blockType) { const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY); return !!support; } function hasPositionValue(props) { return props.attributes.style?.position?.type !== void 0; } function hasStickyOrFixedPositionValue(attributes) { const positionType = attributes?.style?.position?.type; return positionType === "sticky" || positionType === "fixed"; } function resetPosition({ attributes = {}, setAttributes }) { const { style = {} } = attributes; setAttributes({ style: cleanEmptyObject({ ...style, position: { ...style?.position, type: void 0, top: void 0, right: void 0, bottom: void 0, left: void 0 } }) }); } function useIsPositionDisabled({ name: blockName } = {}) { const [allowFixed, allowSticky] = use_settings_useSettings( "position.fixed", "position.sticky" ); const isDisabled = !allowFixed && !allowSticky; return !hasPositionSupport(blockName) || isDisabled; } function PositionPanelPure({ style = {}, clientId, name: blockName, setAttributes }) { const allowFixed = hasFixedPositionSupport(blockName); const allowSticky = hasStickyPositionSupport(blockName); const value = style?.position?.type; const { firstParentClientId } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockParents } = select(store); const parents = getBlockParents(clientId); return { firstParentClientId: parents[parents.length - 1] }; }, [clientId] ); const blockInformation = useBlockDisplayInformation(firstParentClientId); const stickyHelpText = allowSticky && value === STICKY_OPTION.value && blockInformation ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the name of the parent block. */ (0,external_wp_i18n_namespaceObject.__)( "The block will stick to the scrollable area of the parent %s block." ), blockInformation.title ) : null; const options = (0,external_wp_element_namespaceObject.useMemo)(() => { const availableOptions = [DEFAULT_OPTION]; if (allowSticky || value === STICKY_OPTION.value) { availableOptions.push(STICKY_OPTION); } if (allowFixed || value === FIXED_OPTION.value) { availableOptions.push(FIXED_OPTION); } return availableOptions; }, [allowFixed, allowSticky, value]); const onChangeType = (next) => { const placementValue = "0px"; const newStyle = { ...style, position: { ...style?.position, type: next, top: next === "sticky" || next === "fixed" ? placementValue : void 0 } }; setAttributes({ style: utils_cleanEmptyObject(newStyle) }); }; const selectedOption = value ? options.find((option) => option.value === value) || DEFAULT_OPTION : DEFAULT_OPTION; return external_wp_element_namespaceObject.Platform.select({ web: options.length > 1 ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "position", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, help: stickyHelpText, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CustomSelectControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Position"), hideLabelFromVision: true, describedBy: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected position. (0,external_wp_i18n_namespaceObject.__)("Currently selected position: %s"), selectedOption.name ), options, value: selectedOption, onChange: ({ selectedItem }) => { onChangeType(selectedItem.value); }, size: "__unstable-large" } ) } ) }) : null, native: null }); } var position_default = { edit: function Edit(props) { const isPositionDisabled = useIsPositionDisabled(props); if (isPositionDisabled) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PositionPanelPure, { ...props }); }, useBlockProps: position_useBlockProps, attributeKeys: ["style"], hasSupport(name) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, POSITION_SUPPORT_KEY); } }; const POSITION_BLOCK_PROPS_REFERENCE = {}; function position_useBlockProps({ name, style }) { const hasPositionBlockSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)( name, POSITION_SUPPORT_KEY ); const isPositionDisabled = useIsPositionDisabled({ name }); const allowPositionStyles = hasPositionBlockSupport && !isPositionDisabled; const id = (0,external_wp_compose_namespaceObject.useInstanceId)(POSITION_BLOCK_PROPS_REFERENCE); const positionSelector = `.wp-container-${id}.wp-container-${id}`; let css; if (allowPositionStyles) { css = getPositionCSS({ selector: positionSelector, style }) || ""; } const className = dist_clsx({ [`wp-container-${id}`]: allowPositionStyles && !!css, // Only attach a container class if there is generated CSS to be attached. [`is-position-${style?.position?.type}`]: allowPositionStyles && !!css && !!style?.position?.type }); useStyleOverride({ css }); return { className }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/use-global-styles-output.js const ELEMENT_CLASS_NAMES = { button: "wp-element-button", caption: "wp-element-caption" }; const BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = { __experimentalBorder: "border", color: "color", spacing: "spacing", typography: "typography" }; const { kebabCase: use_global_styles_output_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); function getPresetsDeclarations(blockPresets = {}, mergedSettings) { return PRESET_METADATA.reduce( (declarations, { path, valueKey, valueFunc, cssVarInfix }) => { const presetByOrigin = getValueFromObjectPath( blockPresets, path, [] ); ["default", "theme", "custom"].forEach((origin) => { if (presetByOrigin[origin]) { presetByOrigin[origin].forEach((value) => { if (valueKey && !valueFunc) { declarations.push( `--wp--preset--${cssVarInfix}--${use_global_styles_output_kebabCase( value.slug )}: ${value[valueKey]}` ); } else if (valueFunc && typeof valueFunc === "function") { declarations.push( `--wp--preset--${cssVarInfix}--${use_global_styles_output_kebabCase( value.slug )}: ${valueFunc(value, mergedSettings)}` ); } }); } }); return declarations; }, [] ); } function getPresetsClasses(blockSelector = "*", blockPresets = {}) { return PRESET_METADATA.reduce( (declarations, { path, cssVarInfix, classes }) => { if (!classes) { return declarations; } const presetByOrigin = getValueFromObjectPath( blockPresets, path, [] ); ["default", "theme", "custom"].forEach((origin) => { if (presetByOrigin[origin]) { presetByOrigin[origin].forEach(({ slug }) => { classes.forEach(({ classSuffix, propertyName }) => { const classSelectorToUse = `.has-${use_global_styles_output_kebabCase( slug )}-${classSuffix}`; const selectorToUse = blockSelector.split(",").map( (selector) => `${selector}${classSelectorToUse}` ).join(","); const value = `var(--wp--preset--${cssVarInfix}--${use_global_styles_output_kebabCase( slug )})`; declarations += `${selectorToUse}{${propertyName}: ${value} !important;}`; }); }); } }); return declarations; }, "" ); } function getPresetsSvgFilters(blockPresets = {}) { return PRESET_METADATA.filter( // Duotone are the only type of filters for now. (metadata) => metadata.path.at(-1) === "duotone" ).flatMap((metadata) => { const presetByOrigin = getValueFromObjectPath( blockPresets, metadata.path, {} ); return ["default", "theme"].filter((origin) => presetByOrigin[origin]).flatMap( (origin) => presetByOrigin[origin].map( (preset) => getDuotoneFilter( `wp-duotone-${preset.slug}`, preset.colors ) ) ).join(""); }); } function flattenTree(input = {}, prefix, token) { let result = []; Object.keys(input).forEach((key) => { const newKey = prefix + use_global_styles_output_kebabCase(key.replace("/", "-")); const newLeaf = input[key]; if (newLeaf instanceof Object) { const newPrefix = newKey + token; result = [...result, ...flattenTree(newLeaf, newPrefix, token)]; } else { result.push(`${newKey}: ${newLeaf}`); } }); return result; } function concatFeatureVariationSelectorString(featureSelector, styleVariationSelector) { const featureSelectors = featureSelector.split(","); const combinedSelectors = []; featureSelectors.forEach((selector) => { combinedSelectors.push( `${styleVariationSelector.trim()}${selector.trim()}` ); }); return combinedSelectors.join(", "); } const getFeatureDeclarations = (selectors, styles) => { const declarations = {}; Object.entries(selectors).forEach(([feature, selector]) => { if (feature === "root" || !styles?.[feature]) { return; } const isShorthand = typeof selector === "string"; if (!isShorthand) { Object.entries(selector).forEach( ([subfeature, subfeatureSelector]) => { if (subfeature === "root" || !styles?.[feature][subfeature]) { return; } const subfeatureStyles = { [feature]: { [subfeature]: styles[feature][subfeature] } }; const newDeclarations = getStylesDeclarations(subfeatureStyles); declarations[subfeatureSelector] = [ ...declarations[subfeatureSelector] || [], ...newDeclarations ]; delete styles[feature][subfeature]; } ); } if (isShorthand || selector.root) { const featureSelector = isShorthand ? selector : selector.root; const featureStyles = { [feature]: styles[feature] }; const newDeclarations = getStylesDeclarations(featureStyles); declarations[featureSelector] = [ ...declarations[featureSelector] || [], ...newDeclarations ]; delete styles[feature]; } }); return declarations; }; function getStylesDeclarations(blockStyles = {}, selector = "", useRootPaddingAlign, tree = {}, disableRootPadding = false) { const isRoot = ROOT_BLOCK_SELECTOR === selector; const output = Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY).reduce( (declarations, [key, { value, properties, useEngine, rootOnly }]) => { if (rootOnly && !isRoot) { return declarations; } const pathToValue = value; if (pathToValue[0] === "elements" || useEngine) { return declarations; } const styleValue = getValueFromObjectPath( blockStyles, pathToValue ); if (key === "--wp--style--root--padding" && (typeof styleValue === "string" || !useRootPaddingAlign)) { return declarations; } if (properties && typeof styleValue !== "string") { Object.entries(properties).forEach((entry) => { const [name, prop] = entry; if (!getValueFromObjectPath(styleValue, [prop], false)) { return; } const cssProperty = name.startsWith("--") ? name : use_global_styles_output_kebabCase(name); declarations.push( `${cssProperty}: ${(0,external_wp_styleEngine_namespaceObject.getCSSValueFromRawStyle)( getValueFromObjectPath(styleValue, [prop]) )}` ); }); } else if (getValueFromObjectPath(blockStyles, pathToValue, false)) { const cssProperty = key.startsWith("--") ? key : use_global_styles_output_kebabCase(key); declarations.push( `${cssProperty}: ${(0,external_wp_styleEngine_namespaceObject.getCSSValueFromRawStyle)( getValueFromObjectPath(blockStyles, pathToValue) )}` ); } return declarations; }, [] ); if (!!blockStyles.background) { if (blockStyles.background?.backgroundImage) { blockStyles.background.backgroundImage = getResolvedValue( blockStyles.background.backgroundImage, tree ); } if (!isRoot && !!blockStyles.background?.backgroundImage?.id) { blockStyles = { ...blockStyles, background: { ...blockStyles.background, ...setBackgroundStyleDefaults(blockStyles.background) } }; } } const extraRules = (0,external_wp_styleEngine_namespaceObject.getCSSRules)(blockStyles); extraRules.forEach((rule) => { if (isRoot && (useRootPaddingAlign || disableRootPadding) && rule.key.startsWith("padding")) { return; } const cssProperty = rule.key.startsWith("--") ? rule.key : use_global_styles_output_kebabCase(rule.key); let ruleValue = getResolvedValue(rule.value, tree, null); if (cssProperty === "font-size") { ruleValue = getTypographyFontSizeValue( { size: ruleValue }, tree?.settings ); } if (cssProperty === "aspect-ratio") { output.push("min-height: unset"); } output.push(`${cssProperty}: ${ruleValue}`); }); return output; } function getLayoutStyles({ layoutDefinitions = LAYOUT_DEFINITIONS, style, selector, hasBlockGapSupport, hasFallbackGapSupport, fallbackGapValue }) { let ruleset = ""; let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : ""; if (hasFallbackGapSupport) { if (selector === ROOT_BLOCK_SELECTOR) { gapValue = !gapValue ? "0.5em" : gapValue; } else if (!hasBlockGapSupport && fallbackGapValue) { gapValue = fallbackGapValue; } } if (gapValue && layoutDefinitions) { Object.values(layoutDefinitions).forEach( ({ className, name, spacingStyles }) => { if (!hasBlockGapSupport && "flex" !== name && "grid" !== name) { return; } if (spacingStyles?.length) { spacingStyles.forEach((spacingStyle) => { const declarations = []; if (spacingStyle.rules) { Object.entries(spacingStyle.rules).forEach( ([cssProperty, cssValue]) => { declarations.push( `${cssProperty}: ${cssValue ? cssValue : gapValue}` ); } ); } if (declarations.length) { let combinedSelector = ""; if (!hasBlockGapSupport) { combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.${className}${spacingStyle?.selector || ""})` : `:where(${selector}.${className}${spacingStyle?.selector || ""})`; } else { combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:root :where(.${className})${spacingStyle?.selector || ""}` : `:root :where(${selector}-${className})${spacingStyle?.selector || ""}`; } ruleset += `${combinedSelector} { ${declarations.join( "; " )}; }`; } }); } } ); if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) { ruleset += `${ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: ${gapValue}; }`; } } if (selector === ROOT_BLOCK_SELECTOR && layoutDefinitions) { const validDisplayModes = ["block", "flex", "grid"]; Object.values(layoutDefinitions).forEach( ({ className, displayMode, baseStyles }) => { if (displayMode && validDisplayModes.includes(displayMode)) { ruleset += `${selector} .${className} { display:${displayMode}; }`; } if (baseStyles?.length) { baseStyles.forEach((baseStyle) => { const declarations = []; if (baseStyle.rules) { Object.entries(baseStyle.rules).forEach( ([cssProperty, cssValue]) => { declarations.push( `${cssProperty}: ${cssValue}` ); } ); } if (declarations.length) { const combinedSelector = `.${className}${baseStyle?.selector || ""}`; ruleset += `${combinedSelector} { ${declarations.join( "; " )}; }`; } }); } } ); } return ruleset; } const STYLE_KEYS = [ "border", "color", "dimensions", "spacing", "typography", "filter", "outline", "shadow", "background" ]; function pickStyleKeys(treeToPickFrom) { if (!treeToPickFrom) { return {}; } const entries = Object.entries(treeToPickFrom); const pickedEntries = entries.filter( ([key]) => STYLE_KEYS.includes(key) ); const clonedEntries = pickedEntries.map(([key, style]) => [ key, JSON.parse(JSON.stringify(style)) ]); return Object.fromEntries(clonedEntries); } const getNodesWithStyles = (tree, blockSelectors) => { const nodes = []; if (!tree?.styles) { return nodes; } const styles = pickStyleKeys(tree.styles); if (styles) { nodes.push({ styles, selector: ROOT_BLOCK_SELECTOR, // Root selector (body) styles should not be wrapped in `:root where()` to keep // specificity at (0,0,1) and maintain backwards compatibility. skipSelectorWrapper: true }); } Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS).forEach(([name, selector]) => { if (tree.styles?.elements?.[name]) { nodes.push({ styles: tree.styles?.elements?.[name], selector, // Top level elements that don't use a class name should not receive the // `:root :where()` wrapper to maintain backwards compatibility. skipSelectorWrapper: !ELEMENT_CLASS_NAMES[name] }); } }); Object.entries(tree.styles?.blocks ?? {}).forEach( ([blockName, node]) => { const blockStyles = pickStyleKeys(node); if (node?.variations) { const variations = {}; Object.entries(node.variations).forEach( ([variationName, variation]) => { variations[variationName] = pickStyleKeys(variation); if (variation?.css) { variations[variationName].css = variation.css; } const variationSelector = blockSelectors[blockName]?.styleVariationSelectors?.[variationName]; Object.entries(variation?.elements ?? {}).forEach( ([element, elementStyles]) => { if (elementStyles && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element]) { nodes.push({ styles: elementStyles, selector: scopeSelector( variationSelector, external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element] ) }); } } ); Object.entries(variation?.blocks ?? {}).forEach( ([ variationBlockName, variationBlockStyles ]) => { const variationBlockSelector = scopeSelector( variationSelector, blockSelectors[variationBlockName]?.selector ); const variationDuotoneSelector = scopeSelector( variationSelector, blockSelectors[variationBlockName]?.duotoneSelector ); const variationFeatureSelectors = scopeFeatureSelectors( variationSelector, blockSelectors[variationBlockName]?.featureSelectors ); const variationBlockStyleNodes = pickStyleKeys(variationBlockStyles); if (variationBlockStyles?.css) { variationBlockStyleNodes.css = variationBlockStyles.css; } nodes.push({ selector: variationBlockSelector, duotoneSelector: variationDuotoneSelector, featureSelectors: variationFeatureSelectors, fallbackGapValue: blockSelectors[variationBlockName]?.fallbackGapValue, hasLayoutSupport: blockSelectors[variationBlockName]?.hasLayoutSupport, styles: variationBlockStyleNodes }); Object.entries( variationBlockStyles.elements ?? {} ).forEach( ([ variationBlockElement, variationBlockElementStyles ]) => { if (variationBlockElementStyles && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[variationBlockElement]) { nodes.push({ styles: variationBlockElementStyles, selector: scopeSelector( variationBlockSelector, external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[variationBlockElement] ) }); } } ); } ); } ); blockStyles.variations = variations; } if (blockSelectors?.[blockName]?.selector) { nodes.push({ duotoneSelector: blockSelectors[blockName].duotoneSelector, fallbackGapValue: blockSelectors[blockName].fallbackGapValue, hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport, selector: blockSelectors[blockName].selector, styles: blockStyles, featureSelectors: blockSelectors[blockName].featureSelectors, styleVariationSelectors: blockSelectors[blockName].styleVariationSelectors }); } Object.entries(node?.elements ?? {}).forEach( ([elementName, value]) => { if (value && blockSelectors?.[blockName] && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName]) { nodes.push({ styles: value, selector: blockSelectors[blockName]?.selector.split(",").map((sel) => { const elementSelectors = external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName].split(","); return elementSelectors.map( (elementSelector) => sel + " " + elementSelector ); }).join(",") }); } } ); } ); return nodes; }; const getNodesWithSettings = (tree, blockSelectors) => { const nodes = []; if (!tree?.settings) { return nodes; } const pickPresets = (treeToPickFrom) => { let presets2 = {}; PRESET_METADATA.forEach(({ path }) => { const value = getValueFromObjectPath(treeToPickFrom, path, false); if (value !== false) { presets2 = setImmutably(presets2, path, value); } }); return presets2; }; const presets = pickPresets(tree.settings); const custom = tree.settings?.custom; if (Object.keys(presets).length > 0 || custom) { nodes.push({ presets, custom, selector: ROOT_CSS_PROPERTIES_SELECTOR }); } Object.entries(tree.settings?.blocks ?? {}).forEach( ([blockName, node]) => { const blockPresets = pickPresets(node); const blockCustom = node.custom; if (Object.keys(blockPresets).length > 0 || blockCustom) { nodes.push({ presets: blockPresets, custom: blockCustom, selector: blockSelectors[blockName]?.selector }); } } ); return nodes; }; const toCustomProperties = (tree, blockSelectors) => { const settings = getNodesWithSettings(tree, blockSelectors); let ruleset = ""; settings.forEach(({ presets, custom, selector }) => { const declarations = getPresetsDeclarations(presets, tree?.settings); const customProps = flattenTree(custom, "--wp--custom--", "--"); if (customProps.length > 0) { declarations.push(...customProps); } if (declarations.length > 0) { ruleset += `${selector}{${declarations.join(";")};}`; } }); return ruleset; }; const toStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false, disableRootPadding = false, styleOptions = void 0) => { const options = { blockGap: true, blockStyles: true, layoutStyles: true, marginReset: true, presets: true, rootPadding: true, variationStyles: false, ...styleOptions }; const nodesWithStyles = getNodesWithStyles(tree, blockSelectors); const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); const useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments; const { contentSize, wideSize } = tree?.settings?.layout || {}; const hasBodyStyles = options.marginReset || options.rootPadding || options.layoutStyles; let ruleset = ""; if (options.presets && (contentSize || wideSize)) { ruleset += `${ROOT_CSS_PROPERTIES_SELECTOR} {`; ruleset = contentSize ? ruleset + ` --wp--style--global--content-size: ${contentSize};` : ruleset; ruleset = wideSize ? ruleset + ` --wp--style--global--wide-size: ${wideSize};` : ruleset; ruleset += "}"; } if (hasBodyStyles) { ruleset += ":where(body) {margin: 0;"; if (options.rootPadding && useRootPaddingAlign) { ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) } .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); } .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); } .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; } .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0; `; } ruleset += "}"; } if (options.blockStyles) { nodesWithStyles.forEach( ({ selector, duotoneSelector, styles, fallbackGapValue, hasLayoutSupport, featureSelectors, styleVariationSelectors, skipSelectorWrapper }) => { if (featureSelectors) { const featureDeclarations = getFeatureDeclarations( featureSelectors, styles ); Object.entries(featureDeclarations).forEach( ([cssSelector, declarations]) => { if (declarations.length) { const rules = declarations.join(";"); ruleset += `:root :where(${cssSelector}){${rules};}`; } } ); } if (duotoneSelector) { const duotoneStyles = {}; if (styles?.filter) { duotoneStyles.filter = styles.filter; delete styles.filter; } const duotoneDeclarations = getStylesDeclarations(duotoneStyles); if (duotoneDeclarations.length) { ruleset += `${duotoneSelector}{${duotoneDeclarations.join( ";" )};}`; } } if (!disableLayoutStyles && (ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport)) { ruleset += getLayoutStyles({ style: styles, selector, hasBlockGapSupport, hasFallbackGapSupport, fallbackGapValue }); } const styleDeclarations = getStylesDeclarations( styles, selector, useRootPaddingAlign, tree, disableRootPadding ); if (styleDeclarations?.length) { const generalSelector = skipSelectorWrapper ? selector : `:root :where(${selector})`; ruleset += `${generalSelector}{${styleDeclarations.join( ";" )};}`; } if (styles?.css) { ruleset += processCSSNesting( styles.css, `:root :where(${selector})` ); } if (options.variationStyles && styleVariationSelectors) { Object.entries(styleVariationSelectors).forEach( ([styleVariationName, styleVariationSelector]) => { const styleVariations = styles?.variations?.[styleVariationName]; if (styleVariations) { if (featureSelectors) { const featureDeclarations = getFeatureDeclarations( featureSelectors, styleVariations ); Object.entries( featureDeclarations ).forEach( ([baseSelector, declarations]) => { if (declarations.length) { const cssSelector = concatFeatureVariationSelectorString( baseSelector, styleVariationSelector ); const rules = declarations.join(";"); ruleset += `:root :where(${cssSelector}){${rules};}`; } } ); } const styleVariationDeclarations = getStylesDeclarations( styleVariations, styleVariationSelector, useRootPaddingAlign, tree ); if (styleVariationDeclarations.length) { ruleset += `:root :where(${styleVariationSelector}){${styleVariationDeclarations.join( ";" )};}`; } if (styleVariations?.css) { ruleset += processCSSNesting( styleVariations.css, `:root :where(${styleVariationSelector})` ); } } } ); } const pseudoSelectorStyles = Object.entries(styles).filter( ([key]) => key.startsWith(":") ); if (pseudoSelectorStyles?.length) { pseudoSelectorStyles.forEach( ([pseudoKey, pseudoStyle]) => { const pseudoDeclarations = getStylesDeclarations(pseudoStyle); if (!pseudoDeclarations?.length) { return; } const _selector = selector.split(",").map((sel) => sel + pseudoKey).join(","); const pseudoRule = `:root :where(${_selector}){${pseudoDeclarations.join( ";" )};}`; ruleset += pseudoRule; } ); } } ); } if (options.layoutStyles) { ruleset = ruleset + ".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }"; ruleset = ruleset + ".wp-site-blocks > .alignright { float: right; margin-left: 2em; }"; ruleset = ruleset + ".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }"; } if (options.blockGap && hasBlockGapSupport) { const gapValue = getGapCSSValue(tree?.styles?.spacing?.blockGap) || "0.5em"; ruleset = ruleset + `:root :where(.wp-site-blocks) > * { margin-block-start: ${gapValue}; margin-block-end: 0; }`; ruleset = ruleset + ":root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }"; ruleset = ruleset + ":root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }"; } if (options.presets) { nodesWithSettings.forEach(({ selector, presets }) => { if (ROOT_BLOCK_SELECTOR === selector || ROOT_CSS_PROPERTIES_SELECTOR === selector) { selector = ""; } const classes = getPresetsClasses(selector, presets); if (classes.length > 0) { ruleset += classes; } }); } return ruleset; }; function toSvgFilters(tree, blockSelectors) { const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); return nodesWithSettings.flatMap(({ presets }) => { return getPresetsSvgFilters(presets); }); } const getSelectorsConfig = (blockType, rootSelector) => { if (blockType?.selectors && Object.keys(blockType.selectors).length > 0) { return blockType.selectors; } const config = { root: rootSelector }; Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach( ([featureKey, featureName]) => { const featureSelector = getBlockCSSSelector( blockType, featureKey ); if (featureSelector) { config[featureName] = featureSelector; } } ); return config; }; const getBlockSelectors = (blockTypes, getBlockStyles, variationInstanceId) => { const result = {}; blockTypes.forEach((blockType) => { const name = blockType.name; const selector = getBlockCSSSelector(blockType); let duotoneSelector = getBlockCSSSelector( blockType, "filter.duotone" ); if (!duotoneSelector) { const rootSelector = getBlockCSSSelector(blockType); const duotoneSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)( blockType, "color.__experimentalDuotone", false ); duotoneSelector = duotoneSupport && scopeSelector(rootSelector, duotoneSupport); } const hasLayoutSupport = !!blockType?.supports?.layout || !!blockType?.supports?.__experimentalLayout; const fallbackGapValue = blockType?.supports?.spacing?.blockGap?.__experimentalDefault; const blockStyleVariations = getBlockStyles(name); const styleVariationSelectors = {}; blockStyleVariations?.forEach((variation) => { const variationSuffix = variationInstanceId ? `-${variationInstanceId}` : ""; const variationName = `${variation.name}${variationSuffix}`; const styleVariationSelector = getBlockStyleVariationSelector( variationName, selector ); styleVariationSelectors[variationName] = styleVariationSelector; }); const featureSelectors = getSelectorsConfig(blockType, selector); result[name] = { duotoneSelector, fallbackGapValue, featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : void 0, hasLayoutSupport, name, selector, styleVariationSelectors: blockStyleVariations?.length ? styleVariationSelectors : void 0 }; }); return result; }; function updateConfigWithSeparator(config) { const needsSeparatorStyleUpdate = config.styles?.blocks?.["core/separator"] && config.styles?.blocks?.["core/separator"].color?.background && !config.styles?.blocks?.["core/separator"].color?.text && !config.styles?.blocks?.["core/separator"].border?.color; if (needsSeparatorStyleUpdate) { return { ...config, styles: { ...config.styles, blocks: { ...config.styles.blocks, "core/separator": { ...config.styles.blocks["core/separator"], color: { ...config.styles.blocks["core/separator"].color, text: config.styles?.blocks["core/separator"].color.background } } } } }; } return config; } function processCSSNesting(css, blockSelector) { let processedCSS = ""; if (!css || css.trim() === "") { return processedCSS; } const parts = css.split("&"); parts.forEach((part) => { if (!part || part.trim() === "") { return; } const isRootCss = !part.includes("{"); if (isRootCss) { processedCSS += `:root :where(${blockSelector}){${part.trim()}}`; } else { const splitPart = part.replace("}", "").split("{"); if (splitPart.length !== 2) { return; } const [nestedSelector, cssValue] = splitPart; const matches = nestedSelector.match(/([>+~\s]*::[a-zA-Z-]+)/); const pseudoPart = matches ? matches[1] : ""; const withoutPseudoElement = matches ? nestedSelector.replace(pseudoPart, "").trim() : nestedSelector.trim(); let combinedSelector; if (withoutPseudoElement === "") { combinedSelector = blockSelector; } else { combinedSelector = nestedSelector.startsWith(" ") ? scopeSelector(blockSelector, withoutPseudoElement) : appendToSelector(blockSelector, withoutPseudoElement); } processedCSS += `:root :where(${combinedSelector})${pseudoPart}{${cssValue.trim()}}`; } }); return processedCSS; } function useGlobalStylesOutputWithConfig(mergedConfig = {}, disableRootPadding) { const [blockGap] = useGlobalSetting("spacing.blockGap"); const hasBlockGapSupport = blockGap !== null; const hasFallbackGapSupport = !hasBlockGapSupport; const disableLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSettings } = select(store); return !!getSettings().disableLayoutStyles; }); const { getBlockStyles } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); return (0,external_wp_element_namespaceObject.useMemo)(() => { if (!mergedConfig?.styles || !mergedConfig?.settings) { return []; } const updatedConfig = updateConfigWithSeparator(mergedConfig); const blockSelectors = getBlockSelectors( (0,external_wp_blocks_namespaceObject.getBlockTypes)(), getBlockStyles ); const customProperties = toCustomProperties( updatedConfig, blockSelectors ); const globalStyles = toStyles( updatedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, disableRootPadding ); const svgs = toSvgFilters(updatedConfig, blockSelectors); const styles = [ { css: customProperties, isGlobalStyles: true }, { css: globalStyles, isGlobalStyles: true }, // Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor. { css: updatedConfig.styles.css ?? "", isGlobalStyles: true }, { assets: svgs, __unstableType: "svg", isGlobalStyles: true } ]; (0,external_wp_blocks_namespaceObject.getBlockTypes)().forEach((blockType) => { if (updatedConfig.styles.blocks[blockType.name]?.css) { const selector = blockSelectors[blockType.name].selector; styles.push({ css: processCSSNesting( updatedConfig.styles.blocks[blockType.name]?.css, selector ), isGlobalStyles: true }); } }); return [styles, updatedConfig.settings]; }, [ hasBlockGapSupport, hasFallbackGapSupport, mergedConfig, disableLayoutStyles, disableRootPadding, getBlockStyles ]); } function useGlobalStylesOutput(disableRootPadding = false) { const { merged: mergedConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); return useGlobalStylesOutputWithConfig(mergedConfig, disableRootPadding); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-style-variation.js const VARIATION_PREFIX = "is-style-"; function getVariationMatches(className) { if (!className) { return []; } return className.split(/\s+/).reduce((matches, name) => { if (name.startsWith(VARIATION_PREFIX)) { const match = name.slice(VARIATION_PREFIX.length); if (match !== "default") { matches.push(match); } } return matches; }, []); } function getVariationNameFromClass(className, registeredStyles = []) { const matches = getVariationMatches(className); if (!matches) { return null; } for (const variation of matches) { if (registeredStyles.some((style) => style.name === variation)) { return variation; } } return null; } function OverrideStyles({ override }) { usePrivateStyleOverride(override); } function __unstableBlockStyleVariationOverridesWithConfig({ config }) { const { getBlockStyles, overrides } = (0,external_wp_data_namespaceObject.useSelect)( (select) => ({ getBlockStyles: select(external_wp_blocks_namespaceObject.store).getBlockStyles, overrides: unlock(select(store)).getStyleOverrides() }), [] ); const { getBlockName } = (0,external_wp_data_namespaceObject.useSelect)(store); const overridesWithConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!overrides?.length) { return; } const newOverrides = []; const overriddenClientIds = []; for (const [, override] of overrides) { if (override?.variation && override?.clientId && /* * Because this component overwrites existing style overrides, * filter out any overrides that are already present in the store. */ !overriddenClientIds.includes(override.clientId)) { const blockName = getBlockName(override.clientId); const configStyles = config?.styles?.blocks?.[blockName]?.variations?.[override.variation]; if (configStyles) { const variationConfig = { settings: config?.settings, // The variation style data is all that is needed to generate // the styles for the current application to a block. The variation // name is updated to match the instance specific class name. styles: { blocks: { [blockName]: { variations: { [`${override.variation}-${override.clientId}`]: configStyles } } } } }; const blockSelectors = getBlockSelectors( (0,external_wp_blocks_namespaceObject.getBlockTypes)(), getBlockStyles, override.clientId ); const hasBlockGapSupport = false; const hasFallbackGapSupport = true; const disableLayoutStyles = true; const disableRootPadding = true; const variationStyles = toStyles( variationConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, disableRootPadding, { blockGap: false, blockStyles: true, layoutStyles: false, marginReset: false, presets: false, rootPadding: false, variationStyles: true } ); newOverrides.push({ id: `${override.variation}-${override.clientId}`, css: variationStyles, __unstableType: "variation", variation: override.variation, // The clientId will be stored with the override and used to ensure // the order of overrides matches the order of blocks so that the // correct CSS cascade is maintained. clientId: override.clientId }); overriddenClientIds.push(override.clientId); } } } return newOverrides; }, [config, overrides, getBlockStyles, getBlockName]); if (!overridesWithConfig || !overridesWithConfig.length) { return; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: overridesWithConfig.map((override) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(OverrideStyles, { override }, override.id)) }); } function getVariationStylesWithRefValues(globalStyles, name, variation) { if (!globalStyles?.styles?.blocks?.[name]?.variations?.[variation]) { return; } const replaceRefs = (variationStyles) => { Object.keys(variationStyles).forEach((key) => { const value = variationStyles[key]; if (typeof value === "object" && value !== null) { if (value.ref !== void 0) { if (typeof value.ref !== "string" || value.ref.trim() === "") { delete variationStyles[key]; } else { const refValue = getValueFromObjectPath( globalStyles, value.ref ); if (refValue) { variationStyles[key] = refValue; } else { delete variationStyles[key]; } } } else { replaceRefs(value); if (Object.keys(value).length === 0) { delete variationStyles[key]; } } } }); }; const styles = JSON.parse( JSON.stringify( globalStyles.styles.blocks[name].variations[variation] ) ); replaceRefs(styles); return styles; } function useBlockStyleVariation(name, variation, clientId) { const { merged: mergedConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); const { globalSettings, globalStyles } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const settings = select(store).getSettings(); return { globalSettings: settings.__experimentalFeatures, globalStyles: settings[globalStylesDataKey] }; }, []); return (0,external_wp_element_namespaceObject.useMemo)(() => { const variationStyles = getVariationStylesWithRefValues( { settings: mergedConfig?.settings ?? globalSettings, styles: mergedConfig?.styles ?? globalStyles }, name, variation ); return { settings: mergedConfig?.settings ?? globalSettings, // The variation style data is all that is needed to generate // the styles for the current application to a block. The variation // name is updated to match the instance specific class name. styles: { blocks: { [name]: { variations: { [`${variation}-${clientId}`]: variationStyles } } } } }; }, [ mergedConfig, globalSettings, globalStyles, variation, clientId, name ]); } function block_style_variation_useBlockProps({ name, className, clientId }) { const { getBlockStyles } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const registeredStyles = getBlockStyles(name); const variation = getVariationNameFromClass(className, registeredStyles); const variationClass = `${VARIATION_PREFIX}${variation}-${clientId}`; const { settings, styles } = useBlockStyleVariation( name, variation, clientId ); const variationStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!variation) { return; } const variationConfig = { settings, styles }; const blockSelectors = getBlockSelectors( (0,external_wp_blocks_namespaceObject.getBlockTypes)(), getBlockStyles, clientId ); const hasBlockGapSupport = false; const hasFallbackGapSupport = true; const disableLayoutStyles = true; const disableRootPadding = true; return toStyles( variationConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, disableRootPadding, { blockGap: false, blockStyles: true, layoutStyles: false, marginReset: false, presets: false, rootPadding: false, variationStyles: true } ); }, [variation, settings, styles, getBlockStyles, clientId]); usePrivateStyleOverride({ id: `variation-${clientId}`, css: variationStyles, __unstableType: "variation", variation, // The clientId will be stored with the override and used to ensure // the order of overrides matches the order of blocks so that the // correct CSS cascade is maintained. clientId }); return variation ? { className: variationClass } : {}; } var block_style_variation_default = { hasSupport: () => true, attributeKeys: ["className"], isMatch: ({ className }) => getVariationMatches(className).length > 0, useBlockProps: block_style_variation_useBlockProps }; ;// ./node_modules/@wordpress/block-editor/build-module/hooks/layout.js const layoutBlockSupportKey = "layout"; const { kebabCase: layout_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); function hasLayoutBlockSupport(blockName) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "layout") || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "__experimentalLayout"); } function useLayoutClasses(blockAttributes = {}, blockName = "") { const { layout } = blockAttributes; const { default: defaultBlockLayout } = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, layoutBlockSupportKey) || {}; const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? { ...layout, type: "constrained" } : layout || defaultBlockLayout || {}; const layoutClassnames = []; if (LAYOUT_DEFINITIONS[usedLayout?.type || "default"]?.className) { const baseClassName = LAYOUT_DEFINITIONS[usedLayout?.type || "default"]?.className; const splitBlockName = blockName.split("/"); const fullBlockName = splitBlockName[0] === "core" ? splitBlockName.pop() : splitBlockName.join("-"); const compoundClassName = `wp-block-${fullBlockName}-${baseClassName}`; layoutClassnames.push(baseClassName, compoundClassName); } const hasGlobalPadding = (0,external_wp_data_namespaceObject.useSelect)( (select) => { return (usedLayout?.inherit || usedLayout?.contentSize || usedLayout?.type === "constrained") && select(store).getSettings().__experimentalFeatures?.useRootPaddingAwareAlignments; }, [usedLayout?.contentSize, usedLayout?.inherit, usedLayout?.type] ); if (hasGlobalPadding) { layoutClassnames.push("has-global-padding"); } if (usedLayout?.orientation) { layoutClassnames.push(`is-${layout_kebabCase(usedLayout.orientation)}`); } if (usedLayout?.justifyContent) { layoutClassnames.push( `is-content-justification-${layout_kebabCase( usedLayout.justifyContent )}` ); } if (usedLayout?.flexWrap && usedLayout.flexWrap === "nowrap") { layoutClassnames.push("is-nowrap"); } return layoutClassnames; } function useLayoutStyles(blockAttributes = {}, blockName, selector) { const { layout = {}, style = {} } = blockAttributes; const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? { ...layout, type: "constrained" } : layout || {}; const fullLayoutType = getLayoutType(usedLayout?.type || "default"); const [blockGapSupport] = use_settings_useSettings("spacing.blockGap"); const hasBlockGapSupport = blockGapSupport !== null; return fullLayoutType?.getLayoutStyle?.({ blockName, selector, layout, style, hasBlockGapSupport }); } function LayoutPanelPure({ layout, setAttributes, name: blockName, clientId }) { const settings = useBlockSettings(blockName); const { layout: layoutSettings } = settings; const { themeSupportsLayout } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSettings } = select(store); return { themeSupportsLayout: getSettings().supportsLayout }; }, []); const blockEditingMode = useBlockEditingMode(); if (blockEditingMode !== "default") { return null; } const layoutBlockSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)( blockName, layoutBlockSupportKey, {} ); const blockSupportAndThemeSettings = { ...layoutSettings, ...layoutBlockSupport }; const { allowSwitching, allowEditing = true, allowInheriting = true, default: defaultBlockLayout } = blockSupportAndThemeSettings; if (!allowEditing) { return null; } const blockSupportAndLayout = { ...layoutBlockSupport, ...layout }; const { type, default: { type: defaultType = "default" } = {} } = blockSupportAndLayout; const blockLayoutType = type || defaultType; const showInheritToggle = !!(allowInheriting && (!blockLayoutType || blockLayoutType === "default" || blockLayoutType === "constrained" || blockSupportAndLayout.inherit)); const usedLayout = layout || defaultBlockLayout || {}; const { inherit = false, contentSize = null } = usedLayout; if ((blockLayoutType === "default" || blockLayoutType === "constrained") && !themeSupportsLayout) { return null; } const layoutType = getLayoutType(blockLayoutType); const constrainedType = getLayoutType("constrained"); const displayControlsForLegacyLayouts = !usedLayout.type && (contentSize || inherit); const hasContentSizeOrLegacySettings = !!inherit || !!contentSize; const onChangeType = (newType) => setAttributes({ layout: { type: newType } }); const onChangeLayout = (newLayout) => setAttributes({ layout: newLayout }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Layout"), children: [ showInheritToggle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Inner blocks use content width"), checked: layoutType?.name === "constrained" || hasContentSizeOrLegacySettings, onChange: () => setAttributes({ layout: { type: layoutType?.name === "constrained" || hasContentSizeOrLegacySettings ? "default" : "constrained" } }), help: layoutType?.name === "constrained" || hasContentSizeOrLegacySettings ? (0,external_wp_i18n_namespaceObject.__)( "Nested blocks use content width with options for full and wide widths." ) : (0,external_wp_i18n_namespaceObject.__)( "Nested blocks will fill the width of this container." ) } ) }), !inherit && allowSwitching && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( LayoutTypeSwitcher, { type: blockLayoutType, onChange: onChangeType } ), layoutType && layoutType.name !== "default" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( layoutType.inspectorControls, { layout: usedLayout, onChange: onChangeLayout, layoutBlockSupport: blockSupportAndThemeSettings, name: blockName, clientId } ), constrainedType && displayControlsForLegacyLayouts && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( constrainedType.inspectorControls, { layout: usedLayout, onChange: onChangeLayout, layoutBlockSupport: blockSupportAndThemeSettings, name: blockName, clientId } ) ] }) }), !inherit && layoutType && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( layoutType.toolBarControls, { layout: usedLayout, onChange: onChangeLayout, layoutBlockSupport, name: blockName, clientId } ) ] }); } var layout_default = { shareWithChildBlocks: true, edit: LayoutPanelPure, attributeKeys: ["layout"], hasSupport(name) { return hasLayoutBlockSupport(name); } }; function LayoutTypeSwitcher({ type, onChange }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __next40pxDefaultSize: true, isBlock: true, label: (0,external_wp_i18n_namespaceObject.__)("Layout type"), __nextHasNoMarginBottom: true, hideLabelFromVision: true, isAdaptiveWidth: true, value: type, onChange, children: getLayoutTypes().map(({ name, label }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: name, label }, name ); }) } ); } function layout_addAttribute(settings) { if ("type" in (settings.attributes?.layout ?? {})) { return settings; } if (hasLayoutBlockSupport(settings)) { settings.attributes = { ...settings.attributes, layout: { type: "object" } }; } return settings; } function BlockWithLayoutStyles({ block: BlockListBlock, props, blockGapSupport, layoutClasses }) { const { name, attributes } = props; const id = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockListBlock); const { layout } = attributes; const { default: defaultBlockLayout } = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, layoutBlockSupportKey) || {}; const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? { ...layout, type: "constrained" } : layout || defaultBlockLayout || {}; const selectorPrefix = `wp-container-${layout_kebabCase(name)}-is-layout-`; const selector = `.${selectorPrefix}${id}`; const hasBlockGapSupport = blockGapSupport !== null; const fullLayoutType = getLayoutType(usedLayout?.type || "default"); const css = fullLayoutType?.getLayoutStyle?.({ blockName: name, selector, layout: usedLayout, style: attributes?.style, hasBlockGapSupport }); const layoutClassNames = dist_clsx( { [`${selectorPrefix}${id}`]: !!css // Only attach a container class if there is generated CSS to be attached. }, layoutClasses ); useStyleOverride({ css }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockListBlock, { ...props, __unstableLayoutClassNames: layoutClassNames } ); } const withLayoutStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (BlockListBlock) => (props) => { const { clientId, name, attributes } = props; const blockSupportsLayout = hasLayoutBlockSupport(name); const layoutClasses = useLayoutClasses(attributes, name); const extraProps = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (!blockSupportsLayout) { return; } const { getSettings, getBlockSettings } = unlock( select(store) ); const { disableLayoutStyles } = getSettings(); if (disableLayoutStyles) { return; } const [blockGapSupport] = getBlockSettings( clientId, "spacing.blockGap" ); return { blockGapSupport }; }, [blockSupportsLayout, clientId] ); if (!extraProps) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockListBlock, { ...props, __unstableLayoutClassNames: blockSupportsLayout ? layoutClasses : void 0 } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockWithLayoutStyles, { block: BlockListBlock, props, layoutClasses, ...extraProps } ); }, "withLayoutStyles" ); (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/layout/addAttribute", layout_addAttribute ); (0,external_wp_hooks_namespaceObject.addFilter)( "editor.BlockListBlock", "core/editor/layout/with-layout-styles", withLayoutStyles ); ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/utils.js function range(start, length) { return Array.from({ length }, (_, i) => start + i); } class GridRect { constructor({ columnStart, rowStart, columnEnd, rowEnd, columnSpan, rowSpan } = {}) { this.columnStart = columnStart ?? 1; this.rowStart = rowStart ?? 1; if (columnSpan !== void 0) { this.columnEnd = this.columnStart + columnSpan - 1; } else { this.columnEnd = columnEnd ?? this.columnStart; } if (rowSpan !== void 0) { this.rowEnd = this.rowStart + rowSpan - 1; } else { this.rowEnd = rowEnd ?? this.rowStart; } } get columnSpan() { return this.columnEnd - this.columnStart + 1; } get rowSpan() { return this.rowEnd - this.rowStart + 1; } contains(column, row) { return column >= this.columnStart && column <= this.columnEnd && row >= this.rowStart && row <= this.rowEnd; } containsRect(rect) { return this.contains(rect.columnStart, rect.rowStart) && this.contains(rect.columnEnd, rect.rowEnd); } intersectsRect(rect) { return this.columnStart <= rect.columnEnd && this.columnEnd >= rect.columnStart && this.rowStart <= rect.rowEnd && this.rowEnd >= rect.rowStart; } } function utils_getComputedCSS(element, property) { return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property); } function getGridTracks(template, gap) { const tracks = []; for (const size of template.split(" ")) { const previousTrack = tracks[tracks.length - 1]; const start = previousTrack ? previousTrack.end + gap : 0; const end = start + parseFloat(size); tracks.push({ start, end }); } return tracks; } function getClosestTrack(tracks, position, edge = "start") { return tracks.reduce( (closest, track, index) => Math.abs(track[edge] - position) < Math.abs(tracks[closest][edge] - position) ? index : closest, 0 ); } function getGridRect(gridElement, rect) { const columnGap = parseFloat(utils_getComputedCSS(gridElement, "column-gap")); const rowGap = parseFloat(utils_getComputedCSS(gridElement, "row-gap")); const gridColumnTracks = getGridTracks( utils_getComputedCSS(gridElement, "grid-template-columns"), columnGap ); const gridRowTracks = getGridTracks( utils_getComputedCSS(gridElement, "grid-template-rows"), rowGap ); const columnStart = getClosestTrack(gridColumnTracks, rect.left) + 1; const rowStart = getClosestTrack(gridRowTracks, rect.top) + 1; const columnEnd = getClosestTrack(gridColumnTracks, rect.right, "end") + 1; const rowEnd = getClosestTrack(gridRowTracks, rect.bottom, "end") + 1; return new GridRect({ columnStart, columnEnd, rowStart, rowEnd }); } function getGridItemRect(gridItemElement) { return getGridRect( gridItemElement.parentElement, new window.DOMRect( gridItemElement.offsetLeft, gridItemElement.offsetTop, gridItemElement.offsetWidth, gridItemElement.offsetHeight ) ); } function getGridInfo(gridElement) { const gridTemplateColumns = utils_getComputedCSS( gridElement, "grid-template-columns" ); const gridTemplateRows = utils_getComputedCSS( gridElement, "grid-template-rows" ); const borderTopWidth = utils_getComputedCSS(gridElement, "border-top-width"); const borderRightWidth = utils_getComputedCSS( gridElement, "border-right-width" ); const borderBottomWidth = utils_getComputedCSS( gridElement, "border-bottom-width" ); const borderLeftWidth = utils_getComputedCSS(gridElement, "border-left-width"); const paddingTop = utils_getComputedCSS(gridElement, "padding-top"); const paddingRight = utils_getComputedCSS(gridElement, "padding-right"); const paddingBottom = utils_getComputedCSS(gridElement, "padding-bottom"); const paddingLeft = utils_getComputedCSS(gridElement, "padding-left"); const numColumns = gridTemplateColumns.split(" ").length; const numRows = gridTemplateRows.split(" ").length; const numItems = numColumns * numRows; return { numColumns, numRows, numItems, currentColor: utils_getComputedCSS(gridElement, "color"), style: { gridTemplateColumns, gridTemplateRows, gap: utils_getComputedCSS(gridElement, "gap"), inset: ` calc(${paddingTop} + ${borderTopWidth}) calc(${paddingRight} + ${borderRightWidth}) calc(${paddingBottom} + ${borderBottomWidth}) calc(${paddingLeft} + ${borderLeftWidth}) ` } }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/tips.js const globalTips = [ (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.__)( "While writing, you can press <kbd>/</kbd> to quickly insert new blocks." ), { kbd: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) } ), (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.__)( "Indent a list by pressing <kbd>space</kbd> at the beginning of a line." ), { kbd: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) } ), (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.__)( "Outdent a list by pressing <kbd>backspace</kbd> at the beginning of a line." ), { kbd: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) } ), (0,external_wp_i18n_namespaceObject.__)("Drag files into the editor to automatically insert media blocks."), (0,external_wp_i18n_namespaceObject.__)("Change a block's type by pressing the block icon on the toolbar.") ]; function Tips() { const [randomIndex] = (0,external_wp_element_namespaceObject.useState)( // Disable Reason: I'm not generating an HTML id. // eslint-disable-next-line no-restricted-syntax Math.floor(Math.random() * globalTips.length) ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tip, { children: globalTips[randomIndex] }); } var tips_default = Tips; ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right.js var chevron_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left.js var chevron_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-card/index.js const { Badge } = unlock(external_wp_components_namespaceObject.privateApis); function BlockCard({ title, icon, description, blockType, className, name, allowParentNavigation, children }) { if (blockType) { external_wp_deprecated_default()("`blockType` property in `BlockCard component`", { since: "5.7", alternative: "`title, icon and description` properties" }); ({ title, icon, description } = blockType); } const parentNavBlockClientId = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (!allowParentNavigation) { return; } const { getSelectedBlockClientId, getBlockParentsByBlockName } = select(store); const _selectedBlockClientId = getSelectedBlockClientId(); return getBlockParentsByBlockName( _selectedBlockClientId, "core/navigation", true )[0]; }, [allowParentNavigation] ); const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx("block-editor-block-card", className), children: [ allowParentNavigation && parentNavBlockClientId && // This is only used by the Navigation block for now. It's not ideal having Navigation block specific code here. /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { onClick: () => selectBlock(parentNavBlockClientId), label: (0,external_wp_i18n_namespaceObject.__)("Go to parent Navigation block"), style: ( // TODO: This style override is also used in ToolsPanelHeader. // It should be supported out-of-the-box by Button. { minWidth: 24, padding: 0 } ), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, size: "small" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon, showColors: true }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("h2", { className: "block-editor-block-card__title", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-card__name", children: !!name?.length ? name : title }), !!name?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Badge, { children: title }) ] }), description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "block-editor-block-card__description", children: description }), children ] }) ] }); } var block_card_default = BlockCard; ;// ./node_modules/@wordpress/upload-media/build-module/store/types.js var Type = /* @__PURE__ */ ((Type2) => { Type2["Unknown"] = "REDUX_UNKNOWN"; Type2["Add"] = "ADD_ITEM"; Type2["Prepare"] = "PREPARE_ITEM"; Type2["Cancel"] = "CANCEL_ITEM"; Type2["Remove"] = "REMOVE_ITEM"; Type2["PauseItem"] = "PAUSE_ITEM"; Type2["ResumeItem"] = "RESUME_ITEM"; Type2["PauseQueue"] = "PAUSE_QUEUE"; Type2["ResumeQueue"] = "RESUME_QUEUE"; Type2["OperationStart"] = "OPERATION_START"; Type2["OperationFinish"] = "OPERATION_FINISH"; Type2["AddOperations"] = "ADD_OPERATIONS"; Type2["CacheBlobUrl"] = "CACHE_BLOB_URL"; Type2["RevokeBlobUrls"] = "REVOKE_BLOB_URLS"; Type2["UpdateSettings"] = "UPDATE_SETTINGS"; return Type2; })(Type || {}); var ItemStatus = /* @__PURE__ */ ((ItemStatus2) => { ItemStatus2["Processing"] = "PROCESSING"; ItemStatus2["Paused"] = "PAUSED"; return ItemStatus2; })(ItemStatus || {}); var OperationType = /* @__PURE__ */ ((OperationType2) => { OperationType2["Prepare"] = "PREPARE"; OperationType2["Upload"] = "UPLOAD"; return OperationType2; })(OperationType || {}); ;// ./node_modules/@wordpress/upload-media/build-module/store/reducer.js const reducer_noop = () => { }; const DEFAULT_STATE = { queue: [], queueStatus: "active", blobUrls: {}, settings: { mediaUpload: reducer_noop } }; function reducer_reducer(state = DEFAULT_STATE, action = { type: Type.Unknown }) { switch (action.type) { case Type.PauseQueue: { return { ...state, queueStatus: "paused" }; } case Type.ResumeQueue: { return { ...state, queueStatus: "active" }; } case Type.Add: return { ...state, queue: [...state.queue, action.item] }; case Type.Cancel: return { ...state, queue: state.queue.map( (item) => item.id === action.id ? { ...item, error: action.error } : item ) }; case Type.Remove: return { ...state, queue: state.queue.filter((item) => item.id !== action.id) }; case Type.OperationStart: { return { ...state, queue: state.queue.map( (item) => item.id === action.id ? { ...item, currentOperation: action.operation } : item ) }; } case Type.AddOperations: return { ...state, queue: state.queue.map((item) => { if (item.id !== action.id) { return item; } return { ...item, operations: [ ...item.operations || [], ...action.operations ] }; }) }; case Type.OperationFinish: return { ...state, queue: state.queue.map((item) => { if (item.id !== action.id) { return item; } const operations = item.operations ? item.operations.slice(1) : []; const attachment = item.attachment || action.item.attachment ? { ...item.attachment, ...action.item.attachment } : void 0; return { ...item, currentOperation: void 0, operations, ...action.item, attachment, additionalData: { ...item.additionalData, ...action.item.additionalData } }; }) }; case Type.CacheBlobUrl: { const blobUrls = state.blobUrls[action.id] || []; return { ...state, blobUrls: { ...state.blobUrls, [action.id]: [...blobUrls, action.blobUrl] } }; } case Type.RevokeBlobUrls: { const newBlobUrls = { ...state.blobUrls }; delete newBlobUrls[action.id]; return { ...state, blobUrls: newBlobUrls }; } case Type.UpdateSettings: { return { ...state, settings: { ...state.settings, ...action.settings } }; } } return state; } var reducer_reducer_default = reducer_reducer; ;// ./node_modules/@wordpress/upload-media/build-module/store/selectors.js function getItems(state) { return state.queue; } function isUploading(state) { return state.queue.length >= 1; } function isUploadingByUrl(state, url) { return state.queue.some( (item) => item.attachment?.url === url || item.sourceUrl === url ); } function isUploadingById(state, attachmentId) { return state.queue.some( (item) => item.attachment?.id === attachmentId || item.sourceAttachmentId === attachmentId ); } function selectors_getSettings(state) { return state.settings; } ;// ./node_modules/@wordpress/upload-media/build-module/store/private-selectors.js function getAllItems(state) { return state.queue; } function getItem(state, id) { return state.queue.find((item) => item.id === id); } function isBatchUploaded(state, batchId) { const batchItems = state.queue.filter( (item) => batchId === item.batchId ); return batchItems.length === 0; } function isUploadingToPost(state, postOrAttachmentId) { return state.queue.some( (item) => item.currentOperation === OperationType.Upload && item.additionalData.post === postOrAttachmentId ); } function getPausedUploadForPost(state, postOrAttachmentId) { return state.queue.find( (item) => item.status === ItemStatus.Paused && item.additionalData.post === postOrAttachmentId ); } function isPaused(state) { return state.queueStatus === "paused"; } function getBlobUrls(state, id) { return state.blobUrls[id] || []; } ;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/native.js const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); /* harmony default export */ const esm_browser_native = ({ randomUUID }); ;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/rng.js // Unique ID creation requires a high quality random # generator. In the browser we therefore // require the crypto API and do not support built-in fallback to lower quality random number // generators (like Math.random()). let getRandomValues; const rnds8 = new Uint8Array(16); function rng() { // lazy load so that environments that need to polyfill have a chance to do so if (!getRandomValues) { // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); if (!getRandomValues) { throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); } } return getRandomValues(rnds8); } ;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/stringify.js /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ const byteToHex = []; for (let i = 0; i < 256; ++i) { byteToHex.push((i + 0x100).toString(16).slice(1)); } function unsafeStringify(arr, offset = 0) { // Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; } function stringify(arr, offset = 0) { const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one // of the following: // - One or more input array values don't map to a hex octet (leading to // "undefined" in the uuid) // - Invalid input values for the RFC `version` or `variant` fields if (!validate(uuid)) { throw TypeError('Stringified UUID is invalid'); } return uuid; } /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify))); ;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/v4.js function v4(options, buf, offset) { if (esm_browser_native.randomUUID && !buf && !options) { return esm_browser_native.randomUUID(); } options = options || {}; const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = rnds[6] & 0x0f | 0x40; rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided if (buf) { offset = offset || 0; for (let i = 0; i < 16; ++i) { buf[offset + i] = rnds[i]; } return buf; } return unsafeStringify(rnds); } /* harmony default export */ const esm_browser_v4 = (v4); ;// ./node_modules/@wordpress/upload-media/build-module/upload-error.js class UploadError extends Error { code; file; constructor({ code, message, file, cause }) { super(message, { cause }); Object.setPrototypeOf(this, new.target.prototype); this.code = code; this.file = file; } } ;// ./node_modules/@wordpress/upload-media/build-module/validate-mime-type.js function validateMimeType(file, allowedTypes) { if (!allowedTypes) { return; } const isAllowedType = allowedTypes.some((allowedType) => { if (allowedType.includes("/")) { return allowedType === file.type; } return file.type.startsWith(`${allowedType}/`); }); if (file.type && !isAllowedType) { throw new UploadError({ code: "MIME_TYPE_NOT_SUPPORTED", message: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: file name. (0,external_wp_i18n_namespaceObject.__)("%s: Sorry, this file type is not supported here."), file.name ), file }); } } ;// ./node_modules/@wordpress/upload-media/build-module/get-mime-types-array.js function getMimeTypesArray(wpMimeTypesObject) { if (!wpMimeTypesObject) { return null; } return Object.entries(wpMimeTypesObject).flatMap( ([extensionsString, mime]) => { const [type] = mime.split("/"); const extensions = extensionsString.split("|"); return [ mime, ...extensions.map( (extension) => `${type}/${extension}` ) ]; } ); } ;// ./node_modules/@wordpress/upload-media/build-module/validate-mime-type-for-user.js function validateMimeTypeForUser(file, wpAllowedMimeTypes) { const allowedMimeTypesForUser = getMimeTypesArray(wpAllowedMimeTypes); if (!allowedMimeTypesForUser) { return; } const isAllowedMimeTypeForUser = allowedMimeTypesForUser.includes( file.type ); if (file.type && !isAllowedMimeTypeForUser) { throw new UploadError({ code: "MIME_TYPE_NOT_ALLOWED_FOR_USER", message: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: file name. (0,external_wp_i18n_namespaceObject.__)( "%s: Sorry, you are not allowed to upload this file type." ), file.name ), file }); } } ;// ./node_modules/@wordpress/upload-media/build-module/validate-file-size.js function validateFileSize(file, maxUploadFileSize) { if (file.size <= 0) { throw new UploadError({ code: "EMPTY_FILE", message: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: file name. (0,external_wp_i18n_namespaceObject.__)("%s: This file is empty."), file.name ), file }); } if (maxUploadFileSize && file.size > maxUploadFileSize) { throw new UploadError({ code: "SIZE_ABOVE_LIMIT", message: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: file name. (0,external_wp_i18n_namespaceObject.__)( "%s: This file exceeds the maximum upload size for this site." ), file.name ), file }); } } ;// ./node_modules/@wordpress/upload-media/build-module/store/actions.js function addItems({ files, onChange, onSuccess, onError, onBatchSuccess, additionalData, allowedTypes }) { return async ({ select, dispatch }) => { const batchId = esm_browser_v4(); for (const file of files) { try { validateMimeType(file, allowedTypes); validateMimeTypeForUser( file, select.getSettings().allowedMimeTypes ); } catch (error) { onError?.(error); continue; } try { validateFileSize( file, select.getSettings().maxUploadFileSize ); } catch (error) { onError?.(error); continue; } dispatch.addItem({ file, batchId, onChange, onSuccess, onBatchSuccess, onError, additionalData }); } }; } function cancelItem(id, error, silent = false) { return async ({ select, dispatch }) => { const item = select.getItem(id); if (!item) { return; } item.abortController?.abort(); if (!silent) { const { onError } = item; onError?.(error ?? new Error("Upload cancelled")); if (!onError && error) { console.error("Upload cancelled", error); } } dispatch({ type: Type.Cancel, id, error }); dispatch.removeItem(id); dispatch.revokeBlobUrls(id); if (item.batchId && select.isBatchUploaded(item.batchId)) { item.onBatchSuccess?.(); } }; } ;// ./node_modules/@wordpress/upload-media/build-module/utils.js function convertBlobToFile(fileOrBlob) { if (fileOrBlob instanceof File) { return fileOrBlob; } const ext = fileOrBlob.type.split("/")[1]; const mediaType = "application/pdf" === fileOrBlob.type ? "document" : fileOrBlob.type.split("/")[0]; return new File([fileOrBlob], `${mediaType}.${ext}`, { type: fileOrBlob.type }); } function renameFile(file, name) { return new File([file], name, { type: file.type, lastModified: file.lastModified }); } function cloneFile(file) { return renameFile(file, file.name); } function getFileExtension(file) { return file.includes(".") ? file.split(".").pop() || null : null; } function getFileBasename(name) { return name.includes(".") ? name.split(".").slice(0, -1).join(".") : name; } function getFileNameFromUrl(url) { return getFilename(url) || _x("unnamed", "file name"); } ;// ./node_modules/@wordpress/upload-media/build-module/stub-file.js class StubFile extends File { constructor(fileName = "stub-file") { super([], fileName); } } ;// ./node_modules/@wordpress/upload-media/build-module/store/private-actions.js function addItem({ file: fileOrBlob, batchId, onChange, onSuccess, onBatchSuccess, onError, additionalData = {}, sourceUrl, sourceAttachmentId, abortController, operations }) { return async ({ dispatch }) => { const itemId = esm_browser_v4(); const file = convertBlobToFile(fileOrBlob); let blobUrl; if (!(file instanceof StubFile)) { blobUrl = (0,external_wp_blob_namespaceObject.createBlobURL)(file); dispatch({ type: Type.CacheBlobUrl, id: itemId, blobUrl }); } dispatch({ type: Type.Add, item: { id: itemId, batchId, status: ItemStatus.Processing, sourceFile: cloneFile(file), file, attachment: { url: blobUrl }, additionalData: { convert_format: false, ...additionalData }, onChange, onSuccess, onBatchSuccess, onError, sourceUrl, sourceAttachmentId, abortController: abortController || new AbortController(), operations: Array.isArray(operations) ? operations : [OperationType.Prepare] } }); dispatch.processItem(itemId); }; } function processItem(id) { return async ({ select, dispatch }) => { if (select.isPaused()) { return; } const item = select.getItem(id); const { attachment, onChange, onSuccess, onBatchSuccess, batchId } = item; const operation = Array.isArray(item.operations?.[0]) ? item.operations[0][0] : item.operations?.[0]; if (attachment) { onChange?.([attachment]); } if (!operation) { if (attachment) { onSuccess?.([attachment]); } dispatch.revokeBlobUrls(id); if (batchId && select.isBatchUploaded(batchId)) { onBatchSuccess?.(); } return; } if (!operation) { return; } dispatch({ type: Type.OperationStart, id, operation }); switch (operation) { case OperationType.Prepare: dispatch.prepareItem(item.id); break; case OperationType.Upload: dispatch.uploadItem(id); break; } }; } function pauseQueue() { return { type: Type.PauseQueue }; } function resumeQueue() { return async ({ select, dispatch }) => { dispatch({ type: Type.ResumeQueue }); for (const item of select.getAllItems()) { dispatch.processItem(item.id); } }; } function removeItem(id) { return async ({ select, dispatch }) => { const item = select.getItem(id); if (!item) { return; } dispatch({ type: Type.Remove, id }); }; } function finishOperation(id, updates) { return async ({ dispatch }) => { dispatch({ type: Type.OperationFinish, id, item: updates }); dispatch.processItem(id); }; } function prepareItem(id) { return async ({ dispatch }) => { const operations = [OperationType.Upload]; dispatch({ type: Type.AddOperations, id, operations }); dispatch.finishOperation(id, {}); }; } function uploadItem(id) { return async ({ select, dispatch }) => { const item = select.getItem(id); select.getSettings().mediaUpload({ filesList: [item.file], additionalData: item.additionalData, signal: item.abortController?.signal, onFileChange: ([attachment]) => { if (!(0,external_wp_blob_namespaceObject.isBlobURL)(attachment.url)) { dispatch.finishOperation(id, { attachment }); } }, onSuccess: ([attachment]) => { dispatch.finishOperation(id, { attachment }); }, onError: (error) => { dispatch.cancelItem(id, error); } }); }; } function revokeBlobUrls(id) { return async ({ select, dispatch }) => { const blobUrls = select.getBlobUrls(id); for (const blobUrl of blobUrls) { (0,external_wp_blob_namespaceObject.revokeBlobURL)(blobUrl); } dispatch({ type: Type.RevokeBlobUrls, id }); }; } function private_actions_updateSettings(settings) { return { type: Type.UpdateSettings, settings }; } ;// ./node_modules/@wordpress/upload-media/build-module/lock-unlock.js const { lock: lock_unlock_lock, unlock: lock_unlock_unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/upload-media" ); ;// ./node_modules/@wordpress/upload-media/build-module/store/constants.js const constants_STORE_NAME = "core/upload-media"; ;// ./node_modules/@wordpress/upload-media/build-module/store/index.js const store_storeConfig = { reducer: reducer_reducer_default, selectors: store_selectors_namespaceObject, actions: store_actions_namespaceObject }; const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { reducer: reducer_reducer_default, selectors: store_selectors_namespaceObject, actions: store_actions_namespaceObject }); (0,external_wp_data_namespaceObject.register)(store_store); lock_unlock_unlock(store_store).registerPrivateActions(store_private_actions_namespaceObject); lock_unlock_unlock(store_store).registerPrivateSelectors(store_private_selectors_namespaceObject); ;// ./node_modules/@wordpress/upload-media/build-module/components/provider/with-registry-provider.js function getSubRegistry(subRegistries, registry, useSubRegistry) { if (!useSubRegistry) { return registry; } let subRegistry = subRegistries.get(registry); if (!subRegistry) { subRegistry = (0,external_wp_data_namespaceObject.createRegistry)({}, registry); subRegistry.registerStore(constants_STORE_NAME, store_storeConfig); subRegistries.set(registry, subRegistry); } return subRegistry; } const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (WrappedComponent) => ({ useSubRegistry = true, ...props }) => { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => /* @__PURE__ */ new WeakMap()); const subRegistry = getSubRegistry( subRegistries, registry, useSubRegistry ); if (subRegistry === registry) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry, ...props }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.RegistryProvider, { value: subRegistry, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry: subRegistry, ...props }) }); }, "withRegistryProvider" ); var with_registry_provider_default = withRegistryProvider; ;// ./node_modules/@wordpress/upload-media/build-module/components/provider/index.js const MediaUploadProvider = with_registry_provider_default((props) => { const { children, settings } = props; const { updateSettings } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); (0,external_wp_element_namespaceObject.useEffect)(() => { updateSettings(settings); }, [settings, updateSettings]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children }); }); var provider_default = MediaUploadProvider; ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/with-registry-provider.js function with_registry_provider_getSubRegistry(subRegistries, registry, useSubRegistry) { if (!useSubRegistry) { return registry; } let subRegistry = subRegistries.get(registry); if (!subRegistry) { subRegistry = (0,external_wp_data_namespaceObject.createRegistry)({}, registry); subRegistry.registerStore(STORE_NAME, storeConfig); subRegistries.set(registry, subRegistry); } return subRegistry; } const with_registry_provider_withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (WrappedComponent) => ({ useSubRegistry = true, ...props }) => { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => /* @__PURE__ */ new WeakMap()); const subRegistry = with_registry_provider_getSubRegistry( subRegistries, registry, useSubRegistry ); if (subRegistry === registry) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry, ...props }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.RegistryProvider, { value: subRegistry, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry: subRegistry, ...props }) }); }, "withRegistryProvider" ); var with_registry_provider_with_registry_provider_default = with_registry_provider_withRegistryProvider; ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/use-block-sync.js const use_block_sync_noop = () => { }; function useBlockSync({ clientId = null, value: controlledBlocks, selection: controlledSelection, onChange = use_block_sync_noop, onInput = use_block_sync_noop }) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { resetBlocks, resetSelection, replaceInnerBlocks, setHasControlledInnerBlocks, __unstableMarkNextChangeAsNotPersistent } = registry.dispatch(store); const { getBlockName, getBlocks, getSelectionStart, getSelectionEnd } = registry.select(store); const isControlled = (0,external_wp_data_namespaceObject.useSelect)( (select) => { return !clientId || select(store).areInnerBlocksControlled(clientId); }, [clientId] ); const pendingChangesRef = (0,external_wp_element_namespaceObject.useRef)({ incoming: null, outgoing: [] }); const subscribedRef = (0,external_wp_element_namespaceObject.useRef)(false); const setControlledBlocks = () => { if (!controlledBlocks) { return; } __unstableMarkNextChangeAsNotPersistent(); if (clientId) { registry.batch(() => { setHasControlledInnerBlocks(clientId, true); const storeBlocks = controlledBlocks.map( (block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block) ); if (subscribedRef.current) { pendingChangesRef.current.incoming = storeBlocks; } __unstableMarkNextChangeAsNotPersistent(); replaceInnerBlocks(clientId, storeBlocks); }); } else { if (subscribedRef.current) { pendingChangesRef.current.incoming = controlledBlocks; } resetBlocks(controlledBlocks); } }; const unsetControlledBlocks = () => { __unstableMarkNextChangeAsNotPersistent(); if (clientId) { setHasControlledInnerBlocks(clientId, false); __unstableMarkNextChangeAsNotPersistent(); replaceInnerBlocks(clientId, []); } else { resetBlocks([]); } }; const onInputRef = (0,external_wp_element_namespaceObject.useRef)(onInput); const onChangeRef = (0,external_wp_element_namespaceObject.useRef)(onChange); (0,external_wp_element_namespaceObject.useEffect)(() => { onInputRef.current = onInput; onChangeRef.current = onChange; }, [onInput, onChange]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (pendingChangesRef.current.outgoing.includes(controlledBlocks)) { if (pendingChangesRef.current.outgoing[pendingChangesRef.current.outgoing.length - 1] === controlledBlocks) { pendingChangesRef.current.outgoing = []; } } else if (getBlocks(clientId) !== controlledBlocks) { pendingChangesRef.current.outgoing = []; setControlledBlocks(); if (controlledSelection) { resetSelection( controlledSelection.selectionStart, controlledSelection.selectionEnd, controlledSelection.initialPosition ); } } }, [controlledBlocks, clientId]); const isMountedRef = (0,external_wp_element_namespaceObject.useRef)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isMountedRef.current) { isMountedRef.current = true; return; } if (!isControlled) { pendingChangesRef.current.outgoing = []; setControlledBlocks(); } }, [isControlled]); (0,external_wp_element_namespaceObject.useEffect)(() => { const { getSelectedBlocksInitialCaretPosition, isLastBlockChangePersistent, __unstableIsLastBlockChangeIgnored, areInnerBlocksControlled } = registry.select(store); let blocks = getBlocks(clientId); let isPersistent = isLastBlockChangePersistent(); let previousAreBlocksDifferent = false; subscribedRef.current = true; const unsubscribe = registry.subscribe(() => { if (clientId !== null && getBlockName(clientId) === null) { return; } const isStillControlled = !clientId || areInnerBlocksControlled(clientId); if (!isStillControlled) { return; } const newIsPersistent = isLastBlockChangePersistent(); const newBlocks = getBlocks(clientId); const areBlocksDifferent = newBlocks !== blocks; blocks = newBlocks; if (areBlocksDifferent && (pendingChangesRef.current.incoming || __unstableIsLastBlockChangeIgnored())) { pendingChangesRef.current.incoming = null; isPersistent = newIsPersistent; return; } const didPersistenceChange = previousAreBlocksDifferent && !areBlocksDifferent && newIsPersistent && !isPersistent; if (areBlocksDifferent || didPersistenceChange) { isPersistent = newIsPersistent; pendingChangesRef.current.outgoing.push(blocks); const updateParent = isPersistent ? onChangeRef.current : onInputRef.current; updateParent(blocks, { selection: { selectionStart: getSelectionStart(), selectionEnd: getSelectionEnd(), initialPosition: getSelectedBlocksInitialCaretPosition() } }); } previousAreBlocksDifferent = areBlocksDifferent; }, store); return () => { subscribedRef.current = false; unsubscribe(); }; }, [registry, clientId]); (0,external_wp_element_namespaceObject.useEffect)(() => { return () => { unsetControlledBlocks(); }; }, []); } ;// external ["wp","keyboardShortcuts"] const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; ;// ./node_modules/@wordpress/block-editor/build-module/components/keyboard-shortcuts/index.js function KeyboardShortcuts() { return null; } function KeyboardShortcutsRegister() { const { registerShortcut } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { registerShortcut({ name: "core/block-editor/copy", category: "block", description: (0,external_wp_i18n_namespaceObject.__)("Copy the selected block(s)."), keyCombination: { modifier: "primary", character: "c" } }); registerShortcut({ name: "core/block-editor/cut", category: "block", description: (0,external_wp_i18n_namespaceObject.__)("Cut the selected block(s)."), keyCombination: { modifier: "primary", character: "x" } }); registerShortcut({ name: "core/block-editor/paste", category: "block", description: (0,external_wp_i18n_namespaceObject.__)("Paste the selected block(s)."), keyCombination: { modifier: "primary", character: "v" } }); registerShortcut({ name: "core/block-editor/duplicate", category: "block", description: (0,external_wp_i18n_namespaceObject.__)("Duplicate the selected block(s)."), keyCombination: { modifier: "primaryShift", character: "d" } }); registerShortcut({ name: "core/block-editor/remove", category: "block", description: (0,external_wp_i18n_namespaceObject.__)("Remove the selected block(s)."), keyCombination: { modifier: "access", character: "z" } }); registerShortcut({ name: "core/block-editor/paste-styles", category: "block", description: (0,external_wp_i18n_namespaceObject.__)( "Paste the copied style to the selected block(s)." ), keyCombination: { modifier: "primaryAlt", character: "v" } }); registerShortcut({ name: "core/block-editor/insert-before", category: "block", description: (0,external_wp_i18n_namespaceObject.__)( "Insert a new block before the selected block(s)." ), keyCombination: { modifier: "primaryAlt", character: "t" } }); registerShortcut({ name: "core/block-editor/insert-after", category: "block", description: (0,external_wp_i18n_namespaceObject.__)( "Insert a new block after the selected block(s)." ), keyCombination: { modifier: "primaryAlt", character: "y" } }); registerShortcut({ name: "core/block-editor/delete-multi-selection", category: "block", description: (0,external_wp_i18n_namespaceObject.__)("Delete selection."), keyCombination: { character: "del" }, aliases: [ { character: "backspace" } ] }); registerShortcut({ name: "core/block-editor/select-all", category: "selection", description: (0,external_wp_i18n_namespaceObject.__)( "Select all text when typing. Press again to select all blocks." ), keyCombination: { modifier: "primary", character: "a" } }); registerShortcut({ name: "core/block-editor/unselect", category: "selection", description: (0,external_wp_i18n_namespaceObject.__)("Clear selection."), keyCombination: { character: "escape" } }); registerShortcut({ name: "core/block-editor/multi-text-selection", category: "selection", description: (0,external_wp_i18n_namespaceObject.__)("Select text across multiple blocks."), keyCombination: { modifier: "shift", character: "arrow" } }); registerShortcut({ name: "core/block-editor/focus-toolbar", category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Navigate to the nearest toolbar."), keyCombination: { modifier: "alt", character: "F10" } }); registerShortcut({ name: "core/block-editor/move-up", category: "block", description: (0,external_wp_i18n_namespaceObject.__)("Move the selected block(s) up."), keyCombination: { modifier: "secondary", character: "t" } }); registerShortcut({ name: "core/block-editor/move-down", category: "block", description: (0,external_wp_i18n_namespaceObject.__)("Move the selected block(s) down."), keyCombination: { modifier: "secondary", character: "y" } }); registerShortcut({ name: "core/block-editor/collapse-list-view", category: "list-view", description: (0,external_wp_i18n_namespaceObject.__)("Collapse all other items."), keyCombination: { modifier: "alt", character: "l" } }); registerShortcut({ name: "core/block-editor/group", category: "block", description: (0,external_wp_i18n_namespaceObject.__)( "Create a group block from the selected multiple blocks." ), keyCombination: { modifier: "primary", character: "g" } }); registerShortcut({ name: "core/block-editor/toggle-block-visibility", category: "block", description: (0,external_wp_i18n_namespaceObject.__)("Show or hide the selected block(s)."), keyCombination: { modifier: "primaryShift", character: "h" } }); }, [registerShortcut]); return null; } KeyboardShortcuts.Register = KeyboardShortcutsRegister; var keyboard_shortcuts_default = KeyboardShortcuts; ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/use-media-upload-settings.js function useMediaUploadSettings(settings = {}) { return (0,external_wp_element_namespaceObject.useMemo)( () => ({ mediaUpload: settings.mediaUpload, mediaSideload: settings.mediaSideload, maxUploadFileSize: settings.maxUploadFileSize, allowedMimeTypes: settings.allowedMimeTypes }), [settings] ); } var use_media_upload_settings_default = useMediaUploadSettings; ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/index.js const provider_noop = () => { }; function mediaUpload(registry, { allowedTypes, additionalData = {}, filesList, onError = provider_noop, onFileChange, onSuccess, onBatchSuccess }) { void registry.dispatch(store_store).addItems({ files: filesList, onChange: onFileChange, onSuccess, onBatchSuccess, onError: ({ message }) => onError(message), additionalData, allowedTypes }); } const ExperimentalBlockEditorProvider = with_registry_provider_with_registry_provider_default( (props) => { const { settings: _settings, registry, stripExperimentalSettings = false } = props; const mediaUploadSettings = use_media_upload_settings_default(_settings); let settings = _settings; if (window.__experimentalMediaProcessing && _settings.mediaUpload) { settings = (0,external_wp_element_namespaceObject.useMemo)( () => ({ ..._settings, mediaUpload: mediaUpload.bind(null, registry) }), [_settings, registry] ); } const { __experimentalUpdateSettings } = unlock( (0,external_wp_data_namespaceObject.useDispatch)(store) ); (0,external_wp_element_namespaceObject.useEffect)(() => { __experimentalUpdateSettings( { ...settings, __internalIsInitialized: true }, { stripExperimentalSettings, reset: true } ); }, [ settings, stripExperimentalSettings, __experimentalUpdateSettings ]); useBlockSync(props); const children = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SlotFillProvider, { passthrough: true, children: [ !settings?.isPreviewMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcuts_default.Register, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRefsProvider, { children: props.children }) ] }); if (window.__experimentalMediaProcessing) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( provider_default, { settings: mediaUploadSettings, useSubRegistry: false, children } ); } return children; } ); const BlockEditorProvider = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { ...props, stripExperimentalSettings: true, children: props.children }); }; var provider_provider_default = BlockEditorProvider; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-context/index.js const block_context_Context = (0,external_wp_element_namespaceObject.createContext)({}); block_context_Context.displayName = "BlockContext"; function BlockContextProvider({ value, children }) { const context = (0,external_wp_element_namespaceObject.useContext)(block_context_Context); const nextValue = (0,external_wp_element_namespaceObject.useMemo)( () => ({ ...context, ...value }), [context, value] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_context_Context.Provider, { value: nextValue, children }); } var block_context_default = block_context_Context; ;// ./node_modules/@wordpress/block-editor/build-module/utils/block-bindings.js const DEFAULT_ATTRIBUTE = "__default"; const PATTERN_OVERRIDES_SOURCE = "core/pattern-overrides"; function isObjectEmpty(object) { return !object || Object.keys(object).length === 0; } function hasPatternOverridesDefaultBinding(bindings) { return bindings?.[DEFAULT_ATTRIBUTE]?.source === PATTERN_OVERRIDES_SOURCE; } function replacePatternOverridesDefaultBinding(bindings, supportedAttributes) { if (hasPatternOverridesDefaultBinding(bindings)) { const bindingsWithDefaults = {}; for (const attributeName of supportedAttributes) { const bindingSource = bindings[attributeName] ? bindings[attributeName] : { source: PATTERN_OVERRIDES_SOURCE }; bindingsWithDefaults[attributeName] = bindingSource; } return bindingsWithDefaults; } return bindings; } function useBlockBindingsUtils(clientId) { const { clientId: contextClientId } = useBlockEditContext(); const blockClientId = clientId || contextClientId; const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { getBlockAttributes } = (0,external_wp_data_namespaceObject.useRegistry)().select(store); const updateBlockBindings = (bindings) => { const { metadata: { bindings: currentBindings, ...metadata } = {} } = getBlockAttributes(blockClientId); const newBindings = { ...currentBindings }; Object.entries(bindings).forEach(([attribute, binding]) => { if (!binding && newBindings[attribute]) { delete newBindings[attribute]; return; } newBindings[attribute] = binding; }); const newMetadata = { ...metadata, bindings: newBindings }; if (isObjectEmpty(newMetadata.bindings)) { delete newMetadata.bindings; } updateBlockAttributes(blockClientId, { metadata: isObjectEmpty(newMetadata) ? void 0 : newMetadata }); }; const removeAllBlockBindings = () => { const { metadata: { bindings, ...metadata } = {} } = getBlockAttributes(blockClientId); updateBlockAttributes(blockClientId, { metadata: isObjectEmpty(metadata) ? void 0 : metadata }); }; return { updateBlockBindings, removeAllBlockBindings }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/private-block-context.js const PrivateBlockContext = (0,external_wp_element_namespaceObject.createContext)({}); PrivateBlockContext.displayName = "PrivateBlockContext"; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/edit.js const DEFAULT_BLOCK_CONTEXT = {}; const Edit = (props) => { const { name } = props; const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); if (!blockType) { return null; } const Component = blockType.edit || blockType.save; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...props }); }; const EditWithFilters = (0,external_wp_components_namespaceObject.withFilters)("editor.BlockEdit")(Edit); const EditWithGeneratedProps = (props) => { const { name, clientId, attributes, setAttributes } = props; const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default); const registeredSources = (0,external_wp_data_namespaceObject.useSelect)( (select) => unlock(select(external_wp_blocks_namespaceObject.store)).getAllBlockBindingsSources(), [] ); const { bindableAttributes } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext); const { blockBindings, context, hasPatternOverrides } = (0,external_wp_element_namespaceObject.useMemo)(() => { const computedContext = blockType?.usesContext ? Object.fromEntries( Object.entries(blockContext).filter( ([key]) => blockType.usesContext.includes(key) ) ) : DEFAULT_BLOCK_CONTEXT; if (attributes?.metadata?.bindings) { Object.values(attributes?.metadata?.bindings || {}).forEach( (binding) => { registeredSources[binding?.source]?.usesContext?.forEach( (key) => { computedContext[key] = blockContext[key]; } ); } ); } return { blockBindings: replacePatternOverridesDefaultBinding( attributes?.metadata?.bindings, bindableAttributes ), context: computedContext, hasPatternOverrides: hasPatternOverridesDefaultBinding( attributes?.metadata?.bindings ) }; }, [ name, blockType?.usesContext, blockContext, attributes?.metadata?.bindings, registeredSources ]); const computedAttributes = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (!blockBindings) { return attributes; } const attributesFromSources = {}; const blockBindingsBySource = /* @__PURE__ */ new Map(); for (const [attributeName, binding] of Object.entries( blockBindings )) { const { source: sourceName, args: sourceArgs } = binding; const source = registeredSources[sourceName]; if (!source || !bindableAttributes?.includes(attributeName)) { continue; } blockBindingsBySource.set(source, { ...blockBindingsBySource.get(source), [attributeName]: { args: sourceArgs } }); } if (blockBindingsBySource.size) { for (const [source, bindings] of blockBindingsBySource) { let values = {}; if (!source.getValues) { Object.keys(bindings).forEach((attr) => { values[attr] = source.label; }); } else { values = source.getValues({ select, context, clientId, bindings }); } for (const [attributeName, value] of Object.entries( values )) { if (attributeName === "url" && (!value || !isURLLike(value))) { attributesFromSources[attributeName] = null; } else { attributesFromSources[attributeName] = value; } } } } return { ...attributes, ...attributesFromSources }; }, [ attributes, bindableAttributes, blockBindings, clientId, context, name, registeredSources ] ); const setBoundAttributes = (0,external_wp_element_namespaceObject.useCallback)( (nextAttributes) => { if (!blockBindings) { setAttributes(nextAttributes); return; } registry.batch(() => { const keptAttributes = { ...nextAttributes }; const blockBindingsBySource = /* @__PURE__ */ new Map(); for (const [attributeName, newValue] of Object.entries( keptAttributes )) { if (!blockBindings[attributeName] || !bindableAttributes?.includes(attributeName)) { continue; } const binding = blockBindings[attributeName]; const source = registeredSources[binding?.source]; if (!source?.setValues) { continue; } blockBindingsBySource.set(source, { ...blockBindingsBySource.get(source), [attributeName]: { args: binding.args, newValue } }); delete keptAttributes[attributeName]; } if (blockBindingsBySource.size) { for (const [ source, bindings ] of blockBindingsBySource) { source.setValues({ select: registry.select, dispatch: registry.dispatch, context, clientId, bindings }); } } const hasParentPattern = !!context["pattern/overrides"]; if ( // Don't update non-connected attributes if the block is using pattern overrides // and the editing is happening while overriding the pattern (not editing the original). !(hasPatternOverrides && hasParentPattern) && Object.keys(keptAttributes).length ) { if (hasPatternOverrides) { delete keptAttributes.caption; delete keptAttributes.href; } setAttributes(keptAttributes); } }); }, [ bindableAttributes, blockBindings, clientId, context, hasPatternOverrides, setAttributes, registeredSources, name, registry ] ); if (!blockType) { return null; } if (blockType.apiVersion > 1) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EditWithFilters, { ...props, attributes: computedAttributes, context, setAttributes: setBoundAttributes } ); } const generatedClassName = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "className", true) ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(name) : null; const className = dist_clsx( generatedClassName, attributes?.className, props.className ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EditWithFilters, { ...props, attributes: computedAttributes, className, context, setAttributes: setBoundAttributes } ); }; var edit_default = EditWithGeneratedProps; ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js var more_vertical_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/warning/index.js function Warning({ className, actions, children, secondaryActions }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { display: "contents", all: "initial" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx(className, "block-editor-warning"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-warning__contents", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-warning__message", children }), (actions?.length > 0 || secondaryActions) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-warning__actions", children: [ actions?.length > 0 && actions.map((action, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { className: "block-editor-warning__action", children: action }, i )), secondaryActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { className: "block-editor-warning__secondary", icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("More options"), popoverProps: { placement: "bottom-end", className: "block-editor-warning__dropdown" }, noIcons: true, children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: secondaryActions.map( (item, pos) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: item.onClick, children: item.title }, pos ) ) }) } ) ] }) ] }) }) }); } var warning_default = Warning; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/multiple-usage-warning.js function MultipleUsageWarning({ originalBlockClientId, name, onReplace }) { const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( warning_default, { actions: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", onClick: () => selectBlock(originalBlockClientId), children: (0,external_wp_i18n_namespaceObject.__)("Find original") }, "find-original" ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", onClick: () => onReplace([]), children: (0,external_wp_i18n_namespaceObject.__)("Remove") }, "remove" ) ], children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("strong", { children: [ blockType?.title, ": " ] }), (0,external_wp_i18n_namespaceObject.__)("This block can only be used once.") ] } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/index.js function BlockEdit({ mayDisplayControls, mayDisplayParentControls, blockEditingMode, isPreviewMode, // The remaining props are passed through the BlockEdit filters and are thus // public API! ...props }) { const { name, isSelected, clientId, attributes = {}, __unstableLayoutClassNames } = props; const { layout = null, metadata = {} } = attributes; const { bindings } = metadata; const layoutSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "layout", false) || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "__experimentalLayout", false); const { originalBlockClientId } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( Provider, { value: (0,external_wp_element_namespaceObject.useMemo)( () => ({ name, isSelected, clientId, layout: layoutSupport ? layout : null, __unstableLayoutClassNames, // We use symbols in favour of an __unstable prefix to avoid // usage outside of the package (this context is exposed). [mayDisplayControlsKey]: mayDisplayControls, [mayDisplayParentControlsKey]: mayDisplayParentControls, [blockEditingModeKey]: blockEditingMode, [blockBindingsKey]: bindings, [isPreviewModeKey]: isPreviewMode }), [ name, isSelected, clientId, layoutSupport, layout, __unstableLayoutClassNames, mayDisplayControls, mayDisplayParentControls, blockEditingMode, bindings, isPreviewMode ] ), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(edit_default, { ...props }), originalBlockClientId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( MultipleUsageWarning, { originalBlockClientId, name, onReplace: props.onReplace } ) ] } ); } // EXTERNAL MODULE: ./node_modules/diff/lib/diff/character.js var character = __webpack_require__(8021); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-compare/block-view.js function BlockView({ title, rawContent, renderedContent, action, actionText, className }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-compare__content", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "block-editor-block-compare__heading", children: title }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-compare__html", children: rawContent }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-compare__preview edit-post-visual-editor", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: (0,external_wp_dom_namespaceObject.safeHTML)(renderedContent) }) }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-compare__action", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", tabIndex: "0", onClick: action, children: actionText } ) }) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-compare/index.js function BlockCompare({ block, onKeep, onConvert, convertor, convertButtonText }) { function getDifference(originalContent, newContent) { const difference2 = (0,character/* diffChars */.JJ)(originalContent, newContent); return difference2.map((item, pos) => { const classes = dist_clsx({ "block-editor-block-compare__added": item.added, "block-editor-block-compare__removed": item.removed }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: classes, children: item.value }, pos); }); } function getConvertedContent(convertedBlock) { const newBlocks = Array.isArray(convertedBlock) ? convertedBlock : [convertedBlock]; const newContent = newBlocks.map( (item) => (0,external_wp_blocks_namespaceObject.getSaveContent)(item.name, item.attributes, item.innerBlocks) ); return newContent.join(""); } const converted = getConvertedContent(convertor(block)); const difference = getDifference(block.originalContent, converted); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-compare__wrapper", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockView, { title: (0,external_wp_i18n_namespaceObject.__)("Current"), className: "block-editor-block-compare__current", action: onKeep, actionText: (0,external_wp_i18n_namespaceObject.__)("Convert to HTML"), rawContent: block.originalContent, renderedContent: block.originalContent } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockView, { title: (0,external_wp_i18n_namespaceObject.__)("After Conversion"), className: "block-editor-block-compare__converted", action: onConvert, actionText: convertButtonText, rawContent: difference, renderedContent: converted } ) ] }); } var block_compare_default = BlockCompare; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-invalid-warning.js const blockToBlocks = (block) => (0,external_wp_blocks_namespaceObject.rawHandler)({ HTML: block.originalContent }); function BlockInvalidWarning({ clientId }) { const { block, canInsertHTMLBlock, canInsertClassicBlock } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { canInsertBlockType, getBlock, getBlockRootClientId } = select(store); const rootClientId = getBlockRootClientId(clientId); return { block: getBlock(clientId), canInsertHTMLBlock: canInsertBlockType( "core/html", rootClientId ), canInsertClassicBlock: canInsertBlockType( "core/freeform", rootClientId ) }; }, [clientId] ); const { replaceBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const [compare, setCompare] = (0,external_wp_element_namespaceObject.useState)(false); const onCompareClose = (0,external_wp_element_namespaceObject.useCallback)(() => setCompare(false), []); const convert = (0,external_wp_element_namespaceObject.useMemo)( () => ({ toClassic() { const classicBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/freeform", { content: block.originalContent }); return replaceBlock(block.clientId, classicBlock); }, toHTML() { const htmlBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/html", { content: block.originalContent }); return replaceBlock(block.clientId, htmlBlock); }, toBlocks() { const newBlocks = blockToBlocks(block); return replaceBlock(block.clientId, newBlocks); }, toRecoveredBlock() { const recoveredBlock = (0,external_wp_blocks_namespaceObject.createBlock)( block.name, block.attributes, block.innerBlocks ); return replaceBlock(block.clientId, recoveredBlock); } }), [block, replaceBlock] ); const secondaryActions = (0,external_wp_element_namespaceObject.useMemo)( () => [ { // translators: Button to fix block content title: (0,external_wp_i18n_namespaceObject._x)("Resolve", "imperative verb"), onClick: () => setCompare(true) }, canInsertHTMLBlock && { title: (0,external_wp_i18n_namespaceObject.__)("Convert to HTML"), onClick: convert.toHTML }, canInsertClassicBlock && { title: (0,external_wp_i18n_namespaceObject.__)("Convert to Classic Block"), onClick: convert.toClassic } ].filter(Boolean), [canInsertHTMLBlock, canInsertClassicBlock, convert] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( warning_default, { actions: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, onClick: convert.toRecoveredBlock, variant: "primary", children: (0,external_wp_i18n_namespaceObject.__)("Attempt recovery") }, "recover" ) ], secondaryActions, children: (0,external_wp_i18n_namespaceObject.__)("Block contains unexpected or invalid content.") } ), compare && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: ( // translators: Dialog title to fix block content (0,external_wp_i18n_namespaceObject.__)("Resolve Block") ), onRequestClose: onCompareClose, className: "block-editor-block-compare", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_compare_default, { block, onKeep: convert.toHTML, onConvert: convert.toBlocks, convertor: blockToBlocks, convertButtonText: (0,external_wp_i18n_namespaceObject.__)("Convert to Blocks") } ) } ) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-warning.js const warning = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(warning_default, { className: "block-editor-block-list__block-crash-warning", children: (0,external_wp_i18n_namespaceObject.__)("This block has encountered an error and cannot be previewed.") }); var block_crash_warning_default = () => warning; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-boundary.js class BlockCrashBoundary extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); this.state = { hasError: false }; } componentDidCatch() { this.setState({ hasError: true }); } render() { if (this.state.hasError) { return this.props.fallback; } return this.props.children; } } var block_crash_boundary_default = BlockCrashBoundary; // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js var lib = __webpack_require__(4132); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-html.js function BlockHTML({ clientId }) { const [html, setHtml] = (0,external_wp_element_namespaceObject.useState)(""); const block = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).getBlock(clientId), [clientId] ); const { updateBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const onChange = () => { const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name); if (!blockType) { return; } const attributes = (0,external_wp_blocks_namespaceObject.getBlockAttributes)( blockType, html, block.attributes ); const content = html ? html : (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes); const [isValid] = html ? (0,external_wp_blocks_namespaceObject.validateBlock)({ ...block, attributes, originalContent: content }) : [true]; updateBlock(clientId, { attributes, originalContent: content, isValid }); if (!html) { setHtml(content); } }; (0,external_wp_element_namespaceObject.useEffect)(() => { setHtml((0,external_wp_blocks_namespaceObject.getBlockContent)(block)); }, [block]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( lib/* default */.A, { className: "block-editor-block-list__block-html-textarea", value: html, onBlur: onChange, onChange: (event) => setHtml(event.target.value) } ); } var block_html_default = BlockHTML; ;// ./node_modules/@react-spring/rafz/dist/esm/index.js var esm_f=esm_l(),esm_n=e=>esm_c(e,esm_f),esm_m=esm_l();esm_n.write=e=>esm_c(e,esm_m);var esm_d=esm_l();esm_n.onStart=e=>esm_c(e,esm_d);var esm_h=esm_l();esm_n.onFrame=e=>esm_c(e,esm_h);var esm_p=esm_l();esm_n.onFinish=e=>esm_c(e,esm_p);var esm_i=[];esm_n.setTimeout=(e,t)=>{let a=esm_n.now()+t,o=()=>{let F=esm_i.findIndex(z=>z.cancel==o);~F&&esm_i.splice(F,1),esm_u-=~F?1:0},s={time:a,handler:e,cancel:o};return esm_i.splice(esm_w(a),0,s),esm_u+=1,esm_v(),s};var esm_w=e=>~(~esm_i.findIndex(t=>t.time>e)||~esm_i.length);esm_n.cancel=e=>{esm_d.delete(e),esm_h.delete(e),esm_p.delete(e),esm_f.delete(e),esm_m.delete(e)};esm_n.sync=e=>{T=!0,esm_n.batchedUpdates(e),T=!1};esm_n.throttle=e=>{let t;function a(){try{e(...t)}finally{t=null}}function o(...s){t=s,esm_n.onStart(a)}return o.handler=e,o.cancel=()=>{esm_d.delete(a),t=null},o};var esm_y=typeof window<"u"?window.requestAnimationFrame:()=>{};esm_n.use=e=>esm_y=e;esm_n.now=typeof performance<"u"?()=>performance.now():Date.now;esm_n.batchedUpdates=e=>e();esm_n.catch=console.error;esm_n.frameLoop="always";esm_n.advance=()=>{esm_n.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):esm_x()};var esm_r=-1,esm_u=0,T=!1;function esm_c(e,t){T?(t.delete(e),e(0)):(t.add(e),esm_v())}function esm_v(){esm_r<0&&(esm_r=0,esm_n.frameLoop!=="demand"&&esm_y(esm_b))}function esm_R(){esm_r=-1}function esm_b(){~esm_r&&(esm_y(esm_b),esm_n.batchedUpdates(esm_x))}function esm_x(){let e=esm_r;esm_r=esm_n.now();let t=esm_w(esm_r);if(t&&(Q(esm_i.splice(0,t),a=>a.handler()),esm_u-=t),!esm_u){esm_R();return}esm_d.flush(),esm_f.flush(e?Math.min(64,esm_r-e):16.667),esm_h.flush(),esm_m.flush(),esm_p.flush()}function esm_l(){let e=new Set,t=e;return{add(a){esm_u+=t==e&&!e.has(a)?1:0,e.add(a)},delete(a){return esm_u-=t==e&&e.has(a)?1:0,e.delete(a)},flush(a){t.size&&(e=new Set,esm_u-=t.size,Q(t,o=>o(a)&&e.add(o)),esm_u+=e.size,t=e)}}}function Q(e,t){e.forEach(a=>{try{t(a)}catch(o){esm_n.catch(o)}})}var esm_S={count(){return esm_u},isRunning(){return esm_r>=0},clear(){esm_r=-1,esm_i=[],esm_d=esm_l(),esm_f=esm_l(),esm_h=esm_l(),esm_m=esm_l(),esm_p=esm_l(),esm_u=0}}; ;// ./node_modules/@react-spring/shared/dist/esm/index.js var ze=Object.defineProperty;var Le=(e,t)=>{for(var r in t)ze(e,r,{get:t[r],enumerable:!0})};var dist_esm_p={};Le(dist_esm_p,{assign:()=>U,colors:()=>dist_esm_c,createStringInterpolator:()=>esm_k,skipAnimation:()=>ee,to:()=>J,willAdvance:()=>dist_esm_S});function Y(){}var mt=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0}),dist_esm_l={arr:Array.isArray,obj:e=>!!e&&e.constructor.name==="Object",fun:e=>typeof e=="function",str:e=>typeof e=="string",num:e=>typeof e=="number",und:e=>e===void 0};function bt(e,t){if(dist_esm_l.arr(e)){if(!dist_esm_l.arr(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return e===t}var esm_Ve=(e,t)=>e.forEach(t);function xt(e,t,r){if(dist_esm_l.arr(e)){for(let n=0;n<e.length;n++)t.call(r,e[n],`${n}`);return}for(let n in e)e.hasOwnProperty(n)&&t.call(r,e[n],n)}var ht=e=>dist_esm_l.und(e)?[]:dist_esm_l.arr(e)?e:[e];function Pe(e,t){if(e.size){let r=Array.from(e);e.clear(),esm_Ve(r,t)}}var yt=(e,...t)=>Pe(e,r=>r(...t)),dist_esm_h=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);var esm_k,J,dist_esm_c=null,ee=!1,dist_esm_S=Y,U=e=>{e.to&&(J=e.to),e.now&&(esm_n.now=e.now),e.colors!==void 0&&(dist_esm_c=e.colors),e.skipAnimation!=null&&(ee=e.skipAnimation),e.createStringInterpolator&&(esm_k=e.createStringInterpolator),e.requestAnimationFrame&&esm_n.use(e.requestAnimationFrame),e.batchedUpdates&&(esm_n.batchedUpdates=e.batchedUpdates),e.willAdvance&&(dist_esm_S=e.willAdvance),e.frameLoop&&(esm_n.frameLoop=e.frameLoop)};var esm_E=new Set,dist_esm_u=[],esm_H=[],A=0,qe={get idle(){return!esm_E.size&&!dist_esm_u.length},start(e){A>e.priority?(esm_E.add(e),esm_n.onStart($e)):(te(e),esm_n(B))},advance:B,sort(e){if(A)esm_n.onFrame(()=>qe.sort(e));else{let t=dist_esm_u.indexOf(e);~t&&(dist_esm_u.splice(t,1),re(e))}},clear(){dist_esm_u=[],esm_E.clear()}};function $e(){esm_E.forEach(te),esm_E.clear(),esm_n(B)}function te(e){dist_esm_u.includes(e)||re(e)}function re(e){dist_esm_u.splice(Ge(dist_esm_u,t=>t.priority>e.priority),0,e)}function B(e){let t=esm_H;for(let r=0;r<dist_esm_u.length;r++){let n=dist_esm_u[r];A=n.priority,n.idle||(dist_esm_S(n),n.advance(e),n.idle||t.push(n))}return A=0,esm_H=dist_esm_u,esm_H.length=0,dist_esm_u=t,dist_esm_u.length>0}function Ge(e,t){let r=e.findIndex(t);return r<0?e.length:r}var ne=(e,t,r)=>Math.min(Math.max(r,e),t);var It={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};var dist_esm_d="[-+]?\\d*\\.?\\d+",esm_M=dist_esm_d+"%";function C(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var oe=new RegExp("rgb"+C(dist_esm_d,dist_esm_d,dist_esm_d)),fe=new RegExp("rgba"+C(dist_esm_d,dist_esm_d,dist_esm_d,dist_esm_d)),ae=new RegExp("hsl"+C(dist_esm_d,esm_M,esm_M)),ie=new RegExp("hsla"+C(dist_esm_d,esm_M,esm_M,dist_esm_d)),se=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ue=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,le=/^#([0-9a-fA-F]{6})$/,esm_ce=/^#([0-9a-fA-F]{8})$/;function be(e){let t;return typeof e=="number"?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=le.exec(e))?parseInt(t[1]+"ff",16)>>>0:dist_esm_c&&dist_esm_c[e]!==void 0?dist_esm_c[e]:(t=oe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|255)>>>0:(t=fe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|me(t[4]))>>>0:(t=se.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=esm_ce.exec(e))?parseInt(t[1],16)>>>0:(t=ue.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=ae.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|255)>>>0:(t=ie.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|me(t[4]))>>>0:null}function esm_j(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function de(e,t,r){let n=r<.5?r*(1+t):r+t-r*t,f=2*r-n,o=esm_j(f,n,e+1/3),i=esm_j(f,n,e),s=esm_j(f,n,e-1/3);return Math.round(o*255)<<24|Math.round(i*255)<<16|Math.round(s*255)<<8}function dist_esm_y(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function esm_pe(e){return(parseFloat(e)%360+360)%360/360}function me(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function esm_z(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function D(e){let t=be(e);if(t===null)return e;t=t||0;let r=(t&4278190080)>>>24,n=(t&16711680)>>>16,f=(t&65280)>>>8,o=(t&255)/255;return`rgba(${r}, ${n}, ${f}, ${o})`}var W=(e,t,r)=>{if(dist_esm_l.fun(e))return e;if(dist_esm_l.arr(e))return W({range:e,output:t,extrapolate:r});if(dist_esm_l.str(e.output[0]))return esm_k(e);let n=e,f=n.output,o=n.range||[0,1],i=n.extrapolateLeft||n.extrapolate||"extend",s=n.extrapolateRight||n.extrapolate||"extend",x=n.easing||(a=>a);return a=>{let F=He(a,o);return Ue(a,o[F],o[F+1],f[F],f[F+1],x,i,s,n.map)}};function Ue(e,t,r,n,f,o,i,s,x){let a=x?x(e):e;if(a<t){if(i==="identity")return a;i==="clamp"&&(a=t)}if(a>r){if(s==="identity")return a;s==="clamp"&&(a=r)}return n===f?n:t===r?e<=t?n:f:(t===-1/0?a=-a:r===1/0?a=a-t:a=(a-t)/(r-t),a=o(a),n===-1/0?a=-a:f===1/0?a=a+n:a=a*(f-n)+n,a)}function He(e,t){for(var r=1;r<t.length-1&&!(t[r]>=e);++r);return r-1}var Be=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);let n=r*e,f=t==="end"?Math.floor(n):Math.ceil(n);return ne(0,1,f/e)},P=1.70158,L=P*1.525,xe=P+1,he=2*Math.PI/3,ye=2*Math.PI/4.5,V=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Lt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:Math.pow(2,10*e-10),easeOutExpo:e=>e===1?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>xe*e*e*e-P*e*e,easeOutBack:e=>1+xe*Math.pow(e-1,3)+P*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*((L+1)*2*e-L)/2:(Math.pow(2*e-2,2)*((L+1)*(e*2-2)+L)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*he),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*he)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*ye))/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*ye)/2+1,easeInBounce:e=>1-V(1-e),easeOutBounce:V,easeInOutBounce:e=>e<.5?(1-V(1-2*e))/2:(1+V(2*e-1))/2,steps:Be};var esm_g=Symbol.for("FluidValue.get"),dist_esm_m=Symbol.for("FluidValue.observers");var Pt=e=>Boolean(e&&e[esm_g]),ve=e=>e&&e[esm_g]?e[esm_g]():e,esm_qt=e=>e[dist_esm_m]||null;function je(e,t){e.eventObserved?e.eventObserved(t):e(t)}function $t(e,t){let r=e[dist_esm_m];r&&r.forEach(n=>{je(n,t)})}var esm_ge=class{[esm_g];[dist_esm_m];constructor(t){if(!t&&!(t=this.get))throw Error("Unknown getter");De(this,t)}},De=(e,t)=>Ee(e,esm_g,t);function Gt(e,t){if(e[esm_g]){let r=e[dist_esm_m];r||Ee(e,dist_esm_m,r=new Set),r.has(t)||(r.add(t),e.observerAdded&&e.observerAdded(r.size,t))}return t}function Qt(e,t){let r=e[dist_esm_m];if(r&&r.has(t)){let n=r.size-1;n?r.delete(t):e[dist_esm_m]=null,e.observerRemoved&&e.observerRemoved(n,t)}}var Ee=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0});var O=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,esm_Oe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,K=new RegExp(`(${O.source})(%|[a-z]+)`,"i"),we=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,dist_esm_b=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;var esm_N=e=>{let[t,r]=We(e);if(!t||dist_esm_h())return e;let n=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(n)return n.trim();if(r&&r.startsWith("--")){let f=window.getComputedStyle(document.documentElement).getPropertyValue(r);return f||e}else{if(r&&dist_esm_b.test(r))return esm_N(r);if(r)return r}return e},We=e=>{let t=dist_esm_b.exec(e);if(!t)return[,];let[,r,n]=t;return[r,n]};var _,esm_Ke=(e,t,r,n,f)=>`rgba(${Math.round(t)}, ${Math.round(r)}, ${Math.round(n)}, ${f})`,Xt=e=>{_||(_=dist_esm_c?new RegExp(`(${Object.keys(dist_esm_c).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map(o=>ve(o).replace(dist_esm_b,esm_N).replace(esm_Oe,D).replace(_,D)),r=t.map(o=>o.match(O).map(Number)),f=r[0].map((o,i)=>r.map(s=>{if(!(i in s))throw Error('The arity of each "output" value must be equal');return s[i]})).map(o=>W({...e,output:o}));return o=>{let i=!K.test(t[0])&&t.find(x=>K.test(x))?.replace(O,""),s=0;return t[0].replace(O,()=>`${f[s++](o)}${i||""}`).replace(we,esm_Ke)}};var Z="react-spring: ",Te=e=>{let t=e,r=!1;if(typeof t!="function")throw new TypeError(`${Z}once requires a function parameter`);return(...n)=>{r||(t(...n),r=!0)}},Ne=Te(console.warn);function Jt(){Ne(`${Z}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var _e=Te(console.warn);function er(){_e(`${Z}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function esm_or(e){return dist_esm_l.str(e)&&(e[0]=="#"||/\d/.test(e)||!dist_esm_h()&&dist_esm_b.test(e)||e in(dist_esm_c||{}))}var dist_esm_v,q=new WeakMap,Ze=e=>e.forEach(({target:t,contentRect:r})=>q.get(t)?.forEach(n=>n(r)));function Fe(e,t){dist_esm_v||typeof ResizeObserver<"u"&&(dist_esm_v=new ResizeObserver(Ze));let r=q.get(t);return r||(r=new Set,q.set(t,r)),r.add(e),dist_esm_v&&dist_esm_v.observe(t),()=>{let n=q.get(t);!n||(n.delete(e),!n.size&&dist_esm_v&&dist_esm_v.unobserve(t))}}var esm_$=new Set,dist_esm_w,esm_Xe=()=>{let e=()=>{esm_$.forEach(t=>t({width:window.innerWidth,height:window.innerHeight}))};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},Ie=e=>(esm_$.add(e),dist_esm_w||(dist_esm_w=esm_Xe()),()=>{esm_$.delete(e),!esm_$.size&&dist_esm_w&&(dist_esm_w(),dist_esm_w=void 0)});var ke=(e,{container:t=document.documentElement}={})=>t===document.documentElement?Ie(e):Fe(e,t);var Se=(e,t,r)=>t-e===0?1:(r-e)/(t-e);var esm_Ye={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}},esm_G=class{callback;container;info;constructor(t,r){this.callback=t,this.container=r,this.info={time:0,x:this.createAxis(),y:this.createAxis()}}createAxis=()=>({current:0,progress:0,scrollLength:0});updateAxis=t=>{let r=this.info[t],{length:n,position:f}=esm_Ye[t];r.current=this.container[`scroll${f}`],r.scrollLength=this.container["scroll"+n]-this.container["client"+n],r.progress=Se(0,r.scrollLength,r.current)};update=()=>{this.updateAxis("x"),this.updateAxis("y")};sendEvent=()=>{this.callback(this.info)};advance=()=>{this.update(),this.sendEvent()}};var esm_T=new WeakMap,Ae=new WeakMap,X=new WeakMap,Me=e=>e===document.documentElement?window:e,yr=(e,{container:t=document.documentElement}={})=>{let r=X.get(t);r||(r=new Set,X.set(t,r));let n=new esm_G(e,t);if(r.add(n),!esm_T.has(t)){let o=()=>(r?.forEach(s=>s.advance()),!0);esm_T.set(t,o);let i=Me(t);window.addEventListener("resize",o,{passive:!0}),t!==document.documentElement&&Ae.set(t,ke(o,{container:t})),i.addEventListener("scroll",o,{passive:!0})}let f=esm_T.get(t);return Re(f),()=>{Re.cancel(f);let o=X.get(t);if(!o||(o.delete(n),o.size))return;let i=esm_T.get(t);esm_T.delete(t),i&&(Me(t).removeEventListener("scroll",i),window.removeEventListener("resize",i),Ae.get(t)?.())}};function Er(e){let t=Je(null);return t.current===null&&(t.current=e()),t.current}var esm_Q=dist_esm_h()?external_React_.useEffect:external_React_.useLayoutEffect;var Ce=()=>{let e=(0,external_React_.useRef)(!1);return esm_Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function Mr(){let e=(0,external_React_.useState)()[1],t=Ce();return()=>{t.current&&e(Math.random())}}function Lr(e,t){let[r]=(0,external_React_.useState)(()=>({inputs:t,result:e()})),n=(0,external_React_.useRef)(),f=n.current,o=f;return o?Boolean(t&&o.inputs&&it(t,o.inputs))||(o={inputs:t,result:e()}):o=r,(0,external_React_.useEffect)(()=>{n.current=o,f==r&&(r.inputs=r.result=void 0)},[o]),o.result}function it(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var $r=e=>(0,external_React_.useEffect)(e,ut),ut=[];function Ur(e){let t=ct();return lt(()=>{t.current=e}),t.current}var Wr=()=>{let[e,t]=dt(null);return esm_Q(()=>{let r=window.matchMedia("(prefers-reduced-motion)"),n=f=>{t(f.matches),U({skipAnimation:f.matches})};return n(r),r.addEventListener("change",n),()=>{r.removeEventListener("change",n)}},[]),e}; ;// ./node_modules/@react-spring/animated/dist/esm/index.js var animated_dist_esm_h=Symbol.for("Animated:node"),animated_dist_esm_v=e=>!!e&&e[animated_dist_esm_h]===e,dist_esm_k=e=>e&&e[animated_dist_esm_h],esm_D=(e,t)=>mt(e,animated_dist_esm_h,t),F=e=>e&&e[animated_dist_esm_h]&&e[animated_dist_esm_h].getPayload(),animated_dist_esm_c=class{payload;constructor(){esm_D(this,this)}getPayload(){return this.payload||[]}};var animated_dist_esm_l=class extends animated_dist_esm_c{constructor(r){super();this._value=r;dist_esm_l.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(r){return new animated_dist_esm_l(r)}getPayload(){return[this]}getValue(){return this._value}setValue(r,n){return dist_esm_l.num(r)&&(this.lastPosition=r,n&&(r=Math.round(r/n)*n,this.done&&(this.lastPosition=r))),this._value===r?!1:(this._value=r,!0)}reset(){let{done:r}=this;this.done=!1,dist_esm_l.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,r&&(this.lastVelocity=null),this.v0=null)}};var animated_dist_esm_d=class extends animated_dist_esm_l{_string=null;_toString;constructor(t){super(0),this._toString=W({output:[t,t]})}static create(t){return new animated_dist_esm_d(t)}getValue(){let t=this._string;return t??(this._string=this._toString(this._value))}setValue(t){if(dist_esm_l.str(t)){if(t==this._string)return!1;this._string=t,this._value=1}else if(super.setValue(t))this._string=null;else return!1;return!0}reset(t){t&&(this._toString=W({output:[this.getValue(),t]})),this._value=0,super.reset()}};var dist_esm_f={dependencies:null};var animated_dist_esm_u=class extends animated_dist_esm_c{constructor(r){super();this.source=r;this.setValue(r)}getValue(r){let n={};return xt(this.source,(a,i)=>{animated_dist_esm_v(a)?n[i]=a.getValue(r):Pt(a)?n[i]=ve(a):r||(n[i]=a)}),n}setValue(r){this.source=r,this.payload=this._makePayload(r)}reset(){this.payload&&esm_Ve(this.payload,r=>r.reset())}_makePayload(r){if(r){let n=new Set;return xt(r,this._addToPayload,n),Array.from(n)}}_addToPayload(r){dist_esm_f.dependencies&&Pt(r)&&dist_esm_f.dependencies.add(r);let n=F(r);n&&esm_Ve(n,a=>this.add(a))}};var animated_dist_esm_y=class extends animated_dist_esm_u{constructor(t){super(t)}static create(t){return new animated_dist_esm_y(t)}getValue(){return this.source.map(t=>t.getValue())}setValue(t){let r=this.getPayload();return t.length==r.length?r.map((n,a)=>n.setValue(t[a])).some(Boolean):(super.setValue(t.map(dist_esm_z)),!0)}};function dist_esm_z(e){return(esm_or(e)?animated_dist_esm_d:animated_dist_esm_l).create(e)}function esm_Le(e){let t=dist_esm_k(e);return t?t.constructor:dist_esm_l.arr(e)?animated_dist_esm_y:esm_or(e)?animated_dist_esm_d:animated_dist_esm_l}var dist_esm_x=(e,t)=>{let r=!dist_esm_l.fun(e)||e.prototype&&e.prototype.isReactComponent;return (0,external_React_.forwardRef)((n,a)=>{let i=(0,external_React_.useRef)(null),o=r&&(0,external_React_.useCallback)(s=>{i.current=esm_ae(a,s)},[a]),[m,T]=esm_ne(n,t),W=Mr(),P=()=>{let s=i.current;if(r&&!s)return;(s?t.applyAnimatedValues(s,m.getValue(!0)):!1)===!1&&W()},_=new animated_dist_esm_b(P,T),p=(0,external_React_.useRef)();esm_Q(()=>(p.current=_,esm_Ve(T,s=>Gt(s,_)),()=>{p.current&&(esm_Ve(p.current.deps,s=>Qt(s,p.current)),esm_n.cancel(p.current.update))})),(0,external_React_.useEffect)(P,[]),$r(()=>()=>{let s=p.current;esm_Ve(s.deps,S=>Qt(S,s))});let $=t.getComponentProps(m.getValue());return external_React_.createElement(e,{...$,ref:o})})},animated_dist_esm_b=class{constructor(t,r){this.update=t;this.deps=r}eventObserved(t){t.type=="change"&&esm_n.write(this.update)}};function esm_ne(e,t){let r=new Set;return dist_esm_f.dependencies=r,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new animated_dist_esm_u(e),dist_esm_f.dependencies=null,[e,r]}function esm_ae(e,t){return e&&(dist_esm_l.fun(e)?e(t):e.current=t),t}var dist_esm_j=Symbol.for("AnimatedComponent"),dist_esm_Ke=(e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:r=a=>new animated_dist_esm_u(a),getComponentProps:n=a=>a}={})=>{let a={applyAnimatedValues:t,createAnimatedStyle:r,getComponentProps:n},i=o=>{let m=esm_I(o)||"Anonymous";return dist_esm_l.str(o)?o=i[o]||(i[o]=dist_esm_x(o,a)):o=o[dist_esm_j]||(o[dist_esm_j]=dist_esm_x(o,a)),o.displayName=`Animated(${m})`,o};return xt(e,(o,m)=>{dist_esm_l.arr(e)&&(m=esm_I(o)),i[m]=i(o)}),{animated:i}},esm_I=e=>dist_esm_l.str(e)?e:e&&dist_esm_l.str(e.displayName)?e.displayName:dist_esm_l.fun(e)&&e.name||null; ;// ./node_modules/@react-spring/core/dist/esm/index.js function dist_esm_I(t,...e){return dist_esm_l.fun(t)?t(...e):t}var esm_te=(t,e)=>t===!0||!!(e&&t&&(dist_esm_l.fun(t)?t(e):ht(t).includes(e))),et=(t,e)=>dist_esm_l.obj(t)?e&&t[e]:t;var esm_ke=(t,e)=>t.default===!0?t[e]:t.default?t.default[e]:void 0,nn=t=>t,dist_esm_ne=(t,e=nn)=>{let n=rn;t.default&&t.default!==!0&&(t=t.default,n=Object.keys(t));let r={};for(let o of n){let s=e(t[o],o);dist_esm_l.und(s)||(r[o]=s)}return r},rn=["config","onProps","onStart","onChange","onPause","onResume","onRest"],on={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function sn(t){let e={},n=0;if(xt(t,(r,o)=>{on[o]||(e[o]=r,n++)}),n)return e}function esm_de(t){let e=sn(t);if(e){let n={to:e};return xt(t,(r,o)=>o in e||(n[o]=r)),n}return{...t}}function esm_me(t){return t=ve(t),dist_esm_l.arr(t)?t.map(esm_me):esm_or(t)?dist_esm_p.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function esm_Ue(t){for(let e in t)return!0;return!1}function esm_Ee(t){return dist_esm_l.fun(t)||dist_esm_l.arr(t)&&dist_esm_l.obj(t[0])}function esm_xe(t,e){t.ref?.delete(t),e?.delete(t)}function esm_he(t,e){e&&t.ref!==e&&(t.ref?.delete(t),e.add(t),t.ref=e)}function wr(t,e,n=1e3){an(()=>{if(e){let r=0;ge(t,(o,s)=>{let a=o.current;if(a.length){let i=n*e[s];isNaN(i)?i=r:r=i,ge(a,u=>{ge(u.queue,p=>{let f=p.delay;p.delay=d=>i+dist_esm_I(f||0,d)})}),o.start()}})}else{let r=Promise.resolve();ge(t,o=>{let s=o.current;if(s.length){let a=s.map(i=>{let u=i.queue;return i.queue=[],u});r=r.then(()=>(ge(s,(i,u)=>ge(a[u]||[],p=>i.queue.push(p))),Promise.all(o.start())))}})}})}var esm_mt={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}};var tt={...esm_mt.default,mass:1,damping:1,easing:Lt.linear,clamp:!1},esm_we=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,tt)}};function gt(t,e,n){n&&(n={...n},esm_ht(n,e),e={...n,...e}),esm_ht(t,e),Object.assign(t,e);for(let a in tt)t[a]==null&&(t[a]=tt[a]);let{mass:r,frequency:o,damping:s}=t;return dist_esm_l.und(o)||(o<.01&&(o=.01),s<0&&(s=0),t.tension=Math.pow(2*Math.PI/o,2)*r,t.friction=4*Math.PI*s*r/o),t}function esm_ht(t,e){if(!dist_esm_l.und(e.decay))t.duration=void 0;else{let n=!dist_esm_l.und(e.tension)||!dist_esm_l.und(e.friction);(n||!dist_esm_l.und(e.frequency)||!dist_esm_l.und(e.damping)||!dist_esm_l.und(e.mass))&&(t.duration=void 0,t.decay=void 0),n&&(t.frequency=void 0)}}var esm_yt=[],dist_esm_Le=class{changed=!1;values=esm_yt;toValues=null;fromValues=esm_yt;to;from;config=new esm_we;immediate=!1};function esm_Me(t,{key:e,props:n,defaultProps:r,state:o,actions:s}){return new Promise((a,i)=>{let u,p,f=esm_te(n.cancel??r?.cancel,e);if(f)b();else{dist_esm_l.und(n.pause)||(o.paused=esm_te(n.pause,e));let c=r?.pause;c!==!0&&(c=o.paused||esm_te(c,e)),u=dist_esm_I(n.delay||0,e),c?(o.resumeQueue.add(m),s.pause()):(s.resume(),m())}function d(){o.resumeQueue.add(m),o.timeouts.delete(p),p.cancel(),u=p.time-esm_n.now()}function m(){u>0&&!dist_esm_p.skipAnimation?(o.delayed=!0,p=esm_n.setTimeout(b,u),o.pauseQueue.add(d),o.timeouts.add(p)):b()}function b(){o.delayed&&(o.delayed=!1),o.pauseQueue.delete(d),o.timeouts.delete(p),t<=(o.cancelId||0)&&(f=!0);try{s.start({...n,callId:t,cancel:f},a)}catch(c){i(c)}}})}var esm_be=(t,e)=>e.length==1?e[0]:e.some(n=>n.cancelled)?esm_q(t.get()):e.every(n=>n.noop)?nt(t.get()):dist_esm_E(t.get(),e.every(n=>n.finished)),nt=t=>({value:t,noop:!0,finished:!0,cancelled:!1}),dist_esm_E=(t,e,n=!1)=>({value:t,finished:e,cancelled:n}),esm_q=t=>({value:t,cancelled:!0,finished:!1});function esm_De(t,e,n,r){let{callId:o,parentId:s,onRest:a}=e,{asyncTo:i,promise:u}=n;return!s&&t===i&&!e.reset?u:n.promise=(async()=>{n.asyncId=o,n.asyncTo=t;let p=dist_esm_ne(e,(l,h)=>h==="onRest"?void 0:l),f,d,m=new Promise((l,h)=>(f=l,d=h)),b=l=>{let h=o<=(n.cancelId||0)&&esm_q(r)||o!==n.asyncId&&dist_esm_E(r,!1);if(h)throw l.result=h,d(l),l},c=(l,h)=>{let g=new esm_Ae,x=new esm_Ne;return(async()=>{if(dist_esm_p.skipAnimation)throw esm_oe(n),x.result=dist_esm_E(r,!1),d(x),x;b(g);let S=dist_esm_l.obj(l)?{...l}:{...h,to:l};S.parentId=o,xt(p,(V,_)=>{dist_esm_l.und(S[_])&&(S[_]=V)});let A=await r.start(S);return b(g),n.paused&&await new Promise(V=>{n.resumeQueue.add(V)}),A})()},P;if(dist_esm_p.skipAnimation)return esm_oe(n),dist_esm_E(r,!1);try{let l;dist_esm_l.arr(t)?l=(async h=>{for(let g of h)await c(g)})(t):l=Promise.resolve(t(c,r.stop.bind(r))),await Promise.all([l.then(f),m]),P=dist_esm_E(r.get(),!0,!1)}catch(l){if(l instanceof esm_Ae)P=l.result;else if(l instanceof esm_Ne)P=l.result;else throw l}finally{o==n.asyncId&&(n.asyncId=s,n.asyncTo=s?i:void 0,n.promise=s?u:void 0)}return dist_esm_l.fun(a)&&esm_n.batchedUpdates(()=>{a(P,r,r.item)}),P})()}function esm_oe(t,e){Pe(t.timeouts,n=>n.cancel()),t.pauseQueue.clear(),t.resumeQueue.clear(),t.asyncId=t.asyncTo=t.promise=void 0,e&&(t.cancelId=e)}var esm_Ae=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},esm_Ne=class extends Error{result;constructor(){super("SkipAnimationSignal")}};var esm_Re=t=>t instanceof esm_X,Sn=1,esm_X=class extends esm_ge{id=Sn++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=dist_esm_k(this);return e&&e.getValue()}to(...e){return dist_esm_p.to(this,e)}interpolate(...e){return Jt(),dist_esm_p.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,n=!1){$t(this,{type:"change",parent:this,value:e,idle:n})}_onPriorityChange(e){this.idle||qe.sort(this),$t(this,{type:"priority",parent:this,priority:e})}};var esm_se=Symbol.for("SpringPhase"),esm_bt=1,rt=2,ot=4,esm_qe=t=>(t[esm_se]&esm_bt)>0,dist_esm_Q=t=>(t[esm_se]&rt)>0,esm_ye=t=>(t[esm_se]&ot)>0,st=(t,e)=>e?t[esm_se]|=rt|esm_bt:t[esm_se]&=~rt,esm_it=(t,e)=>e?t[esm_se]|=ot:t[esm_se]&=~ot;var esm_ue=class extends esm_X{key;animation=new dist_esm_Le;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,n){if(super(),!dist_esm_l.und(e)||!dist_esm_l.und(n)){let r=dist_esm_l.obj(e)?{...e}:{...n,from:e};dist_esm_l.und(r.default)&&(r.default=!0),this.start(r)}}get idle(){return!(dist_esm_Q(this)||this._state.asyncTo)||esm_ye(this)}get goal(){return ve(this.animation.to)}get velocity(){let e=dist_esm_k(this);return e instanceof animated_dist_esm_l?e.lastVelocity||0:e.getPayload().map(n=>n.lastVelocity||0)}get hasAnimated(){return esm_qe(this)}get isAnimating(){return dist_esm_Q(this)}get isPaused(){return esm_ye(this)}get isDelayed(){return this._state.delayed}advance(e){let n=!0,r=!1,o=this.animation,{config:s,toValues:a}=o,i=F(o.to);!i&&Pt(o.to)&&(a=ht(ve(o.to))),o.values.forEach((f,d)=>{if(f.done)return;let m=f.constructor==animated_dist_esm_d?1:i?i[d].lastPosition:a[d],b=o.immediate,c=m;if(!b){if(c=f.lastPosition,s.tension<=0){f.done=!0;return}let P=f.elapsedTime+=e,l=o.fromValues[d],h=f.v0!=null?f.v0:f.v0=dist_esm_l.arr(s.velocity)?s.velocity[d]:s.velocity,g,x=s.precision||(l==m?.005:Math.min(1,Math.abs(m-l)*.001));if(dist_esm_l.und(s.duration))if(s.decay){let S=s.decay===!0?.998:s.decay,A=Math.exp(-(1-S)*P);c=l+h/(1-S)*(1-A),b=Math.abs(f.lastPosition-c)<=x,g=h*A}else{g=f.lastVelocity==null?h:f.lastVelocity;let S=s.restVelocity||x/10,A=s.clamp?0:s.bounce,V=!dist_esm_l.und(A),_=l==m?f.v0>0:l<m,v,w=!1,C=1,$=Math.ceil(e/C);for(let L=0;L<$&&(v=Math.abs(g)>S,!(!v&&(b=Math.abs(m-c)<=x,b)));++L){V&&(w=c==m||c>m==_,w&&(g=-g*A,c=m));let N=-s.tension*1e-6*(c-m),y=-s.friction*.001*g,T=(N+y)/s.mass;g=g+T*C,c=c+g*C}}else{let S=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,f.durationProgress>0&&(f.elapsedTime=s.duration*f.durationProgress,P=f.elapsedTime+=e)),S=(s.progress||0)+P/this._memoizedDuration,S=S>1?1:S<0?0:S,f.durationProgress=S),c=l+s.easing(S)*(m-l),g=(c-f.lastPosition)/e,b=S==1}f.lastVelocity=g,Number.isNaN(c)&&(console.warn("Got NaN while animating:",this),b=!0)}i&&!i[d].done&&(b=!1),b?f.done=!0:n=!1,f.setValue(c,s.round)&&(r=!0)});let u=dist_esm_k(this),p=u.getValue();if(n){let f=ve(o.to);(p!==f||r)&&!s.decay?(u.setValue(f),this._onChange(f)):r&&s.decay&&this._onChange(p),this._stop()}else r&&this._onChange(p)}set(e){return esm_n.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(dist_esm_Q(this)){let{to:e,config:n}=this.animation;esm_n.batchedUpdates(()=>{this._onStart(),n.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,n){let r;return dist_esm_l.und(e)?(r=this.queue||[],this.queue=[]):r=[dist_esm_l.obj(e)?e:{...n,to:e}],Promise.all(r.map(o=>this._update(o))).then(o=>esm_be(this,o))}stop(e){let{to:n}=this.animation;return this._focus(this.get()),esm_oe(this._state,e&&this._lastCallId),esm_n.batchedUpdates(()=>this._stop(n,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){let n=this.key||"",{to:r,from:o}=e;r=dist_esm_l.obj(r)?r[n]:r,(r==null||esm_Ee(r))&&(r=void 0),o=dist_esm_l.obj(o)?o[n]:o,o==null&&(o=void 0);let s={to:r,from:o};return esm_qe(this)||(e.reverse&&([r,o]=[o,r]),o=ve(o),dist_esm_l.und(o)?dist_esm_k(this)||this._set(r):this._set(o)),s}_update({...e},n){let{key:r,defaultProps:o}=this;e.default&&Object.assign(o,dist_esm_ne(e,(i,u)=>/^on/.test(u)?et(i,r):i)),_t(this,e,"onProps"),esm_Ie(this,"onProps",e,this);let s=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let a=this._state;return esm_Me(++this._lastCallId,{key:r,props:e,defaultProps:o,state:a,actions:{pause:()=>{esm_ye(this)||(esm_it(this,!0),yt(a.pauseQueue),esm_Ie(this,"onPause",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},resume:()=>{esm_ye(this)&&(esm_it(this,!1),dist_esm_Q(this)&&this._resume(),yt(a.resumeQueue),esm_Ie(this,"onResume",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},start:this._merge.bind(this,s)}}).then(i=>{if(e.loop&&i.finished&&!(n&&i.noop)){let u=at(e);if(u)return this._update(u,!0)}return i})}_merge(e,n,r){if(n.cancel)return this.stop(!0),r(esm_q(this));let o=!dist_esm_l.und(e.to),s=!dist_esm_l.und(e.from);if(o||s)if(n.callId>this._lastToId)this._lastToId=n.callId;else return r(esm_q(this));let{key:a,defaultProps:i,animation:u}=this,{to:p,from:f}=u,{to:d=p,from:m=f}=e;s&&!o&&(!n.default||dist_esm_l.und(d))&&(d=m),n.reverse&&([d,m]=[m,d]);let b=!bt(m,f);b&&(u.from=m),m=ve(m);let c=!bt(d,p);c&&this._focus(d);let P=esm_Ee(n.to),{config:l}=u,{decay:h,velocity:g}=l;(o||s)&&(l.velocity=0),n.config&&!P&>(l,dist_esm_I(n.config,a),n.config!==i.config?dist_esm_I(i.config,a):void 0);let x=dist_esm_k(this);if(!x||dist_esm_l.und(d))return r(dist_esm_E(this,!0));let S=dist_esm_l.und(n.reset)?s&&!n.default:!dist_esm_l.und(m)&&esm_te(n.reset,a),A=S?m:this.get(),V=esm_me(d),_=dist_esm_l.num(V)||dist_esm_l.arr(V)||esm_or(V),v=!P&&(!_||esm_te(i.immediate||n.immediate,a));if(c){let L=esm_Le(d);if(L!==x.constructor)if(v)x=this._set(V);else throw Error(`Cannot animate between ${x.constructor.name} and ${L.name}, as the "to" prop suggests`)}let w=x.constructor,C=Pt(d),$=!1;if(!C){let L=S||!esm_qe(this)&&b;(c||L)&&($=bt(esm_me(A),V),C=!$),(!bt(u.immediate,v)&&!v||!bt(l.decay,h)||!bt(l.velocity,g))&&(C=!0)}if($&&dist_esm_Q(this)&&(u.changed&&!S?C=!0:C||this._stop(p)),!P&&((C||Pt(p))&&(u.values=x.getPayload(),u.toValues=Pt(d)?null:w==animated_dist_esm_d?[1]:ht(V)),u.immediate!=v&&(u.immediate=v,!v&&!S&&this._set(p)),C)){let{onRest:L}=u;esm_Ve(_n,y=>_t(this,n,y));let N=dist_esm_E(this,esm_Ce(this,p));yt(this._pendingCalls,N),this._pendingCalls.add(r),u.changed&&esm_n.batchedUpdates(()=>{u.changed=!S,L?.(N,this),S?dist_esm_I(i.onRest,N):u.onStart?.(N,this)})}S&&this._set(A),P?r(esm_De(n.to,n,this._state,this)):C?this._start():dist_esm_Q(this)&&!c?this._pendingCalls.add(r):r(nt(A))}_focus(e){let n=this.animation;e!==n.to&&(esm_qt(this)&&this._detach(),n.to=e,esm_qt(this)&&this._attach())}_attach(){let e=0,{to:n}=this.animation;Pt(n)&&(Gt(n,this),esm_Re(n)&&(e=n.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;Pt(e)&&Qt(e,this)}_set(e,n=!0){let r=ve(e);if(!dist_esm_l.und(r)){let o=dist_esm_k(this);if(!o||!bt(r,o.getValue())){let s=esm_Le(r);!o||o.constructor!=s?esm_D(this,s.create(r)):o.setValue(r),o&&esm_n.batchedUpdates(()=>{this._onChange(r,n)})}}return dist_esm_k(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,esm_Ie(this,"onStart",dist_esm_E(this,esm_Ce(this,e.to)),this))}_onChange(e,n){n||(this._onStart(),dist_esm_I(this.animation.onChange,e,this)),dist_esm_I(this.defaultProps.onChange,e,this),super._onChange(e,n)}_start(){let e=this.animation;dist_esm_k(this).reset(ve(e.to)),e.immediate||(e.fromValues=e.values.map(n=>n.lastPosition)),dist_esm_Q(this)||(st(this,!0),esm_ye(this)||this._resume())}_resume(){dist_esm_p.skipAnimation?this.finish():qe.start(this)}_stop(e,n){if(dist_esm_Q(this)){st(this,!1);let r=this.animation;esm_Ve(r.values,s=>{s.done=!0}),r.toValues&&(r.onChange=r.onPause=r.onResume=void 0),$t(this,{type:"idle",parent:this});let o=n?esm_q(this.get()):dist_esm_E(this.get(),esm_Ce(this,e??r.to));yt(this._pendingCalls,o),r.changed&&(r.changed=!1,esm_Ie(this,"onRest",o,this))}}};function esm_Ce(t,e){let n=esm_me(e),r=esm_me(t.get());return bt(r,n)}function at(t,e=t.loop,n=t.to){let r=dist_esm_I(e);if(r){let o=r!==!0&&esm_de(r),s=(o||t).reverse,a=!o||o.reset;return esm_Pe({...t,loop:e,default:!1,pause:void 0,to:!s||esm_Ee(n)?n:void 0,from:a?t.from:void 0,reset:a,...o})}}function esm_Pe(t){let{to:e,from:n}=t=esm_de(t),r=new Set;return dist_esm_l.obj(e)&&Vt(e,r),dist_esm_l.obj(n)&&Vt(n,r),t.keys=r.size?Array.from(r):null,t}function Ot(t){let e=esm_Pe(t);return R.und(e.default)&&(e.default=dist_esm_ne(e)),e}function Vt(t,e){xt(t,(n,r)=>n!=null&&e.add(r))}var _n=["onStart","onRest","onChange","onPause","onResume"];function _t(t,e,n){t.animation[n]=e[n]!==esm_ke(e,n)?et(e[n],t.key):void 0}function esm_Ie(t,e,...n){t.animation[e]?.(...n),t.defaultProps[e]?.(...n)}var Fn=["onStart","onChange","onRest"],kn=1,esm_le=class{id=kn++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,n){this._onFrame=this._onFrame.bind(this),n&&(this._flush=n),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each((n,r)=>e[r]=n.get()),e}set(e){for(let n in e){let r=e[n];dist_esm_l.und(r)||this.springs[n].set(r)}}update(e){return e&&this.queue.push(esm_Pe(e)),this}start(e){let{queue:n}=this;return e?n=ht(e).map(esm_Pe):this.queue=[],this._flush?this._flush(this,n):(jt(this,n),esm_ze(this,n))}stop(e,n){if(e!==!!e&&(n=e),n){let r=this.springs;esm_Ve(ht(n),o=>r[o].stop(!!e))}else esm_oe(this._state,this._lastAsyncId),this.each(r=>r.stop(!!e));return this}pause(e){if(dist_esm_l.und(e))this.start({pause:!0});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].pause())}return this}resume(e){if(dist_esm_l.und(e))this.start({pause:!1});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].resume())}return this}each(e){xt(this.springs,e)}_onFrame(){let{onStart:e,onChange:n,onRest:r}=this._events,o=this._active.size>0,s=this._changed.size>0;(o&&!this._started||s&&!this._started)&&(this._started=!0,Pe(e,([u,p])=>{p.value=this.get(),u(p,this,this._item)}));let a=!o&&this._started,i=s||a&&r.size?this.get():null;s&&n.size&&Pe(n,([u,p])=>{p.value=i,u(p,this,this._item)}),a&&(this._started=!1,Pe(r,([u,p])=>{p.value=i,u(p,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;esm_n.onFrame(this._onFrame)}};function esm_ze(t,e){return Promise.all(e.map(n=>wt(t,n))).then(n=>esm_be(t,n))}async function wt(t,e,n){let{keys:r,to:o,from:s,loop:a,onRest:i,onResolve:u}=e,p=dist_esm_l.obj(e.default)&&e.default;a&&(e.loop=!1),o===!1&&(e.to=null),s===!1&&(e.from=null);let f=dist_esm_l.arr(o)||dist_esm_l.fun(o)?o:void 0;f?(e.to=void 0,e.onRest=void 0,p&&(p.onRest=void 0)):esm_Ve(Fn,P=>{let l=e[P];if(dist_esm_l.fun(l)){let h=t._events[P];e[P]=({finished:g,cancelled:x})=>{let S=h.get(l);S?(g||(S.finished=!1),x&&(S.cancelled=!0)):h.set(l,{value:null,finished:g||!1,cancelled:x||!1})},p&&(p[P]=e[P])}});let d=t._state;e.pause===!d.paused?(d.paused=e.pause,yt(e.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(e.pause=!0);let m=(r||Object.keys(t.springs)).map(P=>t.springs[P].start(e)),b=e.cancel===!0||esm_ke(e,"cancel")===!0;(f||b&&d.asyncId)&&m.push(esm_Me(++t._lastAsyncId,{props:e,state:d,actions:{pause:Y,resume:Y,start(P,l){b?(esm_oe(d,t._lastAsyncId),l(esm_q(t))):(P.onRest=i,l(esm_De(f,P,d,t)))}}})),d.paused&&await new Promise(P=>{d.resumeQueue.add(P)});let c=esm_be(t,await Promise.all(m));if(a&&c.finished&&!(n&&c.noop)){let P=at(e,a,o);if(P)return jt(t,[P]),wt(t,P,!0)}return u&&esm_n.batchedUpdates(()=>u(c,t,t.item)),c}function esm_e(t,e){let n={...t.springs};return e&&pe(Ve(e),r=>{z.und(r.keys)&&(r=esm_Pe(r)),z.obj(r.to)||(r={...r,to:void 0}),Mt(n,r,o=>esm_Lt(o))}),pt(t,n),n}function pt(t,e){Ut(e,(n,r)=>{t.springs[r]||(t.springs[r]=n,Et(n,t))})}function esm_Lt(t,e){let n=new esm_ue;return n.key=t,e&&Gt(n,e),n}function Mt(t,e,n){e.keys&&esm_Ve(e.keys,r=>{(t[r]||(t[r]=n(r)))._prepareNode(e)})}function jt(t,e){esm_Ve(e,n=>{Mt(t.springs,n,r=>esm_Lt(r,t))})}var dist_esm_H=({children:t,...e})=>{let n=(0,external_React_.useContext)(esm_Ge),r=e.pause||!!n.pause,o=e.immediate||!!n.immediate;e=Lr(()=>({pause:r,immediate:o}),[r,o]);let{Provider:s}=esm_Ge;return external_React_.createElement(s,{value:e},t)},esm_Ge=wn(dist_esm_H,{});dist_esm_H.Provider=esm_Ge.Provider;dist_esm_H.Consumer=esm_Ge.Consumer;function wn(t,e){return Object.assign(t,external_React_.createContext(e)),t.Provider._context=t,t.Consumer._context=t,t}var esm_fe=()=>{let t=[],e=function(r){Ln();let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=n(r,s,a);i&&o.push(s.start(i))}}),o};e.current=t,e.add=function(r){t.includes(r)||t.push(r)},e.delete=function(r){let o=t.indexOf(r);~o&&t.splice(o,1)},e.pause=function(){return ce(t,r=>r.pause(...arguments)),this},e.resume=function(){return ce(t,r=>r.resume(...arguments)),this},e.set=function(r){ce(t,(o,s)=>{let a=Ke.fun(r)?r(s,o):r;a&&o.set(a)})},e.start=function(r){let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=this._getProps(r,s,a);i&&o.push(s.start(i))}}),o},e.stop=function(){return ce(t,r=>r.stop(...arguments)),this},e.update=function(r){return ce(t,(o,s)=>o.update(this._getProps(r,o,s))),this};let n=function(r,o,s){return Ke.fun(r)?r(s,o):r};return e._getProps=n,e};function esm_He(t,e,n){let r=jn.fun(e)&&e;r&&!n&&(n=[]);let o=Xe(()=>r||arguments.length==3?esm_fe():void 0,[]),s=Nt(0),a=Dn(),i=Xe(()=>({ctrls:[],queue:[],flush(h,g){let x=esm_e(h,g);return s.current>0&&!i.queue.length&&!Object.keys(x).some(A=>!h.springs[A])?esm_ze(h,g):new Promise(A=>{pt(h,x),i.queue.push(()=>{A(esm_ze(h,g))}),a()})}}),[]),u=Nt([...i.ctrls]),p=[],f=Dt(t)||0;Xe(()=>{Ye(u.current.slice(t,f),h=>{esm_xe(h,o),h.stop(!0)}),u.current.length=t,d(f,t)},[t]),Xe(()=>{d(0,Math.min(f,t))},n);function d(h,g){for(let x=h;x<g;x++){let S=u.current[x]||(u.current[x]=new esm_le(null,i.flush)),A=r?r(x,S):e[x];A&&(p[x]=Ot(A))}}let m=u.current.map((h,g)=>esm_e(h,p[g])),b=Mn(dist_esm_H),c=Dt(b),P=b!==c&&esm_Ue(b);qn(()=>{s.current++,i.ctrls=u.current;let{queue:h}=i;h.length&&(i.queue=[],Ye(h,g=>g())),Ye(u.current,(g,x)=>{o?.add(g),P&&g.start({default:b});let S=p[x];S&&(esm_he(g,S.ref),g.ref?g.queue.push(S):g.start(S))})}),Nn(()=>()=>{Ye(i.ctrls,h=>h.stop(!0))});let l=m.map(h=>({...h}));return o?[l,o]:l}function esm_J(t,e){let n=Qn.fun(t),[[r],o]=esm_He(1,n?t:[t],n?e||[]:e);return n||arguments.length==2?[r,o]:r}var Gn=()=>esm_fe(),Xo=()=>zn(Gn)[0];var Wo=(t,e)=>{let n=Bn(()=>new esm_ue(t,e));return Kn(()=>()=>{n.stop()}),n};function esm_Qt(t,e,n){let r=qt.fun(e)&&e;r&&!n&&(n=[]);let o=!0,s,a=esm_He(t,(i,u)=>{let p=r?r(i,u):e;return s=p.ref,o=o&&p.reverse,p},n||[{}]);if(Yn(()=>{Xn(a[1].current,(i,u)=>{let p=a[1].current[u+(o?1:-1)];if(esm_he(i,s),i.ref){p&&i.update({to:p.springs});return}p?i.start({to:p.springs}):i.start()})},n),r||arguments.length==3){let i=s??a[1];return i._getProps=(u,p,f)=>{let d=qt.fun(u)?u(f,p):u;if(d){let m=i.current[f+(d.reverse?1:-1)];return m&&(d.to=m.springs),d}},a}return a[0]}function esm_Gt(t,e,n){let r=G.fun(e)&&e,{reset:o,sort:s,trail:a=0,expires:i=!0,exitBeforeEnter:u=!1,onDestroyed:p,ref:f,config:d}=r?r():e,m=Jn(()=>r||arguments.length==3?esm_fe():void 0,[]),b=zt(t),c=[],P=lt(null),l=o?null:P.current;Je(()=>{P.current=c}),$n(()=>(j(c,y=>{m?.add(y.ctrl),y.ctrl.ref=m}),()=>{j(P.current,y=>{y.expired&&clearTimeout(y.expirationId),esm_xe(y.ctrl,m),y.ctrl.stop(!0)})}));let h=tr(b,r?r():e,l),g=o&&P.current||[];Je(()=>j(g,({ctrl:y,item:T,key:F})=>{esm_xe(y,m),dist_esm_I(p,T,F)}));let x=[];if(l&&j(l,(y,T)=>{y.expired?(clearTimeout(y.expirationId),g.push(y)):(T=x[T]=h.indexOf(y.key),~T&&(c[T]=y))}),j(b,(y,T)=>{c[T]||(c[T]={key:h[T],item:y,phase:"mount",ctrl:new esm_le},c[T].ctrl.item=y)}),x.length){let y=-1,{leave:T}=r?r():e;j(x,(F,k)=>{let O=l[k];~F?(y=c.indexOf(O),c[y]={...O,item:b[F]}):T&&c.splice(++y,0,O)})}G.fun(s)&&c.sort((y,T)=>s(y.item,T.item));let S=-a,A=Wn(),V=dist_esm_ne(e),_=new Map,v=lt(new Map),w=lt(!1);j(c,(y,T)=>{let F=y.key,k=y.phase,O=r?r():e,U,D,Jt=dist_esm_I(O.delay||0,F);if(k=="mount")U=O.enter,D="enter";else{let M=h.indexOf(F)<0;if(k!="leave")if(M)U=O.leave,D="leave";else if(U=O.update)D="update";else return;else if(!M)U=O.enter,D="enter";else return}if(U=dist_esm_I(U,y.item,T),U=G.obj(U)?esm_de(U):{to:U},!U.config){let M=d||V.config;U.config=dist_esm_I(M,y.item,T,D)}S+=a;let Z={...V,delay:Jt+S,ref:f,immediate:O.immediate,reset:!1,...U};if(D=="enter"&&G.und(Z.from)){let M=r?r():e,Te=G.und(M.initial)||l?M.from:M.initial;Z.from=dist_esm_I(Te,y.item,T)}let{onResolve:Wt}=Z;Z.onResolve=M=>{dist_esm_I(Wt,M);let Te=P.current,B=Te.find(Fe=>Fe.key===F);if(!!B&&!(M.cancelled&&B.phase!="update")&&B.ctrl.idle){let Fe=Te.every(ee=>ee.ctrl.idle);if(B.phase=="leave"){let ee=dist_esm_I(i,B.item);if(ee!==!1){let Ze=ee===!0?0:ee;if(B.expired=!0,!Fe&&Ze>0){Ze<=2147483647&&(B.expirationId=setTimeout(A,Ze));return}}}Fe&&Te.some(ee=>ee.expired)&&(v.current.delete(B),u&&(w.current=!0),A())}};let ft=esm_e(y.ctrl,Z);D==="leave"&&u?v.current.set(y,{phase:D,springs:ft,payload:Z}):_.set(y,{phase:D,springs:ft,payload:Z})});let C=Hn(dist_esm_H),$=Zn(C),L=C!==$&&esm_Ue(C);Je(()=>{L&&j(c,y=>{y.ctrl.start({default:C})})},[C]),j(_,(y,T)=>{if(v.current.size){let F=c.findIndex(k=>k.key===T.key);c.splice(F,1)}}),Je(()=>{j(v.current.size?v.current:_,({phase:y,payload:T},F)=>{let{ctrl:k}=F;F.phase=y,m?.add(k),L&&y=="enter"&&k.start({default:C}),T&&(esm_he(k,T.ref),(k.ref||m)&&!w.current?k.update(T):(k.start(T),w.current&&(w.current=!1)))})},o?void 0:n);let N=y=>Oe.createElement(Oe.Fragment,null,c.map((T,F)=>{let{springs:k}=_.get(T)||T.ctrl,O=y({...k},T.item,T,F);return O&&O.type?Oe.createElement(O.type,{...O.props,key:G.str(T.key)||G.num(T.key)?T.key:T.ctrl.id,ref:O.ref}):O}));return m?[N,m]:N}var esm_er=1;function tr(t,{key:e,keys:n=e},r){if(n===null){let o=new Set;return t.map(s=>{let a=r&&r.find(i=>i.item===s&&i.phase!=="leave"&&!o.has(i));return a?(o.add(a),a.key):esm_er++})}return G.und(n)?t:G.fun(n)?t.map(n):zt(n)}var hs=({container:t,...e}={})=>{let[n,r]=esm_J(()=>({scrollX:0,scrollY:0,scrollXProgress:0,scrollYProgress:0,...e}),[]);return or(()=>{let o=rr(({x:s,y:a})=>{r.start({scrollX:s.current,scrollXProgress:s.progress,scrollY:a.current,scrollYProgress:a.progress})},{container:t?.current||void 0});return()=>{nr(Object.values(n),s=>s.stop()),o()}},[]),n};var Ps=({container:t,...e})=>{let[n,r]=esm_J(()=>({width:0,height:0,...e}),[]);return ar(()=>{let o=sr(({width:s,height:a})=>{r.start({width:s,height:a,immediate:n.width.get()===0||n.height.get()===0})},{container:t?.current||void 0});return()=>{ir(Object.values(n),s=>s.stop()),o()}},[]),n};var cr={any:0,all:1};function Cs(t,e){let[n,r]=pr(!1),o=ur(),s=Bt.fun(t)&&t,a=s?s():{},{to:i={},from:u={},...p}=a,f=s?e:t,[d,m]=esm_J(()=>({from:u,...p}),[]);return lr(()=>{let b=o.current,{root:c,once:P,amount:l="any",...h}=f??{};if(!b||P&&n||typeof IntersectionObserver>"u")return;let g=new WeakMap,x=()=>(i&&m.start(i),r(!0),P?void 0:()=>{u&&m.start(u),r(!1)}),S=V=>{V.forEach(_=>{let v=g.get(_.target);if(_.isIntersecting!==Boolean(v))if(_.isIntersecting){let w=x();Bt.fun(w)?g.set(_.target,w):A.unobserve(_.target)}else v&&(v(),g.delete(_.target))})},A=new IntersectionObserver(S,{root:c&&c.current||void 0,threshold:typeof l=="number"||Array.isArray(l)?l:cr[l],...h});return A.observe(b),()=>A.unobserve(b)},[f]),s?[o,d]:[o,n]}function qs({children:t,...e}){return t(esm_J(e))}function Bs({items:t,children:e,...n}){let r=esm_Qt(t.length,n);return t.map((o,s)=>{let a=e(o,s);return fr.fun(a)?a(r[s]):a})}function Ys({items:t,children:e,...n}){return esm_Gt(t,n)(e)}var esm_W=class extends esm_X{constructor(n,r){super();this.source=n;this.calc=W(...r);let o=this._get(),s=esm_Le(o);esm_D(this,s.create(o))}key;idle=!0;calc;_active=new Set;advance(n){let r=this._get(),o=this.get();bt(r,o)||(dist_esm_k(this).setValue(r),this._onChange(r,this.idle)),!this.idle&&Yt(this._active)&&esm_ct(this)}_get(){let n=dist_esm_l.arr(this.source)?this.source.map(ve):ht(ve(this.source));return this.calc(...n)}_start(){this.idle&&!Yt(this._active)&&(this.idle=!1,esm_Ve(F(this),n=>{n.done=!1}),dist_esm_p.skipAnimation?(esm_n.batchedUpdates(()=>this.advance()),esm_ct(this)):qe.start(this))}_attach(){let n=1;esm_Ve(ht(this.source),r=>{Pt(r)&&Gt(r,this),esm_Re(r)&&(r.idle||this._active.add(r),n=Math.max(n,r.priority+1))}),this.priority=n,this._start()}_detach(){esm_Ve(ht(this.source),n=>{Pt(n)&&Qt(n,this)}),this._active.clear(),esm_ct(this)}eventObserved(n){n.type=="change"?n.idle?this.advance():(this._active.add(n.parent),this._start()):n.type=="idle"?this._active.delete(n.parent):n.type=="priority"&&(this.priority=ht(this.source).reduce((r,o)=>Math.max(r,(esm_Re(o)?o.priority:0)+1),0))}};function vr(t){return t.idle!==!1}function Yt(t){return!t.size||Array.from(t).every(vr)}function esm_ct(t){t.idle||(t.idle=!0,esm_Ve(F(t),e=>{e.done=!0}),$t(t,{type:"idle",parent:t}))}var ui=(t,...e)=>new esm_W(t,e),pi=(t,...e)=>(Cr(),new esm_W(t,e));dist_esm_p.assign({createStringInterpolator:Xt,to:(t,e)=>new esm_W(t,e)});var di=qe.advance; ;// external "ReactDOM" const external_ReactDOM_namespaceObject = window["ReactDOM"]; ;// ./node_modules/@react-spring/web/dist/esm/index.js var web_dist_esm_k=/^--/;function web_dist_esm_I(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!web_dist_esm_k.test(t)&&!(web_dist_esm_c.hasOwnProperty(t)&&web_dist_esm_c[t])?e+"px":(""+e).trim()}var web_dist_esm_v={};function esm_V(t,e){if(!t.nodeType||!t.setAttribute)return!1;let r=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{style:i,children:s,scrollTop:u,scrollLeft:l,viewBox:a,...n}=e,d=Object.values(n),m=Object.keys(n).map(o=>r||t.hasAttribute(o)?o:web_dist_esm_v[o]||(web_dist_esm_v[o]=o.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(let o in i)if(i.hasOwnProperty(o)){let p=web_dist_esm_I(o,i[o]);web_dist_esm_k.test(o)?t.style.setProperty(o,p):t.style[o]=p}m.forEach((o,p)=>{t.setAttribute(o,d[p])}),u!==void 0&&(t.scrollTop=u),l!==void 0&&(t.scrollLeft=l),a!==void 0&&t.setAttribute("viewBox",a)}var web_dist_esm_c={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},esm_F=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),esm_L=["Webkit","Ms","Moz","O"];web_dist_esm_c=Object.keys(web_dist_esm_c).reduce((t,e)=>(esm_L.forEach(r=>t[esm_F(r,e)]=t[e]),t),web_dist_esm_c);var esm_=/^(matrix|translate|scale|rotate|skew)/,dist_esm_$=/^(translate)/,dist_esm_G=/^(rotate|skew)/,web_dist_esm_y=(t,e)=>dist_esm_l.num(t)&&t!==0?t+e:t,web_dist_esm_h=(t,e)=>dist_esm_l.arr(t)?t.every(r=>web_dist_esm_h(r,e)):dist_esm_l.num(t)?t===e:parseFloat(t)===e,dist_esm_g=class extends animated_dist_esm_u{constructor({x:e,y:r,z:i,...s}){let u=[],l=[];(e||r||i)&&(u.push([e||0,r||0,i||0]),l.push(a=>[`translate3d(${a.map(n=>web_dist_esm_y(n,"px")).join(",")})`,web_dist_esm_h(a,0)])),xt(s,(a,n)=>{if(n==="transform")u.push([a||""]),l.push(d=>[d,d===""]);else if(esm_.test(n)){if(delete s[n],dist_esm_l.und(a))return;let d=dist_esm_$.test(n)?"px":dist_esm_G.test(n)?"deg":"";u.push(ht(a)),l.push(n==="rotate3d"?([m,o,p,O])=>[`rotate3d(${m},${o},${p},${web_dist_esm_y(O,d)})`,web_dist_esm_h(O,0)]:m=>[`${n}(${m.map(o=>web_dist_esm_y(o,d)).join(",")})`,web_dist_esm_h(m,n.startsWith("scale")?1:0)])}}),u.length&&(s.transform=new web_dist_esm_x(u,l)),super(s)}},web_dist_esm_x=class extends esm_ge{constructor(r,i){super();this.inputs=r;this.transforms=i}_value=null;get(){return this._value||(this._value=this._get())}_get(){let r="",i=!0;return esm_Ve(this.inputs,(s,u)=>{let l=ve(s[0]),[a,n]=this.transforms[u](dist_esm_l.arr(l)?l:s.map(ve));r+=" "+a,i=i&&n}),i?"none":r}observerAdded(r){r==1&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Gt(s,this)))}observerRemoved(r){r==0&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Qt(s,this)))}eventObserved(r){r.type=="change"&&(this._value=null),$t(this,r)}};var esm_C=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];dist_esm_p.assign({batchedUpdates:external_ReactDOM_namespaceObject.unstable_batchedUpdates,createStringInterpolator:Xt,colors:It});var dist_esm_q=dist_esm_Ke(esm_C,{applyAnimatedValues:esm_V,createAnimatedStyle:t=>new dist_esm_g(t),getComponentProps:({scrollTop:t,scrollLeft:e,...r})=>r}),dist_esm_it=dist_esm_q.animated; ;// ./node_modules/@wordpress/block-editor/build-module/components/use-moving-animation/index.js const BLOCK_ANIMATION_THRESHOLD = 200; function getAbsolutePosition(element) { return { top: element.offsetTop, left: element.offsetLeft }; } function useMovingAnimation({ triggerAnimationOnChange, clientId }) { const ref = (0,external_wp_element_namespaceObject.useRef)(); const { isTyping, getGlobalBlockCount, isBlockSelected, isFirstMultiSelectedBlock, isBlockMultiSelected, isAncestorMultiSelected, isDraggingBlocks } = (0,external_wp_data_namespaceObject.useSelect)(store); const { previous, prevRect } = (0,external_wp_element_namespaceObject.useMemo)( () => ({ previous: ref.current && getAbsolutePosition(ref.current), prevRect: ref.current && ref.current.getBoundingClientRect() }), [triggerAnimationOnChange] ); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!previous || !ref.current) { return; } const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(ref.current); const isSelected = isBlockSelected(clientId); const adjustScrolling = isSelected || isFirstMultiSelectedBlock(clientId); const isDragging = isDraggingBlocks(); function preserveScrollPosition() { if (isDragging) { return; } if (adjustScrolling && prevRect) { const blockRect = ref.current.getBoundingClientRect(); const diff = blockRect.top - prevRect.top; if (diff) { scrollContainer.scrollTop += diff; } } } const disableAnimation = window.matchMedia("(prefers-reduced-motion: reduce)").matches || isTyping() || getGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD; if (disableAnimation) { preserveScrollPosition(); return; } const isPartOfSelection = isSelected || isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId); if (isPartOfSelection && isDragging) { return; } const zIndex = isPartOfSelection ? "1" : ""; const controller = new esm_le({ x: 0, y: 0, config: { mass: 5, tension: 2e3, friction: 200 }, onChange({ value }) { if (!ref.current) { return; } let { x: x2, y: y2 } = value; x2 = Math.round(x2); y2 = Math.round(y2); const finishedMoving = x2 === 0 && y2 === 0; ref.current.style.transformOrigin = "center center"; ref.current.style.transform = finishedMoving ? null : `translate3d(${x2}px,${y2}px,0)`; ref.current.style.zIndex = zIndex; preserveScrollPosition(); } }); ref.current.style.transform = void 0; const destination = getAbsolutePosition(ref.current); const x = Math.round(previous.left - destination.left); const y = Math.round(previous.top - destination.top); controller.start({ x: 0, y: 0, from: { x, y } }); return () => { controller.stop(); controller.set({ x: 0, y: 0 }); }; }, [ previous, prevRect, clientId, isTyping, getGlobalBlockCount, isBlockSelected, isFirstMultiSelectedBlock, isBlockMultiSelected, isAncestorMultiSelected, isDraggingBlocks ]); return ref; } var use_moving_animation_default = useMovingAnimation; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-first-element.js function useFocusFirstElement({ clientId, initialPosition }) { const ref = (0,external_wp_element_namespaceObject.useRef)(); const { isBlockSelected, isMultiSelecting, isZoomOut } = unlock( (0,external_wp_data_namespaceObject.useSelect)(store) ); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isBlockSelected(clientId) || isMultiSelecting() || isZoomOut()) { return; } if (initialPosition === void 0 || initialPosition === null) { return; } if (!ref.current) { return; } const { ownerDocument } = ref.current; if (isInsideRootBlock(ref.current, ownerDocument.activeElement)) { return; } const textInputs = external_wp_dom_namespaceObject.focus.tabbable.find(ref.current).filter((node) => (0,external_wp_dom_namespaceObject.isTextField)(node)); const isReverse = -1 === initialPosition; const target = textInputs[isReverse ? textInputs.length - 1 : 0] || ref.current; if (!isInsideRootBlock(ref.current, target)) { ref.current.focus(); return; } if (!ref.current.getAttribute("contenteditable")) { const focusElement = external_wp_dom_namespaceObject.focus.tabbable.findNext(ref.current); if (focusElement && isInsideRootBlock(ref.current, focusElement) && (0,external_wp_dom_namespaceObject.isFormElement)(focusElement)) { focusElement.focus(); return; } } (0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(target, isReverse); }, [initialPosition, clientId]); return ref; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-is-hovered.js function listener(event) { if (event.defaultPrevented) { return; } event.preventDefault(); event.currentTarget.classList.toggle( "is-hovered", event.type === "mouseover" ); } function useIsHovered() { return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { node.addEventListener("mouseout", listener); node.addEventListener("mouseover", listener); return () => { node.removeEventListener("mouseout", listener); node.removeEventListener("mouseover", listener); node.classList.remove("is-hovered"); }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-handler.js function useFocusHandler(clientId) { const { isBlockSelected } = (0,external_wp_data_namespaceObject.useSelect)(store); const { selectBlock, selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { function onFocus(event) { if (node.parentElement.closest('[contenteditable="true"]')) { return; } if (isBlockSelected(clientId)) { if (!event.target.isContentEditable) { selectionChange(clientId); } return; } if (!isInsideRootBlock(node, event.target)) { return; } selectBlock(clientId); } node.addEventListener("focusin", onFocus); return () => { node.removeEventListener("focusin", onFocus); }; }, [isBlockSelected, selectBlock] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js function isColorTransparent(color) { return !color || color === "transparent" || color === "rgba(0, 0, 0, 0)"; } function useEventHandlers({ clientId, isSelected }) { const { getBlockRootClientId, isZoomOut, hasMultiSelection } = unlock( (0,external_wp_data_namespaceObject.useSelect)(store) ); const { insertAfterBlock, removeBlock, resetZoomLevel, startDraggingBlocks, stopDraggingBlocks } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); return (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { if (!isSelected) { return; } function onKeyDown(event) { const { keyCode, target } = event; if (keyCode !== external_wp_keycodes_namespaceObject.ENTER && keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.DELETE) { return; } if (target !== node || (0,external_wp_dom_namespaceObject.isTextField)(target)) { return; } event.preventDefault(); if (keyCode === external_wp_keycodes_namespaceObject.ENTER && isZoomOut()) { resetZoomLevel(); } else if (keyCode === external_wp_keycodes_namespaceObject.ENTER) { insertAfterBlock(clientId); } else { removeBlock(clientId); } } function onDragStart(event) { if (node !== event.target || node.isContentEditable || node.ownerDocument.activeElement !== node || hasMultiSelection()) { event.preventDefault(); return; } const data = JSON.stringify({ type: "block", srcClientIds: [clientId], srcRootClientId: getBlockRootClientId(clientId) }); event.dataTransfer.effectAllowed = "move"; event.dataTransfer.clearData(); event.dataTransfer.setData("wp-blocks", data); const { ownerDocument } = node; const { defaultView } = ownerDocument; const selection = defaultView.getSelection(); selection.removeAllRanges(); const dragElement = ownerDocument.createElement("div"); dragElement.style.width = "1px"; dragElement.style.height = "1px"; dragElement.style.position = "fixed"; dragElement.style.visibility = "hidden"; ownerDocument.body.appendChild(dragElement); event.dataTransfer.setDragImage(dragElement, 0, 0); const rect = node.getBoundingClientRect(); const clone = node.cloneNode(true); clone.style.visibility = "hidden"; clone.style.display = "none"; const id = node.id; node.id = null; let _scale = 1; { let parentElement = node; while (parentElement = parentElement.parentElement) { const { scale } = defaultView.getComputedStyle(parentElement); if (scale && scale !== "none") { _scale = parseFloat(scale); break; } } } const inverted = 1 / _scale; node.after(clone); const originalNodeProperties = {}; for (const property of [ "transform", "transformOrigin", "transition", "zIndex", "position", "top", "left", "pointerEvents", "opacity", "backgroundColor" ]) { originalNodeProperties[property] = node.style[property]; } const originScrollTop = defaultView.scrollY; const originScrollLeft = defaultView.scrollX; const originClientX = event.clientX; const originClientY = event.clientY; node.style.position = "relative"; node.style.top = `${0}px`; node.style.left = `${0}px`; const originX = event.clientX - rect.left; const originY = event.clientY - rect.top; const dragScale = rect.height > 200 ? 200 / rect.height : 1; node.style.zIndex = "1000"; node.style.transformOrigin = `${originX * inverted}px ${originY * inverted}px`; node.style.transition = "transform 0.2s ease-out"; node.style.transform = `scale(${dragScale})`; node.style.opacity = "0.9"; if (isColorTransparent( defaultView.getComputedStyle(node).backgroundColor )) { let bgColor = "transparent"; let parentElement = node; while (parentElement = parentElement.parentElement) { const { backgroundColor } = defaultView.getComputedStyle(parentElement); if (!isColorTransparent(backgroundColor)) { bgColor = backgroundColor; break; } } node.style.backgroundColor = bgColor; } let hasStarted = false; function over(e) { if (!hasStarted) { hasStarted = true; node.style.pointerEvents = "none"; } const scrollTop = defaultView.scrollY; const scrollLeft = defaultView.scrollX; node.style.top = `${(e.clientY - originClientY + scrollTop - originScrollTop) * inverted}px`; node.style.left = `${(e.clientX - originClientX + scrollLeft - originScrollLeft) * inverted}px`; } function end() { ownerDocument.removeEventListener("dragover", over); ownerDocument.removeEventListener("dragend", end); ownerDocument.removeEventListener("drop", end); ownerDocument.removeEventListener("scroll", over); for (const [property, value] of Object.entries( originalNodeProperties )) { node.style[property] = value; } clone.remove(); node.id = id; dragElement.remove(); stopDraggingBlocks(); document.body.classList.remove( "is-dragging-components-draggable" ); ownerDocument.documentElement.classList.remove( "is-dragging" ); } ownerDocument.addEventListener("dragover", over); ownerDocument.addEventListener("dragend", end); ownerDocument.addEventListener("drop", end); ownerDocument.addEventListener("scroll", over); startDraggingBlocks([clientId]); document.body.classList.add( "is-dragging-components-draggable" ); ownerDocument.documentElement.classList.add("is-dragging"); } node.addEventListener("keydown", onKeyDown); node.addEventListener("dragstart", onDragStart); return () => { node.removeEventListener("keydown", onKeyDown); node.removeEventListener("dragstart", onDragStart); }; }, [ clientId, isSelected, getBlockRootClientId, insertAfterBlock, removeBlock, isZoomOut, resetZoomLevel, hasMultiSelection, startDraggingBlocks, stopDraggingBlocks ] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-intersection-observer.js function useIntersectionObserver() { const observer = (0,external_wp_element_namespaceObject.useContext)(block_list_IntersectionObserver); return (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { if (observer) { observer.observe(node); return () => { observer.unobserve(node); }; } }, [observer] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-scroll-into-view.js function useScrollIntoView({ isSelected }) { const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); return (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { if (isSelected) { const { ownerDocument } = node; const { defaultView } = ownerDocument; if (!defaultView.IntersectionObserver) { return; } const observer = new defaultView.IntersectionObserver( (entries) => { if (!entries[0].isIntersecting) { node.scrollIntoView({ behavior: prefersReducedMotion ? "instant" : "smooth" }); } observer.disconnect(); } ); observer.observe(node); return () => { observer.disconnect(); }; } }, [isSelected] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/use-flash-editable-blocks/index.js function useFlashEditableBlocks({ clientId = "", isEnabled = true } = {}) { const { getEnabledClientIdsTree } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); return (0,external_wp_compose_namespaceObject.useRefEffect)( (element) => { if (!isEnabled) { return; } const flashEditableBlocks = () => { getEnabledClientIdsTree(clientId).forEach( ({ clientId: id }) => { const block = element.querySelector( `[data-block="${id}"]` ); if (!block) { return; } block.classList.remove("has-editable-outline"); block.offsetWidth; block.classList.add("has-editable-outline"); } ); }; const handleClick = (event) => { const shouldFlash = event.target === element || event.target.classList.contains("is-root-container"); if (!shouldFlash) { return; } if (event.defaultPrevented) { return; } event.preventDefault(); flashEditableBlocks(); }; element.addEventListener("click", handleClick); return () => element.removeEventListener("click", handleClick); }, [isEnabled] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js const nodesByDocument = /* @__PURE__ */ new Map(); function add(doc, node) { let set = nodesByDocument.get(doc); if (!set) { set = /* @__PURE__ */ new Set(); nodesByDocument.set(doc, set); doc.addEventListener("pointerdown", down); } set.add(node); } function remove(doc, node) { const set = nodesByDocument.get(doc); if (set) { set.delete(node); restore(node); if (set.size === 0) { nodesByDocument.delete(doc); doc.removeEventListener("pointerdown", down); } } } function restore(node) { const prevDraggable = node.getAttribute("data-draggable"); if (prevDraggable) { node.removeAttribute("data-draggable"); if (prevDraggable === "true" && !node.getAttribute("draggable")) { node.setAttribute("draggable", "true"); } } } function down(event) { const { target } = event; const { ownerDocument, isContentEditable, tagName } = target; const isInputOrTextArea = ["INPUT", "TEXTAREA"].includes(tagName); const nodes = nodesByDocument.get(ownerDocument); if (isContentEditable || isInputOrTextArea) { for (const node of nodes) { if (node.getAttribute("draggable") === "true" && node.contains(target)) { node.removeAttribute("draggable"); node.setAttribute("data-draggable", "true"); } } } else { for (const node of nodes) { restore(node); } } } function useFirefoxDraggableCompatibility() { return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { add(node.ownerDocument, node); return () => { remove(node.ownerDocument, node); }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/index.js function use_block_props_useBlockProps(props = {}, { __unstableIsHtml } = {}) { const { clientId, className, wrapperProps = {}, isAligned, index, mode, name, blockApiVersion, blockTitle, isSelected, isSubtreeDisabled, hasOverlay, initialPosition, blockEditingMode, isHighlighted, isMultiSelected, isPartiallySelected, isReusable, isDragging, hasChildSelected, isEditingDisabled, hasEditableOutline, isTemporarilyEditingAsBlocks, defaultClassName, isSectionBlock, canMove, isBlockHidden } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext); const blockLabel = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Block: %s"), blockTitle); const htmlSuffix = mode === "html" && !__unstableIsHtml ? "-visual" : ""; const ffDragRef = useFirefoxDraggableCompatibility(); const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([ props.ref, useFocusFirstElement({ clientId, initialPosition }), useBlockRefProvider(clientId), useFocusHandler(clientId), useEventHandlers({ clientId, isSelected }), useIsHovered(), useIntersectionObserver(), use_moving_animation_default({ triggerAnimationOnChange: index, clientId }), (0,external_wp_compose_namespaceObject.useDisabled)({ isDisabled: !hasOverlay }), useFlashEditableBlocks({ clientId, isEnabled: isSectionBlock }), useScrollIntoView({ isSelected }), canMove ? ffDragRef : void 0 ]); const blockEditContext = useBlockEditContext(); const hasBlockBindings = !!blockEditContext[blockBindingsKey]; const bindingsStyle = hasBlockBindings ? { "--wp-admin-theme-color": "var(--wp-block-synced-color)", "--wp-admin-theme-color--rgb": "var(--wp-block-synced-color--rgb)" } : {}; if (blockApiVersion < 2 && clientId === blockEditContext.clientId) { external_wp_warning_default()( `Block type "${name}" must support API version 2 or higher to work correctly with "useBlockProps" method.` ); } let hasNegativeMargin = false; if (wrapperProps?.style?.marginTop?.charAt(0) === "-" || wrapperProps?.style?.marginBottom?.charAt(0) === "-" || wrapperProps?.style?.marginLeft?.charAt(0) === "-" || wrapperProps?.style?.marginRight?.charAt(0) === "-") { hasNegativeMargin = true; } return { tabIndex: blockEditingMode === "disabled" ? -1 : 0, draggable: canMove && !hasChildSelected ? true : void 0, ...wrapperProps, ...props, ref: mergedRefs, id: `block-${clientId}${htmlSuffix}`, role: "document", "aria-label": blockLabel, "data-block": clientId, "data-type": name, "data-title": blockTitle, inert: isSubtreeDisabled ? "true" : void 0, className: dist_clsx( "block-editor-block-list__block", { // The wp-block className is important for editor styles. "wp-block": !isAligned, "has-block-overlay": hasOverlay, "is-selected": isSelected, "is-highlighted": isHighlighted, "is-multi-selected": isMultiSelected, "is-partially-selected": isPartiallySelected, "is-reusable": isReusable, "is-dragging": isDragging, "has-child-selected": hasChildSelected, "is-editing-disabled": isEditingDisabled, "has-editable-outline": hasEditableOutline, "has-negative-margin": hasNegativeMargin, "is-content-locked-temporarily-editing-as-blocks": isTemporarilyEditingAsBlocks, "is-block-hidden": isBlockHidden }, className, props.className, wrapperProps.className, defaultClassName ), style: { ...wrapperProps.style, ...props.style, ...bindingsStyle } }; } use_block_props_useBlockProps.save = external_wp_blocks_namespaceObject.__unstableGetBlockProps; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block.js function mergeWrapperProps(propsA, propsB) { const newProps = { ...propsA, ...propsB }; if (propsA?.hasOwnProperty("className") && propsB?.hasOwnProperty("className")) { newProps.className = dist_clsx(propsA.className, propsB.className); } if (propsA?.hasOwnProperty("style") && propsB?.hasOwnProperty("style")) { newProps.style = { ...propsA.style, ...propsB.style }; } return newProps; } function Block({ children, isHtml, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...use_block_props_useBlockProps(props, { __unstableIsHtml: isHtml }), children }); } function BlockListBlock({ block: { __unstableBlockSource }, mode, isLocked, canRemove, clientId, isSelected, isSelectionEnabled, className, __unstableLayoutClassNames: layoutClassNames, name, isValid, attributes, wrapperProps, setAttributes, onReplace, onRemove, onInsertBlocksAfter, onMerge, toggleSelection }) { const { mayDisplayControls, mayDisplayParentControls, themeSupportsLayout, ...context } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext); const parentLayout = useLayout() || {}; let blockEdit = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockEdit, { name, isSelected, attributes, setAttributes, insertBlocksAfter: isLocked ? void 0 : onInsertBlocksAfter, onReplace: canRemove ? onReplace : void 0, onRemove: canRemove ? onRemove : void 0, mergeBlocks: canRemove ? onMerge : void 0, clientId, isSelectionEnabled, toggleSelection, __unstableLayoutClassNames: layoutClassNames, __unstableParentLayout: Object.keys(parentLayout).length ? parentLayout : void 0, mayDisplayControls, mayDisplayParentControls, blockEditingMode: context.blockEditingMode, isPreviewMode: context.isPreviewMode } ); const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); if (blockType?.getEditWrapperProps) { wrapperProps = mergeWrapperProps( wrapperProps, blockType.getEditWrapperProps(attributes) ); } const isAligned = wrapperProps && !!wrapperProps["data-align"] && !themeSupportsLayout; const isSticky = className?.includes("is-position-sticky"); if (isAligned) { blockEdit = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx("wp-block", isSticky && className), "data-align": wrapperProps["data-align"], children: blockEdit } ); } let block; if (!isValid) { const saveContent = __unstableBlockSource ? (0,external_wp_blocks_namespaceObject.serializeRawBlock)(__unstableBlockSource) : (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes); block = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Block, { className: "has-warning", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockInvalidWarning, { clientId }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: (0,external_wp_dom_namespaceObject.safeHTML)(saveContent) }) ] }); } else if (mode === "html") { block = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { display: "none" }, children: blockEdit }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { isHtml: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_html_default, { clientId }) }) ] }); } else if (blockType?.apiVersion > 1) { block = blockEdit; } else { block = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { children: blockEdit }); } const { "data-align": dataAlign, ...restWrapperProps } = wrapperProps ?? {}; const updatedWrapperProps = { ...restWrapperProps, className: dist_clsx( restWrapperProps.className, dataAlign && themeSupportsLayout && `align${dataAlign}`, !(dataAlign && isSticky) && className ) }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivateBlockContext.Provider, { value: { wrapperProps: updatedWrapperProps, isAligned, ...context }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_crash_boundary_default, { fallback: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { className: "has-warning", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_crash_warning_default, {}) }), children: block } ) } ); } const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, registry) => { const { updateBlockAttributes, insertBlocks, mergeBlocks, replaceBlocks, toggleSelection, __unstableMarkLastChangeAsPersistent, moveBlocksToPosition, removeBlock, selectBlock } = dispatch(store); return { setAttributes(nextAttributes) { const { getMultiSelectedBlockClientIds } = registry.select(store); const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(); const { clientId, attributes } = ownProps; const clientIds = multiSelectedBlockClientIds.length ? multiSelectedBlockClientIds : [clientId]; const newAttributes = typeof nextAttributes === "function" ? nextAttributes(attributes) : nextAttributes; updateBlockAttributes(clientIds, newAttributes); }, onInsertBlocks(blocks, index) { const { rootClientId } = ownProps; insertBlocks(blocks, index, rootClientId); }, onInsertBlocksAfter(blocks) { const { clientId, rootClientId } = ownProps; const { getBlockIndex } = registry.select(store); const index = getBlockIndex(clientId); insertBlocks(blocks, index + 1, rootClientId); }, onMerge(forward) { const { clientId, rootClientId } = ownProps; const { getPreviousBlockClientId, getNextBlockClientId, getBlock, getBlockAttributes, getBlockName, getBlockOrder, getBlockIndex, getBlockRootClientId, canInsertBlockType } = registry.select(store); function switchToDefaultOrRemove() { const block = getBlock(clientId); const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); const defaultBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(defaultBlockName); if (getBlockName(clientId) !== defaultBlockName) { const replacement = (0,external_wp_blocks_namespaceObject.switchToBlockType)( block, defaultBlockName ); if (replacement && replacement.length) { replaceBlocks(clientId, replacement); } } else if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block)) { const nextBlockClientId = getNextBlockClientId(clientId); if (nextBlockClientId) { registry.batch(() => { removeBlock(clientId); selectBlock(nextBlockClientId); }); } } else if (defaultBlockType.merge) { const attributes = defaultBlockType.merge( {}, block.attributes ); replaceBlocks( [clientId], [(0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName, attributes)] ); } } function moveFirstItemUp(_clientId, changeSelection = true) { const wrapperBlockName = getBlockName(_clientId); const wrapperBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(wrapperBlockName); const isTextualWrapper = wrapperBlockType.category === "text"; const targetRootClientId = getBlockRootClientId(_clientId); const blockOrder = getBlockOrder(_clientId); const [firstClientId] = blockOrder; if (blockOrder.length === 1 && (0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(getBlock(firstClientId))) { removeBlock(_clientId); } else if (isTextualWrapper) { registry.batch(() => { if (canInsertBlockType( getBlockName(firstClientId), targetRootClientId )) { moveBlocksToPosition( [firstClientId], _clientId, targetRootClientId, getBlockIndex(_clientId) ); } else { const replacement = (0,external_wp_blocks_namespaceObject.switchToBlockType)( getBlock(firstClientId), (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() ); if (replacement && replacement.length && replacement.every( (block) => canInsertBlockType( block.name, targetRootClientId ) )) { insertBlocks( replacement, getBlockIndex(_clientId), targetRootClientId, changeSelection ); removeBlock(firstClientId, false); } else { switchToDefaultOrRemove(); } } if (!getBlockOrder(_clientId).length && (0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(getBlock(_clientId))) { removeBlock(_clientId, false); } }); } else { switchToDefaultOrRemove(); } } if (forward) { if (rootClientId) { const nextRootClientId = getNextBlockClientId(rootClientId); if (nextRootClientId) { if (getBlockName(rootClientId) === getBlockName(nextRootClientId)) { const rootAttributes = getBlockAttributes(rootClientId); const previousRootAttributes = getBlockAttributes(nextRootClientId); if (Object.keys(rootAttributes).every( (key) => rootAttributes[key] === previousRootAttributes[key] )) { registry.batch(() => { moveBlocksToPosition( getBlockOrder(nextRootClientId), nextRootClientId, rootClientId ); removeBlock(nextRootClientId, false); }); return; } } else { mergeBlocks(rootClientId, nextRootClientId); return; } } } const nextBlockClientId = getNextBlockClientId(clientId); if (!nextBlockClientId) { return; } if (getBlockOrder(nextBlockClientId).length) { moveFirstItemUp(nextBlockClientId, false); } else { mergeBlocks(clientId, nextBlockClientId); } } else { const previousBlockClientId = getPreviousBlockClientId(clientId); if (previousBlockClientId) { mergeBlocks(previousBlockClientId, clientId); } else if (rootClientId) { const previousRootClientId = getPreviousBlockClientId(rootClientId); if (previousRootClientId && getBlockName(rootClientId) === getBlockName(previousRootClientId)) { const rootAttributes = getBlockAttributes(rootClientId); const previousRootAttributes = getBlockAttributes(previousRootClientId); if (Object.keys(rootAttributes).every( (key) => rootAttributes[key] === previousRootAttributes[key] )) { registry.batch(() => { moveBlocksToPosition( getBlockOrder(rootClientId), rootClientId, previousRootClientId ); removeBlock(rootClientId, false); }); return; } } moveFirstItemUp(rootClientId); } else { switchToDefaultOrRemove(); } } }, onReplace(blocks, indexToSelect, initialPosition) { if (blocks.length && !(0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blocks[blocks.length - 1])) { __unstableMarkLastChangeAsPersistent(); } const replacementBlocks = blocks?.length === 1 && Array.isArray(blocks[0]) ? blocks[0] : blocks; replaceBlocks( [ownProps.clientId], replacementBlocks, indexToSelect, initialPosition ); }, onRemove() { removeBlock(ownProps.clientId); }, toggleSelection(selectionEnabled) { toggleSelection(selectionEnabled); } }; }); BlockListBlock = (0,external_wp_compose_namespaceObject.compose)( applyWithDispatch, (0,external_wp_components_namespaceObject.withFilters)("editor.BlockListBlock") )(BlockListBlock); function BlockListBlockProvider(props) { const { clientId, rootClientId } = props; const selectedProps = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { isBlockSelected, getBlockMode, isSelectionEnabled: isSelectionEnabled2, getTemplateLock, isSectionBlock: _isSectionBlock, getBlockWithoutAttributes, getBlockAttributes, canRemoveBlock, canMoveBlock, getSettings, getTemporarilyEditingAsBlocks, getBlockEditingMode, getBlockName, isFirstMultiSelectedBlock, getMultiSelectedBlockClientIds, hasSelectedInnerBlock, getBlocksByName, getBlockIndex, isBlockMultiSelected, isBlockSubtreeDisabled, isBlockHighlighted, __unstableIsFullySelected, __unstableSelectionHasUnmergeableBlock, isBlockBeingDragged, isDragging: isDragging2, __unstableHasActiveBlockOverlayActive, getSelectedBlocksInitialCaretPosition } = unlock(select(store)); const blockWithoutAttributes2 = getBlockWithoutAttributes(clientId); if (!blockWithoutAttributes2) { return; } const { hasBlockSupport: _hasBlockSupport, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const attributes2 = getBlockAttributes(clientId); const { name: blockName, isValid: isValid2 } = blockWithoutAttributes2; const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); const { supportsLayout, isPreviewMode: isPreviewMode2, __experimentalBlockBindingsSupportedAttributes } = getSettings(); const bindableAttributes2 = __experimentalBlockBindingsSupportedAttributes?.[blockName]; const hasLightBlockWrapper = blockType?.apiVersion > 1; const previewContext = { isPreviewMode: isPreviewMode2, blockWithoutAttributes: blockWithoutAttributes2, name: blockName, attributes: attributes2, isValid: isValid2, themeSupportsLayout: supportsLayout, index: getBlockIndex(clientId), isReusable: (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType), className: hasLightBlockWrapper ? attributes2.className : void 0, defaultClassName: hasLightBlockWrapper ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockName) : void 0, blockTitle: blockType?.title, isBlockHidden: attributes2?.metadata?.blockVisibility === false, bindableAttributes: bindableAttributes2 }; if (isPreviewMode2) { return previewContext; } const { isBlockHidden: _isBlockHidden } = unlock( select(store) ); const _isSelected = isBlockSelected(clientId); const canRemove2 = canRemoveBlock(clientId); const canMove2 = canMoveBlock(clientId); const match = getActiveBlockVariation(blockName, attributes2); const isMultiSelected2 = isBlockMultiSelected(clientId); const checkDeep = true; const isAncestorOfSelectedBlock = hasSelectedInnerBlock( clientId, checkDeep ); const blockEditingMode2 = getBlockEditingMode(clientId); const multiple = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "multiple", true); const blocksWithSameName = multiple ? [] : getBlocksByName(blockName); const isInvalid = blocksWithSameName.length && blocksWithSameName[0] !== clientId; return { ...previewContext, mode: getBlockMode(clientId), isSelectionEnabled: isSelectionEnabled2(), isLocked: !!getTemplateLock(rootClientId), isSectionBlock: _isSectionBlock(clientId), canRemove: canRemove2, canMove: canMove2, isSelected: _isSelected, isTemporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId, blockEditingMode: blockEditingMode2, mayDisplayControls: _isSelected || isFirstMultiSelectedBlock(clientId) && getMultiSelectedBlockClientIds().every( (id) => getBlockName(id) === blockName ), mayDisplayParentControls: _hasBlockSupport( getBlockName(clientId), "__experimentalExposeControlsToChildren", false ) && hasSelectedInnerBlock(clientId), blockApiVersion: blockType?.apiVersion || 1, blockTitle: match?.title || blockType?.title, isSubtreeDisabled: blockEditingMode2 === "disabled" && isBlockSubtreeDisabled(clientId), hasOverlay: __unstableHasActiveBlockOverlayActive(clientId) && !isDragging2(), initialPosition: _isSelected ? getSelectedBlocksInitialCaretPosition() : void 0, isHighlighted: isBlockHighlighted(clientId), isMultiSelected: isMultiSelected2, isPartiallySelected: isMultiSelected2 && !__unstableIsFullySelected() && !__unstableSelectionHasUnmergeableBlock(), isDragging: isBlockBeingDragged(clientId), hasChildSelected: isAncestorOfSelectedBlock, isEditingDisabled: blockEditingMode2 === "disabled", hasEditableOutline: blockEditingMode2 !== "disabled" && getBlockEditingMode(rootClientId) === "disabled", originalBlockClientId: isInvalid ? blocksWithSameName[0] : false, isBlockHidden: _isBlockHidden(clientId) }; }, [clientId, rootClientId] ); const { isPreviewMode, // Fill values that end up as a public API and may not be defined in // preview mode. mode = "visual", isSelectionEnabled = false, isLocked = false, canRemove = false, canMove = false, blockWithoutAttributes, name, attributes, isValid, isSelected = false, themeSupportsLayout, isTemporarilyEditingAsBlocks, blockEditingMode, mayDisplayControls, mayDisplayParentControls, index, blockApiVersion, blockTitle, isSubtreeDisabled, hasOverlay, initialPosition, isHighlighted, isMultiSelected, isPartiallySelected, isReusable, isDragging, hasChildSelected, isSectionBlock, isEditingDisabled, hasEditableOutline, className, defaultClassName, originalBlockClientId, isBlockHidden, bindableAttributes } = selectedProps; const block = (0,external_wp_element_namespaceObject.useMemo)( () => ({ ...blockWithoutAttributes, attributes }), [blockWithoutAttributes, attributes] ); if (!selectedProps) { return null; } const privateContext = { isPreviewMode, clientId, className, index, mode, name, blockApiVersion, blockTitle, isSelected, isSubtreeDisabled, hasOverlay, initialPosition, blockEditingMode, isHighlighted, isMultiSelected, isPartiallySelected, isReusable, isDragging, hasChildSelected, isSectionBlock, isEditingDisabled, hasEditableOutline, isTemporarilyEditingAsBlocks, defaultClassName, mayDisplayControls, mayDisplayParentControls, originalBlockClientId, themeSupportsLayout, canMove, isBlockHidden, bindableAttributes }; if (isBlockHidden && !isSelected && !isMultiSelected && !hasChildSelected) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockContext.Provider, { value: privateContext, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockListBlock, { ...props, ...{ mode, isSelectionEnabled, isLocked, canRemove, canMove, // Users of the editor.BlockListBlock filter used to be able // to access the block prop. Ideally these blocks would rely // on the clientId prop only. This is kept for backward // compatibility reasons. block, name, attributes, isValid, isSelected } } ) }); } var block_default = (0,external_wp_element_namespaceObject.memo)(BlockListBlockProvider); ;// external ["wp","htmlEntities"] const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; ;// ./node_modules/@wordpress/block-editor/build-module/components/default-block-appender/index.js const ZWNBSP = "\uFEFF"; function DefaultBlockAppender({ rootClientId }) { const { showPrompt, isLocked, placeholder, isManualGrid } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockCount, getSettings, getTemplateLock, getBlockAttributes } = select(store); const isEmpty = !getBlockCount(rootClientId); const { bodyPlaceholder } = getSettings(); return { showPrompt: isEmpty, isLocked: !!getTemplateLock(rootClientId), placeholder: bodyPlaceholder, isManualGrid: getBlockAttributes(rootClientId)?.layout?.isManualPlacement }; }, [rootClientId] ); const { insertDefaultBlock, startTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (isLocked || isManualGrid) { return null; } const value = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)("Type / to choose a block"); const onAppend = () => { insertDefaultBlock(void 0, rootClientId); startTyping(); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { "data-root-client-id": rootClientId || "", className: dist_clsx("block-editor-default-block-appender", { "has-visible-prompt": showPrompt }), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "p", { tabIndex: "0", role: "button", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Add default block"), className: "block-editor-default-block-appender__content", onKeyDown: (event) => { if (external_wp_keycodes_namespaceObject.ENTER === event.keyCode || external_wp_keycodes_namespaceObject.SPACE === event.keyCode) { onAppend(); } }, onClick: () => onAppend(), onFocus: () => { if (showPrompt) { onAppend(); } }, children: showPrompt ? value : ZWNBSP } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inserter_default, { rootClientId, position: "bottom right", isAppender: true, __experimentalIsQuick: true } ) ] } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list-appender/index.js function DefaultAppender({ rootClientId }) { const canInsertDefaultBlock = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).canInsertBlockType( (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(), rootClientId ) ); if (canInsertDefaultBlock) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultBlockAppender, { rootClientId }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( button_block_appender_default, { rootClientId, className: "block-list-appender__toggle" } ); } function BlockListAppender({ rootClientId, CustomAppender, className, tagName: TagName = "div" }) { const isDragOver = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockInsertionPoint, isBlockInsertionPointVisible, getBlockCount } = select(store); const insertionPoint = getBlockInsertionPoint(); return isBlockInsertionPointVisible() && rootClientId === insertionPoint?.rootClientId && getBlockCount(rootClientId) === 0; }, [rootClientId] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TagName, { tabIndex: -1, className: dist_clsx("block-list-appender wp-block", className, { "is-drag-over": isDragOver }), contentEditable: false, "data-block": true, children: CustomAppender ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomAppender, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultAppender, { rootClientId }) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/inbetween.js const inbetween_MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER; function BlockPopoverInbetween({ previousClientId, nextClientId, children, __unstablePopoverSlot, __unstableContentRef, operation = "insert", nearestSide = "right", ...props }) { const [popoverRecomputeCounter, forcePopoverRecompute] = (0,external_wp_element_namespaceObject.useReducer)( // Module is there to make sure that the counter doesn't overflow. (s) => (s + 1) % inbetween_MAX_POPOVER_RECOMPUTE_COUNTER, 0 ); const { orientation, rootClientId, isVisible } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockListSettings, getBlockRootClientId, isBlockVisible } = select(store); const _rootClientId = getBlockRootClientId( previousClientId ?? nextClientId ); return { orientation: getBlockListSettings(_rootClientId)?.orientation || "vertical", rootClientId: _rootClientId, isVisible: isBlockVisible(previousClientId) && isBlockVisible(nextClientId) }; }, [previousClientId, nextClientId] ); const previousElement = useBlockElement(previousClientId); const nextElement = useBlockElement(nextClientId); const isVertical = orientation === "vertical"; const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => { if ( // popoverRecomputeCounter is by definition always equal or greater than 0. // This check is only there to satisfy the correctness of the // exhaustive-deps rule for the `useMemo` hook. popoverRecomputeCounter < 0 || !previousElement && !nextElement || !isVisible ) { return void 0; } const contextElement = operation === "group" ? nextElement || previousElement : previousElement || nextElement; return { contextElement, getBoundingClientRect() { const previousRect = previousElement ? previousElement.getBoundingClientRect() : null; const nextRect = nextElement ? nextElement.getBoundingClientRect() : null; let left = 0; let top = 0; let width = 0; let height = 0; if (operation === "group") { const targetRect = nextRect || previousRect; top = targetRect.top; width = 0; height = targetRect.bottom - targetRect.top; left = nearestSide === "left" ? targetRect.left - 2 : targetRect.right - 2; } else if (isVertical) { top = previousRect ? previousRect.bottom : nextRect.top; width = previousRect ? previousRect.width : nextRect.width; height = nextRect && previousRect ? nextRect.top - previousRect.bottom : 0; left = previousRect ? previousRect.left : nextRect.left; } else { top = previousRect ? previousRect.top : nextRect.top; height = previousRect ? previousRect.height : nextRect.height; if ((0,external_wp_i18n_namespaceObject.isRTL)()) { left = nextRect ? nextRect.right : previousRect.left; width = previousRect && nextRect ? previousRect.left - nextRect.right : 0; } else { left = previousRect ? previousRect.right : nextRect.left; width = previousRect && nextRect ? nextRect.left - previousRect.right : 0; } width = Math.max(width, 0); } return new window.DOMRect(left, top, width, height); } }; }, [ previousElement, nextElement, popoverRecomputeCounter, isVertical, isVisible, operation, nearestSide ]); const popoverScrollRef = use_popover_scroll_default(__unstableContentRef); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!previousElement) { return; } const observer = new window.MutationObserver(forcePopoverRecompute); observer.observe(previousElement, { attributes: true }); return () => { observer.disconnect(); }; }, [previousElement]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!nextElement) { return; } const observer = new window.MutationObserver(forcePopoverRecompute); observer.observe(nextElement, { attributes: true }); return () => { observer.disconnect(); }; }, [nextElement]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!previousElement) { return; } previousElement.ownerDocument.defaultView.addEventListener( "resize", forcePopoverRecompute ); return () => { previousElement.ownerDocument.defaultView?.removeEventListener( "resize", forcePopoverRecompute ); }; }, [previousElement]); if (!previousElement && !nextElement || !isVisible) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Popover, { ref: popoverScrollRef, animate: false, anchor: popoverAnchor, focusOnMount: false, __unstableSlotName: __unstablePopoverSlot, inline: !__unstablePopoverSlot, ...props, className: dist_clsx( "block-editor-block-popover", "block-editor-block-popover__inbetween", props.className ), resize: false, flip: false, placement: "overlay", variant: "unstyled", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-popover__inbetween-container", children }) }, nextClientId + "--" + rootClientId ); } var inbetween_default = BlockPopoverInbetween; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/drop-zone.js const animateVariants = { hide: { opacity: 0, scaleY: 0.75 }, show: { opacity: 1, scaleY: 1 }, exit: { opacity: 0, scaleY: 0.9 } }; function BlockDropZonePopover({ __unstablePopoverSlot, __unstableContentRef }) { const { clientId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getBlockOrder, getBlockInsertionPoint } = select(store); const insertionPoint = getBlockInsertionPoint(); const order = getBlockOrder(insertionPoint.rootClientId); if (!order.length) { return {}; } return { clientId: order[insertionPoint.index] }; }, []); const reducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( cover_default, { clientId, __unstablePopoverSlot, __unstableContentRef, className: "block-editor-block-popover__drop-zone", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { "data-testid": "block-popover-drop-zone", initial: reducedMotion ? animateVariants.show : animateVariants.hide, animate: animateVariants.show, exit: reducedMotion ? animateVariants.show : animateVariants.exit, className: "block-editor-block-popover__drop-zone-foreground" } ) } ); } var drop_zone_default = BlockDropZonePopover; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/insertion-point.js const InsertionPointOpenRef = (0,external_wp_element_namespaceObject.createContext)(); InsertionPointOpenRef.displayName = "InsertionPointOpenRefContext"; function InbetweenInsertionPointPopover({ __unstablePopoverSlot, __unstableContentRef, operation = "insert", nearestSide = "right" }) { const { selectBlock, hideInsertionPoint } = (0,external_wp_data_namespaceObject.useDispatch)(store); const openRef = (0,external_wp_element_namespaceObject.useContext)(InsertionPointOpenRef); const ref = (0,external_wp_element_namespaceObject.useRef)(); const { orientation, previousClientId, nextClientId, rootClientId, isInserterShown, isDistractionFree, isZoomOutMode } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getBlockOrder, getBlockListSettings, getBlockInsertionPoint, isBlockBeingDragged, getPreviousBlockClientId, getNextBlockClientId, getSettings, isZoomOut } = unlock(select(store)); const insertionPoint = getBlockInsertionPoint(); const order = getBlockOrder(insertionPoint.rootClientId); if (!order.length) { return {}; } let _previousClientId = order[insertionPoint.index - 1]; let _nextClientId = order[insertionPoint.index]; while (isBlockBeingDragged(_previousClientId)) { _previousClientId = getPreviousBlockClientId(_previousClientId); } while (isBlockBeingDragged(_nextClientId)) { _nextClientId = getNextBlockClientId(_nextClientId); } const settings = getSettings(); return { previousClientId: _previousClientId, nextClientId: _nextClientId, orientation: getBlockListSettings(insertionPoint.rootClientId)?.orientation || "vertical", rootClientId: insertionPoint.rootClientId, isDistractionFree: settings.isDistractionFree, isInserterShown: insertionPoint?.__unstableWithInserter, isZoomOutMode: isZoomOut() }; }, []); const { getBlockEditingMode } = (0,external_wp_data_namespaceObject.useSelect)(store); const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); function onClick(event) { if (event.target === ref.current && nextClientId && getBlockEditingMode(nextClientId) !== "disabled") { selectBlock(nextClientId, -1); } } function maybeHideInserterPoint(event) { if (event.target === ref.current && !openRef.current) { hideInsertionPoint(); } } function onFocus(event) { if (event.target !== ref.current) { openRef.current = true; } } const maybeResetOpenRef = (0,external_wp_element_namespaceObject.useCallback)( (node) => { if (!node && openRef.current) { openRef.current = false; } }, [openRef] ); const lineVariants = { // Initial position starts from the center and invisible. start: { opacity: 0, scale: 0 }, // The line expands to fill the container. If the inserter is visible it // is delayed so it appears orchestrated. rest: { opacity: 1, scale: 1, transition: { delay: isInserterShown ? 0.5 : 0, type: "tween" } }, hover: { opacity: 1, scale: 1, transition: { delay: 0.5, type: "tween" } } }; const inserterVariants = { start: { scale: disableMotion ? 1 : 0 }, rest: { scale: 1, transition: { delay: 0.4, type: "tween" } } }; if (isDistractionFree) { return null; } if (isZoomOutMode && operation !== "insert") { return null; } const orientationClassname = orientation === "horizontal" || operation === "group" ? "is-horizontal" : "is-vertical"; const className = dist_clsx( "block-editor-block-list__insertion-point", orientationClassname ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inbetween_default, { previousClientId, nextClientId, __unstablePopoverSlot, __unstableContentRef, operation, nearestSide, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__unstableMotion.div, { layout: !disableMotion, initial: disableMotion ? "rest" : "start", animate: "rest", whileHover: "hover", whileTap: "pressed", exit: "start", ref, tabIndex: -1, onClick, onFocus, className: dist_clsx(className, { "is-with-inserter": isInserterShown }), onHoverEnd: maybeHideInserterPoint, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { variants: lineVariants, className: "block-editor-block-list__insertion-point-indicator", "data-testid": "block-list-insertion-point-indicator" } ), isInserterShown && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { variants: inserterVariants, className: dist_clsx( "block-editor-block-list__insertion-point-inserter" ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inserter_default, { ref: maybeResetOpenRef, position: "bottom center", clientId: nextClientId, rootClientId, __experimentalIsQuick: true, onToggle: (isOpen) => { openRef.current = isOpen; }, onSelectOrClose: () => { openRef.current = false; } } ) } ) ] } ) } ); } function InsertionPoint(props) { const { insertionPoint, isVisible, isBlockListEmpty } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockInsertionPoint, isBlockInsertionPointVisible, getBlockCount } = select(store); const blockInsertionPoint = getBlockInsertionPoint(); return { insertionPoint: blockInsertionPoint, isVisible: isBlockInsertionPointVisible(), isBlockListEmpty: getBlockCount(blockInsertionPoint?.rootClientId) === 0 }; }, [] ); if (!isVisible || // Don't render the insertion point if the block list is empty. // The insertion point will be represented by the appender instead. isBlockListEmpty) { return null; } return insertionPoint.operation === "replace" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( drop_zone_default, { ...props }, `${insertionPoint.rootClientId}-${insertionPoint.index}` ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( InbetweenInsertionPointPopover, { operation: insertionPoint.operation, nearestSide: insertionPoint.nearestSide, ...props } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-in-between-inserter.js function useInBetweenInserter() { const openRef = (0,external_wp_element_namespaceObject.useContext)(InsertionPointOpenRef); const isInBetweenInserterDisabled = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).getSettings().isDistractionFree || unlock(select(store)).isZoomOut(), [] ); const { getBlockListSettings, getBlockIndex, isMultiSelecting, getSelectedBlockClientIds, getSettings, getTemplateLock, __unstableIsWithinBlockOverlay, getBlockEditingMode, getBlockName, getBlockAttributes, getParentSectionBlock } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); const { showInsertionPoint, hideInsertionPoint } = (0,external_wp_data_namespaceObject.useDispatch)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { if (isInBetweenInserterDisabled) { return; } function onMouseMove(event) { if (openRef === void 0 || openRef.current) { return; } if (event.target.nodeType === event.target.TEXT_NODE) { return; } if (isMultiSelecting()) { return; } if (!event.target.classList.contains( "block-editor-block-list__layout" )) { hideInsertionPoint(); return; } let rootClientId; if (!event.target.classList.contains("is-root-container")) { const blockElement = !!event.target.getAttribute( "data-block" ) ? event.target : event.target.closest("[data-block]"); rootClientId = blockElement.getAttribute("data-block"); } if (getTemplateLock(rootClientId) || getBlockEditingMode(rootClientId) === "disabled" || getBlockName(rootClientId) === "core/block" || rootClientId && getBlockAttributes(rootClientId).layout?.isManualPlacement) { return; } const blockListSettings = getBlockListSettings(rootClientId); const orientation = blockListSettings?.orientation || "vertical"; const captureToolbars = !!blockListSettings?.__experimentalCaptureToolbars; const offsetTop = event.clientY; const offsetLeft = event.clientX; const children = Array.from(event.target.children); let element = children.find((blockEl) => { const blockElRect = blockEl.getBoundingClientRect(); return blockEl.classList.contains("wp-block") && orientation === "vertical" && blockElRect.top > offsetTop || blockEl.classList.contains("wp-block") && orientation === "horizontal" && ((0,external_wp_i18n_namespaceObject.isRTL)() ? blockElRect.right < offsetLeft : blockElRect.left > offsetLeft); }); if (!element) { hideInsertionPoint(); return; } if (!element.id) { element = element.firstElementChild; if (!element) { hideInsertionPoint(); return; } } const clientId = element.id.slice("block-".length); if (!clientId || __unstableIsWithinBlockOverlay(clientId) || !!getParentSectionBlock(clientId)) { return; } if (getSelectedBlockClientIds().includes(clientId) && orientation === "vertical" && !captureToolbars && !getSettings().hasFixedToolbar) { return; } const elementRect = element.getBoundingClientRect(); if (orientation === "horizontal" && (event.clientY > elementRect.bottom || event.clientY < elementRect.top) || orientation === "vertical" && (event.clientX > elementRect.right || event.clientX < elementRect.left)) { hideInsertionPoint(); return; } const index = getBlockIndex(clientId); if (index === 0) { hideInsertionPoint(); return; } showInsertionPoint(rootClientId, index, { __unstableWithInserter: true }); } node.addEventListener("mousemove", onMouseMove); return () => { node.removeEventListener("mousemove", onMouseMove); }; }, [ openRef, getBlockListSettings, getBlockIndex, isMultiSelecting, showInsertionPoint, hideInsertionPoint, getSelectedBlockClientIds, isInBetweenInserterDisabled ] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-selection-clearer/index.js function useBlockSelectionClearer() { const { getSettings, hasSelectedBlock, hasMultiSelection } = (0,external_wp_data_namespaceObject.useSelect)(store); const { clearSelectedBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { clearBlockSelection: isEnabled } = getSettings(); return (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { if (!isEnabled) { return; } function onMouseDown(event) { if (!hasSelectedBlock() && !hasMultiSelection()) { return; } if (event.target !== node) { return; } clearSelectedBlock(); } node.addEventListener("mousedown", onMouseDown); return () => { node.removeEventListener("mousedown", onMouseDown); }; }, [hasSelectedBlock, hasMultiSelection, clearSelectedBlock, isEnabled] ); } function BlockSelectionClearer(props) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: useBlockSelectionClearer(), ...props }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/button-block-appender.js function ButtonBlockAppender({ showSeparator, isFloating, onAddBlock, isToggle }) { const { clientId } = useBlockEditContext(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( button_block_appender_default, { className: dist_clsx({ "block-list-appender__toggle": isToggle }), rootClientId: clientId, showSeparator, isFloating, onAddBlock } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/default-block-appender.js function default_block_appender_DefaultBlockAppender() { const { clientId } = useBlockEditContext(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultBlockAppender, { rootClientId: clientId }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-nested-settings-update.js const pendingSettingsUpdates = /* @__PURE__ */ new WeakMap(); function createShallowMemo() { let value; return (newValue) => { if (value === void 0 || !external_wp_isShallowEqual_default()(value, newValue)) { value = newValue; } return value; }; } function useShallowMemo(value) { const [memo] = (0,external_wp_element_namespaceObject.useState)(createShallowMemo); return memo(value); } function useNestedSettingsUpdate(clientId, parentLock, allowedBlocks, prioritizedInserterBlocks, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const _allowedBlocks = useShallowMemo(allowedBlocks); const _prioritizedInserterBlocks = useShallowMemo( prioritizedInserterBlocks ); const _templateLock = templateLock === void 0 || parentLock === "contentOnly" ? parentLock : templateLock; (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const newSettings = { allowedBlocks: _allowedBlocks, prioritizedInserterBlocks: _prioritizedInserterBlocks, templateLock: _templateLock }; if (captureToolbars !== void 0) { newSettings.__experimentalCaptureToolbars = captureToolbars; } if (orientation !== void 0) { newSettings.orientation = orientation; } else { const layoutType = getLayoutType(layout?.type); newSettings.orientation = layoutType.getOrientation(layout); } if (__experimentalDefaultBlock !== void 0) { external_wp_deprecated_default()("__experimentalDefaultBlock", { alternative: "defaultBlock", since: "6.3", version: "6.4" }); newSettings.defaultBlock = __experimentalDefaultBlock; } if (defaultBlock !== void 0) { newSettings.defaultBlock = defaultBlock; } if (__experimentalDirectInsert !== void 0) { external_wp_deprecated_default()("__experimentalDirectInsert", { alternative: "directInsert", since: "6.3", version: "6.4" }); newSettings.directInsert = __experimentalDirectInsert; } if (directInsert !== void 0) { newSettings.directInsert = directInsert; } if (newSettings.directInsert !== void 0 && typeof newSettings.directInsert !== "boolean") { external_wp_deprecated_default()("Using `Function` as a `directInsert` argument", { alternative: "`boolean` values", since: "6.5" }); } if (!pendingSettingsUpdates.get(registry)) { pendingSettingsUpdates.set(registry, {}); } pendingSettingsUpdates.get(registry)[clientId] = newSettings; window.queueMicrotask(() => { const settings = pendingSettingsUpdates.get(registry); if (Object.keys(settings).length) { const { updateBlockListSettings } = registry.dispatch(store); updateBlockListSettings(settings); pendingSettingsUpdates.set(registry, {}); } }); }, [ clientId, _allowedBlocks, _prioritizedInserterBlocks, _templateLock, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, captureToolbars, orientation, layout, registry ]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-inner-block-template-sync.js function useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const existingTemplateRef = (0,external_wp_element_namespaceObject.useRef)(null); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { let isCancelled = false; const { getBlocks, getSelectedBlocksInitialCaretPosition, isBlockSelected } = registry.select(store); const { replaceInnerBlocks, __unstableMarkNextChangeAsNotPersistent } = registry.dispatch(store); window.queueMicrotask(() => { if (isCancelled) { return; } const currentInnerBlocks = getBlocks(clientId); const shouldApplyTemplate = currentInnerBlocks.length === 0 || templateLock === "all" || templateLock === "contentOnly"; const hasTemplateChanged = !es6_default()( template, existingTemplateRef.current ); if (!shouldApplyTemplate || !hasTemplateChanged) { return; } existingTemplateRef.current = template; const nextBlocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)( currentInnerBlocks, template ); if (!es6_default()(nextBlocks, currentInnerBlocks)) { __unstableMarkNextChangeAsNotPersistent(); replaceInnerBlocks( clientId, nextBlocks, currentInnerBlocks.length === 0 && templateInsertUpdatesSelection && nextBlocks.length !== 0 && isBlockSelected(clientId), // This ensures the "initialPosition" doesn't change when applying the template // If we're supposed to focus the block, we'll focus the first inner block // otherwise, we won't apply any auto-focus. // This ensures for instance that the focus stays in the inserter when inserting the "buttons" block. getSelectedBlocksInitialCaretPosition() ); } }); return () => { isCancelled = true; }; }, [ template, templateLock, clientId, registry, templateInsertUpdatesSelection ]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-block-context.js function useBlockContext(clientId) { return (0,external_wp_data_namespaceObject.useSelect)( (select) => { const block = select(store).getBlock(clientId); if (!block) { return void 0; } const blockType = select(external_wp_blocks_namespaceObject.store).getBlockType(block.name); if (!blockType) { return void 0; } if (Object.keys(blockType.providesContext).length === 0) { return void 0; } return Object.fromEntries( Object.entries(blockType.providesContext).map( ([contextName, attributeName]) => [ contextName, block.attributes[attributeName] ] ) ); }, [clientId] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/use-on-block-drop/index.js function parseDropEvent(event) { let result = { srcRootClientId: null, srcClientIds: null, srcIndex: null, type: null, blocks: null }; if (!event.dataTransfer) { return result; } try { result = Object.assign( result, JSON.parse(event.dataTransfer.getData("wp-blocks")) ); } catch (err) { return result; } return result; } function onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocks, insertOrReplaceBlocks, clearSelectedBlock, operation, getBlock) { return (event) => { const { srcRootClientId: sourceRootClientId, srcClientIds: sourceClientIds, type: dropType, blocks } = parseDropEvent(event); if (dropType === "inserter") { clearSelectedBlock(); const blocksToInsert = blocks.map( (block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block) ); insertOrReplaceBlocks(blocksToInsert, true, null); } if (dropType === "block") { const sourceBlockIndex = getBlockIndex(sourceClientIds[0]); if (sourceRootClientId === targetRootClientId && sourceBlockIndex === targetBlockIndex) { return; } if (sourceClientIds.includes(targetRootClientId) || getClientIdsOfDescendants(sourceClientIds).some( (id) => id === targetRootClientId )) { return; } if (operation === "group") { const blocksToInsert = sourceClientIds.map( (clientId) => getBlock(clientId) ); insertOrReplaceBlocks( blocksToInsert, true, null, sourceClientIds ); return; } const isAtSameLevel = sourceRootClientId === targetRootClientId; const draggedBlockCount = sourceClientIds.length; const insertIndex = isAtSameLevel && sourceBlockIndex < targetBlockIndex ? targetBlockIndex - draggedBlockCount : targetBlockIndex; moveBlocks(sourceClientIds, sourceRootClientId, insertIndex); } }; } function onFilesDrop(targetRootClientId, getSettings, updateBlockAttributes, canInsertBlockType, insertOrReplaceBlocks) { return (files) => { if (!getSettings().mediaUpload) { return; } const transformation = (0,external_wp_blocks_namespaceObject.findTransform)( (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from"), (transform) => transform.type === "files" && canInsertBlockType(transform.blockName, targetRootClientId) && transform.isMatch(files) ); if (transformation) { const blocks = transformation.transform( files, updateBlockAttributes ); insertOrReplaceBlocks(blocks); } }; } function onHTMLDrop(insertOrReplaceBlocks) { return (HTML) => { const blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({ HTML, mode: "BLOCKS" }); if (blocks.length) { insertOrReplaceBlocks(blocks); } }; } function useOnBlockDrop(targetRootClientId, targetBlockIndex, options = {}) { const { operation = "insert", nearestSide = "right" } = options; const { canInsertBlockType, getBlockIndex, getClientIdsOfDescendants, getBlockOrder, getBlocksByClientId, getSettings, getBlock } = (0,external_wp_data_namespaceObject.useSelect)(store); const { getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const { insertBlocks, moveBlocksToPosition, updateBlockAttributes, clearSelectedBlock, replaceBlocks, removeBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const insertOrReplaceBlocks = (0,external_wp_element_namespaceObject.useCallback)( (blocks, updateSelection = true, initialPosition = 0, clientIdsToReplace = []) => { if (!Array.isArray(blocks)) { blocks = [blocks]; } const clientIds = getBlockOrder(targetRootClientId); const clientId = clientIds[targetBlockIndex]; if (operation === "replace") { replaceBlocks(clientId, blocks, void 0, initialPosition); } else if (operation === "group") { const targetBlock = getBlock(clientId); if (nearestSide === "left") { blocks.push(targetBlock); } else { blocks.unshift(targetBlock); } const groupInnerBlocks = blocks.map((block) => { return (0,external_wp_blocks_namespaceObject.createBlock)( block.name, block.attributes, block.innerBlocks ); }); const areAllImages = blocks.every((block) => { return block.name === "core/image"; }); const galleryBlock = canInsertBlockType( "core/gallery", targetRootClientId ); const wrappedBlocks = (0,external_wp_blocks_namespaceObject.createBlock)( areAllImages && galleryBlock ? "core/gallery" : getGroupingBlockName(), { layout: { type: "flex", flexWrap: areAllImages && galleryBlock ? null : "nowrap" } }, groupInnerBlocks ); replaceBlocks( [clientId, ...clientIdsToReplace], wrappedBlocks, void 0, initialPosition ); } else { insertBlocks( blocks, targetBlockIndex, targetRootClientId, updateSelection, initialPosition ); } }, [ getBlockOrder, targetRootClientId, targetBlockIndex, operation, replaceBlocks, getBlock, nearestSide, canInsertBlockType, getGroupingBlockName, insertBlocks ] ); const moveBlocks = (0,external_wp_element_namespaceObject.useCallback)( (sourceClientIds, sourceRootClientId, insertIndex) => { if (operation === "replace") { const sourceBlocks = getBlocksByClientId(sourceClientIds); const targetBlockClientIds = getBlockOrder(targetRootClientId); const targetBlockClientId = targetBlockClientIds[targetBlockIndex]; registry.batch(() => { removeBlocks(sourceClientIds, false); replaceBlocks( targetBlockClientId, sourceBlocks, void 0, 0 ); }); } else { moveBlocksToPosition( sourceClientIds, sourceRootClientId, targetRootClientId, insertIndex ); } }, [ operation, getBlockOrder, getBlocksByClientId, moveBlocksToPosition, registry, removeBlocks, replaceBlocks, targetBlockIndex, targetRootClientId ] ); const _onDrop = onBlockDrop( targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocks, insertOrReplaceBlocks, clearSelectedBlock, operation, getBlock ); const _onFilesDrop = onFilesDrop( targetRootClientId, getSettings, updateBlockAttributes, canInsertBlockType, insertOrReplaceBlocks ); const _onHTMLDrop = onHTMLDrop(insertOrReplaceBlocks); return (event) => { const files = (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(event.dataTransfer); const html = event.dataTransfer.getData("text/html"); if (html) { _onHTMLDrop(html); } else if (files.length) { _onFilesDrop(files); } else { _onDrop(event); } }; } ;// ./node_modules/@wordpress/block-editor/build-module/utils/math.js function getDistanceFromPointToEdge(point, rect, edge) { const isHorizontal = edge === "top" || edge === "bottom"; const { x, y } = point; const pointLateralPosition = isHorizontal ? x : y; const pointForwardPosition = isHorizontal ? y : x; const edgeStart = isHorizontal ? rect.left : rect.top; const edgeEnd = isHorizontal ? rect.right : rect.bottom; const edgeForwardPosition = rect[edge]; let edgeLateralPosition; if (pointLateralPosition >= edgeStart && pointLateralPosition <= edgeEnd) { edgeLateralPosition = pointLateralPosition; } else if (pointLateralPosition < edgeEnd) { edgeLateralPosition = edgeStart; } else { edgeLateralPosition = edgeEnd; } return Math.sqrt( (pointLateralPosition - edgeLateralPosition) ** 2 + (pointForwardPosition - edgeForwardPosition) ** 2 ); } function getDistanceToNearestEdge(point, rect, allowedEdges = ["top", "bottom", "left", "right"]) { let candidateDistance; let candidateEdge; allowedEdges.forEach((edge) => { const distance = getDistanceFromPointToEdge(point, rect, edge); if (candidateDistance === void 0 || distance < candidateDistance) { candidateDistance = distance; candidateEdge = edge; } }); return [candidateDistance, candidateEdge]; } function isPointContainedByRect(point, rect) { return rect.left <= point.x && rect.right >= point.x && rect.top <= point.y && rect.bottom >= point.y; } function isPointWithinTopAndBottomBoundariesOfRect(point, rect) { return rect.top <= point.y && rect.bottom >= point.y; } ;// ./node_modules/@wordpress/block-editor/build-module/components/use-block-drop-zone/index.js const THRESHOLD_DISTANCE = 30; const MINIMUM_HEIGHT_FOR_THRESHOLD = 120; const MINIMUM_WIDTH_FOR_THRESHOLD = 120; function getDropTargetPosition(blocksData, position, orientation = "vertical", options = {}) { const allowedEdges = orientation === "horizontal" ? ["left", "right"] : ["top", "bottom"]; let nearestIndex = 0; let insertPosition = "before"; let minDistance = Infinity; let targetBlockIndex = null; let nearestSide = "right"; const { dropZoneElement, parentBlockOrientation, rootBlockIndex = 0 } = options; if (dropZoneElement && parentBlockOrientation !== "horizontal") { const rect = dropZoneElement.getBoundingClientRect(); const [distance, edge] = getDistanceToNearestEdge(position, rect, [ "top", "bottom" ]); if (rect.height > MINIMUM_HEIGHT_FOR_THRESHOLD && distance < THRESHOLD_DISTANCE) { if (edge === "top") { return [rootBlockIndex, "before"]; } if (edge === "bottom") { return [rootBlockIndex + 1, "after"]; } } } const isRightToLeft = (0,external_wp_i18n_namespaceObject.isRTL)(); if (dropZoneElement && parentBlockOrientation === "horizontal") { const rect = dropZoneElement.getBoundingClientRect(); const [distance, edge] = getDistanceToNearestEdge(position, rect, [ "left", "right" ]); if (rect.width > MINIMUM_WIDTH_FOR_THRESHOLD && distance < THRESHOLD_DISTANCE) { if (isRightToLeft && edge === "right" || !isRightToLeft && edge === "left") { return [rootBlockIndex, "before"]; } if (isRightToLeft && edge === "left" || !isRightToLeft && edge === "right") { return [rootBlockIndex + 1, "after"]; } } } blocksData.forEach( ({ isUnmodifiedDefaultBlock, getBoundingClientRect, blockIndex, blockOrientation }) => { const rect = getBoundingClientRect(); if (!rect) { return; } let [distance, edge] = getDistanceToNearestEdge( position, rect, allowedEdges ); const [sideDistance, sideEdge] = getDistanceToNearestEdge( position, rect, ["left", "right"] ); const isPointInsideRect = isPointContainedByRect(position, rect); if (isUnmodifiedDefaultBlock && isPointInsideRect) { distance = 0; } else if (orientation === "vertical" && blockOrientation !== "horizontal" && (isPointInsideRect && sideDistance < THRESHOLD_DISTANCE || !isPointInsideRect && isPointWithinTopAndBottomBoundariesOfRect( position, rect ))) { targetBlockIndex = blockIndex; nearestSide = sideEdge; } if (distance < minDistance) { insertPosition = edge === "bottom" || !isRightToLeft && edge === "right" || isRightToLeft && edge === "left" ? "after" : "before"; minDistance = distance; nearestIndex = blockIndex; } } ); const adjacentIndex = nearestIndex + (insertPosition === "after" ? 1 : -1); const isNearestBlockUnmodifiedDefaultBlock = !!blocksData[nearestIndex]?.isUnmodifiedDefaultBlock; const isAdjacentBlockUnmodifiedDefaultBlock = !!blocksData[adjacentIndex]?.isUnmodifiedDefaultBlock; if (targetBlockIndex !== null) { return [targetBlockIndex, "group", nearestSide]; } if (!isNearestBlockUnmodifiedDefaultBlock && !isAdjacentBlockUnmodifiedDefaultBlock) { const insertionIndex = insertPosition === "after" ? nearestIndex + 1 : nearestIndex; return [insertionIndex, "insert"]; } return [ isNearestBlockUnmodifiedDefaultBlock ? nearestIndex : adjacentIndex, "replace" ]; } function isDropTargetValid(getBlockType, allowedBlocks, draggedBlockNames, targetBlockName) { let areBlocksAllowed = true; if (allowedBlocks) { const allowedBlockNames = allowedBlocks?.map(({ name }) => name); areBlocksAllowed = draggedBlockNames.every( (name) => allowedBlockNames?.includes(name) ); } const draggedBlockTypes = draggedBlockNames.map( (name) => getBlockType(name) ); const targetMatchesDraggedBlockParents = draggedBlockTypes.every( (block) => { const [allowedParentName] = block?.parent || []; if (!allowedParentName) { return true; } return allowedParentName === targetBlockName; } ); return areBlocksAllowed && targetMatchesDraggedBlockParents; } function isInsertionPoint(targetToCheck, ownerDocument) { const { defaultView } = ownerDocument; return !!(defaultView && targetToCheck instanceof defaultView.HTMLElement && targetToCheck.closest("[data-is-insertion-point]")); } function useBlockDropZone({ dropZoneElement, // An undefined value represents a top-level block. Default to an empty // string for this so that `targetRootClientId` can be easily compared to // values returned by the `getRootBlockClientId` selector, which also uses // an empty string to represent top-level blocks. rootClientId: targetRootClientId = "", parentClientId: parentBlockClientId = "", isDisabled = false } = {}) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const [dropTarget, setDropTarget] = (0,external_wp_element_namespaceObject.useState)({ index: null, operation: "insert" }); const { getBlockType, getBlockVariations, getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const { canInsertBlockType, getBlockListSettings, getBlocks, getBlockIndex, getDraggedBlockClientIds, getBlockNamesByClientId, getAllowedBlocks, isDragging, isGroupable, isZoomOut, getSectionRootClientId, getBlockParents } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); const { showInsertionPoint, hideInsertionPoint, startDragging, stopDragging } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const onBlockDrop = useOnBlockDrop( dropTarget.operation === "before" || dropTarget.operation === "after" ? parentBlockClientId : targetRootClientId, dropTarget.index, { operation: dropTarget.operation, nearestSide: dropTarget.nearestSide } ); const throttled = (0,external_wp_compose_namespaceObject.useThrottle)( (0,external_wp_element_namespaceObject.useCallback)( (event, ownerDocument) => { if (!isDragging()) { startDragging(); } const draggedBlockClientIds = getDraggedBlockClientIds(); const targetParents = [ targetRootClientId, ...getBlockParents(targetRootClientId, true) ]; const isTargetWithinDraggedBlocks = draggedBlockClientIds.some( (clientId) => targetParents.includes(clientId) ); if (isTargetWithinDraggedBlocks) { return; } const allowedBlocks = getAllowedBlocks(targetRootClientId); const targetBlockName = getBlockNamesByClientId([ targetRootClientId ])[0]; const draggedBlockNames = getBlockNamesByClientId( draggedBlockClientIds ); const isBlockDroppingAllowed = isDropTargetValid( getBlockType, allowedBlocks, draggedBlockNames, targetBlockName ); if (!isBlockDroppingAllowed) { return; } const sectionRootClientId = getSectionRootClientId(); if (isZoomOut() && sectionRootClientId !== targetRootClientId) { return; } const blocks = getBlocks(targetRootClientId).filter((block) => { return !((0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "visibility", true) && block.attributes?.metadata?.blockVisibility === false); }); if (blocks.length === 0) { registry.batch(() => { setDropTarget({ index: 0, operation: "insert" }); showInsertionPoint(targetRootClientId, 0, { operation: "insert" }); }); return; } const blocksData = blocks.map((block) => { const clientId = block.clientId; return { isUnmodifiedDefaultBlock: (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block), getBoundingClientRect: () => { const blockElement = ownerDocument.getElementById( `block-${clientId}` ); return blockElement ? blockElement.getBoundingClientRect() : null; }, blockIndex: getBlockIndex(clientId), blockOrientation: getBlockListSettings(clientId)?.orientation }; }); const dropTargetPosition = getDropTargetPosition( blocksData, { x: event.clientX, y: event.clientY }, getBlockListSettings(targetRootClientId)?.orientation, { dropZoneElement, parentBlockClientId, parentBlockOrientation: parentBlockClientId ? getBlockListSettings(parentBlockClientId)?.orientation : void 0, rootBlockIndex: getBlockIndex(targetRootClientId) } ); const [targetIndex, operation, nearestSide] = dropTargetPosition; const isTargetIndexEmptyDefaultBlock = blocksData[targetIndex]?.isUnmodifiedDefaultBlock; if (isZoomOut() && !isTargetIndexEmptyDefaultBlock && operation !== "insert") { return; } if (operation === "group") { const targetBlock = blocks[targetIndex]; const areAllImages = [ targetBlock.name, ...draggedBlockNames ].every((name) => name === "core/image"); const canInsertGalleryBlock = canInsertBlockType( "core/gallery", targetRootClientId ); const areGroupableBlocks = isGroupable([ targetBlock.clientId, getDraggedBlockClientIds() ]); const groupBlockVariations = getBlockVariations( getGroupingBlockName(), "block" ); const canInsertRow = groupBlockVariations && groupBlockVariations.find( ({ name }) => name === "group-row" ); if (areAllImages && !canInsertGalleryBlock && (!areGroupableBlocks || !canInsertRow)) { return; } if (!areAllImages && (!areGroupableBlocks || !canInsertRow)) { return; } } registry.batch(() => { setDropTarget({ index: targetIndex, operation, nearestSide }); const insertionPointClientId = [ "before", "after" ].includes(operation) ? parentBlockClientId : targetRootClientId; showInsertionPoint(insertionPointClientId, targetIndex, { operation, nearestSide }); }); }, [ isDragging, getAllowedBlocks, targetRootClientId, getBlockNamesByClientId, getDraggedBlockClientIds, getBlockType, getSectionRootClientId, isZoomOut, getBlocks, getBlockListSettings, dropZoneElement, parentBlockClientId, getBlockIndex, registry, startDragging, showInsertionPoint, canInsertBlockType, isGroupable, getBlockVariations, getGroupingBlockName ] ), 200 ); return (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({ dropZoneElement, isDisabled, onDrop: onBlockDrop, onDragOver(event) { throttled(event, event.currentTarget.ownerDocument); }, onDragLeave(event) { const { ownerDocument } = event.currentTarget; if (isInsertionPoint(event.relatedTarget, ownerDocument) || isInsertionPoint(event.target, ownerDocument)) { return; } throttled.cancel(); hideInsertionPoint(); }, onDragEnd() { throttled.cancel(); stopDragging(); hideInsertionPoint(); } }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/index.js const inner_blocks_EMPTY_OBJECT = {}; function BlockContext({ children, clientId }) { const context = useBlockContext(clientId); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockContextProvider, { value: context, children }); } const BlockListItemsMemo = (0,external_wp_element_namespaceObject.memo)(BlockListItems); function UncontrolledInnerBlocks(props) { const { clientId, allowedBlocks, prioritizedInserterBlocks, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, template, templateLock, wrapperRef, templateInsertUpdatesSelection, __experimentalCaptureToolbars: captureToolbars, __experimentalAppenderTagName, renderAppender, orientation, placeholder, layout, name, blockType, parentLock, defaultLayout } = props; useNestedSettingsUpdate( clientId, parentLock, allowedBlocks, prioritizedInserterBlocks, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout ); useInnerBlockTemplateSync( clientId, template, templateLock, templateInsertUpdatesSelection ); const defaultLayoutBlockSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "layout") || (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "__experimentalLayout") || inner_blocks_EMPTY_OBJECT; const { allowSizingOnChildren = false } = defaultLayoutBlockSupport; const usedLayout = layout || defaultLayoutBlockSupport; const memoedLayout = (0,external_wp_element_namespaceObject.useMemo)( () => ({ // Default layout will know about any content/wide size defined by the theme. ...defaultLayout, ...usedLayout, ...allowSizingOnChildren && { allowSizingOnChildren: true } }), [defaultLayout, usedLayout, allowSizingOnChildren] ); const items = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockListItemsMemo, { rootClientId: clientId, renderAppender, __experimentalAppenderTagName, layout: memoedLayout, wrapperRef, placeholder } ); if (!blockType?.providesContext || Object.keys(blockType.providesContext).length === 0) { return items; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockContext, { clientId, children: items }); } function ControlledInnerBlocks(props) { useBlockSync(props); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(UncontrolledInnerBlocks, { ...props }); } const ForwardedInnerBlocks = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { const innerBlocksProps = useInnerBlocksProps({ ref }, props); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inner-blocks", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps }) }); }); function useInnerBlocksProps(props = {}, options = {}) { const { __unstableDisableLayoutClassNames, __unstableDisableDropZone, dropZoneElement } = options; const { clientId, layout = null, __unstableLayoutClassNames: layoutClassNames = "" } = useBlockEditContext(); const selected = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockName, isZoomOut, getTemplateLock, getBlockRootClientId, getBlockEditingMode, getBlockSettings, getSectionRootClientId } = unlock(select(store)); if (!clientId) { const sectionRootClientId = getSectionRootClientId(); return { isDropZoneDisabled: isZoomOut() && sectionRootClientId !== "" }; } const { hasBlockSupport, getBlockType } = select(external_wp_blocks_namespaceObject.store); const blockName = getBlockName(clientId); const blockEditingMode = getBlockEditingMode(clientId); const parentClientId2 = getBlockRootClientId(clientId); const [defaultLayout2] = getBlockSettings(clientId, "layout"); let _isDropZoneDisabled = blockEditingMode === "disabled"; if (isZoomOut()) { const sectionRootClientId = getSectionRootClientId(); _isDropZoneDisabled = clientId !== sectionRootClientId; } return { __experimentalCaptureToolbars: hasBlockSupport( blockName, "__experimentalExposeControlsToChildren", false ), name: blockName, blockType: getBlockType(blockName), parentLock: getTemplateLock(parentClientId2), parentClientId: parentClientId2, isDropZoneDisabled: _isDropZoneDisabled, defaultLayout: defaultLayout2 }; }, [clientId] ); const { __experimentalCaptureToolbars, name, blockType, parentLock, parentClientId, isDropZoneDisabled, defaultLayout } = selected; const blockDropZoneRef = useBlockDropZone({ dropZoneElement, rootClientId: clientId, parentClientId }); const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([ props.ref, __unstableDisableDropZone || isDropZoneDisabled || layout?.isManualPlacement && window.__experimentalEnableGridInteractivity ? null : blockDropZoneRef ]); const innerBlocksProps = { __experimentalCaptureToolbars, layout, name, blockType, parentLock, defaultLayout, ...options }; const InnerBlocks = innerBlocksProps.value && innerBlocksProps.onChange ? ControlledInnerBlocks : UncontrolledInnerBlocks; return { ...props, ref, className: dist_clsx( props.className, "block-editor-block-list__layout", __unstableDisableLayoutClassNames ? "" : layoutClassNames ), children: clientId ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InnerBlocks, { ...innerBlocksProps, clientId }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListItems, { ...options }) }; } useInnerBlocksProps.save = external_wp_blocks_namespaceObject.__unstableGetInnerBlocksProps; ForwardedInnerBlocks.DefaultBlockAppender = default_block_appender_DefaultBlockAppender; ForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender; ForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children; var inner_blocks_default = ForwardedInnerBlocks; ;// ./node_modules/@wordpress/block-editor/build-module/components/observe-typing/index.js const KEY_DOWN_ELIGIBLE_KEY_CODES = /* @__PURE__ */ new Set([ external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.RIGHT, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.ENTER, external_wp_keycodes_namespaceObject.BACKSPACE ]); function isKeyDownEligibleForStartTyping(event) { const { keyCode, shiftKey } = event; return !shiftKey && KEY_DOWN_ELIGIBLE_KEY_CODES.has(keyCode); } function useMouseMoveTypingReset() { const isTyping = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).isTyping(), [] ); const { stopTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { if (!isTyping) { return; } const { ownerDocument } = node; let lastClientX; let lastClientY; function stopTypingOnMouseMove(event) { const { clientX, clientY } = event; if (lastClientX && lastClientY && (lastClientX !== clientX || lastClientY !== clientY)) { stopTyping(); } lastClientX = clientX; lastClientY = clientY; } ownerDocument.addEventListener( "mousemove", stopTypingOnMouseMove ); return () => { ownerDocument.removeEventListener( "mousemove", stopTypingOnMouseMove ); }; }, [isTyping, stopTyping] ); } function useTypingObserver() { const { isTyping } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { isTyping: _isTyping } = select(store); return { isTyping: _isTyping() }; }, []); const { startTyping, stopTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store); const ref1 = useMouseMoveTypingReset(); const ref2 = (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { const { ownerDocument } = node; const { defaultView } = ownerDocument; const selection = defaultView.getSelection(); if (isTyping) { let stopTypingOnNonTextField2 = function(event) { const { target } = event; timerId = defaultView.setTimeout(() => { if (!(0,external_wp_dom_namespaceObject.isTextField)(target)) { stopTyping(); } }); }, stopTypingOnEscapeKey2 = function(event) { const { keyCode } = event; if (keyCode === external_wp_keycodes_namespaceObject.ESCAPE || keyCode === external_wp_keycodes_namespaceObject.TAB) { stopTyping(); } }, stopTypingOnSelectionUncollapse2 = function() { if (!selection.isCollapsed) { stopTyping(); } }; var stopTypingOnNonTextField = stopTypingOnNonTextField2, stopTypingOnEscapeKey = stopTypingOnEscapeKey2, stopTypingOnSelectionUncollapse = stopTypingOnSelectionUncollapse2; let timerId; node.addEventListener("focus", stopTypingOnNonTextField2); node.addEventListener("keydown", stopTypingOnEscapeKey2); ownerDocument.addEventListener( "selectionchange", stopTypingOnSelectionUncollapse2 ); return () => { defaultView.clearTimeout(timerId); node.removeEventListener( "focus", stopTypingOnNonTextField2 ); node.removeEventListener( "keydown", stopTypingOnEscapeKey2 ); ownerDocument.removeEventListener( "selectionchange", stopTypingOnSelectionUncollapse2 ); }; } function startTypingInTextField(event) { const { type, target } = event; if (!(0,external_wp_dom_namespaceObject.isTextField)(target) || !node.contains(target)) { return; } if (type === "keydown" && !isKeyDownEligibleForStartTyping(event)) { return; } startTyping(); } node.addEventListener("keypress", startTypingInTextField); node.addEventListener("keydown", startTypingInTextField); return () => { node.removeEventListener("keypress", startTypingInTextField); node.removeEventListener("keydown", startTypingInTextField); }; }, [isTyping, startTyping, stopTyping] ); return (0,external_wp_compose_namespaceObject.useMergeRefs)([ref1, ref2]); } function ObserveTyping({ children }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: useTypingObserver(), children }); } var observe_typing_default = ObserveTyping; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/zoom-out-separator.js function ZoomOutSeparator({ clientId, rootClientId = "", position = "top" }) { const [isDraggedOver, setIsDraggedOver] = (0,external_wp_element_namespaceObject.useState)(false); const { sectionRootClientId, sectionClientIds, insertionPoint, blockInsertionPointVisible, blockInsertionPoint, blocksBeingDragged } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getInsertionPoint, getBlockOrder, getSectionRootClientId, isBlockInsertionPointVisible, getBlockInsertionPoint, getDraggedBlockClientIds } = unlock(select(store)); const root = getSectionRootClientId(); const sectionRootClientIds = getBlockOrder(root); return { sectionRootClientId: root, sectionClientIds: sectionRootClientIds, insertionPoint: getInsertionPoint(), blockInsertionPoint: getBlockInsertionPoint(), blockInsertionPointVisible: isBlockInsertionPointVisible(), blocksBeingDragged: getDraggedBlockClientIds() }; }, []); const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); if (!clientId) { return; } let isVisible = false; const isSectionBlock = rootClientId === sectionRootClientId && sectionClientIds && sectionClientIds.includes(clientId); if (!isSectionBlock) { return null; } const hasTopInsertionPoint = insertionPoint?.index === 0 && clientId === sectionClientIds[insertionPoint.index]; const hasBottomInsertionPoint = insertionPoint && insertionPoint.hasOwnProperty("index") && clientId === sectionClientIds[insertionPoint.index - 1]; if (position === "top") { isVisible = hasTopInsertionPoint || blockInsertionPointVisible && blockInsertionPoint.index === 0 && clientId === sectionClientIds[blockInsertionPoint.index]; } if (position === "bottom") { isVisible = hasBottomInsertionPoint || blockInsertionPointVisible && clientId === sectionClientIds[blockInsertionPoint.index - 1]; } const blockBeingDraggedClientId = blocksBeingDragged[0]; const isCurrentBlockBeingDragged = blocksBeingDragged.includes(clientId); const blockBeingDraggedIndex = sectionClientIds.indexOf( blockBeingDraggedClientId ); const blockBeingDraggedPreviousSiblingClientId = blockBeingDraggedIndex > 0 ? sectionClientIds[blockBeingDraggedIndex - 1] : null; const isCurrentBlockPreviousSiblingOfBlockBeingDragged = blockBeingDraggedPreviousSiblingClientId === clientId; if (isCurrentBlockBeingDragged || isCurrentBlockPreviousSiblingOfBlockBeingDragged) { isVisible = false; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { children: isVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { initial: { height: 0 }, animate: { // Use a height equal to that of the zoom out frame size. height: "calc(1 * var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale)" }, exit: { height: 0 }, transition: { type: "tween", duration: isReducedMotion ? 0 : 0.2, ease: [0.6, 0, 0.4, 1] }, className: dist_clsx( "block-editor-block-list__zoom-out-separator", { "is-dragged-over": isDraggedOver } ), "data-is-insertion-point": "true", onDragOver: () => setIsDraggedOver(true), onDragLeave: () => setIsDraggedOver(false), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0, transition: { delay: -0.125 } }, transition: { ease: "linear", duration: 0.1, delay: 0.125 }, children: (0,external_wp_i18n_namespaceObject.__)("Drop pattern.") } ) } ) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/index.js const block_list_IntersectionObserver = (0,external_wp_element_namespaceObject.createContext)(); block_list_IntersectionObserver.displayName = "IntersectionObserverContext"; const pendingBlockVisibilityUpdatesPerRegistry = /* @__PURE__ */ new WeakMap(); const delayedBlockVisibilityDebounceOptions = { trailing: true }; function Root({ className, ...settings }) { const { isOutlineMode, isFocusMode, temporarilyEditingAsBlocks } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSettings, getTemporarilyEditingAsBlocks, isTyping, hasBlockSpotlight } = unlock(select(store)); const { outlineMode, focusMode } = getSettings(); return { isOutlineMode: outlineMode && !isTyping(), isFocusMode: focusMode || hasBlockSpotlight(), temporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks() }; }, []); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { setBlockVisibility } = (0,external_wp_data_namespaceObject.useDispatch)(store); const delayedBlockVisibilityUpdates = (0,external_wp_compose_namespaceObject.useDebounce)( (0,external_wp_element_namespaceObject.useCallback)(() => { const updates = {}; pendingBlockVisibilityUpdatesPerRegistry.get(registry).forEach(([id, isIntersecting]) => { updates[id] = isIntersecting; }); setBlockVisibility(updates); }, [registry]), 300, delayedBlockVisibilityDebounceOptions ); const intersectionObserver = (0,external_wp_element_namespaceObject.useMemo)(() => { const { IntersectionObserver: Observer } = window; if (!Observer) { return; } return new Observer((entries) => { if (!pendingBlockVisibilityUpdatesPerRegistry.get(registry)) { pendingBlockVisibilityUpdatesPerRegistry.set(registry, []); } for (const entry of entries) { const clientId = entry.target.getAttribute("data-block"); pendingBlockVisibilityUpdatesPerRegistry.get(registry).push([clientId, entry.isIntersecting]); } delayedBlockVisibilityUpdates(); }); }, []); const innerBlocksProps = useInnerBlocksProps( { ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ useBlockSelectionClearer(), useInBetweenInserter(), useTypingObserver() ]), className: dist_clsx("is-root-container", className, { "is-outline-mode": isOutlineMode, "is-focus-mode": isFocusMode }) }, settings ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_list_IntersectionObserver.Provider, { value: intersectionObserver, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps }), !!temporarilyEditingAsBlocks && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( StopEditingAsBlocksOnOutsideSelect, { clientId: temporarilyEditingAsBlocks } ) ] }); } function StopEditingAsBlocksOnOutsideSelect({ clientId }) { const { stopEditingAsBlocks } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const isBlockOrDescendantSelected = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { isBlockSelected, hasSelectedInnerBlock } = select(store); return isBlockSelected(clientId) || hasSelectedInnerBlock(clientId, true); }, [clientId] ); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isBlockOrDescendantSelected) { stopEditingAsBlocks(clientId); } }, [isBlockOrDescendantSelected, clientId, stopEditingAsBlocks]); return null; } function BlockList(settings) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { value: DEFAULT_BLOCK_EDIT_CONTEXT, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Root, { ...settings }) }); } const block_list_EMPTY_ARRAY = []; const block_list_EMPTY_SET = /* @__PURE__ */ new Set(); function Items({ placeholder, rootClientId, renderAppender: CustomAppender, __experimentalAppenderTagName, layout = defaultLayout }) { const hasAppender = CustomAppender !== false; const hasCustomAppender = !!CustomAppender; const { order, isZoomOut, selectedBlocks, visibleBlocks, shouldRenderAppender } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getSettings, getBlockOrder, getSelectedBlockClientIds, __unstableGetVisibleBlocks, getTemplateLock, getBlockEditingMode, isSectionBlock, isContainerInsertableToInContentOnlyMode, getBlockName, isZoomOut: _isZoomOut, canInsertBlockType } = unlock(select(store)); const _order = getBlockOrder(rootClientId); if (getSettings().isPreviewMode) { return { order: _order, selectedBlocks: block_list_EMPTY_ARRAY, visibleBlocks: block_list_EMPTY_SET }; } const selectedBlockClientIds = getSelectedBlockClientIds(); const selectedBlockClientId = selectedBlockClientIds[0]; const showRootAppender = !rootClientId && !selectedBlockClientId && (!_order.length || !canInsertBlockType( (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(), rootClientId )); const hasSelectedRoot = !!(rootClientId && selectedBlockClientId && rootClientId === selectedBlockClientId); return { order: _order, selectedBlocks: selectedBlockClientIds, visibleBlocks: __unstableGetVisibleBlocks(), isZoomOut: _isZoomOut(), shouldRenderAppender: (!isSectionBlock(rootClientId) || isContainerInsertableToInContentOnlyMode( getBlockName(selectedBlockClientId), rootClientId )) && getBlockEditingMode(rootClientId) !== "disabled" && !getTemplateLock(rootClientId) && hasAppender && !_isZoomOut() && (hasCustomAppender || hasSelectedRoot || showRootAppender) }; }, [rootClientId, hasAppender, hasCustomAppender] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(LayoutProvider, { value: layout, children: [ order.map((clientId) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_data_namespaceObject.AsyncModeProvider, { value: ( // Only provide data asynchronously if the block is // not visible and not selected. !visibleBlocks.has(clientId) && !selectedBlocks.includes(clientId) ), children: [ isZoomOut && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ZoomOutSeparator, { clientId, rootClientId, position: "top" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_default, { rootClientId, clientId } ), isZoomOut && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ZoomOutSeparator, { clientId, rootClientId, position: "bottom" } ) ] }, clientId )), order.length < 1 && placeholder, shouldRenderAppender && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockListAppender, { tagName: __experimentalAppenderTagName, rootClientId, CustomAppender } ) ] }); } function BlockListItems(props) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.AsyncModeProvider, { value: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Items, { ...props }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-multi-selection.js function selector(select) { const { isMultiSelecting, getMultiSelectedBlockClientIds, hasMultiSelection, getSelectedBlockClientId, getSelectedBlocksInitialCaretPosition, __unstableIsFullySelected } = select(store); return { isMultiSelecting: isMultiSelecting(), multiSelectedBlockClientIds: getMultiSelectedBlockClientIds(), hasMultiSelection: hasMultiSelection(), selectedBlockClientId: getSelectedBlockClientId(), initialPosition: getSelectedBlocksInitialCaretPosition(), isFullSelection: __unstableIsFullySelected() }; } function useMultiSelection() { const { initialPosition, isMultiSelecting, multiSelectedBlockClientIds, hasMultiSelection, selectedBlockClientId, isFullSelection } = (0,external_wp_data_namespaceObject.useSelect)(selector, []); return (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { const { ownerDocument } = node; const { defaultView } = ownerDocument; if (initialPosition === void 0 || initialPosition === null) { return; } if (!hasMultiSelection || isMultiSelecting) { return; } const { length } = multiSelectedBlockClientIds; if (length < 2) { return; } if (!isFullSelection) { return; } node.contentEditable = true; node.focus(); defaultView.getSelection().removeAllRanges(); }, [ hasMultiSelection, isMultiSelecting, multiSelectedBlockClientIds, selectedBlockClientId, initialPosition, isFullSelection ] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-tab-nav.js function useTabNav() { const containerRef = ( /** @type {typeof useRef<HTMLElement>} */ (0,external_wp_element_namespaceObject.useRef)() ); const focusCaptureBeforeRef = (0,external_wp_element_namespaceObject.useRef)(); const focusCaptureAfterRef = (0,external_wp_element_namespaceObject.useRef)(); const { hasMultiSelection, getSelectedBlockClientId, getBlockCount, getBlockOrder, getLastFocus, getSectionRootClientId, isZoomOut } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); const { setLastFocus } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const noCaptureRef = (0,external_wp_element_namespaceObject.useRef)(); function onFocusCapture(event) { const canvasElement = containerRef.current.ownerDocument === event.target.ownerDocument ? containerRef.current : containerRef.current.ownerDocument.defaultView.frameElement; if (noCaptureRef.current) { noCaptureRef.current = null; } else if (hasMultiSelection()) { containerRef.current.focus(); } else if (getSelectedBlockClientId()) { if (getLastFocus()?.current) { getLastFocus().current.focus(); } else { containerRef.current.querySelector( `[data-block="${getSelectedBlockClientId()}"]` ).focus(); } } else if (isZoomOut()) { const sectionRootClientId = getSectionRootClientId(); const sectionBlocks = getBlockOrder(sectionRootClientId); if (sectionBlocks.length) { containerRef.current.querySelector(`[data-block="${sectionBlocks[0]}"]`).focus(); } else if (sectionRootClientId) { containerRef.current.querySelector(`[data-block="${sectionRootClientId}"]`).focus(); } else { canvasElement.focus(); } } else { const isBefore = ( // eslint-disable-next-line no-bitwise event.target.compareDocumentPosition(canvasElement) & event.target.DOCUMENT_POSITION_FOLLOWING ); const tabbables = external_wp_dom_namespaceObject.focus.tabbable.find(containerRef.current); if (tabbables.length) { const next = isBefore ? tabbables[0] : tabbables[tabbables.length - 1]; next.focus(); } } } const before = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { ref: focusCaptureBeforeRef, tabIndex: "0", onFocus: onFocusCapture } ); const after = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { ref: focusCaptureAfterRef, tabIndex: "0", onFocus: onFocusCapture } ); const ref = (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { function onKeyDown(event) { if (event.defaultPrevented) { return; } if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) { return; } if ( // Bails in case the focus capture elements aren’t present. They // may be omitted to avoid silent tab stops in preview mode. // See: https://github.com/WordPress/gutenberg/pull/59317 !focusCaptureAfterRef.current || !focusCaptureBeforeRef.current ) { return; } const { target, shiftKey: isShift } = event; const direction = isShift ? "findPrevious" : "findNext"; const nextTabbable = external_wp_dom_namespaceObject.focus.tabbable[direction](target); const currentBlock = target.closest("[data-block]"); const isElementPartOfSelectedBlock = currentBlock && nextTabbable && (isInSameBlock(currentBlock, nextTabbable) || isInsideRootBlock(currentBlock, nextTabbable)); if ((0,external_wp_dom_namespaceObject.isFormElement)(nextTabbable) && isElementPartOfSelectedBlock) { return; } const next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef; noCaptureRef.current = true; next.current.focus({ preventScroll: true }); } function onFocusOut(event) { setLastFocus({ ...getLastFocus(), current: event.target }); const { ownerDocument: ownerDocument2 } = node; if (!event.relatedTarget && event.target.hasAttribute("data-block") && ownerDocument2.activeElement === ownerDocument2.body && getBlockCount() === 0) { node.focus(); } } function preventScrollOnTab(event) { if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) { return; } if (event.target?.getAttribute("role") === "region") { return; } if (containerRef.current === event.target) { return; } const isShift = event.shiftKey; const direction = isShift ? "findPrevious" : "findNext"; const target = external_wp_dom_namespaceObject.focus.tabbable[direction](event.target); if (target === focusCaptureBeforeRef.current || target === focusCaptureAfterRef.current) { event.preventDefault(); target.focus({ preventScroll: true }); } } const { ownerDocument } = node; const { defaultView } = ownerDocument; defaultView.addEventListener("keydown", preventScrollOnTab); node.addEventListener("keydown", onKeyDown); node.addEventListener("focusout", onFocusOut); return () => { defaultView.removeEventListener("keydown", preventScrollOnTab); node.removeEventListener("keydown", onKeyDown); node.removeEventListener("focusout", onFocusOut); }; }, []); const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([containerRef, ref]); return [before, mergedRefs, after]; } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-arrow-nav.js function isNavigationCandidate(element, keyCode, hasModifier) { const isVertical = keyCode === external_wp_keycodes_namespaceObject.UP || keyCode === external_wp_keycodes_namespaceObject.DOWN; const { tagName } = element; const elementType = element.getAttribute("type"); if (isVertical && !hasModifier) { if (tagName === "INPUT") { const verticalInputTypes = [ "date", "datetime-local", "month", "number", "range", "time", "week" ]; return !verticalInputTypes.includes(elementType); } return true; } if (tagName === "INPUT") { const simpleInputTypes = [ "button", "checkbox", "number", "color", "file", "image", "radio", "reset", "submit" ]; return simpleInputTypes.includes(elementType); } return tagName !== "TEXTAREA"; } function getClosestTabbable(target, isReverse, containerElement, onlyVertical) { let focusableNodes = external_wp_dom_namespaceObject.focus.focusable.find(containerElement); if (isReverse) { focusableNodes.reverse(); } focusableNodes = focusableNodes.slice( focusableNodes.indexOf(target) + 1 ); let targetRect; if (onlyVertical) { targetRect = target.getBoundingClientRect(); } function isTabCandidate(node) { if (node.closest("[inert]")) { return; } if (node.children.length === 1 && isInSameBlock(node, node.firstElementChild) && node.firstElementChild.getAttribute("contenteditable") === "true") { return; } if (!external_wp_dom_namespaceObject.focus.tabbable.isTabbableIndex(node)) { return false; } if (node.isContentEditable && node.contentEditable !== "true") { return false; } if (onlyVertical) { const nodeRect = node.getBoundingClientRect(); if (nodeRect.left >= targetRect.right || nodeRect.right <= targetRect.left) { return false; } } return true; } return focusableNodes.find(isTabCandidate); } function useArrowNav() { const { getMultiSelectedBlocksStartClientId, getMultiSelectedBlocksEndClientId, getSettings, hasMultiSelection, __unstableIsFullySelected } = (0,external_wp_data_namespaceObject.useSelect)(store); const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { let verticalRect; function onMouseDown() { verticalRect = null; } function isClosestTabbableABlock(target, isReverse) { const closestTabbable = getClosestTabbable( target, isReverse, node ); return closestTabbable && getBlockClientId(closestTabbable); } function onKeyDown(event) { if (event.defaultPrevented) { return; } const { keyCode, target, shiftKey, ctrlKey, altKey, metaKey } = event; const isUp = keyCode === external_wp_keycodes_namespaceObject.UP; const isDown = keyCode === external_wp_keycodes_namespaceObject.DOWN; const isLeft = keyCode === external_wp_keycodes_namespaceObject.LEFT; const isRight = keyCode === external_wp_keycodes_namespaceObject.RIGHT; const isReverse = isUp || isLeft; const isHorizontal = isLeft || isRight; const isVertical = isUp || isDown; const isNav = isHorizontal || isVertical; const hasModifier = shiftKey || ctrlKey || altKey || metaKey; const isNavEdge = isVertical ? external_wp_dom_namespaceObject.isVerticalEdge : external_wp_dom_namespaceObject.isHorizontalEdge; const { ownerDocument } = node; const { defaultView } = ownerDocument; if (!isNav) { return; } if (hasMultiSelection()) { if (shiftKey) { return; } if (!__unstableIsFullySelected()) { return; } event.preventDefault(); if (isReverse) { selectBlock(getMultiSelectedBlocksStartClientId()); } else { selectBlock(getMultiSelectedBlocksEndClientId(), -1); } return; } if (!isNavigationCandidate(target, keyCode, hasModifier)) { return; } if (!isVertical) { verticalRect = null; } else if (!verticalRect) { verticalRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView); } const isReverseDir = (0,external_wp_dom_namespaceObject.isRTL)(target) ? !isReverse : isReverse; const { keepCaretInsideBlock } = getSettings(); if (shiftKey) { if (isClosestTabbableABlock(target, isReverse) && isNavEdge(target, isReverse)) { node.contentEditable = true; node.focus(); } } else if (isVertical && (0,external_wp_dom_namespaceObject.isVerticalEdge)(target, isReverse) && // When Alt is pressed, only intercept if the caret is also at // the horizontal edge. (altKey ? (0,external_wp_dom_namespaceObject.isHorizontalEdge)(target, isReverseDir) : true) && !keepCaretInsideBlock) { const closestTabbable = getClosestTabbable( target, isReverse, node, true ); if (closestTabbable) { (0,external_wp_dom_namespaceObject.placeCaretAtVerticalEdge)( closestTabbable, // When Alt is pressed, place the caret at the furthest // horizontal edge and the furthest vertical edge. altKey ? !isReverse : isReverse, altKey ? void 0 : verticalRect ); event.preventDefault(); } } else if (isHorizontal && defaultView.getSelection().isCollapsed && (0,external_wp_dom_namespaceObject.isHorizontalEdge)(target, isReverseDir) && !keepCaretInsideBlock) { const closestTabbable = getClosestTabbable( target, isReverseDir, node ); (0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(closestTabbable, isReverse); event.preventDefault(); } } node.addEventListener("mousedown", onMouseDown); node.addEventListener("keydown", onKeyDown); return () => { node.removeEventListener("mousedown", onMouseDown); node.removeEventListener("keydown", onKeyDown); }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-select-all.js function useSelectAll() { const { getBlockOrder, getSelectedBlockClientIds, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { multiSelect, selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { function onKeyDown(event) { if (!isMatch("core/block-editor/select-all", event)) { return; } const selectedClientIds = getSelectedBlockClientIds(); if (selectedClientIds.length < 2 && !(0,external_wp_dom_namespaceObject.isEntirelySelected)(event.target)) { return; } event.preventDefault(); const [firstSelectedClientId] = selectedClientIds; const rootClientId = getBlockRootClientId(firstSelectedClientId); const blockClientIds = getBlockOrder(rootClientId); if (selectedClientIds.length === blockClientIds.length) { if (rootClientId) { node.ownerDocument.defaultView.getSelection().removeAllRanges(); selectBlock(rootClientId); } return; } multiSelect( blockClientIds[0], blockClientIds[blockClientIds.length - 1] ); } node.addEventListener("keydown", onKeyDown); return () => { node.removeEventListener("keydown", onKeyDown); }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-drag-selection.js function setContentEditableWrapper(node, value) { node.contentEditable = value; if (value) { node.focus(); } } function useDragSelection() { const { startMultiSelect, stopMultiSelect } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { isSelectionEnabled, hasSelectedBlock, isDraggingBlocks, isMultiSelecting } = (0,external_wp_data_namespaceObject.useSelect)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { const { ownerDocument } = node; const { defaultView } = ownerDocument; let anchorElement; let rafId; function onMouseUp() { stopMultiSelect(); defaultView.removeEventListener("mouseup", onMouseUp); rafId = defaultView.requestAnimationFrame(() => { if (!hasSelectedBlock()) { return; } setContentEditableWrapper(node, false); const selection = defaultView.getSelection(); if (selection.rangeCount) { const range = selection.getRangeAt(0); const { commonAncestorContainer } = range; const clonedRange = range.cloneRange(); if (anchorElement.contains(commonAncestorContainer)) { anchorElement.focus(); selection.removeAllRanges(); selection.addRange(clonedRange); } } }); } let lastMouseDownTarget; function onMouseDown({ target }) { lastMouseDownTarget = target; } function onMouseLeave({ buttons, target, relatedTarget }) { if (!target.contains(lastMouseDownTarget)) { return; } if (target.contains(relatedTarget)) { return; } if (isDraggingBlocks()) { return; } if (buttons !== 1) { return; } if (isMultiSelecting()) { return; } if (node === target) { return; } if (target.getAttribute("contenteditable") !== "true") { return; } if (!isSelectionEnabled()) { return; } anchorElement = target; startMultiSelect(); defaultView.addEventListener("mouseup", onMouseUp); setContentEditableWrapper(node, true); } node.addEventListener("mouseout", onMouseLeave); node.addEventListener("mousedown", onMouseDown); return () => { node.removeEventListener("mouseout", onMouseLeave); defaultView.removeEventListener("mouseup", onMouseUp); defaultView.cancelAnimationFrame(rafId); }; }, [ startMultiSelect, stopMultiSelect, isSelectionEnabled, hasSelectedBlock ] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-selection-observer.js function extractSelectionStartNode(selection) { const { anchorNode, anchorOffset } = selection; if (anchorNode.nodeType === anchorNode.TEXT_NODE) { return anchorNode; } if (anchorOffset === 0) { return anchorNode; } return anchorNode.childNodes[anchorOffset - 1]; } function extractSelectionEndNode(selection) { const { focusNode, focusOffset } = selection; if (focusNode.nodeType === focusNode.TEXT_NODE) { return focusNode; } if (focusOffset === focusNode.childNodes.length) { return focusNode; } if (focusOffset === 0 && (0,external_wp_dom_namespaceObject.isSelectionForward)(selection)) { return focusNode.previousSibling ?? focusNode.parentElement; } return focusNode.childNodes[focusOffset]; } function findDepth(a, b) { let depth = 0; while (a[depth] === b[depth]) { depth++; } return depth; } function use_selection_observer_setContentEditableWrapper(node, value) { if (node.contentEditable !== String(value)) { node.contentEditable = value; if (value) { node.focus(); } } } function getRichTextElement(node) { const element = node.nodeType === node.ELEMENT_NODE ? node : node.parentElement; return element?.closest("[data-wp-block-attribute-key]"); } function useSelectionObserver() { const { multiSelect, selectBlock, selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { getBlockParents, getBlockSelectionStart, isMultiSelecting } = (0,external_wp_data_namespaceObject.useSelect)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { const { ownerDocument } = node; const { defaultView } = ownerDocument; function onSelectionChange(event) { const selection = defaultView.getSelection(); if (!selection.rangeCount) { return; } const startNode = extractSelectionStartNode(selection); const endNode = extractSelectionEndNode(selection); if (!node.contains(startNode) || !node.contains(endNode)) { return; } const isClickShift = event.shiftKey && event.type === "mouseup"; if (selection.isCollapsed && !isClickShift) { if (node.contentEditable === "true" && !isMultiSelecting()) { use_selection_observer_setContentEditableWrapper(node, false); let element = startNode.nodeType === startNode.ELEMENT_NODE ? startNode : startNode.parentElement; element = element?.closest("[contenteditable]"); element?.focus(); } return; } let startClientId = getBlockClientId(startNode); let endClientId = getBlockClientId(endNode); if (isClickShift) { const selectedClientId = getBlockSelectionStart(); const clickedClientId = getBlockClientId(event.target); const focusNodeIsNonSelectable = clickedClientId !== endClientId; if (startClientId === endClientId && selection.isCollapsed || !endClientId || focusNodeIsNonSelectable) { endClientId = clickedClientId; } if (startClientId !== selectedClientId) { startClientId = selectedClientId; } } if (startClientId === void 0 && endClientId === void 0) { use_selection_observer_setContentEditableWrapper(node, false); return; } const isSingularSelection = startClientId === endClientId; if (isSingularSelection) { if (!isMultiSelecting()) { selectBlock(startClientId); } else { multiSelect(startClientId, startClientId); } } else { const startPath = [ ...getBlockParents(startClientId), startClientId ]; const endPath = [ ...getBlockParents(endClientId), endClientId ]; const depth = findDepth(startPath, endPath); if (startPath[depth] !== startClientId || endPath[depth] !== endClientId) { multiSelect(startPath[depth], endPath[depth]); return; } const richTextElementStart = getRichTextElement(startNode); const richTextElementEnd = getRichTextElement(endNode); if (richTextElementStart && richTextElementEnd) { const range = selection.getRangeAt(0); const richTextDataStart = (0,external_wp_richText_namespaceObject.create)({ element: richTextElementStart, range, __unstableIsEditableTree: true }); const richTextDataEnd = (0,external_wp_richText_namespaceObject.create)({ element: richTextElementEnd, range, __unstableIsEditableTree: true }); const startOffset = richTextDataStart.start ?? richTextDataStart.end; const endOffset = richTextDataEnd.start ?? richTextDataEnd.end; selectionChange({ start: { clientId: startClientId, attributeKey: richTextElementStart.dataset.wpBlockAttributeKey, offset: startOffset }, end: { clientId: endClientId, attributeKey: richTextElementEnd.dataset.wpBlockAttributeKey, offset: endOffset } }); } else { multiSelect(startClientId, endClientId); } } } ownerDocument.addEventListener( "selectionchange", onSelectionChange ); defaultView.addEventListener("mouseup", onSelectionChange); return () => { ownerDocument.removeEventListener( "selectionchange", onSelectionChange ); defaultView.removeEventListener("mouseup", onSelectionChange); }; }, [multiSelect, selectBlock, selectionChange, getBlockParents] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-click-selection.js function useClickSelection() { const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { isSelectionEnabled, getBlockSelectionStart, hasMultiSelection } = (0,external_wp_data_namespaceObject.useSelect)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { function onMouseDown(event) { if (!isSelectionEnabled() || event.button !== 0) { return; } const startClientId = getBlockSelectionStart(); const clickedClientId = getBlockClientId(event.target); if (event.shiftKey) { if (startClientId && startClientId !== clickedClientId) { node.contentEditable = true; node.focus(); } } else if (hasMultiSelection()) { selectBlock(clickedClientId); } } node.addEventListener("mousedown", onMouseDown); return () => { node.removeEventListener("mousedown", onMouseDown); }; }, [ selectBlock, isSelectionEnabled, getBlockSelectionStart, hasMultiSelection ] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-input.js function useInput() { const { __unstableIsFullySelected, getSelectedBlockClientIds, getSelectedBlockClientId, __unstableIsSelectionMergeable, hasMultiSelection, getBlockName, canInsertBlockType, getBlockRootClientId, getSelectionStart, getSelectionEnd, getBlockAttributes } = (0,external_wp_data_namespaceObject.useSelect)(store); const { replaceBlocks, __unstableSplitSelection, removeBlocks, __unstableDeleteSelection, __unstableExpandSelection, __unstableMarkAutomaticChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { function onBeforeInput(event) { if (node.contentEditable === "true") { event.preventDefault(); } } function onKeyDown(event) { if (event.defaultPrevented) { return; } if (!hasMultiSelection()) { if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { if (event.shiftKey || __unstableIsFullySelected()) { return; } const clientId = getSelectedBlockClientId(); const blockName = getBlockName(clientId); const selectionStart = getSelectionStart(); const selectionEnd = getSelectionEnd(); if (selectionStart.attributeKey === selectionEnd.attributeKey) { const selectedAttributeValue = getBlockAttributes(clientId)[selectionStart.attributeKey]; const transforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from").filter( ({ type }) => type === "enter" ); const transformation = (0,external_wp_blocks_namespaceObject.findTransform)( transforms, (item) => { return item.regExp.test( selectedAttributeValue ); } ); if (transformation) { replaceBlocks( clientId, transformation.transform({ content: selectedAttributeValue }) ); __unstableMarkAutomaticChange(); return; } } if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "splitting", false) && !event.__deprecatedOnSplit) { return; } if (canInsertBlockType( blockName, getBlockRootClientId(clientId) )) { __unstableSplitSelection(); event.preventDefault(); } } return; } if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { node.contentEditable = false; event.preventDefault(); if (__unstableIsFullySelected()) { replaceBlocks( getSelectedBlockClientIds(), (0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()) ); } else { __unstableSplitSelection(); } } else if (event.keyCode === external_wp_keycodes_namespaceObject.BACKSPACE || event.keyCode === external_wp_keycodes_namespaceObject.DELETE) { node.contentEditable = false; event.preventDefault(); if (__unstableIsFullySelected()) { removeBlocks(getSelectedBlockClientIds()); } else if (__unstableIsSelectionMergeable()) { __unstableDeleteSelection(event.keyCode === external_wp_keycodes_namespaceObject.DELETE); } else { __unstableExpandSelection(); } } else if ( // If key.length is longer than 1, it's a control key that doesn't // input anything. event.key.length === 1 && !(event.metaKey || event.ctrlKey) ) { node.contentEditable = false; if (__unstableIsSelectionMergeable()) { __unstableDeleteSelection(event.keyCode === external_wp_keycodes_namespaceObject.DELETE); } else { event.preventDefault(); node.ownerDocument.defaultView.getSelection().removeAllRanges(); } } } function onCompositionStart(event) { if (!hasMultiSelection()) { return; } node.contentEditable = false; if (__unstableIsSelectionMergeable()) { __unstableDeleteSelection(); } else { event.preventDefault(); node.ownerDocument.defaultView.getSelection().removeAllRanges(); } } node.addEventListener("beforeinput", onBeforeInput); node.addEventListener("keydown", onKeyDown); node.addEventListener("compositionstart", onCompositionStart); return () => { node.removeEventListener("beforeinput", onBeforeInput); node.removeEventListener("keydown", onKeyDown); node.removeEventListener("compositionstart", onCompositionStart); }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/utils/use-notify-copy.js function useNotifyCopy() { const { getBlockName } = (0,external_wp_data_namespaceObject.useSelect)(store); const { getBlockType } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); return (0,external_wp_element_namespaceObject.useCallback)( (eventType, selectedBlockClientIds) => { let notice = ""; if (eventType === "copyStyles") { notice = (0,external_wp_i18n_namespaceObject.__)("Styles copied to clipboard."); } else if (selectedBlockClientIds.length === 1) { const clientId = selectedBlockClientIds[0]; const title = getBlockType(getBlockName(clientId))?.title; if (eventType === "copy") { notice = (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: Name of the block being copied, e.g. "Paragraph". (0,external_wp_i18n_namespaceObject.__)('Copied "%s" to clipboard.'), title ); } else { notice = (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: Name of the block being cut, e.g. "Paragraph". (0,external_wp_i18n_namespaceObject.__)('Moved "%s" to clipboard.'), title ); } } else if (eventType === "copy") { notice = (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %d: Number of blocks being copied. (0,external_wp_i18n_namespaceObject._n)( "Copied %d block to clipboard.", "Copied %d blocks to clipboard.", selectedBlockClientIds.length ), selectedBlockClientIds.length ); } else { notice = (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %d: Number of blocks being moved. (0,external_wp_i18n_namespaceObject._n)( "Moved %d block to clipboard.", "Moved %d blocks to clipboard.", selectedBlockClientIds.length ), selectedBlockClientIds.length ); } createSuccessNotice(notice, { type: "snackbar" }); }, [createSuccessNotice, getBlockName, getBlockType] ); } ;// ./node_modules/@wordpress/block-editor/build-module/utils/pasting.js function removeWindowsFragments(html) { const startStr = "<!--StartFragment-->"; const startIdx = html.indexOf(startStr); if (startIdx > -1) { html = html.substring(startIdx + startStr.length); } else { return html; } const endStr = "<!--EndFragment-->"; const endIdx = html.indexOf(endStr); if (endIdx > -1) { html = html.substring(0, endIdx); } return html; } function removeCharsetMetaTag(html) { const metaTag = `<meta charset='utf-8'>`; if (html.startsWith(metaTag)) { return html.slice(metaTag.length); } return html; } function getPasteEventData({ clipboardData }) { let plainText = ""; let html = ""; try { plainText = clipboardData.getData("text/plain"); html = clipboardData.getData("text/html"); } catch (error) { return; } html = removeWindowsFragments(html); html = removeCharsetMetaTag(html); const files = (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(clipboardData); if (files.length && !shouldDismissPastedFiles(files, html)) { return { files }; } return { html, plainText, files: [] }; } function shouldDismissPastedFiles(files, html) { if (html && files?.length === 1 && files[0].type.indexOf("image/") === 0) { const IMAGE_TAG = /<\s*img\b/gi; if (html.match(IMAGE_TAG)?.length !== 1) { return true; } const IMG_WITH_LOCAL_SRC = /<\s*img\b[^>]*\bsrc="file:\/\//i; if (html.match(IMG_WITH_LOCAL_SRC)) { return true; } } return false; } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/utils.js const requiresWrapperOnCopy = Symbol("requiresWrapperOnCopy"); function setClipboardBlocks(event, blocks, registry) { let _blocks = blocks; const [firstBlock] = blocks; if (firstBlock) { const firstBlockType = registry.select(external_wp_blocks_namespaceObject.store).getBlockType(firstBlock.name); if (firstBlockType[requiresWrapperOnCopy]) { const { getBlockRootClientId, getBlockName, getBlockAttributes } = registry.select(store); const wrapperBlockClientId = getBlockRootClientId( firstBlock.clientId ); const wrapperBlockName = getBlockName(wrapperBlockClientId); if (wrapperBlockName) { _blocks = (0,external_wp_blocks_namespaceObject.createBlock)( wrapperBlockName, getBlockAttributes(wrapperBlockClientId), _blocks ); } } } const serialized = (0,external_wp_blocks_namespaceObject.serialize)(_blocks); event.clipboardData.setData("text/plain", toPlainText(serialized)); event.clipboardData.setData("text/html", serialized); } function getPasteBlocks(event, canUserUseUnfilteredHTML) { const { plainText, html, files } = getPasteEventData(event); let blocks = []; if (files.length) { const fromTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from"); blocks = files.reduce((accumulator, file) => { const transformation = (0,external_wp_blocks_namespaceObject.findTransform)( fromTransforms, (transform) => transform.type === "files" && transform.isMatch([file]) ); if (transformation) { accumulator.push(transformation.transform([file])); } return accumulator; }, []).flat(); } else { blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({ HTML: html, plainText, mode: "BLOCKS", canUserUseUnfilteredHTML }); } return blocks; } function toPlainText(html) { html = html.replace(/<br>/g, "\n"); const plainText = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(html).trim(); return plainText.replace(/\n\n+/g, "\n\n"); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-clipboard-handler.js function useClipboardHandler() { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { getBlocksByClientId, getSelectedBlockClientIds, hasMultiSelection, getSettings, getBlockName, __unstableIsFullySelected, __unstableIsSelectionCollapsed, __unstableIsSelectionMergeable, __unstableGetSelectedBlocksWithPartialSelection, canInsertBlockType, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { flashBlock, removeBlocks, replaceBlocks, __unstableDeleteSelection, __unstableExpandSelection, __unstableSplitSelection } = (0,external_wp_data_namespaceObject.useDispatch)(store); const notifyCopy = useNotifyCopy(); return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { function handler(event) { if (event.defaultPrevented) { return; } const selectedBlockClientIds = getSelectedBlockClientIds(); if (selectedBlockClientIds.length === 0) { return; } if (!hasMultiSelection()) { const { target } = event; const { ownerDocument } = target; const hasSelection = event.type === "copy" || event.type === "cut" ? (0,external_wp_dom_namespaceObject.documentHasUncollapsedSelection)(ownerDocument) : (0,external_wp_dom_namespaceObject.documentHasSelection)(ownerDocument) && !ownerDocument.activeElement.isContentEditable; if (hasSelection) { return; } } const { activeElement } = event.target.ownerDocument; if (!node.contains(activeElement)) { return; } const isSelectionMergeable = __unstableIsSelectionMergeable(); const shouldHandleWholeBlocks = __unstableIsSelectionCollapsed() || __unstableIsFullySelected(); const expandSelectionIsNeeded = !shouldHandleWholeBlocks && !isSelectionMergeable; if (event.type === "copy" || event.type === "cut") { event.preventDefault(); if (selectedBlockClientIds.length === 1) { flashBlock(selectedBlockClientIds[0]); } if (expandSelectionIsNeeded) { __unstableExpandSelection(); } else { notifyCopy(event.type, selectedBlockClientIds); let blocks; if (shouldHandleWholeBlocks) { blocks = getBlocksByClientId(selectedBlockClientIds); } else { const [head, tail] = __unstableGetSelectedBlocksWithPartialSelection(); const inBetweenBlocks = getBlocksByClientId( selectedBlockClientIds.slice( 1, selectedBlockClientIds.length - 1 ) ); blocks = [head, ...inBetweenBlocks, tail]; } setClipboardBlocks(event, blocks, registry); } } if (event.type === "cut") { if (shouldHandleWholeBlocks && !expandSelectionIsNeeded) { removeBlocks(selectedBlockClientIds); } else { event.target.ownerDocument.activeElement.contentEditable = false; __unstableDeleteSelection(); } } else if (event.type === "paste") { const { __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML, mediaUpload } = getSettings(); const isInternal = event.clipboardData.getData("rich-text") === "true"; if (isInternal) { return; } const { plainText, html, files } = getPasteEventData(event); const isFullySelected = __unstableIsFullySelected(); let blocks = []; if (files.length) { if (!mediaUpload) { event.preventDefault(); return; } const fromTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from"); blocks = files.reduce((accumulator, file) => { const transformation = (0,external_wp_blocks_namespaceObject.findTransform)( fromTransforms, (transform) => transform.type === "files" && transform.isMatch([file]) ); if (transformation) { accumulator.push( transformation.transform([file]) ); } return accumulator; }, []).flat(); } else { blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({ HTML: html, plainText, mode: isFullySelected ? "BLOCKS" : "AUTO", canUserUseUnfilteredHTML }); } if (typeof blocks === "string") { return; } if (isFullySelected) { replaceBlocks( selectedBlockClientIds, blocks, blocks.length - 1, -1 ); event.preventDefault(); return; } if (!hasMultiSelection() && !(0,external_wp_blocks_namespaceObject.hasBlockSupport)( getBlockName(selectedBlockClientIds[0]), "splitting", false ) && !event.__deprecatedOnSplit) { return; } const [firstSelectedClientId] = selectedBlockClientIds; const rootClientId = getBlockRootClientId( firstSelectedClientId ); const newBlocks = []; for (const block of blocks) { if (canInsertBlockType(block.name, rootClientId)) { newBlocks.push(block); } else { const rootBlockName = getBlockName(rootClientId); const switchedBlocks = block.name !== rootBlockName ? (0,external_wp_blocks_namespaceObject.switchToBlockType)(block, rootBlockName) : [block]; if (!switchedBlocks) { return; } for (const switchedBlock of switchedBlocks) { for (const innerBlock of switchedBlock.innerBlocks) { newBlocks.push(innerBlock); } } } } __unstableSplitSelection(newBlocks); event.preventDefault(); } } node.ownerDocument.addEventListener("copy", handler); node.ownerDocument.addEventListener("cut", handler); node.ownerDocument.addEventListener("paste", handler); return () => { node.ownerDocument.removeEventListener("copy", handler); node.ownerDocument.removeEventListener("cut", handler); node.ownerDocument.removeEventListener("paste", handler); }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/index.js function useWritingFlow() { const [before, ref, after] = useTabNav(); const hasMultiSelection = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).hasMultiSelection(), [] ); return [ before, (0,external_wp_compose_namespaceObject.useMergeRefs)([ ref, useClipboardHandler(), useInput(), useDragSelection(), useSelectionObserver(), useClickSelection(), useMultiSelection(), useSelectAll(), useArrowNav(), (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { node.tabIndex = 0; node.dataset.hasMultiSelection = hasMultiSelection; if (!hasMultiSelection) { return () => { delete node.dataset.hasMultiSelection; }; } node.setAttribute( "aria-label", (0,external_wp_i18n_namespaceObject.__)("Multiple selected blocks") ); return () => { delete node.dataset.hasMultiSelection; node.removeAttribute("aria-label"); }; }, [hasMultiSelection] ) ]), after ]; } function WritingFlow({ children, ...props }, forwardedRef) { const [before, ref, after] = useWritingFlow(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ before, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { ...props, ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, forwardedRef]), className: dist_clsx( props.className, "block-editor-writing-flow" ), children } ), after ] }); } var writing_flow_default = (0,external_wp_element_namespaceObject.forwardRef)(WritingFlow); ;// ./node_modules/@wordpress/block-editor/build-module/components/iframe/get-compatibility-styles.js let compatibilityStyles = null; function getCompatibilityStyles() { if (compatibilityStyles) { return compatibilityStyles; } compatibilityStyles = Array.from(document.styleSheets).reduce( (accumulator, styleSheet) => { try { styleSheet.cssRules; } catch (e) { return accumulator; } const { ownerNode, cssRules } = styleSheet; if (ownerNode === null) { return accumulator; } if (!cssRules) { return accumulator; } if (ownerNode.id.startsWith("wp-")) { return accumulator; } if (!ownerNode.id) { return accumulator; } function matchFromRules(_cssRules) { return Array.from(_cssRules).find( ({ selectorText, conditionText, cssRules: __cssRules }) => { if (conditionText) { return matchFromRules(__cssRules); } return selectorText && (selectorText.includes( ".editor-styles-wrapper" ) || selectorText.includes(".wp-block")); } ); } if (matchFromRules(cssRules)) { const isInline = ownerNode.tagName === "STYLE"; if (isInline) { const mainStylesCssId = ownerNode.id.replace( "-inline-css", "-css" ); const mainStylesElement = document.getElementById(mainStylesCssId); if (mainStylesElement) { accumulator.push(mainStylesElement.cloneNode(true)); } } accumulator.push(ownerNode.cloneNode(true)); if (!isInline) { const inlineStylesCssId = ownerNode.id.replace( "-css", "-inline-css" ); const inlineStylesElement = document.getElementById(inlineStylesCssId); if (inlineStylesElement) { accumulator.push( inlineStylesElement.cloneNode(true) ); } } } return accumulator; }, [] ); return compatibilityStyles; } ;// ./node_modules/@wordpress/block-editor/build-module/components/iframe/use-scale-canvas.js function calculateScale({ frameSize, containerWidth, maxContainerWidth, scaleContainerWidth }) { return (Math.min(containerWidth, maxContainerWidth) - frameSize * 2) / scaleContainerWidth; } function computeScrollHeightNext(transitionFrom, transitionTo) { const { scaleValue: prevScale, scrollHeight: prevScrollHeight } = transitionFrom; const { frameSize, scaleValue } = transitionTo; return prevScrollHeight * (scaleValue / prevScale) + frameSize * 2; } function computeScrollTopNext(transitionFrom, transitionTo) { const { containerHeight: prevContainerHeight, frameSize: prevFrameSize, scaleValue: prevScale, scrollTop: prevScrollTop } = transitionFrom; const { containerHeight, frameSize, scaleValue, scrollHeight } = transitionTo; let scrollTopNext = prevScrollTop; scrollTopNext = (scrollTopNext + prevContainerHeight / 2 - prevFrameSize) / prevScale - prevContainerHeight / 2; scrollTopNext = (scrollTopNext + containerHeight / 2) * scaleValue + frameSize - containerHeight / 2; scrollTopNext = prevScrollTop <= prevFrameSize ? 0 : scrollTopNext; const maxScrollTop = scrollHeight - containerHeight; return Math.round( Math.min(Math.max(0, scrollTopNext), Math.max(0, maxScrollTop)) ); } function getAnimationKeyframes(transitionFrom, transitionTo) { const { scaleValue: prevScale, frameSize: prevFrameSize, scrollTop } = transitionFrom; const { scaleValue, frameSize, scrollTop: scrollTopNext } = transitionTo; return [ { translate: `0 0`, scale: prevScale, paddingTop: `${prevFrameSize / prevScale}px`, paddingBottom: `${prevFrameSize / prevScale}px` }, { translate: `0 ${scrollTop - scrollTopNext}px`, scale: scaleValue, paddingTop: `${frameSize / scaleValue}px`, paddingBottom: `${frameSize / scaleValue}px` } ]; } function useScaleCanvas({ frameSize, iframeDocument, maxContainerWidth = 750, scale }) { const [contentResizeListener, { height: contentHeight }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const [ containerResizeListener, { width: containerWidth, height: containerHeight } ] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const initialContainerWidthRef = (0,external_wp_element_namespaceObject.useRef)(0); const isZoomedOut = scale !== 1; const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const isAutoScaled = scale === "auto-scaled"; const startAnimationRef = (0,external_wp_element_namespaceObject.useRef)(false); const animationRef = (0,external_wp_element_namespaceObject.useRef)(null); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isZoomedOut) { initialContainerWidthRef.current = containerWidth; } }, [containerWidth, isZoomedOut]); const scaleContainerWidth = Math.max( initialContainerWidthRef.current, containerWidth ); const scaleValue = isAutoScaled ? calculateScale({ frameSize, containerWidth, maxContainerWidth, scaleContainerWidth }) : scale; const transitionFromRef = (0,external_wp_element_namespaceObject.useRef)({ scaleValue, frameSize, containerHeight: 0, scrollTop: 0, scrollHeight: 0 }); const transitionToRef = (0,external_wp_element_namespaceObject.useRef)({ scaleValue, frameSize, containerHeight: 0, scrollTop: 0, scrollHeight: 0 }); const startZoomOutAnimation = (0,external_wp_element_namespaceObject.useCallback)(() => { const { scrollTop } = transitionFromRef.current; const { scrollTop: scrollTopNext } = transitionToRef.current; iframeDocument.documentElement.style.setProperty( "--wp-block-editor-iframe-zoom-out-scroll-top", `${scrollTop}px` ); iframeDocument.documentElement.style.setProperty( "--wp-block-editor-iframe-zoom-out-scroll-top-next", `${scrollTopNext}px` ); iframeDocument.documentElement.style.setProperty( "--wp-block-editor-iframe-zoom-out-overflow-behavior", transitionFromRef.current.scrollHeight === transitionFromRef.current.containerHeight ? "auto" : "scroll" ); iframeDocument.documentElement.classList.add("zoom-out-animation"); return iframeDocument.documentElement.animate( getAnimationKeyframes( transitionFromRef.current, transitionToRef.current ), { easing: "cubic-bezier(0.46, 0.03, 0.52, 0.96)", duration: 400 } ); }, [iframeDocument]); const finishZoomOutAnimation = (0,external_wp_element_namespaceObject.useCallback)(() => { startAnimationRef.current = false; animationRef.current = null; iframeDocument.documentElement.style.setProperty( "--wp-block-editor-iframe-zoom-out-scale", transitionToRef.current.scaleValue ); iframeDocument.documentElement.style.setProperty( "--wp-block-editor-iframe-zoom-out-frame-size", `${transitionToRef.current.frameSize}px` ); iframeDocument.documentElement.classList.remove("zoom-out-animation"); iframeDocument.documentElement.scrollTop = transitionToRef.current.scrollTop; iframeDocument.documentElement.style.removeProperty( "--wp-block-editor-iframe-zoom-out-scroll-top" ); iframeDocument.documentElement.style.removeProperty( "--wp-block-editor-iframe-zoom-out-scroll-top-next" ); iframeDocument.documentElement.style.removeProperty( "--wp-block-editor-iframe-zoom-out-overflow-behavior" ); transitionFromRef.current = transitionToRef.current; }, [iframeDocument]); const previousIsZoomedOut = (0,external_wp_element_namespaceObject.useRef)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { const trigger = iframeDocument && previousIsZoomedOut.current !== isZoomedOut; previousIsZoomedOut.current = isZoomedOut; if (!trigger) { return; } startAnimationRef.current = true; if (!isZoomedOut) { return; } iframeDocument.documentElement.classList.add("is-zoomed-out"); return () => { iframeDocument.documentElement.classList.remove("is-zoomed-out"); }; }, [iframeDocument, isZoomedOut]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!iframeDocument) { return; } if (isAutoScaled && transitionFromRef.current.scaleValue !== 1) { transitionFromRef.current.scaleValue = calculateScale({ frameSize: transitionFromRef.current.frameSize, containerWidth, maxContainerWidth, scaleContainerWidth: containerWidth }); } if (scaleValue < 1) { if (!startAnimationRef.current) { iframeDocument.documentElement.style.setProperty( "--wp-block-editor-iframe-zoom-out-scale", scaleValue ); iframeDocument.documentElement.style.setProperty( "--wp-block-editor-iframe-zoom-out-frame-size", `${frameSize}px` ); } iframeDocument.documentElement.style.setProperty( "--wp-block-editor-iframe-zoom-out-content-height", `${contentHeight}px` ); iframeDocument.documentElement.style.setProperty( "--wp-block-editor-iframe-zoom-out-inner-height", `${containerHeight}px` ); iframeDocument.documentElement.style.setProperty( "--wp-block-editor-iframe-zoom-out-container-width", `${containerWidth}px` ); iframeDocument.documentElement.style.setProperty( "--wp-block-editor-iframe-zoom-out-scale-container-width", `${scaleContainerWidth}px` ); } if (startAnimationRef.current) { startAnimationRef.current = false; if (animationRef.current) { animationRef.current.reverse(); const tempTransitionFrom = transitionFromRef.current; const tempTransitionTo = transitionToRef.current; transitionFromRef.current = tempTransitionTo; transitionToRef.current = tempTransitionFrom; } else { transitionFromRef.current.scrollTop = iframeDocument.documentElement.scrollTop; transitionFromRef.current.scrollHeight = iframeDocument.documentElement.scrollHeight; transitionFromRef.current.containerHeight = containerHeight; transitionToRef.current = { scaleValue, frameSize, containerHeight: iframeDocument.documentElement.clientHeight // use clientHeight to get the actual height of the new container after zoom state changes have rendered, as it will be the most up-to-date. }; transitionToRef.current.scrollHeight = computeScrollHeightNext( transitionFromRef.current, transitionToRef.current ); transitionToRef.current.scrollTop = computeScrollTopNext( transitionFromRef.current, transitionToRef.current ); animationRef.current = startZoomOutAnimation(); if (prefersReducedMotion) { finishZoomOutAnimation(); } else { animationRef.current.onfinish = finishZoomOutAnimation; } } } }, [ startZoomOutAnimation, finishZoomOutAnimation, prefersReducedMotion, isAutoScaled, scaleValue, frameSize, iframeDocument, contentHeight, containerWidth, containerHeight, maxContainerWidth, scaleContainerWidth ]); return { isZoomedOut, scaleContainerWidth, contentResizeListener, containerResizeListener }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/iframe/index.js function bubbleEvent(event, Constructor, frame) { const init = {}; for (const key in event) { init[key] = event[key]; } if (event instanceof frame.contentDocument.defaultView.MouseEvent) { const rect = frame.getBoundingClientRect(); init.clientX += rect.left; init.clientY += rect.top; } const newEvent = new Constructor(event.type, init); if (init.defaultPrevented) { newEvent.preventDefault(); } const cancelled = !frame.dispatchEvent(newEvent); if (cancelled) { event.preventDefault(); } } function useBubbleEvents(iframeDocument) { return (0,external_wp_compose_namespaceObject.useRefEffect)(() => { const { defaultView } = iframeDocument; if (!defaultView) { return; } const { frameElement } = defaultView; const html = iframeDocument.documentElement; const eventTypes = ["dragover", "mousemove"]; const handlers = {}; for (const name of eventTypes) { handlers[name] = (event) => { const prototype = Object.getPrototypeOf(event); const constructorName = prototype.constructor.name; const Constructor = window[constructorName]; bubbleEvent(event, Constructor, frameElement); }; html.addEventListener(name, handlers[name]); } return () => { for (const name of eventTypes) { html.removeEventListener(name, handlers[name]); } }; }); } function Iframe({ contentRef, children, tabIndex = 0, scale = 1, frameSize = 0, readonly, forwardedRef: ref, title = (0,external_wp_i18n_namespaceObject.__)("Editor canvas"), ...props }) { const { resolvedAssets, isPreviewMode } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSettings } = select(store); const settings = getSettings(); return { resolvedAssets: settings.__unstableResolvedAssets, isPreviewMode: settings.isPreviewMode }; }, []); const { styles = "", scripts = "" } = resolvedAssets; const [iframeDocument, setIframeDocument] = (0,external_wp_element_namespaceObject.useState)(); const [bodyClasses, setBodyClasses] = (0,external_wp_element_namespaceObject.useState)([]); const clearerRef = useBlockSelectionClearer(); const [before, writingFlowRef, after] = useWritingFlow(); const setRef = (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { node._load = () => { setIframeDocument(node.contentDocument); }; let iFrameDocument; function preventFileDropDefault(event) { event.preventDefault(); } function interceptLinkClicks(event) { if (event.target.tagName === "A" && event.target.getAttribute("href")?.startsWith("#")) { event.preventDefault(); iFrameDocument.defaultView.location.hash = event.target.getAttribute("href").slice(1); } } const { ownerDocument } = node; setBodyClasses( Array.from(ownerDocument.body.classList).filter( (name) => name.startsWith("admin-color-") || name.startsWith("post-type-") || name === "wp-embed-responsive" ) ); function onLoad() { const { contentDocument } = node; const { documentElement } = contentDocument; iFrameDocument = contentDocument; documentElement.classList.add("block-editor-iframe__html"); clearerRef(documentElement); contentDocument.dir = ownerDocument.dir; for (const compatStyle of getCompatibilityStyles()) { if (contentDocument.getElementById(compatStyle.id)) { continue; } contentDocument.head.appendChild( compatStyle.cloneNode(true) ); if (!isPreviewMode) { console.warn( `${compatStyle.id} was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`, compatStyle ); } } iFrameDocument.addEventListener( "dragover", preventFileDropDefault, false ); iFrameDocument.addEventListener( "drop", preventFileDropDefault, false ); iFrameDocument.addEventListener("click", interceptLinkClicks); } node.addEventListener("load", onLoad); return () => { delete node._load; node.removeEventListener("load", onLoad); iFrameDocument?.removeEventListener( "dragover", preventFileDropDefault ); iFrameDocument?.removeEventListener( "drop", preventFileDropDefault ); iFrameDocument?.removeEventListener("click", interceptLinkClicks); }; }, []); const { contentResizeListener, containerResizeListener, isZoomedOut, scaleContainerWidth } = useScaleCanvas({ scale, frameSize: parseInt(frameSize), iframeDocument }); const disabledRef = (0,external_wp_compose_namespaceObject.useDisabled)({ isDisabled: !readonly }); const bodyRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ useBubbleEvents(iframeDocument), contentRef, clearerRef, writingFlowRef, disabledRef ]); const html = `<!doctype html> <html> <head> <meta charset="utf-8"> <base href="${window.location.origin}"> <script>window.frameElement._load()</script> <style> html{ height: auto !important; min-height: 100%; } /* Lowest specificity to not override global styles */ :where(body) { margin: 0; /* Default background color in case zoom out mode background colors the html element */ background-color: white; } </style> ${styles} ${scripts} </head> <body> <script>document.currentScript.parentElement.remove()</script> </body> </html>`; const [src, cleanup] = (0,external_wp_element_namespaceObject.useMemo)(() => { const _src = URL.createObjectURL( new window.Blob([html], { type: "text/html" }) ); return [_src, () => URL.revokeObjectURL(_src)]; }, [html]); (0,external_wp_element_namespaceObject.useEffect)(() => cleanup, [cleanup]); const shouldRenderFocusCaptureElements = tabIndex >= 0 && !isPreviewMode; const iframe = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ shouldRenderFocusCaptureElements && before, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "iframe", { ...props, style: { ...props.style, height: props.style?.height, border: 0 }, ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, setRef]), tabIndex, src, title, onKeyDown: (event) => { if (props.onKeyDown) { props.onKeyDown(event); } if (event.currentTarget.ownerDocument !== event.target.ownerDocument) { const { stopPropagation } = event.nativeEvent; event.nativeEvent.stopPropagation = () => { }; event.stopPropagation(); event.nativeEvent.stopPropagation = stopPropagation; bubbleEvent( event, window.KeyboardEvent, event.currentTarget ); } }, children: iframeDocument && (0,external_wp_element_namespaceObject.createPortal)( // We want to prevent React events from bubbling through the iframe // we bubble these manually. /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "body", { ref: bodyRef, className: dist_clsx( "block-editor-iframe__body", "editor-styles-wrapper", ...bodyClasses ), children: [ contentResizeListener, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document: iframeDocument, children }) ] } ), iframeDocument.documentElement ) } ), shouldRenderFocusCaptureElements && after ] }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-iframe__container", children: [ containerResizeListener, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx( "block-editor-iframe__scale-container", isZoomedOut && "is-zoomed-out" ), style: { "--wp-block-editor-iframe-zoom-out-scale-container-width": isZoomedOut && `${scaleContainerWidth}px` }, children: iframe } ) ] }); } function IframeIfReady(props, ref) { const isInitialised = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).getSettings().__internalIsInitialized, [] ); if (!isInitialised) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Iframe, { ...props, forwardedRef: ref }); } var iframe_default = (0,external_wp_element_namespaceObject.forwardRef)(IframeIfReady); ;// ./node_modules/parsel-js/dist/parsel.js const TOKENS = { attribute: /\[\s*(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)\s*(?:(?<operator>\W?=)\s*(?<value>.+?)\s*(\s(?<caseSensitive>[iIsS]))?\s*)?\]/gu, id: /#(?<name>[-\w\P{ASCII}]+)/gu, class: /\.(?<name>[-\w\P{ASCII}]+)/gu, comma: /\s*,\s*/g, combinator: /\s*[\s>+~]\s*/g, 'pseudo-element': /::(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu, 'pseudo-class': /:(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu, universal: /(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?\*/gu, type: /(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)/gu, // this must be last }; const TRIM_TOKENS = new Set(['combinator', 'comma']); const RECURSIVE_PSEUDO_CLASSES = new Set([ 'not', 'is', 'where', 'has', 'matches', '-moz-any', '-webkit-any', 'nth-child', 'nth-last-child', ]); const nthChildRegExp = /(?<index>[\dn+-]+)\s+of\s+(?<subtree>.+)/; const RECURSIVE_PSEUDO_CLASSES_ARGS = { 'nth-child': nthChildRegExp, 'nth-last-child': nthChildRegExp, }; const getArgumentPatternByType = (type) => { switch (type) { case 'pseudo-element': case 'pseudo-class': return new RegExp(TOKENS[type].source.replace('(?<argument>¶*)', '(?<argument>.*)'), 'gu'); default: return TOKENS[type]; } }; function gobbleParens(text, offset) { let nesting = 0; let result = ''; for (; offset < text.length; offset++) { const char = text[offset]; switch (char) { case '(': ++nesting; break; case ')': --nesting; break; } result += char; if (nesting === 0) { return result; } } return result; } function tokenizeBy(text, grammar = TOKENS) { if (!text) { return []; } const tokens = [text]; for (const [type, pattern] of Object.entries(grammar)) { for (let i = 0; i < tokens.length; i++) { const token = tokens[i]; if (typeof token !== 'string') { continue; } pattern.lastIndex = 0; const match = pattern.exec(token); if (!match) { continue; } const from = match.index - 1; const args = []; const content = match[0]; const before = token.slice(0, from + 1); if (before) { args.push(before); } args.push({ ...match.groups, type, content, }); const after = token.slice(from + content.length + 1); if (after) { args.push(after); } tokens.splice(i, 1, ...args); } } let offset = 0; for (const token of tokens) { switch (typeof token) { case 'string': throw new Error(`Unexpected sequence ${token} found at index ${offset}`); case 'object': offset += token.content.length; token.pos = [offset - token.content.length, offset]; if (TRIM_TOKENS.has(token.type)) { token.content = token.content.trim() || ' '; } break; } } return tokens; } const STRING_PATTERN = /(['"])([^\\\n]+?)\1/g; const ESCAPE_PATTERN = /\\./g; function parsel_tokenize(selector, grammar = TOKENS) { // Prevent leading/trailing whitespaces from being interpreted as combinators selector = selector.trim(); if (selector === '') { return []; } const replacements = []; // Replace escapes with placeholders. selector = selector.replace(ESCAPE_PATTERN, (value, offset) => { replacements.push({ value, offset }); return '\uE000'.repeat(value.length); }); // Replace strings with placeholders. selector = selector.replace(STRING_PATTERN, (value, quote, content, offset) => { replacements.push({ value, offset }); return `${quote}${'\uE001'.repeat(content.length)}${quote}`; }); // Replace parentheses with placeholders. { let pos = 0; let offset; while ((offset = selector.indexOf('(', pos)) > -1) { const value = gobbleParens(selector, offset); replacements.push({ value, offset }); selector = `${selector.substring(0, offset)}(${'¶'.repeat(value.length - 2)})${selector.substring(offset + value.length)}`; pos = offset + value.length; } } // Now we have no nested structures and we can parse with regexes const tokens = tokenizeBy(selector, grammar); // Replace placeholders in reverse order. const changedTokens = new Set(); for (const replacement of replacements.reverse()) { for (const token of tokens) { const { offset, value } = replacement; if (!(token.pos[0] <= offset && offset + value.length <= token.pos[1])) { continue; } const { content } = token; const tokenOffset = offset - token.pos[0]; token.content = content.slice(0, tokenOffset) + value + content.slice(tokenOffset + value.length); if (token.content !== content) { changedTokens.add(token); } } } // Update changed tokens. for (const token of changedTokens) { const pattern = getArgumentPatternByType(token.type); if (!pattern) { throw new Error(`Unknown token type: ${token.type}`); } pattern.lastIndex = 0; const match = pattern.exec(token.content); if (!match) { throw new Error(`Unable to parse content for ${token.type}: ${token.content}`); } Object.assign(token, match.groups); } return tokens; } /** * Convert a flat list of tokens into a tree of complex & compound selectors */ function nestTokens(tokens, { list = true } = {}) { if (list && tokens.find((t) => t.type === 'comma')) { const selectors = []; const temp = []; for (let i = 0; i < tokens.length; i++) { if (tokens[i].type === 'comma') { if (temp.length === 0) { throw new Error('Incorrect comma at ' + i); } selectors.push(nestTokens(temp, { list: false })); temp.length = 0; } else { temp.push(tokens[i]); } } if (temp.length === 0) { throw new Error('Trailing comma'); } else { selectors.push(nestTokens(temp, { list: false })); } return { type: 'list', list: selectors }; } for (let i = tokens.length - 1; i >= 0; i--) { let token = tokens[i]; if (token.type === 'combinator') { let left = tokens.slice(0, i); let right = tokens.slice(i + 1); return { type: 'complex', combinator: token.content, left: nestTokens(left), right: nestTokens(right), }; } } switch (tokens.length) { case 0: throw new Error('Could not build AST.'); case 1: // If we're here, there are no combinators, so it's just a list. return tokens[0]; default: return { type: 'compound', list: [...tokens], // clone to avoid pointers messing up the AST }; } } /** * Traverse an AST in depth-first order */ function* flatten(node, /** * @internal */ parent) { switch (node.type) { case 'list': for (let child of node.list) { yield* flatten(child, node); } break; case 'complex': yield* flatten(node.left, node); yield* flatten(node.right, node); break; case 'compound': yield* node.list.map((token) => [token, node]); break; default: yield [node, parent]; } } /** * Traverse an AST (or part thereof), in depth-first order */ function walk(node, visit, /** * @internal */ parent) { if (!node) { return; } for (const [token, ast] of flatten(node, parent)) { visit(token, ast); } } /** * Parse a CSS selector * * @param selector - The selector to parse * @param options.recursive - Whether to parse the arguments of pseudo-classes like :is(), :has() etc. Defaults to true. * @param options.list - Whether this can be a selector list (A, B, C etc). Defaults to true. */ function parse(selector, { recursive = true, list = true } = {}) { const tokens = parsel_tokenize(selector); if (!tokens) { return; } const ast = nestTokens(tokens, { list }); if (!recursive) { return ast; } for (const [token] of flatten(ast)) { if (token.type !== 'pseudo-class' || !token.argument) { continue; } if (!RECURSIVE_PSEUDO_CLASSES.has(token.name)) { continue; } let argument = token.argument; const childArg = RECURSIVE_PSEUDO_CLASSES_ARGS[token.name]; if (childArg) { const match = childArg.exec(argument); if (!match) { continue; } Object.assign(token, match.groups); argument = match.groups['subtree']; } if (!argument) { continue; } Object.assign(token, { subtree: parse(argument, { recursive: true, list: true, }), }); } return ast; } /** * Converts the given list or (sub)tree to a string. */ function parsel_stringify(listOrNode) { let tokens; if (Array.isArray(listOrNode)) { tokens = listOrNode; } else { tokens = [...flatten(listOrNode)].map(([token]) => token); } return tokens.map(token => token.content).join(''); } /** * To convert the specificity array to a number */ function specificityToNumber(specificity, base) { base = base || Math.max(...specificity) + 1; return (specificity[0] * (base << 1) + specificity[1] * base + specificity[2]); } /** * Calculate specificity of a selector. * * If the selector is a list, the max specificity is returned. */ function specificity(selector) { let ast = selector; if (typeof ast === 'string') { ast = parse(ast, { recursive: true }); } if (!ast) { return []; } if (ast.type === 'list' && 'list' in ast) { let base = 10; const specificities = ast.list.map((ast) => { const sp = specificity(ast); base = Math.max(base, ...specificity(ast)); return sp; }); const numbers = specificities.map((ast) => specificityToNumber(ast, base)); return specificities[numbers.indexOf(Math.max(...numbers))]; } const ret = [0, 0, 0]; for (const [token] of flatten(ast)) { switch (token.type) { case 'id': ret[0]++; break; case 'class': case 'attribute': ret[1]++; break; case 'pseudo-element': case 'type': ret[2]++; break; case 'pseudo-class': if (token.name === 'where') { break; } if (!RECURSIVE_PSEUDO_CLASSES.has(token.name) || !token.subtree) { ret[1]++; break; } const sub = specificity(token.subtree); sub.forEach((s, i) => (ret[i] += s)); // :nth-child() & :nth-last-child() add (0, 1, 0) to the specificity of their most complex selector if (token.name === 'nth-child' || token.name === 'nth-last-child') { ret[1]++; } } } return ret; } // EXTERNAL MODULE: ./node_modules/postcss/lib/processor.js var processor = __webpack_require__(9656); var processor_default = /*#__PURE__*/__webpack_require__.n(processor); // EXTERNAL MODULE: ./node_modules/postcss/lib/css-syntax-error.js var css_syntax_error = __webpack_require__(356); var css_syntax_error_default = /*#__PURE__*/__webpack_require__.n(css_syntax_error); // EXTERNAL MODULE: ./node_modules/postcss-prefix-selector/index.js var postcss_prefix_selector = __webpack_require__(1443); var postcss_prefix_selector_default = /*#__PURE__*/__webpack_require__.n(postcss_prefix_selector); // EXTERNAL MODULE: ./node_modules/postcss-urlrebase/index.js var postcss_urlrebase = __webpack_require__(5404); var postcss_urlrebase_default = /*#__PURE__*/__webpack_require__.n(postcss_urlrebase); ;// ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/index.js const cacheByWrapperSelector = /* @__PURE__ */ new Map(); const ROOT_SELECTOR_TOKENS = [ { type: "type", content: "body" }, { type: "type", content: "html" }, { type: "pseudo-class", content: ":root" }, { type: "pseudo-class", content: ":where(body)" }, { type: "pseudo-class", content: ":where(:root)" }, { type: "pseudo-class", content: ":where(html)" } ]; function prefixRootSelector(prefix, selector) { const tokenized = parsel_tokenize(selector); const lastRootIndex = tokenized.findLastIndex(({ content, type }) => { return ROOT_SELECTOR_TOKENS.some( (rootSelector) => content === rootSelector.content && type === rootSelector.type ); }); let insertionPoint = -1; for (let i = lastRootIndex + 1; i < tokenized.length; i++) { if (tokenized[i].type === "combinator") { insertionPoint = i; break; } } const tokenizedPrefix = parsel_tokenize(prefix); tokenized.splice( // Insert at the insertion point, or the end. insertionPoint === -1 ? tokenized.length : insertionPoint, 0, { type: "combinator", content: " " }, ...tokenizedPrefix ); return parsel_stringify(tokenized); } function transformStyle({ css, ignoredSelectors = [], baseURL }, wrapperSelector = "", transformOptions) { if (!wrapperSelector && !baseURL) { return css; } try { const excludedSelectors = [ ...ignoredSelectors, ...transformOptions?.ignoredSelectors ?? [], wrapperSelector ]; return new (processor_default())( [ wrapperSelector && postcss_prefix_selector_default()({ prefix: wrapperSelector, transform(prefix, selector, prefixedSelector) { if (excludedSelectors.some( (excludedSelector) => excludedSelector instanceof RegExp ? selector.match(excludedSelector) : selector.includes(excludedSelector) )) { return selector; } const hasRootSelector = ROOT_SELECTOR_TOKENS.some( (rootSelector) => selector.startsWith(rootSelector.content) ); if (hasRootSelector) { return prefixRootSelector(prefix, selector); } return prefixedSelector; } }), baseURL && postcss_urlrebase_default()({ rootUrl: baseURL }) ].filter(Boolean) ).process(css, {}).css; } catch (error) { if (error instanceof (css_syntax_error_default())) { console.warn( "wp.blockEditor.transformStyles Failed to transform CSS.", error.message + "\n" + error.showSourceCode(false) ); } else { console.warn( "wp.blockEditor.transformStyles Failed to transform CSS.", error ); } return null; } } const transform_styles_transformStyles = (styles, wrapperSelector = "", transformOptions) => { let cache = cacheByWrapperSelector.get(wrapperSelector); if (!cache) { cache = /* @__PURE__ */ new WeakMap(); cacheByWrapperSelector.set(wrapperSelector, cache); } return styles.map((style) => { let css = cache.get(style); if (!css) { css = transformStyle(style, wrapperSelector, transformOptions); cache.set(style, css); } return css; }); }; var transform_styles_default = transform_styles_transformStyles; ;// ./node_modules/@wordpress/block-editor/build-module/components/editor-styles/index.js k([names, a11y]); function useDarkThemeBodyClassName(styles, scope) { return (0,external_wp_element_namespaceObject.useCallback)( (node) => { if (!node) { return; } const { ownerDocument } = node; const { defaultView, body } = ownerDocument; const canvas = scope ? ownerDocument.querySelector(scope) : body; let backgroundColor; if (!canvas) { const tempCanvas = ownerDocument.createElement("div"); tempCanvas.classList.add("editor-styles-wrapper"); body.appendChild(tempCanvas); backgroundColor = defaultView?.getComputedStyle(tempCanvas, null).getPropertyValue("background-color"); body.removeChild(tempCanvas); } else { backgroundColor = defaultView?.getComputedStyle(canvas, null).getPropertyValue("background-color"); } const colordBackgroundColor = w(backgroundColor); if (colordBackgroundColor.luminance() > 0.5 || colordBackgroundColor.alpha() === 0) { body.classList.remove("is-dark-theme"); } else { body.classList.add("is-dark-theme"); } }, [styles, scope] ); } function EditorStyles({ styles, scope, transformOptions }) { const overrides = (0,external_wp_data_namespaceObject.useSelect)( (select) => unlock(select(store)).getStyleOverrides(), [] ); const [transformedStyles, transformedSvgs] = (0,external_wp_element_namespaceObject.useMemo)(() => { const _styles = Object.values(styles ?? []); for (const [id, override] of overrides) { const index = _styles.findIndex(({ id: _id }) => id === _id); const overrideWithId = { ...override, id }; if (index === -1) { _styles.push(overrideWithId); } else { _styles[index] = overrideWithId; } } return [ transform_styles_default( _styles.filter((style) => style?.css), scope, transformOptions ), _styles.filter((style) => style.__unstableType === "svgs").map((style) => style.assets).join("") ]; }, [styles, overrides, scope, transformOptions]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "style", { ref: useDarkThemeBodyClassName(transformedStyles, scope) } ), transformedStyles.map((css, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { children: css }, index)), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 0 0", width: "0", height: "0", role: "none", style: { visibility: "hidden", position: "absolute", left: "-9999px", overflow: "hidden" }, dangerouslySetInnerHTML: { __html: transformedSvgs } } ) ] }); } var editor_styles_default = (0,external_wp_element_namespaceObject.memo)(EditorStyles); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-preview/auto.js const MemoizedBlockList = (0,external_wp_element_namespaceObject.memo)(BlockList); const MAX_HEIGHT = 2e3; const EMPTY_ADDITIONAL_STYLES = []; function ScaledBlockPreview({ viewportWidth, containerWidth, minHeight, additionalStyles = EMPTY_ADDITIONAL_STYLES }) { if (!viewportWidth) { viewportWidth = containerWidth; } const [contentResizeListener, { height: contentHeight }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const { styles } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const settings = select(store).getSettings(); return { styles: settings.styles }; }, []); const editorStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { if (styles) { return [ ...styles, { css: "body{height:auto;overflow:hidden;border:none;padding:0;}", __unstableType: "presets" }, ...additionalStyles ]; } return styles; }, [styles, additionalStyles]); const scale = containerWidth / viewportWidth; const aspectRatio = contentHeight ? containerWidth / (contentHeight * scale) : 0; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Disabled, { className: "block-editor-block-preview__content", style: { transform: `scale(${scale})`, // Using width + aspect-ratio instead of height here triggers browsers' native // handling of scrollbar's visibility. It prevents the flickering issue seen // in https://github.com/WordPress/gutenberg/issues/52027. // See https://github.com/WordPress/gutenberg/pull/52921 for more info. aspectRatio, maxHeight: contentHeight > MAX_HEIGHT ? MAX_HEIGHT * scale : void 0, minHeight }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( iframe_default, { contentRef: (0,external_wp_compose_namespaceObject.useRefEffect)((bodyElement) => { const { ownerDocument: { documentElement } } = bodyElement; documentElement.classList.add( "block-editor-block-preview__content-iframe" ); documentElement.style.position = "absolute"; documentElement.style.width = "100%"; bodyElement.style.boxSizing = "border-box"; bodyElement.style.position = "absolute"; bodyElement.style.width = "100%"; }, []), "aria-hidden": true, tabIndex: -1, style: { position: "absolute", width: viewportWidth, height: contentHeight, pointerEvents: "none", // This is a catch-all max-height for patterns. // See: https://github.com/WordPress/gutenberg/pull/38175. maxHeight: MAX_HEIGHT, minHeight: scale !== 0 && scale < 1 && minHeight ? minHeight / scale : minHeight }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles_default, { styles: editorStyles }), contentResizeListener, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, { renderAppender: false }) ] } ) } ); } function AutoBlockPreview(props) { const [containerResizeListener, { width: containerWidth }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { position: "relative", width: "100%", height: 0 }, children: containerResizeListener }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-preview__container", children: !!containerWidth && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ScaledBlockPreview, { ...props, containerWidth } ) }) ] }); } ;// external ["wp","priorityQueue"] const external_wp_priorityQueue_namespaceObject = window["wp"]["priorityQueue"]; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-preview/async.js const blockPreviewQueue = (0,external_wp_priorityQueue_namespaceObject.createQueue)(); function Async({ children, placeholder }) { const [shouldRender, setShouldRender] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { const context = {}; blockPreviewQueue.add(context, () => { (0,external_wp_element_namespaceObject.flushSync)(() => { setShouldRender(true); }); }); return () => { blockPreviewQueue.cancel(context); }; }, []); if (!shouldRender) { return placeholder; } return children; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-preview/index.js const block_preview_EMPTY_ADDITIONAL_STYLES = []; function BlockPreview({ blocks, viewportWidth = 1200, minHeight, additionalStyles = block_preview_EMPTY_ADDITIONAL_STYLES, // Deprecated props: __experimentalMinHeight, __experimentalPadding }) { if (__experimentalMinHeight) { minHeight = __experimentalMinHeight; external_wp_deprecated_default()("The __experimentalMinHeight prop", { since: "6.2", version: "6.4", alternative: "minHeight" }); } if (__experimentalPadding) { additionalStyles = [ ...additionalStyles, { css: `body { padding: ${__experimentalPadding}px; }` } ]; external_wp_deprecated_default()("The __experimentalPadding prop of BlockPreview", { since: "6.2", version: "6.4", alternative: "additionalStyles" }); } const originalSettings = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).getSettings(), [] ); const settings = (0,external_wp_element_namespaceObject.useMemo)( () => ({ ...originalSettings, focusMode: false, // Disable "Spotlight mode". isPreviewMode: true }), [originalSettings] ); const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)( () => Array.isArray(blocks) ? blocks : [blocks], [blocks] ); if (!blocks || blocks.length === 0) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ExperimentalBlockEditorProvider, { value: renderedBlocks, settings, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AutoBlockPreview, { viewportWidth, minHeight, additionalStyles } ) } ); } const MemoizedBlockPreview = (0,external_wp_element_namespaceObject.memo)(BlockPreview); MemoizedBlockPreview.Async = Async; var block_preview_default = MemoizedBlockPreview; function useBlockPreview({ blocks, props = {}, layout }) { const originalSettings = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).getSettings(), [] ); const settings = (0,external_wp_element_namespaceObject.useMemo)( () => ({ ...originalSettings, styles: void 0, // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles. focusMode: false, // Disable "Spotlight mode". isPreviewMode: true }), [originalSettings] ); const disabledRef = (0,external_wp_compose_namespaceObject.useDisabled)(); const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, disabledRef]); const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)( () => Array.isArray(blocks) ? blocks : [blocks], [blocks] ); const children = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( ExperimentalBlockEditorProvider, { value: renderedBlocks, settings, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles_default, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListItems, { renderAppender: false, layout }) ] } ); return { ...props, ref, className: dist_clsx( props.className, "block-editor-block-preview__live-content", "components-disabled" ), children: blocks?.length ? children : null }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/preview-panel.js function InserterPreviewPanel({ item }) { const { name, title, icon, description, initialAttributes, example } = item; const isReusable = (0,external_wp_blocks_namespaceObject.isReusableBlock)(item); const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!example) { return (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes); } return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, { attributes: { ...example.attributes, ...initialAttributes }, innerBlocks: example.innerBlocks }); }, [name, example, initialAttributes]); const previewHeight = 144; const sidebarWidth = 280; const viewportWidth = example?.viewportWidth ?? 500; const scale = sidebarWidth / viewportWidth; const minHeight = scale !== 0 && scale < 1 && previewHeight ? previewHeight / scale : previewHeight; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__preview-container", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__preview", children: isReusable || example ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__preview-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_preview_default, { blocks, viewportWidth, minHeight: previewHeight, additionalStyles: ( //We want this CSS to be in sync with the one in BlockPreviewPanel. [ { css: ` body { padding: 24px; min-height:${Math.round(minHeight)}px; display:flex; align-items:center; } .is-root-container { width: 100%; } ` } ] ) } ) }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__preview-content-missing", children: (0,external_wp_i18n_namespaceObject.__)("No preview available.") }) }), !isReusable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_card_default, { title, icon, description } ) ] }); } var preview_panel_default = InserterPreviewPanel; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/item.js function InserterListboxItem({ isFirst, as: Component, children, ...props }, ref) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite.Item, { ref, role: "option", accessibleWhenDisabled: true, ...props, render: (htmlProps) => { const propsWithTabIndex = { ...htmlProps, tabIndex: isFirst ? 0 : htmlProps.tabIndex }; if (Component) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...propsWithTabIndex, children }); } if (typeof children === "function") { return children(propsWithTabIndex); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...propsWithTabIndex, children }); } } ); } var item_default = (0,external_wp_element_namespaceObject.forwardRef)(InserterListboxItem); ;// ./node_modules/@wordpress/icons/build-module/library/drag-handle.js var drag_handle_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 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/draggable-chip.js function BlockDraggableChip({ count, icon, isPattern, fadeWhenDisabled }) { const patternLabel = isPattern && (0,external_wp_i18n_namespaceObject.__)("Pattern"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-draggable-chip-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "block-editor-block-draggable-chip", "data-testid": "block-draggable-chip", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Flex, { justify: "center", className: "block-editor-block-draggable-chip__content", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: icon ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon }) : patternLabel || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: Number of blocks. */ (0,external_wp_i18n_namespaceObject._n)("%d block", "%d blocks", count), count ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: drag_handle_default }) }), fadeWhenDisabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "block-editor-block-draggable-chip__disabled", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-draggable-chip__disabled-icon" }) }) ] } ) } ) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-draggable-blocks/index.js const InserterDraggableBlocks = ({ isEnabled, blocks, icon, children, pattern }) => { const blockTypeIcon = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockType } = select(external_wp_blocks_namespaceObject.store); return blocks.length === 1 && getBlockType(blocks[0].name)?.icon; }, [blocks] ); const { startDragging, stopDragging } = unlock( (0,external_wp_data_namespaceObject.useDispatch)(store) ); const patternBlock = (0,external_wp_element_namespaceObject.useMemo)(() => { return pattern?.type === INSERTER_PATTERN_TYPES.user && pattern?.syncStatus !== "unsynced" ? [(0,external_wp_blocks_namespaceObject.createBlock)("core/block", { ref: pattern.id })] : void 0; }, [pattern?.type, pattern?.syncStatus, pattern?.id]); if (!isEnabled) { return children({ draggable: false, onDragStart: void 0, onDragEnd: void 0 }); } const draggableBlocks = patternBlock ?? blocks; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Draggable, { __experimentalTransferDataType: "wp-blocks", transferData: { type: "inserter", blocks: draggableBlocks }, onDragStart: (event) => { startDragging(); for (const block of draggableBlocks) { const type = `wp-block:${block.name}`; event.dataTransfer.items.add("", type); } }, onDragEnd: () => { stopDragging(); }, __experimentalDragComponent: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockDraggableChip, { count: blocks.length, icon: icon || !pattern && blockTypeIcon, isPattern: !!pattern } ), children: ({ onDraggableStart, onDraggableEnd }) => { return children({ draggable: true, onDragStart: onDraggableStart, onDragEnd: onDraggableEnd }); } } ); }; var inserter_draggable_blocks_default = InserterDraggableBlocks; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-list-item/index.js function InserterListItem({ className, isFirst, item, onSelect, onHover, isDraggable, ...props }) { const isDraggingRef = (0,external_wp_element_namespaceObject.useRef)(false); const itemIconStyle = item.icon ? { backgroundColor: item.icon.background, color: item.icon.foreground } : {}; const blocks = (0,external_wp_element_namespaceObject.useMemo)( () => [ (0,external_wp_blocks_namespaceObject.createBlock)( item.name, item.initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(item.innerBlocks) ) ], [item.name, item.initialAttributes, item.innerBlocks] ); const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(item) && item.syncStatus !== "unsynced" || (0,external_wp_blocks_namespaceObject.isTemplatePart)(item); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inserter_draggable_blocks_default, { isEnabled: isDraggable && !item.isDisabled, blocks, icon: item.icon, children: ({ draggable, onDragStart, onDragEnd }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx( "block-editor-block-types-list__list-item", { "is-synced": isSynced } ), draggable, onDragStart: (event) => { isDraggingRef.current = true; if (onDragStart) { onHover(null); onDragStart(event); } }, onDragEnd: (event) => { isDraggingRef.current = false; if (onDragEnd) { onDragEnd(event); } }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( item_default, { isFirst, className: dist_clsx( "block-editor-block-types-list__item", className ), disabled: item.isDisabled, onClick: (event) => { event.preventDefault(); onSelect( item, (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey ); onHover(null); }, onKeyDown: (event) => { const { keyCode } = event; if (keyCode === external_wp_keycodes_namespaceObject.ENTER) { event.preventDefault(); onSelect( item, (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey ); onHover(null); } }, onMouseEnter: () => { if (isDraggingRef.current) { return; } onHover(item); }, onMouseLeave: () => onHover(null), ...props, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { className: "block-editor-block-types-list__item-icon", style: itemIconStyle, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: item.icon, showColors: true }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-types-list__item-title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { numberOfLines: 3, children: item.title }) }) ] } ) } ) } ); } var inserter_list_item_default = (0,external_wp_element_namespaceObject.memo)(InserterListItem); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/group.js function InserterListboxGroup(props, ref) { const [shouldSpeak, setShouldSpeak] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { if (shouldSpeak) { (0,external_wp_a11y_namespaceObject.speak)( (0,external_wp_i18n_namespaceObject.__)("Use left and right arrow keys to move through blocks") ); } }, [shouldSpeak]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { ref, role: "listbox", "aria-orientation": "horizontal", onFocus: () => { setShouldSpeak(true); }, onBlur: (event) => { const focusingOutsideGroup = !event.currentTarget.contains( event.relatedTarget ); if (focusingOutsideGroup) { setShouldSpeak(false); } }, ...props } ); } var group_default = (0,external_wp_element_namespaceObject.forwardRef)(InserterListboxGroup); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/row.js function InserterListboxRow(props, ref) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Group, { role: "presentation", ref, ...props }); } var row_default = (0,external_wp_element_namespaceObject.forwardRef)(InserterListboxRow); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-types-list/index.js function chunk(array, size) { const chunks = []; for (let i = 0, j = array.length; i < j; i += size) { chunks.push(array.slice(i, i + size)); } return chunks; } function BlockTypesList({ items = [], onSelect, onHover = () => { }, children, label, isDraggable = true }) { const className = "block-editor-block-types-list"; const listId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockTypesList, className); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(group_default, { className, "aria-label": label, children: [ chunk(items, 3).map((row, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(row_default, { children: row.map((item, j) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inserter_list_item_default, { item, className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)( item.id ), onSelect, onHover, isDraggable: isDraggable && !item.isDisabled, isFirst: i === 0 && j === 0, rowId: `${listId}-${i}` }, item.id )) }, i)), children ] }); } var block_types_list_default = BlockTypesList; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/panel.js function InserterPanel({ title, icon, children }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__panel-header", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "block-editor-inserter__panel-title", children: title }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__panel-content", children }) ] }); } var panel_default = InserterPanel; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-block-types-state.js const useBlockTypesState = (rootClientId, onInsert, isQuick) => { const options = (0,external_wp_element_namespaceObject.useMemo)( () => ({ [isFiltered]: !!isQuick }), [isQuick] ); const [items] = (0,external_wp_data_namespaceObject.useSelect)( (select) => [ select(store).getInserterItems( rootClientId, options ) ], [rootClientId, options] ); const { getClosestAllowedInsertionPoint } = unlock( (0,external_wp_data_namespaceObject.useSelect)(store) ); const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const [categories, collections] = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getCategories, getCollections } = select(external_wp_blocks_namespaceObject.store); return [getCategories(), getCollections()]; }, []); const onSelectItem = (0,external_wp_element_namespaceObject.useCallback)( ({ name, initialAttributes, innerBlocks, syncStatus, content }, shouldFocusBlock) => { const destinationClientId = getClosestAllowedInsertionPoint( name, rootClientId ); if (destinationClientId === null) { const title = (0,external_wp_blocks_namespaceObject.getBlockType)(name)?.title ?? name; createErrorNotice( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block pattern title. */ (0,external_wp_i18n_namespaceObject.__)(`Block "%s" can't be inserted.`), title ), { type: "snackbar", id: "inserter-notice" } ); return; } const insertedBlock = syncStatus === "unsynced" ? (0,external_wp_blocks_namespaceObject.parse)(content, { __unstableSkipMigrationLogs: true }) : (0,external_wp_blocks_namespaceObject.createBlock)( name, initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(innerBlocks) ); onInsert( insertedBlock, void 0, shouldFocusBlock, destinationClientId ); }, [ getClosestAllowedInsertionPoint, rootClientId, onInsert, createErrorNotice ] ); return [items, categories, collections, onSelectItem]; }; var use_block_types_state_default = useBlockTypesState; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/index.js function InserterListBoxWrapper({ key, children }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children }, key); } function InserterListbox({ children }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite, { focusShift: true, focusWrap: "horizontal", render: InserterListBoxWrapper, children } ); } var inserter_listbox_default = InserterListbox; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/no-results.js function InserterNoResults() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__no-results", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("No results found.") }) }); } var no_results_default = InserterNoResults; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-types-tab.js const getBlockNamespace = (item) => item.name.split("/")[0]; const MAX_SUGGESTED_ITEMS = 6; const block_types_tab_EMPTY_ARRAY = []; function BlockTypesTabPanel({ items, collections, categories, onSelectItem, onHover, showMostUsedBlocks, className }) { const suggestedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { return orderBy(items, "frecency", "desc").slice( 0, MAX_SUGGESTED_ITEMS ); }, [items]); const uncategorizedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { return items.filter((item) => !item.category); }, [items]); const itemsPerCollection = (0,external_wp_element_namespaceObject.useMemo)(() => { const result = { ...collections }; Object.keys(collections).forEach((namespace) => { result[namespace] = items.filter( (item) => getBlockNamespace(item) === namespace ); if (result[namespace].length === 0) { delete result[namespace]; } }); return result; }, [items, collections]); (0,external_wp_element_namespaceObject.useEffect)(() => () => onHover(null), []); const currentlyRenderedCategories = (0,external_wp_compose_namespaceObject.useAsyncList)(categories); const didRenderAllCategories = categories.length === currentlyRenderedCategories.length; const collectionEntries = (0,external_wp_element_namespaceObject.useMemo)(() => { return Object.entries(collections); }, [collections]); const currentlyRenderedCollections = (0,external_wp_compose_namespaceObject.useAsyncList)( didRenderAllCategories ? collectionEntries : block_types_tab_EMPTY_ARRAY ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className, children: [ showMostUsedBlocks && // Only show the most used blocks if the total amount of block // is larger than 1 row, otherwise it is not so useful. items.length > 3 && !!suggestedItems.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(panel_default, { title: (0,external_wp_i18n_namespaceObject._x)("Most used", "blocks"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_types_list_default, { items: suggestedItems, onSelect: onSelectItem, onHover, label: (0,external_wp_i18n_namespaceObject._x)("Most used", "blocks") } ) }), currentlyRenderedCategories.map((category) => { const categoryItems = items.filter( (item) => item.category === category.slug ); if (!categoryItems || !categoryItems.length) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( panel_default, { title: category.title, icon: category.icon, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_types_list_default, { items: categoryItems, onSelect: onSelectItem, onHover, label: category.title } ) }, category.slug ); }), didRenderAllCategories && uncategorizedItems.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( panel_default, { className: "block-editor-inserter__uncategorized-blocks-panel", title: (0,external_wp_i18n_namespaceObject.__)("Uncategorized"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_types_list_default, { items: uncategorizedItems, onSelect: onSelectItem, onHover, label: (0,external_wp_i18n_namespaceObject.__)("Uncategorized") } ) } ), currentlyRenderedCollections.map( ([namespace, collection]) => { const collectionItems = itemsPerCollection[namespace]; if (!collectionItems || !collectionItems.length) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( panel_default, { title: collection.title, icon: collection.icon, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_types_list_default, { items: collectionItems, onSelect: onSelectItem, onHover, label: collection.title } ) }, namespace ); } ) ] }); } function BlockTypesTab({ rootClientId, onInsert, onHover, showMostUsedBlocks }, ref) { const [items, categories, collections, onSelectItem] = use_block_types_state_default( rootClientId, onInsert ); if (!items.length) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {}); } const itemsForCurrentRoot = []; const itemsRemaining = []; for (const item of items) { if (item.category === "reusable") { continue; } if (item.isAllowedInCurrentRoot) { itemsForCurrentRoot.push(item); } else { itemsRemaining.push(item); } } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_listbox_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref, children: [ !!itemsForCurrentRoot.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockTypesTabPanel, { items: itemsForCurrentRoot, categories, collections, onSelectItem, onHover, showMostUsedBlocks, className: "block-editor-inserter__insertable-blocks-at-selection" } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockTypesTabPanel, { items: itemsRemaining, categories, collections, onSelectItem, onHover, showMostUsedBlocks, className: "block-editor-inserter__all-blocks" } ) ] }) }); } var block_types_tab_default = (0,external_wp_element_namespaceObject.forwardRef)(BlockTypesTab); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js function PatternCategoriesList({ selectedCategory, patternCategories, onClickCategory }) { const baseClassName = "block-editor-block-patterns-explorer__sidebar"; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseClassName}__categories-list`, children: patternCategories.map(({ name, label }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, label, className: `${baseClassName}__categories-list__item`, isPressed: selectedCategory === name, onClick: () => { onClickCategory(name); }, children: label }, name ); }) }); } function PatternsExplorerSearch({ searchValue, setSearchValue }) { const baseClassName = "block-editor-block-patterns-explorer__search"; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: baseClassName, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SearchControl, { __nextHasNoMarginBottom: true, onChange: setSearchValue, value: searchValue, label: (0,external_wp_i18n_namespaceObject.__)("Search"), placeholder: (0,external_wp_i18n_namespaceObject.__)("Search") } ) }); } function PatternExplorerSidebar({ selectedCategory, patternCategories, onClickCategory, searchValue, setSearchValue }) { const baseClassName = "block-editor-block-patterns-explorer__sidebar"; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: baseClassName, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PatternsExplorerSearch, { searchValue, setSearchValue } ), !searchValue && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PatternCategoriesList, { selectedCategory, patternCategories, onClickCategory } ) ] }); } var pattern_explorer_sidebar_default = PatternExplorerSidebar; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-paging/index.js function Pagination({ currentPage, numPages, changePage, totalItems }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-patterns__grid-pagination-wrapper", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Total number of patterns. (0,external_wp_i18n_namespaceObject._n)("%s item", "%s items", totalItems), totalItems ) }), numPages > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 3, justify: "flex-start", className: "block-editor-patterns__grid-pagination", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, className: "block-editor-patterns__grid-pagination-previous", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: () => changePage(1), disabled: currentPage === 1, "aria-label": (0,external_wp_i18n_namespaceObject.__)("First page"), size: "compact", accessibleWhenDisabled: true, className: "block-editor-patterns__grid-pagination-button", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\xAB" }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: () => changePage(currentPage - 1), disabled: currentPage === 1, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Previous page"), size: "compact", accessibleWhenDisabled: true, className: "block-editor-patterns__grid-pagination-button", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\u2039" }) } ) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Current page number. 2: Total number of pages. (0,external_wp_i18n_namespaceObject._x)("%1$s of %2$s", "paging"), currentPage, numPages ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, className: "block-editor-patterns__grid-pagination-next", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: () => changePage(currentPage + 1), disabled: currentPage === numPages, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Next page"), size: "compact", accessibleWhenDisabled: true, className: "block-editor-patterns__grid-pagination-button", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\u203A" }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: () => changePage(numPages), disabled: currentPage === numPages, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Last page"), size: "compact", accessibleWhenDisabled: true, className: "block-editor-patterns__grid-pagination-button", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\xBB" }) } ) ] } ) ] } ) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-list/index.js const WithToolTip = ({ showTooltip, title, children }) => { if (showTooltip) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: title, children }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children }); }; function BlockPattern({ id, isDraggable, pattern, onClick, onHover, showTitlesAsTooltip, category, isSelected }) { const [isDragging, setIsDragging] = (0,external_wp_element_namespaceObject.useState)(false); const { blocks, viewportWidth } = pattern; const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockPattern); const descriptionId = `block-editor-block-patterns-list__item-description-${instanceId}`; const isUserPattern = pattern.type === INSERTER_PATTERN_TYPES.user; const patternBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!category || !isDraggable) { return blocks; } return (blocks ?? []).map((block) => { const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(block); if (clonedBlock.attributes.metadata?.categories?.includes( category )) { clonedBlock.attributes.metadata.categories = [category]; } return clonedBlock; }); }, [blocks, isDraggable, category]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inserter_draggable_blocks_default, { isEnabled: isDraggable, blocks: patternBlocks, pattern, children: ({ draggable, onDragStart, onDragEnd }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "block-editor-block-patterns-list__list-item", draggable, onDragStart: (event) => { setIsDragging(true); if (onDragStart) { onHover?.(null); onDragStart(event); } }, onDragEnd: (event) => { setIsDragging(false); if (onDragEnd) { onDragEnd(event); } }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WithToolTip, { showTooltip: showTitlesAsTooltip && !isUserPattern, title: pattern.title, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Composite.Item, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { role: "option", "aria-label": pattern.title, "aria-describedby": pattern.description ? descriptionId : void 0, className: dist_clsx( "block-editor-block-patterns-list__item", { "block-editor-block-patterns-list__list-item-synced": pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus, "is-selected": isSelected } ) } ), id, onClick: () => { onClick(pattern, blocks); onHover?.(null); }, onMouseEnter: () => { if (isDragging) { return; } onHover?.(pattern); }, onMouseLeave: () => onHover?.(null), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_preview_default.Async, { placeholder: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockPatternPlaceholder, {}), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_preview_default, { blocks, viewportWidth } ) } ), (!showTitlesAsTooltip || isUserPattern) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { className: "block-editor-patterns__pattern-details", spacing: 2, children: [ isUserPattern && !pattern.syncStatus && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-patterns__pattern-icon-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( icon_default, { className: "block-editor-patterns__pattern-icon", icon: symbol_default } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-patterns-list__item-title", children: pattern.title }) ] } ), !!pattern.description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: pattern.description }) ] } ) } ) } ) } ); } function BlockPatternPlaceholder() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-patterns-list__item is-placeholder" }); } function BlockPatternsList({ isDraggable, blockPatterns, onHover, onClickPattern, orientation, label = (0,external_wp_i18n_namespaceObject.__)("Block patterns"), category, showTitlesAsTooltip, pagingProps }, ref) { const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_namespaceObject.useState)(void 0); const [activePattern, setActivePattern] = (0,external_wp_element_namespaceObject.useState)(null); (0,external_wp_element_namespaceObject.useEffect)(() => { const firstCompositeItemId = blockPatterns[0]?.name; setActiveCompositeId(firstCompositeItemId); }, [blockPatterns]); const handleClickPattern = (pattern, blocks) => { setActivePattern(pattern.name); onClickPattern(pattern, blocks); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Composite, { orientation, activeId: activeCompositeId, setActiveId: setActiveCompositeId, role: "listbox", className: "block-editor-block-patterns-list", "aria-label": label, ref, children: [ blockPatterns.map((pattern) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockPattern, { id: pattern.name, pattern, onClick: handleClickPattern, onHover, isDraggable, showTitlesAsTooltip, category, isSelected: !!activePattern && activePattern === pattern.name }, pattern.name )), pagingProps && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { ...pagingProps }) ] } ); } var block_patterns_list_default = (0,external_wp_element_namespaceObject.forwardRef)(BlockPatternsList); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-insertion-point.js function getIndex({ destinationRootClientId, destinationIndex, rootClientId, registry }) { if (rootClientId === destinationRootClientId) { return destinationIndex; } const parents = [ "", ...registry.select(store).getBlockParents(destinationRootClientId), destinationRootClientId ]; const parentIndex = parents.indexOf(rootClientId); if (parentIndex !== -1) { return registry.select(store).getBlockIndex(parents[parentIndex + 1]) + 1; } return registry.select(store).getBlockOrder(rootClientId).length; } function useInsertionPoint({ rootClientId = "", insertionIndex, clientId, isAppender, onSelect, shouldFocusBlock = true, selectBlockOnInsert = true }) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { getSelectedBlock, getClosestAllowedInsertionPoint, isBlockInsertionPointVisible } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); const { destinationRootClientId, destinationIndex } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getSelectedBlockClientId, getBlockRootClientId, getBlockIndex, getBlockOrder, getInsertionPoint } = unlock(select(store)); const selectedBlockClientId = getSelectedBlockClientId(); let _destinationRootClientId = rootClientId; let _destinationIndex; const insertionPoint = getInsertionPoint(); if (insertionIndex !== void 0) { _destinationIndex = insertionIndex; } else if (insertionPoint && insertionPoint.hasOwnProperty("index")) { _destinationRootClientId = insertionPoint?.rootClientId ? insertionPoint.rootClientId : rootClientId; _destinationIndex = insertionPoint.index; } else if (clientId) { _destinationIndex = getBlockIndex(clientId); } else if (!isAppender && selectedBlockClientId) { _destinationRootClientId = getBlockRootClientId( selectedBlockClientId ); _destinationIndex = getBlockIndex(selectedBlockClientId) + 1; } else { _destinationIndex = getBlockOrder( _destinationRootClientId ).length; } return { destinationRootClientId: _destinationRootClientId, destinationIndex: _destinationIndex }; }, [rootClientId, insertionIndex, clientId, isAppender] ); const { replaceBlocks, insertBlocks, showInsertionPoint, hideInsertionPoint, setLastFocus } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const onInsertBlocks = (0,external_wp_element_namespaceObject.useCallback)( (blocks, meta, shouldForceFocusBlock = false, _rootClientId) => { if (shouldForceFocusBlock || shouldFocusBlock || selectBlockOnInsert) { setLastFocus(null); } const selectedBlock = getSelectedBlock(); if (!isAppender && selectedBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(selectedBlock, "content")) { replaceBlocks( selectedBlock.clientId, blocks, null, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta ); } else { insertBlocks( blocks, isAppender || _rootClientId === void 0 ? destinationIndex : getIndex({ destinationRootClientId, destinationIndex, rootClientId: _rootClientId, registry }), isAppender || _rootClientId === void 0 ? destinationRootClientId : _rootClientId, selectBlockOnInsert, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta ); } const blockLength = Array.isArray(blocks) ? blocks.length : 1; const message = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: the name of the block that has been added (0,external_wp_i18n_namespaceObject._n)("%d block added.", "%d blocks added.", blockLength), blockLength ); (0,external_wp_a11y_namespaceObject.speak)(message); if (onSelect) { onSelect(blocks); } }, [ isAppender, getSelectedBlock, replaceBlocks, insertBlocks, destinationRootClientId, destinationIndex, onSelect, shouldFocusBlock, selectBlockOnInsert ] ); const onToggleInsertionPoint = (0,external_wp_element_namespaceObject.useCallback)( (item) => { if (item && !isBlockInsertionPointVisible()) { const allowedDestinationRootClientId = getClosestAllowedInsertionPoint( item.name, destinationRootClientId ); if (allowedDestinationRootClientId !== null) { showInsertionPoint( allowedDestinationRootClientId, getIndex({ destinationRootClientId, destinationIndex, rootClientId: allowedDestinationRootClientId, registry }) ); } } else { hideInsertionPoint(); } }, [ getClosestAllowedInsertionPoint, isBlockInsertionPointVisible, showInsertionPoint, hideInsertionPoint, destinationRootClientId, destinationIndex ] ); return [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint]; } var use_insertion_point_default = useInsertionPoint; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-state.js const usePatternsState = (onInsert, rootClientId, selectedCategory, isQuick) => { const options = (0,external_wp_element_namespaceObject.useMemo)( () => ({ [isFiltered]: !!isQuick }), [isQuick] ); const { patternCategories, patterns, userPatternCategories } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getSettings, __experimentalGetAllowedPatterns } = unlock( select(store) ); const { __experimentalUserPatternCategories, __experimentalBlockPatternCategories } = getSettings(); return { patterns: __experimentalGetAllowedPatterns( rootClientId, options ), userPatternCategories: __experimentalUserPatternCategories, patternCategories: __experimentalBlockPatternCategories }; }, [rootClientId, options] ); const { getClosestAllowedInsertionPointForPattern } = unlock( (0,external_wp_data_namespaceObject.useSelect)(store) ); const allCategories = (0,external_wp_element_namespaceObject.useMemo)(() => { const categories = [...patternCategories]; userPatternCategories?.forEach((userCategory) => { if (!categories.find( (existingCategory) => existingCategory.name === userCategory.name )) { categories.push(userCategory); } }); return categories; }, [patternCategories, userPatternCategories]); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const onClickPattern = (0,external_wp_element_namespaceObject.useCallback)( (pattern, blocks) => { const destinationRootClientId = isQuick ? rootClientId : getClosestAllowedInsertionPointForPattern( pattern, rootClientId ); if (destinationRootClientId === null) { return; } const patternBlocks = pattern.type === INSERTER_PATTERN_TYPES.user && pattern.syncStatus !== "unsynced" ? [(0,external_wp_blocks_namespaceObject.createBlock)("core/block", { ref: pattern.id })] : blocks; onInsert( (patternBlocks ?? []).map((block) => { const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(block); if (clonedBlock.attributes.metadata?.categories?.includes( selectedCategory )) { clonedBlock.attributes.metadata.categories = [ selectedCategory ]; } return clonedBlock; }), pattern.name, false, destinationRootClientId ); createSuccessNotice( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block pattern title. */ (0,external_wp_i18n_namespaceObject.__)('Block pattern "%s" inserted.'), pattern.title ), { type: "snackbar", id: "inserter-notice" } ); }, [ createSuccessNotice, onInsert, selectedCategory, rootClientId, getClosestAllowedInsertionPointForPattern, isQuick ] ); return [patterns, allCategories, onClickPattern]; }; var use_patterns_state_default = usePatternsState; // EXTERNAL MODULE: ./node_modules/remove-accents/index.js var remove_accents = __webpack_require__(9681); var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); ;// ./node_modules/lower-case/dist.es2015/index.js /** * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt */ var SUPPORTED_LOCALE = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, az: { regexp: /\u0130/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, lt: { regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, map: { I: "\u0069\u0307", J: "\u006A\u0307", Į: "\u012F\u0307", Ì: "\u0069\u0307\u0300", Í: "\u0069\u0307\u0301", Ĩ: "\u0069\u0307\u0303", }, }, }; /** * Localized lower case. */ function localeLowerCase(str, locale) { var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; if (lang) return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); return lowerCase(str); } /** * Lower case as a function. */ function lowerCase(str) { return str.toLowerCase(); } ;// ./node_modules/no-case/dist.es2015/index.js // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; /** * Normalize the string into something other libraries can manipulate easier. */ function noCase(input, options) { if (options === void 0) { options = {}; } 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; var result = dist_es2015_replace(dist_es2015_replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; // Trim the delimiter from around the output string. while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; // Transform each token independently. return result.slice(start, end).split("\0").map(transform).join(delimiter); } /** * Replace `re` in the input string with the replacement value. */ function dist_es2015_replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-items.js const defaultGetName = (item) => item.name || ""; const defaultGetTitle = (item) => item.title; const defaultGetDescription = (item) => item.description || ""; const defaultGetKeywords = (item) => item.keywords || []; const defaultGetCategory = (item) => item.category; const defaultGetCollection = () => null; const splitRegexp = [ /([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu, // One lowercase or digit, followed by one uppercase. /([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu // One uppercase followed by one uppercase and one lowercase. ]; const stripRegexp = new RegExp("(\\p{C}|\\p{P}|\\p{S})+", "giu"); const extractedWords = /* @__PURE__ */ new Map(); const normalizedStrings = /* @__PURE__ */ new Map(); function extractWords(input = "") { if (extractedWords.has(input)) { return extractedWords.get(input); } const result = noCase(input, { splitRegexp, stripRegexp }).split(" ").filter(Boolean); extractedWords.set(input, result); return result; } function normalizeString(input = "") { if (normalizedStrings.has(input)) { return normalizedStrings.get(input); } let result = remove_accents_default()(input); result = result.replace(/^\//, ""); result = result.toLowerCase(); normalizedStrings.set(input, result); return result; } const getNormalizedSearchTerms = (input = "") => { return extractWords(normalizeString(input)); }; const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { return unmatchedTerms.filter( (term) => !getNormalizedSearchTerms(unprocessedTerms).some( (unprocessedTerm) => unprocessedTerm.includes(term) ) ); }; const searchBlockItems = (items, categories, collections, searchInput) => { const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); if (normalizedSearchTerms.length === 0) { return items; } const config = { getCategory: (item) => categories.find(({ slug }) => slug === item.category)?.title, getCollection: (item) => collections[item.name.split("/")[0]]?.title }; return searchItems(items, searchInput, config); }; const searchItems = (items = [], searchInput = "", config = {}) => { const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); if (normalizedSearchTerms.length === 0) { return items; } const rankedItems = items.map((item) => { return [item, getItemSearchRank(item, searchInput, config)]; }).filter(([, rank]) => rank > 0); rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1); return rankedItems.map(([item]) => item); }; function getItemSearchRank(item, searchTerm, config = {}) { const { getName = defaultGetName, getTitle = defaultGetTitle, getDescription = defaultGetDescription, getKeywords = defaultGetKeywords, getCategory = defaultGetCategory, getCollection = defaultGetCollection } = config; const name = getName(item); const title = getTitle(item); const description = getDescription(item); const keywords = getKeywords(item); const category = getCategory(item); const collection = getCollection(item); const normalizedSearchInput = normalizeString(searchTerm); const normalizedTitle = normalizeString(title); let rank = 0; if (normalizedSearchInput === normalizedTitle) { rank += 30; } else if (normalizedTitle.startsWith(normalizedSearchInput)) { rank += 20; } else { const terms = [ name, title, description, ...keywords, category, collection ].join(" "); const normalizedSearchTerms = extractWords(normalizedSearchInput); const unmatchedTerms = removeMatchingTerms( normalizedSearchTerms, terms ); if (unmatchedTerms.length === 0) { rank += 10; } } if (rank !== 0 && name.startsWith("core/")) { const isCoreBlockVariation = name !== item.id; rank += isCoreBlockVariation ? 1 : 2; } return rank; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-paging.js const PAGE_SIZE = 20; function usePatternsPaging(currentCategoryPatterns, currentCategory, scrollContainerRef, currentFilter = "") { const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(1); const previousCategory = (0,external_wp_compose_namespaceObject.usePrevious)(currentCategory); const previousFilter = (0,external_wp_compose_namespaceObject.usePrevious)(currentFilter); if ((previousCategory !== currentCategory || previousFilter !== currentFilter) && currentPage !== 1) { setCurrentPage(1); } const totalItems = currentCategoryPatterns.length; const pageIndex = currentPage - 1; const categoryPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { return currentCategoryPatterns.slice( pageIndex * PAGE_SIZE, pageIndex * PAGE_SIZE + PAGE_SIZE ); }, [pageIndex, currentCategoryPatterns]); const numPages = Math.ceil(currentCategoryPatterns.length / PAGE_SIZE); const changePage = (page) => { const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)( scrollContainerRef?.current ); scrollContainer?.scrollTo(0, 0); setCurrentPage(page); }; (0,external_wp_element_namespaceObject.useEffect)( function scrollToTopOnCategoryChange() { const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)( scrollContainerRef?.current ); scrollContainer?.scrollTo(0, 0); }, [currentCategory, scrollContainerRef] ); return { totalItems, categoryPatterns, numPages, changePage, currentPage }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/pattern-list.js function PatternsListHeader({ filterValue, filteredBlockPatternsLength }) { if (!filterValue) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHeading, { level: 2, lineHeight: "48px", className: "block-editor-block-patterns-explorer__search-results-count", children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of patterns. */ (0,external_wp_i18n_namespaceObject._n)( "%d pattern found", "%d patterns found", filteredBlockPatternsLength ), filteredBlockPatternsLength ) } ); } function PatternList({ searchValue, selectedCategory, patternCategories, rootClientId, onModalClose }) { const container = (0,external_wp_element_namespaceObject.useRef)(); const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); const [destinationRootClientId, onInsertBlocks] = use_insertion_point_default({ rootClientId, shouldFocusBlock: true }); const [patterns, , onClickPattern] = use_patterns_state_default( onInsertBlocks, destinationRootClientId, selectedCategory ); const registeredPatternCategories = (0,external_wp_element_namespaceObject.useMemo)( () => patternCategories.map( (patternCategory) => patternCategory.name ), [patternCategories] ); const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { const filteredPatterns = patterns.filter((pattern) => { if (selectedCategory === allPatternsCategory.name) { return true; } if (selectedCategory === myPatternsCategory.name && pattern.type === INSERTER_PATTERN_TYPES.user) { return true; } if (selectedCategory === starterPatternsCategory.name && pattern.blockTypes?.includes("core/post-content")) { return true; } if (selectedCategory === "uncategorized") { const hasKnownCategory = pattern.categories?.some( (category) => registeredPatternCategories.includes(category) ) ?? false; return !pattern.categories?.length || !hasKnownCategory; } return pattern.categories?.includes(selectedCategory); }); if (!searchValue) { return filteredPatterns; } return searchItems(filteredPatterns, searchValue); }, [ searchValue, patterns, selectedCategory, registeredPatternCategories ]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!searchValue) { return; } const count = filteredBlockPatterns.length; const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", count), count ); debouncedSpeak(resultsFoundMessage); }, [searchValue, debouncedSpeak, filteredBlockPatterns.length]); const pagingProps = usePatternsPaging( filteredBlockPatterns, selectedCategory, container ); const [previousSearchValue, setPreviousSearchValue] = (0,external_wp_element_namespaceObject.useState)(searchValue); if (searchValue !== previousSearchValue) { setPreviousSearchValue(searchValue); pagingProps.changePage(1); } const hasItems = !!filteredBlockPatterns?.length; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: "block-editor-block-patterns-explorer__list", ref: container, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PatternsListHeader, { filterValue: searchValue, filteredBlockPatternsLength: filteredBlockPatterns.length } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_listbox_default, { children: hasItems && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_patterns_list_default, { blockPatterns: pagingProps.categoryPatterns, onClickPattern: (pattern, blocks) => { onClickPattern(pattern, blocks); onModalClose(); }, isDraggable: false } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { ...pagingProps }) ] }) }) ] } ); } var pattern_list_default = PatternList; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js function hasRegisteredCategory(pattern, allCategories) { if (!pattern.categories || !pattern.categories.length) { return false; } return pattern.categories.some( (cat) => allCategories.some((category) => category.name === cat) ); } function usePatternCategories(rootClientId, sourceFilter = "all") { const [patterns, allCategories] = use_patterns_state_default( void 0, rootClientId ); const filteredPatterns = (0,external_wp_element_namespaceObject.useMemo)( () => sourceFilter === "all" ? patterns : patterns.filter( (pattern) => !isPatternFiltered(pattern, sourceFilter) ), [sourceFilter, patterns] ); const populatedCategories = (0,external_wp_element_namespaceObject.useMemo)(() => { const categories = allCategories.filter( (category) => filteredPatterns.some( (pattern) => pattern.categories?.includes(category.name) ) ).sort((a, b) => a.label.localeCompare(b.label)); if (filteredPatterns.some( (pattern) => !hasRegisteredCategory(pattern, allCategories) ) && !categories.find( (category) => category.name === "uncategorized" )) { categories.push({ name: "uncategorized", label: (0,external_wp_i18n_namespaceObject._x)("Uncategorized") }); } if (filteredPatterns.some( (pattern) => pattern.blockTypes?.includes("core/post-content") )) { categories.unshift(starterPatternsCategory); } if (filteredPatterns.some( (pattern) => pattern.type === INSERTER_PATTERN_TYPES.user )) { categories.unshift(myPatternsCategory); } if (filteredPatterns.length > 0) { categories.unshift({ name: allPatternsCategory.name, label: allPatternsCategory.label }); } (0,external_wp_a11y_namespaceObject.speak)( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of categories . */ (0,external_wp_i18n_namespaceObject._n)( "%d category button displayed.", "%d category buttons displayed.", categories.length ), categories.length ) ); return categories; }, [allCategories, filteredPatterns]); return populatedCategories; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/index.js function PatternsExplorer({ initialCategory, rootClientId, onModalClose }) { const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)(""); const [selectedCategory, setSelectedCategory] = (0,external_wp_element_namespaceObject.useState)( initialCategory?.name ); const patternCategories = usePatternCategories(rootClientId); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-patterns-explorer", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( pattern_explorer_sidebar_default, { selectedCategory, patternCategories, onClickCategory: setSelectedCategory, searchValue, setSearchValue } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( pattern_list_default, { searchValue, selectedCategory, patternCategories, rootClientId, onModalClose } ) ] }); } function PatternsExplorerModal({ onModalClose, ...restProps }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Patterns"), onRequestClose: onModalClose, isFullScreen: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsExplorer, { onModalClose, ...restProps }) } ); } var block_patterns_explorer_default = PatternsExplorerModal; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/mobile-tab-navigation.js function ScreenHeader({ title }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: /* @__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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Navigator.BackButton, { style: ( // TODO: This style override is also used in ToolsPanelHeader. // It should be supported out-of-the-box by Button. { minWidth: 24, padding: 0 } ), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, size: "small", label: (0,external_wp_i18n_namespaceObject.__)("Back") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 5, children: title }) }) ] }) }) }) }); } function MobileTabNavigation({ categories, children }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Navigator, { initialPath: "/", className: "block-editor-inserter__mobile-tab-navigation", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Navigator.Button, { path: `/category/${category.name}`, as: external_wp_components_namespaceObject.__experimentalItem, isAction: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children: category.label }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default } ) ] }) }, category.name )) }) }), categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Navigator.Screen, { path: `/category/${category.name}`, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenHeader, { title: (0,external_wp_i18n_namespaceObject.__)("Back") }), children(category) ] }, category.name )) ] } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/patterns-filter.js const getShouldDisableSyncFilter = (sourceFilter) => sourceFilter !== "all" && sourceFilter !== "user"; const getShouldHideSourcesFilter = (category) => { return category.name === myPatternsCategory.name; }; const PATTERN_SOURCE_MENU_OPTIONS = [ { value: "all", label: (0,external_wp_i18n_namespaceObject._x)("All", "patterns") }, { value: INSERTER_PATTERN_TYPES.directory, label: (0,external_wp_i18n_namespaceObject.__)("Pattern Directory") }, { value: INSERTER_PATTERN_TYPES.theme, label: (0,external_wp_i18n_namespaceObject.__)("Theme & Plugins") }, { value: INSERTER_PATTERN_TYPES.user, label: (0,external_wp_i18n_namespaceObject.__)("User") } ]; function PatternsFilter({ setPatternSyncFilter, setPatternSourceFilter, patternSyncFilter, patternSourceFilter, scrollContainerRef, category }) { const currentPatternSourceFilter = category.name === myPatternsCategory.name ? INSERTER_PATTERN_TYPES.user : patternSourceFilter; const shouldDisableSyncFilter = getShouldDisableSyncFilter( currentPatternSourceFilter ); const shouldHideSourcesFilter = getShouldHideSourcesFilter(category); const patternSyncMenuOptions = (0,external_wp_element_namespaceObject.useMemo)( () => [ { value: "all", label: (0,external_wp_i18n_namespaceObject._x)("All", "patterns") }, { value: INSERTER_SYNC_TYPES.full, label: (0,external_wp_i18n_namespaceObject._x)("Synced", "patterns"), disabled: shouldDisableSyncFilter }, { value: INSERTER_SYNC_TYPES.unsynced, label: (0,external_wp_i18n_namespaceObject._x)("Not synced", "patterns"), disabled: shouldDisableSyncFilter } ], [shouldDisableSyncFilter] ); function handleSetSourceFilterChange(newSourceFilter) { setPatternSourceFilter(newSourceFilter); if (getShouldDisableSyncFilter(newSourceFilter)) { setPatternSyncFilter("all"); } } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { popoverProps: { placement: "right-end" }, label: (0,external_wp_i18n_namespaceObject.__)("Filter patterns"), toggleProps: { size: "compact" }, icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( icon_default, { icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SVG, { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Path, { d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z", fill: "currentColor" } ) } ) } ), children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ !shouldHideSourcesFilter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Source"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItemsChoice, { choices: PATTERN_SOURCE_MENU_OPTIONS, onSelect: (value) => { handleSetSourceFilterChange(value); scrollContainerRef.current?.scrollTo( 0, 0 ); }, value: currentPatternSourceFilter } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Type"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItemsChoice, { choices: patternSyncMenuOptions, onSelect: (value) => { setPatternSyncFilter(value); scrollContainerRef.current?.scrollTo( 0, 0 ); }, value: patternSyncFilter } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__patterns-filter-help", children: (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.__)( "Patterns are available from the <Link>WordPress.org Pattern Directory</Link>, bundled in the active theme, or created by users on this site. Only patterns created on this site can be synced." ), { Link: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)( "https://wordpress.org/patterns/" ) } ) } ) }) ] }) } ) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js const pattern_category_previews_noop = () => { }; function PatternCategoryPreviews({ rootClientId, onInsert, onHover = pattern_category_previews_noop, category, showTitlesAsTooltip }) { const [allPatterns, , onClickPattern] = use_patterns_state_default( onInsert, rootClientId, category?.name ); const [patternSyncFilter, setPatternSyncFilter] = (0,external_wp_element_namespaceObject.useState)("all"); const [patternSourceFilter, setPatternSourceFilter] = (0,external_wp_element_namespaceObject.useState)("all"); const availableCategories = usePatternCategories( rootClientId, patternSourceFilter ); const scrollContainerRef = (0,external_wp_element_namespaceObject.useRef)(); const currentCategoryPatterns = (0,external_wp_element_namespaceObject.useMemo)( () => allPatterns.filter((pattern) => { if (isPatternFiltered( pattern, patternSourceFilter, patternSyncFilter )) { return false; } if (category.name === allPatternsCategory.name) { return true; } if (category.name === myPatternsCategory.name && pattern.type === INSERTER_PATTERN_TYPES.user) { return true; } if (category.name === starterPatternsCategory.name && pattern.blockTypes?.includes("core/post-content")) { return true; } if (category.name === "uncategorized") { if (!pattern.categories) { return true; } return !pattern.categories.some( (catName) => availableCategories.some((c) => c.name === catName) ); } return pattern.categories?.includes(category.name); }), [ allPatterns, availableCategories, category.name, patternSourceFilter, patternSyncFilter ] ); const pagingProps = usePatternsPaging( currentCategoryPatterns, category, scrollContainerRef ); const { changePage } = pagingProps; (0,external_wp_element_namespaceObject.useEffect)(() => () => onHover(null), []); const onSetPatternSyncFilter = (0,external_wp_element_namespaceObject.useCallback)( (value) => { setPatternSyncFilter(value); changePage(1); }, [setPatternSyncFilter, changePage] ); const onSetPatternSourceFilter = (0,external_wp_element_namespaceObject.useCallback)( (value) => { setPatternSourceFilter(value); changePage(1); }, [setPatternSourceFilter, changePage] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, className: "block-editor-inserter__patterns-category-panel-header", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHeading, { className: "block-editor-inserter__patterns-category-panel-title", size: 13, level: 4, as: "div", children: category.label } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PatternsFilter, { patternSyncFilter, patternSourceFilter, setPatternSyncFilter: onSetPatternSyncFilter, setPatternSourceFilter: onSetPatternSourceFilter, scrollContainerRef, category } ) ] }), !currentCategoryPatterns.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalText, { variant: "muted", className: "block-editor-inserter__patterns-category-no-results", children: (0,external_wp_i18n_namespaceObject.__)("No results found") } ) ] } ), currentCategoryPatterns.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalText, { size: "12", as: "p", className: "block-editor-inserter__help-text", children: (0,external_wp_i18n_namespaceObject.__)("Drag and drop patterns into the canvas.") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_patterns_list_default, { ref: scrollContainerRef, blockPatterns: pagingProps.categoryPatterns, onClickPattern, onHover, label: category.label, orientation: "vertical", category: category.name, isDraggable: true, showTitlesAsTooltip, patternFilter: patternSourceFilter, pagingProps } ) ] }) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/category-tabs/index.js const { Tabs: category_tabs_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); function CategoryTabs({ categories, selectedCategory, onSelectCategory, children }) { const ANIMATION_DURATION = 0.25; const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const defaultTransition = { type: "tween", duration: disableMotion ? 0 : ANIMATION_DURATION, ease: [0.6, 0, 0.4, 1] }; const previousSelectedCategory = (0,external_wp_compose_namespaceObject.usePrevious)(selectedCategory); const selectedTabId = selectedCategory ? selectedCategory.name : null; const [activeTabId, setActiveId] = (0,external_wp_element_namespaceObject.useState)(); const firstTabId = categories?.[0]?.name; if (selectedTabId === null && !activeTabId && firstTabId) { setActiveId(firstTabId); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( category_tabs_Tabs, { selectOnMove: false, selectedTabId, orientation: "vertical", onSelect: (categoryId) => { onSelectCategory( categories.find( (category) => category.name === categoryId ) ); }, activeTabId, onActiveTabIdChange: setActiveId, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs_Tabs.TabList, { className: "block-editor-inserter__category-tablist", children: categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( category_tabs_Tabs.Tab, { tabId: category.name, "aria-current": category === selectedCategory ? "true" : void 0, children: category.label }, category.name )) }), categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( category_tabs_Tabs.TabPanel, { tabId: category.name, focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { className: "block-editor-inserter__category-panel", initial: !previousSelectedCategory ? "closed" : "open", animate: "open", variants: { open: { transform: "translateX( 0 )", transitionEnd: { zIndex: "1" } }, closed: { transform: "translateX( -100% )", zIndex: "-1" } }, transition: defaultTransition, children } ) }, category.name )) ] } ); } var category_tabs_default = CategoryTabs; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/index.js function BlockPatternsTab({ onSelectCategory, selectedCategory, onInsert, rootClientId, children }) { const [showPatternsExplorer, setShowPatternsExplorer] = (0,external_wp_element_namespaceObject.useState)(false); const categories = usePatternCategories(rootClientId); const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); if (!categories.length) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {}); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ !isMobile && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__block-patterns-tabs-container", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( category_tabs_default, { categories, selectedCategory, onSelectCategory, children } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "block-editor-inserter__patterns-explore-button", onClick: () => setShowPatternsExplorer(true), variant: "secondary", children: (0,external_wp_i18n_namespaceObject.__)("Explore all patterns") } ) ] }), isMobile && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileTabNavigation, { categories, children: (category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__category-panel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PatternCategoryPreviews, { onInsert, rootClientId, category }, category.name ) }) }), showPatternsExplorer && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_patterns_explorer_default, { initialCategory: selectedCategory || categories[0], patternCategories: categories, onModalClose: () => setShowPatternsExplorer(false), rootClientId } ) ] }); } var block_patterns_tab_default = BlockPatternsTab; ;// ./node_modules/@wordpress/icons/build-module/library/external.js var external_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.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/utils.js const mediaTypeTag = { image: "img", video: "video", audio: "audio" }; function getBlockAndPreviewFromMedia(media, mediaType) { const attributes = { id: media.id || void 0, caption: media.caption || void 0 }; const mediaSrc = media.url; const alt = media.alt || void 0; if (mediaType === "image") { attributes.url = mediaSrc; attributes.alt = alt; } else if (["video", "audio"].includes(mediaType)) { attributes.src = mediaSrc; } const PreviewTag = mediaTypeTag[mediaType]; const preview = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreviewTag, { src: media.previewUrl || mediaSrc, alt, controls: mediaType === "audio" ? true : void 0, inert: "true", onError: ({ currentTarget }) => { if (currentTarget.src === media.previewUrl) { currentTarget.src = mediaSrc; } } } ); return [(0,external_wp_blocks_namespaceObject.createBlock)(`core/${mediaType}`, attributes), preview]; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-preview.js const ALLOWED_MEDIA_TYPES = ["image"]; const MEDIA_OPTIONS_POPOVER_PROPS = { placement: "bottom-end", className: "block-editor-inserter__media-list__item-preview-options__popover" }; function MediaPreviewOptions({ category, media }) { if (!category.getReportUrl) { return null; } const reportUrl = category.getReportUrl(media); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { className: "block-editor-inserter__media-list__item-preview-options", label: (0,external_wp_i18n_namespaceObject.__)("Options"), popoverProps: MEDIA_OPTIONS_POPOVER_PROPS, icon: more_vertical_default, children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => window.open(reportUrl, "_blank").focus(), icon: external_default, children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The media type to report e.g: "image", "video", "audio" */ (0,external_wp_i18n_namespaceObject.__)("Report %s"), category.mediaType ) } ) }) } ); } function InsertExternalImageModal({ onClose, onSubmit }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Insert external image"), onRequestClose: onClose, className: "block-editor-inserter-media-tab-media-preview-inserter-external-image-modal", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( "This image cannot be uploaded to your Media Library, but it can still be inserted as an external image." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( "External images can be removed by the external provider without warning and could even have legal compliance issues related to privacy legislation." ) }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Flex, { className: "block-editor-block-lock-modal__actions", justify: "flex-end", expanded: false, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: onClose, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: onSubmit, children: (0,external_wp_i18n_namespaceObject.__)("Insert") } ) }) ] } ) ] } ); } function MediaPreview({ media, onClick, category }) { const [showExternalUploadModal, setShowExternalUploadModal] = (0,external_wp_element_namespaceObject.useState)(false); const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); const [isInserting, setIsInserting] = (0,external_wp_element_namespaceObject.useState)(false); const [block, preview] = (0,external_wp_element_namespaceObject.useMemo)( () => getBlockAndPreviewFromMedia(media, category.mediaType), [media, category.mediaType] ); const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { getSettings, getBlock } = (0,external_wp_data_namespaceObject.useSelect)(store); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const onMediaInsert = (0,external_wp_element_namespaceObject.useCallback)( (previewBlock) => { if (isInserting) { return; } const settings = getSettings(); const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(previewBlock); const { id, url, caption } = clonedBlock.attributes; if (!id && !settings.mediaUpload) { setShowExternalUploadModal(true); return; } if (!!id) { onClick(clonedBlock); return; } setIsInserting(true); window.fetch(url).then((response) => response.blob()).then((blob) => { const fileName = (0,external_wp_url_namespaceObject.getFilename)(url) || "image.jpg"; const file = new File([blob], fileName, { type: blob.type }); settings.mediaUpload({ filesList: [file], additionalData: { caption }, onFileChange([img]) { if ((0,external_wp_blob_namespaceObject.isBlobURL)(img.url)) { return; } if (!getBlock(clonedBlock.clientId)) { onClick({ ...clonedBlock, attributes: { ...clonedBlock.attributes, id: img.id, url: img.url } }); createSuccessNotice( (0,external_wp_i18n_namespaceObject.__)("Image uploaded and inserted."), { type: "snackbar", id: "inserter-notice" } ); } else { updateBlockAttributes(clonedBlock.clientId, { ...clonedBlock.attributes, id: img.id, url: img.url }); } setIsInserting(false); }, allowedTypes: ALLOWED_MEDIA_TYPES, onError(message) { createErrorNotice(message, { type: "snackbar", id: "inserter-notice" }); setIsInserting(false); } }); }).catch(() => { setShowExternalUploadModal(true); setIsInserting(false); }); }, [ isInserting, getSettings, onClick, createSuccessNotice, updateBlockAttributes, createErrorNotice, getBlock ] ); const title = typeof media.title === "string" ? media.title : media.title?.rendered || (0,external_wp_i18n_namespaceObject.__)("no title"); const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => setIsHovered(true), []); const onMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(() => setIsHovered(false), []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_draggable_blocks_default, { isEnabled: true, blocks: [block], children: ({ draggable, onDragStart, onDragEnd }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx( "block-editor-inserter__media-list__list-item", { "is-hovered": isHovered } ), draggable, onDragStart, onDragEnd, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { onMouseEnter, onMouseLeave, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: title, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite.Item, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { "aria-label": title, role: "option", className: "block-editor-inserter__media-list__item" } ), onClick: () => onMediaInsert(block), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__media-list__item-preview", children: [ preview, isInserting && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__media-list__item-preview-spinner", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) ] }) } ) }), !isInserting && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( MediaPreviewOptions, { category, media } ) ] } ) } ) }), showExternalUploadModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( InsertExternalImageModal, { onClose: () => setShowExternalUploadModal(false), onSubmit: () => { onClick((0,external_wp_blocks_namespaceObject.cloneBlock)(block)); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Image inserted."), { type: "snackbar", id: "inserter-notice" }); setShowExternalUploadModal(false); } } ) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-list.js function MediaList({ mediaList, category, onClick, label = (0,external_wp_i18n_namespaceObject.__)("Media List") }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite, { role: "listbox", className: "block-editor-inserter__media-list", "aria-label": label, children: mediaList.map((media, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( MediaPreview, { media, category, onClick }, media.id || media.sourceId || index )) } ); } var media_list_default = MediaList; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/hooks.js function useMediaResults(category, query = {}) { const [mediaList, setMediaList] = (0,external_wp_element_namespaceObject.useState)(); const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false); const lastRequestRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { (async () => { const key = JSON.stringify({ category: category.name, ...query }); lastRequestRef.current = key; setIsLoading(true); setMediaList([]); const _media = await category.fetch?.(query); if (key === lastRequestRef.current) { setMediaList(_media); setIsLoading(false); } })(); }, [category.name, ...Object.values(query)]); return { mediaList, isLoading }; } function useMediaCategories(rootClientId) { const [categories, setCategories] = (0,external_wp_element_namespaceObject.useState)([]); const inserterMediaCategories = (0,external_wp_data_namespaceObject.useSelect)( (select) => unlock(select(store)).getInserterMediaCategories(), [] ); const { canInsertImage, canInsertVideo, canInsertAudio } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { canInsertBlockType } = select(store); return { canInsertImage: canInsertBlockType( "core/image", rootClientId ), canInsertVideo: canInsertBlockType( "core/video", rootClientId ), canInsertAudio: canInsertBlockType( "core/audio", rootClientId ) }; }, [rootClientId] ); (0,external_wp_element_namespaceObject.useEffect)(() => { (async () => { const _categories = []; if (!inserterMediaCategories) { return; } const categoriesHaveMedia = new Map( await Promise.all( inserterMediaCategories.map(async (category) => { if (category.isExternalResource) { return [category.name, true]; } let results = []; try { results = await category.fetch({ per_page: 1 }); } catch (e) { } return [category.name, !!results.length]; }) ) ); const canInsertMediaType = { image: canInsertImage, video: canInsertVideo, audio: canInsertAudio }; inserterMediaCategories.forEach((category) => { if (canInsertMediaType[category.mediaType] && categoriesHaveMedia.get(category.name)) { _categories.push(category); } }); if (!!_categories.length) { setCategories(_categories); } })(); }, [ canInsertImage, canInsertVideo, canInsertAudio, inserterMediaCategories ]); return categories; } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-panel.js const INITIAL_MEDIA_ITEMS_PER_PAGE = 10; function MediaCategoryPanel({ rootClientId, onInsert, category }) { const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(); const { mediaList, isLoading } = useMediaResults(category, { per_page: !!debouncedSearch ? 20 : INITIAL_MEDIA_ITEMS_PER_PAGE, search: debouncedSearch }); const baseCssClass = "block-editor-inserter__media-panel"; const searchLabel = category.labels.search_items || (0,external_wp_i18n_namespaceObject.__)("Search"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: baseCssClass, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SearchControl, { __nextHasNoMarginBottom: true, className: `${baseCssClass}-search`, onChange: setSearch, value: search, label: searchLabel, placeholder: searchLabel } ), isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseCssClass}-spinner`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }), !isLoading && !mediaList?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {}), !isLoading && !!mediaList?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( media_list_default, { rootClientId, onClick: onInsert, mediaList, category } ) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-tab.js const media_tab_ALLOWED_MEDIA_TYPES = ["image", "video", "audio"]; function MediaTab({ rootClientId, selectedCategory, onSelectCategory, onInsert, children }) { const mediaCategories = useMediaCategories(rootClientId); const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const baseCssClass = "block-editor-inserter__media-tabs"; const onSelectMedia = (0,external_wp_element_namespaceObject.useCallback)( (media) => { if (!media?.url) { return; } const [block] = getBlockAndPreviewFromMedia(media, media.type); onInsert(block); }, [onInsert] ); const categories = (0,external_wp_element_namespaceObject.useMemo)( () => mediaCategories.map((mediaCategory) => ({ ...mediaCategory, label: mediaCategory.labels.name })), [mediaCategories] ); if (!categories.length) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {}); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ !isMobile && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: `${baseCssClass}-container`, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( category_tabs_default, { categories, selectedCategory, onSelectCategory, children } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( media_upload_default, { multiple: false, onSelect: onSelectMedia, allowedTypes: media_tab_ALLOWED_MEDIA_TYPES, render: ({ open }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, onClick: (event) => { event.target.focus(); open(); }, className: "block-editor-inserter__media-library-button", variant: "secondary", "data-unstable-ignore-focus-outside-for-relatedtarget": ".media-modal", children: (0,external_wp_i18n_namespaceObject.__)("Open Media Library") } ) } ) }) ] }), isMobile && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileTabNavigation, { categories, children: (category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( MediaCategoryPanel, { onInsert, rootClientId, category } ) }) ] }); } var media_tab_default = MediaTab; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-menu-extension/index.js const { Fill: __unstableInserterMenuExtension, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)( "__unstableInserterMenuExtension" ); __unstableInserterMenuExtension.Slot = Slot; var inserter_menu_extension_default = __unstableInserterMenuExtension; ;// ./node_modules/@wordpress/block-editor/build-module/utils/order-inserter-block-items.js const orderInserterBlockItems = (items, priority) => { if (!priority) { return items; } items.sort(({ id: aName }, { id: bName }) => { let aIndex = priority.indexOf(aName); let bIndex = priority.indexOf(bName); if (aIndex < 0) { aIndex = priority.length; } if (bIndex < 0) { bIndex = priority.length; } return aIndex - bIndex; }); return items; }; ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-results.js const INITIAL_INSERTER_RESULTS = 9; const search_results_EMPTY_ARRAY = []; function InserterSearchResults({ filterValue, onSelect, onHover, onHoverPattern, rootClientId, clientId, isAppender, __experimentalInsertionIndex, maxBlockPatterns, maxBlockTypes, showBlockDirectory = false, isDraggable = true, shouldFocusBlock = true, prioritizePatterns, selectBlockOnInsert, isQuick }) { const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); const { prioritizedBlocks } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const blockListSettings = select(store).getBlockListSettings(rootClientId); return { prioritizedBlocks: blockListSettings?.prioritizedInserterBlocks || search_results_EMPTY_ARRAY }; }, [rootClientId] ); const [destinationRootClientId, onInsertBlocks] = use_insertion_point_default({ onSelect, rootClientId, clientId, isAppender, insertionIndex: __experimentalInsertionIndex, shouldFocusBlock, selectBlockOnInsert }); const [ blockTypes, blockTypeCategories, blockTypeCollections, onSelectBlockType ] = use_block_types_state_default(destinationRootClientId, onInsertBlocks, isQuick); const [patterns, , onClickPattern] = use_patterns_state_default( onInsertBlocks, destinationRootClientId, void 0, isQuick ); const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { if (maxBlockPatterns === 0) { return []; } const results = searchItems(patterns, filterValue); return maxBlockPatterns !== void 0 ? results.slice(0, maxBlockPatterns) : results; }, [filterValue, patterns, maxBlockPatterns]); let maxBlockTypesToShow = maxBlockTypes; if (prioritizePatterns && filteredBlockPatterns.length > 2) { maxBlockTypesToShow = 0; } const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { if (maxBlockTypesToShow === 0) { return []; } const nonPatternBlockTypes = blockTypes.filter( (blockType) => blockType.name !== "core/block" ); let orderedItems = orderBy(nonPatternBlockTypes, "frecency", "desc"); if (!filterValue && prioritizedBlocks.length) { orderedItems = orderInserterBlockItems( orderedItems, prioritizedBlocks ); } const results = searchBlockItems( orderedItems, blockTypeCategories, blockTypeCollections, filterValue ); return maxBlockTypesToShow !== void 0 ? results.slice(0, maxBlockTypesToShow) : results; }, [ filterValue, blockTypes, blockTypeCategories, blockTypeCollections, maxBlockTypesToShow, prioritizedBlocks ]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!filterValue) { return; } const count = filteredBlockTypes.length + filteredBlockPatterns.length; const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", count), count ); debouncedSpeak(resultsFoundMessage); }, [ filterValue, debouncedSpeak, filteredBlockTypes, filteredBlockPatterns ]); const currentShownBlockTypes = (0,external_wp_compose_namespaceObject.useAsyncList)(filteredBlockTypes, { step: INITIAL_INSERTER_RESULTS }); const hasItems = filteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0; const blocksUI = !!filteredBlockTypes.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( panel_default, { title: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { children: (0,external_wp_i18n_namespaceObject.__)("Blocks") }), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_types_list_default, { items: currentShownBlockTypes, onSelect: onSelectBlockType, onHover, label: (0,external_wp_i18n_namespaceObject.__)("Blocks"), isDraggable } ) } ); const patternsUI = !!filteredBlockPatterns.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( panel_default, { title: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { children: (0,external_wp_i18n_namespaceObject.__)("Block patterns") }), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__quick-inserter-patterns", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_patterns_list_default, { blockPatterns: filteredBlockPatterns, onClickPattern, onHover: onHoverPattern, isDraggable } ) }) } ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(inserter_listbox_default, { children: [ !showBlockDirectory && !hasItems && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {}), prioritizePatterns ? patternsUI : blocksUI, !!filteredBlockTypes.length && !!filteredBlockPatterns.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__quick-inserter-separator" }), prioritizePatterns ? blocksUI : patternsUI, showBlockDirectory && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inserter_menu_extension_default.Slot, { fillProps: { onSelect: onSelectBlockType, onHover, filterValue, hasItems, rootClientId: destinationRootClientId }, children: (fills) => { if (fills.length) { return fills; } if (!hasItems) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {}); } return null; } } ) ] }); } var search_results_search_results_default = InserterSearchResults; ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js var close_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/tabbed-sidebar/index.js const { Tabs: tabbed_sidebar_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); function TabbedSidebar({ defaultTabId, onClose, onSelect, selectedTab, tabs, closeButtonLabel }, ref) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-tabbed-sidebar", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( tabbed_sidebar_Tabs, { selectOnMove: false, defaultTabId, onSelect, selectedTabId: selectedTab, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-tabbed-sidebar__tablist-and-close-button", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { className: "block-editor-tabbed-sidebar__close-button", icon: close_small_default, label: closeButtonLabel, onClick: () => onClose(), size: "compact" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( tabbed_sidebar_Tabs.TabList, { className: "block-editor-tabbed-sidebar__tablist", ref, children: tabs.map((tab) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( tabbed_sidebar_Tabs.Tab, { tabId: tab.name, className: "block-editor-tabbed-sidebar__tab", children: tab.title }, tab.name )) } ) ] }), tabs.map((tab) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( tabbed_sidebar_Tabs.TabPanel, { tabId: tab.name, focusable: false, className: "block-editor-tabbed-sidebar__tabpanel", ref: tab.panelRef, children: tab.panel }, tab.name )) ] } ) }); } var tabbed_sidebar_default = (0,external_wp_element_namespaceObject.forwardRef)(TabbedSidebar); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-zoom-out.js function useZoomOut(enabled = true) { const { setZoomLevel, resetZoomLevel } = unlock( (0,external_wp_data_namespaceObject.useDispatch)(store) ); const { isZoomedOut, isZoomOut } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { isZoomOut: _isZoomOut } = unlock(select(store)); return { isZoomedOut: _isZoomOut(), isZoomOut: _isZoomOut }; }, []); const controlZoomLevelRef = (0,external_wp_element_namespaceObject.useRef)(false); const isEnabledRef = (0,external_wp_element_namespaceObject.useRef)(enabled); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isZoomedOut !== isEnabledRef.current) { controlZoomLevelRef.current = false; } }, [isZoomedOut]); (0,external_wp_element_namespaceObject.useEffect)(() => { isEnabledRef.current = enabled; if (enabled !== isZoomOut()) { controlZoomLevelRef.current = true; if (enabled) { setZoomLevel("auto-scaled"); } else { resetZoomLevel(); } } return () => { if (controlZoomLevelRef.current && isZoomOut()) { resetZoomLevel(); } }; }, [enabled, isZoomOut, resetZoomLevel, setZoomLevel]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/menu.js const NOOP = () => { }; function InserterMenu({ rootClientId, clientId, isAppender, __experimentalInsertionIndex, onSelect, showInserterHelpPanel, showMostUsedBlocks, __experimentalFilterValue = "", shouldFocusBlock = true, onPatternCategorySelection, onClose, __experimentalInitialTab, __experimentalInitialCategory }, ref) { const { isZoomOutMode, hasSectionRootClientId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { isZoomOut, getSectionRootClientId } = unlock( select(store) ); return { isZoomOutMode: isZoomOut(), hasSectionRootClientId: !!getSectionRootClientId() }; }, []); const [filterValue, setFilterValue, delayedFilterValue] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(__experimentalFilterValue); const [hoveredItem, setHoveredItem] = (0,external_wp_element_namespaceObject.useState)(null); const [selectedPatternCategory, setSelectedPatternCategory] = (0,external_wp_element_namespaceObject.useState)( __experimentalInitialCategory ); const [patternFilter, setPatternFilter] = (0,external_wp_element_namespaceObject.useState)("all"); const [selectedMediaCategory, setSelectedMediaCategory] = (0,external_wp_element_namespaceObject.useState)(null); const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("large"); function getInitialTab() { if (__experimentalInitialTab) { return __experimentalInitialTab; } if (isZoomOutMode) { return "patterns"; } return "blocks"; } const [selectedTab, setSelectedTab] = (0,external_wp_element_namespaceObject.useState)(getInitialTab()); const shouldUseZoomOut = hasSectionRootClientId && (selectedTab === "patterns" || selectedTab === "media"); useZoomOut(shouldUseZoomOut && isLargeViewport); const [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint] = use_insertion_point_default({ rootClientId, clientId, isAppender, insertionIndex: __experimentalInsertionIndex, shouldFocusBlock }); const blockTypesTabRef = (0,external_wp_element_namespaceObject.useRef)(); const onInsert = (0,external_wp_element_namespaceObject.useCallback)( (blocks, meta, shouldForceFocusBlock, _rootClientId) => { onInsertBlocks( blocks, meta, shouldForceFocusBlock, _rootClientId ); onSelect(blocks); window.requestAnimationFrame(() => { if (!shouldFocusBlock && !blockTypesTabRef.current?.contains( ref.current.ownerDocument.activeElement )) { blockTypesTabRef.current?.querySelector("button").focus(); } }); }, [onInsertBlocks, onSelect, shouldFocusBlock] ); const onInsertPattern = (0,external_wp_element_namespaceObject.useCallback)( (blocks, patternName, ...args) => { onToggleInsertionPoint(false); onInsertBlocks(blocks, { patternName }, ...args); onSelect(); }, [onInsertBlocks, onSelect] ); const onHover = (0,external_wp_element_namespaceObject.useCallback)( (item) => { onToggleInsertionPoint(item); setHoveredItem(item); }, [onToggleInsertionPoint, setHoveredItem] ); const onClickPatternCategory = (0,external_wp_element_namespaceObject.useCallback)( (patternCategory, filter) => { setSelectedPatternCategory(patternCategory); setPatternFilter(filter); onPatternCategorySelection?.(); }, [setSelectedPatternCategory, onPatternCategorySelection] ); const showPatternPanel = selectedTab === "patterns" && !delayedFilterValue && !!selectedPatternCategory; const showMediaPanel = selectedTab === "media" && !!selectedMediaCategory; const inserterSearch = (0,external_wp_element_namespaceObject.useMemo)(() => { if (selectedTab === "media") { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SearchControl, { __nextHasNoMarginBottom: true, className: "block-editor-inserter__search", onChange: (value) => { if (hoveredItem) { setHoveredItem(null); } setFilterValue(value); }, value: filterValue, label: (0,external_wp_i18n_namespaceObject.__)("Search"), placeholder: (0,external_wp_i18n_namespaceObject.__)("Search") } ), !!delayedFilterValue && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( search_results_search_results_default, { filterValue: delayedFilterValue, onSelect, onHover, rootClientId, clientId, isAppender, __experimentalInsertionIndex, showBlockDirectory: true, shouldFocusBlock, prioritizePatterns: selectedTab === "patterns" } ) ] }); }, [ selectedTab, hoveredItem, setHoveredItem, setFilterValue, filterValue, delayedFilterValue, onSelect, onHover, shouldFocusBlock, clientId, rootClientId, __experimentalInsertionIndex, isAppender ]); const blocksTab = (0,external_wp_element_namespaceObject.useMemo)(() => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__block-list", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_types_tab_default, { ref: blockTypesTabRef, rootClientId: destinationRootClientId, onInsert, onHover, showMostUsedBlocks } ) }), showInserterHelpPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__tips", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "h2", children: (0,external_wp_i18n_namespaceObject.__)("A tip for using the block editor") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(tips_default, {}) ] }) ] }); }, [ destinationRootClientId, onInsert, onHover, showMostUsedBlocks, showInserterHelpPanel ]); const patternsTab = (0,external_wp_element_namespaceObject.useMemo)(() => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_patterns_tab_default, { rootClientId: destinationRootClientId, onInsert: onInsertPattern, onSelectCategory: onClickPatternCategory, selectedCategory: selectedPatternCategory, children: showPatternPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PatternCategoryPreviews, { rootClientId: destinationRootClientId, onInsert: onInsertPattern, category: selectedPatternCategory, patternFilter, showTitlesAsTooltip: true } ) } ); }, [ destinationRootClientId, onInsertPattern, onClickPatternCategory, patternFilter, selectedPatternCategory, showPatternPanel ]); const mediaTab = (0,external_wp_element_namespaceObject.useMemo)(() => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( media_tab_default, { rootClientId: destinationRootClientId, selectedCategory: selectedMediaCategory, onSelectCategory: setSelectedMediaCategory, onInsert, children: showMediaPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( MediaCategoryPanel, { rootClientId: destinationRootClientId, onInsert, category: selectedMediaCategory } ) } ); }, [ destinationRootClientId, onInsert, selectedMediaCategory, setSelectedMediaCategory, showMediaPanel ]); const handleSetSelectedTab = (value) => { if (value !== "patterns") { setSelectedPatternCategory(null); } setSelectedTab(value); }; const tabsRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (tabsRef.current) { window.requestAnimationFrame(() => { tabsRef.current.querySelector('[role="tab"][aria-selected="true"]')?.focus(); }); } }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: dist_clsx("block-editor-inserter__menu", { "show-panel": showPatternPanel || showMediaPanel, "is-zoom-out": isZoomOutMode }), ref, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__main-area", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( tabbed_sidebar_default, { ref: tabsRef, onSelect: handleSetSelectedTab, onClose, selectedTab, closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close Block Inserter"), tabs: [ { name: "blocks", title: (0,external_wp_i18n_namespaceObject.__)("Blocks"), panel: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ inserterSearch, selectedTab === "blocks" && !delayedFilterValue && blocksTab ] }) }, { name: "patterns", title: (0,external_wp_i18n_namespaceObject.__)("Patterns"), panel: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ inserterSearch, selectedTab === "patterns" && !delayedFilterValue && patternsTab ] }) }, { name: "media", title: (0,external_wp_i18n_namespaceObject.__)("Media"), panel: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ inserterSearch, mediaTab ] }) } ] } ) }), showInserterHelpPanel && hoveredItem && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Popover, { className: "block-editor-inserter__preview-container__popover", placement: "right-start", offset: 16, focusOnMount: false, animate: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_panel_default, { item: hoveredItem }) } ) ] } ); } const PrivateInserterMenu = (0,external_wp_element_namespaceObject.forwardRef)(InserterMenu); function PublicInserterMenu(props, ref) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivateInserterMenu, { ...props, onPatternCategorySelection: NOOP, ref } ); } var menu_default = (0,external_wp_element_namespaceObject.forwardRef)(PublicInserterMenu); ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/quick-inserter.js const SEARCH_THRESHOLD = 6; const SHOWN_BLOCK_TYPES = 6; const SHOWN_BLOCK_PATTERNS = 2; function QuickInserter({ onSelect, rootClientId, clientId, isAppender, selectBlockOnInsert, hasSearch = true }) { const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(""); const [destinationRootClientId, onInsertBlocks] = use_insertion_point_default({ onSelect, rootClientId, clientId, isAppender, selectBlockOnInsert }); const [blockTypes] = use_block_types_state_default( destinationRootClientId, onInsertBlocks, true ); const { setInserterIsOpened, insertionIndex } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getSettings, getBlockIndex, getBlockCount } = select(store); const settings = getSettings(); const index = getBlockIndex(clientId); const blockCount = getBlockCount(); return { setInserterIsOpened: settings.__experimentalSetIsInserterOpened, insertionIndex: index === -1 ? blockCount : index }; }, [clientId] ); const showSearch = hasSearch && blockTypes.length > SEARCH_THRESHOLD; (0,external_wp_element_namespaceObject.useEffect)(() => { if (setInserterIsOpened) { setInserterIsOpened(false); } }, [setInserterIsOpened]); const onBrowseAll = () => { setInserterIsOpened({ filterValue, onSelect, rootClientId, insertionIndex }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: dist_clsx("block-editor-inserter__quick-inserter", { "has-search": showSearch, "has-expand": setInserterIsOpened }), children: [ showSearch && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SearchControl, { __nextHasNoMarginBottom: true, className: "block-editor-inserter__search", value: filterValue, onChange: (value) => { setFilterValue(value); }, label: (0,external_wp_i18n_namespaceObject.__)("Search"), placeholder: (0,external_wp_i18n_namespaceObject.__)("Search") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__quick-inserter-results", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( search_results_search_results_default, { filterValue, onSelect, rootClientId, clientId, isAppender, maxBlockPatterns: !!filterValue ? SHOWN_BLOCK_PATTERNS : 0, maxBlockTypes: SHOWN_BLOCK_TYPES, isDraggable: false, selectBlockOnInsert, isQuick: true } ) }), setInserterIsOpened && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "block-editor-inserter__quick-inserter-expand", onClick: onBrowseAll, "aria-label": (0,external_wp_i18n_namespaceObject.__)( "Browse all. This will open the main inserter panel in the editor toolbar." ), children: (0,external_wp_i18n_namespaceObject.__)("Browse all") } ) ] } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/index.js const defaultRenderToggle = ({ onToggle, disabled, isOpen, blockTitle, hasSingleBlockType, toggleProps = {} }) => { const { as: Wrapper = external_wp_components_namespaceObject.Button, label: labelProp, onClick, ...rest } = toggleProps; let label = labelProp; if (!label && hasSingleBlockType) { label = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block when there is only one (0,external_wp_i18n_namespaceObject._x)("Add %s", "directly add the only allowed block"), blockTitle ); } else if (!label) { label = (0,external_wp_i18n_namespaceObject._x)("Add block", "Generic label for block inserter button"); } function handleClick(event) { if (onToggle) { onToggle(event); } if (onClick) { onClick(event); } } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Wrapper, { __next40pxDefaultSize: toggleProps.as ? void 0 : true, icon: plus_default, label, tooltipPosition: "bottom", onClick: handleClick, className: "block-editor-inserter__toggle", "aria-haspopup": !hasSingleBlockType ? "true" : false, "aria-expanded": !hasSingleBlockType ? isOpen : false, disabled, ...rest } ); }; class Inserter extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); this.onToggle = this.onToggle.bind(this); this.renderToggle = this.renderToggle.bind(this); this.renderContent = this.renderContent.bind(this); } onToggle(isOpen) { const { onToggle } = this.props; if (onToggle) { onToggle(isOpen); } } /** * Render callback to display Dropdown toggle element. * * @param {Object} options * @param {Function} options.onToggle Callback to invoke when toggle is * pressed. * @param {boolean} options.isOpen Whether dropdown is currently open. * * @return {Element} Dropdown toggle element. */ renderToggle({ onToggle, isOpen }) { const { disabled, blockTitle, hasSingleBlockType, directInsertBlock, toggleProps, hasItems, renderToggle = defaultRenderToggle } = this.props; return renderToggle({ onToggle, isOpen, disabled: disabled || !hasItems, blockTitle, hasSingleBlockType, directInsertBlock, toggleProps }); } /** * Render callback to display Dropdown content element. * * @param {Object} options * @param {Function} options.onClose Callback to invoke when dropdown is * closed. * * @return {Element} Dropdown content element. */ renderContent({ onClose }) { const { rootClientId, clientId, isAppender, showInserterHelpPanel, // This prop is experimental to give some time for the quick inserter to mature // Feel free to make them stable after a few releases. __experimentalIsQuick: isQuick, onSelectOrClose, selectBlockOnInsert } = this.props; if (isQuick) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( QuickInserter, { onSelect: (blocks) => { const firstBlock = Array.isArray(blocks) && blocks?.length ? blocks[0] : blocks; if (onSelectOrClose && typeof onSelectOrClose === "function") { onSelectOrClose(firstBlock); } onClose(); }, rootClientId, clientId, isAppender, selectBlockOnInsert } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( menu_default, { onSelect: () => { onClose(); }, rootClientId, clientId, isAppender, showInserterHelpPanel } ); } render() { const { position, hasSingleBlockType, directInsertBlock, insertOnlyAllowedBlock, __experimentalIsQuick: isQuick, onSelectOrClose } = this.props; if (hasSingleBlockType || directInsertBlock) { return this.renderToggle({ onToggle: insertOnlyAllowedBlock }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { className: "block-editor-inserter", contentClassName: dist_clsx("block-editor-inserter__popover", { "is-quick": isQuick }), popoverProps: { position, shift: true }, onToggle: this.onToggle, expandOnMobile: true, headerTitle: (0,external_wp_i18n_namespaceObject.__)("Add a block"), renderToggle: this.renderToggle, renderContent: this.renderContent, onClose: onSelectOrClose } ); } } var inserter_default = (0,external_wp_compose_namespaceObject.compose)([ (0,external_wp_data_namespaceObject.withSelect)( (select, { clientId, rootClientId, shouldDirectInsert = true }) => { const { getBlockRootClientId, hasInserterItems, getAllowedBlocks, getDirectInsertBlock } = select(store); const { getBlockVariations } = select(external_wp_blocks_namespaceObject.store); rootClientId = rootClientId || getBlockRootClientId(clientId) || void 0; const allowedBlocks = getAllowedBlocks(rootClientId); const directInsertBlock = shouldDirectInsert && getDirectInsertBlock(rootClientId); const hasSingleBlockType = allowedBlocks?.length === 1 && getBlockVariations(allowedBlocks[0].name, "inserter")?.length === 0; let allowedBlockType = false; if (hasSingleBlockType) { allowedBlockType = allowedBlocks[0]; } return { hasItems: hasInserterItems(rootClientId), hasSingleBlockType, blockTitle: allowedBlockType ? allowedBlockType.title : "", allowedBlockType, directInsertBlock, rootClientId }; } ), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, { select }) => { return { insertOnlyAllowedBlock() { const { rootClientId, clientId, isAppender, hasSingleBlockType, allowedBlockType, directInsertBlock, onSelectOrClose, selectBlockOnInsert } = ownProps; if (!hasSingleBlockType && !directInsertBlock) { return; } function getAdjacentBlockAttributes(attributesToCopy) { const { getBlock, getPreviousBlockClientId } = select(store); if (!attributesToCopy || !clientId && !rootClientId) { return {}; } const result = {}; let adjacentAttributes = {}; if (!clientId) { const parentBlock = getBlock(rootClientId); if (parentBlock?.innerBlocks?.length) { const lastInnerBlock = parentBlock.innerBlocks[parentBlock.innerBlocks.length - 1]; if (directInsertBlock && directInsertBlock?.name === lastInnerBlock.name) { adjacentAttributes = lastInnerBlock.attributes; } } } else { const currentBlock = getBlock(clientId); const previousBlock = getBlock( getPreviousBlockClientId(clientId) ); if (currentBlock?.name === previousBlock?.name) { adjacentAttributes = previousBlock?.attributes || {}; } } attributesToCopy.forEach((attribute) => { if (adjacentAttributes.hasOwnProperty(attribute)) { result[attribute] = adjacentAttributes[attribute]; } }); return result; } function getInsertionIndex() { const { getBlockIndex, getBlockSelectionEnd, getBlockOrder, getBlockRootClientId } = select(store); if (clientId) { return getBlockIndex(clientId); } const end = getBlockSelectionEnd(); if (!isAppender && end && getBlockRootClientId(end) === rootClientId) { return getBlockIndex(end) + 1; } return getBlockOrder(rootClientId).length; } const { insertBlock } = dispatch(store); let blockToInsert; if (directInsertBlock) { const newAttributes = getAdjacentBlockAttributes( directInsertBlock.attributesToCopy ); blockToInsert = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, { ...directInsertBlock.attributes || {}, ...newAttributes }); } else { blockToInsert = (0,external_wp_blocks_namespaceObject.createBlock)(allowedBlockType.name); } insertBlock( blockToInsert, getInsertionIndex(), rootClientId, selectBlockOnInsert ); if (onSelectOrClose) { onSelectOrClose(blockToInsert); } const message = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block that has been added (0,external_wp_i18n_namespaceObject.__)("%s block added"), allowedBlockType.title ); (0,external_wp_a11y_namespaceObject.speak)(message); } }; }), // The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as // a way to detect the global Inserter. (0,external_wp_compose_namespaceObject.ifCondition)( ({ hasItems, isAppender, rootClientId, clientId }) => hasItems || !isAppender && !rootClientId && !clientId ) ])(Inserter); ;// ./node_modules/@wordpress/block-editor/build-module/components/button-block-appender/index.js function button_block_appender_ButtonBlockAppender({ rootClientId, className, onFocus, tabIndex, onSelect }, ref) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inserter_default, { position: "bottom center", rootClientId, __experimentalIsQuick: true, onSelectOrClose: (...args) => { if (onSelect && typeof onSelect === "function") { onSelect(...args); } }, renderToggle: ({ onToggle, disabled, isOpen, blockTitle, hasSingleBlockType }) => { const isToggleButton = !hasSingleBlockType; const label = hasSingleBlockType ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block when there is only one (0,external_wp_i18n_namespaceObject._x)( "Add %s", "directly add the only allowed block" ), blockTitle ) : (0,external_wp_i18n_namespaceObject._x)( "Add block", "Generic label for block inserter button" ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ref, onFocus, tabIndex, className: dist_clsx( className, "block-editor-button-block-appender" ), onClick: onToggle, "aria-haspopup": isToggleButton ? "true" : void 0, "aria-expanded": isToggleButton ? isOpen : void 0, disabled, label, showTooltip: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: plus_default }) } ); }, isAppender: true } ); } const ButtonBlockerAppender = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { external_wp_deprecated_default()(`wp.blockEditor.ButtonBlockerAppender`, { alternative: "wp.blockEditor.ButtonBlockAppender", since: "5.9" }); return button_block_appender_ButtonBlockAppender(props, ref); }); var button_block_appender_default = (0,external_wp_element_namespaceObject.forwardRef)(button_block_appender_ButtonBlockAppender); ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/grid-visualizer.js function GridVisualizer({ clientId, contentRef, parentLayout }) { const isDistractionFree = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).getSettings().isDistractionFree, [] ); const gridElement = useBlockElement(clientId); if (isDistractionFree || !gridElement) { return null; } const isManualGrid = parentLayout?.isManualPlacement && window.__experimentalEnableGridInteractivity; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridVisualizerGrid, { gridClientId: clientId, gridElement, isManualGrid, ref: contentRef } ); } const GridVisualizerGrid = (0,external_wp_element_namespaceObject.forwardRef)( ({ gridClientId, gridElement, isManualGrid }, ref) => { const [gridInfo, setGridInfo] = (0,external_wp_element_namespaceObject.useState)( () => getGridInfo(gridElement) ); const [isDroppingAllowed, setIsDroppingAllowed] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { const resizeCallback = () => setGridInfo(getGridInfo(gridElement)); const borderBoxSpy = new window.ResizeObserver(resizeCallback); borderBoxSpy.observe(gridElement, { box: "border-box" }); const contentBoxSpy = new window.ResizeObserver(resizeCallback); contentBoxSpy.observe(gridElement); return () => { borderBoxSpy.disconnect(); contentBoxSpy.disconnect(); }; }, [gridElement]); (0,external_wp_element_namespaceObject.useEffect)(() => { function onGlobalDrag() { setIsDroppingAllowed(true); } function onGlobalDragEnd() { setIsDroppingAllowed(false); } document.addEventListener("drag", onGlobalDrag); document.addEventListener("dragend", onGlobalDragEnd); return () => { document.removeEventListener("drag", onGlobalDrag); document.removeEventListener("dragend", onGlobalDragEnd); }; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( cover_default, { className: dist_clsx("block-editor-grid-visualizer", { "is-dropping-allowed": isDroppingAllowed }), clientId: gridClientId, __unstablePopoverSlot: "__unstable-block-tools-after", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { ref, className: "block-editor-grid-visualizer__grid", style: gridInfo.style, children: isManualGrid ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ManualGridVisualizer, { gridClientId, gridInfo } ) : Array.from({ length: gridInfo.numItems }, (_, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridVisualizerCell, { color: gridInfo.currentColor }, i )) } ) } ); } ); function ManualGridVisualizer({ gridClientId, gridInfo }) { const [highlightedRect, setHighlightedRect] = (0,external_wp_element_namespaceObject.useState)(null); const gridItemStyles = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockOrder, getBlockStyles } = unlock( select(store) ); const blockOrder = getBlockOrder(gridClientId); return getBlockStyles(blockOrder); }, [gridClientId] ); const occupiedRects = (0,external_wp_element_namespaceObject.useMemo)(() => { const rects = []; for (const style of Object.values(gridItemStyles)) { const { columnStart, rowStart, columnSpan = 1, rowSpan = 1 } = style?.layout ?? {}; if (!columnStart || !rowStart) { continue; } rects.push( new GridRect({ columnStart, rowStart, columnSpan, rowSpan }) ); } return rects; }, [gridItemStyles]); return range(1, gridInfo.numRows).map( (row) => range(1, gridInfo.numColumns).map((column) => { const isCellOccupied = occupiedRects.some( (rect) => rect.contains(column, row) ); const isHighlighted = highlightedRect?.contains(column, row) ?? false; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridVisualizerCell, { color: gridInfo.currentColor, className: isHighlighted && "is-highlighted", children: isCellOccupied ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridVisualizerDropZone, { column, row, gridClientId, gridInfo, setHighlightedRect } ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridVisualizerAppender, { column, row, gridClientId, gridInfo, setHighlightedRect } ) }, `${row}-${column}` ); }) ); } function GridVisualizerCell({ color, children, className }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx( "block-editor-grid-visualizer__cell", className ), style: { boxShadow: `inset 0 0 0 1px color-mix(in srgb, ${color} 20%, #0000)`, color }, children } ); } function useGridVisualizerDropZone(column, row, gridClientId, gridInfo, setHighlightedRect) { const { getBlockAttributes, getBlockRootClientId, canInsertBlockType, getBlockName } = (0,external_wp_data_namespaceObject.useSelect)(store); const { updateBlockAttributes, moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell( gridClientId, gridInfo.numColumns ); return useDropZoneWithValidation({ validateDrag(srcClientId) { const blockName = getBlockName(srcClientId); if (!canInsertBlockType(blockName, gridClientId)) { return false; } const attributes = getBlockAttributes(srcClientId); const rect = new GridRect({ columnStart: column, rowStart: row, columnSpan: attributes.style?.layout?.columnSpan, rowSpan: attributes.style?.layout?.rowSpan }); const isInBounds = new GridRect({ columnSpan: gridInfo.numColumns, rowSpan: gridInfo.numRows }).containsRect(rect); return isInBounds; }, onDragEnter(srcClientId) { const attributes = getBlockAttributes(srcClientId); setHighlightedRect( new GridRect({ columnStart: column, rowStart: row, columnSpan: attributes.style?.layout?.columnSpan, rowSpan: attributes.style?.layout?.rowSpan }) ); }, onDragLeave() { setHighlightedRect( (prevHighlightedRect) => prevHighlightedRect?.columnStart === column && prevHighlightedRect?.rowStart === row ? null : prevHighlightedRect ); }, onDrop(srcClientId) { setHighlightedRect(null); const attributes = getBlockAttributes(srcClientId); updateBlockAttributes(srcClientId, { style: { ...attributes.style, layout: { ...attributes.style?.layout, columnStart: column, rowStart: row } } }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition( [srcClientId], getBlockRootClientId(srcClientId), gridClientId, getNumberOfBlocksBeforeCell(column, row) ); } }); } function GridVisualizerDropZone({ column, row, gridClientId, gridInfo, setHighlightedRect }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "block-editor-grid-visualizer__drop-zone", ref: useGridVisualizerDropZone( column, row, gridClientId, gridInfo, setHighlightedRect ) } ); } function GridVisualizerAppender({ column, row, gridClientId, gridInfo, setHighlightedRect }) { const { updateBlockAttributes, moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell( gridClientId, gridInfo.numColumns ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( button_block_appender_default, { rootClientId: gridClientId, className: "block-editor-grid-visualizer__appender", ref: useGridVisualizerDropZone( column, row, gridClientId, gridInfo, setHighlightedRect ), style: { color: gridInfo.currentColor }, onSelect: (block) => { if (!block) { return; } updateBlockAttributes(block.clientId, { style: { layout: { columnStart: column, rowStart: row } } }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition( [block.clientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell(column, row) ); } } ); } function useDropZoneWithValidation({ validateDrag, onDragEnter, onDragLeave, onDrop }) { const { getDraggedBlockClientIds } = (0,external_wp_data_namespaceObject.useSelect)(store); return (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({ onDragEnter() { const [srcClientId] = getDraggedBlockClientIds(); if (srcClientId && validateDrag(srcClientId)) { onDragEnter(srcClientId); } }, onDragLeave() { onDragLeave(); }, onDrop() { const [srcClientId] = getDraggedBlockClientIds(); if (srcClientId && validateDrag(srcClientId)) { onDrop(srcClientId); } } }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/grid-item-resizer.js function GridItemResizer({ clientId, bounds, onChange, parentLayout }) { const blockElement = useBlockElement(clientId); const rootBlockElement = blockElement?.parentElement; const { isManualPlacement } = parentLayout; if (!blockElement || !rootBlockElement) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridItemResizerInner, { clientId, bounds, blockElement, rootBlockElement, onChange, isManualGrid: isManualPlacement && window.__experimentalEnableGridInteractivity } ); } function GridItemResizerInner({ clientId, bounds, blockElement, rootBlockElement, onChange, isManualGrid }) { const [resizeDirection, setResizeDirection] = (0,external_wp_element_namespaceObject.useState)(null); const [enableSide, setEnableSide] = (0,external_wp_element_namespaceObject.useState)({ top: false, bottom: false, left: false, right: false }); (0,external_wp_element_namespaceObject.useEffect)(() => { const observer = new window.ResizeObserver(() => { const blockClientRect = blockElement.getBoundingClientRect(); const rootBlockClientRect = rootBlockElement.getBoundingClientRect(); setEnableSide({ top: blockClientRect.top > rootBlockClientRect.top, bottom: blockClientRect.bottom < rootBlockClientRect.bottom, left: blockClientRect.left > rootBlockClientRect.left, right: blockClientRect.right < rootBlockClientRect.right }); }); observer.observe(blockElement); return () => observer.disconnect(); }, [blockElement, rootBlockElement]); const justification = { right: "left", left: "right" }; const alignment = { top: "flex-end", bottom: "flex-start" }; const styles = { display: "flex", justifyContent: "center", alignItems: "center", ...justification[resizeDirection] && { justifyContent: justification[resizeDirection] }, ...alignment[resizeDirection] && { alignItems: alignment[resizeDirection] } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( cover_default, { className: "block-editor-grid-item-resizer", clientId, __unstablePopoverSlot: "__unstable-block-tools-after", additionalStyles: styles, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ResizableBox, { className: "block-editor-grid-item-resizer__box", size: { width: "100%", height: "100%" }, enable: { bottom: enableSide.bottom, bottomLeft: false, bottomRight: false, left: enableSide.left, right: enableSide.right, top: enableSide.top, topLeft: false, topRight: false }, bounds, boundsByDirection: true, onPointerDown: ({ target, pointerId }) => { target.setPointerCapture(pointerId); }, onResizeStart: (event, direction) => { setResizeDirection(direction); }, onResizeStop: (event, direction, boxElement) => { const columnGap = parseFloat( utils_getComputedCSS(rootBlockElement, "column-gap") ); const rowGap = parseFloat( utils_getComputedCSS(rootBlockElement, "row-gap") ); const gridColumnTracks = getGridTracks( utils_getComputedCSS( rootBlockElement, "grid-template-columns" ), columnGap ); const gridRowTracks = getGridTracks( utils_getComputedCSS( rootBlockElement, "grid-template-rows" ), rowGap ); const rect = new window.DOMRect( blockElement.offsetLeft + boxElement.offsetLeft, blockElement.offsetTop + boxElement.offsetTop, boxElement.offsetWidth, boxElement.offsetHeight ); const columnStart = getClosestTrack(gridColumnTracks, rect.left) + 1; const rowStart = getClosestTrack(gridRowTracks, rect.top) + 1; const columnEnd = getClosestTrack(gridColumnTracks, rect.right, "end") + 1; const rowEnd = getClosestTrack(gridRowTracks, rect.bottom, "end") + 1; onChange({ columnSpan: columnEnd - columnStart + 1, rowSpan: rowEnd - rowStart + 1, columnStart: isManualGrid ? columnStart : void 0, rowStart: isManualGrid ? rowStart : void 0 }); } } ) } ); } ;// ./node_modules/@wordpress/icons/build-module/library/chevron-up.js var chevron_up_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-down.js var chevron_down_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/grid-item-movers.js function GridItemMovers({ layout, parentLayout, onChange, gridClientId, blockClientId }) { const { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); const columnStart = layout?.columnStart ?? 1; const rowStart = layout?.rowStart ?? 1; const columnSpan = layout?.columnSpan ?? 1; const rowSpan = layout?.rowSpan ?? 1; const columnEnd = columnStart + columnSpan - 1; const rowEnd = rowStart + rowSpan - 1; const columnCount = parentLayout?.columnCount; const rowCount = parentLayout?.rowCount; const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell( gridClientId, columnCount ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "parent", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { className: "block-editor-grid-item-mover__move-button-container", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-grid-item-mover__move-horizontal-button-container is-left", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridItemMover, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, label: (0,external_wp_i18n_namespaceObject.__)("Move left"), description: (0,external_wp_i18n_namespaceObject.__)("Move left"), isDisabled: columnStart <= 1, onClick: () => { onChange({ columnStart: columnStart - 1 }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition( [blockClientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell( columnStart - 1, rowStart ) ); } } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-grid-item-mover__move-vertical-button-container", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridItemMover, { className: "is-up-button", icon: chevron_up_default, label: (0,external_wp_i18n_namespaceObject.__)("Move up"), description: (0,external_wp_i18n_namespaceObject.__)("Move up"), isDisabled: rowStart <= 1, onClick: () => { onChange({ rowStart: rowStart - 1 }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition( [blockClientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell( columnStart, rowStart - 1 ) ); } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridItemMover, { className: "is-down-button", icon: chevron_down_default, label: (0,external_wp_i18n_namespaceObject.__)("Move down"), description: (0,external_wp_i18n_namespaceObject.__)("Move down"), isDisabled: rowCount && rowEnd >= rowCount, onClick: () => { onChange({ rowStart: rowStart + 1 }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition( [blockClientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell( columnStart, rowStart + 1 ) ); } } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-grid-item-mover__move-horizontal-button-container is-right", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridItemMover, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default, label: (0,external_wp_i18n_namespaceObject.__)("Move right"), description: (0,external_wp_i18n_namespaceObject.__)("Move right"), isDisabled: columnCount && columnEnd >= columnCount, onClick: () => { onChange({ columnStart: columnStart + 1 }); __unstableMarkNextChangeAsNotPersistent(); moveBlocksToPosition( [blockClientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell( columnStart + 1, rowStart ) ); } } ) }) ] }) }); } function GridItemMover({ className, icon, label, isDisabled, onClick, description }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(GridItemMover); const descriptionId = `block-editor-grid-item-mover-button__description-${instanceId}`; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { className: dist_clsx( "block-editor-grid-item-mover-button", className ), icon, label, "aria-describedby": descriptionId, onClick: isDisabled ? null : onClick, disabled: isDisabled, accessibleWhenDisabled: true } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: description }) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/layout-child.js const LAYOUT_CHILD_BLOCK_PROPS_REFERENCE = {}; function useBlockPropsChildLayoutStyles({ style }) { const shouldRenderChildLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)((select) => { return !select(store).getSettings().disableLayoutStyles; }); const layout = style?.layout ?? {}; const { selfStretch, flexSize, columnStart, rowStart, columnSpan, rowSpan } = layout; const parentLayout = useLayout() || {}; const { columnCount, minimumColumnWidth } = parentLayout; const id = (0,external_wp_compose_namespaceObject.useInstanceId)(LAYOUT_CHILD_BLOCK_PROPS_REFERENCE); const selector = `.wp-container-content-${id}`; if (false) {} let css = ""; if (shouldRenderChildLayoutStyles) { if (selfStretch === "fixed" && flexSize) { css = `${selector} { flex-basis: ${flexSize}; box-sizing: border-box; }`; } else if (selfStretch === "fill") { css = `${selector} { flex-grow: 1; }`; } else if (columnStart && columnSpan) { css = `${selector} { grid-column: ${columnStart} / span ${columnSpan}; }`; } else if (columnStart) { css = `${selector} { grid-column: ${columnStart}; }`; } else if (columnSpan) { css = `${selector} { grid-column: span ${columnSpan}; }`; } if (rowStart && rowSpan) { css += `${selector} { grid-row: ${rowStart} / span ${rowSpan}; }`; } else if (rowStart) { css += `${selector} { grid-row: ${rowStart}; }`; } else if (rowSpan) { css += `${selector} { grid-row: span ${rowSpan}; }`; } if ((columnSpan || columnStart) && (minimumColumnWidth || !columnCount)) { let parentColumnValue = parseFloat(minimumColumnWidth); if (isNaN(parentColumnValue)) { parentColumnValue = 12; } let parentColumnUnit = minimumColumnWidth?.replace( parentColumnValue, "" ); if (!["px", "rem", "em"].includes(parentColumnUnit)) { parentColumnUnit = "rem"; } let numColsToBreakAt = 2; if (columnSpan && columnStart) { numColsToBreakAt = columnSpan + columnStart - 1; } else if (columnSpan) { numColsToBreakAt = columnSpan; } else { numColsToBreakAt = columnStart; } const defaultGapValue = parentColumnUnit === "px" ? 24 : 1.5; const containerQueryValue = numColsToBreakAt * parentColumnValue + (numColsToBreakAt - 1) * defaultGapValue; const minimumContainerQueryValue = parentColumnValue * 2 + defaultGapValue - 1; const gridColumnValue = columnSpan && columnSpan > 1 ? "1/-1" : "auto"; css += `@container (max-width: ${Math.max( containerQueryValue, minimumContainerQueryValue )}${parentColumnUnit}) { ${selector} { grid-column: ${gridColumnValue}; grid-row: auto; } }`; } } useStyleOverride({ css }); if (!css) { return; } return { className: `wp-container-content-${id}` }; } function ChildLayoutControlsPure({ clientId, style, setAttributes }) { const parentLayout = useLayout() || {}; const { type: parentLayoutType = "default", allowSizingOnChildren = false, isManualPlacement } = parentLayout; if (parentLayoutType !== "grid") { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridTools, { clientId, style, setAttributes, allowSizingOnChildren, isManualPlacement, parentLayout } ); } function GridTools({ clientId, style, setAttributes, allowSizingOnChildren, isManualPlacement, parentLayout }) { const { rootClientId, isVisible } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockRootClientId, getBlockEditingMode, getTemplateLock } = select(store); const _rootClientId = getBlockRootClientId(clientId); if (getTemplateLock(_rootClientId) || getBlockEditingMode(_rootClientId) !== "default") { return { rootClientId: _rootClientId, isVisible: false }; } return { rootClientId: _rootClientId, isVisible: true }; }, [clientId] ); const [resizerBounds, setResizerBounds] = (0,external_wp_element_namespaceObject.useState)(); if (!isVisible) { return null; } function updateLayout(layout) { setAttributes({ style: { ...style, layout: { ...style?.layout, ...layout } } }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridVisualizer, { clientId: rootClientId, contentRef: setResizerBounds, parentLayout } ), allowSizingOnChildren && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridItemResizer, { clientId, bounds: resizerBounds, onChange: updateLayout, parentLayout } ), isManualPlacement && window.__experimentalEnableGridInteractivity && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridItemMovers, { layout: style?.layout, parentLayout, onChange: updateLayout, gridClientId: rootClientId, blockClientId: clientId } ) ] }); } var layout_child_default = { useBlockProps: useBlockPropsChildLayoutStyles, edit: ChildLayoutControlsPure, attributeKeys: ["style"], hasSupport() { return true; } }; ;// ./node_modules/@wordpress/block-editor/build-module/hooks/content-lock-ui.js function ContentLockControlsPure({ clientId }) { const { templateLock, isLockedByParent, isEditingAsBlocks } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getContentLockingParent, getTemplateLock, getTemporarilyEditingAsBlocks } = unlock(select(store)); return { templateLock: getTemplateLock(clientId), isLockedByParent: !!getContentLockingParent(clientId), isEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId }; }, [clientId] ); const { stopEditingAsBlocks } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const isContentLocked = !isLockedByParent && templateLock === "contentOnly"; const stopEditingAsBlockCallback = (0,external_wp_element_namespaceObject.useCallback)(() => { stopEditingAsBlocks(clientId); }, [clientId, stopEditingAsBlocks]); if (!isContentLocked && !isEditingAsBlocks) { return null; } const showStopEditingAsBlocks = isEditingAsBlocks && !isContentLocked; return showStopEditingAsBlocks && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "other", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: stopEditingAsBlockCallback, children: (0,external_wp_i18n_namespaceObject.__)("Done") }) }); } var content_lock_ui_default = { edit: ContentLockControlsPure, hasSupport() { return true; } }; ;// ./node_modules/@wordpress/block-editor/build-module/hooks/metadata.js const META_ATTRIBUTE_NAME = "metadata"; function addMetaAttribute(blockTypeSettings) { if (blockTypeSettings?.attributes?.[META_ATTRIBUTE_NAME]?.type) { return blockTypeSettings; } blockTypeSettings.attributes = { ...blockTypeSettings.attributes, [META_ATTRIBUTE_NAME]: { type: "object" } }; return blockTypeSettings; } function metadata_addTransforms(result, source, index, results) { if (results.length === 1 && result.innerBlocks.length === source.length) { return result; } if (results.length === 1 && source.length > 1 || results.length > 1 && source.length === 1) { return result; } if (results.length > 1 && source.length > 1 && results.length !== source.length) { return result; } const sourceMetadata = source[index]?.attributes?.metadata; if (!sourceMetadata) { return result; } const preservedMetadata = {}; if (sourceMetadata.noteId && !result.attributes?.metadata?.noteId) { preservedMetadata.noteId = sourceMetadata.noteId; } if (sourceMetadata.name && !result.attributes?.metadata?.name && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, "renaming", true)) { preservedMetadata.name = sourceMetadata.name; } if (sourceMetadata.blockVisibility !== void 0 && !result.attributes?.metadata?.blockVisibility && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, "visibility", true)) { preservedMetadata.blockVisibility = sourceMetadata.blockVisibility; } if (Object.keys(preservedMetadata).length > 0) { return { ...result, attributes: { ...result.attributes, metadata: { ...result.attributes.metadata, ...preservedMetadata } } }; } return result; } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/metadata/addMetaAttribute", addMetaAttribute ); (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.switchToBlockType.transformedBlock", "core/metadata/addTransforms", metadata_addTransforms ); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-hooks.js const block_hooks_EMPTY_OBJECT = {}; function BlockHooksControlPure({ name, clientId, metadata: { ignoredHookedBlocks = [] } = {} }) { const blockTypes = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), [] ); const hookedBlocksForCurrentBlock = (0,external_wp_element_namespaceObject.useMemo)( () => blockTypes?.filter( ({ name: blockName, blockHooks }) => blockHooks && name in blockHooks || ignoredHookedBlocks.includes(blockName) ), [blockTypes, name, ignoredHookedBlocks] ); const hookedBlockClientIds = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlocks, getBlockRootClientId: getBlockRootClientId2, getGlobalBlockCount } = select(store); const rootClientId = getBlockRootClientId2(clientId); const _hookedBlockClientIds = hookedBlocksForCurrentBlock.reduce( (clientIds, block) => { if (getGlobalBlockCount(block.name) === 0) { return clientIds; } const relativePosition = block?.blockHooks?.[name]; let candidates; switch (relativePosition) { case "before": case "after": candidates = getBlocks(rootClientId); break; case "first_child": case "last_child": candidates = getBlocks(clientId); break; case void 0: candidates = [ ...getBlocks(rootClientId), ...getBlocks(clientId) ]; break; } const hookedBlock = candidates?.find( (candidate) => candidate.name === block.name ); if (hookedBlock) { return { ...clientIds, [block.name]: hookedBlock.clientId }; } return clientIds; }, {} ); if (Object.values(_hookedBlockClientIds).length > 0) { return _hookedBlockClientIds; } return block_hooks_EMPTY_OBJECT; }, [hookedBlocksForCurrentBlock, name, clientId] ); const { getBlockIndex, getBlockCount, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { insertBlock, removeBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (!hookedBlocksForCurrentBlock.length) { return null; } const groupedHookedBlocks = hookedBlocksForCurrentBlock.reduce( (groups, block) => { const [namespace] = block.name.split("/"); if (!groups[namespace]) { groups[namespace] = []; } groups[namespace].push(block); return groups; }, {} ); const insertBlockIntoDesignatedLocation = (block, relativePosition) => { const blockIndex = getBlockIndex(clientId); const innerBlocksLength = getBlockCount(clientId); const rootClientId = getBlockRootClientId(clientId); switch (relativePosition) { case "before": case "after": insertBlock( block, relativePosition === "after" ? blockIndex + 1 : blockIndex, rootClientId, // Insert as a child of the current block's parent false ); break; case "first_child": case "last_child": insertBlock( block, // TODO: It'd be great if insertBlock() would accept negative indices for insertion. relativePosition === "first_child" ? 0 : innerBlocksLength, clientId, // Insert as a child of the current block. false ); break; case void 0: insertBlock( block, blockIndex + 1, rootClientId, // Insert as a child of the current block's parent false ); break; } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.PanelBody, { className: "block-editor-hooks__block-hooks", title: (0,external_wp_i18n_namespaceObject.__)("Plugins"), initialOpen: true, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-hooks__block-hooks-helptext", children: (0,external_wp_i18n_namespaceObject.__)( "Manage the inclusion of blocks added automatically by plugins." ) }), Object.keys(groupedHookedBlocks).map((vendor) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { children: vendor }), groupedHookedBlocks[vendor].map((block) => { const checked = block.name in hookedBlockClientIds; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, checked, label: block.title, onChange: () => { if (!checked) { const relativePosition = block.blockHooks[name]; insertBlockIntoDesignatedLocation( (0,external_wp_blocks_namespaceObject.createBlock)(block.name), relativePosition ); return; } removeBlock( hookedBlockClientIds[block.name], false ); } }, block.title ); }) ] }, vendor); }) ] } ) }); } var block_hooks_default = { edit: BlockHooksControlPure, attributeKeys: ["metadata"], hasSupport() { return true; } }; ;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-bindings.js const { Menu } = unlock(external_wp_components_namespaceObject.privateApis); const block_bindings_EMPTY_OBJECT = {}; const getAttributeType = (blockName, attribute) => { const _attributeType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName).attributes?.[attribute]?.type; return _attributeType === "rich-text" ? "string" : _attributeType; }; const block_bindings_useToolsPanelDropdownMenuProps = () => { const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); return !isMobile ? { popoverProps: { placement: "left-start", // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px) offset: 259 } } : {}; }; function BlockBindingsPanelMenuContent({ attribute, binding, sources }) { const { clientId } = useBlockEditContext(); const { updateBlockBindings } = useBlockBindingsUtils(); const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default); const { attributeType, select } = (0,external_wp_data_namespaceObject.useSelect)( (_select) => { const { name: blockName } = _select(store).getBlock(clientId); return { attributeType: getAttributeType(blockName, attribute), select: _select }; }, [clientId, attribute] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu, { placement: isMobile ? "bottom-start" : "left-start", children: Object.entries(sources).map(([sourceKey, source]) => { const sourceDataItems = source.data?.filter( (item) => item?.type === attributeType ); const noItemsAvailable = !sourceDataItems || sourceDataItems.length === 0; if (noItemsAvailable) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( Menu, { placement: isMobile ? "bottom-start" : "left-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.SubmenuTriggerItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: source.label }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Popover, { gutter: 8, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Group, { children: sourceDataItems.map((item) => { const itemBindings = { source: sourceKey, args: item?.args || { key: item.key } }; let values = {}; try { values = source.getValues({ select, context: blockContext, bindings: { [attribute]: itemBindings } }); } catch (e) { } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( Menu.CheckboxItem, { onChange: () => { const isCurrentlySelected = es6_default()( binding?.args, item.args ) ?? // Deprecate key dependency in 7.0. item.key === binding?.args?.key; if (isCurrentlySelected) { updateBlockBindings({ [attribute]: void 0 }); } else { updateBlockBindings({ [attribute]: itemBindings }); } }, name: attribute + "-binding", value: values[attribute], checked: es6_default()( binding?.args, item.args ) ?? // Deprecate key dependency in 7.0. item.key === binding?.args?.key, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: item?.label }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemHelpText, { children: values[attribute] }) ] }, sourceKey + JSON.stringify( item.args ) || item.key ); }) }) }) ] }, sourceKey ); }) }); } function BlockBindingsAttribute({ attribute, binding, sources, blockName }) { const { source: sourceName, args } = binding || {}; const source = sources?.[sourceName]; let displayText; let isValid = true; const isNotBound = binding === void 0; if (isNotBound) { const attributeType = getAttributeType(blockName, attribute); const hasCompatibleSources = Object.values(sources).some( (src) => src.data?.some((item) => item?.type === attributeType) ); if (!hasCompatibleSources) { displayText = (0,external_wp_i18n_namespaceObject.__)("No sources available"); } else { displayText = (0,external_wp_i18n_namespaceObject.__)("Not connected"); } isValid = true; } else if (!source) { isValid = false; displayText = (0,external_wp_i18n_namespaceObject.__)("Source not registered"); if (Object.keys(sources).length === 0) { displayText = (0,external_wp_i18n_namespaceObject.__)("No sources available"); } } else { displayText = source.data?.find((item) => es6_default()(item.args, args))?.label || source.label || sourceName; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-bindings__item", spacing: 0, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { truncate: true, children: attribute }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalText, { truncate: true, variant: isValid ? "muted" : void 0, isDestructive: !isValid, children: displayText } ) ] }); } function ReadOnlyBlockBindingsPanelItem({ attribute, binding, sources, blockName }) { const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => !!binding, label: attribute, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu, { placement: isMobile ? "bottom-start" : "left-start", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.TriggerButton, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, {}), disabled: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockBindingsAttribute, { attribute, binding, sources, blockName } ) }) }) }); } function EditableBlockBindingsPanelItem({ attribute, binding, sources, blockName }) { const { updateBlockBindings } = useBlockBindingsUtils(); const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => !!binding, label: attribute, onDeselect: () => { updateBlockBindings({ [attribute]: void 0 }); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { placement: isMobile ? "bottom-start" : "left-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.TriggerButton, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, {}), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockBindingsAttribute, { attribute, binding, sources, blockName } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Popover, { gutter: isMobile ? 8 : 36, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockBindingsPanelMenuContent, { attribute, binding, sources } ) }) ] }) } ); } const BlockBindingsPanel = ({ name: blockName, metadata }) => { const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default); const { removeAllBlockBindings } = useBlockBindingsUtils(); const dropdownMenuProps = block_bindings_useToolsPanelDropdownMenuProps(); const _sources = {}; const { sources, canUpdateBlockBindings, bindableAttributes } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { __experimentalBlockBindingsSupportedAttributes } = select(store).getSettings(); const _bindableAttributes = __experimentalBlockBindingsSupportedAttributes?.[blockName]; if (!_bindableAttributes || _bindableAttributes.length === 0) { return block_bindings_EMPTY_OBJECT; } const registeredSources = (0,external_wp_blocks_namespaceObject.getBlockBindingsSources)(); Object.entries(registeredSources).forEach( ([ sourceName, { getFieldsList, usesContext, label, getValues } ]) => { const context = {}; if (usesContext?.length) { for (const key of usesContext) { context[key] = blockContext[key]; } } if (getFieldsList) { const fieldsListResult = getFieldsList({ select, context }); _sources[sourceName] = { data: fieldsListResult || [], label, getValues }; } else { _sources[sourceName] = { data: [], label, getValues }; } } ); return { sources: Object.values(_sources).length > 0 ? _sources : block_bindings_EMPTY_OBJECT, canUpdateBlockBindings: select(store).getSettings().canUpdateBlockBindings, bindableAttributes: _bindableAttributes }; }, [blockContext, blockName] ); if (!bindableAttributes || bindableAttributes.length === 0) { return null; } const { bindings } = metadata || {}; const hasCompatibleData = Object.values(sources).some( (source) => source.data && source.data.length > 0 ); const readOnly = !canUpdateBlockBindings || !hasCompatibleData; if (bindings === void 0 && !hasCompatibleData) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "bindings", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject.__)("Attributes"), resetAll: () => { removeAllBlockBindings(); }, dropdownMenuProps, className: "block-editor-bindings__panel", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: bindableAttributes.map((attribute) => { const binding = bindings?.[attribute]; const attributeType = getAttributeType( blockName, attribute ); const hasCompatibleDataForAttribute = Object.values( sources ).some( (source) => source.data?.some( (item) => item?.type === attributeType ) ); const isAttributeReadOnly = readOnly || !hasCompatibleDataForAttribute; return isAttributeReadOnly ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ReadOnlyBlockBindingsPanelItem, { attribute, binding, sources, blockName }, attribute ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EditableBlockBindingsPanelItem, { attribute, binding, sources, blockName }, attribute ); }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "div", variant: "muted", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( "Attributes connected to custom fields or other dynamic data." ) }) }) ] } ) }); }; var block_bindings_default = { edit: BlockBindingsPanel, attributeKeys: ["metadata"], hasSupport(name) { return ![ "core/post-date", "core/navigation-link", "core/navigation-submenu" ].includes(name); } }; ;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-renaming.js function addLabelCallback(settings) { if (settings.__experimentalLabel) { return settings; } const supportsBlockNaming = (0,external_wp_blocks_namespaceObject.hasBlockSupport)( settings, "renaming", true // default value ); if (supportsBlockNaming) { settings.__experimentalLabel = (attributes, { context }) => { const { metadata } = attributes; if (context === "list-view" && metadata?.name) { return metadata.name; } }; } return settings; } (0,external_wp_hooks_namespaceObject.addFilter)( "blocks.registerBlockType", "core/metadata/addLabelCallback", addLabelCallback ); ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/use-grid-layout-sync.js function useGridLayoutSync({ clientId: gridClientId }) { const { gridLayout, blockOrder, selectedBlockLayout } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockAttributes: getBlockAttributes2, getBlockOrder } = select(store); const selectedBlock = select(store).getSelectedBlock(); return { gridLayout: getBlockAttributes2(gridClientId).layout ?? {}, blockOrder: getBlockOrder(gridClientId), selectedBlockLayout: selectedBlock?.attributes.style?.layout }; }, [gridClientId] ); const { getBlockAttributes, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); const selectedBlockRect = (0,external_wp_element_namespaceObject.useMemo)( () => selectedBlockLayout ? new GridRect(selectedBlockLayout) : null, [selectedBlockLayout] ); const previouslySelectedBlockRect = (0,external_wp_compose_namespaceObject.usePrevious)(selectedBlockRect); const previousIsManualPlacement = (0,external_wp_compose_namespaceObject.usePrevious)( gridLayout.isManualPlacement ); const previousBlockOrder = (0,external_wp_compose_namespaceObject.usePrevious)(blockOrder); (0,external_wp_element_namespaceObject.useEffect)(() => { const updates = {}; if (gridLayout.isManualPlacement) { const occupiedRects = []; for (const clientId of blockOrder) { const { columnStart, rowStart, columnSpan = 1, rowSpan = 1 } = getBlockAttributes(clientId).style?.layout ?? {}; if (!columnStart || !rowStart) { continue; } occupiedRects.push( new GridRect({ columnStart, rowStart, columnSpan, rowSpan }) ); } for (const clientId of blockOrder) { const attributes = getBlockAttributes(clientId); const { columnStart, rowStart, columnSpan = 1, rowSpan = 1 } = attributes.style?.layout ?? {}; if (columnStart && rowStart) { continue; } const [newColumnStart, newRowStart] = placeBlock( occupiedRects, gridLayout.columnCount, columnSpan, rowSpan, previouslySelectedBlockRect?.columnEnd, previouslySelectedBlockRect?.rowEnd ); occupiedRects.push( new GridRect({ columnStart: newColumnStart, rowStart: newRowStart, columnSpan, rowSpan }) ); updates[clientId] = { style: { ...attributes.style, layout: { ...attributes.style?.layout, columnStart: newColumnStart, rowStart: newRowStart } } }; } const bottomMostRow = Math.max( ...occupiedRects.map((r) => r.rowEnd) ); if (!gridLayout.rowCount || gridLayout.rowCount < bottomMostRow) { updates[gridClientId] = { layout: { ...gridLayout, rowCount: bottomMostRow } }; } for (const clientId of previousBlockOrder ?? []) { if (!blockOrder.includes(clientId)) { const rootClientId = getBlockRootClientId(clientId); if (rootClientId === null) { continue; } const rootAttributes = getBlockAttributes(rootClientId); if (rootAttributes?.layout?.type === "grid") { continue; } const attributes = getBlockAttributes(clientId); const { columnStart, rowStart, columnSpan, rowSpan, ...layout } = attributes.style?.layout ?? {}; if (columnStart || rowStart || columnSpan || rowSpan) { const hasEmptyLayoutAttribute = Object.keys(layout).length === 0; updates[clientId] = setImmutably( attributes, ["style", "layout"], hasEmptyLayoutAttribute ? void 0 : layout ); } } } } else { if (previousIsManualPlacement === true) { for (const clientId of blockOrder) { const attributes = getBlockAttributes(clientId); const { columnStart, rowStart, ...layout } = attributes.style?.layout ?? {}; if (columnStart || rowStart) { const hasEmptyLayoutAttribute = Object.keys(layout).length === 0; updates[clientId] = setImmutably( attributes, ["style", "layout"], hasEmptyLayoutAttribute ? void 0 : layout ); } } } if (gridLayout.rowCount) { updates[gridClientId] = { layout: { ...gridLayout, rowCount: void 0 } }; } } if (Object.keys(updates).length) { __unstableMarkNextChangeAsNotPersistent(); updateBlockAttributes( Object.keys(updates), updates, /* uniqueByBlock: */ true ); } }, [ // Actual deps to sync: gridClientId, gridLayout, previousBlockOrder, blockOrder, previouslySelectedBlockRect, previousIsManualPlacement, // These won't change, but the linter thinks they might: __unstableMarkNextChangeAsNotPersistent, getBlockAttributes, getBlockRootClientId, updateBlockAttributes ]); } function placeBlock(occupiedRects, gridColumnCount, blockColumnSpan, blockRowSpan, startColumn = 1, startRow = 1) { for (let row = startRow; ; row++) { for (let column = row === startRow ? startColumn : 1; column <= gridColumnCount; column++) { const candidateRect = new GridRect({ columnStart: column, rowStart: row, columnSpan: blockColumnSpan, rowSpan: blockRowSpan }); if (!occupiedRects.some( (r) => r.intersectsRect(candidateRect) )) { return [column, row]; } } } } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/grid-visualizer.js function GridLayoutSync(props) { useGridLayoutSync(props); } function grid_visualizer_GridTools({ clientId, layout }) { const isVisible = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { isBlockSelected, isDraggingBlocks, getTemplateLock, getBlockEditingMode } = select(store); if (!isDraggingBlocks() && !isBlockSelected(clientId) || getTemplateLock(clientId) || getBlockEditingMode(clientId) !== "default") { return false; } return true; }, [clientId] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GridLayoutSync, { clientId }), isVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GridVisualizer, { clientId, parentLayout: layout }) ] }); } const addGridVisualizerToBlockEdit = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (BlockEdit) => (props) => { if (props.attributes.layout?.type !== "grid") { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( grid_visualizer_GridTools, { clientId: props.clientId, layout: props.attributes.layout } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit") ] }); }, "addGridVisualizerToBlockEdit" ); (0,external_wp_hooks_namespaceObject.addFilter)( "editor.BlockEdit", "core/editor/grid-visualizer", addGridVisualizerToBlockEdit ); ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-border-props.js function getBorderClassesAndStyles(attributes) { const border = attributes.style?.border || {}; const className = getBorderClasses(attributes); return { className: className || void 0, style: getInlineStyles({ border }) }; } function useBorderProps(attributes) { const { colors } = useMultipleOriginColorsAndGradients(); const borderProps = getBorderClassesAndStyles(attributes); const { borderColor } = attributes; if (borderColor) { const borderColorObject = getMultiOriginColor({ colors, namedColor: borderColor }); borderProps.style.borderColor = borderColorObject.color; } return borderProps; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-shadow-props.js function getShadowClassesAndStyles(attributes) { const shadow = attributes.style?.shadow || ""; return { style: getInlineStyles({ shadow }) }; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-color-props.js function getColorClassesAndStyles(attributes) { const { backgroundColor, textColor, gradient, style } = attributes; const backgroundClass = getColorClassName( "background-color", backgroundColor ); const textClass = getColorClassName("color", textColor); const gradientClass = __experimentalGetGradientClass(gradient); const hasGradient = gradientClass || style?.color?.gradient; const className = dist_clsx(textClass, gradientClass, { // Don't apply the background class if there's a gradient. [backgroundClass]: !hasGradient && !!backgroundClass, "has-text-color": textColor || style?.color?.text, "has-background": backgroundColor || style?.color?.background || gradient || style?.color?.gradient, "has-link-color": style?.elements?.link?.color }); const colorStyles = style?.color || {}; const styleProp = getInlineStyles({ color: colorStyles }); return { className: className || void 0, style: styleProp }; } function useColorProps(attributes) { const { backgroundColor, textColor, gradient } = attributes; const [ userPalette, themePalette, defaultPalette, userGradients, themeGradients, defaultGradients ] = use_settings_useSettings( "color.palette.custom", "color.palette.theme", "color.palette.default", "color.gradients.custom", "color.gradients.theme", "color.gradients.default" ); const colors = (0,external_wp_element_namespaceObject.useMemo)( () => [ ...userPalette || [], ...themePalette || [], ...defaultPalette || [] ], [userPalette, themePalette, defaultPalette] ); const gradients = (0,external_wp_element_namespaceObject.useMemo)( () => [ ...userGradients || [], ...themeGradients || [], ...defaultGradients || [] ], [userGradients, themeGradients, defaultGradients] ); const colorProps = getColorClassesAndStyles(attributes); if (backgroundColor) { const backgroundColorObject = getColorObjectByAttributeValues( colors, backgroundColor ); colorProps.style.backgroundColor = backgroundColorObject.color; } if (gradient) { colorProps.style.background = getGradientValueBySlug( gradients, gradient ); } if (textColor) { const textColorObject = getColorObjectByAttributeValues( colors, textColor ); colorProps.style.color = textColorObject.color; } return colorProps; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-spacing-props.js function getSpacingClassesAndStyles(attributes) { const { style } = attributes; const spacingStyles = style?.spacing || {}; const styleProp = getInlineStyles({ spacing: spacingStyles }); return { style: styleProp }; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-typography-props.js const { kebabCase: use_typography_props_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); function getTypographyClassesAndStyles(attributes, settings) { let typographyStyles = attributes?.style?.typography || {}; typographyStyles = { ...typographyStyles, fontSize: getTypographyFontSizeValue( { size: attributes?.style?.typography?.fontSize }, settings ) }; const style = getInlineStyles({ typography: typographyStyles }); const fontFamilyClassName = !!attributes?.fontFamily ? `has-${use_typography_props_kebabCase(attributes.fontFamily)}-font-family` : ""; const textAlignClassName = !!attributes?.style?.typography?.textAlign ? `has-text-align-${attributes?.style?.typography?.textAlign}` : ""; const className = dist_clsx( fontFamilyClassName, textAlignClassName, getFontSizeClass(attributes?.fontSize) ); return { className, style }; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-cached-truthy.js function useCachedTruthy(value) { const [cachedValue, setCachedValue] = (0,external_wp_element_namespaceObject.useState)(value); (0,external_wp_element_namespaceObject.useEffect)(() => { if (value) { setCachedValue(value); } }, [value]); return cachedValue; } ;// ./node_modules/@wordpress/block-editor/build-module/hooks/index.js createBlockEditFilter( [ align_default, text_align_default, anchor_default, custom_class_name_default, style_default, duotone_default, fit_text_default, position_default, layout_default, content_lock_ui_default, block_hooks_default, block_bindings_default, layout_child_default, allowed_blocks_default ].filter(Boolean) ); createBlockListBlockFilter([ align_default, text_align_default, background_default, style_default, color_default, dimensions_default, duotone_default, font_family_default, font_size_default, fit_text_default, border_default, position_default, block_style_variation_default, layout_child_default ]); createBlockSaveFilter([ align_default, text_align_default, anchor_default, aria_label_default, custom_class_name_default, border_default, fit_text_default, color_default, style_default, font_family_default, font_size_default ]); ;// ./node_modules/@wordpress/block-editor/build-module/components/colors/with-colors.js const { kebabCase: with_colors_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); const upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpperCase() + rest.join(""); const withCustomColorPalette = (colorsArray) => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (WrappedComponent) => (props) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, colors: colorsArray }), "withCustomColorPalette" ); const withEditorColorPalette = () => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (WrappedComponent) => (props) => { const [userPalette, themePalette, defaultPalette] = use_settings_useSettings( "color.palette.custom", "color.palette.theme", "color.palette.default" ); const allColors = (0,external_wp_element_namespaceObject.useMemo)( () => [ ...userPalette || [], ...themePalette || [], ...defaultPalette || [] ], [userPalette, themePalette, defaultPalette] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, colors: allColors }); }, "withEditorColorPalette" ); function createColorHOC(colorTypes, withColorPalette) { const colorMap = colorTypes.reduce((colorObject, colorType) => { return { ...colorObject, ...typeof colorType === "string" ? { [colorType]: with_colors_kebabCase(colorType) } : colorType }; }, {}); return (0,external_wp_compose_namespaceObject.compose)([ withColorPalette, (WrappedComponent) => { return class extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); this.setters = this.createSetters(); this.colorUtils = { getMostReadableColor: this.getMostReadableColor.bind(this) }; this.state = {}; } getMostReadableColor(colorValue) { const { colors } = this.props; return getMostReadableColor(colors, colorValue); } createSetters() { return Object.keys(colorMap).reduce( (settersAccumulator, colorAttributeName) => { const upperFirstColorAttributeName = upperFirst(colorAttributeName); const customColorAttributeName = `custom${upperFirstColorAttributeName}`; settersAccumulator[`set${upperFirstColorAttributeName}`] = this.createSetColor( colorAttributeName, customColorAttributeName ); return settersAccumulator; }, {} ); } createSetColor(colorAttributeName, customColorAttributeName) { return (colorValue) => { const colorObject = getColorObjectByColorValue( this.props.colors, colorValue ); this.props.setAttributes({ [colorAttributeName]: colorObject && colorObject.slug ? colorObject.slug : void 0, [customColorAttributeName]: colorObject && colorObject.slug ? void 0 : colorValue }); }; } static getDerivedStateFromProps({ attributes, colors }, previousState) { return Object.entries(colorMap).reduce( (newState, [colorAttributeName, colorContext]) => { const colorObject = getColorObjectByAttributeValues( colors, attributes[colorAttributeName], attributes[`custom${upperFirst( colorAttributeName )}`] ); const previousColorObject = previousState[colorAttributeName]; const previousColor = previousColorObject?.color; if (previousColor === colorObject.color && previousColorObject) { newState[colorAttributeName] = previousColorObject; } else { newState[colorAttributeName] = { ...colorObject, class: getColorClassName( colorContext, colorObject.slug ) }; } return newState; }, {} ); } render() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WrappedComponent, { ...{ ...this.props, colors: void 0, ...this.state, ...this.setters, colorUtils: this.colorUtils } } ); } }; } ]); } function createCustomColorsHOC(colorsArray) { return (...colorTypes) => { const withColorPalette = withCustomColorPalette(colorsArray); return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( createColorHOC(colorTypes, withColorPalette), "withCustomColors" ); }; } function withColors(...colorTypes) { const withColorPalette = withEditorColorPalette(); return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( createColorHOC(colorTypes, withColorPalette), "withColors" ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/colors/index.js ;// ./node_modules/@wordpress/block-editor/build-module/components/gradients/index.js ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/font-size-picker.js function font_size_picker_FontSizePicker(props) { const [fontSizes, customFontSize] = use_settings_useSettings( "typography.fontSizes", "typography.customFontSize" ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FontSizePicker, { ...props, fontSizes, disableCustomFontSizes: !customFontSize } ); } var font_size_picker_default = font_size_picker_FontSizePicker; ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/with-font-sizes.js const DEFAULT_FONT_SIZES = []; const with_font_sizes_upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpperCase() + rest.join(""); var with_font_sizes_default = (...fontSizeNames) => { const fontSizeAttributeNames = fontSizeNames.reduce( (fontSizeAttributeNamesAccumulator, fontSizeAttributeName) => { fontSizeAttributeNamesAccumulator[fontSizeAttributeName] = `custom${with_font_sizes_upperFirst(fontSizeAttributeName)}`; return fontSizeAttributeNamesAccumulator; }, {} ); return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (0,external_wp_compose_namespaceObject.compose)([ (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (WrappedComponent) => (props) => { const [fontSizes] = use_settings_useSettings("typography.fontSizes"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WrappedComponent, { ...props, fontSizes: fontSizes || DEFAULT_FONT_SIZES } ); }, "withFontSizes" ), (WrappedComponent) => { return class extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); this.setters = this.createSetters(); this.state = {}; } createSetters() { return Object.entries(fontSizeAttributeNames).reduce( (settersAccumulator, [ fontSizeAttributeName, customFontSizeAttributeName ]) => { const upperFirstFontSizeAttributeName = with_font_sizes_upperFirst(fontSizeAttributeName); settersAccumulator[`set${upperFirstFontSizeAttributeName}`] = this.createSetFontSize( fontSizeAttributeName, customFontSizeAttributeName ); return settersAccumulator; }, {} ); } createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName) { return (fontSizeValue) => { const fontSizeObject = this.props.fontSizes?.find( ({ size }) => size === Number(fontSizeValue) ); this.props.setAttributes({ [fontSizeAttributeName]: fontSizeObject && fontSizeObject.slug ? fontSizeObject.slug : void 0, [customFontSizeAttributeName]: fontSizeObject && fontSizeObject.slug ? void 0 : fontSizeValue }); }; } static getDerivedStateFromProps({ attributes, fontSizes }, previousState) { const didAttributesChange = (customFontSizeAttributeName, fontSizeAttributeName) => { if (previousState[fontSizeAttributeName]) { if (attributes[fontSizeAttributeName]) { return attributes[fontSizeAttributeName] !== previousState[fontSizeAttributeName].slug; } return previousState[fontSizeAttributeName].size !== attributes[customFontSizeAttributeName]; } return true; }; if (!Object.values(fontSizeAttributeNames).some( didAttributesChange )) { return null; } const newState = Object.entries( fontSizeAttributeNames ).filter( ([key, value]) => didAttributesChange(value, key) ).reduce( (newStateAccumulator, [ fontSizeAttributeName, customFontSizeAttributeName ]) => { const fontSizeAttributeValue = attributes[fontSizeAttributeName]; const fontSizeObject = utils_getFontSize( fontSizes, fontSizeAttributeValue, attributes[customFontSizeAttributeName] ); newStateAccumulator[fontSizeAttributeName] = { ...fontSizeObject, class: getFontSizeClass( fontSizeAttributeValue ) }; return newStateAccumulator; }, {} ); return { ...previousState, ...newState }; } render() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WrappedComponent, { ...{ ...this.props, fontSizes: void 0, ...this.state, ...this.setters } } ); } }; } ]), "withFontSizes" ); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/index.js ;// ./node_modules/@wordpress/block-editor/build-module/autocompleters/block.js const block_noop = () => { }; const block_SHOWN_BLOCK_TYPES = 9; function createBlockCompleter() { return { name: "blocks", className: "block-editor-autocompleters__block", triggerPrefix: "/", useItems(filterValue) { const { rootClientId, selectedBlockId, prioritizedBlocks } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSelectedBlockClientId, getBlock, getBlockListSettings, getBlockRootClientId } = select(store); const { getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const selectedBlockClientId = getSelectedBlockClientId(); const { name: blockName, attributes } = getBlock( selectedBlockClientId ); const activeBlockVariation = getActiveBlockVariation( blockName, attributes ); const _rootClientId = getBlockRootClientId( selectedBlockClientId ); return { selectedBlockId: activeBlockVariation ? `${blockName}/${activeBlockVariation.name}` : blockName, rootClientId: _rootClientId, prioritizedBlocks: getBlockListSettings(_rootClientId)?.prioritizedInserterBlocks }; }, []); const [items, categories, collections] = use_block_types_state_default( rootClientId, block_noop, true ); const filteredItems = (0,external_wp_element_namespaceObject.useMemo)(() => { const initialFilteredItems = !!filterValue.trim() ? searchBlockItems( items, categories, collections, filterValue ) : orderInserterBlockItems( orderBy(items, "frecency", "desc"), prioritizedBlocks ); return initialFilteredItems.filter((item) => item.id !== selectedBlockId).slice(0, block_SHOWN_BLOCK_TYPES); }, [ filterValue, selectedBlockId, items, categories, collections, prioritizedBlocks ]); const options = (0,external_wp_element_namespaceObject.useMemo)( () => filteredItems.map((blockItem) => { const { title, icon, isDisabled } = blockItem; return { key: `block-${blockItem.id}`, value: blockItem, label: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_icon_default, { icon, showColors: true }, "icon" ), title ] }), isDisabled }; }), [filteredItems] ); return [options]; }, allowContext(before, after) { return !(/\S/.test(before) || /\S/.test(after)); }, getOptionCompletion(inserterItem) { const { name, initialAttributes, innerBlocks, syncStatus, blocks } = inserterItem; return { action: "replace", value: syncStatus === "unsynced" ? (blocks ?? []).map( (block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block) ) : (0,external_wp_blocks_namespaceObject.createBlock)( name, initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)( innerBlocks ) ) }; } }; } var block_block_default = createBlockCompleter(); ;// external ["wp","apiFetch"] const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// ./node_modules/@wordpress/icons/build-module/library/post.js var post_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/autocompleters/link.js const SHOWN_SUGGESTIONS = 10; function createLinkCompleter() { return { name: "links", className: "block-editor-autocompleters__link", triggerPrefix: "[[", options: async (letters) => { let options = await external_wp_apiFetch_default()({ path: (0,external_wp_url_namespaceObject.addQueryArgs)("/wp/v2/search", { per_page: SHOWN_SUGGESTIONS, search: letters, type: "post", order_by: "menu_order" }) }); options = options.filter((option) => option.title !== ""); return options; }, getOptionKeywords(item) { const expansionWords = item.title.split(/\s+/); return [...expansionWords]; }, getOptionLabel(item) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( icon_default, { icon: item.subtype === "page" ? page_default : post_default }, "icon" ), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title) ] }); }, getOptionCompletion(item) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: item.url, children: item.title }); } }; } var link_link_default = createLinkCompleter(); ;// ./node_modules/@wordpress/block-editor/build-module/components/autocomplete/index.js const autocomplete_EMPTY_ARRAY = []; function useCompleters({ completers = autocomplete_EMPTY_ARRAY }) { const { name } = useBlockEditContext(); return (0,external_wp_element_namespaceObject.useMemo)(() => { let filteredCompleters = [...completers, link_link_default]; if (name === (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() || (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "__experimentalSlashInserter", false)) { filteredCompleters = [...filteredCompleters, block_block_default]; } if ((0,external_wp_hooks_namespaceObject.hasFilter)("editor.Autocomplete.completers")) { if (filteredCompleters === completers) { filteredCompleters = filteredCompleters.map( (completer) => ({ ...completer }) ); } filteredCompleters = (0,external_wp_hooks_namespaceObject.applyFilters)( "editor.Autocomplete.completers", filteredCompleters, name ); } return filteredCompleters; }, [completers, name]); } function useBlockEditorAutocompleteProps(props) { return (0,external_wp_components_namespaceObject.__unstableUseAutocompleteProps)({ ...props, completers: useCompleters(props) }); } function BlockEditorAutocomplete(props) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Autocomplete, { ...props, completers: useCompleters(props) }); } var autocomplete_default = BlockEditorAutocomplete; ;// ./node_modules/@wordpress/icons/build-module/library/fullscreen.js var fullscreen_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 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-full-height-alignment-control/index.js function BlockFullHeightAlignmentControl({ isActive, label = (0,external_wp_i18n_namespaceObject.__)("Full height"), onToggle, isDisabled }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { isActive, icon: fullscreen_default, label, onClick: () => onToggle(!isActive), disabled: isDisabled } ); } var block_full_height_alignment_control_default = BlockFullHeightAlignmentControl; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-matrix-control/index.js const block_alignment_matrix_control_noop = () => { }; function BlockAlignmentMatrixControl(props) { const { label = (0,external_wp_i18n_namespaceObject.__)("Change matrix alignment"), onChange = block_alignment_matrix_control_noop, value = "center", isDisabled } = props; const icon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.AlignmentMatrixControl.Icon, { value }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps: { placement: "bottom-start" }, renderToggle: ({ onToggle, isOpen }) => { const openOnArrowDown = (event) => { if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { event.preventDefault(); onToggle(); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { onClick: onToggle, "aria-haspopup": "true", "aria-expanded": isOpen, onKeyDown: openOnArrowDown, label, icon, showTooltip: true, disabled: isDisabled } ); }, renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.AlignmentMatrixControl, { hasFocusBorder: false, onChange, value } ) } ); } var block_alignment_matrix_control_default = BlockAlignmentMatrixControl; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-title/use-block-display-title.js function useBlockDisplayTitle({ clientId, maximumLength, context }) { const blockTitle = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (!clientId) { return null; } const { getBlockName, getBlockAttributes } = select(store); const { getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const blockName = getBlockName(clientId); const blockType = getBlockType(blockName); if (!blockType) { return null; } const attributes = getBlockAttributes(clientId); const label = (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, attributes, context); if (label !== blockType.title) { return label; } const match = getActiveBlockVariation(blockName, attributes); return match?.title || blockType.title; }, [clientId, context] ); if (!blockTitle) { return null; } if (maximumLength && maximumLength > 0 && blockTitle.length > maximumLength) { const omission = "..."; return blockTitle.slice(0, maximumLength - omission.length) + omission; } return blockTitle; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-title/index.js function BlockTitle({ clientId, maximumLength, context }) { return useBlockDisplayTitle({ clientId, maximumLength, context }); } ;// ./node_modules/@wordpress/block-editor/build-module/utils/get-editor-region.js function getEditorRegion(editor) { if (!editor) { return null; } const editorCanvas = Array.from( document.querySelectorAll('iframe[name="editor-canvas"]').values() ).find((iframe) => { const iframeDocument = iframe.contentDocument || iframe.contentWindow.document; return iframeDocument === editor.ownerDocument; }) ?? editor; return editorCanvas?.closest('[role="region"]') ?? editorCanvas; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-breadcrumb/index.js function BlockBreadcrumb({ rootLabelText }) { const { selectBlock, clearSelectedBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { clientId, parents, hasSelection } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSelectionStart, getSelectedBlockClientId, getEnabledBlockParents } = unlock(select(store)); const selectedBlockClientId = getSelectedBlockClientId(); return { parents: getEnabledBlockParents(selectedBlockClientId), clientId: selectedBlockClientId, hasSelection: !!getSelectionStart().clientId }; }, []); const rootLabel = rootLabelText || (0,external_wp_i18n_namespaceObject.__)("Document"); const blockRef = (0,external_wp_element_namespaceObject.useRef)(); useBlockElementRef(clientId, blockRef); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "ul", { className: "block-editor-block-breadcrumb", role: "list", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Block breadcrumb"), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "li", { className: !hasSelection ? "block-editor-block-breadcrumb__current" : void 0, "aria-current": !hasSelection ? "true" : void 0, children: [ hasSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", className: "block-editor-block-breadcrumb__button", onClick: () => { const blockEditor = blockRef.current?.closest( ".editor-styles-wrapper" ); clearSelectedBlock(); getEditorRegion(blockEditor)?.focus(); }, children: rootLabel } ), !hasSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: rootLabel }), !!clientId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( icon_default, { icon: chevron_right_small_default, className: "block-editor-block-breadcrumb__separator" } ) ] } ), parents.map((parentClientId) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", className: "block-editor-block-breadcrumb__button", onClick: () => selectBlock(parentClientId), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockTitle, { clientId: parentClientId, maximumLength: 35 } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( icon_default, { icon: chevron_right_small_default, className: "block-editor-block-breadcrumb__separator" } ) ] }, parentClientId)), !!clientId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "li", { className: "block-editor-block-breadcrumb__current", "aria-current": "true", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTitle, { clientId, maximumLength: 35 }) } ) ] } ); } var block_breadcrumb_default = BlockBreadcrumb; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-content-overlay/index.js function useBlockOverlayActive(clientId) { return (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { __unstableHasActiveBlockOverlayActive } = select(store); return __unstableHasActiveBlockOverlayActive(clientId); }, [clientId] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-block-toolbar-popover-props.js const COMMON_PROPS = { placement: "top-start" }; const DEFAULT_PROPS = { ...COMMON_PROPS, flip: false, shift: true }; const RESTRICTED_HEIGHT_PROPS = { ...COMMON_PROPS, flip: true, shift: false }; function getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky) { if (!contentElement || !selectedBlockElement) { return DEFAULT_PROPS; } const scrollTop = scrollContainer?.scrollTop || 0; const blockRect = getElementBounds(selectedBlockElement); const contentRect = contentElement.getBoundingClientRect(); const topOfContentElementInViewport = scrollTop + contentRect.top; const viewportHeight = contentElement.ownerDocument.documentElement.clientHeight; const restrictedTopArea = topOfContentElementInViewport + toolbarHeight; const hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea; const isBlockTallerThanViewport = blockRect.height > viewportHeight - toolbarHeight; if (!isSticky && (hasSpaceForToolbarAbove || isBlockTallerThanViewport)) { return DEFAULT_PROPS; } return RESTRICTED_HEIGHT_PROPS; } function useBlockToolbarPopoverProps({ contentElement, clientId }) { const selectedBlockElement = useBlockElement(clientId); const [toolbarHeight, setToolbarHeight] = (0,external_wp_element_namespaceObject.useState)(0); const { blockIndex, isSticky } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockIndex, getBlockAttributes } = select(store); return { blockIndex: getBlockIndex(clientId), isSticky: hasStickyOrFixedPositionValue( getBlockAttributes(clientId) ) }; }, [clientId] ); const scrollContainer = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!contentElement) { return; } return (0,external_wp_dom_namespaceObject.getScrollContainer)(contentElement); }, [contentElement]); const [props, setProps] = (0,external_wp_element_namespaceObject.useState)( () => getProps( contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky ) ); const popoverRef = (0,external_wp_compose_namespaceObject.useRefEffect)((popoverNode) => { setToolbarHeight(popoverNode.offsetHeight); }, []); const updateProps = (0,external_wp_element_namespaceObject.useCallback)( () => setProps( getProps( contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky ) ), [contentElement, selectedBlockElement, scrollContainer, toolbarHeight] ); (0,external_wp_element_namespaceObject.useLayoutEffect)(updateProps, [blockIndex, updateProps]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!contentElement || !selectedBlockElement) { return; } const contentView = contentElement?.ownerDocument?.defaultView; contentView?.addEventHandler?.("resize", updateProps); let resizeObserver; const blockView = selectedBlockElement?.ownerDocument?.defaultView; if (blockView.ResizeObserver) { resizeObserver = new blockView.ResizeObserver(updateProps); resizeObserver.observe(selectedBlockElement); } return () => { contentView?.removeEventHandler?.("resize", updateProps); if (resizeObserver) { resizeObserver.disconnect(); } }; }, [updateProps, contentElement, selectedBlockElement]); return { ...props, ref: popoverRef }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-selected-block-tool-props.js function useSelectedBlockToolProps(clientId) { const selectedBlockProps = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockRootClientId, getBlockParents, __experimentalGetBlockListSettingsForBlocks, isBlockInsertionPointVisible, getBlockInsertionPoint, getBlockOrder, hasMultiSelection, getLastMultiSelectedBlockClientId } = select(store); const blockParentsClientIds = getBlockParents(clientId); const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks( blockParentsClientIds ); const capturingClientId = blockParentsClientIds.find( (parentClientId) => parentBlockListSettings[parentClientId]?.__experimentalCaptureToolbars ); let isInsertionPointVisible = false; if (isBlockInsertionPointVisible()) { const insertionPoint = getBlockInsertionPoint(); const order = getBlockOrder(insertionPoint.rootClientId); isInsertionPointVisible = order[insertionPoint.index] === clientId; } return { capturingClientId, isInsertionPointVisible, lastClientId: hasMultiSelection() ? getLastMultiSelectedBlockClientId() : null, rootClientId: getBlockRootClientId(clientId) }; }, [clientId] ); return selectedBlockProps; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/empty-block-inserter.js function EmptyBlockInserter({ clientId, __unstableContentRef }) { const { capturingClientId, isInsertionPointVisible, lastClientId, rootClientId } = useSelectedBlockToolProps(clientId); const popoverProps = useBlockToolbarPopoverProps({ contentElement: __unstableContentRef?.current, clientId }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( cover_default, { clientId: capturingClientId || clientId, bottomClientId: lastClientId, className: dist_clsx( "block-editor-block-list__block-side-inserter-popover", { "is-insertion-point-visible": isInsertionPointVisible } ), __unstableContentRef, ...popoverProps, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-list__empty-block-inserter", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inserter_default, { position: "bottom right", rootClientId, clientId, __experimentalIsQuick: true } ) }) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/use-scroll-when-dragging.js const SCROLL_INACTIVE_DISTANCE_PX = 50; const SCROLL_INTERVAL_MS = 25; const PIXELS_PER_SECOND_PER_PERCENTAGE = 1e3; const VELOCITY_MULTIPLIER = PIXELS_PER_SECOND_PER_PERCENTAGE * (SCROLL_INTERVAL_MS / 1e3); function useScrollWhenDragging() { const dragStartYRef = (0,external_wp_element_namespaceObject.useRef)(null); const velocityYRef = (0,external_wp_element_namespaceObject.useRef)(null); const scrollParentYRef = (0,external_wp_element_namespaceObject.useRef)(null); const scrollEditorIntervalRef = (0,external_wp_element_namespaceObject.useRef)(null); (0,external_wp_element_namespaceObject.useEffect)( () => () => { if (scrollEditorIntervalRef.current) { clearInterval(scrollEditorIntervalRef.current); scrollEditorIntervalRef.current = null; } }, [] ); const startScrolling = (0,external_wp_element_namespaceObject.useCallback)((event) => { dragStartYRef.current = event.clientY; scrollParentYRef.current = (0,external_wp_dom_namespaceObject.getScrollContainer)(event.target); scrollEditorIntervalRef.current = setInterval(() => { if (scrollParentYRef.current && velocityYRef.current) { const newTop = scrollParentYRef.current.scrollTop + velocityYRef.current; scrollParentYRef.current.scroll({ top: newTop }); } }, SCROLL_INTERVAL_MS); }, []); const scrollOnDragOver = (0,external_wp_element_namespaceObject.useCallback)((event) => { if (!scrollParentYRef.current) { return; } const scrollParentHeight = scrollParentYRef.current.offsetHeight; const offsetDragStartPosition = dragStartYRef.current - scrollParentYRef.current.offsetTop; const offsetDragPosition = event.clientY - scrollParentYRef.current.offsetTop; if (event.clientY > offsetDragStartPosition) { const moveableDistance = Math.max( scrollParentHeight - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0 ); const dragDistance = Math.max( offsetDragPosition - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0 ); const distancePercentage = moveableDistance === 0 || dragDistance === 0 ? 0 : dragDistance / moveableDistance; velocityYRef.current = VELOCITY_MULTIPLIER * distancePercentage; } else if (event.clientY < offsetDragStartPosition) { const moveableDistance = Math.max( offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0 ); const dragDistance = Math.max( offsetDragStartPosition - offsetDragPosition - SCROLL_INACTIVE_DISTANCE_PX, 0 ); const distancePercentage = moveableDistance === 0 || dragDistance === 0 ? 0 : dragDistance / moveableDistance; velocityYRef.current = -VELOCITY_MULTIPLIER * distancePercentage; } else { velocityYRef.current = 0; } }, []); const stopScrolling = () => { dragStartYRef.current = null; scrollParentYRef.current = null; if (scrollEditorIntervalRef.current) { clearInterval(scrollEditorIntervalRef.current); scrollEditorIntervalRef.current = null; } }; return [startScrolling, scrollOnDragOver, stopScrolling]; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/index.js const BlockDraggable = ({ appendToOwnerDocument, children, clientIds, cloneClassname, elementId, onDragStart, onDragEnd, fadeWhenDisabled = false, dragComponent }) => { const { srcRootClientId, isDraggable, icon, visibleInserter, getBlockType } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { canMoveBlocks, getBlockRootClientId: getBlockRootClientId2, getBlockName, getBlockAttributes, isBlockInsertionPointVisible } = select(store); const { getBlockType: _getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const rootClientId = getBlockRootClientId2(clientIds[0]); const blockName = getBlockName(clientIds[0]); const variation = getActiveBlockVariation( blockName, getBlockAttributes(clientIds[0]) ); return { srcRootClientId: rootClientId, isDraggable: canMoveBlocks(clientIds), icon: variation?.icon || _getBlockType(blockName)?.icon, visibleInserter: isBlockInsertionPointVisible(), getBlockType: _getBlockType }; }, [clientIds] ); const isDraggingRef = (0,external_wp_element_namespaceObject.useRef)(false); const [startScrolling, scrollOnDragOver, stopScrolling] = useScrollWhenDragging(); const { getAllowedBlocks, getBlockNamesByClientId, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { startDraggingBlocks, stopDraggingBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { return () => { if (isDraggingRef.current) { stopDraggingBlocks(); } }; }, []); const blockEl = useBlockElement(clientIds[0]); const editorRoot = blockEl?.closest("body"); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!editorRoot || !fadeWhenDisabled) { return; } const onDragOver = (event) => { if (!event.target.closest("[data-block]")) { return; } const draggedBlockNames = getBlockNamesByClientId(clientIds); const targetClientId = event.target.closest("[data-block]").getAttribute("data-block"); const allowedBlocks = getAllowedBlocks(targetClientId); const targetBlockName = getBlockNamesByClientId([ targetClientId ])[0]; let dropTargetValid; if (allowedBlocks?.length === 0) { const targetRootClientId = getBlockRootClientId(targetClientId); const targetRootBlockName = getBlockNamesByClientId([ targetRootClientId ])[0]; const rootAllowedBlocks = getAllowedBlocks(targetRootClientId); dropTargetValid = isDropTargetValid( getBlockType, rootAllowedBlocks, draggedBlockNames, targetRootBlockName ); } else { dropTargetValid = isDropTargetValid( getBlockType, allowedBlocks, draggedBlockNames, targetBlockName ); } if (!dropTargetValid && !visibleInserter) { window?.document?.body?.classList?.add( "block-draggable-invalid-drag-token" ); } else { window?.document?.body?.classList?.remove( "block-draggable-invalid-drag-token" ); } }; const throttledOnDragOver = (0,external_wp_compose_namespaceObject.throttle)(onDragOver, 200); editorRoot.addEventListener("dragover", throttledOnDragOver); return () => { editorRoot.removeEventListener("dragover", throttledOnDragOver); }; }, [ clientIds, editorRoot, fadeWhenDisabled, getAllowedBlocks, getBlockNamesByClientId, getBlockRootClientId, getBlockType, visibleInserter ]); if (!isDraggable) { return children({ draggable: false }); } const transferData = { type: "block", srcClientIds: clientIds, srcRootClientId }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Draggable, { appendToOwnerDocument, cloneClassname, __experimentalTransferDataType: "wp-blocks", transferData, onDragStart: (event) => { window.requestAnimationFrame(() => { startDraggingBlocks(clientIds); isDraggingRef.current = true; startScrolling(event); if (onDragStart) { onDragStart(); } }); }, onDragOver: scrollOnDragOver, onDragEnd: () => { stopDraggingBlocks(); isDraggingRef.current = false; stopScrolling(); if (onDragEnd) { onDragEnd(); } }, __experimentalDragComponent: ( // Check against `undefined` so that `null` can be used to disable // the default drag component. dragComponent !== void 0 ? dragComponent : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockDraggableChip, { count: clientIds.length, icon, fadeWhenDisabled: true } ) ), elementId, children: ({ onDraggableStart, onDraggableEnd }) => { return children({ draggable: true, onDragStart: onDraggableStart, onDragEnd: onDraggableEnd }); } } ); }; var block_draggable_default = BlockDraggable; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-mover/mover-description.js const getMovementDirection = (moveDirection, orientation) => { if (moveDirection === "up") { if (orientation === "horizontal") { return (0,external_wp_i18n_namespaceObject.isRTL)() ? "right" : "left"; } return "up"; } else if (moveDirection === "down") { if (orientation === "horizontal") { return (0,external_wp_i18n_namespaceObject.isRTL)() ? "left" : "right"; } return "down"; } return null; }; function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLast, dir, orientation) { const position = firstIndex + 1; if (selectedCount > 1) { return getMultiBlockMoverDescription( selectedCount, firstIndex, isFirst, isLast, dir, orientation ); } if (isFirst && isLast) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Type of block (i.e. Text, Image etc) (0,external_wp_i18n_namespaceObject.__)("Block %s is the only block, and cannot be moved"), type ); } if (dir > 0 && !isLast) { const movementDirection = getMovementDirection("down", orientation); if (movementDirection === "down") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position (0,external_wp_i18n_namespaceObject.__)( "Move %1$s block from position %2$d down to position %3$d" ), type, position, position + 1 ); } if (movementDirection === "left") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position (0,external_wp_i18n_namespaceObject.__)( "Move %1$s block from position %2$d left to position %3$d" ), type, position, position + 1 ); } if (movementDirection === "right") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position (0,external_wp_i18n_namespaceObject.__)( "Move %1$s block from position %2$d right to position %3$d" ), type, position, position + 1 ); } } if (dir > 0 && isLast) { const movementDirection = getMovementDirection("down", orientation); if (movementDirection === "down") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) (0,external_wp_i18n_namespaceObject.__)( "Block %1$s is at the end of the content and can\u2019t be moved down" ), type ); } if (movementDirection === "left") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) (0,external_wp_i18n_namespaceObject.__)( "Block %1$s is at the end of the content and can\u2019t be moved left" ), type ); } if (movementDirection === "right") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) (0,external_wp_i18n_namespaceObject.__)( "Block %1$s is at the end of the content and can\u2019t be moved right" ), type ); } } if (dir < 0 && !isFirst) { const movementDirection = getMovementDirection("up", orientation); if (movementDirection === "up") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position (0,external_wp_i18n_namespaceObject.__)("Move %1$s block from position %2$d up to position %3$d"), type, position, position - 1 ); } if (movementDirection === "left") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position (0,external_wp_i18n_namespaceObject.__)( "Move %1$s block from position %2$d left to position %3$d" ), type, position, position - 1 ); } if (movementDirection === "right") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position (0,external_wp_i18n_namespaceObject.__)( "Move %1$s block from position %2$d right to position %3$d" ), type, position, position - 1 ); } } if (dir < 0 && isFirst) { const movementDirection = getMovementDirection("up", orientation); if (movementDirection === "up") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) (0,external_wp_i18n_namespaceObject.__)( "Block %1$s is at the beginning of the content and can\u2019t be moved up" ), type ); } if (movementDirection === "left") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) (0,external_wp_i18n_namespaceObject.__)( "Block %1$s is at the beginning of the content and can\u2019t be moved left" ), type ); } if (movementDirection === "right") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc) (0,external_wp_i18n_namespaceObject.__)( "Block %1$s is at the beginning of the content and can\u2019t be moved right" ), type ); } } } function getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir, orientation) { const position = firstIndex + 1; if (isFirst && isLast) { return (0,external_wp_i18n_namespaceObject.__)("All blocks are selected, and cannot be moved"); } if (dir > 0 && !isLast) { const movementDirection = getMovementDirection("down", orientation); if (movementDirection === "down") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d down by one place"), selectedCount, position ); } if (movementDirection === "left") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d left by one place"), selectedCount, position ); } if (movementDirection === "right") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d right by one place"), selectedCount, position ); } } if (dir > 0 && isLast) { const movementDirection = getMovementDirection("down", orientation); if (movementDirection === "down") { return (0,external_wp_i18n_namespaceObject.__)( "Blocks cannot be moved down as they are already at the bottom" ); } if (movementDirection === "left") { return (0,external_wp_i18n_namespaceObject.__)( "Blocks cannot be moved left as they are already are at the leftmost position" ); } if (movementDirection === "right") { return (0,external_wp_i18n_namespaceObject.__)( "Blocks cannot be moved right as they are already are at the rightmost position" ); } } if (dir < 0 && !isFirst) { const movementDirection = getMovementDirection("up", orientation); if (movementDirection === "up") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d up by one place"), selectedCount, position ); } if (movementDirection === "left") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d left by one place"), selectedCount, position ); } if (movementDirection === "right") { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d right by one place"), selectedCount, position ); } } if (dir < 0 && isFirst) { const movementDirection = getMovementDirection("up", orientation); if (movementDirection === "up") { return (0,external_wp_i18n_namespaceObject.__)( "Blocks cannot be moved up as they are already at the top" ); } if (movementDirection === "left") { return (0,external_wp_i18n_namespaceObject.__)( "Blocks cannot be moved left as they are already are at the leftmost position" ); } if (movementDirection === "right") { return (0,external_wp_i18n_namespaceObject.__)( "Blocks cannot be moved right as they are already are at the rightmost position" ); } } } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-mover/button.js const getArrowIcon = (direction, orientation) => { if (direction === "up") { if (orientation === "horizontal") { return (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default; } return chevron_up_default; } else if (direction === "down") { if (orientation === "horizontal") { return (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default; } return chevron_down_default; } return null; }; const getMovementDirectionLabel = (moveDirection, orientation) => { if (moveDirection === "up") { if (orientation === "horizontal") { return (0,external_wp_i18n_namespaceObject.isRTL)() ? (0,external_wp_i18n_namespaceObject.__)("Move right") : (0,external_wp_i18n_namespaceObject.__)("Move left"); } return (0,external_wp_i18n_namespaceObject.__)("Move up"); } else if (moveDirection === "down") { if (orientation === "horizontal") { return (0,external_wp_i18n_namespaceObject.isRTL)() ? (0,external_wp_i18n_namespaceObject.__)("Move left") : (0,external_wp_i18n_namespaceObject.__)("Move right"); } return (0,external_wp_i18n_namespaceObject.__)("Move down"); } return null; }; const BlockMoverButton = (0,external_wp_element_namespaceObject.forwardRef)( ({ clientIds, direction, orientation: moverOrientation, ...props }, ref) => { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockMoverButton); const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds]; const blocksCount = normalizedClientIds.length; const { disabled } = props; const { blockType, isDisabled, rootClientId, isFirst, isLast, firstIndex, orientation = "vertical" } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockIndex, getBlockRootClientId, getBlockOrder, getBlock, getBlockListSettings } = select(store); const firstClientId = normalizedClientIds[0]; const blockRootClientId = getBlockRootClientId(firstClientId); const firstBlockIndex = getBlockIndex(firstClientId); const lastBlockIndex = getBlockIndex( normalizedClientIds[normalizedClientIds.length - 1] ); const blockOrder = getBlockOrder(blockRootClientId); const block = getBlock(firstClientId); const isFirstBlock = firstBlockIndex === 0; const isLastBlock = lastBlockIndex === blockOrder.length - 1; const { orientation: blockListOrientation } = getBlockListSettings(blockRootClientId) || {}; return { blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null, isDisabled: disabled || (direction === "up" ? isFirstBlock : isLastBlock), rootClientId: blockRootClientId, firstIndex: firstBlockIndex, isFirst: isFirstBlock, isLast: isLastBlock, orientation: moverOrientation || blockListOrientation }; }, [clientIds, direction] ); const { moveBlocksDown, moveBlocksUp } = (0,external_wp_data_namespaceObject.useDispatch)(store); const moverFunction = direction === "up" ? moveBlocksUp : moveBlocksDown; const onClick = (event) => { moverFunction(clientIds, rootClientId); if (props.onClick) { props.onClick(event); } }; const descriptionId = `block-editor-block-mover-button__description-${instanceId}`; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ref, className: dist_clsx( "block-editor-block-mover-button", `is-${direction}-button` ), icon: getArrowIcon(direction, orientation), label: getMovementDirectionLabel( direction, orientation ), "aria-describedby": descriptionId, ...props, onClick: isDisabled ? null : onClick, disabled: isDisabled, accessibleWhenDisabled: true } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: getBlockMoverDescription( blocksCount, blockType && blockType.title, firstIndex, isFirst, isLast, direction === "up" ? -1 : 1, orientation ) }) ] }); } ); const BlockMoverUpButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverButton, { direction: "up", ref, ...props }); }); const BlockMoverDownButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverButton, { direction: "down", ref, ...props }); }); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-mover/index.js function BlockMover({ clientIds, hideDragHandle, isBlockMoverUpButtonDisabled, isBlockMoverDownButtonDisabled }) { const { canMove, rootClientId, isFirst, isLast, orientation, isManualGrid } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockIndex, getBlockListSettings, canMoveBlocks, getBlockOrder, getBlockRootClientId, getBlockAttributes } = select(store); const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds]; const firstClientId = normalizedClientIds[0]; const _rootClientId = getBlockRootClientId(firstClientId); const firstIndex = getBlockIndex(firstClientId); const lastIndex = getBlockIndex( normalizedClientIds[normalizedClientIds.length - 1] ); const blockOrder = getBlockOrder(_rootClientId); const { layout = {} } = getBlockAttributes(_rootClientId) ?? {}; return { canMove: canMoveBlocks(clientIds), rootClientId: _rootClientId, isFirst: firstIndex === 0, isLast: lastIndex === blockOrder.length - 1, orientation: getBlockListSettings(_rootClientId)?.orientation, isManualGrid: layout.type === "grid" && layout.isManualPlacement && window.__experimentalEnableGridInteractivity }; }, [clientIds] ); if (!canMove || isFirst && isLast && !rootClientId || hideDragHandle && isManualGrid) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.ToolbarGroup, { className: dist_clsx("block-editor-block-mover", { "is-horizontal": orientation === "horizontal" }), children: [ !hideDragHandle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_draggable_default, { clientIds, fadeWhenDisabled: true, children: (draggableProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, icon: drag_handle_default, className: "block-editor-block-mover__drag-handle", label: (0,external_wp_i18n_namespaceObject.__)("Drag"), tabIndex: "-1", ...draggableProps } ) }), !isManualGrid && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-mover__move-button-container", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (itemProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockMoverUpButton, { disabled: isBlockMoverUpButtonDisabled, clientIds, ...itemProps } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (itemProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockMoverDownButton, { disabled: isBlockMoverDownButtonDisabled, clientIds, ...itemProps } ) }) ] }) ] } ); } var block_mover_default = BlockMover; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/utils.js const { clearTimeout: utils_clearTimeout, setTimeout: utils_setTimeout } = window; const DEBOUNCE_TIMEOUT = 200; function useDebouncedShowGestures({ ref, isFocused, highlightParent, debounceTimeout = DEBOUNCE_TIMEOUT }) { const { getSelectedBlockClientId, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { toggleBlockHighlight } = (0,external_wp_data_namespaceObject.useDispatch)(store); const timeoutRef = (0,external_wp_element_namespaceObject.useRef)(); const isDistractionFree = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).getSettings().isDistractionFree, [] ); const handleOnChange = (nextIsFocused) => { if (nextIsFocused && isDistractionFree) { return; } const selectedBlockClientId = getSelectedBlockClientId(); const clientId = highlightParent ? getBlockRootClientId(selectedBlockClientId) : selectedBlockClientId; toggleBlockHighlight(clientId, nextIsFocused); }; const getIsHovered = () => { return ref?.current && ref.current.matches(":hover"); }; const shouldHideGestures = () => { const isHovered = getIsHovered(); return !isFocused && !isHovered; }; const clearTimeoutRef = () => { const timeout = timeoutRef.current; if (timeout && utils_clearTimeout) { utils_clearTimeout(timeout); } }; const debouncedShowGestures = (event) => { if (event) { event.stopPropagation(); } clearTimeoutRef(); handleOnChange(true); }; const debouncedHideGestures = (event) => { if (event) { event.stopPropagation(); } clearTimeoutRef(); timeoutRef.current = utils_setTimeout(() => { if (shouldHideGestures()) { handleOnChange(false); } }, debounceTimeout); }; (0,external_wp_element_namespaceObject.useEffect)( () => () => { handleOnChange(false); clearTimeoutRef(); }, [] ); return { debouncedShowGestures, debouncedHideGestures }; } function useShowHoveredOrFocusedGestures({ ref, highlightParent = false, debounceTimeout = DEBOUNCE_TIMEOUT }) { const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); const { debouncedShowGestures, debouncedHideGestures } = useDebouncedShowGestures({ ref, debounceTimeout, isFocused, highlightParent }); const registerRef = (0,external_wp_element_namespaceObject.useRef)(false); const isFocusedWithin = () => { return ref?.current && ref.current.contains(ref.current.ownerDocument.activeElement); }; (0,external_wp_element_namespaceObject.useEffect)(() => { const node = ref.current; const handleOnFocus = () => { if (isFocusedWithin()) { setIsFocused(true); debouncedShowGestures(); } }; const handleOnBlur = () => { if (!isFocusedWithin()) { setIsFocused(false); debouncedHideGestures(); } }; if (node && !registerRef.current) { node.addEventListener("focus", handleOnFocus, true); node.addEventListener("blur", handleOnBlur, true); registerRef.current = true; } return () => { if (node) { node.removeEventListener("focus", handleOnFocus); node.removeEventListener("blur", handleOnBlur); } }; }, [ ref, registerRef, setIsFocused, debouncedShowGestures, debouncedHideGestures ]); return { onMouseMove: debouncedShowGestures, onMouseLeave: debouncedHideGestures }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-parent-selector/index.js function BlockParentSelector() { const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { parentClientId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getBlockParents, getSelectedBlockClientId, getParentSectionBlock } = unlock(select(store)); const selectedBlockClientId = getSelectedBlockClientId(); const parentSection = getParentSectionBlock(selectedBlockClientId); const parents = getBlockParents(selectedBlockClientId); const _parentClientId = parentSection ?? parents[parents.length - 1]; return { parentClientId: _parentClientId }; }, []); const blockInformation = useBlockDisplayInformation(parentClientId); const nodeRef = (0,external_wp_element_namespaceObject.useRef)(); const showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures({ ref: nodeRef, highlightParent: true }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "block-editor-block-parent-selector", ref: nodeRef, ...showHoveredOrFocusedGestures, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { className: "block-editor-block-parent-selector__button", onClick: () => selectBlock(parentClientId), label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block's parent. */ (0,external_wp_i18n_namespaceObject.__)("Select parent block: %s"), blockInformation?.title ), showTooltip: true, icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: blockInformation?.icon }) } ) }, parentClientId ); } ;// ./node_modules/@wordpress/icons/build-module/library/copy.js var copy_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, { fillRule: "evenodd", clipRule: "evenodd", d: "M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z" } ) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/preview-block-popover.js function PreviewBlockPopover({ blocks }) { const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); if (isMobile) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__popover-preview-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Popover, { className: "block-editor-block-switcher__popover-preview", placement: "right-start", focusOnMount: false, offset: 16, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-switcher__preview", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__preview-title", children: (0,external_wp_i18n_namespaceObject.__)("Preview") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_default, { viewportWidth: 601, blocks }) ] }) } ) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-variation-transformations.js const block_variation_transformations_EMPTY_OBJECT = {}; function useBlockVariationTransforms({ clientIds, blocks }) { const { activeBlockVariation, blockVariationTransformations } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockAttributes, canRemoveBlocks } = select(store); const { getActiveBlockVariation, getBlockVariations } = select(external_wp_blocks_namespaceObject.store); const canRemove = canRemoveBlocks(clientIds); if (blocks.length !== 1 || !canRemove) { return block_variation_transformations_EMPTY_OBJECT; } const [firstBlock] = blocks; return { blockVariationTransformations: getBlockVariations( firstBlock.name, "transform" ), activeBlockVariation: getActiveBlockVariation( firstBlock.name, getBlockAttributes(firstBlock.clientId) ) }; }, [clientIds, blocks] ); const transformations = (0,external_wp_element_namespaceObject.useMemo)(() => { return blockVariationTransformations?.filter( ({ name }) => name !== activeBlockVariation?.name ); }, [blockVariationTransformations, activeBlockVariation]); return transformations; } const BlockVariationTransformations = ({ transformations, onSelect, blocks }) => { const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ hoveredTransformItemName && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreviewBlockPopover, { blocks: (0,external_wp_blocks_namespaceObject.cloneBlock)( blocks[0], transformations.find( ({ name }) => name === hoveredTransformItemName ).attributes ) } ), transformations?.map((item) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockVariationTransformationItem, { item, onSelect, setHoveredTransformItemName }, item.name )) ] }); }; function BlockVariationTransformationItem({ item, onSelect, setHoveredTransformItemName }) { const { name, icon, title } = item; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.MenuItem, { className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name), onClick: (event) => { event.preventDefault(); onSelect(name); }, onMouseLeave: () => setHoveredTransformItemName(null), onMouseEnter: () => setHoveredTransformItemName(name), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon, showColors: true }), title ] } ); } var block_variation_transformations_default = BlockVariationTransformations; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-transformations-menu.js function useGroupedTransforms(possibleBlockTransformations) { const priorityContentTransformationBlocks = { "core/paragraph": 1, "core/heading": 2, "core/list": 3, "core/quote": 4 }; const transformations = (0,external_wp_element_namespaceObject.useMemo)(() => { const priorityTextTransformsNames = Object.keys( priorityContentTransformationBlocks ); const groupedPossibleTransforms = possibleBlockTransformations.reduce( (accumulator, item) => { const { name } = item; if (priorityTextTransformsNames.includes(name)) { accumulator.priorityTextTransformations.push(item); } else { accumulator.restTransformations.push(item); } return accumulator; }, { priorityTextTransformations: [], restTransformations: [] } ); if (groupedPossibleTransforms.priorityTextTransformations.length === 1 && groupedPossibleTransforms.priorityTextTransformations[0].name === "core/quote") { const singleQuote = groupedPossibleTransforms.priorityTextTransformations.pop(); groupedPossibleTransforms.restTransformations.push(singleQuote); } return groupedPossibleTransforms; }, [possibleBlockTransformations]); transformations.priorityTextTransformations.sort( ({ name: currentName }, { name: nextName }) => { return priorityContentTransformationBlocks[currentName] < priorityContentTransformationBlocks[nextName] ? -1 : 1; } ); return transformations; } const BlockTransformationsMenu = ({ className, possibleBlockTransformations, possibleBlockVariationTransformations, onSelect, onSelectVariation, blocks }) => { const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)(); const { priorityTextTransformations, restTransformations } = useGroupedTransforms(possibleBlockTransformations); const hasBothContentTransformations = priorityTextTransformations.length && restTransformations.length; const restTransformItems = !!restTransformations.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( RestTransformationItems, { restTransformations, onSelect, setHoveredTransformItemName } ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Transform to"), className, children: [ hoveredTransformItemName && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreviewBlockPopover, { blocks: (0,external_wp_blocks_namespaceObject.switchToBlockType)( blocks, hoveredTransformItemName ) } ), !!possibleBlockVariationTransformations?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_variation_transformations_default, { transformations: possibleBlockVariationTransformations, blocks, onSelect: onSelectVariation } ), priorityTextTransformations.map((item) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockTransformationItem, { item, onSelect, setHoveredTransformItemName }, item.name )), !hasBothContentTransformations && restTransformItems ] }), !!hasBothContentTransformations && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { className, children: restTransformItems }) ] }); }; function RestTransformationItems({ restTransformations, onSelect, setHoveredTransformItemName }) { return restTransformations.map((item) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockTransformationItem, { item, onSelect, setHoveredTransformItemName }, item.name )); } function BlockTransformationItem({ item, onSelect, setHoveredTransformItemName }) { const { name, icon, title, isDisabled } = item; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.MenuItem, { className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name), onClick: (event) => { event.preventDefault(); onSelect(name); }, disabled: isDisabled, onMouseLeave: () => setHoveredTransformItemName(null), onMouseEnter: () => setHoveredTransformItemName(name), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon, showColors: true }), title ] } ); } var block_transformations_menu_default = BlockTransformationsMenu; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/utils.js function getActiveStyle(styles, className) { for (const style of new (external_wp_tokenList_default())(className).values()) { if (style.indexOf("is-style-") === -1) { continue; } const potentialStyleName = style.substring(9); const activeStyle = styles?.find( ({ name }) => name === potentialStyleName ); if (activeStyle) { return activeStyle; } } return getDefaultStyle(styles); } function replaceActiveStyle(className, activeStyle, newStyle) { const list = new (external_wp_tokenList_default())(className); if (activeStyle) { list.remove("is-style-" + activeStyle.name); } list.add("is-style-" + newStyle.name); return list.value; } function getRenderedStyles(styles) { if (!styles || styles.length === 0) { return []; } return getDefaultStyle(styles) ? styles : [ { name: "default", label: (0,external_wp_i18n_namespaceObject._x)("Default", "block style"), isDefault: true }, ...styles ]; } function getDefaultStyle(styles) { return styles?.find((style) => style.isDefault); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/use-styles-for-block.js function useGenericPreviewBlock(block, type) { return (0,external_wp_element_namespaceObject.useMemo)(() => { const example = type?.example; const blockName = type?.name; if (example && blockName) { return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockName, { attributes: example.attributes, innerBlocks: example.innerBlocks }); } if (block) { return (0,external_wp_blocks_namespaceObject.cloneBlock)(block); } }, [type?.example ? block?.name : block, type]); } function useStylesForBlocks({ clientId, onSwitch }) { const selector = (select) => { const { getBlock } = select(store); const block2 = getBlock(clientId); if (!block2) { return {}; } const blockType2 = (0,external_wp_blocks_namespaceObject.getBlockType)(block2.name); const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store); return { block: block2, blockType: blockType2, styles: getBlockStyles(block2.name), className: block2.attributes.className || "" }; }; const { styles, block, blockType, className } = (0,external_wp_data_namespaceObject.useSelect)(selector, [ clientId ]); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const stylesToRender = getRenderedStyles(styles); const activeStyle = getActiveStyle(stylesToRender, className); const genericPreviewBlock = useGenericPreviewBlock(block, blockType); const onSelect = (style) => { const styleClassName = replaceActiveStyle( className, activeStyle, style ); updateBlockAttributes(clientId, { className: styleClassName }); onSwitch(); }; return { onSelect, stylesToRender, activeStyle, genericPreviewBlock, className }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/menu-items.js const menu_items_noop = () => { }; function BlockStylesMenuItems({ clientId, onSwitch = menu_items_noop }) { const { onSelect, stylesToRender, activeStyle } = useStylesForBlocks({ clientId, onSwitch }); if (!stylesToRender || stylesToRender.length === 0) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: stylesToRender.map((style) => { const menuItemText = style.label || style.name; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: activeStyle.name === style.name ? check_check_default : null, onClick: () => onSelect(style), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalText, { as: "span", limit: 18, ellipsizeMode: "tail", truncate: true, children: menuItemText } ) }, style.name ); }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-styles-menu.js function BlockStylesMenu({ hoveredBlock, onSwitch }) { const { clientId } = hoveredBlock; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Styles"), className: "block-editor-block-switcher__styles__menugroup", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesMenuItems, { clientId, onSwitch }) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/utils.js const getMatchingBlockByName = (block, selectedBlockName, consumedBlocks = /* @__PURE__ */ new Set()) => { const { clientId, name, innerBlocks = [] } = block; if (consumedBlocks.has(clientId)) { return; } if (name === selectedBlockName) { return block; } for (const innerBlock of innerBlocks) { const match = getMatchingBlockByName( innerBlock, selectedBlockName, consumedBlocks ); if (match) { return match; } } }; const getRetainedBlockAttributes = (name, attributes) => { const contentAttributes = (0,external_wp_blocks_namespaceObject.getBlockAttributesNamesByRole)(name, "content"); if (!contentAttributes?.length) { return attributes; } return contentAttributes.reduce((_accumulator, attribute) => { if (attributes[attribute]) { _accumulator[attribute] = attributes[attribute]; } return _accumulator; }, {}); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/use-transformed-patterns.js const transformMatchingBlock = (match, selectedBlock) => { const retainedBlockAttributes = getRetainedBlockAttributes( selectedBlock.name, selectedBlock.attributes ); match.attributes = { ...match.attributes, ...retainedBlockAttributes }; }; const getPatternTransformedBlocks = (selectedBlocks, patternBlocks) => { const _patternBlocks = patternBlocks.map( (block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block) ); const consumedBlocks = /* @__PURE__ */ new Set(); for (const selectedBlock of selectedBlocks) { let isMatch = false; for (const patternBlock of _patternBlocks) { const match = getMatchingBlockByName( patternBlock, selectedBlock.name, consumedBlocks ); if (!match) { continue; } isMatch = true; consumedBlocks.add(match.clientId); transformMatchingBlock(match, selectedBlock); break; } if (!isMatch) { return; } } return _patternBlocks; }; const useTransformedPatterns = (patterns, selectedBlocks) => { return (0,external_wp_element_namespaceObject.useMemo)( () => patterns.reduce((accumulator, _pattern) => { const transformedBlocks = getPatternTransformedBlocks( selectedBlocks, _pattern.blocks ); if (transformedBlocks) { accumulator.push({ ..._pattern, transformedBlocks }); } return accumulator; }, []), [patterns, selectedBlocks] ); }; var use_transformed_patterns_default = useTransformedPatterns; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/pattern-transformations-menu.js function PatternTransformationsMenu({ blocks, patterns: statePatterns, onSelect }) { const [showTransforms, setShowTransforms] = (0,external_wp_element_namespaceObject.useState)(false); const patterns = use_transformed_patterns_default(statePatterns, blocks); if (!patterns.length) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { className: "block-editor-block-switcher__pattern__transforms__menugroup", children: [ showTransforms && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreviewPatternsPopover, { patterns, onSelect } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: (event) => { event.preventDefault(); setShowTransforms(!showTransforms); }, icon: chevron_right_default, children: (0,external_wp_i18n_namespaceObject.__)("Patterns") } ) ] }); } function PreviewPatternsPopover({ patterns, onSelect }) { const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__popover-preview-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Popover, { className: "block-editor-block-switcher__popover-preview", placement: isMobile ? "bottom" : "right-start", offset: 16, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__preview is-pattern-list-preview", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( pattern_transformations_menu_BlockPatternsList, { patterns, onSelect } ) }) } ) }); } function pattern_transformations_menu_BlockPatternsList({ patterns, onSelect }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite, { role: "listbox", className: "block-editor-block-switcher__preview-patterns-container", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Patterns list"), children: patterns.map((pattern) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( pattern_transformations_menu_BlockPattern, { pattern, onSelect }, pattern.name )) } ); } function pattern_transformations_menu_BlockPattern({ pattern, onSelect }) { const baseClassName = "block-editor-block-switcher__preview-patterns-container"; const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)( pattern_transformations_menu_BlockPattern, `${baseClassName}-list__item-description` ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: `${baseClassName}-list__list-item`, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Composite.Item, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { role: "option", "aria-label": pattern.title, "aria-describedby": pattern.description ? descriptionId : void 0, className: `${baseClassName}-list__item` } ), onClick: () => onSelect(pattern.transformedBlocks), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_preview_default, { blocks: pattern.transformedBlocks, viewportWidth: pattern.viewportWidth || 500 } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseClassName}-list__item-title`, children: pattern.title }) ] } ), !!pattern.description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: pattern.description }) ] }); } var pattern_transformations_menu_default = PatternTransformationsMenu; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/index.js function BlockSwitcherDropdownMenuContents({ onClose, clientIds, hasBlockStyles, canRemove }) { const { replaceBlocks, multiSelect, updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { possibleBlockTransformations, patterns, blocks, isUsingBindings } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockAttributes, getBlocksByClientId, getBlockRootClientId, getBlockTransformItems, __experimentalGetPatternTransformItems } = select(store); const rootClientId = getBlockRootClientId(clientIds[0]); const _blocks = getBlocksByClientId(clientIds); return { blocks: _blocks, possibleBlockTransformations: getBlockTransformItems( _blocks, rootClientId ), patterns: __experimentalGetPatternTransformItems( _blocks, rootClientId ), isUsingBindings: clientIds.every( (clientId) => !!getBlockAttributes(clientId)?.metadata?.bindings ) }; }, [clientIds] ); const blockVariationTransformations = useBlockVariationTransforms({ clientIds, blocks }); function selectForMultipleBlocks(insertedBlocks) { if (insertedBlocks.length > 1) { multiSelect( insertedBlocks[0].clientId, insertedBlocks[insertedBlocks.length - 1].clientId ); } } function onBlockTransform(name) { const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, name); replaceBlocks(clientIds, newBlocks); selectForMultipleBlocks(newBlocks); } function onBlockVariationTransform(name) { updateBlockAttributes(blocks[0].clientId, { ...blockVariationTransformations.find( ({ name: variationName }) => variationName === name ).attributes }); } function onPatternTransform(transformedBlocks) { replaceBlocks(clientIds, transformedBlocks); selectForMultipleBlocks(transformedBlocks); } const isSingleBlock = blocks.length === 1; const isSynced = isSingleBlock && ((0,external_wp_blocks_namespaceObject.isTemplatePart)(blocks[0]) || (0,external_wp_blocks_namespaceObject.isReusableBlock)(blocks[0])); const hasPossibleBlockTransformations = !!possibleBlockTransformations?.length && canRemove && !isSynced; const hasPossibleBlockVariationTransformations = !!blockVariationTransformations?.length; const hasPatternTransformation = !!patterns?.length && canRemove; const hasBlockOrBlockVariationTransforms = hasPossibleBlockTransformations || hasPossibleBlockVariationTransformations; const hasContents = hasBlockStyles || hasBlockOrBlockVariationTransforms || hasPatternTransformation; if (!hasContents) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-block-switcher__no-transforms", children: (0,external_wp_i18n_namespaceObject.__)("No transforms.") }); } const connectedBlockDescription = isSingleBlock ? (0,external_wp_i18n_namespaceObject._x)( "This block is connected.", "block toolbar button label and description" ) : (0,external_wp_i18n_namespaceObject._x)( "These blocks are connected.", "block toolbar button label and description" ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-switcher__container", children: [ hasPatternTransformation && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( pattern_transformations_menu_default, { blocks, patterns, onSelect: (transformedBlocks) => { onPatternTransform(transformedBlocks); onClose(); } } ), hasBlockOrBlockVariationTransforms && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_transformations_menu_default, { className: "block-editor-block-switcher__transforms__menugroup", possibleBlockTransformations, possibleBlockVariationTransformations: blockVariationTransformations, blocks, onSelect: (name) => { onBlockTransform(name); onClose(); }, onSelectVariation: (name) => { onBlockVariationTransform(name); onClose(); } } ), hasBlockStyles && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockStylesMenu, { hoveredBlock: blocks[0], onSwitch: onClose } ), isUsingBindings && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "block-editor-block-switcher__binding-indicator", children: connectedBlockDescription }) }) ] }); } const BlockSwitcher = ({ clientIds }) => { const { hasContentOnlyLocking, canRemove, hasBlockStyles, icon, invalidBlocks, isReusable, isTemplate, isDisabled, isSectionInSelection } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getTemplateLock, getBlocksByClientId, getBlockAttributes, canRemoveBlocks, getBlockEditingMode, isSectionBlock } = unlock(select(store)); const { getBlockStyles, getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const _blocks = getBlocksByClientId(clientIds); if (!_blocks.length || _blocks.some((block) => !block)) { return { invalidBlocks: true }; } const [{ name: firstBlockName }] = _blocks; const _isSingleBlockSelected = _blocks.length === 1; const blockType = getBlockType(firstBlockName); const editingMode = getBlockEditingMode(clientIds[0]); let _icon; let _hasTemplateLock; if (_isSingleBlockSelected) { const match = getActiveBlockVariation( firstBlockName, getBlockAttributes(clientIds[0]) ); _icon = match?.icon || blockType.icon; _hasTemplateLock = getTemplateLock(clientIds[0]) === "contentOnly"; } else { const isSelectionOfSameType = new Set(_blocks.map(({ name }) => name)).size === 1; _hasTemplateLock = clientIds.some( (id) => getTemplateLock(id) === "contentOnly" ); _icon = isSelectionOfSameType ? blockType.icon : copy_default; } const _isSectionInSelection = clientIds.some( (id) => isSectionBlock(id) ); return { canRemove: canRemoveBlocks(clientIds), hasBlockStyles: _isSingleBlockSelected && !!getBlockStyles(firstBlockName)?.length, icon: _icon, isReusable: _isSingleBlockSelected && (0,external_wp_blocks_namespaceObject.isReusableBlock)(_blocks[0]), isTemplate: _isSingleBlockSelected && (0,external_wp_blocks_namespaceObject.isTemplatePart)(_blocks[0]), hasContentOnlyLocking: _hasTemplateLock, isDisabled: editingMode !== "default", isSectionInSelection: _isSectionInSelection }; }, [clientIds] ); const blockTitle = useBlockDisplayTitle({ clientId: clientIds?.[0], maximumLength: 35 }); const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_preferences_namespaceObject.store).get("core", "showIconLabels"), [] ); if (invalidBlocks) { return null; } const isSingleBlock = clientIds.length === 1; const blockSwitcherLabel = isSingleBlock ? blockTitle : (0,external_wp_i18n_namespaceObject.__)("Multiple blocks selected"); const blockIndicatorText = (isReusable || isTemplate) && !showIconLabels && blockTitle ? blockTitle : void 0; const hideTransformsForSections = window?.__experimentalContentOnlyPatternInsertion && isSectionInSelection; const hideDropdown = hideTransformsForSections || isDisabled || !hasBlockStyles && !canRemove || hasContentOnlyLocking; if (hideDropdown) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { disabled: true, className: "block-editor-block-switcher__no-switcher-icon", title: blockSwitcherLabel, icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_icon_default, { className: "block-editor-block-switcher__toggle", icon, showColors: true } ), text: blockIndicatorText } ) }); } const blockSwitcherDescription = isSingleBlock ? (0,external_wp_i18n_namespaceObject.__)("Change block type or style") : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of blocks. */ (0,external_wp_i18n_namespaceObject._n)( "Change type of %d block", "Change type of %d blocks", clientIds.length ), clientIds.length ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { className: "block-editor-block-switcher", label: blockSwitcherLabel, popoverProps: { placement: "bottom-start", className: "block-editor-block-switcher__popover" }, icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_icon_default, { className: "block-editor-block-switcher__toggle", icon, showColors: true } ), text: blockIndicatorText, toggleProps: { description: blockSwitcherDescription, ...toggleProps }, menuProps: { orientation: "both" }, children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockSwitcherDropdownMenuContents, { onClose, clientIds, hasBlockStyles, canRemove } ) } ) }) }); }; var block_switcher_default = BlockSwitcher; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/block-toolbar-last-item.js const { Fill: __unstableBlockToolbarLastItem, Slot: block_toolbar_last_item_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)( "__unstableBlockToolbarLastItem" ); __unstableBlockToolbarLastItem.Slot = block_toolbar_last_item_Slot; var block_toolbar_last_item_default = __unstableBlockToolbarLastItem; ;// ./node_modules/@wordpress/block-editor/build-module/hooks/supports.js const ALIGN_SUPPORT_KEY = "align"; const ALIGN_WIDE_SUPPORT_KEY = "alignWide"; const supports_BORDER_SUPPORT_KEY = "__experimentalBorder"; const supports_COLOR_SUPPORT_KEY = "color"; const CUSTOM_CLASS_NAME_SUPPORT_KEY = "customClassName"; const supports_FONT_FAMILY_SUPPORT_KEY = "typography.__experimentalFontFamily"; const supports_FONT_SIZE_SUPPORT_KEY = "typography.fontSize"; const supports_LINE_HEIGHT_SUPPORT_KEY = "typography.lineHeight"; const supports_FONT_STYLE_SUPPORT_KEY = "typography.__experimentalFontStyle"; const supports_FONT_WEIGHT_SUPPORT_KEY = "typography.__experimentalFontWeight"; const supports_TEXT_ALIGN_SUPPORT_KEY = "typography.textAlign"; const supports_TEXT_COLUMNS_SUPPORT_KEY = "typography.textColumns"; const supports_TEXT_DECORATION_SUPPORT_KEY = "typography.__experimentalTextDecoration"; const supports_WRITING_MODE_SUPPORT_KEY = "typography.__experimentalWritingMode"; const supports_TEXT_TRANSFORM_SUPPORT_KEY = "typography.__experimentalTextTransform"; const supports_LETTER_SPACING_SUPPORT_KEY = "typography.__experimentalLetterSpacing"; const LAYOUT_SUPPORT_KEY = "layout"; const supports_TYPOGRAPHY_SUPPORT_KEYS = [ supports_LINE_HEIGHT_SUPPORT_KEY, supports_FONT_SIZE_SUPPORT_KEY, supports_FONT_STYLE_SUPPORT_KEY, supports_FONT_WEIGHT_SUPPORT_KEY, supports_FONT_FAMILY_SUPPORT_KEY, supports_TEXT_ALIGN_SUPPORT_KEY, supports_TEXT_COLUMNS_SUPPORT_KEY, supports_TEXT_DECORATION_SUPPORT_KEY, supports_TEXT_TRANSFORM_SUPPORT_KEY, supports_WRITING_MODE_SUPPORT_KEY, supports_LETTER_SPACING_SUPPORT_KEY ]; const EFFECTS_SUPPORT_KEYS = ["shadow"]; const supports_SPACING_SUPPORT_KEY = "spacing"; const supports_styleSupportKeys = [ ...EFFECTS_SUPPORT_KEYS, ...supports_TYPOGRAPHY_SUPPORT_KEYS, supports_BORDER_SUPPORT_KEY, supports_COLOR_SUPPORT_KEY, supports_SPACING_SUPPORT_KEY ]; const hasAlignSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, ALIGN_SUPPORT_KEY); const getAlignSupport = (nameOrType) => getBlockSupport(nameOrType, ALIGN_SUPPORT_KEY); const hasAlignWideSupport = (nameOrType) => hasBlockSupport(nameOrType, ALIGN_WIDE_SUPPORT_KEY); const getAlignWideSupport = (nameOrType) => getBlockSupport(nameOrType, ALIGN_WIDE_SUPPORT_KEY); function supports_hasBorderSupport(nameOrType, feature = "any") { if (external_wp_element_namespaceObject.Platform.OS !== "web") { return false; } const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_BORDER_SUPPORT_KEY); if (support === true) { return true; } if (feature === "any") { return !!(support?.color || support?.radius || support?.width || support?.style); } return !!support?.[feature]; } const getBorderSupport = (nameOrType, feature) => getBlockSupport(nameOrType, [supports_BORDER_SUPPORT_KEY, feature]); const supports_hasColorSupport = (nameOrType) => { const colorSupport = getBlockSupport(nameOrType, supports_COLOR_SUPPORT_KEY); return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false); }; const supports_hasLinkColorSupport = (nameOrType) => { if (Platform.OS !== "web") { return false; } const colorSupport = getBlockSupport(nameOrType, supports_COLOR_SUPPORT_KEY); return colorSupport !== null && typeof colorSupport === "object" && !!colorSupport.link; }; const supports_hasGradientSupport = (nameOrType) => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY); return colorSupport !== null && typeof colorSupport === "object" && !!colorSupport.gradients; }; const supports_hasBackgroundColorSupport = (nameOrType) => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY); return colorSupport && colorSupport.background !== false; }; const hasTextAlignSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_TEXT_ALIGN_SUPPORT_KEY); const getTextAlignSupport = (nameOrType) => getBlockSupport(nameOrType, supports_TEXT_ALIGN_SUPPORT_KEY); const supports_hasTextColorSupport = (nameOrType) => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY); return colorSupport && colorSupport.text !== false; }; const getColorSupport = (nameOrType, feature) => getBlockSupport(nameOrType, [supports_COLOR_SUPPORT_KEY, feature]); const hasCustomClassNameSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true); const getCustomClassNameSupport = (nameOrType) => getBlockSupport(nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true); const hasFontFamilySupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_FONT_FAMILY_SUPPORT_KEY); const getFontFamilySupport = (nameOrType) => getBlockSupport(nameOrType, supports_FONT_FAMILY_SUPPORT_KEY); const hasFontSizeSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_FONT_SIZE_SUPPORT_KEY); const getFontSizeSupport = (nameOrType) => getBlockSupport(nameOrType, supports_FONT_SIZE_SUPPORT_KEY); const hasLayoutSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, LAYOUT_SUPPORT_KEY); const getLayoutSupport = (nameOrType) => getBlockSupport(nameOrType, LAYOUT_SUPPORT_KEY); const supports_hasStyleSupport = (nameOrType) => supports_styleSupportKeys.some((key) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, key)); ;// ./node_modules/@wordpress/block-editor/build-module/components/use-paste-styles/index.js function hasSerializedBlocks(text) { try { const blocks = (0,external_wp_blocks_namespaceObject.parse)(text, { __unstableSkipMigrationLogs: true, __unstableSkipAutop: true }); if (blocks.length === 1 && blocks[0].name === "core/freeform") { return false; } return true; } catch (err) { return false; } } const STYLE_ATTRIBUTES = { align: hasAlignSupport, borderColor: (nameOrType) => supports_hasBorderSupport(nameOrType, "color"), backgroundColor: supports_hasBackgroundColorSupport, textAlign: hasTextAlignSupport, textColor: supports_hasTextColorSupport, gradient: supports_hasGradientSupport, className: hasCustomClassNameSupport, fontFamily: hasFontFamilySupport, fontSize: hasFontSizeSupport, layout: hasLayoutSupport, style: supports_hasStyleSupport }; function getStyleAttributes(sourceBlock, targetBlock) { return Object.entries(STYLE_ATTRIBUTES).reduce( (attributes, [attributeKey, hasSupport]) => { if (hasSupport(sourceBlock.name) && hasSupport(targetBlock.name)) { attributes[attributeKey] = sourceBlock.attributes[attributeKey]; } return attributes; }, {} ); } function recursivelyUpdateBlockAttributes(targetBlocks, sourceBlocks, updateBlockAttributes) { for (let index = 0; index < Math.min(sourceBlocks.length, targetBlocks.length); index += 1) { updateBlockAttributes( targetBlocks[index].clientId, getStyleAttributes(sourceBlocks[index], targetBlocks[index]) ); recursivelyUpdateBlockAttributes( targetBlocks[index].innerBlocks, sourceBlocks[index].innerBlocks, updateBlockAttributes ); } } function usePasteStyles() { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { createSuccessNotice, createWarningNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); return (0,external_wp_element_namespaceObject.useCallback)( async (targetBlocks) => { let html = ""; try { if (!window.navigator.clipboard) { createErrorNotice( (0,external_wp_i18n_namespaceObject.__)( "Unable to paste styles. This feature is only available on secure (https) sites in supporting browsers." ), { type: "snackbar" } ); return; } html = await window.navigator.clipboard.readText(); } catch (error) { createErrorNotice( (0,external_wp_i18n_namespaceObject.__)( "Unable to paste styles. Please allow browser clipboard permissions before continuing." ), { type: "snackbar" } ); return; } if (!html || !hasSerializedBlocks(html)) { createWarningNotice( (0,external_wp_i18n_namespaceObject.__)( "Unable to paste styles. Block styles couldn't be found within the copied content." ), { type: "snackbar" } ); return; } const copiedBlocks = (0,external_wp_blocks_namespaceObject.parse)(html); if (copiedBlocks.length === 1) { registry.batch(() => { recursivelyUpdateBlockAttributes( targetBlocks, targetBlocks.map(() => copiedBlocks[0]), updateBlockAttributes ); }); } else { registry.batch(() => { recursivelyUpdateBlockAttributes( targetBlocks, copiedBlocks, updateBlockAttributes ); }); } if (targetBlocks.length === 1) { const title = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlocks[0].name)?.title; createSuccessNotice( (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: Name of the block being pasted, e.g. "Paragraph". (0,external_wp_i18n_namespaceObject.__)("Pasted styles to %s."), title ), { type: "snackbar" } ); } else { createSuccessNotice( (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %d: The number of the blocks. (0,external_wp_i18n_namespaceObject.__)("Pasted styles to %d blocks."), targetBlocks.length ), { type: "snackbar" } ); } }, [ registry.batch, updateBlockAttributes, createSuccessNotice, createWarningNotice, createErrorNotice ] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-actions/index.js function BlockActions({ clientIds, children, __experimentalUpdateSelection: updateSelection }) { const { getDefaultBlockName, getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const selected = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { canInsertBlockType, getBlockRootClientId, getBlocksByClientId: getBlocksByClientId2, getDirectInsertBlock, canRemoveBlocks } = select(store); const blocks = getBlocksByClientId2(clientIds); const rootClientId = getBlockRootClientId(clientIds[0]); const canInsertDefaultBlock = canInsertBlockType( getDefaultBlockName(), rootClientId ); const directInsertBlock = rootClientId ? getDirectInsertBlock(rootClientId) : null; return { canRemove: canRemoveBlocks(clientIds), canInsertBlock: blocks.every((block) => { return (canInsertDefaultBlock || !!directInsertBlock) && canInsertBlockType(block.name, rootClientId); }), canCopyStyles: blocks.every((block) => { return !!block && ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "color") || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "typography")); }), canDuplicate: blocks.every((block) => { return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "multiple", true) && canInsertBlockType(block.name, rootClientId); }) }; }, [clientIds, getDefaultBlockName] ); const { getBlocksByClientId, getBlocks } = (0,external_wp_data_namespaceObject.useSelect)(store); const { canRemove, canInsertBlock, canCopyStyles, canDuplicate } = selected; const { removeBlocks, replaceBlocks, duplicateBlocks, insertAfterBlock, insertBeforeBlock, flashBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const pasteStyles = usePasteStyles(); return children({ canCopyStyles, canDuplicate, canInsertBlock, canRemove, onDuplicate() { return duplicateBlocks(clientIds, updateSelection); }, onRemove() { return removeBlocks(clientIds, updateSelection); }, onInsertBefore() { insertBeforeBlock(clientIds[0]); }, onInsertAfter() { insertAfterBlock(clientIds[clientIds.length - 1]); }, onGroup() { if (!clientIds.length) { return; } const groupingBlockName = getGroupingBlockName(); const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)( getBlocksByClientId(clientIds), groupingBlockName ); if (!newBlocks) { return; } replaceBlocks(clientIds, newBlocks); }, onUngroup() { if (!clientIds.length) { return; } const innerBlocks = getBlocks(clientIds[0]); if (!innerBlocks.length) { return; } replaceBlocks(clientIds, innerBlocks); }, onCopy() { if (clientIds.length === 1) { flashBlock(clientIds[0]); } }, async onPasteStyles() { await pasteStyles(getBlocksByClientId(clientIds)); } }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/collab/block-comment-icon-slot.js const CommentIconSlotFill = (0,external_wp_components_namespaceObject.createSlotFill)(Symbol("CommentIconSlotFill")); var block_comment_icon_slot_default = CommentIconSlotFill; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-html-convert-button.js function BlockHTMLConvertButton({ clientId }) { const block = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).getBlock(clientId), [clientId] ); const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (!block || block.name !== "core/html") { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => replaceBlocks( clientId, (0,external_wp_blocks_namespaceObject.rawHandler)({ HTML: (0,external_wp_blocks_namespaceObject.getBlockContent)(block) }) ), children: (0,external_wp_i18n_namespaceObject.__)("Convert to Blocks") } ); } var block_html_convert_button_default = BlockHTMLConvertButton; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-menu-first-item.js const { Fill: __unstableBlockSettingsMenuFirstItem, Slot: block_settings_menu_first_item_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)( "__unstableBlockSettingsMenuFirstItem" ); __unstableBlockSettingsMenuFirstItem.Slot = block_settings_menu_first_item_Slot; var block_settings_menu_first_item_default = __unstableBlockSettingsMenuFirstItem; ;// ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js function useConvertToGroupButtonProps(selectedClientIds) { return (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlocksByClientId, getSelectedBlockClientIds, isUngroupable, isGroupable } = select(store); const { getGroupingBlockName, getBlockType } = select(external_wp_blocks_namespaceObject.store); const clientIds = selectedClientIds?.length ? selectedClientIds : getSelectedBlockClientIds(); const blocksSelection = getBlocksByClientId(clientIds); const [firstSelectedBlock] = blocksSelection; const _isUngroupable = clientIds.length === 1 && isUngroupable(clientIds[0]); return { clientIds, isGroupable: isGroupable(clientIds), isUngroupable: _isUngroupable, blocksSelection, groupingBlockName: getGroupingBlockName(), onUngroup: _isUngroupable && getBlockType(firstSelectedBlock.name)?.transforms?.ungroup }; }, [selectedClientIds] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/index.js function ConvertToGroupButton({ clientIds, isGroupable, isUngroupable, onUngroup, blocksSelection, groupingBlockName, onClose = () => { } }) { const { getSelectedBlockClientIds } = (0,external_wp_data_namespaceObject.useSelect)(store); const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); const onConvertToGroup = () => { const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)( blocksSelection, groupingBlockName ); if (newBlocks) { replaceBlocks(clientIds, newBlocks); } }; const onConvertFromGroup = () => { let innerBlocks = blocksSelection[0].innerBlocks; if (!innerBlocks.length) { return; } if (onUngroup) { innerBlocks = onUngroup( blocksSelection[0].attributes, blocksSelection[0].innerBlocks ); } replaceBlocks(clientIds, innerBlocks); }; if (!isGroupable && !isUngroupable) { return null; } const selectedBlockClientIds = getSelectedBlockClientIds(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ isGroupable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { shortcut: selectedBlockClientIds.length > 1 ? external_wp_keycodes_namespaceObject.displayShortcut.primary("g") : void 0, onClick: () => { onConvertToGroup(); onClose(); }, children: (0,external_wp_i18n_namespaceObject._x)("Group", "verb") } ), isUngroupable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { onConvertFromGroup(); onClose(); }, children: (0,external_wp_i18n_namespaceObject._x)( "Ungroup", "Ungrouping blocks from within a grouping block back into individual blocks within the Editor" ) } ) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/use-block-lock.js function useBlockLock(clientId) { return (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { canEditBlock, canMoveBlock, canRemoveBlock, canLockBlockType, getBlockName, getTemplateLock } = select(store); const canEdit = canEditBlock(clientId); const canMove = canMoveBlock(clientId); const canRemove = canRemoveBlock(clientId); return { canEdit, canMove, canRemove, canLock: canLockBlockType(getBlockName(clientId)), isContentLocked: getTemplateLock(clientId) === "contentOnly", isLocked: !canEdit || !canMove || !canRemove }; }, [clientId] ); } ;// ./node_modules/@wordpress/icons/build-module/library/unlock.js var unlock_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.8h1.5c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/lock-outline.js var lock_outline_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-1zM9.8 7c0-1.2 1-2.2 2.2-2.2 1.2 0 2.2 1 2.2 2.2v3H9.8V7zm6.7 11.5h-9v-7h9v7z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/lock.js var lock_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/modal.js const ALLOWS_EDIT_LOCKING = ["core/navigation"]; function getTemplateLockValue(lock) { if (lock.remove && lock.move) { return "all"; } if (lock.remove && !lock.move) { return "insert"; } return false; } function BlockLockModal({ clientId, onClose }) { const [lock, setLock] = (0,external_wp_element_namespaceObject.useState)({ move: false, remove: false }); const { canEdit, canMove, canRemove } = useBlockLock(clientId); const { allowsEditLocking, templateLock, hasTemplateLock } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockName, getBlockAttributes } = select(store); const blockName = getBlockName(clientId); const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); return { allowsEditLocking: ALLOWS_EDIT_LOCKING.includes(blockName), templateLock: getBlockAttributes(clientId)?.templateLock, hasTemplateLock: !!blockType?.attributes?.templateLock }; }, [clientId] ); const [applyTemplateLock, setApplyTemplateLock] = (0,external_wp_element_namespaceObject.useState)( !!templateLock ); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const blockInformation = useBlockDisplayInformation(clientId); (0,external_wp_element_namespaceObject.useEffect)(() => { setLock({ move: !canMove, remove: !canRemove, ...allowsEditLocking ? { edit: !canEdit } : {} }); }, [canEdit, canMove, canRemove, allowsEditLocking]); const isAllChecked = Object.values(lock).every(Boolean); const isMixed = Object.values(lock).some(Boolean) && !isAllChecked; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block. */ (0,external_wp_i18n_namespaceObject.__)("Lock %s"), blockInformation.title ), overlayClassName: "block-editor-block-lock-modal", onRequestClose: onClose, size: "small", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "form", { onSubmit: (event) => { event.preventDefault(); updateBlockAttributes([clientId], { lock, templateLock: applyTemplateLock ? getTemplateLockValue(lock) : void 0 }); onClose(); }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-block-lock-modal__options", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("legend", { children: (0,external_wp_i18n_namespaceObject.__)("Select the features you want to lock") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "ul", { role: "list", className: "block-editor-block-lock-modal__checklist", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, className: "block-editor-block-lock-modal__options-all", label: (0,external_wp_i18n_namespaceObject.__)("Lock all"), checked: isAllChecked, indeterminate: isMixed, onChange: (newValue) => setLock({ move: newValue, remove: newValue, ...allowsEditLocking ? { edit: newValue } : {} }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "ul", { role: "list", className: "block-editor-block-lock-modal__checklist", children: [ allowsEditLocking && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "block-editor-block-lock-modal__checklist-item", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Lock editing"), checked: !!lock.edit, onChange: (edit) => setLock((prevLock) => ({ ...prevLock, edit })) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Icon, { className: "block-editor-block-lock-modal__lock-icon", icon: lock.edit ? lock_default : unlock_default } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "block-editor-block-lock-modal__checklist-item", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Lock movement"), checked: lock.move, onChange: (move) => setLock((prevLock) => ({ ...prevLock, move })) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Icon, { className: "block-editor-block-lock-modal__lock-icon", icon: lock.move ? lock_default : unlock_default } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "block-editor-block-lock-modal__checklist-item", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Lock removal"), checked: lock.remove, onChange: (remove) => setLock((prevLock) => ({ ...prevLock, remove })) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Icon, { className: "block-editor-block-lock-modal__lock-icon", icon: lock.remove ? lock_default : unlock_default } ) ] }) ] } ) ] }) } ), hasTemplateLock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, className: "block-editor-block-lock-modal__template-lock", label: (0,external_wp_i18n_namespaceObject.__)("Apply to all blocks inside"), checked: applyTemplateLock, disabled: lock.move && !lock.remove, onChange: () => setApplyTemplateLock(!applyTemplateLock) } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Flex, { className: "block-editor-block-lock-modal__actions", justify: "flex-end", expanded: false, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: onClose, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "primary", type: "submit", __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)("Apply") } ) }) ] } ) ] } ) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/menu-item.js function BlockLockMenuItem({ clientId }) { const { canLock, isLocked } = useBlockLock(clientId); const [isModalOpen, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)( (isActive) => !isActive, false ); if (!canLock) { return null; } const label = isLocked ? (0,external_wp_i18n_namespaceObject.__)("Unlock") : (0,external_wp_i18n_namespaceObject.__)("Lock"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: isLocked ? unlock_default : lock_outline_default, onClick: toggleModal, "aria-expanded": isModalOpen, "aria-haspopup": "dialog", children: label } ), isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockModal, { clientId, onClose: toggleModal }) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-mode-toggle.js const block_mode_toggle_noop = () => { }; function BlockModeToggle({ clientId, onToggle = block_mode_toggle_noop }) { const { blockType, mode, enabled } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlock, getBlockMode, getSettings } = select(store); const block = getBlock(clientId); return { mode: getBlockMode(clientId), blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null, enabled: getSettings().codeEditingEnabled && !!block?.isValid }; }, [clientId] ); const { toggleBlockMode } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (!blockType || !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "html", true) || !enabled) { return null; } const label = mode === "visual" ? (0,external_wp_i18n_namespaceObject.__)("Edit as HTML") : (0,external_wp_i18n_namespaceObject.__)("Edit visually"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { toggleBlockMode(clientId); onToggle(); }, children: label } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/content-lock/modify-content-lock-menu-item.js function ModifyContentLockMenuItem({ clientId, onClose }) { const { templateLock, isLockedByParent, isEditingAsBlocks } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getContentLockingParent, getTemplateLock, getTemporarilyEditingAsBlocks } = unlock(select(store)); return { templateLock: getTemplateLock(clientId), isLockedByParent: !!getContentLockingParent(clientId), isEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId }; }, [clientId] ); const blockEditorActions = (0,external_wp_data_namespaceObject.useDispatch)(store); const isContentLocked = !isLockedByParent && templateLock === "contentOnly"; if (!isContentLocked && !isEditingAsBlocks) { return null; } const { modifyContentLockBlock } = unlock(blockEditorActions); const showStartEditingAsBlocks = !isEditingAsBlocks && isContentLocked; return showStartEditingAsBlocks && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { modifyContentLockBlock(clientId); onClose(); }, children: (0,external_wp_i18n_namespaceObject._x)("Modify", "Unlock content locked blocks") } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/use-block-rename.js function useBlockRename(name) { return { canRename: (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "renaming", true) }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/is-empty-string.js function isEmptyString(testString) { return testString?.trim()?.length === 0; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/modal.js function BlockRenameModal({ clientId, onClose }) { const [editedBlockName, setEditedBlockName] = (0,external_wp_element_namespaceObject.useState)(); const blockInformation = useBlockDisplayInformation(clientId); const { metadata } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockAttributes } = select(store); return { metadata: getBlockAttributes(clientId)?.metadata }; }, [clientId] ); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const blockName = metadata?.name || ""; const originalBlockName = blockInformation?.title; const hasOverridesWarning = !!blockName && !!metadata?.bindings && Object.values(metadata.bindings).some( (binding) => binding.source === "core/pattern-overrides" ); const nameHasChanged = editedBlockName !== void 0 && editedBlockName !== blockName; const nameIsOriginal = editedBlockName === originalBlockName; const nameIsEmpty = isEmptyString(editedBlockName); const isNameValid = nameHasChanged || nameIsOriginal; const autoSelectInputText = (event) => event.target.select(); const handleSubmit = () => { const newName = nameIsOriginal || nameIsEmpty ? void 0 : editedBlockName; const message = nameIsOriginal || nameIsEmpty ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: new name/label for the block */ (0,external_wp_i18n_namespaceObject.__)('Block name reset to: "%s".'), editedBlockName ) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: new name/label for the block */ (0,external_wp_i18n_namespaceObject.__)('Block name changed to: "%s".'), editedBlockName ); (0,external_wp_a11y_namespaceObject.speak)(message, "assertive"); updateBlockAttributes([clientId], { metadata: utils_cleanEmptyObject({ ...metadata, name: newName }) }); onClose(); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Rename"), onRequestClose: onClose, overlayClassName: "block-editor-block-rename-modal", focusOnMount: "firstContentElement", size: "small", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "form", { onSubmit: (e) => { e.preventDefault(); if (!isNameValid) { return; } handleSubmit(); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, value: editedBlockName ?? blockName, label: (0,external_wp_i18n_namespaceObject.__)("Name"), help: hasOverridesWarning ? (0,external_wp_i18n_namespaceObject.__)( "This block allows overrides. Changing the name can cause problems with content entered into instances of this pattern." ) : void 0, placeholder: originalBlockName, onChange: setEditedBlockName, onFocus: autoSelectInputText } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: onClose, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, accessibleWhenDisabled: true, disabled: !isNameValid, variant: "primary", type: "submit", children: (0,external_wp_i18n_namespaceObject.__)("Save") } ) ] }) ] }) } ) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/rename-control.js function BlockRenameControl({ clientId }) { const [renamingBlock, setRenamingBlock] = (0,external_wp_element_namespaceObject.useState)(false); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { setRenamingBlock(true); }, "aria-expanded": renamingBlock, "aria-haspopup": "dialog", children: (0,external_wp_i18n_namespaceObject.__)("Rename") } ), renamingBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockRenameModal, { clientId, onClose: () => setRenamingBlock(false) } ) ] }); } ;// ./node_modules/@wordpress/icons/build-module/library/seen.js var seen_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/unseen.js var unseen_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-visibility/menu-item.js function BlockVisibilityMenuItem({ clientIds }) { const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const blocks = (0,external_wp_data_namespaceObject.useSelect)( (select) => { return select(store).getBlocksByClientId(clientIds); }, [clientIds] ); const listViewShortcut = (0,external_wp_data_namespaceObject.useSelect)((select) => { return select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation( "core/editor/toggle-list-view" ); }, []); const hasHiddenBlock = blocks.some( (block) => block.attributes.metadata?.blockVisibility === false ); const toggleBlockVisibility = () => { const isHiding = !hasHiddenBlock; const attributesByClientId = Object.fromEntries( blocks?.map(({ clientId, attributes }) => [ clientId, { metadata: utils_cleanEmptyObject({ ...attributes?.metadata, blockVisibility: isHiding ? false : void 0 }) } ]) ); updateBlockAttributes(clientIds, attributesByClientId, { uniqueByBlock: true }); if (isHiding) { if (blocks.length > 1) { createSuccessNotice( (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The shortcut key to access the List View. (0,external_wp_i18n_namespaceObject.__)( "Blocks hidden. You can access them via the List View (%s)." ), listViewShortcut ), { id: "block-visibility-hidden", type: "snackbar" } ); } else { createSuccessNotice( (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The shortcut key to access the List View. (0,external_wp_i18n_namespaceObject.__)( "Block hidden. You can access it via the List View (%s)." ), listViewShortcut ), { id: "block-visibility-hidden", type: "snackbar" } ); } } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: hasHiddenBlock ? seen_default : unseen_default, onClick: toggleBlockVisibility, children: hasHiddenBlock ? (0,external_wp_i18n_namespaceObject.__)("Show") : (0,external_wp_i18n_namespaceObject.__)("Hide") } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu-controls/index.js const { Fill, Slot: block_settings_menu_controls_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("BlockSettingsMenuControls"); const BlockSettingsMenuControlsSlot = ({ fillProps, clientIds = null }) => { const { selectedBlocks, selectedClientIds, isContentOnly, canToggleSelectedBlocksVisibility } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlocksByClientId, getBlockNamesByClientId, getSelectedBlockClientIds, getBlockEditingMode } = select(store); const ids = clientIds !== null ? clientIds : getSelectedBlockClientIds(); return { selectedBlocks: getBlockNamesByClientId(ids), selectedClientIds: ids, isContentOnly: getBlockEditingMode(ids[0]) === "contentOnly", canToggleSelectedBlocksVisibility: getBlocksByClientId( ids ).every( (block) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "visibility", true) ) }; }, [clientIds] ); const { canLock } = useBlockLock(selectedClientIds[0]); const { canRename } = useBlockRename(selectedBlocks[0]); const showLockButton = selectedClientIds.length === 1 && canLock && !isContentOnly; const showRenameButton = selectedClientIds.length === 1 && canRename && !isContentOnly; const showVisibilityButton = canToggleSelectedBlocksVisibility && !isContentOnly; const convertToGroupButtonProps = useConvertToGroupButtonProps(selectedClientIds); const { isGroupable, isUngroupable } = convertToGroupButtonProps; const showConvertToGroupButton = (isGroupable || isUngroupable) && !isContentOnly; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_settings_menu_controls_Slot, { fillProps: { ...fillProps, selectedBlocks, selectedClientIds }, children: (fills) => { if (!fills?.length > 0 && !showConvertToGroupButton && !showLockButton) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ showConvertToGroupButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ConvertToGroupButton, { ...convertToGroupButtonProps, onClose: fillProps?.onClose } ), showLockButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockLockMenuItem, { clientId: selectedClientIds[0] } ), showRenameButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockRenameControl, { clientId: selectedClientIds[0] } ), showVisibilityButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockVisibilityMenuItem, { clientIds: selectedClientIds } ), fills, selectedClientIds.length === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ModifyContentLockMenuItem, { clientId: selectedClientIds[0], onClose: fillProps?.onClose } ), fillProps?.count === 1 && !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockModeToggle, { clientId: fillProps?.firstBlockClientId, onToggle: fillProps?.onClose } ) ] }); } } ); }; function BlockSettingsMenuControls({ ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { ...props }) }); } BlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot; var block_settings_menu_controls_default = BlockSettingsMenuControls; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-parent-selector-menu-item.js function BlockParentSelectorMenuItem({ parentClientId, parentBlockType }) { const isSmallViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const menuItemRef = (0,external_wp_element_namespaceObject.useRef)(); const gesturesProps = useShowHoveredOrFocusedGestures({ ref: menuItemRef, highlightParent: true }); if (!isSmallViewport) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { ...gesturesProps, ref: menuItemRef, icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: parentBlockType.icon }), onClick: () => selectBlock(parentClientId), children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block's parent. */ (0,external_wp_i18n_namespaceObject.__)("Select parent block (%s)"), parentBlockType.title ) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-dropdown.js const block_settings_dropdown_POPOVER_PROPS = { className: "block-editor-block-settings-menu__popover", placement: "bottom-start" }; function CopyMenuItem({ clientIds, onCopy, label, shortcut, eventType = "copy", __experimentalUpdateSelection: updateSelection = false }) { const { getBlocksByClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { removeBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); const notifyCopy = useNotifyCopy(); const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)( () => (0,external_wp_blocks_namespaceObject.serialize)(getBlocksByClientId(clientIds)), () => { switch (eventType) { case "copy": case "copyStyles": onCopy(); notifyCopy(eventType, clientIds); break; case "cut": notifyCopy(eventType, clientIds); removeBlocks(clientIds, updateSelection); break; default: break; } } ); const copyMenuItemLabel = label ? label : (0,external_wp_i18n_namespaceObject.__)("Copy"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ref, shortcut, children: copyMenuItemLabel }); } function BlockSettingsDropdown({ block, clientIds, children, __experimentalSelectBlock, ...props }) { const currentClientId = block?.clientId; const count = clientIds.length; const firstBlockClientId = clientIds[0]; const { firstParentClientId, parentBlockType, previousBlockClientId, selectedBlockClientIds, openedBlockSettingsMenu, isContentOnly, isZoomOut } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockName, getBlockRootClientId, getPreviousBlockClientId, getSelectedBlockClientIds: getSelectedBlockClientIds2, getBlockAttributes, getOpenedBlockSettingsMenu, getBlockEditingMode, isZoomOut: _isZoomOut } = unlock(select(store)); const { getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const _firstParentClientId = getBlockRootClientId(firstBlockClientId); const parentBlockName = _firstParentClientId && getBlockName(_firstParentClientId); return { firstParentClientId: _firstParentClientId, parentBlockType: _firstParentClientId && (getActiveBlockVariation( parentBlockName, getBlockAttributes(_firstParentClientId) ) || (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName)), previousBlockClientId: getPreviousBlockClientId(firstBlockClientId), selectedBlockClientIds: getSelectedBlockClientIds2(), openedBlockSettingsMenu: getOpenedBlockSettingsMenu(), isContentOnly: getBlockEditingMode(firstBlockClientId) === "contentOnly", isZoomOut: _isZoomOut() }; }, [firstBlockClientId] ); const { getBlockOrder, getSelectedBlockClientIds } = (0,external_wp_data_namespaceObject.useSelect)(store); const { setOpenedBlockSettingsMenu } = unlock( (0,external_wp_data_namespaceObject.useDispatch)(store) ); const shortcuts = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getShortcutRepresentation } = select(external_wp_keyboardShortcuts_namespaceObject.store); return { copy: getShortcutRepresentation("core/block-editor/copy"), cut: getShortcutRepresentation("core/block-editor/cut"), duplicate: getShortcutRepresentation( "core/block-editor/duplicate" ), remove: getShortcutRepresentation("core/block-editor/remove"), insertAfter: getShortcutRepresentation( "core/block-editor/insert-after" ), insertBefore: getShortcutRepresentation( "core/block-editor/insert-before" ) }; }, []); const hasSelectedBlocks = selectedBlockClientIds.length > 0; async function updateSelectionAfterDuplicate(clientIdsPromise) { if (!__experimentalSelectBlock) { return; } const ids = await clientIdsPromise; if (ids && ids[0]) { __experimentalSelectBlock(ids[0], false); } } function updateSelectionAfterRemove() { if (!__experimentalSelectBlock) { return; } let blockToFocus = previousBlockClientId || firstParentClientId; if (!blockToFocus) { blockToFocus = getBlockOrder()[0]; } const shouldUpdateSelection = hasSelectedBlocks && getSelectedBlockClientIds().length === 0; __experimentalSelectBlock(blockToFocus, shouldUpdateSelection); } const parentBlockIsSelected = selectedBlockClientIds?.includes(firstParentClientId); const open = !currentClientId ? void 0 : openedBlockSettingsMenu === currentClientId || false; function onToggle(localOpen) { if (localOpen && openedBlockSettingsMenu !== currentClientId) { setOpenedBlockSettingsMenu(currentClientId); } else if (!localOpen && openedBlockSettingsMenu && openedBlockSettingsMenu === currentClientId) { setOpenedBlockSettingsMenu(void 0); } } const shouldShowBlockParentMenuItem = !parentBlockIsSelected && !!firstParentClientId; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockActions, { clientIds, __experimentalUpdateSelection: !__experimentalSelectBlock, children: ({ canCopyStyles, canDuplicate, canInsertBlock, canRemove, onDuplicate, onInsertAfter, onInsertBefore, onRemove, onCopy, onPasteStyles }) => { const isEmpty = !canRemove && !canDuplicate && !canInsertBlock && isContentOnly; if (isEmpty) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("Options"), className: "block-editor-block-settings-menu", popoverProps: block_settings_dropdown_POPOVER_PROPS, open, onToggle, noIcons: true, ...props, children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_settings_menu_first_item_default.Slot, { fillProps: { onClose } } ), shouldShowBlockParentMenuItem && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockParentSelectorMenuItem, { parentClientId: firstParentClientId, parentBlockType } ), count === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_html_convert_button_default, { clientId: firstBlockClientId } ), !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CopyMenuItem, { clientIds, onCopy, shortcut: shortcuts.copy } ), !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CopyMenuItem, { clientIds, label: (0,external_wp_i18n_namespaceObject.__)("Cut"), eventType: "cut", shortcut: shortcuts.cut, __experimentalUpdateSelection: !__experimentalSelectBlock } ), canDuplicate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: (0,external_wp_compose_namespaceObject.pipe)( onClose, onDuplicate, updateSelectionAfterDuplicate ), shortcut: shortcuts.duplicate, children: (0,external_wp_i18n_namespaceObject.__)("Duplicate") } ), canInsertBlock && !isZoomOut && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: (0,external_wp_compose_namespaceObject.pipe)( onClose, onInsertBefore ), shortcut: shortcuts.insertBefore, children: (0,external_wp_i18n_namespaceObject.__)("Add before") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: (0,external_wp_compose_namespaceObject.pipe)( onClose, onInsertAfter ), shortcut: shortcuts.insertAfter, children: (0,external_wp_i18n_namespaceObject.__)("Add after") } ) ] }), count === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_comment_icon_slot_default.Slot, { fillProps: { clientId: firstBlockClientId, onClose } } ) ] }), canCopyStyles && !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CopyMenuItem, { clientIds, onCopy, label: (0,external_wp_i18n_namespaceObject.__)("Copy styles"), eventType: "copyStyles" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: onPasteStyles, children: (0,external_wp_i18n_namespaceObject.__)("Paste styles") }) ] }), !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_settings_menu_controls_default.Slot, { fillProps: { onClose, count, firstBlockClientId }, clientIds } ), typeof children === "function" ? children({ onClose }) : external_wp_element_namespaceObject.Children.map( (child) => (0,external_wp_element_namespaceObject.cloneElement)(child, { onClose }) ), canRemove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: (0,external_wp_compose_namespaceObject.pipe)( onClose, onRemove, updateSelectionAfterRemove ), shortcut: shortcuts.remove, children: (0,external_wp_i18n_namespaceObject.__)("Delete") } ) }) ] }) } ); } } ); } var block_settings_dropdown_default = BlockSettingsDropdown; ;// ./node_modules/@wordpress/block-editor/build-module/components/collab/block-comment-icon-toolbar-slot.js const CommentIconToolbarSlotFill = (0,external_wp_components_namespaceObject.createSlotFill)( Symbol("CommentIconToolbarSlotFill") ); var block_comment_icon_toolbar_slot_default = CommentIconToolbarSlotFill; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/index.js function BlockSettingsMenu({ clientIds, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_comment_icon_toolbar_slot_default.Slot, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_settings_dropdown_default, { clientIds, toggleProps, ...props } ) }) ] }); } var block_settings_menu_default = BlockSettingsMenu; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/toolbar.js function BlockLockToolbar({ clientId }) { const { canLock, isLocked } = useBlockLock(clientId); const [isModalOpen, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)( (isActive) => !isActive, false ); const hasLockButtonShownRef = (0,external_wp_element_namespaceObject.useRef)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isLocked) { hasLockButtonShownRef.current = true; } }, [isLocked]); if (!isLocked && !hasLockButtonShownRef.current) { return null; } let label = isLocked ? (0,external_wp_i18n_namespaceObject.__)("Unlock") : (0,external_wp_i18n_namespaceObject.__)("Lock"); if (!canLock && isLocked) { label = (0,external_wp_i18n_namespaceObject.__)("Locked"); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { className: "block-editor-block-lock-toolbar", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { disabled: !canLock, icon: isLocked ? lock_default : unlock_default, label, onClick: toggleModal, "aria-expanded": isModalOpen, "aria-haspopup": "dialog" } ) }), isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockModal, { clientId, onClose: toggleModal }) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-visibility/toolbar.js function BlockVisibilityToolbar({ clientIds }) { const { blocks, canToggleBlockVisibility } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockName, getBlocksByClientId } = select(store); const _blocks = getBlocksByClientId(clientIds); return { blocks: _blocks, canToggleBlockVisibility: _blocks.every( ({ clientId }) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)( getBlockName(clientId), "visibility", true ) ) }; }, [clientIds] ); const hasHiddenBlock = blocks.some( (block) => block.attributes.metadata?.blockVisibility === false ); const hasBlockVisibilityButtonShownRef = (0,external_wp_element_namespaceObject.useRef)(false); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (hasHiddenBlock) { hasBlockVisibilityButtonShownRef.current = true; } }, [hasHiddenBlock]); if (!hasHiddenBlock && !hasBlockVisibilityButtonShownRef.current) { return null; } const toggleBlockVisibility = () => { const attributesByClientId = Object.fromEntries( blocks?.map(({ clientId, attributes }) => [ clientId, { metadata: utils_cleanEmptyObject({ ...attributes?.metadata, blockVisibility: hasHiddenBlock ? void 0 : false }) } ]) ); updateBlockAttributes(clientIds, attributesByClientId, { uniqueByBlock: true }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { className: "block-editor-block-lock-toolbar", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { disabled: !canToggleBlockVisibility, icon: hasHiddenBlock ? unseen_default : seen_default, label: hasHiddenBlock ? (0,external_wp_i18n_namespaceObject.__)("Hidden") : (0,external_wp_i18n_namespaceObject.__)("Visible"), onClick: toggleBlockVisibility } ) }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/group.js var group_group_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: "M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/row.js var row_row_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 6.5h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4V16h5a.5.5 0 0 0 .5-.5v-7A.5.5 0 0 0 9 8H4V6.5Zm16 0h-5a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h5V16h-5a.5.5 0 0 1-.5-.5v-7A.5.5 0 0 1 15 8h5V6.5Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/stack.js var stack_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: "M17.5 4v5a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V4H8v5a.5.5 0 0 0 .5.5h7A.5.5 0 0 0 16 9V4h1.5Zm0 16v-5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v5H8v-5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v5h1.5Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/grid.js var grid_grid_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: "m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z", fillRule: "evenodd", clipRule: "evenodd" } ) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/toolbar.js const layouts = { group: { type: "constrained" }, row: { type: "flex", flexWrap: "nowrap" }, stack: { type: "flex", orientation: "vertical" }, grid: { type: "grid" } }; function BlockGroupToolbar() { const { blocksSelection, clientIds, groupingBlockName, isGroupable } = useConvertToGroupButtonProps(); const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { canRemove, variations } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { canRemoveBlocks } = select(store); const { getBlockVariations } = select(external_wp_blocks_namespaceObject.store); return { canRemove: canRemoveBlocks(clientIds), variations: getBlockVariations( groupingBlockName, "transform" ) }; }, [clientIds, groupingBlockName] ); const onConvertToGroup = (layout) => { const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)( blocksSelection, groupingBlockName ); if (typeof layout !== "string") { layout = "group"; } if (newBlocks && newBlocks.length > 0) { newBlocks[0].attributes.layout = layouts[layout]; replaceBlocks(clientIds, newBlocks); } }; const onConvertToRow = () => onConvertToGroup("row"); const onConvertToStack = () => onConvertToGroup("stack"); const onConvertToGrid = () => onConvertToGroup("grid"); if (!isGroupable || !canRemove) { return null; } const canInsertRow = !!variations.find( ({ name }) => name === "group-row" ); const canInsertStack = !!variations.find( ({ name }) => name === "group-stack" ); const canInsertGrid = !!variations.find( ({ name }) => name === "group-grid" ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { icon: group_group_default, label: (0,external_wp_i18n_namespaceObject._x)("Group", "action: convert blocks to group"), onClick: onConvertToGroup } ), canInsertRow && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { icon: row_row_default, label: (0,external_wp_i18n_namespaceObject._x)("Row", "action: convert blocks to row"), onClick: onConvertToRow } ), canInsertStack && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { icon: stack_default, label: (0,external_wp_i18n_namespaceObject._x)("Stack", "action: convert blocks to stack"), onClick: onConvertToStack } ), canInsertGrid && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { icon: grid_grid_default, label: (0,external_wp_i18n_namespaceObject._x)("Grid", "action: convert blocks to grid"), onClick: onConvertToGrid } ) ] }); } var toolbar_default = BlockGroupToolbar; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit-visually-button/index.js function BlockEditVisuallyButton({ clientIds }) { const clientId = clientIds.length === 1 ? clientIds[0] : void 0; const canEditVisually = (0,external_wp_data_namespaceObject.useSelect)( (select) => !!clientId && select(store).getBlockMode(clientId) === "html", [clientId] ); const { toggleBlockMode } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (!canEditVisually) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { onClick: () => { toggleBlockMode(clientId); }, children: (0,external_wp_i18n_namespaceObject.__)("Edit visually") } ) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/block-name-context.js const __unstableBlockNameContext = (0,external_wp_element_namespaceObject.createContext)(""); __unstableBlockNameContext.displayName = "__unstableBlockNameContext"; var block_name_context_default = __unstableBlockNameContext; ;// ./node_modules/@wordpress/block-editor/build-module/components/navigable-toolbar/index.js function hasOnlyToolbarItem(elements) { const dataProp = "toolbarItem"; return !elements.some((element) => !(dataProp in element.dataset)); } function getAllFocusableToolbarItemsIn(container) { return Array.from( container.querySelectorAll("[data-toolbar-item]:not([disabled])") ); } function hasFocusWithin(container) { return container.contains(container.ownerDocument.activeElement); } function focusFirstTabbableIn(container) { const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(container); if (firstTabbable) { firstTabbable.focus({ // When focusing newly mounted toolbars, // the position of the popover is often not right on the first render // This prevents the layout shifts when focusing the dialogs. preventScroll: true }); } } function useIsAccessibleToolbar(toolbarRef) { const initialAccessibleToolbarState = true; const [isAccessibleToolbar, setIsAccessibleToolbar] = (0,external_wp_element_namespaceObject.useState)( initialAccessibleToolbarState ); const determineIsAccessibleToolbar = (0,external_wp_element_namespaceObject.useCallback)(() => { const tabbables = external_wp_dom_namespaceObject.focus.tabbable.find(toolbarRef.current); const onlyToolbarItem = hasOnlyToolbarItem(tabbables); if (!onlyToolbarItem) { external_wp_deprecated_default()("Using custom components as toolbar controls", { since: "5.6", alternative: "ToolbarItem, ToolbarButton or ToolbarDropdownMenu components", link: "https://developer.wordpress.org/block-editor/components/toolbar-button/#inside-blockcontrols" }); } setIsAccessibleToolbar(onlyToolbarItem); }, [toolbarRef]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { const observer = new window.MutationObserver( determineIsAccessibleToolbar ); observer.observe(toolbarRef.current, { childList: true, subtree: true }); return () => observer.disconnect(); }, [determineIsAccessibleToolbar, isAccessibleToolbar, toolbarRef]); return isAccessibleToolbar; } function useToolbarFocus({ toolbarRef, focusOnMount, isAccessibleToolbar, defaultIndex, onIndexChange, shouldUseKeyboardFocusShortcut, focusEditorOnEscape }) { const [initialFocusOnMount] = (0,external_wp_element_namespaceObject.useState)(focusOnMount); const [initialIndex] = (0,external_wp_element_namespaceObject.useState)(defaultIndex); const focusToolbar = (0,external_wp_element_namespaceObject.useCallback)(() => { focusFirstTabbableIn(toolbarRef.current); }, [toolbarRef]); const focusToolbarViaShortcut = () => { if (shouldUseKeyboardFocusShortcut) { focusToolbar(); } }; (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/block-editor/focus-toolbar", focusToolbarViaShortcut); (0,external_wp_element_namespaceObject.useEffect)(() => { if (initialFocusOnMount) { focusToolbar(); } }, [isAccessibleToolbar, initialFocusOnMount, focusToolbar]); (0,external_wp_element_namespaceObject.useEffect)(() => { const navigableToolbarRef = toolbarRef.current; let raf = 0; if (!initialFocusOnMount && !hasFocusWithin(navigableToolbarRef)) { raf = window.requestAnimationFrame(() => { const items = getAllFocusableToolbarItemsIn(navigableToolbarRef); const index = initialIndex || 0; if (items[index] && hasFocusWithin(navigableToolbarRef)) { items[index].focus({ // When focusing newly mounted toolbars, // the position of the popover is often not right on the first render // This prevents the layout shifts when focusing the dialogs. preventScroll: true }); } }); } return () => { window.cancelAnimationFrame(raf); if (!onIndexChange || !navigableToolbarRef) { return; } const items = getAllFocusableToolbarItemsIn(navigableToolbarRef); const index = items.findIndex((item) => item.tabIndex === 0); onIndexChange(index); }; }, [initialIndex, initialFocusOnMount, onIndexChange, toolbarRef]); const { getLastFocus } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); (0,external_wp_element_namespaceObject.useEffect)(() => { const navigableToolbarRef = toolbarRef.current; if (focusEditorOnEscape) { const handleKeyDown = (event) => { const lastFocus = getLastFocus(); if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && lastFocus?.current) { event.preventDefault(); lastFocus.current.focus(); } }; navigableToolbarRef.addEventListener("keydown", handleKeyDown); return () => { navigableToolbarRef.removeEventListener( "keydown", handleKeyDown ); }; } }, [focusEditorOnEscape, getLastFocus, toolbarRef]); } function NavigableToolbar({ children, focusOnMount, focusEditorOnEscape = false, shouldUseKeyboardFocusShortcut = true, __experimentalInitialIndex: initialIndex, __experimentalOnIndexChange: onIndexChange, orientation = "horizontal", ...props }) { const toolbarRef = (0,external_wp_element_namespaceObject.useRef)(); const isAccessibleToolbar = useIsAccessibleToolbar(toolbarRef); useToolbarFocus({ toolbarRef, focusOnMount, defaultIndex: initialIndex, onIndexChange, isAccessibleToolbar, shouldUseKeyboardFocusShortcut, focusEditorOnEscape }); if (isAccessibleToolbar) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Toolbar, { label: props["aria-label"], ref: toolbarRef, orientation, ...props, children } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.NavigableMenu, { orientation, role: "toolbar", ref: toolbarRef, ...props, children } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/use-has-block-toolbar.js function useHasBlockToolbar() { const enabled = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getBlockEditingMode, getBlockName, getBlockSelectionStart } = select(store); const selectedBlockClientId = getBlockSelectionStart(); const blockType = selectedBlockClientId && (0,external_wp_blocks_namespaceObject.getBlockType)(getBlockName(selectedBlockClientId)); return blockType && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "__experimentalToolbar", true) && getBlockEditingMode(selectedBlockClientId) !== "disabled"; }, []); return enabled; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/change-design.js const change_design_EMPTY_ARRAY = []; const MAX_PATTERNS_TO_SHOW = 6; const change_design_POPOVER_PROPS = { placement: "bottom-start" }; function ChangeDesign({ clientId }) { const { categories, currentPatternName, patterns } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockAttributes, getBlockRootClientId, __experimentalGetAllowedPatterns } = select(store); const attributes = getBlockAttributes(clientId); const _categories = attributes?.metadata?.categories || change_design_EMPTY_ARRAY; const rootBlock = getBlockRootClientId(clientId); const _patterns = _categories.length > 0 ? __experimentalGetAllowedPatterns(rootBlock) : change_design_EMPTY_ARRAY; return { categories: _categories, currentPatternName: attributes?.metadata?.patternName, patterns: _patterns }; }, [clientId] ); const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); const sameCategoryPatternsWithSingleWrapper = (0,external_wp_element_namespaceObject.useMemo)(() => { if (categories.length === 0 || !patterns || patterns.length === 0) { return change_design_EMPTY_ARRAY; } return patterns.filter((pattern) => { const isCorePattern = pattern.source === "core" || pattern.source?.startsWith("pattern-directory") && pattern.source !== "pattern-directory/theme"; return ( // Check if the pattern has only one top level block, // otherwise we may switch to a pattern that doesn't have replacement suggestions. pattern.blocks.length === 1 && // We exclude the core patterns and pattern directory patterns that are not theme patterns. !isCorePattern && // Exclude current pattern. currentPatternName !== pattern.name && pattern.categories?.some((category) => { return categories.includes(category); }) && // Check if the pattern is not a synced pattern. (pattern.syncStatus === "unsynced" || !pattern.id) ); }).slice(0, MAX_PATTERNS_TO_SHOW); }, [categories, currentPatternName, patterns]); if (sameCategoryPatternsWithSingleWrapper.length < 2) { return null; } const onClickPattern = (pattern) => { const newBlocks = (pattern.blocks ?? []).map((block) => { return (0,external_wp_blocks_namespaceObject.cloneBlock)(block); }); newBlocks[0].attributes.metadata = { ...newBlocks[0].attributes.metadata, categories }; replaceBlocks(clientId, newBlocks); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps: change_design_POPOVER_PROPS, renderToggle: ({ onToggle, isOpen }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { onClick: () => onToggle(!isOpen), "aria-expanded": isOpen, children: (0,external_wp_i18n_namespaceObject.__)("Change design") } ) }); }, renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { className: "block-editor-block-toolbar-change-design-content-wrapper", paddingSize: "none", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_patterns_list_default, { blockPatterns: sameCategoryPatternsWithSingleWrapper, onClickPattern, showTitlesAsTooltip: true } ) } ) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/switch-section-style.js const styleIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", "aria-hidden": "true", focusable: "false", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_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-3z" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Path, { stroke: "currentColor", strokeWidth: "1.5", 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-3z" } ) ] } ); function SwitchSectionStyle({ clientId }) { const { stylesToRender, activeStyle, className } = useStylesForBlocks({ clientId }); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { merged: mergedConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); const { globalSettings, globalStyles, blockName } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const settings = select(store).getSettings(); return { globalSettings: settings.__experimentalFeatures, globalStyles: settings[globalStylesDataKey], blockName: select(store).getBlockName(clientId) }; }, [clientId] ); const activeStyleBackground = activeStyle?.name ? getVariationStylesWithRefValues( { settings: mergedConfig?.settings ?? globalSettings, styles: mergedConfig?.styles ?? globalStyles }, blockName, activeStyle.name )?.color?.background : void 0; if (!stylesToRender || stylesToRender.length === 0) { return null; } const handleStyleSwitch = () => { const currentIndex = stylesToRender.findIndex( (style) => style.name === activeStyle.name ); const nextIndex = (currentIndex + 1) % stylesToRender.length; const nextStyle = stylesToRender[nextIndex]; const styleClassName = replaceActiveStyle( className, activeStyle, nextStyle ); updateBlockAttributes(clientId, { className: styleClassName }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { onClick: handleStyleSwitch, label: (0,external_wp_i18n_namespaceObject.__)("Shuffle styles"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Icon, { icon: styleIcon, style: { fill: activeStyleBackground || "transparent" } } ) } ) }); } var switch_section_style_default = SwitchSectionStyle; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/index.js function PrivateBlockToolbar({ hideDragHandle, focusOnMount, __experimentalInitialIndex, __experimentalOnIndexChange, variant = "unstyled" }) { const { blockClientId, blockClientIds, isDefaultEditingMode, blockType, toolbarKey, shouldShowVisualToolbar, showParentSelector, isUsingBindings, hasParentPattern, hasContentOnlyLocking, showShuffleButton, showSlots, showGroupButtons, showLockButtons, showBlockVisibilityButton, showSwitchSectionStyleButton } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getBlockName, getBlockMode, getBlockParents, getSelectedBlockClientIds, isBlockValid, getBlockEditingMode, getBlockAttributes, getBlockParentsByBlockName, getTemplateLock, getParentSectionBlock, isZoomOut, isSectionBlock } = unlock(select(store)); const selectedBlockClientIds = getSelectedBlockClientIds(); const selectedBlockClientId = selectedBlockClientIds[0]; const parents = getBlockParents(selectedBlockClientId); const parentSection = getParentSectionBlock(selectedBlockClientId); const parentClientId = parentSection ?? parents[parents.length - 1]; const parentBlockName = getBlockName(parentClientId); const parentBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName); const editingMode = getBlockEditingMode(selectedBlockClientId); const _isDefaultEditingMode = editingMode === "default"; const _blockName = getBlockName(selectedBlockClientId); const isValid = selectedBlockClientIds.every( (id) => isBlockValid(id) ); const isVisual = selectedBlockClientIds.every( (id) => getBlockMode(id) === "visual" ); const _isUsingBindings = selectedBlockClientIds.every( (clientId) => !!getBlockAttributes(clientId)?.metadata?.bindings ); const _hasParentPattern = selectedBlockClientIds.every( (clientId) => getBlockParentsByBlockName(clientId, "core/block", true).length > 0 ); const _hasTemplateLock = selectedBlockClientIds.some( (id) => getTemplateLock(id) === "contentOnly" ); const _isZoomOut = isZoomOut(); const _showSwitchSectionStyleButton = window?.__experimentalContentOnlyPatternInsertion && (_isZoomOut || isSectionBlock(selectedBlockClientId)); return { blockClientId: selectedBlockClientId, blockClientIds: selectedBlockClientIds, isDefaultEditingMode: _isDefaultEditingMode, blockType: selectedBlockClientId && (0,external_wp_blocks_namespaceObject.getBlockType)(_blockName), shouldShowVisualToolbar: isValid && isVisual, toolbarKey: `${selectedBlockClientId}${parentClientId}`, showParentSelector: !_isZoomOut && parentBlockType && editingMode !== "contentOnly" && getBlockEditingMode(parentClientId) !== "disabled" && (0,external_wp_blocks_namespaceObject.hasBlockSupport)( parentBlockType, "__experimentalParentSelector", true ) && selectedBlockClientIds.length === 1, isUsingBindings: _isUsingBindings, hasParentPattern: _hasParentPattern, hasContentOnlyLocking: _hasTemplateLock, showShuffleButton: _isZoomOut, showSlots: !_isZoomOut, showGroupButtons: !_isZoomOut, showLockButtons: !_isZoomOut, showBlockVisibilityButton: !_isZoomOut, showSwitchSectionStyleButton: _showSwitchSectionStyleButton }; }, []); const toolbarWrapperRef = (0,external_wp_element_namespaceObject.useRef)(null); const nodeRef = (0,external_wp_element_namespaceObject.useRef)(); const showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures({ ref: nodeRef }); const isLargeViewport = !(0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const hasBlockToolbar = useHasBlockToolbar(); if (!hasBlockToolbar) { return null; } const isMultiToolbar = blockClientIds.length > 1; const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType) || (0,external_wp_blocks_namespaceObject.isTemplatePart)(blockType); const classes = dist_clsx("block-editor-block-contextual-toolbar", { "has-parent": showParentSelector }); const innerClasses = dist_clsx("block-editor-block-toolbar", { "is-synced": isSynced, "is-connected": isUsingBindings }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( NavigableToolbar, { focusEditorOnEscape: true, className: classes, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Block tools"), variant: variant === "toolbar" ? void 0 : variant, focusOnMount, __experimentalInitialIndex, __experimentalOnIndexChange, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: toolbarWrapperRef, className: innerClasses, children: [ showParentSelector && !isMultiToolbar && isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockParentSelector, {}), (shouldShowVisualToolbar || isMultiToolbar) && !hasParentPattern && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { ref: nodeRef, ...showHoveredOrFocusedGestures, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { className: "block-editor-block-toolbar__block-controls", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_switcher_default, { clientIds: blockClientIds }), isDefaultEditingMode && showBlockVisibilityButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockVisibilityToolbar, { clientIds: blockClientIds } ), !isMultiToolbar && isDefaultEditingMode && showLockButtons && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockLockToolbar, { clientId: blockClientId } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_mover_default, { clientIds: blockClientIds, hideDragHandle } ) ] }) } ), !hasContentOnlyLocking && shouldShowVisualToolbar && isMultiToolbar && showGroupButtons && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(toolbar_default, {}), showShuffleButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ChangeDesign, { clientId: blockClientIds[0] }), showSwitchSectionStyleButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(switch_section_style_default, { clientId: blockClientIds[0] }), shouldShowVisualToolbar && showSlots && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_controls_default.Slot, { group: "parent", className: "block-editor-block-toolbar__slot" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_controls_default.Slot, { group: "block", className: "block-editor-block-toolbar__slot" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default.Slot, { className: "block-editor-block-toolbar__slot" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_controls_default.Slot, { group: "inline", className: "block-editor-block-toolbar__slot" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_controls_default.Slot, { group: "other", className: "block-editor-block-toolbar__slot" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_name_context_default.Provider, { value: blockType?.name, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_toolbar_last_item_default.Slot, {}) } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEditVisuallyButton, { clientIds: blockClientIds }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_settings_menu_default, { clientIds: blockClientIds }) ] }) }, toolbarKey ); } function BlockToolbar({ hideDragHandle, variant }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivateBlockToolbar, { hideDragHandle, variant, focusOnMount: void 0, __experimentalInitialIndex: void 0, __experimentalOnIndexChange: void 0 } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-toolbar-popover.js function BlockToolbarPopover({ clientId, isTyping, __unstableContentRef }) { const { capturingClientId, isInsertionPointVisible, lastClientId } = useSelectedBlockToolProps(clientId); const initialToolbarItemIndexRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { initialToolbarItemIndexRef.current = void 0; }, [clientId]); const { stopTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store); const isToolbarForcedRef = (0,external_wp_element_namespaceObject.useRef)(false); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/block-editor/focus-toolbar", () => { isToolbarForcedRef.current = true; stopTyping(true); }); (0,external_wp_element_namespaceObject.useEffect)(() => { isToolbarForcedRef.current = false; }); const clientIdToPositionOver = capturingClientId || clientId; const popoverProps = useBlockToolbarPopoverProps({ contentElement: __unstableContentRef?.current, clientId: clientIdToPositionOver }); return !isTyping && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivateBlockPopover, { clientId: clientIdToPositionOver, bottomClientId: lastClientId, className: dist_clsx("block-editor-block-list__block-popover", { "is-insertion-point-visible": isInsertionPointVisible }), resize: false, ...popoverProps, __unstableContentRef, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivateBlockToolbar, { focusOnMount: isToolbarForcedRef.current, __experimentalInitialIndex: initialToolbarItemIndexRef.current, __experimentalOnIndexChange: (index) => { initialToolbarItemIndexRef.current = index; }, variant: "toolbar" } ) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/zoom-out-mode-inserter-button.js function ZoomOutModeInserterButton({ onClick }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "primary", icon: plus_default, size: "compact", className: dist_clsx( "block-editor-button-pattern-inserter__button", "block-editor-block-tools__zoom-out-mode-inserter-button" ), onClick, label: (0,external_wp_i18n_namespaceObject._x)( "Add pattern", "Generic label for pattern inserter button" ) } ); } var zoom_out_mode_inserter_button_default = ZoomOutModeInserterButton; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/zoom-out-mode-inserters.js function ZoomOutModeInserters() { const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false); const { hasSelection, blockOrder, setInserterIsOpened, sectionRootClientId, selectedBlockClientId, blockInsertionPoint, insertionPointVisible } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSettings, getBlockOrder, getSelectionStart, getSelectedBlockClientId, getSectionRootClientId, getBlockInsertionPoint, isBlockInsertionPointVisible } = unlock(select(store)); const root = getSectionRootClientId(); return { hasSelection: !!getSelectionStart().clientId, blockOrder: getBlockOrder(root), sectionRootClientId: root, setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened, selectedBlockClientId: getSelectedBlockClientId(), blockInsertionPoint: getBlockInsertionPoint(), insertionPointVisible: isBlockInsertionPointVisible() }; }, []); const { showInsertionPoint } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); (0,external_wp_element_namespaceObject.useEffect)(() => { const timeout = setTimeout(() => { setIsReady(true); }, 500); return () => { clearTimeout(timeout); }; }, []); if (!isReady || !hasSelection) { return null; } const previousClientId = selectedBlockClientId; const index = blockOrder.findIndex( (clientId) => selectedBlockClientId === clientId ); const insertionIndex = index + 1; const nextClientId = blockOrder[insertionIndex]; if (insertionPointVisible && blockInsertionPoint?.index === insertionIndex) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inbetween_default, { previousClientId, nextClientId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( zoom_out_mode_inserter_button_default, { onClick: () => { setInserterIsOpened({ rootClientId: sectionRootClientId, insertionIndex, tab: "patterns", category: "all" }); showInsertionPoint(sectionRootClientId, insertionIndex, { operation: "insert" }); } } ) } ); } var zoom_out_mode_inserters_default = ZoomOutModeInserters; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-show-block-tools.js function useShowBlockTools() { return (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSelectedBlockClientId, getFirstMultiSelectedBlockClientId, getBlock, getBlockMode, getSettings, isTyping, isBlockInterfaceHidden } = unlock(select(store)); const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId(); const block = getBlock(clientId); const hasSelectedBlock = !!clientId && !!block; const isEmptyDefaultBlock = hasSelectedBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block, "content") && getBlockMode(clientId) !== "html"; const _showEmptyBlockSideInserter = clientId && !isTyping() && isEmptyDefaultBlock; const _showBlockToolbarPopover = !isBlockInterfaceHidden() && !getSettings().hasFixedToolbar && !_showEmptyBlockSideInserter && hasSelectedBlock && !isEmptyDefaultBlock; return { showEmptyBlockSideInserter: _showEmptyBlockSideInserter, showBlockToolbarPopover: _showBlockToolbarPopover }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/index.js function block_tools_selector(select) { const { getSelectedBlockClientId, getFirstMultiSelectedBlockClientId, getSettings, isTyping, isDragging, isZoomOut } = unlock(select(store)); const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId(); return { clientId, hasFixedToolbar: getSettings().hasFixedToolbar, isTyping: isTyping(), isZoomOutMode: isZoomOut(), isDragging: isDragging() }; } function BlockTools({ children, __unstableContentRef, ...props }) { const { clientId, hasFixedToolbar, isTyping, isZoomOutMode, isDragging } = (0,external_wp_data_namespaceObject.useSelect)(block_tools_selector, []); const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); const { getBlocksByClientId, getSelectedBlockClientIds, getBlockRootClientId, isGroupable, getBlockName } = (0,external_wp_data_namespaceObject.useSelect)(store); const { getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const { showEmptyBlockSideInserter, showBlockToolbarPopover } = useShowBlockTools(); const pasteStyles = usePasteStyles(); const { duplicateBlocks, removeBlocks, replaceBlocks, insertAfterBlock, insertBeforeBlock, selectBlock, moveBlocksUp, moveBlocksDown, expandBlock, updateBlockAttributes } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); function onKeyDown(event) { if (event.defaultPrevented) { return; } if (isMatch("core/block-editor/move-up", event) || isMatch("core/block-editor/move-down", event)) { const clientIds = getSelectedBlockClientIds(); if (clientIds.length) { event.preventDefault(); const rootClientId = getBlockRootClientId(clientIds[0]); const direction = isMatch("core/block-editor/move-up", event) ? "up" : "down"; if (direction === "up") { moveBlocksUp(clientIds, rootClientId); } else { moveBlocksDown(clientIds, rootClientId); } const blockLength = Array.isArray(clientIds) ? clientIds.length : 1; const message = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: the name of the block that has been moved (0,external_wp_i18n_namespaceObject._n)( "%d block moved.", "%d blocks moved.", clientIds.length ), blockLength ); (0,external_wp_a11y_namespaceObject.speak)(message); } } else if (isMatch("core/block-editor/duplicate", event)) { const clientIds = getSelectedBlockClientIds(); if (clientIds.length) { event.preventDefault(); duplicateBlocks(clientIds); } } else if (isMatch("core/block-editor/remove", event)) { const clientIds = getSelectedBlockClientIds(); if (clientIds.length) { event.preventDefault(); removeBlocks(clientIds); } } else if (isMatch("core/block-editor/paste-styles", event)) { const clientIds = getSelectedBlockClientIds(); if (clientIds.length) { event.preventDefault(); const blocks = getBlocksByClientId(clientIds); pasteStyles(blocks); } } else if (isMatch("core/block-editor/insert-after", event)) { const clientIds = getSelectedBlockClientIds(); if (clientIds.length) { event.preventDefault(); insertAfterBlock(clientIds[clientIds.length - 1]); } } else if (isMatch("core/block-editor/insert-before", event)) { const clientIds = getSelectedBlockClientIds(); if (clientIds.length) { event.preventDefault(); insertBeforeBlock(clientIds[0]); } } else if (isMatch("core/block-editor/unselect", event)) { if (event.target.closest("[role=toolbar]")) { return; } const clientIds = getSelectedBlockClientIds(); if (clientIds.length > 1) { event.preventDefault(); selectBlock(clientIds[0]); } } else if (isMatch("core/block-editor/collapse-list-view", event)) { if ((0,external_wp_dom_namespaceObject.isTextField)(event.target) || (0,external_wp_dom_namespaceObject.isTextField)( event.target?.contentWindow?.document?.activeElement )) { return; } event.preventDefault(); expandBlock(clientId); } else if (isMatch("core/block-editor/group", event)) { const clientIds = getSelectedBlockClientIds(); if (clientIds.length > 1 && isGroupable(clientIds)) { event.preventDefault(); const blocks = getBlocksByClientId(clientIds); const groupingBlockName = getGroupingBlockName(); const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)( blocks, groupingBlockName ); replaceBlocks(clientIds, newBlocks); (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("Selected blocks are grouped.")); } } else if (isMatch("core/block-editor/toggle-block-visibility", event)) { const clientIds = getSelectedBlockClientIds(); if (clientIds.length) { event.preventDefault(); const blocks = getBlocksByClientId(clientIds); const canToggleBlockVisibility = blocks.every( (block) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)( getBlockName(block.clientId), "visibility", true ) ); if (!canToggleBlockVisibility) { return; } const hasHiddenBlock = blocks.some( (block) => block.attributes.metadata?.blockVisibility === false ); const attributesByClientId = Object.fromEntries( blocks.map(({ clientId: mapClientId, attributes }) => [ mapClientId, { metadata: utils_cleanEmptyObject({ ...attributes?.metadata, blockVisibility: hasHiddenBlock ? void 0 : false }) } ]) ); updateBlockAttributes(clientIds, attributesByClientId, { uniqueByBlock: true }); } } } const blockToolbarRef = use_popover_scroll_default(__unstableContentRef); const blockToolbarAfterRef = use_popover_scroll_default(__unstableContentRef); return ( // eslint-disable-next-line jsx-a11y/no-static-element-interactions /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { ...props, onKeyDown, className: dist_clsx(props.className, { "block-editor-block-tools--is-dragging": isDragging }), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(InsertionPointOpenRef.Provider, { value: (0,external_wp_element_namespaceObject.useRef)(false), children: [ !isTyping && !isZoomOutMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( InsertionPoint, { __unstableContentRef } ), showEmptyBlockSideInserter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EmptyBlockInserter, { __unstableContentRef, clientId } ), showBlockToolbarPopover && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockToolbarPopover, { __unstableContentRef, clientId, isTyping } ), !isZoomOutMode && !hasFixedToolbar && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Popover.Slot, { name: "block-toolbar", ref: blockToolbarRef } ), children, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Popover.Slot, { name: "__unstable-block-tools-after", ref: blockToolbarAfterRef } ), isZoomOutMode && !isDragging && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( zoom_out_mode_inserters_default, { __unstableContentRef } ) ] }) } ) ); } ;// external ["wp","commands"] const external_wp_commands_namespaceObject = window["wp"]["commands"]; ;// ./node_modules/@wordpress/icons/build-module/library/ungroup.js var ungroup_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 4h-7c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5h-7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7zm-5 5c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h1V9H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-1h-1.5v1z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/trash.js var trash_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/use-block-commands/index.js const getTransformCommands = () => function useTransformCommands() { const { replaceBlocks, multiSelect } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { blocks, clientIds, canRemove, possibleBlockTransformations, invalidSelection } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getBlockRootClientId, getBlockTransformItems, getSelectedBlockClientIds, getBlocksByClientId, canRemoveBlocks } = select(store); const selectedBlockClientIds = getSelectedBlockClientIds(); const selectedBlocks = getBlocksByClientId( selectedBlockClientIds ); if (selectedBlocks.filter((block) => !block).length > 0) { return { invalidSelection: true }; } const rootClientId = getBlockRootClientId( selectedBlockClientIds[0] ); return { blocks: selectedBlocks, clientIds: selectedBlockClientIds, possibleBlockTransformations: getBlockTransformItems( selectedBlocks, rootClientId ), canRemove: canRemoveBlocks(selectedBlockClientIds), invalidSelection: false }; }, []); if (invalidSelection) { return { isLoading: false, commands: [] }; } const isTemplate = blocks.length === 1 && (0,external_wp_blocks_namespaceObject.isTemplatePart)(blocks[0]); function selectForMultipleBlocks(insertedBlocks) { if (insertedBlocks.length > 1) { multiSelect( insertedBlocks[0].clientId, insertedBlocks[insertedBlocks.length - 1].clientId ); } } function onBlockTransform(name) { const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, name); replaceBlocks(clientIds, newBlocks); selectForMultipleBlocks(newBlocks); } const hasPossibleBlockTransformations = !!possibleBlockTransformations.length && canRemove && !isTemplate; if (!clientIds || clientIds.length < 1 || !hasPossibleBlockTransformations) { return { isLoading: false, commands: [] }; } const commands = possibleBlockTransformations.map( (transformation) => { const { name, title, icon } = transformation; return { name: "core/block-editor/transform-to-" + name.replace("/", "-"), /* translators: %s: Block or block variation name. */ label: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Transform to %s"), title), icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon }), callback: ({ close }) => { onBlockTransform(name); close(); } }; } ); return { isLoading: false, commands }; }; const getQuickActionsCommands = () => function useQuickActionsCommands() { const { clientIds, isUngroupable, isGroupable } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getSelectedBlockClientIds, isUngroupable: _isUngroupable, isGroupable: _isGroupable } = select(store); const selectedBlockClientIds = getSelectedBlockClientIds(); return { clientIds: selectedBlockClientIds, isUngroupable: _isUngroupable(), isGroupable: _isGroupable() }; }, [] ); const { canInsertBlockType, getBlockRootClientId, getBlocksByClientId, canRemoveBlocks, getBlockName } = (0,external_wp_data_namespaceObject.useSelect)(store); const { getDefaultBlockName, getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const blocks = getBlocksByClientId(clientIds); const { removeBlocks, replaceBlocks, duplicateBlocks, insertAfterBlock, insertBeforeBlock, updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const onGroup = () => { if (!blocks.length) { return; } const groupingBlockName = getGroupingBlockName(); const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, groupingBlockName); if (!newBlocks) { return; } replaceBlocks(clientIds, newBlocks); }; const onUngroup = () => { if (!blocks.length) { return; } const innerBlocks = blocks[0].innerBlocks; if (!innerBlocks.length) { return; } replaceBlocks(clientIds, innerBlocks); }; if (!clientIds || clientIds.length < 1) { return { isLoading: false, commands: [] }; } const rootClientId = getBlockRootClientId(clientIds[0]); const canInsertDefaultBlock = canInsertBlockType( getDefaultBlockName(), rootClientId ); const canDuplicate = blocks.every((block) => { return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "multiple", true) && canInsertBlockType(block.name, rootClientId); }); const canRemove = canRemoveBlocks(clientIds); const canToggleBlockVisibility = blocks.every( ({ clientId }) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(getBlockName(clientId), "visibility", true) ); const commands = []; if (canDuplicate) { commands.push({ name: "duplicate", label: (0,external_wp_i18n_namespaceObject.__)("Duplicate"), callback: () => duplicateBlocks(clientIds, true), icon: copy_default }); } if (canInsertDefaultBlock) { commands.push( { name: "add-before", label: (0,external_wp_i18n_namespaceObject.__)("Add before"), callback: () => { const clientId = Array.isArray(clientIds) ? clientIds[0] : clientId; insertBeforeBlock(clientId); }, icon: plus_default }, { name: "add-after", label: (0,external_wp_i18n_namespaceObject.__)("Add after"), callback: () => { const clientId = Array.isArray(clientIds) ? clientIds[clientIds.length - 1] : clientId; insertAfterBlock(clientId); }, icon: plus_default } ); } if (isGroupable) { commands.push({ name: "Group", label: (0,external_wp_i18n_namespaceObject.__)("Group"), callback: onGroup, icon: group_group_default }); } if (isUngroupable) { commands.push({ name: "ungroup", label: (0,external_wp_i18n_namespaceObject.__)("Ungroup"), callback: onUngroup, icon: ungroup_default }); } if (canRemove) { commands.push({ name: "remove", label: (0,external_wp_i18n_namespaceObject.__)("Delete"), callback: () => removeBlocks(clientIds, true), icon: trash_default }); } if (canToggleBlockVisibility) { const hasHiddenBlock = blocks.some( (block) => block.attributes.metadata?.blockVisibility === false ); commands.push({ name: "core/toggle-block-visibility", label: hasHiddenBlock ? (0,external_wp_i18n_namespaceObject.__)("Show") : (0,external_wp_i18n_namespaceObject.__)("Hide"), callback: () => { const attributesByClientId = Object.fromEntries( blocks?.map(({ clientId, attributes }) => [ clientId, { metadata: utils_cleanEmptyObject({ ...attributes?.metadata, blockVisibility: hasHiddenBlock ? void 0 : false }) } ]) ); updateBlockAttributes(clientIds, attributesByClientId, { uniqueByBlock: true }); }, icon: hasHiddenBlock ? seen_default : unseen_default }); } return { isLoading: false, commands: commands.map((command) => ({ ...command, name: "core/block-editor/action-" + command.name, callback: ({ close }) => { command.callback(); close(); } })) }; }; const useBlockCommands = () => { (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: "core/block-editor/blockTransforms", hook: getTransformCommands() }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: "core/block-editor/blockQuickActions", hook: getQuickActionsCommands(), context: "block-selection-edit" }); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-canvas/index.js const EDITOR_STYLE_TRANSFORM_OPTIONS = { // Don't transform selectors that already specify `.editor-styles-wrapper`. ignoredSelectors: [/\.editor-styles-wrapper/gi] }; function ExperimentalBlockCanvas({ shouldIframe = true, height = "300px", children = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockList, {}), styles, contentRef: contentRefProp, iframeProps }) { useBlockCommands(); const isTabletViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const resetTypingRef = useMouseMoveTypingReset(); const clearerRef = useBlockSelectionClearer(); const localRef = (0,external_wp_element_namespaceObject.useRef)(); const contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([contentRefProp, clearerRef, localRef]); const zoomLevel = (0,external_wp_data_namespaceObject.useSelect)( (select) => unlock(select(store)).getZoomLevel(), [] ); const zoomOutIframeProps = zoomLevel !== 100 && !isTabletViewport ? { scale: zoomLevel, frameSize: "40px" } : {}; if (!shouldIframe) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( BlockTools, { __unstableContentRef: localRef, style: { height, display: "flex" }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( editor_styles_default, { styles, scope: ":where(.editor-styles-wrapper)", transformOptions: EDITOR_STYLE_TRANSFORM_OPTIONS } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( writing_flow_default, { ref: contentRef, className: "editor-styles-wrapper", tabIndex: -1, style: { height: "100%", width: "100%" }, children } ) ] } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockTools, { __unstableContentRef: localRef, style: { height, display: "flex" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( iframe_default, { ...iframeProps, ...zoomOutIframeProps, ref: resetTypingRef, contentRef, style: { ...iframeProps?.style }, name: "editor-canvas", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles_default, { styles }), children ] } ) } ); } function BlockCanvas({ children, height, styles }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockCanvas, { height, styles, children }); } var block_canvas_default = BlockCanvas; ;// ./node_modules/@wordpress/block-editor/build-module/components/color-style-selector/index.js const ColorSelectorSVGIcon = () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z" }) }); const ColorSelectorIcon = ({ style, className }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-library-colors-selector__icon-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: `${className} block-library-colors-selector__state-selection`, style, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorSelectorSVGIcon, {}) } ) }); }; const renderToggleComponent = ({ TextColor, BackgroundColor }) => ({ onToggle, isOpen }) => { const openOnArrowDown = (event) => { if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { event.preventDefault(); onToggle(); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { className: "components-toolbar__control block-library-colors-selector__toggle", label: (0,external_wp_i18n_namespaceObject.__)("Open Colors Selector"), onClick: onToggle, onKeyDown: openOnArrowDown, icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundColor, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TextColor, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorSelectorIcon, {}) }) }) } ) }); }; const BlockColorsStyleSelector = ({ children, ...other }) => { external_wp_deprecated_default()(`wp.blockEditor.BlockColorsStyleSelector`, { alternative: "block supports API", since: "6.1", version: "6.3" }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps: { placement: "bottom-start" }, className: "block-library-colors-selector", contentClassName: "block-library-colors-selector__popover", renderToggle: renderToggleComponent(other), renderContent: () => children } ); }; var color_style_selector_default = BlockColorsStyleSelector; ;// ./node_modules/@wordpress/icons/build-module/library/list-view.js var list_view_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 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/context.js const ListViewContext = (0,external_wp_element_namespaceObject.createContext)({}); ListViewContext.displayName = "ListViewContext"; const useListViewContext = () => (0,external_wp_element_namespaceObject.useContext)(ListViewContext); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/aria-referenced-text.js function AriaReferencedText({ children, ...props }) { const ref = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { if (ref.current) { ref.current.textContent = ref.current.textContent; } }, [children]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { hidden: true, ...props, ref, children }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/appender.js const Appender = (0,external_wp_element_namespaceObject.forwardRef)( ({ nestingLevel, blockCount, clientId, ...props }, ref) => { const { insertedBlock, setInsertedBlock } = useListViewContext(); const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Appender); const { directInsert, hideInserter } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockListSettings, getTemplateLock, isZoomOut } = unlock(select(store)); const settings = getBlockListSettings(clientId); const directInsertValue = settings?.directInsert || false; const hideInserterValue = !!getTemplateLock(clientId) || isZoomOut(); return { directInsert: directInsertValue, hideInserter: hideInserterValue }; }, [clientId] ); const blockTitle = useBlockDisplayTitle({ clientId, context: "list-view" }); const insertedBlockTitle = useBlockDisplayTitle({ clientId: insertedBlock?.clientId, context: "list-view" }); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!insertedBlockTitle?.length) { return; } (0,external_wp_a11y_namespaceObject.speak)( (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: name of block being inserted (i.e. Paragraph, Image, Group etc) (0,external_wp_i18n_namespaceObject.__)("%s block inserted"), insertedBlockTitle ), "assertive" ); }, [insertedBlockTitle]); if (hideInserter) { return null; } const descriptionId = `list-view-appender__${instanceId}`; const description = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: The name of the block. 2: The numerical position of the block. 3: The level of nesting for the block. */ (0,external_wp_i18n_namespaceObject.__)("Append to %1$s block at position %2$d, Level %3$d"), blockTitle, blockCount + 1, nestingLevel ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "list-view-appender", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inserter_default, { ref, rootClientId: clientId, position: "bottom right", isAppender: true, selectBlockOnInsert: false, shouldDirectInsert: directInsert, __experimentalIsQuick: true, ...props, toggleProps: { "aria-describedby": descriptionId }, onSelectOrClose: (maybeInsertedBlock) => { if (maybeInsertedBlock?.clientId) { setInsertedBlock(maybeInsertedBlock); } } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AriaReferencedText, { id: descriptionId, children: description }) ] }); } ); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/leaf.js const AnimatedTreeGridRow = dist_esm_it(external_wp_components_namespaceObject.__experimentalTreeGridRow); const ListViewLeaf = (0,external_wp_element_namespaceObject.forwardRef)( ({ isDragged, isSelected, position, level, rowCount, children, className, path, ...props }, ref) => { const animationRef = use_moving_animation_default({ clientId: props["data-block"], enableAnimation: true, triggerAnimationOnChange: path }); const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, animationRef]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AnimatedTreeGridRow, { ref: mergedRef, className: dist_clsx("block-editor-list-view-leaf", className), level, positionInSet: position, setSize: rowCount, isExpanded: void 0, ...props, children } ); } ); var leaf_default = ListViewLeaf; ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-scroll-into-view.js function useListViewScrollIntoView({ isSelected, selectedClientIds, rowItemRef }) { const isSingleSelection = selectedClientIds.length === 1; (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!isSelected || !isSingleSelection || !rowItemRef.current) { return; } const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(rowItemRef.current); const { ownerDocument } = rowItemRef.current; const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement; if (windowScroll || !scrollContainer) { return; } const rowRect = rowItemRef.current.getBoundingClientRect(); const scrollContainerRect = scrollContainer.getBoundingClientRect(); if (rowRect.top < scrollContainerRect.top || rowRect.bottom > scrollContainerRect.bottom) { rowItemRef.current.scrollIntoView(); } }, [isSelected, isSingleSelection, rowItemRef]); } ;// ./node_modules/@wordpress/icons/build-module/library/pin-small.js var pin_small_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.97 10.159a3.382 3.382 0 0 0-2.857.955l1.724 1.723-2.836 2.913L7 17h1.25l2.913-2.837 1.723 1.723a3.38 3.38 0 0 0 .606-.825c.33-.63.446-1.343.35-2.032L17 10.695 13.305 7l-2.334 3.159Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/lock-small.js var lock_small_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, { fillRule: "evenodd", clipRule: "evenodd", d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z" } ) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/expander.js function ListViewExpander({ onClick }) { return ( // Keyboard events are handled by TreeGrid see: components/src/tree-grid/index.js // // The expander component is implemented as a pseudo element in the w3 example // https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html // // We've mimicked this by adding an icon with aria-hidden set to true to hide this from the accessibility tree. // For the current tree grid implementation, please do not try to make this a button. // // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { className: "block-editor-list-view__expander", onClick: (event) => onClick(event, { forceToggle: true }), "aria-hidden": "true", "data-testid": "list-view-expander", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small_default : chevron_right_small_default }) } ) ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-images.js const MAX_IMAGES = 3; const IMAGE_GETTERS = { "core/image": ({ clientId, attributes }) => { if (attributes.url) { return { url: attributes.url, alt: attributes.alt || "", clientId }; } }, "core/cover": ({ clientId, attributes }) => { if (attributes.backgroundType === "image" && attributes.url) { return { url: attributes.url, alt: attributes.alt || "", clientId }; } }, "core/media-text": ({ clientId, attributes }) => { if (attributes.mediaType === "image" && attributes.mediaUrl) { return { url: attributes.mediaUrl, alt: attributes.mediaAlt || "", clientId }; } }, "core/gallery": ({ innerBlocks }) => { const images = []; const getValues = !!innerBlocks?.length ? IMAGE_GETTERS[innerBlocks[0].name] : void 0; if (!getValues) { return images; } for (const innerBlock of innerBlocks) { const img = getValues(innerBlock); if (img) { images.push(img); } if (images.length >= MAX_IMAGES) { return images; } } return images; } }; function getImagesFromBlock(block, isExpanded) { const getImages = IMAGE_GETTERS[block.name]; const images = !!getImages ? getImages(block) : void 0; if (!images) { return []; } if (!Array.isArray(images)) { return [images]; } return isExpanded ? [] : images; } function useListViewImages({ clientId, isExpanded }) { const { block } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { return { block: select(store).getBlock(clientId) }; }, [clientId] ); const images = (0,external_wp_element_namespaceObject.useMemo)(() => { return getImagesFromBlock(block, isExpanded); }, [block, isExpanded]); return images; } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-select-button.js const { Badge: block_select_button_Badge } = unlock(external_wp_components_namespaceObject.privateApis); function ListViewBlockSelectButton({ className, block: { clientId }, onClick, onContextMenu, onMouseDown, onToggleExpanded, tabIndex, onFocus, onDragStart, onDragEnd, draggable, isExpanded, ariaDescribedBy }, ref) { const blockInformation = useBlockDisplayInformation(clientId); const blockTitle = useBlockDisplayTitle({ clientId, context: "list-view" }); const { isLocked } = useBlockLock(clientId); const { canToggleBlockVisibility, isBlockHidden, isContentOnly } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockName } = select(store); const { isBlockHidden: _isBlockHidden } = unlock( select(store) ); return { canToggleBlockVisibility: (0,external_wp_blocks_namespaceObject.hasBlockSupport)( getBlockName(clientId), "visibility", true ), isBlockHidden: _isBlockHidden(clientId), isContentOnly: select(store).getBlockEditingMode( clientId ) === "contentOnly" }; }, [clientId] ); const shouldShowLockIcon = isLocked && !isContentOnly; const shouldShowBlockVisibilityIcon = canToggleBlockVisibility && isBlockHidden; const isSticky = blockInformation?.positionType === "sticky"; const images = useListViewImages({ clientId, isExpanded }); const onDragStartHandler = (event) => { event.dataTransfer.clearData(); onDragStart?.(event); }; function onKeyDown(event) { if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER || event.keyCode === external_wp_keycodes_namespaceObject.SPACE) { onClick(event); } } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "a", { className: dist_clsx( "block-editor-list-view-block-select-button", className ), onClick, onContextMenu, onKeyDown, onMouseDown, ref, tabIndex, onFocus, onDragStart: onDragStartHandler, onDragEnd, draggable, href: `#block-${clientId}`, "aria-describedby": ariaDescribedBy, "aria-expanded": isExpanded, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewExpander, { onClick: onToggleExpanded }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_icon_default, { icon: blockInformation?.icon, showColors: true, context: "list-view" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", className: "block-editor-list-view-block-select-button__label-wrapper", justify: "flex-start", spacing: 1, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { ellipsizeMode: "auto", children: blockTitle }) }), blockInformation?.anchor && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__anchor-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_select_button_Badge, { className: "block-editor-list-view-block-select-button__anchor", children: blockInformation.anchor }) }), isSticky && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__sticky", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: pin_small_default }) }), images.length ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { className: "block-editor-list-view-block-select-button__images", "aria-hidden": true, children: images.map((image, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { className: "block-editor-list-view-block-select-button__image", style: { backgroundImage: `url(${image.url})`, zIndex: images.length - index // Ensure the first image is on top, and subsequent images are behind. } }, image.clientId )) } ) : null, shouldShowBlockVisibilityIcon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__block-visibility", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: unseen_default }) }), shouldShowLockIcon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__lock", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: lock_small_default }) }) ] } ) ] } ); } var block_select_button_default = (0,external_wp_element_namespaceObject.forwardRef)(ListViewBlockSelectButton); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-contents.js const ListViewBlockContents = (0,external_wp_element_namespaceObject.forwardRef)( ({ onClick, onToggleExpanded, block, isSelected, position, siblingBlockCount, level, isExpanded, selectedClientIds, ...props }, ref) => { const { clientId } = block; const { AdditionalBlockContent, insertedBlock, setInsertedBlock } = useListViewContext(); const draggableClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId]; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ AdditionalBlockContent && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AdditionalBlockContent, { block, insertedBlock, setInsertedBlock } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_draggable_default, { appendToOwnerDocument: true, clientIds: draggableClientIds, cloneClassname: "block-editor-list-view-draggable-chip", children: ({ draggable, onDragStart, onDragEnd }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_select_button_default, { ref, className: "block-editor-list-view-block-contents", block, onClick, onToggleExpanded, isSelected, position, siblingBlockCount, level, draggable, onDragStart, onDragEnd, isExpanded, ...props } ) } ) ] }); } ); var block_contents_default = ListViewBlockContents; ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/utils.js const getBlockPositionDescription = (position, siblingCount, level) => (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */ (0,external_wp_i18n_namespaceObject.__)("Block %1$d of %2$d, Level %3$d."), position, siblingCount, level ); const getBlockPropertiesDescription = (blockInformation, isLocked) => [ blockInformation?.positionLabel ? `${(0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Position of selected block, e.g. "Sticky" or "Fixed". (0,external_wp_i18n_namespaceObject.__)("Position: %s"), blockInformation.positionLabel )}.` : void 0, isLocked ? (0,external_wp_i18n_namespaceObject.__)("This block is locked.") : void 0 ].filter(Boolean).join(" "); const isClientIdSelected = (clientId, selectedBlockClientIds) => Array.isArray(selectedBlockClientIds) && selectedBlockClientIds.length ? selectedBlockClientIds.indexOf(clientId) !== -1 : selectedBlockClientIds === clientId; function getCommonDepthClientIds(startId, endId, startParents, endParents) { const startPath = [...startParents, startId]; const endPath = [...endParents, endId]; const depth = Math.min(startPath.length, endPath.length) - 1; const start = startPath[depth]; const end = endPath[depth]; return { start, end }; } function focusListItem(focusClientId, treeGridElement) { const getFocusElement = () => { const row = treeGridElement?.querySelector( `[role=row][data-block="${focusClientId}"]` ); if (!row) { return null; } return external_wp_dom_namespaceObject.focus.focusable.find(row)[0]; }; let focusElement = getFocusElement(); if (focusElement) { focusElement.focus(); } else { window.requestAnimationFrame(() => { focusElement = getFocusElement(); if (focusElement) { focusElement.focus(); } }); } } function getDragDisplacementValues({ blockIndexes, blockDropTargetIndex, blockDropPosition, clientId, firstDraggedBlockIndex, isDragged }) { let displacement; let isNesting; let isAfterDraggedBlocks; if (!isDragged) { isNesting = false; const thisBlockIndex = blockIndexes[clientId]; isAfterDraggedBlocks = thisBlockIndex > firstDraggedBlockIndex; if (blockDropTargetIndex !== void 0 && blockDropTargetIndex !== null && firstDraggedBlockIndex !== void 0) { if (thisBlockIndex !== void 0) { if (thisBlockIndex >= firstDraggedBlockIndex && thisBlockIndex < blockDropTargetIndex) { displacement = "up"; } else if (thisBlockIndex < firstDraggedBlockIndex && thisBlockIndex >= blockDropTargetIndex) { displacement = "down"; } else { displacement = "normal"; } isNesting = typeof blockDropTargetIndex === "number" && blockDropTargetIndex - 1 === thisBlockIndex && blockDropPosition === "inside"; } } else if (blockDropTargetIndex === null && firstDraggedBlockIndex !== void 0) { if (thisBlockIndex !== void 0 && thisBlockIndex >= firstDraggedBlockIndex) { displacement = "up"; } else { displacement = "normal"; } } else if (blockDropTargetIndex !== void 0 && blockDropTargetIndex !== null && firstDraggedBlockIndex === void 0) { if (thisBlockIndex !== void 0) { if (thisBlockIndex < blockDropTargetIndex) { displacement = "normal"; } else { displacement = "down"; } } } else if (blockDropTargetIndex === null) { displacement = "normal"; } } return { displacement, isNesting, isAfterDraggedBlocks }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/block.js function ListViewBlock({ block: { clientId }, displacement, isAfterDraggedBlocks, isDragged, isNesting, isSelected, isBranchSelected, selectBlock, position, level, rowCount, siblingBlockCount, showBlockMovers, path, isExpanded, selectedClientIds, isSyncedBranch }) { const cellRef = (0,external_wp_element_namespaceObject.useRef)(null); const rowRef = (0,external_wp_element_namespaceObject.useRef)(null); const settingsRef = (0,external_wp_element_namespaceObject.useRef)(null); const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); const [settingsAnchorRect, setSettingsAnchorRect] = (0,external_wp_element_namespaceObject.useState)(); const { isLocked, canEdit, canMove } = useBlockLock(clientId); const isFirstSelectedBlock = isSelected && selectedClientIds[0] === clientId; const isLastSelectedBlock = isSelected && selectedClientIds[selectedClientIds.length - 1] === clientId; const { toggleBlockHighlight, duplicateBlocks, multiSelect, replaceBlocks, removeBlocks, insertAfterBlock, insertBeforeBlock, setOpenedBlockSettingsMenu, updateBlockAttributes } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const debouncedToggleBlockHighlight = (0,external_wp_compose_namespaceObject.useDebounce)( toggleBlockHighlight, 50 ); const { canInsertBlockType, getSelectedBlockClientIds, getPreviousBlockClientId, getBlockRootClientId, getBlockOrder, getBlockParents, getBlocksByClientId, canRemoveBlocks, isGroupable } = (0,external_wp_data_namespaceObject.useSelect)(store); const { getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const blockInformation = useBlockDisplayInformation(clientId); const pasteStyles = usePasteStyles(); const { block, blockName, allowRightClickOverrides, isBlockHidden } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlock, getBlockName, getSettings } = select(store); const { isBlockHidden: _isBlockHidden } = unlock( select(store) ); return { block: getBlock(clientId), blockName: getBlockName(clientId), allowRightClickOverrides: getSettings().allowRightClickOverrides, isBlockHidden: _isBlockHidden(clientId) }; }, [clientId] ); const showBlockActions = ( // When a block hides its toolbar it also hides the block settings menu, // since that menu is part of the toolbar in the editor canvas. // List View respects this by also hiding the block settings menu. (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "__experimentalToolbar", true) ); const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewBlock); const descriptionId = `list-view-block-select-button__description-${instanceId}`; const { expand, collapse, collapseAll, BlockSettingsMenu, listViewInstanceId, expandedState, setInsertedBlock, treeGridElementRef, rootClientId } = useListViewContext(); const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); function getBlocksToUpdate() { const selectedBlockClientIds = getSelectedBlockClientIds(); const isUpdatingSelectedBlocks = selectedBlockClientIds.includes(clientId); const firstBlockClientId = isUpdatingSelectedBlocks ? selectedBlockClientIds[0] : clientId; const firstBlockRootClientId = getBlockRootClientId(firstBlockClientId); const blocksToUpdate = isUpdatingSelectedBlocks ? selectedBlockClientIds : [clientId]; return { blocksToUpdate, firstBlockClientId, firstBlockRootClientId, selectedBlockClientIds }; } async function onKeyDown(event) { if (event.defaultPrevented) { return; } if (event.target.closest("[role=dialog]")) { return; } const isDeleteKey = [external_wp_keycodes_namespaceObject.BACKSPACE, external_wp_keycodes_namespaceObject.DELETE].includes(event.keyCode); if (isMatch("core/block-editor/unselect", event) && selectedClientIds.length > 0) { event.stopPropagation(); event.preventDefault(); selectBlock(event, void 0); } else if (isDeleteKey || isMatch("core/block-editor/remove", event)) { const { blocksToUpdate: blocksToDelete, firstBlockClientId, firstBlockRootClientId, selectedBlockClientIds } = getBlocksToUpdate(); if (!canRemoveBlocks(blocksToDelete)) { return; } let blockToFocus = getPreviousBlockClientId(firstBlockClientId) ?? // If the previous block is not found (when the first block is deleted), // fallback to focus the parent block. firstBlockRootClientId; removeBlocks(blocksToDelete, false); const shouldUpdateSelection = selectedBlockClientIds.length > 0 && getSelectedBlockClientIds().length === 0; if (!blockToFocus) { blockToFocus = getBlockOrder()[0]; } updateFocusAndSelection(blockToFocus, shouldUpdateSelection); } else if (isMatch("core/block-editor/paste-styles", event)) { event.preventDefault(); const { blocksToUpdate } = getBlocksToUpdate(); const blocks = getBlocksByClientId(blocksToUpdate); pasteStyles(blocks); } else if (isMatch("core/block-editor/duplicate", event)) { event.preventDefault(); const { blocksToUpdate, firstBlockRootClientId } = getBlocksToUpdate(); const canDuplicate = getBlocksByClientId(blocksToUpdate).every( (blockToUpdate) => { return !!blockToUpdate && (0,external_wp_blocks_namespaceObject.hasBlockSupport)( blockToUpdate.name, "multiple", true ) && canInsertBlockType( blockToUpdate.name, firstBlockRootClientId ); } ); if (canDuplicate) { const updatedBlocks = await duplicateBlocks( blocksToUpdate, false ); if (updatedBlocks?.length) { updateFocusAndSelection(updatedBlocks[0], false); } } } else if (isMatch("core/block-editor/insert-before", event)) { event.preventDefault(); const { blocksToUpdate } = getBlocksToUpdate(); await insertBeforeBlock(blocksToUpdate[0]); const newlySelectedBlocks = getSelectedBlockClientIds(); setOpenedBlockSettingsMenu(void 0); updateFocusAndSelection(newlySelectedBlocks[0], false); } else if (isMatch("core/block-editor/insert-after", event)) { event.preventDefault(); const { blocksToUpdate } = getBlocksToUpdate(); await insertAfterBlock(blocksToUpdate.at(-1)); const newlySelectedBlocks = getSelectedBlockClientIds(); setOpenedBlockSettingsMenu(void 0); updateFocusAndSelection(newlySelectedBlocks[0], false); } else if (isMatch("core/block-editor/select-all", event)) { event.preventDefault(); const { firstBlockRootClientId, selectedBlockClientIds } = getBlocksToUpdate(); const blockClientIds = getBlockOrder(firstBlockRootClientId); if (!blockClientIds.length) { return; } if (external_wp_isShallowEqual_default()(selectedBlockClientIds, blockClientIds)) { if (firstBlockRootClientId && firstBlockRootClientId !== rootClientId) { updateFocusAndSelection(firstBlockRootClientId, true); return; } } multiSelect( blockClientIds[0], blockClientIds[blockClientIds.length - 1], null ); } else if (isMatch("core/block-editor/collapse-list-view", event)) { event.preventDefault(); const { firstBlockClientId } = getBlocksToUpdate(); const blockParents = getBlockParents(firstBlockClientId, false); collapseAll(); expand(blockParents); } else if (isMatch("core/block-editor/group", event)) { const { blocksToUpdate } = getBlocksToUpdate(); if (blocksToUpdate.length > 1 && isGroupable(blocksToUpdate)) { event.preventDefault(); const blocks = getBlocksByClientId(blocksToUpdate); const groupingBlockName = getGroupingBlockName(); const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)( blocks, groupingBlockName ); replaceBlocks(blocksToUpdate, newBlocks); (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("Selected blocks are grouped.")); const newlySelectedBlocks = getSelectedBlockClientIds(); setOpenedBlockSettingsMenu(void 0); updateFocusAndSelection(newlySelectedBlocks[0], false); } } else if (isMatch("core/block-editor/toggle-block-visibility", event)) { event.preventDefault(); const { blocksToUpdate } = getBlocksToUpdate(); const blocks = getBlocksByClientId(blocksToUpdate); const canToggleVisibility = blocks.every( (blockToUpdate) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockToUpdate.name, "visibility", true) ); if (!canToggleVisibility) { return; } const hasHiddenBlock = blocks.some( (blockToUpdate) => blockToUpdate.attributes.metadata?.blockVisibility === false ); const attributesByClientId = Object.fromEntries( blocks.map(({ clientId: mapClientId, attributes }) => [ mapClientId, { metadata: utils_cleanEmptyObject({ ...attributes?.metadata, blockVisibility: hasHiddenBlock ? void 0 : false }) } ]) ); updateBlockAttributes(blocksToUpdate, attributesByClientId, { uniqueByBlock: true }); } } const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => { setIsHovered(true); debouncedToggleBlockHighlight(clientId, true); }, [clientId, setIsHovered, debouncedToggleBlockHighlight]); const onMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(() => { setIsHovered(false); debouncedToggleBlockHighlight(clientId, false); }, [clientId, setIsHovered, debouncedToggleBlockHighlight]); const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)( (event) => { selectBlock(event, clientId); event.preventDefault(); }, [clientId, selectBlock] ); const updateFocusAndSelection = (0,external_wp_element_namespaceObject.useCallback)( (focusClientId, shouldSelectBlock) => { if (shouldSelectBlock) { selectBlock(void 0, focusClientId, null, null); } focusListItem(focusClientId, treeGridElementRef?.current); }, [selectBlock, treeGridElementRef] ); const toggleExpanded = (0,external_wp_element_namespaceObject.useCallback)( (event) => { event.preventDefault(); event.stopPropagation(); if (isExpanded === true) { collapse(clientId); } else if (isExpanded === false) { expand(clientId); } }, [clientId, expand, collapse, isExpanded] ); const onContextMenu = (0,external_wp_element_namespaceObject.useCallback)( (event) => { if (showBlockActions && allowRightClickOverrides) { settingsRef.current?.click(); setSettingsAnchorRect( new window.DOMRect(event.clientX, event.clientY, 0, 0) ); event.preventDefault(); } }, [allowRightClickOverrides, settingsRef, showBlockActions] ); const onMouseDown = (0,external_wp_element_namespaceObject.useCallback)( (event) => { if (allowRightClickOverrides && event.button === 2) { event.preventDefault(); } }, [allowRightClickOverrides] ); const settingsPopoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => { const { ownerDocument } = rowRef?.current || {}; if (!settingsAnchorRect || !ownerDocument) { return void 0; } return { ownerDocument, getBoundingClientRect() { return settingsAnchorRect; } }; }, [settingsAnchorRect]); const clearSettingsAnchorRect = (0,external_wp_element_namespaceObject.useCallback)(() => { setSettingsAnchorRect(void 0); }, [setSettingsAnchorRect]); useListViewScrollIntoView({ isSelected, rowItemRef: rowRef, selectedClientIds }); if (!block) { return null; } const blockPositionDescription = getBlockPositionDescription( position, siblingBlockCount, level ); const blockPropertiesDescription = getBlockPropertiesDescription( blockInformation, isLocked ); const blockVisibilityDescription = isBlockHidden ? (0,external_wp_i18n_namespaceObject.__)("Block is hidden.") : null; const hasSiblings = siblingBlockCount > 0; const hasRenderedMovers = showBlockMovers && hasSiblings; const moverCellClassName = dist_clsx( "block-editor-list-view-block__mover-cell", { "is-visible": isHovered || isSelected } ); const listViewBlockSettingsClassName = dist_clsx( "block-editor-list-view-block__menu-cell", { "is-visible": isHovered || isFirstSelectedBlock } ); let colSpan; if (hasRenderedMovers) { colSpan = 2; } else if (!showBlockActions) { colSpan = 3; } const classes = dist_clsx({ "is-selected": isSelected, "is-first-selected": isFirstSelectedBlock, "is-last-selected": isLastSelectedBlock, "is-branch-selected": isBranchSelected, "is-synced-branch": isSyncedBranch, "is-dragging": isDragged, "has-single-cell": !showBlockActions, "is-synced": blockInformation?.isSynced, "is-draggable": canMove, "is-displacement-normal": displacement === "normal", "is-displacement-up": displacement === "up", "is-displacement-down": displacement === "down", "is-after-dragged-blocks": isAfterDraggedBlocks, "is-nesting": isNesting }); const dropdownClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId]; const currentlyEditingBlockInCanvas = isSelected && selectedClientIds.length === 1; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( leaf_default, { className: classes, isDragged, onKeyDown, onMouseEnter, onMouseLeave, onFocus: onMouseEnter, onBlur: onMouseLeave, level, position, rowCount, path, id: `list-view-${listViewInstanceId}-block-${clientId}`, "data-block": clientId, "data-expanded": canEdit ? isExpanded : void 0, ref: rowRef, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalTreeGridCell, { className: "block-editor-list-view-block__contents-cell", colSpan, ref: cellRef, "aria-selected": !!isSelected, children: ({ ref, tabIndex, onFocus }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-list-view-block__contents-container", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_contents_default, { block, onClick: selectEditorBlock, onContextMenu, onMouseDown, onToggleExpanded: toggleExpanded, isSelected, position, siblingBlockCount, level, ref, tabIndex: currentlyEditingBlockInCanvas ? 0 : tabIndex, onFocus, isExpanded: canEdit ? isExpanded : void 0, selectedClientIds, ariaDescribedBy: descriptionId } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AriaReferencedText, { id: descriptionId, children: [ blockPositionDescription, blockPropertiesDescription, blockVisibilityDescription ].filter(Boolean).join(" ") }) ] }) } ), hasRenderedMovers && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalTreeGridCell, { className: moverCellClassName, withoutGridItem: true, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridItem, { children: ({ ref, tabIndex, onFocus }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockMoverUpButton, { orientation: "vertical", clientIds: [clientId], ref, tabIndex, onFocus } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridItem, { children: ({ ref, tabIndex, onFocus }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockMoverDownButton, { orientation: "vertical", clientIds: [clientId], ref, tabIndex, onFocus } ) }) ] } ) }), showBlockActions && BlockSettingsMenu && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalTreeGridCell, { className: listViewBlockSettingsClassName, "aria-selected": !!isSelected, ref: settingsRef, children: ({ ref, tabIndex, onFocus }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockSettingsMenu, { clientIds: dropdownClientIds, block, icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("Options"), popoverProps: { anchor: settingsPopoverAnchor // Used to position the settings at the cursor on right-click. }, toggleProps: { ref, className: "block-editor-list-view-block__menu", tabIndex, onClick: clearSettingsAnchorRect, onFocus, size: "small" }, disableOpenOnArrowDown: true, expand, expandedState, setInsertedBlock, __experimentalSelectBlock: updateFocusAndSelection } ) } ) ] } ); } var list_view_block_block_default = (0,external_wp_element_namespaceObject.memo)(ListViewBlock); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/branch.js function countBlocks(block, expandedState, draggedClientIds, isExpandedByDefault) { const isDragged = draggedClientIds?.includes(block.clientId); if (isDragged) { return 0; } const isExpanded = expandedState[block.clientId] ?? isExpandedByDefault; if (isExpanded) { return 1 + block.innerBlocks.reduce( countReducer( expandedState, draggedClientIds, isExpandedByDefault ), 0 ); } return 1; } const countReducer = (expandedState, draggedClientIds, isExpandedByDefault) => (count, block) => { const isDragged = draggedClientIds?.includes(block.clientId); if (isDragged) { return count; } const isExpanded = expandedState[block.clientId] ?? isExpandedByDefault; if (isExpanded && block.innerBlocks.length > 0) { return count + countBlocks( block, expandedState, draggedClientIds, isExpandedByDefault ); } return count + 1; }; const branch_noop = () => { }; function ListViewBranch(props) { const { blocks, selectBlock = branch_noop, showBlockMovers, selectedClientIds, level = 1, path = "", isBranchSelected = false, listPosition = 0, fixedListWindow, isExpanded, parentId, shouldShowInnerBlocks = true, isSyncedBranch = false, showAppender: showAppenderProp = true } = props; const parentBlockInformation = useBlockDisplayInformation(parentId); const syncedBranch = isSyncedBranch || !!parentBlockInformation?.isSynced; const canParentExpand = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (!parentId) { return true; } return select(store).canEditBlock(parentId); }, [parentId] ); const { blockDropPosition, blockDropTargetIndex, firstDraggedBlockIndex, blockIndexes, expandedState, draggedClientIds } = useListViewContext(); const nextPositionRef = (0,external_wp_element_namespaceObject.useRef)(); if (!canParentExpand) { return null; } const showAppender = showAppenderProp && level === 1; const filteredBlocks = blocks.filter(Boolean); const blockCount = filteredBlocks.length; const rowCount = showAppender ? blockCount + 1 : blockCount; nextPositionRef.current = listPosition; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ filteredBlocks.map((block, index) => { const { clientId, innerBlocks } = block; if (index > 0) { nextPositionRef.current += countBlocks( filteredBlocks[index - 1], expandedState, draggedClientIds, isExpanded ); } const isDragged = !!draggedClientIds?.includes(clientId); const { displacement, isAfterDraggedBlocks, isNesting } = getDragDisplacementValues({ blockIndexes, blockDropTargetIndex, blockDropPosition, clientId, firstDraggedBlockIndex, isDragged }); const { itemInView } = fixedListWindow; const blockInView = itemInView(nextPositionRef.current); const position = index + 1; const updatedPath = path.length > 0 ? `${path}_${position}` : `${position}`; const hasNestedBlocks = !!innerBlocks?.length; const shouldExpand = hasNestedBlocks && shouldShowInnerBlocks ? expandedState[clientId] ?? isExpanded : void 0; const isSelected = isClientIdSelected( clientId, selectedClientIds ); const isSelectedBranch = isBranchSelected || isSelected && hasNestedBlocks; const showBlock = isDragged || blockInView || isSelected && clientId === selectedClientIds[0] || index === 0 || index === blockCount - 1; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_data_namespaceObject.AsyncModeProvider, { value: !isSelected, children: [ showBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( list_view_block_block_default, { block, selectBlock, isSelected, isBranchSelected: isSelectedBranch, isDragged, level, position, rowCount, siblingBlockCount: blockCount, showBlockMovers, path: updatedPath, isExpanded: isDragged ? false : shouldExpand, listPosition: nextPositionRef.current, selectedClientIds, isSyncedBranch: syncedBranch, displacement, isAfterDraggedBlocks, isNesting } ), !showBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("tr", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { className: "block-editor-list-view-placeholder" }) }), hasNestedBlocks && shouldExpand && !isDragged && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ListViewBranch, { parentId: clientId, blocks: innerBlocks, selectBlock, showBlockMovers, level: level + 1, path: updatedPath, listPosition: nextPositionRef.current + 1, fixedListWindow, isBranchSelected: isSelectedBranch, selectedClientIds, isExpanded, isSyncedBranch: syncedBranch } ) ] }, clientId); }), showAppender && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalTreeGridRow, { level, setSize: rowCount, positionInSet: rowCount, isExpanded: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { children: (treeGridCellProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Appender, { clientId: parentId, nestingLevel: level, blockCount, ...treeGridCellProps } ) }) } ) ] }); } var branch_default = (0,external_wp_element_namespaceObject.memo)(ListViewBranch); ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/drop-indicator.js function ListViewDropIndicatorPreview({ draggedBlockClientId, listViewRef, blockDropTarget }) { const blockInformation = useBlockDisplayInformation(draggedBlockClientId); const blockTitle = useBlockDisplayTitle({ clientId: draggedBlockClientId, context: "list-view" }); const { rootClientId, clientId, dropPosition } = blockDropTarget || {}; const [rootBlockElement, blockElement] = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!listViewRef.current) { return []; } const _rootBlockElement = rootClientId ? listViewRef.current.querySelector( `[data-block="${rootClientId}"]` ) : void 0; const _blockElement = clientId ? listViewRef.current.querySelector( `[data-block="${clientId}"]` ) : void 0; return [_rootBlockElement, _blockElement]; }, [listViewRef, rootClientId, clientId]); const targetElement = blockElement || rootBlockElement; const rtl = (0,external_wp_i18n_namespaceObject.isRTL)(); const getDropIndicatorWidth = (0,external_wp_element_namespaceObject.useCallback)( (targetElementRect, indent) => { if (!targetElement) { return 0; } let width = targetElement.offsetWidth; const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)( targetElement, "horizontal" ); const ownerDocument = targetElement.ownerDocument; const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement; if (scrollContainer && !windowScroll) { const scrollContainerRect = scrollContainer.getBoundingClientRect(); const distanceBetweenContainerAndTarget = (0,external_wp_i18n_namespaceObject.isRTL)() ? scrollContainerRect.right - targetElementRect.right : targetElementRect.left - scrollContainerRect.left; const scrollContainerWidth = scrollContainer.clientWidth; if (scrollContainerWidth < width + distanceBetweenContainerAndTarget) { width = scrollContainerWidth - distanceBetweenContainerAndTarget; } if (!rtl && targetElementRect.left + indent < scrollContainerRect.left) { width -= scrollContainerRect.left - targetElementRect.left; return width; } if (rtl && targetElementRect.right - indent > scrollContainerRect.right) { width -= targetElementRect.right - scrollContainerRect.right; return width; } } return width - indent; }, [rtl, targetElement] ); const style = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!targetElement) { return {}; } const targetElementRect = targetElement.getBoundingClientRect(); return { width: getDropIndicatorWidth(targetElementRect, 0) }; }, [getDropIndicatorWidth, targetElement]); const horizontalScrollOffsetStyle = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!targetElement) { return {}; } const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(targetElement); const ownerDocument = targetElement.ownerDocument; const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement; if (scrollContainer && !windowScroll) { const scrollContainerRect = scrollContainer.getBoundingClientRect(); const targetElementRect = targetElement.getBoundingClientRect(); const distanceBetweenContainerAndTarget = rtl ? scrollContainerRect.right - targetElementRect.right : targetElementRect.left - scrollContainerRect.left; if (!rtl && scrollContainerRect.left > targetElementRect.left) { return { transform: `translateX( ${distanceBetweenContainerAndTarget}px )` }; } if (rtl && scrollContainerRect.right < targetElementRect.right) { return { transform: `translateX( ${distanceBetweenContainerAndTarget * -1}px )` }; } } return {}; }, [rtl, targetElement]); const ariaLevel = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!rootBlockElement) { return 1; } const _ariaLevel = parseInt( rootBlockElement.getAttribute("aria-level"), 10 ); return _ariaLevel ? _ariaLevel + 1 : 1; }, [rootBlockElement]); const hasAdjacentSelectedBranch = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!targetElement) { return false; } return targetElement.classList.contains("is-branch-selected"); }, [targetElement]); const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => { const isValidDropPosition = dropPosition === "top" || dropPosition === "bottom" || dropPosition === "inside"; if (!targetElement || !isValidDropPosition) { return void 0; } return { contextElement: targetElement, getBoundingClientRect() { const rect = targetElement.getBoundingClientRect(); let left = rect.left; let top = 0; const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)( targetElement, "horizontal" ); const doc = targetElement.ownerDocument; const windowScroll = scrollContainer === doc.body || scrollContainer === doc.documentElement; if (scrollContainer && !windowScroll) { const scrollContainerRect = scrollContainer.getBoundingClientRect(); const scrollbarWidth = rtl ? scrollContainer.offsetWidth - scrollContainer.clientWidth : 0; if (left < scrollContainerRect.left + scrollbarWidth) { left = scrollContainerRect.left + scrollbarWidth; } } if (dropPosition === "top") { top = rect.top - rect.height * 2; } else { top = rect.top; } const width = getDropIndicatorWidth(rect, 0); const height = rect.height; return new window.DOMRect(left, top, width, height); } }; }, [targetElement, dropPosition, getDropIndicatorWidth, rtl]); if (!targetElement) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Popover, { animate: false, anchor: popoverAnchor, focusOnMount: false, className: "block-editor-list-view-drop-indicator--preview", variant: "unstyled", flip: false, resize: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { style, className: dist_clsx( "block-editor-list-view-drop-indicator__line", { "block-editor-list-view-drop-indicator__line--darker": hasAdjacentSelectedBranch } ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: "block-editor-list-view-leaf", "aria-level": ariaLevel, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: dist_clsx( "block-editor-list-view-block-select-button", "block-editor-list-view-block-contents" ), style: horizontalScrollOffsetStyle, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewExpander, { onClick: () => { } }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_icon_default, { icon: blockInformation?.icon, showColors: true, context: "list-view" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", className: "block-editor-list-view-block-select-button__label-wrapper", justify: "flex-start", spacing: 1, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { ellipsizeMode: "auto", children: blockTitle }) }) } ) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-list-view-block__menu-cell" }) ] } ) } ) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-block-selection.js function useBlockSelection() { const { clearSelectedBlock, multiSelect, selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { getBlockName, getBlockParents, getBlockSelectionStart, getSelectedBlockClientIds, hasMultiSelection, hasSelectedBlock } = (0,external_wp_data_namespaceObject.useSelect)(store); const { getBlockType } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const updateBlockSelection = (0,external_wp_element_namespaceObject.useCallback)( async (event, clientId, destinationClientId, focusPosition) => { if (!event?.shiftKey && event?.keyCode !== external_wp_keycodes_namespaceObject.ESCAPE) { selectBlock(clientId, focusPosition); return; } event.preventDefault(); const isOnlyDeselection = event.type === "keydown" && event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE; const isKeyPress = event.type === "keydown" && (event.keyCode === external_wp_keycodes_namespaceObject.UP || event.keyCode === external_wp_keycodes_namespaceObject.DOWN || event.keyCode === external_wp_keycodes_namespaceObject.HOME || event.keyCode === external_wp_keycodes_namespaceObject.END); if (!isKeyPress && !hasSelectedBlock() && !hasMultiSelection()) { selectBlock(clientId, null); return; } const selectedBlocks = getSelectedBlockClientIds(); const clientIdWithParents = [ ...getBlockParents(clientId), clientId ]; if (isOnlyDeselection || isKeyPress && !selectedBlocks.some( (blockId) => clientIdWithParents.includes(blockId) )) { await clearSelectedBlock(); } if (!isOnlyDeselection) { let startTarget = getBlockSelectionStart(); let endTarget = clientId; if (isKeyPress) { if (!hasSelectedBlock() && !hasMultiSelection()) { startTarget = clientId; } if (destinationClientId) { endTarget = destinationClientId; } } const startParents = getBlockParents(startTarget); const endParents = getBlockParents(endTarget); const { start, end } = getCommonDepthClientIds( startTarget, endTarget, startParents, endParents ); await multiSelect(start, end, null); } const updatedSelectedBlocks = getSelectedBlockClientIds(); if ((event.keyCode === external_wp_keycodes_namespaceObject.HOME || event.keyCode === external_wp_keycodes_namespaceObject.END) && updatedSelectedBlocks.length > 1) { return; } const selectionDiff = selectedBlocks.filter( (blockId) => !updatedSelectedBlocks.includes(blockId) ); let label; if (selectionDiff.length === 1) { const title = getBlockType( getBlockName(selectionDiff[0]) )?.title; if (title) { label = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ (0,external_wp_i18n_namespaceObject.__)("%s deselected."), title ); } } else if (selectionDiff.length > 1) { label = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: number of deselected blocks */ (0,external_wp_i18n_namespaceObject.__)("%s blocks deselected."), selectionDiff.length ); } if (label) { (0,external_wp_a11y_namespaceObject.speak)(label, "assertive"); } }, [ clearSelectedBlock, getBlockName, getBlockType, getBlockParents, getBlockSelectionStart, getSelectedBlockClientIds, hasMultiSelection, hasSelectedBlock, multiSelect, selectBlock ] ); return { updateBlockSelection }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-block-indexes.js function useListViewBlockIndexes(blocks) { const blockIndexes = (0,external_wp_element_namespaceObject.useMemo)(() => { const indexes = {}; let currentGlobalIndex = 0; const traverseBlocks = (blockList) => { blockList.forEach((block) => { indexes[block.clientId] = currentGlobalIndex; currentGlobalIndex++; if (block.innerBlocks.length > 0) { traverseBlocks(block.innerBlocks); } }); }; traverseBlocks(blocks); return indexes; }, [blocks]); return blockIndexes; } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-client-ids.js function useListViewClientIds({ blocks, rootClientId }) { return (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getDraggedBlockClientIds, getSelectedBlockClientIds, getEnabledClientIdsTree } = unlock(select(store)); return { selectedClientIds: getSelectedBlockClientIds(), draggedClientIds: getDraggedBlockClientIds(), clientIdsTree: blocks ?? getEnabledClientIdsTree(rootClientId) }; }, [blocks, rootClientId] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-collapse-items.js function useListViewCollapseItems({ collapseAll, expand }) { const { expandedBlock, getBlockParents } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getBlockParents: _getBlockParents, getExpandedBlock } = unlock( select(store) ); return { expandedBlock: getExpandedBlock(), getBlockParents: _getBlockParents }; }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { if (expandedBlock) { const blockParents = getBlockParents(expandedBlock, false); collapseAll(); expand(blockParents); } }, [collapseAll, expand, expandedBlock, getBlockParents]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-drop-zone.js const NESTING_LEVEL_INDENTATION = 24; function isUpGesture(point, rect, nestingLevel = 1, rtl = false) { const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION; return rtl ? point.x > blockIndentPosition : point.x < blockIndentPosition; } function getDesiredRelativeParentLevel(point, rect, nestingLevel = 1, rtl = false) { const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION; const distanceBetweenPointAndBlockIndentPosition = rtl ? blockIndentPosition - point.x : point.x - blockIndentPosition; const desiredParentLevel = Math.round( distanceBetweenPointAndBlockIndentPosition / NESTING_LEVEL_INDENTATION ); return Math.abs(desiredParentLevel); } function getCandidateBlockParents(candidateBlockData, blocksData) { const candidateBlockParents = []; let currentBlockData = candidateBlockData; while (currentBlockData) { candidateBlockParents.push({ ...currentBlockData }); currentBlockData = blocksData.find( (blockData) => blockData.clientId === currentBlockData.rootClientId ); } return candidateBlockParents; } function getNextNonDraggedBlock(blocksData, index) { const nextBlockData = blocksData[index + 1]; if (nextBlockData && nextBlockData.isDraggedBlock) { return getNextNonDraggedBlock(blocksData, index + 1); } return nextBlockData; } function isNestingGesture(point, rect, nestingLevel = 1, rtl = false) { const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION; const isNestingHorizontalGesture = rtl ? point.x < blockIndentPosition - NESTING_LEVEL_INDENTATION : point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION; return isNestingHorizontalGesture && point.y < rect.bottom; } const ALLOWED_DROP_EDGES = ["top", "bottom"]; function getListViewDropTarget(blocksData, position, rtl = false) { let candidateEdge; let candidateBlockData; let candidateDistance; let candidateRect; let candidateBlockIndex; for (let i = 0; i < blocksData.length; i++) { const blockData = blocksData[i]; if (blockData.isDraggedBlock) { continue; } const rect = blockData.element.getBoundingClientRect(); const [distance, edge] = getDistanceToNearestEdge( position, rect, ALLOWED_DROP_EDGES ); const isCursorWithinBlock = isPointContainedByRect(position, rect); if (candidateDistance === void 0 || distance < candidateDistance || isCursorWithinBlock) { candidateDistance = distance; const index = blocksData.indexOf(blockData); const previousBlockData = blocksData[index - 1]; if (edge === "top" && previousBlockData && previousBlockData.rootClientId === blockData.rootClientId && !previousBlockData.isDraggedBlock) { candidateBlockData = previousBlockData; candidateEdge = "bottom"; candidateRect = previousBlockData.element.getBoundingClientRect(); candidateBlockIndex = index - 1; } else { candidateBlockData = blockData; candidateEdge = edge; candidateRect = rect; candidateBlockIndex = index; } if (isCursorWithinBlock) { break; } } } if (!candidateBlockData) { return; } const candidateBlockParents = getCandidateBlockParents( candidateBlockData, blocksData ); const isDraggingBelow = candidateEdge === "bottom"; if (isDraggingBelow && candidateBlockData.canInsertDraggedBlocksAsChild && (candidateBlockData.innerBlockCount > 0 && candidateBlockData.isExpanded || isNestingGesture( position, candidateRect, candidateBlockParents.length, rtl ))) { const newBlockIndex = candidateBlockData.isExpanded ? 0 : candidateBlockData.innerBlockCount || 0; return { rootClientId: candidateBlockData.clientId, clientId: candidateBlockData.clientId, blockIndex: newBlockIndex, dropPosition: "inside" }; } if (isDraggingBelow && candidateBlockData.rootClientId && isUpGesture( position, candidateRect, candidateBlockParents.length, rtl )) { const nextBlock = getNextNonDraggedBlock( blocksData, candidateBlockIndex ); const currentLevel = candidateBlockData.nestingLevel; const nextLevel = nextBlock ? nextBlock.nestingLevel : 1; if (currentLevel && nextLevel) { const desiredRelativeLevel = getDesiredRelativeParentLevel( position, candidateRect, candidateBlockParents.length, rtl ); const targetParentIndex = Math.max( Math.min(desiredRelativeLevel, currentLevel - nextLevel), 0 ); if (candidateBlockParents[targetParentIndex]) { let newBlockIndex = candidateBlockData.blockIndex; if (candidateBlockParents[targetParentIndex].nestingLevel === nextBlock?.nestingLevel) { newBlockIndex = nextBlock?.blockIndex; } else { for (let i = candidateBlockIndex; i >= 0; i--) { const blockData = blocksData[i]; if (blockData.rootClientId === candidateBlockParents[targetParentIndex].rootClientId) { newBlockIndex = blockData.blockIndex + 1; break; } } } return { rootClientId: candidateBlockParents[targetParentIndex].rootClientId, clientId: candidateBlockData.clientId, blockIndex: newBlockIndex, dropPosition: candidateEdge }; } } } if (!candidateBlockData.canInsertDraggedBlocksAsSibling) { return; } const offset = isDraggingBelow ? 1 : 0; return { rootClientId: candidateBlockData.rootClientId, clientId: candidateBlockData.clientId, blockIndex: candidateBlockData.blockIndex + offset, dropPosition: candidateEdge }; } const EXPAND_THROTTLE_OPTIONS = { leading: false, // Don't call the function immediately on the first call. trailing: true // Do call the function on the last call. }; function useListViewDropZone({ dropZoneElement, expandedState, setExpandedState }) { const { getBlockRootClientId, getBlockIndex, getBlockCount, getDraggedBlockClientIds, canInsertBlocks } = (0,external_wp_data_namespaceObject.useSelect)(store); const [target, setTarget] = (0,external_wp_element_namespaceObject.useState)(); const { rootClientId: targetRootClientId, blockIndex: targetBlockIndex } = target || {}; const onBlockDrop = useOnBlockDrop(targetRootClientId, targetBlockIndex); const rtl = (0,external_wp_i18n_namespaceObject.isRTL)(); const previousRootClientId = (0,external_wp_compose_namespaceObject.usePrevious)(targetRootClientId); const maybeExpandBlock = (0,external_wp_element_namespaceObject.useCallback)( (_expandedState, _target) => { const { rootClientId } = _target || {}; if (!rootClientId) { return; } if (_target?.dropPosition === "inside" && !_expandedState[rootClientId]) { setExpandedState({ type: "expand", clientIds: [rootClientId] }); } }, [setExpandedState] ); const throttledMaybeExpandBlock = (0,external_wp_compose_namespaceObject.useThrottle)( maybeExpandBlock, 500, EXPAND_THROTTLE_OPTIONS ); (0,external_wp_element_namespaceObject.useEffect)(() => { if (target?.dropPosition !== "inside" || previousRootClientId !== target?.rootClientId) { throttledMaybeExpandBlock.cancel(); return; } throttledMaybeExpandBlock(expandedState, target); }, [ expandedState, previousRootClientId, target, throttledMaybeExpandBlock ]); const draggedBlockClientIds = getDraggedBlockClientIds(); const throttled = (0,external_wp_compose_namespaceObject.useThrottle)( (0,external_wp_element_namespaceObject.useCallback)( (event, currentTarget) => { const position = { x: event.clientX, y: event.clientY }; const isBlockDrag = !!draggedBlockClientIds?.length; const blockElements = Array.from( currentTarget.querySelectorAll("[data-block]") ); const blocksData = blockElements.map((blockElement) => { const clientId = blockElement.dataset.block; const isExpanded = blockElement.dataset.expanded === "true"; const isDraggedBlock = blockElement.classList.contains("is-dragging"); const nestingLevel = parseInt( blockElement.getAttribute("aria-level"), 10 ); const rootClientId = getBlockRootClientId(clientId); return { clientId, isExpanded, rootClientId, blockIndex: getBlockIndex(clientId), element: blockElement, nestingLevel: nestingLevel || void 0, isDraggedBlock: isBlockDrag ? isDraggedBlock : false, innerBlockCount: getBlockCount(clientId), canInsertDraggedBlocksAsSibling: isBlockDrag ? canInsertBlocks( draggedBlockClientIds, rootClientId ) : true, canInsertDraggedBlocksAsChild: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, clientId) : true }; }); const newTarget = getListViewDropTarget( blocksData, position, rtl ); if (newTarget) { setTarget(newTarget); } }, [ canInsertBlocks, draggedBlockClientIds, getBlockCount, getBlockIndex, getBlockRootClientId, rtl ] ), 50 ); const ref = (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({ dropZoneElement, onDrop(event) { throttled.cancel(); if (target) { onBlockDrop(event); } setTarget(void 0); }, onDragLeave() { throttled.cancel(); setTarget(null); }, onDragOver(event) { throttled(event, event.currentTarget); }, onDragEnd() { throttled.cancel(); setTarget(void 0); } }); return { ref, target }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-expand-selected-item.js function useListViewExpandSelectedItem({ firstSelectedBlockClientId, setExpandedState }) { const [selectedTreeId, setSelectedTreeId] = (0,external_wp_element_namespaceObject.useState)(null); const { selectedBlockParentClientIds } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockParents } = select(store); return { selectedBlockParentClientIds: getBlockParents( firstSelectedBlockClientId, false ) }; }, [firstSelectedBlockClientId] ); (0,external_wp_element_namespaceObject.useEffect)(() => { if (selectedTreeId === firstSelectedBlockClientId) { return; } if (selectedBlockParentClientIds?.length) { setExpandedState({ type: "expand", clientIds: selectedBlockParentClientIds }); } }, [ firstSelectedBlockClientId, selectedBlockParentClientIds, selectedTreeId, setExpandedState ]); return { setSelectedTreeId }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-clipboard-handler.js function use_clipboard_handler_useClipboardHandler({ selectBlock }) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { getBlockOrder, getBlockRootClientId, getBlocksByClientId, getPreviousBlockClientId, getSelectedBlockClientIds, getSettings, canInsertBlockType, canRemoveBlocks } = (0,external_wp_data_namespaceObject.useSelect)(store); const { flashBlock, removeBlocks, replaceBlocks, insertBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); const notifyCopy = useNotifyCopy(); return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { function updateFocusAndSelection(focusClientId, shouldSelectBlock) { if (shouldSelectBlock) { selectBlock(void 0, focusClientId, null, null); } focusListItem(focusClientId, node); } function getBlocksToUpdate(clientId) { const selectedBlockClientIds = getSelectedBlockClientIds(); const isUpdatingSelectedBlocks = selectedBlockClientIds.includes(clientId); const firstBlockClientId = isUpdatingSelectedBlocks ? selectedBlockClientIds[0] : clientId; const firstBlockRootClientId = getBlockRootClientId(firstBlockClientId); const blocksToUpdate = isUpdatingSelectedBlocks ? selectedBlockClientIds : [clientId]; return { blocksToUpdate, firstBlockClientId, firstBlockRootClientId, originallySelectedBlockClientIds: selectedBlockClientIds }; } function handler(event) { if (event.defaultPrevented) { return; } if (!node.contains(event.target.ownerDocument.activeElement)) { return; } const listViewRow = event.target.ownerDocument.activeElement?.closest( "[role=row]" ); const clientId = listViewRow?.dataset?.block; if (!clientId) { return; } const { blocksToUpdate: selectedBlockClientIds, firstBlockClientId, firstBlockRootClientId, originallySelectedBlockClientIds } = getBlocksToUpdate(clientId); if (selectedBlockClientIds.length === 0) { return; } event.preventDefault(); if (event.type === "copy" || event.type === "cut") { if (selectedBlockClientIds.length === 1) { flashBlock(selectedBlockClientIds[0]); } notifyCopy(event.type, selectedBlockClientIds); const blocks = getBlocksByClientId(selectedBlockClientIds); setClipboardBlocks(event, blocks, registry); } if (event.type === "cut") { if (!canRemoveBlocks(selectedBlockClientIds)) { return; } let blockToFocus = getPreviousBlockClientId(firstBlockClientId) ?? // If the previous block is not found (when the first block is deleted), // fallback to focus the parent block. firstBlockRootClientId; removeBlocks(selectedBlockClientIds, false); const shouldUpdateSelection = originallySelectedBlockClientIds.length > 0 && getSelectedBlockClientIds().length === 0; if (!blockToFocus) { blockToFocus = getBlockOrder()[0]; } updateFocusAndSelection(blockToFocus, shouldUpdateSelection); } else if (event.type === "paste") { const { __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML } = getSettings(); const blocks = getPasteBlocks( event, canUserUseUnfilteredHTML ); if (selectedBlockClientIds.length === 1) { const [selectedBlockClientId] = selectedBlockClientIds; if (blocks.every( (block) => canInsertBlockType( block.name, selectedBlockClientId ) )) { insertBlocks( blocks, void 0, selectedBlockClientId ); updateFocusAndSelection(blocks[0]?.clientId, false); return; } } replaceBlocks( selectedBlockClientIds, blocks, blocks.length - 1, -1 ); updateFocusAndSelection(blocks[0]?.clientId, false); } } node.ownerDocument.addEventListener("copy", handler); node.ownerDocument.addEventListener("cut", handler); node.ownerDocument.addEventListener("paste", handler); return () => { node.ownerDocument.removeEventListener("copy", handler); node.ownerDocument.removeEventListener("cut", handler); node.ownerDocument.removeEventListener("paste", handler); }; }, []); } ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/index.js const expanded = (state, action) => { if (action.type === "clear") { return {}; } if (Array.isArray(action.clientIds)) { return { ...state, ...action.clientIds.reduce( (newState, id) => ({ ...newState, [id]: action.type === "expand" }), {} ) }; } return state; }; const BLOCK_LIST_ITEM_HEIGHT = 32; function ListViewComponent({ id, blocks, dropZoneElement, showBlockMovers = false, isExpanded = false, showAppender = false, blockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown, rootClientId, description, onSelect, additionalBlockContent: AdditionalBlockContent }, ref) { if (blocks) { external_wp_deprecated_default()( "`blocks` property in `wp.blockEditor.__experimentalListView`", { since: "6.3", alternative: "`rootClientId` property" } ); } const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewComponent); const { clientIdsTree, draggedClientIds, selectedClientIds } = useListViewClientIds({ blocks, rootClientId }); const blockIndexes = useListViewBlockIndexes(clientIdsTree); const { getBlock } = (0,external_wp_data_namespaceObject.useSelect)(store); const { visibleBlockCount } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getGlobalBlockCount, getClientIdsOfDescendants } = select(store); const draggedBlockCount = draggedClientIds?.length > 0 ? getClientIdsOfDescendants(draggedClientIds).length + 1 : 0; return { visibleBlockCount: getGlobalBlockCount() - draggedBlockCount }; }, [draggedClientIds] ); const { updateBlockSelection } = useBlockSelection(); const [expandedState, setExpandedState] = (0,external_wp_element_namespaceObject.useReducer)(expanded, {}); const [insertedBlock, setInsertedBlock] = (0,external_wp_element_namespaceObject.useState)(null); const { setSelectedTreeId } = useListViewExpandSelectedItem({ firstSelectedBlockClientId: selectedClientIds[0], setExpandedState }); const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)( /** * @param {MouseEvent | KeyboardEvent | undefined} event * @param {string} blockClientId * @param {null | undefined | -1 | 1} focusPosition */ (event, blockClientId, focusPosition) => { updateBlockSelection(event, blockClientId, null, focusPosition); setSelectedTreeId(blockClientId); if (onSelect) { onSelect(getBlock(blockClientId)); } }, [setSelectedTreeId, updateBlockSelection, onSelect, getBlock] ); const { ref: dropZoneRef, target: blockDropTarget } = useListViewDropZone({ dropZoneElement, expandedState, setExpandedState }); const elementRef = (0,external_wp_element_namespaceObject.useRef)(); const clipBoardRef = use_clipboard_handler_useClipboardHandler({ selectBlock: selectEditorBlock }); const treeGridRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ clipBoardRef, elementRef, dropZoneRef, ref ]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (selectedClientIds?.length) { focusListItem(selectedClientIds[0], elementRef?.current); } }, []); const expand = (0,external_wp_element_namespaceObject.useCallback)( (clientId) => { if (!clientId) { return; } const clientIds = Array.isArray(clientId) ? clientId : [clientId]; setExpandedState({ type: "expand", clientIds }); }, [setExpandedState] ); const collapse = (0,external_wp_element_namespaceObject.useCallback)( (clientId) => { if (!clientId) { return; } setExpandedState({ type: "collapse", clientIds: [clientId] }); }, [setExpandedState] ); const collapseAll = (0,external_wp_element_namespaceObject.useCallback)(() => { setExpandedState({ type: "clear" }); }, [setExpandedState]); const expandRow = (0,external_wp_element_namespaceObject.useCallback)( (row) => { expand(row?.dataset?.block); }, [expand] ); const collapseRow = (0,external_wp_element_namespaceObject.useCallback)( (row) => { collapse(row?.dataset?.block); }, [collapse] ); const focusRow = (0,external_wp_element_namespaceObject.useCallback)( (event, startRow, endRow) => { if (event.shiftKey) { updateBlockSelection( event, startRow?.dataset?.block, endRow?.dataset?.block ); } }, [updateBlockSelection] ); useListViewCollapseItems({ collapseAll, expand }); const firstDraggedBlockClientId = draggedClientIds?.[0]; const { blockDropTargetIndex, blockDropPosition, firstDraggedBlockIndex } = (0,external_wp_element_namespaceObject.useMemo)(() => { let _blockDropTargetIndex, _firstDraggedBlockIndex; if (blockDropTarget?.clientId) { const foundBlockIndex = blockIndexes[blockDropTarget.clientId]; _blockDropTargetIndex = foundBlockIndex === void 0 || blockDropTarget?.dropPosition === "top" ? foundBlockIndex : foundBlockIndex + 1; } else if (blockDropTarget === null) { _blockDropTargetIndex = null; } if (firstDraggedBlockClientId) { const foundBlockIndex = blockIndexes[firstDraggedBlockClientId]; _firstDraggedBlockIndex = foundBlockIndex === void 0 || blockDropTarget?.dropPosition === "top" ? foundBlockIndex : foundBlockIndex + 1; } return { blockDropTargetIndex: _blockDropTargetIndex, blockDropPosition: blockDropTarget?.dropPosition, firstDraggedBlockIndex: _firstDraggedBlockIndex }; }, [blockDropTarget, blockIndexes, firstDraggedBlockClientId]); const contextValue = (0,external_wp_element_namespaceObject.useMemo)( () => ({ blockDropPosition, blockDropTargetIndex, blockIndexes, draggedClientIds, expandedState, expand, firstDraggedBlockIndex, collapse, collapseAll, BlockSettingsMenu, listViewInstanceId: instanceId, AdditionalBlockContent, insertedBlock, setInsertedBlock, treeGridElementRef: elementRef, rootClientId }), [ blockDropPosition, blockDropTargetIndex, blockIndexes, draggedClientIds, expandedState, expand, firstDraggedBlockIndex, collapse, collapseAll, BlockSettingsMenu, instanceId, AdditionalBlockContent, insertedBlock, setInsertedBlock, rootClientId ] ); const [fixedListWindow] = (0,external_wp_compose_namespaceObject.__experimentalUseFixedWindowList)( elementRef, BLOCK_LIST_ITEM_HEIGHT, visibleBlockCount, { // Ensure that the windowing logic is recalculated when the expanded state changes. // This is necessary because expanding a collapsed block in a short list view can // switch the list view to a tall list view with a scrollbar, and vice versa. // When this happens, the windowing logic needs to be recalculated to ensure that // the correct number of blocks are rendered, by rechecking for a scroll container. expandedState, useWindowing: true, windowOverscan: 40 } ); if (!clientIdsTree.length && !showAppender) { return null; } const describedById = description && `block-editor-list-view-description-${instanceId}`; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_data_namespaceObject.AsyncModeProvider, { value: true, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ListViewDropIndicatorPreview, { draggedBlockClientId: firstDraggedBlockClientId, listViewRef: elementRef, blockDropTarget } ), description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: describedById, children: description }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalTreeGrid, { id, className: dist_clsx("block-editor-list-view-tree", { "is-dragging": draggedClientIds?.length > 0 && blockDropTargetIndex !== void 0 }), "aria-label": (0,external_wp_i18n_namespaceObject.__)("Block navigation structure"), ref: treeGridRef, onCollapseRow: collapseRow, onExpandRow: expandRow, onFocusRow: focusRow, applicationAriaLabel: (0,external_wp_i18n_namespaceObject.__)("Block navigation structure"), "aria-describedby": describedById, style: { "--wp-admin--list-view-dragged-items-height": draggedClientIds?.length ? `${BLOCK_LIST_ITEM_HEIGHT * (draggedClientIds.length - 1)}px` : null }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( branch_default, { blocks: clientIdsTree, parentId: rootClientId, selectBlock: selectEditorBlock, showBlockMovers, fixedListWindow, selectedClientIds, isExpanded, showAppender } ) }) } ) ] }); } const PrivateListView = (0,external_wp_element_namespaceObject.forwardRef)(ListViewComponent); var list_view_list_view_default = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivateListView, { ref, ...props, showAppender: false, rootClientId: null, onSelect: null, additionalBlockContent: null, blockSettingsMenu: void 0 } ); }); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/dropdown.js function BlockNavigationDropdownToggle({ isEnabled, onToggle, isOpen, innerRef, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...props, ref: innerRef, icon: list_view_default, "aria-expanded": isOpen, "aria-haspopup": "true", onClick: isEnabled ? onToggle : void 0, label: (0,external_wp_i18n_namespaceObject.__)("List view"), className: "block-editor-block-navigation", "aria-disabled": !isEnabled } ); } function BlockNavigationDropdown({ isDisabled, ...props }, ref) { external_wp_deprecated_default()("wp.blockEditor.BlockNavigationDropdown", { since: "6.1", alternative: "wp.components.Dropdown and wp.blockEditor.ListView" }); const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)( (select) => !!select(store).getBlockCount(), [] ); const isEnabled = hasBlocks && !isDisabled; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { contentClassName: "block-editor-block-navigation__popover", popoverProps: { placement: "bottom-start" }, renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockNavigationDropdownToggle, { ...props, innerRef: ref, isOpen, onToggle, isEnabled } ), renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-navigation__container", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-block-navigation__label", children: (0,external_wp_i18n_namespaceObject.__)("List view") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(list_view_list_view_default, {}) ] }) } ); } var dropdown_default = (0,external_wp_element_namespaceObject.forwardRef)(BlockNavigationDropdown); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/preview-panel.js function BlockStylesPreviewPanel({ genericPreviewBlock, style, className, activeStyle }) { const example = (0,external_wp_blocks_namespaceObject.getBlockType)(genericPreviewBlock.name)?.example; const styleClassName = replaceActiveStyle(className, activeStyle, style); const previewBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => { return { ...genericPreviewBlock, title: style.label || style.name, description: style.description, initialAttributes: { ...genericPreviewBlock.attributes, className: styleClassName + " block-editor-block-styles__block-preview-container" }, example }; }, [genericPreviewBlock, styleClassName]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_panel_default, { item: previewBlocks }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/index.js const block_styles_noop = () => { }; function BlockStyles({ clientId, onSwitch = block_styles_noop, onHoverClassName = block_styles_noop }) { const { onSelect, stylesToRender, activeStyle, genericPreviewBlock, className: previewClassName } = useStylesForBlocks({ clientId, onSwitch }); const [hoveredStyle, setHoveredStyle] = (0,external_wp_element_namespaceObject.useState)(null); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); if (!stylesToRender || stylesToRender.length === 0) { return null; } const debouncedSetHoveredStyle = (0,external_wp_compose_namespaceObject.debounce)(setHoveredStyle, 250); const onSelectStylePreview = (style) => { onSelect(style); onHoverClassName(null); setHoveredStyle(null); debouncedSetHoveredStyle.cancel(); }; const styleItemHandler = (item) => { if (hoveredStyle === item) { debouncedSetHoveredStyle.cancel(); return; } debouncedSetHoveredStyle(item); onHoverClassName(item?.name ?? null); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-styles", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-styles__variants", children: stylesToRender.map((style) => { const buttonText = style.label || style.name; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: dist_clsx( "block-editor-block-styles__item", { "is-active": activeStyle.name === style.name } ), variant: "secondary", label: buttonText, onMouseEnter: () => styleItemHandler(style), onFocus: () => styleItemHandler(style), onMouseLeave: () => styleItemHandler(null), onBlur: () => styleItemHandler(null), onClick: () => onSelectStylePreview(style), "aria-current": activeStyle.name === style.name, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalTruncate, { numberOfLines: 1, className: "block-editor-block-styles__item-text", children: buttonText } ) }, style.name ); }) }), hoveredStyle && !isMobileViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Popover, { placement: "left-start", offset: 34, focusOnMount: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "block-editor-block-styles__preview-panel", onMouseLeave: () => styleItemHandler(null), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockStylesPreviewPanel, { activeStyle, className: previewClassName, genericPreviewBlock, style: hoveredStyle } ) } ) } ) ] }); } var block_styles_default = BlockStyles; ;// ./node_modules/@wordpress/icons/build-module/library/paragraph.js var paragraph_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: "m9.99609 14v-.2251l.00391.0001v6.225h1.5v-14.5h2.5v14.5h1.5v-14.5h3v-1.5h-8.50391c-2.76142 0-5 2.23858-5 5 0 2.7614 2.23858 5 5 5z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-1.js var heading_level_1_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: "M17.6 7c-.6.9-1.5 1.7-2.6 2v1h2v7h2V7h-1.4zM11 11H7V7H5v10h2v-4h4v4h2V7h-2v4z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-2.js var heading_level_2_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: "M9 11.1H5v-4H3v10h2v-4h4v4h2v-10H9v4zm8 4c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6v1.5h8v-2H17z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-3.js var heading_level_3_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: "M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.3 1.7c-.4-.4-1-.7-1.6-.8v-.1c.6-.2 1.1-.5 1.5-.9.3-.4.5-.8.5-1.3 0-.4-.1-.8-.3-1.1-.2-.3-.5-.6-.8-.8-.4-.2-.8-.4-1.2-.5-.6-.1-1.1-.2-1.6-.2-.6 0-1.3.1-1.8.3s-1.1.5-1.6.9l1.2 1.4c.4-.2.7-.4 1.1-.6.3-.2.7-.3 1.1-.3.4 0 .8.1 1.1.3.3.2.4.5.4.8 0 .4-.2.7-.6.9-.7.3-1.5.5-2.2.4v1.6c.5 0 1 0 1.5.1.3.1.7.2 1 .3.2.1.4.2.5.4s.1.4.1.6c0 .3-.2.7-.5.8-.4.2-.9.3-1.4.3s-1-.1-1.4-.3c-.4-.2-.8-.4-1.2-.7L13 15.6c.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.6 0 1.1-.1 1.6-.2.4-.1.9-.2 1.3-.5.4-.2.7-.5.9-.9.2-.4.3-.8.3-1.2 0-.6-.3-1.1-.7-1.5z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-4.js var heading_level_4_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 13V7h-3l-4 6v2h5v2h2v-2h1v-2h-1zm-2 0h-2.8L18 9v4zm-9-2H5V7H3v10h2v-4h4v4h2V7H9v4z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-5.js var heading_level_5_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: "M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.7 1.2c-.2-.3-.5-.7-.8-.9-.3-.3-.7-.5-1.1-.6-.5-.1-.9-.2-1.4-.2-.2 0-.5.1-.7.1-.2.1-.5.1-.7.2l.1-1.9h4.3V7H14l-.3 5 1 .6.5-.2.4-.1c.1-.1.3-.1.4-.1h.5c.5 0 1 .1 1.4.4.4.2.6.7.6 1.1 0 .4-.2.8-.6 1.1-.4.3-.9.4-1.4.4-.4 0-.9-.1-1.3-.3-.4-.2-.7-.4-1.1-.7 0 0-1.1 1.4-1 1.5.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.5 0 1-.1 1.5-.3s.9-.4 1.3-.7c.4-.3.7-.7.9-1.1s.3-.9.3-1.4-.1-1-.3-1.4z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-6.js var heading_level_6_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.7 12.4c-.2-.3-.4-.6-.7-.9s-.6-.5-1-.6c-.4-.2-.8-.2-1.2-.2-.5 0-.9.1-1.3.3s-.8.5-1.2.8c0-.5 0-.9.2-1.4l.6-.9c.2-.2.5-.4.8-.5.6-.2 1.3-.2 1.9 0 .3.1.6.3.8.5 0 0 1.3-1.3 1.3-1.4-.4-.3-.9-.6-1.4-.8-.6-.2-1.3-.3-2-.3-.6 0-1.1.1-1.7.4-.5.2-1 .5-1.4.9-.4.4-.8 1-1 1.6-.3.7-.4 1.5-.4 2.3s.1 1.5.3 2.1c.2.6.6 1.1 1 1.5.4.4.9.7 1.4.9 1 .3 2 .3 3 0 .4-.1.8-.3 1.2-.6.3-.3.6-.6.8-1 .2-.5.3-.9.3-1.4s-.1-.9-.3-1.3zm-2 2.1c-.1.2-.3.4-.4.5-.1.1-.3.2-.5.2-.2.1-.4.1-.6.1-.2.1-.5 0-.7-.1-.2 0-.3-.2-.5-.3-.1-.2-.3-.4-.4-.6-.2-.3-.3-.7-.3-1 .3-.3.6-.5 1-.7.3-.1.7-.2 1-.2.4 0 .8.1 1.1.3.3.3.4.7.4 1.1 0 .2 0 .5-.1.7zM9 11H5V7H3v10h2v-4h4v4h2V7H9v4z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-heading-level-dropdown/heading-level-icon.js const LEVEL_TO_PATH = { 0: paragraph_default, 1: heading_level_1_default, 2: heading_level_2_default, 3: heading_level_3_default, 4: heading_level_4_default, 5: heading_level_5_default, 6: heading_level_6_default }; function HeadingLevelIcon({ level }) { if (LEVEL_TO_PATH[level]) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: LEVEL_TO_PATH[level] }); } return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-heading-level-dropdown/index.js const HEADING_LEVELS = [1, 2, 3, 4, 5, 6]; const block_heading_level_dropdown_POPOVER_PROPS = { className: "block-library-heading-level-dropdown" }; function HeadingLevelDropdown({ options = HEADING_LEVELS, value, onChange }) { const validOptions = options.filter( (option) => option === 0 || HEADING_LEVELS.includes(option) ).sort((a, b) => a - b); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarDropdownMenu, { popoverProps: block_heading_level_dropdown_POPOVER_PROPS, icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(HeadingLevelIcon, { level: value }), label: (0,external_wp_i18n_namespaceObject.__)("Change level"), controls: validOptions.map((targetLevel) => { const isActive = targetLevel === value; return { icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(HeadingLevelIcon, { level: targetLevel }), title: targetLevel === 0 ? (0,external_wp_i18n_namespaceObject.__)("Paragraph") : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: heading level e.g: "1", "2", "3" (0,external_wp_i18n_namespaceObject.__)("Heading %d"), targetLevel ), isActive, onClick() { onChange(targetLevel); }, role: "menuitemradio" }; }) } ); } ;// ./node_modules/@wordpress/icons/build-module/library/layout.js var layout_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" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/block-variation-picker/index.js function BlockVariationPicker({ icon = layout_layout_default, label = (0,external_wp_i18n_namespaceObject.__)("Choose variation"), instructions = (0,external_wp_i18n_namespaceObject.__)("Select a variation to start with:"), variations, onSelect, allowSkip }) { const classes = dist_clsx("block-editor-block-variation-picker", { "has-many-variations": variations.length > 4 }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Placeholder, { icon, label, instructions, className: classes, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "ul", { className: "block-editor-block-variation-picker__variations", role: "list", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Block variations"), children: variations.map((variation) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", icon: variation.icon && variation.icon.src ? variation.icon.src : variation.icon, iconSize: 48, onClick: () => onSelect(variation), className: "block-editor-block-variation-picker__variation", label: variation.description || variation.title } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-variation-picker__variation-label", children: variation.title }) ] }, variation.name)) } ), allowSkip && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-variation-picker__skip", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", onClick: () => onSelect(), children: (0,external_wp_i18n_namespaceObject.__)("Skip") } ) }) ] } ); } var block_variation_picker_default = BlockVariationPicker; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/constants.js const VIEWMODES = { carousel: "carousel", grid: "grid" }; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/setup-toolbar.js const Actions = ({ onBlockPatternSelect }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-pattern-setup__actions", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: onBlockPatternSelect, children: (0,external_wp_i18n_namespaceObject.__)("Choose") } ) }); const CarouselNavigation = ({ handlePrevious, handleNext, activeSlide, totalSlides }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-pattern-setup__navigation", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, label: (0,external_wp_i18n_namespaceObject.__)("Previous pattern"), onClick: handlePrevious, disabled: activeSlide === 0, accessibleWhenDisabled: true } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default, label: (0,external_wp_i18n_namespaceObject.__)("Next pattern"), onClick: handleNext, disabled: activeSlide === totalSlides - 1, accessibleWhenDisabled: true } ) ] }); const SetupToolbar = ({ viewMode, setViewMode, handlePrevious, handleNext, activeSlide, totalSlides, onBlockPatternSelect }) => { const isCarouselView = viewMode === VIEWMODES.carousel; const displayControls = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-pattern-setup__display-controls", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", icon: stretch_full_width_default, label: (0,external_wp_i18n_namespaceObject.__)("Carousel view"), onClick: () => setViewMode(VIEWMODES.carousel), isPressed: isCarouselView } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", icon: grid_grid_default, label: (0,external_wp_i18n_namespaceObject.__)("Grid view"), onClick: () => setViewMode(VIEWMODES.grid), isPressed: viewMode === VIEWMODES.grid } ) ] }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-pattern-setup__toolbar", children: [ isCarouselView && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CarouselNavigation, { handlePrevious, handleNext, activeSlide, totalSlides } ), displayControls, isCarouselView && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Actions, { onBlockPatternSelect }) ] }); }; var setup_toolbar_default = SetupToolbar; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/use-patterns-setup.js function usePatternsSetup(clientId, blockName, filterPatternsFn) { return (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockRootClientId, getPatternsByBlockTypes, __experimentalGetAllowedPatterns } = select(store); const rootClientId = getBlockRootClientId(clientId); if (filterPatternsFn) { return __experimentalGetAllowedPatterns(rootClientId).filter( filterPatternsFn ); } return getPatternsByBlockTypes(blockName, rootClientId); }, [clientId, blockName, filterPatternsFn] ); } var use_patterns_setup_default = usePatternsSetup; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/index.js const SetupContent = ({ viewMode, activeSlide, patterns, onBlockPatternSelect, showTitles }) => { const containerClass = "block-editor-block-pattern-setup__container"; if (viewMode === VIEWMODES.carousel) { const slideClass = /* @__PURE__ */ new Map([ [activeSlide, "active-slide"], [activeSlide - 1, "previous-slide"], [activeSlide + 1, "next-slide"] ]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-pattern-setup__carousel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: containerClass, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "carousel-container", children: patterns.map((pattern, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockPatternSlide, { active: index === activeSlide, className: slideClass.get(index) || "", pattern }, pattern.name )) }) }) }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-pattern-setup__grid", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite, { role: "listbox", className: containerClass, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Patterns list"), children: patterns.map((pattern) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_pattern_setup_BlockPattern, { pattern, onSelect: onBlockPatternSelect, showTitles }, pattern.name )) } ) }); }; function block_pattern_setup_BlockPattern({ pattern, onSelect, showTitles }) { const baseClassName = "block-editor-block-pattern-setup-list"; const { blocks, description, viewportWidth = 700 } = pattern; const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)( block_pattern_setup_BlockPattern, `${baseClassName}__item-description` ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseClassName}__list-item`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Composite.Item, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { "aria-describedby": description ? descriptionId : void 0, "aria-label": pattern.title, className: `${baseClassName}__item` } ), id: `${baseClassName}__pattern__${pattern.name}`, role: "option", onClick: () => onSelect(blocks), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_preview_default, { blocks, viewportWidth } ), showTitles && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseClassName}__item-title`, children: pattern.title }), !!description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: description }) ] } ) }); } function BlockPatternSlide({ active, className, pattern, minHeight }) { const { blocks, title, description } = pattern; const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)( BlockPatternSlide, "block-editor-block-pattern-setup-list__item-description" ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { "aria-hidden": !active, role: "img", className: `pattern-slide ${className}`, "aria-label": title, "aria-describedby": description ? descriptionId : void 0, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_default, { blocks, minHeight }), !!description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: description }) ] } ); } const BlockPatternSetup = ({ clientId, blockName, filterPatternsFn, onBlockPatternSelect, initialViewMode = VIEWMODES.carousel, showTitles = false }) => { const [viewMode, setViewMode] = (0,external_wp_element_namespaceObject.useState)(initialViewMode); const [activeSlide, setActiveSlide] = (0,external_wp_element_namespaceObject.useState)(0); const { replaceBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); const patterns = use_patterns_setup_default(clientId, blockName, filterPatternsFn); if (!patterns?.length) { return null; } const onBlockPatternSelectDefault = (blocks) => { const clonedBlocks = blocks.map((block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)); replaceBlock(clientId, clonedBlocks); }; const onPatternSelectCallback = onBlockPatternSelect || onBlockPatternSelectDefault; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: `block-editor-block-pattern-setup view-mode-${viewMode}`, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SetupContent, { viewMode, activeSlide, patterns, onBlockPatternSelect: onPatternSelectCallback, showTitles } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( setup_toolbar_default, { viewMode, setViewMode, activeSlide, totalSlides: patterns.length, handleNext: () => { setActiveSlide( (active) => Math.min(active + 1, patterns.length - 1) ); }, handlePrevious: () => { setActiveSlide( (active) => Math.max(active - 1, 0) ); }, onBlockPatternSelect: () => { onPatternSelectCallback( patterns[activeSlide].blocks ); } } ) ] } ) }); }; var block_pattern_setup_default = BlockPatternSetup; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-variation-transforms/index.js function VariationsButtons({ className, onSelectVariation, selectedValue, variations }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Transform to variation") }), variations.map((variation) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, size: "compact", icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: variation.icon, showColors: true }), isPressed: selectedValue === variation.name, label: selectedValue === variation.name ? variation.title : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Block or block variation name. */ (0,external_wp_i18n_namespaceObject.__)("Transform to %s"), variation.title ), onClick: () => onSelectVariation(variation.name), "aria-label": variation.title, showTooltip: true }, variation.name )) ] }); } function VariationsDropdown({ className, onSelectVariation, selectedValue, variations }) { const selectOptions = variations.map( ({ name, title, description }) => ({ value: name, label: title, info: description }) ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { className, label: (0,external_wp_i18n_namespaceObject.__)("Transform to variation"), text: (0,external_wp_i18n_namespaceObject.__)("Transform to variation"), popoverProps: { position: "bottom center", className: `${className}__popover` }, icon: chevron_down_default, toggleProps: { iconPosition: "right" }, children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItemsChoice, { choices: selectOptions, value: selectedValue, onSelect: onSelectVariation } ) }) } ); } function VariationsToggleGroupControl({ className, onSelectVariation, selectedValue, variations }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { label: (0,external_wp_i18n_namespaceObject.__)("Transform to variation"), value: selectedValue, hideLabelFromVision: true, onChange: onSelectVariation, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, children: variations.map((variation) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: variation.icon, showColors: true }), value: variation.name, label: selectedValue === variation.name ? variation.title : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Block or block variation name. */ (0,external_wp_i18n_namespaceObject.__)("Transform to %s"), variation.title ) }, variation.name )) } ) }); } function __experimentalBlockVariationTransforms({ blockClientId }) { const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { activeBlockVariation, unfilteredVariations, blockName, isContentOnly, isSection } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getActiveBlockVariation, getBlockVariations } = select(external_wp_blocks_namespaceObject.store); const { getBlockName, getBlockAttributes, getBlockEditingMode, isSectionBlock } = unlock(select(store)); const name = blockClientId && getBlockName(blockClientId); const { hasContentRoleAttribute } = unlock(select(external_wp_blocks_namespaceObject.store)); const isContentBlock = hasContentRoleAttribute(name); return { activeBlockVariation: getActiveBlockVariation( name, getBlockAttributes(blockClientId), "transform" ), unfilteredVariations: name && getBlockVariations(name, "transform"), blockName: name, isContentOnly: getBlockEditingMode(blockClientId) === "contentOnly" && !isContentBlock, isSection: isSectionBlock(blockClientId) }; }, [blockClientId] ); const variations = (0,external_wp_element_namespaceObject.useMemo)(() => { if (blockName === "core/paragraph") { if (activeBlockVariation?.name === "stretchy-paragraph" || unfilteredVariations.every( (v) => ["paragraph", "stretchy-paragraph"].includes(v.name) )) { return []; } return unfilteredVariations.filter( (v) => v.name !== "stretchy-paragraph" ); } else if (blockName === "core/heading") { if (activeBlockVariation?.name === "stretchy-heading" || unfilteredVariations.every( (v) => ["heading", "stretchy-heading"].includes(v.name) )) { return []; } return unfilteredVariations.filter( (v) => v.name !== "stretchy-heading" ); } return unfilteredVariations; }, [activeBlockVariation?.name, blockName, unfilteredVariations]); const selectedValue = activeBlockVariation?.name; const hasUniqueIcons = (0,external_wp_element_namespaceObject.useMemo)(() => { const variationIcons = /* @__PURE__ */ new Set(); if (!variations) { return false; } variations.forEach((variation) => { if (variation.icon) { variationIcons.add(variation.icon?.src || variation.icon); } }); return variationIcons.size === variations.length; }, [variations]); const onSelectVariation = (variationName) => { updateBlockAttributes(blockClientId, { ...variations.find(({ name }) => name === variationName).attributes }); }; const hideVariationsForSections = window?.__experimentalContentOnlyPatternInsertion && isSection; if (!variations?.length || isContentOnly || hideVariationsForSections) { return null; } const baseClass = "block-editor-block-variation-transforms"; const showButtons = variations.length > 5; const ButtonComponent = showButtons ? VariationsButtons : VariationsToggleGroupControl; const Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Component, { className: baseClass, onSelectVariation, selectedValue, variations } ); } var block_variation_transforms_default = __experimentalBlockVariationTransforms; ;// ./node_modules/@wordpress/block-editor/build-module/components/color-palette/with-color-context.js var with_color_context_default = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)((WrappedComponent) => { return (props) => { const [ defaultColors, themeColors, customColors, enableCustomColors, enableDefaultColors ] = use_settings_useSettings( "color.palette.default", "color.palette.theme", "color.palette.custom", "color.custom", "color.defaultPalette" ); const _colors = enableDefaultColors ? [ ...themeColors || [], ...defaultColors || [], ...customColors || [] ] : [...themeColors || [], ...customColors || []]; const { colors = _colors, disableCustomColors = !enableCustomColors } = props; const hasColorsToChoose = colors && colors.length > 0 || !disableCustomColors; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WrappedComponent, { ...{ ...props, colors, disableCustomColors, hasColorsToChoose } } ); }; }, "withColorContext"); ;// ./node_modules/@wordpress/block-editor/build-module/components/color-palette/index.js var color_palette_default = with_color_context_default(external_wp_components_namespaceObject.ColorPalette); ;// ./node_modules/@wordpress/block-editor/build-module/components/color-palette/control.js function ColorPaletteControl({ onChange, value, ...otherProps }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( control_default, { ...otherProps, onColorChange: onChange, colorValue: value, gradients: [], disableCustomGradients: true } ); } ;// external ["wp","date"] const external_wp_date_namespaceObject = window["wp"]["date"]; ;// ./node_modules/@wordpress/block-editor/build-module/components/date-format-picker/index.js const exampleDate = /* @__PURE__ */ new Date(); exampleDate.setDate(20); exampleDate.setMonth(exampleDate.getMonth() - 3); if (exampleDate.getMonth() === 4) { exampleDate.setMonth(3); } function DateFormatPicker({ format, defaultFormat, onChange }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { as: "fieldset", spacing: 4, className: "block-editor-date-format-picker", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Date format") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Default format"), help: `${(0,external_wp_i18n_namespaceObject.__)("Example:")} ${(0,external_wp_date_namespaceObject.dateI18n)( defaultFormat, exampleDate )}`, checked: !format, onChange: (checked) => onChange(checked ? null : defaultFormat) } ), format && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NonDefaultControls, { format, onChange }) ] } ); } function NonDefaultControls({ format, onChange }) { const suggestedFormats = [ .../* @__PURE__ */ new Set([ /* translators: See https://www.php.net/manual/datetime.format.php */ "Y-m-d", /* translators: See https://www.php.net/manual/datetime.format.php */ (0,external_wp_i18n_namespaceObject._x)("n/j/Y", "short date format"), /* translators: See https://www.php.net/manual/datetime.format.php */ (0,external_wp_i18n_namespaceObject._x)("n/j/Y g:i A", "short date format with time"), /* translators: See https://www.php.net/manual/datetime.format.php */ (0,external_wp_i18n_namespaceObject._x)("M j, Y", "medium date format"), /* translators: See https://www.php.net/manual/datetime.format.php */ (0,external_wp_i18n_namespaceObject._x)("M j, Y g:i A", "medium date format with time"), /* translators: See https://www.php.net/manual/datetime.format.php */ (0,external_wp_i18n_namespaceObject._x)("F j, Y", "long date format"), /* translators: See https://www.php.net/manual/datetime.format.php */ (0,external_wp_i18n_namespaceObject._x)("M j", "short date format without the year") ]) ]; const suggestedOptions = [ ...suggestedFormats.map((suggestedFormat, index) => ({ key: `suggested-${index}`, name: (0,external_wp_date_namespaceObject.dateI18n)(suggestedFormat, exampleDate), format: suggestedFormat })), { key: "human-diff", name: (0,external_wp_date_namespaceObject.humanTimeDiff)(exampleDate), format: "human-diff" } ]; const customOption = { key: "custom", name: (0,external_wp_i18n_namespaceObject.__)("Custom"), className: "block-editor-date-format-picker__custom-format-select-control__custom-option", hint: (0,external_wp_i18n_namespaceObject.__)("Enter your own date format") }; const [isCustom, setIsCustom] = (0,external_wp_element_namespaceObject.useState)( () => !!format && !suggestedOptions.some((option) => option.format === format) ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CustomSelectControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Choose a format"), options: [...suggestedOptions, customOption], value: isCustom ? customOption : suggestedOptions.find( (option) => option.format === format ) ?? customOption, onChange: ({ selectedItem }) => { if (selectedItem === customOption) { setIsCustom(true); } else { setIsCustom(false); onChange(selectedItem.format); } } } ), isCustom && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Custom format"), hideLabelFromVision: true, help: (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.__)( "Enter a date or time <Link>format string</Link>." ), { Link: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)( "https://wordpress.org/documentation/article/customize-date-and-time-format/" ) } ) } ), value: format, onChange: (value) => onChange(value) } ) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/dropdown.js const WithToolsPanelItem = ({ setting, children, panelId, ...props }) => { const clearValue = () => { if (setting.colorValue) { setting.onColorChange(); } else if (setting.gradientValue) { setting.onGradientChange(); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => { return !!setting.colorValue || !!setting.gradientValue; }, label: setting.label, onDeselect: clearValue, isShownByDefault: setting.isShownByDefault !== void 0 ? setting.isShownByDefault : true, ...props, className: "block-editor-tools-panel-color-gradient-settings__item", panelId, resetAllFilter: setting.resetAllFilter, children } ); }; const dropdown_LabeledColorIndicator = ({ colorValue, label }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ColorIndicator, { className: "block-editor-panel-color-gradient-settings__color-indicator", colorValue } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FlexItem, { className: "block-editor-panel-color-gradient-settings__color-name", title: label, children: label } ) ] }); const dropdown_renderToggle = (settings) => ({ onToggle, isOpen }) => { const { clearable, colorValue, gradientValue, onColorChange, onGradientChange, label } = settings; const colorButtonRef = (0,external_wp_element_namespaceObject.useRef)(void 0); const toggleProps = { onClick: onToggle, className: dist_clsx( "block-editor-panel-color-gradient-settings__dropdown", { "is-open": isOpen } ), "aria-expanded": isOpen, ref: colorButtonRef }; const clearValue = () => { if (colorValue) { onColorChange(); } else if (gradientValue) { onGradientChange(); } }; const value = colorValue ?? gradientValue; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...toggleProps, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( dropdown_LabeledColorIndicator, { colorValue: value, label } ) }), clearable && value && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Reset"), className: "block-editor-panel-color-gradient-settings__reset", size: "small", icon: reset_default, onClick: () => { clearValue(); if (isOpen) { onToggle(); } colorButtonRef.current?.focus(); } } ) ] }); }; function ColorGradientSettingsDropdown({ colors, disableCustomColors, disableCustomGradients, enableAlpha, gradients, settings, __experimentalIsRenderedInSidebar, ...props }) { let popoverProps; if (__experimentalIsRenderedInSidebar) { popoverProps = { placement: "left-start", offset: 36, shift: true }; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: settings.map((setting, index) => { const controlProps = { clearable: false, colorValue: setting.colorValue, colors, disableCustomColors, disableCustomGradients, enableAlpha, gradientValue: setting.gradientValue, gradients, label: setting.label, onColorChange: setting.onColorChange, onGradientChange: setting.onGradientChange, showTitle: false, __experimentalIsRenderedInSidebar, ...setting }; const toggleSettings = { clearable: setting.clearable, label: setting.label, colorValue: setting.colorValue, gradientValue: setting.gradientValue, onColorChange: setting.onColorChange, onGradientChange: setting.onGradientChange }; return setting && // If not in an `ItemGroup` wrap the dropdown in a // `ToolsPanelItem` /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WithToolsPanelItem, { setting, ...props, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, className: "block-editor-tools-panel-color-gradient-settings__dropdown", renderToggle: dropdown_renderToggle(toggleSettings), renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-panel-color-gradient-settings__dropdown-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( control_default, { ...controlProps } ) }) }) } ) }, index ); }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/panel-color-gradient-settings.js const panel_color_gradient_settings_colorsAndGradientKeys = [ "colors", "disableCustomColors", "gradients", "disableCustomGradients" ]; const PanelColorGradientSettingsInner = ({ className, colors, gradients, disableCustomColors, disableCustomGradients, children, settings, title, showTitle = true, __experimentalIsRenderedInSidebar, enableAlpha }) => { const panelId = (0,external_wp_compose_namespaceObject.useInstanceId)(PanelColorGradientSettingsInner); const { batch } = (0,external_wp_data_namespaceObject.useRegistry)(); if ((!colors || colors.length === 0) && (!gradients || gradients.length === 0) && disableCustomColors && disableCustomGradients && settings?.every( (setting) => (!setting.colors || setting.colors.length === 0) && (!setting.gradients || setting.gradients.length === 0) && (setting.disableCustomColors === void 0 || setting.disableCustomColors) && (setting.disableCustomGradients === void 0 || setting.disableCustomGradients) )) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalToolsPanel, { className: dist_clsx( "block-editor-panel-color-gradient-settings", className ), label: showTitle ? title : void 0, resetAll: () => { batch(() => { settings.forEach( ({ colorValue, gradientValue, onColorChange, onGradientChange }) => { if (colorValue) { onColorChange(); } else if (gradientValue) { onGradientChange(); } } ); }); }, panelId, __experimentalFirstVisibleItemClass: "first", __experimentalLastVisibleItemClass: "last", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ColorGradientSettingsDropdown, { settings, panelId, ...{ colors, gradients, disableCustomColors, disableCustomGradients, __experimentalIsRenderedInSidebar, enableAlpha } } ), !!children && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginY: 4 }), " ", children ] }) ] } ); }; const PanelColorGradientSettingsSelect = (props) => { const colorGradientSettings = useMultipleOriginColorsAndGradients(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PanelColorGradientSettingsInner, { ...{ ...colorGradientSettings, ...props } } ); }; const PanelColorGradientSettings = (props) => { if (panel_color_gradient_settings_colorsAndGradientKeys.every((key) => props.hasOwnProperty(key))) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelColorGradientSettingsInner, { ...props }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelColorGradientSettingsSelect, { ...props }); }; var panel_color_gradient_settings_default = PanelColorGradientSettings; ;// ./node_modules/@wordpress/icons/build-module/library/aspect-ratio.js var aspect_ratio_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 5.5h-13c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2v-9c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5h-13c-.3 0-.5-.2-.5-.5v-9c0-.3.2-.5.5-.5h13c.3 0 .5.2.5.5v9zM6.5 12H8v-2h2V8.5H6.5V12zm9.5 2h-2v1.5h3.5V12H16v2z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/constants.js const MIN_ZOOM = 100; const MAX_ZOOM = 300; const constants_POPOVER_PROPS = { placement: "bottom-start" }; ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/use-save-image.js const messages = { crop: (0,external_wp_i18n_namespaceObject.__)("Image cropped."), rotate: (0,external_wp_i18n_namespaceObject.__)("Image rotated."), cropAndRotate: (0,external_wp_i18n_namespaceObject.__)("Image cropped and rotated.") }; function useSaveImage({ crop, rotation, url, id, onSaveImage, onFinishEditing }) { const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const [isInProgress, setIsInProgress] = (0,external_wp_element_namespaceObject.useState)(false); const { editMediaEntity } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const settings = select(store).getSettings(); return { editMediaEntity: settings?.[mediaEditKey] }; }, []); const cancel = (0,external_wp_element_namespaceObject.useCallback)(() => { setIsInProgress(false); onFinishEditing(); }, [onFinishEditing]); const apply = (0,external_wp_element_namespaceObject.useCallback)(async () => { if (!editMediaEntity) { onFinishEditing(); createErrorNotice( (0,external_wp_i18n_namespaceObject.__)("Sorry, you are not allowed to edit images on this site."), { id: "image-editing-error", type: "snackbar" } ); return; } setIsInProgress(true); const modifiers = []; if (rotation > 0) { modifiers.push({ type: "rotate", args: { angle: rotation } }); } if (crop.width < 99.9 || crop.height < 99.9) { modifiers.push({ type: "crop", args: { left: crop.x, top: crop.y, width: crop.width, height: crop.height } }); } if (modifiers.length === 0) { setIsInProgress(false); onFinishEditing(); return; } const modifierType = modifiers.length === 1 ? modifiers[0].type : "cropAndRotate"; try { const savedImage = await editMediaEntity( id, { src: url, modifiers }, { throwOnError: true } ); if (savedImage) { onSaveImage({ id: savedImage.id, url: savedImage.source_url }); createSuccessNotice(messages[modifierType], { type: "snackbar", actions: [ { label: (0,external_wp_i18n_namespaceObject.__)("Undo"), onClick: () => { onSaveImage({ id, url }); } } ] }); } } catch (error) { createErrorNotice( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Error message. */ (0,external_wp_i18n_namespaceObject.__)("Could not edit image. %s"), (0,external_wp_dom_namespaceObject.__unstableStripHTML)(error.message) ), { id: "image-editing-error", type: "snackbar" } ); } finally { setIsInProgress(false); onFinishEditing(); } }, [ crop, rotation, id, url, onSaveImage, createErrorNotice, createSuccessNotice, onFinishEditing, editMediaEntity ]); return (0,external_wp_element_namespaceObject.useMemo)( () => ({ isInProgress, apply, cancel }), [isInProgress, apply, cancel] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/use-transform-image.js function useTransformImage({ url, naturalWidth, naturalHeight }) { const [editedUrl, setEditedUrl] = (0,external_wp_element_namespaceObject.useState)(); const [crop, setCrop] = (0,external_wp_element_namespaceObject.useState)(); const [position, setPosition] = (0,external_wp_element_namespaceObject.useState)({ x: 0, y: 0 }); const [zoom, setZoom] = (0,external_wp_element_namespaceObject.useState)(100); const [rotation, setRotation] = (0,external_wp_element_namespaceObject.useState)(0); const defaultAspect = naturalWidth / naturalHeight; const [aspect, setAspect] = (0,external_wp_element_namespaceObject.useState)(defaultAspect); const rotateClockwise = (0,external_wp_element_namespaceObject.useCallback)(() => { const angle = (rotation + 90) % 360; let naturalAspectRatio = defaultAspect; if (rotation % 180 === 90) { naturalAspectRatio = 1 / defaultAspect; } if (angle === 0) { setEditedUrl(); setRotation(angle); setAspect(defaultAspect); setPosition((prevPosition) => ({ x: -(prevPosition.y * naturalAspectRatio), y: prevPosition.x * naturalAspectRatio })); return; } function editImage(event) { const canvas = document.createElement("canvas"); let translateX = 0; let translateY = 0; if (angle % 180) { canvas.width = event.target.height; canvas.height = event.target.width; } else { canvas.width = event.target.width; canvas.height = event.target.height; } if (angle === 90 || angle === 180) { translateX = canvas.width; } if (angle === 270 || angle === 180) { translateY = canvas.height; } const context = canvas.getContext("2d"); context.translate(translateX, translateY); context.rotate(angle * Math.PI / 180); context.drawImage(event.target, 0, 0); canvas.toBlob((blob) => { setEditedUrl(URL.createObjectURL(blob)); setRotation(angle); setAspect(canvas.width / canvas.height); setPosition((prevPosition) => ({ x: -(prevPosition.y * naturalAspectRatio), y: prevPosition.x * naturalAspectRatio })); }); } const el = new window.Image(); el.src = url; el.onload = editImage; const imgCrossOrigin = (0,external_wp_hooks_namespaceObject.applyFilters)( "media.crossOrigin", void 0, url ); if (typeof imgCrossOrigin === "string") { el.crossOrigin = imgCrossOrigin; } }, [rotation, defaultAspect, url]); return (0,external_wp_element_namespaceObject.useMemo)( () => ({ editedUrl, setEditedUrl, crop, setCrop, position, setPosition, zoom, setZoom, rotation, setRotation, rotateClockwise, aspect, setAspect, defaultAspect }), [ editedUrl, crop, position, zoom, rotation, rotateClockwise, aspect, defaultAspect ] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/context.js const ImageEditingContext = (0,external_wp_element_namespaceObject.createContext)({}); ImageEditingContext.displayName = "ImageEditingContext"; const useImageEditingContext = () => (0,external_wp_element_namespaceObject.useContext)(ImageEditingContext); function ImageEditingProvider({ id, url, naturalWidth, naturalHeight, onFinishEditing, onSaveImage, children }) { const transformImage = useTransformImage({ url, naturalWidth, naturalHeight }); const saveImage = useSaveImage({ id, url, onSaveImage, onFinishEditing, ...transformImage }); const providerValue = (0,external_wp_element_namespaceObject.useMemo)( () => ({ ...transformImage, ...saveImage }), [transformImage, saveImage] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageEditingContext.Provider, { value: providerValue, children }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/aspect-ratio-dropdown.js function AspectRatioGroup({ aspectRatios, isDisabled, label, onClick, value }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label, children: aspectRatios.map(({ name, slug, ratio }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { disabled: isDisabled, onClick: () => { onClick(ratio); }, role: "menuitemradio", isSelected: ratio === value, icon: ratio === value ? check_check_default : void 0, children: name }, slug )) }); } function ratioToNumber(str) { const [a, b, ...rest] = str.split("/").map(Number); if (a <= 0 || b <= 0 || Number.isNaN(a) || Number.isNaN(b) || rest.length) { return NaN; } return b ? a / b : a; } function presetRatioAsNumber({ ratio, ...rest }) { return { ratio: ratioToNumber(ratio), ...rest }; } function AspectRatioDropdown({ toggleProps }) { const { isInProgress, aspect, setAspect, defaultAspect } = useImageEditingContext(); const [defaultRatios, themeRatios, showDefaultRatios] = use_settings_useSettings( "dimensions.aspectRatios.default", "dimensions.aspectRatios.theme", "dimensions.defaultAspectRatios" ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { icon: aspect_ratio_default, label: (0,external_wp_i18n_namespaceObject.__)("Aspect Ratio"), popoverProps: constants_POPOVER_PROPS, toggleProps, children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AspectRatioGroup, { isDisabled: isInProgress, onClick: (newAspect) => { setAspect(newAspect); onClose(); }, value: aspect, aspectRatios: [ // All ratios should be mirrored in AspectRatioTool in @wordpress/block-editor. { slug: "original", name: (0,external_wp_i18n_namespaceObject.__)("Original"), ratio: defaultAspect }, ...showDefaultRatios ? defaultRatios.map(presetRatioAsNumber).filter(({ ratio }) => ratio === 1) : [] ] } ), themeRatios?.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AspectRatioGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Theme"), isDisabled: isInProgress, onClick: (newAspect) => { setAspect(newAspect); onClose(); }, value: aspect, aspectRatios: themeRatios } ), showDefaultRatios && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AspectRatioGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Landscape"), isDisabled: isInProgress, onClick: (newAspect) => { setAspect(newAspect); onClose(); }, value: aspect, aspectRatios: defaultRatios.map(presetRatioAsNumber).filter(({ ratio }) => ratio > 1) } ), showDefaultRatios && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AspectRatioGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Portrait"), isDisabled: isInProgress, onClick: (newAspect) => { setAspect(newAspect); onClose(); }, value: aspect, aspectRatios: defaultRatios.map(presetRatioAsNumber).filter(({ ratio }) => ratio < 1) } ) ] }) } ); } ;// ./node_modules/tslib/tslib.es6.mjs /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { 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); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { 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; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 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]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 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; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; 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); 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); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 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"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 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"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* harmony default export */ const tslib_es6 = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); // EXTERNAL MODULE: ./node_modules/normalize-wheel/index.js var normalize_wheel = __webpack_require__(7520); var normalize_wheel_default = /*#__PURE__*/__webpack_require__.n(normalize_wheel); ;// ./node_modules/react-easy-crop/index.module.js /** * Compute the dimension of the crop area based on media size, * aspect ratio and optionally rotation */ function getCropSize(mediaWidth, mediaHeight, containerWidth, containerHeight, aspect, rotation) { if (rotation === void 0) { rotation = 0; } var _a = rotateSize(mediaWidth, mediaHeight, rotation), width = _a.width, height = _a.height; var fittingWidth = Math.min(width, containerWidth); var fittingHeight = Math.min(height, containerHeight); if (fittingWidth > fittingHeight * aspect) { return { width: fittingHeight * aspect, height: fittingHeight }; } return { width: fittingWidth, height: fittingWidth / aspect }; } /** * Compute media zoom. * We fit the media into the container with "max-width: 100%; max-height: 100%;" */ function getMediaZoom(mediaSize) { // Take the axis with more pixels to improve accuracy return mediaSize.width > mediaSize.height ? mediaSize.width / mediaSize.naturalWidth : mediaSize.height / mediaSize.naturalHeight; } /** * Ensure a new media position stays in the crop area. */ function restrictPosition(position, mediaSize, cropSize, zoom, rotation) { if (rotation === void 0) { rotation = 0; } var _a = rotateSize(mediaSize.width, mediaSize.height, rotation), width = _a.width, height = _a.height; return { x: restrictPositionCoord(position.x, width, cropSize.width, zoom), y: restrictPositionCoord(position.y, height, cropSize.height, zoom) }; } function restrictPositionCoord(position, mediaSize, cropSize, zoom) { var maxPosition = mediaSize * zoom / 2 - cropSize / 2; return clamp(position, -maxPosition, maxPosition); } function getDistanceBetweenPoints(pointA, pointB) { return Math.sqrt(Math.pow(pointA.y - pointB.y, 2) + Math.pow(pointA.x - pointB.x, 2)); } function getRotationBetweenPoints(pointA, pointB) { return Math.atan2(pointB.y - pointA.y, pointB.x - pointA.x) * 180 / Math.PI; } /** * Compute the output cropped area of the media in percentages and pixels. * x/y are the top-left coordinates on the src media */ function computeCroppedArea(crop, mediaSize, cropSize, aspect, zoom, rotation, restrictPosition) { if (rotation === void 0) { rotation = 0; } if (restrictPosition === void 0) { restrictPosition = true; } // if the media is rotated by the user, we cannot limit the position anymore // as it might need to be negative. var limitAreaFn = restrictPosition ? limitArea : noOp; var mediaBBoxSize = rotateSize(mediaSize.width, mediaSize.height, rotation); var mediaNaturalBBoxSize = rotateSize(mediaSize.naturalWidth, mediaSize.naturalHeight, rotation); // calculate the crop area in percentages // in the rotated space var croppedAreaPercentages = { x: limitAreaFn(100, ((mediaBBoxSize.width - cropSize.width / zoom) / 2 - crop.x / zoom) / mediaBBoxSize.width * 100), y: limitAreaFn(100, ((mediaBBoxSize.height - cropSize.height / zoom) / 2 - crop.y / zoom) / mediaBBoxSize.height * 100), width: limitAreaFn(100, cropSize.width / mediaBBoxSize.width * 100 / zoom), height: limitAreaFn(100, cropSize.height / mediaBBoxSize.height * 100 / zoom) }; // we compute the pixels size naively var widthInPixels = Math.round(limitAreaFn(mediaNaturalBBoxSize.width, croppedAreaPercentages.width * mediaNaturalBBoxSize.width / 100)); var heightInPixels = Math.round(limitAreaFn(mediaNaturalBBoxSize.height, croppedAreaPercentages.height * mediaNaturalBBoxSize.height / 100)); var isImgWiderThanHigh = mediaNaturalBBoxSize.width >= mediaNaturalBBoxSize.height * aspect; // then we ensure the width and height exactly match the aspect (to avoid rounding approximations) // if the media is wider than high, when zoom is 0, the crop height will be equals to image height // thus we want to compute the width from the height and aspect for accuracy. // Otherwise, we compute the height from width and aspect. var sizePixels = isImgWiderThanHigh ? { width: Math.round(heightInPixels * aspect), height: heightInPixels } : { width: widthInPixels, height: Math.round(widthInPixels / aspect) }; var croppedAreaPixels = __assign(__assign({}, sizePixels), { x: Math.round(limitAreaFn(mediaNaturalBBoxSize.width - sizePixels.width, croppedAreaPercentages.x * mediaNaturalBBoxSize.width / 100)), y: Math.round(limitAreaFn(mediaNaturalBBoxSize.height - sizePixels.height, croppedAreaPercentages.y * mediaNaturalBBoxSize.height / 100)) }); return { croppedAreaPercentages: croppedAreaPercentages, croppedAreaPixels: croppedAreaPixels }; } /** * Ensure the returned value is between 0 and max */ function limitArea(max, value) { return Math.min(max, Math.max(0, value)); } function noOp(_max, value) { return value; } /** * Compute crop and zoom from the croppedAreaPercentages. */ function getInitialCropFromCroppedAreaPercentages(croppedAreaPercentages, mediaSize, rotation, cropSize, minZoom, maxZoom) { var mediaBBoxSize = rotateSize(mediaSize.width, mediaSize.height, rotation); // This is the inverse process of computeCroppedArea var zoom = clamp(cropSize.width / mediaBBoxSize.width * (100 / croppedAreaPercentages.width), minZoom, maxZoom); var crop = { x: zoom * mediaBBoxSize.width / 2 - cropSize.width / 2 - mediaBBoxSize.width * zoom * (croppedAreaPercentages.x / 100), y: zoom * mediaBBoxSize.height / 2 - cropSize.height / 2 - mediaBBoxSize.height * zoom * (croppedAreaPercentages.y / 100) }; return { crop: crop, zoom: zoom }; } /** * Compute zoom from the croppedAreaPixels */ function getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize) { var mediaZoom = getMediaZoom(mediaSize); return cropSize.height > cropSize.width ? cropSize.height / (croppedAreaPixels.height * mediaZoom) : cropSize.width / (croppedAreaPixels.width * mediaZoom); } /** * Compute crop and zoom from the croppedAreaPixels */ function getInitialCropFromCroppedAreaPixels(croppedAreaPixels, mediaSize, rotation, cropSize, minZoom, maxZoom) { if (rotation === void 0) { rotation = 0; } var mediaNaturalBBoxSize = rotateSize(mediaSize.naturalWidth, mediaSize.naturalHeight, rotation); var zoom = clamp(getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize), minZoom, maxZoom); var cropZoom = cropSize.height > cropSize.width ? cropSize.height / croppedAreaPixels.height : cropSize.width / croppedAreaPixels.width; var crop = { x: ((mediaNaturalBBoxSize.width - croppedAreaPixels.width) / 2 - croppedAreaPixels.x) * cropZoom, y: ((mediaNaturalBBoxSize.height - croppedAreaPixels.height) / 2 - croppedAreaPixels.y) * cropZoom }; return { crop: crop, zoom: zoom }; } /** * Return the point that is the center of point a and b */ function getCenter(a, b) { return { x: (b.x + a.x) / 2, y: (b.y + a.y) / 2 }; } function getRadianAngle(degreeValue) { return degreeValue * Math.PI / 180; } /** * Returns the new bounding area of a rotated rectangle. */ function rotateSize(width, height, rotation) { var rotRad = getRadianAngle(rotation); return { width: Math.abs(Math.cos(rotRad) * width) + Math.abs(Math.sin(rotRad) * height), height: Math.abs(Math.sin(rotRad) * width) + Math.abs(Math.cos(rotRad) * height) }; } /** * Clamp value between min and max */ function clamp(value, min, max) { return Math.min(Math.max(value, min), max); } /** * Combine multiple class names into a single string. */ function classNames() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return args.filter(function (value) { if (typeof value === 'string' && value.length > 0) { return true; } return false; }).join(' ').trim(); } var css_248z = ".reactEasyCrop_Container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n user-select: none;\n touch-action: none;\n cursor: move;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\n will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\n}\n\n.reactEasyCrop_Contain {\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n}\n.reactEasyCrop_Cover_Horizontal {\n width: 100%;\n height: auto;\n}\n.reactEasyCrop_Cover_Vertical {\n width: auto;\n height: 100%;\n}\n\n.reactEasyCrop_CropArea {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n border: 1px solid rgba(255, 255, 255, 0.5);\n box-sizing: border-box;\n box-shadow: 0 0 0 9999em;\n color: rgba(0, 0, 0, 0.5);\n overflow: hidden;\n}\n\n.reactEasyCrop_CropAreaRound {\n border-radius: 50%;\n}\n\n.reactEasyCrop_CropAreaGrid::before {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 0;\n bottom: 0;\n left: 33.33%;\n right: 33.33%;\n border-top: 0;\n border-bottom: 0;\n}\n\n.reactEasyCrop_CropAreaGrid::after {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 33.33%;\n bottom: 33.33%;\n left: 0;\n right: 0;\n border-left: 0;\n border-right: 0;\n}\n"; var index_module_MIN_ZOOM = 1; var index_module_MAX_ZOOM = 3; var Cropper = /** @class */function (_super) { __extends(Cropper, _super); function Cropper() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.imageRef = external_React_.createRef(); _this.videoRef = external_React_.createRef(); _this.containerPosition = { x: 0, y: 0 }; _this.containerRef = null; _this.styleRef = null; _this.containerRect = null; _this.mediaSize = { width: 0, height: 0, naturalWidth: 0, naturalHeight: 0 }; _this.dragStartPosition = { x: 0, y: 0 }; _this.dragStartCrop = { x: 0, y: 0 }; _this.gestureZoomStart = 0; _this.gestureRotationStart = 0; _this.isTouching = false; _this.lastPinchDistance = 0; _this.lastPinchRotation = 0; _this.rafDragTimeout = null; _this.rafPinchTimeout = null; _this.wheelTimer = null; _this.currentDoc = typeof document !== 'undefined' ? document : null; _this.currentWindow = typeof window !== 'undefined' ? window : null; _this.resizeObserver = null; _this.state = { cropSize: null, hasWheelJustStarted: false, mediaObjectFit: undefined }; _this.initResizeObserver = function () { if (typeof window.ResizeObserver === 'undefined' || !_this.containerRef) { return; } var isFirstResize = true; _this.resizeObserver = new window.ResizeObserver(function (entries) { if (isFirstResize) { isFirstResize = false; // observe() is called on mount, we don't want to trigger a recompute on mount return; } _this.computeSizes(); }); _this.resizeObserver.observe(_this.containerRef); }; // this is to prevent Safari on iOS >= 10 to zoom the page _this.preventZoomSafari = function (e) { return e.preventDefault(); }; _this.cleanEvents = function () { if (!_this.currentDoc) return; _this.currentDoc.removeEventListener('mousemove', _this.onMouseMove); _this.currentDoc.removeEventListener('mouseup', _this.onDragStopped); _this.currentDoc.removeEventListener('touchmove', _this.onTouchMove); _this.currentDoc.removeEventListener('touchend', _this.onDragStopped); _this.currentDoc.removeEventListener('gesturemove', _this.onGestureMove); _this.currentDoc.removeEventListener('gestureend', _this.onGestureEnd); _this.currentDoc.removeEventListener('scroll', _this.onScroll); }; _this.clearScrollEvent = function () { if (_this.containerRef) _this.containerRef.removeEventListener('wheel', _this.onWheel); if (_this.wheelTimer) { clearTimeout(_this.wheelTimer); } }; _this.onMediaLoad = function () { var cropSize = _this.computeSizes(); if (cropSize) { _this.emitCropData(); _this.setInitialCrop(cropSize); } if (_this.props.onMediaLoaded) { _this.props.onMediaLoaded(_this.mediaSize); } }; _this.setInitialCrop = function (cropSize) { if (_this.props.initialCroppedAreaPercentages) { var _a = getInitialCropFromCroppedAreaPercentages(_this.props.initialCroppedAreaPercentages, _this.mediaSize, _this.props.rotation, cropSize, _this.props.minZoom, _this.props.maxZoom), crop = _a.crop, zoom = _a.zoom; _this.props.onCropChange(crop); _this.props.onZoomChange && _this.props.onZoomChange(zoom); } else if (_this.props.initialCroppedAreaPixels) { var _b = getInitialCropFromCroppedAreaPixels(_this.props.initialCroppedAreaPixels, _this.mediaSize, _this.props.rotation, cropSize, _this.props.minZoom, _this.props.maxZoom), crop = _b.crop, zoom = _b.zoom; _this.props.onCropChange(crop); _this.props.onZoomChange && _this.props.onZoomChange(zoom); } }; _this.computeSizes = function () { var _a, _b, _c, _d, _e, _f; var mediaRef = _this.imageRef.current || _this.videoRef.current; if (mediaRef && _this.containerRef) { _this.containerRect = _this.containerRef.getBoundingClientRect(); _this.saveContainerPosition(); var containerAspect = _this.containerRect.width / _this.containerRect.height; var naturalWidth = ((_a = _this.imageRef.current) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = _this.videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0; var naturalHeight = ((_c = _this.imageRef.current) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = _this.videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0; var isMediaScaledDown = mediaRef.offsetWidth < naturalWidth || mediaRef.offsetHeight < naturalHeight; var mediaAspect = naturalWidth / naturalHeight; // We do not rely on the offsetWidth/offsetHeight if the media is scaled down // as the values they report are rounded. That will result in precision losses // when calculating zoom. We use the fact that the media is positionned relative // to the container. That allows us to use the container's dimensions // and natural aspect ratio of the media to calculate accurate media size. // However, for this to work, the container should not be rotated var renderedMediaSize = void 0; if (isMediaScaledDown) { switch (_this.state.mediaObjectFit) { default: case 'contain': renderedMediaSize = containerAspect > mediaAspect ? { width: _this.containerRect.height * mediaAspect, height: _this.containerRect.height } : { width: _this.containerRect.width, height: _this.containerRect.width / mediaAspect }; break; case 'horizontal-cover': renderedMediaSize = { width: _this.containerRect.width, height: _this.containerRect.width / mediaAspect }; break; case 'vertical-cover': renderedMediaSize = { width: _this.containerRect.height * mediaAspect, height: _this.containerRect.height }; break; } } else { renderedMediaSize = { width: mediaRef.offsetWidth, height: mediaRef.offsetHeight }; } _this.mediaSize = __assign(__assign({}, renderedMediaSize), { naturalWidth: naturalWidth, naturalHeight: naturalHeight }); // set media size in the parent if (_this.props.setMediaSize) { _this.props.setMediaSize(_this.mediaSize); } var cropSize = _this.props.cropSize ? _this.props.cropSize : getCropSize(_this.mediaSize.width, _this.mediaSize.height, _this.containerRect.width, _this.containerRect.height, _this.props.aspect, _this.props.rotation); if (((_e = _this.state.cropSize) === null || _e === void 0 ? void 0 : _e.height) !== cropSize.height || ((_f = _this.state.cropSize) === null || _f === void 0 ? void 0 : _f.width) !== cropSize.width) { _this.props.onCropSizeChange && _this.props.onCropSizeChange(cropSize); } _this.setState({ cropSize: cropSize }, _this.recomputeCropPosition); // pass crop size to parent if (_this.props.setCropSize) { _this.props.setCropSize(cropSize); } return cropSize; } }; _this.saveContainerPosition = function () { if (_this.containerRef) { var bounds = _this.containerRef.getBoundingClientRect(); _this.containerPosition = { x: bounds.left, y: bounds.top }; } }; _this.onMouseDown = function (e) { if (!_this.currentDoc) return; e.preventDefault(); _this.currentDoc.addEventListener('mousemove', _this.onMouseMove); _this.currentDoc.addEventListener('mouseup', _this.onDragStopped); _this.saveContainerPosition(); _this.onDragStart(Cropper.getMousePoint(e)); }; _this.onMouseMove = function (e) { return _this.onDrag(Cropper.getMousePoint(e)); }; _this.onScroll = function (e) { if (!_this.currentDoc) return; e.preventDefault(); _this.saveContainerPosition(); }; _this.onTouchStart = function (e) { if (!_this.currentDoc) return; _this.isTouching = true; if (_this.props.onTouchRequest && !_this.props.onTouchRequest(e)) { return; } _this.currentDoc.addEventListener('touchmove', _this.onTouchMove, { passive: false }); // iOS 11 now defaults to passive: true _this.currentDoc.addEventListener('touchend', _this.onDragStopped); _this.saveContainerPosition(); if (e.touches.length === 2) { _this.onPinchStart(e); } else if (e.touches.length === 1) { _this.onDragStart(Cropper.getTouchPoint(e.touches[0])); } }; _this.onTouchMove = function (e) { // Prevent whole page from scrolling on iOS. e.preventDefault(); if (e.touches.length === 2) { _this.onPinchMove(e); } else if (e.touches.length === 1) { _this.onDrag(Cropper.getTouchPoint(e.touches[0])); } }; _this.onGestureStart = function (e) { if (!_this.currentDoc) return; e.preventDefault(); _this.currentDoc.addEventListener('gesturechange', _this.onGestureMove); _this.currentDoc.addEventListener('gestureend', _this.onGestureEnd); _this.gestureZoomStart = _this.props.zoom; _this.gestureRotationStart = _this.props.rotation; }; _this.onGestureMove = function (e) { e.preventDefault(); if (_this.isTouching) { // this is to avoid conflict between gesture and touch events return; } var point = Cropper.getMousePoint(e); var newZoom = _this.gestureZoomStart - 1 + e.scale; _this.setNewZoom(newZoom, point, { shouldUpdatePosition: true }); if (_this.props.onRotationChange) { var newRotation = _this.gestureRotationStart + e.rotation; _this.props.onRotationChange(newRotation); } }; _this.onGestureEnd = function (e) { _this.cleanEvents(); }; _this.onDragStart = function (_a) { var _b, _c; var x = _a.x, y = _a.y; _this.dragStartPosition = { x: x, y: y }; _this.dragStartCrop = __assign({}, _this.props.crop); (_c = (_b = _this.props).onInteractionStart) === null || _c === void 0 ? void 0 : _c.call(_b); }; _this.onDrag = function (_a) { var x = _a.x, y = _a.y; if (!_this.currentWindow) return; if (_this.rafDragTimeout) _this.currentWindow.cancelAnimationFrame(_this.rafDragTimeout); _this.rafDragTimeout = _this.currentWindow.requestAnimationFrame(function () { if (!_this.state.cropSize) return; if (x === undefined || y === undefined) return; var offsetX = x - _this.dragStartPosition.x; var offsetY = y - _this.dragStartPosition.y; var requestedPosition = { x: _this.dragStartCrop.x + offsetX, y: _this.dragStartCrop.y + offsetY }; var newPosition = _this.props.restrictPosition ? restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : requestedPosition; _this.props.onCropChange(newPosition); }); }; _this.onDragStopped = function () { var _a, _b; _this.isTouching = false; _this.cleanEvents(); _this.emitCropData(); (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a); }; _this.onWheel = function (e) { if (!_this.currentWindow) return; if (_this.props.onWheelRequest && !_this.props.onWheelRequest(e)) { return; } e.preventDefault(); var point = Cropper.getMousePoint(e); var pixelY = normalize_wheel_default()(e).pixelY; var newZoom = _this.props.zoom - pixelY * _this.props.zoomSpeed / 200; _this.setNewZoom(newZoom, point, { shouldUpdatePosition: true }); if (!_this.state.hasWheelJustStarted) { _this.setState({ hasWheelJustStarted: true }, function () { var _a, _b; return (_b = (_a = _this.props).onInteractionStart) === null || _b === void 0 ? void 0 : _b.call(_a); }); } if (_this.wheelTimer) { clearTimeout(_this.wheelTimer); } _this.wheelTimer = _this.currentWindow.setTimeout(function () { return _this.setState({ hasWheelJustStarted: false }, function () { var _a, _b; return (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a); }); }, 250); }; _this.getPointOnContainer = function (_a, containerTopLeft) { var x = _a.x, y = _a.y; if (!_this.containerRect) { throw new Error('The Cropper is not mounted'); } return { x: _this.containerRect.width / 2 - (x - containerTopLeft.x), y: _this.containerRect.height / 2 - (y - containerTopLeft.y) }; }; _this.getPointOnMedia = function (_a) { var x = _a.x, y = _a.y; var _b = _this.props, crop = _b.crop, zoom = _b.zoom; return { x: (x + crop.x) / zoom, y: (y + crop.y) / zoom }; }; _this.setNewZoom = function (zoom, point, _a) { var _b = _a === void 0 ? {} : _a, _c = _b.shouldUpdatePosition, shouldUpdatePosition = _c === void 0 ? true : _c; if (!_this.state.cropSize || !_this.props.onZoomChange) return; var newZoom = clamp(zoom, _this.props.minZoom, _this.props.maxZoom); if (shouldUpdatePosition) { var zoomPoint = _this.getPointOnContainer(point, _this.containerPosition); var zoomTarget = _this.getPointOnMedia(zoomPoint); var requestedPosition = { x: zoomTarget.x * newZoom - zoomPoint.x, y: zoomTarget.y * newZoom - zoomPoint.y }; var newPosition = _this.props.restrictPosition ? restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, newZoom, _this.props.rotation) : requestedPosition; _this.props.onCropChange(newPosition); } _this.props.onZoomChange(newZoom); }; _this.getCropData = function () { if (!_this.state.cropSize) { return null; } // this is to ensure the crop is correctly restricted after a zoom back (https://github.com/ValentinH/react-easy-crop/issues/6) var restrictedPosition = _this.props.restrictPosition ? restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop; return computeCroppedArea(restrictedPosition, _this.mediaSize, _this.state.cropSize, _this.getAspect(), _this.props.zoom, _this.props.rotation, _this.props.restrictPosition); }; _this.emitCropData = function () { var cropData = _this.getCropData(); if (!cropData) return; var croppedAreaPercentages = cropData.croppedAreaPercentages, croppedAreaPixels = cropData.croppedAreaPixels; if (_this.props.onCropComplete) { _this.props.onCropComplete(croppedAreaPercentages, croppedAreaPixels); } if (_this.props.onCropAreaChange) { _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels); } }; _this.emitCropAreaChange = function () { var cropData = _this.getCropData(); if (!cropData) return; var croppedAreaPercentages = cropData.croppedAreaPercentages, croppedAreaPixels = cropData.croppedAreaPixels; if (_this.props.onCropAreaChange) { _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels); } }; _this.recomputeCropPosition = function () { if (!_this.state.cropSize) return; var newPosition = _this.props.restrictPosition ? restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop; _this.props.onCropChange(newPosition); _this.emitCropData(); }; return _this; } Cropper.prototype.componentDidMount = function () { if (!this.currentDoc || !this.currentWindow) return; if (this.containerRef) { if (this.containerRef.ownerDocument) { this.currentDoc = this.containerRef.ownerDocument; } if (this.currentDoc.defaultView) { this.currentWindow = this.currentDoc.defaultView; } this.initResizeObserver(); // only add window resize listener if ResizeObserver is not supported. Otherwise, it would be redundant if (typeof window.ResizeObserver === 'undefined') { this.currentWindow.addEventListener('resize', this.computeSizes); } this.props.zoomWithScroll && this.containerRef.addEventListener('wheel', this.onWheel, { passive: false }); this.containerRef.addEventListener('gesturestart', this.onGestureStart); } this.currentDoc.addEventListener('scroll', this.onScroll); if (!this.props.disableAutomaticStylesInjection) { this.styleRef = this.currentDoc.createElement('style'); this.styleRef.setAttribute('type', 'text/css'); if (this.props.nonce) { this.styleRef.setAttribute('nonce', this.props.nonce); } this.styleRef.innerHTML = css_248z; this.currentDoc.head.appendChild(this.styleRef); } // when rendered via SSR, the image can already be loaded and its onLoad callback will never be called if (this.imageRef.current && this.imageRef.current.complete) { this.onMediaLoad(); } // set image and video refs in the parent if the callbacks exist if (this.props.setImageRef) { this.props.setImageRef(this.imageRef); } if (this.props.setVideoRef) { this.props.setVideoRef(this.videoRef); } }; Cropper.prototype.componentWillUnmount = function () { var _a, _b; if (!this.currentDoc || !this.currentWindow) return; if (typeof window.ResizeObserver === 'undefined') { this.currentWindow.removeEventListener('resize', this.computeSizes); } (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect(); if (this.containerRef) { this.containerRef.removeEventListener('gesturestart', this.preventZoomSafari); } if (this.styleRef) { (_b = this.styleRef.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(this.styleRef); } this.cleanEvents(); this.props.zoomWithScroll && this.clearScrollEvent(); }; Cropper.prototype.componentDidUpdate = function (prevProps) { var _a, _b, _c, _d, _e, _f, _g, _h, _j; if (prevProps.rotation !== this.props.rotation) { this.computeSizes(); this.recomputeCropPosition(); } else if (prevProps.aspect !== this.props.aspect) { this.computeSizes(); } else if (prevProps.objectFit !== this.props.objectFit) { this.computeSizes(); } else if (prevProps.zoom !== this.props.zoom) { this.recomputeCropPosition(); } else if (((_a = prevProps.cropSize) === null || _a === void 0 ? void 0 : _a.height) !== ((_b = this.props.cropSize) === null || _b === void 0 ? void 0 : _b.height) || ((_c = prevProps.cropSize) === null || _c === void 0 ? void 0 : _c.width) !== ((_d = this.props.cropSize) === null || _d === void 0 ? void 0 : _d.width)) { this.computeSizes(); } else if (((_e = prevProps.crop) === null || _e === void 0 ? void 0 : _e.x) !== ((_f = this.props.crop) === null || _f === void 0 ? void 0 : _f.x) || ((_g = prevProps.crop) === null || _g === void 0 ? void 0 : _g.y) !== ((_h = this.props.crop) === null || _h === void 0 ? void 0 : _h.y)) { this.emitCropAreaChange(); } if (prevProps.zoomWithScroll !== this.props.zoomWithScroll && this.containerRef) { this.props.zoomWithScroll ? this.containerRef.addEventListener('wheel', this.onWheel, { passive: false }) : this.clearScrollEvent(); } if (prevProps.video !== this.props.video) { (_j = this.videoRef.current) === null || _j === void 0 ? void 0 : _j.load(); } var objectFit = this.getObjectFit(); if (objectFit !== this.state.mediaObjectFit) { this.setState({ mediaObjectFit: objectFit }, this.computeSizes); } }; Cropper.prototype.getAspect = function () { var _a = this.props, cropSize = _a.cropSize, aspect = _a.aspect; if (cropSize) { return cropSize.width / cropSize.height; } return aspect; }; Cropper.prototype.getObjectFit = function () { var _a, _b, _c, _d; if (this.props.objectFit === 'cover') { var mediaRef = this.imageRef.current || this.videoRef.current; if (mediaRef && this.containerRef) { this.containerRect = this.containerRef.getBoundingClientRect(); var containerAspect = this.containerRect.width / this.containerRect.height; var naturalWidth = ((_a = this.imageRef.current) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = this.videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0; var naturalHeight = ((_c = this.imageRef.current) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = this.videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0; var mediaAspect = naturalWidth / naturalHeight; return mediaAspect < containerAspect ? 'horizontal-cover' : 'vertical-cover'; } return 'horizontal-cover'; } return this.props.objectFit; }; Cropper.prototype.onPinchStart = function (e) { var pointA = Cropper.getTouchPoint(e.touches[0]); var pointB = Cropper.getTouchPoint(e.touches[1]); this.lastPinchDistance = getDistanceBetweenPoints(pointA, pointB); this.lastPinchRotation = getRotationBetweenPoints(pointA, pointB); this.onDragStart(getCenter(pointA, pointB)); }; Cropper.prototype.onPinchMove = function (e) { var _this = this; if (!this.currentDoc || !this.currentWindow) return; var pointA = Cropper.getTouchPoint(e.touches[0]); var pointB = Cropper.getTouchPoint(e.touches[1]); var center = getCenter(pointA, pointB); this.onDrag(center); if (this.rafPinchTimeout) this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout); this.rafPinchTimeout = this.currentWindow.requestAnimationFrame(function () { var distance = getDistanceBetweenPoints(pointA, pointB); var newZoom = _this.props.zoom * (distance / _this.lastPinchDistance); _this.setNewZoom(newZoom, center, { shouldUpdatePosition: false }); _this.lastPinchDistance = distance; var rotation = getRotationBetweenPoints(pointA, pointB); var newRotation = _this.props.rotation + (rotation - _this.lastPinchRotation); _this.props.onRotationChange && _this.props.onRotationChange(newRotation); _this.lastPinchRotation = rotation; }); }; Cropper.prototype.render = function () { var _this = this; var _a = this.props, image = _a.image, video = _a.video, mediaProps = _a.mediaProps, transform = _a.transform, _b = _a.crop, x = _b.x, y = _b.y, rotation = _a.rotation, zoom = _a.zoom, cropShape = _a.cropShape, showGrid = _a.showGrid, _c = _a.style, containerStyle = _c.containerStyle, cropAreaStyle = _c.cropAreaStyle, mediaStyle = _c.mediaStyle, _d = _a.classes, containerClassName = _d.containerClassName, cropAreaClassName = _d.cropAreaClassName, mediaClassName = _d.mediaClassName; var objectFit = this.state.mediaObjectFit; return external_React_.createElement("div", { onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart, ref: function ref(el) { return _this.containerRef = el; }, "data-testid": "container", style: containerStyle, className: classNames('reactEasyCrop_Container', containerClassName) }, image ? external_React_.createElement("img", __assign({ alt: "", className: classNames('reactEasyCrop_Image', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName) }, mediaProps, { src: image, ref: this.imageRef, style: __assign(__assign({}, mediaStyle), { transform: transform || "translate(".concat(x, "px, ").concat(y, "px) rotate(").concat(rotation, "deg) scale(").concat(zoom, ")") }), onLoad: this.onMediaLoad })) : video && external_React_.createElement("video", __assign({ autoPlay: true, loop: true, muted: true, className: classNames('reactEasyCrop_Video', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName) }, mediaProps, { ref: this.videoRef, onLoadedMetadata: this.onMediaLoad, style: __assign(__assign({}, mediaStyle), { transform: transform || "translate(".concat(x, "px, ").concat(y, "px) rotate(").concat(rotation, "deg) scale(").concat(zoom, ")") }), controls: false }), (Array.isArray(video) ? video : [{ src: video }]).map(function (item) { return external_React_.createElement("source", __assign({ key: item.src }, item)); })), this.state.cropSize && external_React_.createElement("div", { style: __assign(__assign({}, cropAreaStyle), { width: this.state.cropSize.width, height: this.state.cropSize.height }), "data-testid": "cropper", className: classNames('reactEasyCrop_CropArea', cropShape === 'round' && 'reactEasyCrop_CropAreaRound', showGrid && 'reactEasyCrop_CropAreaGrid', cropAreaClassName) })); }; Cropper.defaultProps = { zoom: 1, rotation: 0, aspect: 4 / 3, maxZoom: index_module_MAX_ZOOM, minZoom: index_module_MIN_ZOOM, cropShape: 'rect', objectFit: 'contain', showGrid: true, style: {}, classes: {}, mediaProps: {}, zoomSpeed: 1, restrictPosition: true, zoomWithScroll: true }; Cropper.getMousePoint = function (e) { return { x: Number(e.clientX), y: Number(e.clientY) }; }; Cropper.getTouchPoint = function (touch) { return { x: Number(touch.clientX), y: Number(touch.clientY) }; }; return Cropper; }(external_React_.Component); ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/cropper.js function ImageCropper({ url, width, height, naturalHeight, naturalWidth, borderProps }) { const { isInProgress, editedUrl, position, zoom, aspect, setPosition, setCrop, setZoom, rotation } = useImageEditingContext(); const [contentResizeListener, { width: clientWidth }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); let editedHeight = height || clientWidth * naturalHeight / naturalWidth; if (rotation % 180 === 90) { editedHeight = clientWidth * naturalWidth / naturalHeight; } const area = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: dist_clsx( "wp-block-image__crop-area", borderProps?.className, { "is-applying": isInProgress } ), style: { ...borderProps?.style, width: width || clientWidth, height: editedHeight }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Cropper, { image: editedUrl || url, disabled: isInProgress, minZoom: MIN_ZOOM / 100, maxZoom: MAX_ZOOM / 100, crop: position, zoom: zoom / 100, aspect, onCropChange: (pos) => { setPosition(pos); }, onCropComplete: (newCropPercent) => { setCrop(newCropPercent); }, onZoomChange: (newZoom) => { setZoom(newZoom * 100); } } ), isInProgress && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) ] } ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ contentResizeListener, area ] }); } ;// ./node_modules/@wordpress/icons/build-module/library/search.js var search_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/zoom-dropdown.js function ZoomDropdown() { const { isInProgress, zoom, setZoom } = useImageEditingContext(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { contentClassName: "wp-block-image__zoom", popoverProps: constants_POPOVER_PROPS, renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { icon: search_default, label: (0,external_wp_i18n_namespaceObject.__)("Zoom"), onClick: onToggle, "aria-expanded": isOpen, disabled: isInProgress } ), renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "medium", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Zoom"), min: MIN_ZOOM, max: MAX_ZOOM, value: Math.round(zoom), onChange: setZoom } ) }) } ); } ;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js var rotate_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/rotation-button.js function RotationButton() { const { isInProgress, rotateClockwise } = useImageEditingContext(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { icon: rotate_right_default, label: (0,external_wp_i18n_namespaceObject.__)("Rotate"), onClick: rotateClockwise, disabled: isInProgress } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/form-controls.js function FormControls() { const { isInProgress, apply, cancel } = useImageEditingContext(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: apply, disabled: isInProgress, children: (0,external_wp_i18n_namespaceObject.__)("Apply") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: cancel, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") }) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/index.js function ImageEditor({ id, url, width, height, naturalHeight, naturalWidth, onSaveImage, onFinishEditing, borderProps }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( ImageEditingProvider, { id, url, naturalWidth, naturalHeight, onSaveImage, onFinishEditing, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ImageCropper, { borderProps, url, width, height, naturalHeight, naturalWidth } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_controls_default, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ZoomDropdown, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioDropdown, { toggleProps }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RotationButton, {}) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FormControls, {}) }) ] }) ] } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/use-dimension-handler.js function useDimensionHandler(customHeight, customWidth, defaultHeight, defaultWidth, onChange) { const [currentWidth, setCurrentWidth] = (0,external_wp_element_namespaceObject.useState)( customWidth ?? defaultWidth ?? "" ); const [currentHeight, setCurrentHeight] = (0,external_wp_element_namespaceObject.useState)( customHeight ?? defaultHeight ?? "" ); (0,external_wp_element_namespaceObject.useEffect)(() => { if (customWidth === void 0 && defaultWidth !== void 0) { setCurrentWidth(defaultWidth); } if (customHeight === void 0 && defaultHeight !== void 0) { setCurrentHeight(defaultHeight); } }, [defaultWidth, defaultHeight]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (customWidth !== void 0 && Number.parseInt(customWidth) !== Number.parseInt(currentWidth)) { setCurrentWidth(customWidth); } if (customHeight !== void 0 && Number.parseInt(customHeight) !== Number.parseInt(currentHeight)) { setCurrentHeight(customHeight); } }, [customWidth, customHeight]); const updateDimension = (dimension, value) => { const parsedValue = value === "" ? void 0 : parseInt(value, 10); if (dimension === "width") { setCurrentWidth(parsedValue); } else { setCurrentHeight(parsedValue); } onChange({ [dimension]: parsedValue }); }; const updateDimensions = (nextHeight, nextWidth) => { setCurrentHeight(nextHeight ?? defaultHeight); setCurrentWidth(nextWidth ?? defaultWidth); onChange({ height: nextHeight, width: nextWidth }); }; return { currentHeight, currentWidth, updateDimension, updateDimensions }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/index.js const IMAGE_SIZE_PRESETS = [25, 50, 75, 100]; const image_size_control_noop = () => { }; function getScaledWidthAndHeight(scale, imageWidth, imageHeight) { const scaledWidth = Math.round(imageWidth * (scale / 100)); const scaledHeight = Math.round(imageHeight * (scale / 100)); return { scaledWidth, scaledHeight }; } function ImageSizeControl({ imageSizeHelp, imageWidth, imageHeight, imageSizeOptions = [], isResizable = true, slug, width, height, onChange, onChangeImage = image_size_control_noop }) { const { currentHeight, currentWidth, updateDimension, updateDimensions } = useDimensionHandler(height, width, imageHeight, imageWidth, onChange); const handleUpdateDimensions = (scale) => { if (void 0 === scale) { updateDimensions(); return; } const { scaledWidth, scaledHeight } = getScaledWidthAndHeight( scale, imageWidth, imageHeight ); updateDimensions(scaledHeight, scaledWidth); }; const selectedValue = IMAGE_SIZE_PRESETS.find((scale) => { const { scaledWidth, scaledHeight } = getScaledWidthAndHeight( scale, imageWidth, imageHeight ); return currentWidth === scaledWidth && currentHeight === scaledHeight; }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-image-size-control", spacing: "4", children: [ imageSizeOptions && imageSizeOptions.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Resolution"), value: slug, options: imageSizeOptions, onChange: onChangeImage, help: imageSizeHelp, size: "__unstable-large" } ), isResizable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { align: "baseline", spacing: "4", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalNumberControl, { label: (0,external_wp_i18n_namespaceObject.__)("Width"), value: currentWidth, min: 1, onChange: (value) => updateDimension("width", value), size: "__unstable-large" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalNumberControl, { label: (0,external_wp_i18n_namespaceObject.__)("Height"), value: currentHeight, min: 1, onChange: (value) => updateDimension("height", value), size: "__unstable-large" } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { label: (0,external_wp_i18n_namespaceObject.__)("Image size presets"), hideLabelFromVision: true, onChange: handleUpdateDimensions, value: selectedValue, isBlock: true, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, children: IMAGE_SIZE_PRESETS.map((scale) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: scale, label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: Percentage value. */ (0,external_wp_i18n_namespaceObject.__)("%d%%"), scale ) }, scale ); }) } ) ] }) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer-url.js function LinkViewerURL({ url, urlLabel, className }) { const linkClassName = dist_clsx( className, "block-editor-url-popover__link-viewer-url" ); if (!url) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: linkClassName }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { className: linkClassName, href: url, children: urlLabel || (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(url)) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer.js function LinkViewer({ className, linkClassName, onEditLinkClick, url, urlLabel, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: dist_clsx( "block-editor-url-popover__link-viewer", className ), ...props, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( LinkViewerURL, { url, urlLabel, className: linkClassName } ), onEditLinkClick && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { icon: pencil_default, label: (0,external_wp_i18n_namespaceObject.__)("Edit"), onClick: onEditLinkClick, size: "compact" } ) ] } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-editor.js function LinkEditor({ autocompleteRef, className, onChangeInputValue, value, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "form", { className: dist_clsx( "block-editor-url-popover__link-editor", className ), ...props, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( url_input_default, { value, onChange: onChangeInputValue, autocompleteRef } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { icon: keyboard_return_default, label: (0,external_wp_i18n_namespaceObject.__)("Apply"), type: "submit", size: "compact" } ) ] } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/index.js const { __experimentalPopoverLegacyPositionToPlacement } = unlock( external_wp_components_namespaceObject.privateApis ); const DEFAULT_PLACEMENT = "bottom"; const URLPopover = (0,external_wp_element_namespaceObject.forwardRef)( ({ additionalControls, children, renderSettings, // The DEFAULT_PLACEMENT value is assigned inside the function's body placement, focusOnMount = "firstElement", // Deprecated position, // Rest ...popoverProps }, ref) => { if (position !== void 0) { external_wp_deprecated_default()("`position` prop in wp.blockEditor.URLPopover", { since: "6.2", alternative: "`placement` prop" }); } let computedPlacement; if (placement !== void 0) { computedPlacement = placement; } else if (position !== void 0) { computedPlacement = __experimentalPopoverLegacyPositionToPlacement(position); } computedPlacement = computedPlacement || DEFAULT_PLACEMENT; const [isSettingsExpanded, setIsSettingsExpanded] = (0,external_wp_element_namespaceObject.useState)(false); const showSettings = !!renderSettings && isSettingsExpanded; const toggleSettingsVisibility = () => { setIsSettingsExpanded(!isSettingsExpanded); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Popover, { ref, role: "dialog", "aria-modal": "true", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Edit URL"), className: "block-editor-url-popover", focusOnMount, placement: computedPlacement, shift: true, variant: "toolbar", ...popoverProps, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-url-popover__input-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-popover__row", children: [ children, !!renderSettings && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { className: "block-editor-url-popover__settings-toggle", icon: chevron_down_default, label: (0,external_wp_i18n_namespaceObject.__)("Link settings"), onClick: toggleSettingsVisibility, "aria-expanded": isSettingsExpanded, size: "compact" } ) ] }) }), showSettings && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-url-popover__settings", children: renderSettings() }), additionalControls && !showSettings && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-url-popover__additional-controls", children: additionalControls }) ] } ); } ); URLPopover.LinkEditor = LinkEditor; URLPopover.LinkViewer = LinkViewer; var url_popover_default = URLPopover; ;// ./node_modules/@wordpress/block-editor/build-module/components/media-placeholder/index.js const media_placeholder_noop = () => { }; const InsertFromURLPopover = ({ src, onChange, onSubmit, onClose, popoverAnchor }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(url_popover_default, { anchor: popoverAnchor, onClose, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "form", { className: "block-editor-media-placeholder__url-input-form", onSubmit, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalInputControl, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("URL"), type: "text", hideLabelFromVision: true, placeholder: (0,external_wp_i18n_namespaceObject.__)("Paste or type URL"), onChange, value: src, suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", icon: keyboard_return_default, label: (0,external_wp_i18n_namespaceObject.__)("Apply"), type: "submit" } ) }) } ) } ) }); const URLSelectionUI = ({ src, onChangeSrc, onSelectURL }) => { const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const [isURLInputVisible, setIsURLInputVisible] = (0,external_wp_element_namespaceObject.useState)(false); const openURLInput = () => { setIsURLInputVisible(true); }; const closeURLInput = () => { setIsURLInputVisible(false); popoverAnchor?.focus(); }; const onSubmitSrc = (event) => { event.preventDefault(); if (src && onSelectURL) { onSelectURL(src); closeURLInput(); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-media-placeholder__url-input-container", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "block-editor-media-placeholder__button", onClick: openURLInput, isPressed: isURLInputVisible, variant: "secondary", "aria-haspopup": "dialog", ref: setPopoverAnchor, children: (0,external_wp_i18n_namespaceObject.__)("Insert from URL") } ), isURLInputVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( InsertFromURLPopover, { src, onChange: onChangeSrc, onSubmit: onSubmitSrc, onClose: closeURLInput, popoverAnchor } ) ] }); }; function MediaPlaceholder({ value = {}, allowedTypes, className, icon, labels = {}, mediaPreview, notices, isAppender, accept, addToGallery, multiple = false, handleUpload = true, disableDropZone, disableMediaButtons, onError, onSelect, onCancel, onSelectURL, onToggleFeaturedImage, onDoubleClick, onFilesPreUpload = media_placeholder_noop, onHTMLDrop: deprecatedOnHTMLDrop, children, mediaLibraryButton, placeholder, style }) { if (deprecatedOnHTMLDrop) { external_wp_deprecated_default()("wp.blockEditor.MediaPlaceholder onHTMLDrop prop", { since: "6.2", version: "6.4" }); } const mediaUpload = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSettings } = select(store); return getSettings().mediaUpload; }, []); const [src, setSrc] = (0,external_wp_element_namespaceObject.useState)(""); (0,external_wp_element_namespaceObject.useEffect)(() => { setSrc(value?.src ?? ""); }, [value?.src]); const onlyAllowsImages = () => { if (!allowedTypes || allowedTypes.length === 0) { return false; } return allowedTypes.every( (allowedType) => allowedType === "image" || allowedType.startsWith("image/") ); }; const onFilesUpload = (files) => { if (!handleUpload || typeof handleUpload === "function" && !handleUpload(files)) { return onSelect(files); } onFilesPreUpload(files); let setMedia; if (multiple) { if (addToGallery) { let lastMediaPassed = []; setMedia = (newMedia) => { const filteredMedia = (value ?? []).filter((item) => { if (item.id) { return !lastMediaPassed.some( // Be sure to convert to number for comparison. ({ id }) => Number(id) === Number(item.id) ); } return !lastMediaPassed.some( ({ urlSlug }) => item.url.includes(urlSlug) ); }); onSelect(filteredMedia.concat(newMedia)); lastMediaPassed = newMedia.map((media) => { const cutOffIndex = media.url.lastIndexOf("."); const urlSlug = media.url.slice(0, cutOffIndex); return { id: media.id, urlSlug }; }); }; } else { setMedia = onSelect; } } else { setMedia = ([media]) => onSelect(media); } mediaUpload({ allowedTypes, filesList: files, onFileChange: setMedia, onError, multiple }); }; async function handleBlocksDrop(event) { const { blocks } = parseDropEvent(event); if (!blocks?.length) { return; } const uploadedMediaList = await Promise.all( blocks.map((block) => { const blockType = block.name.split("/")[1]; if (block.attributes.id) { block.attributes.type = blockType; return block.attributes; } return new Promise((resolve, reject) => { window.fetch(block.attributes.url).then((response) => response.blob()).then( (blob) => mediaUpload({ filesList: [blob], additionalData: { title: block.attributes.title, alt_text: block.attributes.alt, caption: block.attributes.caption, type: blockType }, onFileChange: ([media]) => { if (media.id) { resolve(media); } }, allowedTypes, onError: reject }) ).catch(() => resolve(block.attributes.url)); }); }) ).catch((err) => onError(err)); if (!uploadedMediaList?.length) { return; } onSelect(multiple ? uploadedMediaList : uploadedMediaList[0]); } const onUpload = (event) => { onFilesUpload(event.target.files); }; const defaultRenderPlaceholder = (content) => { let { instructions, title } = labels; if (!mediaUpload && !onSelectURL) { instructions = (0,external_wp_i18n_namespaceObject.__)( "To edit this block, you need permission to upload media." ); } if (instructions === void 0 || title === void 0) { const typesAllowed = allowedTypes ?? []; const [firstAllowedType] = typesAllowed; const isOneType = 1 === typesAllowed.length; const isAudio = isOneType && "audio" === firstAllowedType; const isImage = isOneType && "image" === firstAllowedType; const isVideo = isOneType && "video" === firstAllowedType; if (instructions === void 0 && mediaUpload) { instructions = (0,external_wp_i18n_namespaceObject.__)( "Drag and drop an image or video, upload, or choose from your library." ); if (isAudio) { instructions = (0,external_wp_i18n_namespaceObject.__)( "Drag and drop an audio file, upload, or choose from your library." ); } else if (isImage) { instructions = (0,external_wp_i18n_namespaceObject.__)( "Drag and drop an image, upload, or choose from your library." ); } else if (isVideo) { instructions = (0,external_wp_i18n_namespaceObject.__)( "Drag and drop a video, upload, or choose from your library." ); } } if (title === void 0) { title = (0,external_wp_i18n_namespaceObject.__)("Media"); if (isAudio) { title = (0,external_wp_i18n_namespaceObject.__)("Audio"); } else if (isImage) { title = (0,external_wp_i18n_namespaceObject.__)("Image"); } else if (isVideo) { title = (0,external_wp_i18n_namespaceObject.__)("Video"); } } } const placeholderClassName = dist_clsx( "block-editor-media-placeholder", className, { "is-appender": isAppender } ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Placeholder, { icon, label: title, instructions, className: placeholderClassName, notices, onDoubleClick, preview: mediaPreview, style, children: [ content, children ] } ); }; const renderPlaceholder = placeholder ?? defaultRenderPlaceholder; const renderDropZone = () => { if (disableDropZone) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropZone, { onFilesDrop: onFilesUpload, onDrop: handleBlocksDrop, isEligible: (dataTransfer) => { const prefix = "wp-block:core/"; const types = []; for (const type of dataTransfer.types) { if (type.startsWith(prefix)) { types.push(type.slice(prefix.length)); } } return types.every( (type) => allowedTypes.includes(type) ) && (multiple ? true : types.length === 1); } } ); }; const renderCancelLink = () => { return onCancel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "block-editor-media-placeholder__cancel-button", title: (0,external_wp_i18n_namespaceObject.__)("Cancel"), variant: "link", onClick: onCancel, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ); }; const renderUrlSelectionUI = () => { return onSelectURL && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( URLSelectionUI, { src, onChangeSrc: setSrc, onSelectURL } ); }; const renderFeaturedImageToggle = () => { return onToggleFeaturedImage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-media-placeholder__url-input-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "block-editor-media-placeholder__button", onClick: onToggleFeaturedImage, variant: "secondary", children: (0,external_wp_i18n_namespaceObject.__)("Use featured image") } ) }); }; const renderMediaUploadChecked = () => { const defaultButton = ({ open }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", onClick: () => { open(); }, children: (0,external_wp_i18n_namespaceObject.__)("Media Library") } ); }; const libraryButton = mediaLibraryButton ?? defaultButton; const uploadMediaLibraryButton = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( media_upload_default, { addToGallery, gallery: multiple && onlyAllowsImages(), multiple, onSelect, allowedTypes, mode: "browse", value: Array.isArray(value) ? value.map(({ id }) => id) : value.id, render: libraryButton } ); if (mediaUpload && isAppender) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ renderDropZone(), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FormFileUpload, { onChange: onUpload, accept, multiple: !!multiple, render: ({ openFileDialog }) => { const content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", className: dist_clsx( "block-editor-media-placeholder__button", "block-editor-media-placeholder__upload-button" ), onClick: openFileDialog, children: (0,external_wp_i18n_namespaceObject._x)("Upload", "verb") } ), uploadMediaLibraryButton, renderUrlSelectionUI(), renderFeaturedImageToggle(), renderCancelLink() ] }); return renderPlaceholder(content); } } ) ] }); } if (mediaUpload) { const content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ renderDropZone(), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FormFileUpload, { render: ({ openFileDialog }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, onClick: openFileDialog, variant: "primary", className: dist_clsx( "block-editor-media-placeholder__button", "block-editor-media-placeholder__upload-button" ), children: (0,external_wp_i18n_namespaceObject._x)("Upload", "verb") } ), onChange: onUpload, accept, multiple: !!multiple } ), uploadMediaLibraryButton, renderUrlSelectionUI(), renderFeaturedImageToggle(), renderCancelLink() ] }); return renderPlaceholder(content); } return renderPlaceholder(uploadMediaLibraryButton); }; if (disableMediaButtons) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(check_default, { children: renderDropZone() }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( check_default, { fallback: renderPlaceholder(renderUrlSelectionUI()), children: renderMediaUploadChecked() } ); } var media_placeholder_default = (0,external_wp_components_namespaceObject.withFilters)("editor.MediaPlaceholder")(MediaPlaceholder); ;// ./node_modules/@wordpress/block-editor/build-module/components/panel-color-settings/index.js const PanelColorSettings = ({ colorSettings, ...props }) => { const settings = colorSettings.map((setting) => { if (!setting) { return setting; } const { value, onChange, ...otherSettings } = setting; return { ...otherSettings, colorValue: value, onColorChange: onChange }; }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( panel_color_gradient_settings_default, { settings, gradients: [], disableCustomGradients: true, ...props } ); }; var panel_color_settings_default = PanelColorSettings; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar/index.js const format_toolbar_POPOVER_PROPS = { placement: "bottom-start" }; const FormatToolbar = () => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ ["bold", "italic", "link", "unknown"].map((format) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Slot, { name: `RichText.ToolbarControls.${format}` }, format )), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: "RichText.ToolbarControls", children: (fills) => { if (!fills.length) { return null; } const allProps = fills.map(([{ props }]) => props); const hasActive = allProps.some( ({ isActive }) => isActive ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { icon: chevron_down_default, label: (0,external_wp_i18n_namespaceObject.__)("More"), toggleProps: { ...toggleProps, className: dist_clsx( toggleProps.className, { "is-pressed": hasActive } ), description: (0,external_wp_i18n_namespaceObject.__)( "Displays more block tools" ) }, controls: orderBy( fills.map(([{ props }]) => props), "title" ), popoverProps: format_toolbar_POPOVER_PROPS } ) }); } }) ] }); }; var format_toolbar_default = FormatToolbar; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar-container.js function InlineToolbar({ popoverAnchor }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Popover, { placement: "top", focusOnMount: false, anchor: popoverAnchor, className: "block-editor-rich-text__inline-format-toolbar", __unstableSlotName: "block-toolbar", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( NavigableToolbar, { className: "block-editor-rich-text__inline-format-toolbar-group", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Format tools"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(format_toolbar_default, {}) }) } ) } ); } const FormatToolbarContainer = ({ inline, editableContentElement }) => { if (inline) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InlineToolbar, { popoverAnchor: editableContentElement }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "inline", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(format_toolbar_default, {}) }); }; var format_toolbar_container_default = FormatToolbarContainer; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-mark-persistent.js function useMarkPersistent({ html, value }) { const previousTextRef = (0,external_wp_element_namespaceObject.useRef)(); const hasActiveFormats = !!value.activeFormats?.length; const { __unstableMarkLastChangeAsPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!previousTextRef.current) { previousTextRef.current = value.text; return; } if (previousTextRef.current !== value.text) { const timeout = window.setTimeout(() => { __unstableMarkLastChangeAsPersistent(); }, 1e3); previousTextRef.current = value.text; return () => { window.clearTimeout(timeout); }; } __unstableMarkLastChangeAsPersistent(); }, [html, hasActiveFormats]); } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-format-types.js function formatTypesSelector(select) { return select(external_wp_richText_namespaceObject.store).getFormatTypes(); } const interactiveContentTags = /* @__PURE__ */ new Set([ "a", "audio", "button", "details", "embed", "iframe", "input", "label", "select", "textarea", "video" ]); function prefixSelectKeys(selected, prefix) { if (typeof selected !== "object") { return { [prefix]: selected }; } return Object.fromEntries( Object.entries(selected).map(([key, value]) => [ `${prefix}.${key}`, value ]) ); } function getPrefixedSelectKeys(selected, prefix) { if (selected[prefix]) { return selected[prefix]; } return Object.keys(selected).filter((key) => key.startsWith(prefix + ".")).reduce((accumulator, key) => { accumulator[key.slice(prefix.length + 1)] = selected[key]; return accumulator; }, {}); } function useFormatTypes({ clientId, identifier, withoutInteractiveFormatting, allowedFormats }) { const allFormatTypes = (0,external_wp_data_namespaceObject.useSelect)(formatTypesSelector, []); const formatTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { return allFormatTypes.filter(({ name, interactive, tagName }) => { if (allowedFormats && !allowedFormats.includes(name)) { return false; } if (withoutInteractiveFormatting && (interactive || interactiveContentTags.has(tagName))) { return false; } return true; }); }, [allFormatTypes, allowedFormats, withoutInteractiveFormatting]); const keyedSelected = (0,external_wp_data_namespaceObject.useSelect)( (select) => formatTypes.reduce((accumulator, type) => { if (!type.__experimentalGetPropsForEditableTreePreparation) { return accumulator; } return { ...accumulator, ...prefixSelectKeys( type.__experimentalGetPropsForEditableTreePreparation( select, { richTextIdentifier: identifier, blockClientId: clientId } ), type.name ) }; }, {}), [formatTypes, clientId, identifier] ); const dispatch = (0,external_wp_data_namespaceObject.useDispatch)(); const prepareHandlers = []; const valueHandlers = []; const changeHandlers = []; const dependencies = []; for (const key in keyedSelected) { dependencies.push(keyedSelected[key]); } formatTypes.forEach((type) => { if (type.__experimentalCreatePrepareEditableTree) { const handler = type.__experimentalCreatePrepareEditableTree( getPrefixedSelectKeys(keyedSelected, type.name), { richTextIdentifier: identifier, blockClientId: clientId } ); if (type.__experimentalCreateOnChangeEditableValue) { valueHandlers.push(handler); } else { prepareHandlers.push(handler); } } if (type.__experimentalCreateOnChangeEditableValue) { let dispatchers = {}; if (type.__experimentalGetPropsForEditableTreeChangeHandler) { dispatchers = type.__experimentalGetPropsForEditableTreeChangeHandler( dispatch, { richTextIdentifier: identifier, blockClientId: clientId } ); } const selected = getPrefixedSelectKeys(keyedSelected, type.name); changeHandlers.push( type.__experimentalCreateOnChangeEditableValue( { ...typeof selected === "object" ? selected : {}, ...dispatchers }, { richTextIdentifier: identifier, blockClientId: clientId } ) ); } }); return { formatTypes, prepareHandlers, valueHandlers, changeHandlers, dependencies }; } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/before-input-rules.js const wrapSelectionSettings = ["`", '"', "'", "\u201C\u201D", "\u2018\u2019"]; var before_input_rules_default = (props) => (element) => { function onInput(event) { const { inputType, data } = event; const { value, onChange, registry } = props.current; if (inputType !== "insertText") { return; } if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) { return; } const pair = (0,external_wp_hooks_namespaceObject.applyFilters)( "blockEditor.wrapSelectionSettings", wrapSelectionSettings ).find( ([startChar2, endChar2]) => startChar2 === data || endChar2 === data ); if (!pair) { return; } const [startChar, endChar = startChar] = pair; const start = value.start; const end = value.end + startChar.length; let newValue = (0,external_wp_richText_namespaceObject.insert)(value, startChar, start, start); newValue = (0,external_wp_richText_namespaceObject.insert)(newValue, endChar, end, end); const { __unstableMarkLastChangeAsPersistent, __unstableMarkAutomaticChange } = registry.dispatch(store); __unstableMarkLastChangeAsPersistent(); onChange(newValue); __unstableMarkAutomaticChange(); const init = {}; for (const key in event) { init[key] = event[key]; } init.data = endChar; const { ownerDocument } = element; const { defaultView } = ownerDocument; const newEvent = new defaultView.InputEvent("input", init); window.queueMicrotask(() => { event.target.dispatchEvent(newEvent); }); event.preventDefault(); } element.addEventListener("beforeinput", onInput); return () => { element.removeEventListener("beforeinput", onInput); }; }; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/prevent-event-discovery.js function preventEventDiscovery(value) { const searchText = "tales of gutenberg"; const addText = " \u{1F421}\u{1F422}\u{1F980}\u{1F424}\u{1F98B}\u{1F418}\u{1F427}\u{1F439}\u{1F981}\u{1F984}\u{1F98D}\u{1F43C}\u{1F43F}\u{1F383}\u{1F434}\u{1F41D}\u{1F406}\u{1F995}\u{1F994}\u{1F331}\u{1F347}\u03C0\u{1F34C}\u{1F409}\u{1F4A7}\u{1F968}\u{1F30C}\u{1F342}\u{1F360}\u{1F966}\u{1F95A}\u{1F95D}\u{1F39F}\u{1F965}\u{1F952}\u{1F6F5}\u{1F956}\u{1F352}\u{1F36F}\u{1F3BE}\u{1F3B2}\u{1F43A}\u{1F41A}\u{1F42E}\u231B\uFE0F"; const { start, text } = value; if (start < searchText.length) { return value; } const charactersBefore = text.slice(start - searchText.length, start); if (charactersBefore.toLowerCase() !== searchText) { return value; } return (0,external_wp_richText_namespaceObject.insert)(value, addText); } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/input-rules.js function findSelection(blocks) { let i = blocks.length; while (i--) { const attributeKey = retrieveSelectedAttribute( blocks[i].attributes ); if (attributeKey) { blocks[i].attributes[attributeKey] = blocks[i].attributes[attributeKey].toString().replace(START_OF_SELECTED_AREA, ""); return [blocks[i].clientId, attributeKey, 0, 0]; } const nestedSelection = findSelection(blocks[i].innerBlocks); if (nestedSelection) { return nestedSelection; } } return []; } var input_rules_default = (props) => (element) => { function inputRule() { const { getValue, onReplace, selectionChange, registry } = props.current; if (!onReplace) { return; } const value = getValue(); const { start, text } = value; const characterBefore = text.slice(start - 1, start); if (characterBefore !== " ") { return; } const trimmedTextBefore = text.slice(0, start).trim(); const prefixTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from").filter( ({ type }) => type === "prefix" ); const transformation = (0,external_wp_blocks_namespaceObject.findTransform)( prefixTransforms, ({ prefix }) => { return trimmedTextBefore === prefix; } ); if (!transformation) { return; } const content = (0,external_wp_richText_namespaceObject.toHTMLString)({ value: (0,external_wp_richText_namespaceObject.insert)(value, START_OF_SELECTED_AREA, 0, start) }); const block = transformation.transform(content); selectionChange(...findSelection([block])); onReplace([block]); registry.dispatch(store).__unstableMarkAutomaticChange(); return true; } function onInput(event) { const { inputType, type } = event; const { getValue, onChange, __unstableAllowPrefixTransformations, formatTypes, registry } = props.current; if (inputType !== "insertText" && type !== "compositionend") { return; } if (__unstableAllowPrefixTransformations && inputRule()) { return; } const value = getValue(); const transformed = formatTypes.reduce( (accumulator, { __unstableInputRule }) => { if (__unstableInputRule) { accumulator = __unstableInputRule(accumulator); } return accumulator; }, preventEventDiscovery(value) ); const { __unstableMarkLastChangeAsPersistent, __unstableMarkAutomaticChange } = registry.dispatch(store); if (transformed !== value) { __unstableMarkLastChangeAsPersistent(); onChange({ ...transformed, activeFormats: value.activeFormats }); __unstableMarkAutomaticChange(); } } element.addEventListener("input", onInput); element.addEventListener("compositionend", onInput); return () => { element.removeEventListener("input", onInput); element.removeEventListener("compositionend", onInput); }; }; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/insert-replacement-text.js var insert_replacement_text_default = (props) => (element) => { function onInput(event) { if (event.inputType !== "insertReplacementText") { return; } const { registry } = props.current; registry.dispatch(store).__unstableMarkLastChangeAsPersistent(); } element.addEventListener("beforeinput", onInput); return () => { element.removeEventListener("beforeinput", onInput); }; }; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js var remove_browser_shortcuts_default = () => (node) => { function onKeydown(event) { if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, "z") || external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, "y") || external_wp_keycodes_namespaceObject.isKeyboardEvent.primaryShift(event, "z")) { event.preventDefault(); } } node.addEventListener("keydown", onKeydown); return () => { node.removeEventListener("keydown", onKeydown); }; }; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/shortcuts.js var shortcuts_default = (props) => (element) => { const { keyboardShortcuts } = props.current; function onKeyDown(event) { for (const keyboardShortcut of keyboardShortcuts.current) { keyboardShortcut(event); } } element.addEventListener("keydown", onKeyDown); return () => { element.removeEventListener("keydown", onKeyDown); }; }; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/input-events.js var input_events_default = (props) => (element) => { const { inputEvents } = props.current; function onInput(event) { for (const keyboardShortcut of inputEvents.current) { keyboardShortcut(event); } } element.addEventListener("input", onInput); return () => { element.removeEventListener("input", onInput); }; }; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/undo-automatic-change.js var undo_automatic_change_default = (props) => (element) => { function onKeyDown(event) { const { keyCode } = event; if (event.defaultPrevented) { return; } if (keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.ESCAPE) { return; } const { registry } = props.current; const { didAutomaticChange, getSettings } = registry.select(store); const { __experimentalUndo } = getSettings(); if (!__experimentalUndo) { return; } if (!didAutomaticChange()) { return; } event.preventDefault(); __experimentalUndo(); } element.addEventListener("keydown", onKeyDown); return () => { element.removeEventListener("keydown", onKeyDown); }; }; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/utils.js function addActiveFormats(value, activeFormats) { if (activeFormats?.length) { let index = value.formats.length; while (index--) { value.formats[index] = [ ...activeFormats, ...value.formats[index] || [] ]; } } } function getMultilineTag(multiline) { if (multiline !== true && multiline !== "p" && multiline !== "li") { return; } return multiline === true ? "p" : multiline; } function getAllowedFormats({ allowedFormats, disableFormats }) { if (disableFormats) { return getAllowedFormats.EMPTY_ARRAY; } return allowedFormats; } getAllowedFormats.EMPTY_ARRAY = []; function createLinkInParagraph(url, onReplace) { const link = /* @__PURE__ */ jsx("a", { href: url, children: url }); onReplace( createBlock("core/paragraph", { content: renderToString(link) }) ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/paste-handler.js var paste_handler_default = (props) => (element) => { function _onPaste(event) { const { disableFormats, onChange, value, formatTypes, tagName, onReplace, __unstableEmbedURLOnPaste, preserveWhiteSpace, pastePlainText } = props.current; if (!element.contains(event.target)) { return; } if (event.defaultPrevented) { return; } const { plainText, html } = getPasteEventData(event); event.preventDefault(); window.console.log("Received HTML:\n\n", html); window.console.log("Received plain text:\n\n", plainText); if (disableFormats) { onChange((0,external_wp_richText_namespaceObject.insert)(value, plainText)); return; } const isInternal = event.clipboardData.getData("rich-text") === "true"; function pasteInline(content2) { const transformed = formatTypes.reduce( (accumulator, { __unstablePasteRule }) => { if (__unstablePasteRule && accumulator === value) { accumulator = __unstablePasteRule(value, { html, plainText }); } return accumulator; }, value ); if (transformed !== value) { onChange(transformed); } else { const valueToInsert = (0,external_wp_richText_namespaceObject.create)({ html: content2 }); addActiveFormats(valueToInsert, value.activeFormats); onChange((0,external_wp_richText_namespaceObject.insert)(value, valueToInsert)); } } if (isInternal) { pasteInline(html); return; } if (pastePlainText) { onChange((0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({ text: plainText }))); return; } let mode = "INLINE"; const trimmedPlainText = plainText.trim(); if (__unstableEmbedURLOnPaste && (0,external_wp_richText_namespaceObject.isEmpty)(value) && (0,external_wp_url_namespaceObject.isURL)(trimmedPlainText) && // For the link pasting feature, allow only http(s) protocols. /^https?:/.test(trimmedPlainText)) { mode = "BLOCKS"; } const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({ HTML: html, plainText, mode, tagName, preserveWhiteSpace }); if (typeof content === "string") { pasteInline(content); } else if (content.length > 0) { if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) { onReplace(content, content.length - 1, -1); } } } const { defaultView } = element.ownerDocument; defaultView.addEventListener("paste", _onPaste); return () => { defaultView.removeEventListener("paste", _onPaste); }; }; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/delete.js var delete_default = (props) => (element) => { function onKeyDown(event) { const { keyCode } = event; if (event.defaultPrevented) { return; } const { value, onMerge, onRemove } = props.current; if (keyCode === external_wp_keycodes_namespaceObject.DELETE || keyCode === external_wp_keycodes_namespaceObject.BACKSPACE) { const { start, end, text } = value; const isReverse = keyCode === external_wp_keycodes_namespaceObject.BACKSPACE; const hasActiveFormats = value.activeFormats && !!value.activeFormats.length; if (!(0,external_wp_richText_namespaceObject.isCollapsed)(value) || hasActiveFormats || isReverse && start !== 0 || !isReverse && end !== text.length) { return; } if (onMerge) { onMerge(!isReverse); } else if (onRemove && (0,external_wp_richText_namespaceObject.isEmpty)(value) && isReverse) { onRemove(!isReverse); } event.preventDefault(); } } element.addEventListener("keydown", onKeyDown); return () => { element.removeEventListener("keydown", onKeyDown); }; }; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/enter.js var enter_default = (props) => (element) => { function onKeyDownDeprecated(event) { if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { return; } const { onReplace, onSplit } = props.current; if (onReplace && onSplit) { event.__deprecatedOnSplit = true; } } function onKeyDown(event) { if (event.defaultPrevented) { return; } if (event.target !== element) { return; } if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { return; } const { value, onChange, disableLineBreaks, onSplitAtEnd, onSplitAtDoubleLineEnd, registry } = props.current; event.preventDefault(); const { text, start, end } = value; if (event.shiftKey) { if (!disableLineBreaks) { onChange((0,external_wp_richText_namespaceObject.insert)(value, "\n")); } } else if (onSplitAtEnd && start === end && end === text.length) { onSplitAtEnd(); } else if ( // For some blocks it's desirable to split at the end of the // block when there are two line breaks at the end of the // block, so triple Enter exits the block. onSplitAtDoubleLineEnd && start === end && end === text.length && text.slice(-2) === "\n\n" ) { registry.batch(() => { const _value = { ...value }; _value.start = _value.end - 2; onChange((0,external_wp_richText_namespaceObject.remove)(_value)); onSplitAtDoubleLineEnd(); }); } else if (!disableLineBreaks) { onChange((0,external_wp_richText_namespaceObject.insert)(value, "\n")); } } const { defaultView } = element.ownerDocument; defaultView.addEventListener("keydown", onKeyDown); element.addEventListener("keydown", onKeyDownDeprecated); return () => { defaultView.removeEventListener("keydown", onKeyDown); element.removeEventListener("keydown", onKeyDownDeprecated); }; }; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/firefox-compat.js var firefox_compat_default = (props) => (element) => { function onFocus() { const { registry } = props.current; if (!registry.select(store).isMultiSelecting()) { return; } const parentEditable = element.parentElement.closest( '[contenteditable="true"]' ); if (parentEditable) { parentEditable.focus(); } } element.addEventListener("focus", onFocus); return () => { element.removeEventListener("focus", onFocus); }; }; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/index.js const allEventListeners = [ before_input_rules_default, input_rules_default, insert_replacement_text_default, remove_browser_shortcuts_default, shortcuts_default, input_events_default, undo_automatic_change_default, paste_handler_default, delete_default, enter_default, firefox_compat_default ]; function useEventListeners(props) { const propsRef = (0,external_wp_element_namespaceObject.useRef)(props); (0,external_wp_element_namespaceObject.useInsertionEffect)(() => { propsRef.current = props; }); const refEffects = (0,external_wp_element_namespaceObject.useMemo)( () => allEventListeners.map((refEffect) => refEffect(propsRef)), [propsRef] ); return (0,external_wp_compose_namespaceObject.useRefEffect)( (element) => { if (!props.isSelected) { return; } const cleanups = refEffects.map((effect) => effect(element)); return () => { cleanups.forEach((cleanup) => cleanup()); }; }, [refEffects, props.isSelected] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-edit.js const format_edit_DEFAULT_BLOCK_CONTEXT = {}; const usesContextKey = Symbol("usesContext"); function format_edit_Edit({ onChange, onFocus, value, forwardedRef, settings }) { const { name, edit: EditFunction, [usesContextKey]: usesContext } = settings; const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default); const context = (0,external_wp_element_namespaceObject.useMemo)(() => { return usesContext ? Object.fromEntries( Object.entries(blockContext).filter( ([key]) => usesContext.includes(key) ) ) : format_edit_DEFAULT_BLOCK_CONTEXT; }, [usesContext, blockContext]); if (!EditFunction) { return null; } const activeFormat = (0,external_wp_richText_namespaceObject.getActiveFormat)(value, name); const isActive = activeFormat !== void 0; const activeObject = (0,external_wp_richText_namespaceObject.getActiveObject)(value); const isObjectActive = activeObject !== void 0 && activeObject.type === name; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EditFunction, { isActive, activeAttributes: isActive ? activeFormat.attributes || {} : {}, isObjectActive, activeObjectAttributes: isObjectActive ? activeObject.attributes || {} : {}, value, onChange, onFocus, contentRef: forwardedRef, context }, name ); } function FormatEdit({ formatTypes, ...props }) { return formatTypes.map((settings) => /* @__PURE__ */ (0,external_React_.createElement)(format_edit_Edit, { settings, ...props, key: settings.name })); } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/content.js function valueToHTMLString(value, multiline) { if (rich_text_default.isEmpty(value)) { const multilineTag = getMultilineTag(multiline); return multilineTag ? `<${multilineTag}></${multilineTag}>` : ""; } if (Array.isArray(value)) { external_wp_deprecated_default()("wp.blockEditor.RichText value prop as children type", { since: "6.1", version: "6.3", alternative: "value prop as string", link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" }); return external_wp_blocks_namespaceObject.children.toHTML(value); } if (typeof value === "string") { return value; } return value.toHTMLString(); } function Content({ value, tagName: Tag, multiline, format, ...props }) { value = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: valueToHTMLString(value, multiline) }); return Tag ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ...props, children: value }) : value; } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/multiline.js function RichTextMultiline({ children, identifier, tagName: TagName = "div", value = "", onChange, multiline, ...props }, forwardedRef) { external_wp_deprecated_default()("wp.blockEditor.RichText multiline prop", { since: "6.1", version: "6.3", alternative: "nested blocks (InnerBlocks)", link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/nested-blocks-inner-blocks/" }); const { clientId } = useBlockEditContext(); const { getSelectionStart, getSelectionEnd } = (0,external_wp_data_namespaceObject.useSelect)(store); const { selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); const multilineTagName = getMultilineTag(multiline); value = value || `<${multilineTagName}></${multilineTagName}>`; const padded = `</${multilineTagName}>${value}<${multilineTagName}>`; const values = padded.split( `</${multilineTagName}><${multilineTagName}>` ); values.shift(); values.pop(); function _onChange(newValues) { onChange( `<${multilineTagName}>${newValues.join( `</${multilineTagName}><${multilineTagName}>` )}</${multilineTagName}>` ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ref: forwardedRef, children: values.map((_value, index) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( RichTextWrapper, { identifier: `${identifier}-${index}`, tagName: multilineTagName, value: _value, onChange: (newValue) => { const newValues = values.slice(); newValues[index] = newValue; _onChange(newValues); }, isSelected: void 0, onKeyDown: (event) => { if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { return; } event.preventDefault(); const { offset: start } = getSelectionStart(); const { offset: end } = getSelectionEnd(); if (typeof start !== "number" || typeof end !== "number") { return; } const richTextValue = (0,external_wp_richText_namespaceObject.create)({ html: _value }); richTextValue.start = start; richTextValue.end = end; const array = (0,external_wp_richText_namespaceObject.split)(richTextValue).map( (v) => (0,external_wp_richText_namespaceObject.toHTMLString)({ value: v }) ); const newValues = values.slice(); newValues.splice(index, 1, ...array); _onChange(newValues); selectionChange( clientId, `${identifier}-${index + 1}`, 0, 0 ); }, onMerge: (forward) => { const newValues = values.slice(); let offset = 0; if (forward) { if (!newValues[index + 1]) { return; } newValues.splice( index, 2, newValues[index] + newValues[index + 1] ); offset = newValues[index].length - 1; } else { if (!newValues[index - 1]) { return; } newValues.splice( index - 1, 2, newValues[index - 1] + newValues[index] ); offset = newValues[index - 1].length - 1; } _onChange(newValues); selectionChange( clientId, `${identifier}-${index - (forward ? 0 : 1)}`, offset, offset ); }, ...props }, index ); }) }); } var multiline_default = (0,external_wp_element_namespaceObject.forwardRef)(RichTextMultiline); ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/with-deprecations.js function withDeprecations(Component) { return (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { let value = props.value; let onChange = props.onChange; if (Array.isArray(value)) { external_wp_deprecated_default()("wp.blockEditor.RichText value prop as children type", { since: "6.1", version: "6.3", alternative: "value prop as string", link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" }); value = external_wp_blocks_namespaceObject.children.toHTML(props.value); onChange = (newValue) => props.onChange( external_wp_blocks_namespaceObject.children.fromDOM( (0,external_wp_richText_namespaceObject.__unstableCreateElement)(document, newValue).childNodes ) ); } const NewComponent = props.multiline ? multiline_default : Component; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( NewComponent, { ...props, value, onChange, ref } ); }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/index.js const keyboardShortcutContext = (0,external_wp_element_namespaceObject.createContext)(); keyboardShortcutContext.displayName = "keyboardShortcutContext"; const inputEventContext = (0,external_wp_element_namespaceObject.createContext)(); inputEventContext.displayName = "inputEventContext"; const instanceIdKey = Symbol("instanceId"); function removeNativeProps(props) { const { __unstableMobileNoFocusOnMount, deleteEnter, placeholderTextColor, textAlign, selectionColor, tagsToEliminate, disableEditingMenu, fontSize, fontFamily, fontWeight, fontStyle, minWidth, maxWidth, disableSuggestions, disableAutocorrection, ...restProps } = props; return restProps; } function RichTextWrapper({ children, tagName = "div", value: adjustedValue = "", onChange: adjustedOnChange, isSelected: originalIsSelected, multiline, inlineToolbar, wrapperClassName, autocompleters, onReplace, placeholder, allowedFormats, withoutInteractiveFormatting, onRemove, onMerge, onSplit, __unstableOnSplitAtEnd: onSplitAtEnd, __unstableOnSplitAtDoubleLineEnd: onSplitAtDoubleLineEnd, identifier, preserveWhiteSpace, __unstablePastePlainText: pastePlainText, __unstableEmbedURLOnPaste, __unstableDisableFormats: disableFormats, disableLineBreaks, __unstableAllowPrefixTransformations, readOnly, ...props }, forwardedRef) { props = removeNativeProps(props); if (onSplit) { external_wp_deprecated_default()("wp.blockEditor.RichText onSplit prop", { since: "6.4", alternative: 'block.json support key: "splitting"' }); } const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(RichTextWrapper); const anchorRef = (0,external_wp_element_namespaceObject.useRef)(); const context = useBlockEditContext(); const { clientId, isSelected: isBlockSelected } = context; const blockBindings = context[blockBindingsKey]; const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default); const { bindableAttributes } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const selector = (select) => { if (!isBlockSelected) { return { isSelected: false }; } const { getSelectionStart: getSelectionStart2, getSelectionEnd: getSelectionEnd2 } = select(store); const selectionStart2 = getSelectionStart2(); const selectionEnd2 = getSelectionEnd2(); let isSelected2; if (originalIsSelected === void 0) { isSelected2 = selectionStart2.clientId === clientId && selectionEnd2.clientId === clientId && (identifier ? selectionStart2.attributeKey === identifier : selectionStart2[instanceIdKey] === instanceId); } else if (originalIsSelected) { isSelected2 = selectionStart2.clientId === clientId; } return { selectionStart: isSelected2 ? selectionStart2.offset : void 0, selectionEnd: isSelected2 ? selectionEnd2.offset : void 0, isSelected: isSelected2 }; }; const { selectionStart, selectionEnd, isSelected } = (0,external_wp_data_namespaceObject.useSelect)(selector, [ clientId, identifier, instanceId, originalIsSelected, isBlockSelected ]); const { disableBoundBlock, bindingsPlaceholder, bindingsLabel } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (!blockBindings?.[identifier] || !bindableAttributes) { return {}; } const relatedBinding = blockBindings[identifier]; const blockBindingsSource = (0,external_wp_blocks_namespaceObject.getBlockBindingsSource)( relatedBinding.source ); const blockBindingsContext = {}; if (blockBindingsSource?.usesContext?.length) { for (const key of blockBindingsSource.usesContext) { blockBindingsContext[key] = blockContext[key]; } } const _disableBoundBlock = !blockBindingsSource?.canUserEditValue?.({ select, context: blockBindingsContext, args: relatedBinding.args }); if (adjustedValue.length > 0) { return { disableBoundBlock: _disableBoundBlock, // Null values will make them fall back to the default behavior. bindingsPlaceholder: null, bindingsLabel: null }; } const { getBlockAttributes } = select(store); const blockAttributes = getBlockAttributes(clientId); let clientSideFieldLabel = null; if (blockBindingsSource?.getFieldsList) { const fieldsItems = blockBindingsSource.getFieldsList({ select, context: blockBindingsContext }); clientSideFieldLabel = fieldsItems?.find( (item) => es6_default()(item.args, relatedBinding?.args) )?.label; } const bindingKey = clientSideFieldLabel ?? blockBindingsSource?.label; const _bindingsPlaceholder = _disableBoundBlock ? bindingKey : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: connected field label or source label */ (0,external_wp_i18n_namespaceObject.__)("Add %s"), bindingKey ); const _bindingsLabel = _disableBoundBlock ? relatedBinding?.args?.key || blockBindingsSource?.label : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: source label or key */ (0,external_wp_i18n_namespaceObject.__)("Empty %s; start writing to edit its value"), relatedBinding?.args?.key || blockBindingsSource?.label ); return { disableBoundBlock: _disableBoundBlock, bindingsPlaceholder: blockAttributes?.placeholder || _bindingsPlaceholder, bindingsLabel: _bindingsLabel }; }, [ blockBindings, identifier, bindableAttributes, adjustedValue, clientId, blockContext ] ); const isInsidePatternOverrides = !!blockContext?.["pattern/overrides"]; const hasOverrideEnabled = blockBindings?.__default?.source === "core/pattern-overrides"; const shouldDisableForPattern = isInsidePatternOverrides && !hasOverrideEnabled; const shouldDisableEditing = readOnly || disableBoundBlock || shouldDisableForPattern; const { getSelectionStart, getSelectionEnd, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); const adjustedAllowedFormats = getAllowedFormats({ allowedFormats, disableFormats }); const hasFormats = !adjustedAllowedFormats || adjustedAllowedFormats.length > 0; const onSelectionChange = (0,external_wp_element_namespaceObject.useCallback)( (start, end) => { const selection = {}; const unset = start === void 0 && end === void 0; const baseSelection = { clientId, [identifier ? "attributeKey" : instanceIdKey]: identifier ? identifier : instanceId }; if (typeof start === "number" || unset) { if (end === void 0 && getBlockRootClientId(clientId) !== getBlockRootClientId(getSelectionEnd().clientId)) { return; } selection.start = { ...baseSelection, offset: start }; } if (typeof end === "number" || unset) { if (start === void 0 && getBlockRootClientId(clientId) !== getBlockRootClientId(getSelectionStart().clientId)) { return; } selection.end = { ...baseSelection, offset: end }; } selectionChange(selection); }, [ clientId, getBlockRootClientId, getSelectionEnd, getSelectionStart, identifier, instanceId, selectionChange ] ); const { formatTypes, prepareHandlers, valueHandlers, changeHandlers, dependencies } = useFormatTypes({ clientId, identifier, withoutInteractiveFormatting, allowedFormats: adjustedAllowedFormats }); function addEditorOnlyFormats(value2) { return valueHandlers.reduce( (accumulator, fn) => fn(accumulator, value2.text), value2.formats ); } function removeEditorOnlyFormats(value2) { formatTypes.forEach((formatType) => { if (formatType.__experimentalCreatePrepareEditableTree) { value2 = (0,external_wp_richText_namespaceObject.removeFormat)( value2, formatType.name, 0, value2.text.length ); } }); return value2.formats; } function addInvisibleFormats(value2) { return prepareHandlers.reduce( (accumulator, fn) => fn(accumulator, value2.text), value2.formats ); } const { value, getValue, onChange, ref: richTextRef } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({ value: adjustedValue, onChange(html, { __unstableFormats, __unstableText }) { adjustedOnChange(html); Object.values(changeHandlers).forEach((changeHandler) => { changeHandler(__unstableFormats, __unstableText); }); }, selectionStart, selectionEnd, onSelectionChange, placeholder: bindingsPlaceholder || placeholder, __unstableIsSelected: isSelected, __unstableDisableFormats: disableFormats, preserveWhiteSpace, __unstableDependencies: [...dependencies, tagName], __unstableAfterParse: addEditorOnlyFormats, __unstableBeforeSerialize: removeEditorOnlyFormats, __unstableAddInvisibleFormats: addInvisibleFormats }); const autocompleteProps = useBlockEditorAutocompleteProps({ onReplace, completers: autocompleters, record: value, onChange }); useMarkPersistent({ html: adjustedValue, value }); const keyboardShortcuts = (0,external_wp_element_namespaceObject.useRef)(/* @__PURE__ */ new Set()); const inputEvents = (0,external_wp_element_namespaceObject.useRef)(/* @__PURE__ */ new Set()); function onFocus() { anchorRef.current?.focus(); } const TagName = tagName; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ isSelected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboardShortcutContext.Provider, { value: keyboardShortcuts, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inputEventContext.Provider, { value: inputEvents, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Popover.__unstableSlotNameProvider, { value: "__unstable-block-tools-after", children: [ children && children({ value, onChange, onFocus }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FormatEdit, { value, onChange, onFocus, formatTypes, forwardedRef: anchorRef } ) ] }) }) }), isSelected && hasFormats && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( format_toolbar_container_default, { inline: inlineToolbar, editableContentElement: anchorRef.current } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TagName, { role: "textbox", "aria-multiline": !disableLineBreaks, "aria-readonly": shouldDisableEditing, ...props, draggable: void 0, "aria-label": bindingsLabel || props["aria-label"] || placeholder, ...autocompleteProps, ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ // Rich text ref must be first because its focus listener // must be set up before any other ref calls .focus() on // mount. richTextRef, forwardedRef, autocompleteProps.ref, props.ref, useEventListeners({ registry, getValue, onChange, __unstableAllowPrefixTransformations, formatTypes, onReplace, selectionChange, isSelected, disableFormats, value, tagName, onSplit, __unstableEmbedURLOnPaste, pastePlainText, onMerge, onRemove, removeEditorOnlyFormats, disableLineBreaks, onSplitAtEnd, onSplitAtDoubleLineEnd, keyboardShortcuts, inputEvents }), anchorRef ]), contentEditable: !shouldDisableEditing, suppressContentEditableWarning: true, className: dist_clsx( "block-editor-rich-text__editable", props.className, "rich-text" ), tabIndex: props.tabIndex === 0 && !shouldDisableEditing ? null : props.tabIndex, "data-wp-block-attribute-key": identifier } ) ] }); } const PrivateRichText = withDeprecations( (0,external_wp_element_namespaceObject.forwardRef)(RichTextWrapper) ); PrivateRichText.Content = Content; PrivateRichText.isEmpty = (value) => { return !value || value.length === 0; }; const PublicForwardedRichTextContainer = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { const context = useBlockEditContext(); const isPreviewMode = context[isPreviewModeKey]; if (isPreviewMode) { const { children, tagName: Tag = "div", value, onChange, isSelected, multiline, inlineToolbar, wrapperClassName, autocompleters, onReplace, placeholder, allowedFormats, withoutInteractiveFormatting, onRemove, onMerge, onSplit, __unstableOnSplitAtEnd, __unstableOnSplitAtDoubleLineEnd, identifier, preserveWhiteSpace, __unstablePastePlainText, __unstableEmbedURLOnPaste, __unstableDisableFormats, disableLineBreaks, __unstableAllowPrefixTransformations, readOnly, ...contentProps } = removeNativeProps(props); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Tag, { ref, ...contentProps, dangerouslySetInnerHTML: { __html: valueToHTMLString(value, multiline) } } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateRichText, { ref, ...props, readOnly: false }); }); PublicForwardedRichTextContainer.Content = Content; PublicForwardedRichTextContainer.isEmpty = (value) => { return !value || value.length === 0; }; var rich_text_default = PublicForwardedRichTextContainer; ;// ./node_modules/@wordpress/block-editor/build-module/components/editable-text/index.js const EditableText = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(rich_text_default, { ref, ...props, __unstableDisableFormats: true }); }); EditableText.Content = ({ value = "", tagName: Tag = "div", ...props }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ...props, children: value }); }; var editable_text_default = EditableText; ;// ./node_modules/@wordpress/block-editor/build-module/components/plain-text/index.js const PlainText = (0,external_wp_element_namespaceObject.forwardRef)(({ __experimentalVersion, ...props }, ref) => { if (__experimentalVersion === 2) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editable_text_default, { ref, ...props }); } const { className, onChange, ...remainingProps } = props; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( lib/* default */.A, { ref, className: dist_clsx("block-editor-plain-text", className), onChange: (event) => onChange(event.target.value), ...remainingProps } ); }); var plain_text_default = PlainText; ;// ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/label.js function ResponsiveBlockControlLabel({ property, viewport, desc }) { const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ResponsiveBlockControlLabel); const accessibleLabel = desc || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: property name. 2: viewport name. */ (0,external_wp_i18n_namespaceObject._x)( "Controls the %1$s property for %2$s viewports.", "Text labelling a interface as controlling a given layout property (eg: margin) for a given screen size." ), property, viewport.label ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "aria-describedby": `rbc-desc-${instanceId}`, children: viewport.label }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", id: `rbc-desc-${instanceId}`, children: accessibleLabel }) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/index.js function ResponsiveBlockControl(props) { const { title, property, toggleLabel, onIsResponsiveChange, renderDefaultControl, renderResponsiveControls, isResponsive = false, defaultLabel = { id: "all", label: (0,external_wp_i18n_namespaceObject._x)("All", "screen sizes") }, viewports = [ { id: "small", label: (0,external_wp_i18n_namespaceObject.__)("Small screens") }, { id: "medium", label: (0,external_wp_i18n_namespaceObject.__)("Medium screens") }, { id: "large", label: (0,external_wp_i18n_namespaceObject.__)("Large screens") } ] } = props; if (!title || !property || !renderDefaultControl) { return null; } const toggleControlLabel = toggleLabel || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Property value for the control (eg: margin, padding, etc.). */ (0,external_wp_i18n_namespaceObject.__)("Use the same %s on all screen sizes."), property ); const toggleHelpText = (0,external_wp_i18n_namespaceObject.__)( "Choose whether to use the same value for all screen sizes or a unique value for each screen size." ); const defaultControl = renderDefaultControl( /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ResponsiveBlockControlLabel, { property, viewport: defaultLabel } ), defaultLabel ); const defaultResponsiveControls = () => { return viewports.map((viewport) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children: renderDefaultControl( /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ResponsiveBlockControlLabel, { property, viewport } ), viewport ) }, viewport.id)); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-responsive-block-control", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("legend", { className: "block-editor-responsive-block-control__title", children: title }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-responsive-block-control__inner", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, className: "block-editor-responsive-block-control__toggle", label: toggleControlLabel, checked: !isResponsive, onChange: onIsResponsiveChange, help: toggleHelpText } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: dist_clsx( "block-editor-responsive-block-control__group", { "is-responsive": isResponsive } ), children: [ !isResponsive && defaultControl, isResponsive && (renderResponsiveControls ? renderResponsiveControls(viewports) : defaultResponsiveControls()) ] } ) ] }) ] }); } var responsive_block_control_default = ResponsiveBlockControl; ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/shortcut.js function RichTextShortcut({ character, type, onUse }) { const keyboardShortcuts = (0,external_wp_element_namespaceObject.useContext)(keyboardShortcutContext); const onUseRef = (0,external_wp_element_namespaceObject.useRef)(); onUseRef.current = onUse; (0,external_wp_element_namespaceObject.useEffect)(() => { function callback(event) { if (external_wp_keycodes_namespaceObject.isKeyboardEvent[type](event, character)) { onUseRef.current(); event.preventDefault(); } } keyboardShortcuts.current.add(callback); return () => { keyboardShortcuts.current.delete(callback); }; }, [character, type]); return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/toolbar-button.js function RichTextToolbarButton({ name, shortcutType, shortcutCharacter, ...props }) { let shortcut; let fillName = "RichText.ToolbarControls"; if (name) { fillName += `.${name}`; } if (shortcutType && shortcutCharacter) { shortcut = external_wp_keycodes_namespaceObject.displayShortcut[shortcutType](shortcutCharacter); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: fillName, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { ...props, shortcut }) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/input-event.js function __unstableRichTextInputEvent({ inputType, onInput }) { const callbacks = (0,external_wp_element_namespaceObject.useContext)(inputEventContext); const onInputRef = (0,external_wp_element_namespaceObject.useRef)(); onInputRef.current = onInput; (0,external_wp_element_namespaceObject.useEffect)(() => { function callback(event) { if (event.inputType === inputType) { onInputRef.current(); event.preventDefault(); } } callbacks.current.add(callback); return () => { callbacks.current.delete(callback); }; }, [inputType]); return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/unit-control/index.js function UnitControl({ units: unitsProp, ...props }) { const [availableUnits] = use_settings_useSettings("spacing.units"); const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || ["%", "px", "em", "rem", "vw"], units: unitsProp }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { units, ...props }); } ;// ./node_modules/@wordpress/icons/build-module/library/arrow-left.js var arrow_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/url-input/button.js function URLInputButton({ url, onChange }) { const [expanded, toggleExpanded] = (0,external_wp_element_namespaceObject.useReducer)( (isExpanded) => !isExpanded, false ); const submitLink = (event) => { event.preventDefault(); toggleExpanded(); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-input__button", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", icon: link_default, label: url ? (0,external_wp_i18n_namespaceObject.__)("Edit link") : (0,external_wp_i18n_namespaceObject.__)("Insert link"), onClick: toggleExpanded, className: "components-toolbar__control", isPressed: !!url } ), expanded && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "form", { className: "block-editor-url-input__button-modal", onSubmit: submitLink, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-input__button-modal-line", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "block-editor-url-input__back", icon: arrow_left_default, label: (0,external_wp_i18n_namespaceObject.__)("Close"), onClick: toggleExpanded } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( url_input_default, { value: url || "", onChange, suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", icon: keyboard_return_default, label: (0,external_wp_i18n_namespaceObject.__)("Submit"), type: "submit" } ) }) } ) ] }) } ) ] }); } var button_default = URLInputButton; ;// ./node_modules/@wordpress/icons/build-module/library/image.js var image_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.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" }) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/image-url-input-ui.js const LINK_DESTINATION_NONE = "none"; const LINK_DESTINATION_CUSTOM = "custom"; const LINK_DESTINATION_MEDIA = "media"; const LINK_DESTINATION_ATTACHMENT = "attachment"; const NEW_TAB_REL = ["noreferrer", "noopener"]; const ImageURLInputUI = ({ linkDestination, onChangeUrl, url, mediaType = "image", mediaUrl, mediaLink, linkTarget, linkClass, rel, showLightboxSetting, lightboxEnabled, onSetLightbox, resetLightbox }) => { const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(false); const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const openLinkUI = () => { setIsOpen(true); }; const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)(false); const [urlInput, setUrlInput] = (0,external_wp_element_namespaceObject.useState)(null); const autocompleteRef = (0,external_wp_element_namespaceObject.useRef)(null); const wrapperRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!wrapperRef.current) { return; } const nextFocusTarget = external_wp_dom_namespaceObject.focus.focusable.find(wrapperRef.current)[0] || wrapperRef.current; nextFocusTarget.focus(); }, [isEditingLink, url, lightboxEnabled]); const startEditLink = () => { if (linkDestination === LINK_DESTINATION_MEDIA || linkDestination === LINK_DESTINATION_ATTACHMENT) { setUrlInput(""); } setIsEditingLink(true); }; const stopEditLink = () => { setIsEditingLink(false); }; const closeLinkUI = () => { setUrlInput(null); stopEditLink(); setIsOpen(false); }; const getUpdatedLinkTargetSettings = (value) => { const newLinkTarget = value ? "_blank" : void 0; let updatedRel; if (newLinkTarget) { const rels = (rel ?? "").split(" "); NEW_TAB_REL.forEach((relVal) => { if (!rels.includes(relVal)) { rels.push(relVal); } }); updatedRel = rels.join(" "); } else { const rels = (rel ?? "").split(" ").filter( (relVal) => NEW_TAB_REL.includes(relVal) === false ); updatedRel = rels.length ? rels.join(" ") : void 0; } return { linkTarget: newLinkTarget, rel: updatedRel }; }; const onFocusOutside = () => { return (event) => { const autocompleteElement = autocompleteRef.current; if (autocompleteElement && autocompleteElement.contains(event.target)) { return; } setIsOpen(false); setUrlInput(null); stopEditLink(); }; }; const onSubmitLinkChange = () => { return (event) => { if (urlInput) { const selectedDestination = getLinkDestinations().find( (destination) => destination.url === urlInput )?.linkDestination || LINK_DESTINATION_CUSTOM; onChangeUrl({ href: (0,external_wp_url_namespaceObject.prependHTTP)(urlInput), linkDestination: selectedDestination, lightbox: { enabled: false } }); } stopEditLink(); setUrlInput(null); event.preventDefault(); }; }; const onLinkRemove = () => { onChangeUrl({ linkDestination: LINK_DESTINATION_NONE, href: "" }); }; const getLinkDestinations = () => { const linkDestinations = [ { linkDestination: LINK_DESTINATION_MEDIA, title: (0,external_wp_i18n_namespaceObject.__)("Link to image file"), url: mediaType === "image" ? mediaUrl : void 0, icon: image_default } ]; if (mediaType === "image" && mediaLink) { linkDestinations.push({ linkDestination: LINK_DESTINATION_ATTACHMENT, title: (0,external_wp_i18n_namespaceObject.__)("Link to attachment page"), url: mediaType === "image" ? mediaLink : void 0, icon: page_default }); } return linkDestinations; }; const onSetHref = (value) => { const linkDestinations = getLinkDestinations(); let linkDestinationInput; if (!value) { linkDestinationInput = LINK_DESTINATION_NONE; } else { linkDestinationInput = (linkDestinations.find((destination) => { return destination.url === value; }) || { linkDestination: LINK_DESTINATION_CUSTOM }).linkDestination; } onChangeUrl({ linkDestination: linkDestinationInput, href: value }); }; const onSetNewTab = (value) => { const updatedLinkTarget = getUpdatedLinkTargetSettings(value); onChangeUrl(updatedLinkTarget); }; const onSetLinkRel = (value) => { onChangeUrl({ rel: value }); }; const onSetLinkClass = (value) => { onChangeUrl({ linkClass: value }); }; const advancedOptions = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Open in new tab"), onChange: onSetNewTab, checked: linkTarget === "_blank" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Link relation"), value: rel ?? "", onChange: onSetLinkRel, help: (0,external_wp_element_namespaceObject.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.__)( "The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document." ), { a: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: "https://developer.mozilla.org/docs/Web/HTML/Attributes/rel" }) } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Link CSS class"), value: linkClass || "", onChange: onSetLinkClass } ) ] }); const linkEditorValue = urlInput !== null ? urlInput : url; const hideLightboxPanel = !lightboxEnabled || lightboxEnabled && !showLightboxSetting; const showLinkEditor = !linkEditorValue && hideLightboxPanel; const urlLabel = (getLinkDestinations().find( (destination) => destination.linkDestination === linkDestination ) || {}).title; const PopoverChildren = () => { if (lightboxEnabled && showLightboxSetting && !url && !isEditingLink) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-popover__expand-on-click", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: fullscreen_default }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "text", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("Enlarge on click") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "description", children: (0,external_wp_i18n_namespaceObject.__)("Scales the image with a lightbox effect") }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { icon: link_off_default, label: (0,external_wp_i18n_namespaceObject.__)("Disable enlarge on click"), onClick: () => { onSetLightbox?.(false); }, size: "compact" } ) ] }); } else if (!url || isEditingLink) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( url_popover_default.LinkEditor, { className: "block-editor-format-toolbar__link-container-content", value: linkEditorValue, onChangeInputValue: setUrlInput, onSubmit: onSubmitLinkChange(), autocompleteRef } ); } else if (url && !isEditingLink) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( url_popover_default.LinkViewer, { className: "block-editor-format-toolbar__link-container-content", url, onEditLinkClick: startEditLink, urlLabel } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { icon: link_off_default, label: (0,external_wp_i18n_namespaceObject.__)("Remove link"), onClick: () => { onLinkRemove(); resetLightbox?.(); }, size: "compact" } ) ] }); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToolbarButton, { icon: link_default, className: "components-toolbar__control", label: (0,external_wp_i18n_namespaceObject.__)("Link"), "aria-expanded": isOpen, onClick: openLinkUI, ref: setPopoverAnchor, isActive: !!url || lightboxEnabled && showLightboxSetting } ), isOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( url_popover_default, { ref: wrapperRef, anchor: popoverAnchor, onFocusOutside: onFocusOutside(), onClose: closeLinkUI, renderSettings: hideLightboxPanel ? () => advancedOptions : null, additionalControls: showLinkEditor && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.NavigableMenu, { children: [ getLinkDestinations().map((link) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: link.icon, iconPosition: "left", onClick: () => { setUrlInput(null); onSetHref(link.url); stopEditLink(); }, children: link.title }, link.linkDestination )), showLightboxSetting && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { className: "block-editor-url-popover__expand-on-click", icon: fullscreen_default, info: (0,external_wp_i18n_namespaceObject.__)( "Scale the image with a lightbox effect." ), iconPosition: "left", onClick: () => { setUrlInput(null); onChangeUrl({ linkDestination: LINK_DESTINATION_NONE, href: "" }); onSetLightbox?.(true); stopEditLink(); }, children: (0,external_wp_i18n_namespaceObject.__)("Enlarge on click") }, "expand-on-click" ) ] }), offset: 13, children: PopoverChildren() } ) ] }); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/preview-options/index.js function PreviewOptions() { external_wp_deprecated_default()("wp.blockEditor.PreviewOptions", { version: "6.5" }); return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/use-resize-canvas/index.js function useResizeCanvas(deviceType) { const [actualWidth, updateActualWidth] = (0,external_wp_element_namespaceObject.useState)(window.innerWidth); (0,external_wp_element_namespaceObject.useEffect)(() => { if (deviceType === "Desktop") { return; } const resizeListener = () => updateActualWidth(window.innerWidth); window.addEventListener("resize", resizeListener); return () => { window.removeEventListener("resize", resizeListener); }; }, [deviceType]); const getCanvasWidth = (device) => { let deviceWidth; switch (device) { case "Tablet": deviceWidth = 780; break; case "Mobile": deviceWidth = 360; break; default: return null; } return deviceWidth < actualWidth ? deviceWidth : actualWidth; }; const contentInlineStyles = (device) => { const height = device === "Mobile" ? "768px" : "1024px"; const marginVertical = "40px"; const marginHorizontal = "auto"; switch (device) { case "Tablet": case "Mobile": return { width: getCanvasWidth(device), // Keeping margin styles separate to avoid warnings // when those props get overridden in the iframe component marginTop: marginVertical, marginBottom: marginVertical, marginLeft: marginHorizontal, marginRight: marginHorizontal, height, overflowY: "auto" }; default: return { marginLeft: marginHorizontal, marginRight: marginHorizontal }; } }; return contentInlineStyles(deviceType); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/edit-contents-button.js function EditContentsButton({ clientId }) { const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { attributes } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { return { attributes: select(store).getBlockAttributes(clientId) }; }, [clientId] ); if (!attributes?.metadata?.patternName) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { className: "block-editor-block-inspector-edit-contents-button", __next40pxDefaultSize: true, variant: "secondary", onClick: () => { const { patternName, ...metadataWithoutPatternName } = attributes?.metadata ?? {}; updateBlockAttributes(clientId, { ...attributes, metadata: metadataWithoutPatternName }); }, children: (0,external_wp_i18n_namespaceObject.__)("Edit contents") } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/skip-to-selected-block/index.js function SkipToSelectedBlock() { const selectedBlockClientId = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).getBlockSelectionStart(), [] ); const ref = (0,external_wp_element_namespaceObject.useRef)(); useBlockElementRef(selectedBlockClientId, ref); const onClick = () => { ref.current?.focus(); }; return selectedBlockClientId ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", className: "block-editor-skip-to-selected-block", onClick, children: (0,external_wp_i18n_namespaceObject.__)("Skip to the selected block") } ) : null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/multi-selection-inspector/index.js function MultiSelectionInspector() { const selectedBlockCount = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).getSelectedBlockCount(), [] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", spacing: 2, className: "block-editor-multi-selection-inspector__card", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: copy_default, showColors: true }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-multi-selection-inspector__card-title", children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of blocks */ (0,external_wp_i18n_namespaceObject._n)("%d Block", "%d Blocks", selectedBlockCount), selectedBlockCount ) }) ] } ); } ;// ./node_modules/@wordpress/icons/build-module/library/cog.js var cog_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", 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", clipRule: "evenodd" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/styles.js var styles_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/utils.js const TAB_SETTINGS = { name: "settings", title: (0,external_wp_i18n_namespaceObject.__)("Settings"), value: "settings", icon: cog_default }; const TAB_STYLES = { name: "styles", title: (0,external_wp_i18n_namespaceObject.__)("Styles"), value: "styles", icon: styles_default }; const TAB_CONTENT = { name: "content", title: (0,external_wp_i18n_namespaceObject.__)("Content"), value: "content", icon: page_default }; const TAB_LIST_VIEW = { name: "list", title: (0,external_wp_i18n_namespaceObject.__)("List View"), value: "list-view", icon: list_view_default }; ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/advanced-controls-panel.js const AdvancedControls = () => { const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(InspectorAdvancedControls.slotName); const privateFills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)( PrivateInspectorControlsAllowedBlocks.name ); const hasFills = Boolean(fills && fills.length); const hasPrivateFills = Boolean(privateFills && privateFills.length); if (!hasFills && !hasPrivateFills) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.PanelBody, { className: "block-editor-block-inspector__advanced", title: (0,external_wp_i18n_namespaceObject.__)("Advanced"), initialOpen: false, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "advanced" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInspectorControlsAllowedBlocks.Slot, {}) ] } ); }; var advanced_controls_panel_default = AdvancedControls; ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/position-controls-panel.js const PositionControlsPanel = () => { const { selectedClientIds, selectedBlocks, hasPositionAttribute } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getBlocksByClientId, getSelectedBlockClientIds } = select(store); const selectedBlockClientIds = getSelectedBlockClientIds(); const _selectedBlocks = getBlocksByClientId( selectedBlockClientIds ); return { selectedClientIds: selectedBlockClientIds, selectedBlocks: _selectedBlocks, hasPositionAttribute: _selectedBlocks?.some( ({ attributes }) => !!attributes?.style?.position?.type ) }; }, []); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const dropdownMenuProps = useToolsPanelDropdownMenuProps(); function resetPosition() { if (!selectedClientIds?.length || !selectedBlocks?.length) { return; } const attributesByClientId = Object.fromEntries( selectedBlocks?.map(({ clientId, attributes }) => [ clientId, { style: utils_cleanEmptyObject({ ...attributes?.style, position: { ...attributes?.style?.position, type: void 0, top: void 0, right: void 0, bottom: void 0, left: void 0 } }) } ]) ); updateBlockAttributes(selectedClientIds, attributesByClientId, true); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanel, { className: "block-editor-block-inspector__position", label: (0,external_wp_i18n_namespaceObject.__)("Position"), resetAll: resetPosition, dropdownMenuProps, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { isShownByDefault: hasPositionAttribute, label: (0,external_wp_i18n_namespaceObject.__)("Position"), hasValue: () => hasPositionAttribute, onDeselect: resetPosition, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "position" }) } ) } ); }; const PositionControls = () => { const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(groups_groups_default.position.name); const hasFills = Boolean(fills && fills.length); if (!hasFills) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PositionControlsPanel, {}); }; var position_controls_panel_default = PositionControls; ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/settings-tab.js const SettingsTab = ({ showAdvancedControls = false }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(position_controls_panel_default, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "bindings" }), showAdvancedControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(advanced_controls_panel_default, {}) }) ] }); var settings_tab_default = SettingsTab; ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/styles-tab.js const StylesTab = ({ blockName, clientId, hasBlockStyles, isSectionBlock }) => { const borderPanelLabel = useBorderPanelLabel({ blockName }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ hasBlockStyles && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Styles"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_styles_default, { clientId }) }) }), !isSectionBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inspector_controls_default.Slot, { group: "color", label: (0,external_wp_i18n_namespaceObject.__)("Color"), className: "color-block-support-panel__inner-wrapper" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inspector_controls_default.Slot, { group: "background", label: (0,external_wp_i18n_namespaceObject.__)("Background image") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "filter" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inspector_controls_default.Slot, { group: "typography", label: (0,external_wp_i18n_namespaceObject.__)("Typography") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inspector_controls_default.Slot, { group: "dimensions", label: (0,external_wp_i18n_namespaceObject.__)("Dimensions") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inspector_controls_default.Slot, { group: "border", label: borderPanelLabel } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "styles" }) ] }) ] }); }; var styles_tab_default = StylesTab; ;// ./node_modules/@wordpress/block-editor/build-module/components/block-quick-navigation/index.js function BlockQuickNavigation({ clientIds, onSelect }) { if (!clientIds.length) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: clientIds.map((clientId) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockQuickNavigationItem, { onSelect, clientId }, clientId )) }); } function BlockQuickNavigationItem({ clientId, onSelect }) { const blockInformation = useBlockDisplayInformation(clientId); const blockTitle = useBlockDisplayTitle({ clientId, context: "list-view" }); const { isSelected } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { isBlockSelected, hasSelectedInnerBlock } = select(store); return { isSelected: isBlockSelected(clientId) || hasSelectedInnerBlock( clientId, /* deep: */ true ) }; }, [clientId] ); const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, isPressed: isSelected, onClick: async () => { await selectBlock(clientId); if (onSelect) { onSelect(clientId); } }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: blockInformation?.icon }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { style: { textAlign: "left" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { children: blockTitle }) }) ] }) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/content-tab.js const ContentTab = ({ contentClientIds }) => { if (!contentClientIds || contentClientIds.length === 0) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Content"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockQuickNavigation, { clientIds: contentClientIds }) }); }; var content_tab_default = ContentTab; ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js const allowlist = ["core/navigation"]; const useIsListViewTabDisabled = (blockName) => { return !allowlist.includes(blockName); }; var use_is_list_view_tab_disabled_default = useIsListViewTabDisabled; ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/index.js const { Tabs: inspector_controls_tabs_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); function InspectorControlsTabs({ blockName, clientId, hasBlockStyles, tabs, isSectionBlock, contentClientIds }) { const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)((select) => { return select(external_wp_preferences_namespaceObject.store).get("core", "showIconLabels"); }, []); const initialTabName = !use_is_list_view_tab_disabled_default(blockName) ? TAB_LIST_VIEW.name : void 0; const [selectedTabId, setSelectedTabId] = (0,external_wp_element_namespaceObject.useState)( initialTabName ?? tabs[0]?.name ); (0,external_wp_element_namespaceObject.useEffect)(() => { if (initialTabName) { return; } if (tabs?.length && selectedTabId) { const activeTab = tabs.find( (tab) => tab.name === selectedTabId ); if (!activeTab) { setSelectedTabId(tabs[0].name); } } }, [tabs, selectedTabId, initialTabName]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-inspector__tabs", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( inspector_controls_tabs_Tabs, { defaultTabId: initialTabName, selectedTabId, onSelect: setSelectedTabId, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabList, { children: tabs.map( (tab) => showIconLabels ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.Tab, { tabId: tab.name, children: tab.title }, tab.name) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: tab.title, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inspector_controls_tabs_Tabs.Tab, { tabId: tab.name, "aria-label": tab.title, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: tab.icon }) } ) }, tab.name) ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { tabId: TAB_SETTINGS.name, focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(settings_tab_default, { showAdvancedControls: !!blockName }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { tabId: TAB_STYLES.name, focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( styles_tab_default, { blockName, clientId, hasBlockStyles, isSectionBlock } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { tabId: TAB_CONTENT.name, focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(content_tab_default, { contentClientIds }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { tabId: TAB_LIST_VIEW.name, focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "list" }) }) ] }, clientId ) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js const use_inspector_controls_tabs_EMPTY_ARRAY = []; function getShowTabs(blockName, tabSettings = {}) { if (tabSettings[blockName] !== void 0) { return tabSettings[blockName]; } if (tabSettings.default !== void 0) { return tabSettings.default; } return true; } function useInspectorControlsTabs(blockName, contentClientIds, isSectionBlock, hasBlockStyles) { const tabs = []; const { bindings: bindingsGroup, border: borderGroup, color: colorGroup, default: defaultGroup, dimensions: dimensionsGroup, list: listGroup, position: positionGroup, styles: stylesGroup, typography: typographyGroup, effects: effectsGroup } = groups_groups_default; const listViewDisabled = use_is_list_view_tab_disabled_default(blockName); const listFills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(listGroup.name); const hasListFills = !listViewDisabled && !!listFills && listFills.length; const styleFills = [ ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(borderGroup.name) || [], ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(colorGroup.name) || [], ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(dimensionsGroup.name) || [], ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(stylesGroup.name) || [], ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(typographyGroup.name) || [], ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(effectsGroup.name) || [] ]; const hasStyleFills = styleFills.length; const advancedFills = [ ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(InspectorAdvancedControls.slotName) || [], ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(bindingsGroup.name) || [] ]; const settingsFills = [ ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(defaultGroup.name) || [], ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(positionGroup.name) || [], ...hasListFills && hasStyleFills > 1 ? advancedFills : [] ]; const hasContentTab = !!(contentClientIds && contentClientIds.length > 0); if (hasListFills && !isSectionBlock) { tabs.push(TAB_LIST_VIEW); } if (hasContentTab) { tabs.push(TAB_CONTENT); } if (settingsFills.length && !isSectionBlock) { tabs.push(TAB_SETTINGS); } if (isSectionBlock ? hasBlockStyles : hasStyleFills) { tabs.push(TAB_STYLES); } const tabSettings = (0,external_wp_data_namespaceObject.useSelect)((select) => { return select(store).getSettings().blockInspectorTabs; }, []); const showTabs = getShowTabs(blockName, tabSettings); return showTabs ? tabs : use_inspector_controls_tabs_EMPTY_ARRAY; } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js function useBlockInspectorAnimationSettings(blockType) { return (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (blockType) { const globalBlockInspectorAnimationSettings = select(store).getSettings().blockInspectorAnimation; const animationParent = globalBlockInspectorAnimationSettings?.animationParent; const { getSelectedBlockClientId, getBlockParentsByBlockName } = select(store); const _selectedBlockClientId = getSelectedBlockClientId(); const animationParentBlockClientId = getBlockParentsByBlockName( _selectedBlockClientId, animationParent, true )[0]; if (!animationParentBlockClientId && blockType.name !== animationParent) { return null; } return globalBlockInspectorAnimationSettings?.[blockType.name]; } return null; }, [blockType] ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/index.js function BlockStylesPanel({ clientId }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Styles"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_styles_default, { clientId }) }); } function StyleInspectorSlots({ blockName, showAdvancedControls = true, showPositionControls = true, showListControls = false, showBindingsControls = true }) { const borderPanelLabel = useBorderPanelLabel({ blockName }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, {}), showListControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "list" }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inspector_controls_default.Slot, { group: "color", label: (0,external_wp_i18n_namespaceObject.__)("Color"), className: "color-block-support-panel__inner-wrapper" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inspector_controls_default.Slot, { group: "background", label: (0,external_wp_i18n_namespaceObject.__)("Background image") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inspector_controls_default.Slot, { group: "typography", label: (0,external_wp_i18n_namespaceObject.__)("Typography") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( inspector_controls_default.Slot, { group: "dimensions", label: (0,external_wp_i18n_namespaceObject.__)("Dimensions") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "border", label: borderPanelLabel }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "styles" }), showPositionControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(position_controls_panel_default, {}), showBindingsControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "bindings" }), showAdvancedControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(advanced_controls_panel_default, {}) }) ] }); } function BlockInspector() { const { selectedBlockCount, selectedBlockName, selectedBlockClientId, blockType, isSectionBlock, isSectionBlockInSelection, hasBlockStyles } = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getSelectedBlockClientId, getSelectedBlockClientIds, getSelectedBlockCount, getBlockName, getParentSectionBlock, isSectionBlock: _isSectionBlock } = unlock(select(store)); const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store); const _selectedBlockClientId = getSelectedBlockClientId(); const renderedBlockClientId = getParentSectionBlock(_selectedBlockClientId) || _selectedBlockClientId; const _selectedBlockName = renderedBlockClientId && getBlockName(renderedBlockClientId); const _blockType = _selectedBlockName && (0,external_wp_blocks_namespaceObject.getBlockType)(_selectedBlockName); const selectedBlockClientIds = getSelectedBlockClientIds(); const _isSectionBlockInSelection = selectedBlockClientIds.some( (id) => _isSectionBlock(id) ); const blockStyles = _selectedBlockName && getBlockStyles(_selectedBlockName); const _hasBlockStyles = blockStyles && blockStyles.length > 0; return { selectedBlockCount: getSelectedBlockCount(), selectedBlockClientId: renderedBlockClientId, selectedBlockName: _selectedBlockName, blockType: _blockType, isSectionBlockInSelection: _isSectionBlockInSelection, isSectionBlock: _isSectionBlock(renderedBlockClientId), hasBlockStyles: _hasBlockStyles }; }, []); const contentClientIds = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (!isSectionBlock || !selectedBlockClientId) { return []; } const { getClientIdsOfDescendants, getBlockName, getBlockEditingMode } = unlock(select(store)); const descendants = getClientIdsOfDescendants( selectedBlockClientId ); const navigationDescendants = /* @__PURE__ */ new Set(); descendants.forEach((clientId) => { if (getBlockName(clientId) === "core/navigation") { const navChildren = getClientIdsOfDescendants(clientId); navChildren.forEach( (childId) => navigationDescendants.add(childId) ); } }); return descendants.filter((current) => { if (navigationDescendants.has(current)) { return false; } return getBlockName(current) !== "core/list-item" && getBlockEditingMode(current) === "contentOnly"; }); }, [isSectionBlock, selectedBlockClientId] ); const availableTabs = useInspectorControlsTabs( blockType?.name, contentClientIds, isSectionBlock, hasBlockStyles ); const hasMultipleTabs = availableTabs?.length > 1; const blockInspectorAnimationSettings = useBlockInspectorAnimationSettings(blockType); const hasSelectedBlocks = selectedBlockCount > 1; if (hasSelectedBlocks && !isSectionBlockInSelection) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-inspector", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MultiSelectionInspector, {}), hasMultipleTabs ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsTabs, { tabs: availableTabs }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( StyleInspectorSlots, { blockName: selectedBlockName, showAdvancedControls: false, showPositionControls: false, showBindingsControls: false } ) ] }); } if (hasSelectedBlocks && isSectionBlockInSelection) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-inspector", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MultiSelectionInspector, {}) }); } const isSelectedBlockUnregistered = selectedBlockName === (0,external_wp_blocks_namespaceObject.getUnregisteredTypeHandlerName)(); const shouldShowWarning = !blockType || !selectedBlockClientId || isSelectedBlockUnregistered; if (shouldShowWarning) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-inspector__no-blocks", children: (0,external_wp_i18n_namespaceObject.__)("No block selected.") }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockInspectorSingleBlockWrapper, { animate: blockInspectorAnimationSettings, wrapper: (children) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AnimatedContainer, { blockInspectorAnimationSettings, selectedBlockClientId, children } ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockInspectorSingleBlock, { clientId: selectedBlockClientId, blockName: blockType.name, isSectionBlock, availableTabs, contentClientIds, hasBlockStyles } ) } ); } const BlockInspectorSingleBlockWrapper = ({ animate, wrapper, children }) => { return animate ? wrapper(children) : children; }; const AnimatedContainer = ({ blockInspectorAnimationSettings, selectedBlockClientId, children }) => { const animationOrigin = blockInspectorAnimationSettings && blockInspectorAnimationSettings.enterDirection === "leftToRight" ? -50 : 50; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { animate: { x: 0, opacity: 1, transition: { ease: "easeInOut", duration: 0.14 } }, initial: { x: animationOrigin, opacity: 0 }, children }, selectedBlockClientId ); }; const BlockInspectorSingleBlock = ({ clientId, blockName, isSectionBlock, availableTabs, contentClientIds, hasBlockStyles }) => { const hasMultipleTabs = availableTabs?.length > 1; const blockInformation = useBlockDisplayInformation(clientId); const isBlockSynced = blockInformation.isSynced; const shouldShowTabs = !isBlockSynced && hasMultipleTabs; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-inspector", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( block_card_default, { ...blockInformation, className: isBlockSynced && "is-synced", allowParentNavigation: true, children: window?.__experimentalContentOnlyPatternInsertion && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditContentsButton, { clientId }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_variation_transforms_default, { blockClientId: clientId }), shouldShowTabs && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( InspectorControlsTabs, { hasBlockStyles, clientId, blockName, tabs: availableTabs, isSectionBlock, contentClientIds } ), !shouldShowTabs && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ hasBlockStyles && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesPanel, { clientId }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(content_tab_default, { contentClientIds }), !isSectionBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( StyleInspectorSlots, { blockName, showListControls: true } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SkipToSelectedBlock, {}, "back") ] }); }; var block_inspector_default = BlockInspector; ;// ./node_modules/@wordpress/block-editor/build-module/components/copy-handler/index.js const __unstableUseClipboardHandler = () => { external_wp_deprecated_default()("__unstableUseClipboardHandler", { alternative: "BlockCanvas or WritingFlow", since: "6.4", version: "6.7" }); return useClipboardHandler(); }; function CopyHandler(props) { external_wp_deprecated_default()("CopyHandler", { alternative: "BlockCanvas or WritingFlow", since: "6.4", version: "6.7" }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props, ref: useClipboardHandler() }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/library.js const library_noop = () => { }; function InserterLibrary({ rootClientId, clientId, isAppender, showInserterHelpPanel, showMostUsedBlocks = false, __experimentalInsertionIndex, __experimentalInitialTab, __experimentalInitialCategory, __experimentalFilterValue, onPatternCategorySelection, onSelect = library_noop, shouldFocusBlock = false, onClose }, ref) { const { destinationRootClientId } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockRootClientId } = select(store); const _rootClientId = rootClientId || getBlockRootClientId(clientId) || void 0; return { destinationRootClientId: _rootClientId }; }, [clientId, rootClientId] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivateInserterMenu, { onSelect, rootClientId: destinationRootClientId, clientId, isAppender, showInserterHelpPanel, showMostUsedBlocks, __experimentalInsertionIndex, __experimentalFilterValue, onPatternCategorySelection, __experimentalInitialTab, __experimentalInitialCategory, shouldFocusBlock, ref, onClose } ); } const PrivateInserterLibrary = (0,external_wp_element_namespaceObject.forwardRef)(InserterLibrary); function PublicInserterLibrary(props, ref) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivateInserterLibrary, { ...props, onPatternCategorySelection: void 0, ref } ); } var library_default = (0,external_wp_element_namespaceObject.forwardRef)(PublicInserterLibrary); ;// ./node_modules/@wordpress/block-editor/build-module/components/selection-scroll-into-view/index.js function MultiSelectScrollIntoView() { external_wp_deprecated_default()("wp.blockEditor.MultiSelectScrollIntoView", { hint: "This behaviour is now built-in.", since: "5.8" }); return null; } ;// ./node_modules/@wordpress/block-editor/build-module/components/typewriter/index.js const isIE = window.navigator.userAgent.indexOf("Trident") !== -1; const arrowKeyCodes = /* @__PURE__ */ new Set([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT]); const initialTriggerPercentage = 0.75; function useTypewriter() { const hasSelectedBlock = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(store).hasSelectedBlock(), [] ); return (0,external_wp_compose_namespaceObject.useRefEffect)( (node) => { if (!hasSelectedBlock) { return; } const { ownerDocument } = node; const { defaultView } = ownerDocument; let scrollResizeRafId; let onKeyDownRafId; let caretRect; function onScrollResize() { if (scrollResizeRafId) { return; } scrollResizeRafId = defaultView.requestAnimationFrame(() => { computeCaretRectangle(); scrollResizeRafId = null; }); } function onKeyDown(event) { if (onKeyDownRafId) { defaultView.cancelAnimationFrame(onKeyDownRafId); } onKeyDownRafId = defaultView.requestAnimationFrame(() => { maintainCaretPosition(event); onKeyDownRafId = null; }); } function maintainCaretPosition({ keyCode }) { if (!isSelectionEligibleForScroll()) { return; } const currentCaretRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView); if (!currentCaretRect) { return; } if (!caretRect) { caretRect = currentCaretRect; return; } if (arrowKeyCodes.has(keyCode)) { caretRect = currentCaretRect; return; } const diff = currentCaretRect.top - caretRect.top; if (diff === 0) { return; } const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(node); if (!scrollContainer) { return; } const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement; const scrollY = windowScroll ? defaultView.scrollY : scrollContainer.scrollTop; const scrollContainerY = windowScroll ? 0 : scrollContainer.getBoundingClientRect().top; const relativeScrollPosition = windowScroll ? caretRect.top / defaultView.innerHeight : (caretRect.top - scrollContainerY) / (defaultView.innerHeight - scrollContainerY); if (scrollY === 0 && relativeScrollPosition < initialTriggerPercentage && isLastEditableNode()) { caretRect = currentCaretRect; return; } const scrollContainerHeight = windowScroll ? defaultView.innerHeight : scrollContainer.clientHeight; if ( // The caret is under the lower fold. caretRect.top + caretRect.height > scrollContainerY + scrollContainerHeight || // The caret is above the upper fold. caretRect.top < scrollContainerY ) { caretRect = currentCaretRect; return; } if (windowScroll) { defaultView.scrollBy(0, diff); } else { scrollContainer.scrollTop += diff; } } function addSelectionChangeListener() { ownerDocument.addEventListener( "selectionchange", computeCaretRectOnSelectionChange ); } function computeCaretRectOnSelectionChange() { ownerDocument.removeEventListener( "selectionchange", computeCaretRectOnSelectionChange ); computeCaretRectangle(); } function computeCaretRectangle() { if (isSelectionEligibleForScroll()) { caretRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView); } } function isSelectionEligibleForScroll() { return node.contains(ownerDocument.activeElement) && ownerDocument.activeElement.isContentEditable; } function isLastEditableNode() { const editableNodes = node.querySelectorAll( '[contenteditable="true"]' ); const lastEditableNode = editableNodes[editableNodes.length - 1]; return lastEditableNode === ownerDocument.activeElement; } defaultView.addEventListener("scroll", onScrollResize, true); defaultView.addEventListener("resize", onScrollResize, true); node.addEventListener("keydown", onKeyDown); node.addEventListener("keyup", maintainCaretPosition); node.addEventListener("mousedown", addSelectionChangeListener); node.addEventListener("touchstart", addSelectionChangeListener); return () => { defaultView.removeEventListener( "scroll", onScrollResize, true ); defaultView.removeEventListener( "resize", onScrollResize, true ); node.removeEventListener("keydown", onKeyDown); node.removeEventListener("keyup", maintainCaretPosition); node.removeEventListener( "mousedown", addSelectionChangeListener ); node.removeEventListener( "touchstart", addSelectionChangeListener ); ownerDocument.removeEventListener( "selectionchange", computeCaretRectOnSelectionChange ); defaultView.cancelAnimationFrame(scrollResizeRafId); defaultView.cancelAnimationFrame(onKeyDownRafId); }; }, [hasSelectedBlock] ); } function Typewriter({ children }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: useTypewriter(), className: "block-editor__typewriter", children }); } const TypewriterOrIEBypass = isIE ? (props) => props.children : Typewriter; var typewriter_default = TypewriterOrIEBypass; ;// ./node_modules/@wordpress/block-editor/build-module/components/recursion-provider/index.js const RenderedRefsContext = (0,external_wp_element_namespaceObject.createContext)({}); RenderedRefsContext.displayName = "RenderedRefsContext"; function addToBlockType(renderedBlocks, blockName, uniqueId) { const result = { ...renderedBlocks, [blockName]: renderedBlocks[blockName] ? new Set(renderedBlocks[blockName]) : /* @__PURE__ */ new Set() }; result[blockName].add(uniqueId); return result; } function RecursionProvider({ children, uniqueId, blockName = "" }) { const previouslyRenderedBlocks = (0,external_wp_element_namespaceObject.useContext)(RenderedRefsContext); const { name } = useBlockEditContext(); blockName = blockName || name; const newRenderedBlocks = (0,external_wp_element_namespaceObject.useMemo)( () => addToBlockType(previouslyRenderedBlocks, blockName, uniqueId), [previouslyRenderedBlocks, blockName, uniqueId] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderedRefsContext.Provider, { value: newRenderedBlocks, children }); } function useHasRecursion(uniqueId, blockName = "") { const previouslyRenderedBlocks = (0,external_wp_element_namespaceObject.useContext)(RenderedRefsContext); const { name } = useBlockEditContext(); blockName = blockName || name; return Boolean(previouslyRenderedBlocks[blockName]?.has(uniqueId)); } const DeprecatedExperimentalRecursionProvider = (props) => { external_wp_deprecated_default()("wp.blockEditor.__experimentalRecursionProvider", { since: "6.5", alternative: "wp.blockEditor.RecursionProvider" }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RecursionProvider, { ...props }); }; const DeprecatedExperimentalUseHasRecursion = (...args) => { external_wp_deprecated_default()("wp.blockEditor.__experimentalUseHasRecursion", { since: "6.5", alternative: "wp.blockEditor.useHasRecursion" }); return useHasRecursion(...args); }; ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-popover-header/index.js function InspectorPopoverHeader({ title, help, actions = [], onClose }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-inspector-popover-header", spacing: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHeading, { className: "block-editor-inspector-popover-header__heading", level: 2, size: 13, children: title } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), actions.map(({ label, icon, onClick }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", className: "block-editor-inspector-popover-header__action", label, icon, variant: !icon && "tertiary", onClick, children: !icon && label }, label )), onClose && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", className: "block-editor-inspector-popover-header__action", label: (0,external_wp_i18n_namespaceObject.__)("Close"), icon: close_small_default, onClick: onClose } ) ] }), help && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: help }) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/publish-date-time-picker/index.js function PublishDateTimePicker({ onClose, onChange, showPopoverHeaderActions, isCompact, currentDate, title, ...additionalProps }, ref) { const datePickerProps = { startOfWeek: (0,external_wp_date_namespaceObject.getSettings)().l10n.startOfWeek, onChange, currentDate: isCompact ? void 0 : currentDate, currentTime: isCompact ? currentDate : void 0, ...additionalProps }; const DatePickerComponent = isCompact ? external_wp_components_namespaceObject.TimePicker : external_wp_components_namespaceObject.DateTimePicker; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref, className: "block-editor-publish-date-time-picker", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( InspectorPopoverHeader, { title: title || (0,external_wp_i18n_namespaceObject.__)("Publish"), actions: showPopoverHeaderActions ? [ { label: (0,external_wp_i18n_namespaceObject.__)("Now"), onClick: () => onChange?.(null) } ] : void 0, onClose } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DatePickerComponent, { ...datePickerProps }) ] }); } const PrivatePublishDateTimePicker = (0,external_wp_element_namespaceObject.forwardRef)(PublishDateTimePicker); function PublicPublishDateTimePicker(props, ref) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivatePublishDateTimePicker, { ...props, showPopoverHeaderActions: true, isCompact: false, ref } ); } var publish_date_time_picker_default = (0,external_wp_element_namespaceObject.forwardRef)(PublicPublishDateTimePicker); ;// ./node_modules/@wordpress/block-editor/build-module/components/tool-selector/index.js function ToolSelector() { external_wp_deprecated_default()("wp.blockEditor.ToolSelector", { since: "6.9", hint: "The ToolSelector component no longer renders anything." }); return null; } var tool_selector_default = (0,external_wp_element_namespaceObject.forwardRef)(ToolSelector); ;// ./node_modules/@wordpress/block-editor/build-module/components/index.js ;// ./node_modules/@wordpress/block-editor/build-module/elements/index.js const elements_ELEMENT_CLASS_NAMES = { button: "wp-element-button", caption: "wp-element-caption" }; const __experimentalGetElementClassName = (element) => { return elements_ELEMENT_CLASS_NAMES[element] ? elements_ELEMENT_CLASS_NAMES[element] : ""; }; ;// ./node_modules/@wordpress/block-editor/build-module/utils/get-px-from-css-unit.js var get_px_from_css_unit_default = () => ""; ;// ./node_modules/@wordpress/block-editor/build-module/utils/index.js ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/image-settings-panel.js function useHasImageSettingsPanel(name, value, inheritedValue) { return name === "core/image" && inheritedValue?.lightbox?.allowEditing || !!value?.lightbox; } function ImageSettingsPanel({ onChange, value, inheritedValue, panelId }) { const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetLightbox = () => { onChange(void 0); }; const onChangeLightbox = (newSetting) => { onChange({ enabled: newSetting }); }; let lightboxChecked = false; if (inheritedValue?.lightbox?.enabled) { lightboxChecked = inheritedValue.lightbox.enabled; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject._x)("Settings", "Image settings"), resetAll: resetLightbox, panelId, dropdownMenuProps, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => !!value?.lightbox, label: (0,external_wp_i18n_namespaceObject.__)("Enlarge on click"), onDeselect: resetLightbox, isShownByDefault: true, panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Enlarge on click"), checked: lightboxChecked, onChange: onChangeLightbox } ) } ) } ) }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/advanced-panel.js function AdvancedPanel({ value, onChange, inheritedValue = value }) { const [cssError, setCSSError] = (0,external_wp_element_namespaceObject.useState)(null); const customCSS = inheritedValue?.css; function handleOnChange(newValue) { onChange({ ...value, css: newValue }); if (cssError) { const [transformed] = transform_styles_default( [{ css: newValue }], ".for-validation-only" ); if (transformed) { setCSSError(null); } } } function handleOnBlur(event) { if (!event?.target?.value) { setCSSError(null); return; } const [transformed] = transform_styles_default( [{ css: event.target.value }], ".for-validation-only" ); setCSSError( transformed === null ? (0,external_wp_i18n_namespaceObject.__)("There is an error with your CSS structure.") : null ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ cssError && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "error", onRemove: () => setCSSError(null), children: cssError }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextareaControl, { label: (0,external_wp_i18n_namespaceObject.__)("Additional CSS"), __nextHasNoMarginBottom: true, value: customCSS, onChange: (newValue) => handleOnChange(newValue), onBlur: handleOnBlur, className: "block-editor-global-styles-advanced-panel__custom-css-input", spellCheck: false } ) ] }); } ;// ./node_modules/memize/dist/index.js /** * Memize options object. * * @typedef MemizeOptions * * @property {number} [maxSize] Maximum size of the cache. */ /** * Internal cache entry. * * @typedef MemizeCacheNode * * @property {?MemizeCacheNode|undefined} [prev] Previous node. * @property {?MemizeCacheNode|undefined} [next] Next node. * @property {Array<*>} args Function arguments for cache * entry. * @property {*} val Function result. */ /** * Properties of the enhanced function for controlling cache. * * @typedef MemizeMemoizedFunction * * @property {()=>void} clear Clear the cache. */ /** * Accepts a function to be memoized, and returns a new memoized function, with * optional options. * * @template {(...args: any[]) => any} F * * @param {F} fn Function to memoize. * @param {MemizeOptions} [options] Options object. * * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function. */ function memize(fn, options) { var size = 0; /** @type {?MemizeCacheNode|undefined} */ var head; /** @type {?MemizeCacheNode|undefined} */ var tail; options = options || {}; function memoized(/* ...args */) { var node = head, len = arguments.length, args, i; searchCache: while (node) { // Perform a shallow equality test to confirm that whether the node // under test is a candidate for the arguments passed. Two arrays // are shallowly equal if their length matches and each entry is // strictly equal between the two sets. Avoid abstracting to a // function which could incur an arguments leaking deoptimization. // Check whether node arguments match arguments length if (node.args.length !== arguments.length) { node = node.next; continue; } // Check whether node arguments match arguments values for (i = 0; i < len; i++) { if (node.args[i] !== arguments[i]) { node = node.next; continue searchCache; } } // At this point we can assume we've found a match // Surface matched node to head if not already if (node !== head) { // As tail, shift to previous. Must only shift if not also // head, since if both head and tail, there is no previous. if (node === tail) { tail = node.prev; } // Adjust siblings to point to each other. If node was tail, // this also handles new tail's empty `next` assignment. /** @type {MemizeCacheNode} */ (node.prev).next = node.next; if (node.next) { node.next.prev = node.prev; } node.next = head; node.prev = null; /** @type {MemizeCacheNode} */ (head).prev = node; head = node; } // Return immediately return node.val; } // No cached value found. Continue to insertion phase: // Create a copy of arguments (avoid leaking deoptimization) args = new Array(len); for (i = 0; i < len; i++) { args[i] = arguments[i]; } node = { args: args, // Generate the result from original function val: fn.apply(null, args), }; // Don't need to check whether node is already head, since it would // have been returned above already if it was // Shift existing head down list if (head) { head.prev = node; node.next = head; } else { // If no head, follows that there's no tail (at initial or reset) tail = node; } // Trim tail if we're reached max size and are pending cache insertion if (size === /** @type {MemizeOptions} */ (options).maxSize) { tail = /** @type {MemizeCacheNode} */ (tail).prev; /** @type {MemizeCacheNode} */ (tail).next = null; } else { size++; } head = node; return node.val; } memoized.clear = function () { head = null; tail = null; size = 0; }; // Ignore reason: There's not a clear solution to create an intersection of // the function with additional properties, where the goal is to retain the // function signature of the incoming argument and add control properties // on the return value. // @ts-ignore return memoized; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/get-global-styles-changes.js const globalStylesChangesCache = /* @__PURE__ */ new Map(); const get_global_styles_changes_EMPTY_ARRAY = []; const translationMap = { caption: (0,external_wp_i18n_namespaceObject.__)("Caption"), link: (0,external_wp_i18n_namespaceObject.__)("Link"), button: (0,external_wp_i18n_namespaceObject.__)("Button"), heading: (0,external_wp_i18n_namespaceObject.__)("Heading"), h1: (0,external_wp_i18n_namespaceObject.__)("H1"), h2: (0,external_wp_i18n_namespaceObject.__)("H2"), h3: (0,external_wp_i18n_namespaceObject.__)("H3"), h4: (0,external_wp_i18n_namespaceObject.__)("H4"), h5: (0,external_wp_i18n_namespaceObject.__)("H5"), h6: (0,external_wp_i18n_namespaceObject.__)("H6"), "settings.color": (0,external_wp_i18n_namespaceObject.__)("Color"), "settings.typography": (0,external_wp_i18n_namespaceObject.__)("Typography"), "settings.shadow": (0,external_wp_i18n_namespaceObject.__)("Shadow"), "settings.layout": (0,external_wp_i18n_namespaceObject.__)("Layout"), "styles.color": (0,external_wp_i18n_namespaceObject.__)("Colors"), "styles.spacing": (0,external_wp_i18n_namespaceObject.__)("Spacing"), "styles.background": (0,external_wp_i18n_namespaceObject.__)("Background"), "styles.typography": (0,external_wp_i18n_namespaceObject.__)("Typography") }; const getBlockNames = memize( () => (0,external_wp_blocks_namespaceObject.getBlockTypes)().reduce((accumulator, { name, title }) => { accumulator[name] = title; return accumulator; }, {}) ); const isObject = (obj) => obj !== null && typeof obj === "object"; function getTranslation(key) { if (translationMap[key]) { return translationMap[key]; } const keyArray = key.split("."); if (keyArray?.[0] === "blocks") { const blockName = getBlockNames()?.[keyArray[1]]; return blockName || keyArray[1]; } if (keyArray?.[0] === "elements") { return translationMap[keyArray[1]] || keyArray[1]; } return void 0; } function deepCompare(changedObject, originalObject, parentPath = "") { if (!isObject(changedObject) && !isObject(originalObject)) { return changedObject !== originalObject ? parentPath.split(".").slice(0, 2).join(".") : void 0; } changedObject = isObject(changedObject) ? changedObject : {}; originalObject = isObject(originalObject) ? originalObject : {}; const allKeys = /* @__PURE__ */ new Set([ ...Object.keys(changedObject), ...Object.keys(originalObject) ]); let diffs = []; for (const key of allKeys) { const path = parentPath ? parentPath + "." + key : key; const changedPath = deepCompare( changedObject[key], originalObject[key], path ); if (changedPath) { diffs = diffs.concat(changedPath); } } return diffs; } function getGlobalStylesChangelist(next, previous) { const cacheKey = JSON.stringify({ next, previous }); if (globalStylesChangesCache.has(cacheKey)) { return globalStylesChangesCache.get(cacheKey); } const changedValueTree = deepCompare( { styles: { background: next?.styles?.background, color: next?.styles?.color, typography: next?.styles?.typography, spacing: next?.styles?.spacing }, blocks: next?.styles?.blocks, elements: next?.styles?.elements, settings: next?.settings }, { styles: { background: previous?.styles?.background, color: previous?.styles?.color, typography: previous?.styles?.typography, spacing: previous?.styles?.spacing }, blocks: previous?.styles?.blocks, elements: previous?.styles?.elements, settings: previous?.settings } ); if (!changedValueTree.length) { globalStylesChangesCache.set(cacheKey, get_global_styles_changes_EMPTY_ARRAY); return get_global_styles_changes_EMPTY_ARRAY; } const result = [...new Set(changedValueTree)].reduce((acc, curr) => { const translation = getTranslation(curr); if (translation) { acc.push([curr.split(".")[0], translation]); } return acc; }, []); globalStylesChangesCache.set(cacheKey, result); return result; } function getGlobalStylesChanges(next, previous, options = {}) { let changeList = getGlobalStylesChangelist(next, previous); const changesLength = changeList.length; const { maxResults } = options; if (changesLength) { if (!!maxResults && changesLength > maxResults) { changeList = changeList.slice(0, maxResults); } return Object.entries( changeList.reduce((acc, curr) => { const group = acc[curr[0]] || []; if (!group.includes(curr[1])) { acc[curr[0]] = [...group, curr[1]]; } return acc; }, {}) ).map(([key, changeValues]) => { const changeValuesLength = changeValues.length; const joinedChangesValue = changeValues.join( /* translators: Used between list items, there is a space after the comma. */ (0,external_wp_i18n_namespaceObject.__)(", ") // eslint-disable-line @wordpress/i18n-no-flanking-whitespace ); switch (key) { case "blocks": { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: a list of block names separated by a comma. (0,external_wp_i18n_namespaceObject._n)("%s block.", "%s blocks.", changeValuesLength), joinedChangesValue ); } case "elements": { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: a list of element names separated by a comma. (0,external_wp_i18n_namespaceObject._n)("%s element.", "%s elements.", changeValuesLength), joinedChangesValue ); } case "settings": { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: a list of theme.json setting labels separated by a comma. (0,external_wp_i18n_namespaceObject.__)("%s settings."), joinedChangesValue ); } case "styles": { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: a list of theme.json top-level styles labels separated by a comma. (0,external_wp_i18n_namespaceObject.__)("%s styles."), joinedChangesValue ); } default: { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: a list of global styles changes separated by a comma. (0,external_wp_i18n_namespaceObject.__)("%s."), joinedChangesValue ); } } }); } return get_global_styles_changes_EMPTY_ARRAY; } ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/index.js ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/get-rich-text-values.js function addValuesForElement(element, values, innerBlocks) { if (null === element || void 0 === element || false === element) { return; } if (Array.isArray(element)) { return addValuesForElements(element, values, innerBlocks); } switch (typeof element) { case "string": case "number": return; } const { type, props } = element; switch (type) { case external_wp_element_namespaceObject.StrictMode: case external_wp_element_namespaceObject.Fragment: return addValuesForElements(props.children, values, innerBlocks); case external_wp_element_namespaceObject.RawHTML: return; case inner_blocks_default.Content: return addValuesForBlocks(values, innerBlocks); case Content: values.push(props.value); return; } switch (typeof type) { case "string": if (typeof props.children !== "undefined") { return addValuesForElements( props.children, values, innerBlocks ); } return; case "function": const el = type.prototype && typeof type.prototype.render === "function" ? new type(props).render() : type(props); return addValuesForElement(el, values, innerBlocks); } } function addValuesForElements(children, ...args) { children = Array.isArray(children) ? children : [children]; for (let i = 0; i < children.length; i++) { addValuesForElement(children[i], ...args); } } function addValuesForBlocks(values, blocks) { for (let i = 0; i < blocks.length; i++) { const { name, attributes, innerBlocks } = blocks[i]; const saveElement = (0,external_wp_blocks_namespaceObject.getSaveElement)( name, attributes, // Instead of letting save elements use `useInnerBlocksProps.save`, // force them to use InnerBlocks.Content instead so we can intercept // a single component. /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inner_blocks_default.Content, {}) ); addValuesForElement(saveElement, values, innerBlocks); } } function getRichTextValues(blocks = []) { external_wp_blocks_namespaceObject.__unstableGetBlockProps.skipFilters = true; const values = []; addValuesForBlocks(values, blocks); external_wp_blocks_namespaceObject.__unstableGetBlockProps.skipFilters = false; return values.map( (value) => value instanceof external_wp_richText_namespaceObject.RichTextData ? value : external_wp_richText_namespaceObject.RichTextData.fromHTMLString(value) ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/resizable-box-popover/index.js function ResizableBoxPopover({ clientId, resizableBoxProps, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( cover_default, { clientId, __unstablePopoverSlot: "block-toolbar", ...props, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { ...resizableBoxProps }) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/block-removal-warning-modal/index.js function BlockRemovalWarningModal({ rules }) { const { clientIds, selectPrevious, message } = (0,external_wp_data_namespaceObject.useSelect)( (select) => unlock(select(store)).getRemovalPromptData() ); const { clearBlockRemovalPrompt, setBlockRemovalRules, privateRemoveBlocks } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); (0,external_wp_element_namespaceObject.useEffect)(() => { setBlockRemovalRules(rules); return () => { setBlockRemovalRules(); }; }, [rules, setBlockRemovalRules]); if (!message) { return; } const onConfirmRemoval = () => { privateRemoveBlocks( clientIds, selectPrevious, /* force */ true ); clearBlockRemovalPrompt(); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Be careful!"), onRequestClose: clearBlockRemovalPrompt, size: "medium", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: message }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: clearBlockRemovalPrompt, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: "primary", onClick: onConfirmRemoval, __next40pxDefaultSize: true, children: (0,external_wp_i18n_namespaceObject.__)("Delete") } ) ] }) ] } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/scale-tool.js const DEFAULT_SCALE_OPTIONS = [ { value: "fill", label: (0,external_wp_i18n_namespaceObject._x)("Fill", "Scale option for dimensions control"), help: (0,external_wp_i18n_namespaceObject.__)("Fill the space by stretching the content.") }, { value: "contain", label: (0,external_wp_i18n_namespaceObject._x)("Contain", "Scale option for dimensions control"), help: (0,external_wp_i18n_namespaceObject.__)("Fit the content to the space without clipping.") }, { value: "cover", label: (0,external_wp_i18n_namespaceObject._x)("Cover", "Scale option for dimensions control"), help: (0,external_wp_i18n_namespaceObject.__)("Fill the space by clipping what doesn't fit.") }, { value: "none", label: (0,external_wp_i18n_namespaceObject._x)("None", "Scale option for dimensions control"), help: (0,external_wp_i18n_namespaceObject.__)( "Do not adjust the sizing of the content. Content that is too large will be clipped, and content that is too small will have additional padding." ) }, { value: "scale-down", label: (0,external_wp_i18n_namespaceObject._x)("Scale down", "Scale option for dimensions control"), help: (0,external_wp_i18n_namespaceObject.__)( "Scale down the content to fit the space if it is too big. Content that is too small will have additional padding." ) } ]; function ScaleTool({ panelId, value, onChange, options = DEFAULT_SCALE_OPTIONS, defaultValue = DEFAULT_SCALE_OPTIONS[0].value, isShownByDefault = true }) { const displayValue = value ?? "fill"; const scaleHelp = (0,external_wp_element_namespaceObject.useMemo)(() => { return options.reduce((acc, option) => { acc[option.value] = option.help; return acc; }, {}); }, [options]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)("Scale"), isShownByDefault, hasValue: () => displayValue !== defaultValue, onDeselect: () => onChange(defaultValue), panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Scale"), isBlock: true, help: scaleHelp[displayValue], value: displayValue, onChange, size: "__unstable-large", children: options.map((option) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { ...option }, option.value )) } ) } ); } ;// ./node_modules/@babel/runtime/helpers/esm/extends.js function extends_extends() { return extends_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, extends_extends.apply(null, arguments); } ;// ./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js function memoize(fn) { var cache = Object.create(null); return function (arg) { if (cache[arg] === undefined) cache[arg] = fn(arg); return cache[arg]; }; } ;// ./node_modules/@emotion/styled/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23 var isPropValid = /* #__PURE__ */memoize(function (prop) { return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 /* o */ && prop.charCodeAt(1) === 110 /* n */ && prop.charCodeAt(2) < 91; } /* Z+1 */ ); ;// ./node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js /* Based off glamor's StyleSheet, thanks Sunil ❤️ high performance StyleSheet for css-in-js systems - uses multiple style tags behind the scenes for millions of rules - uses `insertRule` for appending in production for *much* faster performance // usage import { StyleSheet } from '@emotion/sheet' let styleSheet = new StyleSheet({ key: '', container: document.head }) styleSheet.insert('#box { border: 1px solid red; }') - appends a css rule into the stylesheet styleSheet.flush() - empties the stylesheet of all its contents */ // $FlowFixMe function sheetForTag(tag) { if (tag.sheet) { // $FlowFixMe return tag.sheet; } // this weirdness brought to you by firefox /* istanbul ignore next */ for (var i = 0; i < document.styleSheets.length; i++) { if (document.styleSheets[i].ownerNode === tag) { // $FlowFixMe return document.styleSheets[i]; } } } function createStyleElement(options) { var tag = document.createElement('style'); tag.setAttribute('data-emotion', options.key); if (options.nonce !== undefined) { tag.setAttribute('nonce', options.nonce); } tag.appendChild(document.createTextNode('')); tag.setAttribute('data-s', ''); return tag; } var StyleSheet = /*#__PURE__*/function () { // Using Node instead of HTMLElement since container may be a ShadowRoot function StyleSheet(options) { var _this = this; this._insertTag = function (tag) { var before; if (_this.tags.length === 0) { if (_this.insertionPoint) { before = _this.insertionPoint.nextSibling; } else if (_this.prepend) { before = _this.container.firstChild; } else { before = _this.before; } } else { before = _this.tags[_this.tags.length - 1].nextSibling; } _this.container.insertBefore(tag, before); _this.tags.push(tag); }; this.isSpeedy = options.speedy === undefined ? "production" === 'production' : options.speedy; this.tags = []; this.ctr = 0; this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets this.key = options.key; this.container = options.container; this.prepend = options.prepend; this.insertionPoint = options.insertionPoint; this.before = null; } var _proto = StyleSheet.prototype; _proto.hydrate = function hydrate(nodes) { nodes.forEach(this._insertTag); }; _proto.insert = function insert(rule) { // the max length is how many rules we have per style tag, it's 65000 in speedy mode // it's 1 in dev because we insert source maps that map a single rule to a location // and you can only have one source map per style tag if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) { this._insertTag(createStyleElement(this)); } var tag = this.tags[this.tags.length - 1]; if (false) { var isImportRule; } if (this.isSpeedy) { var sheet = sheetForTag(tag); try { // this is the ultrafast version, works across browsers // the big drawback is that the css won't be editable in devtools sheet.insertRule(rule, sheet.cssRules.length); } catch (e) { if (false) {} } } else { tag.appendChild(document.createTextNode(rule)); } this.ctr++; }; _proto.flush = function flush() { // $FlowFixMe this.tags.forEach(function (tag) { return tag.parentNode && tag.parentNode.removeChild(tag); }); this.tags = []; this.ctr = 0; if (false) {} }; return StyleSheet; }(); ;// ./node_modules/stylis/src/Utility.js /** * @param {number} * @return {number} */ var abs = Math.abs /** * @param {number} * @return {string} */ var Utility_from = String.fromCharCode /** * @param {object} * @return {object} */ var Utility_assign = Object.assign /** * @param {string} value * @param {number} length * @return {number} */ function hash (value, length) { return Utility_charat(value, 0) ^ 45 ? (((((((length << 2) ^ Utility_charat(value, 0)) << 2) ^ Utility_charat(value, 1)) << 2) ^ Utility_charat(value, 2)) << 2) ^ Utility_charat(value, 3) : 0 } /** * @param {string} value * @return {string} */ function trim (value) { return value.trim() } /** * @param {string} value * @param {RegExp} pattern * @return {string?} */ function Utility_match (value, pattern) { return (value = pattern.exec(value)) ? value[0] : value } /** * @param {string} value * @param {(string|RegExp)} pattern * @param {string} replacement * @return {string} */ function Utility_replace (value, pattern, replacement) { return value.replace(pattern, replacement) } /** * @param {string} value * @param {string} search * @return {number} */ function indexof (value, search) { return value.indexOf(search) } /** * @param {string} value * @param {number} index * @return {number} */ function Utility_charat (value, index) { return value.charCodeAt(index) | 0 } /** * @param {string} value * @param {number} begin * @param {number} end * @return {string} */ function Utility_substr (value, begin, end) { return value.slice(begin, end) } /** * @param {string} value * @return {number} */ function Utility_strlen (value) { return value.length } /** * @param {any[]} value * @return {number} */ function Utility_sizeof (value) { return value.length } /** * @param {any} value * @param {any[]} array * @return {any} */ function Utility_append (value, array) { return array.push(value), value } /** * @param {string[]} array * @param {function} callback * @return {string} */ function Utility_combine (array, callback) { return array.map(callback).join('') } ;// ./node_modules/stylis/src/Tokenizer.js var line = 1 var column = 1 var Tokenizer_length = 0 var position = 0 var Tokenizer_character = 0 var characters = '' /** * @param {string} value * @param {object | null} root * @param {object | null} parent * @param {string} type * @param {string[] | string} props * @param {object[] | string} children * @param {number} length */ function node (value, root, parent, type, props, children, length) { return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''} } /** * @param {object} root * @param {object} props * @return {object} */ function Tokenizer_copy (root, props) { return Utility_assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props) } /** * @return {number} */ function Tokenizer_char () { return Tokenizer_character } /** * @return {number} */ function prev () { Tokenizer_character = position > 0 ? Utility_charat(characters, --position) : 0 if (column--, Tokenizer_character === 10) column = 1, line-- return Tokenizer_character } /** * @return {number} */ function next () { Tokenizer_character = position < Tokenizer_length ? Utility_charat(characters, position++) : 0 if (column++, Tokenizer_character === 10) column = 1, line++ return Tokenizer_character } /** * @return {number} */ function peek () { return Utility_charat(characters, position) } /** * @return {number} */ function caret () { return position } /** * @param {number} begin * @param {number} end * @return {string} */ function slice (begin, end) { return Utility_substr(characters, begin, end) } /** * @param {number} type * @return {number} */ function token (type) { switch (type) { // \0 \t \n \r \s whitespace token case 0: case 9: case 10: case 13: case 32: return 5 // ! + , / > @ ~ isolate token case 33: case 43: case 44: case 47: case 62: case 64: case 126: // ; { } breakpoint token case 59: case 123: case 125: return 4 // : accompanied token case 58: return 3 // " ' ( [ opening delimit token case 34: case 39: case 40: case 91: return 2 // ) ] closing delimit token case 41: case 93: return 1 } return 0 } /** * @param {string} value * @return {any[]} */ function alloc (value) { return line = column = 1, Tokenizer_length = Utility_strlen(characters = value), position = 0, [] } /** * @param {any} value * @return {any} */ function dealloc (value) { return characters = '', value } /** * @param {number} type * @return {string} */ function delimit (type) { return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type))) } /** * @param {string} value * @return {string[]} */ function Tokenizer_tokenize (value) { return dealloc(tokenizer(alloc(value))) } /** * @param {number} type * @return {string} */ function whitespace (type) { while (Tokenizer_character = peek()) if (Tokenizer_character < 33) next() else break return token(type) > 2 || token(Tokenizer_character) > 3 ? '' : ' ' } /** * @param {string[]} children * @return {string[]} */ function tokenizer (children) { while (next()) switch (token(Tokenizer_character)) { case 0: append(identifier(position - 1), children) break case 2: append(delimit(Tokenizer_character), children) break default: append(from(Tokenizer_character), children) } return children } /** * @param {number} index * @param {number} count * @return {string} */ function escaping (index, count) { while (--count && next()) // not 0-9 A-F a-f if (Tokenizer_character < 48 || Tokenizer_character > 102 || (Tokenizer_character > 57 && Tokenizer_character < 65) || (Tokenizer_character > 70 && Tokenizer_character < 97)) break return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32)) } /** * @param {number} type * @return {number} */ function delimiter (type) { while (next()) switch (Tokenizer_character) { // ] ) " ' case type: return position // " ' case 34: case 39: if (type !== 34 && type !== 39) delimiter(Tokenizer_character) break // ( case 40: if (type === 41) delimiter(type) break // \ case 92: next() break } return position } /** * @param {number} type * @param {number} index * @return {number} */ function commenter (type, index) { while (next()) // // if (type + Tokenizer_character === 47 + 10) break // /* else if (type + Tokenizer_character === 42 + 42 && peek() === 47) break return '/*' + slice(index, position - 1) + '*' + Utility_from(type === 47 ? type : next()) } /** * @param {number} index * @return {string} */ function identifier (index) { while (!token(peek())) next() return slice(index, position) } ;// ./node_modules/stylis/src/Enum.js var Enum_MS = '-ms-' var Enum_MOZ = '-moz-' var Enum_WEBKIT = '-webkit-' var COMMENT = 'comm' var Enum_RULESET = 'rule' var Enum_DECLARATION = 'decl' var PAGE = '@page' var MEDIA = '@media' var IMPORT = '@import' var CHARSET = '@charset' var VIEWPORT = '@viewport' var SUPPORTS = '@supports' var DOCUMENT = '@document' var NAMESPACE = '@namespace' var Enum_KEYFRAMES = '@keyframes' var FONT_FACE = '@font-face' var COUNTER_STYLE = '@counter-style' var FONT_FEATURE_VALUES = '@font-feature-values' ;// ./node_modules/stylis/src/Serializer.js /** * @param {object[]} children * @param {function} callback * @return {string} */ function Serializer_serialize (children, callback) { var output = '' var length = Utility_sizeof(children) for (var i = 0; i < length; i++) output += callback(children[i], i, children, callback) || '' return output } /** * @param {object} element * @param {number} index * @param {object[]} children * @param {function} callback * @return {string} */ function Serializer_stringify (element, index, children, callback) { switch (element.type) { case IMPORT: case Enum_DECLARATION: return element.return = element.return || element.value case COMMENT: return '' case Enum_KEYFRAMES: return element.return = element.value + '{' + Serializer_serialize(element.children, callback) + '}' case Enum_RULESET: element.value = element.props.join(',') } return Utility_strlen(children = Serializer_serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : '' } ;// ./node_modules/stylis/src/Middleware.js /** * @param {function[]} collection * @return {function} */ function middleware (collection) { var length = Utility_sizeof(collection) return function (element, index, children, callback) { var output = '' for (var i = 0; i < length; i++) output += collection[i](element, index, children, callback) || '' return output } } /** * @param {function} callback * @return {function} */ function rulesheet (callback) { return function (element) { if (!element.root) if (element = element.return) callback(element) } } /** * @param {object} element * @param {number} index * @param {object[]} children * @param {function} callback */ function prefixer (element, index, children, callback) { if (element.length > -1) if (!element.return) switch (element.type) { case DECLARATION: element.return = prefix(element.value, element.length, children) return case KEYFRAMES: return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback) case RULESET: if (element.length) return combine(element.props, function (value) { switch (match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback) // :placeholder case '::placeholder': return serialize([ copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}), copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}), copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]}) ], callback) } return '' }) } } /** * @param {object} element * @param {number} index * @param {object[]} children */ function namespace (element) { switch (element.type) { case RULESET: element.props = element.props.map(function (value) { return combine(tokenize(value), function (value, index, children) { switch (charat(value, 0)) { // \f case 12: return substr(value, 1, strlen(value)) // \0 ( + > ~ case 0: case 40: case 43: case 62: case 126: return value // : case 58: if (children[++index] === 'global') children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1) // \s case 32: return index === 1 ? '' : value default: switch (index) { case 0: element = value return sizeof(children) > 1 ? '' : value case index = sizeof(children) - 1: case 2: return index === 2 ? value + element + element : value + element default: return value } } }) }) } } ;// ./node_modules/stylis/src/Parser.js /** * @param {string} value * @return {object[]} */ function compile (value) { return dealloc(Parser_parse('', null, null, null, [''], value = alloc(value), 0, [0], value)) } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {string[]} rule * @param {string[]} rules * @param {string[]} rulesets * @param {number[]} pseudo * @param {number[]} points * @param {string[]} declarations * @return {object} */ function Parser_parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) { var index = 0 var offset = 0 var length = pseudo var atrule = 0 var property = 0 var previous = 0 var variable = 1 var scanning = 1 var ampersand = 1 var character = 0 var type = '' var props = rules var children = rulesets var reference = rule var characters = type while (scanning) switch (previous = character, character = next()) { // ( case 40: if (previous != 108 && Utility_charat(characters, length - 1) == 58) { if (indexof(characters += Utility_replace(delimit(character), '&', '&\f'), '&\f') != -1) ampersand = -1 break } // " ' [ case 34: case 39: case 91: characters += delimit(character) break // \t \n \r \s case 9: case 10: case 13: case 32: characters += whitespace(previous) break // \ case 92: characters += escaping(caret() - 1, 7) continue // / case 47: switch (peek()) { case 42: case 47: Utility_append(comment(commenter(next(), caret()), root, parent), declarations) break default: characters += '/' } break // { case 123 * variable: points[index++] = Utility_strlen(characters) * ampersand // } ; \0 case 125 * variable: case 59: case 0: switch (character) { // \0 } case 0: case 125: scanning = 0 // ; case 59 + offset: if (property > 0 && (Utility_strlen(characters) - length)) Utility_append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(Utility_replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations) break // @ ; case 59: characters += ';' // { rule/at-rule default: Utility_append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets) if (character === 123) if (offset === 0) Parser_parse(characters, root, reference, reference, props, rulesets, length, points, children) else switch (atrule === 99 && Utility_charat(characters, 3) === 110 ? 100 : atrule) { // d m s case 100: case 109: case 115: Parser_parse(value, reference, reference, rule && Utility_append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children) break default: Parser_parse(characters, reference, reference, reference, [''], children, 0, points, children) } } index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo break // : case 58: length = 1 + Utility_strlen(characters), property = previous default: if (variable < 1) if (character == 123) --variable else if (character == 125 && variable++ == 0 && prev() == 125) continue switch (characters += Utility_from(character), character * variable) { // & case 38: ampersand = offset > 0 ? 1 : (characters += '\f', -1) break // , case 44: points[index++] = (Utility_strlen(characters) - 1) * ampersand, ampersand = 1 break // @ case 64: // - if (peek() === 45) characters += delimit(next()) atrule = peek(), offset = length = Utility_strlen(type = characters += identifier(caret())), character++ break // - case 45: if (previous === 45 && Utility_strlen(characters) == 2) variable = 0 } } return rulesets } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {number} index * @param {number} offset * @param {string[]} rules * @param {number[]} points * @param {string} type * @param {string[]} props * @param {string[]} children * @param {number} length * @return {object} */ function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) { var post = offset - 1 var rule = offset === 0 ? rules : [''] var size = Utility_sizeof(rule) for (var i = 0, j = 0, k = 0; i < index; ++i) for (var x = 0, y = Utility_substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x) if (z = trim(j > 0 ? rule[x] + ' ' + y : Utility_replace(y, /&\f/g, rule[x]))) props[k++] = z return node(value, root, parent, offset === 0 ? Enum_RULESET : type, props, children, length) } /** * @param {number} value * @param {object} root * @param {object?} parent * @return {object} */ function comment (value, root, parent) { return node(value, root, parent, COMMENT, Utility_from(Tokenizer_char()), Utility_substr(value, 2, -2), 0) } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {number} length * @return {object} */ function declaration (value, root, parent, length) { return node(value, root, parent, Enum_DECLARATION, Utility_substr(value, 0, length), Utility_substr(value, length + 1, -1), length) } ;// ./node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) { var previous = 0; var character = 0; while (true) { previous = character; character = peek(); // &\f if (previous === 38 && character === 12) { points[index] = 1; } if (token(character)) { break; } next(); } return slice(begin, position); }; var toRules = function toRules(parsed, points) { // pretend we've started with a comma var index = -1; var character = 44; do { switch (token(character)) { case 0: // &\f if (character === 38 && peek() === 12) { // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings // stylis inserts \f after & to know when & where it should replace this sequence with the context selector // and when it should just concatenate the outer and inner selectors // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here points[index] = 1; } parsed[index] += identifierWithPointTracking(position - 1, points, index); break; case 2: parsed[index] += delimit(character); break; case 4: // comma if (character === 44) { // colon parsed[++index] = peek() === 58 ? '&\f' : ''; points[index] = parsed[index].length; break; } // fallthrough default: parsed[index] += Utility_from(character); } } while (character = next()); return parsed; }; var getRules = function getRules(value, points) { return dealloc(toRules(alloc(value), points)); }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11 var fixedElements = /* #__PURE__ */new WeakMap(); var compat = function compat(element) { if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo // negative .length indicates that this rule has been already prefixed element.length < 1) { return; } var value = element.value, parent = element.parent; var isImplicitRule = element.column === parent.column && element.line === parent.line; while (parent.type !== 'rule') { parent = parent.parent; if (!parent) return; } // short-circuit for the simplest case if (element.props.length === 1 && value.charCodeAt(0) !== 58 /* colon */ && !fixedElements.get(parent)) { return; } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level) // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent" if (isImplicitRule) { return; } fixedElements.set(element, true); var points = []; var rules = getRules(value, points); var parentRules = parent.props; for (var i = 0, k = 0; i < rules.length; i++) { for (var j = 0; j < parentRules.length; j++, k++) { element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i]; } } }; var removeLabel = function removeLabel(element) { if (element.type === 'decl') { var value = element.value; if ( // charcode for l value.charCodeAt(0) === 108 && // charcode for b value.charCodeAt(2) === 98) { // this ignores label element["return"] = ''; element.value = ''; } } }; var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason'; var isIgnoringComment = function isIgnoringComment(element) { return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1; }; var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) { return function (element, index, children) { if (element.type !== 'rule' || cache.compat) return; var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g); if (unsafePseudoClasses) { var isNested = element.parent === children[0]; // in nested rules comments become children of the "auto-inserted" rule // // considering this input: // .a { // .b /* comm */ {} // color: hotpink; // } // we get output corresponding to this: // .a { // & { // /* comm */ // color: hotpink; // } // .b {} // } var commentContainer = isNested ? children[0].children : // global rule at the root level children; for (var i = commentContainer.length - 1; i >= 0; i--) { var node = commentContainer[i]; if (node.line < element.line) { break; } // it is quite weird but comments are *usually* put at `column: element.column - 1` // so we seek *from the end* for the node that is earlier than the rule's `element` and check that // this will also match inputs like this: // .a { // /* comm */ // .b {} // } // // but that is fine // // it would be the easiest to change the placement of the comment to be the first child of the rule: // .a { // .b { /* comm */ } // } // with such inputs we wouldn't have to search for the comment at all // TODO: consider changing this comment placement in the next major version if (node.column < element.column) { if (isIgnoringComment(node)) { return; } break; } } unsafePseudoClasses.forEach(function (unsafePseudoClass) { console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\"."); }); } }; }; var isImportRule = function isImportRule(element) { return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64; }; var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) { for (var i = index - 1; i >= 0; i--) { if (!isImportRule(children[i])) { return true; } } return false; }; // use this to remove incorrect elements from further processing // so they don't get handed to the `sheet` (or anything else) // as that could potentially lead to additional logs which in turn could be overhelming to the user var nullifyElement = function nullifyElement(element) { element.type = ''; element.value = ''; element["return"] = ''; element.children = ''; element.props = ''; }; var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) { if (!isImportRule(element)) { return; } if (element.parent) { console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."); nullifyElement(element); } else if (isPrependedWithRegularRules(index, children)) { console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."); nullifyElement(element); } }; /* eslint-disable no-fallthrough */ function emotion_cache_browser_esm_prefix(value, length) { switch (hash(value, length)) { // color-adjust case 5103: return Enum_WEBKIT + 'print-' + value + value; // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break case 5572: case 6356: case 5844: case 3191: case 6645: case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, case 6391: case 5879: case 5623: case 6135: case 4599: case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) case 4215: case 6389: case 5109: case 5365: case 5621: case 3829: return Enum_WEBKIT + value + value; // appearance, user-select, transform, hyphens, text-size-adjust case 5349: case 4246: case 4810: case 6968: case 2756: return Enum_WEBKIT + value + Enum_MOZ + value + Enum_MS + value + value; // flex, flex-direction case 6828: case 4268: return Enum_WEBKIT + value + Enum_MS + value + value; // order case 6165: return Enum_WEBKIT + value + Enum_MS + 'flex-' + value + value; // align-items case 5187: return Enum_WEBKIT + value + Utility_replace(value, /(\w+).+(:[^]+)/, Enum_WEBKIT + 'box-$1$2' + Enum_MS + 'flex-$1$2') + value; // align-self case 5443: return Enum_WEBKIT + value + Enum_MS + 'flex-item-' + Utility_replace(value, /flex-|-self/, '') + value; // align-content case 4675: return Enum_WEBKIT + value + Enum_MS + 'flex-line-pack' + Utility_replace(value, /align-content|flex-|-self/, '') + value; // flex-shrink case 5548: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'shrink', 'negative') + value; // flex-basis case 5292: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'basis', 'preferred-size') + value; // flex-grow case 6060: return Enum_WEBKIT + 'box-' + Utility_replace(value, '-grow', '') + Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'grow', 'positive') + value; // transition case 4554: return Enum_WEBKIT + Utility_replace(value, /([^-])(transform)/g, '$1' + Enum_WEBKIT + '$2') + value; // cursor case 6187: return Utility_replace(Utility_replace(Utility_replace(value, /(zoom-|grab)/, Enum_WEBKIT + '$1'), /(image-set)/, Enum_WEBKIT + '$1'), value, '') + value; // background, background-image case 5495: case 3959: return Utility_replace(value, /(image-set\([^]*)/, Enum_WEBKIT + '$1' + '$`$1'); // justify-content case 4968: return Utility_replace(Utility_replace(value, /(.+:)(flex-)?(.*)/, Enum_WEBKIT + 'box-pack:$3' + Enum_MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + Enum_WEBKIT + value + value; // (margin|padding)-inline-(start|end) case 4095: case 3583: case 4068: case 2532: return Utility_replace(value, /(.+)-inline(.+)/, Enum_WEBKIT + '$1$2') + value; // (min|max)?(width|height|inline-size|block-size) case 8116: case 7059: case 5753: case 5535: case 5445: case 5701: case 4933: case 4677: case 5533: case 5789: case 5021: case 4765: // stretch, max-content, min-content, fill-available if (Utility_strlen(value) - 1 - length > 6) switch (Utility_charat(value, length + 1)) { // (m)ax-content, (m)in-content case 109: // - if (Utility_charat(value, length + 4) !== 45) break; // (f)ill-available, (f)it-content case 102: return Utility_replace(value, /(.+:)(.+)-([^]+)/, '$1' + Enum_WEBKIT + '$2-$3' + '$1' + Enum_MOZ + (Utility_charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value; // (s)tretch case 115: return ~indexof(value, 'stretch') ? emotion_cache_browser_esm_prefix(Utility_replace(value, 'stretch', 'fill-available'), length) + value : value; } break; // position: sticky case 4949: // (s)ticky? if (Utility_charat(value, length + 1) !== 115) break; // display: (flex|inline-flex) case 6444: switch (Utility_charat(value, Utility_strlen(value) - 3 - (~indexof(value, '!important') && 10))) { // stic(k)y case 107: return Utility_replace(value, ':', ':' + Enum_WEBKIT) + value; // (inline-)?fl(e)x case 101: return Utility_replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + Enum_WEBKIT + (Utility_charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + Enum_WEBKIT + '$2$3' + '$1' + Enum_MS + '$2box$3') + value; } break; // writing-mode case 5936: switch (Utility_charat(value, length + 11)) { // vertical-l(r) case 114: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value; // vertical-r(l) case 108: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value; // horizontal(-)tb case 45: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value; } return Enum_WEBKIT + value + Enum_MS + value + value; } return value; } var emotion_cache_browser_esm_prefixer = function prefixer(element, index, children, callback) { if (element.length > -1) if (!element["return"]) switch (element.type) { case Enum_DECLARATION: element["return"] = emotion_cache_browser_esm_prefix(element.value, element.length); break; case Enum_KEYFRAMES: return Serializer_serialize([Tokenizer_copy(element, { value: Utility_replace(element.value, '@', '@' + Enum_WEBKIT) })], callback); case Enum_RULESET: if (element.length) return Utility_combine(element.props, function (value) { switch (Utility_match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return Serializer_serialize([Tokenizer_copy(element, { props: [Utility_replace(value, /:(read-\w+)/, ':' + Enum_MOZ + '$1')] })], callback); // :placeholder case '::placeholder': return Serializer_serialize([Tokenizer_copy(element, { props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_WEBKIT + 'input-$1')] }), Tokenizer_copy(element, { props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_MOZ + '$1')] }), Tokenizer_copy(element, { props: [Utility_replace(value, /:(plac\w+)/, Enum_MS + 'input-$1')] })], callback); } return ''; }); } }; var defaultStylisPlugins = [emotion_cache_browser_esm_prefixer]; var createCache = function createCache(options) { var key = options.key; if (false) {} if ( key === 'css') { var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be) // note this very very intentionally targets all style elements regardless of the key to ensure // that creating a cache works inside of render of a React component Array.prototype.forEach.call(ssrStyles, function (node) { // we want to only move elements which have a space in the data-emotion attribute value // because that indicates that it is an Emotion 11 server-side rendered style elements // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes) // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles // will not result in the Emotion 10 styles being destroyed var dataEmotionAttribute = node.getAttribute('data-emotion'); if (dataEmotionAttribute.indexOf(' ') === -1) { return; } document.head.appendChild(node); node.setAttribute('data-s', ''); }); } var stylisPlugins = options.stylisPlugins || defaultStylisPlugins; if (false) {} var inserted = {}; var container; var nodesToHydrate = []; { container = options.container || document.head; Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which // means that the style elements we're looking at are only Emotion 11 server-rendered style elements document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) { var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe for (var i = 1; i < attrib.length; i++) { inserted[attrib[i]] = true; } nodesToHydrate.push(node); }); } var _insert; var omnipresentPlugins = [compat, removeLabel]; if (false) {} { var currentSheet; var finalizingPlugins = [Serializer_stringify, false ? 0 : rulesheet(function (rule) { currentSheet.insert(rule); })]; var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins)); var stylis = function stylis(styles) { return Serializer_serialize(compile(styles), serializer); }; _insert = function insert(selector, serialized, sheet, shouldCache) { currentSheet = sheet; if (false) {} stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); if (shouldCache) { cache.inserted[serialized.name] = true; } }; } var cache = { key: key, sheet: new StyleSheet({ key: key, container: container, nonce: options.nonce, speedy: options.speedy, prepend: options.prepend, insertionPoint: options.insertionPoint }), nonce: options.nonce, inserted: inserted, registered: {}, insert: _insert }; cache.sheet.hydrate(nodesToHydrate); return cache; }; /* harmony default export */ const emotion_cache_browser_esm = (createCache); ;// ./node_modules/@emotion/hash/dist/emotion-hash.esm.js /* eslint-disable */ // Inspired by https://github.com/garycourt/murmurhash-js // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86 function murmur2(str) { // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. // const m = 0x5bd1e995; // const r = 24; // Initialize the hash var h = 0; // Mix 4 bytes at a time into the hash var k, i = 0, len = str.length; for (; len >= 4; ++i, len -= 4) { k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24; k = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16); k ^= /* k >>> r: */ k >>> 24; h = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); } // Handle the last few bytes of the input array switch (len) { case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16; case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8; case 1: h ^= str.charCodeAt(i) & 0xff; h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); } // Do a few final mixes of the hash to ensure the last few // bytes are well-incorporated. h ^= h >>> 13; h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); return ((h ^ h >>> 15) >>> 0).toString(36); } /* harmony default export */ const emotion_hash_esm = (murmur2); ;// ./node_modules/@emotion/unitless/dist/emotion-unitless.esm.js var unitlessKeys = { animationIterationCount: 1, borderImageOutset: 1, borderImageSlice: 1, borderImageWidth: 1, boxFlex: 1, boxFlexGroup: 1, boxOrdinalGroup: 1, columnCount: 1, columns: 1, flex: 1, flexGrow: 1, flexPositive: 1, flexShrink: 1, flexNegative: 1, flexOrder: 1, gridRow: 1, gridRowEnd: 1, gridRowSpan: 1, gridRowStart: 1, gridColumn: 1, gridColumnEnd: 1, gridColumnSpan: 1, gridColumnStart: 1, msGridRow: 1, msGridRowSpan: 1, msGridColumn: 1, msGridColumnSpan: 1, fontWeight: 1, lineHeight: 1, opacity: 1, order: 1, orphans: 1, tabSize: 1, widows: 1, zIndex: 1, zoom: 1, WebkitLineClamp: 1, // SVG-related properties fillOpacity: 1, floodOpacity: 1, stopOpacity: 1, strokeDasharray: 1, strokeDashoffset: 1, strokeMiterlimit: 1, strokeOpacity: 1, strokeWidth: 1 }; /* harmony default export */ const emotion_unitless_esm = (unitlessKeys); ;// ./node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key)."; var hyphenateRegex = /[A-Z]|^ms/g; var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g; var isCustomProperty = function isCustomProperty(property) { return property.charCodeAt(1) === 45; }; var isProcessableValue = function isProcessableValue(value) { return value != null && typeof value !== 'boolean'; }; var processStyleName = /* #__PURE__ */memoize(function (styleName) { return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); }); var processStyleValue = function processStyleValue(key, value) { switch (key) { case 'animation': case 'animationName': { if (typeof value === 'string') { return value.replace(animationRegex, function (match, p1, p2) { cursor = { name: p1, styles: p2, next: cursor }; return p1; }); } } } if (emotion_unitless_esm[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) { return value + 'px'; } return value; }; if (false) { var hyphenatedCache, hyphenPattern, msPattern, oldProcessStyleValue, contentValues, contentValuePattern; } var noComponentSelectorMessage = (/* unused pure expression or super */ null && ('Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.')); function handleInterpolation(mergedProps, registered, interpolation) { if (interpolation == null) { return ''; } if (interpolation.__emotion_styles !== undefined) { if (false) {} return interpolation; } switch (typeof interpolation) { case 'boolean': { return ''; } case 'object': { if (interpolation.anim === 1) { cursor = { name: interpolation.name, styles: interpolation.styles, next: cursor }; return interpolation.name; } if (interpolation.styles !== undefined) { var next = interpolation.next; if (next !== undefined) { // not the most efficient thing ever but this is a pretty rare case // and there will be very few iterations of this generally while (next !== undefined) { cursor = { name: next.name, styles: next.styles, next: cursor }; next = next.next; } } var styles = interpolation.styles + ";"; if (false) {} return styles; } return createStringFromObject(mergedProps, registered, interpolation); } case 'function': { if (mergedProps !== undefined) { var previousCursor = cursor; var result = interpolation(mergedProps); cursor = previousCursor; return handleInterpolation(mergedProps, registered, result); } else if (false) {} break; } case 'string': if (false) { var replaced, matched; } break; } // finalize string values (regular strings and functions interpolated into css calls) if (registered == null) { return interpolation; } var cached = registered[interpolation]; return cached !== undefined ? cached : interpolation; } function createStringFromObject(mergedProps, registered, obj) { var string = ''; if (Array.isArray(obj)) { for (var i = 0; i < obj.length; i++) { string += handleInterpolation(mergedProps, registered, obj[i]) + ";"; } } else { for (var _key in obj) { var value = obj[_key]; if (typeof value !== 'object') { if (registered != null && registered[value] !== undefined) { string += _key + "{" + registered[value] + "}"; } else if (isProcessableValue(value)) { string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";"; } } else { if (_key === 'NO_COMPONENT_SELECTOR' && "production" !== 'production') {} if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) { for (var _i = 0; _i < value.length; _i++) { if (isProcessableValue(value[_i])) { string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";"; } } } else { var interpolated = handleInterpolation(mergedProps, registered, value); switch (_key) { case 'animation': case 'animationName': { string += processStyleName(_key) + ":" + interpolated + ";"; break; } default: { if (false) {} string += _key + "{" + interpolated + "}"; } } } } } } return string; } var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g; var sourceMapPattern; if (false) {} // this is the cursor for keyframes // keyframes are stored on the SerializedStyles object as a linked list var cursor; var emotion_serialize_browser_esm_serializeStyles = function serializeStyles(args, registered, mergedProps) { if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) { return args[0]; } var stringMode = true; var styles = ''; cursor = undefined; var strings = args[0]; if (strings == null || strings.raw === undefined) { stringMode = false; styles += handleInterpolation(mergedProps, registered, strings); } else { if (false) {} styles += strings[0]; } // we start at 1 since we've already handled the first arg for (var i = 1; i < args.length; i++) { styles += handleInterpolation(mergedProps, registered, args[i]); if (stringMode) { if (false) {} styles += strings[i]; } } var sourceMap; if (false) {} // using a global regex with .exec is stateful so lastIndex has to be reset each time labelPattern.lastIndex = 0; var identifierName = ''; var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5 while ((match = labelPattern.exec(styles)) !== null) { identifierName += '-' + // $FlowFixMe we know it's not null match[1]; } var name = emotion_hash_esm(styles) + identifierName; if (false) {} return { name: name, styles: styles, next: cursor }; }; ;// ./node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js var syncFallback = function syncFallback(create) { return create(); }; var useInsertionEffect = external_React_['useInsertion' + 'Effect'] ? external_React_['useInsertion' + 'Effect'] : false; var emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback; var useInsertionEffectWithLayoutFallback = (/* unused pure expression or super */ null && (useInsertionEffect || useLayoutEffect)); ;// ./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js var emotion_element_6a883da9_browser_esm_hasOwnProperty = {}.hasOwnProperty; var EmotionCacheContext = /* #__PURE__ */(0,external_React_.createContext)( // we're doing this to avoid preconstruct's dead code elimination in this one case // because this module is primarily intended for the browser and node // but it's also required in react native and similar environments sometimes // and we could have a special build just for that // but this is much easier and the native packages // might use a different theme context in the future anyway typeof HTMLElement !== 'undefined' ? /* #__PURE__ */emotion_cache_browser_esm({ key: 'css' }) : null); if (false) {} var CacheProvider = EmotionCacheContext.Provider; var __unsafe_useEmotionCache = function useEmotionCache() { return useContext(EmotionCacheContext); }; var withEmotionCache = function withEmotionCache(func) { // $FlowFixMe return /*#__PURE__*/(0,external_React_.forwardRef)(function (props, ref) { // the cache will never be null in the browser var cache = (0,external_React_.useContext)(EmotionCacheContext); return func(props, cache, ref); }); }; var ThemeContext = /* #__PURE__ */(0,external_React_.createContext)({}); if (false) {} var useTheme = function useTheme() { return useContext(ThemeContext); }; var getTheme = function getTheme(outerTheme, theme) { if (typeof theme === 'function') { var mergedTheme = theme(outerTheme); if (false) {} return mergedTheme; } if (false) {} return _extends({}, outerTheme, theme); }; var createCacheWithTheme = /* #__PURE__ */(/* unused pure expression or super */ null && (weakMemoize(function (outerTheme) { return weakMemoize(function (theme) { return getTheme(outerTheme, theme); }); }))); var ThemeProvider = function ThemeProvider(props) { var theme = useContext(ThemeContext); if (props.theme !== theme) { theme = createCacheWithTheme(theme)(props.theme); } return /*#__PURE__*/createElement(ThemeContext.Provider, { value: theme }, props.children); }; function withTheme(Component) { var componentName = Component.displayName || Component.name || 'Component'; var render = function render(props, ref) { var theme = useContext(ThemeContext); return /*#__PURE__*/createElement(Component, _extends({ theme: theme, ref: ref }, props)); }; // $FlowFixMe var WithTheme = /*#__PURE__*/forwardRef(render); WithTheme.displayName = "WithTheme(" + componentName + ")"; return hoistNonReactStatics(WithTheme, Component); } var getLastPart = function getLastPart(functionName) { // The match may be something like 'Object.createEmotionProps' or // 'Loader.prototype.render' var parts = functionName.split('.'); return parts[parts.length - 1]; }; var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) { // V8 var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line); if (match) return getLastPart(match[1]); // Safari / Firefox match = /^([A-Za-z0-9$.]+)@/.exec(line); if (match) return getLastPart(match[1]); return undefined; }; var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS // identifiers, thus we only need to replace what is a valid character for JS, // but not for CSS. var sanitizeIdentifier = function sanitizeIdentifier(identifier) { return identifier.replace(/\$/g, '-'); }; var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) { if (!stackTrace) return undefined; var lines = stackTrace.split('\n'); for (var i = 0; i < lines.length; i++) { var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error" if (!functionName) continue; // If we reach one of these, we have gone too far and should quit if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an // uppercase letter if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName); } return undefined; }; var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__'; var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__'; var createEmotionProps = function createEmotionProps(type, props) { if (false) {} var newProps = {}; for (var key in props) { if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key)) { newProps[key] = props[key]; } } newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when // the label hasn't already been computed if (false) { var label; } return newProps; }; var Insertion = function Insertion(_ref) { var cache = _ref.cache, serialized = _ref.serialized, isStringTag = _ref.isStringTag; registerStyles(cache, serialized, isStringTag); var rules = useInsertionEffectAlwaysWithSyncFallback(function () { return insertStyles(cache, serialized, isStringTag); }); return null; }; var Emotion = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache, ref) { var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works // not passing the registered cache to serializeStyles because it would // make certain babel optimisations not possible if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) { cssProp = cache.registered[cssProp]; } var WrappedComponent = props[typePropName]; var registeredStyles = [cssProp]; var className = ''; if (typeof props.className === 'string') { className = getRegisteredStyles(cache.registered, registeredStyles, props.className); } else if (props.className != null) { className = props.className + " "; } var serialized = serializeStyles(registeredStyles, undefined, useContext(ThemeContext)); if (false) { var labelFromStack; } className += cache.key + "-" + serialized.name; var newProps = {}; for (var key in props) { if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && ( true || 0)) { newProps[key] = props[key]; } } newProps.ref = ref; newProps.className = className; return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, { cache: cache, serialized: serialized, isStringTag: typeof WrappedComponent === 'string' }), /*#__PURE__*/createElement(WrappedComponent, newProps)); }))); if (false) {} ;// ./node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js var isBrowser = "object" !== 'undefined'; function emotion_utils_browser_esm_getRegisteredStyles(registered, registeredStyles, classNames) { var rawClassName = ''; classNames.split(' ').forEach(function (className) { if (registered[className] !== undefined) { registeredStyles.push(registered[className] + ";"); } else { rawClassName += className + " "; } }); return rawClassName; } var emotion_utils_browser_esm_registerStyles = function registerStyles(cache, serialized, isStringTag) { var className = cache.key + "-" + serialized.name; if ( // we only need to add the styles to the registered cache if the // class name could be used further down // the tree but if it's a string tag, we know it won't // so we don't have to add it to registered cache. // this improves memory usage since we can avoid storing the whole style string (isStringTag === false || // we need to always store it if we're in compat mode and // in node since emotion-server relies on whether a style is in // the registered cache to know whether a style is global or not // also, note that this check will be dead code eliminated in the browser isBrowser === false ) && cache.registered[className] === undefined) { cache.registered[className] = serialized.styles; } }; var emotion_utils_browser_esm_insertStyles = function insertStyles(cache, serialized, isStringTag) { emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag); var className = cache.key + "-" + serialized.name; if (cache.inserted[serialized.name] === undefined) { var current = serialized; do { var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true); current = current.next; } while (current !== undefined); } }; ;// ./node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js var testOmitPropsOnStringTag = isPropValid; var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) { return key !== 'theme'; }; var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) { return typeof tag === 'string' && // 96 is one less than the char code // for "a" so this is checking that // it's a lowercase character tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent; }; var composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) { var shouldForwardProp; if (options) { var optionsShouldForwardProp = options.shouldForwardProp; shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) { return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName); } : optionsShouldForwardProp; } if (typeof shouldForwardProp !== 'function' && isReal) { shouldForwardProp = tag.__emotion_forwardProp; } return shouldForwardProp; }; var emotion_styled_base_browser_esm_ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; var emotion_styled_base_browser_esm_Insertion = function Insertion(_ref) { var cache = _ref.cache, serialized = _ref.serialized, isStringTag = _ref.isStringTag; emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag); var rules = emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback(function () { return emotion_utils_browser_esm_insertStyles(cache, serialized, isStringTag); }); return null; }; var createStyled = function createStyled(tag, options) { if (false) {} var isReal = tag.__emotion_real === tag; var baseTag = isReal && tag.__emotion_base || tag; var identifierName; var targetClassName; if (options !== undefined) { identifierName = options.label; targetClassName = options.target; } var shouldForwardProp = composeShouldForwardProps(tag, options, isReal); var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag); var shouldUseAs = !defaultShouldForwardProp('as'); return function () { var args = arguments; var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : []; if (identifierName !== undefined) { styles.push("label:" + identifierName + ";"); } if (args[0] == null || args[0].raw === undefined) { styles.push.apply(styles, args); } else { if (false) {} styles.push(args[0][0]); var len = args.length; var i = 1; for (; i < len; i++) { if (false) {} styles.push(args[i], args[0][i]); } } // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class var Styled = withEmotionCache(function (props, cache, ref) { var FinalTag = shouldUseAs && props.as || baseTag; var className = ''; var classInterpolations = []; var mergedProps = props; if (props.theme == null) { mergedProps = {}; for (var key in props) { mergedProps[key] = props[key]; } mergedProps.theme = (0,external_React_.useContext)(ThemeContext); } if (typeof props.className === 'string') { className = emotion_utils_browser_esm_getRegisteredStyles(cache.registered, classInterpolations, props.className); } else if (props.className != null) { className = props.className + " "; } var serialized = emotion_serialize_browser_esm_serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps); className += cache.key + "-" + serialized.name; if (targetClassName !== undefined) { className += " " + targetClassName; } var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp; var newProps = {}; for (var _key in props) { if (shouldUseAs && _key === 'as') continue; if ( // $FlowFixMe finalShouldForwardProp(_key)) { newProps[_key] = props[_key]; } } newProps.className = className; newProps.ref = ref; return /*#__PURE__*/(0,external_React_.createElement)(external_React_.Fragment, null, /*#__PURE__*/(0,external_React_.createElement)(emotion_styled_base_browser_esm_Insertion, { cache: cache, serialized: serialized, isStringTag: typeof FinalTag === 'string' }), /*#__PURE__*/(0,external_React_.createElement)(FinalTag, newProps)); }); Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")"; Styled.defaultProps = tag.defaultProps; Styled.__emotion_real = Styled; Styled.__emotion_base = baseTag; Styled.__emotion_styles = styles; Styled.__emotion_forwardProp = shouldForwardProp; Object.defineProperty(Styled, 'toString', { value: function value() { if (targetClassName === undefined && "production" !== 'production') {} // $FlowFixMe: coerce undefined to string return "." + targetClassName; } }); Styled.withComponent = function (nextTag, nextOptions) { return createStyled(nextTag, extends_extends({}, options, nextOptions, { shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true) })).apply(void 0, styles); }; return Styled; }; }; /* harmony default export */ const emotion_styled_base_browser_esm = (createStyled); ;// ./node_modules/@emotion/styled/dist/emotion-styled.browser.esm.js var tags = ['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', 'marquee', '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', // SVG 'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan']; var newStyled = emotion_styled_base_browser_esm.bind(); tags.forEach(function (tagName) { // $FlowFixMe: we can ignore this because its exposed type is defined by the CreateStyled type newStyled[tagName] = newStyled(tagName); }); /* harmony default export */ const emotion_styled_browser_esm = (newStyled); ;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/width-height-tool.js const SingleColumnToolsPanelItem = emotion_styled_browser_esm((0,external_wp_components_namespaceObject.__experimentalToolsPanelItem))` grid-column: span 1; `; function WidthHeightTool({ panelId, value = {}, onChange = () => { }, units, isShownByDefault = true }) { const width = value.width === "auto" ? "" : value.width ?? ""; const height = value.height === "auto" ? "" : value.height ?? ""; const onDimensionChange = (dimension) => (nextDimension) => { const nextValue = { ...value }; if (!nextDimension) { delete nextValue[dimension]; } else { nextValue[dimension] = nextDimension; } onChange(nextValue); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SingleColumnToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)("Width"), isShownByDefault, hasValue: () => width !== "", onDeselect: onDimensionChange("width"), panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { label: (0,external_wp_i18n_namespaceObject.__)("Width"), placeholder: (0,external_wp_i18n_namespaceObject.__)("Auto"), labelPosition: "top", units, min: 0, value: width, onChange: onDimensionChange("width"), size: "__unstable-large" } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SingleColumnToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)("Height"), isShownByDefault, hasValue: () => height !== "", onDeselect: onDimensionChange("height"), panelId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { label: (0,external_wp_i18n_namespaceObject.__)("Height"), placeholder: (0,external_wp_i18n_namespaceObject.__)("Auto"), labelPosition: "top", units, min: 0, value: height, onChange: onDimensionChange("height"), size: "__unstable-large" } ) } ) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/index.js function DimensionsTool({ panelId, value = {}, onChange = () => { }, aspectRatioOptions, // Default options handled by AspectRatioTool. defaultAspectRatio = "auto", // Match CSS default value for aspect-ratio. scaleOptions, // Default options handled by ScaleTool. defaultScale = "fill", // Match CSS default value for object-fit. unitsOptions, // Default options handled by UnitControl. tools = ["aspectRatio", "widthHeight", "scale"] }) { const width = value.width === void 0 || value.width === "auto" ? null : value.width; const height = value.height === void 0 || value.height === "auto" ? null : value.height; const aspectRatio = value.aspectRatio === void 0 || value.aspectRatio === "auto" ? null : value.aspectRatio; const scale = value.scale === void 0 || value.scale === "fill" ? null : value.scale; const [lastScale, setLastScale] = (0,external_wp_element_namespaceObject.useState)(scale); const [lastAspectRatio, setLastAspectRatio] = (0,external_wp_element_namespaceObject.useState)(aspectRatio); const aspectRatioValue = width && height ? "custom" : lastAspectRatio; const showScaleControl = aspectRatio || width && height; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ tools.includes("aspectRatio") && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AspectRatioTool, { panelId, options: aspectRatioOptions, defaultValue: defaultAspectRatio, value: aspectRatioValue, onChange: (nextAspectRatio) => { const nextValue = { ...value }; nextAspectRatio = nextAspectRatio === "auto" ? null : nextAspectRatio; setLastAspectRatio(nextAspectRatio); if (!nextAspectRatio) { delete nextValue.aspectRatio; } else { nextValue.aspectRatio = nextAspectRatio; } if (!nextAspectRatio) { delete nextValue.scale; } else if (lastScale) { nextValue.scale = lastScale; } else { nextValue.scale = defaultScale; setLastScale(defaultScale); } if ("custom" !== nextAspectRatio && width && height) { delete nextValue.height; } onChange(nextValue); } } ), tools.includes("widthHeight") && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WidthHeightTool, { panelId, units: unitsOptions, value: { width, height }, onChange: ({ width: nextWidth, height: nextHeight }) => { const nextValue = { ...value }; nextWidth = nextWidth === "auto" ? null : nextWidth; nextHeight = nextHeight === "auto" ? null : nextHeight; if (!nextWidth) { delete nextValue.width; } else { nextValue.width = nextWidth; } if (!nextHeight) { delete nextValue.height; } else { nextValue.height = nextHeight; } if (nextWidth && nextHeight) { delete nextValue.aspectRatio; } else if (lastAspectRatio) { nextValue.aspectRatio = lastAspectRatio; } else { } if (!lastAspectRatio && !!nextWidth !== !!nextHeight) { delete nextValue.scale; } else if (lastScale) { nextValue.scale = lastScale; } else { nextValue.scale = defaultScale; setLastScale(defaultScale); } onChange(nextValue); } } ), tools.includes("scale") && showScaleControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ScaleTool, { panelId, options: scaleOptions, defaultValue: defaultScale, value: lastScale, onChange: (nextScale) => { const nextValue = { ...value }; nextScale = nextScale === "fill" ? null : nextScale; setLastScale(nextScale); if (!nextScale) { delete nextValue.scale; } else { nextValue.scale = nextScale; } onChange(nextValue); } } ) ] }); } var dimensions_tool_default = DimensionsTool; ;// ./node_modules/@wordpress/block-editor/build-module/components/resolution-tool/index.js const DEFAULT_SIZE_OPTIONS = [ { label: (0,external_wp_i18n_namespaceObject._x)("Thumbnail", "Image size option for resolution control"), value: "thumbnail" }, { label: (0,external_wp_i18n_namespaceObject._x)("Medium", "Image size option for resolution control"), value: "medium" }, { label: (0,external_wp_i18n_namespaceObject._x)("Large", "Image size option for resolution control"), value: "large" }, { label: (0,external_wp_i18n_namespaceObject._x)("Full Size", "Image size option for resolution control"), value: "full" } ]; function ResolutionTool({ panelId, value, onChange, options = DEFAULT_SIZE_OPTIONS, defaultValue = DEFAULT_SIZE_OPTIONS[0].value, isShownByDefault = true, resetAllFilter }) { const displayValue = value ?? defaultValue; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => displayValue !== defaultValue, label: (0,external_wp_i18n_namespaceObject.__)("Resolution"), onDeselect: () => onChange(defaultValue), isShownByDefault, panelId, resetAllFilter, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Resolution"), value: displayValue, options, onChange, help: (0,external_wp_i18n_namespaceObject.__)("Select the size of the source image."), size: "__unstable-large" } ) } ); } ;// ./node_modules/@wordpress/block-editor/build-module/components/html-element-control/messages.js const htmlElementMessages = { a: (0,external_wp_i18n_namespaceObject.__)( "The <a> element should be used for links that navigate to a different page or to a different section within the same page." ), article: (0,external_wp_i18n_namespaceObject.__)( "The <article> element should represent a self-contained, syndicatable portion of the document." ), aside: (0,external_wp_i18n_namespaceObject.__)( "The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content." ), button: (0,external_wp_i18n_namespaceObject.__)( "The <button> element should be used for interactive controls that perform an action on the current page, such as opening a modal or toggling content visibility." ), div: (0,external_wp_i18n_namespaceObject.__)( "The <div> element should only be used if the block is a design element with no semantic meaning." ), footer: (0,external_wp_i18n_namespaceObject.__)( "The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.)." ), header: (0,external_wp_i18n_namespaceObject.__)( "The <header> element should represent introductory content, typically a group of introductory or navigational aids." ), main: (0,external_wp_i18n_namespaceObject.__)( "The <main> element should be used for the primary content of your document only." ), nav: (0,external_wp_i18n_namespaceObject.__)( "The <nav> element should be used to identify groups of links that are intended to be used for website or page content navigation." ), section: (0,external_wp_i18n_namespaceObject.__)( "The <section> element should represent a standalone portion of the document that can't be better represented by another element." ) }; ;// ./node_modules/@wordpress/block-editor/build-module/components/html-element-control/index.js function HTMLElementControl({ tagName, onChange, clientId, options = [ { label: (0,external_wp_i18n_namespaceObject.__)("Default (<div>)"), value: "div" }, { label: "<header>", value: "header" }, { label: "<main>", value: "main" }, { label: "<section>", value: "section" }, { label: "<article>", value: "article" }, { label: "<aside>", value: "aside" }, { label: "<footer>", value: "footer" } ] }) { const checkForMainTag = !!clientId && options.some((option) => option.value === "main"); const hasMainElementElsewhere = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (!checkForMainTag) { return false; } const { getClientIdsWithDescendants, getBlockAttributes } = select(store); return getClientIdsWithDescendants().some((id) => { if (id === clientId) { return false; } return getBlockAttributes(id)?.tagName === "main"; }); }, [clientId, checkForMainTag] ); const modifiedOptions = options.map((option) => { if (option.value === "main" && hasMainElementElsewhere && tagName !== "main") { return { ...option, disabled: true, label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: HTML element name */ (0,external_wp_i18n_namespaceObject.__)("%s (Already in use)"), option.label ) }; } return option; }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, className: "block-editor-html-element-control", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("HTML element"), options: modifiedOptions, value: tagName, onChange, help: htmlElementMessages[tagName] } ), tagName === "main" && hasMainElementElsewhere && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "warning", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)( "Multiple <main> elements detected. The duplicate may be in your content or template. This is not valid HTML and may cause accessibility issues. Please change this HTML element." ) }) ] }); } ;// ./node_modules/@wordpress/block-editor/build-module/private-apis.js const privateApis = {}; lock(privateApis, { ...global_styles_namespaceObject, ExperimentalBlockCanvas: ExperimentalBlockCanvas, ExperimentalBlockEditorProvider: ExperimentalBlockEditorProvider, getDuotoneFilter: getDuotoneFilter, getRichTextValues: getRichTextValues, PrivateQuickInserter: QuickInserter, extractWords: extractWords, getNormalizedSearchTerms: getNormalizedSearchTerms, normalizeString: normalizeString, PrivateListView: PrivateListView, ResizableBoxPopover: ResizableBoxPopover, useHasBlockToolbar: useHasBlockToolbar, cleanEmptyObject: utils_cleanEmptyObject, BlockQuickNavigation: BlockQuickNavigation, LayoutStyle: LayoutStyle, BlockManager: BlockManager, BlockRemovalWarningModal: BlockRemovalWarningModal, useLayoutClasses: useLayoutClasses, useLayoutStyles: useLayoutStyles, DimensionsTool: dimensions_tool_default, ResolutionTool: ResolutionTool, TabbedSidebar: tabbed_sidebar_default, TextAlignmentControl: TextAlignmentControl, usesContextKey: usesContextKey, useFlashEditableBlocks: useFlashEditableBlocks, HTMLElementControl: HTMLElementControl, useZoomOut: useZoomOut, globalStylesDataKey: globalStylesDataKey, globalStylesLinksDataKey: globalStylesLinksDataKey, selectBlockPatternsKey: selectBlockPatternsKey, requiresWrapperOnCopy: requiresWrapperOnCopy, PrivateRichText: PrivateRichText, PrivateInserterLibrary: PrivateInserterLibrary, reusableBlocksSelectKey: reusableBlocksSelectKey, PrivateBlockPopover: PrivateBlockPopover, PrivatePublishDateTimePicker: PrivatePublishDateTimePicker, useSpacingSizes: useSpacingSizes, useBlockDisplayTitle: useBlockDisplayTitle, __unstableBlockStyleVariationOverridesWithConfig: __unstableBlockStyleVariationOverridesWithConfig, setBackgroundStyleDefaults: setBackgroundStyleDefaults, sectionRootClientIdKey: sectionRootClientIdKey, CommentIconSlotFill: block_comment_icon_slot_default, CommentIconToolbarSlotFill: block_comment_icon_toolbar_slot_default, mediaEditKey: mediaEditKey, useBlockElement: useBlockElement, useBlockElementRef: useBlockElementRef }); ;// ./node_modules/@wordpress/block-editor/build-module/index.js })(); (window.wp = window.wp || {}).blockEditor = __webpack_exports__; /******/ })() ; widgets.min.js 0000644 00000046776 15151622574 0007366 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={n:t=>{var i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},d:(t,i)=>{for(var n in i)e.o(i,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:i[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MoveToWidgetArea:()=>J,addWidgetIdToBlock:()=>q,getWidgetIdFromBlock:()=>X,registerLegacyWidgetBlock:()=>Y,registerLegacyWidgetVariations:()=>K,registerWidgetGroupBlock:()=>ee});var i={};e.r(i),e.d(i,{yu:()=>c,UU:()=>W,W0:()=>A});var n={};e.r(n),e.d(n,{yu:()=>z,UU:()=>$,W0:()=>Q});const s=window.wp.blocks,r=window.ReactJSXRuntime,o=window.wp.primitives;var a=(0,r.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,r.jsx)(o.Path,{d:"M6 3H8V5H16V3H18V5C19.1046 5 20 5.89543 20 7V19C20 20.1046 19.1046 21 18 21H6C4.89543 21 4 20.1046 4 19V7C4 5.89543 4.89543 5 6 5V3ZM18 6.5H6C5.72386 6.5 5.5 6.72386 5.5 7V8H18.5V7C18.5 6.72386 18.2761 6.5 18 6.5ZM18.5 9.5H5.5V19C5.5 19.2761 5.72386 19.5 6 19.5H18C18.2761 19.5 18.5 19.2761 18.5 19V9.5ZM11 11H13V13H11V11ZM7 11V13H9V11H7ZM15 13V11H17V13H15Z"})});const c=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"core/legacy-widget","title":"Legacy Widget","category":"widgets","description":"Display a legacy widget.","textdomain":"default","attributes":{"id":{"type":"string","default":null},"idBase":{"type":"string","default":null},"instance":{"type":"object","default":null}},"supports":{"html":false,"customClassName":false,"reusable":false},"editorStyle":"wp-block-legacy-widget-editor"}');function l(e){var t,i,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(i=l(e[t]))&&(n&&(n+=" "),n+=i)}else for(i in e)e[i]&&(n&&(n+=" "),n+=i);return n}const d=function(){for(var e,t,i=0,n="",s=arguments.length;i<s;i++)(e=arguments[i])&&(t=l(e))&&(n&&(n+=" "),n+=t);return n},h=window.wp.blockEditor,u=window.wp.components;var m=(0,r.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,r.jsx)(o.Path,{d:"M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z"})});const w=window.wp.i18n,g=window.wp.element,p=window.wp.coreData,f=window.wp.data;function b({selectedId:e,onSelect:t}){const i=(0,f.useSelect)((e=>{const t=e(h.store).getSettings()?.widgetTypesToHideFromLegacyWidgetBlock??[];return e(p.store).getWidgetTypes({per_page:-1})?.filter((e=>!t.includes(e.id)))}),[]);return i?0===i.length?(0,w.__)("There are no widgets available."):(0,r.jsx)(u.SelectControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,w.__)("Legacy widget"),value:e??"",options:[{value:"",label:(0,w.__)("Select widget")},...i.map((e=>({value:e.id,label:e.name})))],onChange:e=>{if(e){const n=i.find((t=>t.id===e));t({selectedId:n.id,isMulti:n.is_multi})}else t({selectedId:null})}}):(0,r.jsx)(u.Spinner,{})}function v({name:e,description:t}){return(0,r.jsxs)("div",{className:"wp-block-legacy-widget-inspector-card",children:[(0,r.jsx)("h3",{className:"wp-block-legacy-widget-inspector-card__name",children:e}),(0,r.jsx)("span",{children:t})]})}const y=window.wp.notices,_=window.wp.compose,x=window.wp.apiFetch;var j=e.n(x);class k{constructor({id:e,idBase:t,instance:i,onChangeInstance:n,onChangeHasPreview:s,onError:r}){this.id=e,this.idBase=t,this._instance=i,this._hasPreview=null,this.onChangeInstance=n,this.onChangeHasPreview=s,this.onError=r,this.number=++B,this.handleFormChange=(0,_.debounce)(this.handleFormChange.bind(this),200),this.handleFormSubmit=this.handleFormSubmit.bind(this),this.initDOM(),this.bindEvents(),this.loadContent()}destroy(){this.unbindEvents(),this.element.remove()}initDOM(){this.element=C("div",{class:"widget open"},[C("div",{class:"widget-inside"},[this.form=C("form",{class:"form",method:"post"},[C("input",{class:"widget-id",type:"hidden",name:"widget-id",value:this.id??`${this.idBase}-${this.number}`}),C("input",{class:"id_base",type:"hidden",name:"id_base",value:this.idBase??this.id}),C("input",{class:"widget-width",type:"hidden",name:"widget-width",value:"250"}),C("input",{class:"widget-height",type:"hidden",name:"widget-height",value:"200"}),C("input",{class:"widget_number",type:"hidden",name:"widget_number",value:this.idBase?this.number.toString():""}),this.content=C("div",{class:"widget-content"}),this.id&&C("button",{class:"button is-primary",type:"submit"},(0,w.__)("Save"))])])])}bindEvents(){if(window.jQuery){const{jQuery:e}=window;e(this.form).on("change",null,this.handleFormChange),e(this.form).on("input",null,this.handleFormChange),e(this.form).on("submit",this.handleFormSubmit)}else this.form.addEventListener("change",this.handleFormChange),this.form.addEventListener("input",this.handleFormChange),this.form.addEventListener("submit",this.handleFormSubmit)}unbindEvents(){if(window.jQuery){const{jQuery:e}=window;e(this.form).off("change",null,this.handleFormChange),e(this.form).off("input",null,this.handleFormChange),e(this.form).off("submit",this.handleFormSubmit)}else this.form.removeEventListener("change",this.handleFormChange),this.form.removeEventListener("input",this.handleFormChange),this.form.removeEventListener("submit",this.handleFormSubmit)}async loadContent(){try{if(this.id){const{form:e}=await S(this.id);this.content.innerHTML=e}else if(this.idBase){const{form:e,preview:t}=await T({idBase:this.idBase,instance:this.instance,number:this.number});if(this.content.innerHTML=e,this.hasPreview=!H(t),!this.instance.hash){const{instance:e}=await T({idBase:this.idBase,instance:this.instance,number:this.number,formData:I(this.form)});this.instance=e}}if(window.jQuery){const{jQuery:e}=window;e(document).trigger("widget-added",[e(this.element)])}}catch(e){this.onError(e)}}handleFormChange(){this.idBase&&this.saveForm()}handleFormSubmit(e){e.preventDefault(),this.saveForm()}async saveForm(){const e=I(this.form);try{if(this.id){const{form:t}=await S(this.id,e);if(this.content.innerHTML=t,window.jQuery){const{jQuery:e}=window;e(document).trigger("widget-updated",[e(this.element)])}}else if(this.idBase){const{instance:t,preview:i}=await T({idBase:this.idBase,instance:this.instance,number:this.number,formData:e});this.instance=t,this.hasPreview=!H(i)}}catch(e){this.onError(e)}}get instance(){return this._instance}set instance(e){this._instance!==e&&(this._instance=e,this.onChangeInstance(e))}get hasPreview(){return this._hasPreview}set hasPreview(e){this._hasPreview!==e&&(this._hasPreview=e,this.onChangeHasPreview(e))}}let B=0;function C(e,t={},i=null){const n=document.createElement(e);for(const[e,i]of Object.entries(t))n.setAttribute(e,i);if(Array.isArray(i))for(const e of i)e&&n.appendChild(e);else"string"==typeof i&&(n.innerText=i);return n}async function S(e,t=null){let i;return i=t?await j()({path:`/wp/v2/widgets/${e}?context=edit`,method:"PUT",data:{form_data:t}}):await j()({path:`/wp/v2/widgets/${e}?context=edit`,method:"GET"}),{form:i.rendered_form}}async function T({idBase:e,instance:t,number:i,formData:n=null}){const s=await j()({path:`/wp/v2/widget-types/${e}/encode`,method:"POST",data:{instance:t,number:i,form_data:n}});return{instance:s.instance,form:s.form,preview:s.preview}}function H(e){const t=document.createElement("div");return t.innerHTML=e,M(t)}function M(e){switch(e.nodeType){case e.TEXT_NODE:return""===e.nodeValue.trim();case e.ELEMENT_NODE:return!["AUDIO","CANVAS","EMBED","IFRAME","IMG","MATH","OBJECT","SVG","VIDEO"].includes(e.tagName)&&(!e.hasChildNodes()||Array.from(e.childNodes).every(M));default:return!0}}function I(e){return new window.URLSearchParams(Array.from(new window.FormData(e))).toString()}function V({title:e,isVisible:t,id:i,idBase:n,instance:s,isWide:o,onChangeInstance:a,onChangeHasPreview:c}){const l=(0,g.useRef)(),h=(0,_.useViewportMatch)("small"),m=(0,g.useRef)(new Set),p=(0,g.useRef)(new Set),{createNotice:b}=(0,f.useDispatch)(y.store);return(0,g.useEffect)((()=>{if(p.current.has(s))return void p.current.delete(s);const e=new k({id:i,idBase:n,instance:s,onChangeInstance(e){m.current.add(s),p.current.add(e),a(e)},onChangeHasPreview:c,onError(e){window.console.error(e),b("error",(0,w.sprintf)((0,w.__)('The "%s" block was affected by errors and may not function properly. Check the developer tools for more details.'),n||i))}});return l.current.appendChild(e.element),()=>{m.current.has(s)?m.current.delete(s):e.destroy()}}),[i,n,s,a,c,h]),o&&h?(0,r.jsxs)("div",{className:d({"wp-block-legacy-widget__container":t}),children:[t&&(0,r.jsx)("h3",{className:"wp-block-legacy-widget__edit-form-title",children:e}),(0,r.jsx)(u.Popover,{focusOnMount:!1,placement:"right",offset:32,resize:!1,flip:!1,shift:!0,children:(0,r.jsx)("div",{ref:l,className:"wp-block-legacy-widget__edit-form",hidden:!t})})]}):(0,r.jsx)("div",{ref:l,className:"wp-block-legacy-widget__edit-form",hidden:!t,children:(0,r.jsx)("h3",{className:"wp-block-legacy-widget__edit-form-title",children:e})})}function P({idBase:e,instance:t,isVisible:i}){const[n,s]=(0,g.useState)(!1),[o,a]=(0,g.useState)("");(0,g.useEffect)((()=>{const i=void 0===window.AbortController?void 0:new window.AbortController;return async function(){const n=`/wp/v2/widget-types/${e}/render`;return await j()({path:n,method:"POST",signal:i?.signal,data:t?{instance:t}:{}})}().then((e=>{a(e.preview)})).catch((e=>{if("AbortError"!==e.name)throw e})),()=>i?.abort()}),[e,t]);const c=(0,_.useRefEffect)((e=>{if(!n)return;function t(){const t=Math.max(e.contentDocument.documentElement?.offsetHeight??0,e.contentDocument.body?.offsetHeight??0);e.style.height=`${0!==t?t:100}px`}const{IntersectionObserver:i}=e.ownerDocument.defaultView,s=new i((([e])=>{e.isIntersecting&&t()}),{threshold:1});return s.observe(e),e.addEventListener("load",t),()=>{s.disconnect(),e.removeEventListener("load",t)}}),[n]);return(0,r.jsxs)(r.Fragment,{children:[i&&!n&&(0,r.jsx)(u.Placeholder,{children:(0,r.jsx)(u.Spinner,{})}),(0,r.jsx)("div",{className:d("wp-block-legacy-widget__edit-preview",{"is-offscreen":!i||!n}),children:(0,r.jsx)(u.Disabled,{children:(0,r.jsx)("iframe",{ref:c,className:"wp-block-legacy-widget__edit-preview-iframe",tabIndex:"-1",title:(0,w.__)("Legacy Widget Preview"),srcDoc:o,onLoad:e=>{e.target.contentDocument.body.style.overflow="hidden",s(!0)},height:100})})})]})}function E({name:e}){return(0,r.jsxs)("div",{className:"wp-block-legacy-widget__edit-no-preview",children:[e&&(0,r.jsx)("h3",{children:e}),(0,r.jsx)("p",{children:(0,w.__)("No preview available.")})]})}function F({clientId:e,rawInstance:t}){const{replaceBlocks:i}=(0,f.useDispatch)(h.store);return(0,r.jsx)(u.ToolbarButton,{onClick:()=>{t.title?i(e,[(0,s.createBlock)("core/heading",{content:t.title}),...(0,s.rawHandler)({HTML:t.text})]):i(e,(0,s.rawHandler)({HTML:t.text}))},children:(0,w.__)("Convert to blocks")})}function N({attributes:{id:e,idBase:t},setAttributes:i}){return(0,r.jsx)(u.Placeholder,{icon:(0,r.jsx)(h.BlockIcon,{icon:m}),label:(0,w.__)("Legacy Widget"),children:(0,r.jsx)(u.Flex,{children:(0,r.jsx)(u.FlexBlock,{children:(0,r.jsx)(b,{selectedId:e??t,onSelect:({selectedId:e,isMulti:t})=>{i(e?t?{id:null,idBase:e,instance:{}}:{id:e,idBase:null,instance:null}:{id:null,idBase:null,instance:null})}})})})})}function L({attributes:{id:e,idBase:t,instance:i},setAttributes:n,clientId:s,isSelected:o,isWide:a=!1}){const[c,l]=(0,g.useState)(null),d=e??t,{record:f,hasResolved:b}=(0,p.useEntityRecord)("root","widgetType",d),y=(0,g.useCallback)((e=>{n({instance:e})}),[]);if(!f&&b)return(0,r.jsx)(u.Placeholder,{icon:(0,r.jsx)(h.BlockIcon,{icon:m}),label:(0,w.__)("Legacy Widget"),children:(0,w.__)("Widget is missing.")});if(!b)return(0,r.jsx)(u.Placeholder,{children:(0,r.jsx)(u.Spinner,{})});const _=t&&!o?"preview":"edit";return(0,r.jsxs)(r.Fragment,{children:["text"===t&&(0,r.jsx)(h.BlockControls,{group:"other",children:(0,r.jsx)(F,{clientId:s,rawInstance:i.raw})}),(0,r.jsx)(h.InspectorControls,{children:(0,r.jsx)(v,{name:f.name,description:f.description})}),(0,r.jsx)(V,{title:f.name,isVisible:"edit"===_,id:e,idBase:t,instance:i,isWide:a,onChangeInstance:y,onChangeHasPreview:l}),t&&(0,r.jsxs)(r.Fragment,{children:[null===c&&"preview"===_&&(0,r.jsx)(u.Placeholder,{children:(0,r.jsx)(u.Spinner,{})}),!0===c&&(0,r.jsx)(P,{idBase:t,instance:i,isVisible:"preview"===_}),!1===c&&"preview"===_&&(0,r.jsx)(E,{name:f.name})]})]})}var D={to:[{block:"core/calendar",widget:"calendar"},{block:"core/search",widget:"search"},{block:"core/html",widget:"custom_html",transform:({content:e})=>({content:e})},{block:"core/archives",widget:"archives",transform:({count:e,dropdown:t})=>({displayAsDropdown:!!t,showPostCounts:!!e})},{block:"core/latest-posts",widget:"recent-posts",transform:({show_date:e,number:t})=>({displayPostDate:!!e,postsToShow:t})},{block:"core/latest-comments",widget:"recent-comments",transform:({number:e})=>({commentsToShow:e})},{block:"core/tag-cloud",widget:"tag_cloud",transform:({taxonomy:e,count:t})=>({showTagCounts:!!t,taxonomy:e})},{block:"core/categories",widget:"categories",transform:({count:e,dropdown:t,hierarchical:i})=>({displayAsDropdown:!!t,showPostCounts:!!e,showHierarchy:!!i})},{block:"core/audio",widget:"media_audio",transform:({url:e,preload:t,loop:i,attachment_id:n})=>({src:e,id:n,preload:t,loop:i})},{block:"core/video",widget:"media_video",transform:({url:e,preload:t,loop:i,attachment_id:n})=>({src:e,id:n,preload:t,loop:i})},{block:"core/image",widget:"media_image",transform:({alt:e,attachment_id:t,caption:i,height:n,link_classes:s,link_rel:r,link_target_blank:o,link_type:a,link_url:c,size:l,url:d,width:h})=>({alt:e,caption:i,height:n,id:t,link:c,linkClass:s,linkDestination:a,linkTarget:o?"_blank":void 0,rel:r,sizeSlug:l,url:d,width:h})},{block:"core/gallery",widget:"media_gallery",transform:({ids:e,link_type:t,size:i,number:n})=>({ids:e,columns:n,linkTo:t,sizeSlug:i,images:e.map((e=>({id:e})))})},{block:"core/rss",widget:"rss",transform:({url:e,show_author:t,show_date:i,show_summary:n,items:s})=>({feedURL:e,displayAuthor:!!t,displayDate:!!i,displayExcerpt:!!n,itemsToShow:s})}].map((({block:e,widget:t,transform:i})=>({type:"block",blocks:[e],isMatch:({idBase:e,instance:i})=>e===t&&!!i?.raw,transform:({instance:t})=>{const n=(0,s.createBlock)(e,i?i(t.raw):void 0);return t.raw?.title?[(0,s.createBlock)("core/heading",{content:t.raw.title}),n]:n}})))};const{name:W}=c,A={icon:a,edit:function(e){const{id:t,idBase:i}=e.attributes,{isWide:n=!1}=e,s=(0,h.useBlockProps)({className:d({"is-wide-widget":n})});return(0,r.jsx)("div",{...s,children:t||i?(0,r.jsx)(L,{...e}):(0,r.jsx)(N,{...e})})},transforms:D};var O=(0,r.jsx)(o.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,r.jsx)(o.Path,{d:"M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z"})});const z=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"core/widget-group","title":"Widget Group","category":"widgets","attributes":{"title":{"type":"string"}},"supports":{"html":false,"inserter":true,"customClassName":true,"reusable":false},"editorStyle":"wp-block-widget-group-editor","style":"wp-block-widget-group"}');function R({clientId:e}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.Placeholder,{className:"wp-block-widget-group__placeholder",icon:(0,r.jsx)(h.BlockIcon,{icon:O}),label:(0,w.__)("Widget Group"),children:(0,r.jsx)(h.ButtonBlockAppender,{rootClientId:e})}),(0,r.jsx)(h.InnerBlocks,{renderAppender:!1})]})}function G({attributes:e,setAttributes:t}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(h.RichText,{tagName:"h2",identifier:"title",className:"widget-title",allowedFormats:[],placeholder:(0,w.__)("Title"),value:e.title??"",onChange:e=>t({title:e})}),(0,r.jsx)(h.InnerBlocks,{})]})}var U=[{attributes:{title:{type:"string"}},supports:{html:!1,inserter:!0,customClassName:!0,reusable:!1},save:({attributes:e})=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(h.RichText.Content,{tagName:"h2",className:"widget-title",value:e.title}),(0,r.jsx)(h.InnerBlocks.Content,{})]})}];const{name:$}=z,Q={title:(0,w.__)("Widget Group"),description:(0,w.__)("Create a classic widget layout with a title that’s styled by your theme for your widget areas."),icon:O,__experimentalLabel:({name:e})=>e,edit:function(e){const{clientId:t}=e,{innerBlocks:i}=(0,f.useSelect)((e=>e(h.store).getBlock(t)),[t]);return(0,r.jsx)("div",{...(0,h.useBlockProps)({className:"widget"}),children:0===i.length?(0,r.jsx)(R,{...e}):(0,r.jsx)(G,{...e})})},save:function({attributes:e}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(h.RichText.Content,{tagName:"h2",className:"widget-title",value:e.title}),(0,r.jsx)("div",{className:"wp-widget-group__inner-blocks",children:(0,r.jsx)(h.InnerBlocks.Content,{})})]})},transforms:{from:[{type:"block",isMultiBlock:!0,blocks:["*"],isMatch:(e,t)=>!t.some((e=>"core/widget-group"===e.name)),__experimentalConvert(e){let t=[...e.map((e=>(0,s.createBlock)(e.name,e.attributes,e.innerBlocks)))];const i="core/heading"===t[0].name?t[0]:null;return t=t.filter((e=>e!==i)),(0,s.createBlock)("core/widget-group",{...i&&{title:i.attributes.content}},t)}}]},deprecated:U};var Z=(0,r.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,r.jsx)(o.Path,{d:"M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z"})});function J({currentWidgetAreaId:e,widgetAreas:t,onSelect:i}){return(0,r.jsx)(u.ToolbarGroup,{children:(0,r.jsx)(u.ToolbarItem,{children:n=>(0,r.jsx)(u.DropdownMenu,{icon:Z,label:(0,w.__)("Move to widget area"),toggleProps:n,children:({onClose:n})=>(0,r.jsx)(u.MenuGroup,{label:(0,w.__)("Move to"),children:(0,r.jsx)(u.MenuItemsChoice,{choices:t.map((e=>({value:e.id,label:e.name,info:e.description}))),value:e,onSelect:e=>{i(e),n()}})})})})})}function X(e){return e.attributes.__internalWidgetId}function q(e,t){return{...e,attributes:{...e.attributes||{},__internalWidgetId:t}}}function K(e){const t=(0,f.subscribe)((()=>{const i=e?.widgetTypesToHideFromLegacyWidgetBlock??[],n=(0,f.select)(p.store).getWidgetTypes({per_page:-1})?.filter((e=>!i.includes(e.id)));n&&(t(),(0,f.dispatch)(s.store).addBlockVariations("core/legacy-widget",n.map((e=>({name:e.id,title:e.name,description:e.description,attributes:e.is_multi?{idBase:e.id,instance:{}}:{id:e.id}})))))}))}function Y(e={}){const{yu:t,W0:n,UU:r}=i;(0,s.registerBlockType)({name:r,...t},{...n,supports:{...n.supports,...e}})}function ee(e={}){const{yu:t,W0:i,UU:r}=n;(0,s.registerBlockType)({name:r,...t},{...i,supports:{...i.supports,...e}})}(window.wp=window.wp||{}).widgets=t})(); annotations.js 0000644 00000037522 15151622574 0007460 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { store: () => (/* reexport */ store) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/annotations/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { __experimentalGetAllAnnotationsForBlock: () => (__experimentalGetAllAnnotationsForBlock), __experimentalGetAnnotations: () => (__experimentalGetAnnotations), __experimentalGetAnnotationsForBlock: () => (__experimentalGetAnnotationsForBlock), __experimentalGetAnnotationsForRichText: () => (__experimentalGetAnnotationsForRichText) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/annotations/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { __experimentalAddAnnotation: () => (__experimentalAddAnnotation), __experimentalRemoveAnnotation: () => (__experimentalRemoveAnnotation), __experimentalRemoveAnnotationsBySource: () => (__experimentalRemoveAnnotationsBySource), __experimentalUpdateAnnotationRange: () => (__experimentalUpdateAnnotationRange) }); ;// external ["wp","richText"] const external_wp_richText_namespaceObject = window["wp"]["richText"]; ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// ./node_modules/@wordpress/annotations/build-module/store/constants.js const STORE_NAME = "core/annotations"; ;// ./node_modules/@wordpress/annotations/build-module/format/annotation.js const FORMAT_NAME = "core/annotation"; const ANNOTATION_ATTRIBUTE_PREFIX = "annotation-text-"; function applyAnnotations(record, annotations = []) { annotations.forEach((annotation2) => { let { start, end } = annotation2; if (start > record.text.length) { start = record.text.length; } if (end > record.text.length) { end = record.text.length; } const className = ANNOTATION_ATTRIBUTE_PREFIX + annotation2.source; const id = ANNOTATION_ATTRIBUTE_PREFIX + annotation2.id; record = (0,external_wp_richText_namespaceObject.applyFormat)( record, { type: FORMAT_NAME, attributes: { className, id } }, start, end ); }); return record; } function removeAnnotations(record) { return removeFormat(record, "core/annotation", 0, record.text.length); } function retrieveAnnotationPositions(formats) { const positions = {}; formats.forEach((characterFormats, i) => { characterFormats = characterFormats || []; characterFormats = characterFormats.filter( (format) => format.type === FORMAT_NAME ); characterFormats.forEach((format) => { let { id } = format.attributes; id = id.replace(ANNOTATION_ATTRIBUTE_PREFIX, ""); if (!positions.hasOwnProperty(id)) { positions[id] = { start: i }; } positions[id].end = i + 1; }); }); return positions; } function updateAnnotationsWithPositions(annotations, positions, { removeAnnotation, updateAnnotationRange }) { annotations.forEach((currentAnnotation) => { const position = positions[currentAnnotation.id]; if (!position) { removeAnnotation(currentAnnotation.id); return; } const { start, end } = currentAnnotation; if (start !== position.start || end !== position.end) { updateAnnotationRange( currentAnnotation.id, position.start, position.end ); } }); } const annotation = { name: FORMAT_NAME, title: (0,external_wp_i18n_namespaceObject.__)("Annotation"), tagName: "mark", className: "annotation-text", attributes: { className: "class", id: "id" }, edit() { return null; }, __experimentalGetPropsForEditableTreePreparation(select, { richTextIdentifier, blockClientId }) { return { annotations: select( STORE_NAME ).__experimentalGetAnnotationsForRichText( blockClientId, richTextIdentifier ) }; }, __experimentalCreatePrepareEditableTree({ annotations }) { return (formats, text) => { if (annotations.length === 0) { return formats; } let record = { formats, text }; record = applyAnnotations(record, annotations); return record.formats; }; }, __experimentalGetPropsForEditableTreeChangeHandler(dispatch) { return { removeAnnotation: dispatch(STORE_NAME).__experimentalRemoveAnnotation, updateAnnotationRange: dispatch(STORE_NAME).__experimentalUpdateAnnotationRange }; }, __experimentalCreateOnChangeEditableValue(props) { return (formats) => { const positions = retrieveAnnotationPositions(formats); const { removeAnnotation, updateAnnotationRange, annotations } = props; updateAnnotationsWithPositions(annotations, positions, { removeAnnotation, updateAnnotationRange }); }; } }; ;// ./node_modules/@wordpress/annotations/build-module/format/index.js const { name: format_name, ...settings } = annotation; (0,external_wp_richText_namespaceObject.registerFormatType)(format_name, settings); ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// ./node_modules/@wordpress/annotations/build-module/block/index.js const addAnnotationClassName = (OriginalComponent) => { return (0,external_wp_data_namespaceObject.withSelect)((select, { clientId, className }) => { const annotations = select(STORE_NAME).__experimentalGetAnnotationsForBlock( clientId ); return { className: annotations.map((annotation) => { return "is-annotated-by-" + annotation.source; }).concat(className).filter(Boolean).join(" ") }; })(OriginalComponent); }; (0,external_wp_hooks_namespaceObject.addFilter)( "editor.BlockListBlock", "core/annotations", addAnnotationClassName ); ;// ./node_modules/@wordpress/annotations/build-module/store/reducer.js function filterWithReference(collection, predicate) { const filteredCollection = collection.filter(predicate); return collection.length === filteredCollection.length ? collection : filteredCollection; } const mapValues = (obj, callback) => Object.entries(obj).reduce( (acc, [key, value]) => ({ ...acc, [key]: callback(value) }), {} ); function isValidAnnotationRange(annotation) { return typeof annotation.start === "number" && typeof annotation.end === "number" && annotation.start <= annotation.end; } function annotations(state = {}, action) { switch (action.type) { case "ANNOTATION_ADD": const blockClientId = action.blockClientId; const newAnnotation = { id: action.id, blockClientId, richTextIdentifier: action.richTextIdentifier, source: action.source, selector: action.selector, range: action.range }; if (newAnnotation.selector === "range" && !isValidAnnotationRange(newAnnotation.range)) { return state; } const previousAnnotationsForBlock = state?.[blockClientId] ?? []; return { ...state, [blockClientId]: [ ...previousAnnotationsForBlock, newAnnotation ] }; case "ANNOTATION_REMOVE": return mapValues(state, (annotationsForBlock) => { return filterWithReference( annotationsForBlock, (annotation) => { return annotation.id !== action.annotationId; } ); }); case "ANNOTATION_UPDATE_RANGE": return mapValues(state, (annotationsForBlock) => { let hasChangedRange = false; const newAnnotations = annotationsForBlock.map( (annotation) => { if (annotation.id === action.annotationId) { hasChangedRange = true; return { ...annotation, range: { start: action.start, end: action.end } }; } return annotation; } ); return hasChangedRange ? newAnnotations : annotationsForBlock; }); case "ANNOTATION_REMOVE_SOURCE": return mapValues(state, (annotationsForBlock) => { return filterWithReference( annotationsForBlock, (annotation) => { return annotation.source !== action.source; } ); }); } return state; } var reducer_default = annotations; ;// ./node_modules/@wordpress/annotations/build-module/store/selectors.js const EMPTY_ARRAY = []; const __experimentalGetAnnotationsForBlock = (0,external_wp_data_namespaceObject.createSelector)( (state, blockClientId) => { return (state?.[blockClientId] ?? []).filter((annotation) => { return annotation.selector === "block"; }); }, (state, blockClientId) => [state?.[blockClientId] ?? EMPTY_ARRAY] ); function __experimentalGetAllAnnotationsForBlock(state, blockClientId) { return state?.[blockClientId] ?? EMPTY_ARRAY; } const __experimentalGetAnnotationsForRichText = (0,external_wp_data_namespaceObject.createSelector)( (state, blockClientId, richTextIdentifier) => { return (state?.[blockClientId] ?? []).filter((annotation) => { return annotation.selector === "range" && richTextIdentifier === annotation.richTextIdentifier; }).map((annotation) => { const { range, ...other } = annotation; return { ...range, ...other }; }); }, (state, blockClientId) => [state?.[blockClientId] ?? EMPTY_ARRAY] ); function __experimentalGetAnnotations(state) { return Object.values(state).flat(); } ;// ./node_modules/@wordpress/annotations/node_modules/uuid/dist/esm-browser/native.js const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); /* harmony default export */ const esm_browser_native = ({ randomUUID }); ;// ./node_modules/@wordpress/annotations/node_modules/uuid/dist/esm-browser/rng.js // Unique ID creation requires a high quality random # generator. In the browser we therefore // require the crypto API and do not support built-in fallback to lower quality random number // generators (like Math.random()). let getRandomValues; const rnds8 = new Uint8Array(16); function rng() { // lazy load so that environments that need to polyfill have a chance to do so if (!getRandomValues) { // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); if (!getRandomValues) { throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); } } return getRandomValues(rnds8); } ;// ./node_modules/@wordpress/annotations/node_modules/uuid/dist/esm-browser/stringify.js /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ const byteToHex = []; for (let i = 0; i < 256; ++i) { byteToHex.push((i + 0x100).toString(16).slice(1)); } function unsafeStringify(arr, offset = 0) { // Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; } function stringify(arr, offset = 0) { const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one // of the following: // - One or more input array values don't map to a hex octet (leading to // "undefined" in the uuid) // - Invalid input values for the RFC `version` or `variant` fields if (!validate(uuid)) { throw TypeError('Stringified UUID is invalid'); } return uuid; } /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify))); ;// ./node_modules/@wordpress/annotations/node_modules/uuid/dist/esm-browser/v4.js function v4(options, buf, offset) { if (esm_browser_native.randomUUID && !buf && !options) { return esm_browser_native.randomUUID(); } options = options || {}; const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = rnds[6] & 0x0f | 0x40; rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided if (buf) { offset = offset || 0; for (let i = 0; i < 16; ++i) { buf[offset + i] = rnds[i]; } return buf; } return unsafeStringify(rnds); } /* harmony default export */ const esm_browser_v4 = (v4); ;// ./node_modules/@wordpress/annotations/build-module/store/actions.js function __experimentalAddAnnotation({ blockClientId, richTextIdentifier = null, range = null, selector = "range", source = "default", id = esm_browser_v4() }) { const action = { type: "ANNOTATION_ADD", id, blockClientId, richTextIdentifier, source, selector }; if (selector === "range") { action.range = range; } return action; } function __experimentalRemoveAnnotation(annotationId) { return { type: "ANNOTATION_REMOVE", annotationId }; } function __experimentalUpdateAnnotationRange(annotationId, start, end) { return { type: "ANNOTATION_UPDATE_RANGE", annotationId, start, end }; } function __experimentalRemoveAnnotationsBySource(source) { return { type: "ANNOTATION_REMOVE_SOURCE", source }; } ;// ./node_modules/@wordpress/annotations/build-module/store/index.js const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { reducer: reducer_default, selectors: selectors_namespaceObject, actions: actions_namespaceObject }); (0,external_wp_data_namespaceObject.register)(store); ;// ./node_modules/@wordpress/annotations/build-module/index.js (window.wp = window.wp || {}).annotations = __webpack_exports__; /******/ })() ; api-fetch.js 0000644 00000037703 15151622574 0006764 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // EXPORTS __webpack_require__.d(__webpack_exports__, { "default": () => (/* binding */ index_default) }); ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// ./node_modules/@wordpress/api-fetch/build-module/middlewares/nonce.js function createNonceMiddleware(nonce) { const middleware = (options, next) => { const { headers = {} } = options; for (const headerName in headers) { if (headerName.toLowerCase() === "x-wp-nonce" && headers[headerName] === middleware.nonce) { return next(options); } } return next({ ...options, headers: { ...headers, "X-WP-Nonce": middleware.nonce } }); }; middleware.nonce = nonce; return middleware; } var nonce_default = createNonceMiddleware; ;// ./node_modules/@wordpress/api-fetch/build-module/middlewares/namespace-endpoint.js const namespaceAndEndpointMiddleware = (options, next) => { let path = options.path; let namespaceTrimmed, endpointTrimmed; if (typeof options.namespace === "string" && typeof options.endpoint === "string") { namespaceTrimmed = options.namespace.replace(/^\/|\/$/g, ""); endpointTrimmed = options.endpoint.replace(/^\//, ""); if (endpointTrimmed) { path = namespaceTrimmed + "/" + endpointTrimmed; } else { path = namespaceTrimmed; } } delete options.namespace; delete options.endpoint; return next({ ...options, path }); }; var namespace_endpoint_default = namespaceAndEndpointMiddleware; ;// ./node_modules/@wordpress/api-fetch/build-module/middlewares/root-url.js const createRootURLMiddleware = (rootURL) => (options, next) => { return namespace_endpoint_default(options, (optionsWithPath) => { let url = optionsWithPath.url; let path = optionsWithPath.path; let apiRoot; if (typeof path === "string") { apiRoot = rootURL; if (-1 !== rootURL.indexOf("?")) { path = path.replace("?", "&"); } path = path.replace(/^\//, ""); if ("string" === typeof apiRoot && -1 !== apiRoot.indexOf("?")) { path = path.replace("?", "&"); } url = apiRoot + path; } return next({ ...optionsWithPath, url }); }); }; var root_url_default = createRootURLMiddleware; ;// external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; ;// ./node_modules/@wordpress/api-fetch/build-module/middlewares/preloading.js function createPreloadingMiddleware(preloadedData) { const cache = Object.fromEntries( Object.entries(preloadedData).map(([path, data]) => [ (0,external_wp_url_namespaceObject.normalizePath)(path), data ]) ); return (options, next) => { const { parse = true } = options; let rawPath = options.path; if (!rawPath && options.url) { const { rest_route: pathFromQuery, ...queryArgs } = (0,external_wp_url_namespaceObject.getQueryArgs)( options.url ); if (typeof pathFromQuery === "string") { rawPath = (0,external_wp_url_namespaceObject.addQueryArgs)(pathFromQuery, queryArgs); } } if (typeof rawPath !== "string") { return next(options); } const method = options.method || "GET"; const path = (0,external_wp_url_namespaceObject.normalizePath)(rawPath); if ("GET" === method && cache[path]) { const cacheData = cache[path]; delete cache[path]; return prepareResponse(cacheData, !!parse); } else if ("OPTIONS" === method && cache[method] && cache[method][path]) { const cacheData = cache[method][path]; delete cache[method][path]; return prepareResponse(cacheData, !!parse); } return next(options); }; } function prepareResponse(responseData, parse) { if (parse) { return Promise.resolve(responseData.body); } try { return Promise.resolve( new window.Response(JSON.stringify(responseData.body), { status: 200, statusText: "OK", headers: responseData.headers }) ); } catch { Object.entries( responseData.headers ).forEach(([key, value]) => { if (key.toLowerCase() === "link") { responseData.headers[key] = value.replace( /<([^>]+)>/, (_, url) => `<${encodeURI(url)}>` ); } }); return Promise.resolve( parse ? responseData.body : new window.Response(JSON.stringify(responseData.body), { status: 200, statusText: "OK", headers: responseData.headers }) ); } } var preloading_default = createPreloadingMiddleware; ;// ./node_modules/@wordpress/api-fetch/build-module/middlewares/fetch-all-middleware.js const modifyQuery = ({ path, url, ...options }, queryArgs) => ({ ...options, url: url && (0,external_wp_url_namespaceObject.addQueryArgs)(url, queryArgs), path: path && (0,external_wp_url_namespaceObject.addQueryArgs)(path, queryArgs) }); const parseResponse = (response) => response.json ? response.json() : Promise.reject(response); const parseLinkHeader = (linkHeader) => { if (!linkHeader) { return {}; } const match = linkHeader.match(/<([^>]+)>; rel="next"/); return match ? { next: match[1] } : {}; }; const getNextPageUrl = (response) => { const { next } = parseLinkHeader(response.headers.get("link")); return next; }; const requestContainsUnboundedQuery = (options) => { const pathIsUnbounded = !!options.path && options.path.indexOf("per_page=-1") !== -1; const urlIsUnbounded = !!options.url && options.url.indexOf("per_page=-1") !== -1; return pathIsUnbounded || urlIsUnbounded; }; const fetchAllMiddleware = async (options, next) => { if (options.parse === false) { return next(options); } if (!requestContainsUnboundedQuery(options)) { return next(options); } const response = await index_default({ ...modifyQuery(options, { per_page: 100 }), // Ensure headers are returned for page 1. parse: false }); const results = await parseResponse(response); if (!Array.isArray(results)) { return results; } let nextPage = getNextPageUrl(response); if (!nextPage) { return results; } let mergedResults = [].concat(results); while (nextPage) { const nextResponse = await index_default({ ...options, // Ensure the URL for the next page is used instead of any provided path. path: void 0, url: nextPage, // Ensure we still get headers so we can identify the next page. parse: false }); const nextResults = await parseResponse(nextResponse); mergedResults = mergedResults.concat(nextResults); nextPage = getNextPageUrl(nextResponse); } return mergedResults; }; var fetch_all_middleware_default = fetchAllMiddleware; ;// ./node_modules/@wordpress/api-fetch/build-module/middlewares/http-v1.js const OVERRIDE_METHODS = /* @__PURE__ */ new Set(["PATCH", "PUT", "DELETE"]); const DEFAULT_METHOD = "GET"; const httpV1Middleware = (options, next) => { const { method = DEFAULT_METHOD } = options; if (OVERRIDE_METHODS.has(method.toUpperCase())) { options = { ...options, headers: { ...options.headers, "X-HTTP-Method-Override": method, "Content-Type": "application/json" }, method: "POST" }; } return next(options); }; var http_v1_default = httpV1Middleware; ;// ./node_modules/@wordpress/api-fetch/build-module/middlewares/user-locale.js const userLocaleMiddleware = (options, next) => { if (typeof options.url === "string" && !(0,external_wp_url_namespaceObject.hasQueryArg)(options.url, "_locale")) { options.url = (0,external_wp_url_namespaceObject.addQueryArgs)(options.url, { _locale: "user" }); } if (typeof options.path === "string" && !(0,external_wp_url_namespaceObject.hasQueryArg)(options.path, "_locale")) { options.path = (0,external_wp_url_namespaceObject.addQueryArgs)(options.path, { _locale: "user" }); } return next(options); }; var user_locale_default = userLocaleMiddleware; ;// ./node_modules/@wordpress/api-fetch/build-module/utils/response.js async function parseJsonAndNormalizeError(response) { try { return await response.json(); } catch { throw { code: "invalid_json", message: (0,external_wp_i18n_namespaceObject.__)("The response is not a valid JSON response.") }; } } async function parseResponseAndNormalizeError(response, shouldParseResponse = true) { if (!shouldParseResponse) { return response; } if (response.status === 204) { return null; } return await parseJsonAndNormalizeError(response); } async function parseAndThrowError(response, shouldParseResponse = true) { if (!shouldParseResponse) { throw response; } throw await parseJsonAndNormalizeError(response); } ;// ./node_modules/@wordpress/api-fetch/build-module/middlewares/media-upload.js function isMediaUploadRequest(options) { const isCreateMethod = !!options.method && options.method === "POST"; const isMediaEndpoint = !!options.path && options.path.indexOf("/wp/v2/media") !== -1 || !!options.url && options.url.indexOf("/wp/v2/media") !== -1; return isMediaEndpoint && isCreateMethod; } const mediaUploadMiddleware = (options, next) => { if (!isMediaUploadRequest(options)) { return next(options); } let retries = 0; const maxRetries = 5; const postProcess = (attachmentId) => { retries++; return next({ path: `/wp/v2/media/${attachmentId}/post-process`, method: "POST", data: { action: "create-image-subsizes" }, parse: false }).catch(() => { if (retries < maxRetries) { return postProcess(attachmentId); } next({ path: `/wp/v2/media/${attachmentId}?force=true`, method: "DELETE" }); return Promise.reject(); }); }; return next({ ...options, parse: false }).catch((response) => { if (!(response instanceof globalThis.Response)) { return Promise.reject(response); } const attachmentId = response.headers.get( "x-wp-upload-attachment-id" ); if (response.status >= 500 && response.status < 600 && attachmentId) { return postProcess(attachmentId).catch(() => { if (options.parse !== false) { return Promise.reject({ code: "post_process", message: (0,external_wp_i18n_namespaceObject.__)( "Media upload failed. If this is a photo or a large image, please scale it down and try again." ) }); } return Promise.reject(response); }); } return parseAndThrowError(response, options.parse); }).then( (response) => parseResponseAndNormalizeError(response, options.parse) ); }; var media_upload_default = mediaUploadMiddleware; ;// ./node_modules/@wordpress/api-fetch/build-module/middlewares/theme-preview.js const createThemePreviewMiddleware = (themePath) => (options, next) => { if (typeof options.url === "string") { const wpThemePreview = (0,external_wp_url_namespaceObject.getQueryArg)( options.url, "wp_theme_preview" ); if (wpThemePreview === void 0) { options.url = (0,external_wp_url_namespaceObject.addQueryArgs)(options.url, { wp_theme_preview: themePath }); } else if (wpThemePreview === "") { options.url = (0,external_wp_url_namespaceObject.removeQueryArgs)( options.url, "wp_theme_preview" ); } } if (typeof options.path === "string") { const wpThemePreview = (0,external_wp_url_namespaceObject.getQueryArg)( options.path, "wp_theme_preview" ); if (wpThemePreview === void 0) { options.path = (0,external_wp_url_namespaceObject.addQueryArgs)(options.path, { wp_theme_preview: themePath }); } else if (wpThemePreview === "") { options.path = (0,external_wp_url_namespaceObject.removeQueryArgs)( options.path, "wp_theme_preview" ); } } return next(options); }; var theme_preview_default = createThemePreviewMiddleware; ;// ./node_modules/@wordpress/api-fetch/build-module/index.js const DEFAULT_HEADERS = { // The backend uses the Accept header as a condition for considering an // incoming request as a REST request. // // See: https://core.trac.wordpress.org/ticket/44534 Accept: "application/json, */*;q=0.1" }; const DEFAULT_OPTIONS = { credentials: "include" }; const middlewares = [ user_locale_default, namespace_endpoint_default, http_v1_default, fetch_all_middleware_default ]; function registerMiddleware(middleware) { middlewares.unshift(middleware); } const defaultFetchHandler = (nextOptions) => { const { url, path, data, parse = true, ...remainingOptions } = nextOptions; let { body, headers } = nextOptions; headers = { ...DEFAULT_HEADERS, ...headers }; if (data) { body = JSON.stringify(data); headers["Content-Type"] = "application/json"; } const responsePromise = globalThis.fetch( // Fall back to explicitly passing `window.location` which is the behavior if `undefined` is passed. url || path || window.location.href, { ...DEFAULT_OPTIONS, ...remainingOptions, body, headers } ); return responsePromise.then( (response) => { if (!response.ok) { return parseAndThrowError(response, parse); } return parseResponseAndNormalizeError(response, parse); }, (err) => { if (err && err.name === "AbortError") { throw err; } if (!globalThis.navigator.onLine) { throw { code: "offline_error", message: (0,external_wp_i18n_namespaceObject.__)( "Unable to connect. Please check your Internet connection." ) }; } throw { code: "fetch_error", message: (0,external_wp_i18n_namespaceObject.__)( "Could not get a valid response from the server." ) }; } ); }; let fetchHandler = defaultFetchHandler; function setFetchHandler(newFetchHandler) { fetchHandler = newFetchHandler; } const apiFetch = (options) => { const enhancedHandler = middlewares.reduceRight( (next, middleware) => { return (workingOptions) => middleware(workingOptions, next); }, fetchHandler ); return enhancedHandler(options).catch((error) => { if (error.code !== "rest_cookie_invalid_nonce") { return Promise.reject(error); } return globalThis.fetch(apiFetch.nonceEndpoint).then((response) => { if (!response.ok) { return Promise.reject(error); } return response.text(); }).then((text) => { apiFetch.nonceMiddleware.nonce = text; return apiFetch(options); }); }); }; apiFetch.use = registerMiddleware; apiFetch.setFetchHandler = setFetchHandler; apiFetch.createNonceMiddleware = nonce_default; apiFetch.createPreloadingMiddleware = preloading_default; apiFetch.createRootURLMiddleware = root_url_default; apiFetch.fetchAllMiddleware = fetch_all_middleware_default; apiFetch.mediaUploadMiddleware = media_upload_default; apiFetch.createThemePreviewMiddleware = theme_preview_default; var index_default = apiFetch; (window.wp = window.wp || {}).apiFetch = __webpack_exports__["default"]; /******/ })() ; wordcount.js 0000644 00000032404 15151622574 0007141 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 677: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ stripTags) /* harmony export */ }); function stripTags(settings, text) { return text.replace(settings.HTMLRegExp, "\n"); } /***/ }), /***/ 2125: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ transposeAstralsToCountableChar) /* harmony export */ }); function transposeAstralsToCountableChar(settings, text) { return text.replace(settings.astralRegExp, "a"); } /***/ }), /***/ 3608: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ stripConnectors) /* harmony export */ }); function stripConnectors(settings, text) { return text.replace(settings.connectorRegExp, " "); } /***/ }), /***/ 4516: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ stripShortcodes) /* harmony export */ }); function stripShortcodes(settings, text) { if (settings.shortcodesRegExp) { return text.replace(settings.shortcodesRegExp, "\n"); } return text; } /***/ }), /***/ 4579: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ stripHTMLComments) /* harmony export */ }); function stripHTMLComments(settings, text) { return text.replace(settings.HTMLcommentRegExp, ""); } /***/ }), /***/ 4846: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ stripHTMLEntities) /* harmony export */ }); function stripHTMLEntities(settings, text) { return text.replace(settings.HTMLEntityRegExp, ""); } /***/ }), /***/ 6019: /***/ (() => { /***/ }), /***/ 6542: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ stripRemovables) /* harmony export */ }); function stripRemovables(settings, text) { return text.replace(settings.removeRegExp, ""); } /***/ }), /***/ 7742: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ L: () => (/* binding */ defaultSettings) /* harmony export */ }); const defaultSettings = { HTMLRegExp: /<\/?[a-z][^>]*?>/gi, HTMLcommentRegExp: /<!--[\s\S]*?-->/g, spaceRegExp: / | /gi, HTMLEntityRegExp: /&\S+?;/g, // \u2014 = em-dash. connectorRegExp: /--|\u2014/g, // Characters to be removed from input text. removeRegExp: new RegExp( [ "[", // Basic Latin (extract) "!-/:-@[-`{-~", // Latin-1 Supplement (extract) "\x80-\xBF\xD7\xF7", /* * The following range consists of: * General Punctuation * Superscripts and Subscripts * Currency Symbols * Combining Diacritical Marks for Symbols * Letterlike Symbols * Number Forms * Arrows * Mathematical Operators * Miscellaneous Technical * Control Pictures * Optical Character Recognition * Enclosed Alphanumerics * Box Drawing * Block Elements * Geometric Shapes * Miscellaneous Symbols * Dingbats * Miscellaneous Mathematical Symbols-A * Supplemental Arrows-A * Braille Patterns * Supplemental Arrows-B * Miscellaneous Mathematical Symbols-B * Supplemental Mathematical Operators * Miscellaneous Symbols and Arrows */ "\u2000-\u2BFF", // Supplemental Punctuation. "\u2E00-\u2E7F", "]" ].join(""), "g" ), // Remove UTF-16 surrogate points, see https://en.wikipedia.org/wiki/UTF-16#U.2BD800_to_U.2BDFFF astralRegExp: /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, wordsRegExp: /\S\s+/g, characters_excluding_spacesRegExp: /\S/g, /* * Match anything that is not a formatting character, excluding: * \f = form feed * \n = new line * \r = carriage return * \t = tab * \v = vertical tab * \u00AD = soft hyphen * \u2028 = line separator * \u2029 = paragraph separator */ characters_including_spacesRegExp: /[^\f\n\r\t\v\u00AD\u2028\u2029]/g, l10n: { type: "words" } }; /***/ }), /***/ 8026: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ transposeHTMLEntitiesToCountableChars) /* harmony export */ }); function transposeHTMLEntitiesToCountableChars(settings, text) { return text.replace(settings.HTMLEntityRegExp, "a"); } /***/ }), /***/ 8511: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ stripSpaces) /* harmony export */ }); function stripSpaces(settings, text) { return text.replace(settings.spaceRegExp, " "); } /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. (() => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ count: () => (/* binding */ count) /* harmony export */ }); /* harmony import */ var _defaultSettings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7742); /* harmony import */ var _stripTags__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(677); /* harmony import */ var _transposeAstralsToCountableChar__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2125); /* harmony import */ var _stripHTMLEntities__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4846); /* harmony import */ var _stripConnectors__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(3608); /* harmony import */ var _stripRemovables__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6542); /* harmony import */ var _stripHTMLComments__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4579); /* harmony import */ var _stripShortcodes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4516); /* harmony import */ var _stripSpaces__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8511); /* harmony import */ var _transposeHTMLEntitiesToCountableChars__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(8026); /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(6019); /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_types__WEBPACK_IMPORTED_MODULE_10__); /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _types__WEBPACK_IMPORTED_MODULE_10__) if(["default","count"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _types__WEBPACK_IMPORTED_MODULE_10__[__WEBPACK_IMPORT_KEY__] /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); function loadSettings(type = "words", userSettings = {}) { const mergedSettings = { ..._defaultSettings__WEBPACK_IMPORTED_MODULE_0__/* .defaultSettings */ .L, ...userSettings }; const settings = { ...mergedSettings, type, shortcodes: [] }; settings.shortcodes = settings.l10n?.shortcodes ?? []; if (settings.shortcodes && settings.shortcodes.length) { settings.shortcodesRegExp = new RegExp( "\\[\\/?(?:" + settings.shortcodes.join("|") + ")[^\\]]*?\\]", "g" ); } if (settings.type !== "characters_excluding_spaces" && settings.type !== "characters_including_spaces") { settings.type = "words"; } return settings; } function countWords(text, regex, settings) { text = [ _stripTags__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.bind(null, settings), _stripHTMLComments__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A.bind(null, settings), _stripShortcodes__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A.bind(null, settings), _stripSpaces__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A.bind(null, settings), _stripHTMLEntities__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.bind(null, settings), _stripConnectors__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .A.bind(null, settings), _stripRemovables__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A.bind(null, settings) ].reduce((result, fn) => fn(result), text); text = text + "\n"; return text.match(regex)?.length ?? 0; } function countCharacters(text, regex, settings) { text = [ _stripTags__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.bind(null, settings), _stripHTMLComments__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A.bind(null, settings), _stripShortcodes__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A.bind(null, settings), _transposeAstralsToCountableChar__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .A.bind(null, settings), _stripSpaces__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A.bind(null, settings), _transposeHTMLEntitiesToCountableChars__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .A.bind(null, settings) ].reduce((result, fn) => fn(result), text); text = text + "\n"; return text.match(regex)?.length ?? 0; } function count(text, type, userSettings) { const settings = loadSettings(type, userSettings); let matchRegExp; switch (settings.type) { case "words": matchRegExp = settings.wordsRegExp; return countWords(text, matchRegExp, settings); case "characters_including_spaces": matchRegExp = settings.characters_including_spacesRegExp; return countCharacters(text, matchRegExp, settings); case "characters_excluding_spaces": matchRegExp = settings.characters_excluding_spacesRegExp; return countCharacters(text, matchRegExp, settings); default: return 0; } } })(); (window.wp = window.wp || {}).wordcount = __webpack_exports__; /******/ })() ; annotations.min.js 0000644 00000012301 15151622574 0010226 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{store:()=>C});var n={};t.r(n),t.d(n,{__experimentalGetAllAnnotationsForBlock:()=>x,__experimentalGetAnnotations:()=>N,__experimentalGetAnnotationsForBlock:()=>y,__experimentalGetAnnotationsForRichText:()=>T});var r={};t.r(r),t.d(r,{__experimentalAddAnnotation:()=>v,__experimentalRemoveAnnotation:()=>U,__experimentalRemoveAnnotationsBySource:()=>k,__experimentalUpdateAnnotationRange:()=>S});const o=window.wp.richText,a=window.wp.i18n,i="core/annotations",c="core/annotation",s="annotation-text-";const l={name:c,title:(0,a.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit:()=>null,__experimentalGetPropsForEditableTreePreparation:(t,{richTextIdentifier:e,blockClientId:n})=>({annotations:t(i).__experimentalGetAnnotationsForRichText(n,e)}),__experimentalCreatePrepareEditableTree:({annotations:t})=>(e,n)=>{if(0===t.length)return e;let r={formats:e,text:n};return r=function(t,e=[]){return e.forEach((e=>{let{start:n,end:r}=e;n>t.text.length&&(n=t.text.length),r>t.text.length&&(r=t.text.length);const a=s+e.source,i=s+e.id;t=(0,o.applyFormat)(t,{type:c,attributes:{className:a,id:i}},n,r)})),t}(r,t),r.formats},__experimentalGetPropsForEditableTreeChangeHandler:t=>({removeAnnotation:t(i).__experimentalRemoveAnnotation,updateAnnotationRange:t(i).__experimentalUpdateAnnotationRange}),__experimentalCreateOnChangeEditableValue:t=>e=>{const n=function(t){const e={};return t.forEach(((t,n)=>{(t=(t=t||[]).filter((t=>t.type===c))).forEach((t=>{let{id:r}=t.attributes;r=r.replace(s,""),e.hasOwnProperty(r)||(e[r]={start:n}),e[r].end=n+1}))})),e}(e),{removeAnnotation:r,updateAnnotationRange:o,annotations:a}=t;!function(t,e,{removeAnnotation:n,updateAnnotationRange:r}){t.forEach((t=>{const o=e[t.id];if(!o)return void n(t.id);const{start:a,end:i}=t;a===o.start&&i===o.end||r(t.id,o.start,o.end)}))}(a,n,{removeAnnotation:r,updateAnnotationRange:o})}},{name:d,...u}=l;(0,o.registerFormatType)(d,u);const p=window.wp.hooks,m=window.wp.data;function f(t,e){const n=t.filter(e);return t.length===n.length?t:n}(0,p.addFilter)("editor.BlockListBlock","core/annotations",(t=>(0,m.withSelect)(((t,{clientId:e,className:n})=>({className:t(i).__experimentalGetAnnotationsForBlock(e).map((t=>"is-annotated-by-"+t.source)).concat(n).filter(Boolean).join(" ")})))(t)));const _=(t,e)=>Object.entries(t).reduce(((t,[n,r])=>({...t,[n]:e(r)})),{});var A=function(t={},e){switch(e.type){case"ANNOTATION_ADD":const n=e.blockClientId,r={id:e.id,blockClientId:n,richTextIdentifier:e.richTextIdentifier,source:e.source,selector:e.selector,range:e.range};if("range"===r.selector&&!function(t){return"number"==typeof t.start&&"number"==typeof t.end&&t.start<=t.end}(r.range))return t;const o=t?.[n]??[];return{...t,[n]:[...o,r]};case"ANNOTATION_REMOVE":return _(t,(t=>f(t,(t=>t.id!==e.annotationId))));case"ANNOTATION_UPDATE_RANGE":return _(t,(t=>{let n=!1;const r=t.map((t=>t.id===e.annotationId?(n=!0,{...t,range:{start:e.start,end:e.end}}):t));return n?r:t}));case"ANNOTATION_REMOVE_SOURCE":return _(t,(t=>f(t,(t=>t.source!==e.source))))}return t};const g=[],y=(0,m.createSelector)(((t,e)=>(t?.[e]??[]).filter((t=>"block"===t.selector))),((t,e)=>[t?.[e]??g]));function x(t,e){return t?.[e]??g}const T=(0,m.createSelector)(((t,e,n)=>(t?.[e]??[]).filter((t=>"range"===t.selector&&n===t.richTextIdentifier)).map((t=>{const{range:e,...n}=t;return{...e,...n}}))),((t,e)=>[t?.[e]??g]));function N(t){return Object.values(t).flat()}const h={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let O;const b=new Uint8Array(16);function I(){if(!O&&(O="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!O))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return O(b)}const w=[];for(let t=0;t<256;++t)w.push((t+256).toString(16).slice(1));function E(t,e=0){return w[t[e+0]]+w[t[e+1]]+w[t[e+2]]+w[t[e+3]]+"-"+w[t[e+4]]+w[t[e+5]]+"-"+w[t[e+6]]+w[t[e+7]]+"-"+w[t[e+8]]+w[t[e+9]]+"-"+w[t[e+10]]+w[t[e+11]]+w[t[e+12]]+w[t[e+13]]+w[t[e+14]]+w[t[e+15]]}const R=function(t,e,n){if(h.randomUUID&&!e&&!t)return h.randomUUID();const r=(t=t||{}).random||(t.rng||I)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(let t=0;t<16;++t)e[n+t]=r[t];return e}return E(r)};function v({blockClientId:t,richTextIdentifier:e=null,range:n=null,selector:r="range",source:o="default",id:a=R()}){const i={type:"ANNOTATION_ADD",id:a,blockClientId:t,richTextIdentifier:e,source:o,selector:r};return"range"===r&&(i.range=n),i}function U(t){return{type:"ANNOTATION_REMOVE",annotationId:t}}function S(t,e,n){return{type:"ANNOTATION_UPDATE_RANGE",annotationId:t,start:e,end:n}}function k(t){return{type:"ANNOTATION_REMOVE_SOURCE",source:t}}const C=(0,m.createReduxStore)(i,{reducer:A,selectors:n,actions:r});(0,m.register)(C),(window.wp=window.wp||{}).annotations=e})(); edit-site.min.js 0000644 00002570403 15151622574 0007576 0 ustar 00 /*! This file is auto-generated */ (()=>{var e,t,n={66:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)};var n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function s(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map((function(e){return s(e,n)}))}function r(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function a(e,t){try{return t in e}catch(e){return!1}}function o(e,t,n){var i={};return n.isMergeableObject(e)&&r(e).forEach((function(t){i[t]=s(e[t],n)})),r(t).forEach((function(r){(function(e,t){return a(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,r)||(a(e,r)&&n.isMergeableObject(t[r])?i[r]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(r,n)(e[r],t[r],n):i[r]=s(t[r],n))})),i}function l(e,n,r){(r=r||{}).arrayMerge=r.arrayMerge||i,r.isMergeableObject=r.isMergeableObject||t,r.cloneUnlessOtherwiseSpecified=s;var a=Array.isArray(n);return a===Array.isArray(e)?a?r.arrayMerge(e,n,r):o(e,n,r):s(n,r)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var c=l;e.exports=c},83:(e,t,n)=>{"use strict"; /** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var s=n(1609);var i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=s.useState,a=s.useEffect,o=s.useLayoutEffect,l=s.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),s=r({inst:{value:n,getSnapshot:t}}),i=s[0].inst,u=s[1];return o((function(){i.value=n,i.getSnapshot=t,c(i)&&u({inst:i})}),[e,n,t]),a((function(){return c(i)&&u({inst:i}),e((function(){c(i)&&u({inst:i})}))}),[e]),l(n),n};t.useSyncExternalStore=void 0!==s.useSyncExternalStore?s.useSyncExternalStore:u},422:(e,t,n)=>{"use strict";e.exports=n(83)},1233:e=>{"use strict";e.exports=window.wp.preferences},1609:e=>{"use strict";e.exports=window.React},4660:e=>{e.exports=function(){function e(t,n,s){function i(a,o){if(!n[a]){if(!t[a]){if(r)return r(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,(function(e){return i(t[a][1][e]||e)}),c,c.exports,e,t,n,s)}return n[a].exports}for(var r=void 0,a=0;a<s.length;a++)i(s[a]);return i}return e}()({1:[function(e,t,n){"use strict";var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var s in n)i(n,s)&&(e[s]=n[s])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,n,s,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+s),i);else for(var r=0;r<s;r++)e[i+r]=t[n+r]},flattenChunks:function(e){var t,n,s,i,r,a;for(s=0,t=0,n=e.length;t<n;t++)s+=e[t].length;for(a=new Uint8Array(s),i=0,t=0,n=e.length;t<n;t++)r=e[t],a.set(r,i),i+=r.length;return a}},a={arraySet:function(e,t,n,s,i){for(var r=0;r<s;r++)e[i+r]=t[n+r]},flattenChunks:function(e){return[].concat.apply([],e)}};n.setTyped=function(e){e?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,r)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,a))},n.setTyped(s)},{}],2:[function(e,t,n){"use strict";var s=e("./common"),i=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){r=!1}for(var a=new s.Buf8(256),o=0;o<256;o++)a[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function l(e,t){if(t<65534&&(e.subarray&&r||!e.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(e,t));for(var n="",a=0;a<t;a++)n+=String.fromCharCode(e[a]);return n}a[254]=a[254]=1,n.string2buf=function(e){var t,n,i,r,a,o=e.length,l=0;for(r=0;r<o;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<o&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=new s.Buf8(l),a=0,r=0;a<l;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<o&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|63&n):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|63&n):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new s.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t},n.buf2string=function(e,t){var n,s,i,r,o=t||e.length,c=new Array(2*o);for(s=0,n=0;n<o;)if((i=e[n++])<128)c[s++]=i;else if((r=a[i])>4)c[s++]=65533,n+=r-1;else{for(i&=2===r?31:3===r?15:7;r>1&&n<o;)i=i<<6|63&e[n++],r--;r>1?c[s++]=65533:i<65536?c[s++]=i:(i-=65536,c[s++]=55296|i>>10&1023,c[s++]=56320|1023&i)}return l(c,s)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t}},{"./common":1}],3:[function(e,t,n){"use strict";function s(e,t,n,s){for(var i=65535&e,r=e>>>16&65535,a=0;0!==n;){n-=a=n>2e3?2e3:n;do{r=r+(i=i+t[s++]|0)|0}while(--a);i%=65521,r%=65521}return i|r<<16}t.exports=s},{}],4:[function(e,t,n){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(e,t,n){"use strict";function s(){for(var e,t=[],n=0;n<256;n++){e=n;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}var i=s();function r(e,t,n,s){var r=i,a=s+n;e^=-1;for(var o=s;o<a;o++)e=e>>>8^r[255&(e^t[o])];return~e}t.exports=r},{}],6:[function(e,t,n){"use strict";function s(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}t.exports=s},{}],7:[function(e,t,n){"use strict";var s=30,i=12;t.exports=function(e,t){var n,r,a,o,l,c,u,d,h,p,f,m,g,v,y,x,b,w,_,j,S,C,k,E,P;n=e.state,r=e.next_in,E=e.input,a=r+(e.avail_in-5),o=e.next_out,P=e.output,l=o-(t-e.avail_out),c=o+(e.avail_out-257),u=n.dmax,d=n.wsize,h=n.whave,p=n.wnext,f=n.window,m=n.hold,g=n.bits,v=n.lencode,y=n.distcode,x=(1<<n.lenbits)-1,b=(1<<n.distbits)-1;e:do{g<15&&(m+=E[r++]<<g,g+=8,m+=E[r++]<<g,g+=8),w=v[m&x];t:for(;;){if(m>>>=_=w>>>24,g-=_,0==(_=w>>>16&255))P[o++]=65535&w;else{if(!(16&_)){if(64&_){if(32&_){n.mode=i;break e}e.msg="invalid literal/length code",n.mode=s;break e}w=v[(65535&w)+(m&(1<<_)-1)];continue t}for(j=65535&w,(_&=15)&&(g<_&&(m+=E[r++]<<g,g+=8),j+=m&(1<<_)-1,m>>>=_,g-=_),g<15&&(m+=E[r++]<<g,g+=8,m+=E[r++]<<g,g+=8),w=y[m&b];;){if(m>>>=_=w>>>24,g-=_,16&(_=w>>>16&255)){if(S=65535&w,g<(_&=15)&&(m+=E[r++]<<g,(g+=8)<_&&(m+=E[r++]<<g,g+=8)),(S+=m&(1<<_)-1)>u){e.msg="invalid distance too far back",n.mode=s;break e}if(m>>>=_,g-=_,S>(_=o-l)){if((_=S-_)>h&&n.sane){e.msg="invalid distance too far back",n.mode=s;break e}if(C=0,k=f,0===p){if(C+=d-_,_<j){j-=_;do{P[o++]=f[C++]}while(--_);C=o-S,k=P}}else if(p<_){if(C+=d+p-_,(_-=p)<j){j-=_;do{P[o++]=f[C++]}while(--_);if(C=0,p<j){j-=_=p;do{P[o++]=f[C++]}while(--_);C=o-S,k=P}}}else if(C+=p-_,_<j){j-=_;do{P[o++]=f[C++]}while(--_);C=o-S,k=P}for(;j>2;)P[o++]=k[C++],P[o++]=k[C++],P[o++]=k[C++],j-=3;j&&(P[o++]=k[C++],j>1&&(P[o++]=k[C++]))}else{C=o-S;do{P[o++]=P[C++],P[o++]=P[C++],P[o++]=P[C++],j-=3}while(j>2);j&&(P[o++]=P[C++],j>1&&(P[o++]=P[C++]))}break}if(64&_){e.msg="invalid distance code",n.mode=s;break e}w=y[(65535&w)+(m&(1<<_)-1)]}}break}}while(r<a&&o<c);r-=j=g>>3,m&=(1<<(g-=j<<3))-1,e.next_in=r,e.next_out=o,e.avail_in=r<a?a-r+5:5-(r-a),e.avail_out=o<c?c-o+257:257-(o-c),n.hold=m,n.bits=g}},{}],8:[function(e,t,n){"use strict";var s=e("../utils/common"),i=e("./adler32"),r=e("./crc32"),a=e("./inffast"),o=e("./inftrees"),l=0,c=1,u=2,d=4,h=5,p=6,f=0,m=1,g=2,v=-2,y=-3,x=-4,b=-5,w=8,_=1,j=2,S=3,C=4,k=5,E=6,P=7,I=8,V=9,O=10,T=11,A=12,N=13,F=14,M=15,B=16,D=17,R=18,L=19,z=20,H=21,G=22,W=23,U=24,q=25,Z=26,Y=27,K=28,X=29,Q=30,J=31,$=852,ee=592,te=15;function ne(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function se(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ie(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=_,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new s.Buf32($),t.distcode=t.distdyn=new s.Buf32(ee),t.sane=1,t.back=-1,f):v}function re(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ie(e)):v}function ae(e,t){var n,s;return e&&e.state?(s=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?v:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=n,s.wbits=t,re(e))):v}function oe(e,t){var n,s;return e?(s=new se,e.state=s,s.window=null,(n=ae(e,t))!==f&&(e.state=null),n):v}function le(e){return oe(e,te)}var ce,ue,de=!0;function he(e){if(de){var t;for(ce=new s.Buf32(512),ue=new s.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(o(c,e.lens,0,288,ce,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;o(u,e.lens,0,32,ue,0,e.work,{bits:5}),de=!1}e.lencode=ce,e.lenbits=9,e.distcode=ue,e.distbits=5}function pe(e,t,n,i){var r,a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new s.Buf8(a.wsize)),i>=a.wsize?(s.arraySet(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((r=a.wsize-a.wnext)>i&&(r=i),s.arraySet(a.window,t,n-i,r,a.wnext),(i-=r)?(s.arraySet(a.window,t,n-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0}function fe(e,t){var n,$,ee,te,se,ie,re,ae,oe,le,ce,ue,de,fe,me,ge,ve,ye,xe,be,we,_e,je,Se,Ce=0,ke=new s.Buf8(4),Ee=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return v;(n=e.state).mode===A&&(n.mode=N),se=e.next_out,ee=e.output,re=e.avail_out,te=e.next_in,$=e.input,ie=e.avail_in,ae=n.hold,oe=n.bits,le=ie,ce=re,_e=f;e:for(;;)switch(n.mode){case _:if(0===n.wrap){n.mode=N;break}for(;oe<16;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}if(2&n.wrap&&35615===ae){n.check=0,ke[0]=255&ae,ke[1]=ae>>>8&255,n.check=r(n.check,ke,2,0),ae=0,oe=0,n.mode=j;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&ae)<<8)+(ae>>8))%31){e.msg="incorrect header check",n.mode=Q;break}if((15&ae)!==w){e.msg="unknown compression method",n.mode=Q;break}if(oe-=4,we=8+(15&(ae>>>=4)),0===n.wbits)n.wbits=we;else if(we>n.wbits){e.msg="invalid window size",n.mode=Q;break}n.dmax=1<<we,e.adler=n.check=1,n.mode=512&ae?O:A,ae=0,oe=0;break;case j:for(;oe<16;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}if(n.flags=ae,(255&n.flags)!==w){e.msg="unknown compression method",n.mode=Q;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=Q;break}n.head&&(n.head.text=ae>>8&1),512&n.flags&&(ke[0]=255&ae,ke[1]=ae>>>8&255,n.check=r(n.check,ke,2,0)),ae=0,oe=0,n.mode=S;case S:for(;oe<32;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}n.head&&(n.head.time=ae),512&n.flags&&(ke[0]=255&ae,ke[1]=ae>>>8&255,ke[2]=ae>>>16&255,ke[3]=ae>>>24&255,n.check=r(n.check,ke,4,0)),ae=0,oe=0,n.mode=C;case C:for(;oe<16;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}n.head&&(n.head.xflags=255&ae,n.head.os=ae>>8),512&n.flags&&(ke[0]=255&ae,ke[1]=ae>>>8&255,n.check=r(n.check,ke,2,0)),ae=0,oe=0,n.mode=k;case k:if(1024&n.flags){for(;oe<16;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}n.length=ae,n.head&&(n.head.extra_len=ae),512&n.flags&&(ke[0]=255&ae,ke[1]=ae>>>8&255,n.check=r(n.check,ke,2,0)),ae=0,oe=0}else n.head&&(n.head.extra=null);n.mode=E;case E:if(1024&n.flags&&((ue=n.length)>ie&&(ue=ie),ue&&(n.head&&(we=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),s.arraySet(n.head.extra,$,te,ue,we)),512&n.flags&&(n.check=r(n.check,$,ue,te)),ie-=ue,te+=ue,n.length-=ue),n.length))break e;n.length=0,n.mode=P;case P:if(2048&n.flags){if(0===ie)break e;ue=0;do{we=$[te+ue++],n.head&&we&&n.length<65536&&(n.head.name+=String.fromCharCode(we))}while(we&&ue<ie);if(512&n.flags&&(n.check=r(n.check,$,ue,te)),ie-=ue,te+=ue,we)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=I;case I:if(4096&n.flags){if(0===ie)break e;ue=0;do{we=$[te+ue++],n.head&&we&&n.length<65536&&(n.head.comment+=String.fromCharCode(we))}while(we&&ue<ie);if(512&n.flags&&(n.check=r(n.check,$,ue,te)),ie-=ue,te+=ue,we)break e}else n.head&&(n.head.comment=null);n.mode=V;case V:if(512&n.flags){for(;oe<16;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}if(ae!==(65535&n.check)){e.msg="header crc mismatch",n.mode=Q;break}ae=0,oe=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=A;break;case O:for(;oe<32;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}e.adler=n.check=ne(ae),ae=0,oe=0,n.mode=T;case T:if(0===n.havedict)return e.next_out=se,e.avail_out=re,e.next_in=te,e.avail_in=ie,n.hold=ae,n.bits=oe,g;e.adler=n.check=1,n.mode=A;case A:if(t===h||t===p)break e;case N:if(n.last){ae>>>=7&oe,oe-=7&oe,n.mode=Y;break}for(;oe<3;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}switch(n.last=1&ae,oe-=1,3&(ae>>>=1)){case 0:n.mode=F;break;case 1:if(he(n),n.mode=z,t===p){ae>>>=2,oe-=2;break e}break;case 2:n.mode=D;break;case 3:e.msg="invalid block type",n.mode=Q}ae>>>=2,oe-=2;break;case F:for(ae>>>=7&oe,oe-=7&oe;oe<32;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}if((65535&ae)!=(ae>>>16^65535)){e.msg="invalid stored block lengths",n.mode=Q;break}if(n.length=65535&ae,ae=0,oe=0,n.mode=M,t===p)break e;case M:n.mode=B;case B:if(ue=n.length){if(ue>ie&&(ue=ie),ue>re&&(ue=re),0===ue)break e;s.arraySet(ee,$,te,ue,se),ie-=ue,te+=ue,re-=ue,se+=ue,n.length-=ue;break}n.mode=A;break;case D:for(;oe<14;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}if(n.nlen=257+(31&ae),ae>>>=5,oe-=5,n.ndist=1+(31&ae),ae>>>=5,oe-=5,n.ncode=4+(15&ae),ae>>>=4,oe-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Q;break}n.have=0,n.mode=R;case R:for(;n.have<n.ncode;){for(;oe<3;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}n.lens[Ee[n.have++]]=7&ae,ae>>>=3,oe-=3}for(;n.have<19;)n.lens[Ee[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,je={bits:n.lenbits},_e=o(l,n.lens,0,19,n.lencode,0,n.work,je),n.lenbits=je.bits,_e){e.msg="invalid code lengths set",n.mode=Q;break}n.have=0,n.mode=L;case L:for(;n.have<n.nlen+n.ndist;){for(;ge=(Ce=n.lencode[ae&(1<<n.lenbits)-1])>>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=oe);){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}if(ve<16)ae>>>=me,oe-=me,n.lens[n.have++]=ve;else{if(16===ve){for(Se=me+2;oe<Se;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}if(ae>>>=me,oe-=me,0===n.have){e.msg="invalid bit length repeat",n.mode=Q;break}we=n.lens[n.have-1],ue=3+(3&ae),ae>>>=2,oe-=2}else if(17===ve){for(Se=me+3;oe<Se;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}oe-=me,we=0,ue=3+(7&(ae>>>=me)),ae>>>=3,oe-=3}else{for(Se=me+7;oe<Se;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}oe-=me,we=0,ue=11+(127&(ae>>>=me)),ae>>>=7,oe-=7}if(n.have+ue>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Q;break}for(;ue--;)n.lens[n.have++]=we}}if(n.mode===Q)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=Q;break}if(n.lenbits=9,je={bits:n.lenbits},_e=o(c,n.lens,0,n.nlen,n.lencode,0,n.work,je),n.lenbits=je.bits,_e){e.msg="invalid literal/lengths set",n.mode=Q;break}if(n.distbits=6,n.distcode=n.distdyn,je={bits:n.distbits},_e=o(u,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,je),n.distbits=je.bits,_e){e.msg="invalid distances set",n.mode=Q;break}if(n.mode=z,t===p)break e;case z:n.mode=H;case H:if(ie>=6&&re>=258){e.next_out=se,e.avail_out=re,e.next_in=te,e.avail_in=ie,n.hold=ae,n.bits=oe,a(e,ce),se=e.next_out,ee=e.output,re=e.avail_out,te=e.next_in,$=e.input,ie=e.avail_in,ae=n.hold,oe=n.bits,n.mode===A&&(n.back=-1);break}for(n.back=0;ge=(Ce=n.lencode[ae&(1<<n.lenbits)-1])>>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=oe);){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}if(ge&&!(240&ge)){for(ye=me,xe=ge,be=ve;ge=(Ce=n.lencode[be+((ae&(1<<ye+xe)-1)>>ye)])>>>16&255,ve=65535&Ce,!(ye+(me=Ce>>>24)<=oe);){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}ae>>>=ye,oe-=ye,n.back+=ye}if(ae>>>=me,oe-=me,n.back+=me,n.length=ve,0===ge){n.mode=Z;break}if(32&ge){n.back=-1,n.mode=A;break}if(64&ge){e.msg="invalid literal/length code",n.mode=Q;break}n.extra=15&ge,n.mode=G;case G:if(n.extra){for(Se=n.extra;oe<Se;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}n.length+=ae&(1<<n.extra)-1,ae>>>=n.extra,oe-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=W;case W:for(;ge=(Ce=n.distcode[ae&(1<<n.distbits)-1])>>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=oe);){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}if(!(240&ge)){for(ye=me,xe=ge,be=ve;ge=(Ce=n.distcode[be+((ae&(1<<ye+xe)-1)>>ye)])>>>16&255,ve=65535&Ce,!(ye+(me=Ce>>>24)<=oe);){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}ae>>>=ye,oe-=ye,n.back+=ye}if(ae>>>=me,oe-=me,n.back+=me,64&ge){e.msg="invalid distance code",n.mode=Q;break}n.offset=ve,n.extra=15&ge,n.mode=U;case U:if(n.extra){for(Se=n.extra;oe<Se;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}n.offset+=ae&(1<<n.extra)-1,ae>>>=n.extra,oe-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Q;break}n.mode=q;case q:if(0===re)break e;if(ue=ce-re,n.offset>ue){if((ue=n.offset-ue)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Q;break}ue>n.wnext?(ue-=n.wnext,de=n.wsize-ue):de=n.wnext-ue,ue>n.length&&(ue=n.length),fe=n.window}else fe=ee,de=se-n.offset,ue=n.length;ue>re&&(ue=re),re-=ue,n.length-=ue;do{ee[se++]=fe[de++]}while(--ue);0===n.length&&(n.mode=H);break;case Z:if(0===re)break e;ee[se++]=n.length,re--,n.mode=H;break;case Y:if(n.wrap){for(;oe<32;){if(0===ie)break e;ie--,ae|=$[te++]<<oe,oe+=8}if(ce-=re,e.total_out+=ce,n.total+=ce,ce&&(e.adler=n.check=n.flags?r(n.check,ee,ce,se-ce):i(n.check,ee,ce,se-ce)),ce=re,(n.flags?ae:ne(ae))!==n.check){e.msg="incorrect data check",n.mode=Q;break}ae=0,oe=0}n.mode=K;case K:if(n.wrap&&n.flags){for(;oe<32;){if(0===ie)break e;ie--,ae+=$[te++]<<oe,oe+=8}if(ae!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=Q;break}ae=0,oe=0}n.mode=X;case X:_e=m;break e;case Q:_e=y;break e;case J:return x;default:return v}return e.next_out=se,e.avail_out=re,e.next_in=te,e.avail_in=ie,n.hold=ae,n.bits=oe,(n.wsize||ce!==e.avail_out&&n.mode<Q&&(n.mode<Y||t!==d))&&pe(e,e.output,e.next_out,ce-e.avail_out)?(n.mode=J,x):(le-=e.avail_in,ce-=e.avail_out,e.total_in+=le,e.total_out+=ce,n.total+=ce,n.wrap&&ce&&(e.adler=n.check=n.flags?r(n.check,ee,ce,e.next_out-ce):i(n.check,ee,ce,e.next_out-ce)),e.data_type=n.bits+(n.last?64:0)+(n.mode===A?128:0)+(n.mode===z||n.mode===M?256:0),(0===le&&0===ce||t===d)&&_e===f&&(_e=b),_e)}function me(e){if(!e||!e.state)return v;var t=e.state;return t.window&&(t.window=null),e.state=null,f}function ge(e,t){var n;return e&&e.state&&2&(n=e.state).wrap?(n.head=t,t.done=!1,f):v}function ve(e,t){var n,s=t.length;return e&&e.state?0!==(n=e.state).wrap&&n.mode!==T?v:n.mode===T&&i(1,t,s,0)!==n.check?y:pe(e,t,s,s)?(n.mode=J,x):(n.havedict=1,f):v}n.inflateReset=re,n.inflateReset2=ae,n.inflateResetKeep=ie,n.inflateInit=le,n.inflateInit2=oe,n.inflate=fe,n.inflateEnd=me,n.inflateGetHeader=ge,n.inflateSetDictionary=ve,n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(e,t,n){"use strict";var s=e("../utils/common"),i=15,r=852,a=592,o=0,l=1,c=2,u=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],d=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],h=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],p=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,f,m,g,v,y){var x,b,w,_,j,S,C,k,E,P=y.bits,I=0,V=0,O=0,T=0,A=0,N=0,F=0,M=0,B=0,D=0,R=null,L=0,z=new s.Buf16(i+1),H=new s.Buf16(i+1),G=null,W=0;for(I=0;I<=i;I++)z[I]=0;for(V=0;V<f;V++)z[t[n+V]]++;for(A=P,T=i;T>=1&&0===z[T];T--);if(A>T&&(A=T),0===T)return m[g++]=20971520,m[g++]=20971520,y.bits=1,0;for(O=1;O<T&&0===z[O];O++);for(A<O&&(A=O),M=1,I=1;I<=i;I++)if(M<<=1,(M-=z[I])<0)return-1;if(M>0&&(e===o||1!==T))return-1;for(H[1]=0,I=1;I<i;I++)H[I+1]=H[I]+z[I];for(V=0;V<f;V++)0!==t[n+V]&&(v[H[t[n+V]]++]=V);if(e===o?(R=G=v,S=19):e===l?(R=u,L-=257,G=d,W-=257,S=256):(R=h,G=p,S=-1),D=0,V=0,I=O,j=g,N=A,F=0,w=-1,_=(B=1<<A)-1,e===l&&B>r||e===c&&B>a)return 1;for(;;){C=I-F,v[V]<S?(k=0,E=v[V]):v[V]>S?(k=G[W+v[V]],E=R[L+v[V]]):(k=96,E=0),x=1<<I-F,O=b=1<<N;do{m[j+(D>>F)+(b-=x)]=C<<24|k<<16|E}while(0!==b);for(x=1<<I-1;D&x;)x>>=1;if(0!==x?(D&=x-1,D+=x):D=0,V++,0==--z[I]){if(I===T)break;I=t[n+v[V]]}if(I>A&&(D&_)!==w){for(0===F&&(F=A),j+=O,M=1<<(N=I-F);N+F<T&&!((M-=z[N+F])<=0);)N++,M<<=1;if(B+=1<<N,e===l&&B>r||e===c&&B>a)return 1;m[w=D&_]=A<<24|N<<16|j-g}}return 0!==D&&(m[j+D]=I-F<<24|64<<16),y.bits=A,0}},{"../utils/common":1}],10:[function(e,t,n){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],11:[function(e,t,n){"use strict";function s(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}t.exports=s},{}],"/lib/inflate.js":[function(e,t,n){"use strict";var s=e("./zlib/inflate"),i=e("./utils/common"),r=e("./utils/strings"),a=e("./zlib/constants"),o=e("./zlib/messages"),l=e("./zlib/zstream"),c=e("./zlib/gzheader"),u=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=s.inflateInit2(this.strm,t.windowBits);if(n!==a.Z_OK)throw new Error(o[n]);if(this.header=new c,s.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=r.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=s.inflateSetDictionary(this.strm,t.dictionary))!==a.Z_OK))throw new Error(o[n])}function h(e,t){var n=new d(t);if(n.push(e,!0),n.err)throw n.msg||o[n.err];return n.result}function p(e,t){return(t=t||{}).raw=!0,h(e,t)}d.prototype.push=function(e,t){var n,o,l,c,d,h=this.strm,p=this.options.chunkSize,f=this.options.dictionary,m=!1;if(this.ended)return!1;o=t===~~t?t:!0===t?a.Z_FINISH:a.Z_NO_FLUSH,"string"==typeof e?h.input=r.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new i.Buf8(p),h.next_out=0,h.avail_out=p),(n=s.inflate(h,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&f&&(n=s.inflateSetDictionary(this.strm,f)),n===a.Z_BUF_ERROR&&!0===m&&(n=a.Z_OK,m=!1),n!==a.Z_STREAM_END&&n!==a.Z_OK)return this.onEnd(n),this.ended=!0,!1;h.next_out&&(0!==h.avail_out&&n!==a.Z_STREAM_END&&(0!==h.avail_in||o!==a.Z_FINISH&&o!==a.Z_SYNC_FLUSH)||("string"===this.options.to?(l=r.utf8border(h.output,h.next_out),c=h.next_out-l,d=r.buf2string(h.output,l),h.next_out=c,h.avail_out=p-c,c&&i.arraySet(h.output,h.output,l,c,0),this.onData(d)):this.onData(i.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(m=!0)}while((h.avail_in>0||0===h.avail_out)&&n!==a.Z_STREAM_END);return n===a.Z_STREAM_END&&(o=a.Z_FINISH),o===a.Z_FINISH?(n=s.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===a.Z_OK):o!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),h.avail_out=0,!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===a.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=d,n.inflate=h,n.inflateRaw=p,n.ungzip=h},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")},6087:e=>{"use strict";e.exports=window.wp.element},7143:e=>{"use strict";e.exports=window.wp.data},7734:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var s,i,r;if(Array.isArray(t)){if((s=t.length)!=n.length)return!1;for(i=s;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],n.get(i[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((s=t.length)!=n.length)return!1;for(i=s;0!=i--;)if(t[i]!==n[i])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((s=(r=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=s;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,r[i]))return!1;for(i=s;0!=i--;){var a=r[i];if(!e(t[a],n[a]))return!1}return!0}return t!=t&&n!=n}},7951:(e,t,n)=>{"use strict";n.d(t,{loadView:()=>d,useView:()=>u});var s=Object.prototype.hasOwnProperty;function i(e,t,n){for(n of e.keys())if(r(n,t))return n}function r(e,t){var n,a,o;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((a=e.length)===t.length)for(;a--&&r(e[a],t[a]););return-1===a}if(n===Set){if(e.size!==t.size)return!1;for(a of e){if((o=a)&&"object"==typeof o&&!(o=i(t,o)))return!1;if(!t.has(o))return!1}return!0}if(n===Map){if(e.size!==t.size)return!1;for(a of e){if((o=a[0])&&"object"==typeof o&&!(o=i(t,o)))return!1;if(!r(a[1],t.get(o)))return!1}return!0}if(n===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(n===DataView){if((a=e.byteLength)===t.byteLength)for(;a--&&e.getInt8(a)===t.getInt8(a););return-1===a}if(ArrayBuffer.isView(e)){if((a=e.byteLength)===t.byteLength)for(;a--&&e[a]===t[a];);return-1===a}if(!n||"object"==typeof e){for(n in a=0,e){if(s.call(e,n)&&++a&&!s.call(t,n))return!1;if(!(n in t)||!r(e[n],t[n]))return!1}return Object.keys(t).length===a}}return e!=e&&t!=t}function a(e,t,n){return`dataviews-${e}-${t}-${n}`}var o=n(6087),l=n(7143),c=n(1233);function u(e){const{kind:t,name:n,slug:s,defaultView:i,queryParams:u,onChangeQueryParams:d}=e,h=a(t,n,s),p=(0,l.useSelect)((e=>e(c.store).get("core/views",h)),[h]),{set:f}=(0,l.useDispatch)(c.store),m=p??i,g=Number(u?.page??m.page??1),v=u?.search??m.search??"";return{view:(0,o.useMemo)((()=>({...m,page:g,search:v})),[m,g,v]),isModified:!!p,updateView:(0,o.useCallback)((e=>{const t={page:e?.page,search:e?.search},n=function(e,t){const n={...e};for(const e of t)delete n[e];return n}(e,["page","search"]);d&&!r(t,{page:g,search:v})&&d(t),r(m,n)||(r(n,i)?f("core/views",h,void 0):f("core/views",h,n))}),[d,g,v,m,i,f,h]),resetToDefault:(0,o.useCallback)((()=>{f("core/views",h,void 0)}),[h,f])}}async function d(e){const{kind:t,name:n,slug:s,defaultView:i,queryParams:r}=e,o=a(t,n,s);return{...(0,l.select)(c.store).get("core/views",o)??i,page:r?.page??1,search:r?.search??""}}},8572:e=>{e.exports=function(){function e(t,n,s){function i(a,o){if(!n[a]){if(!t[a]){if(r)return r(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,(function(e){return i(t[a][1][e]||e)}),c,c.exports,e,t,n,s)}return n[a].exports}for(var r=void 0,a=0;a<s.length;a++)i(s[a]);return i}return e}()({1:[function(e,t,n){var s=4096,i=2*s+32,r=2*s-1,a=new Uint32Array([0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215]);function o(e){this.buf_=new Uint8Array(i),this.input_=e,this.reset()}o.READ_SIZE=s,o.IBUF_MASK=r,o.prototype.reset=function(){this.buf_ptr_=0,this.val_=0,this.pos_=0,this.bit_pos_=0,this.bit_end_pos_=0,this.eos_=0,this.readMoreInput();for(var e=0;e<4;e++)this.val_|=this.buf_[this.pos_]<<8*e,++this.pos_;return this.bit_end_pos_>0},o.prototype.readMoreInput=function(){if(!(this.bit_end_pos_>256))if(this.eos_){if(this.bit_pos_>this.bit_end_pos_)throw new Error("Unexpected end of input "+this.bit_pos_+" "+this.bit_end_pos_)}else{var e=this.buf_ptr_,t=this.input_.read(this.buf_,e,s);if(t<0)throw new Error("Unexpected end of input");if(t<s){this.eos_=1;for(var n=0;n<32;n++)this.buf_[e+t+n]=0}if(0===e){for(n=0;n<32;n++)this.buf_[(s<<1)+n]=this.buf_[n];this.buf_ptr_=s}else this.buf_ptr_=0;this.bit_end_pos_+=t<<3}},o.prototype.fillBitWindow=function(){for(;this.bit_pos_>=8;)this.val_>>>=8,this.val_|=this.buf_[this.pos_&r]<<24,++this.pos_,this.bit_pos_=this.bit_pos_-8>>>0,this.bit_end_pos_=this.bit_end_pos_-8>>>0},o.prototype.readBits=function(e){32-this.bit_pos_<e&&this.fillBitWindow();var t=this.val_>>>this.bit_pos_&a[e];return this.bit_pos_+=e,t},t.exports=o},{}],2:[function(e,t,n){n.lookup=new Uint8Array([0,0,0,0,0,0,0,0,0,4,4,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,12,16,12,12,20,12,16,24,28,12,12,32,12,36,12,44,44,44,44,44,44,44,44,44,44,32,32,24,40,28,12,12,48,52,52,52,48,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,24,12,28,12,12,12,56,60,60,60,56,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,24,12,28,12,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,56,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,22,22,22,22,23,23,23,23,24,24,24,24,25,25,25,25,26,26,26,26,27,27,27,27,28,28,28,28,29,29,29,29,30,30,30,30,31,31,31,31,32,32,32,32,33,33,33,33,34,34,34,34,35,35,35,35,36,36,36,36,37,37,37,37,38,38,38,38,39,39,39,39,40,40,40,40,41,41,41,41,42,42,42,42,43,43,43,43,44,44,44,44,45,45,45,45,46,46,46,46,47,47,47,47,48,48,48,48,49,49,49,49,50,50,50,50,51,51,51,51,52,52,52,52,53,53,53,53,54,54,54,54,55,55,55,55,56,56,56,56,57,57,57,57,58,58,58,58,59,59,59,59,60,60,60,60,61,61,61,61,62,62,62,62,63,63,63,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n.lookupOffsets=new Uint16Array([1024,1536,1280,1536,0,256,768,512])},{}],3:[function(e,t,n){var s=e("./streams").BrotliInput,i=e("./streams").BrotliOutput,r=e("./bit_reader"),a=e("./dictionary"),o=e("./huffman").HuffmanCode,l=e("./huffman").BrotliBuildHuffmanTable,c=e("./context"),u=e("./prefix"),d=e("./transform"),h=8,p=16,f=256,m=704,g=26,v=6,y=2,x=8,b=255,w=1080,_=18,j=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),S=16,C=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),k=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),E=new Uint16Array([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]);function P(e){var t;return 0===e.readBits(1)?16:(t=e.readBits(3))>0?17+t:(t=e.readBits(3))>0?8+t:17}function I(e){if(e.readBits(1)){var t=e.readBits(3);return 0===t?1:e.readBits(t)+(1<<t)}return 0}function V(){this.meta_block_length=0,this.input_end=0,this.is_uncompressed=0,this.is_metadata=!1}function O(e){var t,n,s,i=new V;if(i.input_end=e.readBits(1),i.input_end&&e.readBits(1))return i;if(7===(t=e.readBits(2)+4)){if(i.is_metadata=!0,0!==e.readBits(1))throw new Error("Invalid reserved bit");if(0===(n=e.readBits(2)))return i;for(s=0;s<n;s++){var r=e.readBits(8);if(s+1===n&&n>1&&0===r)throw new Error("Invalid size byte");i.meta_block_length|=r<<8*s}}else for(s=0;s<t;++s){var a=e.readBits(4);if(s+1===t&&t>4&&0===a)throw new Error("Invalid size nibble");i.meta_block_length|=a<<4*s}return++i.meta_block_length,i.input_end||i.is_metadata||(i.is_uncompressed=e.readBits(1)),i}function T(e,t,n){var s;return n.fillBitWindow(),(s=e[t+=n.val_>>>n.bit_pos_&b].bits-x)>0&&(n.bit_pos_+=x,t+=e[t].value,t+=n.val_>>>n.bit_pos_&(1<<s)-1),n.bit_pos_+=e[t].bits,e[t].value}function A(e,t,n,s){for(var i=0,r=h,a=0,c=0,u=32768,d=[],f=0;f<32;f++)d.push(new o(0,0));for(l(d,0,5,e,_);i<t&&u>0;){var m,g=0;if(s.readMoreInput(),s.fillBitWindow(),g+=s.val_>>>s.bit_pos_&31,s.bit_pos_+=d[g].bits,(m=255&d[g].value)<p)a=0,n[i++]=m,0!==m&&(r=m,u-=32768>>m);else{var v,y,x=m-14,b=0;if(m===p&&(b=r),c!==b&&(a=0,c=b),v=a,a>0&&(a-=2,a<<=x),i+(y=(a+=s.readBits(x)+3)-v)>t)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var w=0;w<y;w++)n[i+w]=c;i+=y,0!==c&&(u-=y<<15-c)}}if(0!==u)throw new Error("[ReadHuffmanCodeLengths] space = "+u);for(;i<t;i++)n[i]=0}function N(e,t,n,s){var i,r=0,a=new Uint8Array(e);if(s.readMoreInput(),1===(i=s.readBits(2))){for(var c=e-1,u=0,d=new Int32Array(4),h=s.readBits(2)+1;c;)c>>=1,++u;for(p=0;p<h;++p)d[p]=s.readBits(u)%e,a[d[p]]=2;switch(a[d[0]]=1,h){case 1:break;case 3:if(d[0]===d[1]||d[0]===d[2]||d[1]===d[2])throw new Error("[ReadHuffmanCode] invalid symbols");break;case 2:if(d[0]===d[1])throw new Error("[ReadHuffmanCode] invalid symbols");a[d[1]]=1;break;case 4:if(d[0]===d[1]||d[0]===d[2]||d[0]===d[3]||d[1]===d[2]||d[1]===d[3]||d[2]===d[3])throw new Error("[ReadHuffmanCode] invalid symbols");s.readBits(1)?(a[d[2]]=3,a[d[3]]=3):a[d[0]]=2}}else{var p,f=new Uint8Array(_),m=32,g=0,v=[new o(2,0),new o(2,4),new o(2,3),new o(3,2),new o(2,0),new o(2,4),new o(2,3),new o(4,1),new o(2,0),new o(2,4),new o(2,3),new o(3,2),new o(2,0),new o(2,4),new o(2,3),new o(4,5)];for(p=i;p<_&&m>0;++p){var y,b=j[p],w=0;s.fillBitWindow(),w+=s.val_>>>s.bit_pos_&15,s.bit_pos_+=v[w].bits,y=v[w].value,f[b]=y,0!==y&&(m-=32>>y,++g)}if(1!==g&&0!==m)throw new Error("[ReadHuffmanCode] invalid num_codes or space");A(f,e,a,s)}if(0===(r=l(t,n,x,a,e)))throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: ");return r}function F(e,t,n){var s,i;return s=T(e,t,n),i=u.kBlockLengthPrefixCode[s].nbits,u.kBlockLengthPrefixCode[s].offset+n.readBits(i)}function M(e,t,n){var s;return e<S?(n+=C[e],s=t[n&=3]+k[e]):s=e-S+1,s}function B(e,t){for(var n=e[t],s=t;s;--s)e[s]=e[s-1];e[0]=n}function D(e,t){var n,s=new Uint8Array(256);for(n=0;n<256;++n)s[n]=n;for(n=0;n<t;++n){var i=e[n];e[n]=s[i],i&&B(s,i)}}function R(e,t){this.alphabet_size=e,this.num_htrees=t,this.codes=new Array(t+t*E[e+31>>>5]),this.htrees=new Uint32Array(t)}function L(e,t){var n,s,i={num_htrees:null,context_map:null},r=0;t.readMoreInput();var a=i.num_htrees=I(t)+1,l=i.context_map=new Uint8Array(e);if(a<=1)return i;for(t.readBits(1)&&(r=t.readBits(4)+1),n=[],s=0;s<w;s++)n[s]=new o(0,0);for(N(a+r,n,0,t),s=0;s<e;){var c;if(t.readMoreInput(),0===(c=T(n,0,t)))l[s]=0,++s;else if(c<=r)for(var u=1+(1<<c)+t.readBits(c);--u;){if(s>=e)throw new Error("[DecodeContextMap] i >= context_map_size");l[s]=0,++s}else l[s]=c-r,++s}return t.readBits(1)&&D(l,e),i}function z(e,t,n,s,i,r,a){var o,l=2*n,c=n,u=T(t,n*w,a);(o=0===u?i[l+(1&r[c])]:1===u?i[l+(r[c]-1&1)]+1:u-2)>=e&&(o-=e),s[n]=o,i[l+(1&r[c])]=o,++r[c]}function H(e,t,n,s,i,a){var o,l=i+1,c=n&i,u=a.pos_&r.IBUF_MASK;if(t<8||a.bit_pos_+(t<<3)<a.bit_end_pos_)for(;t-- >0;)a.readMoreInput(),s[c++]=a.readBits(8),c===l&&(e.write(s,l),c=0);else{if(a.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;a.bit_pos_<32;)s[c]=a.val_>>>a.bit_pos_,a.bit_pos_+=8,++c,--t;if(u+(o=a.bit_end_pos_-a.bit_pos_>>3)>r.IBUF_MASK){for(var d=r.IBUF_MASK+1-u,h=0;h<d;h++)s[c+h]=a.buf_[u+h];o-=d,c+=d,t-=d,u=0}for(h=0;h<o;h++)s[c+h]=a.buf_[u+h];if(t-=o,(c+=o)>=l)for(e.write(s,l),c-=l,h=0;h<c;h++)s[h]=s[l+h];for(;c+t>=l;){if(o=l-c,a.input_.read(s,c,o)<o)throw new Error("[CopyUncompressedBlockToOutput] not enough bytes");e.write(s,l),t-=o,c=0}if(a.input_.read(s,c,t)<t)throw new Error("[CopyUncompressedBlockToOutput] not enough bytes");a.reset()}}function G(e){var t=e.bit_pos_+7&-8;return 0==e.readBits(t-e.bit_pos_)}function W(e){var t=new s(e),n=new r(t);return P(n),O(n).meta_block_length}function U(e,t){var n=new s(e);null==t&&(t=W(e));var r=new Uint8Array(t),a=new i(r);return q(n,a),a.pos<a.buffer.length&&(a.buffer=a.buffer.subarray(0,a.pos)),a.buffer}function q(e,t){var n,s,i,l,h,p,x,b,_,j=0,C=0,k=0,E=0,V=[16,15,11,4],A=0,B=0,D=0,W=[new R(0,0),new R(0,0),new R(0,0)],U=128+r.READ_SIZE;s=(1<<(k=P(_=new r(e))))-16,l=(i=1<<k)-1,h=new Uint8Array(i+U+a.maxDictionaryWordLength),p=i,x=[],b=[];for(var q=0;q<3*w;q++)x[q]=new o(0,0),b[q]=new o(0,0);for(;!C;){var Z,Y,K,X,Q,J,$,ee,te,ne=0,se=[1<<28,1<<28,1<<28],ie=[0],re=[1,1,1],ae=[0,1,0,1,0,1],oe=[0],le=null,ce=null,ue=null,de=null,he=0,pe=null,fe=0,me=0,ge=0;for(n=0;n<3;++n)W[n].codes=null,W[n].htrees=null;_.readMoreInput();var ve=O(_);if(j+(ne=ve.meta_block_length)>t.buffer.length){var ye=new Uint8Array(j+ne);ye.set(t.buffer),t.buffer=ye}if(C=ve.input_end,Z=ve.is_uncompressed,ve.is_metadata)for(G(_);ne>0;--ne)_.readMoreInput(),_.readBits(8);else if(0!==ne)if(Z)_.bit_pos_=_.bit_pos_+7&-8,H(t,ne,j,h,l,_),j+=ne;else{for(n=0;n<3;++n)re[n]=I(_)+1,re[n]>=2&&(N(re[n]+2,x,n*w,_),N(g,b,n*w,_),se[n]=F(b,n*w,_),oe[n]=1);for(_.readMoreInput(),X=(1<<(Y=_.readBits(2)))-1,Q=(K=S+(_.readBits(4)<<Y))+(48<<Y),ce=new Uint8Array(re[0]),n=0;n<re[0];++n)_.readMoreInput(),ce[n]=_.readBits(2)<<1;var xe=L(re[0]<<v,_);J=xe.num_htrees,le=xe.context_map;var be=L(re[2]<<y,_);for($=be.num_htrees,ue=be.context_map,W[0]=new R(f,J),W[1]=new R(m,re[1]),W[2]=new R(Q,$),n=0;n<3;++n)W[n].decode(_);for(de=0,pe=0,ee=ce[ie[0]],me=c.lookupOffsets[ee],ge=c.lookupOffsets[ee+1],te=W[1].htrees[0];ne>0;){var we,_e,je,Se,Ce,ke,Ee,Pe,Ie,Ve,Oe,Te;for(_.readMoreInput(),0===se[1]&&(z(re[1],x,1,ie,ae,oe,_),se[1]=F(b,w,_),te=W[1].htrees[ie[1]]),--se[1],(_e=(we=T(W[1].codes,te,_))>>6)>=2?(_e-=2,Ee=-1):Ee=0,je=u.kInsertRangeLut[_e]+(we>>3&7),Se=u.kCopyRangeLut[_e]+(7&we),Ce=u.kInsertLengthPrefixCode[je].offset+_.readBits(u.kInsertLengthPrefixCode[je].nbits),ke=u.kCopyLengthPrefixCode[Se].offset+_.readBits(u.kCopyLengthPrefixCode[Se].nbits),B=h[j-1&l],D=h[j-2&l],Ie=0;Ie<Ce;++Ie)_.readMoreInput(),0===se[0]&&(z(re[0],x,0,ie,ae,oe,_),se[0]=F(b,0,_),de=ie[0]<<v,ee=ce[ie[0]],me=c.lookupOffsets[ee],ge=c.lookupOffsets[ee+1]),he=le[de+(c.lookup[me+B]|c.lookup[ge+D])],--se[0],D=B,B=T(W[0].codes,W[0].htrees[he],_),h[j&l]=B,(j&l)===l&&t.write(h,i),++j;if((ne-=Ce)<=0)break;if(Ee<0&&(_.readMoreInput(),0===se[2]&&(z(re[2],x,2,ie,ae,oe,_),se[2]=F(b,2*w,_),pe=ie[2]<<y),--se[2],fe=ue[pe+(255&(ke>4?3:ke-2))],(Ee=T(W[2].codes,W[2].htrees[fe],_))>=K&&(Te=(Ee-=K)&X,Ee=K+((Ae=(2+(1&(Ee>>=Y))<<(Oe=1+(Ee>>1)))-4)+_.readBits(Oe)<<Y)+Te)),(Pe=M(Ee,V,A))<0)throw new Error("[BrotliDecompress] invalid distance");if(Ve=j&l,Pe>(E=j<s&&E!==s?j:s)){if(!(ke>=a.minDictionaryWordLength&&ke<=a.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+j+" distance: "+Pe+" len: "+ke+" bytes left: "+ne);var Ae=a.offsetsByLength[ke],Ne=Pe-E-1,Fe=a.sizeBitsByLength[ke],Me=Ne>>Fe;if(Ae+=(Ne&(1<<Fe)-1)*ke,!(Me<d.kNumTransforms))throw new Error("Invalid backward reference. pos: "+j+" distance: "+Pe+" len: "+ke+" bytes left: "+ne);var Be=d.transformDictionaryWord(h,Ve,Ae,ke,Me);if(j+=Be,ne-=Be,(Ve+=Be)>=p){t.write(h,i);for(var De=0;De<Ve-p;De++)h[De]=h[p+De]}}else{if(Ee>0&&(V[3&A]=Pe,++A),ke>ne)throw new Error("Invalid backward reference. pos: "+j+" distance: "+Pe+" len: "+ke+" bytes left: "+ne);for(Ie=0;Ie<ke;++Ie)h[j&l]=h[j-Pe&l],(j&l)===l&&t.write(h,i),++j,--ne}B=h[j-1&l],D=h[j-2&l]}j&=1073741823}}t.write(h,j&l)}R.prototype.decode=function(e){var t,n=0;for(t=0;t<this.num_htrees;++t)this.htrees[t]=n,n+=N(this.alphabet_size,this.codes,n,e)},n.BrotliDecompressedSize=W,n.BrotliDecompressBuffer=U,n.BrotliDecompress=q,a.init()},{"./bit_reader":1,"./context":2,"./dictionary":6,"./huffman":7,"./prefix":9,"./streams":10,"./transform":11}],4:[function(e,t,n){var s=e("base64-js");n.init=function(){return(0,e("./decode").BrotliDecompressBuffer)(s.toByteArray(e("./dictionary.bin.js")))}},{"./decode":3,"./dictionary.bin.js":5,"base64-js":8}],5:[function(e,t,n){t.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="},{}],6:[function(e,t,n){var s=e("./dictionary-browser");n.init=function(){n.dictionary=s.init()},n.offsetsByLength=new Uint32Array([0,0,0,0,0,4096,9216,21504,35840,44032,53248,63488,74752,87040,93696,100864,104704,106752,108928,113536,115968,118528,119872,121280,122016]),n.sizeBitsByLength=new Uint8Array([0,0,0,0,10,10,11,11,10,10,10,10,10,9,9,8,7,7,8,7,7,6,6,5,5]),n.minDictionaryWordLength=4,n.maxDictionaryWordLength=24},{"./dictionary-browser":4}],7:[function(e,t,n){function s(e,t){this.bits=e,this.value=t}n.HuffmanCode=s;var i=15;function r(e,t){for(var n=1<<t-1;e&n;)n>>=1;return(e&n-1)+n}function a(e,t,n,i,r){do{e[t+(i-=n)]=new s(r.bits,r.value)}while(i>0)}function o(e,t,n){for(var s=1<<t-n;t<i&&!((s-=e[t])<=0);)++t,s<<=1;return t-n}n.BrotliBuildHuffmanTable=function(e,t,n,l,c){var u,d,h,p,f,m,g,v,y,x,b=t,w=new Int32Array(i+1),_=new Int32Array(i+1);for(x=new Int32Array(c),d=0;d<c;d++)w[l[d]]++;for(_[1]=0,u=1;u<i;u++)_[u+1]=_[u]+w[u];for(d=0;d<c;d++)0!==l[d]&&(x[_[l[d]]++]=d);if(y=v=1<<(g=n),1===_[i]){for(h=0;h<y;++h)e[t+h]=new s(0,65535&x[0]);return y}for(h=0,d=0,u=1,p=2;u<=n;++u,p<<=1)for(;w[u]>0;--w[u])a(e,t+h,p,v,new s(255&u,65535&x[d++])),h=r(h,u);for(m=y-1,f=-1,u=n+1,p=2;u<=i;++u,p<<=1)for(;w[u]>0;--w[u])(h&m)!==f&&(t+=v,y+=v=1<<(g=o(w,u,n)),e[b+(f=h&m)]=new s(g+n&255,t-b-f&65535)),a(e,t+(h>>n),p,v,new s(u-n&255,65535&x[d++])),h=r(h,u);return y}},{}],8:[function(e,t,n){"use strict";n.byteLength=u,n.toByteArray=h,n.fromByteArray=m;for(var s=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,l=a.length;o<l;++o)s[o]=a[o],i[a.charCodeAt(o)]=o;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e){var t=c(e),n=t[0],s=t[1];return 3*(n+s)/4-s}function d(e,t,n){return 3*(t+n)/4-n}function h(e){for(var t,n=c(e),s=n[0],a=n[1],o=new r(d(e,s,a)),l=0,u=a>0?s-4:s,h=0;h<u;h+=4)t=i[e.charCodeAt(h)]<<18|i[e.charCodeAt(h+1)]<<12|i[e.charCodeAt(h+2)]<<6|i[e.charCodeAt(h+3)],o[l++]=t>>16&255,o[l++]=t>>8&255,o[l++]=255&t;return 2===a&&(t=i[e.charCodeAt(h)]<<2|i[e.charCodeAt(h+1)]>>4,o[l++]=255&t),1===a&&(t=i[e.charCodeAt(h)]<<10|i[e.charCodeAt(h+1)]<<4|i[e.charCodeAt(h+2)]>>2,o[l++]=t>>8&255,o[l++]=255&t),o}function p(e){return s[e>>18&63]+s[e>>12&63]+s[e>>6&63]+s[63&e]}function f(e,t,n){for(var s,i=[],r=t;r<n;r+=3)s=(e[r]<<16&16711680)+(e[r+1]<<8&65280)+(255&e[r+2]),i.push(p(s));return i.join("")}function m(e){for(var t,n=e.length,i=n%3,r=[],a=16383,o=0,l=n-i;o<l;o+=a)r.push(f(e,o,o+a>l?l:o+a));return 1===i?(t=e[n-1],r.push(s[t>>2]+s[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],r.push(s[t>>10]+s[t>>4&63]+s[t<<2&63]+"=")),r.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],9:[function(e,t,n){function s(e,t){this.offset=e,this.nbits=t}n.kBlockLengthPrefixCode=[new s(1,2),new s(5,2),new s(9,2),new s(13,2),new s(17,3),new s(25,3),new s(33,3),new s(41,3),new s(49,4),new s(65,4),new s(81,4),new s(97,4),new s(113,5),new s(145,5),new s(177,5),new s(209,5),new s(241,6),new s(305,6),new s(369,7),new s(497,8),new s(753,9),new s(1265,10),new s(2289,11),new s(4337,12),new s(8433,13),new s(16625,24)],n.kInsertLengthPrefixCode=[new s(0,0),new s(1,0),new s(2,0),new s(3,0),new s(4,0),new s(5,0),new s(6,1),new s(8,1),new s(10,2),new s(14,2),new s(18,3),new s(26,3),new s(34,4),new s(50,4),new s(66,5),new s(98,5),new s(130,6),new s(194,7),new s(322,8),new s(578,9),new s(1090,10),new s(2114,12),new s(6210,14),new s(22594,24)],n.kCopyLengthPrefixCode=[new s(2,0),new s(3,0),new s(4,0),new s(5,0),new s(6,0),new s(7,0),new s(8,0),new s(9,0),new s(10,1),new s(12,1),new s(14,2),new s(18,2),new s(22,3),new s(30,3),new s(38,4),new s(54,4),new s(70,5),new s(102,5),new s(134,6),new s(198,7),new s(326,8),new s(582,9),new s(1094,10),new s(2118,24)],n.kInsertRangeLut=[0,0,8,8,0,16,8,16,16],n.kCopyRangeLut=[0,8,0,8,16,0,16,8,16]},{}],10:[function(e,t,n){function s(e){this.buffer=e,this.pos=0}function i(e){this.buffer=e,this.pos=0}s.prototype.read=function(e,t,n){this.pos+n>this.buffer.length&&(n=this.buffer.length-this.pos);for(var s=0;s<n;s++)e[t+s]=this.buffer[this.pos+s];return this.pos+=n,n},n.BrotliInput=s,i.prototype.write=function(e,t){if(this.pos+t>this.buffer.length)throw new Error("Output buffer is not large enough");return this.buffer.set(e.subarray(0,t),this.pos),this.pos+=t,t},n.BrotliOutput=i},{}],11:[function(e,t,n){var s=e("./dictionary"),i=0,r=1,a=2,o=3,l=4,c=5,u=6,d=7,h=8,p=9,f=10,m=11,g=12,v=13,y=14,x=15,b=16,w=17,_=18,j=20;function S(e,t,n){this.prefix=new Uint8Array(e.length),this.transform=t,this.suffix=new Uint8Array(n.length);for(var s=0;s<e.length;s++)this.prefix[s]=e.charCodeAt(s);for(s=0;s<n.length;s++)this.suffix[s]=n.charCodeAt(s)}var C=[new S("",i,""),new S("",i," "),new S(" ",i," "),new S("",g,""),new S("",f," "),new S("",i," the "),new S(" ",i,""),new S("s ",i," "),new S("",i," of "),new S("",f,""),new S("",i," and "),new S("",v,""),new S("",r,""),new S(", ",i," "),new S("",i,", "),new S(" ",f," "),new S("",i," in "),new S("",i," to "),new S("e ",i," "),new S("",i,'"'),new S("",i,"."),new S("",i,'">'),new S("",i,"\n"),new S("",o,""),new S("",i,"]"),new S("",i," for "),new S("",y,""),new S("",a,""),new S("",i," a "),new S("",i," that "),new S(" ",f,""),new S("",i,". "),new S(".",i,""),new S(" ",i,", "),new S("",x,""),new S("",i," with "),new S("",i,"'"),new S("",i," from "),new S("",i," by "),new S("",b,""),new S("",w,""),new S(" the ",i,""),new S("",l,""),new S("",i,". The "),new S("",m,""),new S("",i," on "),new S("",i," as "),new S("",i," is "),new S("",d,""),new S("",r,"ing "),new S("",i,"\n\t"),new S("",i,":"),new S(" ",i,". "),new S("",i,"ed "),new S("",j,""),new S("",_,""),new S("",u,""),new S("",i,"("),new S("",f,", "),new S("",h,""),new S("",i," at "),new S("",i,"ly "),new S(" the ",i," of "),new S("",c,""),new S("",p,""),new S(" ",f,", "),new S("",f,'"'),new S(".",i,"("),new S("",m," "),new S("",f,'">'),new S("",i,'="'),new S(" ",i,"."),new S(".com/",i,""),new S(" the ",i," of the "),new S("",f,"'"),new S("",i,". This "),new S("",i,","),new S(".",i," "),new S("",f,"("),new S("",f,"."),new S("",i," not "),new S(" ",i,'="'),new S("",i,"er "),new S(" ",m," "),new S("",i,"al "),new S(" ",m,""),new S("",i,"='"),new S("",m,'"'),new S("",f,". "),new S(" ",i,"("),new S("",i,"ful "),new S(" ",f,". "),new S("",i,"ive "),new S("",i,"less "),new S("",m,"'"),new S("",i,"est "),new S(" ",f,"."),new S("",m,'">'),new S(" ",i,"='"),new S("",f,","),new S("",i,"ize "),new S("",m,"."),new S(" ",i,""),new S(" ",i,","),new S("",f,'="'),new S("",m,'="'),new S("",i,"ous "),new S("",m,", "),new S("",f,"='"),new S(" ",f,","),new S(" ",m,'="'),new S(" ",m,", "),new S("",m,","),new S("",m,"("),new S("",m,". "),new S(" ",m,"."),new S("",m,"='"),new S(" ",m,". "),new S(" ",f,'="'),new S(" ",m,"='"),new S(" ",f,"='")];function k(e,t){return e[t]<192?(e[t]>=97&&e[t]<=122&&(e[t]^=32),1):e[t]<224?(e[t+1]^=32,2):(e[t+2]^=5,3)}n.kTransforms=C,n.kNumTransforms=C.length,n.transformDictionaryWord=function(e,t,n,i,r){var a,o=C[r].prefix,l=C[r].suffix,c=C[r].transform,u=c<g?0:c-(g-1),d=0,h=t;u>i&&(u=i);for(var v=0;v<o.length;)e[t++]=o[v++];for(n+=u,i-=u,c<=p&&(i-=c),d=0;d<i;d++)e[t++]=s.dictionary[n+d];if(a=t-i,c===f)k(e,a);else if(c===m)for(;i>0;){var y=k(e,a);a+=y,i-=y}for(var x=0;x<l.length;)e[t++]=l[x++];return t-h}},{"./dictionary":6}],12:[function(e,t,n){t.exports=e("./dec/decode").BrotliDecompressBuffer},{"./dec/decode":3}]},{},[12])(12)},9681:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},n=Object.keys(t).join("|"),s=new RegExp(n,"g"),i=new RegExp(n,"");function r(e){return t[e]}var a=function(e){return e.replace(s,r)};e.exports=a,e.exports.has=function(e){return!!e.match(i)},e.exports.remove=a}},s={};function i(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(n,s){if(1&s&&(n=this(n)),8&s)return n;if("object"==typeof n&&n){if(4&s&&n.__esModule)return n;if(16&s&&"function"==typeof n.then)return n}var r=Object.create(null);i.r(r);var a={};e=e||[null,t({}),t([]),t(t)];for(var o=2&s&&n;"object"==typeof o&&!~e.indexOf(o);o=t(o))Object.getOwnPropertyNames(o).forEach((e=>a[e]=()=>n[e]));return a.default=()=>n,i.d(r,a),r},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";i.r(r),i.d(r,{PluginMoreMenuItem:()=>BV,PluginSidebar:()=>DV,PluginSidebarMoreMenuItem:()=>RV,PluginTemplateSettingPanel:()=>To,initializeEditor:()=>ZV,initializePostsDashboard:()=>UV,reinitializeEditor:()=>YV,store:()=>Rt});var e={};i.r(e),i.d(e,{__experimentalSetPreviewDeviceType:()=>ze,addTemplate:()=>Ge,closeGeneralSidebar:()=>at,openGeneralSidebar:()=>rt,openNavigationPanelToMenu:()=>Je,removeTemplate:()=>We,revertTemplate:()=>it,setEditedEntity:()=>Ze,setEditedPostContext:()=>Ke,setHasPageContentFocus:()=>lt,setHomeTemplateId:()=>Ye,setIsInserterOpened:()=>et,setIsListViewOpened:()=>tt,setIsNavigationPanelOpened:()=>$e,setIsSaveViewOpened:()=>st,setNavigationMenu:()=>qe,setNavigationPanelActiveMenu:()=>Qe,setPage:()=>Xe,setTemplate:()=>He,setTemplatePart:()=>Ue,switchEditorMode:()=>ot,toggleDistractionFree:()=>ct,toggleFeature:()=>Le,updateSettings:()=>nt});var t={};i.r(t),i.d(t,{registerRoute:()=>dt,setEditorCanvasContainerView:()=>ut,unregisterRoute:()=>ht});var n={};i.r(n),i.d(n,{__experimentalGetInsertionPoint:()=>Ct,__experimentalGetPreviewDeviceType:()=>mt,getCanUserCreateMedia:()=>gt,getCurrentTemplateNavigationPanelSubMenu:()=>Ot,getCurrentTemplateTemplateParts:()=>It,getEditedPostContext:()=>_t,getEditedPostId:()=>wt,getEditedPostType:()=>bt,getEditorMode:()=>Vt,getHomeTemplateId:()=>xt,getNavigationPanelActiveMenu:()=>Tt,getPage:()=>jt,getReusableBlocks:()=>vt,getSettings:()=>yt,hasPageContentFocus:()=>Ft,isFeatureActive:()=>ft,isInserterOpened:()=>St,isListViewOpened:()=>kt,isNavigationOpened:()=>At,isPage:()=>Nt,isSaveViewOpened:()=>Et});var s={};i.r(s),i.d(s,{getEditorCanvasContainerView:()=>Mt,getRoutes:()=>Bt});const a=window.ReactJSXRuntime,o=window.wp.blocks,l=window.wp.blockLibrary;var c=i(7143);const u=window.wp.deprecated;var d=i.n(u),h=i(6087);const f=window.wp.editor;var m=i(1233);const g=window.wp.widgets,v=window.wp.hooks,y=window.wp.compose,x=window.wp.blockEditor,b=window.wp.components,w=window.wp.i18n,_=window.wp.notices,j=window.wp.coreData;var S={grad:.9,turn:360,rad:360/(2*Math.PI)},C=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},k=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},E=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},P=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},I=function(e){return{r:E(e.r,0,255),g:E(e.g,0,255),b:E(e.b,0,255),a:E(e.a)}},V=function(e){return{r:k(e.r),g:k(e.g),b:k(e.b),a:k(e.a,3)}},O=/^#([0-9a-f]{3,8})$/i,T=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},A=function(e){var t=e.r,n=e.g,s=e.b,i=e.a,r=Math.max(t,n,s),a=r-Math.min(t,n,s),o=a?r===t?(n-s)/a:r===n?2+(s-t)/a:4+(t-n)/a:0;return{h:60*(o<0?o+6:o),s:r?a/r*100:0,v:r/255*100,a:i}},N=function(e){var t=e.h,n=e.s,s=e.v,i=e.a;t=t/360*6,n/=100,s/=100;var r=Math.floor(t),a=s*(1-n),o=s*(1-(t-r)*n),l=s*(1-(1-t+r)*n),c=r%6;return{r:255*[s,o,a,a,l,s][c],g:255*[l,s,s,o,a,a][c],b:255*[a,a,l,s,s,o][c],a:i}},F=function(e){return{h:P(e.h),s:E(e.s,0,100),l:E(e.l,0,100),a:E(e.a)}},M=function(e){return{h:k(e.h),s:k(e.s),l:k(e.l),a:k(e.a,3)}},B=function(e){return N((n=(t=e).s,{h:t.h,s:(n*=((s=t.l)<50?s:100-s)/100)>0?2*n/(s+n)*100:0,v:s+n,a:t.a}));var t,n,s},D=function(e){return{h:(t=A(e)).h,s:(i=(200-(n=t.s))*(s=t.v)/100)>0&&i<200?n*s/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,s,i},R=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,L=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,z=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,H=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,G={string:[[function(e){var t=O.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?k(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?k(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=z.exec(e)||H.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:I({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(e){var t=R.exec(e)||L.exec(e);if(!t)return null;var n,s,i=F({h:(n=t[1],s=t[2],void 0===s&&(s="deg"),Number(n)*(S[s]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return B(i)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,s=e.b,i=e.a,r=void 0===i?1:i;return C(t)&&C(n)&&C(s)?I({r:Number(t),g:Number(n),b:Number(s),a:Number(r)}):null},"rgb"],[function(e){var t=e.h,n=e.s,s=e.l,i=e.a,r=void 0===i?1:i;if(!C(t)||!C(n)||!C(s))return null;var a=F({h:Number(t),s:Number(n),l:Number(s),a:Number(r)});return B(a)},"hsl"],[function(e){var t=e.h,n=e.s,s=e.v,i=e.a,r=void 0===i?1:i;if(!C(t)||!C(n)||!C(s))return null;var a=function(e){return{h:P(e.h),s:E(e.s,0,100),v:E(e.v,0,100),a:E(e.a)}}({h:Number(t),s:Number(n),v:Number(s),a:Number(r)});return N(a)},"hsv"]]},W=function(e,t){for(var n=0;n<t.length;n++){var s=t[n][0](e);if(s)return[s,t[n][1]]}return[null,void 0]},U=function(e){return"string"==typeof e?W(e.trim(),G.string):"object"==typeof e&&null!==e?W(e,G.object):[null,void 0]},q=function(e,t){var n=D(e);return{h:n.h,s:E(n.s+100*t,0,100),l:n.l,a:n.a}},Z=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Y=function(e,t){var n=D(e);return{h:n.h,s:n.s,l:E(n.l+100*t,0,100),a:n.a}},K=function(){function e(e){this.parsed=U(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return null!==this.parsed},e.prototype.brightness=function(){return k(Z(this.rgba),2)},e.prototype.isDark=function(){return Z(this.rgba)<.5},e.prototype.isLight=function(){return Z(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=V(this.rgba)).r,n=e.g,s=e.b,r=(i=e.a)<1?T(k(255*i)):"","#"+T(t)+T(n)+T(s)+r;var e,t,n,s,i,r},e.prototype.toRgb=function(){return V(this.rgba)},e.prototype.toRgbString=function(){return t=(e=V(this.rgba)).r,n=e.g,s=e.b,(i=e.a)<1?"rgba("+t+", "+n+", "+s+", "+i+")":"rgb("+t+", "+n+", "+s+")";var e,t,n,s,i},e.prototype.toHsl=function(){return M(D(this.rgba))},e.prototype.toHslString=function(){return t=(e=M(D(this.rgba))).h,n=e.s,s=e.l,(i=e.a)<1?"hsla("+t+", "+n+"%, "+s+"%, "+i+")":"hsl("+t+", "+n+"%, "+s+"%)";var e,t,n,s,i},e.prototype.toHsv=function(){return e=A(this.rgba),{h:k(e.h),s:k(e.s),v:k(e.v),a:k(e.a,3)};var e},e.prototype.invert=function(){return X({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),X(q(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),X(q(this.rgba,-e))},e.prototype.grayscale=function(){return X(q(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),X(Y(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),X(Y(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?X({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):k(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=D(this.rgba);return"number"==typeof e?X({h:e,s:t.s,l:t.l,a:t.a}):k(t.h)},e.prototype.isEqual=function(e){return this.toHex()===X(e).toHex()},e}(),X=function(e){return e instanceof K?e:new K(e)},Q=[],J=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},$=function(e){return.2126*J(e.r)+.7152*J(e.g)+.0722*J(e.b)};const ee=window.wp.privateApis,{lock:te,unlock:ne}=(0,ee.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/edit-site"),{useGlobalSetting:se,useGlobalStyle:ie}=ne(x.privateApis);function re(){const[e="black"]=ie("color.text"),[t="white"]=ie("color.background"),[n=e]=ie("elements.h1.color.text"),[s=n]=ie("elements.link.color.text"),[i=s]=ie("elements.button.color.background"),[r]=se("color.palette.core"),[a]=se("color.palette.theme"),[o]=se("color.palette.custom"),l=(a??[]).concat(o??[]).concat(r??[]),c=l.filter((({color:t})=>t===e)),u=l.filter((({color:e})=>e===i));return{paletteColors:l,highlightedColors:c.concat(u).concat(l).filter((({color:e})=>e!==t)).slice(0,2)}}function ae(e,t,n){return e&&"object"==typeof e?(t.reduce(((e,s,i)=>(void 0===e[s]&&(Number.isInteger(t[i+1])?e[s]=[]:e[s]={}),i===t.length-1&&(e[s]=n),e[s])),e),e):e}!function(e){e.forEach((function(e){Q.indexOf(e)<0&&(e(K,G),Q.push(e))}))}([function(e){e.prototype.luminance=function(){return e=$(this.rgba),void 0===(t=2)&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0;var e,t,n},e.prototype.contrast=function(t){void 0===t&&(t="#FFF");var n,s,i,r,a,o,l,c=t instanceof e?t:new e(t);return r=this.rgba,a=c.toRgb(),n=(o=$(r))>(l=$(a))?(o+.05)/(l+.05):(l+.05)/(o+.05),void 0===(s=2)&&(s=0),void 0===i&&(i=Math.pow(10,s)),Math.floor(i*n)/i+0},e.prototype.isReadable=function(e,t){return void 0===e&&(e="#FFF"),void 0===t&&(t={}),this.contrast(e)>=(a=void 0===(r=(n=t).size)?"normal":r,"AAA"===(i=void 0===(s=n.level)?"AA":s)&&"normal"===a?7:"AA"===i&&"large"===a?3:4.5);var n,s,i,r,a}}]);const{cleanEmptyObject:oe,GlobalStylesContext:le}=ne(x.privateApis),ce={...o.__EXPERIMENTAL_STYLE_PROPERTY,blockGap:{value:["spacing","blockGap"]}},ue={"border.color":"color","color.background":"color","color.text":"color","elements.link.color.text":"color","elements.link.:hover.color.text":"color","elements.link.typography.fontFamily":"font-family","elements.link.typography.fontSize":"font-size","elements.button.color.text":"color","elements.button.color.background":"color","elements.button.typography.fontFamily":"font-family","elements.button.typography.fontSize":"font-size","elements.caption.color.text":"color","elements.heading.color":"color","elements.heading.color.background":"color","elements.heading.typography.fontFamily":"font-family","elements.heading.gradient":"gradient","elements.heading.color.gradient":"gradient","elements.h1.color":"color","elements.h1.color.background":"color","elements.h1.typography.fontFamily":"font-family","elements.h1.color.gradient":"gradient","elements.h2.color":"color","elements.h2.color.background":"color","elements.h2.typography.fontFamily":"font-family","elements.h2.color.gradient":"gradient","elements.h3.color":"color","elements.h3.color.background":"color","elements.h3.typography.fontFamily":"font-family","elements.h3.color.gradient":"gradient","elements.h4.color":"color","elements.h4.color.background":"color","elements.h4.typography.fontFamily":"font-family","elements.h4.color.gradient":"gradient","elements.h5.color":"color","elements.h5.color.background":"color","elements.h5.typography.fontFamily":"font-family","elements.h5.color.gradient":"gradient","elements.h6.color":"color","elements.h6.color.background":"color","elements.h6.typography.fontFamily":"font-family","elements.h6.color.gradient":"gradient","color.gradient":"gradient",blockGap:"spacing","typography.fontSize":"font-size","typography.fontFamily":"font-family"},de={"border.color":"borderColor","color.background":"backgroundColor","color.text":"textColor","color.gradient":"gradient","typography.fontSize":"fontSize","typography.fontFamily":"fontFamily"},he=["border","color","spacing","typography"],pe=(e,t)=>{let n=e;return t.forEach((e=>{n=n?.[e]})),n},fe=["borderColor","borderWidth","borderStyle"],me=["top","right","bottom","left"];function ge(e,t,n){if(!t?.[e]||n?.[e]?.style)return[];const{color:s,style:i,width:r}=t[e];return!(s||r)||i?[]:[{path:["border",e,"style"],value:"solid"}]}function ve(e,t,n){const s=function(e,t){const{supportedPanels:n}=(0,c.useSelect)((n=>({supportedPanels:ne(n(o.store)).getSupportedStyles(e,t)})),[e,t]);return n}(e),i=n?.styles?.blocks?.[e];return(0,h.useMemo)((()=>{const e=s.flatMap((e=>{if(!ce[e])return[];const{value:n}=ce[e],s=n.join("."),i=t[de[s]],r=i?`var:preset|${ue[s]}|${i}`:pe(t.style,n);if("linkColor"===e){const e=r?[{path:n,value:r}]:[],s=["elements","link",":hover","color","text"],i=pe(t.style,s);return i&&e.push({path:s,value:i}),e}if(fe.includes(e)&&r){const e=[{path:n,value:r}];return me.forEach((t=>{const s=[...n];s.splice(-1,0,t),e.push({path:s,value:r})})),e}return r?[{path:n,value:r}]:[]}));return function(e,t,n){if(!e&&!t)return[];const s=[...ge("top",e,n),...ge("right",e,n),...ge("bottom",e,n),...ge("left",e,n)],{color:i,style:r,width:a}=e||{};return(t||i||a)&&!r&&me.forEach((e=>{n?.[e]?.style||s.push({path:["border",e,"style"],value:"solid"})})),s}(t.style?.border,t.borderColor,i?.border).forEach((t=>e.push(t))),e}),[s,t,i])}function ye({name:e,attributes:t,setAttributes:n}){const{user:s,setUserConfig:i}=(0,h.useContext)(le),r=ve(e,t,s),{__unstableMarkNextChangeAsNotPersistent:l}=(0,c.useDispatch)(x.store),{createSuccessNotice:u}=(0,c.useDispatch)(_.store),d=(0,h.useCallback)((()=>{if(0!==r.length&&r.length>0){const{style:a}=t,c=structuredClone(a),d=structuredClone(s);for(const{path:t,value:n}of r)ae(c,t,void 0),ae(d,["styles","blocks",e,...t],n);const h={borderColor:void 0,backgroundColor:void 0,textColor:void 0,gradient:void 0,fontSize:void 0,fontFamily:void 0,style:oe(c)};l(),n(h),i(d,{undoIgnore:!0}),u((0,w.sprintf)((0,w.__)("%s styles applied."),(0,o.getBlockType)(e).title),{type:"snackbar",actions:[{label:(0,w.__)("Undo"),onClick(){l(),n(t),i(s,{undoIgnore:!0})}}]})}}),[l,t,r,u,e,n,i,s]);return(0,a.jsxs)(b.BaseControl,{__nextHasNoMarginBottom:!0,className:"edit-site-push-changes-to-global-styles-control",help:(0,w.sprintf)((0,w.__)("Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks."),(0,o.getBlockType)(e).title),children:[(0,a.jsx)(b.BaseControl.VisualLabel,{children:(0,w.__)("Styles")}),(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"secondary",accessibleWhenDisabled:!0,disabled:0===r.length,onClick:d,children:(0,w.__)("Apply globally")})]})}function xe(e){const t=(0,x.useBlockEditingMode)(),n=(0,c.useSelect)((e=>e(j.store).getCurrentTheme()?.is_block_theme),[]),s=he.some((t=>(0,o.hasBlockSupport)(e.name,t)));return"default"===t&&s&&n?(0,a.jsx)(x.InspectorAdvancedControls,{children:(0,a.jsx)(ye,{...e})}):null}const be=(0,y.createHigherOrderComponent)((e=>t=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(e,{...t},"edit"),t.isSelected&&(0,a.jsx)(xe,{...t})]})));(0,v.addFilter)("editor.BlockEdit","core/edit-site/push-changes-to-global-styles",be);var we=(0,c.combineReducers)({settings:function(e={},t){return"UPDATE_SETTINGS"===t.type?{...e,...t.settings}:e},editedPost:function(e={},t){switch(t.type){case"SET_EDITED_POST":return{postType:t.postType,id:t.id,context:t.context};case"SET_EDITED_POST_CONTEXT":return{...e,context:t.context}}return e},saveViewPanel:function(e=!1,t){return"SET_IS_SAVE_VIEW_OPENED"===t.type?t.isOpen:e},editorCanvasContainerView:function(e=void 0,t){return"SET_EDITOR_CANVAS_CONTAINER_VIEW"===t.type?t.view:e},routes:function(e=[],t){switch(t.type){case"REGISTER_ROUTE":return[...e,t.route];case"UNREGISTER_ROUTE":return e.filter((e=>e.name!==t.name))}return e}});const _e=window.wp.patterns,je="wp_navigation",Se="wp_template",Ce="wp_template_part",ke="custom",Ee="uncategorized",Pe="all-parts",{PATTERN_TYPES:Ie,PATTERN_DEFAULT_CATEGORY:Ve,PATTERN_USER_CATEGORY:Oe,EXCLUDED_PATTERN_SOURCES:Te,PATTERN_SYNC_TYPES:Ae}=ne(_e.privateApis),Ne=[Ce,je,Ie.user],Fe={[Se]:(0,w.__)("Template"),[Ce]:(0,w.__)("Template part"),[Ie.user]:(0,w.__)("Pattern"),[je]:(0,w.__)("Navigation")},Me="grid",Be="table",De="isAny",{interfaceStore:Re}=ne(f.privateApis);function Le(e){return function({registry:t}){d()("dispatch( 'core/edit-site' ).toggleFeature( featureName )",{since:"6.0",alternative:"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )"}),t.dispatch(m.store).toggle("core/edit-site",e)}}const ze=e=>({registry:t})=>{d()("dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType",{since:"6.5",version:"6.7",hint:"registry.dispatch( editorStore ).setDeviceType"}),t.dispatch(f.store).setDeviceType(e)};function He(){return d()("dispatch( 'core/edit-site' ).setTemplate",{since:"6.5",version:"6.8",hint:"The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically."}),{type:"NOTHING"}}const Ge=e=>async({dispatch:t,registry:n})=>{d()("dispatch( 'core/edit-site' ).addTemplate",{since:"6.5",version:"6.8",hint:"use saveEntityRecord directly"});const s=await n.dispatch(j.store).saveEntityRecord("postType",Se,e);e.content&&n.dispatch(j.store).editEntityRecord("postType",Se,s.id,{blocks:(0,o.parse)(e.content)},{undoIgnore:!0}),t({type:"SET_EDITED_POST",postType:Se,id:s.id})},We=e=>({registry:t})=>ne(t.dispatch(f.store)).removeTemplates([e]);function Ue(e){return d()("dispatch( 'core/edit-site' ).setTemplatePart",{since:"6.8"}),{type:"SET_EDITED_POST",postType:Ce,id:e}}function qe(e){return d()("dispatch( 'core/edit-site' ).setNavigationMenu",{since:"6.8"}),{type:"SET_EDITED_POST",postType:je,id:e}}function Ze(e,t,n){return{type:"SET_EDITED_POST",postType:e,id:t,context:n}}function Ye(){return d()("dispatch( 'core/edit-site' ).setHomeTemplateId",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function Ke(e){return d()("dispatch( 'core/edit-site' ).setEditedPostContext",{since:"6.8"}),{type:"SET_EDITED_POST_CONTEXT",context:e}}function Xe(){return d()("dispatch( 'core/edit-site' ).setPage",{since:"6.5",version:"6.8",hint:"The setPage is not needed anymore, the correct entity is resolved from the URL automatically."}),{type:"NOTHING"}}function Qe(){return d()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function Je(){return d()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function $e(){return d()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}const et=e=>({registry:t})=>{d()("dispatch( 'core/edit-site' ).setIsInserterOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsInserterOpened"}),t.dispatch(f.store).setIsInserterOpened(e)},tt=e=>({registry:t})=>{d()("dispatch( 'core/edit-site' ).setIsListViewOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsListViewOpened"}),t.dispatch(f.store).setIsListViewOpened(e)};function nt(e){return{type:"UPDATE_SETTINGS",settings:e}}function st(e){return{type:"SET_IS_SAVE_VIEW_OPENED",isOpen:e}}const it=(e,t)=>({registry:n})=>ne(n.dispatch(f.store)).revertTemplate(e,t),rt=e=>({registry:t})=>{t.dispatch(Re).enableComplementaryArea("core",e)},at=()=>({registry:e})=>{e.dispatch(Re).disableComplementaryArea("core")},ot=e=>({registry:t})=>{d()("dispatch( 'core/edit-site' ).switchEditorMode",{since:"6.6",alternative:"dispatch( 'core/editor').switchEditorMode"}),t.dispatch(f.store).switchEditorMode(e)},lt=e=>({dispatch:t,registry:n})=>{d()("dispatch( 'core/edit-site' ).setHasPageContentFocus",{since:"6.5"}),e&&n.dispatch(x.store).clearSelectedBlock(),t({type:"SET_HAS_PAGE_CONTENT_FOCUS",hasPageContentFocus:e})},ct=()=>({registry:e})=>{d()("dispatch( 'core/edit-site' ).toggleDistractionFree",{since:"6.6",alternative:"dispatch( 'core/editor').toggleDistractionFree"}),e.dispatch(f.store).toggleDistractionFree()},ut=e=>({dispatch:t})=>{t({type:"SET_EDITOR_CANVAS_CONTAINER_VIEW",view:e})};function dt(e){return{type:"REGISTER_ROUTE",route:e}}function ht(e){return{type:"UNREGISTER_ROUTE",name:e}}const pt=[];const ft=(0,c.createRegistrySelector)((e=>(t,n)=>(d()("select( 'core/edit-site' ).isFeatureActive",{since:"6.0",alternative:"select( 'core/preferences' ).get"}),!!e(m.store).get("core/edit-site",n)))),mt=(0,c.createRegistrySelector)((e=>()=>(d()("select( 'core/edit-site' ).__experimentalGetPreviewDeviceType",{since:"6.5",version:"6.7",alternative:"select( 'core/editor' ).getDeviceType"}),e(f.store).getDeviceType()))),gt=(0,c.createRegistrySelector)((e=>()=>(d()("wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()",{since:"6.7",alternative:"wp.data.select( 'core' ).canUser( 'create', { kind: 'postType', type: 'attachment' } )"}),e(j.store).canUser("create","media")))),vt=(0,c.createRegistrySelector)((e=>()=>{d()("select( 'core/edit-site' ).getReusableBlocks()",{since:"6.5",version:"6.8",alternative:"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )"});return"web"===h.Platform.OS?e(j.store).getEntityRecords("postType","wp_block",{per_page:-1}):[]}));function yt(e){return e.settings}function xt(){d()("select( 'core/edit-site' ).getHomeTemplateId",{since:"6.2",version:"6.4"})}function bt(e){return d()("select( 'core/edit-site' ).getEditedPostType",{since:"6.8",alternative:"select( 'core/editor' ).getCurrentPostType"}),e.editedPost.postType}function wt(e){return d()("select( 'core/edit-site' ).getEditedPostId",{since:"6.8",alternative:"select( 'core/editor' ).getCurrentPostId"}),e.editedPost.id}function _t(e){return d()("select( 'core/edit-site' ).getEditedPostContext",{since:"6.8"}),e.editedPost.context}function jt(e){return d()("select( 'core/edit-site' ).getPage",{since:"6.8"}),{context:e.editedPost.context}}const St=(0,c.createRegistrySelector)((e=>()=>(d()("select( 'core/edit-site' ).isInserterOpened",{since:"6.5",alternative:"select( 'core/editor' ).isInserterOpened"}),e(f.store).isInserterOpened()))),Ct=(0,c.createRegistrySelector)((e=>()=>(d()("select( 'core/edit-site' ).__experimentalGetInsertionPoint",{since:"6.5",version:"6.7"}),ne(e(f.store)).getInserter()))),kt=(0,c.createRegistrySelector)((e=>()=>(d()("select( 'core/edit-site' ).isListViewOpened",{since:"6.5",alternative:"select( 'core/editor' ).isListViewOpened"}),e(f.store).isListViewOpened())));function Et(e){return e.saveViewPanel}function Pt(e){const t=e(j.store).getEntityRecords("postType",Ce,{per_page:-1}),{getBlocksByName:n,getBlocksByClientId:s}=e(x.store);return[s(n("core/template-part")),t]}const It=(0,c.createRegistrySelector)((e=>(0,c.createSelector)((()=>(d()("select( 'core/edit-site' ).getCurrentTemplateTemplateParts()",{since:"6.7",version:"6.9",alternative:"select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )"}),function(e=pt,t){const n=t?t.reduce(((e,t)=>({...e,[t.id]:t})),{}):{},s=[],i=[...e];for(;i.length;){const{innerBlocks:e,...t}=i.shift();if(i.unshift(...e),(0,o.isTemplatePart)(t)){const{attributes:{theme:e,slug:i}}=t,r=n[`${e}//${i}`];r&&s.push({templatePart:r,block:t})}}return s}(...Pt(e)))),(()=>Pt(e))))),Vt=(0,c.createRegistrySelector)((e=>()=>e(m.store).get("core","editorMode")));function Ot(){d()("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu",{since:"6.2",version:"6.4"})}function Tt(){d()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu",{since:"6.2",version:"6.4"})}function At(){d()("dispatch( 'core/edit-site' ).isNavigationOpened",{since:"6.2",version:"6.4"})}function Nt(e){return d()("select( 'core/edit-site' ).isPage",{since:"6.8",alternative:"select( 'core/editor' ).getCurrentPostType"}),!!e.editedPost.context?.postId}function Ft(){return d()("select( 'core/edit-site' ).hasPageContentFocus",{since:"6.5"}),!1}function Mt(e){return e.editorCanvasContainerView}function Bt(e){return e.routes}const Dt={reducer:we,actions:e,selectors:n},Rt=(0,c.createReduxStore)("core/edit-site",Dt);(0,c.register)(Rt),ne(Rt).registerPrivateSelectors(s),ne(Rt).registerPrivateActions(t);const Lt=window.wp.router;function zt(e){var t,n,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=zt(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}const Ht=function(){for(var e,t,n=0,s="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=zt(e))&&(s&&(s+=" "),s+=t);return s},Gt=(0,h.forwardRef)((({children:e,className:t,ariaLabel:n,as:s="div",...i},r)=>(0,a.jsx)(s,{ref:r,className:Ht("admin-ui-navigable-region",t),"aria-label":n,role:"region",tabIndex:"-1",...i,children:e})));Gt.displayName="NavigableRegion";var Wt=Gt;const Ut=window.wp.plugins,qt=window.wp.htmlEntities,Zt=window.wp.primitives;var Yt=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})});const Kt=window.wp.commands,Xt=window.wp.keycodes,Qt=window.wp.url;var Jt=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,a.jsx)(Zt.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"})});var $t=function({className:e}){const{isRequestingSite:t,siteIconUrl:n}=(0,c.useSelect)((e=>{const{getEntityRecord:t}=e(j.store),n=t("root","__unstableBase",void 0);return{isRequestingSite:!n,siteIconUrl:n?.site_icon_url}}),[]);if(t&&!n)return(0,a.jsx)("div",{className:"edit-site-site-icon__image"});const s=n?(0,a.jsx)("img",{className:"edit-site-site-icon__image",alt:(0,w.__)("Site Icon"),src:n}):(0,a.jsx)(b.Icon,{className:"edit-site-site-icon__icon",icon:Jt,size:48});return(0,a.jsx)("div",{className:Ht(e,"edit-site-site-icon"),children:s})};const en=window.wp.dom,tn=(0,h.createContext)((()=>{}));function nn(){let e={direction:null,focusSelector:null};return{get:()=>e,navigate(t,n=null){e={direction:t,focusSelector:"forward"===t&&n?n:e.focusSelector}}}}function sn({children:e,shouldAnimate:t}){const n=(0,h.useContext)(tn),s=(0,h.useRef)(),[i,r]=(0,h.useState)(null);(0,h.useLayoutEffect)((()=>{const{direction:e,focusSelector:t}=n.get();!function(e,t,n){let s;if("back"===t&&n&&(s=e.querySelector(n)),null!==t&&!s){const[t]=en.focus.tabbable.find(e);s=t??e}s?.focus()}(s.current,e,t),r(e)}),[n]);const o=Ht("edit-site-sidebar__screen-wrapper",t?{"slide-from-left":"back"===i,"slide-from-right":"forward"===i}:{});return(0,a.jsx)("div",{ref:s,className:o,children:e})}function rn({children:e}){const[t]=(0,h.useState)(nn);return(0,a.jsx)(tn.Provider,{value:t,children:e})}function an({routeKey:e,shouldAnimate:t,children:n}){return(0,a.jsx)("div",{className:"edit-site-sidebar__content",children:(0,a.jsx)(sn,{shouldAnimate:t,children:n},e)})}tn.displayName="SidebarNavigationContext";const{useLocation:on,useHistory:ln}=ne(Lt.privateApis),cn=(0,h.memo)((0,h.forwardRef)((({isTransparent:e},t)=>{const{dashboardLink:n,homeUrl:s,siteTitle:i}=(0,c.useSelect)((e=>{const{getSettings:t}=ne(e(Rt)),{getEntityRecord:n}=e(j.store),s=n("root","site");return{dashboardLink:t().__experimentalDashboardLink,homeUrl:n("root","__unstableBase")?.home,siteTitle:!s?.title&&s?.url?(0,Qt.filterURLForDisplay)(s?.url):s?.title}}),[]),{open:r}=(0,c.useDispatch)(Kt.store);return(0,a.jsx)("div",{className:"edit-site-site-hub",children:(0,a.jsxs)(b.__experimentalHStack,{justify:"flex-start",spacing:"0",children:[(0,a.jsx)("div",{className:Ht("edit-site-site-hub__view-mode-toggle-container",{"has-transparent-background":e}),children:(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,ref:t,href:n,label:(0,w.__)("Go to the Dashboard"),className:"edit-site-layout__view-mode-toggle",style:{transform:"scale(0.5333) translateX(-4px)",borderRadius:4},children:(0,a.jsx)($t,{className:"edit-site-layout__view-mode-toggle-icon"})})}),(0,a.jsxs)(b.__experimentalHStack,{children:[(0,a.jsx)("div",{className:"edit-site-site-hub__title",children:(0,a.jsxs)(b.Button,{__next40pxDefaultSize:!0,variant:"link",href:s,target:"_blank",children:[(0,qt.decodeEntities)(i),(0,a.jsx)(b.VisuallyHidden,{as:"span",children:(0,w.__)("(opens in a new tab)")})]})}),(0,a.jsx)(b.__experimentalHStack,{spacing:0,expanded:!1,className:"edit-site-site-hub__actions",children:(0,a.jsx)(b.Button,{size:"compact",className:"edit-site-site-hub_toggle-command-center",icon:Yt,onClick:()=>r(),label:(0,w.__)("Open command palette"),shortcut:Xt.displayShortcut.primary("k")})})]})]})})})));var un=cn;const dn=(0,h.memo)((0,h.forwardRef)((({isTransparent:e},t)=>{const{path:n}=on(),s=ln(),{navigate:i}=(0,h.useContext)(tn),{dashboardLink:r,homeUrl:o,siteTitle:l,isBlockTheme:u,isClassicThemeWithStyleBookSupport:d}=(0,c.useSelect)((e=>{const{getSettings:t}=ne(e(Rt)),{getEntityRecord:n,getCurrentTheme:s}=e(j.store),i=n("root","site"),r=s(),a=t(),o=r.theme_supports["editor-styles"],l=a.supportsLayout;return{dashboardLink:a.__experimentalDashboardLink,homeUrl:n("root","__unstableBase")?.home,siteTitle:!i?.title&&i?.url?(0,Qt.filterURLForDisplay)(i?.url):i?.title,isBlockTheme:r?.is_block_theme,isClassicThemeWithStyleBookSupport:!r?.is_block_theme&&(o||l)}}),[]),{open:p}=(0,c.useDispatch)(Kt.store);let f;"/"!==n&&(u||d?f="/":"/pattern"!==n&&(f="/pattern"));const m={href:f?void 0:r,label:f?(0,w.__)("Go to Site Editor"):(0,w.__)("Go to the Dashboard"),onClick:f?()=>{s.navigate(f),i("back")}:void 0};return(0,a.jsx)("div",{className:"edit-site-site-hub",children:(0,a.jsxs)(b.__experimentalHStack,{justify:"flex-start",spacing:"0",children:[(0,a.jsx)("div",{className:Ht("edit-site-site-hub__view-mode-toggle-container",{"has-transparent-background":e}),children:(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,ref:t,className:"edit-site-layout__view-mode-toggle",style:{transform:"scale(0.5)",borderRadius:4},...m,children:(0,a.jsx)($t,{className:"edit-site-layout__view-mode-toggle-icon"})})}),(0,a.jsxs)(b.__experimentalHStack,{children:[(0,a.jsx)("div",{className:"edit-site-site-hub__title",children:(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"link",href:o,target:"_blank",label:(0,w.__)("View site (opens in a new tab)"),children:(0,qt.decodeEntities)(l)})}),(0,a.jsx)(b.__experimentalHStack,{spacing:0,expanded:!1,className:"edit-site-site-hub__actions",children:(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,className:"edit-site-site-hub_toggle-command-center",icon:Yt,onClick:()=>p(),label:(0,w.__)("Open command palette"),shortcut:Xt.displayShortcut.primary("k")})})]})]})})}))),{useLocation:hn,useHistory:pn}=ne(Lt.privateApis),fn={position:void 0,userSelect:void 0,cursor:void 0,width:void 0,height:void 0,top:void 0,right:void 0,bottom:void 0,left:void 0},mn=320,gn=9/19.5,vn={width:"100%",height:"100%"};function yn(e,t){const n=1-Math.max(0,Math.min(1,(e-mn)/980)),s=((e,t,n)=>e+(t-e)*n)(t,gn,n);return e/s}var xn=function e({isFullWidth:t,isOversized:n,setIsOversized:s,isReady:i,children:r,defaultSize:o,innerContentStyle:l}){const u=pn(),{path:d,query:p}=hn(),{canvas:f="view"}=p,m=(0,y.useReducedMotion)(),[g,v]=(0,h.useState)(vn),[x,_]=(0,h.useState)(),[S,C]=(0,h.useState)(!1),[k,E]=(0,h.useState)(!1),[P,I]=(0,h.useState)(1),V={type:"tween",duration:S?0:.5},O=(0,h.useRef)(null),T=(0,y.useInstanceId)(e,"edit-site-resizable-frame-handle-help"),A=o.width/o.height,N=(0,c.useSelect)((e=>{const{getCurrentTheme:t}=e(j.store);return t()?.is_block_theme}),[]),F={default:{flexGrow:0,height:g.height},fullWidth:{flexGrow:1,height:g.height}},M={hidden:{opacity:0,...(0,w.isRTL)()?{right:0}:{left:0}},visible:{opacity:1,...(0,w.isRTL)()?{right:-14}:{left:-14}},active:{opacity:1,...(0,w.isRTL)()?{right:-14}:{left:-14},scaleY:1.3}},B=S?"active":k?"visible":"hidden";return(0,a.jsx)(b.ResizableBox,{as:b.__unstableMotion.div,ref:O,initial:!1,variants:F,animate:t?"fullWidth":"default",onAnimationComplete:e=>{"fullWidth"===e&&v({width:"100%",height:"100%"})},whileHover:"view"===f&&N?{scale:1.005,transition:{duration:m?0:.5,ease:"easeOut"}}:{},transition:V,size:g,enable:{top:!1,bottom:!1,...(0,w.isRTL)()?{right:i,left:!1}:{left:i,right:!1},topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},resizeRatio:P,handleClasses:void 0,handleStyles:{left:fn,right:fn},minWidth:mn,maxWidth:t?"100%":"150%",maxHeight:"100%",onFocus:()=>E(!0),onBlur:()=>E(!1),onMouseOver:()=>E(!0),onMouseOut:()=>E(!1),handleComponent:{[(0,w.isRTL)()?"right":"left"]:"view"===f&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.Tooltip,{text:(0,w.__)("Drag to resize"),children:(0,a.jsx)(b.__unstableMotion.button,{role:"separator","aria-orientation":"vertical",className:Ht("edit-site-resizable-frame__handle",{"is-resizing":S}),variants:M,animate:B,"aria-label":(0,w.__)("Drag to resize"),"aria-describedby":T,"aria-valuenow":O.current?.resizable?.offsetWidth||void 0,"aria-valuemin":mn,"aria-valuemax":o.width,onKeyDown:e=>{if(!["ArrowLeft","ArrowRight"].includes(e.key))return;e.preventDefault();const t=20*(e.shiftKey?5:1)*("ArrowLeft"===e.key?1:-1)*((0,w.isRTL)()?-1:1),n=Math.min(Math.max(mn,O.current.resizable.offsetWidth+t),o.width);v({width:n,height:yn(n,A)})},initial:"hidden",exit:"hidden",whileFocus:"active",whileHover:"active"},"handle")}),(0,a.jsx)("div",{hidden:!0,id:T,children:(0,w.__)("Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.")})]})},onResizeStart:(e,t,n)=>{_(n.offsetWidth),C(!0)},onResize:(e,t,i,r)=>{const a=r.width/P,l=Math.abs(a),c=r.width<0?l:(o.width-x)/2,u=Math.min(l,c),d=0===l?0:u/l;I(1-d+2*d);const h=x+r.width;s(h>o.width),v({height:n?"100%":yn(h,A)})},onResizeStop:(e,t,i)=>{if(C(!1),!n)return;s(!1);i.ownerDocument.documentElement.offsetWidth-i.offsetWidth>200||!N?v(vn):u.navigate((0,Qt.addQueryArgs)(d,{canvas:"edit"}),{transition:"canvas-mode-edit-transition"})},className:Ht("edit-site-resizable-frame__inner",{"is-resizing":S}),showHandle:!1,children:(0,a.jsx)("div",{className:"edit-site-resizable-frame__inner-content",style:l,children:r})})};const bn=window.wp.keyboardShortcuts,wn="core/edit-site/save";function _n(){const{__experimentalGetDirtyEntityRecords:e,isSavingEntityRecord:t}=(0,c.useSelect)(j.store),{hasNonPostEntityChanges:n,isPostSavingLocked:s}=(0,c.useSelect)(f.store),{savePost:i}=(0,c.useDispatch)(f.store),{setIsSaveViewOpened:r}=(0,c.useDispatch)(Rt),{registerShortcut:a,unregisterShortcut:o}=(0,c.useDispatch)(bn.store);return(0,h.useEffect)((()=>(a({name:wn,category:"global",description:(0,w.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),()=>{o(wn)})),[a,o]),(0,bn.useShortcut)("core/edit-site/save",(a=>{a.preventDefault();const o=e(),l=!!o.length,c=o.some((e=>t(e.kind,e.name,e.key)));l&&!c&&(n()?r(!0):s()||i())})),null}const jn=1e4;function Sn(){const[e,t]=(0,h.useState)(!1),n=(0,c.useSelect)((t=>{const n=t(j.store).hasResolvingSelectors();return!e&&!n}),[e]);return(0,h.useEffect)((()=>{let n;return e||(n=setTimeout((()=>{t(!0)}),jn)),()=>{clearTimeout(n)}}),[e]),(0,h.useEffect)((()=>{if(n){const e=setTimeout((()=>{t(!0)}),100);return()=>{clearTimeout(e)}}}),[n]),!e}var Cn=zn(),kn=e=>Bn(e,Cn),En=zn();kn.write=e=>Bn(e,En);var Pn=zn();kn.onStart=e=>Bn(e,Pn);var In=zn();kn.onFrame=e=>Bn(e,In);var Vn=zn();kn.onFinish=e=>Bn(e,Vn);var On=[];kn.setTimeout=(e,t)=>{let n=kn.now()+t,s=()=>{let e=On.findIndex((e=>e.cancel==s));~e&&On.splice(e,1),Fn-=~e?1:0},i={time:n,handler:e,cancel:s};return On.splice(Tn(n),0,i),Fn+=1,Dn(),i};var Tn=e=>~(~On.findIndex((t=>t.time>e))||~On.length);kn.cancel=e=>{Pn.delete(e),In.delete(e),Vn.delete(e),Cn.delete(e),En.delete(e)},kn.sync=e=>{Mn=!0,kn.batchedUpdates(e),Mn=!1},kn.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function s(...e){t=e,kn.onStart(n)}return s.handler=e,s.cancel=()=>{Pn.delete(n),t=null},s};var An=typeof window<"u"?window.requestAnimationFrame:()=>{};kn.use=e=>An=e,kn.now=typeof performance<"u"?()=>performance.now():Date.now,kn.batchedUpdates=e=>e(),kn.catch=console.error,kn.frameLoop="always",kn.advance=()=>{"demand"!==kn.frameLoop?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):Ln()};var Nn=-1,Fn=0,Mn=!1;function Bn(e,t){Mn?(t.delete(e),e(0)):(t.add(e),Dn())}function Dn(){Nn<0&&(Nn=0,"demand"!==kn.frameLoop&&An(Rn))}function Rn(){~Nn&&(An(Rn),kn.batchedUpdates(Ln))}function Ln(){let e=Nn;Nn=kn.now();let t=Tn(Nn);t&&(Hn(On.splice(0,t),(e=>e.handler())),Fn-=t),Fn?(Pn.flush(),Cn.flush(e?Math.min(64,Nn-e):16.667),In.flush(),En.flush(),Vn.flush()):Nn=-1}function zn(){let e=new Set,t=e;return{add(n){Fn+=t!=e||e.has(n)?0:1,e.add(n)},delete:n=>(Fn-=t==e&&e.has(n)?1:0,e.delete(n)),flush(n){t.size&&(e=new Set,Fn-=t.size,Hn(t,(t=>t(n)&&e.add(t))),Fn+=e.size,t=e)}}}function Hn(e,t){e.forEach((e=>{try{t(e)}catch(e){kn.catch(e)}}))}var Gn=i(1609),Wn=i.t(Gn,2),Un=Object.defineProperty,qn={};function Zn(){}((e,t)=>{for(var n in t)Un(e,n,{get:t[n],enumerable:!0})})(qn,{assign:()=>os,colors:()=>is,createStringInterpolator:()=>es,skipAnimation:()=>rs,to:()=>ts,willAdvance:()=>as});var Yn={arr:Array.isArray,obj:e=>!!e&&"Object"===e.constructor.name,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,und:e=>void 0===e};function Kn(e,t){if(Yn.arr(e)){if(!Yn.arr(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return e===t}var Xn=(e,t)=>e.forEach(t);function Qn(e,t,n){if(Yn.arr(e))for(let s=0;s<e.length;s++)t.call(n,e[s],`${s}`);else for(let s in e)e.hasOwnProperty(s)&&t.call(n,e[s],s)}var Jn=e=>Yn.und(e)?[]:Yn.arr(e)?e:[e];function $n(e,t){if(e.size){let n=Array.from(e);e.clear(),Xn(n,t)}}var es,ts,ns=(e,...t)=>$n(e,(e=>e(...t))),ss=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),is=null,rs=!1,as=Zn,os=e=>{e.to&&(ts=e.to),e.now&&(kn.now=e.now),void 0!==e.colors&&(is=e.colors),null!=e.skipAnimation&&(rs=e.skipAnimation),e.createStringInterpolator&&(es=e.createStringInterpolator),e.requestAnimationFrame&&kn.use(e.requestAnimationFrame),e.batchedUpdates&&(kn.batchedUpdates=e.batchedUpdates),e.willAdvance&&(as=e.willAdvance),e.frameLoop&&(kn.frameLoop=e.frameLoop)},ls=new Set,cs=[],us=[],ds=0,hs={get idle(){return!ls.size&&!cs.length},start(e){ds>e.priority?(ls.add(e),kn.onStart(ps)):(fs(e),kn(gs))},advance:gs,sort(e){if(ds)kn.onFrame((()=>hs.sort(e)));else{let t=cs.indexOf(e);~t&&(cs.splice(t,1),ms(e))}},clear(){cs=[],ls.clear()}};function ps(){ls.forEach(fs),ls.clear(),kn(gs)}function fs(e){cs.includes(e)||ms(e)}function ms(e){cs.splice(function(e,t){let n=e.findIndex(t);return n<0?e.length:n}(cs,(t=>t.priority>e.priority)),0,e)}function gs(e){let t=us;for(let n=0;n<cs.length;n++){let s=cs[n];ds=s.priority,s.idle||(as(s),s.advance(e),s.idle||t.push(s))}return ds=0,(us=cs).length=0,(cs=t).length>0}var vs="[-+]?\\d*\\.?\\d+",ys=vs+"%";function xs(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var bs=new RegExp("rgb"+xs(vs,vs,vs)),ws=new RegExp("rgba"+xs(vs,vs,vs,vs)),_s=new RegExp("hsl"+xs(vs,ys,ys)),js=new RegExp("hsla"+xs(vs,ys,ys,vs)),Ss=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,Cs=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ks=/^#([0-9a-fA-F]{6})$/,Es=/^#([0-9a-fA-F]{8})$/;function Ps(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Is(e,t,n){let s=n<.5?n*(1+t):n+t-n*t,i=2*n-s,r=Ps(i,s,e+1/3),a=Ps(i,s,e),o=Ps(i,s,e-1/3);return Math.round(255*r)<<24|Math.round(255*a)<<16|Math.round(255*o)<<8}function Vs(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function Os(e){return(parseFloat(e)%360+360)%360/360}function Ts(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function As(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function Ns(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=ks.exec(e))?parseInt(t[1]+"ff",16)>>>0:is&&void 0!==is[e]?is[e]:(t=bs.exec(e))?(Vs(t[1])<<24|Vs(t[2])<<16|Vs(t[3])<<8|255)>>>0:(t=ws.exec(e))?(Vs(t[1])<<24|Vs(t[2])<<16|Vs(t[3])<<8|Ts(t[4]))>>>0:(t=Ss.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=Es.exec(e))?parseInt(t[1],16)>>>0:(t=Cs.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=_s.exec(e))?(255|Is(Os(t[1]),As(t[2]),As(t[3])))>>>0:(t=js.exec(e))?(Is(Os(t[1]),As(t[2]),As(t[3]))|Ts(t[4]))>>>0:null}(e);return null===t?e:(t=t||0,`rgba(${(4278190080&t)>>>24}, ${(16711680&t)>>>16}, ${(65280&t)>>>8}, ${(255&t)/255})`)}var Fs=(e,t,n)=>{if(Yn.fun(e))return e;if(Yn.arr(e))return Fs({range:e,output:t,extrapolate:n});if(Yn.str(e.output[0]))return es(e);let s=e,i=s.output,r=s.range||[0,1],a=s.extrapolateLeft||s.extrapolate||"extend",o=s.extrapolateRight||s.extrapolate||"extend",l=s.easing||(e=>e);return e=>{let t=function(e,t){for(var n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}(e,r);return function(e,t,n,s,i,r,a,o,l){let c=l?l(e):e;if(c<t){if("identity"===a)return c;"clamp"===a&&(c=t)}if(c>n){if("identity"===o)return c;"clamp"===o&&(c=n)}return s===i?s:t===n?e<=t?s:i:(t===-1/0?c=-c:n===1/0?c-=t:c=(c-t)/(n-t),c=r(c),s===-1/0?c=-c:i===1/0?c+=s:c=c*(i-s)+s,c)}(e,r[t],r[t+1],i[t],i[t+1],l,a,o,s.map)}};var Ms=1.70158,Bs=1.525*Ms,Ds=Ms+1,Rs=2*Math.PI/3,Ls=2*Math.PI/4.5,zs=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,Hs={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=>0===e?0:Math.pow(2,10*e-10),easeOutExpo:e=>1===e?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>0===e?0:1===e?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=>Ds*e*e*e-Ms*e*e,easeOutBack:e=>1+Ds*Math.pow(e-1,3)+Ms*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*(2*(Bs+1)*e-Bs)/2:(Math.pow(2*e-2,2)*((Bs+1)*(2*e-2)+Bs)+2)/2,easeInElastic:e=>0===e?0:1===e?1:-Math.pow(2,10*e-10)*Math.sin((10*e-10.75)*Rs),easeOutElastic:e=>0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin((10*e-.75)*Rs)+1,easeInOutElastic:e=>0===e?0:1===e?1:e<.5?-Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*Ls)/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*Ls)/2+1,easeInBounce:e=>1-zs(1-e),easeOutBounce:zs,easeInOutBounce:e=>e<.5?(1-zs(1-2*e))/2:(1+zs(2*e-1))/2,steps:(e,t="end")=>n=>{let s=(n="end"===t?Math.min(n,.999):Math.max(n,.001))*e;return((e,t,n)=>Math.min(Math.max(n,e),t))(0,1,("end"===t?Math.floor(s):Math.ceil(s))/e)}},Gs=Symbol.for("FluidValue.get"),Ws=Symbol.for("FluidValue.observers"),Us=e=>Boolean(e&&e[Gs]),qs=e=>e&&e[Gs]?e[Gs]():e,Zs=e=>e[Ws]||null;function Ys(e,t){let n=e[Ws];n&&n.forEach((e=>{!function(e,t){e.eventObserved?e.eventObserved(t):e(t)}(e,t)}))}var Ks=class{[Gs];[Ws];constructor(e){if(!e&&!(e=this.get))throw Error("Unknown getter");Xs(this,e)}},Xs=(e,t)=>ei(e,Gs,t);function Qs(e,t){if(e[Gs]){let n=e[Ws];n||ei(e,Ws,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function Js(e,t){let n=e[Ws];if(n&&n.has(t)){let s=n.size-1;s?n.delete(t):e[Ws]=null,e.observerRemoved&&e.observerRemoved(s,t)}}var $s,ei=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),ti=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,ni=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,si=new RegExp(`(${ti.source})(%|[a-z]+)`,"i"),ii=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,ri=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,ai=e=>{let[t,n]=oi(e);if(!t||ss())return e;let s=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(s)return s.trim();if(n&&n.startsWith("--")){return window.getComputedStyle(document.documentElement).getPropertyValue(n)||e}return n&&ri.test(n)?ai(n):n||e},oi=e=>{let t=ri.exec(e);if(!t)return[,];let[,n,s]=t;return[n,s]},li=(e,t,n,s,i)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(s)}, ${i})`,ci=e=>{$s||($s=is?new RegExp(`(${Object.keys(is).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map((e=>qs(e).replace(ri,ai).replace(ni,Ns).replace($s,Ns))),n=t.map((e=>e.match(ti).map(Number))),s=n[0].map(((e,t)=>n.map((e=>{if(!(t in e))throw Error('The arity of each "output" value must be equal');return e[t]})))).map((t=>Fs({...e,output:t})));return e=>{let n=!si.test(t[0])&&t.find((e=>si.test(e)))?.replace(ti,""),i=0;return t[0].replace(ti,(()=>`${s[i++](e)}${n||""}`)).replace(ii,li)}},ui="react-spring: ",di=e=>{let t=e,n=!1;if("function"!=typeof t)throw new TypeError(`${ui}once requires a function parameter`);return(...e)=>{n||(t(...e),n=!0)}},hi=di(console.warn);di(console.warn);function pi(e){return Yn.str(e)&&("#"==e[0]||/\d/.test(e)||!ss()&&ri.test(e)||e in(is||{}))}new WeakMap;new Set,new WeakMap,new WeakMap,new WeakMap;var fi=ss()?Gn.useEffect:Gn.useLayoutEffect;function mi(){let e=(0,Gn.useState)()[1],t=(()=>{let e=(0,Gn.useRef)(!1);return fi((()=>(e.current=!0,()=>{e.current=!1})),[]),e})();return()=>{t.current&&e(Math.random())}}var gi=[];var vi=Symbol.for("Animated:node"),yi=e=>e&&e[vi],xi=(e,t)=>((e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}))(e,vi,t),bi=e=>e&&e[vi]&&e[vi].getPayload(),wi=class{payload;constructor(){xi(this,this)}getPayload(){return this.payload||[]}},_i=class extends wi{constructor(e){super(),this._value=e,Yn.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(e){return new _i(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return Yn.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value!==e&&(this._value=e,!0)}reset(){let{done:e}=this;this.done=!1,Yn.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},ji=class extends _i{_string=null;_toString;constructor(e){super(0),this._toString=Fs({output:[e,e]})}static create(e){return new ji(e)}getValue(){return this._string??(this._string=this._toString(this._value))}setValue(e){if(Yn.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else{if(!super.setValue(e))return!1;this._string=null}return!0}reset(e){e&&(this._toString=Fs({output:[this.getValue(),e]})),this._value=0,super.reset()}},Si={dependencies:null},Ci=class extends wi{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){let t={};return Qn(this.source,((n,s)=>{(e=>!!e&&e[vi]===e)(n)?t[s]=n.getValue(e):Us(n)?t[s]=qs(n):e||(t[s]=n)})),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&Xn(this.payload,(e=>e.reset()))}_makePayload(e){if(e){let t=new Set;return Qn(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){Si.dependencies&&Us(e)&&Si.dependencies.add(e);let t=bi(e);t&&Xn(t,(e=>this.add(e)))}},ki=class extends Ci{constructor(e){super(e)}static create(e){return new ki(e)}getValue(){return this.source.map((e=>e.getValue()))}setValue(e){let t=this.getPayload();return e.length==t.length?t.map(((t,n)=>t.setValue(e[n]))).some(Boolean):(super.setValue(e.map(Ei)),!0)}};function Ei(e){return(pi(e)?ji:_i).create(e)}function Pi(e){let t=yi(e);return t?t.constructor:Yn.arr(e)?ki:pi(e)?ji:_i}var Ii=(e,t)=>{let n=!Yn.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,Gn.forwardRef)(((s,i)=>{let r=(0,Gn.useRef)(null),a=n&&(0,Gn.useCallback)((e=>{r.current=function(e,t){return e&&(Yn.fun(e)?e(t):e.current=t),t}(i,e)}),[i]),[o,l]=function(e,t){let n=new Set;return Si.dependencies=n,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new Ci(e),Si.dependencies=null,[e,n]}(s,t),c=mi(),u=()=>{let e=r.current;n&&!e||!1===(!!e&&t.applyAnimatedValues(e,o.getValue(!0)))&&c()},d=new Vi(u,l),h=(0,Gn.useRef)();fi((()=>(h.current=d,Xn(l,(e=>Qs(e,d))),()=>{h.current&&(Xn(h.current.deps,(e=>Js(e,h.current))),kn.cancel(h.current.update))}))),(0,Gn.useEffect)(u,[]),(e=>{(0,Gn.useEffect)(e,gi)})((()=>()=>{let e=h.current;Xn(e.deps,(t=>Js(t,e)))}));let p=t.getComponentProps(o.getValue());return Gn.createElement(e,{...p,ref:a})}))},Vi=class{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){"change"==e.type&&kn.write(this.update)}};var Oi=Symbol.for("AnimatedComponent"),Ti=e=>Yn.str(e)?e:e&&Yn.str(e.displayName)?e.displayName:Yn.fun(e)&&e.name||null;function Ai(e,...t){return Yn.fun(e)?e(...t):e}var Ni=(e,t)=>!0===e||!!(t&&e&&(Yn.fun(e)?e(t):Jn(e).includes(t))),Fi=(e,t)=>Yn.obj(e)?t&&e[t]:e,Mi=(e,t)=>!0===e.default?e[t]:e.default?e.default[t]:void 0,Bi=e=>e,Di=(e,t=Bi)=>{let n=Ri;e.default&&!0!==e.default&&(e=e.default,n=Object.keys(e));let s={};for(let i of n){let n=t(e[i],i);Yn.und(n)||(s[i]=n)}return s},Ri=["config","onProps","onStart","onChange","onPause","onResume","onRest"],Li={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 zi(e){let t=function(e){let t={},n=0;if(Qn(e,((e,s)=>{Li[s]||(t[s]=e,n++)})),n)return t}(e);if(t){let n={to:t};return Qn(e,((e,s)=>s in t||(n[s]=e))),n}return{...e}}function Hi(e){return e=qs(e),Yn.arr(e)?e.map(Hi):pi(e)?qn.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function Gi(e){return Yn.fun(e)||Yn.arr(e)&&Yn.obj(e[0])}var Wi={tension:170,friction:26,mass:1,damping:1,easing:Hs.linear,clamp:!1},Ui=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,Wi)}};function qi(e,t){if(Yn.und(t.decay)){let n=!Yn.und(t.tension)||!Yn.und(t.friction);(n||!Yn.und(t.frequency)||!Yn.und(t.damping)||!Yn.und(t.mass))&&(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}else e.duration=void 0}var Zi=[],Yi=class{changed=!1;values=Zi;toValues=null;fromValues=Zi;to;from;config=new Ui;immediate=!1};function Ki(e,{key:t,props:n,defaultProps:s,state:i,actions:r}){return new Promise(((a,o)=>{let l,c,u=Ni(n.cancel??s?.cancel,t);if(u)p();else{Yn.und(n.pause)||(i.paused=Ni(n.pause,t));let e=s?.pause;!0!==e&&(e=i.paused||Ni(e,t)),l=Ai(n.delay||0,t),e?(i.resumeQueue.add(h),r.pause()):(r.resume(),h())}function d(){i.resumeQueue.add(h),i.timeouts.delete(c),c.cancel(),l=c.time-kn.now()}function h(){l>0&&!qn.skipAnimation?(i.delayed=!0,c=kn.setTimeout(p,l),i.pauseQueue.add(d),i.timeouts.add(c)):p()}function p(){i.delayed&&(i.delayed=!1),i.pauseQueue.delete(d),i.timeouts.delete(c),e<=(i.cancelId||0)&&(u=!0);try{r.start({...n,callId:e,cancel:u},a)}catch(e){o(e)}}}))}var Xi=(e,t)=>1==t.length?t[0]:t.some((e=>e.cancelled))?$i(e.get()):t.every((e=>e.noop))?Qi(e.get()):Ji(e.get(),t.every((e=>e.finished))),Qi=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),Ji=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),$i=e=>({value:e,cancelled:!0,finished:!1});function er(e,t,n,s){let{callId:i,parentId:r,onRest:a}=t,{asyncTo:o,promise:l}=n;return r||e!==o||t.reset?n.promise=(async()=>{n.asyncId=i,n.asyncTo=e;let c,u,d,h=Di(t,((e,t)=>"onRest"===t?void 0:e)),p=new Promise(((e,t)=>(c=e,u=t))),f=e=>{let t=i<=(n.cancelId||0)&&$i(s)||i!==n.asyncId&&Ji(s,!1);if(t)throw e.result=t,u(e),e},m=(e,t)=>{let r=new nr,a=new sr;return(async()=>{if(qn.skipAnimation)throw tr(n),a.result=Ji(s,!1),u(a),a;f(r);let o=Yn.obj(e)?{...e}:{...t,to:e};o.parentId=i,Qn(h,((e,t)=>{Yn.und(o[t])&&(o[t]=e)}));let l=await s.start(o);return f(r),n.paused&&await new Promise((e=>{n.resumeQueue.add(e)})),l})()};if(qn.skipAnimation)return tr(n),Ji(s,!1);try{let t;t=Yn.arr(e)?(async e=>{for(let t of e)await m(t)})(e):Promise.resolve(e(m,s.stop.bind(s))),await Promise.all([t.then(c),p]),d=Ji(s.get(),!0,!1)}catch(e){if(e instanceof nr)d=e.result;else{if(!(e instanceof sr))throw e;d=e.result}}finally{i==n.asyncId&&(n.asyncId=r,n.asyncTo=r?o:void 0,n.promise=r?l:void 0)}return Yn.fun(a)&&kn.batchedUpdates((()=>{a(d,s,s.item)})),d})():l}function tr(e,t){$n(e.timeouts,(e=>e.cancel())),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}var nr=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.")}},sr=class extends Error{result;constructor(){super("SkipAnimationSignal")}},ir=e=>e instanceof ar,rr=1,ar=class extends Ks{id=rr++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=yi(this);return e&&e.getValue()}to(...e){return qn.to(this,e)}interpolate(...e){return hi(`${ui}The "interpolate" function is deprecated in v9 (use "to" instead)`),qn.to(this,e)}toJSON(){return this.get()}observerAdded(e){1==e&&this._attach()}observerRemoved(e){0==e&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){Ys(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||hs.sort(this),Ys(this,{type:"priority",parent:this,priority:e})}},or=Symbol.for("SpringPhase"),lr=e=>(1&e[or])>0,cr=e=>(2&e[or])>0,ur=e=>(4&e[or])>0,dr=(e,t)=>t?e[or]|=3:e[or]&=-3,hr=(e,t)=>t?e[or]|=4:e[or]&=-5,pr=class extends ar{key;animation=new Yi;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,t){if(super(),!Yn.und(e)||!Yn.und(t)){let n=Yn.obj(e)?{...e}:{...t,from:e};Yn.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(cr(this)||this._state.asyncTo)||ur(this)}get goal(){return qs(this.animation.to)}get velocity(){let e=yi(this);return e instanceof _i?e.lastVelocity||0:e.getPayload().map((e=>e.lastVelocity||0))}get hasAnimated(){return lr(this)}get isAnimating(){return cr(this)}get isPaused(){return ur(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,n=!1,s=this.animation,{config:i,toValues:r}=s,a=bi(s.to);!a&&Us(s.to)&&(r=Jn(qs(s.to))),s.values.forEach(((o,l)=>{if(o.done)return;let c=o.constructor==ji?1:a?a[l].lastPosition:r[l],u=s.immediate,d=c;if(!u){if(d=o.lastPosition,i.tension<=0)return void(o.done=!0);let t,n=o.elapsedTime+=e,r=s.fromValues[l],a=null!=o.v0?o.v0:o.v0=Yn.arr(i.velocity)?i.velocity[l]:i.velocity,h=i.precision||(r==c?.005:Math.min(1,.001*Math.abs(c-r)));if(Yn.und(i.duration))if(i.decay){let e=!0===i.decay?.998:i.decay,s=Math.exp(-(1-e)*n);d=r+a/(1-e)*(1-s),u=Math.abs(o.lastPosition-d)<=h,t=a*s}else{t=null==o.lastVelocity?a:o.lastVelocity;let n,s=i.restVelocity||h/10,l=i.clamp?0:i.bounce,p=!Yn.und(l),f=r==c?o.v0>0:r<c,m=!1,g=1,v=Math.ceil(e/g);for(let e=0;e<v&&(n=Math.abs(t)>s,n||(u=Math.abs(c-d)<=h,!u));++e){p&&(m=d==c||d>c==f,m&&(t=-t*l,d=c)),t+=(1e-6*-i.tension*(d-c)+.001*-i.friction*t)/i.mass*g,d+=t*g}}else{let s=1;i.duration>0&&(this._memoizedDuration!==i.duration&&(this._memoizedDuration=i.duration,o.durationProgress>0&&(o.elapsedTime=i.duration*o.durationProgress,n=o.elapsedTime+=e)),s=(i.progress||0)+n/this._memoizedDuration,s=s>1?1:s<0?0:s,o.durationProgress=s),d=r+i.easing(s)*(c-r),t=(d-o.lastPosition)/e,u=1==s}o.lastVelocity=t,Number.isNaN(d)&&(console.warn("Got NaN while animating:",this),u=!0)}a&&!a[l].done&&(u=!1),u?o.done=!0:t=!1,o.setValue(d,i.round)&&(n=!0)}));let o=yi(this),l=o.getValue();if(t){let e=qs(s.to);l===e&&!n||i.decay?n&&i.decay&&this._onChange(l):(o.setValue(e),this._onChange(e)),this._stop()}else n&&this._onChange(l)}set(e){return kn.batchedUpdates((()=>{this._stop(),this._focus(e),this._set(e)})),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(cr(this)){let{to:e,config:t}=this.animation;kn.batchedUpdates((()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()}))}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let n;return Yn.und(e)?(n=this.queue||[],this.queue=[]):n=[Yn.obj(e)?e:{...t,to:e}],Promise.all(n.map((e=>this._update(e)))).then((e=>Xi(this,e)))}stop(e){let{to:t}=this.animation;return this._focus(this.get()),tr(this._state,e&&this._lastCallId),kn.batchedUpdates((()=>this._stop(t,e))),this}reset(){this._update({reset:!0})}eventObserved(e){"change"==e.type?this._start():"priority"==e.type&&(this.priority=e.priority+1)}_prepareNode(e){let t=this.key||"",{to:n,from:s}=e;n=Yn.obj(n)?n[t]:n,(null==n||Gi(n))&&(n=void 0),s=Yn.obj(s)?s[t]:s,null==s&&(s=void 0);let i={to:n,from:s};return lr(this)||(e.reverse&&([n,s]=[s,n]),s=qs(s),Yn.und(s)?yi(this)||this._set(n):this._set(s)),i}_update({...e},t){let{key:n,defaultProps:s}=this;e.default&&Object.assign(s,Di(e,((e,t)=>/^on/.test(t)?Fi(e,n):e))),xr(this,e,"onProps"),br(this,"onProps",e,this);let i=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 r=this._state;return Ki(++this._lastCallId,{key:n,props:e,defaultProps:s,state:r,actions:{pause:()=>{ur(this)||(hr(this,!0),ns(r.pauseQueue),br(this,"onPause",Ji(this,fr(this,this.animation.to)),this))},resume:()=>{ur(this)&&(hr(this,!1),cr(this)&&this._resume(),ns(r.resumeQueue),br(this,"onResume",Ji(this,fr(this,this.animation.to)),this))},start:this._merge.bind(this,i)}}).then((n=>{if(e.loop&&n.finished&&(!t||!n.noop)){let t=mr(e);if(t)return this._update(t,!0)}return n}))}_merge(e,t,n){if(t.cancel)return this.stop(!0),n($i(this));let s=!Yn.und(e.to),i=!Yn.und(e.from);if(s||i){if(!(t.callId>this._lastToId))return n($i(this));this._lastToId=t.callId}let{key:r,defaultProps:a,animation:o}=this,{to:l,from:c}=o,{to:u=l,from:d=c}=e;i&&!s&&(!t.default||Yn.und(u))&&(u=d),t.reverse&&([u,d]=[d,u]);let h=!Kn(d,c);h&&(o.from=d),d=qs(d);let p=!Kn(u,l);p&&this._focus(u);let f=Gi(t.to),{config:m}=o,{decay:g,velocity:v}=m;(s||i)&&(m.velocity=0),t.config&&!f&&function(e,t,n){n&&(qi(n={...n},t),t={...n,...t}),qi(e,t),Object.assign(e,t);for(let t in Wi)null==e[t]&&(e[t]=Wi[t]);let{mass:s,frequency:i,damping:r}=e;Yn.und(i)||(i<.01&&(i=.01),r<0&&(r=0),e.tension=Math.pow(2*Math.PI/i,2)*s,e.friction=4*Math.PI*r*s/i)}(m,Ai(t.config,r),t.config!==a.config?Ai(a.config,r):void 0);let y=yi(this);if(!y||Yn.und(u))return n(Ji(this,!0));let x=Yn.und(t.reset)?i&&!t.default:!Yn.und(d)&&Ni(t.reset,r),b=x?d:this.get(),w=Hi(u),_=Yn.num(w)||Yn.arr(w)||pi(w),j=!f&&(!_||Ni(a.immediate||t.immediate,r));if(p){let e=Pi(u);if(e!==y.constructor){if(!j)throw Error(`Cannot animate between ${y.constructor.name} and ${e.name}, as the "to" prop suggests`);y=this._set(w)}}let S=y.constructor,C=Us(u),k=!1;if(!C){let e=x||!lr(this)&&h;(p||e)&&(k=Kn(Hi(b),w),C=!k),(!Kn(o.immediate,j)&&!j||!Kn(m.decay,g)||!Kn(m.velocity,v))&&(C=!0)}if(k&&cr(this)&&(o.changed&&!x?C=!0:C||this._stop(l)),!f&&((C||Us(l))&&(o.values=y.getPayload(),o.toValues=Us(u)?null:S==ji?[1]:Jn(w)),o.immediate!=j&&(o.immediate=j,!j&&!x&&this._set(l)),C)){let{onRest:e}=o;Xn(yr,(e=>xr(this,t,e)));let s=Ji(this,fr(this,l));ns(this._pendingCalls,s),this._pendingCalls.add(n),o.changed&&kn.batchedUpdates((()=>{o.changed=!x,e?.(s,this),x?Ai(a.onRest,s):o.onStart?.(s,this)}))}x&&this._set(b),f?n(er(t.to,t,this._state,this)):C?this._start():cr(this)&&!p?this._pendingCalls.add(n):n(Qi(b))}_focus(e){let t=this.animation;e!==t.to&&(Zs(this)&&this._detach(),t.to=e,Zs(this)&&this._attach())}_attach(){let e=0,{to:t}=this.animation;Us(t)&&(Qs(t,this),ir(t)&&(e=t.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;Us(e)&&Js(e,this)}_set(e,t=!0){let n=qs(e);if(!Yn.und(n)){let e=yi(this);if(!e||!Kn(n,e.getValue())){let s=Pi(n);e&&e.constructor==s?e.setValue(n):xi(this,s.create(n)),e&&kn.batchedUpdates((()=>{this._onChange(n,t)}))}}return yi(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,br(this,"onStart",Ji(this,fr(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),Ai(this.animation.onChange,e,this)),Ai(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){let e=this.animation;yi(this).reset(qs(e.to)),e.immediate||(e.fromValues=e.values.map((e=>e.lastPosition))),cr(this)||(dr(this,!0),ur(this)||this._resume())}_resume(){qn.skipAnimation?this.finish():hs.start(this)}_stop(e,t){if(cr(this)){dr(this,!1);let n=this.animation;Xn(n.values,(e=>{e.done=!0})),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),Ys(this,{type:"idle",parent:this});let s=t?$i(this.get()):Ji(this.get(),fr(this,e??n.to));ns(this._pendingCalls,s),n.changed&&(n.changed=!1,br(this,"onRest",s,this))}}};function fr(e,t){let n=Hi(t);return Kn(Hi(e.get()),n)}function mr(e,t=e.loop,n=e.to){let s=Ai(t);if(s){let i=!0!==s&&zi(s),r=(i||e).reverse,a=!i||i.reset;return gr({...e,loop:t,default:!1,pause:void 0,to:!r||Gi(n)?n:void 0,from:a?e.from:void 0,reset:a,...i})}}function gr(e){let{to:t,from:n}=e=zi(e),s=new Set;return Yn.obj(t)&&vr(t,s),Yn.obj(n)&&vr(n,s),e.keys=s.size?Array.from(s):null,e}function vr(e,t){Qn(e,((e,n)=>null!=e&&t.add(n)))}var yr=["onStart","onRest","onChange","onPause","onResume"];function xr(e,t,n){e.animation[n]=t[n]!==Mi(t,n)?Fi(t[n],e.key):void 0}function br(e,t,...n){e.animation[t]?.(...n),e.defaultProps[t]?.(...n)}var wr=["onStart","onChange","onRest"],_r=1,jr=class{id=_r++;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,t){this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),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(((t,n)=>e[n]=t.get())),e}set(e){for(let t in e){let n=e[t];Yn.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(gr(e)),this}start(e){let{queue:t}=this;return e?t=Jn(e).map(gr):this.queue=[],this._flush?this._flush(this,t):(Pr(this,t),Sr(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){let n=this.springs;Xn(Jn(t),(t=>n[t].stop(!!e)))}else tr(this._state,this._lastAsyncId),this.each((t=>t.stop(!!e)));return this}pause(e){if(Yn.und(e))this.start({pause:!0});else{let t=this.springs;Xn(Jn(e),(e=>t[e].pause()))}return this}resume(e){if(Yn.und(e))this.start({pause:!1});else{let t=this.springs;Xn(Jn(e),(e=>t[e].resume()))}return this}each(e){Qn(this.springs,e)}_onFrame(){let{onStart:e,onChange:t,onRest:n}=this._events,s=this._active.size>0,i=this._changed.size>0;(s&&!this._started||i&&!this._started)&&(this._started=!0,$n(e,(([e,t])=>{t.value=this.get(),e(t,this,this._item)})));let r=!s&&this._started,a=i||r&&n.size?this.get():null;i&&t.size&&$n(t,(([e,t])=>{t.value=a,e(t,this,this._item)})),r&&(this._started=!1,$n(n,(([e,t])=>{t.value=a,e(t,this,this._item)})))}eventObserved(e){if("change"==e.type)this._changed.add(e.parent),e.idle||this._active.add(e.parent);else{if("idle"!=e.type)return;this._active.delete(e.parent)}kn.onFrame(this._onFrame)}};function Sr(e,t){return Promise.all(t.map((t=>Cr(e,t)))).then((t=>Xi(e,t)))}async function Cr(e,t,n){let{keys:s,to:i,from:r,loop:a,onRest:o,onResolve:l}=t,c=Yn.obj(t.default)&&t.default;a&&(t.loop=!1),!1===i&&(t.to=null),!1===r&&(t.from=null);let u=Yn.arr(i)||Yn.fun(i)?i:void 0;u?(t.to=void 0,t.onRest=void 0,c&&(c.onRest=void 0)):Xn(wr,(n=>{let s=t[n];if(Yn.fun(s)){let i=e._events[n];t[n]=({finished:e,cancelled:t})=>{let n=i.get(s);n?(e||(n.finished=!1),t&&(n.cancelled=!0)):i.set(s,{value:null,finished:e||!1,cancelled:t||!1})},c&&(c[n]=t[n])}}));let d=e._state;t.pause===!d.paused?(d.paused=t.pause,ns(t.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(t.pause=!0);let h=(s||Object.keys(e.springs)).map((n=>e.springs[n].start(t))),p=!0===t.cancel||!0===Mi(t,"cancel");(u||p&&d.asyncId)&&h.push(Ki(++e._lastAsyncId,{props:t,state:d,actions:{pause:Zn,resume:Zn,start(t,n){p?(tr(d,e._lastAsyncId),n($i(e))):(t.onRest=o,n(er(u,t,d,e)))}}})),d.paused&&await new Promise((e=>{d.resumeQueue.add(e)}));let f=Xi(e,await Promise.all(h));if(a&&f.finished&&(!n||!f.noop)){let n=mr(t,a,i);if(n)return Pr(e,[n]),Cr(e,n,!0)}return l&&kn.batchedUpdates((()=>l(f,e,e.item))),f}function kr(e,t){let n=new pr;return n.key=e,t&&Qs(n,t),n}function Er(e,t,n){t.keys&&Xn(t.keys,(s=>{(e[s]||(e[s]=n(s)))._prepareNode(t)}))}function Pr(e,t){Xn(t,(t=>{Er(e.springs,t,(t=>kr(t,e)))}))}var Ir=({children:e,...t})=>{let n=(0,Gn.useContext)(Vr),s=t.pause||!!n.pause,i=t.immediate||!!n.immediate;t=function(e,t){let[n]=(0,Gn.useState)((()=>({inputs:t,result:e()}))),s=(0,Gn.useRef)(),i=s.current,r=i;return r?Boolean(t&&r.inputs&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(t,r.inputs))||(r={inputs:t,result:e()}):r=n,(0,Gn.useEffect)((()=>{s.current=r,i==n&&(n.inputs=n.result=void 0)}),[r]),r.result}((()=>({pause:s,immediate:i})),[s,i]);let{Provider:r}=Vr;return Gn.createElement(r,{value:t},e)},Vr=function(e,t){return Object.assign(e,Gn.createContext(t)),e.Provider._context=e,e.Consumer._context=e,e}(Ir,{});Ir.Provider=Vr.Provider,Ir.Consumer=Vr.Consumer;var Or=class extends ar{constructor(e,t){super(),this.source=e,this.calc=Fs(...t);let n=this._get(),s=Pi(n);xi(this,s.create(n))}key;idle=!0;calc;_active=new Set;advance(e){let t=this._get();Kn(t,this.get())||(yi(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&Ar(this._active)&&Nr(this)}_get(){let e=Yn.arr(this.source)?this.source.map(qs):Jn(qs(this.source));return this.calc(...e)}_start(){this.idle&&!Ar(this._active)&&(this.idle=!1,Xn(bi(this),(e=>{e.done=!1})),qn.skipAnimation?(kn.batchedUpdates((()=>this.advance())),Nr(this)):hs.start(this))}_attach(){let e=1;Xn(Jn(this.source),(t=>{Us(t)&&Qs(t,this),ir(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))})),this.priority=e,this._start()}_detach(){Xn(Jn(this.source),(e=>{Us(e)&&Js(e,this)})),this._active.clear(),Nr(this)}eventObserved(e){"change"==e.type?e.idle?this.advance():(this._active.add(e.parent),this._start()):"idle"==e.type?this._active.delete(e.parent):"priority"==e.type&&(this.priority=Jn(this.source).reduce(((e,t)=>Math.max(e,(ir(t)?t.priority:0)+1)),0))}};function Tr(e){return!1!==e.idle}function Ar(e){return!e.size||Array.from(e).every(Tr)}function Nr(e){e.idle||(e.idle=!0,Xn(bi(e),(e=>{e.done=!0})),Ys(e,{type:"idle",parent:e}))}qn.assign({createStringInterpolator:ci,to:(e,t)=>new Or(e,t)});hs.advance;const Fr=window.ReactDOM;var Mr=/^--/;function Br(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||Mr.test(e)||Rr.hasOwnProperty(e)&&Rr[e]?(""+t).trim():t+"px"}var Dr={};var Rr={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},Lr=["Webkit","Ms","Moz","O"];Rr=Object.keys(Rr).reduce(((e,t)=>(Lr.forEach((n=>e[((e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1))(n,t)]=e[t])),e)),Rr);var zr=/^(matrix|translate|scale|rotate|skew)/,Hr=/^(translate)/,Gr=/^(rotate|skew)/,Wr=(e,t)=>Yn.num(e)&&0!==e?e+t:e,Ur=(e,t)=>Yn.arr(e)?e.every((e=>Ur(e,t))):Yn.num(e)?e===t:parseFloat(e)===t,qr=class extends Ci{constructor({x:e,y:t,z:n,...s}){let i=[],r=[];(e||t||n)&&(i.push([e||0,t||0,n||0]),r.push((e=>[`translate3d(${e.map((e=>Wr(e,"px"))).join(",")})`,Ur(e,0)]))),Qn(s,((e,t)=>{if("transform"===t)i.push([e||""]),r.push((e=>[e,""===e]));else if(zr.test(t)){if(delete s[t],Yn.und(e))return;let n=Hr.test(t)?"px":Gr.test(t)?"deg":"";i.push(Jn(e)),r.push("rotate3d"===t?([e,t,s,i])=>[`rotate3d(${e},${t},${s},${Wr(i,n)})`,Ur(i,0)]:e=>[`${t}(${e.map((e=>Wr(e,n))).join(",")})`,Ur(e,t.startsWith("scale")?1:0)])}})),i.length&&(s.transform=new Zr(i,r)),super(s)}},Zr=class extends Ks{constructor(e,t){super(),this.inputs=e,this.transforms=t}_value=null;get(){return this._value||(this._value=this._get())}_get(){let e="",t=!0;return Xn(this.inputs,((n,s)=>{let i=qs(n[0]),[r,a]=this.transforms[s](Yn.arr(i)?i:n.map(qs));e+=" "+r,t=t&&a})),t?"none":e}observerAdded(e){1==e&&Xn(this.inputs,(e=>Xn(e,(e=>Us(e)&&Qs(e,this)))))}observerRemoved(e){0==e&&Xn(this.inputs,(e=>Xn(e,(e=>Us(e)&&Js(e,this)))))}eventObserved(e){"change"==e.type&&(this._value=null),Ys(this,e)}};qn.assign({batchedUpdates:Fr.unstable_batchedUpdates,createStringInterpolator:ci,colors:{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 Yr=((e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:n=e=>new Ci(e),getComponentProps:s=e=>e}={})=>{let i={applyAnimatedValues:t,createAnimatedStyle:n,getComponentProps:s},r=e=>{let t=Ti(e)||"Anonymous";return(e=Yn.str(e)?r[e]||(r[e]=Ii(e,i)):e[Oi]||(e[Oi]=Ii(e,i))).displayName=`Animated(${t})`,e};return Qn(e,((t,n)=>{Yn.arr(e)&&(n=Ti(t)),r[n]=r(t)})),{animated:r}})(["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"],{applyAnimatedValues:function(e,t){if(!e.nodeType||!e.setAttribute)return!1;let n="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName,{style:s,children:i,scrollTop:r,scrollLeft:a,viewBox:o,...l}=t,c=Object.values(l),u=Object.keys(l).map((t=>n||e.hasAttribute(t)?t:Dr[t]||(Dr[t]=t.replace(/([A-Z])/g,(e=>"-"+e.toLowerCase())))));void 0!==i&&(e.textContent=i);for(let t in s)if(s.hasOwnProperty(t)){let n=Br(t,s[t]);Mr.test(t)?e.style.setProperty(t,n):e.style[t]=n}u.forEach(((t,n)=>{e.setAttribute(t,c[n])})),void 0!==r&&(e.scrollTop=r),void 0!==a&&(e.scrollLeft=a),void 0!==o&&e.setAttribute("viewBox",o)},createAnimatedStyle:e=>new qr(e),getComponentProps:({scrollTop:e,scrollLeft:t,...n})=>n});Yr.animated;var Kr=function({triggerAnimationOnChange:e}){const t=(0,h.useRef)(),{previous:n,prevRect:s}=(0,h.useMemo)((()=>{return{previous:t.current&&(e=t.current,{top:e.offsetTop,left:e.offsetLeft}),prevRect:t.current&&t.current.getBoundingClientRect()};var e}),[e]);return(0,h.useLayoutEffect)((()=>{if(!n||!t.current)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const e=new jr({x:0,y:0,width:s.width,height:s.height,config:{duration:400,easing:Hs.easeInOutQuint},onChange({value:e}){if(!t.current)return;let{x:n,y:s,width:i,height:r}=e;n=Math.round(n),s=Math.round(s),i=Math.round(i),r=Math.round(r);const a=0===n&&0===s;t.current.style.transformOrigin="center center",t.current.style.transform=a?null:`translate3d(${n}px,${s}px,0)`,t.current.style.width=a?null:`${i}px`,t.current.style.height=a?null:`${r}px`}});t.current.style.transform=void 0;const i=t.current.getBoundingClientRect(),r=Math.round(s.left-i.left),a=Math.round(s.top-i.top),o=i.width,l=i.height;return e.start({x:0,y:0,width:o,height:l,from:{x:r,y:a,width:s.width,height:s.height}}),()=>{e.stop(),e.set({x:0,y:0,width:s.width,height:s.height})}}),[n,s]),t},Xr=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{d:"M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z"})});function Qr(){return!!(0,Qt.getQueryArg)(window.location.href,"wp_theme_preview")}function Jr(){return Qr()?(0,Qt.getQueryArg)(window.location.href,"wp_theme_preview"):null}const{useLocation:$r}=ne(Lt.privateApis);function ea({className:e="edit-site-save-button__button",variant:t="primary",showTooltip:n=!0,showReviewMessage:s,icon:i,size:r,__next40pxDefaultSize:o=!1}){const{params:l}=$r(),{setIsSaveViewOpened:u}=(0,c.useDispatch)(Rt),{saveDirtyEntities:d}=ne((0,c.useDispatch)(f.store)),{dirtyEntityRecords:h}=(0,f.useEntitiesSavedStatesIsDirty)(),{isSaving:p,isSaveViewOpen:m,previewingThemeName:g}=(0,c.useSelect)((e=>{const{isSavingEntityRecord:t,isResolving:n}=e(j.store),{isSaveViewOpened:s}=e(Rt),i=n("activateTheme"),r=Jr();return{isSaving:h.some((e=>t(e.kind,e.name,e.key)))||i,isSaveViewOpen:s(),previewingThemeName:r?e(j.store).getTheme(r)?.name?.rendered:void 0}}),[h]),v=!!h.length;let y;1===h.length&&(l.postId?y=`${h[0].key}`===l.postId&&h[0].name===l.postType:l.path?.includes("wp_global_styles")&&(y="globalStyles"===h[0].name));const x=p||!v&&!Qr(),_=Qr()?p?(0,w.sprintf)((0,w.__)("Activating %s"),g):x?(0,w.__)("Saved"):v?(0,w.sprintf)((0,w.__)("Activate %s & Save"),g):(0,w.sprintf)((0,w.__)("Activate %s"),g):p?(0,w.__)("Saving"):x?(0,w.__)("Saved"):!y&&s?(0,w.sprintf)((0,w._n)("Review %d change…","Review %d changes…",h.length),h.length):(0,w.__)("Save"),S=y?()=>d({dirtyEntityRecords:h}):()=>u(!0);return(0,a.jsx)(b.Button,{variant:t,className:e,"aria-disabled":x,"aria-expanded":m,isBusy:p,onClick:x?void 0:S,label:_,shortcut:x?void 0:Xt.displayShortcut.primary("s"),showTooltip:n,icon:i,__next40pxDefaultSize:o,size:r,children:_})}function ta(){const{isDisabled:e,isSaving:t}=(0,c.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,isSavingEntityRecord:n}=e(j.store),s=t(),i=s.some((e=>n(e.kind,e.name,e.key)));return{isSaving:i,isDisabled:i||!s.length&&!Qr()}}),[]);return(0,a.jsx)(b.__experimentalHStack,{className:"edit-site-save-hub",alignment:"right",spacing:4,children:(0,a.jsx)(ea,{className:"edit-site-save-hub__button",variant:e?null:"primary",showTooltip:!1,icon:e&&!t?Xr:null,showReviewMessage:!0,__next40pxDefaultSize:!0})})}const{useHistory:na,useLocation:sa}=ne(Lt.privateApis);const ia=window.wp.apiFetch;var ra=i.n(ia);const{EntitiesSavedStatesExtensible:aa}=ne(f.privateApis),{useLocation:oa}=ne(Lt.privateApis),la=({onClose:e,renderDialog:t,variant:n})=>{const s=(0,f.useEntitiesSavedStatesIsDirty)();let i;i=s.isDirty?(0,w.__)("Activate & Save"):(0,w.__)("Activate");const r=function(){const[e,t]=(0,h.useState)();return(0,h.useEffect)((()=>{const e=(0,Qt.addQueryArgs)("/wp/v2/themes?status=active",{context:"edit",wp_theme_preview:""});ra()({path:e}).then((e=>t(e[0]))).catch((()=>{}))}),[]),e}(),o=(0,c.useSelect)((e=>e(j.store).getCurrentTheme()),[]),l=(0,a.jsx)("p",{children:(0,w.sprintf)((0,w.__)("Saving your changes will change your active theme from %1$s to %2$s."),r?.name?.rendered??"...",o?.name?.rendered??"...")}),u=function(){const e=na(),{path:t}=sa(),{startResolution:n,finishResolution:s}=(0,c.useDispatch)(j.store);return async()=>{if(Qr()){const i="themes.php?action=activate&stylesheet="+Jr()+"&_wpnonce="+window.WP_BLOCK_THEME_ACTIVATE_NONCE;n("activateTheme"),await window.fetch(i),s("activateTheme"),e.navigate((0,Qt.addQueryArgs)(t,{wp_theme_preview:""}))}}}();return(0,a.jsx)(aa,{...{...s,additionalPrompt:l,close:e,onSave:async e=>(await u(),e),saveEnabled:!0,saveLabel:i,renderDialog:t,variant:n}})},ca=({onClose:e,renderDialog:t,variant:n})=>Qr()?(0,a.jsx)(la,{onClose:e,renderDialog:t,variant:n}):(0,a.jsx)(f.EntitiesSavedStates,{close:e,renderDialog:t,variant:n});function ua(){const{query:e}=oa(),{canvas:t="view"}=e,{isSaveViewOpen:n,isDirty:s,isSaving:i}=(0,c.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,isSavingEntityRecord:n,isResolving:s}=e(j.store),i=t(),r=s("activateTheme"),{isSaveViewOpened:a}=ne(e(Rt));return{isSaveViewOpen:a(),isDirty:i.length>0,isSaving:i.some((e=>n(e.kind,e.name,e.key)))||r}}),[]),{setIsSaveViewOpened:r}=(0,c.useDispatch)(Rt),o=()=>r(!1);if((0,h.useEffect)((()=>{r(!1)}),[t,r]),"view"===t)return n?(0,a.jsx)(b.Modal,{className:"edit-site-save-panel__modal",onRequestClose:o,title:(0,w.__)("Review changes"),size:"small",children:(0,a.jsx)(ca,{onClose:o,variant:"inline"})}):null;const l=Qr()||s,u=i||!l;return(0,a.jsxs)(Wt,{className:Ht("edit-site-layout__actions",{"is-entity-save-view-open":n}),ariaLabel:(0,w.__)("Save panel"),children:[(0,a.jsx)("div",{className:Ht("edit-site-editor__toggle-save-panel",{"screen-reader-text":n}),children:(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"secondary",className:"edit-site-editor__toggle-save-panel-button",onClick:()=>r(!0),"aria-haspopup":"dialog",disabled:u,accessibleWhenDisabled:!0,children:(0,w.__)("Open save panel")})}),n&&(0,a.jsx)(ca,{onClose:o,renderDialog:!0})]})}const{useGlobalStyle:da}=ne(x.privateApis),{GlobalStylesProvider:ha}=ne(f.privateApis),{useLocation:pa}=ne(Lt.privateApis),fa=.3;function ma(){const{query:e,name:t,areas:n,widths:s}=pa(),{canvas:i="view"}=e,r=(0,y.useViewportMatch)("medium","<"),o=(0,h.useRef)(),l=(0,b.__unstableUseNavigateRegions)(),u=(0,y.useReducedMotion)(),[d,p]=(0,y.useResizeObserver)(),g=Sn(),[v,x]=(0,h.useState)(!1),_=Kr({triggerAnimationOnChange:t+"-"+i}),{showIconLabels:j}=(0,c.useSelect)((e=>({showIconLabels:e(m.store).get("core","showIconLabels")}))),[S]=da("color.background"),[C]=da("color.gradient"),k=(0,y.usePrevious)(i);return(0,h.useEffect)((()=>{"edit"===k&&o.current?.focus()}),[i]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.UnsavedChangesWarning,{}),"view"===i&&(0,a.jsx)(_n,{}),(0,a.jsx)("div",{...l,ref:l.ref,className:Ht("edit-site-layout",l.className,{"is-full-canvas":"edit"===i,"show-icon-labels":j}),children:(0,a.jsxs)("div",{className:"edit-site-layout__content",children:[(!r||!n.mobile)&&(0,a.jsx)(Wt,{ariaLabel:(0,w.__)("Navigation"),className:"edit-site-layout__sidebar-region",children:(0,a.jsx)(b.__unstableAnimatePresence,{children:"view"===i&&(0,a.jsxs)(b.__unstableMotion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{type:"tween",duration:u||r?0:fa,ease:"easeOut"},className:"edit-site-layout__sidebar",children:[(0,a.jsx)(un,{ref:o,isTransparent:v}),(0,a.jsx)(rn,{children:(0,a.jsx)(an,{shouldAnimate:"styles"!==t,routeKey:t,children:(0,a.jsx)(f.ErrorBoundary,{children:n.sidebar})})}),(0,a.jsx)(ta,{}),(0,a.jsx)(ua,{})]})})}),(0,a.jsx)(f.EditorSnackbars,{}),r&&n.mobile&&(0,a.jsx)("div",{className:"edit-site-layout__mobile",children:(0,a.jsx)(rn,{children:"edit"!==i?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(dn,{ref:o,isTransparent:v}),(0,a.jsx)(an,{routeKey:t,children:(0,a.jsx)(f.ErrorBoundary,{children:n.mobile})}),(0,a.jsx)(ta,{}),(0,a.jsx)(ua,{})]}):(0,a.jsx)(f.ErrorBoundary,{children:n.mobile})})}),!r&&n.content&&"edit"!==i&&(0,a.jsx)("div",{className:"edit-site-layout__area",style:{maxWidth:s?.content},children:(0,a.jsx)(f.ErrorBoundary,{children:n.content})}),!r&&n.edit&&"edit"!==i&&(0,a.jsx)("div",{className:"edit-site-layout__area",style:{maxWidth:s?.edit},children:(0,a.jsx)(f.ErrorBoundary,{children:n.edit})}),!r&&n.preview&&(0,a.jsxs)("div",{className:"edit-site-layout__canvas-container",children:[d,!!p.width&&(0,a.jsx)("div",{className:Ht("edit-site-layout__canvas",{"is-right-aligned":v}),ref:_,children:(0,a.jsx)(f.ErrorBoundary,{children:(0,a.jsx)(xn,{isReady:!g,isFullWidth:"edit"===i,defaultSize:{width:p.width-24,height:p.height},isOversized:v,setIsOversized:x,innerContentStyle:{background:C??S},children:n.preview})})})]})]})})]})}function ga(e){const{createErrorNotice:t}=(0,c.useDispatch)(_.store);return(0,a.jsx)(b.SlotFillProvider,{children:(0,a.jsxs)(ha,{children:[(0,a.jsx)(Ut.PluginArea,{onError:function(e){t((0,w.sprintf)((0,w.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}}),(0,a.jsx)(ma,{...e})]})})}var va=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})}),ya=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})}),xa=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})}),ba=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})});const{useGlobalStylesReset:wa}=ne(x.privateApis),{useHistory:_a,useLocation:ja}=ne(Lt.privateApis),Sa=()=>function(){const{openGeneralSidebar:e}=ne((0,c.useDispatch)(Rt)),{params:t}=ja(),{canvas:n="view"}=t,{set:s}=(0,c.useDispatch)(m.store),i=_a(),r=(0,c.useSelect)((e=>e(j.store).getCurrentTheme().is_block_theme),[]);return{isLoading:!1,commands:(0,h.useMemo)((()=>r?[{name:"core/edit-site/toggle-styles-welcome-guide",label:(0,w.__)("Learn about styles"),callback:({close:t})=>{t(),"edit"!==n&&i.navigate("/styles?canvas=edit",{transition:"canvas-mode-edit-transition"}),e("edit-site/global-styles"),s("core/edit-site","welcomeGuideStyles",!0),setTimeout((()=>{s("core/edit-site","welcomeGuideStyles",!0)}),500)},icon:va}]:[]),[i,e,n,r,s])}},Ca=()=>function(){const[e,t]=wa();return{isLoading:!1,commands:(0,h.useMemo)((()=>e?[{name:"core/edit-site/reset-global-styles",label:(0,w.__)("Reset styles"),icon:(0,w.isRTL)()?ya:xa,callback:({close:e})=>{e(),t()}}]:[]),[e,t])}},ka=()=>function(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t}=ne((0,c.useDispatch)(Rt)),{params:n}=ja(),{canvas:s="view"}=n,i=_a(),r=(0,c.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(j.store),s=n(),i=s?t("root","globalStyles",s):void 0;return!!i?._links?.["version-history"]?.[0]?.count}),[]);return{isLoading:!1,commands:(0,h.useMemo)((()=>r?[{name:"core/edit-site/open-styles-revisions",label:(0,w.__)("Open style revisions"),icon:ba,callback:({close:n})=>{n(),"edit"!==s&&i.navigate("/styles?canvas=edit",{transition:"canvas-mode-edit-transition"}),e("edit-site/global-styles"),t("global-styles-revisions")}}]:[]),[i,e,t,r,s])}};var Ea=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})});const{EditorContentSlotFill:Pa,ResizableEditor:Ia}=ne(f.privateApis);function Va(e){switch(e){case"style-book":return(0,w.__)("Style Book");case"global-styles-revisions":case"global-styles-revisions:style-book":return(0,w.__)("Style Revisions");default:return""}}function Oa(){const e=(0,b.__experimentalUseSlotFills)(Pa.name);return!!e?.length}var Ta=function({children:e,closeButtonLabel:t,onClose:n,enableResizing:s=!1}){const{editorCanvasContainerView:i,showListViewByDefault:r}=(0,c.useSelect)((e=>({editorCanvasContainerView:ne(e(Rt)).getEditorCanvasContainerView(),showListViewByDefault:e(m.store).get("core","showListViewByDefault")})),[]),[o,l]=(0,h.useState)(!1),{setEditorCanvasContainerView:u}=ne((0,c.useDispatch)(Rt)),{setIsListViewOpened:d}=(0,c.useDispatch)(f.store),p=(0,y.useFocusOnMount)("firstElement"),g=(0,y.useFocusReturn)();function v(){d(r),u(void 0),l(!0),"function"==typeof n&&n()}const x=Array.isArray(e)?h.Children.map(e,((e,t)=>0===t?(0,h.cloneElement)(e,{ref:g}):e)):(0,h.cloneElement)(e,{ref:g});if(o)return null;const _=Va(i),j=n||t;return(0,a.jsx)(Pa.Fill,{children:(0,a.jsx)("div",{className:"edit-site-editor-canvas-container",children:(0,a.jsx)(Ia,{enableResizing:s,children:(0,a.jsxs)("section",{className:"edit-site-editor-canvas-container__section",ref:j?p:null,onKeyDown:function(e){e.keyCode!==Xt.ESCAPE||e.defaultPrevented||(e.preventDefault(),v())},"aria-label":_,children:[j&&(0,a.jsx)(b.Button,{size:"compact",className:"edit-site-editor-canvas-container__close-button",icon:Ea,label:t||(0,w.__)("Close"),onClick:v}),x]})})})})};const{useCommandContext:Aa}=ne(Kt.privateApis),{useLocation:Na}=ne(Lt.privateApis);var Fa=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})}),Ma=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.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"})}),Ba=(0,a.jsxs)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,a.jsx)(Zt.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,a.jsx)(Zt.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"})]}),Da=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})}),Ra=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})}),La=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})}),za=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})});function Ha(e){return(0,a.jsx)(b.Button,{size:"compact",...e,className:Ht("edit-site-sidebar-button",e.className)})}const{useHistory:Ga,useLocation:Wa}=ne(Lt.privateApis);function Ua({isRoot:e,title:t,actions:n,content:s,footer:i,description:r,backPath:o}){const{dashboardLink:l,dashboardLinkText:u,previewingThemeName:d}=(0,c.useSelect)((e=>{const{getSettings:t}=ne(e(Rt)),n=Jr();return{dashboardLink:t().__experimentalDashboardLink,dashboardLinkText:t().__experimentalDashboardLinkText,previewingThemeName:n?e(j.store).getTheme(n)?.name?.rendered:void 0}}),[]),p=Wa(),f=Ga(),{navigate:m}=(0,h.useContext)(tn),g=o??p.state?.backPath,v=(0,w.isRTL)()?La:za;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(b.__experimentalVStack,{className:Ht("edit-site-sidebar-navigation-screen__main",{"has-footer":!!i}),spacing:0,justify:"flex-start",children:[(0,a.jsxs)(b.__experimentalHStack,{spacing:3,alignment:"flex-start",className:"edit-site-sidebar-navigation-screen__title-icon",children:[!e&&(0,a.jsx)(Ha,{onClick:()=>{f.navigate(g),m("back")},icon:v,label:(0,w.__)("Back"),showTooltip:!1}),e&&(0,a.jsx)(Ha,{icon:v,label:u||(0,w.__)("Go to the Dashboard"),href:l}),(0,a.jsx)(b.__experimentalHeading,{className:"edit-site-sidebar-navigation-screen__title",color:"#e0e0e0",level:1,size:20,children:Qr()?(0,w.sprintf)((0,w.__)("Previewing %1$s: %2$s"),d,t):t}),n&&(0,a.jsx)("div",{className:"edit-site-sidebar-navigation-screen__actions",children:n})]}),(0,a.jsxs)("div",{className:"edit-site-sidebar-navigation-screen__content",children:[r&&(0,a.jsx)("div",{className:"edit-site-sidebar-navigation-screen__description",children:r}),s]})]}),i&&(0,a.jsx)("footer",{className:"edit-site-sidebar-navigation-screen__footer",children:i})]})}var qa=(0,h.forwardRef)((({icon:e,size:t=24,...n},s)=>(0,h.cloneElement)(e,{width:t,height:t,...n,ref:s}))),Za=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"})}),Ya=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"})});const{useHistory:Ka,useLink:Xa}=ne(Lt.privateApis);function Qa({className:e,icon:t,withChevron:n=!1,suffix:s,uid:i,to:r,onClick:o,children:l,...c}){const u=Ka(),{navigate:d}=(0,h.useContext)(tn);const p=Xa(r);return(0,a.jsx)(b.__experimentalItem,{className:Ht("edit-site-sidebar-navigation-item",{"with-suffix":!n&&s},e),id:i,onClick:function(e){o?(o(e),d("forward")):r&&(e.preventDefault(),u.navigate(r),d("forward",`[id="${i}"]`))},href:r?p.href:void 0,...c,children:(0,a.jsxs)(b.__experimentalHStack,{justify:"flex-start",children:[t&&(0,a.jsx)(qa,{style:{fill:"currentcolor"},icon:t,size:24}),(0,a.jsx)(b.FlexBlock,{children:l}),n&&(0,a.jsx)(qa,{icon:(0,w.isRTL)()?Za:Ya,className:"edit-site-sidebar-navigation-item__drilldown-indicator",size:24}),!n&&s]})})}const Ja={per_page:-1,_fields:"id,name,avatar_urls",context:"view",capabilities:["edit_theme_options"]},$a={per_page:100,page:1},eo=[],{GlobalStylesContext:to}=ne(x.privateApis);function no({query:e}={}){const{user:t}=(0,h.useContext)(to),n={...$a,...e},{authors:s,currentUser:i,isDirty:r,revisions:a,isLoadingGlobalStylesRevisions:o,revisionsCount:l}=(0,c.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,getCurrentUser:s,getUsers:i,getRevisions:r,__experimentalGetCurrentGlobalStylesId:a,getEntityRecord:o,isResolving:l}=e(j.store),c=t(),u=s(),d=c.length>0,h=a(),p=h?o("root","globalStyles",h):void 0,f=p?._links?.["version-history"]?.[0]?.count??0,m=r("root","globalStyles",h,n)||eo;return{authors:i(Ja)||eo,currentUser:u,isDirty:d,revisions:m,isLoadingGlobalStylesRevisions:l("getRevisions",["root","globalStyles",h,n]),revisionsCount:f}}),[e]);return(0,h.useMemo)((()=>{if(!s.length||o)return{revisions:eo,hasUnsavedChanges:r,isLoading:!0,revisionsCount:l};const e=a.map((e=>({...e,author:s.find((t=>t.id===e.author))})));if(a.length){if("unsaved"!==e[0].id&&1===n.page&&(e[0].isLatest=!0),r&&t&&Object.keys(t).length>0&&i&&1===n.page){const n={id:"unsaved",styles:t?.styles,settings:t?.settings,_links:t?._links,author:{name:i?.name,avatar_urls:i?.avatar_urls},modified:new Date};e.unshift(n)}n.page===Math.ceil(l/n.per_page)&&e.push({id:"parent",styles:{},settings:{}})}return{revisions:e,hasUnsavedChanges:r,isLoading:!1,revisionsCount:l}}),[r,a,i,s,t,o])}function so({record:e,revisionsCount:t,...n}){const s={},i=e?._links?.["predecessor-version"]?.[0]?.id??null;return t=t||e?._links?.["version-history"]?.[0]?.count||0,i&&t>1&&(s.href=(0,Qt.addQueryArgs)("revision.php",{revision:e?._links["predecessor-version"][0].id}),s.as="a"),(0,a.jsx)(b.__experimentalItemGroup,{size:"large",className:"edit-site-sidebar-navigation-screen-details-footer",children:(0,a.jsx)(Qa,{icon:ba,...s,...n,children:(0,w.sprintf)((0,w._n)("%d Revision","%d Revisions",t),t)})})}const{useLocation:io,useHistory:ro}=ne(Lt.privateApis);function ao(e){const{name:t}=io();return(0,a.jsx)(Qa,{...e,"aria-current":"styles"===t})}function oo(){const e=ro(),{path:t}=io(),{revisions:n,isLoading:s,revisionsCount:i}=no(),{openGeneralSidebar:r}=(0,c.useDispatch)(Rt),{setEditorCanvasContainerView:o}=ne((0,c.useDispatch)(Rt)),{set:l}=(0,c.useDispatch)(m.store),u=(0,h.useCallback)((async()=>(e.navigate((0,Qt.addQueryArgs)(t,{canvas:"edit"}),{transition:"canvas-mode-edit-transition"}),Promise.all([l("core","distractionFree",!1),r("edit-site/global-styles")]))),[t,e,r,l]),d=(0,h.useCallback)((async()=>{await u(),o("global-styles-revisions")}),[u,o]),p=!!i&&!s;return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(Ua,{title:(0,w.__)("Design"),isRoot:!0,description:(0,w.__)("Customize the appearance of your website using the block editor."),content:(0,a.jsx)(lo,{activeItem:"styles-navigation-item"}),footer:p&&(0,a.jsx)(so,{record:n?.[0],revisionsCount:i,onClick:d})})})}function lo({isBlockBasedTheme:e=!0}){return(0,a.jsxs)(b.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-main",children:[e&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ao,{to:"/styles",uid:"global-styles-navigation-item",icon:Fa,children:(0,w.__)("Styles")}),(0,a.jsx)(Qa,{uid:"navigation-navigation-item",to:"/navigation",withChevron:!0,icon:Ma,children:(0,w.__)("Navigation")}),(0,a.jsx)(Qa,{uid:"page-navigation-item",to:"/page",withChevron:!0,icon:Ba,children:(0,w.__)("Pages")}),(0,a.jsx)(Qa,{uid:"template-navigation-item",to:"/template",withChevron:!0,icon:Da,children:(0,w.__)("Templates")})]}),!e&&(0,a.jsx)(Qa,{uid:"stylebook-navigation-item",to:"/stylebook",withChevron:!0,icon:Fa,children:(0,w.__)("Styles")}),(0,a.jsx)(Qa,{uid:"patterns-navigation-item",to:"/pattern",withChevron:!0,icon:Ra,children:(0,w.__)("Patterns")})]})}function co({customDescription:e}){const t=(0,c.useSelect)((e=>e(j.store).getCurrentTheme()?.is_block_theme),[]),{setEditorCanvasContainerView:n}=ne((0,c.useDispatch)(Rt));let s;return(0,h.useEffect)((()=>{n(void 0)}),[n]),s=e||(t?(0,w.__)("Customize the appearance of your website using the block editor."):(0,w.__)("Explore block styles and patterns to refine your site.")),(0,a.jsx)(Ua,{isRoot:!0,title:(0,w.__)("Design"),description:s,content:(0,a.jsx)(lo,{isBlockBasedTheme:t})})}function uo(){return(0,a.jsx)(b.__experimentalSpacer,{padding:3,children:(0,a.jsx)(b.Notice,{status:"warning",isDismissible:!1,children:(0,w.__)("The theme you are currently using does not support this screen.")})})}var ho=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{d:"M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z"})});function po({nonAnimatedSrc:e,animatedSrc:t}){return(0,a.jsxs)("picture",{className:"edit-site-welcome-guide__image",children:[(0,a.jsx)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,a.jsx)("img",{src:t,width:"312",height:"240",alt:""})]})}function fo(){const{toggle:e}=(0,c.useDispatch)(m.store),{isActive:t,isBlockBasedTheme:n}=(0,c.useSelect)((e=>({isActive:!!e(m.store).get("core/edit-site","welcomeGuide"),isBlockBasedTheme:e(j.store).getCurrentTheme()?.is_block_theme})),[]);return t&&n?(0,a.jsx)(b.Guide,{className:"edit-site-welcome-guide guide-editor",contentLabel:(0,w.__)("Welcome to the site editor"),finishButtonText:(0,w.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuide"),pages:[{image:(0,a.jsx)(po,{nonAnimatedSrc:"https://s.w.org/images/block-editor/edit-your-site.svg?1",animatedSrc:"https://s.w.org/images/block-editor/edit-your-site.gif?1"}),content:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,w.__)("Edit your site")}),(0,a.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,w.__)("Design everything on your site — from the header right down to the footer — using blocks.")}),(0,a.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,h.createInterpolateElement)((0,w.__)("Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors."),{StylesIconImage:(0,a.jsx)("img",{alt:(0,w.__)("styles"),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"})})})]})}]}):null}const{interfaceStore:mo}=ne(f.privateApis);function go(){const{toggle:e}=(0,c.useDispatch)(m.store),{isActive:t,isStylesOpen:n}=(0,c.useSelect)((e=>{const t=e(mo).getActiveComplementaryArea("core");return{isActive:!!e(m.store).get("core/edit-site","welcomeGuideStyles"),isStylesOpen:"edit-site/global-styles"===t}}),[]);if(!t||!n)return null;const s=(0,w.__)("Welcome to Styles");return(0,a.jsx)(b.Guide,{className:"edit-site-welcome-guide guide-styles",contentLabel:s,finishButtonText:(0,w.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuideStyles"),pages:[{image:(0,a.jsx)(po,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-to-styles.svg?1",animatedSrc:"https://s.w.org/images/block-editor/welcome-to-styles.gif?1"}),content:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:s}),(0,a.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,w.__)("Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.")})]})},{image:(0,a.jsx)(po,{nonAnimatedSrc:"https://s.w.org/images/block-editor/set-the-design.svg?1",animatedSrc:"https://s.w.org/images/block-editor/set-the-design.gif?1"}),content:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,w.__)("Set the design")}),(0,a.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,w.__)("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!")})]})},{image:(0,a.jsx)(po,{nonAnimatedSrc:"https://s.w.org/images/block-editor/personalize-blocks.svg?1",animatedSrc:"https://s.w.org/images/block-editor/personalize-blocks.gif?1"}),content:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,w.__)("Personalize blocks")}),(0,a.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,w.__)("You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.")})]})},{image:(0,a.jsx)(po,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,w.__)("Learn more")}),(0,a.jsxs)("p",{className:"edit-site-welcome-guide__text",children:[(0,w.__)("New to block themes and styling your site?")," ",(0,a.jsx)(b.ExternalLink,{href:(0,w.__)("https://wordpress.org/documentation/article/styles-overview/"),children:(0,w.__)("Here’s a detailed guide to learn how to make the most of it.")})]})]})}]})}function vo(){const{toggle:e}=(0,c.useDispatch)(m.store);if(!(0,c.useSelect)((e=>{const t=!!e(m.store).get("core/edit-site","welcomeGuidePage"),n=!!e(m.store).get("core/edit-site","welcomeGuide");return t&&!n}),[]))return null;const t=(0,w.__)("Editing a page");return(0,a.jsx)(b.Guide,{className:"edit-site-welcome-guide guide-page",contentLabel:t,finishButtonText:(0,w.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuidePage"),pages:[{image:(0,a.jsx)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240",children:(0,a.jsx)("source",{src:"https://s.w.org/images/block-editor/editing-your-page.mp4",type:"video/mp4"})}),content:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:t}),(0,a.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,w.__)("It’s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar.")})]})}]})}function yo(){const{toggle:e}=(0,c.useDispatch)(m.store),{isActive:t,hasPreviousEntity:n}=(0,c.useSelect)((e=>{const{getEditorSettings:t}=e(f.store),{get:n}=e(m.store);return{isActive:n("core/edit-site","welcomeGuideTemplate"),hasPreviousEntity:!!t().onNavigateToPreviousEntityRecord}}),[]);if(!(t&&n))return null;const s=(0,w.__)("Editing a template");return(0,a.jsx)(b.Guide,{className:"edit-site-welcome-guide guide-template",contentLabel:s,finishButtonText:(0,w.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuideTemplate"),pages:[{image:(0,a.jsx)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240",children:(0,a.jsx)("source",{src:"https://s.w.org/images/block-editor/editing-your-template.mp4",type:"video/mp4"})}),content:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:s}),(0,a.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,w.__)("Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.")})]})}]})}function xo({postType:e}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(fo,{}),(0,a.jsx)(go,{}),"page"===e&&(0,a.jsx)(vo,{}),"wp_template"===e&&(0,a.jsx)(yo,{})]})}const{useGlobalStylesOutput:bo}=ne(x.privateApis);function wo({disableRootPadding:e}){return function(e){const[t,n]=bo(e),{getSettings:s}=(0,c.useSelect)(Rt),{updateSettings:i}=(0,c.useDispatch)(Rt);(0,h.useEffect)((()=>{if(!t||!n)return;const e=s(),r=Object.values(e.styles??[]).filter((e=>!e.isGlobalStyles));i({...e,styles:[...r,...t],__experimentalFeatures:n})}),[t,n,i,s])}(e),null}const{Theme:_o}=ne(b.privateApis),{useGlobalStyle:jo}=ne(x.privateApis);function So({id:e}){const[t]=jo("color.text"),[n]=jo("color.background"),{highlightedColors:s}=re(),i=s[0]?.color??t,{elapsed:r,total:o}=(0,c.useSelect)((e=>{const t=e(j.store).countSelectorsByStatus(),n=t.resolving??0,s=t.finished??0;return{elapsed:s,total:s+n}}),[]);return(0,a.jsx)("div",{className:"edit-site-canvas-loader",children:(0,a.jsx)(_o,{accent:i,background:n,children:(0,a.jsx)(b.ProgressBar,{id:e,max:o,value:r})})})}const{useHistory:Co}=ne(Lt.privateApis);const{useLocation:ko,useHistory:Eo}=ne(Lt.privateApis);function Po(){const{query:e}=ko(),{canvas:t="view"}=e,n=function(){const e=Co();return(0,h.useCallback)((t=>{e.navigate(`/${t.postType}/${t.postId}?canvas=edit&focusMode=true`)}),[e])}(),{settings:s}=(0,c.useSelect)((e=>{const{getSettings:t}=e(Rt);return{settings:t()}}),[]),i=function(){const e=ko(),t=(0,y.usePrevious)(e),n=Eo();return(0,h.useMemo)((()=>{const s=e.query.focusMode||e?.params?.postId&&Ne.includes(e?.params?.postType),i="edit"===t?.query.canvas;return s&&i?()=>n.back():void 0}),[e,n])}();return(0,h.useMemo)((()=>({...s,richEditingEnabled:!0,supportsTemplateMode:!0,focusMode:"view"!==t,onNavigateToEntityRecord:n,onNavigateToPreviousEntityRecord:i,isPreviewMode:"view"===t})),[s,t,n,i])}const{Fill:Io,Slot:Vo}=(0,b.createSlotFill)("PluginTemplateSettingPanel"),Oo=({children:e})=>{d()("wp.editSite.PluginTemplateSettingPanel",{since:"6.6",version:"6.8",alternative:"wp.editor.PluginDocumentSettingPanel"});return(0,c.useSelect)((e=>"wp_template"===e(f.store).getCurrentPostType()),[])?(0,a.jsx)(Io,{children:e}):null};Oo.Slot=Vo;var To=Oo,Ao=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.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"})}),No=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})});function Fo({className:e,...t}){return(0,a.jsx)(b.Icon,{className:Ht(e,"edit-site-global-styles-icon-with-current-color"),...t})}function Mo({icon:e,children:t,...n}){return(0,a.jsxs)(b.__experimentalItem,{...n,children:[e&&(0,a.jsxs)(b.__experimentalHStack,{justify:"flex-start",children:[(0,a.jsx)(Fo,{icon:e,size:24}),(0,a.jsx)(b.FlexItem,{children:t})]}),!e&&t]})}function Bo(e){return(0,a.jsx)(b.Navigator.Button,{as:Mo,...e})}var Do=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})}),Ro=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.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"})}),Lo=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})}),zo=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.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"})});const{useHasDimensionsPanel:Ho,useHasTypographyPanel:Go,useHasColorPanel:Wo,useGlobalSetting:Uo,useSettingsForBlockElement:qo,useHasBackgroundPanel:Zo}=ne(x.privateApis);var Yo=function(){const[e]=Uo(""),t=qo(e),n=Zo(e),s=Go(t),i=Wo(t),r=Ho(t);return(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(b.__experimentalItemGroup,{children:[s&&(0,a.jsx)(Bo,{icon:Do,path:"/typography",children:(0,w.__)("Typography")}),i&&(0,a.jsx)(Bo,{icon:Ro,path:"/colors",children:(0,w.__)("Colors")}),n&&(0,a.jsx)(Bo,{icon:Lo,path:"/background","aria-label":(0,w.__)("Background styles"),children:(0,w.__)("Background")}),(0,a.jsx)(Bo,{icon:zo,path:"/shadows",children:(0,w.__)("Shadows")}),r&&(0,a.jsx)(Bo,{icon:Da,path:"/layout",children:(0,w.__)("Layout")})]})})};function Ko(e){const t=/^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/,n=e.trim(),s=e=>(e=e.trim()).match(t)?`"${e=e.replace(/^["']|["']$/g,"")}"`:e;return n.includes(",")?n.split(",").map(s).filter((e=>""!==e)).join(", "):s(n)}function Xo(e){if(!e)return"";let t=e.trim();return t.includes(",")&&(t=t.split(",").find((e=>""!==e.trim())).trim()),t=t.replace(/^["']|["']$/g,""),window.navigator.userAgent.toLowerCase().includes("firefox")&&(t=`"${t}"`),t}function Qo(e){const t={fontFamily:Ko(e.fontFamily)};if(!Array.isArray(e.fontFace))return t.fontWeight="400",t.fontStyle="normal",t;if(e.fontFace){const i=e.fontFace.filter((e=>e?.fontStyle&&"normal"===e.fontStyle.toLowerCase()));if(i.length>0){t.fontStyle="normal";const e=function(e){const t=[];return e.forEach((e=>{const n=String(e.fontWeight).split(" ");if(2===n.length){const e=parseInt(n[0]),s=parseInt(n[1]);for(let n=e;n<=s;n+=100)t.push(n)}else 1===n.length&&t.push(parseInt(n[0]))})),t}(i),r=(n=400,0===(s=e).length?null:(s.sort(((e,t)=>Math.abs(n-e)-Math.abs(n-t))),s[0]));t.fontWeight=String(r)||"400"}else t.fontStyle=e.fontFace.length&&e.fontFace[0].fontStyle||"normal",t.fontWeight=e.fontFace.length&&String(e.fontFace[0].fontWeight)||"400"}var n,s;return t}function Jo(e){return e?`is-style-${e}`:""}function $o(e,t){const n=new RegExp(`^${t}([\\d]+)$`);return e.reduce(((e,t)=>{if("string"==typeof t?.slug){const s=t?.slug.match(n);if(s){const t=parseInt(s[1],10);if(t>e)return t}}return e}),0)+1}function el(e,t){if(!Array.isArray(e)||!t)return null;const n=t.replace("var(","").replace(")",""),s=n?.split("--").slice(-1)[0];return e.find((e=>e.slug===s))}const{useGlobalStyle:tl,GlobalStylesContext:nl}=ne(x.privateApis),{mergeBaseAndUserConfigs:sl}=ne(f.privateApis);function il({fontSize:e,variation:t}){const{base:n}=(0,h.useContext)(nl);let s=n;t&&(s=sl(n,t));const[i]=tl("color.text"),[r,o]=function(e){const t=e?.settings?.typography?.fontFamilies?.theme,n=e?.settings?.typography?.fontFamilies?.custom;let s=[];t&&n?s=[...t,...n]:t?s=t:n&&(s=n);const i=e?.styles?.typography?.fontFamily,r=el(s,i),a=e?.styles?.elements?.heading?.typography?.fontFamily;let o;return o=a?el(s,e?.styles?.elements?.heading?.typography?.fontFamily):r,[r,o]}(s),l=r?Qo(r):{},c=o?Qo(o):{};return i&&(l.color=i,c.color=i),e&&(l.fontSize=e,c.fontSize=e),(0,a.jsxs)(b.__unstableMotion.div,{animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:.3,type:"tween"},style:{textAlign:"center",lineHeight:1},children:[(0,a.jsx)("span",{style:c,children:(0,w._x)("A","Uppercase letter A")}),(0,a.jsx)("span",{style:l,children:(0,w._x)("a","Lowercase letter A")})]})}function rl({normalizedColorSwatchSize:e,ratio:t}){const{highlightedColors:n}=re(),s=e*t;return n.map((({slug:e,color:t},n)=>(0,a.jsx)(b.__unstableMotion.div,{style:{height:s,width:s,background:t,borderRadius:s/2},animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:1===n?.2:.1}},`${e}-${n}`)))}const{useGlobalStyle:al}=ne(x.privateApis),ol={leading:!0,trailing:!0};function ll({children:e,label:t,isFocused:n,withHoverView:s}){const[i="white"]=al("color.background"),[r]=al("color.gradient"),o=(0,y.useReducedMotion)(),[l,c]=(0,h.useState)(!1),[u,{width:d}]=(0,y.useResizeObserver)(),[p,f]=(0,h.useState)(d),[m,g]=(0,h.useState)(),v=(0,y.useThrottle)(f,250,ol);(0,h.useLayoutEffect)((()=>{d&&v(d)}),[d,v]),(0,h.useLayoutEffect)((()=>{const e=p?p/248:1,t=e-(m||0);!(Math.abs(t)>.1)&&m||g(e)}),[p,m]);const x=m||(d?d/248:1),w=!!d;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{style:{position:"relative"},children:u}),w&&(0,a.jsx)("div",{className:"edit-site-global-styles-preview__wrapper",style:{height:152*x},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),tabIndex:-1,children:(0,a.jsx)(b.__unstableMotion.div,{style:{height:152*x,width:"100%",background:r??i,cursor:s?"pointer":void 0},initial:"start",animate:(l||n)&&!o&&t?"hover":"start",children:[].concat(e).map(((e,t)=>e({ratio:x,key:t})))})})]})}const{useGlobalStyle:cl}=ne(x.privateApis),ul={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}},dl={hover:{opacity:1},start:{opacity:.5}},hl={hover:{scale:1,opacity:1},start:{scale:0,opacity:0}};var pl=({label:e,isFocused:t,withHoverView:n,variation:s})=>{const[i]=cl("typography.fontWeight"),[r="serif"]=cl("typography.fontFamily"),[o=r]=cl("elements.h1.typography.fontFamily"),[l=i]=cl("elements.h1.typography.fontWeight"),[c="black"]=cl("color.text"),[u=c]=cl("elements.h1.color.text"),{paletteColors:d}=re();return(0,a.jsxs)(ll,{label:e,isFocused:t,withHoverView:n,children:[({ratio:e,key:t})=>(0,a.jsx)(b.__unstableMotion.div,{variants:ul,style:{height:"100%",overflow:"hidden"},children:(0,a.jsxs)(b.__experimentalHStack,{spacing:10*e,justify:"center",style:{height:"100%",overflow:"hidden"},children:[(0,a.jsx)(il,{fontSize:65*e,variation:s}),(0,a.jsx)(b.__experimentalVStack,{spacing:4*e,children:(0,a.jsx)(rl,{normalizedColorSwatchSize:32,ratio:e})})]})},t),({key:e})=>(0,a.jsx)(b.__unstableMotion.div,{variants:n&&dl,style:{height:"100%",width:"100%",position:"absolute",top:0,overflow:"hidden",filter:"blur(60px)",opacity:.1},children:(0,a.jsx)(b.__experimentalHStack,{spacing:0,justify:"flex-start",style:{height:"100%",overflow:"hidden"},children:d.slice(0,4).map((({color:e},t)=>(0,a.jsx)("div",{style:{height:"100%",background:e,flexGrow:1}},t)))})},e),({ratio:t,key:n})=>(0,a.jsx)(b.__unstableMotion.div,{variants:hl,style:{height:"100%",width:"100%",overflow:"hidden",position:"absolute",top:0},children:(0,a.jsx)(b.__experimentalVStack,{spacing:3*t,justify:"center",style:{height:"100%",overflow:"hidden",padding:10*t,boxSizing:"border-box"},children:e&&(0,a.jsx)("div",{style:{fontSize:40*t,fontFamily:o,color:u,fontWeight:l,lineHeight:"1em",textAlign:"center"},children:e})})},n)]})};var fl=function(){const e=(0,c.useSelect)((e=>{const{__experimentalGetCurrentThemeGlobalStylesVariations:t}=e(j.store);return!!t()?.length}),[]);return(0,a.jsxs)(b.Card,{size:"small",isBorderless:!0,className:"edit-site-global-styles-screen-root",isRounded:!1,children:[(0,a.jsx)(b.CardBody,{children:(0,a.jsxs)(b.__experimentalVStack,{spacing:4,children:[(0,a.jsx)(b.Card,{className:"edit-site-global-styles-screen-root__active-style-tile",children:(0,a.jsx)(b.CardMedia,{className:"edit-site-global-styles-screen-root__active-style-tile-preview",children:(0,a.jsx)(pl,{})})}),e&&(0,a.jsx)(b.__experimentalItemGroup,{children:(0,a.jsx)(Bo,{path:"/variations",children:(0,a.jsxs)(b.__experimentalHStack,{justify:"space-between",children:[(0,a.jsx)(b.FlexItem,{children:(0,w.__)("Browse styles")}),(0,a.jsx)(Fo,{icon:(0,w.isRTL)()?za:La})]})})}),(0,a.jsx)(Yo,{})]})}),(0,a.jsx)(b.CardDivider,{}),(0,a.jsxs)(b.CardBody,{children:[(0,a.jsx)(b.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:2,children:(0,w.__)("Customize the appearance of specific blocks for the whole site.")}),(0,a.jsx)(b.__experimentalItemGroup,{children:(0,a.jsx)(Bo,{path:"/blocks",children:(0,a.jsxs)(b.__experimentalHStack,{justify:"space-between",children:[(0,a.jsx)(b.FlexItem,{children:(0,w.__)("Blocks")}),(0,a.jsx)(Fo,{icon:(0,w.isRTL)()?za:La})]})})})]})]})};const ml=window.wp.a11y,{useGlobalStyle:gl}=ne(x.privateApis);function vl(e){const t=(0,c.useSelect)((t=>{const{getBlockStyles:n}=t(o.store);return n(e)}),[e]),[n]=gl("variations",e);return function(e,t){return e?.filter((e=>"block"===e.source||t.includes(e.name)))}(t,Object.keys(n??{}))}function yl({name:e}){const t=vl(e);return(0,a.jsx)(b.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:t.map(((t,n)=>t?.isDefault?null:(0,a.jsx)(Bo,{path:"/blocks/"+encodeURIComponent(e)+"/variations/"+encodeURIComponent(t.name),children:t.label},n)))})}var xl=function({title:e,description:t,onBack:n}){return(0,a.jsxs)(b.__experimentalVStack,{spacing:0,children:[(0,a.jsx)(b.__experimentalView,{children:(0,a.jsx)(b.__experimentalSpacer,{marginBottom:0,paddingX:4,paddingY:3,children:(0,a.jsxs)(b.__experimentalHStack,{spacing:2,children:[(0,a.jsx)(b.Navigator.BackButton,{icon:(0,w.isRTL)()?La:za,size:"small",label:(0,w.__)("Back"),onClick:n}),(0,a.jsx)(b.__experimentalSpacer,{children:(0,a.jsx)(b.__experimentalHeading,{className:"edit-site-global-styles-header",level:2,size:13,children:e})})]})})}),t&&(0,a.jsx)("p",{className:"edit-site-global-styles-header__description",children:t})]})};const{useHasDimensionsPanel:bl,useHasTypographyPanel:wl,useHasBorderPanel:_l,useGlobalSetting:jl,useSettingsForBlockElement:Sl,useHasColorPanel:Cl}=ne(x.privateApis);function kl(e){const[t]=jl("",e),n=Sl(t,e),s=wl(n),i=Cl(n),r=_l(n),a=bl(n),o=r||a,l=!!vl(e)?.length;return s||i||o||l}function El({block:e}){return kl(e.name)?(0,a.jsx)(Bo,{path:"/blocks/"+encodeURIComponent(e.name),children:(0,a.jsxs)(b.__experimentalHStack,{justify:"flex-start",children:[(0,a.jsx)(x.BlockIcon,{icon:e.icon}),(0,a.jsx)(b.FlexItem,{children:e.title})]})}):null}const Pl=(0,h.memo)((function({filterValue:e}){const t=function(){const e=(0,c.useSelect)((e=>e(o.store).getBlockTypes()),[]),{core:t,noncore:n}=e.reduce(((e,t)=>{const{core:n,noncore:s}=e;return(t.name.startsWith("core/")?n:s).push(t),e}),{core:[],noncore:[]});return[...t,...n]}(),n=(0,y.useDebounce)(ml.speak,500),{isMatchingSearchTerm:s}=(0,c.useSelect)(o.store),i=e?t.filter((t=>s(t,e))):t,r=(0,h.useRef)();return(0,h.useEffect)((()=>{if(!e)return;const t=r.current.childElementCount,s=(0,w.sprintf)((0,w._n)("%d result found.","%d results found.",t),t);n(s,t)}),[e,n]),(0,a.jsx)("div",{ref:r,className:"edit-site-block-types-item-list",role:"list",children:0===i.length?(0,a.jsx)(b.__experimentalText,{align:"center",as:"p",children:(0,w.__)("No blocks found.")}):i.map((e=>(0,a.jsx)(El,{block:e},"menu-itemblock-"+e.name)))})}));var Il=function(){const[e,t]=(0,h.useState)(""),n=(0,h.useDeferredValue)(e);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(xl,{title:(0,w.__)("Blocks"),description:(0,w.__)("Customize the appearance of specific blocks and for the whole site.")}),(0,a.jsx)(b.SearchControl,{__nextHasNoMarginBottom:!0,className:"edit-site-block-types-search",onChange:t,value:e,label:(0,w.__)("Search"),placeholder:(0,w.__)("Search")}),(0,a.jsx)(Pl,{filterValue:n})]})};var Vl=({name:e,variation:t=""})=>{const n=(0,o.getBlockType)(e)?.example,s=(0,h.useMemo)((()=>{if(!n)return null;const s={...n,attributes:{...n.attributes,style:void 0,className:t?Jo(t):n.attributes?.className}};return(0,o.getBlockFromExample)(e,s)}),[e,n,t]),i=n?.viewportWidth??500,r=144,l=235/i,c=0!==l&&l<1?r/l:r;return n?(0,a.jsx)(b.__experimentalSpacer,{marginX:4,marginBottom:4,children:(0,a.jsx)("div",{className:"edit-site-global-styles__block-preview-panel",style:{maxHeight:r,boxSizing:"initial"},children:(0,a.jsx)(x.BlockPreview,{blocks:s,viewportWidth:i,minHeight:r,additionalStyles:[{css:`\n\t\t\t\t\t\t\t\tbody{\n\t\t\t\t\t\t\t\t\tpadding: 24px;\n\t\t\t\t\t\t\t\t\tmin-height:${Math.round(c)}px;\n\t\t\t\t\t\t\t\t\tdisplay:flex;\n\t\t\t\t\t\t\t\t\talign-items:center;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t.is-root-container { width: 100%; }\n\t\t\t\t\t\t\t`}]})})}):null};var Ol=function({children:e,level:t}){return(0,a.jsx)(b.__experimentalHeading,{className:"edit-site-global-styles-subtitle",level:t??2,children:e})};const Tl={backgroundSize:"cover",backgroundPosition:"50% 50%"};function Al(e){if(!e)return e;const t=e.color||e.width;return!e.style&&t?{...e,style:"solid"}:!e.style||t?e:void 0}const{useHasDimensionsPanel:Nl,useHasTypographyPanel:Fl,useHasBorderPanel:Ml,useGlobalSetting:Bl,useSettingsForBlockElement:Dl,useHasColorPanel:Rl,useHasFiltersPanel:Ll,useHasImageSettingsPanel:zl,useGlobalStyle:Hl,useHasBackgroundPanel:Gl,BackgroundPanel:Wl,BorderPanel:Ul,ColorPanel:ql,TypographyPanel:Zl,DimensionsPanel:Yl,FiltersPanel:Kl,ImageSettingsPanel:Xl,AdvancedPanel:Ql}=ne(x.privateApis);var Jl=function({name:e,variation:t}){let n=[];t&&(n=["variations",t].concat(n));const s=n.join("."),[i]=Hl(s,e,"user",{shouldDecodeEncode:!1}),[r,l]=Hl(s,e,"all",{shouldDecodeEncode:!1}),[u]=Bl("",e,"user"),[d,p]=Bl("",e),f=Dl(d,e),m=(0,o.getBlockType)(e);let g=!1;f?.spacing?.blockGap&&m?.supports?.spacing?.blockGap&&(!0===m?.supports?.spacing?.__experimentalSkipSerialization||m?.supports?.spacing?.__experimentalSkipSerialization?.some?.((e=>"blockGap"===e)))&&(g=!0);let v=!1;f?.dimensions?.aspectRatio&&"core/group"===e&&(v=!0);const y=(0,h.useMemo)((()=>{const e=structuredClone(f);return g&&(e.spacing.blockGap=!1),v&&(e.dimensions.aspectRatio=!1),e}),[f,g,v]),x=vl(e),_=Gl(y),S=Fl(y),C=Rl(y),k=Ml(y),E=Nl(y),P=Ll(y),I=zl(e,u,y),V=!!x?.length&&!t,{canEditCSS:O}=(0,c.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(j.store),s=n(),i=s?t("root","globalStyles",s):void 0;return{canEditCSS:!!i?._links?.["wp:action-edit-css"]}}),[]),T=t?x.find((e=>e.name===t)):null,A=(0,h.useMemo)((()=>({...r,layout:y.layout})),[r,y.layout]),N=(0,h.useMemo)((()=>({...i,layout:u.layout})),[i,u.layout]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(xl,{title:t?T?.label:m.title}),(0,a.jsx)(Vl,{name:e,variation:t}),V&&(0,a.jsx)("div",{className:"edit-site-global-styles-screen-variations",children:(0,a.jsxs)(b.__experimentalVStack,{spacing:3,children:[(0,a.jsx)(Ol,{children:(0,w.__)("Style Variations")}),(0,a.jsx)(yl,{name:e})]})}),C&&(0,a.jsx)(ql,{inheritedValue:r,value:i,onChange:l,settings:y}),_&&(0,a.jsx)(Wl,{inheritedValue:r,value:i,onChange:l,settings:y,defaultValues:Tl}),S&&(0,a.jsx)(Zl,{inheritedValue:r,value:i,onChange:l,settings:y}),E&&(0,a.jsx)(Yl,{inheritedValue:A,value:N,onChange:e=>{const t={...e};delete t.layout,l(t),e.layout!==u.layout&&p({...u,layout:e.layout})},settings:y,includeLayoutControls:!0}),k&&(0,a.jsx)(Ul,{inheritedValue:r,value:i,onChange:e=>{if(!e?.border)return void l(e);const{radius:t,...n}=e.border,s=function(e){return e?(0,b.__experimentalHasSplitBorders)(e)?{top:Al(e.top),right:Al(e.right),bottom:Al(e.bottom),left:Al(e.left)}:Al(e):e}(n),i=(0,b.__experimentalHasSplitBorders)(s)?{color:null,style:null,width:null,...s}:{top:s,right:s,bottom:s,left:s};l({...e,border:{...i,radius:t}})},settings:y}),P&&(0,a.jsx)(Kl,{inheritedValue:A,value:N,onChange:l,settings:y,includeLayoutControls:!0}),I&&(0,a.jsx)(Xl,{onChange:e=>{p(void 0===e?{...d,lightbox:void 0}:{...d,lightbox:{...d.lightbox,...e}})},value:u,inheritedValue:y}),O&&(0,a.jsxs)(b.PanelBody,{title:(0,w.__)("Advanced"),initialOpen:!1,children:[(0,a.jsx)("p",{children:(0,w.sprintf)((0,w.__)("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."),m?.title)}),(0,a.jsx)(Ql,{value:i,onChange:l,inheritedValue:r})]})]})};const{useGlobalStyle:$l}=ne(x.privateApis);function ec({parentMenu:e,element:t,label:n}){const s="text"!==t&&t?`elements.${t}.`:"",i="link"===t?{textDecoration:"underline"}:{},[r]=$l(s+"typography.fontFamily"),[o]=$l(s+"typography.fontStyle"),[l]=$l(s+"typography.fontWeight"),[c]=$l(s+"color.background"),[u]=$l("color.background"),[d]=$l(s+"color.gradient"),[h]=$l(s+"color.text");return(0,a.jsx)(Bo,{path:e+"/typography/"+t,children:(0,a.jsxs)(b.__experimentalHStack,{justify:"flex-start",children:[(0,a.jsx)(b.FlexItem,{className:"edit-site-global-styles-screen-typography__indicator",style:{fontFamily:r??"serif",background:d??c??u,color:h,fontStyle:o,fontWeight:l,...i},"aria-hidden":"true",children:(0,w.__)("Aa")}),(0,a.jsx)(b.FlexItem,{children:n})]})})}var tc=function(){return(0,a.jsxs)(b.__experimentalVStack,{spacing:3,children:[(0,a.jsx)(Ol,{level:3,children:(0,w.__)("Elements")}),(0,a.jsxs)(b.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[(0,a.jsx)(ec,{parentMenu:"",element:"text",label:(0,w.__)("Text")}),(0,a.jsx)(ec,{parentMenu:"",element:"link",label:(0,w.__)("Links")}),(0,a.jsx)(ec,{parentMenu:"",element:"heading",label:(0,w.__)("Headings")}),(0,a.jsx)(ec,{parentMenu:"",element:"caption",label:(0,w.__)("Captions")}),(0,a.jsx)(ec,{parentMenu:"",element:"button",label:(0,w.__)("Buttons")})]})]})};var nc=({variation:e,isFocused:t,withHoverView:n})=>(0,a.jsx)(ll,{label:e.title,isFocused:t,withHoverView:n,children:({ratio:t,key:n})=>(0,a.jsx)(b.__experimentalHStack,{spacing:10*t,justify:"center",style:{height:"100%",overflow:"hidden"},children:(0,a.jsx)(il,{variation:e,fontSize:85*t})},n)});const sc=[],{GlobalStylesContext:ic,areGlobalStyleConfigsEqual:rc}=ne(x.privateApis),{mergeBaseAndUserConfigs:ac}=ne(f.privateApis);function oc(e,t){if(!t?.length)return e;if("object"!=typeof e||!e||!Object.keys(e).length)return e;for(const n in e)t.includes(n)?delete e[n]:"object"==typeof e[n]&&oc(e[n],t);return e}function lc({title:e,settings:t,styles:n}){return e===(0,w.__)("Default")||Object.keys(t).length>0||Object.keys(n).length>0}function cc(e=[]){const{variationsFromTheme:t}=(0,c.useSelect)((e=>({variationsFromTheme:e(j.store).__experimentalGetCurrentThemeGlobalStylesVariations()||sc})),[]),{user:n}=(0,h.useContext)(ic),s=e.toString();return(0,h.useMemo)((()=>{const s=oc(structuredClone(n),e);s.title=(0,w.__)("Default");const i=t.filter((t=>dc(t,e))).map((e=>ac(s,e))),r=[s,...i];return r?.length?r.filter(lc):[]}),[s,n,t])}const uc=(e,t)=>{if(!e||!t?.length)return{};const n={};return Object.keys(e).forEach((s=>{if(t.includes(s))n[s]=e[s];else if("object"==typeof e[s]){const i=uc(e[s],t);Object.keys(i).length&&(n[s]=i)}})),n};function dc(e,t){const n=uc(structuredClone(e),t);return rc(n,e)}const{mergeBaseAndUserConfigs:hc}=ne(f.privateApis),{GlobalStylesContext:pc,areGlobalStyleConfigsEqual:fc}=ne(x.privateApis);function mc({variation:e,children:t,isPill:n,properties:s,showTooltip:i}){const[r,o]=(0,h.useState)(!1),{base:l,user:c,setUserConfig:u}=(0,h.useContext)(pc),d=(0,h.useMemo)((()=>{let t=hc(l,e);return s&&(t=uc(t,s)),{user:e,base:l,merged:t,setUserConfig:()=>{}}}),[e,l,s]),p=()=>u(e),f=(0,h.useMemo)((()=>fc(c,e)),[c,e]);let m=e?.title;e?.description&&(m=(0,w.sprintf)((0,w._x)("%1$s (%2$s)","variation label"),e?.title,e?.description));const g=(0,a.jsx)("div",{className:Ht("edit-site-global-styles-variations_item",{"is-active":f}),role:"button",onClick:p,onKeyDown:e=>{e.keyCode===Xt.ENTER&&(e.preventDefault(),p())},tabIndex:"0","aria-label":m,"aria-current":f,onFocus:()=>o(!0),onBlur:()=>o(!1),children:(0,a.jsx)("div",{className:Ht("edit-site-global-styles-variations_item-preview",{"is-pill":n}),children:t(r)})});return(0,a.jsx)(pc.Provider,{value:d,children:i?(0,a.jsx)(b.Tooltip,{text:e?.title,children:g}):g})}function gc({title:e,gap:t=2}){const n=["typography"],s=cc(n);return s?.length<=1?null:(0,a.jsxs)(b.__experimentalVStack,{spacing:3,children:[e&&(0,a.jsx)(Ol,{level:3,children:e}),(0,a.jsx)(b.__experimentalGrid,{columns:3,gap:t,className:"edit-site-global-styles-style-variations-container",children:s.map(((e,t)=>(0,a.jsx)(mc,{variation:e,properties:n,showTooltip:!0,children:()=>(0,a.jsx)(nc,{variation:e})},t)))})]})}var vc=function(){return(0,a.jsxs)(b.__experimentalVStack,{spacing:2,children:[(0,a.jsx)(b.__experimentalHStack,{justify:"space-between",children:(0,a.jsx)(Ol,{level:3,children:(0,w.__)("Font Sizes")})}),(0,a.jsx)(b.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:(0,a.jsx)(Bo,{path:"/typography/font-sizes",children:(0,a.jsxs)(b.__experimentalHStack,{direction:"row",children:[(0,a.jsx)(b.FlexItem,{children:(0,w.__)("Font size presets")}),(0,a.jsx)(qa,{icon:(0,w.isRTL)()?za:La})]})})})]})},yc=(0,a.jsxs)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,a.jsx)(Zt.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"}),(0,a.jsx)(Zt.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"})]});const xc="/wp/v2/font-families",bc="/wp/v2/font-collections";async function wc(e){const t={path:xc,method:"POST",body:e},n=await ra()(t);return{id:n.id,...n.font_family_settings,fontFace:[]}}async function _c(e,t){const n={path:`${xc}/${e}/font-faces`,method:"POST",body:t},s=await ra()(n);return{id:s.id,...s.font_face_settings}}async function jc(e){const t={path:`${xc}?slug=${e}&_embed=true`,method:"GET"},n=await ra()(t);if(!n||0===n.length)return null;const s=n[0];return{id:s.id,...s.font_family_settings,fontFace:s?._embedded?.font_faces.map((e=>e.font_face_settings))||[]}}async function Sc(e){const t={path:`${xc}/${e}?force=true`,method:"DELETE"};return await ra()(t)}const Cc=["otf","ttf","woff","woff2"],kc={100:(0,w._x)("Thin","font weight"),200:(0,w._x)("Extra-light","font weight"),300:(0,w._x)("Light","font weight"),400:(0,w._x)("Normal","font weight"),500:(0,w._x)("Medium","font weight"),600:(0,w._x)("Semi-bold","font weight"),700:(0,w._x)("Bold","font weight"),800:(0,w._x)("Extra-bold","font weight"),900:(0,w._x)("Black","font weight")},Ec={normal:(0,w._x)("Normal","font style"),italic:(0,w._x)("Italic","font style")},{File:Pc}=window,{kebabCase:Ic}=ne(b.privateApis);function Vc(e,t={}){return e.name||!e.fontFamily&&!e.slug||(e.name=e.fontFamily||e.slug),{...e,...t}}function Oc(e){return`${kc[e.fontWeight]||e.fontWeight} ${"normal"===e.fontStyle?"":Ec[e.fontStyle]||e.fontStyle}`}function Tc(e=[],t=[]){const n=new Map;for(const t of e)n.set(`${t.fontWeight}${t.fontStyle}`,t);for(const e of t)n.set(`${e.fontWeight}${e.fontStyle}`,e);return Array.from(n.values())}function Ac(e=[],t=[]){const n=new Map;for(const t of e)n.set(t.slug,{...t});for(const e of t)if(n.has(e.slug)){const{fontFace:t,...s}=e,i=Tc(n.get(e.slug).fontFace,t);n.set(e.slug,{...s,fontFace:i})}else n.set(e.slug,{...e});return Array.from(n.values())}async function Nc(e,t,n="all"){let s;if("string"==typeof t)s=`url(${t})`;else{if(!(t instanceof Pc))return;s=await t.arrayBuffer()}const i=new window.FontFace(Xo(e.fontFamily),s,{style:e.fontStyle,weight:e.fontWeight}),r=await i.load();if("document"!==n&&"all"!==n||document.fonts.add(r),"iframe"===n||"all"===n){document.querySelector('iframe[name="editor-canvas"]').contentDocument.fonts.add(r)}}function Fc(e,t="all"){const n=t=>{t.forEach((n=>{n.family===Xo(e?.fontFamily)&&n.weight===e?.fontWeight&&n.style===e?.fontStyle&&t.delete(n)}))};if("document"!==t&&"all"!==t||n(document.fonts),"iframe"===t||"all"===t){n(document.querySelector('iframe[name="editor-canvas"]').contentDocument.fonts)}}function Mc(e){if(!e)return;let t;var n;return t=Array.isArray(e)?e[0]:e,t.startsWith("file:.")?void 0:(("string"!=typeof(n=t)||n===decodeURIComponent(n))&&(t=encodeURI(t)),t)}function Bc(e){const t=new FormData,{fontFace:n,category:s,...i}=e,r={...i,slug:Ic(e.slug)};return t.append("font_family_settings",JSON.stringify(r)),t}function Dc(e){if(e?.fontFace){return e.fontFace.map(((e,t)=>{const n={...e},s=new FormData;if(n.file){const e=Array.isArray(n.file)?n.file:[n.file],i=[];e.forEach(((e,n)=>{const r=`file-${t}-${n}`;s.append(r,e,e.name),i.push(r)})),n.src=1===i.length?i[0]:i,delete n.file,s.append("font_face_settings",JSON.stringify(n))}else s.append("font_face_settings",JSON.stringify(n));return s}))}}async function Rc(e,t){const n=[];for(const s of t)try{const t=await _c(e,s);n.push({status:"fulfilled",value:t})}catch(e){n.push({status:"rejected",reason:e})}const s={errors:[],successes:[]};return n.forEach(((e,n)=>{if("fulfilled"===e.status){const i=e.value;i.id?s.successes.push(i):s.errors.push({data:t[n],message:`Error: ${i.message}`})}else s.errors.push({data:t[n],message:e.reason.message})})),s}function Lc(e,t){return-1!==t.findIndex((t=>t.fontWeight===e.fontWeight&&t.fontStyle===e.fontStyle))}function zc(e,t,n){const s=t=>t.slug===e.slug,i=n.find(s);return t?(i=>{const r=e=>e.fontWeight===t.fontWeight&&e.fontStyle===t.fontStyle;if(!i)return[...n,{...e,fontFace:[t]}];let a=i.fontFace||[];return a=a.find(r)?a.filter((e=>!r(e))):[...a,t],0===a.length?n.filter((e=>!s(e))):n.map((e=>s(e)?{...e,fontFace:a}:e))})(i):i?n.filter((e=>!s(e))):[...n,e]}const{useGlobalSetting:Hc}=ne(x.privateApis),Gc=(0,h.createContext)({});Gc.displayName="FontLibraryContext";var Wc=function({children:e}){const{saveEntityRecord:t}=(0,c.useDispatch)(j.store),{globalStylesId:n}=(0,c.useSelect)((e=>{const{__experimentalGetCurrentGlobalStylesId:t}=e(j.store);return{globalStylesId:t()}})),s=(0,j.useEntityRecord)("root","globalStyles",n),[i,r]=(0,h.useState)(!1),[o,l]=(0,h.useState)(0),u=()=>{l(Date.now())},{records:d=[],isResolving:p}=(0,j.useEntityRecords)("postType","wp_font_family",{refreshKey:o,_embed:!0}),f=(d||[]).map((e=>({id:e.id,...e.font_family_settings,fontFace:e?._embedded?.font_faces.map((e=>e.font_face_settings))||[]})))||[],[m,g]=Hc("typography.fontFamilies"),v=async e=>{const n=s.record;ae(n,["settings","typography","fontFamilies"],e),await t("root","globalStyles",n)},[y,x]=(0,h.useState)(!1),[b,_]=(0,h.useState)(null),S=m?.theme?m.theme.map((e=>Vc(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],C=m?.custom?m.custom.map((e=>Vc(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],k=f?f.map((e=>Vc(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[];(0,h.useEffect)((()=>{y||_(null)}),[y]);const[E]=(0,h.useState)(new Set),P=e=>e.reduce(((e,t)=>{const n=t?.fontFace&&t.fontFace?.length>0?t?.fontFace.map((e=>`${e.fontStyle+e.fontWeight}`)):["normal400"];return e[t.slug]=n,e}),{}),I=e=>P("theme"===e?S:C),V=(e,t,n,s)=>t||n?!!I(s)[e]?.includes(t+n):!!I(s)[e],O=e=>{const t=(m?.[e.source]??[]).filter((t=>t.slug!==e.slug)),n={...m,[e.source]:t};return g(n),e.fontFace&&e.fontFace.forEach((e=>{Fc(e,"all")})),n},T=e=>{const t=A(e),n={...m,custom:Ac(m?.custom,t)};return g(n),N(t),n},A=e=>e.map((({id:e,fontFace:t,...n})=>({...n,...t&&t.length>0?{fontFace:t.map((({id:e,...t})=>t))}:{}}))),N=e=>{e.forEach((e=>{e.fontFace&&e.fontFace.forEach((e=>{Nc(e,Mc(e.src),"all")}))}))},[F,M]=(0,h.useState)([]),B=async()=>{const e=await async function(){const e={path:`${bc}?_fields=slug,name,description`,method:"GET"};return await ra()(e)}();M(e)};return(0,h.useEffect)((()=>{B()}),[]),(0,a.jsx)(Gc.Provider,{value:{libraryFontSelected:b,handleSetLibraryFontSelected:e=>{if(!e)return void _(null);const t=("theme"===e.source?S:k).find((t=>t.slug===e.slug));_({...t||e,source:e.source})},fontFamilies:m,baseCustomFonts:k,isFontActivated:V,getFontFacesActivated:(e,t)=>I(t)[e]||[],loadFontFaceAsset:async e=>{if(!e.src)return;const t=Mc(e.src);t&&!E.has(t)&&(Nc(e,t,"document"),E.add(t))},installFonts:async function(e){r(!0);try{const t=[];let n=[];for(const s of e){let e=!1,i=await jc(s.slug);i||(e=!0,i=await wc(Bc(s)));const r=i.fontFace&&s.fontFace?i.fontFace.filter((e=>Lc(e,s.fontFace))):[];i.fontFace&&s.fontFace&&(s.fontFace=s.fontFace.filter((e=>!Lc(e,i.fontFace))));let a=[],o=[];if(s?.fontFace?.length>0){const e=await Rc(i.id,Dc(s));a=e?.successes,o=e?.errors}(a?.length>0||r?.length>0)&&(i.fontFace=[...a],t.push(i)),i&&!s?.fontFace?.length&&t.push(i),e&&s?.fontFace?.length>0&&0===a?.length&&await Sc(i.id),n=n.concat(o)}if(n=n.reduce(((e,t)=>e.includes(t.message)?e:[...e,t.message]),[]),t.length>0){const e=T(t);await v(e),u()}if(n.length>0){const e=new Error((0,w.__)("There was an error installing fonts."));throw e.installationErrors=n,e}}finally{r(!1)}},uninstallFontFamily:async function(e){try{const t=await Sc(e.id);if(t.deleted){const t=O(e);await v(t)}return u(),t}catch(e){throw console.error("There was an error uninstalling the font family:",e),e}},toggleActivateFont:(e,t)=>{const n=zc(e,t,m?.[e.source]??[]);g({...m,[e.source]:n});V(e.slug,t?.fontStyle,t?.fontWeight,e.source)?Fc(t,"all"):Nc(t,Mc(t?.src),"all")},getAvailableFontsOutline:P,modalTabOpen:y,setModalTabOpen:x,refreshLibrary:u,saveFontFamilies:v,isResolvingLibrary:p,isInstalling:i,collections:F,getFontCollection:async e=>{try{if(!!F.find((t=>t.slug===e))?.font_families)return;const t=await async function(e){const t={path:`${bc}/${e}`,method:"GET"};return await ra()(t)}(e),n=F.map((n=>n.slug===e?{...n,...t}:n));M(n)}catch(e){throw console.error(e),e}}},children:e})};var Uc=function({font:e,text:t}){const n=(0,h.useRef)(null),s=function(e){return e.fontStyle||e.fontWeight?e:e.fontFace&&e.fontFace.length?e.fontFace.find((e=>"normal"===e.fontStyle&&"400"===e.fontWeight))||e.fontFace[0]:{fontStyle:"normal",fontWeight:"400",fontFamily:e.fontFamily,fake:!0}}(e),i=Qo(e);t=t||e.name;const r=e.preview,[o,l]=(0,h.useState)(!1),[c,u]=(0,h.useState)(!1),{loadFontFaceAsset:d}=(0,h.useContext)(Gc),p=r??function(e){return e.preview?e.preview:e.src?Array.isArray(e.src)?e.src[0]:e.src:void 0}(s),f=p&&p.match(/\.(png|jpg|jpeg|gif|svg)$/i);var m;const g={fontSize:"18px",lineHeight:1,opacity:c?"1":"0",...i,...{fontFamily:Ko((m=s).fontFamily),fontStyle:m.fontStyle||"normal",fontWeight:m.fontWeight||"400"}};return(0,h.useEffect)((()=>{const e=new window.IntersectionObserver((([e])=>{l(e.isIntersecting)}),{});return e.observe(n.current),()=>e.disconnect()}),[n]),(0,h.useEffect)((()=>{(async()=>{o&&(!f&&s.src&&await d(s),u(!0))})()}),[s,o,d,f]),(0,a.jsx)("div",{ref:n,children:f?(0,a.jsx)("img",{src:p,loading:"lazy",alt:t,className:"font-library-modal__font-variant_demo-image"}):(0,a.jsx)(b.__experimentalText,{style:g,className:"font-library-modal__font-variant_demo-text",children:t})})};var qc=function({font:e,onClick:t,variantsText:n,navigatorPath:s}){const i=e.fontFace?.length||1,r={cursor:t?"pointer":"default"},o=(0,b.useNavigator)();return(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,onClick:()=>{t(),s&&o.goTo(s)},style:r,className:"font-library-modal__font-card",children:(0,a.jsxs)(b.Flex,{justify:"space-between",wrap:!1,children:[(0,a.jsx)(Uc,{font:e}),(0,a.jsxs)(b.Flex,{justify:"flex-end",children:[(0,a.jsx)(b.FlexItem,{children:(0,a.jsx)(b.__experimentalText,{className:"font-library-modal__font-card__count",children:n||(0,w.sprintf)((0,w._n)("%d variant","%d variants",i),i)})}),(0,a.jsx)(b.FlexItem,{children:(0,a.jsx)(b.Icon,{icon:(0,w.isRTL)()?za:La})})]})]})})};var Zc=function({face:e,font:t}){const{isFontActivated:n,toggleActivateFont:s}=(0,h.useContext)(Gc),i=t?.fontFace?.length>0?n(t.slug,e.fontStyle,e.fontWeight,t.source):n(t.slug,null,null,t.source),r=()=>{t?.fontFace?.length>0?s(t,e):s(t)},o=t.name+" "+Oc(e),l=(0,h.useId)();return(0,a.jsx)("div",{className:"font-library-modal__font-card",children:(0,a.jsxs)(b.Flex,{justify:"flex-start",align:"center",gap:"1rem",children:[(0,a.jsx)(b.CheckboxControl,{checked:i,onChange:r,__nextHasNoMarginBottom:!0,id:l}),(0,a.jsx)("label",{htmlFor:l,children:(0,a.jsx)(Uc,{font:e,text:o,onClick:r})})]})})};function Yc(e){switch(e){case"normal":return 400;case"bold":return 700;case"bolder":return 500;case"lighter":return 300;default:return parseInt(e,10)}}function Kc(e){return e.sort(((e,t)=>"normal"===e.fontStyle&&"normal"!==t.fontStyle?-1:"normal"===t.fontStyle&&"normal"!==e.fontStyle?1:e.fontStyle===t.fontStyle?Yc(e.fontWeight)-Yc(t.fontWeight):e.fontStyle.localeCompare(t.fontStyle)))}const{useGlobalSetting:Xc}=ne(x.privateApis);function Qc({font:e,isOpen:t,setIsOpen:n,setNotice:s,uninstallFontFamily:i,handleSetLibraryFontSelected:r}){const o=(0,b.useNavigator)();return(0,a.jsx)(b.__experimentalConfirmDialog,{isOpen:t,cancelButtonText:(0,w.__)("Cancel"),confirmButtonText:(0,w.__)("Delete"),onCancel:()=>{n(!1)},onConfirm:async()=>{s(null),n(!1);try{await i(e),o.goBack(),r(null),s({type:"success",message:(0,w.__)("Font family uninstalled successfully.")})}catch(e){s({type:"error",message:(0,w.__)("There was an error uninstalling the font family.")+e.message})}},size:"medium",children:e&&(0,w.sprintf)((0,w.__)('Are you sure you want to delete "%s" font and all its variants and assets?'),e.name)})}var Jc=function(){const{baseCustomFonts:e,libraryFontSelected:t,handleSetLibraryFontSelected:n,refreshLibrary:s,uninstallFontFamily:i,isResolvingLibrary:r,isInstalling:o,saveFontFamilies:l,getFontFacesActivated:u}=(0,h.useContext)(Gc),[d,p]=Xc("typography.fontFamilies"),[f,m]=(0,h.useState)(!1),[g,v]=(0,h.useState)(!1),[y]=Xc("typography.fontFamilies",void 0,"base"),x=(0,c.useSelect)((e=>{const{__experimentalGetCurrentGlobalStylesId:t}=e(j.store);return t()})),_=(0,j.useEntityRecord)("root","globalStyles",x),S=!!_?.edits?.settings?.typography?.fontFamilies,C=d?.theme?d.theme.map((e=>Vc(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],k=new Set(C.map((e=>e.slug))),E=y?.theme?C.concat(y.theme.filter((e=>!k.has(e.slug))).map((e=>Vc(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name)))):[],P="custom"===t?.source&&t?.id,I=(0,c.useSelect)((e=>{const{canUser:t}=e(j.store);return P&&t("delete",{kind:"postType",name:"wp_font_family",id:P})}),[P]),V=!!t&&"theme"!==t?.source&&I,O=e=>{const t=e?.fontFace?.length>0?e.fontFace.length:1,n=u(e.slug,e.source).length;return(0,w.sprintf)((0,w.__)("%1$s/%2$s variants active"),n,t)};(0,h.useEffect)((()=>{n(t),s()}),[]);const T=t?u(t.slug,t.source).length:0,A=t?.fontFace?.length??(t?.fontFamily?1:0),N=T>0&&T!==A,F=T===A,M=E.length>0||e.length>0;return(0,a.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[r&&(0,a.jsx)("div",{className:"font-library-modal__loading",children:(0,a.jsx)(b.ProgressBar,{})}),!r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(b.Navigator,{initialPath:t?"/fontFamily":"/",children:[(0,a.jsx)(b.Navigator.Screen,{path:"/",children:(0,a.jsxs)(b.__experimentalVStack,{spacing:"8",children:[g&&(0,a.jsx)(b.Notice,{status:g.type,onRemove:()=>v(null),children:g.message}),!M&&(0,a.jsx)(b.__experimentalText,{as:"p",children:(0,w.__)("No fonts installed.")}),E.length>0&&(0,a.jsxs)(b.__experimentalVStack,{children:[(0,a.jsx)("h2",{className:"font-library-modal__fonts-title",children:(0,w._x)("Theme","font source")}),(0,a.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:E.map((e=>(0,a.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,a.jsx)(qc,{font:e,navigatorPath:"/fontFamily",variantsText:O(e),onClick:()=>{v(null),n(e)}})},e.slug)))})]}),e.length>0&&(0,a.jsxs)(b.__experimentalVStack,{children:[(0,a.jsx)("h2",{className:"font-library-modal__fonts-title",children:(0,w._x)("Custom","font source")}),(0,a.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:e.map((e=>(0,a.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,a.jsx)(qc,{font:e,navigatorPath:"/fontFamily",variantsText:O(e),onClick:()=>{v(null),n(e)}})},e.slug)))})]})]})}),(0,a.jsxs)(b.Navigator.Screen,{path:"/fontFamily",children:[(0,a.jsx)(Qc,{font:t,isOpen:f,setIsOpen:m,setNotice:v,uninstallFontFamily:i,handleSetLibraryFontSelected:n}),(0,a.jsxs)(b.Flex,{justify:"flex-start",children:[(0,a.jsx)(b.Navigator.BackButton,{icon:(0,w.isRTL)()?La:za,size:"small",onClick:()=>{n(null),v(null)},label:(0,w.__)("Back")}),(0,a.jsx)(b.__experimentalHeading,{level:2,size:13,className:"edit-site-global-styles-header",children:t?.name})]}),g&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.__experimentalSpacer,{margin:1}),(0,a.jsx)(b.Notice,{status:g.type,onRemove:()=>v(null),children:g.message}),(0,a.jsx)(b.__experimentalSpacer,{margin:1})]}),(0,a.jsx)(b.__experimentalSpacer,{margin:4}),(0,a.jsx)(b.__experimentalText,{children:(0,w.__)("Choose font variants. Keep in mind that too many variants could make your site slower.")}),(0,a.jsx)(b.__experimentalSpacer,{margin:4}),(0,a.jsxs)(b.__experimentalVStack,{spacing:0,children:[(0,a.jsx)(b.CheckboxControl,{className:"font-library-modal__select-all",label:(0,w.__)("Select all"),checked:F,onChange:()=>{const e=d?.[t.source]?.filter((e=>e.slug!==t.slug))??[],n=F?e:[...e,t];p({...d,[t.source]:n}),t.fontFace&&t.fontFace.forEach((e=>{F?Fc(e,"all"):Nc(e,Mc(e?.src),"all")}))},indeterminate:N,__nextHasNoMarginBottom:!0}),(0,a.jsx)(b.__experimentalSpacer,{margin:8}),(0,a.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:(e=>e?e.fontFace&&e.fontFace.length?Kc(e.fontFace):[{fontFamily:e.fontFamily,fontStyle:"normal",fontWeight:"400"}]:[])(t).map(((e,n)=>(0,a.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,a.jsx)(Zc,{font:t,face:e},`face${n}`)},`face${n}`)))})]})]})]}),(0,a.jsxs)(b.__experimentalHStack,{justify:"flex-end",className:"font-library-modal__footer",children:[o&&(0,a.jsx)(b.ProgressBar,{}),V&&(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,isDestructive:!0,variant:"tertiary",onClick:()=>{m(!0)},children:(0,w.__)("Delete")}),(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:async()=>{v(null);try{await l(d),v({type:"success",message:(0,w.__)("Font family updated successfully.")})}catch(e){v({type:"error",message:(0,w.sprintf)((0,w.__)("There was an error updating the font family. %s"),e.message)})}},disabled:!S,accessibleWhenDisabled:!0,children:(0,w.__)("Update")})]})]})]})},$c=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})}),eu=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})});function tu(e,t,n){return t?!!n[e]?.[`${t.fontStyle}-${t.fontWeight}`]:!!n[e]}var nu=function(){return(0,a.jsx)("div",{className:"font-library__google-fonts-confirm",children:(0,a.jsx)(b.Card,{children:(0,a.jsxs)(b.CardBody,{children:[(0,a.jsx)(b.__experimentalHeading,{level:2,children:(0,w.__)("Connect to Google Fonts")}),(0,a.jsx)(b.__experimentalSpacer,{margin:6}),(0,a.jsx)(b.__experimentalText,{as:"p",children:(0,w.__)("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.")}),(0,a.jsx)(b.__experimentalSpacer,{margin:3}),(0,a.jsx)(b.__experimentalText,{as:"p",children:(0,w.__)("You can alternatively upload files directly on the Upload tab.")}),(0,a.jsx)(b.__experimentalSpacer,{margin:6}),(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:()=>{window.localStorage.setItem("wp-font-library-google-fonts-permission","true"),window.dispatchEvent(new Event("storage"))},children:(0,w.__)("Allow access to Google Fonts")})]})})})};var su=function({face:e,font:t,handleToggleVariant:n,selected:s}){const i=()=>{t?.fontFace?n(t,e):n(t)},r=t.name+" "+Oc(e),o=(0,h.useId)();return(0,a.jsx)("div",{className:"font-library-modal__font-card",children:(0,a.jsxs)(b.Flex,{justify:"flex-start",align:"center",gap:"1rem",children:[(0,a.jsx)(b.CheckboxControl,{checked:s,onChange:i,__nextHasNoMarginBottom:!0,id:o}),(0,a.jsx)("label",{htmlFor:o,children:(0,a.jsx)(Uc,{font:e,text:r,onClick:i})})]})})};const iu={slug:"all",name:(0,w._x)("All","font categories")},ru="wp-font-library-google-fonts-permission";var au=function({slug:e}){const t="google-fonts"===e,n=()=>"true"===window.localStorage.getItem(ru),[s,i]=(0,h.useState)(null),[r,o]=(0,h.useState)(!1),[l,c]=(0,h.useState)([]),[u,d]=(0,h.useState)(1),[p,f]=(0,h.useState)({}),[m,g]=(0,h.useState)(t&&!n()),{collections:v,getFontCollection:x,installFonts:_,isInstalling:j}=(0,h.useContext)(Gc),S=v.find((t=>t.slug===e));(0,h.useEffect)((()=>{const e=()=>{g(t&&!n())};return e(),window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[e,t]);const C=()=>{window.localStorage.setItem(ru,"false"),window.dispatchEvent(new Event("storage"))};(0,h.useEffect)((()=>{(async()=>{try{await x(e),B()}catch(e){r||o({type:"error",message:e?.message})}})()}),[e,x,o,r]),(0,h.useEffect)((()=>{i(null)}),[e]),(0,h.useEffect)((()=>{c([])}),[s]);const k=(0,h.useMemo)((()=>S?.font_families??[]),[S]),E=[iu,...S?.categories??[]],P=(0,h.useMemo)((()=>function(e,t){const{category:n,search:s}=t;let i=e||[];return n&&"all"!==n&&(i=i.filter((e=>-1!==e.categories.indexOf(n)))),s&&(i=i.filter((e=>e.font_family_settings.name.toLowerCase().includes(s.toLowerCase())))),i}(k,p)),[k,p]),I=!S?.font_families&&!r,V=Math.max(window.innerHeight,500),O=Math.floor((V-417)/61),T=Math.ceil(P.length/O),A=(u-1)*O,N=u*O,F=P.slice(A,N),M=(0,y.debounce)((e=>{f({...p,search:e}),d(1)}),300),B=()=>{f({}),d(1)},D=(e,t)=>{const n=zc(e,t,l);c(n)},R=function(e){return e.reduce(((e,t)=>({...e,[t.slug]:(t?.fontFace||[]).reduce(((e,t)=>({...e,[`${t.fontStyle}-${t.fontWeight}`]:!0})),{})})),{})}(l),L=l.length>0?l[0]?.fontFace?.length:0,z=L>0&&L!==s?.fontFace?.length,H=L===s?.fontFace?.length;if(m)return(0,a.jsx)(nu,{});const G=()=>"google-fonts"!==e||m||s?null:(0,a.jsx)(b.DropdownMenu,{icon:No,label:(0,w.__)("Actions"),popoverProps:{position:"bottom left"},controls:[{title:(0,w.__)("Revoke access to Google Fonts"),onClick:C}]});return(0,a.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[I&&(0,a.jsx)("div",{className:"font-library-modal__loading",children:(0,a.jsx)(b.ProgressBar,{})}),!I&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(b.Navigator,{initialPath:"/",className:"font-library-modal__tabpanel-layout",children:[(0,a.jsxs)(b.Navigator.Screen,{path:"/",children:[(0,a.jsxs)(b.__experimentalHStack,{justify:"space-between",children:[(0,a.jsxs)(b.__experimentalVStack,{children:[(0,a.jsx)(b.__experimentalHeading,{level:2,size:13,children:S.name}),(0,a.jsx)(b.__experimentalText,{children:S.description})]}),(0,a.jsx)(G,{})]}),(0,a.jsx)(b.__experimentalSpacer,{margin:4}),(0,a.jsxs)(b.Flex,{children:[(0,a.jsx)(b.FlexItem,{children:(0,a.jsx)(b.SearchControl,{className:"font-library-modal__search",value:p.search,placeholder:(0,w.__)("Font name…"),label:(0,w.__)("Search"),onChange:M,__nextHasNoMarginBottom:!0,hideLabelFromVision:!1})}),(0,a.jsx)(b.FlexItem,{children:(0,a.jsx)(b.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,w.__)("Category"),value:p.category,onChange:e=>{f({...p,category:e}),d(1)},children:E&&E.map((e=>(0,a.jsx)("option",{value:e.slug,children:e.name},e.slug)))})})]}),(0,a.jsx)(b.__experimentalSpacer,{margin:4}),!!S?.font_families?.length&&!P.length&&(0,a.jsx)(b.__experimentalText,{children:(0,w.__)("No fonts found. Try with a different search term.")}),(0,a.jsx)("div",{className:"font-library-modal__fonts-grid__main",children:(0,a.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:F.map((e=>(0,a.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,a.jsx)(qc,{font:e.font_family_settings,navigatorPath:"/fontFamily",onClick:()=>{i(e.font_family_settings)}})},e.font_family_settings.slug)))})})]}),(0,a.jsxs)(b.Navigator.Screen,{path:"/fontFamily",children:[(0,a.jsxs)(b.Flex,{justify:"flex-start",children:[(0,a.jsx)(b.Navigator.BackButton,{icon:(0,w.isRTL)()?La:za,size:"small",onClick:()=>{i(null),o(null)},label:(0,w.__)("Back")}),(0,a.jsx)(b.__experimentalHeading,{level:2,size:13,className:"edit-site-global-styles-header",children:s?.name})]}),r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.__experimentalSpacer,{margin:1}),(0,a.jsx)(b.Notice,{status:r.type,onRemove:()=>o(null),children:r.message}),(0,a.jsx)(b.__experimentalSpacer,{margin:1})]}),(0,a.jsx)(b.__experimentalSpacer,{margin:4}),(0,a.jsx)(b.__experimentalText,{children:(0,w.__)("Select font variants to install.")}),(0,a.jsx)(b.__experimentalSpacer,{margin:4}),(0,a.jsx)(b.CheckboxControl,{className:"font-library-modal__select-all",label:(0,w.__)("Select all"),checked:H,onChange:()=>{c(H?[]:[s])},indeterminate:z,__nextHasNoMarginBottom:!0}),(0,a.jsx)(b.__experimentalVStack,{spacing:0,children:(0,a.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:(W=s,W?W.fontFace&&W.fontFace.length?Kc(W.fontFace):[{fontFamily:W.fontFamily,fontStyle:"normal",fontWeight:"400"}]:[]).map(((e,t)=>(0,a.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,a.jsx)(su,{font:s,face:e,handleToggleVariant:D,selected:tu(s.slug,s.fontFace?e:null,R)})},`face${t}`)))})}),(0,a.jsx)(b.__experimentalSpacer,{margin:16})]})]}),s&&(0,a.jsx)(b.Flex,{justify:"flex-end",className:"font-library-modal__footer",children:(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:async()=>{o(null);const e=l[0];try{e?.fontFace&&await Promise.all(e.fontFace.map((async e=>{e.src&&(e.file=await async function(e){e=Array.isArray(e)?e:[e];const t=await Promise.all(e.map((async e=>fetch(new Request(e)).then((t=>{if(!t.ok)throw new Error(`Error downloading font face asset from ${e}. Server responded with status: ${t.status}`);return t.blob()})).then((t=>{const n=e.split("/").pop();return new Pc([t],n,{type:t.type})})))));return 1===t.length?t[0]:t}(e.src))})))}catch(e){return void o({type:"error",message:(0,w.__)("Error installing the fonts, could not be downloaded.")})}try{await _([e]),o({type:"success",message:(0,w.__)("Fonts were installed successfully.")})}catch(e){o({type:"error",message:e.message})}c([])},isBusy:j,disabled:0===l.length||j,accessibleWhenDisabled:!0,children:(0,w.__)("Install")})}),!s&&(0,a.jsxs)(b.__experimentalHStack,{expanded:!1,className:"font-library-modal__footer",justify:"end",spacing:6,children:[(0,a.jsx)(b.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:1,className:"font-library-modal__page-selection",children:(0,h.createInterpolateElement)((0,w.sprintf)((0,w._x)("<div>Page</div>%1$s<div>of %2$s</div>","paging"),"<CurrentPage />",T),{div:(0,a.jsx)("div",{"aria-hidden":!0}),CurrentPage:(0,a.jsx)(b.SelectControl,{"aria-label":(0,w.__)("Current page"),value:u,options:[...Array(T)].map(((e,t)=>({label:t+1,value:t+1}))),onChange:e=>d(parseInt(e)),size:"small",__nextHasNoMarginBottom:!0,variant:"minimal"})})}),(0,a.jsxs)(b.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,a.jsx)(b.Button,{onClick:()=>d(u-1),disabled:1===u,accessibleWhenDisabled:!0,label:(0,w.__)("Previous page"),icon:(0,w.isRTL)()?$c:eu,showTooltip:!0,size:"compact",tooltipPosition:"top"}),(0,a.jsx)(b.Button,{onClick:()=>d(u+1),disabled:u===T,accessibleWhenDisabled:!0,label:(0,w.__)("Next page"),icon:(0,w.isRTL)()?eu:$c,showTooltip:!0,size:"compact",tooltipPosition:"top"})]})]})]})]});var W},ou=i(8572),lu=i.n(ou),cu=i(4660),uu=i.n(cu);globalThis.fetch;class du{constructor(e,t={},n){this.type=e,this.detail=t,this.msg=n,Object.defineProperty(this,"__mayPropagate",{enumerable:!1,writable:!0}),this.__mayPropagate=!0}preventDefault(){}stopPropagation(){this.__mayPropagate=!1}valueOf(){return this}toString(){return this.msg?`[${this.type} event]: ${this.msg}`:`[${this.type} event]`}}class hu{constructor(){this.listeners={}}addEventListener(e,t,n){let s=this.listeners[e]||[];n?s.unshift(t):s.push(t),this.listeners[e]=s}removeEventListener(e,t){let n=this.listeners[e]||[],s=n.findIndex((e=>e===t));s>-1&&(n.splice(s,1),this.listeners[e]=n)}dispatch(e){let t=this.listeners[e.type];if(t)for(let n=0,s=t.length;n<s&&e.__mayPropagate;n++)t[n](e)}}const pu=new Date("1904-01-01T00:00:00+0000").getTime();class fu{constructor(e,t,n){this.name=(n||e.tag||"").trim(),this.length=e.length,this.start=e.offset,this.offset=0,this.data=t,["getInt8","getUint8","getInt16","getUint16","getInt32","getUint32","getBigInt64","getBigUint64"].forEach((e=>{let t=e.replace(/get(Big)?/,"").toLowerCase(),n=parseInt(e.replace(/[^\d]/g,""))/8;Object.defineProperty(this,t,{get:()=>this.getValue(e,n)})}))}get currentPosition(){return this.start+this.offset}set currentPosition(e){this.start=e,this.offset=0}skip(e=0,t=8){this.offset+=e*t/8}getValue(e,t){let n=this.start+this.offset;this.offset+=t;try{return this.data[e](n)}catch(n){throw console.error("parser",e,t,this),console.error("parser",this.start,this.offset),n}}flags(e){if(8===e||16===e||32===e||64===e)return this[`uint${e}`].toString(2).padStart(e,0).split("").map((e=>"1"===e));console.error("Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long"),console.trace()}get tag(){const e=this.uint32;return t=[e>>24&255,e>>16&255,e>>8&255,255&e],Array.from(t).map((e=>String.fromCharCode(e))).join("");var t}get fixed(){return this.int16+Math.round(1e3*this.uint16/65356)/1e3}get legacyFixed(){let e=this.uint16,t=this.uint16.toString(16).padStart(4,0);return parseFloat(`${e}.${t}`)}get uint24(){return(this.uint8<<16)+(this.uint8<<8)+this.uint8}get uint128(){let e=0;for(let t=0;t<5;t++){let t=this.uint8;if(e=128*e+(127&t),t<128)break}return e}get longdatetime(){return new Date(pu+1e3*parseInt(this.int64.toString()))}get fword(){return this.int16}get ufword(){return this.uint16}get Offset16(){return this.uint16}get Offset32(){return this.uint32}get F2DOT14(){const e=p.uint16;return[0,1,-2,-1][e>>14]+(16383&e)/16384}verifyLength(){this.offset!=this.length&&console.error(`unexpected parsed table size (${this.offset}) for "${this.name}" (expected ${this.length})`)}readBytes(e=0,t=0,n=8,s=!1){if(0===(e=e||this.length))return[];t&&(this.currentPosition=t);const i=`${s?"":"u"}int${n}`,r=[];for(;e--;)r.push(this[i]);return r}}class mu{constructor(e){const t={enumerable:!1,get:()=>e};Object.defineProperty(this,"parser",t);const n=e.currentPosition,s={enumerable:!1,get:()=>n};Object.defineProperty(this,"start",s)}load(e){Object.keys(e).forEach((t=>{let n=Object.getOwnPropertyDescriptor(e,t);n.get?this[t]=n.get.bind(this):void 0!==n.value&&(this[t]=n.value)})),this.parser.length&&this.parser.verifyLength()}}class gu extends mu{constructor(e,t,n){const{parser:s,start:i}=super(new fu(e,t,n)),r={enumerable:!1,get:()=>s};Object.defineProperty(this,"p",r);const a={enumerable:!1,get:()=>i};Object.defineProperty(this,"tableStart",a)}}function vu(e,t,n){let s;Object.defineProperty(e,t,{get:()=>s||(s=n(),s),enumerable:!0})}class yu extends gu{constructor(e,t,n){const{p:s}=super({offset:0,length:12},t,"sfnt");this.version=s.uint32,this.numTables=s.uint16,this.searchRange=s.uint16,this.entrySelector=s.uint16,this.rangeShift=s.uint16,s.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new xu(s))),this.tables={},this.directory.forEach((e=>{vu(this.tables,e.tag.trim(),(()=>n(this.tables,{tag:e.tag,offset:e.offset,length:e.length},t)))}))}}class xu{constructor(e){this.tag=e.tag,this.checksum=e.uint32,this.offset=e.uint32,this.length=e.uint32}}const bu=uu().inflate||void 0;let wu;class _u extends gu{constructor(e,t,n){const{p:s}=super({offset:0,length:44},t,"woff");this.signature=s.tag,this.flavor=s.uint32,this.length=s.uint32,this.numTables=s.uint16,s.uint16,this.totalSfntSize=s.uint32,this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.metaOffset=s.uint32,this.metaLength=s.uint32,this.metaOrigLength=s.uint32,this.privOffset=s.uint32,this.privLength=s.uint32,s.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new ju(s))),Su(this,t,n)}}class ju{constructor(e){this.tag=e.tag,this.offset=e.uint32,this.compLength=e.uint32,this.origLength=e.uint32,this.origChecksum=e.uint32}}function Su(e,t,n){e.tables={},e.directory.forEach((s=>{vu(e.tables,s.tag.trim(),(()=>{let i=0,r=t;if(s.compLength!==s.origLength){const e=t.buffer.slice(s.offset,s.offset+s.compLength);let n;if(bu)n=bu(new Uint8Array(e));else{if(!wu){const e="no brotli decoder available to decode WOFF2 font";throw font.onerror&&font.onerror(e),new Error(e)}n=wu(new Uint8Array(e))}r=new DataView(n.buffer)}else i=s.offset;return n(e.tables,{tag:s.tag,offset:i,length:s.origLength},r)}))}))}const Cu=lu();let ku;class Eu extends gu{constructor(e,t,n){const{p:s}=super({offset:0,length:48},t,"woff2");this.signature=s.tag,this.flavor=s.uint32,this.length=s.uint32,this.numTables=s.uint16,s.uint16,this.totalSfntSize=s.uint32,this.totalCompressedSize=s.uint32,this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.metaOffset=s.uint32,this.metaLength=s.uint32,this.metaOrigLength=s.uint32,this.privOffset=s.uint32,this.privLength=s.uint32,s.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new Pu(s)));let i,r=s.currentPosition;this.directory[0].offset=0,this.directory.forEach(((e,t)=>{let n=this.directory[t+1];n&&(n.offset=e.offset+(void 0!==e.transformLength?e.transformLength:e.origLength))}));let a=t.buffer.slice(r);if(Cu)i=Cu(new Uint8Array(a));else{if(!ku){const t="no brotli decoder available to decode WOFF2 font";throw e.onerror&&e.onerror(t),new Error(t)}i=new Uint8Array(ku(a))}!function(e,t,n){e.tables={},e.directory.forEach((s=>{vu(e.tables,s.tag.trim(),(()=>{const i=s.offset,r=i+(s.transformLength?s.transformLength:s.origLength),a=new DataView(t.slice(i,r).buffer);try{return n(e.tables,{tag:s.tag,offset:0,length:s.origLength},a)}catch(e){console.error(e)}}))}))}(this,i,n)}}class Pu{constructor(e){this.flags=e.uint8;const t=this.tagNumber=63&this.flags;this.tag=63===t?e.tag:["cmap","head","hhea","hmtx","maxp","name","OS/2","post","cvt ","fpgm","glyf","loca","prep","CFF ","VORG","EBDT","EBLC","gasp","hdmx","kern","LTSH","PCLT","VDMX","vhea","vmtx","BASE","GDEF","GPOS","GSUB","EBSC","JSTF","MATH","CBDT","CBLC","COLR","CPAL","SVG ","sbix","acnt","avar","bdat","bloc","bsln","cvar","fdsc","feat","fmtx","fvar","gvar","hsty","just","lcar","mort","morx","opbd","prop","trak","Zapf","Silf","Glat","Gloc","Feat","Sill"][63&t];let n=0!==(this.transformVersion=(192&this.flags)>>6);"glyf"!==this.tag&&"loca"!==this.tag||(n=3!==this.transformVersion),this.origLength=e.uint128,n&&(this.transformLength=e.uint128)}}const Iu={};let Vu=!1;function Ou(e,t,n){let s=t.tag.replace(/[^\w\d]/g,""),i=Iu[s];return i?new i(t,n,e):(console.warn(`lib-font has no definition for ${s}. The table was skipped.`),{})}function Tu(){let e=0;function t(n,s){if(!Vu)return e>10?s(new Error("loading took too long")):(e++,setTimeout((()=>t(n)),250));n(Ou)}return new Promise(((e,n)=>t(e)))}async function Au(e,t,n={}){if(!globalThis.document)return;let s=function(e,t){let n=e.lastIndexOf("."),s=(e.substring(n+1)||"").toLowerCase(),i={ttf:"truetype",otf:"opentype",woff:"woff",woff2:"woff2"}[s];if(i)return i;let r={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.",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.",fon:"The .fon format is not supported: this is an ancient Windows bitmap font format.",ttc:"Based on the current CSS specification, font collections are not (yet?) supported."}[s];if(r||(r=`${e} is not a known webfont format.`),t)throw new Error(r);console.warn(`Could not load font: ${r}`)}(t,n.errorOnStyle);if(!s)return;let i=document.createElement("style");i.className="injected-by-Font-js";let r=[];return n.styleRules&&(r=Object.entries(n.styleRules).map((([e,t])=>`${e}: ${t};`))),i.textContent=`\n@font-face {\n font-family: "${e}";\n ${r.join("\n\t")}\n src: url("${t}") format("${s}");\n}`,globalThis.document.head.appendChild(i),i}Promise.all([Promise.resolve().then((function(){return nd})),Promise.resolve().then((function(){return sd})),Promise.resolve().then((function(){return id})),Promise.resolve().then((function(){return ad})),Promise.resolve().then((function(){return od})),Promise.resolve().then((function(){return ud})),Promise.resolve().then((function(){return dd})),Promise.resolve().then((function(){return pd})),Promise.resolve().then((function(){return Sd})),Promise.resolve().then((function(){return Md})),Promise.resolve().then((function(){return Ah})),Promise.resolve().then((function(){return Nh})),Promise.resolve().then((function(){return Bh})),Promise.resolve().then((function(){return Lh})),Promise.resolve().then((function(){return zh})),Promise.resolve().then((function(){return Hh})),Promise.resolve().then((function(){return Wh})),Promise.resolve().then((function(){return Uh})),Promise.resolve().then((function(){return qh})),Promise.resolve().then((function(){return Zh})),Promise.resolve().then((function(){return Yh})),Promise.resolve().then((function(){return Kh})),Promise.resolve().then((function(){return Qh})),Promise.resolve().then((function(){return np})),Promise.resolve().then((function(){return ip})),Promise.resolve().then((function(){return rp})),Promise.resolve().then((function(){return ap})),Promise.resolve().then((function(){return op})),Promise.resolve().then((function(){return lp})),Promise.resolve().then((function(){return dp})),Promise.resolve().then((function(){return gp})),Promise.resolve().then((function(){return xp})),Promise.resolve().then((function(){return wp})),Promise.resolve().then((function(){return Sp})),Promise.resolve().then((function(){return Cp})),Promise.resolve().then((function(){return kp})),Promise.resolve().then((function(){return Pp})),Promise.resolve().then((function(){return Ip})),Promise.resolve().then((function(){return Ap})),Promise.resolve().then((function(){return Np})),Promise.resolve().then((function(){return Mp}))]).then((e=>{e.forEach((e=>{let t=Object.keys(e)[0];Iu[t]=e[t]})),Vu=!0}));const Nu=[0,1,0,0],Fu=[79,84,84,79],Mu=[119,79,70,70],Bu=[119,79,70,50];function Du(e,t){if(e.length===t.length){for(let n=0;n<e.length;n++)if(e[n]!==t[n])return;return!0}}class Ru extends hu{constructor(e,t={}){super(),this.name=e,this.options=t,this.metrics=!1}get src(){return this.__src}set src(e){this.__src=e,(async()=>{globalThis.document&&!this.options.skipStyleSheet&&await Au(this.name,e,this.options),this.loadFont(e)})()}async loadFont(e,t){fetch(e).then((e=>function(e){if(!e.ok)throw new Error(`HTTP ${e.status} - ${e.statusText}`);return e}(e)&&e.arrayBuffer())).then((n=>this.fromDataBuffer(n,t||e))).catch((n=>{const s=new du("error",n,`Failed to load font at ${t||e}`);this.dispatch(s),this.onerror&&this.onerror(s)}))}async fromDataBuffer(e,t){this.fontData=new DataView(e);let n=function(e){const t=[e.getUint8(0),e.getUint8(1),e.getUint8(2),e.getUint8(3)];return Du(t,Nu)||Du(t,Fu)?"SFNT":Du(t,Mu)?"WOFF":Du(t,Bu)?"WOFF2":void 0}(this.fontData);if(!n)throw new Error(`${t} is either an unsupported font format, or not a font at all.`);await this.parseBasicData(n);const s=new du("load",{font:this});this.dispatch(s),this.onload&&this.onload(s)}async parseBasicData(e){return Tu().then((t=>("SFNT"===e&&(this.opentype=new yu(this,this.fontData,t)),"WOFF"===e&&(this.opentype=new _u(this,this.fontData,t)),"WOFF2"===e&&(this.opentype=new Eu(this,this.fontData,t)),this.opentype)))}getGlyphId(e){return this.opentype.tables.cmap.getGlyphId(e)}reverse(e){return this.opentype.tables.cmap.reverse(e)}supports(e){return 0!==this.getGlyphId(e)}supportsVariation(e){return!1!==this.opentype.tables.cmap.supportsVariation(e)}measureText(e,t=16){if(this.__unloaded)throw new Error("Cannot measure text: font was unloaded. Please reload before calling measureText()");let n=document.createElement("div");n.textContent=e,n.style.fontFamily=this.name,n.style.fontSize=`${t}px`,n.style.color="transparent",n.style.background="transparent",n.style.top="0",n.style.left="0",n.style.position="absolute",document.body.appendChild(n);let s=n.getBoundingClientRect();document.body.removeChild(n);const i=this.opentype.tables["OS/2"];return s.fontSize=t,s.ascender=i.sTypoAscender,s.descender=i.sTypoDescender,s}unload(){if(this.styleElement.parentNode){this.styleElement.parentNode.removeElement(this.styleElement);const e=new du("unload",{font:this});this.dispatch(e),this.onunload&&this.onunload(e)}this._unloaded=!0}load(){if(this.__unloaded){delete this.__unloaded,document.head.appendChild(this.styleElement);const e=new du("load",{font:this});this.dispatch(e),this.onload&&this.onload(e)}}}globalThis.Font=Ru;class Lu extends mu{constructor(e,t,n){super(e),this.plaformID=t,this.encodingID=n}}class zu extends Lu{constructor(e,t,n){super(e,t,n),this.format=0,this.length=e.uint16,this.language=e.uint16,this.glyphIdArray=[...new Array(256)].map((t=>e.uint8))}supports(e){return e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.")),0<=e&&e<=255}reverse(e){return console.warn("reverse not implemented for cmap subtable format 0"),{}}getSupportedCharCodes(){return[{start:1,end:256}]}}class Hu extends Lu{constructor(e,t,n){super(e,t,n),this.format=2,this.length=e.uint16,this.language=e.uint16,this.subHeaderKeys=[...new Array(256)].map((t=>e.uint16));const s=Math.max(...this.subHeaderKeys),i=e.currentPosition;vu(this,"subHeaders",(()=>(e.currentPosition=i,[...new Array(s)].map((t=>new Gu(e))))));const r=i+8*s;vu(this,"glyphIndexArray",(()=>(e.currentPosition=r,[...new Array(s)].map((t=>e.uint16)))))}supports(e){e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented."));const t=e&&255,n=e&&65280,s=this.subHeaders[n],i=this.subHeaders[s],r=i.firstCode,a=r+i.entryCount;return r<=t&&t<=a}reverse(e){return console.warn("reverse not implemented for cmap subtable format 2"),{}}getSupportedCharCodes(e=!1){return e?this.subHeaders.map((e=>({firstCode:e.firstCode,lastCode:e.lastCode}))):this.subHeaders.map((e=>({start:e.firstCode,end:e.lastCode})))}}class Gu{constructor(e){this.firstCode=e.uint16,this.entryCount=e.uint16,this.lastCode=this.first+this.entryCount,this.idDelta=e.int16,this.idRangeOffset=e.uint16}}class Wu extends Lu{constructor(e,t,n){super(e,t,n),this.format=4,this.length=e.uint16,this.language=e.uint16,this.segCountX2=e.uint16,this.segCount=this.segCountX2/2,this.searchRange=e.uint16,this.entrySelector=e.uint16,this.rangeShift=e.uint16;const s=e.currentPosition;vu(this,"endCode",(()=>e.readBytes(this.segCount,s,16)));const i=s+2+this.segCountX2;vu(this,"startCode",(()=>e.readBytes(this.segCount,i,16)));const r=i+this.segCountX2;vu(this,"idDelta",(()=>e.readBytes(this.segCount,r,16,!0)));const a=r+this.segCountX2;vu(this,"idRangeOffset",(()=>e.readBytes(this.segCount,a,16)));const o=a+this.segCountX2,l=this.length-(o-this.tableStart);vu(this,"glyphIdArray",(()=>e.readBytes(l,o,16))),vu(this,"segments",(()=>this.buildSegments(a,o,e)))}buildSegments(e,t,n){return[...new Array(this.segCount)].map(((t,s)=>{let i=this.startCode[s],r=this.endCode[s],a=this.idDelta[s],o=this.idRangeOffset[s],l=e+2*s,c=[];if(0===o)for(let e=i+a,t=r+a;e<=t;e++)c.push(e);else for(let e=0,t=r-i;e<=t;e++)n.currentPosition=l+o+2*e,c.push(n.uint16);return{startCode:i,endCode:r,idDelta:a,idRangeOffset:o,glyphIDs:c}}))}reverse(e){let t=this.segments.find((t=>t.glyphIDs.includes(e)));if(!t)return{};const n=t.startCode+t.glyphIDs.indexOf(e);return{code:n,unicode:String.fromCodePoint(n)}}getGlyphId(e){if(e.charCodeAt&&(e=e.charCodeAt(0)),55296<=e&&e<=57343)return 0;if(!(65534&~e&&65535&~e))return 0;let t=this.segments.find((t=>t.startCode<=e&&e<=t.endCode));return t?t.glyphIDs[e-t.startCode]:0}supports(e){return 0!==this.getGlyphId(e)}getSupportedCharCodes(e=!1){return e?this.segments:this.segments.map((e=>({start:e.startCode,end:e.endCode})))}}class Uu extends Lu{constructor(e,t,n){super(e,t,n),this.format=6,this.length=e.uint16,this.language=e.uint16,this.firstCode=e.uint16,this.entryCount=e.uint16,this.lastCode=this.firstCode+this.entryCount-1;vu(this,"glyphIdArray",(()=>[...new Array(this.entryCount)].map((t=>e.uint16))))}supports(e){if(e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.")),e<this.firstCode)return{};if(e>this.firstCode+this.entryCount)return{};const t=e-this.firstCode;return{code:t,unicode:String.fromCodePoint(t)}}reverse(e){let t=this.glyphIdArray.indexOf(e);if(t>-1)return this.firstCode+t}getSupportedCharCodes(e=!1){return e?[{firstCode:this.firstCode,lastCode:this.lastCode}]:[{start:this.firstCode,end:this.lastCode}]}}class qu extends Lu{constructor(e,t,n){super(e,t,n),this.format=8,e.uint16,this.length=e.uint32,this.language=e.uint32,this.is32=[...new Array(8192)].map((t=>e.uint8)),this.numGroups=e.uint32;vu(this,"groups",(()=>[...new Array(this.numGroups)].map((t=>new Zu(e)))))}supports(e){return e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.")),-1!==this.groups.findIndex((t=>t.startcharCode<=e&&e<=t.endcharCode))}reverse(e){return console.warn("reverse not implemented for cmap subtable format 8"),{}}getSupportedCharCodes(e=!1){return e?this.groups:this.groups.map((e=>({start:e.startcharCode,end:e.endcharCode})))}}class Zu{constructor(e){this.startcharCode=e.uint32,this.endcharCode=e.uint32,this.startGlyphID=e.uint32}}class Yu extends Lu{constructor(e,t,n){super(e,t,n),this.format=10,e.uint16,this.length=e.uint32,this.language=e.uint32,this.startCharCode=e.uint32,this.numChars=e.uint32,this.endCharCode=this.startCharCode+this.numChars;vu(this,"glyphs",(()=>[...new Array(this.numChars)].map((t=>e.uint16))))}supports(e){return e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.")),!(e<this.startCharCode)&&(!(e>this.startCharCode+this.numChars)&&e-this.startCharCode)}reverse(e){return console.warn("reverse not implemented for cmap subtable format 10"),{}}getSupportedCharCodes(e=!1){return e?[{startCharCode:this.startCharCode,endCharCode:this.endCharCode}]:[{start:this.startCharCode,end:this.endCharCode}]}}class Ku extends Lu{constructor(e,t,n){super(e,t,n),this.format=12,e.uint16,this.length=e.uint32,this.language=e.uint32,this.numGroups=e.uint32;vu(this,"groups",(()=>[...new Array(this.numGroups)].map((t=>new Xu(e)))))}supports(e){return e.charCodeAt&&(e=e.charCodeAt(0)),55296<=e&&e<=57343?0:65534&~e&&65535&~e?-1!==this.groups.findIndex((t=>t.startCharCode<=e&&e<=t.endCharCode)):0}reverse(e){for(let t of this.groups){let n=t.startGlyphID;if(n>e)continue;if(n===e)return t.startCharCode;if(n+(t.endCharCode-t.startCharCode)<e)continue;const s=t.startCharCode+(e-n);return{code:s,unicode:String.fromCodePoint(s)}}return{}}getSupportedCharCodes(e=!1){return e?this.groups:this.groups.map((e=>({start:e.startCharCode,end:e.endCharCode})))}}class Xu{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.startGlyphID=e.uint32}}class Qu extends Lu{constructor(e,t,n){super(e,t,n),this.format=13,e.uint16,this.length=e.uint32,this.language=e.uint32,this.numGroups=e.uint32;vu(this,"groups",[...new Array(this.numGroups)].map((t=>new Ju(e))))}supports(e){return e.charCodeAt&&(e=e.charCodeAt(0)),-1!==this.groups.findIndex((t=>t.startCharCode<=e&&e<=t.endCharCode))}reverse(e){return console.warn("reverse not implemented for cmap subtable format 13"),{}}getSupportedCharCodes(e=!1){return e?this.groups:this.groups.map((e=>({start:e.startCharCode,end:e.endCharCode})))}}class Ju{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.glyphID=e.uint32}}class $u extends Lu{constructor(e,t,n){super(e,t,n),this.subTableStart=e.currentPosition,this.format=14,this.length=e.uint32,this.numVarSelectorRecords=e.uint32,vu(this,"varSelectors",(()=>[...new Array(this.numVarSelectorRecords)].map((t=>new ed(e)))))}supports(){return console.warn("supports not implemented for cmap subtable format 14"),0}getSupportedCharCodes(){return console.warn("getSupportedCharCodes not implemented for cmap subtable format 14"),[]}reverse(e){return console.warn("reverse not implemented for cmap subtable format 14"),{}}supportsVariation(e){let t=this.varSelector.find((t=>t.varSelector===e));return t||!1}getSupportedVariations(){return this.varSelectors.map((e=>e.varSelector))}}class ed{constructor(e){this.varSelector=e.uint24,this.defaultUVSOffset=e.Offset32,this.nonDefaultUVSOffset=e.Offset32}}class td{constructor(e,t){const n=this.platformID=e.uint16,s=this.encodingID=e.uint16,i=this.offset=e.Offset32;vu(this,"table",(()=>(e.currentPosition=t+i,function(e,t,n){const s=e.uint16;return 0===s?new zu(e,t,n):2===s?new Hu(e,t,n):4===s?new Wu(e,t,n):6===s?new Uu(e,t,n):8===s?new qu(e,t,n):10===s?new Yu(e,t,n):12===s?new Ku(e,t,n):13===s?new Qu(e,t,n):14===s?new $u(e,t,n):{}}(e,n,s))))}}var nd=Object.freeze({__proto__:null,cmap:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numTables=n.uint16,this.encodingRecords=[...new Array(this.numTables)].map((e=>new td(n,this.tableStart)))}getSubTable(e){return this.encodingRecords[e].table}getSupportedEncodings(){return this.encodingRecords.map((e=>({platformID:e.platformID,encodingId:e.encodingID})))}getSupportedCharCodes(e,t){const n=this.encodingRecords.findIndex((n=>n.platformID===e&&n.encodingID===t));if(-1===n)return!1;return this.getSubTable(n).getSupportedCharCodes()}reverse(e){for(let t=0;t<this.numTables;t++){let n=this.getSubTable(t).reverse(e);if(n)return n}}getGlyphId(e){let t=0;return this.encodingRecords.some(((n,s)=>{let i=this.getSubTable(s);return!!i.getGlyphId&&(t=i.getGlyphId(e),0!==t)})),t}supports(e){return this.encodingRecords.some(((t,n)=>{const s=this.getSubTable(n);return s.supports&&!1!==s.supports(e)}))}supportsVariation(e){return this.encodingRecords.some(((t,n)=>{const s=this.getSubTable(n);return s.supportsVariation&&!1!==s.supportsVariation(e)}))}}});var sd=Object.freeze({__proto__:null,head:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.load({majorVersion:n.uint16,minorVersion:n.uint16,fontRevision:n.fixed,checkSumAdjustment:n.uint32,magicNumber:n.uint32,flags:n.flags(16),unitsPerEm:n.uint16,created:n.longdatetime,modified:n.longdatetime,xMin:n.int16,yMin:n.int16,xMax:n.int16,yMax:n.int16,macStyle:n.flags(16),lowestRecPPEM:n.uint16,fontDirectionHint:n.uint16,indexToLocFormat:n.uint16,glyphDataFormat:n.uint16})}}});var id=Object.freeze({__proto__:null,hhea:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.ascender=n.fword,this.descender=n.fword,this.lineGap=n.fword,this.advanceWidthMax=n.ufword,this.minLeftSideBearing=n.fword,this.minRightSideBearing=n.fword,this.xMaxExtent=n.fword,this.caretSlopeRise=n.int16,this.caretSlopeRun=n.int16,this.caretOffset=n.int16,n.int16,n.int16,n.int16,n.int16,this.metricDataFormat=n.int16,this.numberOfHMetrics=n.uint16,n.verifyLength()}}});class rd{constructor(e,t){this.advanceWidth=e,this.lsb=t}}var ad=Object.freeze({__proto__:null,hmtx:class extends gu{constructor(e,t,n){const{p:s}=super(e,t),i=n.hhea.numberOfHMetrics,r=n.maxp.numGlyphs,a=s.currentPosition;if(vu(this,"hMetrics",(()=>(s.currentPosition=a,[...new Array(i)].map((e=>new rd(s.uint16,s.int16)))))),i<r){const e=a+4*i;vu(this,"leftSideBearings",(()=>(s.currentPosition=e,[...new Array(r-i)].map((e=>s.int16)))))}}}});var od=Object.freeze({__proto__:null,maxp:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.version=n.legacyFixed,this.numGlyphs=n.uint16,1===this.version&&(this.maxPoints=n.uint16,this.maxContours=n.uint16,this.maxCompositePoints=n.uint16,this.maxCompositeContours=n.uint16,this.maxZones=n.uint16,this.maxTwilightPoints=n.uint16,this.maxStorage=n.uint16,this.maxFunctionDefs=n.uint16,this.maxInstructionDefs=n.uint16,this.maxStackElements=n.uint16,this.maxSizeOfInstructions=n.uint16,this.maxComponentElements=n.uint16,this.maxComponentDepth=n.uint16),n.verifyLength()}}});class ld{constructor(e,t){this.length=e,this.offset=t}}class cd{constructor(e,t){this.platformID=e.uint16,this.encodingID=e.uint16,this.languageID=e.uint16,this.nameID=e.uint16,this.length=e.uint16,this.offset=e.Offset16,vu(this,"string",(()=>(e.currentPosition=t.stringStart+this.offset,function(e,t){const{platformID:n,length:s}=t;if(0===s)return"";if(0===n||3===n){const t=[];for(let n=0,i=s/2;n<i;n++)t[n]=String.fromCharCode(e.uint16);return t.join("")}const i=e.readBytes(s),r=[];return i.forEach((function(e,t){r[t]=String.fromCharCode(e)})),r.join("")}(e,this))))}}var ud=Object.freeze({__proto__:null,name:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.format=n.uint16,this.count=n.uint16,this.stringOffset=n.Offset16,this.nameRecords=[...new Array(this.count)].map((e=>new cd(n,this))),1===this.format&&(this.langTagCount=n.uint16,this.langTagRecords=[...new Array(this.langTagCount)].map((e=>new ld(n.uint16,n.Offset16)))),this.stringStart=this.tableStart+this.stringOffset}get(e){let t=this.nameRecords.find((t=>t.nameID===e));if(t)return t.string}}});var dd=Object.freeze({__proto__:null,OS2:class extends gu{constructor(e,t){const{p:n}=super(e,t);return this.version=n.uint16,this.xAvgCharWidth=n.int16,this.usWeightClass=n.uint16,this.usWidthClass=n.uint16,this.fsType=n.uint16,this.ySubscriptXSize=n.int16,this.ySubscriptYSize=n.int16,this.ySubscriptXOffset=n.int16,this.ySubscriptYOffset=n.int16,this.ySuperscriptXSize=n.int16,this.ySuperscriptYSize=n.int16,this.ySuperscriptXOffset=n.int16,this.ySuperscriptYOffset=n.int16,this.yStrikeoutSize=n.int16,this.yStrikeoutPosition=n.int16,this.sFamilyClass=n.int16,this.panose=[...new Array(10)].map((e=>n.uint8)),this.ulUnicodeRange1=n.flags(32),this.ulUnicodeRange2=n.flags(32),this.ulUnicodeRange3=n.flags(32),this.ulUnicodeRange4=n.flags(32),this.achVendID=n.tag,this.fsSelection=n.uint16,this.usFirstCharIndex=n.uint16,this.usLastCharIndex=n.uint16,this.sTypoAscender=n.int16,this.sTypoDescender=n.int16,this.sTypoLineGap=n.int16,this.usWinAscent=n.uint16,this.usWinDescent=n.uint16,0===this.version?n.verifyLength():(this.ulCodePageRange1=n.flags(32),this.ulCodePageRange2=n.flags(32),1===this.version?n.verifyLength():(this.sxHeight=n.int16,this.sCapHeight=n.int16,this.usDefaultChar=n.uint16,this.usBreakChar=n.uint16,this.usMaxContext=n.uint16,this.version<=4?n.verifyLength():(this.usLowerOpticalPointSize=n.uint16,this.usUpperOpticalPointSize=n.uint16,5===this.version?n.verifyLength():void 0)))}}});const hd=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];var pd=Object.freeze({__proto__:null,post:class extends gu{constructor(e,t){const{p:n}=super(e,t);if(this.version=n.legacyFixed,this.italicAngle=n.fixed,this.underlinePosition=n.fword,this.underlineThickness=n.fword,this.isFixedPitch=n.uint32,this.minMemType42=n.uint32,this.maxMemType42=n.uint32,this.minMemType1=n.uint32,this.maxMemType1=n.uint32,1===this.version||3===this.version)return n.verifyLength();if(this.numGlyphs=n.uint16,2===this.version){this.glyphNameIndex=[...new Array(this.numGlyphs)].map((e=>n.uint16)),this.namesOffset=n.currentPosition,this.glyphNameOffsets=[1];for(let e=0;e<this.numGlyphs;e++){if(this.glyphNameIndex[e]<hd.length){this.glyphNameOffsets.push(this.glyphNameOffsets[e]);continue}let t=n.int8;n.skip(t),this.glyphNameOffsets.push(this.glyphNameOffsets[e]+t+1)}}2.5===this.version&&(this.offset=[...new Array(this.numGlyphs)].map((e=>n.int8)))}getGlyphName(e){if(2!==this.version)return console.warn(`post table version ${this.version} does not support glyph name lookups`),"";let t=this.glyphNameIndex[e];if(t<258)return hd[t];let n=this.glyphNameOffsets[e],s=this.glyphNameOffsets[e+1]-n-1;if(0===s)return".notdef.";this.parser.currentPosition=this.namesOffset+n;return this.parser.readBytes(s,this.namesOffset+n,8,!0).map((e=>String.fromCharCode(e))).join("")}}});class fd extends gu{constructor(e,t){const{p:n}=super(e,t,"AxisTable");this.baseTagListOffset=n.Offset16,this.baseScriptListOffset=n.Offset16,vu(this,"baseTagList",(()=>new md({offset:e.offset+this.baseTagListOffset},t))),vu(this,"baseScriptList",(()=>new gd({offset:e.offset+this.baseScriptListOffset},t)))}}class md extends gu{constructor(e,t){const{p:n}=super(e,t,"BaseTagListTable");this.baseTagCount=n.uint16,this.baselineTags=[...new Array(this.baseTagCount)].map((e=>n.tag))}}class gd extends gu{constructor(e,t){const{p:n}=super(e,t,"BaseScriptListTable");this.baseScriptCount=n.uint16;const s=n.currentPosition;vu(this,"baseScriptRecords",(()=>(n.currentPosition=s,[...new Array(this.baseScriptCount)].map((e=>new vd(this.start,n))))))}}class vd{constructor(e,t){this.baseScriptTag=t.tag,this.baseScriptOffset=t.Offset16,vu(this,"baseScriptTable",(()=>(t.currentPosition=e+this.baseScriptOffset,new yd(t))))}}class yd{constructor(e){this.start=e.currentPosition,this.baseValuesOffset=e.Offset16,this.defaultMinMaxOffset=e.Offset16,this.baseLangSysCount=e.uint16,this.baseLangSysRecords=[...new Array(this.baseLangSysCount)].map((t=>new xd(this.start,e))),vu(this,"baseValues",(()=>(e.currentPosition=this.start+this.baseValuesOffset,new bd(e)))),vu(this,"defaultMinMax",(()=>(e.currentPosition=this.start+this.defaultMinMaxOffset,new wd(e))))}}class xd{constructor(e,t){this.baseLangSysTag=t.tag,this.minMaxOffset=t.Offset16,vu(this,"minMax",(()=>(t.currentPosition=e+this.minMaxOffset,new wd(t))))}}class bd{constructor(e){this.parser=e,this.start=e.currentPosition,this.defaultBaselineIndex=e.uint16,this.baseCoordCount=e.uint16,this.baseCoords=[...new Array(this.baseCoordCount)].map((t=>e.Offset16))}getTable(e){return this.parser.currentPosition=this.start+this.baseCoords[e],new jd(this.parser)}}class wd{constructor(e){this.minCoord=e.Offset16,this.maxCoord=e.Offset16,this.featMinMaxCount=e.uint16;const t=e.currentPosition;vu(this,"featMinMaxRecords",(()=>(e.currentPosition=t,[...new Array(this.featMinMaxCount)].map((t=>new _d(e))))))}}class _d{constructor(e){this.featureTableTag=e.tag,this.minCoord=e.Offset16,this.maxCoord=e.Offset16}}class jd{constructor(e){this.baseCoordFormat=e.uint16,this.coordinate=e.int16,2===this.baseCoordFormat&&(this.referenceGlyph=e.uint16,this.baseCoordPoint=e.uint16),3===this.baseCoordFormat&&(this.deviceTable=e.Offset16)}}var Sd=Object.freeze({__proto__:null,BASE:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.horizAxisOffset=n.Offset16,this.vertAxisOffset=n.Offset16,vu(this,"horizAxis",(()=>new fd({offset:e.offset+this.horizAxisOffset},t))),vu(this,"vertAxis",(()=>new fd({offset:e.offset+this.vertAxisOffset},t))),1===this.majorVersion&&1===this.minorVersion&&(this.itemVarStoreOffset=n.Offset32,vu(this,"itemVarStore",(()=>new fd({offset:e.offset+this.itemVarStoreOffset},t))))}}});class Cd{constructor(e){this.classFormat=e.uint16,1===this.classFormat&&(this.startGlyphID=e.uint16,this.glyphCount=e.uint16,this.classValueArray=[...new Array(this.glyphCount)].map((t=>e.uint16))),2===this.classFormat&&(this.classRangeCount=e.uint16,this.classRangeRecords=[...new Array(this.classRangeCount)].map((t=>new kd(e))))}}class kd{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.class=e.uint16}}class Ed extends mu{constructor(e){super(e),this.coverageFormat=e.uint16,1===this.coverageFormat&&(this.glyphCount=e.uint16,this.glyphArray=[...new Array(this.glyphCount)].map((t=>e.uint16))),2===this.coverageFormat&&(this.rangeCount=e.uint16,this.rangeRecords=[...new Array(this.rangeCount)].map((t=>new Pd(e))))}}class Pd{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.startCoverageIndex=e.uint16}}class Id{constructor(e,t){this.table=e,this.parser=t,this.start=t.currentPosition,this.format=t.uint16,this.variationRegionListOffset=t.Offset32,this.itemVariationDataCount=t.uint16,this.itemVariationDataOffsets=[...new Array(this.itemVariationDataCount)].map((e=>t.Offset32))}}class Vd extends mu{constructor(e){super(e),this.coverageOffset=e.Offset16,this.glyphCount=e.uint16,this.attachPointOffsets=[...new Array(this.glyphCount)].map((t=>e.Offset16))}getPoint(e){return this.parser.currentPosition=this.start+this.attachPointOffsets[e],new Od(this.parser)}}class Od{constructor(e){this.pointCount=e.uint16,this.pointIndices=[...new Array(this.pointCount)].map((t=>e.uint16))}}class Td extends mu{constructor(e){super(e),this.coverageOffset=e.Offset16,vu(this,"coverage",(()=>(e.currentPosition=this.start+this.coverageOffset,new Ed(e)))),this.ligGlyphCount=e.uint16,this.ligGlyphOffsets=[...new Array(this.ligGlyphCount)].map((t=>e.Offset16))}getLigGlyph(e){return this.parser.currentPosition=this.start+this.ligGlyphOffsets[e],new Ad(this.parser)}}class Ad extends mu{constructor(e){super(e),this.caretCount=e.uint16,this.caretValueOffsets=[...new Array(this.caretCount)].map((t=>e.Offset16))}getCaretValue(e){return this.parser.currentPosition=this.start+this.caretValueOffsets[e],new Nd(this.parser)}}class Nd{constructor(e){this.caretValueFormat=e.uint16,1===this.caretValueFormat&&(this.coordinate=e.int16),2===this.caretValueFormat&&(this.caretValuePointIndex=e.uint16),3===this.caretValueFormat&&(this.coordinate=e.int16,this.deviceOffset=e.Offset16)}}class Fd extends mu{constructor(e){super(e),this.markGlyphSetTableFormat=e.uint16,this.markGlyphSetCount=e.uint16,this.coverageOffsets=[...new Array(this.markGlyphSetCount)].map((t=>e.Offset32))}getMarkGlyphSet(e){return this.parser.currentPosition=this.start+this.coverageOffsets[e],new Ed(this.parser)}}var Md=Object.freeze({__proto__:null,GDEF:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.glyphClassDefOffset=n.Offset16,vu(this,"glyphClassDefs",(()=>{if(0!==this.glyphClassDefOffset)return n.currentPosition=this.tableStart+this.glyphClassDefOffset,new Cd(n)})),this.attachListOffset=n.Offset16,vu(this,"attachList",(()=>{if(0!==this.attachListOffset)return n.currentPosition=this.tableStart+this.attachListOffset,new Vd(n)})),this.ligCaretListOffset=n.Offset16,vu(this,"ligCaretList",(()=>{if(0!==this.ligCaretListOffset)return n.currentPosition=this.tableStart+this.ligCaretListOffset,new Td(n)})),this.markAttachClassDefOffset=n.Offset16,vu(this,"markAttachClassDef",(()=>{if(0!==this.markAttachClassDefOffset)return n.currentPosition=this.tableStart+this.markAttachClassDefOffset,new Cd(n)})),this.minorVersion>=2&&(this.markGlyphSetsDefOffset=n.Offset16,vu(this,"markGlyphSetsDef",(()=>{if(0!==this.markGlyphSetsDefOffset)return n.currentPosition=this.tableStart+this.markGlyphSetsDefOffset,new Fd(n)}))),3===this.minorVersion&&(this.itemVarStoreOffset=n.Offset32,vu(this,"itemVarStore",(()=>{if(0!==this.itemVarStoreOffset)return n.currentPosition=this.tableStart+this.itemVarStoreOffset,new Id(n)})))}}});class Bd extends mu{static EMPTY={scriptCount:0,scriptRecords:[]};constructor(e){super(e),this.scriptCount=e.uint16,this.scriptRecords=[...new Array(this.scriptCount)].map((t=>new Dd(e)))}}class Dd{constructor(e){this.scriptTag=e.tag,this.scriptOffset=e.Offset16}}class Rd extends mu{constructor(e){super(e),this.defaultLangSys=e.Offset16,this.langSysCount=e.uint16,this.langSysRecords=[...new Array(this.langSysCount)].map((t=>new Ld(e)))}}class Ld{constructor(e){this.langSysTag=e.tag,this.langSysOffset=e.Offset16}}class zd{constructor(e){this.lookupOrder=e.Offset16,this.requiredFeatureIndex=e.uint16,this.featureIndexCount=e.uint16,this.featureIndices=[...new Array(this.featureIndexCount)].map((t=>e.uint16))}}class Hd extends mu{static EMPTY={featureCount:0,featureRecords:[]};constructor(e){super(e),this.featureCount=e.uint16,this.featureRecords=[...new Array(this.featureCount)].map((t=>new Gd(e)))}}class Gd{constructor(e){this.featureTag=e.tag,this.featureOffset=e.Offset16}}class Wd extends mu{constructor(e){super(e),this.featureParams=e.Offset16,this.lookupIndexCount=e.uint16,this.lookupListIndices=[...new Array(this.lookupIndexCount)].map((t=>e.uint16))}getFeatureParams(){if(this.featureParams>0){const e=this.parser;e.currentPosition=this.start+this.featureParams;const t=this.featureTag;if("size"===t)return new qd(e);if(t.startsWith("cc"))return new Ud(e);if(t.startsWith("ss"))return new Zd(e)}}}class Ud{constructor(e){this.format=e.uint16,this.featUiLabelNameId=e.uint16,this.featUiTooltipTextNameId=e.uint16,this.sampleTextNameId=e.uint16,this.numNamedParameters=e.uint16,this.firstParamUiLabelNameId=e.uint16,this.charCount=e.uint16,this.character=[...new Array(this.charCount)].map((t=>e.uint24))}}class qd{constructor(e){this.designSize=e.uint16,this.subfamilyIdentifier=e.uint16,this.subfamilyNameID=e.uint16,this.smallEnd=e.uint16,this.largeEnd=e.uint16}}class Zd{constructor(e){this.version=e.uint16,this.UINameID=e.uint16}}function Yd(e){e.parser.currentPosition-=2,delete e.coverageOffset,delete e.getCoverageTable}class Kd extends mu{constructor(e){super(e),this.substFormat=e.uint16,this.coverageOffset=e.Offset16}getCoverageTable(){let e=this.parser;return e.currentPosition=this.start+this.coverageOffset,new Ed(e)}}class Xd{constructor(e){this.glyphSequenceIndex=e.uint16,this.lookupListIndex=e.uint16}}class Qd extends Kd{constructor(e){super(e),this.deltaGlyphID=e.int16}}class Jd extends Kd{constructor(e){super(e),this.sequenceCount=e.uint16,this.sequenceOffsets=[...new Array(this.sequenceCount)].map((t=>e.Offset16))}getSequence(e){let t=this.parser;return t.currentPosition=this.start+this.sequenceOffsets[e],new $d(t)}}class $d{constructor(e){this.glyphCount=e.uint16,this.substituteGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}class eh extends Kd{constructor(e){super(e),this.alternateSetCount=e.uint16,this.alternateSetOffsets=[...new Array(this.alternateSetCount)].map((t=>e.Offset16))}getAlternateSet(e){let t=this.parser;return t.currentPosition=this.start+this.alternateSetOffsets[e],new th(t)}}class th{constructor(e){this.glyphCount=e.uint16,this.alternateGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}class nh extends Kd{constructor(e){super(e),this.ligatureSetCount=e.uint16,this.ligatureSetOffsets=[...new Array(this.ligatureSetCount)].map((t=>e.Offset16))}getLigatureSet(e){let t=this.parser;return t.currentPosition=this.start+this.ligatureSetOffsets[e],new sh(t)}}class sh extends mu{constructor(e){super(e),this.ligatureCount=e.uint16,this.ligatureOffsets=[...new Array(this.ligatureCount)].map((t=>e.Offset16))}getLigature(e){let t=this.parser;return t.currentPosition=this.start+this.ligatureOffsets[e],new ih(t)}}class ih{constructor(e){this.ligatureGlyph=e.uint16,this.componentCount=e.uint16,this.componentGlyphIDs=[...new Array(this.componentCount-1)].map((t=>e.uint16))}}class rh extends Kd{constructor(e){super(e),1===this.substFormat&&(this.subRuleSetCount=e.uint16,this.subRuleSetOffsets=[...new Array(this.subRuleSetCount)].map((t=>e.Offset16))),2===this.substFormat&&(this.classDefOffset=e.Offset16,this.subClassSetCount=e.uint16,this.subClassSetOffsets=[...new Array(this.subClassSetCount)].map((t=>e.Offset16))),3===this.substFormat&&(Yd(this),this.glyphCount=e.uint16,this.substitutionCount=e.uint16,this.coverageOffsets=[...new Array(this.glyphCount)].map((t=>e.Offset16)),this.substLookupRecords=[...new Array(this.substitutionCount)].map((t=>new Xd(e))))}getSubRuleSet(e){if(1!==this.substFormat)throw new Error(`lookup type 5.${this.substFormat} has no subrule sets.`);let t=this.parser;return t.currentPosition=this.start+this.subRuleSetOffsets[e],new ah(t)}getSubClassSet(e){if(2!==this.substFormat)throw new Error(`lookup type 5.${this.substFormat} has no subclass sets.`);let t=this.parser;return t.currentPosition=this.start+this.subClassSetOffsets[e],new lh(t)}getCoverageTable(e){if(3!==this.substFormat&&!e)return super.getCoverageTable();if(!e)throw new Error(`lookup type 5.${this.substFormat} requires an coverage table index.`);let t=this.parser;return t.currentPosition=this.start+this.coverageOffsets[e],new Ed(t)}}class ah extends mu{constructor(e){super(e),this.subRuleCount=e.uint16,this.subRuleOffsets=[...new Array(this.subRuleCount)].map((t=>e.Offset16))}getSubRule(e){let t=this.parser;return t.currentPosition=this.start+this.subRuleOffsets[e],new oh(t)}}class oh{constructor(e){this.glyphCount=e.uint16,this.substitutionCount=e.uint16,this.inputSequence=[...new Array(this.glyphCount-1)].map((t=>e.uint16)),this.substLookupRecords=[...new Array(this.substitutionCount)].map((t=>new Xd(e)))}}class lh extends mu{constructor(e){super(e),this.subClassRuleCount=e.uint16,this.subClassRuleOffsets=[...new Array(this.subClassRuleCount)].map((t=>e.Offset16))}getSubClass(e){let t=this.parser;return t.currentPosition=this.start+this.subClassRuleOffsets[e],new ch(t)}}class ch extends oh{constructor(e){super(e)}}class uh extends Kd{constructor(e){super(e),1===this.substFormat&&(this.chainSubRuleSetCount=e.uint16,this.chainSubRuleSetOffsets=[...new Array(this.chainSubRuleSetCount)].map((t=>e.Offset16))),2===this.substFormat&&(this.backtrackClassDefOffset=e.Offset16,this.inputClassDefOffset=e.Offset16,this.lookaheadClassDefOffset=e.Offset16,this.chainSubClassSetCount=e.uint16,this.chainSubClassSetOffsets=[...new Array(this.chainSubClassSetCount)].map((t=>e.Offset16))),3===this.substFormat&&(Yd(this),this.backtrackGlyphCount=e.uint16,this.backtrackCoverageOffsets=[...new Array(this.backtrackGlyphCount)].map((t=>e.Offset16)),this.inputGlyphCount=e.uint16,this.inputCoverageOffsets=[...new Array(this.inputGlyphCount)].map((t=>e.Offset16)),this.lookaheadGlyphCount=e.uint16,this.lookaheadCoverageOffsets=[...new Array(this.lookaheadGlyphCount)].map((t=>e.Offset16)),this.seqLookupCount=e.uint16,this.seqLookupRecords=[...new Array(this.substitutionCount)].map((t=>new mh(e))))}getChainSubRuleSet(e){if(1!==this.substFormat)throw new Error(`lookup type 6.${this.substFormat} has no chainsubrule sets.`);let t=this.parser;return t.currentPosition=this.start+this.chainSubRuleSetOffsets[e],new dh(t)}getChainSubClassSet(e){if(2!==this.substFormat)throw new Error(`lookup type 6.${this.substFormat} has no chainsubclass sets.`);let t=this.parser;return t.currentPosition=this.start+this.chainSubClassSetOffsets[e],new ph(t)}getCoverageFromOffset(e){if(3!==this.substFormat)throw new Error(`lookup type 6.${this.substFormat} does not use contextual coverage offsets.`);let t=this.parser;return t.currentPosition=this.start+e,new Ed(t)}}class dh extends mu{constructor(e){super(e),this.chainSubRuleCount=e.uint16,this.chainSubRuleOffsets=[...new Array(this.chainSubRuleCount)].map((t=>e.Offset16))}getSubRule(e){let t=this.parser;return t.currentPosition=this.start+this.chainSubRuleOffsets[e],new hh(t)}}class hh{constructor(e){this.backtrackGlyphCount=e.uint16,this.backtrackSequence=[...new Array(this.backtrackGlyphCount)].map((t=>e.uint16)),this.inputGlyphCount=e.uint16,this.inputSequence=[...new Array(this.inputGlyphCount-1)].map((t=>e.uint16)),this.lookaheadGlyphCount=e.uint16,this.lookAheadSequence=[...new Array(this.lookAheadGlyphCount)].map((t=>e.uint16)),this.substitutionCount=e.uint16,this.substLookupRecords=[...new Array(this.SubstCount)].map((t=>new Xd(e)))}}class ph extends mu{constructor(e){super(e),this.chainSubClassRuleCount=e.uint16,this.chainSubClassRuleOffsets=[...new Array(this.chainSubClassRuleCount)].map((t=>e.Offset16))}getSubClass(e){let t=this.parser;return t.currentPosition=this.start+this.chainSubRuleOffsets[e],new fh(t)}}class fh{constructor(e){this.backtrackGlyphCount=e.uint16,this.backtrackSequence=[...new Array(this.backtrackGlyphCount)].map((t=>e.uint16)),this.inputGlyphCount=e.uint16,this.inputSequence=[...new Array(this.inputGlyphCount-1)].map((t=>e.uint16)),this.lookaheadGlyphCount=e.uint16,this.lookAheadSequence=[...new Array(this.lookAheadGlyphCount)].map((t=>e.uint16)),this.substitutionCount=e.uint16,this.substLookupRecords=[...new Array(this.substitutionCount)].map((t=>new mh(e)))}}class mh extends mu{constructor(e){super(e),this.sequenceIndex=e.uint16,this.lookupListIndex=e.uint16}}class gh extends mu{constructor(e){super(e),this.substFormat=e.uint16,this.extensionLookupType=e.uint16,this.extensionOffset=e.Offset32}}class vh extends Kd{constructor(e){super(e),this.backtrackGlyphCount=e.uint16,this.backtrackCoverageOffsets=[...new Array(this.backtrackGlyphCount)].map((t=>e.Offset16)),this.lookaheadGlyphCount=e.uint16,this.lookaheadCoverageOffsets=[new Array(this.lookaheadGlyphCount)].map((t=>e.Offset16)),this.glyphCount=e.uint16,this.substituteGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}var yh={buildSubtable:function(e,t){const n=new[void 0,Qd,Jd,eh,nh,rh,uh,gh,vh][e](t);return n.type=e,n}};class xh extends mu{constructor(e){super(e)}}class bh extends xh{constructor(e){super(e),console.log("lookup type 1")}}class wh extends xh{constructor(e){super(e),console.log("lookup type 2")}}class _h extends xh{constructor(e){super(e),console.log("lookup type 3")}}class jh extends xh{constructor(e){super(e),console.log("lookup type 4")}}class Sh extends xh{constructor(e){super(e),console.log("lookup type 5")}}class Ch extends xh{constructor(e){super(e),console.log("lookup type 6")}}class kh extends xh{constructor(e){super(e),console.log("lookup type 7")}}class Eh extends xh{constructor(e){super(e),console.log("lookup type 8")}}class Ph extends xh{constructor(e){super(e),console.log("lookup type 9")}}var Ih={buildSubtable:function(e,t){const n=new[void 0,bh,wh,_h,jh,Sh,Ch,kh,Eh,Ph][e](t);return n.type=e,n}};class Vh extends mu{static EMPTY={lookupCount:0,lookups:[]};constructor(e){super(e),this.lookupCount=e.uint16,this.lookups=[...new Array(this.lookupCount)].map((t=>e.Offset16))}}class Oh extends mu{constructor(e,t){super(e),this.ctType=t,this.lookupType=e.uint16,this.lookupFlag=e.uint16,this.subTableCount=e.uint16,this.subtableOffsets=[...new Array(this.subTableCount)].map((t=>e.Offset16)),this.markFilteringSet=e.uint16}get rightToLeft(){return!0&this.lookupFlag}get ignoreBaseGlyphs(){return!0&this.lookupFlag}get ignoreLigatures(){return!0&this.lookupFlag}get ignoreMarks(){return!0&this.lookupFlag}get useMarkFilteringSet(){return!0&this.lookupFlag}get markAttachmentType(){return!0&this.lookupFlag}getSubTable(e){const t="GSUB"===this.ctType?yh:Ih;return this.parser.currentPosition=this.start+this.subtableOffsets[e],t.buildSubtable(this.lookupType,this.parser)}}class Th extends gu{constructor(e,t,n){const{p:s,tableStart:i}=super(e,t,n);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.scriptListOffset=s.Offset16,this.featureListOffset=s.Offset16,this.lookupListOffset=s.Offset16,1===this.majorVersion&&1===this.minorVersion&&(this.featureVariationsOffset=s.Offset32);const r=!(this.scriptListOffset||this.featureListOffset||this.lookupListOffset);vu(this,"scriptList",(()=>r?Bd.EMPTY:(s.currentPosition=i+this.scriptListOffset,new Bd(s)))),vu(this,"featureList",(()=>r?Hd.EMPTY:(s.currentPosition=i+this.featureListOffset,new Hd(s)))),vu(this,"lookupList",(()=>r?Vh.EMPTY:(s.currentPosition=i+this.lookupListOffset,new Vh(s)))),this.featureVariationsOffset&&vu(this,"featureVariations",(()=>r?FeatureVariations.EMPTY:(s.currentPosition=i+this.featureVariationsOffset,new FeatureVariations(s))))}getSupportedScripts(){return this.scriptList.scriptRecords.map((e=>e.scriptTag))}getScriptTable(e){let t=this.scriptList.scriptRecords.find((t=>t.scriptTag===e));this.parser.currentPosition=this.scriptList.start+t.scriptOffset;let n=new Rd(this.parser);return n.scriptTag=e,n}ensureScriptTable(e){return"string"==typeof e?this.getScriptTable(e):e}getSupportedLangSys(e){const t=0!==(e=this.ensureScriptTable(e)).defaultLangSys,n=e.langSysRecords.map((e=>e.langSysTag));return t&&n.unshift("dflt"),n}getDefaultLangSysTable(e){let t=(e=this.ensureScriptTable(e)).defaultLangSys;if(0!==t){this.parser.currentPosition=e.start+t;let n=new zd(this.parser);return n.langSysTag="",n.defaultForScript=e.scriptTag,n}}getLangSysTable(e,t="dflt"){if("dflt"===t)return this.getDefaultLangSysTable(e);let n=(e=this.ensureScriptTable(e)).langSysRecords.find((e=>e.langSysTag===t));this.parser.currentPosition=e.start+n.langSysOffset;let s=new zd(this.parser);return s.langSysTag=t,s}getFeatures(e){return e.featureIndices.map((e=>this.getFeature(e)))}getFeature(e){let t;if(t=parseInt(e)==e?this.featureList.featureRecords[e]:this.featureList.featureRecords.find((t=>t.featureTag===e)),!t)return;this.parser.currentPosition=this.featureList.start+t.featureOffset;let n=new Wd(this.parser);return n.featureTag=t.featureTag,n}getLookups(e){return e.lookupListIndices.map((e=>this.getLookup(e)))}getLookup(e,t){let n=this.lookupList.lookups[e];return this.parser.currentPosition=this.lookupList.start+n,new Oh(this.parser,t)}}var Ah=Object.freeze({__proto__:null,GSUB:class extends Th{constructor(e,t){super(e,t,"GSUB")}getLookup(e){return super.getLookup(e,"GSUB")}}});var Nh=Object.freeze({__proto__:null,GPOS:class extends Th{constructor(e,t){super(e,t,"GPOS")}getLookup(e){return super.getLookup(e,"GPOS")}}});class Fh extends mu{constructor(e){super(e),this.numEntries=e.uint16,this.documentRecords=[...new Array(this.numEntries)].map((t=>new Mh(e)))}getDocument(e){let t=this.documentRecords[e];if(!t)return"";let n=this.start+t.svgDocOffset;return this.parser.currentPosition=n,this.parser.readBytes(t.svgDocLength)}getDocumentForGlyph(e){let t=this.documentRecords.findIndex((t=>t.startGlyphID<=e&&e<=t.endGlyphID));return-1===t?"":this.getDocument(t)}}class Mh{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.svgDocOffset=e.Offset32,this.svgDocLength=e.uint32}}var Bh=Object.freeze({__proto__:null,SVG:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.offsetToSVGDocumentList=n.Offset32,n.currentPosition=this.tableStart+this.offsetToSVGDocumentList,this.documentList=new Fh(n)}}});class Dh{constructor(e){this.tag=e.tag,this.minValue=e.fixed,this.defaultValue=e.fixed,this.maxValue=e.fixed,this.flags=e.flags(16),this.axisNameID=e.uint16}}class Rh{constructor(e,t,n){let s=e.currentPosition;this.subfamilyNameID=e.uint16,e.uint16,this.coordinates=[...new Array(t)].map((t=>e.fixed)),e.currentPosition-s<n&&(this.postScriptNameID=e.uint16)}}var Lh=Object.freeze({__proto__:null,fvar:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.axesArrayOffset=n.Offset16,n.uint16,this.axisCount=n.uint16,this.axisSize=n.uint16,this.instanceCount=n.uint16,this.instanceSize=n.uint16;const s=this.tableStart+this.axesArrayOffset;vu(this,"axes",(()=>(n.currentPosition=s,[...new Array(this.axisCount)].map((e=>new Dh(n))))));const i=s+this.axisCount*this.axisSize;vu(this,"instances",(()=>{let e=[];for(let t=0;t<this.instanceCount;t++)n.currentPosition=i+t*this.instanceSize,e.push(new Rh(n,this.axisCount,this.instanceSize));return e}))}getSupportedAxes(){return this.axes.map((e=>e.tag))}getAxis(e){return this.axes.find((t=>t.tag===e))}}});var zh=Object.freeze({__proto__:null,cvt:class extends gu{constructor(e,t){const{p:n}=super(e,t),s=e.length/2;vu(this,"items",(()=>[...new Array(s)].map((e=>n.fword))))}}});var Hh=Object.freeze({__proto__:null,fpgm:class extends gu{constructor(e,t){const{p:n}=super(e,t);vu(this,"instructions",(()=>[...new Array(e.length)].map((e=>n.uint8))))}}});class Gh{constructor(e){this.rangeMaxPPEM=e.uint16,this.rangeGaspBehavior=e.uint16}}var Wh=Object.freeze({__proto__:null,gasp:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numRanges=n.uint16;vu(this,"gaspRanges",(()=>[...new Array(this.numRanges)].map((e=>new Gh(n)))))}}});var Uh=Object.freeze({__proto__:null,glyf:class extends gu{constructor(e,t){super(e,t)}getGlyphData(e,t){return this.parser.currentPosition=this.tableStart+e,this.parser.readBytes(t)}}});var qh=Object.freeze({__proto__:null,loca:class extends gu{constructor(e,t,n){const{p:s}=super(e,t),i=n.maxp.numGlyphs+1;0===n.head.indexToLocFormat?(this.x2=!0,vu(this,"offsets",(()=>[...new Array(i)].map((e=>s.Offset16))))):vu(this,"offsets",(()=>[...new Array(i)].map((e=>s.Offset32))))}getGlyphDataOffsetAndLength(e){let t=this.offsets[e]*this.x2?2:1;return{offset:t,length:(this.offsets[e+1]*this.x2?2:1)-t}}}});var Zh=Object.freeze({__proto__:null,prep:class extends gu{constructor(e,t){const{p:n}=super(e,t);vu(this,"instructions",(()=>[...new Array(e.length)].map((e=>n.uint8))))}}});var Yh=Object.freeze({__proto__:null,CFF:class extends gu{constructor(e,t){const{p:n}=super(e,t);vu(this,"data",(()=>n.readBytes()))}}});var Kh=Object.freeze({__proto__:null,CFF2:class extends gu{constructor(e,t){const{p:n}=super(e,t);vu(this,"data",(()=>n.readBytes()))}}});class Xh{constructor(e){this.glyphIndex=e.uint16,this.vertOriginY=e.int16}}var Qh=Object.freeze({__proto__:null,VORG:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.defaultVertOriginY=n.int16,this.numVertOriginYMetrics=n.uint16,vu(this,"vertORiginYMetrics",(()=>[...new Array(this.numVertOriginYMetrics)].map((e=>new Xh(n)))))}}});class Jh{constructor(e){this.indexSubTableArrayOffset=e.Offset32,this.indexTablesSize=e.uint32,this.numberofIndexSubTables=e.uint32,this.colorRef=e.uint32,this.hori=new ep(e),this.vert=new ep(e),this.startGlyphIndex=e.uint16,this.endGlyphIndex=e.uint16,this.ppemX=e.uint8,this.ppemY=e.uint8,this.bitDepth=e.uint8,this.flags=e.int8}}class $h{constructor(e){this.hori=new ep(e),this.vert=new ep(e),this.ppemX=e.uint8,this.ppemY=e.uint8,this.substitutePpemX=e.uint8,this.substitutePpemY=e.uint8}}class ep{constructor(e){this.ascender=e.int8,this.descender=e.int8,this.widthMax=e.uint8,this.caretSlopeNumerator=e.int8,this.caretSlopeDenominator=e.int8,this.caretOffset=e.int8,this.minOriginSB=e.int8,this.minAdvanceSB=e.int8,this.maxBeforeBL=e.int8,this.minAfterBL=e.int8,this.pad1=e.int8,this.pad2=e.int8}}class tp extends gu{constructor(e,t,n){const{p:s}=super(e,t,n);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.numSizes=s.uint32,vu(this,"bitMapSizes",(()=>[...new Array(this.numSizes)].map((e=>new Jh(s)))))}}var np=Object.freeze({__proto__:null,EBLC:tp});class sp extends gu{constructor(e,t,n){const{p:s}=super(e,t,n);this.majorVersion=s.uint16,this.minorVersion=s.uint16}}var ip=Object.freeze({__proto__:null,EBDT:sp});var rp=Object.freeze({__proto__:null,EBSC:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.numSizes=n.uint32,vu(this,"bitmapScales",(()=>[...new Array(this.numSizes)].map((e=>new $h(n)))))}}});var ap=Object.freeze({__proto__:null,CBLC:class extends tp{constructor(e,t){super(e,t,"CBLC")}}});var op=Object.freeze({__proto__:null,CBDT:class extends sp{constructor(e,t){super(e,t,"CBDT")}}});var lp=Object.freeze({__proto__:null,sbix:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.flags=n.flags(16),this.numStrikes=n.uint32,vu(this,"strikeOffsets",(()=>[...new Array(this.numStrikes)].map((e=>n.Offset32))))}}});class cp{constructor(e){this.gID=e.uint16,this.firstLayerIndex=e.uint16,this.numLayers=e.uint16}}class up{constructor(e){this.gID=e.uint16,this.paletteIndex=e.uint16}}var dp=Object.freeze({__proto__:null,COLR:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numBaseGlyphRecords=n.uint16,this.baseGlyphRecordsOffset=n.Offset32,this.layerRecordsOffset=n.Offset32,this.numLayerRecords=n.uint16}getBaseGlyphRecord(e){let t=this.tableStart+this.baseGlyphRecordsOffset;this.parser.currentPosition=t;let n=new cp(this.parser),s=n.gID,i=this.tableStart+this.layerRecordsOffset-6;this.parser.currentPosition=i;let r=new cp(this.parser),a=r.gID;if(s===e)return n;if(a===e)return r;for(;t!==i;){let n=t+(i-t)/12;this.parser.currentPosition=n;let s=new cp(this.parser),r=s.gID;if(r===e)return s;r>e?i=n:r<e&&(t=n)}return!1}getLayers(e){let t=this.getBaseGlyphRecord(e);return this.parser.currentPosition=this.tableStart+this.layerRecordsOffset+4*t.firstLayerIndex,[...new Array(t.numLayers)].map((e=>new up(p)))}}});class hp{constructor(e){this.blue=e.uint8,this.green=e.uint8,this.red=e.uint8,this.alpha=e.uint8}}class pp{constructor(e,t){this.paletteTypes=[...new Array(t)].map((t=>e.uint32))}}class fp{constructor(e,t){this.paletteLabels=[...new Array(t)].map((t=>e.uint16))}}class mp{constructor(e,t){this.paletteEntryLabels=[...new Array(t)].map((t=>e.uint16))}}var gp=Object.freeze({__proto__:null,CPAL:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numPaletteEntries=n.uint16;const s=this.numPalettes=n.uint16;this.numColorRecords=n.uint16,this.offsetFirstColorRecord=n.Offset32,this.colorRecordIndices=[...new Array(this.numPalettes)].map((e=>n.uint16)),vu(this,"colorRecords",(()=>(n.currentPosition=this.tableStart+this.offsetFirstColorRecord,[...new Array(this.numColorRecords)].map((e=>new hp(n)))))),1===this.version&&(this.offsetPaletteTypeArray=n.Offset32,this.offsetPaletteLabelArray=n.Offset32,this.offsetPaletteEntryLabelArray=n.Offset32,vu(this,"paletteTypeArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteTypeArray,new pp(n,s)))),vu(this,"paletteLabelArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteLabelArray,new fp(n,s)))),vu(this,"paletteEntryLabelArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteEntryLabelArray,new mp(n,s)))))}}});class vp{constructor(e){this.format=e.uint32,this.length=e.uint32,this.offset=e.Offset32}}class yp{constructor(e){e.uint16,e.uint16,this.signatureLength=e.uint32,this.signature=e.readBytes(this.signatureLength)}}var xp=Object.freeze({__proto__:null,DSIG:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint32,this.numSignatures=n.uint16,this.flags=n.uint16,this.signatureRecords=[...new Array(this.numSignatures)].map((e=>new vp(n)))}getData(e){const t=this.signatureRecords[e];return this.parser.currentPosition=this.tableStart+t.offset,new yp(this.parser)}}});class bp{constructor(e,t){this.pixelSize=e.uint8,this.maxWidth=e.uint8,this.widths=e.readBytes(t)}}var wp=Object.freeze({__proto__:null,hdmx:class extends gu{constructor(e,t,n){const{p:s}=super(e,t),i=n.hmtx.numGlyphs;this.version=s.uint16,this.numRecords=s.int16,this.sizeDeviceRecord=s.int32,this.records=[...new Array(numRecords)].map((e=>new bp(s,i)))}}});class _p{constructor(e){this.version=e.uint16,this.length=e.uint16,this.coverage=e.flags(8),this.format=e.uint8,0===this.format&&(this.nPairs=e.uint16,this.searchRange=e.uint16,this.entrySelector=e.uint16,this.rangeShift=e.uint16,vu(this,"pairs",(()=>[...new Array(this.nPairs)].map((t=>new jp(e)))))),2===this.format&&console.warn("Kern subtable format 2 is not supported: this parser currently only parses universal table data.")}get horizontal(){return this.coverage[0]}get minimum(){return this.coverage[1]}get crossstream(){return this.coverage[2]}get override(){return this.coverage[3]}}class jp{constructor(e){this.left=e.uint16,this.right=e.uint16,this.value=e.fword}}var Sp=Object.freeze({__proto__:null,kern:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.nTables=n.uint16,vu(this,"tables",(()=>{let e=this.tableStart+4;const t=[];for(let s=0;s<this.nTables;s++){n.currentPosition=e;let s=new _p(n);t.push(s),e+=s}return t}))}}});var Cp=Object.freeze({__proto__:null,LTSH:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numGlyphs=n.uint16,this.yPels=n.readBytes(this.numGlyphs)}}});var kp=Object.freeze({__proto__:null,MERG:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.mergeClassCount=n.uint16,this.mergeDataOffset=n.Offset16,this.classDefCount=n.uint16,this.offsetToClassDefOffsets=n.Offset16,vu(this,"mergeEntryMatrix",(()=>[...new Array(this.mergeClassCount)].map((e=>n.readBytes(this.mergeClassCount))))),console.warn("Full MERG parsing is currently not supported."),console.warn("If you need this table parsed, please file an issue, or better yet, a PR.")}}});class Ep{constructor(e,t){this.tableStart=e,this.parser=t,this.tag=t.tag,this.dataOffset=t.Offset32,this.dataLength=t.uint32}getData(){return this.parser.currentField=this.tableStart+this.dataOffset,this.parser.readBytes(this.dataLength)}}var Pp=Object.freeze({__proto__:null,meta:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint32,this.flags=n.uint32,n.uint32,this.dataMapsCount=n.uint32,this.dataMaps=[...new Array(this.dataMapsCount)].map((e=>new Ep(this.tableStart,n)))}}});var Ip=Object.freeze({__proto__:null,PCLT:class extends gu{constructor(e,t){super(e,t),console.warn("This font uses a PCLT table, which is currently not supported by this parser."),console.warn("If you need this table parsed, please file an issue, or better yet, a PR.")}}});class Vp{constructor(e){this.bCharSet=e.uint8,this.xRatio=e.uint8,this.yStartRatio=e.uint8,this.yEndRatio=e.uint8}}class Op{constructor(e){this.recs=e.uint16,this.startsz=e.uint8,this.endsz=e.uint8,this.records=[...new Array(this.recs)].map((t=>new Tp(e)))}}class Tp{constructor(e){this.yPelHeight=e.uint16,this.yMax=e.int16,this.yMin=e.int16}}var Ap=Object.freeze({__proto__:null,VDMX:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numRecs=n.uint16,this.numRatios=n.uint16,this.ratRanges=[...new Array(this.numRatios)].map((e=>new Vp(n))),this.offsets=[...new Array(this.numRatios)].map((e=>n.Offset16)),this.VDMXGroups=[...new Array(this.numRecs)].map((e=>new Op(n)))}}});var Np=Object.freeze({__proto__:null,vhea:class extends gu{constructor(e,t){const{p:n}=super(e,t);this.version=n.fixed,this.ascent=this.vertTypoAscender=n.int16,this.descent=this.vertTypoDescender=n.int16,this.lineGap=this.vertTypoLineGap=n.int16,this.advanceHeightMax=n.int16,this.minTopSideBearing=n.int16,this.minBottomSideBearing=n.int16,this.yMaxExtent=n.int16,this.caretSlopeRise=n.int16,this.caretSlopeRun=n.int16,this.caretOffset=n.int16,this.reserved=n.int16,this.reserved=n.int16,this.reserved=n.int16,this.reserved=n.int16,this.metricDataFormat=n.int16,this.numOfLongVerMetrics=n.uint16,n.verifyLength()}}});class Fp{constructor(e,t){this.advanceHeight=e,this.topSideBearing=t}}var Mp=Object.freeze({__proto__:null,vmtx:class extends gu{constructor(e,t,n){super(e,t);const s=n.vhea.numOfLongVerMetrics,i=n.maxp.numGlyphs,r=p.currentPosition;if(lazy(this,"vMetrics",(()=>(p.currentPosition=r,[...new Array(s)].map((e=>new Fp(p.uint16,p.int16)))))),s<i){const e=r+4*s;lazy(this,"topSideBearings",(()=>(p.currentPosition=e,[...new Array(i-s)].map((e=>p.int16)))))}}}});const{kebabCase:Bp}=ne(b.privateApis);var Dp=function(){const{installFonts:e}=(0,h.useContext)(Gc),[t,n]=(0,h.useState)(!1),[s,i]=(0,h.useState)(!1),r=async e=>{i(null),n(!0);const t=new Set,s=[...e];let r=!1;const a=s.map((async e=>{const n=await async function(e){const t=new Ru("Uploaded Font");try{const n=await l(e);return await t.fromDataBuffer(n,"font"),!0}catch(e){return!1}}(e);if(!n)return r=!0,null;if(t.has(e.name))return null;const s=e.name.split(".").pop().toLowerCase();return Cc.includes(s)?(t.add(e.name),e):null})),c=(await Promise.all(a)).filter((e=>null!==e));if(c.length>0)o(c);else{const e=r?(0,w.__)("Sorry, you are not allowed to upload this file type."):(0,w.__)("No fonts found to install.");i({type:"error",message:e}),n(!1)}},o=async e=>{const t=await Promise.all(e.map((async e=>{const t=await c(e);return await Nc(t,t.file,"all"),t})));u(t)};async function l(e){return new Promise(((t,n)=>{const s=new window.FileReader;s.readAsArrayBuffer(e),s.onload=()=>t(s.result),s.onerror=n}))}const c=async e=>{const t=await l(e),n=new Ru("Uploaded Font");n.fromDataBuffer(t,e.name);const s=(await new Promise((e=>n.onload=e))).detail.font,{name:i}=s.opentype.tables,r=i.get(16)||i.get(1),a=i.get(2).toLowerCase().includes("italic"),o=s.opentype.tables["OS/2"].usWeightClass||"normal",c=!!s.opentype.tables.fvar&&s.opentype.tables.fvar.axes.find((({tag:e})=>"wght"===e));return{file:e,fontFamily:r,fontStyle:a?"italic":"normal",fontWeight:(c?`${c.minValue} ${c.maxValue}`:null)||o}},u=async t=>{const s=function(e){const t=e.reduce(((e,t)=>(e[t.fontFamily]||(e[t.fontFamily]={name:t.fontFamily,fontFamily:t.fontFamily,slug:Bp(t.fontFamily.toLowerCase()),fontFace:[]}),e[t.fontFamily].fontFace.push(t),e)),{});return Object.values(t)}(t);try{await e(s),i({type:"success",message:(0,w.__)("Fonts were installed successfully.")})}catch(e){i({type:"error",message:e.message,errors:e?.installationErrors})}n(!1)};return(0,a.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[(0,a.jsx)(b.DropZone,{onFilesDrop:e=>{r(e)}}),(0,a.jsxs)(b.__experimentalVStack,{className:"font-library-modal__local-fonts",children:[s&&(0,a.jsxs)(b.Notice,{status:s.type,__unstableHTML:!0,onRemove:()=>i(null),children:[s.message,s.errors&&(0,a.jsx)("ul",{children:s.errors.map(((e,t)=>(0,a.jsx)("li",{children:e},t)))})]}),t&&(0,a.jsx)(b.FlexItem,{children:(0,a.jsx)("div",{className:"font-library-modal__upload-area",children:(0,a.jsx)(b.ProgressBar,{})})}),!t&&(0,a.jsx)(b.FormFileUpload,{accept:Cc.map((e=>`.${e}`)).join(","),multiple:!0,onChange:e=>{r(e.target.files)},render:({openFileDialog:e})=>(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,className:"font-library-modal__upload-area",onClick:e,children:(0,w.__)("Upload font")})}),(0,a.jsx)(b.__experimentalSpacer,{margin:2}),(0,a.jsx)(b.__experimentalText,{className:"font-library-modal__upload-area__text",children:(0,w.__)("Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2.")})]})]})};const{Tabs:Rp}=ne(b.privateApis),Lp={id:"installed-fonts",title:(0,w._x)("Library","Font library")},zp={id:"upload-fonts",title:(0,w._x)("Upload","noun")};var Hp=function({onRequestClose:e,defaultTabId:t="installed-fonts"}){const{collections:n}=(0,h.useContext)(Gc),s=(0,c.useSelect)((e=>e(j.store).canUser("create",{kind:"postType",name:"wp_font_family"})),[]),i=[Lp];return s&&(i.push(zp),i.push(...(e=>e.map((({slug:t,name:n})=>({id:t,title:1===e.length&&"google-fonts"===t?(0,w.__)("Install Fonts"):n}))))(n||[]))),(0,a.jsx)(b.Modal,{title:(0,w.__)("Fonts"),onRequestClose:e,isFullScreen:!0,className:"font-library-modal",children:(0,a.jsxs)(Rp,{defaultTabId:t,children:[(0,a.jsx)("div",{className:"font-library-modal__tablist-container",children:(0,a.jsx)(Rp.TabList,{children:i.map((({id:e,title:t})=>(0,a.jsx)(Rp.Tab,{tabId:e,children:t},e)))})}),i.map((({id:e})=>{let t;switch(e){case"upload-fonts":t=(0,a.jsx)(Dp,{});break;case"installed-fonts":t=(0,a.jsx)(Jc,{});break;default:t=(0,a.jsx)(au,{slug:e})}return(0,a.jsx)(Rp.TabPanel,{tabId:e,focusable:!1,children:t},e)}))]})})};var Gp=function({font:e}){const{handleSetLibraryFontSelected:t,setModalTabOpen:n}=(0,h.useContext)(Gc),s=e?.fontFace?.length||1,i=Qo(e);return(0,a.jsx)(b.__experimentalItem,{onClick:()=>{t(e),n("installed-fonts")},children:(0,a.jsxs)(b.__experimentalHStack,{justify:"space-between",children:[(0,a.jsx)(b.FlexItem,{style:i,children:e.name}),(0,a.jsx)(b.FlexItem,{className:"edit-site-global-styles-screen-typography__font-variants-count",children:(0,w.sprintf)((0,w._n)("%d variant","%d variants",s),s)})]})})};const{useGlobalSetting:Wp}=ne(x.privateApis);function Up(e,t){return e?e.map((e=>Vc(e,{source:t}))):[]}function qp(){const{baseCustomFonts:e,modalTabOpen:t,setModalTabOpen:n}=(0,h.useContext)(Gc),[s]=Wp("typography.fontFamilies"),[i]=Wp("typography.fontFamilies",void 0,"base"),r=[...Up(s?.theme,"theme"),...Up(s?.custom,"custom")].sort(((e,t)=>e.name.localeCompare(t.name))),o=0<r.length,l=o||i?.theme?.length>0||e?.length>0;return(0,a.jsxs)(a.Fragment,{children:[!!t&&(0,a.jsx)(Hp,{onRequestClose:()=>n(null),defaultTabId:t}),(0,a.jsxs)(b.__experimentalVStack,{spacing:2,children:[(0,a.jsxs)(b.__experimentalHStack,{justify:"space-between",children:[(0,a.jsx)(Ol,{level:3,children:(0,w.__)("Fonts")}),(0,a.jsx)(b.Button,{onClick:()=>n("installed-fonts"),label:(0,w.__)("Manage fonts"),icon:yc,size:"small"})]}),r.length>0&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(b.__experimentalItemGroup,{size:"large",isBordered:!0,isSeparated:!0,children:r.map((e=>(0,a.jsx)(Gp,{font:e},e.slug)))})}),!o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.__experimentalText,{as:"p",children:l?(0,w.__)("No fonts activated."):(0,w.__)("No fonts installed.")}),(0,a.jsx)(b.Button,{className:"edit-site-global-styles-font-families__manage-fonts",variant:"secondary",__next40pxDefaultSize:!0,onClick:()=>{n(l?"installed-fonts":"upload-fonts")},children:l?(0,w.__)("Manage fonts"):(0,w.__)("Add fonts")})]})]})]})}var Zp=({...e})=>(0,a.jsx)(Wc,{children:(0,a.jsx)(qp,{...e})});var Yp=function(){const e=(0,c.useSelect)((e=>e(f.store).getEditorSettings().fontLibraryEnabled),[]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(xl,{title:(0,w.__)("Typography"),description:(0,w.__)("Available fonts, typographic styles, and the application of those styles.")}),(0,a.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,a.jsxs)(b.__experimentalVStack,{spacing:7,children:[(0,a.jsx)(gc,{title:(0,w.__)("Typesets")}),e&&(0,a.jsx)(Zp,{}),(0,a.jsx)(tc,{}),(0,a.jsx)(vc,{})]})})]})};const{useGlobalStyle:Kp,useGlobalSetting:Xp,useSettingsForBlockElement:Qp,TypographyPanel:Jp}=ne(x.privateApis);function $p({element:e,headingLevel:t}){let n=[];"heading"===e?n=n.concat(["elements",t]):e&&"text"!==e&&(n=n.concat(["elements",e]));const s=n.join("."),[i]=Kp(s,void 0,"user",{shouldDecodeEncode:!1}),[r,o]=Kp(s,void 0,"all",{shouldDecodeEncode:!1}),[l]=Xp(""),c=Qp(l,void 0,"heading"===e?t:e);return(0,a.jsx)(Jp,{inheritedValue:r,value:i,onChange:o,settings:c})}const{useGlobalStyle:ef}=ne(x.privateApis);function tf({name:e,element:t,headingLevel:n}){let s="";"heading"===t?s=`elements.${n}.`:t&&"text"!==t&&(s=`elements.${t}.`);const[i]=ef(s+"typography.fontFamily",e),[r]=ef(s+"color.gradient",e),[o]=ef(s+"color.background",e),[l]=ef("color.background"),[c]=ef(s+"color.text",e),[u]=ef(s+"typography.fontSize",e),[d]=ef(s+"typography.fontStyle",e),[h]=ef(s+"typography.fontWeight",e),[p]=ef(s+"typography.letterSpacing",e),f="link"===t?{textDecoration:"underline"}:{};return(0,a.jsx)("div",{className:"edit-site-typography-preview",style:{fontFamily:i??"serif",background:r??o??l,color:c,fontSize:u,fontStyle:d,fontWeight:h,letterSpacing:p,...f},children:"Aa"})}const nf={text:{description:(0,w.__)("Manage the fonts used on the site."),title:(0,w.__)("Text")},link:{description:(0,w.__)("Manage the fonts and typography used on the links."),title:(0,w.__)("Links")},heading:{description:(0,w.__)("Manage the fonts and typography used on headings."),title:(0,w.__)("Headings")},caption:{description:(0,w.__)("Manage the fonts and typography used on captions."),title:(0,w.__)("Captions")},button:{description:(0,w.__)("Manage the fonts and typography used on buttons."),title:(0,w.__)("Buttons")}};var sf=function({element:e}){const[t,n]=(0,h.useState)("heading");return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(xl,{title:nf[e].title,description:nf[e].description}),(0,a.jsx)(b.__experimentalSpacer,{marginX:4,children:(0,a.jsx)(tf,{element:e,headingLevel:t})}),"heading"===e&&(0,a.jsx)(b.__experimentalSpacer,{marginX:4,marginBottom:"1em",children:(0,a.jsxs)(b.__experimentalToggleGroupControl,{label:(0,w.__)("Select heading level"),hideLabelFromVision:!0,value:t,onChange:n,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0,children:[(0,a.jsx)(b.__experimentalToggleGroupControlOption,{value:"heading",showTooltip:!0,"aria-label":(0,w.__)("All headings"),label:(0,w._x)("All","heading levels")}),(0,a.jsx)(b.__experimentalToggleGroupControlOption,{value:"h1",showTooltip:!0,"aria-label":(0,w.__)("Heading 1"),label:(0,w.__)("H1")}),(0,a.jsx)(b.__experimentalToggleGroupControlOption,{value:"h2",showTooltip:!0,"aria-label":(0,w.__)("Heading 2"),label:(0,w.__)("H2")}),(0,a.jsx)(b.__experimentalToggleGroupControlOption,{value:"h3",showTooltip:!0,"aria-label":(0,w.__)("Heading 3"),label:(0,w.__)("H3")}),(0,a.jsx)(b.__experimentalToggleGroupControlOption,{value:"h4",showTooltip:!0,"aria-label":(0,w.__)("Heading 4"),label:(0,w.__)("H4")}),(0,a.jsx)(b.__experimentalToggleGroupControlOption,{value:"h5",showTooltip:!0,"aria-label":(0,w.__)("Heading 5"),label:(0,w.__)("H5")}),(0,a.jsx)(b.__experimentalToggleGroupControlOption,{value:"h6",showTooltip:!0,"aria-label":(0,w.__)("Heading 6"),label:(0,w.__)("H6")})]})}),(0,a.jsx)($p,{element:e,headingLevel:t})]})};const{useGlobalStyle:rf}=ne(x.privateApis);var af=function({fontSize:e}){const[t]=rf("typography"),n=e?.fluid?.min&&e?.fluid?.max?{minimumFontSize:e.fluid.min,maximumFontSize:e.fluid.max}:{fontSize:e.size},s=(0,x.getComputedFluidTypographyValue)(n);return(0,a.jsx)("div",{className:"edit-site-typography-preview",style:{fontSize:s,fontFamily:t?.fontFamily??"serif"},children:(0,w.__)("Aa")})};var of=function({fontSize:e,isOpen:t,toggleOpen:n,handleRemoveFontSize:s}){return(0,a.jsx)(b.__experimentalConfirmDialog,{isOpen:t,cancelButtonText:(0,w.__)("Cancel"),confirmButtonText:(0,w.__)("Delete"),onCancel:()=>{n()},onConfirm:async()=>{n(),s(e)},size:"medium",children:e&&(0,w.sprintf)((0,w.__)('Are you sure you want to delete "%s" font size preset?'),e.name)})};var lf=function({fontSize:e,toggleOpen:t,handleRename:n}){const[s,i]=(0,h.useState)(e.name);return(0,a.jsx)(b.Modal,{onRequestClose:t,focusOnMount:"firstContentElement",title:(0,w.__)("Rename"),size:"small",children:(0,a.jsx)("form",{onSubmit:e=>{e.preventDefault(),s.trim()&&n(s),t(),t()},children:(0,a.jsxs)(b.__experimentalVStack,{spacing:"3",children:[(0,a.jsx)(b.__experimentalInputControl,{__next40pxDefaultSize:!0,autoComplete:"off",value:s,onChange:i,label:(0,w.__)("Name"),placeholder:(0,w.__)("Font size preset name")}),(0,a.jsxs)(b.__experimentalHStack,{justify:"right",children:[(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,children:(0,w.__)("Cancel")}),(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",children:(0,w.__)("Save")})]})]})})})};const cf=["px","em","rem","vw","vh"];var uf=function({__nextHasNoMarginBottom:e,...t}){const{baseControlProps:n}=(0,b.useBaseControlProps)(t),{value:s,onChange:i,fallbackValue:r,disabled:o,label:l}=t,c=(0,b.__experimentalUseCustomUnits)({availableUnits:cf}),[u,d="px"]=(0,b.__experimentalParseQuantityAndUnitFromRawValue)(s,c),h=!!d&&["em","rem","vw","vh"].includes(d);return(0,a.jsx)(b.BaseControl,{...n,__nextHasNoMarginBottom:!0,children:(0,a.jsxs)(b.Flex,{children:[(0,a.jsx)(b.FlexItem,{isBlock:!0,children:(0,a.jsx)(b.__experimentalUnitControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:l,hideLabelFromVision:!0,value:s,onChange:e=>{i(e)},units:c,min:0,disabled:o})}),(0,a.jsx)(b.FlexItem,{isBlock:!0,children:(0,a.jsx)(b.__experimentalSpacer,{marginX:2,marginBottom:0,children:(0,a.jsx)(b.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:l,hideLabelFromVision:!0,value:u,initialPosition:r,withInputField:!1,onChange:e=>{i?.(e+d)},min:0,max:h?10:100,step:h?.1:1,disabled:o})})})]})})};const{Menu:df}=ne(b.privateApis),{useGlobalSetting:hf}=ne(x.privateApis);var pf=function(){const[e,t]=(0,h.useState)(!1),[n,s]=(0,h.useState)(!1),{params:{origin:i,slug:r},goBack:o}=(0,b.useNavigator)(),[l,c]=hf("typography.fontSizes"),[u]=hf("typography.fluid"),d=l[i]??[],p=d.find((e=>e.slug===r));if((0,h.useEffect)((()=>{r&&!p&&o()}),[r,p,o]),!i||!r||!p)return null;const f=void 0!==p?.fluid?!!p.fluid:!!u,m="object"==typeof p?.fluid,g=(e,t)=>{const n=d.map((n=>n.slug===r?{...n,[e]:t}:n));c({...l,[i]:n})},v=()=>{t(!e)},y=()=>{s(!n)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(of,{fontSize:p,isOpen:e,toggleOpen:v,handleRemoveFontSize:()=>{const e=d.filter((e=>e.slug!==r));c({...l,[i]:e})}}),n&&(0,a.jsx)(lf,{fontSize:p,toggleOpen:y,handleRename:e=>{g("name",e)}}),(0,a.jsxs)(b.__experimentalVStack,{spacing:4,children:[(0,a.jsxs)(b.__experimentalHStack,{justify:"space-between",align:"flex-start",children:[(0,a.jsx)(xl,{title:p.name,description:(0,w.sprintf)((0,w.__)("Manage the font size %s."),p.name)}),"custom"===i&&(0,a.jsx)(b.FlexItem,{children:(0,a.jsx)(b.__experimentalSpacer,{marginTop:3,marginBottom:0,paddingX:4,children:(0,a.jsxs)(df,{children:[(0,a.jsx)(df.TriggerButton,{render:(0,a.jsx)(b.Button,{size:"small",icon:No,label:(0,w.__)("Font size options")})}),(0,a.jsxs)(df.Popover,{children:[(0,a.jsx)(df.Item,{onClick:y,children:(0,a.jsx)(df.ItemLabel,{children:(0,w.__)("Rename")})}),(0,a.jsx)(df.Item,{onClick:v,children:(0,a.jsx)(df.ItemLabel,{children:(0,w.__)("Delete")})})]})]})})})]}),(0,a.jsx)(b.__experimentalView,{children:(0,a.jsx)(b.__experimentalSpacer,{paddingX:4,marginBottom:0,paddingBottom:6,children:(0,a.jsxs)(b.__experimentalVStack,{spacing:4,children:[(0,a.jsx)(b.FlexItem,{children:(0,a.jsx)(af,{fontSize:p})}),(0,a.jsx)(uf,{label:(0,w.__)("Size"),value:m?"":p.size,onChange:e=>{g("size",e)},disabled:m}),(0,a.jsx)(b.ToggleControl,{label:(0,w.__)("Fluid typography"),help:(0,w.__)("Scale the font size dynamically to fit the screen or viewport."),checked:f,onChange:e=>{g("fluid",e)},__nextHasNoMarginBottom:!0}),f&&(0,a.jsx)(b.ToggleControl,{label:(0,w.__)("Custom fluid values"),help:(0,w.__)("Set custom min and max values for the fluid font size."),checked:m,onChange:e=>{g("fluid",!e||{min:p.size,max:p.size})},__nextHasNoMarginBottom:!0}),m&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(uf,{label:(0,w.__)("Minimum"),value:p.fluid?.min,onChange:e=>{g("fluid",{...p.fluid,min:e})}}),(0,a.jsx)(uf,{label:(0,w.__)("Maximum"),value:p.fluid?.max,onChange:e=>{g("fluid",{...p.fluid,max:e})}})]})]})})})]})]})},ff=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})});var mf=function({text:e,confirmButtonText:t,isOpen:n,toggleOpen:s,onConfirm:i}){return(0,a.jsx)(b.__experimentalConfirmDialog,{isOpen:n,cancelButtonText:(0,w.__)("Cancel"),confirmButtonText:t,onCancel:()=>{s()},onConfirm:async()=>{s(),i()},size:"medium",children:e})};const{Menu:gf}=ne(b.privateApis),{useGlobalSetting:vf}=ne(x.privateApis);function yf({label:e,origin:t,sizes:n,handleAddFontSize:s,handleResetFontSizes:i}){const[r,o]=(0,h.useState)(!1),l=()=>o(!r),c="custom"===t?(0,w.__)("Are you sure you want to remove all custom font size presets?"):(0,w.__)("Are you sure you want to reset all font size presets to their default values?");return(0,a.jsxs)(a.Fragment,{children:[r&&(0,a.jsx)(mf,{text:c,confirmButtonText:"custom"===t?(0,w.__)("Remove"):(0,w.__)("Reset"),isOpen:r,toggleOpen:l,onConfirm:i}),(0,a.jsxs)(b.__experimentalVStack,{spacing:4,children:[(0,a.jsxs)(b.__experimentalHStack,{children:[(0,a.jsx)(Ol,{level:3,children:e}),(0,a.jsxs)(b.FlexItem,{className:"edit-site-global-styles__typography-panel__options-container",children:["custom"===t&&(0,a.jsx)(b.Button,{label:(0,w.__)("Add font size"),icon:ff,size:"small",onClick:s}),!!i&&(0,a.jsxs)(gf,{children:[(0,a.jsx)(gf.TriggerButton,{render:(0,a.jsx)(b.Button,{size:"small",icon:No,label:(0,w.__)("Font size presets options")})}),(0,a.jsx)(gf.Popover,{children:(0,a.jsx)(gf.Item,{onClick:l,children:(0,a.jsx)(gf.ItemLabel,{children:"custom"===t?(0,w.__)("Remove font size presets"):(0,w.__)("Reset font size presets")})})})]})]})]}),!!n.length&&(0,a.jsx)(b.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:n.map((e=>(0,a.jsx)(Bo,{path:`/typography/font-sizes/${t}/${e.slug}`,children:(0,a.jsxs)(b.__experimentalHStack,{children:[(0,a.jsx)(b.FlexItem,{className:"edit-site-font-size__item",children:e.name}),(0,a.jsx)(b.FlexItem,{display:"flex",children:(0,a.jsx)(qa,{icon:(0,w.isRTL)()?za:La})})]})},e.slug)))})]})]})}var xf=function(){const[e,t]=vf("typography.fontSizes.theme"),[n]=vf("typography.fontSizes.theme",null,"base"),[s,i]=vf("typography.fontSizes.default"),[r]=vf("typography.fontSizes.default",null,"base"),[o=[],l]=vf("typography.fontSizes.custom"),[c]=vf("typography.defaultFontSizes"),u=()=>{const e=$o(o,"custom-"),t={name:(0,w.sprintf)((0,w.__)("New Font Size %d"),e),size:"16px",slug:`custom-${e}`};l([...o,t])},d=(e,t)=>e.map((e=>e.size)).join("")===t.map((e=>e.size)).join("");return(0,a.jsxs)(b.__experimentalVStack,{spacing:2,children:[(0,a.jsx)(xl,{title:(0,w.__)("Font size presets"),description:(0,w.__)("Create and edit the presets used for font sizes across the site.")}),(0,a.jsx)(b.__experimentalView,{children:(0,a.jsx)(b.__experimentalSpacer,{paddingX:4,children:(0,a.jsxs)(b.__experimentalVStack,{spacing:8,children:[!!e?.length&&(0,a.jsx)(yf,{label:(0,w.__)("Theme"),origin:"theme",sizes:e,baseSizes:n,handleAddFontSize:u,handleResetFontSizes:d(e,n)?null:()=>t(n)}),c&&!!s?.length&&(0,a.jsx)(yf,{label:(0,w.__)("Default"),origin:"default",sizes:s,baseSizes:r,handleAddFontSize:u,handleResetFontSizes:d(s,r)?null:()=>i(r)}),(0,a.jsx)(yf,{label:(0,w.__)("Custom"),origin:"custom",sizes:o,handleAddFontSize:u,handleResetFontSizes:o.length>0?()=>l([]):null})]})})})]})};var bf=function({className:e,...t}){return(0,a.jsx)(b.Flex,{className:Ht("edit-site-global-styles__color-indicator-wrapper",e),...t})};const{useGlobalSetting:wf}=ne(x.privateApis),_f=[];var jf=function({name:e}){const[t]=wf("color.palette.custom"),[n]=wf("color.palette.theme"),[s]=wf("color.palette.default"),[i]=wf("color.defaultPalette",e),r=(0,h.useMemo)((()=>[...t||_f,...n||_f,...s&&i?s:_f]),[t,n,s,i]),o=e?"/blocks/"+encodeURIComponent(e)+"/colors/palette":"/colors/palette";return(0,a.jsxs)(b.__experimentalVStack,{spacing:3,children:[(0,a.jsx)(Ol,{level:3,children:(0,w.__)("Palette")}),(0,a.jsx)(b.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:(0,a.jsx)(Bo,{path:o,children:(0,a.jsxs)(b.__experimentalHStack,{direction:"row",children:[r.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.__experimentalZStack,{isLayered:!1,offset:-8,children:r.slice(0,5).map((({color:e},t)=>(0,a.jsx)(bf,{children:(0,a.jsx)(b.ColorIndicator,{colorValue:e})},`${e}-${t}`)))}),(0,a.jsx)(b.FlexItem,{isBlock:!0,children:(0,w.__)("Edit palette")})]}):(0,a.jsx)(b.FlexItem,{children:(0,w.__)("Add colors")}),(0,a.jsx)(qa,{icon:(0,w.isRTL)()?za:La})]})})})]})};const{useGlobalStyle:Sf,useGlobalSetting:Cf,useSettingsForBlockElement:kf,ColorPanel:Ef}=ne(x.privateApis);var Pf=function(){const[e]=Sf("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=Sf("",void 0,"all",{shouldDecodeEncode:!1}),[s]=Cf(""),i=kf(s);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(xl,{title:(0,w.__)("Colors"),description:(0,w.__)("Palette colors and the application of those colors on site elements.")}),(0,a.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,a.jsxs)(b.__experimentalVStack,{spacing:7,children:[(0,a.jsx)(jf,{}),(0,a.jsx)(Ef,{inheritedValue:t,value:e,onChange:n,settings:i})]})})]})},If=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/SVG",children:(0,a.jsx)(Zt.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"})});function Vf(){const{paletteColors:e}=re();return e.slice(0,4).map((({slug:e,color:t},n)=>(0,a.jsx)("div",{style:{flexGrow:1,height:"100%",background:t}},`${e}-${n}`)))}const Of={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}};var Tf=({label:e,isFocused:t,withHoverView:n})=>(0,a.jsx)(ll,{label:e,isFocused:t,withHoverView:n,children:({key:e})=>(0,a.jsx)(b.__unstableMotion.div,{variants:Of,style:{height:"100%",overflow:"hidden"},children:(0,a.jsx)(b.__experimentalHStack,{spacing:0,justify:"center",style:{height:"100%",overflow:"hidden"},children:(0,a.jsx)(Vf,{})})},e)});function Af({title:e,gap:t=2}){const n=["color"],s=cc(n);return s?.length<=1?null:(0,a.jsxs)(b.__experimentalVStack,{spacing:3,children:[e&&(0,a.jsx)(Ol,{level:3,children:e}),(0,a.jsx)(b.__experimentalGrid,{spacing:t,children:s.map(((e,t)=>(0,a.jsx)(mc,{variation:e,isPill:!0,properties:n,showTooltip:!0,children:()=>(0,a.jsx)(Tf,{})},t)))})]})}const{useGlobalSetting:Nf}=ne(x.privateApis),Ff={placement:"bottom-start",offset:8};function Mf({name:e}){const[t,n]=Nf("color.palette.theme",e),[s]=Nf("color.palette.theme",e,"base"),[i,r]=Nf("color.palette.default",e),[o]=Nf("color.palette.default",e,"base"),[l,c]=Nf("color.palette.custom",e),[u]=Nf("color.defaultPalette",e),d=(0,y.useViewportMatch)("small","<")?Ff:void 0,[h]=function(e){const[t,n]=se("color.palette.theme",e);return window.__experimentalEnableColorRandomizer?[function(){const e=Math.floor(225*Math.random()),s=t.map((t=>{const{color:n}=t,s=X(n).rotate(e).toHex();return{...t,color:s}}));n(s)}]:[]}();return(0,a.jsxs)(b.__experimentalVStack,{className:"edit-site-global-styles-color-palette-panel",spacing:8,children:[(0,a.jsxs)(b.__experimentalVStack,{spacing:4,children:[!!t&&!!t.length&&(0,a.jsx)(b.__experimentalPaletteEdit,{canReset:t!==s,canOnlyChangeValues:!0,colors:t,onChange:n,paletteLabel:(0,w.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:d}),window.__experimentalEnableColorRandomizer&&t?.length>0&&(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"secondary",icon:If,onClick:h,children:(0,w.__)("Randomize colors")})]}),!!i&&!!i.length&&!!u&&(0,a.jsx)(b.__experimentalPaletteEdit,{canReset:i!==o,canOnlyChangeValues:!0,colors:i,onChange:r,paletteLabel:(0,w.__)("Default"),paletteLabelHeadingLevel:3,popoverProps:d}),(0,a.jsx)(b.__experimentalPaletteEdit,{colors:l,onChange:c,paletteLabel:(0,w.__)("Custom"),paletteLabelHeadingLevel:3,slugPrefix:"custom-",popoverProps:d}),(0,a.jsx)(Af,{title:(0,w.__)("Palettes")})]})}const{useGlobalSetting:Bf}=ne(x.privateApis),Df={placement:"bottom-start",offset:8},Rf=()=>{};function Lf({name:e}){const[t,n]=Bf("color.gradients.theme",e),[s]=Bf("color.gradients.theme",e,"base"),[i,r]=Bf("color.gradients.default",e),[o]=Bf("color.gradients.default",e,"base"),[l,c]=Bf("color.gradients.custom",e),[u]=Bf("color.defaultGradients",e),[d]=Bf("color.duotone.custom")||[],[h]=Bf("color.duotone.default")||[],[p]=Bf("color.duotone.theme")||[],[f]=Bf("color.defaultDuotone"),m=[...d||[],...p||[],...h&&f?h:[]],g=(0,y.useViewportMatch)("small","<")?Df:void 0;return(0,a.jsxs)(b.__experimentalVStack,{className:"edit-site-global-styles-gradient-palette-panel",spacing:8,children:[!!t&&!!t.length&&(0,a.jsx)(b.__experimentalPaletteEdit,{canReset:t!==s,canOnlyChangeValues:!0,gradients:t,onChange:n,paletteLabel:(0,w.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:g}),!!i&&!!i.length&&!!u&&(0,a.jsx)(b.__experimentalPaletteEdit,{canReset:i!==o,canOnlyChangeValues:!0,gradients:i,onChange:r,paletteLabel:(0,w.__)("Default"),paletteLabelLevel:3,popoverProps:g}),(0,a.jsx)(b.__experimentalPaletteEdit,{gradients:l,onChange:c,paletteLabel:(0,w.__)("Custom"),paletteLabelLevel:3,slugPrefix:"custom-",popoverProps:g}),!!m&&!!m.length&&(0,a.jsxs)("div",{children:[(0,a.jsx)(Ol,{level:3,children:(0,w.__)("Duotone")}),(0,a.jsx)(b.__experimentalSpacer,{margin:3}),(0,a.jsx)(b.DuotonePicker,{duotonePalette:m,disableCustomDuotone:!0,disableCustomColors:!0,clearable:!1,onChange:Rf})]})]})}const{Tabs:zf}=ne(b.privateApis);var Hf=function({name:e}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(xl,{title:(0,w.__)("Edit palette"),description:(0,w.__)("The combination of colors used across the site and in color pickers.")}),(0,a.jsxs)(zf,{children:[(0,a.jsxs)(zf.TabList,{children:[(0,a.jsx)(zf.Tab,{tabId:"color",children:(0,w.__)("Color")}),(0,a.jsx)(zf.Tab,{tabId:"gradient",children:(0,w.__)("Gradient")})]}),(0,a.jsx)(zf.TabPanel,{tabId:"color",focusable:!1,children:(0,a.jsx)(Mf,{name:e})}),(0,a.jsx)(zf.TabPanel,{tabId:"gradient",focusable:!1,children:(0,a.jsx)(Lf,{name:e})})]})]})};const Gf={backgroundSize:"auto"},{useGlobalStyle:Wf,useGlobalSetting:Uf,BackgroundPanel:qf}=ne(x.privateApis);function Zf(){const[e]=Wf("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=Wf("",void 0,"all",{shouldDecodeEncode:!1}),[s]=Uf("");return(0,a.jsx)(qf,{inheritedValue:t,value:e,onChange:n,settings:s,defaultValues:Gf})}const{useHasBackgroundPanel:Yf,useGlobalSetting:Kf}=ne(x.privateApis);var Xf=function(){const[e]=Kf(""),t=Yf(e);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(xl,{title:(0,w.__)("Background"),description:(0,a.jsx)(b.__experimentalText,{children:(0,w.__)("Set styles for the site’s background.")})}),t&&(0,a.jsx)(Zf,{})]})};var Qf=function({text:e,confirmButtonText:t,isOpen:n,toggleOpen:s,onConfirm:i}){return(0,a.jsx)(b.__experimentalConfirmDialog,{isOpen:n,cancelButtonText:(0,w.__)("Cancel"),confirmButtonText:t,onCancel:()=>{s()},onConfirm:async()=>{s(),i()},size:"medium",children:e})};const{useGlobalSetting:Jf}=ne(x.privateApis),{Menu:$f}=ne(b.privateApis),em="6px 6px 9px rgba(0, 0, 0, 0.2)";function tm(){const[e]=Jf("shadow.presets.default"),[t]=Jf("shadow.defaultPresets"),[n]=Jf("shadow.presets.theme"),[s,i]=Jf("shadow.presets.custom"),[r,o]=(0,h.useState)(!1),l=()=>o(!r);return(0,a.jsxs)(a.Fragment,{children:[r&&(0,a.jsx)(Qf,{text:(0,w.__)("Are you sure you want to remove all custom shadows?"),confirmButtonText:(0,w.__)("Remove"),isOpen:r,toggleOpen:l,onConfirm:()=>{i([])}}),(0,a.jsx)(xl,{title:(0,w.__)("Shadows"),description:(0,w.__)("Manage and create shadow styles for use across the site.")}),(0,a.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,a.jsxs)(b.__experimentalVStack,{className:"edit-site-global-styles__shadows-panel",spacing:7,children:[t&&(0,a.jsx)(nm,{label:(0,w.__)("Default"),shadows:e||[],category:"default"}),n&&n.length>0&&(0,a.jsx)(nm,{label:(0,w.__)("Theme"),shadows:n||[],category:"theme"}),(0,a.jsx)(nm,{label:(0,w.__)("Custom"),shadows:s||[],category:"custom",canCreate:!0,onCreate:e=>{i([...s||[],e])},onReset:l})]})})]})}function nm({label:e,shadows:t,category:n,canCreate:s,onCreate:i,onReset:r}){return(0,a.jsxs)(b.__experimentalVStack,{spacing:2,children:[(0,a.jsxs)(b.__experimentalHStack,{justify:"space-between",children:[(0,a.jsx)(Ol,{level:3,children:e}),(0,a.jsxs)(b.FlexItem,{className:"edit-site-global-styles__shadows-panel__options-container",children:[s&&(0,a.jsx)(b.Button,{size:"small",icon:ff,label:(0,w.__)("Add shadow"),onClick:()=>{(()=>{const e=$o(t,"shadow-");i({name:(0,w.sprintf)((0,w.__)("Shadow %s"),e),shadow:em,slug:`shadow-${e}`})})()}}),!!t?.length&&"custom"===n&&(0,a.jsxs)($f,{children:[(0,a.jsx)($f.TriggerButton,{render:(0,a.jsx)(b.Button,{size:"small",icon:No,label:(0,w.__)("Shadow options")})}),(0,a.jsx)($f.Popover,{children:(0,a.jsx)($f.Item,{onClick:r,children:(0,a.jsx)($f.ItemLabel,{children:(0,w.__)("Remove all custom shadows")})})})]})]})]}),t.length>0&&(0,a.jsx)(b.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:t.map((e=>(0,a.jsx)(sm,{shadow:e,category:n},e.slug)))})]})}function sm({shadow:e,category:t}){return(0,a.jsx)(Bo,{path:`/shadows/edit/${t}/${e.slug}`,children:(0,a.jsxs)(b.__experimentalHStack,{children:[(0,a.jsx)(b.FlexItem,{children:e.name}),(0,a.jsx)(qa,{icon:(0,w.isRTL)()?za:La})]})})}var im=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{d:"M7 11.5h10V13H7z"})});const{useGlobalSetting:rm}=ne(x.privateApis),{Menu:am}=ne(b.privateApis),om=[{label:(0,w.__)("Rename"),action:"rename"},{label:(0,w.__)("Delete"),action:"delete"}],lm=[{label:(0,w.__)("Reset"),action:"reset"}];function cm(){const{goBack:e,params:{category:t,slug:n}}=(0,b.useNavigator)(),[s,i]=rm(`shadow.presets.${t}`);(0,h.useEffect)((()=>{const t=s?.some((e=>e.slug===n));n&&!t&&e()}),[s,n,e]);const[r]=rm(`shadow.presets.${t}`,void 0,"base"),[o,l]=(0,h.useState)((()=>(s||[]).find((e=>e.slug===n)))),c=(0,h.useMemo)((()=>(r||[]).find((e=>e.slug===n))),[r,n]),[u,d]=(0,h.useState)(!1),[p,f]=(0,h.useState)(!1),[m,g]=(0,h.useState)(o.name);if(!t||!n)return null;return o?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(b.__experimentalHStack,{justify:"space-between",children:[(0,a.jsx)(xl,{title:o.name}),(0,a.jsx)(b.FlexItem,{children:(0,a.jsx)(b.__experimentalSpacer,{marginTop:2,marginBottom:0,paddingX:4,children:(0,a.jsxs)(am,{children:[(0,a.jsx)(am.TriggerButton,{render:(0,a.jsx)(b.Button,{size:"small",icon:No,label:(0,w.__)("Menu")})}),(0,a.jsx)(am.Popover,{children:("custom"===t?om:lm).map((e=>(0,a.jsx)(am.Item,{onClick:()=>(e=>{if("reset"===e){const e=s.map((e=>e.slug===n?c:e));l(c),i(e)}else"delete"===e?d(!0):"rename"===e&&f(!0)})(e.action),disabled:"reset"===e.action&&o.shadow===c.shadow,children:(0,a.jsx)(am.ItemLabel,{children:e.label})},e.action)))})]})})})]}),(0,a.jsxs)("div",{className:"edit-site-global-styles-screen",children:[(0,a.jsx)(um,{shadow:o.shadow}),(0,a.jsx)(dm,{shadow:o.shadow,onChange:e=>{l({...o,shadow:e});const t=s.map((t=>t.slug===n?{...o,shadow:e}:t));i(t)}})]}),u&&(0,a.jsx)(b.__experimentalConfirmDialog,{isOpen:!0,onConfirm:()=>{i(s.filter((e=>e.slug!==n))),d(!1)},onCancel:()=>{d(!1)},confirmButtonText:(0,w.__)("Delete"),size:"medium",children:(0,w.sprintf)((0,w.__)('Are you sure you want to delete "%s" shadow preset?'),o.name)}),p&&(0,a.jsx)(b.Modal,{title:(0,w.__)("Rename"),onRequestClose:()=>f(!1),size:"small",children:(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),(e=>{if(!e)return;const t=s.map((t=>t.slug===n?{...o,name:e}:t));l({...o,name:e}),i(t)})(m),f(!1)},children:[(0,a.jsx)(b.__experimentalInputControl,{__next40pxDefaultSize:!0,autoComplete:"off",label:(0,w.__)("Name"),placeholder:(0,w.__)("Shadow name"),value:m,onChange:e=>g(e)}),(0,a.jsx)(b.__experimentalSpacer,{marginBottom:6}),(0,a.jsxs)(b.Flex,{className:"block-editor-shadow-edit-modal__actions",justify:"flex-end",expanded:!1,children:[(0,a.jsx)(b.FlexItem,{children:(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>f(!1),children:(0,w.__)("Cancel")})}),(0,a.jsx)(b.FlexItem,{children:(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",children:(0,w.__)("Save")})})]})]})})]}):(0,a.jsx)(xl,{title:""})}function um({shadow:e}){const t={boxShadow:e};return(0,a.jsx)(b.__experimentalSpacer,{marginBottom:4,marginTop:-2,children:(0,a.jsx)(b.__experimentalHStack,{align:"center",justify:"center",className:"edit-site-global-styles__shadow-preview-panel",children:(0,a.jsx)("div",{className:"edit-site-global-styles__shadow-preview-block",style:t})})})}function dm({shadow:e,onChange:t}){const n=(0,h.useRef)(),s=(0,h.useMemo)((()=>function(e){return(e.match(/(?:[^,(]|\([^)]*\))+/g)||[]).map((e=>e.trim()))}(e)),[e]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.__experimentalVStack,{spacing:2,children:(0,a.jsxs)(b.__experimentalHStack,{justify:"space-between",children:[(0,a.jsx)(Ol,{level:3,children:(0,w.__)("Shadows")}),(0,a.jsx)(b.FlexItem,{className:"edit-site-global-styles__shadows-panel__options-container",children:(0,a.jsx)(b.Button,{size:"small",icon:ff,label:(0,w.__)("Add shadow"),onClick:()=>{t([...s,em].join(", "))},ref:n})})]})}),(0,a.jsx)(b.__experimentalSpacer,{}),(0,a.jsx)(b.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:s.map(((e,i)=>(0,a.jsx)(hm,{shadow:e,onChange:e=>((e,n)=>{const i=[...s];i[e]=n,t(i.join(", "))})(i,e),canRemove:s.length>1,onRemove:()=>(e=>{t(s.filter(((t,n)=>n!==e)).join(", ")),n.current.focus()})(i)},i)))})]})}function hm({shadow:e,onChange:t,canRemove:n,onRemove:s}){const i=(0,h.useMemo)((()=>function(e){const t={x:"0",y:"0",blur:"0",spread:"0",color:"#000",inset:!1};if(!e)return t;if(e.includes("none"))return t;const n=/((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g,s=e.match(n)||[];if(1!==s.length)return t;const i=s[0].split(" ").map((e=>e.trim())).filter((e=>e));if(i.length<2)return t;const r=e.match(/inset/gi)||[];if(r.length>1)return t;const a=1===r.length;let o=e.replace(n,"").trim();a&&(o=o.replace("inset","").replace("INSET","").trim());let l=(o.match(/^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi)||[]).map((e=>e?.trim())).filter((e=>e));if(l.length>1)return t;if(0===l.length&&(l=o.trim().split(" ").filter((e=>e)),l.length>1))return t;const[c,u,d,h]=i;return{x:c,y:u,blur:d||t.blur,spread:h||t.spread,inset:a,color:o||t.color}}(e)),[e]),r=e=>{t(function(e){const t=`${e.x||"0px"} ${e.y||"0px"} ${e.blur||"0px"} ${e.spread||"0px"}`;return`${e.inset?"inset":""} ${t} ${e.color||""}`.trim()}(e))};return(0,a.jsx)(b.Dropdown,{popoverProps:{placement:"left-start",offset:36,shift:!0},className:"edit-site-global-styles__shadow-editor__dropdown",renderToggle:({onToggle:e,isOpen:t})=>{const r={onClick:e,className:Ht("edit-site-global-styles__shadow-editor__dropdown-toggle",{"is-open":t}),"aria-expanded":t},o={onClick:()=>{t&&e(),s()},className:Ht("edit-site-global-styles__shadow-editor__remove-button",{"is-open":t}),label:(0,w.__)("Remove shadow")};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,icon:zo,...r,children:i.inset?(0,w.__)("Inner shadow"):(0,w.__)("Drop shadow")}),n&&(0,a.jsx)(b.Button,{size:"small",icon:im,...o})]})},renderContent:()=>(0,a.jsx)(b.__experimentalDropdownContentWrapper,{paddingSize:"medium",className:"edit-site-global-styles__shadow-editor__dropdown-content",children:(0,a.jsx)(pm,{shadowObj:i,onChange:r})})})}function pm({shadowObj:e,onChange:t}){const n=(n,s)=>{const i={...e,[n]:s};t(i)};return(0,a.jsxs)(b.__experimentalVStack,{spacing:4,className:"edit-site-global-styles__shadow-editor-panel",children:[(0,a.jsx)(b.ColorPalette,{clearable:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,value:e.color,onChange:e=>n("color",e)}),(0,a.jsxs)(b.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,value:e.inset?"inset":"outset",isBlock:!0,onChange:e=>n("inset","inset"===e),hideLabelFromVision:!0,__next40pxDefaultSize:!0,children:[(0,a.jsx)(b.__experimentalToggleGroupControlOption,{value:"outset",label:(0,w.__)("Outset")}),(0,a.jsx)(b.__experimentalToggleGroupControlOption,{value:"inset",label:(0,w.__)("Inset")})]}),(0,a.jsxs)(b.__experimentalGrid,{columns:2,gap:4,children:[(0,a.jsx)(fm,{label:(0,w.__)("X Position"),value:e.x,onChange:e=>n("x",e)}),(0,a.jsx)(fm,{label:(0,w.__)("Y Position"),value:e.y,onChange:e=>n("y",e)}),(0,a.jsx)(fm,{label:(0,w.__)("Blur"),value:e.blur,onChange:e=>n("blur",e)}),(0,a.jsx)(fm,{label:(0,w.__)("Spread"),value:e.spread,onChange:e=>n("spread",e)})]})]})}function fm({label:e,value:t,onChange:n}){return(0,a.jsx)(b.__experimentalUnitControl,{label:e,__next40pxDefaultSize:!0,value:t,onChange:e=>{const t=void 0!==e&&!isNaN(parseFloat(e));n(t?e:"0px")}})}function mm(){return(0,a.jsx)(tm,{})}function gm(){return(0,a.jsx)(cm,{})}const{useGlobalStyle:vm,useGlobalSetting:ym,useSettingsForBlockElement:xm,DimensionsPanel:bm}=ne(x.privateApis),wm={contentSize:!0,wideSize:!0,padding:!0,margin:!0,blockGap:!0,minHeight:!0,childLayout:!1};function _m(){const[e]=vm("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=vm("",void 0,"all",{shouldDecodeEncode:!1}),[s]=ym("",void 0,"user"),[i,r]=ym(""),o=xm(i),l=(0,h.useMemo)((()=>({...t,layout:o.layout})),[t,o.layout]),c=(0,h.useMemo)((()=>({...e,layout:s.layout})),[e,s.layout]);return(0,a.jsx)(bm,{inheritedValue:l,value:c,onChange:e=>{const t={...e};if(delete t.layout,n(t),e.layout!==s.layout){const t={...s,layout:e.layout};t.layout?.definitions&&delete t.layout.definitions,r(t)}},settings:o,includeLayoutControls:!0,defaultControls:wm})}const{useHasDimensionsPanel:jm,useGlobalSetting:Sm,useSettingsForBlockElement:Cm}=ne(x.privateApis);var km=function(){const[e]=Sm(""),t=Cm(e),n=jm(t);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(xl,{title:(0,w.__)("Layout")}),n&&(0,a.jsx)(_m,{})]})};const{GlobalStylesContext:Em}=ne(x.privateApis);function Pm({gap:e=2}){const{user:t}=(0,h.useContext)(Em),n=t?.styles,s=(0,c.useSelect)((e=>e(j.store).__experimentalGetCurrentThemeGlobalStylesVariations()),[]),i=s?.filter((e=>!dc(e,["color"])&&!dc(e,["typography","spacing"]))),r=(0,h.useMemo)((()=>[...[{title:(0,w.__)("Default"),settings:{},styles:{}},...i??[]].map((e=>{const t={...e?.styles?.blocks};n?.blocks&&Object.keys(n.blocks).forEach((e=>{if(n.blocks[e].css){const s=t[e]||{},i={css:`${t[e]?.css||""} ${n.blocks[e].css.trim()||""}`};t[e]={...s,...i}}}));const s=n?.css||e.styles?.css?{css:`${e.styles?.css||""} ${n?.css||""}`}:{},i=Object.keys(t).length>0?{blocks:t}:{},r={...e.styles,...s,...i};return{...e,settings:e.settings??{},styles:r}}))]),[i,n?.blocks,n?.css]);return!i||i?.length<1?null:(0,a.jsx)(b.__experimentalGrid,{columns:2,className:"edit-site-global-styles-style-variations-container",gap:e,children:r.map(((e,t)=>(0,a.jsx)(mc,{variation:e,children:t=>(0,a.jsx)(pl,{label:e?.title,withHoverView:!0,isFocused:t,variation:e})},t)))})}function Im(){return(0,a.jsxs)(b.__experimentalVStack,{spacing:10,className:"edit-site-global-styles-variation-container",children:[(0,a.jsx)(Pm,{gap:3}),(0,a.jsx)(Af,{title:(0,w.__)("Palettes"),gap:3}),(0,a.jsx)(gc,{title:(0,w.__)("Typography"),gap:3})]})}const{useZoomOut:Vm}=ne(x.privateApis);var Om=function(){const e=(0,c.useSelect)((e=>e(x.store).getSettings().isPreviewMode),[]);return Vm(!e),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(xl,{title:(0,w.__)("Browse styles"),description:(0,w.__)("Choose a variation to change the look of the site.")}),(0,a.jsx)(b.Card,{size:"small",isBorderless:!0,className:"edit-site-global-styles-screen-style-variations",children:(0,a.jsx)(b.CardBody,{children:(0,a.jsx)(Im,{})})})]})};const Tm=window.wp.mediaUtils,Am=[{slug:"theme-colors",title:(0,w.__)("Theme Colors"),origin:"theme",type:"colors"},{slug:"theme-gradients",title:(0,w.__)("Theme Gradients"),origin:"theme",type:"gradients"},{slug:"custom-colors",title:(0,w.__)("Custom Colors"),origin:"custom",type:"colors"},{slug:"custom-gradients",title:(0,w.__)("Custom Gradients"),origin:"custom",type:"gradients"},{slug:"duotones",title:(0,w.__)("Duotones"),origin:"theme",type:"duotones"},{slug:"default-colors",title:(0,w.__)("Default Colors"),origin:"default",type:"colors"},{slug:"default-gradients",title:(0,w.__)("Default Gradients"),origin:"default",type:"gradients"}],Nm=[{slug:"site-identity",title:(0,w.__)("Site Identity"),blocks:["core/site-logo","core/site-title","core/site-tagline"]},{slug:"design",title:(0,w.__)("Design"),blocks:["core/navigation","core/avatar","core/post-time-to-read"],exclude:["core/home-link","core/navigation-link"]},{slug:"posts",title:(0,w.__)("Posts"),blocks:["core/post-title","core/post-excerpt","core/post-author","core/post-author-name","core/post-author-biography","core/post-date","core/post-terms","core/term-description","core/query-title","core/query-no-results","core/query-pagination","core/query-numbers"]},{slug:"comments",title:(0,w.__)("Comments"),blocks:["core/comments-title","core/comments-pagination","core/comments-pagination-numbers","core/comments","core/comments-author-name","core/comment-content","core/comment-date","core/comment-edit-link","core/comment-reply-link","core/comment-template","core/post-comments-count","core/post-comments-link"]}],Fm=[{slug:"overview",title:(0,w.__)("Overview"),blocks:[]},{slug:"text",title:(0,w.__)("Text"),blocks:["core/post-content","core/home-link","core/navigation-link"]},{slug:"colors",title:(0,w.__)("Colors"),blocks:[]},{slug:"theme",title:(0,w.__)("Theme"),subcategories:Nm},{slug:"media",title:(0,w.__)("Media"),blocks:["core/post-featured-image"]},{slug:"widgets",title:(0,w.__)("Widgets"),blocks:[]},{slug:"embed",title:(0,w.__)("Embeds"),include:[]}],Mm=[...Nm,{slug:"media",title:(0,w.__)("Media"),blocks:["core/post-featured-image"]},{slug:"widgets",title:(0,w.__)("Widgets"),blocks:[]},{slug:"embed",title:(0,w.__)("Embeds"),include:[]}],Bm=[{slug:"overview",title:(0,w.__)("Overview"),blocks:[]},{slug:"text",title:(0,w.__)("Text"),blocks:["core/post-content","core/home-link","core/navigation-link"]},{slug:"colors",title:(0,w.__)("Colors"),blocks:[]},{slug:"blocks",title:(0,w.__)("All Blocks"),blocks:[],subcategories:Mm}];function Dm(e,t){if(!e?.slug||!t?.length)return;const n=e?.subcategories??[];if(n.length)return n.reduce(((e,n)=>{const s=Dm(n,t);return s&&(e.subcategories||(e.subcategories=[]),e.subcategories=[...e.subcategories,s]),e}),{title:e.title,slug:e.slug});const s=e?.blocks||[],i=e?.exclude||[],r=t.filter((t=>!i.includes(t.name)&&(t.category===e.slug||s.includes(t.name))));return r.length?{title:e.title,slug:e.slug,examples:r}:void 0}function Rm(){const e=[...Nm,...Fm].map((({slug:e})=>e)),t=(0,o.getCategories)().filter((({slug:t})=>!e.includes(t)));return[...Fm,...t]}var Lm=({colors:e,type:t,templateColumns:n="1fr 1fr",itemHeight:s="52px"})=>e?(0,a.jsx)(b.__experimentalGrid,{templateColumns:n,rowGap:8,columnGap:16,children:e.map((e=>{const n="gradients"===t?(0,x.__experimentalGetGradientClass)(e.slug):(0,x.getColorClassName)("background-color",e.slug),i=Ht("edit-site-style-book__color-example",n);return(0,a.jsx)(Zt.View,{className:i,style:{height:s}},e.slug)}))}):null;var zm=({duotones:e})=>e?(0,a.jsx)(b.__experimentalGrid,{columns:2,rowGap:16,columnGap:16,children:e.map((e=>(0,a.jsxs)(b.__experimentalGrid,{className:"edit-site-style-book__duotone-example",columns:2,rowGap:8,columnGap:8,children:[(0,a.jsx)(Zt.View,{children:(0,a.jsx)("img",{alt:`Duotone example: ${e.slug}`,src:"https://s.w.org/images/core/5.3/MtBlanc1.jpg",style:{filter:`url(#wp-duotone-${e.slug})`}})}),e.colors.map((e=>(0,a.jsx)(Zt.View,{className:"edit-site-style-book__color-example",style:{backgroundColor:e}},e)))]},e.slug)))}):null;function Hm(e){const t=(0,o.getBlockTypes)().filter((e=>{const{name:t,example:n,supports:s}=e;return"core/heading"!==t&&!!n&&!1!==s?.inserter})).map((e=>({name:e.name,title:e.title,category:e.category,blocks:(0,o.getBlockFromExample)(e.name,{...e.example,attributes:{...e.example.attributes,style:void 0}})})));if(!!!(0,o.getBlockType)("core/heading"))return t;const n={name:"core/heading",title:(0,w.__)("Headings"),category:"text",blocks:[1,2,3,4,5,6].map((e=>(0,o.createBlock)("core/heading",{content:(0,w.sprintf)((0,w.__)("Heading %d"),e),level:e})))},s=function(e){if(!e)return[];const t=[];return Am.forEach((n=>{const s=e[n.type],i=Array.isArray(s)?s.find((e=>e.slug===n.origin)):void 0;if(i?.[n.type]){const e={name:n.slug,title:n.title,category:"colors"};"duotones"===n.type?(e.content=(0,a.jsx)(zm,{duotones:i[n.type]}),t.push(e)):(e.content=(0,a.jsx)(Lm,{colors:i[n.type],type:n.type}),t.push(e))}})),t}(e),i=function(e){const t=[],n=Array.isArray(e?.colors)?e.colors.find((e=>"theme"===e.slug)):void 0;if(n){const e={name:"theme-colors",title:(0,w.__)("Colors"),category:"overview",content:(0,a.jsx)(Lm,{colors:n.colors,type:"colors",templateColumns:"repeat(auto-fill, minmax( 200px, 1fr ))",itemHeight:"32px"})};t.push(e)}const s=[];if((0,o.getBlockType)("core/heading")){const e=(0,o.createBlock)("core/heading",{content:(0,w.__)("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789X{(…)},.-<>?!*&:/A@HELFO™©"),level:1});s.push(e)}if((0,o.getBlockType)("core/paragraph")){const e=(0,o.createBlock)("core/paragraph",{content:(0,w.__)("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.")}),t=(0,o.createBlock)("core/paragraph",{content:(0,w.__)("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.")});if((0,o.getBlockType)("core/group")){const n=(0,o.createBlock)("core/group",{layout:{type:"grid",columnCount:2,minimumColumnWidth:"12rem"},style:{spacing:{blockGap:"1.5rem"}}},[e,t]);s.push(n)}else s.push(e)}return s.length&&t.push({name:"typography",title:(0,w.__)("Typography"),category:"overview",blocks:s}),["core/image","core/separator","core/buttons","core/pullquote","core/search"].forEach((e=>{const n=(0,o.getBlockType)(e);if(n&&n.example){const s={name:e,title:n.title,category:"overview",blocks:(0,o.getBlockFromExample)(e,{...n.example,attributes:{...n.example.attributes,style:void 0}})};t.push(s)}})),t}(e);return[n,...s,...t,...i]}function Gm({breadcrumbs:e,badges:t,title:n,subTitle:s,actions:i}){return(0,a.jsxs)(b.__experimentalVStack,{className:"admin-ui-page__header",as:"header",children:[(0,a.jsxs)(b.__experimentalHStack,{className:"admin-ui-page__header-title",justify:"space-between",spacing:2,children:[(0,a.jsxs)(b.__experimentalHStack,{spacing:2,children:[n&&(0,a.jsx)(b.__experimentalHeading,{as:"h2",level:3,weight:500,truncate:!0,children:n}),e,t]}),(0,a.jsx)(b.__experimentalHStack,{style:{width:"auto",flexShrink:0},spacing:2,className:"admin-ui-page__header-actions",children:i})]}),s&&(0,a.jsx)("p",{className:"admin-ui-page__header-subtitle",children:s})]})}var Wm=function({breadcrumbs:e,badges:t,title:n,subTitle:s,children:i,className:r,actions:o,hasPadding:l=!1}){const c=Ht("admin-ui-page",r);return(0,a.jsxs)(Wt,{className:c,ariaLabel:n,children:[(n||e||t)&&(0,a.jsx)(Gm,{breadcrumbs:e,badges:t,title:n,subTitle:s,actions:o}),l?(0,a.jsx)("div",{className:"admin-ui-page__content has-padding",children:i}):i]})};const{useLocation:Um,useHistory:qm}=ne(Lt.privateApis),Zm=({isStyleBookOpened:e,setIsStyleBookOpened:t,path:n})=>{const s=qm(),i=(0,c.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(j.store),s=n(),i=s?t("root","globalStyles",s):void 0;return!!i?._links?.["wp:action-edit-css"]}),[]);return(0,a.jsxs)(b.__experimentalHStack,{children:[(0,a.jsx)(b.Button,{isPressed:e,icon:Ao,label:(0,w.__)("Style Book"),onClick:()=>{t(!e);const i=e?(0,Qt.removeQueryArgs)(n,"preview"):(0,Qt.addQueryArgs)(n,{preview:"stylebook"});s.navigate(i)},size:"compact"}),i&&(0,a.jsx)(b.DropdownMenu,{icon:No,label:(0,w.__)("More"),toggleProps:{size:"compact"},children:({onClose:e})=>(0,a.jsx)(b.MenuGroup,{children:i&&(0,a.jsx)(b.MenuItem,{onClick:()=>{e(),s.navigate((0,Qt.addQueryArgs)(n,{section:"/css"}))},children:(0,w.__)("Additional CSS")})})})]})},Ym=()=>{const{path:e,query:t}=Um(),n=qm();return(0,h.useMemo)((()=>[t.section??"/",t=>{n.navigate((0,Qt.addQueryArgs)(e,{section:t}))}]),[e,t.section,n])};function Km(){const{path:e}=Um(),[t,n]=(0,h.useState)(e.includes("preview=stylebook")),s=(0,y.useViewportMatch)("medium","<"),[i,r]=Ym();return(0,a.jsx)(Wm,{actions:s?null:(0,a.jsx)(Zm,{isStyleBookOpened:t,setIsStyleBookOpened:n,path:e}),className:"edit-site-styles",title:(0,w.__)("Styles"),children:(0,a.jsx)(Wg,{path:i,onPathChange:r})})}const{ExperimentalBlockEditorProvider:Xm,useGlobalStyle:Qm,GlobalStylesContext:Jm,useGlobalStylesOutputWithConfig:$m}=ne(x.privateApis),{mergeBaseAndUserConfigs:eg}=ne(f.privateApis),{Tabs:tg}=ne(b.privateApis);function ng(e){return!e||0===Object.keys(e).length}const sg=(e,t)=>{if(!e||!t||!t?.contentDocument)return;const n="top"===e?t.contentDocument.body:t.contentDocument.getElementById(e);n&&n.scrollIntoView({behavior:"smooth"})},ig=e=>e&&"string"==typeof e&&("/"===e||e.startsWith("/typography")||e.startsWith("/colors")||e.startsWith("/blocks"))?{top:!0}:null;function rg(){const{colors:e,gradients:t}=(0,x.__experimentalUseMultipleOriginColorsAndGradients)(),[n,s,i,r]=(0,x.useSettings)("color.defaultDuotone","color.duotone.custom","color.duotone.theme","color.duotone.default");return(0,h.useMemo)((()=>{const a={colors:e,gradients:t,duotones:[]};return i&&i.length&&a.duotones.push({name:(0,w._x)("Theme","Indicates these duotone filters come from the theme."),slug:"theme",duotones:i}),n&&r&&r.length&&a.duotones.push({name:(0,w._x)("Default","Indicates these duotone filters come from WordPress."),slug:"default",duotones:r}),s&&s.length&&a.duotones.push({name:(0,w._x)("Custom","Indicates these doutone filters are created by the user."),slug:"custom",duotones:s}),a}),[e,t,s,i,r,n])}function ag(e){const t=[],n=Dm({slug:"overview"},e);t.push(...n.examples);const s=e.filter((e=>"overview"!==e.category&&!n.examples.find((t=>t.name===e.name))));return t.push(...s),t}function og(e,t){return t?e.map((e=>({...e,variation:t,blocks:Array.isArray(e.blocks)?e.blocks.map((e=>({...e,attributes:{...e.attributes,style:void 0,className:Jo(t)}}))):{...e.blocks,attributes:{...e.blocks.attributes,style:void 0,className:Jo(t)}}}))):e}const lg=({userConfig:e={},isStatic:t=!1})=>{const n=(0,c.useSelect)((e=>e(Rt).getSettings()),[]),s=(0,c.useSelect)((e=>e(j.store).canUser("create",{kind:"postType",name:"attachment"})),[]);(0,h.useEffect)((()=>{(0,c.dispatch)(x.store).updateSettings({...n,mediaUpload:s?Tm.uploadMedia:void 0})}),[n,s]);const[i,r]=Ym(),o=Hm(rg()),l=ag(o);let u=null,d=null;if(i.includes("/colors"))u="colors";else if(i.includes("/typography"))u="text";else if(i.includes("/blocks")){u="blocks";let e=decodeURIComponent(i).split("/blocks/")[1];e?.includes("/variations")&&([e,d]=e.split("/variations/")),e&&o.find((t=>t.name===e))&&(u=e)}else t||(u="overview");const p=Bm.find((e=>e.slug===u)),f=(0,h.useMemo)((()=>p?Dm(p,o):{examples:[o.find((e=>e.name===u))]}),[p,o,u]),m=(0,h.useMemo)((()=>u?d?{examples:og(f.examples,d)}:f:{examples:l}),[u,l,d,f]),{base:g}=(0,h.useContext)(Jm),v=ig(i),y=(0,h.useMemo)((()=>ng(e)||ng(g)?{}:eg(g,e)),[g,e]),[b]=$m(y),w=(0,h.useMemo)((()=>({...n,styles:ng(b)||ng(e)?n.styles:b,isPreviewMode:!0})),[b,n,e]);return(0,a.jsx)("div",{className:"edit-site-style-book",children:(0,a.jsxs)(x.BlockEditorProvider,{settings:w,children:[(0,a.jsx)(wo,{disableRootPadding:!0}),(0,a.jsx)(cg,{examples:m,settings:w,goTo:v,isSelected:t?null:e=>i===`/blocks/${encodeURIComponent(e)}`||i.startsWith(`/blocks/${encodeURIComponent(e)}/`),onSelect:t?null:(e,t=!1)=>{Am.find((t=>t.slug===e))?r("/colors/palette"):"typography"!==e?t||r(`/blocks/${encodeURIComponent(e)}`):r("/typography")}})]})})},cg=({examples:e,isSelected:t,onClick:n,onSelect:s,settings:i,title:r,goTo:o})=>{const[l,c]=(0,h.useState)(!1),[u,d]=(0,h.useState)(!1),p=(0,h.useRef)(null),f={role:"button",onFocus:()=>c(!0),onBlur:()=>c(!1),onKeyDown:e=>{if(e.defaultPrevented)return;const{keyCode:t}=e;!n||t!==Xt.ENTER&&t!==Xt.SPACE||(e.preventDefault(),n(e))},onClick:e=>{e.defaultPrevented||n&&(e.preventDefault(),n(e))},readonly:!0};return(0,h.useLayoutEffect)((()=>{u&&p?.current&&o?.top&&sg("top",p?.current)}),[p?.current,o,sg,u]),(0,a.jsxs)(x.__unstableIframe,{onLoad:()=>d(!0),ref:p,className:Ht("edit-site-style-book__iframe",{"is-focused":l&&!!n,"is-button":!!n}),name:"style-book-canvas",tabIndex:0,...n?f:{},children:[(0,a.jsx)(x.__unstableEditorStyles,{styles:i.styles}),(0,a.jsxs)("style",{children:['\n\tbody {\n\t\tposition: relative;\n\t\tpadding: 32px !important;\n\t}\n\n\t\n\t.is-root-container {\n\t\tdisplay: flow-root;\n\t}\n\n\n\t.edit-site-style-book__examples {\n\t\tmax-width: 1200px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.edit-site-style-book__example {\n\t max-width: 900px;\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 40px;\n\t\tpadding: 16px;\n\t\twidth: 100%;\n\t\tbox-sizing: border-box;\n\t\tscroll-margin-top: 32px;\n\t\tscroll-margin-bottom: 32px;\n\t\tmargin: 0 auto 40px auto;\n\t}\n\n\t.edit-site-style-book__example.is-selected {\n\t\tbox-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t}\n\n\t.edit-site-style-book__example.is-disabled-example {\n\t\tpointer-events: none;\n\t}\n\n\t.edit-site-style-book__example:focus:not(:disabled) {\n\t\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t\toutline: 3px solid transparent;\n\t}\n\n\t.edit-site-style-book__duotone-example > div:first-child {\n\t\tdisplay: flex;\n\t\taspect-ratio: 16 / 9;\n\t\tgrid-row: span 1;\n\t\tgrid-column: span 2;\n\t}\n\t.edit-site-style-book__duotone-example img {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tobject-fit: cover;\n\t}\n\t.edit-site-style-book__duotone-example > div:not(:first-child) {\n\t\theight: 20px;\n\t\tborder: 1px solid color-mix( in srgb, currentColor 10%, transparent );\n\t}\n\n\t.edit-site-style-book__color-example {\n\t\tborder: 1px solid color-mix( in srgb, currentColor 10%, transparent );\n\t}\n\n\t.edit-site-style-book__subcategory-title,\n\t.edit-site-style-book__example-title {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\tfont-size: 13px;\n\t\tfont-weight: normal;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\tpadding-top: 8px;\n\t\tborder-top: 1px solid color-mix( in srgb, currentColor 10%, transparent );\n\t\tcolor: color-mix( in srgb, currentColor 60%, transparent );\n\t}\n\n\t.edit-site-style-book__subcategory-title {\n\t\tfont-size: 16px;\n\t\tmargin-bottom: 40px;\n \tpadding-bottom: 8px;\n\t}\n\n\t.edit-site-style-book__example-preview {\n\t\twidth: 100%;\n\t}\n\n\t.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,\n\t.edit-site-style-book__example-preview .block-list-appender {\n\t\tdisplay: none;\n\t}\n\t:where(.is-root-container > .wp-block:first-child) {\n\t\tmargin-top: 0;\n\t}\n\t:where(.is-root-container > .wp-block:last-child) {\n\t\tmargin-bottom: 0;\n\t}\n',!!n&&"body { cursor: pointer; } body * { pointer-events: none; }"]}),(0,a.jsx)(ug,{className:"edit-site-style-book__examples",filteredExamples:e,label:r?(0,w.sprintf)((0,w.__)("Examples of blocks in the %s category"),r):(0,w.__)("Examples of blocks"),isSelected:t,onSelect:s},r)]})},ug=(0,h.memo)((({className:e,filteredExamples:t,label:n,isSelected:s,onSelect:i})=>(0,a.jsxs)(b.Composite,{orientation:"vertical",className:e,"aria-label":n,role:"grid",children:[!!t?.examples?.length&&t.examples.map((e=>(0,a.jsx)(pg,{id:`example-${e.name}`,title:e.title,content:e.content,blocks:e.blocks,isSelected:s?.(e.name),onClick:i?()=>i(e.name,!!e.variation):null},e.name))),!!t?.subcategories?.length&&t.subcategories.map((e=>(0,a.jsxs)(b.Composite.Group,{className:"edit-site-style-book__subcategory",children:[(0,a.jsx)(b.Composite.GroupLabel,{children:(0,a.jsx)("h2",{className:"edit-site-style-book__subcategory-title",children:e.title})}),(0,a.jsx)(dg,{examples:e.examples,isSelected:s,onSelect:i})]},`subcategory-${e.slug}`)))]}))),dg=({examples:e,isSelected:t,onSelect:n})=>!!e?.length&&e.map((e=>(0,a.jsx)(pg,{id:`example-${e.name}`,title:e.title,content:e.content,blocks:e.blocks,isSelected:t?.(e.name),onClick:n?()=>n(e.name):null},e.name))),hg=["example-duotones"],pg=({id:e,title:t,blocks:n,isSelected:s,onClick:i,content:r})=>{const o=(0,c.useSelect)((e=>e(x.store).getSettings()),[]),l=(0,h.useMemo)((()=>({...o,focusMode:!1,isPreviewMode:!0})),[o]),u=(0,h.useMemo)((()=>Array.isArray(n)?n:[n]),[n]),d=hg.includes(e)||!i?{disabled:!0,accessibleWhenDisabled:!!i}:{};return(0,a.jsx)("div",{role:"row",children:(0,a.jsx)("div",{role:"gridcell",children:(0,a.jsxs)(b.Composite.Item,{className:Ht("edit-site-style-book__example",{"is-selected":s,"is-disabled-example":!!d?.disabled}),id:e,"aria-label":i?(0,w.sprintf)((0,w.__)("Open %s styles in Styles panel"),t):void 0,render:(0,a.jsx)("div",{}),role:i?"button":null,onClick:i,...d,children:[(0,a.jsx)("span",{className:"edit-site-style-book__example-title",children:t}),(0,a.jsx)("div",{className:"edit-site-style-book__example-preview","aria-hidden":!0,children:(0,a.jsx)(b.Disabled,{className:"edit-site-style-book__example-preview__content",children:r||(0,a.jsxs)(Xm,{value:u,settings:l,children:[(0,a.jsx)(x.__unstableEditorStyles,{}),(0,a.jsx)(x.BlockList,{renderAppender:!1})]})})})]})})})};var fg=function({enableResizing:e=!0,isSelected:t,onClick:n,onSelect:s,showCloseButton:i=!0,onClose:r,showTabs:o=!0,userConfig:l={},path:u=""}){const[d]=Qm("color.text"),[p]=Qm("color.background"),f=rg(),m=(0,h.useMemo)((()=>Hm(f)),[f]),g=(0,h.useMemo)((()=>Rm().filter((e=>m.some((t=>t.category===e.slug))))),[m]),v=ag(m),{base:y}=(0,h.useContext)(Jm),b=ig(u),_=(0,h.useMemo)((()=>ng(l)||ng(y)?{}:eg(y,l)),[y,l]),j=(0,c.useSelect)((e=>e(x.store).getSettings()),[]),[S]=$m(_),C=(0,h.useMemo)((()=>({...j,styles:ng(S)||ng(l)?j.styles:S,isPreviewMode:!0})),[S,j,l]);return(0,a.jsx)(Ta,{onClose:r,enableResizing:e,closeButtonLabel:i?(0,w.__)("Close"):null,children:(0,a.jsx)("div",{className:Ht("edit-site-style-book",{"is-button":!!n}),style:{color:d,background:p},children:o?(0,a.jsxs)(tg,{children:[(0,a.jsx)("div",{className:"edit-site-style-book__tablist-container",children:(0,a.jsx)(tg.TabList,{children:g.map((e=>(0,a.jsx)(tg.Tab,{tabId:e.slug,children:e.title},e.slug)))})}),g.map((e=>{const n=e.slug?Rm().find((t=>t.slug===e.slug)):null,i=n?Dm(n,m):{examples:m};return(0,a.jsx)(tg.TabPanel,{tabId:e.slug,focusable:!1,className:"edit-site-style-book__tabpanel",children:(0,a.jsx)(cg,{category:e.slug,examples:i,isSelected:t,onSelect:s,settings:C,title:e.title,goTo:b})},e.slug)}))]}):(0,a.jsx)(cg,{examples:{examples:v},isSelected:t,onClick:n,onSelect:s,settings:C,goTo:b})})})};const{useGlobalStyle:mg,AdvancedPanel:gg}=ne(x.privateApis);var vg=function(){const[e]=mg("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=mg("",void 0,"all",{shouldDecodeEncode:!1}),{setEditorCanvasContainerView:s}=ne((0,c.useDispatch)(Rt));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(xl,{title:(0,w.__)("Additional CSS"),description:(0,a.jsxs)(a.Fragment,{children:[(0,w.__)("You can add custom CSS to further customize the appearance and layout of your site."),(0,a.jsx)("br",{}),(0,a.jsx)(b.ExternalLink,{href:(0,w.__)("https://developer.wordpress.org/advanced-administration/wordpress/css/"),className:"edit-site-global-styles-screen-css-help-link",children:(0,w.__)("Learn more about CSS")})]}),onBack:()=>{s(void 0)}}),(0,a.jsx)("div",{className:"edit-site-global-styles-screen-css",children:(0,a.jsx)(gg,{value:e,onChange:n,inheritedValue:t})})]})};const{ExperimentalBlockEditorProvider:yg,GlobalStylesContext:xg,useGlobalStylesOutputWithConfig:bg,__unstableBlockStyleVariationOverridesWithConfig:wg}=ne(x.privateApis),{mergeBaseAndUserConfigs:_g}=ne(f.privateApis);function jg(e){return!e||0===Object.keys(e).length}var Sg=function({userConfig:e,blocks:t}){const{base:n}=(0,h.useContext)(xg),s=(0,h.useMemo)((()=>jg(e)||jg(n)?{}:_g(n,e)),[n,e]),i=(0,h.useMemo)((()=>Array.isArray(t)?t:[t]),[t]),r=(0,c.useSelect)((e=>e(x.store).getSettings()),[]),o=(0,h.useMemo)((()=>({...r,isPreviewMode:!0})),[r]),[l]=bg(s),u=jg(l)||jg(e)?o.styles:l;return(0,a.jsx)(Ta,{title:(0,w.__)("Revisions"),closeButtonLabel:(0,w.__)("Close revisions"),enableResizing:!0,children:(0,a.jsxs)(x.__unstableIframe,{className:"edit-site-revisions__iframe",name:"revisions",tabIndex:0,children:[(0,a.jsx)("style",{children:".is-root-container { display: flow-root; }"}),(0,a.jsx)(b.Disabled,{className:"edit-site-revisions__example-preview__content",children:(0,a.jsxs)(yg,{value:i,settings:o,children:[(0,a.jsx)(x.BlockList,{renderAppender:!1}),(0,a.jsx)(x.__unstableEditorStyles,{styles:u}),(0,a.jsx)(wg,{config:s})]})})]})})};const Cg=window.wp.date,{getGlobalStylesChanges:kg}=ne(x.privateApis);function Eg({revision:e,previousRevision:t}){const n=kg(e,t,{maxResults:7});return n.length?(0,a.jsx)("ul",{"data-testid":"global-styles-revision-changes",className:"edit-site-global-styles-screen-revisions__changes",children:n.map((e=>(0,a.jsx)("li",{children:e},e)))}):null}var Pg=function({userRevisions:e,selectedRevisionId:t,onChange:n,canApplyRevision:s,onApplyRevision:i}){const{currentThemeName:r,currentUser:o}=(0,c.useSelect)((e=>{const{getCurrentTheme:t,getCurrentUser:n}=e(j.store),s=t();return{currentThemeName:s?.name?.rendered||s?.stylesheet,currentUser:n()}}),[]),l=(0,Cg.getDate)().getTime(),{datetimeAbbreviated:u}=(0,Cg.getSettings)().formats;return(0,a.jsx)(b.Composite,{orientation:"vertical",className:"edit-site-global-styles-screen-revisions__revisions-list","aria-label":(0,w.__)("Global styles revisions list"),role:"listbox",children:e.map(((c,d)=>{const{id:h,author:p,modified:f}=c,m="unsaved"===h,g=m?o:p,v=g?.name||(0,w.__)("User"),y=g?.avatar_urls?.[48],x=t?t===h:0===d,_=!s&&x,j="parent"===h,S=(0,Cg.getDate)(f),C=f&&l-S.getTime()>864e5?(0,Cg.dateI18n)(u,S):(0,Cg.humanTimeDiff)(f),k=function(e,t,n,s){return"parent"===e?(0,w.__)("Reset the styles to the theme defaults"):"unsaved"===e?(0,w.sprintf)((0,w.__)("Unsaved changes by %s"),t):s?(0,w.sprintf)((0,w.__)("Changes saved by %1$s on %2$s. This revision matches current editor styles."),t,n):(0,w.sprintf)((0,w.__)("Changes saved by %1$s on %2$s"),t,n)}(h,v,(0,Cg.dateI18n)(u,S),_);return(0,a.jsxs)(b.Composite.Item,{className:"edit-site-global-styles-screen-revisions__revision-item","aria-current":x,role:"option",onKeyDown:e=>{const{keyCode:t}=e;t!==Xt.ENTER&&t!==Xt.SPACE||n(c)},onClick:e=>{e.preventDefault(),n(c)},"aria-selected":x,"aria-label":k,render:(0,a.jsx)("div",{}),children:[(0,a.jsx)("span",{className:"edit-site-global-styles-screen-revisions__revision-item-wrapper",children:j?(0,a.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__description",children:[(0,w.__)("Default styles"),(0,a.jsx)("span",{className:"edit-site-global-styles-screen-revisions__meta",children:r})]}):(0,a.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__description",children:[m?(0,a.jsx)("span",{className:"edit-site-global-styles-screen-revisions__date",children:(0,w.__)("(Unsaved)")}):(0,a.jsx)("time",{className:"edit-site-global-styles-screen-revisions__date",dateTime:f,children:C}),(0,a.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__meta",children:[(0,a.jsx)("img",{alt:v,src:y}),v]}),x&&(0,a.jsx)(Eg,{revision:c,previousRevision:d<e.length?e[d+1]:{}})]})}),x&&(_?(0,a.jsx)("p",{className:"edit-site-global-styles-screen-revisions__applied-text",children:(0,w.__)("These styles are already applied to your site.")}):(0,a.jsx)(b.Button,{size:"compact",variant:"primary",className:"edit-site-global-styles-screen-revisions__apply-button",onClick:i,"aria-label":(0,w.__)("Apply the selected revision to your site."),children:j?(0,w.__)("Reset to defaults"):(0,w.__)("Apply")}))]},h)}))})};function Ig({currentPage:e,numPages:t,changePage:n,totalItems:s,className:i,disabled:r=!1,buttonVariant:o="tertiary",label:l=(0,w.__)("Pagination")}){return(0,a.jsxs)(b.__experimentalHStack,{expanded:!1,as:"nav","aria-label":l,spacing:3,justify:"flex-start",className:Ht("edit-site-pagination",i),children:[(0,a.jsx)(b.__experimentalText,{variant:"muted",className:"edit-site-pagination__total",children:(0,w.sprintf)((0,w._n)("%s item","%s items",s),s)}),(0,a.jsxs)(b.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,a.jsx)(b.Button,{variant:o,onClick:()=>n(1),accessibleWhenDisabled:!0,disabled:r||1===e,label:(0,w.__)("First page"),icon:(0,w.isRTL)()?$c:eu,size:"compact"}),(0,a.jsx)(b.Button,{variant:o,onClick:()=>n(e-1),accessibleWhenDisabled:!0,disabled:r||1===e,label:(0,w.__)("Previous page"),icon:(0,w.isRTL)()?La:za,size:"compact"})]}),(0,a.jsx)(b.__experimentalText,{variant:"muted",children:(0,w.sprintf)((0,w._x)("%1$s of %2$s","paging"),e,t)}),(0,a.jsxs)(b.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,a.jsx)(b.Button,{variant:o,onClick:()=>n(e+1),accessibleWhenDisabled:!0,disabled:r||e===t,label:(0,w.__)("Next page"),icon:(0,w.isRTL)()?za:La,size:"compact"}),(0,a.jsx)(b.Button,{variant:o,onClick:()=>n(t),accessibleWhenDisabled:!0,disabled:r||e===t,label:(0,w.__)("Last page"),icon:(0,w.isRTL)()?eu:$c,size:"compact"})]})]})}const{GlobalStylesContext:Vg,areGlobalStyleConfigsEqual:Og}=ne(x.privateApis);var Tg=function(){const{user:e,setUserConfig:t}=(0,h.useContext)(Vg),{blocks:n,editorCanvasContainerView:s}=(0,c.useSelect)((e=>({editorCanvasContainerView:ne(e(Rt)).getEditorCanvasContainerView(),blocks:e(x.store).getBlocks()})),[]),[i,r]=(0,h.useState)(1),[o,l]=(0,h.useState)([]),{revisions:u,isLoading:d,hasUnsavedChanges:p,revisionsCount:f}=no({query:{per_page:10,page:i}}),m=Math.ceil(f/10),[g,v]=(0,h.useState)(e),[y,_]=(0,h.useState)(!1),{setEditorCanvasContainerView:j}=ne((0,c.useDispatch)(Rt)),S=Og(g,e),C=()=>{j("global-styles-revisions:style-book"===s?"style-book":void 0)},k=e=>{t((()=>e)),_(!1),C()};(0,h.useEffect)((()=>{!d&&u.length&&l(u)}),[u,d]);const E=u[0],P=g?.id,I=!!E?.id&&!S&&!P;(0,h.useEffect)((()=>{I&&v(E)}),[I,E]);const V=!!P&&"unsaved"!==P&&!S,O=!!o.length;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(xl,{title:f&&(0,w.sprintf)((0,w.__)("Revisions (%s)"),f),description:(0,w.__)('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.'),onBack:C}),!O&&(0,a.jsx)(b.Spinner,{className:"edit-site-global-styles-screen-revisions__loading"}),O&&("global-styles-revisions:style-book"===s?(0,a.jsx)(fg,{userConfig:g,isSelected:()=>{},onClose:()=>{j("global-styles-revisions")}}):(0,a.jsx)(Sg,{blocks:n,userConfig:g,closeButtonLabel:(0,w.__)("Close revisions")})),(0,a.jsx)(Pg,{onChange:v,selectedRevisionId:P,userRevisions:o,canApplyRevision:V,onApplyRevision:()=>p?_(!0):k(g)}),m>1&&(0,a.jsx)("div",{className:"edit-site-global-styles-screen-revisions__footer",children:(0,a.jsx)(Ig,{className:"edit-site-global-styles-screen-revisions__pagination",currentPage:i,numPages:m,changePage:r,totalItems:f,disabled:d,label:(0,w.__)("Global Styles pagination")})}),y&&(0,a.jsx)(b.__experimentalConfirmDialog,{isOpen:y,confirmButtonText:(0,w.__)("Apply"),onConfirm:()=>k(g),onCancel:()=>_(!1),size:"medium",children:(0,w.__)("Are you sure you want to apply this revision? Any unsaved changes will be lost.")})]})};const{useGlobalStylesReset:Ag}=ne(x.privateApis),{Slot:Ng,Fill:Fg}=(0,b.createSlotFill)("GlobalStylesMenu");function Mg(){const[e,t]=Ag(),{toggle:n}=(0,c.useDispatch)(m.store),{canEditCSS:s}=(0,c.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(j.store),s=n(),i=s?t("root","globalStyles",s):void 0;return{canEditCSS:!!i?._links?.["wp:action-edit-css"]}}),[]),{setEditorCanvasContainerView:i}=ne((0,c.useDispatch)(Rt)),r=()=>{i("global-styles-css")};return(0,a.jsx)(Fg,{children:(0,a.jsx)(b.DropdownMenu,{icon:No,label:(0,w.__)("More"),toggleProps:{size:"compact"},children:({onClose:i})=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(b.MenuGroup,{children:[s&&(0,a.jsx)(b.MenuItem,{onClick:r,children:(0,w.__)("Additional CSS")}),(0,a.jsx)(b.MenuItem,{onClick:()=>{n("core/edit-site","welcomeGuideStyles"),i()},children:(0,w.__)("Welcome Guide")})]}),(0,a.jsx)(b.MenuGroup,{children:(0,a.jsx)(b.MenuItem,{onClick:()=>{t(),i()},disabled:!e,children:(0,w.__)("Reset styles")})})]})})})}function Bg({className:e,...t}){return(0,a.jsx)(b.Navigator.Screen,{className:["edit-site-global-styles-sidebar__navigator-screen",e].filter(Boolean).join(" "),...t})}function Dg({parentMenu:e,blockStyles:t,blockName:n}){return t.map(((t,s)=>(0,a.jsx)(Bg,{path:e+"/variations/"+t.name,children:(0,a.jsx)(Jl,{name:n,variation:t.name})},s)))}function Rg({name:e,parentMenu:t=""}){const n=(0,c.useSelect)((t=>{const{getBlockStyles:n}=t(o.store);return n(e)}),[e]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Bg,{path:t+"/colors/palette",children:(0,a.jsx)(Hf,{name:e})}),!!n?.length&&(0,a.jsx)(Dg,{parentMenu:t,blockStyles:n,blockName:e})]})}function Lg(){const e=(0,b.useNavigator)(),{path:t}=e.location;return(0,a.jsx)(fg,{isSelected:e=>t===`/blocks/${encodeURIComponent(e)}`||t.startsWith(`/blocks/${encodeURIComponent(e)}/`),onSelect:t=>{Am.find((e=>e.slug===t))?e.goTo("/colors/palette"):"typography"!==t?e.goTo("/blocks/"+encodeURIComponent(t)):e.goTo("/typography")}})}function zg(){const e=(0,b.useNavigator)(),{selectedBlockName:t,selectedBlockClientId:n}=(0,c.useSelect)((e=>{const{getSelectedBlockClientId:t,getBlockName:n}=e(x.store),s=t();return{selectedBlockName:n(s),selectedBlockClientId:s}}),[]),s=kl(t);(0,h.useEffect)((()=>{if(!n||!s)return;const i=e.location.path;if("/blocks"!==i&&!i.startsWith("/blocks/"))return;const r="/blocks/"+encodeURIComponent(t);r!==i&&e.goTo(r,{skipFocus:!0})}),[n,t,s])}function Hg(){const{goTo:e,location:t}=(0,b.useNavigator)(),n=(0,c.useSelect)((e=>ne(e(Rt)).getEditorCanvasContainerView()),[]),s=t?.path,i="/revisions"===s;(0,h.useEffect)((()=>{switch(n){case"global-styles-revisions":case"global-styles-revisions:style-book":i||e("/revisions");break;case"global-styles-css":e("/css");break;default:i&&e("/",{isBack:!0})}}),[n,i,e])}function Gg({path:e,onPathChange:t,children:n}){return function(e,t){const n=(0,b.useNavigator)(),{path:s}=n.location,i=(0,y.usePrevious)(e),r=(0,y.usePrevious)(s);(0,h.useEffect)((()=>{e!==s&&(e!==i?n.goTo(e):s!==r&&t(s))}),[t,e,r,i,s,n])}(e,t),n}var Wg=function({path:e,onPathChange:t}){const n=(0,o.getBlockTypes)(),s=(0,c.useSelect)((e=>ne(e(Rt)).getEditorCanvasContainerView()),[]);return(0,a.jsxs)(b.Navigator,{className:"edit-site-global-styles-sidebar__navigator-provider",initialPath:"/",children:[e&&t&&(0,a.jsx)(Gg,{path:e,onPathChange:t}),(0,a.jsx)(Bg,{path:"/",children:(0,a.jsx)(fl,{})}),(0,a.jsx)(Bg,{path:"/variations",children:(0,a.jsx)(Om,{})}),(0,a.jsx)(Bg,{path:"/blocks",children:(0,a.jsx)(Il,{})}),(0,a.jsx)(Bg,{path:"/typography",children:(0,a.jsx)(Yp,{})}),(0,a.jsx)(Bg,{path:"/typography/font-sizes",children:(0,a.jsx)(xf,{})}),(0,a.jsx)(Bg,{path:"/typography/font-sizes/:origin/:slug",children:(0,a.jsx)(pf,{})}),(0,a.jsx)(Bg,{path:"/typography/text",children:(0,a.jsx)(sf,{element:"text"})}),(0,a.jsx)(Bg,{path:"/typography/link",children:(0,a.jsx)(sf,{element:"link"})}),(0,a.jsx)(Bg,{path:"/typography/heading",children:(0,a.jsx)(sf,{element:"heading"})}),(0,a.jsx)(Bg,{path:"/typography/caption",children:(0,a.jsx)(sf,{element:"caption"})}),(0,a.jsx)(Bg,{path:"/typography/button",children:(0,a.jsx)(sf,{element:"button"})}),(0,a.jsx)(Bg,{path:"/colors",children:(0,a.jsx)(Pf,{})}),(0,a.jsx)(Bg,{path:"/shadows",children:(0,a.jsx)(mm,{})}),(0,a.jsx)(Bg,{path:"/shadows/edit/:category/:slug",children:(0,a.jsx)(gm,{})}),(0,a.jsx)(Bg,{path:"/layout",children:(0,a.jsx)(km,{})}),(0,a.jsx)(Bg,{path:"/css",children:(0,a.jsx)(vg,{})}),(0,a.jsx)(Bg,{path:"/revisions",children:(0,a.jsx)(Tg,{})}),(0,a.jsx)(Bg,{path:"/background",children:(0,a.jsx)(Xf,{})}),n.map((e=>(0,a.jsx)(Bg,{path:"/blocks/"+encodeURIComponent(e.name),children:(0,a.jsx)(Jl,{name:e.name})},"menu-block-"+e.name))),(0,a.jsx)(Rg,{}),n.map((e=>(0,a.jsx)(Rg,{name:e.name,parentMenu:"/blocks/"+encodeURIComponent(e.name)},"screens-block-"+e.name))),"style-book"===s&&(0,a.jsx)(Lg,{}),(0,a.jsx)(Mg,{}),(0,a.jsx)(zg,{}),(0,a.jsx)(Hg,{})]})};const{ComplementaryArea:Ug,ComplementaryAreaMoreMenuItem:qg}=ne(f.privateApis);function Zg({className:e,identifier:t,title:n,icon:s,children:i,closeLabel:r,header:o,headerClassName:l,panelClassName:c,isActiveByDefault:u}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Ug,{className:e,scope:"core",identifier:t,title:n,icon:s,closeLabel:r,header:o,headerClassName:l,panelClassName:c,isActiveByDefault:u,children:i}),(0,a.jsx)(qg,{scope:"core",identifier:t,icon:s,children:n})]})}const{interfaceStore:Yg}=ne(f.privateApis),{useLocation:Kg}=ne(Lt.privateApis);function Xg(){const{query:e}=Kg(),{canvas:t="view",name:n}=e,{shouldClearCanvasContainerView:s,isStyleBookOpened:i,showListViewByDefault:r,hasRevisions:o,isRevisionsOpened:l,isRevisionsStyleBookOpened:u}=(0,c.useSelect)((e=>{const{getActiveComplementaryArea:n}=e(Yg),{getEditorCanvasContainerView:s}=ne(e(Rt)),i=s(),r="visual"===e(f.store).getEditorMode(),a="edit"===t,o=e(m.store).get("core","showListViewByDefault"),{getEntityRecord:l,__experimentalGetCurrentGlobalStylesId:c}=e(j.store),u=c(),d=u?l("root","globalStyles",u):void 0;return{isStyleBookOpened:"style-book"===i,shouldClearCanvasContainerView:"edit-site/global-styles"!==n("core")||!r||!a,showListViewByDefault:o,hasRevisions:!!d?._links?.["version-history"]?.[0]?.count,isRevisionsStyleBookOpened:"global-styles-revisions:style-book"===i,isRevisionsOpened:"global-styles-revisions"===i}}),[t]),{setEditorCanvasContainerView:d}=ne((0,c.useDispatch)(Rt)),p=(0,y.useViewportMatch)("medium","<");(0,h.useEffect)((()=>{s&&d(void 0)}),[s,d]);const{setIsListViewOpened:g}=(0,c.useDispatch)(f.store),{getActiveComplementaryArea:v}=(0,c.useSelect)(Yg),{enableComplementaryArea:x}=(0,c.useDispatch)(Yg),_=(0,h.useRef)(null);return(0,h.useEffect)((()=>{"styles"===n&&"edit"===t?(_.current=v("core"),x("core","edit-site/global-styles")):_.current&&x("core",_.current)}),[n,x,t,v]),(0,a.jsx)(Zg,{className:"edit-site-global-styles-sidebar",identifier:"edit-site/global-styles",title:(0,w.__)("Styles"),icon:Fa,closeLabel:(0,w.__)("Close Styles"),panelClassName:"edit-site-global-styles-sidebar__panel",header:(0,a.jsxs)(b.Flex,{className:"edit-site-global-styles-sidebar__header",gap:1,children:[(0,a.jsx)(b.FlexItem,{children:(0,a.jsx)("h2",{className:"edit-site-global-styles-sidebar__header-title",children:(0,w.__)("Styles")})}),(0,a.jsxs)(b.Flex,{justify:"flex-end",gap:1,className:"edit-site-global-styles-sidebar__header-actions",children:[!p&&(0,a.jsx)(b.FlexItem,{children:(0,a.jsx)(b.Button,{icon:Ao,label:(0,w.__)("Style Book"),isPressed:i||u,accessibleWhenDisabled:!0,disabled:s,onClick:()=>{l?d("global-styles-revisions:style-book"):u?d("global-styles-revisions"):(g(i&&r),d(i?void 0:"style-book"))},size:"compact"})}),(0,a.jsx)(b.FlexItem,{children:(0,a.jsx)(b.Button,{label:(0,w.__)("Revisions"),icon:ba,onClick:()=>{g(!1),d(u?"style-book":l?void 0:i?"global-styles-revisions:style-book":"global-styles-revisions")},accessibleWhenDisabled:!0,disabled:!o,isPressed:l||u,size:"compact"})}),(0,a.jsx)(Ng,{})]})]}),children:(0,a.jsx)(Wg,{})})}var Qg=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})});const Jg=window.wp.blob;function $g(){const e=(0,c.useSelect)((e=>{const t=e(j.store).getCurrentTheme()?._links?.["wp:export-theme"]?.[0]?.targetHints??{};return!!t.allow?.includes("GET")}),[]),{createErrorNotice:t}=(0,c.useDispatch)(_.store);if(!e)return null;return(0,a.jsx)(b.MenuItem,{role:"menuitem",icon:Qg,onClick:async function(){try{const e=await ra()({path:"/wp-block-editor/v1/export",parse:!1,headers:{Accept:"application/zip"}}),t=await e.blob(),n=e.headers.get("content-disposition").match(/=(.+)\.zip/),s=n[1]?n[1]:"edit-site-export";(0,Jg.downloadBlob)(s+".zip",t,"application/zip")}catch(e){let n={};try{n=await e.json()}catch(e){}const s=n.message&&"unknown_error"!==n.code?n.message:(0,w.__)("An error occurred while creating the site export.");t(s,{type:"snackbar"})}},info:(0,w.__)("Download your theme with updated templates and styles."),children:(0,w._x)("Export","site exporter menu item")})}function ev(){const{toggle:e}=(0,c.useDispatch)(m.store);return(0,a.jsx)(b.MenuItem,{onClick:()=>e("core/edit-site","welcomeGuide"),children:(0,w.__)("Welcome Guide")})}const{ToolsMoreMenuGroup:tv,PreferencesModal:nv}=ne(f.privateApis);function sv(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(tv,{children:[(0,a.jsx)($g,{}),(0,a.jsx)(ev,{})]}),(0,a.jsx)(nv,{})]})}const{useLocation:iv,useHistory:rv}=ne(Lt.privateApis);const{useLocation:av}=ne(Lt.privateApis);const{getTemplateInfo:ov}=ne(f.privateApis);var lv=function(e,t){const{title:n,isLoaded:s}=(0,c.useSelect)((n=>{const{getEditedEntityRecord:s,getCurrentTheme:i,hasFinishedResolution:r}=n(j.store);if(!t)return{isLoaded:!1};const a=s("postType",e,t),{default_template_types:o=[]}=i()??{},l=ov({template:a,templateTypes:o}),c=r("getEditedEntityRecord",["postType",e,t]);return{title:l.title,isLoaded:c}}),[e,t]);let i;s&&(i=(0,w.sprintf)((0,w._x)("%1$s ‹ %2$s","breadcrumb trail"),(0,qt.decodeEntities)(n),Fe[e]??Fe[Se])),function(e){const t=av(),n=(0,c.useSelect)((e=>e(j.store).getEntityRecord("root","site")?.title),[]),s=(0,h.useRef)(!0);(0,h.useEffect)((()=>{s.current=!1}),[t]),(0,h.useEffect)((()=>{if(!s.current&&e&&n){const t=(0,w.sprintf)((0,w.__)("%1$s ‹ %2$s ‹ Editor — WordPress"),(0,qt.decodeEntities)(e),(0,qt.decodeEntities)(n));document.title=t,(0,ml.speak)(e,"assertive")}}),[e,n,t])}(s&&i)};const{useLocation:cv}=ne(Lt.privateApis),uv=[Se,Ce,je,Ie.user],dv=["page","post"];function hv(){const e=(0,c.useSelect)((e=>{const{getEntityRecord:t}=e(j.store),n=t("root","__unstableBase");return n?.home}),[]);return(0,a.jsx)("iframe",{src:(0,Qt.addQueryArgs)(e,{wp_site_preview:1}),title:(0,w.__)("Site Preview"),style:{display:"block",width:"100%",height:"100%",backgroundColor:"#fff"},onLoad:e=>{const t=e.target.contentDocument;en.focus.focusable.find(t).forEach((e=>{e.style.pointerEvents="none",e.tabIndex=-1,e.setAttribute("aria-hidden","true")}))}})}const{Editor:pv,BackButton:fv}=ne(f.privateApis),{useHistory:mv,useLocation:gv}=ne(Lt.privateApis),{BlockKeyboardShortcuts:vv}=ne(l.privateApis),yv={edit:{opacity:0,scale:.2},hover:{opacity:1,scale:1,clipPath:"inset( 22% round 2px )"}},xv={edit:{clipPath:"inset(0% round 0px)"},hover:{clipPath:"inset( 22% round 2px )"},tap:{clipPath:"inset(0% round 0px)"}};function bv(e){switch(e){case"navigation":return"/navigation";case"wp_block":return"/pattern?postType=wp_block";case"wp_template_part":return"/pattern?postType=wp_template_part";case"wp_template":return"/template";case"page":return"/page";case"post":return"/"}throw"Unknown post type"}function wv({isHomeRoute:e=!1,isPostsList:t=!1}){const n=(0,y.useReducedMotion)(),s=gv(),{canvas:i="view"}=s.query,r=Sn();!function(e){const{clearSelectedBlock:t}=(0,c.useDispatch)(x.store),{setDeviceType:n,closePublishSidebar:s,setIsListViewOpened:i,setIsInserterOpened:r}=(0,c.useDispatch)(f.store),{get:a}=(0,c.useSelect)(m.store),o=(0,c.useRegistry)();(0,h.useLayoutEffect)((()=>{const l=window.matchMedia("(min-width: 782px)").matches;o.batch((()=>{t(),n("Desktop"),s(),r(!1),l&&"edit"===e&&a("core","showListViewByDefault")&&!a("core","distractionFree")?i(!0):i(!1)}))}),[e,o,t,n,s,r,i,a])}(i);const o=function(){const{name:e,params:t={},query:n}=cv(),{postId:s=n?.postId}=t;let i;"navigation-item"===e?i=je:"pattern-item"===e?i=Ie.user:"template-part-item"===e?i=Ce:"template-item"===e||"templates"===e?i=Se:"page-item"===e||"pages"===e?i="page":"post-item"!==e&&"posts"!==e||(i="post");const r=(0,c.useSelect)((e=>{const{getHomePage:t}=ne(e(j.store));return t()}),[]),a=(0,c.useSelect)((e=>{if(uv.includes(i)&&s)return;if(s&&s.includes(","))return;const{getTemplateId:t}=ne(e(j.store));return i&&s&&dv.includes(i)?t(i,s):"page"===r?.postType?t("page",r?.postId):"wp_template"===r?.postType?r?.postId:void 0}),[r,s,i]),o=(0,h.useMemo)((()=>uv.includes(i)&&s?{}:i&&s&&dv.includes(i)?{postType:i,postId:s}:"page"===r?.postType?{postType:"page",postId:r?.postId}:{}),[r,i,s]);return uv.includes(i)&&s?{isReady:!0,postType:i,postId:s,context:o}:r?{isReady:void 0!==a,postType:Se,postId:a,context:o}:{isReady:!1}}();!function({postType:e,postId:t,context:n,isReady:s}){const{setEditedEntity:i}=(0,c.useDispatch)(Rt);(0,h.useEffect)((()=>{s&&i(e,t,n)}),[s,e,t,n,i])}(o);const{postType:l,postId:u,context:d}=o,{isBlockBasedTheme:p,editorCanvasView:g,currentPostIsTrashed:v,hasSiteIcon:S}=(0,c.useSelect)((e=>{const{getEditorCanvasContainerView:t}=ne(e(Rt)),{getCurrentTheme:n,getEntityRecord:s}=e(j.store),i=s("root","__unstableBase",void 0);return{isBlockBasedTheme:n()?.is_block_theme,editorCanvasView:t(),currentPostIsTrashed:"trash"===e(f.store).getCurrentPostAttribute("status"),hasSiteIcon:!!i?.site_icon_url}}),[]),C=!!d?.postId;lv(C?d.postType:l,C?d.postId:u);const k=Qr(),E=!Oa(),P=function(){const{query:e,path:t}=iv(),n=rv(),{canvas:s="view"}=e,i=(0,c.useSelect)((e=>"trash"===e(f.store).getCurrentPostAttribute("status")),[]),[r,a]=(0,h.useState)(!1);(0,h.useEffect)((()=>{"edit"===s&&a(!1)}),[s]);const o={"aria-label":(0,w.__)("Edit"),"aria-disabled":i,title:null,role:"button",tabIndex:0,onFocus:()=>a(!0),onBlur:()=>a(!1),onKeyDown:e=>{const{keyCode:s}=e;s!==Xt.ENTER&&s!==Xt.SPACE||i||(e.preventDefault(),n.navigate((0,Qt.addQueryArgs)(t,{canvas:"edit"}),{transition:"canvas-mode-edit-transition"}))},onClick:()=>n.navigate((0,Qt.addQueryArgs)(t,{canvas:"edit"}),{transition:"canvas-mode-edit-transition"}),onClickCapture:e=>{i&&(e.preventDefault(),e.stopPropagation())},readonly:!0};return{className:Ht("edit-site-visual-editor__editor-canvas",{"is-focused":r&&"view"===s}),..."view"===s?o:{}}}(),I="edit"===i,V=(0,y.useInstanceId)(So,"edit-site-editor__loading-progress"),O=Po(),T=(0,h.useMemo)((()=>[...O.styles,{css:"view"===i?`body{min-height: 100vh; ${v?"":"cursor: pointer;"}}`:void 0}]),[O.styles,i,v]),{resetZoomLevel:A}=ne((0,c.useDispatch)(x.store)),{createSuccessNotice:N}=(0,c.useDispatch)(_.store),F=mv(),M=(0,h.useCallback)(((e,t)=>{switch(e){case"move-to-trash":case"delete-post":F.navigate(bv(C?d.postType:l));break;case"duplicate-post":{const e=t[0],n="string"==typeof e.title?e.title:e.title?.rendered;N((0,w.sprintf)((0,w.__)('"%s" successfully created.'),(0,qt.decodeEntities)(n)||(0,w.__)("(no title)")),{type:"snackbar",id:"duplicate-post-action",actions:[{label:(0,w.__)("Edit"),onClick:()=>{F.navigate(`/${e.type}/${e.id}?canvas=edit`)}}]})}}}),[l,d?.postType,C,F,N]),B=Va(g),D=!r,R={duration:n?0:.2};return!p&&e?(0,a.jsx)(hv,{}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(wo,{disableRootPadding:l!==Se}),(0,a.jsx)(f.EditorKeyboardShortcutsRegister,{}),I&&(0,a.jsx)(vv,{}),D?null:(0,a.jsx)(So,{id:V}),I&&(0,a.jsx)(xo,{postType:C?d.postType:l}),D&&(0,a.jsxs)(pv,{postType:C?d.postType:l,postId:C?d.postId:u,templateId:C?u:void 0,settings:O,className:"edit-site-editor__editor-interface",styles:T,customSaveButton:k&&(0,a.jsx)(ea,{size:"compact"}),customSavePanel:k&&(0,a.jsx)(ua,{}),forceDisableBlockTools:!E,title:B,iframeProps:P,onActionPerformed:M,extraSidebarPanels:!C&&(0,a.jsx)(To.Slot,{}),children:[I&&(0,a.jsx)(fv,{children:({length:e})=>e<=1&&(0,a.jsxs)(b.__unstableMotion.div,{className:"edit-site-editor__view-mode-toggle",transition:R,animate:"edit",initial:"edit",whileHover:"hover",whileTap:"tap",children:[(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,label:(0,w.__)("Open Navigation"),showTooltip:!0,tooltipPosition:"middle right",onClick:()=>{A(),t&&s.query?.focusMode?F.navigate("/",{transition:"canvas-mode-view-transition"}):F.navigate(function(e,t){const{path:n,name:s}=e;return["pattern-item","template-part-item","page-item","template-item","post-item"].includes(s)?bv(t):(0,Qt.addQueryArgs)(n,{canvas:void 0})}(s,C?d.postType:l),{transition:"canvas-mode-view-transition"})},children:(0,a.jsx)(b.__unstableMotion.div,{variants:xv,children:(0,a.jsx)($t,{className:"edit-site-editor__view-mode-toggle-icon"})})}),(0,a.jsx)(b.__unstableMotion.div,{className:Ht("edit-site-editor__back-icon",{"has-site-icon":S}),variants:yv,children:(0,a.jsx)(qa,{icon:ho})})]})}),(0,a.jsx)(sv,{}),p&&(0,a.jsx)(Xg,{})]})]})}function _v(e){const t=e.currentTheme?.is_block_theme,n=e.currentTheme?.theme_supports["editor-styles"],s=e.editorSettings?.supportsLayout;return!t&&(n||s)}const jv={name:"home",path:"/",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t||_v(e)?(0,a.jsx)(co,{}):(0,a.jsx)(uo,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t||_v(e)?(0,a.jsx)(wv,{isHomeRoute:!0}):void 0},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t||_v(e)?(0,a.jsx)(co,{}):(0,a.jsx)(uo,{})}}},{useLocation:Sv}=ne(Lt.privateApis);function Cv(){const{query:e={}}=Sv(),{canvas:t}=e;return"edit"===t?(0,a.jsx)(wv,{}):(0,a.jsx)(Km,{})}const kv={name:"styles",path:"/styles",areas:{content:(0,a.jsx)(Km,{}),sidebar:(0,a.jsx)(oo,{backPath:"/"}),preview:({query:e})=>"stylebook"===e.preview?(0,a.jsx)(lg,{}):(0,a.jsx)(wv,{}),mobile:(0,a.jsx)(Cv,{})},widths:{content:380}},Ev={per_page:100,status:["publish","draft"],order:"desc",orderby:"date"};function Pv({menuTitle:e,onClose:t,onSave:n}){const[s,i]=(0,h.useState)(e),r=s!==e&&(o=s,o?.trim()?.length>0);var o;return(0,a.jsx)(b.Modal,{title:(0,w.__)("Rename"),onRequestClose:t,focusOnMount:"firstContentElement",size:"small",children:(0,a.jsx)("form",{className:"sidebar-navigation__rename-modal-form",children:(0,a.jsxs)(b.__experimentalVStack,{spacing:"3",children:[(0,a.jsx)(b.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:s,placeholder:(0,w.__)("Navigation title"),onChange:i,label:(0,w.__)("Name")}),(0,a.jsxs)(b.__experimentalHStack,{justify:"right",children:[(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,children:(0,w.__)("Cancel")}),(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,accessibleWhenDisabled:!0,disabled:!r,variant:"primary",type:"submit",onClick:e=>{e.preventDefault(),r&&(n({title:s}),t())},children:(0,w.__)("Save")})]})]})})})}function Iv({onClose:e,onConfirm:t}){return(0,a.jsx)(b.__experimentalConfirmDialog,{isOpen:!0,onConfirm:()=>{t(),e()},onCancel:e,confirmButtonText:(0,w.__)("Delete"),size:"medium",children:(0,w.__)("Are you sure you want to delete this Navigation Menu?")})}const{useHistory:Vv}=ne(Lt.privateApis),Ov={position:"bottom right"};function Tv(e){const{onDelete:t,onSave:n,onDuplicate:s,menuTitle:i,menuId:r}=e,[o,l]=(0,h.useState)(!1),[c,u]=(0,h.useState)(!1),d=Vv(),p=()=>{l(!1),u(!1)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.DropdownMenu,{className:"sidebar-navigation__more-menu",label:(0,w.__)("Actions"),icon:No,popoverProps:Ov,children:({onClose:e})=>(0,a.jsxs)(b.MenuGroup,{children:[(0,a.jsx)(b.MenuItem,{onClick:()=>{l(!0),e()},children:(0,w.__)("Rename")}),(0,a.jsx)(b.MenuItem,{onClick:()=>{d.navigate(`/wp_navigation/${r}?canvas=edit`)},children:(0,w.__)("Edit")}),(0,a.jsx)(b.MenuItem,{onClick:()=>{s(),e()},children:(0,w.__)("Duplicate")}),(0,a.jsx)(b.MenuItem,{isDestructive:!0,onClick:()=>{u(!0),e()},children:(0,w.__)("Delete")})]})}),c&&(0,a.jsx)(Iv,{onClose:p,onConfirm:t}),o&&(0,a.jsx)(Pv,{onClose:p,menuTitle:i,onSave:n})]})}var Av=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})}),Nv=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})});const Fv={className:"block-editor-block-settings-menu__popover",placement:"bottom-start"},{useHistory:Mv,useLocation:Bv}=ne(Lt.privateApis);function Dv(e){const t=Mv(),{path:n}=Bv(),{block:s}=e,{clientId:i}=s,{moveBlocksDown:r,moveBlocksUp:o,removeBlocks:l}=(0,c.useDispatch)(x.store),u=(0,w.sprintf)((0,w.__)("Remove %s"),(0,x.BlockTitle)({clientId:i,maximumLength:25})),d=(0,w.sprintf)((0,w.__)("Go to %s"),(0,x.BlockTitle)({clientId:i,maximumLength:25})),p=(0,c.useSelect)((e=>{const{getBlockRootClientId:t}=e(x.store);return t(i)}),[i]),f=(0,h.useCallback)((e=>{const{attributes:s,name:i}=e;"post-type"===s.kind&&s.id&&s.type&&t&&t.navigate(`/${s.type}/${s.id}?canvas=edit`,{state:{backPath:n}}),"core/page-list-item"===i&&s.id&&t&&t.navigate(`/page/${s.id}?canvas=edit`,{state:{backPath:n}})}),[n,t]);return(0,a.jsx)(b.DropdownMenu,{icon:No,label:(0,w.__)("Options"),className:"block-editor-block-settings-menu",popoverProps:Fv,noIcons:!0,...e,children:({onClose:e})=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(b.MenuGroup,{children:[(0,a.jsx)(b.MenuItem,{icon:Av,onClick:()=>{o([i],p),e()},children:(0,w.__)("Move up")}),(0,a.jsx)(b.MenuItem,{icon:Nv,onClick:()=>{r([i],p),e()},children:(0,w.__)("Move down")}),"page"===s.attributes?.type&&s.attributes?.id&&(0,a.jsx)(b.MenuItem,{onClick:()=>{f(s),e()},children:d})]}),(0,a.jsx)(b.MenuGroup,{children:(0,a.jsx)(b.MenuItem,{onClick:()=>{l([i],!1),e()},children:u})})]})})}const{PrivateListView:Rv}=ne(x.privateApis),Lv=["postType","page",{per_page:100,_fields:["id","link","menu_order","parent","title","type"],orderby:"menu_order",order:"asc"}];function zv({rootClientId:e}){const{listViewRootClientId:t,isLoading:n}=(0,c.useSelect)((t=>{const{areInnerBlocksControlled:n,getBlockName:s,getBlockCount:i,getBlockOrder:r}=t(x.store),{isResolving:a}=t(j.store),o=r(e),l=1===o.length&&"core/page-list"===s(o[0])&&i(o[0])>0,c=a("getEntityRecords",Lv);return{listViewRootClientId:l?o[0]:e,isLoading:!n(e)||c}}),[e]),{replaceBlock:s,__unstableMarkNextChangeAsNotPersistent:i}=(0,c.useDispatch)(x.store),r=(0,h.useCallback)((e=>{"core/navigation-link"!==e.name||e.attributes.url||(i(),s(e.clientId,(0,o.createBlock)("core/navigation-link",e.attributes)))}),[i,s]);return(0,a.jsxs)(a.Fragment,{children:[!n&&(0,a.jsx)(Rv,{rootClientId:t,onSelect:r,blockSettingsMenu:Dv,showAppender:!1,isExpanded:!0}),(0,a.jsx)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor",children:(0,a.jsx)(x.BlockList,{})})]})}const Hv=()=>{};function Gv({navigationMenuId:e}){const{storedSettings:t}=(0,c.useSelect)((e=>{const{getSettings:t}=ne(e(Rt));return{storedSettings:t()}}),[]),n=(0,h.useMemo)((()=>e?[(0,o.createBlock)("core/navigation",{ref:e})]:[]),[e]);return e&&n?.length?(0,a.jsx)(x.BlockEditorProvider,{settings:t,value:n,onChange:Hv,onInput:Hv,children:(0,a.jsx)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__content",children:(0,a.jsx)(zv,{rootClientId:n[0].clientId})})}):null}function Wv(e,t,n){return e?.rendered?"publish"===n?(0,qt.decodeEntities)(e?.rendered):(0,w.sprintf)((0,w._x)("%1$s (%2$s)","menu label"),(0,qt.decodeEntities)(e?.rendered),n):(0,w.sprintf)((0,w.__)("(no title %s)"),t)}function Uv({navigationMenu:e,backPath:t,handleDelete:n,handleDuplicate:s,handleSave:i}){const r=e?.title?.rendered;return(0,a.jsx)(ny,{actions:(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(Tv,{menuId:e?.id,menuTitle:(0,qt.decodeEntities)(r),onDelete:n,onSave:i,onDuplicate:s})}),backPath:t,title:Wv(e?.title,e?.id,e?.status),description:(0,w.__)("Navigation Menus are a curated collection of blocks that allow visitors to get around your site."),children:(0,a.jsx)(Gv,{navigationMenuId:e?.id})})}const{useLocation:qv}=ne(Lt.privateApis),Zv="wp_navigation";function Yv({backPath:e}){const{params:{postId:t}}=qv(),{record:n,isResolving:s}=(0,j.useEntityRecord)("postType",Zv,t),{isSaving:i,isDeleting:r}=(0,c.useSelect)((e=>{const{isSavingEntityRecord:n,isDeletingEntityRecord:s}=e(j.store);return{isSaving:n("postType",Zv,t),isDeleting:s("postType",Zv,t)}}),[t]),o=s||i||r,l=n?.title?.rendered||n?.slug,{handleSave:u,handleDelete:d,handleDuplicate:h}=$v(),p=()=>d(n),f=e=>u(n,e),m=()=>h(n);return o?(0,a.jsx)(ny,{description:(0,w.__)("Navigation Menus are a curated collection of blocks that allow visitors to get around your site."),backPath:e,children:(0,a.jsx)(b.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})}):o||n?n?.content?.raw?(0,a.jsx)(Uv,{navigationMenu:n,backPath:e,handleDelete:p,handleSave:f,handleDuplicate:m}):(0,a.jsx)(ny,{actions:(0,a.jsx)(Tv,{menuId:n?.id,menuTitle:(0,qt.decodeEntities)(l),onDelete:p,onSave:f,onDuplicate:m}),backPath:e,title:Wv(n?.title,n?.id,n?.status),description:(0,w.__)("This Navigation Menu is empty.")}):(0,a.jsx)(ny,{description:(0,w.__)("Navigation Menu missing."),backPath:e})}const{useHistory:Kv}=ne(Lt.privateApis);function Xv(){const{deleteEntityRecord:e}=(0,c.useDispatch)(j.store),{createSuccessNotice:t,createErrorNotice:n}=(0,c.useDispatch)(_.store),s=Kv();return async i=>{const r=i?.id;try{await e("postType",Zv,r,{force:!0},{throwOnError:!0}),t((0,w.__)("Navigation Menu successfully deleted."),{type:"snackbar"}),s.navigate("/navigation")}catch(e){n((0,w.sprintf)((0,w.__)("Unable to delete Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function Qv(){const{getEditedEntityRecord:e}=(0,c.useSelect)((e=>{const{getEditedEntityRecord:t}=e(j.store);return{getEditedEntityRecord:t}}),[]),{editEntityRecord:t,__experimentalSaveSpecifiedEntityEdits:n}=(0,c.useDispatch)(j.store),{createSuccessNotice:s,createErrorNotice:i}=(0,c.useDispatch)(_.store);return async(r,a)=>{if(!a)return;const o=r?.id,l=e("postType",je,o);t("postType",Zv,o,a);const c=Object.keys(a);try{await n("postType",Zv,o,c,{throwOnError:!0}),s((0,w.__)("Renamed Navigation Menu"),{type:"snackbar"})}catch(e){t("postType",Zv,o,l),i((0,w.sprintf)((0,w.__)("Unable to rename Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function Jv(){const e=Kv(),{saveEntityRecord:t}=(0,c.useDispatch)(j.store),{createSuccessNotice:n,createErrorNotice:s}=(0,c.useDispatch)(_.store);return async i=>{const r=i?.title?.rendered||i?.slug;try{const s=await t("postType",Zv,{title:(0,w.sprintf)((0,w._x)("%s (Copy)","navigation menu"),r),content:i?.content?.raw,status:"publish"},{throwOnError:!0});s&&(n((0,w.__)("Duplicated Navigation Menu"),{type:"snackbar"}),e.navigate(`/wp_navigation/${s.id}`))}catch(e){s((0,w.sprintf)((0,w.__)("Unable to duplicate Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function $v(){return{handleDelete:Xv(),handleSave:Qv(),handleDuplicate:Jv()}}function ey(e,t,n){return e?"publish"===n?(0,qt.decodeEntities)(e):(0,w.sprintf)((0,w._x)("%1$s (%2$s)","menu label"),(0,qt.decodeEntities)(e),n):(0,w.sprintf)((0,w.__)("(no title %s)"),t)}function ty({backPath:e}){const{records:t,isResolving:n,hasResolved:s}=(0,j.useEntityRecords)("postType",je,Ev),i=n&&!s,{getNavigationFallbackId:r}=ne((0,c.useSelect)(j.store)),o=(0,c.useSelect)((e=>e(j.store).isResolving("getNavigationFallbackId")),[]),l=t?.[0];l||n||!s||o||r();const{handleSave:u,handleDelete:d,handleDuplicate:h}=$v(),p=!!t?.length;return i?(0,a.jsx)(ny,{backPath:e,children:(0,a.jsx)(b.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})}):i||p?1===t?.length?(0,a.jsx)(Uv,{navigationMenu:l,backPath:e,handleDelete:()=>d(l),handleDuplicate:()=>h(l),handleSave:e=>u(l,e)}):(0,a.jsx)(ny,{backPath:e,children:(0,a.jsx)(b.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-navigation-menus",children:t?.map((({id:e,title:t,status:n},s)=>(0,a.jsx)(sy,{postId:e,withChevron:!0,icon:Ma,children:ey(t?.rendered,s+1,n)},e)))})}):(0,a.jsx)(ny,{description:(0,w.__)("No Navigation Menus found."),backPath:e})}function ny({children:e,actions:t,title:n,description:s,backPath:i}){return(0,a.jsx)(Ua,{title:n||(0,w.__)("Navigation"),actions:t,description:s||(0,w.__)("Manage your Navigation Menus."),backPath:i,content:e})}const sy=({postId:e,...t})=>(0,a.jsx)(Qa,{to:`/wp_navigation/${e}`,...t}),{useLocation:iy}=ne(Lt.privateApis);function ry(){const{query:e={}}=iy(),{canvas:t="view"}=e;return"edit"===t?(0,a.jsx)(wv,{}):(0,a.jsx)(ty,{backPath:"/"})}const ay={name:"navigation",path:"/navigation",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(ty,{backPath:"/"}):(0,a.jsx)(uo,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(wv,{}):void 0},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(ry,{}):(0,a.jsx)(uo,{})}}},{useLocation:oy}=ne(Lt.privateApis);function ly(){const{query:e={}}=oy(),{canvas:t="view"}=e;return"edit"===t?(0,a.jsx)(wv,{}):(0,a.jsx)(Yv,{backPath:"/navigation"})}const cy={name:"navigation-item",path:"/wp_navigation/:postId",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(Yv,{backPath:"/navigation"}):(0,a.jsx)(uo,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(wv,{}):(0,a.jsx)(uo,{})},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(ly,{}):(0,a.jsx)(uo,{})}}};var uy=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})});function dy({count:e,icon:t,id:n,isActive:s,label:i,type:r}){if(!e)return;const o=[`postType=${r}`];return n&&o.push(`categoryId=${n}`),(0,a.jsx)(Qa,{icon:t,suffix:(0,a.jsx)("span",{children:e}),"aria-current":s?"true":void 0,to:`/pattern?${o.join("&")}`,children:i})}const hy=(e,t,n)=>t===n.findIndex((t=>e.name===t.name));const{extractWords:py,getNormalizedSearchTerms:fy,normalizeString:my}=ne(x.privateApis),gy=e=>e.type===Ie.user?e.slug:e.type===Ce?"":e.name||"",vy=e=>"string"==typeof e.title?e.title:e.title&&e.title.rendered?e.title.rendered:e.title&&e.title.raw?e.title.raw:"",yy=e=>e.type===Ie.user?e.excerpt.raw:e.description||"",xy=e=>e.keywords||[],by=()=>!1,wy=(e=[],t="",n={})=>{const s=fy(t),i=n.categoryId!==Ve&&!s.length,r={...n,onlyFilterByCategory:i},a=i?0:1,o=e.map((e=>[e,_y(e,t,r)])).filter((([,e])=>e>a));return 0===s.length||o.sort((([,e],[,t])=>t-e)),o.map((([e])=>e))};function _y(e,t,n){const{categoryId:s,getName:i=gy,getTitle:r=vy,getDescription:a=yy,getKeywords:o=xy,hasCategory:l=by,onlyFilterByCategory:c}=n;let u=s===Ve||s===Pe||s===Oe&&e.type===Ie.user||l(e,s)?1:0;if(!u||c)return u;const d=i(e),h=r(e),p=a(e),f=o(e),m=my(t),g=my(h);if(m===g)u+=30;else if(g.startsWith(m))u+=20;else{const e=[d,h,p,...f].join(" ");0===((e,t)=>e.filter((e=>!fy(t).some((t=>t.includes(e))))))(py(m),e).length&&(u+=10)}return u}const jy=[],Sy=(0,c.createSelector)(((e,t,n="")=>{const{getEntityRecords:s,getCurrentTheme:i,isResolving:r}=e(j.store),a={per_page:-1},o=s("postType",Ce,a)??jy,l=(i()?.default_template_part_areas||[]).map((e=>e.area)),c=r("getEntityRecords",["postType",Ce,a]);return{patterns:wy(o,n,{categoryId:t,hasCategory:(e,t)=>t!==Ee?e.area===t:e.area===t||!l.includes(e.area)}),isResolving:c}}),(e=>[e(j.store).getEntityRecords("postType",Ce,{per_page:-1}),e(j.store).isResolving("getEntityRecords",["postType",Ce,{per_page:-1}]),e(j.store).getCurrentTheme()?.default_template_part_areas])),Cy=(0,c.createSelector)((e=>{const{getSettings:t}=ne(e(Rt)),{isResolving:n}=e(j.store),s=t();return{patterns:[...(s.__experimentalAdditionalBlockPatterns??s.__experimentalBlockPatterns)||[],...e(j.store).getBlockPatterns()||[]].filter((e=>!Te.includes(e.source))).filter(hy).filter((e=>!1!==e.inserter)).map((e=>({...e,keywords:e.keywords||[],type:Ie.theme,blocks:(0,o.parse)(e.content,{__unstableSkipMigrationLogs:!0})}))),isResolving:n("getBlockPatterns")}}),(e=>[e(j.store).getBlockPatterns(),e(j.store).isResolving("getBlockPatterns"),ne(e(Rt)).getSettings()])),ky=(0,c.createSelector)(((e,t,n,s="")=>{const{patterns:i,isResolving:r}=Cy(e),{patterns:a,isResolving:o,categories:l}=Ey(e);let c=[...i||[],...a||[]];return n&&(c=c.filter((e=>e.type===Ie.user?(e.wp_pattern_sync_status||Ae.full)===n:n===Ae.unsynced))),c=wy(c,s,t?{categoryId:t,hasCategory:(e,t)=>e.type===Ie.user?e.wp_pattern_category?.some((e=>l.find((t=>t.id===e))?.slug===t)):e.categories?.includes(t)}:{hasCategory:e=>e.type===Ie.user?l?.length&&(!e.wp_pattern_category?.length||!e.wp_pattern_category?.some((e=>l.find((t=>t.id===e))))):!e.hasOwnProperty("categories")}),{patterns:c,isResolving:r||o}}),(e=>[Cy(e),Ey(e)])),Ey=(0,c.createSelector)(((e,t,n="")=>{const{getEntityRecords:s,isResolving:i,getUserPatternCategories:r}=e(j.store),a={per_page:-1},o=s("postType",Ie.user,a),l=r(),c=new Map;l.forEach((e=>c.set(e.id,e)));let u=o??jy;const d=i("getEntityRecords",["postType",Ie.user,a]);return t&&(u=u.filter((e=>e.wp_pattern_sync_status||Ae.full===t))),u=wy(u,n,{hasCategory:()=>!0}),{patterns:u,isResolving:d,categories:l}}),(e=>[e(j.store).getEntityRecords("postType",Ie.user,{per_page:-1}),e(j.store).isResolving("getEntityRecords",["postType",Ie.user,{per_page:-1}]),e(j.store).getUserPatternCategories()]));var Py=(e,t,{search:n="",syncStatus:s}={})=>(0,c.useSelect)((i=>{if(e===Ce)return Sy(i,t,n);if(e===Ie.user&&t){return ky(i,"uncategorized"===t?"":t,s,n)}return e===Ie.user?Ey(i,s,n):{patterns:jy,isResolving:!1}}),[t,e,n,s]);function Iy(){const e=function(){const e=(0,c.useSelect)((e=>{const{getSettings:t}=ne(e(Rt)),n=t();return n.__experimentalAdditionalBlockPatternCategories??n.__experimentalBlockPatternCategories}));return[...e||[],...(0,c.useSelect)((e=>e(j.store).getBlockPatternCategories()))||[]]}();e.push({name:Ee,label:(0,w.__)("Uncategorized")});const t=function(){const e=(0,c.useSelect)((e=>{const{getSettings:t}=ne(e(Rt));return t().__experimentalAdditionalBlockPatterns??t().__experimentalBlockPatterns})),t=(0,c.useSelect)((e=>e(j.store).getBlockPatterns()));return(0,h.useMemo)((()=>[...e||[],...t||[]].filter((e=>!Te.includes(e.source))).filter(hy).filter((e=>!1!==e.inserter))),[e,t])}(),{patterns:n,categories:s}=Py(Ie.user),i=(0,h.useMemo)((()=>{const i={},r=[];e.forEach((e=>{i[e.name]||(i[e.name]={...e,count:0})})),s.forEach((e=>{i[e.name]||(i[e.name]={...e,count:0})})),t.forEach((e=>{e.categories?.forEach((e=>{i[e]&&(i[e].count+=1)})),e.categories?.length||(i.uncategorized.count+=1)})),n.forEach((e=>{e.wp_pattern_category?.forEach((e=>{const t=s.find((t=>t.id===e))?.name;i[t]&&(i[t].count+=1)})),e.wp_pattern_category?.length&&e.wp_pattern_category?.some((e=>s.find((t=>t.id===e))))||(i.uncategorized.count+=1)})),[...e,...s].forEach((e=>{i[e.name].count&&!r.find((t=>t.name===e.name))&&r.push(i[e.name])}));const a=r.sort(((e,t)=>e.label.localeCompare(t.label)));return a.unshift({name:Oe,label:(0,w.__)("My patterns"),count:n.length}),a.unshift({name:Ve,label:(0,w.__)("All patterns"),description:(0,w.__)("A list of all patterns from all sources."),count:t.length+n.length}),a}),[e,t,s,n]);return{patternCategories:i,hasPatterns:!!i.length}}const Vy=e=>{const t=e||[],n=(0,c.useSelect)((e=>e(j.store).getCurrentTheme()?.default_template_part_areas||[]),[]),s={header:{},footer:{},sidebar:{},uncategorized:{}};n.forEach((e=>s[e.area]={...e,templateParts:[]}));return t.reduce(((e,t)=>{const n=e[t.area]?t.area:Ee;return e[n]?.templateParts?.push(t),e}),s)};const{useLocation:Oy}=ne(Lt.privateApis);function Ty({templatePartAreas:e,patternCategories:t,currentCategory:n,currentType:s}){const[i,...r]=t;return(0,a.jsxs)(b.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group",children:[(0,a.jsx)(dy,{count:Object.values(e).map((({templateParts:e})=>e?.length||0)).reduce(((e,t)=>e+t),0),icon:(0,f.getTemplatePartIcon)(),label:(0,w.__)("All template parts"),id:Pe,type:Ce,isActive:n===Pe&&s===Ce},"all"),Object.entries(e).map((([e,{label:t,templateParts:i}])=>(0,a.jsx)(dy,{count:i?.length,icon:(0,f.getTemplatePartIcon)(e),label:t,id:e,type:Ce,isActive:n===e&&s===Ce},e))),(0,a.jsx)("div",{className:"edit-site-sidebar-navigation-screen-patterns__divider"}),i&&(0,a.jsx)(dy,{count:i.count,label:i.label,icon:uy,id:i.name,type:Ie.user,isActive:n===`${i.name}`&&s===Ie.user},i.name),r.map((e=>(0,a.jsx)(dy,{count:e.count,label:e.label,icon:uy,id:e.name,type:Ie.user,isActive:n===`${e.name}`&&s===Ie.user},e.name)))]})}function Ay({backPath:e}){const{query:{postType:t="wp_block",categoryId:n}}=Oy(),s=n||(t===Ie.user?Ve:Pe),{templatePartAreas:i,hasTemplateParts:r,isLoading:o}=function(){const{records:e,isResolving:t}=(0,j.useEntityRecords)("postType",Ce,{per_page:-1});return{hasTemplateParts:!!e&&!!e.length,isLoading:t,templatePartAreas:Vy(e)}}(),{patternCategories:l,hasPatterns:c}=Iy();return(0,a.jsx)(Ua,{title:(0,w.__)("Patterns"),description:(0,w.__)("Manage what patterns are available when editing the site."),isRoot:!e,backPath:e,content:(0,a.jsxs)(a.Fragment,{children:[o&&(0,w.__)("Loading items…"),!o&&(0,a.jsxs)(a.Fragment,{children:[!r&&!c&&(0,a.jsx)(b.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group",children:(0,a.jsx)(b.__experimentalItem,{children:(0,w.__)("No items found")})}),(0,a.jsx)(Ty,{templatePartAreas:i,patternCategories:l,currentCategory:s,currentType:t})]})]})})}var Ny=i(9681),Fy=i.n(Ny);Math.pow(10,8);const My=6048e5,By=Symbol.for("constructDateFrom");function Dy(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&By in e?e[By](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ry(e,t){return Dy(t||e,e)}function Ly(e,t,n){const s=Ry(e,n?.in);return isNaN(t)?Dy(n?.in||e,NaN):t?(s.setDate(s.getDate()+t),s):s}function zy(e,t,n){return Ly(e,-t,n)}function Hy(e,t,n){return Ly(e,7*t,n)}function Gy(e,t,n){return Hy(e,-t,n)}function Wy(e,t,n){const s=Ry(e,n?.in);if(isNaN(t))return Dy(n?.in||e,NaN);if(!t)return s;const i=s.getDate(),r=Dy(n?.in||e,s.getTime());r.setMonth(s.getMonth()+t+1,0);return i>=r.getDate()?r:(s.setFullYear(r.getFullYear(),r.getMonth(),i),s)}function Uy(e,t,n){return Wy(e,-t,n)}function qy(e,t,n){return Wy(e,12*t,n)}function Zy(e,t,n){return qy(e,-t,n)}var Yy=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{d:"M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z"})}),Ky=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})});const Xy="is",Qy="isNot",Jy="isAny",$y="isNone",ex="isAll",tx="isNotAll",nx="lessThan",sx="greaterThan",ix="lessThanOrEqual",rx="greaterThanOrEqual",ax="before",ox="after",lx="beforeInc",cx="afterInc",ux="contains",dx="notContains",hx="startsWith",px="between",fx="on",mx="notOn",gx="inThePast",vx="over",yx=[Xy,Qy,Jy,$y,ex,tx,nx,sx,ix,rx,ax,ox,lx,cx,ux,dx,hx,px,fx,mx,gx,vx],xx=[Xy,Qy,nx,sx,ix,rx,ax,ox,lx,cx,ux,dx,hx,fx,mx],bx={[Xy]:{key:"is-filter",label:(0,w.__)("Is")},[Qy]:{key:"is-not-filter",label:(0,w.__)("Is not")},[Jy]:{key:"is-any-filter",label:(0,w.__)("Is any")},[$y]:{key:"is-none-filter",label:(0,w.__)("Is none")},[ex]:{key:"is-all-filter",label:(0,w.__)("Is all")},[tx]:{key:"is-not-all-filter",label:(0,w.__)("Is not all")},[nx]:{key:"less-than-filter",label:(0,w.__)("Less than")},[sx]:{key:"greater-than-filter",label:(0,w.__)("Greater than")},[ix]:{key:"less-than-or-equal-filter",label:(0,w.__)("Less than or equal")},[rx]:{key:"greater-than-or-equal-filter",label:(0,w.__)("Greater than or equal")},[ax]:{key:"before-filter",label:(0,w.__)("Before")},[ox]:{key:"after-filter",label:(0,w.__)("After")},[lx]:{key:"before-inc-filter",label:(0,w.__)("Before (inc)")},[cx]:{key:"after-inc-filter",label:(0,w.__)("After (inc)")},[ux]:{key:"contains-filter",label:(0,w.__)("Contains")},[dx]:{key:"not-contains-filter",label:(0,w.__)("Doesn't contain")},[hx]:{key:"starts-with-filter",label:(0,w.__)("Starts with")},[px]:{key:"between-filter",label:(0,w.__)("Between (inc)")},[fx]:{key:"on-filter",label:(0,w.__)("On")},[mx]:{key:"not-on-filter",label:(0,w.__)("Not on")},[gx]:{key:"in-the-past-filter",label:(0,w.__)("In the past")},[vx]:{key:"over-filter",label:(0,w.__)("Over")}},wx=["asc","desc"],_x={asc:"↑",desc:"↓"},jx={asc:"ascending",desc:"descending"},Sx={asc:(0,w.__)("Sort ascending"),desc:(0,w.__)("Sort descending")},Cx={asc:Yy,desc:Ky},kx="table",Ex="grid",Px=[];function Ix({elements:e,getElements:t}){const n=Array.isArray(e)&&e.length>0?e:Px,[s,i]=(0,h.useState)(n),[r,a]=(0,h.useState)(!1);return(0,h.useEffect)((()=>{if(!t)return void i(n);let e=!1;return a(!0),t().then((t=>{if(!e){const e=Array.isArray(t)&&t.length>0?t:n;i(e)}})).catch((()=>{e||i(n)})).finally((()=>{e||a(!1)})),()=>{e=!0}}),[t,n]),{elements:s,isLoading:r}}function Vx({item:e,field:t}){const{elements:n,isLoading:s}=Ix({elements:t.elements,getElements:t.getElements}),i=t.getValue({item:e});return s||0===n.length?i:n?.find((e=>e.value===i))?.label||t.getValue({item:e})}const Ox=/^[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])?)*$/;var Tx={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||Ox.test(n)?null:(0,w.__)("Value must be a valid email address.")}},Edit:"email",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(Vx,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[Jy,$y],validOperators:[Xy,Qy,ux,dx,hx,Jy,$y,ex,tx]}};var Ax={sort:function(e,t,n){return"asc"===n?e-t:t-e},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||Number.isInteger(n)?null:(0,w.__)("Value must be an integer.")}},Edit:"integer",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(Vx,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[Xy,Qy,nx,sx,ix,rx,px],validOperators:[Xy,Qy,nx,sx,ix,rx,px,Jy,$y,ex,tx]}};var Nx={sort:function(e,t,n){return"asc"===n?e-t:t-e},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return function(e){return""===e||null==e}(n)||Number.isFinite(n)?null:(0,w.__)("Value must be a number.")}},Edit:"number",render:({item:e,field:t})=>{t.hasElements;const n=t.getValue({item:e});return[null,void 0].includes(n)?null:Number(n).toFixed(2)},enableSorting:!0,filterBy:{defaultOperators:[Xy,Qy,nx,sx,ix,rx,px],validOperators:[Xy,Qy,nx,sx,ix,rx,px,Jy,$y,ex,tx]}};var Fx={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:{elements:!0,custom:()=>null},Edit:"text",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(Vx,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[Jy,$y],validOperators:[Xy,Qy,ux,dx,hx,Jy,$y,ex,tx]}};var Mx={sort:function(e,t,n){const s=new Date(e).getTime(),i=new Date(t).getTime();return"asc"===n?s-i:i-s},isValid:{elements:!0,custom:()=>null},Edit:"datetime",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(Vx,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[fx,mx,ax,ox,lx,cx,gx,vx],validOperators:[fx,mx,ax,ox,lx,cx,gx,vx]}};var Bx={sort:function(e,t,n){const s=new Date(e).getTime(),i=new Date(t).getTime();return"asc"===n?s-i:i-s},Edit:"date",isValid:{elements:!0,custom:()=>null},render:({item:e,field:t})=>{if(t.hasElements)return(0,a.jsx)(Vx,{item:e,field:t});const n=t.getValue({item:e});return n?(s=n,(0,Cg.dateI18n)((0,Cg.getSettings)().formats.date,(0,Cg.getDate)(s))):"";var s},enableSorting:!0,filterBy:{defaultOperators:[fx,mx,ax,ox,lx,cx,gx,vx,px],validOperators:[fx,mx,ax,ox,lx,cx,gx,vx,px]}};var Dx={sort:function(e,t,n){const s=Boolean(e);return s===Boolean(t)?0:"asc"===n?s?1:-1:s?-1:1},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||[!0,!1].includes(n)?null:(0,w.__)("Value must be true, false, or undefined")}},Edit:"checkbox",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(Vx,{item:e,field:t}):!0===t.getValue({item:e})?(0,w.__)("True"):!1===t.getValue({item:e})?(0,w.__)("False"):null,enableSorting:!0,filterBy:{defaultOperators:[Xy,Qy],validOperators:[Xy,Qy]}};var Rx={sort:function(){return 0},isValid:{elements:!0,custom:()=>null},Edit:null,render:()=>null,enableSorting:!1,filterBy:!1};const Lx={sort:function(e,t,n){const s=Array.isArray(e)?e:[],i=Array.isArray(t)?t:[];if(s.length!==i.length)return"asc"===n?s.length-i.length:i.length-s.length;const r=s.join(","),a=i.join(",");return"asc"===n?r.localeCompare(a):a.localeCompare(r)},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||Array.isArray(n)?n.every((e=>"string"==typeof e))?null:(0,w.__)("Every value must be a string."):(0,w.__)("Value must be an array.")}},Edit:"array",render:function({item:e,field:t}){return(t.getValue({item:e})||[]).join(", ")},enableSorting:!0,filterBy:{defaultOperators:[Jy,$y],validOperators:[Jy,$y,ex,tx]}};var zx=Lx;var Hx={sort:function(e,t,n){return 0},isValid:{elements:!0,custom:()=>null},Edit:"password",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(Vx,{item:e,field:t}):"••••••••",enableSorting:!1,filterBy:!1};var Gx={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:{elements:!0,custom:()=>null},Edit:"telephone",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(Vx,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[Jy,$y],validOperators:[Xy,Qy,ux,dx,hx,Jy,$y,ex,tx]}};var Wx={sort:function(e,t,n){const s=X(e),i=X(t);if(!s.isValid()&&!i.isValid())return 0;if(!s.isValid())return"asc"===n?1:-1;if(!i.isValid())return"asc"===n?-1:1;const r=s.toHsl(),a=i.toHsl();return r.h!==a.h?"asc"===n?r.h-a.h:a.h-r.h:r.s!==a.s?"asc"===n?r.s-a.s:a.s-r.s:"asc"===n?r.l-a.l:a.l-r.l},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||X(n).isValid()?null:(0,w.__)("Value must be a valid color.")}},Edit:"color",render:({item:e,field:t})=>{if(t.hasElements)return(0,a.jsx)(Vx,{item:e,field:t});const n=t.getValue({item:e});return n&&X(n).isValid()?(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,a.jsx)("div",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:n,border:"1px solid #ddd",flexShrink:0}}),(0,a.jsx)("span",{children:n})]}):n},enableSorting:!0,filterBy:{defaultOperators:[Jy,$y],validOperators:[Xy,Qy]}};var Ux={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:{elements:!0,custom:()=>null},Edit:"url",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(Vx,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[Jy,$y],validOperators:[Xy,Qy,ux,dx,hx,Jy,$y,ex,tx]}};const{lock:qx,unlock:Zx}=(0,ee.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/dataviews");function Yx(e,t){let n;return e?.required&&t?.required?n=t?.required?.message?t.required:void 0:e?.elements&&t?.elements?n=t.elements:t?.custom&&(n=t.custom),n}const{ValidatedCheckboxControl:Kx}=Zx(b.privateApis);function Xx(e){return e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}function Qx(e){return!(!Xx(e)&&"number"!=typeof e||isNaN(+Ry(e)))}const Jx={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function $x(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const eb={date:$x({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:$x({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:$x({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},tb={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function nb(e){return(t,n)=>{let s;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;s=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;s=e.values[i]||e.values[t]}return s[e.argumentCallback?e.argumentCallback(t):t]}}function sb(e){return(t,n={})=>{const s=n.width,i=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const a=r[0],o=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(o)?function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n;return}(o,(e=>e.test(a))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(o,(e=>e.test(a)));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;return{value:c,rest:t.slice(a.length)}}}var ib;const rb={code:"en-US",formatDistance:(e,t,n)=>{let s;const i=Jx[e];return s="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s},formatLong:eb,formatRelative:(e,t,n,s)=>tb[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:nb({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:nb({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:nb({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:nb({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:nb({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(ib={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(ib.matchPattern);if(!n)return null;const s=n[0],i=e.match(ib.parsePattern);if(!i)return null;let r=ib.valueCallback?ib.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(s.length)}}),era:sb({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:sb({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:sb({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:sb({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:sb({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};let ab={};function ob(){return ab}function lb(e){const t=Ry(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function cb(e,t){const n=Ry(e,t?.in);return n.setHours(0,0,0,0),n}function ub(e,t,n){const[s,i]=function(e,...t){const n=Dy.bind(null,e||t.find((e=>"object"==typeof e)));return t.map(n)}(n?.in,e,t),r=cb(s),a=cb(i),o=+r-lb(r),l=+a-lb(a);return Math.round((o-l)/864e5)}function db(e,t){const n=Ry(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function hb(e,t){const n=Ry(e,t?.in);return ub(n,db(n))+1}function pb(e,t){const n=ob(),s=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Ry(e,t?.in),r=i.getDay(),a=(r<s?7:0)+r-s;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function fb(e,t){return pb(e,{...t,weekStartsOn:1})}function mb(e,t){const n=Ry(e,t?.in),s=n.getFullYear(),i=Dy(n,0);i.setFullYear(s+1,0,4),i.setHours(0,0,0,0);const r=fb(i),a=Dy(n,0);a.setFullYear(s,0,4),a.setHours(0,0,0,0);const o=fb(a);return n.getTime()>=r.getTime()?s+1:n.getTime()>=o.getTime()?s:s-1}function gb(e,t){const n=mb(e,t),s=Dy(t?.in||e,0);return s.setFullYear(n,0,4),s.setHours(0,0,0,0),fb(s)}function vb(e,t){const n=Ry(e,t?.in),s=+fb(n)-+gb(n);return Math.round(s/My)+1}function yb(e,t){const n=Ry(e,t?.in),s=n.getFullYear(),i=ob(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=Dy(t?.in||e,0);a.setFullYear(s+1,0,r),a.setHours(0,0,0,0);const o=pb(a,t),l=Dy(t?.in||e,0);l.setFullYear(s,0,r),l.setHours(0,0,0,0);const c=pb(l,t);return+n>=+o?s+1:+n>=+c?s:s-1}function xb(e,t){const n=ob(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=yb(e,t),r=Dy(t?.in||e,0);r.setFullYear(i,0,s),r.setHours(0,0,0,0);return pb(r,t)}function bb(e,t){const n=Ry(e,t?.in),s=+pb(n,t)-+xb(n,t);return Math.round(s/My)+1}function wb(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const _b={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return wb("yy"===t?s%100:s,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):wb(n+1,2)},d:(e,t)=>wb(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>wb(e.getHours()%12||12,t.length),H:(e,t)=>wb(e.getHours(),t.length),m:(e,t)=>wb(e.getMinutes(),t.length),s:(e,t)=>wb(e.getSeconds(),t.length),S(e,t){const n=t.length,s=e.getMilliseconds();return wb(Math.trunc(s*Math.pow(10,n-3)),t.length)}},jb="midnight",Sb="noon",Cb="morning",kb="afternoon",Eb="evening",Pb="night",Ib={G:function(e,t,n){const s=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});default:return n.era(s,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),s=t>0?t:1-t;return n.ordinalNumber(s,{unit:"year"})}return _b.y(e,t)},Y:function(e,t,n,s){const i=yb(e,s),r=i>0?i:1-i;if("YY"===t){return wb(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):wb(r,t.length)},R:function(e,t){return wb(mb(e),t.length)},u:function(e,t){return wb(e.getFullYear(),t.length)},Q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return wb(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return wb(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,n){const s=e.getMonth();switch(t){case"M":case"MM":return _b.M(e,t);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,n){const s=e.getMonth();switch(t){case"L":return String(s+1);case"LL":return wb(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,n,s){const i=bb(e,s);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):wb(i,t.length)},I:function(e,t,n){const s=vb(e);return"Io"===t?n.ordinalNumber(s,{unit:"week"}):wb(s,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):_b.d(e,t)},D:function(e,t,n){const s=hb(e);return"Do"===t?n.ordinalNumber(s,{unit:"dayOfYear"}):wb(s,t.length)},E:function(e,t,n){const s=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(e,t,n,s){const i=e.getDay(),r=(i-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return wb(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,s){const i=e.getDay(),r=(i-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return wb(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const s=e.getDay(),i=0===s?7:s;switch(t){case"i":return String(i);case"ii":return wb(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(e,t,n){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,n){const s=e.getHours();let i;switch(i=12===s?Sb:0===s?jb:s/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const s=e.getHours();let i;switch(i=s>=17?Eb:s>=12?kb:s>=4?Cb:Pb,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return _b.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):_b.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return"Ko"===t?n.ordinalNumber(s,{unit:"hour"}):wb(s,t.length)},k:function(e,t,n){let s=e.getHours();return 0===s&&(s=24),"ko"===t?n.ordinalNumber(s,{unit:"hour"}):wb(s,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):_b.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):_b.s(e,t)},S:function(e,t){return _b.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(0===s)return"Z";switch(t){case"X":return Ob(s);case"XXXX":case"XX":return Tb(s);default:return Tb(s,":")}},x:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"x":return Ob(s);case"xxxx":case"xx":return Tb(s);default:return Tb(s,":")}},O:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Vb(s,":");default:return"GMT"+Tb(s,":")}},z:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Vb(s,":");default:return"GMT"+Tb(s,":")}},t:function(e,t,n){return wb(Math.trunc(+e/1e3),t.length)},T:function(e,t,n){return wb(+e,t.length)}};function Vb(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),i=Math.trunc(s/60),r=s%60;return 0===r?n+String(i):n+String(i)+t+wb(r,2)}function Ob(e,t){if(e%60==0){return(e>0?"-":"+")+wb(Math.abs(e)/60,2)}return Tb(e,t)}function Tb(e,t=""){const n=e>0?"-":"+",s=Math.abs(e);return n+wb(Math.trunc(s/60),2)+t+wb(s%60,2)}const Ab=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Nb=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Fb={p:Nb,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],i=n[2];if(!i)return Ab(e,t);let r;switch(s){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Ab(s,t)).replace("{{time}}",Nb(i,t))}},Mb=/^D+$/,Bb=/^Y+$/,Db=["D","DD","YY","YYYY"];const Rb=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Lb=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,zb=/^'([^]*?)'?$/,Hb=/''/g,Gb=/[a-zA-Z]/;function Wb(e,t,n){const s=ob(),i=n?.locale??s.locale??rb,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,o=Ry(e,n?.in);if(!Qx(o))throw new RangeError("Invalid time value");let l=t.match(Lb).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Fb[t])(e,i.formatLong)}return e})).join("").match(Rb).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Ub(e)};if(Ib[t])return{isToken:!0,value:e};if(t.match(Gb))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(l=i.localize.preprocessor(o,l));const c={firstWeekContainsDate:r,weekStartsOn:a,locale:i};return l.map((s=>{if(!s.isToken)return s.value;const r=s.value;(!n?.useAdditionalWeekYearTokens&&function(e){return Bb.test(e)}(r)||!n?.useAdditionalDayOfYearTokens&&function(e){return Mb.test(e)}(r))&&function(e,t,n){const s=function(e,t,n){const s="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(s),Db.includes(e))throw new RangeError(s)}(r,t,String(e));return(0,Ib[r[0]])(o,r,i.localize,c)})).join("")}function Ub(e){const t=e.match(zb);return t?t[1].replace(Hb,"'"):e}const qb={[gx]:[{value:"days",label:(0,w.__)("Days")},{value:"weeks",label:(0,w.__)("Weeks")},{value:"months",label:(0,w.__)("Months")},{value:"years",label:(0,w.__)("Years")}],[vx]:[{value:"days",label:(0,w.__)("Days ago")},{value:"weeks",label:(0,w.__)("Weeks ago")},{value:"months",label:(0,w.__)("Months ago")},{value:"years",label:(0,w.__)("Years ago")}]};function Zb({className:e,data:t,field:n,onChange:s,hideLabelFromVision:i,operator:r}){const o=qb[r===gx?"inThePast":"over"],{id:l,label:c,getValue:u,setValue:d}=n,p=u({item:t}),{value:f="",unit:m=o[0].value}=p&&"object"==typeof p?p:{},g=(0,h.useCallback)((e=>s(d({item:t,value:{value:Number(e),unit:m}}))),[s,d,t,m]),v=(0,h.useCallback)((e=>s(d({item:t,value:{value:f,unit:e}}))),[s,d,t,f]);return(0,a.jsx)(b.BaseControl,{id:l,__nextHasNoMarginBottom:!0,className:Ht(e,"dataviews-controls__relative-date"),label:c,hideLabelFromVision:i,children:(0,a.jsxs)(b.__experimentalHStack,{spacing:2.5,children:[(0,a.jsx)(b.__experimentalNumberControl,{__next40pxDefaultSize:!0,className:"dataviews-controls__relative-date-number",spinControls:"none",min:1,step:1,value:f,onChange:g}),(0,a.jsx)(b.SelectControl,{className:"dataviews-controls__relative-date-unit",__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,w.__)("Unit"),value:m,options:o,onChange:v,hideLabelFromVision:!0})]})})}const{DateCalendar:Yb,ValidatedInputControl:Kb}=Zx(b.privateApis),Xb=e=>{if(!e)return null;const t=(0,Cg.getDate)(e);return t&&Qx(t)?t:null};function Qb({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){const{id:r,label:o,description:l,setValue:c,getValue:u,isValid:d}=t,p=u({item:e}),f="string"==typeof p?p:void 0,[m,g]=(0,h.useState)((()=>Xb(f)||new Date)),v=(0,h.useRef)(null),y=(0,h.useRef)(),x=(0,h.useRef)(null),_=(0,h.useCallback)((t=>n(c({item:e,value:t}))),[e,n,c]);(0,h.useEffect)((()=>()=>{y.current&&clearTimeout(y.current)}),[]);const j=(0,h.useCallback)((e=>{let t;if(e){let n=e;if(f){const t=Xb(f);t&&(n=new Date(e),n.setHours(t.getHours()),n.setMinutes(t.getMinutes()))}t=n.toISOString(),_(t),y.current&&clearTimeout(y.current)}else _(void 0);x.current=v.current&&v.current.ownerDocument.activeElement,y.current=setTimeout((()=>{v.current&&(v.current.focus(),v.current.blur(),_(t),x.current&&x.current instanceof HTMLElement&&x.current.focus())}),0)}),[_,f]),S=(0,h.useCallback)((e=>{if(e){const t=new Date(e);_(t.toISOString());const n=Xb(t.toISOString());n&&g(n)}else _(void 0)}),[_]),{timezone:{string:C},l10n:{startOfWeek:k}}=(0,Cg.getSettings)(),E=d?.required&&!s?`${o} (${(0,w.__)("Required")})`:o;return(0,a.jsx)(b.BaseControl,{__nextHasNoMarginBottom:!0,id:r,label:E,help:l,hideLabelFromVision:s,children:(0,a.jsxs)(b.__experimentalVStack,{spacing:4,children:[(0,a.jsx)(Yb,{style:{width:"100%"},selected:f&&Xb(f)||void 0,onSelect:j,month:m,onMonthChange:g,timeZone:C||void 0,weekStartsOn:k}),(0,a.jsx)(Kb,{ref:v,__next40pxDefaultSize:!0,required:!!d?.required,customValidity:Yx(d,i),type:"datetime-local",label:(0,w.__)("Date time"),hideLabelFromVision:!0,value:f?(P=Xb(f)||void 0,P?"string"==typeof P?P:Wb(P,"yyyy-MM-dd'T'HH:mm"):""):"",onChange:S})]})});var P}function Jb(e,t){const n=Ry(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}var $b=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})});const{DateCalendar:ew,DateRangeCalendar:tw}=Zx(b.privateApis),nw=[{id:"today",label:(0,w.__)("Today"),getValue:()=>(0,Cg.getDate)(null)},{id:"yesterday",label:(0,w.__)("Yesterday"),getValue:()=>zy((0,Cg.getDate)(null),1)},{id:"past-week",label:(0,w.__)("Past week"),getValue:()=>zy((0,Cg.getDate)(null),7)},{id:"past-month",label:(0,w.__)("Past month"),getValue:()=>Uy((0,Cg.getDate)(null),1)}],sw=[{id:"last-7-days",label:(0,w.__)("Last 7 days"),getValue:()=>{const e=(0,Cg.getDate)(null);return[zy(e,7),e]}},{id:"last-30-days",label:(0,w.__)("Last 30 days"),getValue:()=>{const e=(0,Cg.getDate)(null);return[zy(e,30),e]}},{id:"month-to-date",label:(0,w.__)("Month to date"),getValue:()=>{const e=(0,Cg.getDate)(null);return[Jb(e),e]}},{id:"last-year",label:(0,w.__)("Last year"),getValue:()=>{const e=(0,Cg.getDate)(null);return[Zy(e,1),e]}},{id:"year-to-date",label:(0,w.__)("Year to date"),getValue:()=>{const e=(0,Cg.getDate)(null);return[db(e),e]}}],iw=e=>{if(!e)return null;const t=(0,Cg.getDate)(e);return t&&Qx(t)?t:null},rw=e=>e?"string"==typeof e?e:Wb(e,"yyyy-MM-dd"):"";function aw({field:e,validity:t,inputRefs:n,isTouched:s,setIsTouched:i,children:r}){const{isValid:o}=e,[l,c]=(0,h.useState)(void 0),u=(0,h.useCallback)((()=>{const e=Array.isArray(n)?n:[n];for(const t of e){const e=t.current;if(e&&!e.validity.valid)return void c({type:"invalid",message:e.validationMessage})}c(void 0)}),[n]);(0,h.useEffect)((()=>{if(s){const e=setTimeout((()=>{t?c(Yx(o,t)):u()}),0);return()=>clearTimeout(e)}}),[s,o,t,u]);return(0,a.jsxs)("div",{onBlur:e=>{s||e.relatedTarget&&e.currentTarget.contains(e.relatedTarget)||i(!0)},children:[r,(0,a.jsx)("div",{"aria-live":"polite",children:l&&(0,a.jsxs)("p",{className:Ht("components-validated-control__indicator","invalid"===l.type?"is-invalid":void 0,"valid"===l.type?"is-valid":void 0),children:[(0,a.jsx)(b.Icon,{className:"components-validated-control__indicator-icon",icon:$b,size:16,fill:"currentColor"}),l.message]})})]})}function ow({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){const{id:r,label:o,setValue:l,getValue:c,isValid:u}=t,[d,p]=(0,h.useState)(null),f=c({item:e}),m="string"==typeof f?f:void 0,[g,v]=(0,h.useState)((()=>iw(m)||new Date)),[y,x]=(0,h.useState)(!1),_=(0,h.useRef)(null),j=(0,h.useCallback)((t=>n(l({item:e,value:t}))),[e,n,l]),S=(0,h.useCallback)((e=>{const t=e?Wb(e,"yyyy-MM-dd"):void 0;j(t),p(null),x(!0)}),[j]),C=(0,h.useCallback)((e=>{const t=e.getValue(),n=rw(t);v(t),j(n),p(e.id),x(!0)}),[j]),k=(0,h.useCallback)((e=>{if(j(e),e){const t=iw(e);t&&v(t)}p(null),x(!0)}),[j]),{timezone:{string:E},l10n:{startOfWeek:P}}=(0,Cg.getSettings)(),I=u?.required?`${o} (${(0,w.__)("Required")})`:o;return(0,a.jsx)(aw,{field:t,validity:i,inputRefs:_,isTouched:y,setIsTouched:x,children:(0,a.jsx)(b.BaseControl,{__nextHasNoMarginBottom:!0,id:r,className:"dataviews-controls__date",label:I,hideLabelFromVision:s,children:(0,a.jsxs)(b.__experimentalVStack,{spacing:4,children:[(0,a.jsxs)(b.__experimentalHStack,{spacing:2,wrap:!0,justify:"flex-start",children:[nw.map((e=>{const t=d===e.id;return(0,a.jsx)(b.Button,{className:"dataviews-controls__date-preset",variant:"tertiary",isPressed:t,size:"small",onClick:()=>C(e),children:e.label},e.id)})),(0,a.jsx)(b.Button,{className:"dataviews-controls__date-preset",variant:"tertiary",isPressed:!d,size:"small",disabled:!!d,accessibleWhenDisabled:!1,children:(0,w.__)("Custom")})]}),(0,a.jsx)(b.__experimentalInputControl,{__next40pxDefaultSize:!0,ref:_,type:"date",label:(0,w.__)("Date"),hideLabelFromVision:!0,value:m,onChange:k,required:!!t.isValid?.required}),(0,a.jsx)(ew,{style:{width:"100%"},selected:m&&iw(m)||void 0,onSelect:S,month:g,onMonthChange:v,timeZone:E||void 0,weekStartsOn:P})]})})})}function lw({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){const{id:r,label:o,getValue:l,setValue:c}=t;let u;const d=l({item:e});Array.isArray(d)&&2===d.length&&d.every((e=>"string"==typeof e))&&(u=d);const p=(0,h.useCallback)((t=>{n(c({item:e,value:t}))}),[e,n,c]),[f,m]=(0,h.useState)(null),g=(0,h.useMemo)((()=>{if(!u)return{from:void 0,to:void 0};const[e,t]=u;return{from:iw(e)||void 0,to:iw(t)||void 0}}),[u]),[v,y]=(0,h.useState)((()=>g.from||new Date)),[x,_]=(0,h.useState)(!1),j=(0,h.useRef)(null),S=(0,h.useRef)(null),C=(0,h.useCallback)(((e,t)=>{e&&t?p([rw(e),rw(t)]):e||t||p(void 0)}),[p]),k=(0,h.useCallback)((e=>{C(e?.from,e?.to),m(null),_(!0)}),[C]),E=(0,h.useCallback)((e=>{const[t,n]=e.getValue();y(t),C(t,n),m(e.id),_(!0)}),[C]),P=(0,h.useCallback)(((e,t)=>{const[n,s]=u||[void 0,void 0];if(C("from"===e?t:n,"to"===e?t:s),t){const e=iw(t);e&&y(e)}m(null),_(!0)}),[u,C]),{timezone:I,l10n:V}=(0,Cg.getSettings)(),O=t.isValid?.required?`${o} (${(0,w.__)("Required")})`:o;return(0,a.jsx)(aw,{field:t,validity:i,inputRefs:[j,S],isTouched:x,setIsTouched:_,children:(0,a.jsx)(b.BaseControl,{__nextHasNoMarginBottom:!0,id:r,className:"dataviews-controls__date",label:O,hideLabelFromVision:s,children:(0,a.jsxs)(b.__experimentalVStack,{spacing:4,children:[(0,a.jsxs)(b.__experimentalHStack,{spacing:2,wrap:!0,justify:"flex-start",children:[sw.map((e=>{const t=f===e.id;return(0,a.jsx)(b.Button,{className:"dataviews-controls__date-preset",variant:"tertiary",isPressed:t,size:"small",onClick:()=>E(e),children:e.label},e.id)})),(0,a.jsx)(b.Button,{className:"dataviews-controls__date-preset",variant:"tertiary",isPressed:!f,size:"small",accessibleWhenDisabled:!1,disabled:!!f,children:(0,w.__)("Custom")})]}),(0,a.jsxs)(b.__experimentalHStack,{spacing:2,children:[(0,a.jsx)(b.__experimentalInputControl,{__next40pxDefaultSize:!0,ref:j,type:"date",label:(0,w.__)("From"),hideLabelFromVision:!0,value:u?.[0],onChange:e=>P("from",e),required:!!t.isValid?.required}),(0,a.jsx)(b.__experimentalInputControl,{__next40pxDefaultSize:!0,ref:S,type:"date",label:(0,w.__)("To"),hideLabelFromVision:!0,value:u?.[1],onChange:e=>P("to",e),required:!!t.isValid?.required})]}),(0,a.jsx)(tw,{style:{width:"100%"},selected:g,onSelect:k,month:v,onMonthChange:y,timeZone:I.string||void 0,weekStartsOn:V.startOfWeek})]})})})}var cw=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.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"})});const{ValidatedInputControl:uw}=Zx(b.privateApis);function dw({data:e,field:t,onChange:n,hideLabelFromVision:s,type:i,prefix:r,suffix:o,validity:l}){const{label:c,placeholder:u,description:d,getValue:p,setValue:f,isValid:m}=t,g=p({item:e}),v=(0,h.useCallback)((t=>n(f({item:e,value:t}))),[e,f,n]);return(0,a.jsx)(uw,{required:!!m?.required,customValidity:Yx(m,l),label:c,placeholder:u,value:g??"",help:d,onChange:v,hideLabelFromVision:s,type:i,prefix:r,suffix:o,__next40pxDefaultSize:!0})}var hw=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})});var pw=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})});const{ValidatedNumberControl:fw}=Zx(b.privateApis);function mw(e){if(""===e||void 0===e)return"";const t=Number(e);return Number.isFinite(t)?t:""}function gw({value:e,onChange:t,hideLabelFromVision:n,step:s}){const[i="",r=""]=e,o=(0,h.useCallback)((e=>t([mw(e),r])),[t,r]),l=(0,h.useCallback)((e=>t([i,mw(e)])),[t,i]);return(0,a.jsx)(b.BaseControl,{__nextHasNoMarginBottom:!0,help:(0,w.__)("The max. value must be greater than the min. value."),children:(0,a.jsxs)(b.Flex,{direction:"row",gap:4,children:[(0,a.jsx)(b.__experimentalNumberControl,{label:(0,w.__)("Min."),value:i,max:r?Number(r)-s:void 0,onChange:o,__next40pxDefaultSize:!0,hideLabelFromVision:n,step:s}),(0,a.jsx)(b.__experimentalNumberControl,{label:(0,w.__)("Max."),value:r,min:i?Number(i)+s:void 0,onChange:l,__next40pxDefaultSize:!0,hideLabelFromVision:n,step:s})]})})}function vw({data:e,field:t,onChange:n,hideLabelFromVision:s,operator:i,decimals:r,validity:o}){const l=Math.pow(10,-1*Math.abs(r)),{label:c,description:u,getValue:d,setValue:p,isValid:f}=t,m=d({item:e})??"",g=(0,h.useCallback)((t=>{n(p({item:e,value:["",void 0].includes(t)?void 0:Number(t)}))}),[e,n,p]),v=(0,h.useCallback)((t=>{n(p({item:e,value:t}))}),[e,n,p]);if(i===px){let e=["",""];return Array.isArray(m)&&2===m.length&&m.every((e=>"number"==typeof e||""===e))&&(e=m),(0,a.jsx)(gw,{value:e,onChange:v,hideLabelFromVision:s,step:l})}return(0,a.jsx)(fw,{required:!!f?.required,customValidity:Yx(f,o),label:c,help:u,value:m,onChange:g,__next40pxDefaultSize:!0,hideLabelFromVision:s,step:l})}const{ValidatedRadioControl:yw}=Zx(b.privateApis);const{ValidatedSelectControl:xw}=Zx(b.privateApis);const{ValidatedToggleControl:bw}=Zx(b.privateApis);const{ValidatedTextareaControl:ww}=Zx(b.privateApis);const{ValidatedToggleGroupControl:_w}=Zx(b.privateApis);const{ValidatedFormTokenField:jw}=Zx(b.privateApis);const{ValidatedInputControl:Sw,Picker:Cw}=Zx(b.privateApis),kw=({color:e,onColorChange:t})=>{const n=e&&X(e).isValid()?e:"#ffffff";return(0,a.jsx)(b.Dropdown,{renderToggle:({onToggle:e,isOpen:t})=>(0,a.jsx)(b.__experimentalInputControlPrefixWrapper,{variant:"icon",children:(0,a.jsx)("button",{type:"button",onClick:e,style:{width:"24px",height:"24px",borderRadius:"50%",backgroundColor:n,border:"1px solid #ddd",cursor:"pointer",outline:t?"2px solid #007cba":"none",outlineOffset:"2px",display:"flex",alignItems:"center",justifyContent:"center",padding:0,margin:0},"aria-label":"Open color picker"})}),renderContent:()=>(0,a.jsx)("div",{style:{padding:"16px"},children:(0,a.jsx)(Cw,{color:X(n),onChange:t,enableAlpha:!0})})})};var Ew=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.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"})});function Pw(e){return Array.isArray(e.elements)&&e.elements.length>0||"function"==typeof e.getElements}const Iw={array:function({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){const{label:r,placeholder:o,getValue:l,setValue:c,isValid:u}=t,d=l({item:e}),{elements:p,isLoading:f}=Ix({elements:t.elements,getElements:t.getElements}),m=(0,h.useMemo)((()=>Array.isArray(d)?d.map((e=>{const t=p?.find((t=>t.value===e));return t||{value:e,label:e}})):[]),[d,p]),g=(0,h.useCallback)((t=>{const s=t.map((e=>"object"==typeof e&&"value"in e?e.value:e));n(c({item:e,value:s}))}),[n,c,e]);return f?(0,a.jsx)(b.Spinner,{}):(0,a.jsx)(jw,{required:!!u?.required,customValidity:Yx(u,i),label:s?void 0:r,value:m,onChange:g,placeholder:o,suggestions:p?.map((e=>e.value)),__experimentalValidateInput:e=>!t.isValid?.elements||!p||p.some((t=>t.value===e||t.label===e)),__experimentalExpandOnFocus:p&&p.length>0,__experimentalShowHowTo:!t.isValid?.elements,displayTransform:e=>{if("object"==typeof e&&"label"in e)return e.label;if("string"==typeof e&&p){const t=p.find((t=>t.value===e));return t?.label||e}return e},__experimentalRenderItem:({item:e})=>{if("string"==typeof e&&p){const t=p.find((t=>t.value===e));return(0,a.jsx)("span",{children:t?.label||e})}return(0,a.jsx)("span",{children:e})}})},checkbox:function({field:e,onChange:t,data:n,hideLabelFromVision:s,validity:i}){const{getValue:r,setValue:o,label:l,description:c,isValid:u}=e,d=(0,h.useCallback)((()=>{t(o({item:n,value:!r({item:n})}))}),[n,r,t,o]);return(0,a.jsx)(Kx,{required:!!e.isValid?.required,customValidity:Yx(u,i),hidden:s,label:l,help:c,checked:r({item:n}),onChange:d})},color:function({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){const{label:r,placeholder:o,description:l,setValue:c,isValid:u}=t,d=t.getValue({item:e})||"",p=(0,h.useCallback)((t=>{n(c({item:e,value:t.toHex()}))}),[e,n,c]),f=(0,h.useCallback)((t=>{n(c({item:e,value:t||""}))}),[e,n,c]);return(0,a.jsx)(Sw,{required:!!t.isValid?.required,customValidity:Yx(u,i),label:r,placeholder:o,value:d,help:l,onChange:f,hideLabelFromVision:s,type:"text",prefix:(0,a.jsx)(kw,{color:d,onColorChange:p})})},datetime:function({data:e,field:t,onChange:n,hideLabelFromVision:s,operator:i,validity:r}){return i===gx||i===vx?(0,a.jsx)(Zb,{className:"dataviews-controls__datetime",data:e,field:t,onChange:n,hideLabelFromVision:s,operator:i}):(0,a.jsx)(Qb,{data:e,field:t,onChange:n,hideLabelFromVision:s,validity:r})},date:function({data:e,field:t,onChange:n,hideLabelFromVision:s,operator:i,validity:r}){return i===gx||i===vx?(0,a.jsx)(Zb,{className:"dataviews-controls__date",data:e,field:t,onChange:n,hideLabelFromVision:s,operator:i}):i===px?(0,a.jsx)(lw,{data:e,field:t,onChange:n,hideLabelFromVision:s,validity:r}):(0,a.jsx)(ow,{data:e,field:t,onChange:n,hideLabelFromVision:s,validity:r})},email:function({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){return(0,a.jsx)(dw,{data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i,type:"email",prefix:(0,a.jsx)(b.__experimentalInputControlPrefixWrapper,{variant:"icon",children:(0,a.jsx)(b.Icon,{icon:cw})})})},telephone:function({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){return(0,a.jsx)(dw,{data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i,type:"tel",prefix:(0,a.jsx)(b.__experimentalInputControlPrefixWrapper,{variant:"icon",children:(0,a.jsx)(b.Icon,{icon:hw})})})},url:function({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){return(0,a.jsx)(dw,{data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i,type:"url",prefix:(0,a.jsx)(b.__experimentalInputControlPrefixWrapper,{variant:"icon",children:(0,a.jsx)(b.Icon,{icon:pw})})})},integer:function(e){return(0,a.jsx)(vw,{...e,decimals:0})},number:function(e){return(0,a.jsx)(vw,{...e,decimals:2})},password:function({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){const[r,o]=(0,h.useState)(!1),l=(0,h.useCallback)((()=>{o((e=>!e))}),[]);return(0,a.jsx)(dw,{data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i,type:r?"text":"password",suffix:(0,a.jsx)(b.Button,{icon:r?Ew:Ao,onClick:l,size:"small",variant:"tertiary","aria-label":r?(0,w.__)("Hide password"):(0,w.__)("Show password")})})},radio:function({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){const{label:r,description:o,getValue:l,setValue:c,isValid:u}=t,{elements:d,isLoading:p}=Ix({elements:t.elements,getElements:t.getElements}),f=l({item:e}),m=(0,h.useCallback)((t=>n(c({item:e,value:t}))),[e,n,c]);return p?(0,a.jsx)(b.Spinner,{}):(0,a.jsx)(yw,{required:!!t.isValid?.required,customValidity:Yx(u,i),label:r,help:o,onChange:m,options:d,selected:f,hideLabelFromVision:s})},select:function({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){const{type:r,label:o,description:l,getValue:c,setValue:u,isValid:d}=t,p="array"===r,f=c({item:e})??(p?[]:""),m=(0,h.useCallback)((t=>n(u({item:e,value:t}))),[e,n,u]),{elements:g,isLoading:v}=Ix({elements:t.elements,getElements:t.getElements});return v?(0,a.jsx)(b.Spinner,{}):(0,a.jsx)(xw,{required:!!t.isValid?.required,customValidity:Yx(d,i),label:o,value:f,help:l,options:g,onChange:m,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:s,multiple:p})},text:function({data:e,field:t,onChange:n,hideLabelFromVision:s,config:i,validity:r}){const{prefix:o,suffix:l}=i||{};return(0,a.jsx)(dw,{data:e,field:t,onChange:n,hideLabelFromVision:s,validity:r,prefix:o?(0,h.createElement)(o):void 0,suffix:l?(0,h.createElement)(l):void 0})},toggle:function({field:e,onChange:t,data:n,hideLabelFromVision:s,validity:i}){const{label:r,description:o,getValue:l,setValue:c,isValid:u}=e,d=(0,h.useCallback)((()=>{t(c({item:n,value:!l({item:n})}))}),[t,c,n,l]);return(0,a.jsx)(bw,{required:!!u.required,customValidity:Yx(u,i),hidden:s,__nextHasNoMarginBottom:!0,label:r,help:o,checked:l({item:n}),onChange:d})},textarea:function({data:e,field:t,onChange:n,hideLabelFromVision:s,config:i,validity:r}){const{rows:o=4}=i||{},{label:l,placeholder:c,description:u,setValue:d,isValid:p}=t,f=t.getValue({item:e}),m=(0,h.useCallback)((t=>n(d({item:e,value:t}))),[e,n,d]);return(0,a.jsx)(ww,{required:!!p?.required,customValidity:Yx(p,r),label:l,placeholder:c,value:f??"",help:u,onChange:m,rows:o,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:s})},toggleGroup:function({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){const{getValue:r,setValue:o,isValid:l}=t,c=r({item:e}),u=(0,h.useCallback)((t=>n(o({item:e,value:t}))),[e,n,o]),{elements:d,isLoading:p}=Ix({elements:t.elements,getElements:t.getElements});if(p)return(0,a.jsx)(b.Spinner,{});if(0===d.length)return null;const f=d.find((e=>e.value===c));return(0,a.jsx)(_w,{required:!!t.isValid?.required,customValidity:Yx(l,i),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,isBlock:!0,label:t.label,help:f?.description||t.description,onChange:u,value:c,hideLabelFromVision:s,children:d.map((e=>(0,a.jsx)(b.__experimentalToggleGroupControlOption,{label:e.label,value:e.value},e.value)))})}};function Vw(e){return e&&"object"==typeof e&&"string"==typeof e.control}function Ow(e){const{control:t,...n}=e,s=Tw(t);return function(e){return(0,a.jsx)(s,{...e,config:n})}}function Tw(e){if(Object.keys(Iw).includes(e))return Iw[e];throw"Control "+e+" not found"}function Aw(e){return e.map((e=>{const t="email"===(n=e.type)?Tx:"integer"===n?Ax:"number"===n?Nx:"text"===n?Fx:"datetime"===n?Mx:"date"===n?Bx:"boolean"===n?Dx:"media"===n?Rx:"array"===n?zx:"password"===n?Hx:"telephone"===n?Gx:"color"===n?Wx:"url"===n?Ux:{sort:(e,t,n)=>"number"==typeof e&&"number"==typeof t?"asc"===n?e-t:t-e:"asc"===n?e.localeCompare(t):t.localeCompare(e),isValid:{elements:!0,custom:()=>null},Edit:null,render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(Vx,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[Xy,Qy],validOperators:yx}};var n;const s=e.getValue||(i=e.id,({item:e})=>{const t=i.split(".");let n=e;for(const e of t)n=n.hasOwnProperty(e)?n[e]:void 0;return n});var i;const r=e.setValue||(e=>({value:t})=>{const n=e.split("."),s={};let i=s;for(const e of n.slice(0,-1))i[e]={},i=i[e];return i[n.at(-1)]=t,s})(e.id),o=e.sort??function(e,n,i){return t.sort(s({item:e}),s({item:n}),i)},l={...t.isValid,...e.isValid},c=function(e,t){return"function"==typeof e.Edit?e.Edit:"string"==typeof e.Edit?Tw(e.Edit):Vw(e.Edit)?Ow(e.Edit):Pw(e)&&"array"!==e.type?Tw("select"):"string"==typeof t.Edit?Tw(t.Edit):Vw(t.Edit)?Ow(t.Edit):t.Edit}(e,t),u=e.render??function({item:e,field:n}){return t.render({item:e,field:n})},d=function(e,t){if(!1===e.filterBy)return!1;if("object"==typeof e.filterBy){let n=e.filterBy.operators;n&&Array.isArray(n)||(n=t.filterBy?t.filterBy.defaultOperators:[]);let s=yx;return"object"==typeof t.filterBy&&(s=t.filterBy.validOperators),n=n.filter((e=>s.includes(e))),Pw(e)&&n.includes(px)&&(n=n.filter((e=>e!==px))),n.some((e=>xx.includes(e)))&&(n=n.filter((e=>[...xx,px].includes(e)))),0!==n.length&&{isPrimary:!!e.filterBy.isPrimary,operators:n}}if(!1===t.filterBy)return!1;let n=t.filterBy.defaultOperators;return Pw(e)&&n.includes(px)&&(n=n.filter((e=>e!==px))),{operators:n}}(e,t);return{...e,label:e.label||e.id,header:e.header||e.label||e.id,getValue:s,setValue:r,render:u,sort:o,isValid:l,Edit:c,hasElements:Pw(e),enableHiding:e.enableHiding??!0,enableSorting:e.enableSorting??t.enableSorting??!0,filterBy:d,readOnly:e.readOnly??t.readOnly??!1}}))}function Nw(e=""){return Fy()(e.trim().toLowerCase())}const Fw=[];function Mw(e,t){switch(t){case"days":return zy(new Date,e);case"weeks":return Gy(new Date,e);case"months":return Uy(new Date,e);case"years":return Zy(new Date,e);default:return new Date}}function Bw(e,t,n){if(!e)return{data:Fw,paginationInfo:{totalItems:0,totalPages:0}};const s=Aw(n);let i=[...e];if(t.search){const e=Nw(t.search);i=i.filter((t=>s.filter((e=>e.enableGlobalSearch)).some((n=>{const s=n.getValue({item:t});return(Array.isArray(s)?s:[s]).some((t=>Nw(String(t)).includes(e)))}))))}t.filters&&t.filters?.length>0&&t.filters.forEach((e=>{const t=s.find((t=>t.id===e.field));if(t)if(e.operator===Jy&&e?.value?.length>0)i=i.filter((n=>{const s=t.getValue({item:n});return Array.isArray(s)?e.value.some((e=>s.includes(e))):"string"==typeof s&&e.value.includes(s)}));else if(e.operator===$y&&e?.value?.length>0)i=i.filter((n=>{const s=t.getValue({item:n});return Array.isArray(s)?!e.value.some((e=>s.includes(e))):"string"==typeof s&&!e.value.includes(s)}));else if(e.operator===ex&&e?.value?.length>0)i=i.filter((n=>e.value.every((e=>t.getValue({item:n})?.includes(e)))));else if(e.operator===tx&&e?.value?.length>0)i=i.filter((n=>e.value.every((e=>!t.getValue({item:n})?.includes(e)))));else if(e.operator===Xy)i=i.filter((n=>e.value===t.getValue({item:n})||void 0===e.value));else if(e.operator===Qy)i=i.filter((n=>e.value!==t.getValue({item:n})));else if(e.operator===fx&&void 0!==e.value){const n=(0,Cg.getDate)(e.value);i=i.filter((e=>{const s=(0,Cg.getDate)(t.getValue({item:e}));return n.getTime()===s.getTime()}))}else if(e.operator===mx&&void 0!==e.value){const n=(0,Cg.getDate)(e.value);i=i.filter((e=>{const s=(0,Cg.getDate)(t.getValue({item:e}));return n.getTime()!==s.getTime()}))}else if(e.operator===nx&&void 0!==e.value)i=i.filter((n=>t.getValue({item:n})<e.value));else if(e.operator===sx&&void 0!==e.value)i=i.filter((n=>t.getValue({item:n})>e.value));else if(e.operator===ix&&void 0!==e.value)i=i.filter((n=>t.getValue({item:n})<=e.value));else if(e.operator===rx&&void 0!==e.value)i=i.filter((n=>t.getValue({item:n})>=e.value));else if(e.operator===ux&&void 0!==e?.value)i=i.filter((n=>{const s=t.getValue({item:n});return"string"==typeof s&&e.value&&s.toLowerCase().includes(String(e.value).toLowerCase())}));else if(e.operator===dx&&void 0!==e?.value)i=i.filter((n=>{const s=t.getValue({item:n});return"string"==typeof s&&e.value&&!s.toLowerCase().includes(String(e.value).toLowerCase())}));else if(e.operator===hx&&void 0!==e?.value)i=i.filter((n=>{const s=t.getValue({item:n});return"string"==typeof s&&e.value&&s.toLowerCase().startsWith(String(e.value).toLowerCase())}));else if(e.operator===ax&&void 0!==e.value){const n=(0,Cg.getDate)(e.value);i=i.filter((e=>(0,Cg.getDate)(t.getValue({item:e}))<n))}else if(e.operator===ox&&void 0!==e.value){const n=(0,Cg.getDate)(e.value);i=i.filter((e=>(0,Cg.getDate)(t.getValue({item:e}))>n))}else if(e.operator===lx&&void 0!==e.value){const n=(0,Cg.getDate)(e.value);i=i.filter((e=>(0,Cg.getDate)(t.getValue({item:e}))<=n))}else if(e.operator===cx&&void 0!==e.value){const n=(0,Cg.getDate)(e.value);i=i.filter((e=>(0,Cg.getDate)(t.getValue({item:e}))>=n))}else if(e.operator===px&&Array.isArray(e.value)&&2===e.value.length&&void 0!==e.value[0]&&void 0!==e.value[1])i=i.filter((n=>{const s=t.getValue({item:n});return("number"==typeof s||s instanceof Date||"string"==typeof s)&&(s>=e.value[0]&&s<=e.value[1])}));else if(e.operator===gx&&void 0!==e.value?.value&&void 0!==e.value?.unit){const n=Mw(e.value.value,e.value.unit);i=i.filter((e=>{const s=(0,Cg.getDate)(t.getValue({item:e}));return s>=n&&s<=new Date}))}else if(e.operator===vx&&void 0!==e.value?.value&&void 0!==e.value?.unit){const n=Mw(e.value.value,e.value.unit);i=i.filter((e=>(0,Cg.getDate)(t.getValue({item:e}))<n))}}));const r=t.sort?.field?s.find((e=>e.id===t.sort?.field)):null,a=t.groupByField?s.find((e=>e.id===t.groupByField)):null;(r||a)&&i.sort(((e,n)=>{if(a){const t=a.sort(e,n,"asc");if(0!==t)return t}return r?r.sort(e,n,t.sort?.direction??"desc"):0}));let o=i.length,l=1;if(void 0!==t.page&&void 0!==t.perPage){const e=(t.page-1)*t.perPage;o=i?.length||0,l=Math.ceil(o/t.perPage),i=i?.slice(e,e+t.perPage)}return{data:i,paginationInfo:{totalItems:o,totalPages:l}}}const Dw=(0,h.createContext)({view:{type:kx},onChangeView:()=>{},fields:[],data:[],paginationInfo:{totalItems:0,totalPages:0},selection:[],onChangeSelection:()=>{},setOpenedFilter:()=>{},openedFilter:null,getItemId:e=>e.id,isItemClickable:()=>!0,renderItemLink:void 0,containerWidth:0,containerRef:(0,h.createRef)(),resizeObserverRef:()=>{},defaultLayouts:{list:{},grid:{},table:{}},filters:[],isShowingFilter:!1,setIsShowingFilter:()=>{},hasInfiniteScrollHandler:!1,config:{perPageSizes:[]}});Dw.displayName="DataViewsContext";var Rw=Dw,Lw=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.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"})}),zw=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.Path,{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",fillRule:"evenodd",clipRule:"evenodd"})}),Hw=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})}),Gw=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})});function Ww({selection:e,onChangeSelection:t,item:n,getItemId:s,titleField:i,disabled:r,...o}){const l=s(n),c=!r&&e.includes(l),u=i?.getValue?.({item:n})||(0,w.__)("(no title)");return(0,a.jsx)(b.CheckboxControl,{className:"dataviews-selection-checkbox",__nextHasNoMarginBottom:!0,"aria-label":u,"aria-disabled":r,checked:c,onChange:()=>{r||t(e.includes(l)?e.filter((e=>l!==e)):[...e,l])},...o})}const{Menu:Uw,kebabCase:qw}=Zx(b.privateApis);function Zw({action:e,onClick:t,items:n}){const s="string"==typeof e.label?e.label:e.label(n);return(0,a.jsx)(b.Button,{disabled:!!e.disabled,accessibleWhenDisabled:!0,size:"compact",onClick:t,children:s})}function Yw({action:e,onClick:t,items:n}){const s="string"==typeof e.label?e.label:e.label(n);return(0,a.jsx)(Uw.Item,{disabled:e.disabled,onClick:t,children:(0,a.jsx)(Uw.ItemLabel,{children:s})})}function Kw({action:e,items:t,closeModal:n}){const s="string"==typeof e.label?e.label:e.label(t),i="function"==typeof e.modalHeader?e.modalHeader(t):e.modalHeader;return(0,a.jsx)(b.Modal,{title:i||s,__experimentalHideHeader:!!e.hideModalHeader,onRequestClose:n,focusOnMount:e.modalFocusOnMount??!0,size:e.modalSize||"medium",overlayClassName:`dataviews-action-modal dataviews-action-modal__${qw(e.id)}`,children:(0,a.jsx)(e.RenderModal,{items:t,closeModal:n})})}function Xw({actions:e,item:t,registry:n,setActiveModalAction:s}){return(0,a.jsx)(Uw.Group,{children:e.map((e=>(0,a.jsx)(Yw,{action:e,onClick:()=>{"RenderModal"in e?s(e):e.callback([t],{registry:n})},items:[t]},e.id)))})}function Qw({item:e,actions:t,isCompact:n}){const s=(0,c.useRegistry)(),{primaryActions:i,eligibleActions:r}=(0,h.useMemo)((()=>{const n=t.filter((t=>!t.isEligible||t.isEligible(e)));return{primaryActions:n.filter((e=>e.isPrimary)),eligibleActions:n}}),[t,e]);return n?(0,a.jsx)(Jw,{item:e,actions:r,isSmall:!0,registry:s}):(0,a.jsxs)(b.__experimentalHStack,{spacing:0,justify:"flex-end",className:"dataviews-item-actions",style:{flexShrink:0,width:"auto"},children:[(0,a.jsx)($w,{item:e,actions:i,registry:s}),i.length<r.length&&(0,a.jsx)(Jw,{item:e,actions:r,registry:s})]})}function Jw({item:e,actions:t,isSmall:n,registry:s}){const[i,r]=(0,h.useState)(null);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(Uw,{placement:"bottom-end",children:[(0,a.jsx)(Uw.TriggerButton,{render:(0,a.jsx)(b.Button,{size:n?"small":"compact",icon:No,label:(0,w.__)("Actions"),accessibleWhenDisabled:!0,disabled:!t.length,className:"dataviews-all-actions-button"})}),(0,a.jsx)(Uw.Popover,{children:(0,a.jsx)(Xw,{actions:t,item:e,registry:s,setActiveModalAction:r})})]}),!!i&&(0,a.jsx)(Kw,{action:i,items:[e],closeModal:()=>r(null)})]})}function $w({item:e,actions:t,registry:n}){const[s,i]=(0,h.useState)(null);return(0,y.useViewportMatch)("medium","<")?null:Array.isArray(t)&&0!==t.length?(0,a.jsxs)(a.Fragment,{children:[t.map((t=>(0,a.jsx)(Zw,{action:t,onClick:()=>{"RenderModal"in t?i(t):t.callback([e],{registry:n})},items:[e]},t.id))),!!s&&(0,a.jsx)(Kw,{action:s,items:[e],closeModal:()=>i(null)})]}):null}function e_({action:e,items:t,ActionTriggerComponent:n}){const[s,i]=(0,h.useState)(!1),r={action:e,onClick:()=>{i(!0)},items:t};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n,{...r}),s&&(0,a.jsx)(Kw,{action:e,items:t,closeModal:()=>i(!1)})]})}function t_(e,t){return(0,h.useMemo)((()=>e.some((e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))))),[e,t])}function n_(e,t){return(0,h.useMemo)((()=>t.some((t=>e.some((e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))))))),[e,t])}function s_({selection:e,onChangeSelection:t,data:n,actions:s,getItemId:i}){const r=(0,h.useMemo)((()=>n.filter((e=>s.some((t=>t.supportsBulk&&(!t.isEligible||t.isEligible(e))))))),[n,s]),o=n.filter((t=>e.includes(i(t))&&r.includes(t))),l=o.length===r.length;return(0,a.jsx)(b.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,checked:l,indeterminate:!l&&!!o.length,onChange:()=>{t(l?[]:r.map((e=>i(e))))},"aria-label":l?(0,w.__)("Deselect all"):(0,w.__)("Select all")})}function i_({action:e,onClick:t,isBusy:n,items:s}){const i="string"==typeof e.label?e.label:e.label(s);return(0,y.useViewportMatch)("medium","<")?(0,a.jsx)(b.Button,{disabled:n,accessibleWhenDisabled:!0,label:i,icon:e.icon,size:"compact",onClick:t,isBusy:n}):(0,a.jsx)(b.Button,{disabled:n,accessibleWhenDisabled:!0,size:"compact",onClick:t,isBusy:n,children:i})}const r_=[];function a_({action:e,selectedItems:t,actionInProgress:n,setActionInProgress:s}){const i=(0,c.useRegistry)(),r=(0,h.useMemo)((()=>t.filter((t=>!e.isEligible||e.isEligible(t)))),[e,t]);return"RenderModal"in e?(0,a.jsx)(e_,{action:e,items:r,ActionTriggerComponent:i_},e.id):(0,a.jsx)(i_,{action:e,onClick:async()=>{s(e.id),await e.callback(t,{registry:i}),s(null)},items:r,isBusy:n===e.id},e.id)}function o_(e,t,n,s,i,r,o,l,c){const u=r.length>0?(0,w.sprintf)((0,w._n)("%d Item selected","%d Items selected",r.length),r.length):(0,w.sprintf)((0,w._n)("%d Item","%d Items",e.length),e.length);return(0,a.jsxs)(b.__experimentalHStack,{expanded:!1,className:"dataviews-bulk-actions-footer__container",spacing:3,children:[(0,a.jsx)(s_,{selection:s,onChangeSelection:c,data:e,actions:t,getItemId:n}),(0,a.jsx)("span",{className:"dataviews-bulk-actions-footer__item-count",children:u}),(0,a.jsxs)(b.__experimentalHStack,{className:"dataviews-bulk-actions-footer__action-buttons",expanded:!1,spacing:1,children:[i.map((e=>(0,a.jsx)(a_,{action:e,selectedItems:r,actionInProgress:o,setActionInProgress:l},e.id))),r.length>0&&(0,a.jsx)(b.Button,{icon:Ea,showTooltip:!0,tooltipPosition:"top",size:"compact",label:(0,w.__)("Cancel"),disabled:!!o,accessibleWhenDisabled:!1,onClick:()=>{c(r_)}})]})]})}function l_({selection:e,actions:t,onChangeSelection:n,data:s,getItemId:i}){const[r,a]=(0,h.useState)(null),o=(0,h.useRef)(null),l=(0,y.useViewportMatch)("medium","<"),c=(0,h.useMemo)((()=>t.filter((e=>e.supportsBulk))),[t]),u=(0,h.useMemo)((()=>s.filter((e=>c.some((t=>!t.isEligible||t.isEligible(e)))))),[s,c]),d=(0,h.useMemo)((()=>s.filter((t=>e.includes(i(t))&&u.includes(t)))),[e,s,i,u]),p=(0,h.useMemo)((()=>t.filter((e=>e.supportsBulk&&(!l||e.icon)&&d.some((t=>!e.isEligible||e.isEligible(t)))))),[t,d,l]);return r?(o.current||(o.current=o_(s,t,i,e,p,d,r,a,n)),o.current):(o.current&&(o.current=null),o_(s,t,i,e,p,d,r,a,n))}function c_(){const{data:e,selection:t,actions:n=r_,onChangeSelection:s,getItemId:i}=(0,h.useContext)(Rw);return(0,a.jsx)(l_,{selection:t,onChangeSelection:s,data:e,actions:n,getItemId:i})}var u_=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.Path,{d:"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z"})}),d_=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{d:"M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"})}),h_=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"})});const{Menu:p_}=Zx(b.privateApis);function f_({children:e}){return h.Children.toArray(e).filter(Boolean).map(((e,t)=>(0,a.jsxs)(h.Fragment,{children:[t>0&&(0,a.jsx)(p_.Separator,{}),e]},t)))}const m_=(0,h.forwardRef)((function({fieldId:e,view:t,fields:n,onChangeView:s,onHide:i,setOpenedFilter:r,canMove:o=!0},l){const c=t.fields??[],u=c?.indexOf(e),d=t.sort?.field===e;let h=!1,p=!1,f=!1,m=[];const g=n.find((t=>t.id===e));if(!g)return null;h=!1!==g.enableHiding,p=!1!==g.enableSorting;const v=g.header;return m=!!g.filterBy&&g.filterBy?.operators||[],f=!(t.filters?.some((t=>e===t.field))||!g.hasElements&&!g.Edit||!1===g.filterBy||g.filterBy?.isPrimary),p||o||h||f?(0,a.jsxs)(p_,{children:[(0,a.jsxs)(p_.TriggerButton,{render:(0,a.jsx)(b.Button,{size:"compact",className:"dataviews-view-table-header-button",ref:l,variant:"tertiary"}),children:[v,t.sort&&d&&(0,a.jsx)("span",{"aria-hidden":"true",children:_x[t.sort.direction]})]}),(0,a.jsx)(p_.Popover,{style:{minWidth:"240px"},children:(0,a.jsxs)(f_,{children:[p&&(0,a.jsx)(p_.Group,{children:wx.map((n=>{const i=t.sort&&d&&t.sort.direction===n,r=`${e}-${n}`;return(0,a.jsx)(p_.RadioItem,{name:"view-table-sorting",value:r,checked:i,onChange:()=>{s({...t,sort:{field:e,direction:n},showLevels:!1})},children:(0,a.jsx)(p_.ItemLabel,{children:Sx[n]})},r)}))}),f&&(0,a.jsx)(p_.Group,{children:(0,a.jsx)(p_.Item,{prefix:(0,a.jsx)(b.Icon,{icon:u_}),onClick:()=>{r(e),s({...t,page:1,filters:[...t.filters||[],{field:e,value:void 0,operator:m[0]}]})},children:(0,a.jsx)(p_.ItemLabel,{children:(0,w.__)("Add filter")})})}),(o||h)&&g&&(0,a.jsxs)(p_.Group,{children:[o&&(0,a.jsx)(p_.Item,{prefix:(0,a.jsx)(b.Icon,{icon:d_}),disabled:u<1,onClick:()=>{s({...t,fields:[...c.slice(0,u-1)??[],e,c[u-1],...c.slice(u+1)]})},children:(0,a.jsx)(p_.ItemLabel,{children:(0,w.__)("Move left")})}),o&&(0,a.jsx)(p_.Item,{prefix:(0,a.jsx)(b.Icon,{icon:h_}),disabled:u>=c.length-1,onClick:()=>{s({...t,fields:[...c.slice(0,u)??[],c[u+1],e,...c.slice(u+2)]})},children:(0,a.jsx)(p_.ItemLabel,{children:(0,w.__)("Move right")})}),h&&g&&(0,a.jsx)(p_.Item,{prefix:(0,a.jsx)(b.Icon,{icon:Ew}),onClick:()=>{i(g),s({...t,fields:c.filter((t=>t!==e))})},children:(0,a.jsx)(p_.ItemLabel,{children:(0,w.__)("Hide column")})})]})]})})]}):v}));var g_=m_;function v_({item:e,isItemClickable:t,onClickItem:n,renderItemLink:s,className:i,children:r,...o}){if(!t(e))return(0,a.jsx)("div",{className:i,...o,children:r});if(s){const t=s({item:e,className:`${i} ${i}--clickable`,...o,children:r});return(0,h.cloneElement)(t,{onClick:e=>{e.stopPropagation(),t.props.onClick&&t.props.onClick(e)},onKeyDown:e=>{"Enter"!==e.key&&""!==e.key&&" "!==e.key||(e.stopPropagation(),t.props.onKeyDown&&t.props.onKeyDown(e))}})}const l=function({item:e,isItemClickable:t,onClickItem:n,className:s}){return t(e)&&n?{className:s?`${s} ${s}--clickable`:void 0,role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),n(e)},onKeyDown:t=>{"Enter"!==t.key&&""!==t.key&&" "!==t.key||(t.stopPropagation(),n(e))}}:{className:s}}({item:e,isItemClickable:t,onClickItem:n,className:i});return(0,a.jsx)("div",{...l,...o,children:r})}var y_=function({item:e,level:t,titleField:n,mediaField:s,descriptionField:i,onClickItem:r,renderItemLink:o,isItemClickable:l}){return(0,a.jsxs)(b.__experimentalHStack,{spacing:3,justify:"flex-start",children:[s&&(0,a.jsx)(v_,{item:e,isItemClickable:l,onClickItem:r,renderItemLink:o,className:"dataviews-view-table__cell-content-wrapper dataviews-column-primary__media","aria-label":n?(0,w.sprintf)((0,w.__)("Click item: %s"),n.getValue?.({item:e})):void 0,children:(0,a.jsx)(s.render,{item:e,field:s,config:{sizes:"32px"}})}),(0,a.jsxs)(b.__experimentalVStack,{spacing:0,alignment:"flex-start",className:"dataviews-view-table__primary-column-content",children:[n&&(0,a.jsxs)(v_,{item:e,isItemClickable:l,onClickItem:r,renderItemLink:o,className:"dataviews-view-table__cell-content-wrapper dataviews-title-field",children:[void 0!==t&&t>0&&(0,a.jsxs)("span",{className:"dataviews-view-table__level",children:["—".repeat(t)," "]}),(0,a.jsx)(n.render,{item:e,field:n})]}),i&&(0,a.jsx)(i.render,{item:e,field:i})]})]})};function x_({scrollContainerRef:e,enabled:t=!1}){const[n,s]=(0,h.useState)(!1),i=(0,y.useDebounce)((0,h.useCallback)((()=>{const t=e.current;t&&s((e=>{if((0,w.isRTL)())return Math.abs(e.scrollLeft)<=1;return e.scrollLeft+e.clientWidth>=e.scrollWidth-1})(t))}),[e,s]),200);return(0,h.useEffect)((()=>"undefined"!=typeof window&&t&&e.current?(i(),e.current.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{e.current?.removeEventListener("scroll",i),window.removeEventListener("resize",i)}):()=>{}),[e,t]),n}function b_(e,t){return e.reduce(((e,n)=>{const s=t.getValue({item:n});return e.has(s)||e.set(s,[]),e.get(s)?.push(n),e}),new Map)}function w_({item:e,fields:t,column:n,align:s}){const i=t.find((e=>e.id===n));if(!i)return null;const r=Ht("dataviews-view-table__cell-content-wrapper",{"dataviews-view-table__cell-align-end":"end"===s,"dataviews-view-table__cell-align-center":"center"===s});return(0,a.jsx)("div",{className:r,children:(0,a.jsx)(i.render,{item:e,field:i})})}function __({hasBulkActions:e,item:t,level:n,actions:s,fields:i,id:r,view:o,titleField:l,mediaField:c,descriptionField:u,selection:d,getItemId:p,isItemClickable:f,onClickItem:m,renderItemLink:g,onChangeSelection:v,isActionsColumnSticky:y,posinset:x}){const{paginationInfo:b}=(0,h.useContext)(Rw),w=t_(s,t),_=w&&d.includes(r),[j,S]=(0,h.useState)(!1),{showTitle:C=!0,showMedia:k=!0,showDescription:E=!0,infiniteScrollEnabled:P}=o,I=(0,h.useRef)(!1),V=o.fields??[],O=l&&C||c&&k||u&&E;return(0,a.jsxs)("tr",{className:Ht("dataviews-view-table__row",{"is-selected":w&&_,"is-hovered":j,"has-bulk-actions":w}),onMouseEnter:()=>{S(!0)},onMouseLeave:()=>{S(!1)},onTouchStart:()=>{I.current=!0},"aria-setsize":P?b.totalItems:void 0,"aria-posinset":x,role:P?"article":void 0,onClick:e=>{w&&(I.current||"Range"===document.getSelection()?.type||(((0,Xt.isAppleOS)()?e.metaKey:e.ctrlKey)?v(d.includes(r)?d.filter((e=>r!==e)):[...d,r]):v(d.includes(r)?d.filter((e=>r!==e)):[r])))},children:[e&&(0,a.jsx)("td",{className:"dataviews-view-table__checkbox-column",children:(0,a.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper",children:(0,a.jsx)(Ww,{item:t,selection:d,onChangeSelection:v,getItemId:p,titleField:l,disabled:!w})})}),O&&(0,a.jsx)("td",{children:(0,a.jsx)(y_,{item:t,level:n,titleField:C?l:void 0,mediaField:k?c:void 0,descriptionField:E?u:void 0,isItemClickable:f,onClickItem:m,renderItemLink:g})}),V.map((e=>{const{width:n,maxWidth:s,minWidth:r,align:l}=o.layout?.styles?.[e]??{};return(0,a.jsx)("td",{style:{width:n,maxWidth:s,minWidth:r},children:(0,a.jsx)(w_,{fields:i,item:t,column:e,align:l})},e)})),!!s?.length&&(0,a.jsx)("td",{className:Ht("dataviews-view-table__actions-column",{"dataviews-view-table__actions-column--sticky":!0,"dataviews-view-table__actions-column--stuck":y}),onClick:e=>e.stopPropagation(),children:(0,a.jsx)(Qw,{item:t,actions:s})})]})}var j_=function({actions:e,data:t,fields:n,getItemId:s,getItemLevel:i,isLoading:r=!1,onChangeView:o,onChangeSelection:l,selection:c,setOpenedFilter:u,onClickItem:d,isItemClickable:p,renderItemLink:f,view:m,className:g,empty:v}){const{containerRef:y}=(0,h.useContext)(Rw),x=(0,h.useRef)(new Map),_=(0,h.useRef)(),[j,S]=(0,h.useState)(),C=n_(e,t);(0,h.useEffect)((()=>{_.current&&(_.current.focus(),_.current=void 0)}));const k=(0,h.useId)(),E=x_({scrollContainerRef:y,enabled:!!e?.length});if(j)return _.current=j,void S(void 0);const P=e=>{const t=x.current.get(e.id),n=t?x.current.get(t.fallback):void 0;S(n?.node)},I=!!t?.length,V=n.find((e=>e.id===m.titleField)),O=n.find((e=>e.id===m.mediaField)),T=n.find((e=>e.id===m.descriptionField)),A=m.groupByField?n.find((e=>e.id===m.groupByField)):null,N=A?b_(t,A):null,{showTitle:F=!0,showMedia:M=!0,showDescription:B=!0}=m,D=V&&F||O&&M||T&&B,R=m.fields??[],L=(e,t)=>n=>{n?x.current.set(e,{node:n,fallback:R[t>0?t-1:1]}):x.current.delete(e)},z=m.infiniteScrollEnabled&&!N;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("table",{className:Ht("dataviews-view-table",g,{[`has-${m.layout?.density}-density`]:m.layout?.density&&["compact","comfortable"].includes(m.layout.density)}),"aria-busy":r,"aria-describedby":k,role:z?"feed":void 0,children:[(0,a.jsxs)("colgroup",{children:[C&&(0,a.jsx)("col",{className:"dataviews-view-table__col-checkbox"}),D&&(0,a.jsx)("col",{className:"dataviews-view-table__col-primary"}),R.map((e=>(0,a.jsx)("col",{className:`dataviews-view-table__col-${e}`},`col-${e}`))),!!e?.length&&(0,a.jsx)("col",{className:"dataviews-view-table__col-actions"})]}),(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"dataviews-view-table__row",children:[C&&(0,a.jsx)("th",{className:"dataviews-view-table__checkbox-column",scope:"col",children:(0,a.jsx)(s_,{selection:c,onChangeSelection:l,data:t,actions:e,getItemId:s})}),D&&(0,a.jsx)("th",{scope:"col",children:V&&(0,a.jsx)(g_,{ref:L(V.id,0),fieldId:V.id,view:m,fields:n,onChangeView:o,onHide:P,setOpenedFilter:u,canMove:!1})}),R.map(((e,t)=>{const{width:s,maxWidth:i,minWidth:r,align:l}=m.layout?.styles?.[e]??{};return(0,a.jsx)("th",{style:{width:s,maxWidth:i,minWidth:r,textAlign:l},"aria-sort":m.sort?.direction&&m.sort?.field===e?jx[m.sort.direction]:void 0,scope:"col",children:(0,a.jsx)(g_,{ref:L(e,t),fieldId:e,view:m,fields:n,onChangeView:o,onHide:P,setOpenedFilter:u,canMove:m.layout?.enableMoving??!0})},e)})),!!e?.length&&(0,a.jsx)("th",{className:Ht("dataviews-view-table__actions-column",{"dataviews-view-table__actions-column--sticky":!0,"dataviews-view-table__actions-column--stuck":!E}),children:(0,a.jsx)("span",{className:"dataviews-view-table-header",children:(0,w.__)("Actions")})})]})}),I&&A&&N?Array.from(N.entries()).map((([t,r])=>(0,a.jsxs)("tbody",{children:[(0,a.jsx)("tr",{className:"dataviews-view-table__group-header-row",children:(0,a.jsx)("td",{colSpan:R.length+(D?1:0)+(C?1:0)+(e?.length?1:0),className:"dataviews-view-table__group-header-cell",children:(0,w.sprintf)((0,w.__)("%1$s: %2$s"),A.label,t)})}),r.map(((t,r)=>(0,a.jsx)(__,{item:t,level:m.showLevels&&"function"==typeof i?i(t):void 0,hasBulkActions:C,actions:e,fields:n,id:s(t)||r.toString(),view:m,titleField:V,mediaField:O,descriptionField:T,selection:c,getItemId:s,onChangeSelection:l,onClickItem:d,renderItemLink:f,isItemClickable:p,isActionsColumnSticky:!E},s(t))))]},`group-${t}`))):(0,a.jsx)("tbody",{children:I&&t.map(((t,r)=>(0,a.jsx)(__,{item:t,level:m.showLevels&&"function"==typeof i?i(t):void 0,hasBulkActions:C,actions:e,fields:n,id:s(t)||r.toString(),view:m,titleField:V,mediaField:O,descriptionField:T,selection:c,getItemId:s,onChangeSelection:l,onClickItem:d,renderItemLink:f,isItemClickable:p,isActionsColumnSticky:!E,posinset:z?r+1:void 0},s(t))))})]}),(0,a.jsxs)("div",{className:Ht({"dataviews-loading":r,"dataviews-no-results":!I&&!r}),id:k,children:[!I&&(r?(0,a.jsx)("p",{children:(0,a.jsx)(b.Spinner,{})}):v),I&&r&&(0,a.jsx)("p",{className:"dataviews-loading-more",children:(0,a.jsx)(b.Spinner,{})})]})]})};const S_=(0,h.forwardRef)((({className:e,previewSize:t,...n},s)=>(0,a.jsx)("div",{ref:s,className:Ht("dataviews-view-grid-items",e),style:{gridTemplateColumns:t&&`repeat(auto-fill, minmax(${t}px, 1fr))`},...n}))),{Badge:C_}=Zx(b.privateApis);function k_({view:e,selection:t,onChangeSelection:n,onClickItem:s,isItemClickable:i,renderItemLink:r,getItemId:o,item:l,actions:c,mediaField:u,titleField:d,descriptionField:p,regularFields:f,badgeFields:m,hasBulkActions:g,config:v,posinset:x}){const{showTitle:_=!0,showMedia:j=!0,showDescription:S=!0,infiniteScrollEnabled:C}=e,k=t_(c,l),E=o(l),P=(0,y.useInstanceId)(k_),I=t.includes(E),V=u?.render?(0,a.jsx)(u.render,{item:l,field:u,config:v}):null,O=_&&d?.render?(0,a.jsx)(d.render,{item:l,field:d}):null,T=j&&V;let A,N;i(l)&&s&&(O?(A={"aria-labelledby":`dataviews-view-grid__title-field-${P}`},N={id:`dataviews-view-grid__title-field-${P}`}):A={"aria-label":(0,w.__)("Navigate to item")});const{paginationInfo:F}=(0,h.useContext)(Rw);return(0,a.jsxs)(b.__experimentalVStack,{spacing:0,className:Ht("dataviews-view-grid__card",{"is-selected":k&&I}),onClickCapture:e=>{if((0,Xt.isAppleOS)()?e.metaKey:e.ctrlKey){if(e.stopPropagation(),e.preventDefault(),!k)return;n(t.includes(E)?t.filter((e=>E!==e)):[...t,E])}},role:C?"article":void 0,"aria-setsize":C?F.totalItems:void 0,"aria-posinset":x,children:[T&&(0,a.jsx)(v_,{item:l,isItemClickable:i,onClickItem:s,renderItemLink:r,className:"dataviews-view-grid__media",...A,children:V}),g&&T&&(0,a.jsx)(Ww,{item:l,selection:t,onChangeSelection:n,getItemId:o,titleField:d,disabled:!k}),!_&&T&&!!c?.length&&(0,a.jsx)("div",{className:"dataviews-view-grid__media-actions",children:(0,a.jsx)(Qw,{item:l,actions:c,isCompact:!0})}),_&&(0,a.jsxs)(b.__experimentalHStack,{justify:"space-between",className:"dataviews-view-grid__title-actions",children:[(0,a.jsx)(v_,{item:l,isItemClickable:i,onClickItem:s,renderItemLink:r,className:"dataviews-view-grid__title-field dataviews-title-field",...N,children:O}),!!c?.length&&(0,a.jsx)(Qw,{item:l,actions:c,isCompact:!0})]}),(0,a.jsxs)(b.__experimentalVStack,{spacing:1,children:[S&&p?.render&&(0,a.jsx)(p.render,{item:l,field:p}),!!m?.length&&(0,a.jsx)(b.__experimentalHStack,{className:"dataviews-view-grid__badge-fields",spacing:2,wrap:!0,alignment:"top",justify:"flex-start",children:m.map((e=>(0,a.jsx)(C_,{className:"dataviews-view-grid__field-value",children:(0,a.jsx)(e.render,{item:l,field:e})},e.id)))}),!!f?.length&&(0,a.jsx)(b.__experimentalVStack,{className:"dataviews-view-grid__fields",spacing:1,children:f.map((e=>(0,a.jsx)(b.Flex,{className:"dataviews-view-grid__field",gap:1,justify:"flex-start",expanded:!0,style:{height:"auto"},direction:"row",children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.Tooltip,{text:e.label,children:(0,a.jsx)(b.FlexItem,{className:"dataviews-view-grid__field-name",children:e.header})}),(0,a.jsx)(b.FlexItem,{className:"dataviews-view-grid__field-value",style:{maxHeight:"none"},children:(0,a.jsx)(e.render,{item:l,field:e})})]})},e.id)))})]})]},E)}var E_=function({actions:e,data:t,fields:n,getItemId:s,isLoading:i,onChangeSelection:r,onClickItem:o,isItemClickable:l,renderItemLink:c,selection:u,view:d,className:p,empty:f}){const{resizeObserverRef:m}=(0,h.useContext)(Rw),g=n.find((e=>e.id===d?.titleField)),v=n.find((e=>e.id===d?.mediaField)),y=n.find((e=>e.id===d?.descriptionField)),x=d.fields??[],{regularFields:_,badgeFields:j}=x.reduce(((e,t)=>{const s=n.find((e=>e.id===t));if(!s)return e;return e[d.layout?.badgeFields?.includes(t)?"badgeFields":"regularFields"].push(s),e}),{regularFields:[],badgeFields:[]}),S=!!t?.length,C=n_(e,t),k=d.layout?.previewSize,E="900px",P=d.groupByField?n.find((e=>e.id===d.groupByField)):null,I=P?b_(t,P):null,V=d.infiniteScrollEnabled&&!I;return(0,a.jsxs)(a.Fragment,{children:[S&&P&&I&&(0,a.jsx)(b.__experimentalVStack,{spacing:4,children:Array.from(I.entries()).map((([t,n])=>(0,a.jsxs)(b.__experimentalVStack,{spacing:2,children:[(0,a.jsx)("h3",{className:"dataviews-view-grid__group-header",children:(0,w.sprintf)((0,w.__)("%1$s: %2$s"),P.label,t)}),(0,a.jsx)(S_,{className:Ht("dataviews-view-grid",p),previewSize:k,"aria-busy":i,ref:m,children:n.map((t=>(0,a.jsx)(k_,{view:d,selection:u,onChangeSelection:r,onClickItem:o,isItemClickable:l,renderItemLink:c,getItemId:s,item:t,actions:e,mediaField:v,titleField:g,descriptionField:y,regularFields:_,badgeFields:j,hasBulkActions:C,config:{sizes:E}},s(t))))})]},t)))}),S&&!I&&(0,a.jsx)(S_,{className:Ht("dataviews-view-grid",p),previewSize:k,"aria-busy":i,ref:m,role:V?"feed":void 0,children:t.map(((t,n)=>(0,a.jsx)(k_,{view:d,selection:u,onChangeSelection:r,onClickItem:o,isItemClickable:l,renderItemLink:c,getItemId:s,item:t,actions:e,mediaField:v,titleField:g,descriptionField:y,regularFields:_,badgeFields:j,hasBulkActions:C,config:{sizes:E},posinset:V?n+1:void 0},s(t))))}),!S&&(0,a.jsx)("div",{className:Ht({"dataviews-loading":i,"dataviews-no-results":!i}),children:i?(0,a.jsx)("p",{children:(0,a.jsx)(b.Spinner,{})}):f}),S&&i&&(0,a.jsx)("p",{className:"dataviews-loading-more",children:(0,a.jsx)(b.Spinner,{})})]})};const{Menu:P_}=Zx(b.privateApis);function I_(e){return`${e}-item-wrapper`}function V_(e){return`${e}-dropdown`}function O_({idPrefix:e,primaryAction:t,item:n}){const s=(0,c.useRegistry)(),[i,r]=(0,h.useState)(!1),o=function(e,t){return`${e}-primary-action-${t}`}(e,t.id),l="string"==typeof t.label?t.label:t.label([n]);return"RenderModal"in t?(0,a.jsx)("div",{role:"gridcell",children:(0,a.jsx)(b.Composite.Item,{id:o,render:(0,a.jsx)(b.Button,{disabled:!!t.disabled,accessibleWhenDisabled:!0,text:l,size:"small",onClick:()=>r(!0)}),children:i&&(0,a.jsx)(Kw,{action:t,items:[n],closeModal:()=>r(!1)})})},t.id):(0,a.jsx)("div",{role:"gridcell",children:(0,a.jsx)(b.Composite.Item,{id:o,render:(0,a.jsx)(b.Button,{disabled:!!t.disabled,accessibleWhenDisabled:!0,size:"small",onClick:()=>{t.callback([n],{registry:s})},children:l})})},t.id)}function T_({view:e,actions:t,idPrefix:n,isSelected:s,item:i,titleField:r,mediaField:o,descriptionField:l,onSelect:u,otherFields:d,onDropdownTriggerKeyDown:p,posinset:f}){const{showTitle:m=!0,showMedia:g=!0,showDescription:v=!0,infiniteScrollEnabled:y}=e,x=(0,h.useRef)(null),_=`${n}-label`,j=`${n}-description`,S=(0,c.useRegistry)(),[C,k]=(0,h.useState)(!1),[E,P]=(0,h.useState)(null),I=({type:e})=>{k("mouseenter"===e)},{paginationInfo:V}=(0,h.useContext)(Rw);(0,h.useEffect)((()=>{s&&x.current?.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"})}),[s]);const{primaryAction:O,eligibleActions:T}=(0,h.useMemo)((()=>{const e=t.filter((e=>!e.isEligible||e.isEligible(i)));return{primaryAction:e.filter((e=>e.isPrimary))[0],eligibleActions:e}}),[t,i]),A=O&&1===t.length,N=g&&o?.render?(0,a.jsx)("div",{className:"dataviews-view-list__media-wrapper",children:(0,a.jsx)(o.render,{item:i,field:o,config:{sizes:"52px"}})}):null,F=m&&r?.render?(0,a.jsx)(r.render,{item:i,field:r}):null,M=T?.length>0&&(0,a.jsxs)(b.__experimentalHStack,{spacing:3,className:"dataviews-view-list__item-actions",children:[O&&(0,a.jsx)(O_,{idPrefix:n,primaryAction:O,item:i}),!A&&(0,a.jsxs)("div",{role:"gridcell",children:[(0,a.jsxs)(P_,{placement:"bottom-end",children:[(0,a.jsx)(P_.TriggerButton,{render:(0,a.jsx)(b.Composite.Item,{id:V_(n),render:(0,a.jsx)(b.Button,{size:"small",icon:No,label:(0,w.__)("Actions"),accessibleWhenDisabled:!0,disabled:!t.length,onKeyDown:p})})}),(0,a.jsx)(P_.Popover,{children:(0,a.jsx)(Xw,{actions:T,item:i,registry:S,setActiveModalAction:P})})]}),!!E&&(0,a.jsx)(Kw,{action:E,items:[i],closeModal:()=>P(null)})]})]});return(0,a.jsx)(b.Composite.Row,{ref:x,render:(0,a.jsx)("div",{"aria-posinset":f,"aria-setsize":y?V.totalItems:void 0}),role:y?"article":"row",className:Ht({"is-selected":s,"is-hovered":C}),onMouseEnter:I,onMouseLeave:I,children:(0,a.jsxs)(b.__experimentalHStack,{className:"dataviews-view-list__item-wrapper",spacing:0,children:[(0,a.jsx)("div",{role:"gridcell",children:(0,a.jsx)(b.Composite.Item,{id:I_(n),"aria-pressed":s,"aria-labelledby":_,"aria-describedby":j,className:"dataviews-view-list__item",onClick:()=>u(i)})}),(0,a.jsxs)(b.__experimentalHStack,{spacing:3,justify:"start",alignment:"flex-start",children:[N,(0,a.jsxs)(b.__experimentalVStack,{spacing:1,className:"dataviews-view-list__field-wrapper",children:[(0,a.jsxs)(b.__experimentalHStack,{spacing:0,children:[(0,a.jsx)("div",{className:"dataviews-title-field",id:_,children:F}),M]}),v&&l?.render&&(0,a.jsx)("div",{className:"dataviews-view-list__field",children:(0,a.jsx)(l.render,{item:i,field:l})}),(0,a.jsx)("div",{className:"dataviews-view-list__fields",id:j,children:d.map((e=>(0,a.jsxs)("div",{className:"dataviews-view-list__field",children:[(0,a.jsx)(b.VisuallyHidden,{as:"span",className:"dataviews-view-list__field-label",children:e.label}),(0,a.jsx)("span",{className:"dataviews-view-list__field-value",children:(0,a.jsx)(e.render,{item:i,field:e})})]},e.id)))})]})]})]})})}function A_(e){return!!e}function N_(e){return(0,h.useMemo)((()=>e?.every((e=>e.supportsBulk))),[e])}const{Badge:F_}=Zx(b.privateApis);function M_({view:e,multiselect:t,selection:n,onChangeSelection:s,getItemId:i,item:r,mediaField:o,titleField:l,descriptionField:c,regularFields:u,badgeFields:d,config:h,posinset:p,setsize:f}){const{showTitle:m=!0,showMedia:g=!0,showDescription:v=!0}=e,y=i(r),x=n.includes(y),_=o?.render?(0,a.jsx)(o.render,{item:r,field:o,config:h}):null,j=m&&l?.render?(0,a.jsx)(l.render,{item:r,field:l}):null;return(0,a.jsxs)(b.Composite.Item,{"aria-label":l?l.getValue({item:r})||(0,w.__)("(no title)"):void 0,render:({children:e,...t})=>(0,a.jsx)(b.__experimentalVStack,{spacing:0,children:e,...t}),role:"option","aria-posinset":p,"aria-setsize":f,className:Ht("dataviews-view-picker-grid__card",{"is-selected":x}),"aria-selected":x,onClick:()=>{if(x)s(n.filter((e=>y!==e)));else{const e=t?[...n,y]:[y];s(e)}},children:[g&&_&&(0,a.jsx)("div",{className:"dataviews-view-picker-grid__media",children:_}),g&&_&&(0,a.jsx)(Ww,{item:r,selection:n,onChangeSelection:s,getItemId:i,titleField:l,disabled:!1,"aria-hidden":!0,tabIndex:-1}),m&&(0,a.jsx)(b.__experimentalHStack,{justify:"space-between",className:"dataviews-view-picker-grid__title-actions",children:(0,a.jsx)("div",{className:"dataviews-view-picker-grid__title-field dataviews-title-field",children:j})}),(0,a.jsxs)(b.__experimentalVStack,{spacing:1,children:[v&&c?.render&&(0,a.jsx)(c.render,{item:r,field:c}),!!d?.length&&(0,a.jsx)(b.__experimentalHStack,{className:"dataviews-view-picker-grid__badge-fields",spacing:2,wrap:!0,alignment:"top",justify:"flex-start",children:d.map((e=>(0,a.jsx)(F_,{className:"dataviews-view-picker-grid__field-value",children:(0,a.jsx)(e.render,{item:r,field:e})},e.id)))}),!!u?.length&&(0,a.jsx)(b.__experimentalVStack,{className:"dataviews-view-picker-grid__fields",spacing:1,children:u.map((e=>(0,a.jsx)(b.Flex,{className:"dataviews-view-picker-grid__field",gap:1,justify:"flex-start",expanded:!0,style:{height:"auto"},direction:"row",children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.FlexItem,{className:"dataviews-view-picker-grid__field-name",children:e.header}),(0,a.jsx)(b.FlexItem,{className:"dataviews-view-picker-grid__field-value",style:{maxHeight:"none"},children:(0,a.jsx)(e.render,{item:r,field:e})})]})},e.id)))})]})]},y)}function B_({groupName:e,groupField:t,children:n}){const s=(0,y.useInstanceId)(B_,"dataviews-view-picker-grid-group__header");return(0,a.jsxs)(b.__experimentalVStack,{spacing:2,role:"group","aria-labelledby":s,children:[(0,a.jsx)("h3",{className:"dataviews-view-picker-grid-group__header",id:s,children:(0,w.sprintf)((0,w.__)("%1$s: %2$s"),t.label,e)}),n]},e)}var D_=function({actions:e,data:t,fields:n,getItemId:s,isLoading:i,onChangeSelection:r,selection:o,view:l,className:c,empty:u}){const{resizeObserverRef:d,paginationInfo:p,itemListLabel:f}=(0,h.useContext)(Rw),m=n.find((e=>e.id===l?.titleField)),g=n.find((e=>e.id===l?.mediaField)),v=n.find((e=>e.id===l?.descriptionField)),y=l.fields??[],{regularFields:x,badgeFields:w}=y.reduce(((e,t)=>{const s=n.find((e=>e.id===t));if(!s)return e;return e[l.layout?.badgeFields?.includes(t)?"badgeFields":"regularFields"].push(s),e}),{regularFields:[],badgeFields:[]}),_=!!t?.length,j=l.layout?.previewSize,S=N_(e),C="900px",k=l.groupByField?n.find((e=>e.id===l.groupByField)):null,E=k?b_(t,k):null,P=l.infiniteScrollEnabled&&!E,I=l?.page??1,V=l?.perPage??0,O=P?p?.totalItems:void 0;return(0,a.jsxs)(a.Fragment,{children:[_&&k&&E&&(0,a.jsx)(b.Composite,{virtualFocus:!0,orientation:"horizontal",role:"listbox","aria-multiselectable":S,className:Ht("dataviews-view-picker-grid",c),"aria-label":f,render:({children:e,...t})=>(0,a.jsx)(b.__experimentalVStack,{spacing:4,children:e,...t}),children:Array.from(E.entries()).map((([e,n])=>(0,a.jsx)(B_,{groupName:e,groupField:k,children:(0,a.jsx)(S_,{previewSize:j,style:{gridTemplateColumns:j&&`repeat(auto-fill, minmax(${j}px, 1fr))`},"aria-busy":i,ref:d,children:n.map((e=>{const n=(I-1)*V+t.indexOf(e)+1;return(0,a.jsx)(M_,{view:l,multiselect:S,selection:o,onChangeSelection:r,getItemId:s,item:e,mediaField:g,titleField:m,descriptionField:v,regularFields:x,badgeFields:w,config:{sizes:C},posinset:n,setsize:O},s(e))}))})},e)))}),_&&!E&&(0,a.jsx)(b.Composite,{render:(0,a.jsx)(S_,{className:Ht("dataviews-view-picker-grid",c),previewSize:j,"aria-busy":i,ref:d}),virtualFocus:!0,orientation:"horizontal",role:"listbox","aria-multiselectable":S,"aria-label":f,children:t.map(((e,t)=>{let n=P?t+1:void 0;return P||(n=(I-1)*V+t+1),(0,a.jsx)(M_,{view:l,multiselect:S,selection:o,onChangeSelection:r,getItemId:s,item:e,mediaField:g,titleField:m,descriptionField:v,regularFields:x,badgeFields:w,config:{sizes:C},posinset:n,setsize:O},s(e))}))}),!_&&(0,a.jsx)("div",{className:Ht({"dataviews-loading":i,"dataviews-no-results":!i}),children:i?(0,a.jsx)("p",{children:(0,a.jsx)(b.Spinner,{})}):u}),_&&i&&(0,a.jsx)("p",{className:"dataviews-loading-more",children:(0,a.jsx)(b.Spinner,{})})]})};const R_=[{value:120,breakpoint:1},{value:170,breakpoint:1},{value:230,breakpoint:1},{value:290,breakpoint:1112},{value:350,breakpoint:1636},{value:430,breakpoint:588}];function L_(){const e=(0,h.useContext)(Rw),t=e.view,n=R_.filter((t=>e.containerWidth>=t.breakpoint)),s=t.layout?.previewSize??230,i=n.map(((e,t)=>({...e,index:t}))).filter((e=>e.value<=s)).sort(((e,t)=>t.value-e.value))[0]?.index??0,r=n.map(((e,t)=>({value:t})));return(0,a.jsx)(b.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,showTooltip:!1,label:(0,w.__)("Preview size"),value:i,min:0,max:n.length-1,withInputField:!1,onChange:(s=0)=>{e.onChangeView({...t,layout:{...t.layout,previewSize:n[s].value}})},step:1,marks:r})}const z_=[{type:kx,label:(0,w.__)("Table"),component:j_,icon:Lw,viewConfigOptions:function(){const e=(0,h.useContext)(Rw),t=e.view;return(0,a.jsxs)(b.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,size:"__unstable-large",label:(0,w.__)("Density"),value:t.layout?.density||"balanced",onChange:n=>{e.onChangeView({...t,layout:{...t.layout,density:n}})},isBlock:!0,children:[(0,a.jsx)(b.__experimentalToggleGroupControlOption,{value:"comfortable",label:(0,w._x)("Comfortable","Density option for DataView layout")},"comfortable"),(0,a.jsx)(b.__experimentalToggleGroupControlOption,{value:"balanced",label:(0,w._x)("Balanced","Density option for DataView layout")},"balanced"),(0,a.jsx)(b.__experimentalToggleGroupControlOption,{value:"compact",label:(0,w._x)("Compact","Density option for DataView layout")},"compact")]})}},{type:Ex,label:(0,w.__)("Grid"),component:E_,icon:zw,viewConfigOptions:L_},{type:"list",label:(0,w.__)("List"),component:function e(t){const{actions:n,data:s,fields:i,getItemId:r,isLoading:o,onChangeSelection:l,selection:c,view:u,className:d,empty:p}=t,f=(0,y.useInstanceId)(e,"view-list"),m=s?.findLast((e=>c.includes(r(e)))),g=i.find((e=>e.id===u.titleField)),v=i.find((e=>e.id===u.mediaField)),x=i.find((e=>e.id===u.descriptionField)),_=(u?.fields??[]).map((e=>i.find((t=>e===t.id)))).filter(A_),j=e=>l([r(e)]),S=(0,h.useCallback)((e=>`${f}-${r(e)}`),[f,r]),C=(0,h.useCallback)(((e,t)=>t.startsWith(S(e))),[S]),[k,E]=(0,h.useState)(void 0);(0,h.useEffect)((()=>{m&&E(I_(S(m)))}),[m,S]);const P=s.findIndex((e=>C(e,k??""))),I=(0,y.usePrevious)(P),V=-1!==P,O=(0,h.useCallback)(((e,t)=>{const n=Math.min(s.length-1,Math.max(0,e));if(!s[n])return;const i=t(S(s[n]));E(i),document.getElementById(i)?.focus()}),[s,S]);(0,h.useEffect)((()=>{!V&&(void 0!==I&&-1!==I)&&O(I,I_)}),[V,O,I]);const T=(0,h.useCallback)((e=>{"ArrowDown"===e.key&&(e.preventDefault(),O(P+1,V_)),"ArrowUp"===e.key&&(e.preventDefault(),O(P-1,V_))}),[O,P]),A=s?.length;if(!A)return(0,a.jsx)("div",{className:Ht({"dataviews-loading":o,"dataviews-no-results":!A&&!o}),children:!A&&(o?(0,a.jsx)("p",{children:(0,a.jsx)(b.Spinner,{})}):p)});const N=u.groupByField?i.find((e=>e.id===u.groupByField)):null,F=N?b_(s,N):null;return A&&N&&F?(0,a.jsx)(b.Composite,{id:`${f}`,render:(0,a.jsx)("div",{}),className:"dataviews-view-list__group",role:"grid",activeId:k,setActiveId:E,children:(0,a.jsx)(b.__experimentalVStack,{spacing:4,className:Ht("dataviews-view-list",d),children:Array.from(F.entries()).map((([e,t])=>(0,a.jsxs)(b.__experimentalVStack,{spacing:2,children:[(0,a.jsx)("h3",{className:"dataviews-view-list__group-header",children:(0,w.sprintf)((0,w.__)("%1$s: %2$s"),N.label,e)}),t.map((e=>{const t=S(e);return(0,a.jsx)(T_,{view:u,idPrefix:t,actions:n,item:e,isSelected:e===m,onSelect:j,mediaField:v,titleField:g,descriptionField:x,otherFields:_,onDropdownTriggerKeyDown:T},t)}))]},e)))})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.Composite,{id:f,render:(0,a.jsx)("div",{}),className:Ht("dataviews-view-list",d),role:u.infiniteScrollEnabled?"feed":"grid",activeId:k,setActiveId:E,children:s.map(((e,t)=>{const s=S(e);return(0,a.jsx)(T_,{view:u,idPrefix:s,actions:n,item:e,isSelected:e===m,onSelect:j,mediaField:v,titleField:g,descriptionField:x,otherFields:_,onDropdownTriggerKeyDown:T,posinset:u.infiniteScrollEnabled?t+1:void 0},s)}))}),A&&o&&(0,a.jsx)("p",{className:"dataviews-loading-more",children:(0,a.jsx)(b.Spinner,{})})]})},icon:(0,w.isRTL)()?Hw:Gw},{type:"pickerGrid",label:(0,w.__)("Grid"),component:D_,icon:zw,viewConfigOptions:L_,isPicker:!0}],{Menu:H_}=Zx(b.privateApis);function G_({filters:e,view:t,onChangeView:n,setOpenedFilter:s,triggerProps:i}){const r=e.filter((e=>!e.isVisible));return(0,a.jsxs)(H_,{children:[(0,a.jsx)(H_.TriggerButton,{...i}),(0,a.jsx)(H_.Popover,{children:r.map((e=>(0,a.jsx)(H_.Item,{onClick:()=>{s(e.field),n({...t,page:1,filters:[...t.filters||[],{field:e.field,value:void 0,operator:e.operators[0]}]})},children:(0,a.jsx)(H_.ItemLabel,{children:e.name})},e.field)))})]})}var W_=(0,h.forwardRef)((function({filters:e,view:t,onChangeView:n,setOpenedFilter:s},i){if(!e.length||e.every((({isPrimary:e})=>e)))return null;const r=e.filter((e=>!e.isVisible));return(0,a.jsx)(G_,{triggerProps:{render:(0,a.jsx)(b.Button,{accessibleWhenDisabled:!0,size:"compact",className:"dataviews-filters-button",variant:"tertiary",disabled:!r.length,ref:i}),children:(0,w.__)("Add filter")},filters:e,view:t,onChangeView:n,setOpenedFilter:s})}));function U_({buttonRef:e,filtersCount:t,children:n}){return(0,h.useEffect)((()=>()=>{e.current?.focus()}),[e]),(0,a.jsxs)(a.Fragment,{children:[n,!!t&&(0,a.jsx)("span",{className:"dataviews-filters-toggle__count",children:t})]})}var q_=function(){const{filters:e,view:t,onChangeView:n,setOpenedFilter:s,isShowingFilter:i,setIsShowingFilter:r}=(0,h.useContext)(Rw),o=(0,h.useRef)(null),l=(0,h.useCallback)((e=>{n(e),r(!0)}),[n,r]),c=!!e.filter((e=>e.isVisible)).length;if(0===e.length)return null;const u={label:(0,w.__)("Add filter"),"aria-expanded":!1,isPressed:!1},d={label:(0,w._x)("Filter","verb"),"aria-expanded":i,isPressed:i,onClick:()=>{i||s(null),r(!i)}},p=(0,a.jsx)(b.Button,{ref:o,className:"dataviews-filters__visibility-toggle",size:"compact",icon:u_,...c?d:u});return(0,a.jsx)("div",{className:"dataviews-filters__container-visibility-toggle",children:c?(0,a.jsx)(U_,{buttonRef:o,filtersCount:t.filters?.length,children:p}):(0,a.jsx)(G_,{filters:e,view:t,onChangeView:l,setOpenedFilter:s,triggerProps:{render:p}})})},Z_=Object.defineProperty,Y_=Object.defineProperties,K_=Object.getOwnPropertyDescriptors,X_=Object.getOwnPropertySymbols,Q_=Object.prototype.hasOwnProperty,J_=Object.prototype.propertyIsEnumerable,$_=(e,t,n)=>t in e?Z_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ej=(e,t)=>{for(var n in t||(t={}))Q_.call(t,n)&&$_(e,n,t[n]);if(X_)for(var n of X_(t))J_.call(t,n)&&$_(e,n,t[n]);return e},tj=(e,t)=>Y_(e,K_(t)),nj=(e,t)=>{var n={};for(var s in e)Q_.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&X_)for(var s of X_(e))t.indexOf(s)<0&&J_.call(e,s)&&(n[s]=e[s]);return n},sj=Object.defineProperty,ij=Object.defineProperties,rj=Object.getOwnPropertyDescriptors,aj=Object.getOwnPropertySymbols,oj=Object.prototype.hasOwnProperty,lj=Object.prototype.propertyIsEnumerable,cj=(e,t,n)=>t in e?sj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uj=(e,t)=>{for(var n in t||(t={}))oj.call(t,n)&&cj(e,n,t[n]);if(aj)for(var n of aj(t))lj.call(t,n)&&cj(e,n,t[n]);return e},dj=(e,t)=>ij(e,rj(t)),hj=(e,t)=>{var n={};for(var s in e)oj.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&aj)for(var s of aj(e))t.indexOf(s)<0&&lj.call(e,s)&&(n[s]=e[s]);return n};function pj(...e){}function fj(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function mj(...e){return(...t)=>{for(const n of e)"function"==typeof n&&n(...t)}}function gj(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function vj(e){return e}function yj(e,t){if(!e){if("string"!=typeof t)throw new Error("Invariant failed");throw new Error(t)}}function xj(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function bj(e){const t={};for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}function wj(...e){for(const t of e)if(void 0!==t)return t}function _j(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function jj(e){if(!function(e){return!!e&&!!(0,Gn.isValidElement)(e)&&("ref"in e.props||"ref"in e)}(e))return null;return ej({},e.props).ref||e.ref}var Sj,Cj="undefined"!=typeof window&&!!(null==(Sj=window.document)?void 0:Sj.createElement);function kj(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function Ej(e,t=!1){const{activeElement:n}=kj(e);if(!(null==n?void 0:n.nodeName))return null;if("IFRAME"===n.tagName&&n.contentDocument)return Ej(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=kj(n).getElementById(e);if(t)return t}}return n}function Pj(e,t){return e===t||e.contains(t)}function Ij(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==Vj.indexOf(e.type)}var Vj=["button","color","file","image","reset","submit"];function Oj(e){try{const t=e instanceof HTMLInputElement&&null!==e.selectionStart,n="TEXTAREA"===e.tagName;return t||n||!1}catch(e){return!1}}function Tj(e){return e.isContentEditable||Oj(e)}function Aj(e){let t=0,n=0;if(Oj(e))t=e.selectionStart||0,n=e.selectionEnd||0;else if(e.isContentEditable){const s=kj(e).getSelection();if((null==s?void 0:s.rangeCount)&&s.anchorNode&&Pj(e,s.anchorNode)&&s.focusNode&&Pj(e,s.focusNode)){const i=s.getRangeAt(0),r=i.cloneRange();r.selectNodeContents(e),r.setEnd(i.startContainer,i.startOffset),t=r.toString().length,r.setEnd(i.endContainer,i.endOffset),n=r.toString().length}}return{start:t,end:n}}function Nj(e,t){const n=null==e?void 0:e.getAttribute("role");return n&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(n)?n:t}function Fj(e){if(!e)return null;const t=e=>"auto"===e||"scroll"===e;if(e.clientHeight&&e.scrollHeight>e.clientHeight){const{overflowY:n}=getComputedStyle(e);if(t(n))return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){const{overflowX:n}=getComputedStyle(e);if(t(n))return e}return Fj(e.parentElement)||document.scrollingElement||document.body}function Mj(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function Bj(e,t){const n=e.map(((e,t)=>[t,e]));let s=!1;return n.sort((([e,n],[i,r])=>{const a=t(n),o=t(r);return a===o?0:a&&o?function(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}(a,o)?(e>i&&(s=!0),-1):(e<i&&(s=!0),1):0})),s?n.map((([e,t])=>t)):e}function Dj(){return Cj&&!!navigator.maxTouchPoints}function Rj(){return!!Cj&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function Lj(){return Cj&&Rj()&&/apple/i.test(navigator.vendor)}function zj(e){return Boolean(e.currentTarget&&!Pj(e.currentTarget,e.target))}function Hj(e){return e.target===e.currentTarget}function Gj(e,t){const n=new FocusEvent("blur",t),s=e.dispatchEvent(n),i=dj(uj({},t),{bubbles:!0});return e.dispatchEvent(new FocusEvent("focusout",i)),s}function Wj(e,t){const n=new MouseEvent("click",t);return e.dispatchEvent(n)}function Uj(e,t){const n=t||e.currentTarget,s=e.relatedTarget;return!s||!Pj(n,s)}function qj(e,t,n,s){const i=(e=>{if(s){const t=setTimeout(e,s);return()=>clearTimeout(t)}const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})((()=>{e.removeEventListener(t,r,!0),n()})),r=()=>{i(),n()};return e.addEventListener(t,r,{once:!0,capture:!0}),i}function Zj(e,t,n,s=window){const i=[];try{s.document.addEventListener(e,t,n);for(const r of Array.from(s.frames))i.push(Zj(e,t,n,r))}catch(e){}return()=>{try{s.document.removeEventListener(e,t,n)}catch(e){}for(const e of i)e()}}var Yj=ej({},Wn),Kj=Yj.useId,Xj=(Yj.useDeferredValue,Yj.useInsertionEffect),Qj=Cj?Gn.useLayoutEffect:Gn.useEffect;function Jj(e){const t=(0,Gn.useRef)((()=>{throw new Error("Cannot call an event handler while rendering.")}));return Xj?Xj((()=>{t.current=e})):t.current=e,(0,Gn.useCallback)(((...e)=>{var n;return null==(n=t.current)?void 0:n.call(t,...e)}),[])}function $j(...e){return(0,Gn.useMemo)((()=>{if(e.some(Boolean))return t=>{for(const n of e)_j(n,t)}}),e)}function eS(e){if(Kj){const t=Kj();return e||t}const[t,n]=(0,Gn.useState)(e);return Qj((()=>{if(e||t)return;const s=Math.random().toString(36).slice(2,8);n(`id-${s}`)}),[e,t]),e||t}function tS(e,t,n){const s=function(e){const[t]=(0,Gn.useState)(e);return t}(n),[i,r]=(0,Gn.useState)(s);return(0,Gn.useEffect)((()=>{const n=e&&"current"in e?e.current:e;if(!n)return;const i=()=>{const e=n.getAttribute(t);r(null==e?s:e)},a=new MutationObserver(i);return a.observe(n,{attributeFilter:[t]}),i(),()=>a.disconnect()}),[e,t,s]),i}function nS(e,t){const n=(0,Gn.useRef)(!1);(0,Gn.useEffect)((()=>{if(n.current)return e();n.current=!0}),t),(0,Gn.useEffect)((()=>()=>{n.current=!1}),[])}function sS(e){return Jj("function"==typeof e?e:()=>e)}function iS(e,t,n=[]){const s=(0,Gn.useCallback)((n=>(e.wrapElement&&(n=e.wrapElement(n)),t(n))),[...n,e.wrapElement]);return tj(ej({},e),{wrapElement:s})}var rS=!1,aS=0,oS=0;function lS(e){(function(e){const t=e.movementX||e.screenX-aS,n=e.movementY||e.screenY-oS;return aS=e.screenX,oS=e.screenY,t||n||!1})(e)&&(rS=!0)}function cS(){rS=!1}function uS(e){const t=Gn.forwardRef(((t,n)=>e(tj(ej({},t),{ref:n}))));return t.displayName=e.displayName||e.name,t}function dS(e,t){return Gn.memo(e,t)}function hS(e,t){const n=t,{wrapElement:s,render:i}=n,r=nj(n,["wrapElement","render"]),o=$j(t.ref,jj(i));let l;if(Gn.isValidElement(i)){const e=tj(ej({},i.props),{ref:o});l=Gn.cloneElement(i,function(e,t){const n=ej({},e);for(const s in t){if(!fj(t,s))continue;if("className"===s){const s="className";n[s]=e[s]?`${e[s]} ${t[s]}`:t[s];continue}if("style"===s){const s="style";n[s]=e[s]?ej(ej({},e[s]),t[s]):t[s];continue}const i=t[s];if("function"==typeof i&&s.startsWith("on")){const t=e[s];if("function"==typeof t){n[s]=(...e)=>{i(...e),t(...e)};continue}}n[s]=i}return n}(r,e))}else l=i?i(r):(0,a.jsx)(e,ej({},r));return s?s(l):l}function pS(e){const t=(t={})=>e(t);return t.displayName=e.name,t}function fS(e=[],t=[]){const n=Gn.createContext(void 0),s=Gn.createContext(void 0),i=()=>Gn.useContext(n),r=t=>e.reduceRight(((e,n)=>(0,a.jsx)(n,tj(ej({},t),{children:e}))),(0,a.jsx)(n.Provider,ej({},t)));return{context:n,scopedContext:s,useContext:i,useScopedContext:(e=!1)=>{const t=Gn.useContext(s),n=i();return e?t:t||n},useProviderContext:()=>{const e=Gn.useContext(s),t=i();if(!e||e!==t)return t},ContextProvider:r,ScopedContextProvider:e=>(0,a.jsx)(r,tj(ej({},e),{children:t.reduceRight(((t,n)=>(0,a.jsx)(n,tj(ej({},e),{children:t}))),(0,a.jsx)(s.Provider,ej({},e)))}))}}var mS=fS(),gS=mS.useContext,vS=(mS.useScopedContext,mS.useProviderContext,fS([mS.ContextProvider],[mS.ScopedContextProvider])),yS=vS.useContext,xS=(vS.useScopedContext,vS.useProviderContext),bS=vS.ContextProvider,wS=vS.ScopedContextProvider,_S=(0,Gn.createContext)(void 0),jS=(0,Gn.createContext)(void 0),SS=((0,Gn.createContext)(null),(0,Gn.createContext)(null),fS([bS],[wS])),CS=SS.useContext;SS.useScopedContext,SS.useProviderContext,SS.ContextProvider,SS.ScopedContextProvider;function kS(e,t){const n=e.__unstableInternals;return yj(n,"Invalid store"),n[t]}function ES(e,...t){let n=e,s=n,i=Symbol(),r=pj;const a=new Set,o=new Set,l=new Set,c=new Set,u=new Set,d=new WeakMap,h=new WeakMap,p=(e,t,n=c)=>(n.add(t),h.set(t,e),()=>{var e;null==(e=d.get(t))||e(),d.delete(t),h.delete(t),n.delete(t)}),f=(e,r,a=!1)=>{var l;if(!fj(n,e))return;const p=function(e,t){if(function(e){return"function"==typeof e}(e))return e(function(e){return"function"==typeof e}(t)?t():t);return e}(r,n[e]);if(p===n[e])return;if(!a)for(const n of t)null==(l=null==n?void 0:n.setState)||l.call(n,e,p);const f=n;n=dj(uj({},n),{[e]:p});const m=Symbol();i=m,o.add(e);const g=(t,s,i)=>{var r;const a=h.get(t);a&&!a.some((t=>i?i.has(t):t===e))||(null==(r=d.get(t))||r(),d.set(t,t(n,s)))};for(const e of c)g(e,f);queueMicrotask((()=>{if(i!==m)return;const e=n;for(const e of u)g(e,s,o);s=e,o.clear()}))},m={getState:()=>n,setState:f,__unstableInternals:{setup:e=>(l.add(e),()=>l.delete(e)),init:()=>{const e=a.size,s=Symbol();a.add(s);const i=()=>{a.delete(s),a.size||r()};if(e)return i;const o=(c=n,Object.keys(c)).map((e=>mj(...t.map((t=>{var n;const s=null==(n=null==t?void 0:t.getState)?void 0:n.call(t);if(s&&fj(s,e))return OS(t,[e],(t=>{f(e,t[e],!0)}))})))));var c;const u=[];for(const e of l)u.push(e());const d=t.map(IS);return r=mj(...o,...u,...d),i},subscribe:(e,t)=>p(e,t),sync:(e,t)=>(d.set(t,t(n,n)),p(e,t)),batch:(e,t)=>(d.set(t,t(n,s)),p(e,t,u)),pick:e=>ES(function(e,t){const n={};for(const s of t)fj(e,s)&&(n[s]=e[s]);return n}(n,e),m),omit:e=>ES(function(e,t){const n=uj({},e);for(const e of t)fj(n,e)&&delete n[e];return n}(n,e),m)}};return m}function PS(e,...t){if(e)return kS(e,"setup")(...t)}function IS(e,...t){if(e)return kS(e,"init")(...t)}function VS(e,...t){if(e)return kS(e,"subscribe")(...t)}function OS(e,...t){if(e)return kS(e,"sync")(...t)}function TS(e,...t){if(e)return kS(e,"batch")(...t)}function AS(e,...t){if(e)return kS(e,"omit")(...t)}function NS(...e){const t=e.reduce(((e,t)=>{var n;const s=null==(n=null==t?void 0:t.getState)?void 0:n.call(t);return s?Object.assign(e,s):e}),{}),n=ES(t,...e);return Object.assign({},...e,n)}var FS=i(422),{useSyncExternalStore:MS}=FS;function BS(e,t=vj){const n=Gn.useCallback((t=>e?VS(e,null,t):()=>{}),[e]),s=()=>{const n="string"==typeof t?t:null,s="function"==typeof t?t:null,i=null==e?void 0:e.getState();return s?s(i):i&&n&&fj(i,n)?i[n]:void 0};return MS(n,s,s)}function DS(e,t){const n=Gn.useRef({}),s=Gn.useCallback((t=>e?VS(e,null,t):()=>{}),[e]),i=()=>{const s=null==e?void 0:e.getState();let i=!1;const r=n.current;for(const e in t){const n=t[e];if("function"==typeof n){const t=n(s);t!==r[e]&&(r[e]=t,i=!0)}if("string"==typeof n){if(!s)continue;if(!fj(s,n))continue;const t=s[n];t!==r[e]&&(r[e]=t,i=!0)}}return i&&(n.current=ej({},r)),n.current};return MS(s,i,i)}function RS(e,t,n,s){const i=fj(t,n)?t[n]:void 0,r=s?t[s]:void 0,a=function(e){const t=(0,Gn.useRef)(e);return Qj((()=>{t.current=e})),t}({value:i,setValue:r});Qj((()=>OS(e,[n],((e,t)=>{const{value:s,setValue:i}=a.current;i&&e[n]!==t[n]&&e[n]!==s&&i(e[n])}))),[e,n]),Qj((()=>{if(void 0!==i)return e.setState(n,i),TS(e,[n],(()=>{void 0!==i&&e.setState(n,i)}))}))}function LS(e,t,n){return nS(t,[n.store]),RS(e,n,"items","setItems"),e}function zS(e){const t=eS(e.id);return ej({id:t},e)}function HS(e,t,n){return RS(e=LS(e,t,n),n,"activeId","setActiveId"),RS(e,n,"includesBaseElement"),RS(e,n,"virtualFocus"),RS(e,n,"orientation"),RS(e,n,"rtl"),RS(e,n,"focusLoop"),RS(e,n,"focusWrap"),RS(e,n,"focusShift"),e}function GS(e,t,n){return nS(t,[n.store,n.disclosure]),RS(e,n,"open","setOpen"),RS(e,n,"mounted","setMounted"),RS(e,n,"animated"),Object.assign(e,{disclosure:n.disclosure})}function WS(e,t,n){return GS(e,t,n)}function US(e,t,n){return nS(t,[n.popover]),RS(e,n,"placement"),WS(e,t,n)}function qS(e={}){var t;e.store;const n=null==(t=e.store)?void 0:t.getState(),s=wj(e.items,null==n?void 0:n.items,e.defaultItems,[]),i=new Map(s.map((e=>[e.id,e]))),r={items:s,renderedItems:wj(null==n?void 0:n.renderedItems,[])},a=function(e){return null==e?void 0:e.__unstablePrivateStore}(e.store),o=ES({items:s,renderedItems:r.renderedItems},a),l=ES(r,e.store),c=e=>{const t=Bj(e,(e=>e.element));o.setState("renderedItems",t),l.setState("renderedItems",t)};PS(l,(()=>IS(o))),PS(o,(()=>TS(o,["items"],(e=>{l.setState("items",e.items)})))),PS(o,(()=>TS(o,["renderedItems"],(e=>{let t=!0,n=requestAnimationFrame((()=>{const{renderedItems:t}=l.getState();e.renderedItems!==t&&c(e.renderedItems)}));if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(n);const s=function(e){var t;const n=e.find((e=>!!e.element)),s=[...e].reverse().find((e=>!!e.element));let i=null==(t=null==n?void 0:n.element)?void 0:t.parentElement;for(;i&&(null==s?void 0:s.element);){if(s&&i.contains(s.element))return i;i=i.parentElement}return kj(i).body}(e.renderedItems),i=new IntersectionObserver((()=>{t?t=!1:(cancelAnimationFrame(n),n=requestAnimationFrame((()=>c(e.renderedItems))))}),{root:s});for(const t of e.renderedItems)t.element&&i.observe(t.element);return()=>{cancelAnimationFrame(n),i.disconnect()}}))));const u=(e,t,n=!1)=>{let s;t((t=>{const n=t.findIndex((({id:t})=>t===e.id)),r=t.slice();if(-1!==n){s=t[n];const a=uj(uj({},s),e);r[n]=a,i.set(e.id,a)}else r.push(e),i.set(e.id,e);return r}));return()=>{t((t=>{if(!s)return n&&i.delete(e.id),t.filter((({id:t})=>t!==e.id));const r=t.findIndex((({id:t})=>t===e.id));if(-1===r)return t;const a=t.slice();return a[r]=s,i.set(e.id,s),a}))}},d=e=>u(e,(e=>o.setState("items",e)),!0);return dj(uj({},l),{registerItem:d,renderItem:e=>mj(d(e),u(e,(e=>o.setState("renderedItems",e)))),item:e=>{if(!e)return null;let t=i.get(e);if(!t){const{items:n}=o.getState();t=n.find((t=>t.id===e)),t&&i.set(e,t)}return t||null},__unstablePrivateStore:o})}function ZS(e){const t=[];for(const n of e)t.push(...n);return t}function YS(e){return e.slice().reverse()}var KS={id:null};function XS(e,t){return e.find((e=>t?!e.disabled&&e.id!==t:!e.disabled))}function QS(e,t){return e.filter((e=>e.rowId===t))}function JS(e){const t=[];for(const n of e){const e=t.find((e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===n.rowId}));e?e.push(n):t.push([n])}return t}function $S(e){let t=0;for(const{length:n}of e)n>t&&(t=n);return t}function eC(e={}){var t;const n=null==(t=e.store)?void 0:t.getState(),s=qS(e),i=wj(e.activeId,null==n?void 0:n.activeId,e.defaultActiveId),r=ES(dj(uj({},s.getState()),{id:wj(e.id,null==n?void 0:n.id,`id-${Math.random().toString(36).slice(2,8)}`),activeId:i,baseElement:wj(null==n?void 0:n.baseElement,null),includesBaseElement:wj(e.includesBaseElement,null==n?void 0:n.includesBaseElement,null===i),moves:wj(null==n?void 0:n.moves,0),orientation:wj(e.orientation,null==n?void 0:n.orientation,"both"),rtl:wj(e.rtl,null==n?void 0:n.rtl,!1),virtualFocus:wj(e.virtualFocus,null==n?void 0:n.virtualFocus,!1),focusLoop:wj(e.focusLoop,null==n?void 0:n.focusLoop,!1),focusWrap:wj(e.focusWrap,null==n?void 0:n.focusWrap,!1),focusShift:wj(e.focusShift,null==n?void 0:n.focusShift,!1)}),s,e.store);PS(r,(()=>OS(r,["renderedItems","activeId"],(e=>{r.setState("activeId",(t=>{var n;return void 0!==t?t:null==(n=XS(e.renderedItems))?void 0:n.id}))}))));const a=(e="next",t={})=>{var n,s;const i=r.getState(),{skip:a=0,activeId:o=i.activeId,focusShift:l=i.focusShift,focusLoop:c=i.focusLoop,focusWrap:u=i.focusWrap,includesBaseElement:d=i.includesBaseElement,renderedItems:h=i.renderedItems,rtl:p=i.rtl}=t,f="up"===e||"down"===e,m="next"===e||"down"===e,g=m?p&&!f:!p||f,v=l&&!a;let y=f?ZS(function(e,t,n){const s=$S(e);for(const i of e)for(let e=0;e<s;e+=1){const s=i[e];if(!s||n&&s.disabled){const s=0===e&&n?XS(i):i[e-1];i[e]=s&&t!==s.id&&n?s:{id:"__EMPTY_ITEM__",disabled:!0,rowId:null==s?void 0:s.rowId}}}return e}(JS(h),o,v)):h;if(y=g?YS(y):y,y=f?function(e){const t=JS(e),n=$S(t),s=[];for(let e=0;e<n;e+=1)for(const n of t){const t=n[e];t&&s.push(dj(uj({},t),{rowId:t.rowId?`${e}`:void 0}))}return s}(y):y,null==o)return null==(n=XS(y))?void 0:n.id;const x=y.find((e=>e.id===o));if(!x)return null==(s=XS(y))?void 0:s.id;const b=y.some((e=>e.rowId)),w=y.indexOf(x),_=y.slice(w+1),j=QS(_,x.rowId);if(a){const e=function(e,t){return e.filter((e=>t?!e.disabled&&e.id!==t:!e.disabled))}(j,o),t=e.slice(a)[0]||e[e.length-1];return null==t?void 0:t.id}const S=c&&(f?"horizontal"!==c:"vertical"!==c),C=b&&u&&(f?"horizontal"!==u:"vertical"!==u),k=m?(!b||f)&&S&&d:!!f&&d;if(S){const e=function(e,t,n=!1){const s=e.findIndex((e=>e.id===t));return[...e.slice(s+1),...n?[KS]:[],...e.slice(0,s)]}(C&&!k?y:QS(y,x.rowId),o,k),t=XS(e,o);return null==t?void 0:t.id}if(C){const e=XS(k?j:_,o);return k?(null==e?void 0:e.id)||null:null==e?void 0:e.id}const E=XS(j,o);return!E&&k?null:null==E?void 0:E.id};return dj(uj(uj({},s),r),{setBaseElement:e=>r.setState("baseElement",e),setActiveId:e=>r.setState("activeId",e),move:e=>{void 0!==e&&(r.setState("activeId",e),r.setState("moves",(e=>e+1)))},first:()=>{var e;return null==(e=XS(r.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=XS(YS(r.getState().renderedItems)))?void 0:e.id},next:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),a("next",e)),previous:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),a("previous",e)),down:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),a("down",e)),up:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),a("up",e))})}function tC(e={}){return function(e={}){const t=NS(e.store,AS(e.disclosure,["contentElement","disclosureElement"])),n=null==t?void 0:t.getState(),s=wj(e.open,null==n?void 0:n.open,e.defaultOpen,!1),i=wj(e.animated,null==n?void 0:n.animated,!1),r=ES({open:s,animated:i,animating:!!i&&s,mounted:s,contentElement:wj(null==n?void 0:n.contentElement,null),disclosureElement:wj(null==n?void 0:n.disclosureElement,null)},t);return PS(r,(()=>OS(r,["animated","animating"],(e=>{e.animated||r.setState("animating",!1)})))),PS(r,(()=>VS(r,["open"],(()=>{r.getState().animated&&r.setState("animating",!0)})))),PS(r,(()=>OS(r,["open","animating"],(e=>{r.setState("mounted",e.open||e.animating)})))),dj(uj({},r),{disclosure:e.disclosure,setOpen:e=>r.setState("open",e),show:()=>r.setState("open",!0),hide:()=>r.setState("open",!1),toggle:()=>r.setState("open",(e=>!e)),stopAnimation:()=>r.setState("animating",!1),setContentElement:e=>r.setState("contentElement",e),setDisclosureElement:e=>r.setState("disclosureElement",e)})}(e)}var nC=Lj()&&Dj();function sC(e={}){var t=e,{tag:n}=t,s=hj(t,["tag"]);const i=NS(s.store,function(e,...t){if(e)return kS(e,"pick")(...t)}(n,["value","rtl"])),r=null==n?void 0:n.getState(),a=null==i?void 0:i.getState(),o=wj(s.activeId,null==a?void 0:a.activeId,s.defaultActiveId,null),l=eC(dj(uj({},s),{activeId:o,includesBaseElement:wj(s.includesBaseElement,null==a?void 0:a.includesBaseElement,!0),orientation:wj(s.orientation,null==a?void 0:a.orientation,"vertical"),focusLoop:wj(s.focusLoop,null==a?void 0:a.focusLoop,!0),focusWrap:wj(s.focusWrap,null==a?void 0:a.focusWrap,!0),virtualFocus:wj(s.virtualFocus,null==a?void 0:a.virtualFocus,!0)})),c=function(e={}){var t=e,{popover:n}=t,s=hj(t,["popover"]);const i=NS(s.store,AS(n,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"])),r=null==i?void 0:i.getState(),a=tC(dj(uj({},s),{store:i})),o=wj(s.placement,null==r?void 0:r.placement,"bottom"),l=ES(dj(uj({},a.getState()),{placement:o,currentPlacement:o,anchorElement:wj(null==r?void 0:r.anchorElement,null),popoverElement:wj(null==r?void 0:r.popoverElement,null),arrowElement:wj(null==r?void 0:r.arrowElement,null),rendered:Symbol("rendered")}),a,i);return dj(uj(uj({},a),l),{setAnchorElement:e=>l.setState("anchorElement",e),setPopoverElement:e=>l.setState("popoverElement",e),setArrowElement:e=>l.setState("arrowElement",e),render:()=>l.setState("rendered",Symbol("rendered"))})}(dj(uj({},s),{placement:wj(s.placement,null==a?void 0:a.placement,"bottom-start")})),u=wj(s.value,null==a?void 0:a.value,s.defaultValue,""),d=wj(s.selectedValue,null==a?void 0:a.selectedValue,null==r?void 0:r.values,s.defaultSelectedValue,""),h=Array.isArray(d),p=dj(uj(uj({},l.getState()),c.getState()),{value:u,selectedValue:d,resetValueOnSelect:wj(s.resetValueOnSelect,null==a?void 0:a.resetValueOnSelect,h),resetValueOnHide:wj(s.resetValueOnHide,null==a?void 0:a.resetValueOnHide,h&&!n),activeValue:null==a?void 0:a.activeValue}),f=ES(p,l,c,i);return nC&&PS(f,(()=>OS(f,["virtualFocus"],(()=>{f.setState("virtualFocus",!1)})))),PS(f,(()=>{if(n)return mj(OS(f,["selectedValue"],(e=>{Array.isArray(e.selectedValue)&&n.setValues(e.selectedValue)})),OS(n,["values"],(e=>{f.setState("selectedValue",e.values)})))})),PS(f,(()=>OS(f,["resetValueOnHide","mounted"],(e=>{e.resetValueOnHide&&(e.mounted||f.setState("value",u))})))),PS(f,(()=>OS(f,["open"],(e=>{e.open||(f.setState("activeId",o),f.setState("moves",0))})))),PS(f,(()=>OS(f,["moves","activeId"],((e,t)=>{e.moves===t.moves&&f.setState("activeValue",void 0)})))),PS(f,(()=>TS(f,["moves","renderedItems"],((e,t)=>{if(e.moves===t.moves)return;const{activeId:n}=f.getState(),s=l.item(n);f.setState("activeValue",null==s?void 0:s.value)})))),dj(uj(uj(uj({},c),l),f),{tag:n,setValue:e=>f.setState("value",e),resetValue:()=>f.setState("value",p.value),setSelectedValue:e=>f.setState("selectedValue",e)})}function iC(e={}){e=function(e){const t=CS();return zS(e=tj(ej({},e),{tag:void 0!==e.tag?e.tag:t}))}(e);const[t,n]=function(e,t){const[n,s]=Gn.useState((()=>e(t)));Qj((()=>IS(n)),[n]);const i=Gn.useCallback((e=>BS(n,e)),[n]);return[Gn.useMemo((()=>tj(ej({},n),{useState:i})),[n,i]),Jj((()=>{s((n=>e(ej(ej({},t),n.getState()))))}))]}(sC,e);return function(e,t,n){return nS(t,[n.tag]),RS(e,n,"value","setValue"),RS(e,n,"selectedValue","setSelectedValue"),RS(e,n,"resetValueOnHide"),RS(e,n,"resetValueOnSelect"),Object.assign(HS(US(e,t,n),t,n),{tag:n.tag})}(t,n,e)}var rC=fS(),aC=(rC.useContext,rC.useScopedContext,rC.useProviderContext),oC=fS([rC.ContextProvider],[rC.ScopedContextProvider]),lC=(oC.useContext,oC.useScopedContext,oC.useProviderContext,oC.ContextProvider),cC=oC.ScopedContextProvider,uC=((0,Gn.createContext)(void 0),(0,Gn.createContext)(void 0),fS([lC],[cC])),dC=(uC.useContext,uC.useScopedContext,uC.useProviderContext),hC=uC.ContextProvider,pC=uC.ScopedContextProvider,fC=(0,Gn.createContext)(void 0),mC=fS([hC,bS],[pC,wS]),gC=mC.useContext,vC=mC.useScopedContext,yC=mC.useProviderContext,xC=mC.ContextProvider,bC=mC.ScopedContextProvider,wC=(0,Gn.createContext)(void 0),_C=(0,Gn.createContext)(!1);function jC(e={}){const t=iC(e);return(0,a.jsx)(xC,{value:t,children:e.children})}var SC=pS((function(e){var t=e,{store:n}=t,s=nj(t,["store"]);const i=yC();yj(n=n||i,!1);const r=n.useState((e=>{var t;return null==(t=e.baseElement)?void 0:t.id}));return bj(s=ej({htmlFor:r},s))})),CC=dS(uS((function(e){return hS("label",SC(e))}))),kC=pS((function(e){var t=e,{store:n}=t,s=nj(t,["store"]);const i=dC();return n=n||i,s=tj(ej({},s),{ref:$j(null==n?void 0:n.setAnchorElement,s.ref)})}));uS((function(e){return hS("div",kC(e))}));function EC(e,t){return t&&e.item(t)||null}var PC=Symbol("FOCUS_SILENTLY");function IC(e,t,n){if(!t)return!1;if(t===n)return!1;const s=e.item(t.id);return!!s&&(!n||s.element!==n)}var VC=(0,Gn.createContext)(!0),OC="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'])";function TC(e){return!!e.matches(OC)&&(!!function(e){if("function"==typeof e.checkVisibility)return e.checkVisibility();const t=e;return t.offsetWidth>0||t.offsetHeight>0||e.getClientRects().length>0}(e)&&!e.closest("[inert]"))}function AC(e){const t=Ej(e);if(!t)return!1;if(t===e)return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&n===e.id}function NC(e){const t=Ej(e);if(!t)return!1;if(Pj(e,t))return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&("id"in e&&(n===e.id||!!e.querySelector(`#${CSS.escape(n)}`)))}var FC=Lj(),MC=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],BC=Symbol("safariFocusAncestor");function DC(e,t){e&&(e[BC]=t)}function RC(e){return!("input"!==e.tagName.toLowerCase()||!e.type)&&("radio"===e.type||"checkbox"===e.type)}function LC(e,t,n,s,i){return e?t?n&&!s?-1:void 0:n?i:i||0:i}function zC(e,t){return Jj((n=>{null==e||e(n),n.defaultPrevented||t&&(n.stopPropagation(),n.preventDefault())}))}var HC=!0;function GC(e){const t=e.target;t&&"hasAttribute"in t&&(t.hasAttribute("data-focus-visible")||(HC=!1))}function WC(e){e.metaKey||e.ctrlKey||e.altKey||(HC=!0)}var UC=pS((function(e){var t=e,{focusable:n=!0,accessibleWhenDisabled:s,autoFocus:i,onFocusVisible:r}=t,a=nj(t,["focusable","accessibleWhenDisabled","autoFocus","onFocusVisible"]);const o=(0,Gn.useRef)(null);(0,Gn.useEffect)((()=>{n&&(Zj("mousedown",GC,!0),Zj("keydown",WC,!0))}),[n]),FC&&(0,Gn.useEffect)((()=>{if(!n)return;const e=o.current;if(!e)return;if(!RC(e))return;const t=function(e){return"labels"in e?e.labels:null}(e);if(!t)return;const s=()=>queueMicrotask((()=>e.focus()));for(const e of t)e.addEventListener("mouseup",s);return()=>{for(const e of t)e.removeEventListener("mouseup",s)}}),[n]);const l=n&&xj(a),c=!!l&&!s,[u,d]=(0,Gn.useState)(!1);(0,Gn.useEffect)((()=>{n&&c&&u&&d(!1)}),[n,c,u]),(0,Gn.useEffect)((()=>{if(!n)return;if(!u)return;const e=o.current;if(!e)return;if("undefined"==typeof IntersectionObserver)return;const t=new IntersectionObserver((()=>{TC(e)||d(!1)}));return t.observe(e),()=>t.disconnect()}),[n,u]);const h=zC(a.onKeyPressCapture,l),p=zC(a.onMouseDownCapture,l),f=zC(a.onClickCapture,l),m=a.onMouseDown,g=Jj((e=>{if(null==m||m(e),e.defaultPrevented)return;if(!n)return;const t=e.currentTarget;if(!FC)return;if(zj(e))return;if(!Ij(t)&&!RC(t))return;let s=!1;const i=()=>{s=!0};t.addEventListener("focusin",i,{capture:!0,once:!0});const r=function(e){for(;e&&!TC(e);)e=e.closest(OC);return e||null}(t.parentElement);DC(r,!0),qj(t,"mouseup",(()=>{t.removeEventListener("focusin",i,!0),DC(r,!1),s||function(e){!NC(e)&&TC(e)&&e.focus()}(t)}))})),v=(e,t)=>{if(t&&(e.currentTarget=t),!n)return;const s=e.currentTarget;s&&AC(s)&&(null==r||r(e),e.defaultPrevented||(s.dataset.focusVisible="true",d(!0)))},y=a.onKeyDownCapture,x=Jj((e=>{if(null==y||y(e),e.defaultPrevented)return;if(!n)return;if(u)return;if(e.metaKey)return;if(e.altKey)return;if(e.ctrlKey)return;if(!Hj(e))return;const t=e.currentTarget;qj(t,"focusout",(()=>v(e,t)))})),b=a.onFocusCapture,w=Jj((e=>{if(null==b||b(e),e.defaultPrevented)return;if(!n)return;if(!Hj(e))return void d(!1);const t=e.currentTarget,s=()=>v(e,t);HC||function(e){const{tagName:t,readOnly:n,type:s}=e;return"TEXTAREA"===t&&!n||("SELECT"===t&&!n||("INPUT"!==t||n?!!e.isContentEditable||!("combobox"!==e.getAttribute("role")||!e.dataset.name):MC.includes(s)))}(e.target)?qj(e.target,"focusout",s):d(!1)})),_=a.onBlur,j=Jj((e=>{null==_||_(e),n&&Uj(e)&&d(!1)})),S=(0,Gn.useContext)(VC),C=Jj((e=>{n&&i&&e&&S&&queueMicrotask((()=>{AC(e)||TC(e)&&e.focus()}))})),k=function(e,t){const n=e=>{if("string"==typeof e)return e},[s,i]=(0,Gn.useState)((()=>n(t)));return Qj((()=>{const s=e&&"current"in e?e.current:e;i((null==s?void 0:s.tagName.toLowerCase())||n(t))}),[e,t]),s}(o),E=n&&function(e){return!e||"button"===e||"summary"===e||"input"===e||"select"===e||"textarea"===e||"a"===e}(k),P=n&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e}(k),I=a.style,V=(0,Gn.useMemo)((()=>c?ej({pointerEvents:"none"},I):I),[c,I]);return bj(a=tj(ej({"data-focus-visible":n&&u||void 0,"data-autofocus":i||void 0,"aria-disabled":l||void 0},a),{ref:$j(o,C,a.ref),style:V,tabIndex:LC(n,c,E,P,a.tabIndex),disabled:!(!P||!c)||void 0,contentEditable:l?void 0:a.contentEditable,onKeyPressCapture:h,onClickCapture:f,onMouseDownCapture:p,onMouseDown:g,onKeyDownCapture:x,onFocusCapture:w,onBlur:j}))}));uS((function(e){return hS("div",UC(e))}));function qC(e,t,n){return Jj((s=>{var i;if(null==t||t(s),s.defaultPrevented)return;if(s.isPropagationStopped())return;if(!Hj(s))return;if(function(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}(s))return;if(function(e){const t=e.target;return!(t&&!Oj(t)||1!==e.key.length||e.ctrlKey||e.metaKey)}(s))return;const r=e.getState(),a=null==(i=EC(e,r.activeId))?void 0:i.element;if(!a)return;const o=s,{view:l}=o,c=nj(o,["view"]);a!==(null==n?void 0:n.current)&&a.focus(),function(e,t,n){const s=new KeyboardEvent(t,n);return e.dispatchEvent(s)}(a,s.type,c)||s.preventDefault(),s.currentTarget.contains(a)&&s.stopPropagation()}))}var ZC=pS((function(e){var t=e,{store:n,composite:s=!0,focusOnMove:i=s,moveOnKeyPress:r=!0}=t,o=nj(t,["store","composite","focusOnMove","moveOnKeyPress"]);const l=xS();yj(n=n||l,!1);const c=(0,Gn.useRef)(null),u=(0,Gn.useRef)(null),d=function(e){const[t,n]=(0,Gn.useState)(!1),s=(0,Gn.useCallback)((()=>n(!0)),[]),i=e.useState((t=>EC(e,t.activeId)));return(0,Gn.useEffect)((()=>{const e=null==i?void 0:i.element;t&&e&&(n(!1),e.focus({preventScroll:!0}))}),[i,t]),s}(n),h=n.useState("moves"),[,p]=function(e){const[t,n]=(0,Gn.useState)(null);return Qj((()=>{if(null==t)return;if(!e)return;let n=null;return e((e=>(n=e,t))),()=>{e(n)}}),[t,e]),[t,n]}(s?n.setBaseElement:null);(0,Gn.useEffect)((()=>{var e;if(!n)return;if(!h)return;if(!s)return;if(!i)return;const{activeId:t}=n.getState(),r=null==(e=EC(n,t))?void 0:e.element;var a,o;r&&("scrollIntoView"in(a=r)?(a.focus({preventScroll:!0}),a.scrollIntoView(uj({block:"nearest",inline:"nearest"},o))):a.focus())}),[n,h,s,i]),Qj((()=>{if(!n)return;if(!h)return;if(!s)return;const{baseElement:e,activeId:t}=n.getState();if(!(null===t))return;if(!e)return;const i=u.current;u.current=null,i&&Gj(i,{relatedTarget:e}),AC(e)||e.focus()}),[n,h,s]);const f=n.useState("activeId"),m=n.useState("virtualFocus");Qj((()=>{var e;if(!n)return;if(!s)return;if(!m)return;const t=u.current;if(u.current=null,!t)return;const i=(null==(e=EC(n,f))?void 0:e.element)||Ej(t);i!==t&&Gj(t,{relatedTarget:i})}),[n,f,m,s]);const g=qC(n,o.onKeyDownCapture,u),v=qC(n,o.onKeyUpCapture,u),y=o.onFocusCapture,x=Jj((e=>{if(null==y||y(e),e.defaultPrevented)return;if(!n)return;const{virtualFocus:t}=n.getState();if(!t)return;const s=e.relatedTarget,i=function(e){const t=e[PC];return delete e[PC],t}(e.currentTarget);Hj(e)&&i&&(e.stopPropagation(),u.current=s)})),b=o.onFocus,w=Jj((e=>{if(null==b||b(e),e.defaultPrevented)return;if(!s)return;if(!n)return;const{relatedTarget:t}=e,{virtualFocus:i}=n.getState();i?Hj(e)&&!IC(n,t)&&queueMicrotask(d):Hj(e)&&n.setActiveId(null)})),_=o.onBlurCapture,j=Jj((e=>{var t;if(null==_||_(e),e.defaultPrevented)return;if(!n)return;const{virtualFocus:s,activeId:i}=n.getState();if(!s)return;const r=null==(t=EC(n,i))?void 0:t.element,a=e.relatedTarget,o=IC(n,a),l=u.current;if(u.current=null,Hj(e)&&o)a===r?l&&l!==a&&Gj(l,e):r?Gj(r,e):l&&Gj(l,e),e.stopPropagation();else{!IC(n,e.target)&&r&&Gj(r,e)}})),S=o.onKeyDown,C=sS(r),k=Jj((e=>{var t;if(null==S||S(e),e.defaultPrevented)return;if(!n)return;if(!Hj(e))return;const{orientation:s,renderedItems:i,activeId:r}=n.getState(),a=EC(n,r);if(null==(t=null==a?void 0:a.element)?void 0:t.isConnected)return;const o="horizontal"!==s,l="vertical"!==s,c=i.some((e=>!!e.rowId));if(("ArrowLeft"===e.key||"ArrowRight"===e.key||"Home"===e.key||"End"===e.key)&&Oj(e.currentTarget))return;const u={ArrowUp:(c||o)&&(()=>{if(c){const e=function(e){return function(e,t){return e.find((e=>t?!e.disabled&&e.id!==t:!e.disabled))}(ZS(YS(function(e){const t=[];for(const n of e){const e=t.find((e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===n.rowId}));e?e.push(n):t.push([n])}return t}(e))))}(i);return null==e?void 0:e.id}return null==n?void 0:n.last()}),ArrowRight:(c||l)&&n.first,ArrowDown:(c||o)&&n.first,ArrowLeft:(c||l)&&n.last,Home:n.first,End:n.last,PageUp:n.first,PageDown:n.last},d=u[e.key];if(d){const t=d();if(void 0!==t){if(!C(e))return;e.preventDefault(),n.move(t)}}}));o=iS(o,(e=>(0,a.jsx)(bS,{value:n,children:e})),[n]);const E=n.useState((e=>{var t;if(n&&s&&e.virtualFocus)return null==(t=EC(n,e.activeId))?void 0:t.id}));o=tj(ej({"aria-activedescendant":E},o),{ref:$j(c,p,o.ref),onKeyDownCapture:g,onKeyUpCapture:v,onFocusCapture:x,onFocus:w,onBlurCapture:j,onKeyDown:k});const P=n.useState((e=>s&&(e.virtualFocus||null===e.activeId)));return o=UC(ej({focusable:P},o))}));uS((function(e){return hS("div",ZC(e))}));function YC(e,t,n){if(!n)return!1;const s=e.find((e=>!e.disabled&&e.value));return(null==s?void 0:s.value)===t}function KC(e,t){return!!t&&(null!=e&&(e=gj(e),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase())))}var XC=pS((function(e){var t=e,{store:n,focusable:s=!0,autoSelect:i=!1,getAutoSelectId:r,setValueOnChange:a,showMinLength:o=0,showOnChange:l,showOnMouseDown:c,showOnClick:u=c,showOnKeyDown:d,showOnKeyPress:h=d,blurActiveItemOnClick:p,setValueOnClick:f=!0,moveOnKeyPress:m=!0,autoComplete:g="list"}=t,v=nj(t,["store","focusable","autoSelect","getAutoSelectId","setValueOnChange","showMinLength","showOnChange","showOnMouseDown","showOnClick","showOnKeyDown","showOnKeyPress","blurActiveItemOnClick","setValueOnClick","moveOnKeyPress","autoComplete"]);const y=yC();yj(n=n||y,!1);const x=(0,Gn.useRef)(null),[b,w]=(0,Gn.useReducer)((()=>[]),[]),_=(0,Gn.useRef)(!1),j=(0,Gn.useRef)(!1),S=n.useState((e=>e.virtualFocus&&i)),C="inline"===g||"both"===g,[k,E]=(0,Gn.useState)(C);!function(e,t){const n=(0,Gn.useRef)(!1);Qj((()=>{if(n.current)return e();n.current=!0}),t),Qj((()=>()=>{n.current=!1}),[])}((()=>{C&&E(!0)}),[C]);const P=n.useState("value"),I=(0,Gn.useRef)();(0,Gn.useEffect)((()=>OS(n,["selectedValue","activeId"],((e,t)=>{I.current=t.selectedValue}))),[]);const V=n.useState((e=>{var t;if(C&&k){if(e.activeValue&&Array.isArray(e.selectedValue)){if(e.selectedValue.includes(e.activeValue))return;if(null==(t=I.current)?void 0:t.includes(e.activeValue))return}return e.activeValue}})),O=n.useState("renderedItems"),T=n.useState("open"),A=n.useState("contentElement"),N=(0,Gn.useMemo)((()=>{if(!C)return P;if(!k)return P;if(YC(O,V,S)){if(KC(P,V)){const e=(null==V?void 0:V.slice(P.length))||"";return P+e}return P}return V||P}),[C,k,O,V,S,P]);(0,Gn.useEffect)((()=>{const e=x.current;if(!e)return;const t=()=>E(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}}),[]),(0,Gn.useEffect)((()=>{if(!C)return;if(!k)return;if(!V)return;if(!YC(O,V,S))return;if(!KC(P,V))return;let e=pj;return queueMicrotask((()=>{const t=x.current;if(!t)return;const{start:n,end:s}=Aj(t),i=P.length,r=V.length;Mj(t,i,r),e=()=>{if(!AC(t))return;const{start:e,end:a}=Aj(t);e===i&&a===r&&Mj(t,n,s)}})),()=>e()}),[b,C,k,V,O,S,P]);const F=(0,Gn.useRef)(null),M=Jj(r),B=(0,Gn.useRef)(null);(0,Gn.useEffect)((()=>{if(!T)return;if(!A)return;const e=Fj(A);if(!e)return;F.current=e;const t=()=>{_.current=!1},s=()=>{if(!n)return;if(!_.current)return;const{activeId:e}=n.getState();null!==e&&e!==B.current&&(_.current=!1)},i={passive:!0,capture:!0};return e.addEventListener("wheel",t,i),e.addEventListener("touchmove",t,i),e.addEventListener("scroll",s,i),()=>{e.removeEventListener("wheel",t,!0),e.removeEventListener("touchmove",t,!0),e.removeEventListener("scroll",s,!0)}}),[T,A,n]),Qj((()=>{P&&(j.current||(_.current=!0))}),[P]),Qj((()=>{"always"!==S&&T||(_.current=T)}),[S,T]);const D=n.useState("resetValueOnSelect");nS((()=>{var e,t;const s=_.current;if(!n)return;if(!T)return;if(!s&&!D)return;const{baseElement:i,contentElement:r,activeId:a}=n.getState();if(!i||AC(i)){if(null==r?void 0:r.hasAttribute("data-placing")){const e=new MutationObserver(w);return e.observe(r,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(S&&s){const t=M(O),s=void 0!==t?t:null!=(e=function(e){const t=e.find((e=>{var t;return!e.disabled&&"tab"!==(null==(t=e.element)?void 0:t.getAttribute("role"))}));return null==t?void 0:t.id}(O))?e:n.first();B.current=s,n.move(null!=s?s:null)}else{const e=null==(t=n.item(a||n.first()))?void 0:t.element;e&&"scrollIntoView"in e&&e.scrollIntoView({block:"nearest",inline:"nearest"})}}}),[n,T,b,P,S,D,M,O]),(0,Gn.useEffect)((()=>{if(!C)return;const e=x.current;if(!e)return;const t=[e,A].filter((e=>!!e)),s=e=>{t.every((t=>Uj(e,t)))&&(null==n||n.setValue(N))};for(const e of t)e.addEventListener("focusout",s);return()=>{for(const e of t)e.removeEventListener("focusout",s)}}),[C,A,n,N]);const R=e=>e.currentTarget.value.length>=o,L=v.onChange,z=sS(null!=l?l:R),H=sS(null!=a?a:!n.tag),G=Jj((e=>{if(null==L||L(e),e.defaultPrevented)return;if(!n)return;const t=e.currentTarget,{value:s,selectionStart:i,selectionEnd:r}=t,a=e.nativeEvent;if(_.current=!0,function(e){return"input"===e.type}(a)&&(a.isComposing&&(_.current=!1,j.current=!0),C)){const e="insertText"===a.inputType||"insertCompositionText"===a.inputType,t=i===s.length;E(e&&t)}if(H(e)){const e=s===n.getState().value;n.setValue(s),queueMicrotask((()=>{Mj(t,i,r)})),C&&S&&e&&w()}z(e)&&n.show(),S&&_.current||n.setActiveId(null)})),W=v.onCompositionEnd,U=Jj((e=>{_.current=!0,j.current=!1,null==W||W(e),e.defaultPrevented||S&&w()})),q=v.onMouseDown,Z=sS(null!=p?p:()=>!!(null==n?void 0:n.getState().includesBaseElement)),Y=sS(f),K=sS(null!=u?u:R),X=Jj((e=>{null==q||q(e),e.defaultPrevented||e.button||e.ctrlKey||n&&(Z(e)&&n.setActiveId(null),Y(e)&&n.setValue(N),K(e)&&qj(e.currentTarget,"mouseup",n.show))})),Q=v.onKeyDown,J=sS(null!=h?h:R),$=Jj((e=>{if(null==Q||Q(e),e.repeat||(_.current=!1),e.defaultPrevented)return;if(e.ctrlKey)return;if(e.altKey)return;if(e.shiftKey)return;if(e.metaKey)return;if(!n)return;const{open:t}=n.getState();t||"ArrowUp"!==e.key&&"ArrowDown"!==e.key||J(e)&&(e.preventDefault(),n.show())})),ee=v.onBlur,te=Jj((e=>{_.current=!1,null==ee||ee(e),e.defaultPrevented})),ne=eS(v.id),se=function(e){return"inline"===e||"list"===e||"both"===e||"none"===e}(g)?g:void 0,ie=n.useState((e=>null===e.activeId));return v=tj(ej({id:ne,role:"combobox","aria-autocomplete":se,"aria-haspopup":Nj(A,"listbox"),"aria-expanded":T,"aria-controls":null==A?void 0:A.id,"data-active-item":ie||void 0,value:N},v),{ref:$j(x,v.ref),onChange:G,onCompositionEnd:U,onMouseDown:X,onKeyDown:$,onBlur:te}),v=ZC(tj(ej({store:n,focusable:s},v),{moveOnKeyPress:e=>!function(e,...t){const n="function"==typeof e?e(...t):e;return null!=n&&!n}(m,e)&&(C&&E(!0),!0)})),v=kC(ej({store:n},v)),ej({autoComplete:"off"},v)})),QC=uS((function(e){return hS("input",XC(e))}));function JC(e,t){const n=setTimeout(t,e);return()=>clearTimeout(n)}function $C(...e){return e.join(", ").split(", ").reduce(((e,t)=>{const n=t.endsWith("ms")?1:1e3,s=Number.parseFloat(t||"0s")*n;return s>e?s:e}),0)}function ek(e,t,n){return!(n||!1===t||e&&!t)}var tk=pS((function(e){var t=e,{store:n,alwaysVisible:s}=t,i=nj(t,["store","alwaysVisible"]);const r=aC();yj(n=n||r,!1);const o=(0,Gn.useRef)(null),l=eS(i.id),[c,u]=(0,Gn.useState)(null),d=n.useState("open"),h=n.useState("mounted"),p=n.useState("animated"),f=n.useState("contentElement"),m=BS(n.disclosure,"contentElement");Qj((()=>{o.current&&(null==n||n.setContentElement(o.current))}),[n]),Qj((()=>{let e;return null==n||n.setState("animated",(t=>(e=t,!0))),()=>{void 0!==e&&(null==n||n.setState("animated",e))}}),[n]),Qj((()=>{if(p){if(null==f?void 0:f.isConnected)return function(e){let t=requestAnimationFrame((()=>{t=requestAnimationFrame(e)}));return()=>cancelAnimationFrame(t)}((()=>{u(d?"enter":h?"leave":null)}));u(null)}}),[p,f,d,h]),Qj((()=>{if(!n)return;if(!p)return;if(!c)return;if(!f)return;const e=()=>null==n?void 0:n.setState("animating",!1),t=()=>(0,Fr.flushSync)(e);if("leave"===c&&d)return;if("enter"===c&&!d)return;if("number"==typeof p){return JC(p,t)}const{transitionDuration:s,animationDuration:i,transitionDelay:r,animationDelay:a}=getComputedStyle(f),{transitionDuration:o="0",animationDuration:l="0",transitionDelay:u="0",animationDelay:h="0"}=m?getComputedStyle(m):{},g=$C(r,a,u,h)+$C(s,i,o,l);if(!g)return"enter"===c&&n.setState("animated",!1),void e();return JC(Math.max(g-1e3/60,0),t)}),[n,p,f,m,d,c]),i=iS(i,(e=>(0,a.jsx)(cC,{value:n,children:e})),[n]);const g=ek(h,i.hidden,s),v=i.style,y=(0,Gn.useMemo)((()=>g?tj(ej({},v),{display:"none"}):v),[g,v]);return bj(i=tj(ej({id:l,"data-open":d||void 0,"data-enter":"enter"===c||void 0,"data-leave":"leave"===c||void 0,hidden:g},i),{ref:$j(l?n.setContentElement:null,o,i.ref),style:y}))})),nk=uS((function(e){return hS("div",tk(e))})),sk=(uS((function(e){var t=e,{unmountOnHide:n}=t,s=nj(t,["unmountOnHide"]);const i=aC();return!1===BS(s.store||i,(e=>!n||(null==e?void 0:e.mounted)))?null:(0,a.jsx)(nk,ej({},s))})),pS((function(e){var t=e,{store:n,alwaysVisible:s}=t,i=nj(t,["store","alwaysVisible"]);const r=vC(!0),o=gC(),l=!!(n=n||o)&&n===r;yj(n,!1);const c=(0,Gn.useRef)(null),u=eS(i.id),d=n.useState("mounted"),h=ek(d,i.hidden,s),p=h?tj(ej({},i.style),{display:"none"}):i.style,f=n.useState((e=>Array.isArray(e.selectedValue))),m=tS(c,"role",i.role),g=("listbox"===m||"tree"===m||"grid"===m)&&f||void 0,[v,y]=(0,Gn.useState)(!1),x=n.useState("contentElement");Qj((()=>{if(!d)return;const e=c.current;if(!e)return;if(x!==e)return;const t=()=>{y(!!e.querySelector("[role='listbox']"))},n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>n.disconnect()}),[d,x]),v||(i=ej({role:"listbox","aria-multiselectable":g},i)),i=iS(i,(e=>(0,a.jsx)(bC,{value:n,children:(0,a.jsx)(fC.Provider,{value:m,children:e})})),[n,m]);const b=!u||r&&l?null:n.setContentElement;return bj(i=tj(ej({id:u,hidden:h},i),{ref:$j(b,c,i.ref),style:p}))}))),ik=uS((function(e){return hS("div",sk(e))}));function rk(e){const t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var ak=Symbol("composite-hover");var ok=pS((function(e){var t=e,{store:n,focusOnHover:s=!0,blurOnHoverEnd:i=!!s}=t,r=nj(t,["store","focusOnHover","blurOnHoverEnd"]);const a=yS();yj(n=n||a,!1);const o=((0,Gn.useEffect)((()=>{Zj("mousemove",lS,!0),Zj("mousedown",cS,!0),Zj("mouseup",cS,!0),Zj("keydown",cS,!0),Zj("scroll",cS,!0)}),[]),Jj((()=>rS))),l=r.onMouseMove,c=sS(s),u=Jj((e=>{if(null==l||l(e),!e.defaultPrevented&&o()&&c(e)){if(!NC(e.currentTarget)){const e=null==n?void 0:n.getState().baseElement;e&&!AC(e)&&e.focus()}null==n||n.setActiveId(e.currentTarget.id)}})),d=r.onMouseLeave,h=sS(i),p=Jj((e=>{var t;null==d||d(e),e.defaultPrevented||o()&&(function(e){const t=rk(e);return!!t&&Pj(e.currentTarget,t)}(e)||function(e){let t=rk(e);if(!t)return!1;do{if(fj(t,ak)&&t[ak])return!0;t=t.parentElement}while(t);return!1}(e)||c(e)&&h(e)&&(null==n||n.setActiveId(null),null==(t=null==n?void 0:n.getState().baseElement)||t.focus()))})),f=(0,Gn.useCallback)((e=>{e&&(e[ak]=!0)}),[]);return bj(r=tj(ej({},r),{ref:$j(f,r.ref),onMouseMove:u,onMouseLeave:p}))})),lk=(dS(uS((function(e){return hS("div",ok(e))}))),pS((function(e){var t=e,{store:n,shouldRegisterItem:s=!0,getItem:i=vj,element:r}=t,a=nj(t,["store","shouldRegisterItem","getItem","element"]);const o=gS();n=n||o;const l=eS(a.id),c=(0,Gn.useRef)(r);return(0,Gn.useEffect)((()=>{const e=c.current;if(!l)return;if(!e)return;if(!s)return;const t=i({id:l,element:e});return null==n?void 0:n.renderItem(t)}),[l,s,i,n]),bj(a=tj(ej({},a),{ref:$j(c,a.ref)}))})));uS((function(e){return hS("div",lk(e))}));function ck(e){if(!e.isTrusted)return!1;const t=e.currentTarget;return"Enter"===e.key?Ij(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(Ij(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}var uk=Symbol("command"),dk=pS((function(e){var t=e,{clickOnEnter:n=!0,clickOnSpace:s=!0}=t,i=nj(t,["clickOnEnter","clickOnSpace"]);const r=(0,Gn.useRef)(null),[a,o]=(0,Gn.useState)(!1);(0,Gn.useEffect)((()=>{r.current&&o(Ij(r.current))}),[]);const[l,c]=(0,Gn.useState)(!1),u=(0,Gn.useRef)(!1),d=xj(i),[h,p]=function(e,t,n){const s=e.onLoadedMetadataCapture,i=(0,Gn.useMemo)((()=>Object.assign((()=>{}),tj(ej({},s),{[t]:n}))),[s,t,n]);return[null==s?void 0:s[t],{onLoadedMetadataCapture:i}]}(i,uk,!0),f=i.onKeyDown,m=Jj((e=>{null==f||f(e);const t=e.currentTarget;if(e.defaultPrevented)return;if(h)return;if(d)return;if(!Hj(e))return;if(Oj(t))return;if(t.isContentEditable)return;const i=n&&"Enter"===e.key,r=s&&" "===e.key,a="Enter"===e.key&&!n,o=" "===e.key&&!s;if(a||o)e.preventDefault();else if(i||r){const n=ck(e);if(i){if(!n){e.preventDefault();const n=e,{view:s}=n,i=nj(n,["view"]),r=()=>Wj(t,i);Cj&&/firefox\//i.test(navigator.userAgent)?qj(t,"keyup",r):queueMicrotask(r)}}else r&&(u.current=!0,n||(e.preventDefault(),c(!0)))}})),g=i.onKeyUp,v=Jj((e=>{if(null==g||g(e),e.defaultPrevented)return;if(h)return;if(d)return;if(e.metaKey)return;const t=s&&" "===e.key;if(u.current&&t&&(u.current=!1,!ck(e))){e.preventDefault(),c(!1);const t=e.currentTarget,n=e,{view:s}=n,i=nj(n,["view"]);queueMicrotask((()=>Wj(t,i)))}}));return i=tj(ej(ej({"data-active":l||void 0,type:a?"button":void 0},p),i),{ref:$j(r,i.ref),onKeyDown:m,onKeyUp:v}),i=UC(i)}));uS((function(e){return hS("button",dk(e))}));function hk(e,t=!1){const{top:n}=e.getBoundingClientRect();return t?n+e.clientHeight:n}function pk(e,t,n,s=!1){var i;if(!t)return;if(!n)return;const{renderedItems:r}=t.getState(),a=Fj(e);if(!a)return;const o=function(e,t=!1){const n=e.clientHeight,{top:s}=e.getBoundingClientRect(),i=1.5*Math.max(.875*n,n-40),r=t?n-i+s:i+s;return"HTML"===e.tagName?r+e.scrollTop:r}(a,s);let l,c;for(let e=0;e<r.length;e+=1){const r=l;if(l=n(e),!l)break;if(l===r)continue;const a=null==(i=EC(t,l))?void 0:i.element;if(!a)continue;const u=hk(a,s)-o,d=Math.abs(u);if(s&&u<=0||!s&&u>=0){void 0!==c&&c<d&&(l=r);break}c=d}return l}var fk=pS((function(e){var t=e,{store:n,rowId:s,preventScrollOnKeyDown:i=!1,moveOnKeyPress:r=!0,tabbable:o=!1,getItem:l,"aria-setsize":c,"aria-posinset":u}=t,d=nj(t,["store","rowId","preventScrollOnKeyDown","moveOnKeyPress","tabbable","getItem","aria-setsize","aria-posinset"]);const h=yS();n=n||h;const p=eS(d.id),f=(0,Gn.useRef)(null),m=(0,Gn.useContext)(jS),g=xj(d)&&!d.accessibleWhenDisabled,{rowId:v,baseElement:y,isActiveItem:x,ariaSetSize:b,ariaPosInSet:w,isTabbable:_}=DS(n,{rowId:e=>s||(e&&(null==m?void 0:m.baseElement)&&m.baseElement===e.baseElement?m.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===p,ariaSetSize:e=>null!=c?c:e&&(null==m?void 0:m.ariaSetSize)&&m.baseElement===e.baseElement?m.ariaSetSize:void 0,ariaPosInSet(e){if(null!=u)return u;if(!e)return;if(!(null==m?void 0:m.ariaPosInSet))return;if(m.baseElement!==e.baseElement)return;const t=e.renderedItems.filter((e=>e.rowId===v));return m.ariaPosInSet+t.findIndex((e=>e.id===p))},isTabbable(e){if(!(null==e?void 0:e.renderedItems.length))return!0;if(e.virtualFocus)return!1;if(o)return!0;if(null===e.activeId)return!1;const t=null==n?void 0:n.item(e.activeId);return!!(null==t?void 0:t.disabled)||(!(null==t?void 0:t.element)||e.activeId===p)}}),j=(0,Gn.useCallback)((e=>{var t;const n=tj(ej({},e),{id:p||e.id,rowId:v,disabled:!!g,children:null==(t=e.element)?void 0:t.textContent});return l?l(n):n}),[p,v,g,l]),S=d.onFocus,C=(0,Gn.useRef)(!1),k=Jj((e=>{if(null==S||S(e),e.defaultPrevented)return;if(zj(e))return;if(!p)return;if(!n)return;if(function(e,t){return!Hj(e)&&IC(t,e.target)}(e,n))return;const{virtualFocus:t,baseElement:s}=n.getState();if(n.setActiveId(p),Tj(e.currentTarget)&&function(e,t=!1){if(Oj(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){const n=kj(e).getSelection();null==n||n.selectAllChildren(e),t&&(null==n||n.collapseToEnd())}}(e.currentTarget),!t)return;if(!Hj(e))return;if(Tj(i=e.currentTarget)||"INPUT"===i.tagName&&!Ij(i))return;var i;if(!(null==s?void 0:s.isConnected))return;Lj()&&e.currentTarget.hasAttribute("data-autofocus")&&e.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),C.current=!0;e.relatedTarget===s||IC(n,e.relatedTarget)?function(e){e[PC]=!0,e.focus({preventScroll:!0})}(s):s.focus()})),E=d.onBlurCapture,P=Jj((e=>{if(null==E||E(e),e.defaultPrevented)return;const t=null==n?void 0:n.getState();(null==t?void 0:t.virtualFocus)&&C.current&&(C.current=!1,e.preventDefault(),e.stopPropagation())})),I=d.onKeyDown,V=sS(i),O=sS(r),T=Jj((e=>{if(null==I||I(e),e.defaultPrevented)return;if(!Hj(e))return;if(!n)return;const{currentTarget:t}=e,s=n.getState(),i=n.item(p),r=!!(null==i?void 0:i.rowId),a="horizontal"!==s.orientation,o="vertical"!==s.orientation,l=()=>!!r||(!!o||(!s.baseElement||!Oj(s.baseElement))),c={ArrowUp:(r||a)&&n.up,ArrowRight:(r||o)&&n.next,ArrowDown:(r||a)&&n.down,ArrowLeft:(r||o)&&n.previous,Home:()=>{if(l())return!r||e.ctrlKey?null==n?void 0:n.first():null==n?void 0:n.previous(-1)},End:()=>{if(l())return!r||e.ctrlKey?null==n?void 0:n.last():null==n?void 0:n.next(-1)},PageUp:()=>pk(t,n,null==n?void 0:n.up,!0),PageDown:()=>pk(t,n,null==n?void 0:n.down)}[e.key];if(c){if(Tj(t)){const n=Aj(t),s=o&&"ArrowLeft"===e.key,i=o&&"ArrowRight"===e.key,r=a&&"ArrowUp"===e.key,l=a&&"ArrowDown"===e.key;if(i||l){const{length:e}=function(e){if(Oj(e))return e.value;if(e.isContentEditable){const t=kj(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(t);if(n.end!==e)return}else if((s||r)&&0!==n.start)return}const s=c();if(V(e)||void 0!==s){if(!O(e))return;e.preventDefault(),n.move(s)}}})),A=(0,Gn.useMemo)((()=>({id:p,baseElement:y})),[p,y]);return d=iS(d,(e=>(0,a.jsx)(_S.Provider,{value:A,children:e})),[A]),d=tj(ej({id:p,"data-active-item":x||void 0},d),{ref:$j(f,d.ref),tabIndex:_?d.tabIndex:-1,onFocus:k,onBlurCapture:P,onKeyDown:T}),d=dk(d),d=lk(tj(ej({store:n},d),{getItem:j,shouldRegisterItem:!!p&&d.shouldRegisterItem})),bj(tj(ej({},d),{"aria-setsize":b,"aria-posinset":w}))}));dS(uS((function(e){return hS("button",fk(e))})));function mk(e){var t;return null!=(t={menu:"menuitem",listbox:"option",tree:"treeitem"}[e])?t:"option"}var gk=pS((function(e){var t,n=e,{store:s,value:i,hideOnClick:r,setValueOnClick:o,selectValueOnClick:l=!0,resetValueOnSelect:c,focusOnHover:u=!1,moveOnKeyPress:d=!0,getItem:h}=n,p=nj(n,["store","value","hideOnClick","setValueOnClick","selectValueOnClick","resetValueOnSelect","focusOnHover","moveOnKeyPress","getItem"]);const f=vC();yj(s=s||f,!1);const{resetValueOnSelectState:m,multiSelectable:g,selected:v}=DS(s,{resetValueOnSelectState:"resetValueOnSelect",multiSelectable:e=>Array.isArray(e.selectedValue),selected:e=>function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)}(e.selectedValue,i)}),y=(0,Gn.useCallback)((e=>{const t=tj(ej({},e),{value:i});return h?h(t):t}),[i,h]);o=null!=o?o:!g,r=null!=r?r:null!=i&&!g;const x=p.onClick,b=sS(o),w=sS(l),_=sS(null!=(t=null!=c?c:m)?t:g),j=sS(r),S=Jj((e=>{null==x||x(e),e.defaultPrevented||function(e){const t=e.currentTarget;if(!t)return!1;const n=t.tagName.toLowerCase();return!!e.altKey&&("a"===n||"button"===n&&"submit"===t.type||"input"===n&&"submit"===t.type)}(e)||function(e){const t=e.currentTarget;if(!t)return!1;const n=Rj();if(n&&!e.metaKey)return!1;if(!n&&!e.ctrlKey)return!1;const s=t.tagName.toLowerCase();return"a"===s||"button"===s&&"submit"===t.type||"input"===s&&"submit"===t.type}(e)||(null!=i&&(w(e)&&(_(e)&&(null==s||s.resetValue()),null==s||s.setSelectedValue((e=>Array.isArray(e)?e.includes(i)?e.filter((e=>e!==i)):[...e,i]:i))),b(e)&&(null==s||s.setValue(i))),j(e)&&(null==s||s.hide()))})),C=p.onKeyDown,k=Jj((e=>{if(null==C||C(e),e.defaultPrevented)return;const t=null==s?void 0:s.getState().baseElement;if(!t)return;if(AC(t))return;(1===e.key.length||"Backspace"===e.key||"Delete"===e.key)&&(queueMicrotask((()=>t.focus())),Oj(t)&&(null==s||s.setValue(t.value)))}));g&&null!=v&&(p=ej({"aria-selected":v},p)),p=iS(p,(e=>(0,a.jsx)(wC.Provider,{value:i,children:(0,a.jsx)(_C.Provider,{value:null!=v&&v,children:e})})),[i,v]);const E=(0,Gn.useContext)(fC);p=tj(ej({role:mk(E),children:i},p),{onClick:S,onKeyDown:k});const P=sS(d);return p=fk(tj(ej({store:s},p),{getItem:y,moveOnKeyPress:e=>{if(!P(e))return!1;const t=new Event("combobox-item-move"),n=null==s?void 0:s.getState().baseElement;return null==n||n.dispatchEvent(t),!0}})),p=ok(ej({store:s,focusOnHover:u},p))})),vk=dS(uS((function(e){return hS("div",gk(e))})));function yk(e){return gj(e).toLowerCase()}function xk(e,t){if(!e)return e;if(!t)return e;const n=(s=t,Array.isArray(s)?s:void 0!==s?[s]:[]).filter(Boolean).map(yk);var s;const i=[],r=(e,t=!1)=>(0,a.jsx)("span",{"data-autocomplete-value":t?"":void 0,"data-user-value":t?void 0:"",children:e},i.length),o=function(e){return e.sort((([e],[t])=>e-t))}(function(e){return e.filter((([e,t],n,s)=>!s.some((([s,i],r)=>r!==n&&s<=e&&s+i>=e+t))))}(function(e,t){const n=[];for(const s of t){let t=0;const i=s.length;for(;-1!==e.indexOf(s,t);){const r=e.indexOf(s,t);-1!==r&&n.push([r,i]),t=r+1}}return n}(yk(e),new Set(n))));if(!o.length)return i.push(r(e,!0)),i;const[l]=o[0],c=[e.slice(0,l),...o.flatMap((([t,n],s)=>{var i;const r=e.slice(t,t+n),a=null==(i=o[s+1])?void 0:i[0];return[r,e.slice(t+n,a)]}))];return c.forEach(((e,t)=>{e&&i.push(r(e,t%2==0))})),i}var bk=pS((function(e){var t=e,{store:n,value:s,userValue:i}=t,r=nj(t,["store","value","userValue"]);const a=vC();n=n||a;const o=(0,Gn.useContext)(wC),l=null!=s?s:o,c=BS(n,(e=>null!=i?i:null==e?void 0:e.value)),u=(0,Gn.useMemo)((()=>{if(l)return c?xk(l,c):l}),[l,c]);return bj(r=ej({children:u},r))})),wk=uS((function(e){return hS("span",bk(e))}));const _k=[],jk=(e,t)=>e.singleSelection?t?.value:Array.isArray(t?.value)?t.value:!Array.isArray(t?.value)&&t?.value?[t.value]:_k;function Sk(e=""){return Fy()(e.trim().toLowerCase())}const Ck=(e,t,n)=>e.singleSelection?n:Array.isArray(t?.value)?t.value.includes(n)?t.value.filter((e=>e!==n)):[...t.value,n]:[n];function kk(e,t){return`${e}-${t}`}const Ek=({selected:e})=>(0,a.jsx)("span",{className:Ht("dataviews-filters__search-widget-listitem-multi-selection",{"is-selected":e}),children:e&&(0,a.jsx)(b.Icon,{icon:Xr})}),Pk=({selected:e})=>(0,a.jsx)("span",{className:Ht("dataviews-filters__search-widget-listitem-single-selection",{"is-selected":e})});function Ik({view:e,filter:t,onChangeView:n}){const s=(0,y.useInstanceId)(Ik,"dataviews-filter-list-box"),[i,r]=(0,h.useState)(1===t.operators?.length?void 0:null),o=e.filters?.find((e=>e.field===t.field)),l=jk(t,o);return(0,a.jsx)(b.Composite,{virtualFocus:!0,focusLoop:!0,activeId:i,setActiveId:r,role:"listbox",className:"dataviews-filters__search-widget-listbox","aria-label":(0,w.sprintf)((0,w.__)("List of: %1$s"),t.name),onFocusVisible:()=>{!i&&t.elements.length&&r(kk(s,t.elements[0].value))},render:(0,a.jsx)(b.Composite.Typeahead,{}),children:t.elements.map((i=>(0,a.jsxs)(b.Composite.Hover,{render:(0,a.jsx)(b.Composite.Item,{id:kk(s,i.value),render:(0,a.jsx)("div",{"aria-label":i.label,role:"option",className:"dataviews-filters__search-widget-listitem"}),onClick:()=>{const s=o?[...(e.filters??[]).map((e=>e.field===t.field?{...e,operator:o.operator||t.operators[0],value:Ck(t,o,i.value)}:e))]:[...e.filters??[],{field:t.field,operator:t.operators[0],value:Ck(t,o,i.value)}];n({...e,page:1,filters:s})}}),children:[t.singleSelection&&(0,a.jsx)(Pk,{selected:l===i.value}),!t.singleSelection&&(0,a.jsx)(Ek,{selected:l.includes(i.value)}),(0,a.jsx)("span",{children:i.label})]},i.value)))})}function Vk({view:e,filter:t,onChangeView:n}){const[s,i]=(0,h.useState)(""),r=(0,h.useDeferredValue)(s),o=e.filters?.find((e=>e.field===t.field)),l=jk(t,o),c=(0,h.useMemo)((()=>{const e=Sk(r);return t.elements.filter((t=>Sk(t.label).includes(e)))}),[t.elements,r]);return(0,a.jsxs)(jC,{selectedValue:l,setSelectedValue:s=>{const i=o?[...(e.filters??[]).map((e=>e.field===t.field?{...e,operator:o.operator||t.operators[0],value:s}:e))]:[...e.filters??[],{field:t.field,operator:t.operators[0],value:s}];n({...e,page:1,filters:i})},setValue:i,children:[(0,a.jsxs)("div",{className:"dataviews-filters__search-widget-filter-combobox__wrapper",children:[(0,a.jsx)(CC,{render:(0,a.jsx)(b.VisuallyHidden,{children:(0,w.__)("Search items")}),children:(0,w.__)("Search items")}),(0,a.jsx)(QC,{autoSelect:"always",placeholder:(0,w.__)("Search"),className:"dataviews-filters__search-widget-filter-combobox__input"}),(0,a.jsx)("div",{className:"dataviews-filters__search-widget-filter-combobox__icon",children:(0,a.jsx)(b.Icon,{icon:Yt})})]}),(0,a.jsxs)(ik,{className:"dataviews-filters__search-widget-filter-combobox-list",alwaysVisible:!0,children:[c.map((e=>(0,a.jsxs)(vk,{resetValueOnSelect:!1,value:e.value,className:"dataviews-filters__search-widget-listitem",hideOnClick:!1,setValueOnClick:!1,focusOnHover:!0,children:[t.singleSelection&&(0,a.jsx)(Pk,{selected:l===e.value}),!t.singleSelection&&(0,a.jsx)(Ek,{selected:l.includes(e.value)}),(0,a.jsxs)("span",{children:[(0,a.jsx)(wk,{className:"dataviews-filters__search-widget-filter-combobox-item-value",value:e.label}),!!e.description&&(0,a.jsx)("span",{className:"dataviews-filters__search-widget-listitem-description",children:e.description})]})]},e.value))),!c.length&&(0,a.jsx)("p",{children:(0,w.__)("No results found")})]})]})}function Ok(e){const{elements:t,isLoading:n}=Ix({elements:e.filter.elements,getElements:e.filter.getElements});if(n)return(0,a.jsx)("div",{className:"dataviews-filters__search-widget-no-elements",children:(0,a.jsx)(b.Spinner,{})});if(0===t.length)return(0,a.jsx)("div",{className:"dataviews-filters__search-widget-no-elements",children:(0,w.__)("No elements found")});const s=t.length>10?Vk:Ik;return(0,a.jsx)(s,{...e,filter:{...e.filter,elements:t}})}var Tk=i(7734),Ak=i.n(Tk);function Nk({filter:e,view:t,onChangeView:n,fields:s}){const i=t.filters?.find((t=>t.field===e.field)),r=jk(e,i),o=(0,h.useMemo)((()=>{const t=s.find((t=>t.id===e.field));return t?{...t,isValid:{required:!1,custom:()=>null},getValue:({item:e})=>e[t.id],setValue:({value:e})=>({[t.id]:e})}:t}),[s,e.field]),l=(0,h.useMemo)((()=>(t.filters??[]).reduce(((e,t)=>(e[t.field]=t.value,e)),{})),[t.filters]),c=(0,y.useEvent)((s=>{if(!o||!i)return;const a=o.getValue({item:s});Ak()(a,r)||n({...t,filters:(t.filters??[]).map((t=>t.field===e.field?{...t,operator:i.operator||e.operators[0],value:""===a?void 0:a}:t))})}));return o&&o.Edit&&i?(0,a.jsx)(b.Flex,{className:"dataviews-filters__user-input-widget",gap:2.5,direction:"column",children:(0,a.jsx)(o.Edit,{hideLabelFromVision:!0,data:l,field:o,operator:i.operator,onChange:c})}):null}const Fk="Enter",Mk=" ",Bk=({activeElements:e,filterInView:t,filter:n})=>{if(void 0===e||0===e.length)return n.name;const s={Name:(0,a.jsx)("span",{className:"dataviews-filters__summary-filter-text-name"}),Value:(0,a.jsx)("span",{className:"dataviews-filters__summary-filter-text-value"})};if(t?.operator===Jy)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is any: </Name><Value>%2$s</Value>"),n.name,e.map((e=>e.label)).join(", ")),s);if(t?.operator===$y)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is none: </Name><Value>%2$s</Value>"),n.name,e.map((e=>e.label)).join(", ")),s);if(t?.operator===ex)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is all: </Name><Value>%2$s</Value>"),n.name,e.map((e=>e.label)).join(", ")),s);if(t?.operator===tx)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is not all: </Name><Value>%2$s</Value>"),n.name,e.map((e=>e.label)).join(", ")),s);if(t?.operator===Xy)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),n.name,e[0].label),s);if(t?.operator===Qy)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),n.name,e[0].label),s);if(t?.operator===nx)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"),n.name,e[0].label),s);if(t?.operator===sx)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is greater than: </Name><Value>%2$s</Value>"),n.name,e[0].label),s);if(t?.operator===ix)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>"),n.name,e[0].label),s);if(t?.operator===rx)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>"),n.name,e[0].label),s);if(t?.operator===ux)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"),n.name,e[0].label),s);if(t?.operator===dx)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>"),n.name,e[0].label),s);if(t?.operator===hx)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"),n.name,e[0].label),s);if(t?.operator===ax)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"),n.name,e[0].label),s);if(t?.operator===ox)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"),n.name,e[0].label),s);if(t?.operator===lx)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is on or before: </Name><Value>%2$s</Value>"),n.name,e[0].label),s);if(t?.operator===cx)return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is on or after: </Name><Value>%2$s</Value>"),n.name,e[0].label),s);if(t?.operator===px){const{label:t}=e[0];return(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>"),n.name,t[0],t[1]),s)}return t?.operator===fx?(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),n.name,e[0].label),s):t?.operator===mx?(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),n.name,e[0].label),s):t?.operator===gx?(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is in the past: </Name><Value>%2$s</Value>"),n.name,`${e[0].value.value} ${e[0].value.unit}`),s):t?.operator===vx?(0,h.createInterpolateElement)((0,w.sprintf)((0,w.__)("<Name>%1$s is over: </Name><Value>%2$s</Value> ago"),n.name,`${e[0].value.value} ${e[0].value.unit}`),s):(0,w.sprintf)((0,w.__)("Unknown status for %1$s"),n.name)};function Dk({filter:e,view:t,onChangeView:n}){const s=e.operators?.map((e=>({value:e,label:bx[e]?.label}))),i=t.filters?.find((t=>t.field===e.field)),r=i?.operator||e.operators[0];return s.length>1&&(0,a.jsxs)(b.__experimentalHStack,{spacing:2,justify:"flex-start",className:"dataviews-filters__summary-operators-container",children:[(0,a.jsx)(b.FlexItem,{className:"dataviews-filters__summary-operators-filter-name",children:e.name}),(0,a.jsx)(b.SelectControl,{className:"dataviews-filters__summary-operators-filter-select",label:(0,w.__)("Conditions"),value:r,options:s,onChange:s=>{const r=s,a=i?.operator,o=i?[...(t.filters??[]).map((t=>{if(t.field===e.field){const e=[px,gx,vx],n=a&&(e.includes(a)||e.includes(r));return{...t,value:n?void 0:t.value,operator:r}}return t}))]:[...t.filters??[],{field:e.field,operator:r,value:void 0}];n({...t,page:1,filters:o})},size:"small",variant:"minimal",__nextHasNoMarginBottom:!0,hideLabelFromVision:!0})]})}function Rk({addFilterRef:e,openedFilter:t,fields:n,...s}){const i=(0,h.useRef)(null),{filter:r,view:o,onChangeView:l}=s,c=o.filters?.find((e=>e.field===r.field));let u=[];const{elements:d}=Ix({elements:r.elements,getElements:r.getElements});d.length>0?u=d.filter((e=>r.singleSelection?e.value===c?.value:c?.value?.includes(e.value))):void 0!==c?.value&&(u=[{value:c.value,label:c.value}]);const p=r.isPrimary,f=c?.isLocked,m=!f&&void 0!==c?.value,g=!f&&(!p||m);return(0,a.jsx)(b.Dropdown,{defaultOpen:t===r.field,contentClassName:"dataviews-filters__summary-popover",popoverProps:{placement:"bottom-start",role:"dialog"},onClose:()=>{i.current?.focus()},renderToggle:({isOpen:t,onToggle:n})=>(0,a.jsxs)("div",{className:"dataviews-filters__summary-chip-container",children:[(0,a.jsx)(b.Tooltip,{text:(0,w.sprintf)((0,w.__)("Filter by: %1$s"),r.name.toLowerCase()),placement:"top",children:(0,a.jsx)("div",{className:Ht("dataviews-filters__summary-chip",{"has-reset":g,"has-values":m,"is-not-clickable":f}),role:"button",tabIndex:f?-1:0,onClick:()=>{f||n()},onKeyDown:e=>{!f&&[Fk,Mk].includes(e.key)&&(n(),e.preventDefault())},"aria-disabled":f,"aria-pressed":t,"aria-expanded":t,ref:i,children:(0,a.jsx)(Bk,{activeElements:u,filterInView:c,filter:r})})}),g&&(0,a.jsx)(b.Tooltip,{text:p?(0,w.__)("Reset"):(0,w.__)("Remove"),placement:"top",children:(0,a.jsx)("button",{className:Ht("dataviews-filters__summary-chip-remove",{"has-values":m}),onClick:()=>{l({...o,page:1,filters:o.filters?.filter((e=>e.field!==r.field))}),p?i.current?.focus():e.current?.focus()},children:(0,a.jsx)(b.Icon,{icon:Ea})})})]}),renderContent:()=>(0,a.jsxs)(b.__experimentalVStack,{spacing:0,justify:"flex-start",children:[(0,a.jsx)(Dk,{...s}),s.filter.hasElements?(0,a.jsx)(Ok,{...s,filter:{...s.filter,elements:d}}):(0,a.jsx)(Nk,{...s,fields:n})]})})}function Lk({filters:e,view:t,onChangeView:n}){const s=!t.search&&!t.filters?.some((t=>{return!(t.isLocked||void 0===t.value&&(n=t.field,e.some((e=>e.field===n&&e.isPrimary))));var n}));return(0,a.jsx)(b.Button,{disabled:s,accessibleWhenDisabled:!0,size:"compact",variant:"tertiary",className:"dataviews-filters__reset-button",onClick:()=>{n({...t,page:1,search:"",filters:t.filters?.filter((e=>!!e.isLocked))||[]})},children:(0,w.__)("Reset")})}var zk=function(e,t){return(0,h.useMemo)((()=>{const n=[];return e.forEach((e=>{if(!1===e.filterBy||!e.hasElements&&!e.Edit)return;const s=e.filterBy.operators,i=!!e.filterBy?.isPrimary,r=t.filters?.some((t=>t.field===e.id&&!!t.isLocked))??!1;n.push({field:e.id,name:e.label,elements:e.elements,getElements:e.getElements,hasElements:e.hasElements,singleSelection:s.some((e=>xx.includes(e))),operators:s,isVisible:r||i||!!t.filters?.some((t=>t.field===e.id&&yx.includes(t.operator))),isPrimary:i,isLocked:r})})),n.sort(((e,t)=>e.isLocked&&!t.isLocked?-1:!e.isLocked&&t.isLocked?1:e.isPrimary&&!t.isPrimary?-1:!e.isPrimary&&t.isPrimary?1:e.name.localeCompare(t.name))),n}),[e,t])};var Hk=(0,h.memo)((function({className:e}){const{fields:t,view:n,onChangeView:s,openedFilter:i,setOpenedFilter:r}=(0,h.useContext)(Rw),o=(0,h.useRef)(null),l=zk(t,n),c=(0,a.jsx)(W_,{filters:l,view:n,onChangeView:s,ref:o,setOpenedFilter:r},"add-filter"),u=l.filter((e=>e.isVisible));if(0===u.length)return null;const d=[...u.map((e=>(0,a.jsx)(Rk,{filter:e,view:n,fields:t,onChangeView:s,addFilterRef:o,openedFilter:i},e.field))),c];return d.push((0,a.jsx)(Lk,{filters:l,view:n,onChangeView:s},"reset-filters")),(0,a.jsx)(b.__experimentalHStack,{justify:"flex-start",style:{width:"fit-content"},wrap:!0,className:e,children:d})}));var Gk=function(e){const{isShowingFilter:t}=(0,h.useContext)(Rw);return t?(0,a.jsx)(Hk,{...e}):null};function Wk({className:e}){const{actions:t=[],data:n,fields:s,getItemId:i,getItemLevel:r,isLoading:o,view:l,onChangeView:c,selection:u,onChangeSelection:d,setOpenedFilter:p,onClickItem:f,isItemClickable:m,renderItemLink:g,defaultLayouts:v,empty:y=(0,a.jsx)("p",{children:(0,w.__)("No results")})}=(0,h.useContext)(Rw),x=z_.find((e=>e.type===l.type&&v[e.type]))?.component;return(0,a.jsx)(x,{className:e,actions:t,data:n,fields:s,getItemId:i,getItemLevel:r,isLoading:o,onChangeView:c,onChangeSelection:d,selection:u,setOpenedFilter:p,onClickItem:f,renderItemLink:g,isItemClickable:m,view:l,empty:y})}function Uk(){const{view:e,onChangeView:t,paginationInfo:{totalItems:n=0,totalPages:s}}=(0,h.useContext)(Rw);if(!n||!s||e.infiniteScrollEnabled)return null;const i=e.page??1,r=Array.from(Array(s)).map(((e,t)=>{const n=t+1;return{value:n.toString(),label:n.toString(),"aria-label":i===n?(0,w.sprintf)((0,w.__)("Page %1$d of %2$d"),i,s):n.toString()}}));return!!n&&1!==s&&(0,a.jsxs)(b.__experimentalHStack,{expanded:!1,className:"dataviews-pagination",justify:"end",spacing:6,children:[(0,a.jsx)(b.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:1,className:"dataviews-pagination__page-select",children:(0,h.createInterpolateElement)((0,w.sprintf)((0,w._x)("<div>Page</div>%1$s<div>of %2$d</div>","paging"),"<CurrentPage />",s),{div:(0,a.jsx)("div",{"aria-hidden":!0}),CurrentPage:(0,a.jsx)(b.SelectControl,{"aria-label":(0,w.__)("Current page"),value:i.toString(),options:r,onChange:n=>{t({...e,page:+n})},size:"small",__nextHasNoMarginBottom:!0,variant:"minimal"})})}),(0,a.jsxs)(b.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,a.jsx)(b.Button,{onClick:()=>t({...e,page:i-1}),disabled:1===i,accessibleWhenDisabled:!0,label:(0,w.__)("Previous page"),icon:(0,w.isRTL)()?$c:eu,showTooltip:!0,size:"compact",tooltipPosition:"top"}),(0,a.jsx)(b.Button,{onClick:()=>t({...e,page:i+1}),disabled:i>=s,accessibleWhenDisabled:!0,label:(0,w.__)("Next page"),icon:(0,w.isRTL)()?eu:$c,showTooltip:!0,size:"compact",tooltipPosition:"top"})]})]})}var qk=(0,h.memo)(Uk);const Zk=[];function Yk(){const{view:e,paginationInfo:{totalItems:t=0,totalPages:n},data:s,actions:i=Zk}=(0,h.useContext)(Rw),r=n_(i,s)&&[kx,Ex].includes(e.type);return!t||!n||n<=1&&!r?null:!!t&&(0,a.jsxs)(b.__experimentalHStack,{expanded:!1,justify:"end",className:"dataviews-footer",children:[r&&(0,a.jsx)(c_,{}),(0,a.jsx)(qk,{})]})}var Kk=(0,h.memo)((function({label:e}){const{view:t,onChangeView:n}=(0,h.useContext)(Rw),[s,i,r]=(0,y.useDebouncedInput)(t.search);(0,h.useEffect)((()=>{i(t.search??"")}),[t.search,i]);const o=(0,h.useRef)(n),l=(0,h.useRef)(t);(0,h.useEffect)((()=>{o.current=n,l.current=t}),[n,t]),(0,h.useEffect)((()=>{r!==l.current?.search&&o.current({...l.current,page:1,search:r})}),[r]);const c=e||(0,w.__)("Search");return(0,a.jsx)(b.SearchControl,{className:"dataviews-search",__nextHasNoMarginBottom:!0,onChange:i,value:s,label:c,placeholder:c,size:"compact"})})),Xk=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.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"})}),Qk=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",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",clipRule:"evenodd"})});const Jk=window.wp.warning;var $k=i.n(Jk);function eE(){const e=(0,h.useContext)(Rw),{view:t,onChangeView:n}=e,s=t.infiniteScrollEnabled??!1;return e.hasInfiniteScrollHandler?(0,a.jsx)(b.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,w.__)("Enable infinite scroll"),help:(0,w.__)("Automatically load more content as you scroll, instead of showing pagination links."),checked:s,onChange:e=>{n({...t,infiniteScrollEnabled:e})}}):null}const{Menu:tE}=Zx(b.privateApis),nE={className:"dataviews-config__popover",placement:"bottom-end",offset:9};function sE(){const{view:e,onChangeView:t,defaultLayouts:n}=(0,h.useContext)(Rw),s=Object.keys(n);if(s.length<=1)return null;const i=z_.find((t=>e.type===t.type));return(0,a.jsxs)(tE,{children:[(0,a.jsx)(tE.TriggerButton,{render:(0,a.jsx)(b.Button,{size:"compact",icon:i?.icon,label:(0,w.__)("Layout")})}),(0,a.jsx)(tE.Popover,{children:s.map((s=>{const i=z_.find((e=>e.type===s));return i?(0,a.jsx)(tE.RadioItem,{value:s,name:"view-actions-available-view",checked:s===e.type,hideOnClick:!0,onChange:s=>{switch(s.target.value){case"list":case"grid":case"table":case"pickerGrid":const i={...e};return"layout"in i&&delete i.layout,t({...i,type:s.target.value,...n[s.target.value]})}$k()("Invalid dataview")},children:(0,a.jsx)(tE.ItemLabel,{children:i.label})},s):null}))})]})}function iE(){const{view:e,fields:t,onChangeView:n}=(0,h.useContext)(Rw),s=(0,h.useMemo)((()=>t.filter((e=>!1!==e.enableSorting)).map((e=>({label:e.label,value:e.id})))),[t]);return(0,a.jsx)(b.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,w.__)("Sort by"),value:e.sort?.field,options:s,onChange:t=>{n({...e,sort:{direction:e?.sort?.direction||"desc",field:t},showLevels:!1})}})}function rE(){const{view:e,fields:t,onChangeView:n}=(0,h.useContext)(Rw);if(0===t.filter((e=>!1!==e.enableSorting)).length)return null;let s=e.sort?.direction;return!s&&e.sort?.field&&(s="desc"),(0,a.jsx)(b.__experimentalToggleGroupControl,{className:"dataviews-view-config__sort-direction",__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isBlock:!0,label:(0,w.__)("Order"),value:s,onChange:s=>{"asc"!==s&&"desc"!==s?$k()("Invalid direction"):n({...e,sort:{direction:s,field:e.sort?.field||t.find((e=>!1!==e.enableSorting))?.id||""},showLevels:!1})},children:wx.map((e=>(0,a.jsx)(b.__experimentalToggleGroupControlOptionIcon,{value:e,icon:Cx[e],label:Sx[e]},e)))})}function aE(){const{view:e,config:t,onChangeView:n}=(0,h.useContext)(Rw),{infiniteScrollEnabled:s}=e;return!t||!t.perPageSizes||t.perPageSizes.length<2||t.perPageSizes.length>6||s?null:(0,a.jsx)(b.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isBlock:!0,label:(0,w.__)("Items per page"),value:e.perPage||10,disabled:!e?.sort?.field,onChange:t=>{const s="number"==typeof t||void 0===t?t:parseInt(t,10);n({...e,perPage:s,page:1})},children:t.perPageSizes.map((e=>(0,a.jsx)(b.__experimentalToggleGroupControlOption,{value:e,label:e.toString()},e)))})}function oE({previewOptions:e,onChangePreviewOption:t,onMenuOpenChange:n,activeOption:s}){return(0,a.jsxs)(tE,{onOpenChange:n,children:[(0,a.jsx)(tE.TriggerButton,{render:(0,a.jsx)(b.Button,{className:"dataviews-field-control__field-preview-options-button",size:"compact",icon:No,label:(0,w.__)("Preview")})}),(0,a.jsx)(tE.Popover,{children:e?.map((({id:e,label:n})=>(0,a.jsx)(tE.RadioItem,{value:e,checked:e===s,onChange:()=>{t?.(e),(e=>{setTimeout((()=>{const t=document.querySelector(`.dataviews-field-control__field-${e} .dataviews-field-control__field-preview-options-button`);t instanceof HTMLElement&&t.focus()}),50)})(e)},children:(0,a.jsx)(tE.ItemLabel,{children:n})},e)))})]})}function lE({field:e,label:t,description:n,isVisible:s,isFirst:i,isLast:r,canMove:o=!0,onToggleVisibility:l,onMoveUp:c,onMoveDown:u,previewOptions:d,onChangePreviewOption:p}){const[f,m]=(0,h.useState)(!1);return(0,a.jsx)(b.__experimentalItem,{children:(0,a.jsxs)(b.__experimentalHStack,{expanded:!0,className:Ht("dataviews-field-control__field",`dataviews-field-control__field-${e.id}`,{"is-interacting":f}),justify:"flex-start",children:[(0,a.jsx)("span",{className:"dataviews-field-control__icon",children:!o&&!e.enableHiding&&(0,a.jsx)(b.Icon,{icon:Xk})}),(0,a.jsxs)("span",{className:"dataviews-field-control__label-sub-label-container",children:[(0,a.jsx)("span",{className:"dataviews-field-control__label",children:t||e.label}),n&&(0,a.jsx)("span",{className:"dataviews-field-control__sub-label",children:n})]}),(0,a.jsxs)(b.__experimentalHStack,{justify:"flex-end",expanded:!1,className:"dataviews-field-control__actions",children:[s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.Button,{disabled:i||!o,accessibleWhenDisabled:!0,size:"compact",onClick:c,icon:Av,label:i||!o?(0,w.__)("This field can't be moved up"):(0,w.sprintf)((0,w.__)("Move %s up"),e.label)}),(0,a.jsx)(b.Button,{disabled:r||!o,accessibleWhenDisabled:!0,size:"compact",onClick:u,icon:Nv,label:r||!o?(0,w.__)("This field can't be moved down"):(0,w.sprintf)((0,w.__)("Move %s down"),e.label)})]}),l&&(0,a.jsx)(b.Button,{className:"dataviews-field-control__field-visibility-button",disabled:!e.enableHiding,accessibleWhenDisabled:!0,size:"compact",onClick:()=>{l(),setTimeout((()=>{const t=document.querySelector(`.dataviews-field-control__field-${e.id} .dataviews-field-control__field-visibility-button`);t instanceof HTMLElement&&t.focus()}),50)},icon:s?Ew:Ao,label:s?(0,w.sprintf)((0,w._x)("Hide %s","field"),e.label):(0,w.sprintf)((0,w._x)("Show %s","field"),e.label)}),d&&(0,a.jsx)(oE,{previewOptions:d,onChangePreviewOption:p,onMenuOpenChange:m,activeOption:e.id})]})]})})}function cE({index:e,field:t,view:n,onChangeView:s}){const i=n.fields??[],r=void 0!==e&&i.includes(t.id);return(0,a.jsx)(lE,{field:t,isVisible:r,isFirst:void 0!==e&&e<1,isLast:void 0!==e&&e===i.length-1,onToggleVisibility:()=>{s({...n,fields:r?i.filter((e=>e!==t.id)):[...i,t.id]})},onMoveUp:void 0!==e?()=>{s({...n,fields:[...i.slice(0,e-1)??[],t.id,i[e-1],...i.slice(e+1)]})}:void 0,onMoveDown:void 0!==e?()=>{s({...n,fields:[...i.slice(0,e)??[],i[e+1],t.id,...i.slice(e+2)]})}:void 0})}function uE(e){return!!e}function dE(){const{view:e,fields:t,onChangeView:n}=(0,h.useContext)(Rw),s=[e?.titleField,e?.mediaField,e?.descriptionField].filter(Boolean),i=e.fields??[],r=t.filter((e=>!i.includes(e.id)&&!s.includes(e.id)&&"media"!==e.type&&!1!==e.enableHiding));let o=i.map((e=>t.find((t=>t.id===e)))).filter(uE);if(!o?.length&&!r?.length)return null;const l=t.find((t=>t.id===e.titleField)),c=t.find((t=>t.id===e.mediaField)),u=t.find((t=>t.id===e.descriptionField)),d=t.filter((e=>"media"===e.type));let p;if(d.length>1){const t=uE(c)&&(e.showMedia??!0);p=uE(c)&&(0,a.jsx)(lE,{field:c,label:(0,w.__)("Preview"),description:c.label,isVisible:t,onToggleVisibility:()=>{n({...e,showMedia:!t})},canMove:!1,previewOptions:d.map((e=>({label:e.label,id:e.id}))),onChangePreviewOption:t=>n({...e,mediaField:t})},c.id)}const f=[{field:l,isVisibleFlag:"showTitle"},{field:c,isVisibleFlag:"showMedia",ui:p},{field:u,isVisibleFlag:"showDescription"}].filter((({field:e})=>uE(e)));let m=f.filter((({field:t,isVisibleFlag:n})=>uE(t)&&(e[n]??!0)));1===m.length&&(m=m.map((e=>({...e,field:{...e.field,enableHiding:!1}})))),0===m.length&&1===o.length&&(o=[{...o[0],enableHiding:!1}]);const g=f.filter((({field:t,isVisibleFlag:n})=>uE(t)&&!(e[n]??1)));return(0,a.jsxs)(b.__experimentalVStack,{className:"dataviews-field-control",spacing:6,children:[(0,a.jsx)(b.__experimentalVStack,{className:"dataviews-view-config__properties",spacing:0,children:(m.length>0||!!o?.length)&&(0,a.jsxs)(b.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[m.map((({field:t,isVisibleFlag:s,ui:i})=>i??(0,a.jsx)(lE,{field:t,isVisible:!0,onToggleVisibility:()=>{n({...e,[s]:!1})},canMove:!1},t.id))),o.map(((t,s)=>(0,a.jsx)(cE,{field:t,view:e,onChangeView:n,index:s},t.id)))]})}),(!!r?.length||!!g.length)&&(0,a.jsxs)(b.__experimentalVStack,{spacing:4,children:[(0,a.jsx)(b.BaseControl.VisualLabel,{style:{margin:0},children:(0,w.__)("Hidden")}),(0,a.jsx)(b.__experimentalVStack,{className:"dataviews-view-config__properties",spacing:0,children:(0,a.jsxs)(b.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[g.length>0&&g.map((({field:t,isVisibleFlag:s,ui:i})=>i??(0,a.jsx)(lE,{field:t,isVisible:!1,onToggleVisibility:()=>{n({...e,[s]:!0})},canMove:!1},t.id))),r.map((t=>(0,a.jsx)(cE,{field:t,view:e,onChangeView:n},t.id)))]})})]})]})}function hE({title:e,description:t,children:n}){return(0,a.jsxs)(b.__experimentalGrid,{columns:12,className:"dataviews-settings-section",gap:4,children:[(0,a.jsxs)("div",{className:"dataviews-settings-section__sidebar",children:[(0,a.jsx)(b.__experimentalHeading,{level:2,className:"dataviews-settings-section__title",children:e}),t&&(0,a.jsx)(b.__experimentalText,{variant:"muted",className:"dataviews-settings-section__description",children:t})]}),(0,a.jsx)(b.__experimentalGrid,{columns:8,gap:4,className:"dataviews-settings-section__content",children:n})]})}function pE(){const{view:e}=(0,h.useContext)(Rw),t=(0,y.useInstanceId)(fE,"dataviews-view-config-dropdown"),n=z_.find((t=>t.type===e.type));return(0,a.jsx)(b.Dropdown,{expandOnMobile:!0,popoverProps:{...nE,id:t},renderToggle:({onToggle:e,isOpen:n})=>(0,a.jsx)(b.Button,{size:"compact",icon:Qk,label:(0,w._x)("View options","View is used as a noun"),onClick:e,"aria-expanded":n?"true":"false","aria-controls":t}),renderContent:()=>(0,a.jsx)(b.__experimentalDropdownContentWrapper,{paddingSize:"medium",className:"dataviews-config__popover-content-wrapper",children:(0,a.jsxs)(b.__experimentalVStack,{className:"dataviews-view-config",spacing:6,children:[(0,a.jsxs)(hE,{title:(0,w.__)("Appearance"),children:[(0,a.jsxs)(b.__experimentalHStack,{expanded:!0,className:"is-divided-in-two",children:[(0,a.jsx)(iE,{}),(0,a.jsx)(rE,{})]}),!!n?.viewConfigOptions&&(0,a.jsx)(n.viewConfigOptions,{}),(0,a.jsx)(eE,{}),(0,a.jsx)(aE,{})]}),(0,a.jsx)(hE,{title:(0,w.__)("Properties"),children:(0,a.jsx)(dE,{})})]})})})}function fE(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(sE,{}),(0,a.jsx)(pE,{})]})}var mE=(0,h.memo)(fE);const gE=e=>e.id,vE=()=>!0,yE=[],xE=z_.filter((e=>!e.isPicker));function bE({header:e,search:t=!0,searchLabel:n}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(b.__experimentalHStack,{alignment:"top",justify:"space-between",className:"dataviews__view-actions",spacing:1,children:[(0,a.jsxs)(b.__experimentalHStack,{justify:"start",expanded:!1,className:"dataviews__search",children:[t&&(0,a.jsx)(Kk,{label:n}),(0,a.jsx)(q_,{})]}),(0,a.jsxs)(b.__experimentalHStack,{spacing:1,expanded:!1,style:{flexShrink:0},children:[(0,a.jsx)(mE,{}),e]})]}),(0,a.jsx)(Gk,{className:"dataviews-filters__container"}),(0,a.jsx)(Wk,{}),(0,a.jsx)(Yk,{})]})}const wE=function({view:e,onChangeView:t,fields:n,search:s=!0,searchLabel:i,actions:r=yE,data:o,getItemId:l=gE,getItemLevel:c,isLoading:u=!1,paginationInfo:d,defaultLayouts:p,selection:f,onChangeSelection:m,onClickItem:g,renderItemLink:v,isItemClickable:x=vE,header:b,children:w,config:_={perPageSizes:[10,20,50,100]},empty:j}){const{infiniteScrollHandler:S}=d,C=(0,h.useRef)(null),[k,E]=(0,h.useState)(0),P=(0,y.useResizeObserver)((e=>{E(e[0].borderBoxSize[0].inlineSize)}),{box:"border-box"}),[I,V]=(0,h.useState)([]),O=void 0===f||void 0===m,T=O?I:f,[A,N]=(0,h.useState)(null),F=(0,h.useMemo)((()=>Aw(n)),[n]),M=(0,h.useMemo)((()=>T.filter((e=>o.some((t=>l(t)===e))))),[T,o,l]),B=zk(F,e),D=(0,h.useMemo)((()=>(B||[]).some((e=>e.isPrimary||e.isLocked))),[B]),[R,L]=(0,h.useState)(D);(0,h.useEffect)((()=>{D&&!R&&L(!0)}),[D,R]),(0,h.useEffect)((()=>{if(!e.infiniteScrollEnabled||!C.current)return;const t=(0,y.throttle)((e=>{const t=e.target,n=t.scrollTop,s=t.scrollHeight;n+t.clientHeight>=s-100&&S?.()}),100),n=C.current;return n.addEventListener("scroll",t),()=>{n.removeEventListener("scroll",t),t.cancel()}}),[S,e.infiniteScrollEnabled]);const z=(0,h.useMemo)((()=>Object.fromEntries(Object.entries(p).filter((([e])=>xE.some((t=>t.type===e)))))),[p]);return z[e.type]?(0,a.jsx)(Rw.Provider,{value:{view:e,onChangeView:t,fields:F,actions:r,data:o,isLoading:u,paginationInfo:d,selection:M,onChangeSelection:function(e){const t="function"==typeof e?e(T):e;O&&V(t),m&&m(t)},openedFilter:A,setOpenedFilter:N,getItemId:l,getItemLevel:c,isItemClickable:x,onClickItem:g,renderItemLink:v,containerWidth:k,containerRef:C,resizeObserverRef:P,defaultLayouts:z,filters:B,isShowingFilter:R,setIsShowingFilter:L,config:_,empty:j,hasInfiniteScrollHandler:!!S},children:(0,a.jsx)("div",{className:"dataviews-wrapper",ref:C,children:w??(0,a.jsx)(bE,{header:b,search:s,searchLabel:i})})}):null};wE.BulkActionToolbar=c_,wE.Filters=Hk,wE.FiltersToggled=Gk,wE.FiltersToggle=q_,wE.Layout=Wk,wE.LayoutSwitcher=sE,wE.Pagination=Uk,wE.Search=Kk,wE.ViewConfig=pE,wE.Footer=Yk;var _E=wE,jE=i(7951);function SE(){const e=(0,c.useSelect)((e=>{const{getSettings:t}=ne(e(Rt));return t()}),[]),t=e.__experimentalAdditionalBlockPatterns??e.__experimentalBlockPatterns,n=(0,c.useSelect)((e=>e(j.store).getBlockPatterns()),[]),s=(0,h.useMemo)((()=>[...t||[],...n||[]].filter(hy)),[t,n]);return(0,h.useMemo)((()=>{const{__experimentalAdditionalBlockPatterns:t,...n}=e;return{...n,__experimentalBlockPatterns:s,isPreviewMode:!0}}),[e,s])}var CE=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})}),kE=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})});const{useHistory:EE,useLocation:PE}=ne(Lt.privateApis),{CreatePatternModal:IE,useAddPatternCategory:VE}=ne(_e.privateApis),{CreateTemplatePartModal:OE}=ne(f.privateApis);function TE(){const e=EE(),t=PE(),[n,s]=(0,h.useState)(!1),[i,r]=(0,h.useState)(!1),{createPatternFromFile:o}=ne((0,c.useDispatch)(_e.store)),{createSuccessNotice:l,createErrorNotice:u}=(0,c.useDispatch)(_.store),d=(0,h.useRef)(),{isBlockBasedTheme:p,addNewPatternLabel:f,addNewTemplatePartLabel:m,canCreatePattern:g,canCreateTemplatePart:v}=(0,c.useSelect)((e=>{const{getCurrentTheme:t,getPostType:n,canUser:s}=e(j.store);return{isBlockBasedTheme:t()?.is_block_theme,addNewPatternLabel:n(Ie.user)?.labels?.add_new_item,addNewTemplatePartLabel:n(Ce)?.labels?.add_new_item,canCreatePattern:s("create",{kind:"postType",name:Ie.user}),canCreateTemplatePart:s("create",{kind:"postType",name:Ce})}}),[]);function y(){s(!1),r(!1)}const x=[];g&&x.push({icon:Ra,onClick:()=>s(!0),title:f}),p&&v&&x.push({icon:CE,onClick:()=>r(!0),title:m}),g&&x.push({icon:kE,onClick:()=>{d.current.click()},title:(0,w.__)("Import pattern from JSON")});const{categoryMap:S,findOrCreateTerm:C}=VE();return 0===x.length?null:(0,a.jsxs)(a.Fragment,{children:[f&&(0,a.jsx)(b.DropdownMenu,{controls:x,icon:null,toggleProps:{variant:"primary",showTooltip:!1,__next40pxDefaultSize:!0},text:f,label:f}),n&&(0,a.jsx)(IE,{onClose:()=>s(!1),onSuccess:function({pattern:t}){s(!1),e.navigate(`/${Ie.user}/${t.id}?canvas=edit`)},onError:y}),i&&(0,a.jsx)(OE,{closeModal:()=>r(!1),blocks:[],onCreate:function(t){r(!1),e.navigate(`/${Ce}/${t.id}?canvas=edit`)},onError:y}),(0,a.jsx)("input",{type:"file",accept:".json",hidden:!0,ref:d,onChange:async n=>{const s=n.target.files?.[0];if(s)try{let n;if(t.query.postType!==Ce){const e=Array.from(S.values()).find((e=>e.name===t.query.categoryId));e&&(n=e.id||await C(e.label))}const i=await o(s,n?[n]:void 0);n||"my-patterns"===t.query.categoryId||e.navigate(`/pattern?categoryId=${Ve}`),l((0,w.sprintf)((0,w.__)('Imported "%s" from JSON.'),i.title.raw),{type:"snackbar",id:"import-pattern-success"})}catch(e){u(e.message,{type:"snackbar",id:"import-pattern-error"})}finally{n.target.value=""}}})]})}const{RenamePatternCategoryModal:AE}=ne(_e.privateApis);function NE({category:e,onClose:t}){const[n,s]=(0,h.useState)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.MenuItem,{onClick:()=>s(!0),children:(0,w.__)("Rename")}),n&&(0,a.jsx)(FE,{category:e,onClose:()=>{s(!1),t()}})]})}function FE({category:e,onClose:t}){const n={id:e.id,slug:e.slug,name:e.label},s=Iy();return(0,a.jsx)(AE,{category:n,existingCategories:s,onClose:t,overlayClassName:"edit-site-list__rename-modal",focusOnMount:"firstContentElement",size:"small"})}const{useHistory:ME}=ne(Lt.privateApis);function BE({category:e,onClose:t}){const[n,s]=(0,h.useState)(!1),i=ME(),{createSuccessNotice:r,createErrorNotice:o}=(0,c.useDispatch)(_.store),{deleteEntityRecord:l,invalidateResolution:u}=(0,c.useDispatch)(j.store);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.MenuItem,{isDestructive:!0,onClick:()=>s(!0),children:(0,w.__)("Delete")}),(0,a.jsx)(b.__experimentalConfirmDialog,{isOpen:n,onConfirm:async()=>{try{await l("taxonomy","wp_pattern_category",e.id,{force:!0},{throwOnError:!0}),u("getUserPatternCategories"),u("getEntityRecords",["postType",Ie.user,{per_page:-1}]),r((0,w.sprintf)((0,w._x)('"%s" deleted.',"pattern category"),e.label),{type:"snackbar",id:"pattern-category-delete"}),t?.(),i.navigate(`/pattern?categoryId=${Ve}`)}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,w.__)("An error occurred while deleting the pattern category.");o(t,{type:"snackbar",id:"pattern-category-delete"})}},onCancel:()=>s(!1),confirmButtonText:(0,w.__)("Delete"),className:"edit-site-patterns__delete-modal",title:(0,w.sprintf)((0,w._x)('Delete "%s"?',"pattern category"),(0,qt.decodeEntities)(e.label)),size:"medium",__experimentalHideHeader:!1,children:(0,w.sprintf)((0,w.__)('Are you sure you want to delete the category "%s"? The patterns will not be deleted.'),(0,qt.decodeEntities)(e.label))})]})}function DE({categoryId:e,type:t}){const{patternCategories:n}=Iy();let s;return t===Ie.user&&e&&(s=n.find((t=>t.name===e))),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(TE,{}),!!s?.id&&(0,a.jsx)(b.DropdownMenu,{icon:No,label:(0,w.__)("Actions"),toggleProps:{className:"edit-site-patterns__button",size:"compact"},children:({onClose:e})=>(0,a.jsxs)(b.MenuGroup,{children:[(0,a.jsx)(NE,{category:s,onClose:e}),(0,a.jsx)(BE,{category:s,onClose:e})]})})]})}var RE=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})});const{useHistory:LE}=ne(Lt.privateApis),zE=()=>{const e=LE();return(0,h.useMemo)((()=>({id:"edit-post",label:(0,w.__)("Edit"),isPrimary:!0,icon:RE,isEligible:e=>"trash"!==e.status&&e.type!==Ie.theme,callback(t){const n=t[0];e.navigate(`/${n.type}/${n.id}?canvas=edit`)}})),[e])};var HE=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})}),GE=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})}),WE=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",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",clipRule:"evenodd"})});function UE(e,t){return(0,c.useSelect)((n=>{const{getEntityRecord:s,getUser:i,getEditedEntityRecord:r}=n(j.store),a=r("postType",e,t),o=a?.original_source,l=a?.author_text;switch(o){case"theme":return{type:o,icon:Da,text:l,isCustomized:a.source===ke};case"plugin":return{type:o,icon:HE,text:l,isCustomized:a.source===ke};case"site":{const e=s("root","__unstableBase");return{type:o,icon:GE,imageUrl:e?.site_logo?s("postType","attachment",e.site_logo)?.source_url:void 0,text:l,isCustomized:!1}}default:{const e=i(a.author);return{type:"user",icon:WE,imageUrl:e?.avatar_urls?.[48],text:l,isCustomized:!1}}}}),[e,t])}const{useGlobalStyle:qE}=ne(x.privateApis);const ZE={label:(0,w.__)("Preview"),id:"preview",render:function({item:e}){const t=(0,h.useId)(),n=e.description||e?.excerpt?.raw,s=e.type===Ce,[i]=qE("color.background"),r=(0,h.useMemo)((()=>e.blocks??(0,o.parse)(e.content.raw,{__unstableSkipMigrationLogs:!0})),[e?.content?.raw,e.blocks]),l=!r?.length;return(0,a.jsxs)("div",{className:"page-patterns-preview-field",style:{backgroundColor:i},"aria-describedby":n?t:void 0,children:[l&&s&&(0,w.__)("Empty template part"),l&&!s&&(0,w.__)("Empty pattern"),!l&&(0,a.jsx)(x.BlockPreview.Async,{children:(0,a.jsx)(x.BlockPreview,{blocks:r,viewportWidth:e.viewportWidth})}),!!n&&(0,a.jsx)("div",{hidden:!0,id:t,children:n})]})},enableSorting:!1},YE=[{value:Ae.full,label:(0,w._x)("Synced","pattern (singular)"),description:(0,w.__)("Patterns that are kept in sync across the site.")},{value:Ae.unsynced,label:(0,w._x)("Not synced","pattern (singular)"),description:(0,w.__)("Patterns that can be changed freely without affecting the site.")}],KE={label:(0,w.__)("Sync status"),id:"sync-status",render:({item:e})=>{const t="wp_pattern_sync_status"in e?e.wp_pattern_sync_status||Ae.full:Ae.unsynced;return(0,a.jsx)("span",{className:`edit-site-patterns__field-sync-status-${t}`,children:YE.find((({value:e})=>e===t)).label})},elements:YE,filterBy:{operators:["is"],isPrimary:!0},enableSorting:!1};const XE={label:(0,w.__)("Author"),id:"author",getValue:({item:e})=>e.author_text,render:function({item:e}){const[t,n]=(0,h.useState)(!1),{text:s,icon:i,imageUrl:r}=UE(e.type,e.id);return(0,a.jsxs)(b.__experimentalHStack,{alignment:"left",spacing:0,children:[r&&(0,a.jsx)("div",{className:Ht("page-templates-author-field__avatar",{"is-loaded":t}),children:(0,a.jsx)("img",{onLoad:()=>n(!0),alt:"",src:r})}),!r&&(0,a.jsx)("div",{className:"page-templates-author-field__icon",children:(0,a.jsx)(qa,{icon:i})}),(0,a.jsx)("span",{className:"page-templates-author-field__name",children:s})]})},filterBy:{isPrimary:!0}},{ExperimentalBlockEditorProvider:QE}=ne(x.privateApis),{usePostActions:JE,patternTitleField:$E}=ne(f.privateApis),{useLocation:eP,useHistory:tP}=ne(Lt.privateApis),nP=[],sP={[Be]:{layout:{styles:{author:{width:"1%"}}}},[Me]:{layout:{badgeFields:["sync-status"]}}},iP={type:Me,perPage:20,titleField:"title",mediaField:"preview",fields:["sync-status"],filters:[],...sP[Me]};function rP(){const{path:e,query:t}=eP(),{postType:n="wp_block",categoryId:s}=t,i=tP(),r=s||Ve,{view:o,updateView:l,isModified:u,resetToDefault:d}=(0,jE.useView)({kind:"postType",name:n,slug:r,defaultView:iP,queryParams:{page:t.pageNumber,search:t.search},onChangeQueryParams:n=>{i.navigate((0,Qt.addQueryArgs)(e,{...t,pageNumber:n.page,search:n.search}))}}),p=o.filters?.find((({field:e})=>"sync-status"===e))?.value,{patterns:f,isResolving:m}=Py(n,r,{search:o.search,syncStatus:p}),{records:g}=(0,j.useEntityRecords)("postType",Ce,{per_page:-1}),v=(0,h.useMemo)((()=>{if(!g)return nP;const e=new Set;return g.forEach((t=>{e.add(t.author_text)})),Array.from(e).map((e=>({value:e,label:e})))}),[g]),y=(0,h.useMemo)((()=>{const e=[ZE,$E];return n===Ie.user?e.push(KE):n===Ce&&e.push({...XE,elements:v}),e}),[n,v]),{data:x,paginationInfo:_}=(0,h.useMemo)((()=>{const e={...o};return delete e.search,n!==Ce&&(e.filters=[]),Bw(f,e,y)}),[f,o,y,n]),S=function(e){const t=(0,h.useMemo)((()=>e?.filter((e=>e.type!==Ie.theme)).map((e=>[e.type,e.id]))??[]),[e]),n=(0,c.useSelect)((e=>{const{getEntityRecordPermissions:n}=ne(e(j.store));return t.reduce(((e,[t,s])=>(e[s]=n("postType",t,s),e)),{})}),[t]);return(0,h.useMemo)((()=>e?.map((e=>({...e,permissions:n?.[e.id]??{}})))??[]),[e,n])}(x),C=JE({postType:Ce,context:"list"}),k=JE({postType:Ie.user,context:"list"}),E=zE(),P=(0,h.useMemo)((()=>n===Ce?[E,...C].filter(Boolean):[E,...k].filter(Boolean)),[E,n,C,k]),I=SE(),{title:V,description:O}=function(e,t){const{patternCategories:n}=Iy(),s=(0,c.useSelect)((e=>e(j.store).getCurrentTheme()?.default_template_part_areas||[]),[]);let i,r,a;if(e===Ce){const e=s.find((e=>e.area===t));i=e?.label||(0,w.__)("All Template Parts"),r=e?.description||(0,w.__)("Includes every template part defined for any area.")}else e===Ie.user&&t&&(a=n.find((e=>e.name===t)),i=a?.label,r=a?.description);return{title:i,description:r}}(n,r);return(0,a.jsx)(QE,{settings:I,children:(0,a.jsx)(Wm,{className:"edit-site-page-patterns-dataviews",title:V,subTitle:O,actions:(0,a.jsxs)(a.Fragment,{children:[u&&(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,onClick:d,children:(0,w.__)("Reset view")}),(0,a.jsx)(DE,{categoryId:r,postType:n})]}),children:(0,a.jsx)(_E,{paginationInfo:_,fields:y,actions:P,data:S||nP,getItemId:e=>e.name??e.id,isLoading:m,isItemClickable:e=>e.type!==Ie.theme,onClickItem:e=>{i.navigate(`/${e.type}/${[Ie.user,Ce].includes(e.type)?e.id:e.name}?canvas=edit`)},view:o,onChangeView:l,defaultLayouts:sP},r+n)})})}const aP={name:"patterns",path:"/pattern",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme,n=t||_v(e)?"/":void 0;return(0,a.jsx)(Ay,{backPath:n})},content:(0,a.jsx)(rP,{}),mobile({siteData:e,query:t}){const{categoryId:n}=t,s=e.currentTheme?.is_block_theme,i=s||_v(e)?"/":void 0;return n?(0,a.jsx)(rP,{}):(0,a.jsx)(Ay,{backPath:i})}}},oP={name:"pattern-item",path:"/wp_block/:postId",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme,n=t||_v(e)?"/":void 0;return(0,a.jsx)(Ay,{backPath:n})},mobile:(0,a.jsx)(wv,{}),preview:(0,a.jsx)(wv,{})}},lP={name:"template-part-item",path:"/wp_template_part/*postId",areas:{sidebar:(0,a.jsx)(Ay,{backPath:"/"}),mobile:(0,a.jsx)(wv,{}),preview:(0,a.jsx)(wv,{})}},{useLocation:cP}=ne(Lt.privateApis),uP=[];function dP({template:e,isActive:t}){const{text:n,icon:s}=UE(e.type,e.id);return(0,a.jsx)(Qa,{to:(0,Qt.addQueryArgs)("/template",{activeView:n}),icon:s,"aria-current":t,children:n})}function hP(){const{query:{activeView:e="all"}}=cP(),{records:t}=(0,j.useEntityRecords)("postType",Se,{per_page:-1}),n=(0,h.useMemo)((()=>{const e=t?.reduce(((e,t)=>{const n=t.author_text;return n&&!e[n]&&(e[n]=t),e}),{});return(e&&Object.values(e))??uP}),[t]);return(0,a.jsxs)(b.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-templates-browse",children:[(0,a.jsx)(Qa,{to:"/template",icon:Da,"aria-current":"all"===e,children:(0,w.__)("All templates")}),n.map((t=>(0,a.jsx)(dP,{template:t,isActive:e===t.author_text},t.author_text)))]})}function pP({backPath:e}){return(0,a.jsx)(Ua,{title:(0,w.__)("Templates"),description:(0,w.__)("Create new templates, or reset any customizations made to the templates supplied by your theme."),backPath:e,content:(0,a.jsx)(hP,{})})}var fP=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"})}),mP=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.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"})}),gP=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})}),vP=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})}),yP=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})}),xP=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.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"})}),bP=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",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",clipRule:"evenodd"})}),wP=(0,a.jsx)(Zt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Zt.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"})}),_P=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})}),jP=(0,a.jsxs)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,a.jsx)(Zt.Path,{d:"m7 6.5 4 2.5-4 2.5z"}),(0,a.jsx)(Zt.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})]}),SP=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.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"})});const CP={},kP=(e,t)=>{let n=e;return t.split(".").forEach((e=>{n=n?.[e]})),n};function EP(e,t){return`${e}-${(0,Qt.safeDecodeURI)(t)}`}const PP=()=>(0,c.useSelect)((e=>e(j.store).getEntityRecords("postType",Se,{per_page:-1})),[]),IP=()=>(0,c.useSelect)((e=>e(j.store).getCurrentTheme()?.default_template_types||[]),[]),VP=()=>{const e=(0,c.useSelect)((e=>e(j.store).getPostTypes({per_page:-1})),[]);return(0,h.useMemo)((()=>{const t=["attachment"];return e?.filter((({viewable:e,slug:n})=>e&&!t.includes(n))).sort(((e,t)=>"post"===e.slug||"post"===t.slug?0:e.name.localeCompare(t.name)))}),[e])};function OP(){const e=VP(),t=(0,h.useMemo)((()=>e?.filter((e=>e.has_archive))),[e]),n=PP(),s=(0,h.useMemo)((()=>e?.reduce(((e,{labels:t})=>{const n=t.singular_name.toLowerCase();return e[n]=(e[n]||0)+1,e}),{})),[e]),i=(0,h.useCallback)((({labels:e,slug:t})=>{const n=e.singular_name.toLowerCase();return s[n]>1&&n!==t}),[s]);return(0,h.useMemo)((()=>t?.filter((e=>!(n||[]).some((t=>t.slug==="archive-"+e.slug)))).map((e=>{let t;return t=i(e)?(0,w.sprintf)((0,w.__)("Archive: %1$s (%2$s)"),e.labels.singular_name,e.slug):(0,w.sprintf)((0,w.__)("Archive: %s"),e.labels.singular_name),{slug:"archive-"+e.slug,description:(0,w.sprintf)((0,w.__)("Displays an archive with the latest posts of type: %s."),e.labels.singular_name),title:t,icon:"string"==typeof e.icon&&e.icon.startsWith("dashicons-")?e.icon.slice(10):vP,templatePrefix:"archive"}}))||[]),[t,n,i])}const TP=e=>{const t=(()=>{const e=(0,c.useSelect)((e=>e(j.store).getTaxonomies({per_page:-1})),[]);return(0,h.useMemo)((()=>e?.filter((({visibility:e})=>e?.publicly_queryable))),[e])})(),n=PP(),s=IP(),i=(0,h.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let n=t;return["category","post_tag"].includes(t)||(n=`taxonomy-${n}`),"post_tag"===t&&(n="tag"),e[t]=n,e}),{})),[t]),r=t?.reduce(((e,{labels:t})=>{const n=(t.template_name||t.singular_name).toLowerCase();return e[n]=(e[n]||0)+1,e}),{}),a=MP("taxonomy",i),o=(n||[]).map((({slug:e})=>e)),l=(t||[]).reduce(((t,n)=>{const{slug:l,labels:c}=n,u=i[l],d=s?.find((({slug:e})=>e===u)),h=o?.includes(u),p=((e,t)=>{if(["category","post_tag"].includes(t))return!1;const n=(e.template_name||e.singular_name).toLowerCase();return r[n]>1&&n!==t})(c,l);let f=c.template_name||c.singular_name;p&&(f=c.template_name?(0,w.sprintf)((0,w._x)("%1$s (%2$s)","taxonomy template menu label"),c.template_name,l):(0,w.sprintf)((0,w._x)("%1$s (%2$s)","taxonomy menu label"),c.singular_name,l));const m=d?{...d,templatePrefix:i[l]}:{slug:u,title:f,description:(0,w.sprintf)((0,w.__)("Displays taxonomy: %s."),c.singular_name),icon:bP,templatePrefix:i[l]},g=a?.[l]?.hasEntities;return g&&(m.onClick=t=>{e({type:"taxonomy",slug:l,config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"count",exclude:a[l].existingEntitiesIds}),getSpecificTemplate:e=>{const t=EP(i[l],e.slug);return{title:t,slug:t,templatePrefix:i[l]}}},labels:c,hasGeneralTemplate:h,template:t})}),h&&!g||t.push(m),t}),[]);return(0,h.useMemo)((()=>l.reduce(((e,t)=>{const{slug:n}=t;let s="taxonomiesMenuItems";return["category","tag"].includes(n)&&(s="defaultTaxonomiesMenuItems"),e[s].push(t),e}),{defaultTaxonomiesMenuItems:[],taxonomiesMenuItems:[]})),[l])},AP={user:"author"},NP={user:{who:"authors"}};const FP=(e,t,n={})=>{const s=(e=>{const t=PP();return(0,h.useMemo)((()=>Object.entries(e||{}).reduce(((e,[n,s])=>{const i=(t||[]).reduce(((e,t)=>{const n=`${s}-`;return t.slug.startsWith(n)&&e.push(t.slug.substring(n.length)),e}),[]);return i.length&&(e[n]=i),e}),{})),[e,t])})(t);return(0,c.useSelect)((t=>Object.entries(s||{}).reduce(((s,[i,r])=>{const a=t(j.store).getEntityRecords(e,i,{_fields:"id",context:"view",slug:r,...n[i]});return a?.length&&(s[i]=a),s}),{})),[s])},MP=(e,t,n=CP)=>{const s=FP(e,t,n),i=(0,c.useSelect)((i=>Object.keys(t||{}).reduce(((t,r)=>{const a=s?.[r]?.map((({id:e})=>e))||[];return t[r]=!!i(j.store).getEntityRecords(e,r,{per_page:1,_fields:"id",context:"view",exclude:a,...n[r]})?.length,t}),{})),[t,s,e,n]);return(0,h.useMemo)((()=>Object.keys(t||{}).reduce(((e,t)=>{const n=s?.[t]?.map((({id:e})=>e))||[];return e[t]={hasEntities:i[t],existingEntitiesIds:n},e}),{})),[t,s,i])},BP=[];function DP({suggestion:e,search:t,onSelect:n,entityForSuggestions:s}){const i="edit-site-custom-template-modal__suggestions_list__list-item";return(0,a.jsxs)(b.Composite.Item,{render:(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,role:"option",className:i,onClick:()=>n(s.config.getSpecificTemplate(e))}),children:[(0,a.jsx)(b.__experimentalText,{size:"body",lineHeight:1.53846153846,weight:500,className:`${i}__title`,children:(0,a.jsx)(b.TextHighlight,{text:(0,qt.decodeEntities)(e.name),highlight:t})}),e.link&&(0,a.jsx)(b.__experimentalText,{size:"body",lineHeight:1.53846153846,className:`${i}__info`,children:(0,Qt.safeDecodeURI)(e.link)})]})}function RP(e,t){const{config:n}=e,s=(0,h.useMemo)((()=>({order:"asc",context:"view",search:t,per_page:t?20:10,...n.queryArgs(t)})),[t,n]),{records:i,hasResolved:r}=(0,j.useEntityRecords)(e.type,e.slug,s),[a,o]=(0,h.useState)(BP);return(0,h.useEffect)((()=>{if(!r)return;let e=BP;var t,s;i?.length&&(e=i,n.recordNamePath&&(t=e,s=n.recordNamePath,e=(t||[]).map((e=>({...e,name:(0,qt.decodeEntities)(kP(e,s))}))))),o(e)}),[i,r]),a}function LP({entityForSuggestions:e,onSelect:t}){const[n,s,i]=(0,y.useDebouncedInput)(),r=RP(e,i),{labels:o}=e,[l,c]=(0,h.useState)(!1);return!l&&r?.length>9&&c(!0),(0,a.jsxs)(a.Fragment,{children:[l&&(0,a.jsx)(b.SearchControl,{__nextHasNoMarginBottom:!0,onChange:s,value:n,label:o.search_items,placeholder:o.search_items}),!!r?.length&&(0,a.jsx)(b.Composite,{orientation:"vertical",role:"listbox",className:"edit-site-custom-template-modal__suggestions_list","aria-label":(0,w.__)("Suggestions list"),children:r.map((n=>(0,a.jsx)(DP,{suggestion:n,search:i,onSelect:t,entityForSuggestions:e},n.slug)))}),i&&!r?.length&&(0,a.jsx)(b.__experimentalText,{as:"p",className:"edit-site-custom-template-modal__no-results",children:o.not_found})]})}var zP=function({onSelect:e,entityForSuggestions:t,onBack:n,containerRef:s}){const[i,r]=(0,h.useState)(t.hasGeneralTemplate);return(0,h.useEffect)((()=>{if(s.current){const[e]=en.focus.focusable.find(s.current);e?.focus()}}),[i]),(0,a.jsxs)(b.__experimentalVStack,{spacing:4,className:"edit-site-custom-template-modal__contents-wrapper",alignment:"left",children:[!i&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.__experimentalText,{as:"p",children:(0,w.__)("Select whether to create a single template for all items or a specific one.")}),(0,a.jsxs)(b.Flex,{className:"edit-site-custom-template-modal__contents",gap:"4",align:"initial",children:[(0,a.jsxs)(b.FlexItem,{isBlock:!0,as:b.Button,onClick:()=>{const{slug:n,title:s,description:i,templatePrefix:r}=t.template;e({slug:n,title:s,description:i,templatePrefix:r})},children:[(0,a.jsx)(b.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846,children:t.labels.all_items}),(0,a.jsx)(b.__experimentalText,{as:"span",lineHeight:1.53846153846,children:(0,w.__)("For all items")})]}),(0,a.jsxs)(b.FlexItem,{isBlock:!0,as:b.Button,onClick:()=>{r(!0)},children:[(0,a.jsx)(b.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846,children:t.labels.singular_name}),(0,a.jsx)(b.__experimentalText,{as:"span",lineHeight:1.53846153846,children:(0,w.__)("For a specific item")})]})]}),(0,a.jsx)(b.Flex,{justify:"right",children:(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:n,children:(0,w.__)("Back")})})]}),i&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.__experimentalText,{as:"p",children:(0,w.__)("This template will be used only for the specific item chosen.")}),(0,a.jsx)(LP,{entityForSuggestions:t,onSelect:e}),(0,a.jsx)(b.Flex,{justify:"right",children:(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{t.hasGeneralTemplate?n():r(!1)},children:(0,w.__)("Back")})})]})]})};var HP=function(){return HP=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},HP.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function GP(e){return e.toLowerCase()}var WP=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],UP=/[^A-Z0-9]+/gi;function qP(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}function ZP(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,s=void 0===n?WP:n,i=t.stripRegexp,r=void 0===i?UP:i,a=t.transform,o=void 0===a?GP:a,l=t.delimiter,c=void 0===l?" ":l,u=qP(qP(e,s,"$1\0$2"),r,"\0"),d=0,h=u.length;"\0"===u.charAt(d);)d++;for(;"\0"===u.charAt(h-1);)h--;return u.slice(d,h).split("\0").map(o).join(c)}(e,HP({delimiter:"."},t))}var YP=function({createTemplate:e,onBack:t}){const[n,s]=(0,h.useState)(""),i=(0,w.__)("Custom Template"),[r,o]=(0,h.useState)(!1),l=(0,h.useRef)();return(0,h.useEffect)((()=>{l.current&&l.current.focus()}),[]),(0,a.jsx)("form",{onSubmit:async function(t){if(t.preventDefault(),!r){o(!0);try{await e({slug:(s=n||i,void 0===a&&(a={}),ZP(s,HP({delimiter:"-"},a))||"wp-custom-template"),title:n||i},!1)}finally{o(!1)}var s,a}},children:(0,a.jsxs)(b.__experimentalVStack,{spacing:6,children:[(0,a.jsx)(b.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,w.__)("Name"),value:n,onChange:s,placeholder:i,disabled:r,ref:l,help:(0,w.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')}),(0,a.jsxs)(b.__experimentalHStack,{className:"edit-site-custom-generic-template__modal-actions",justify:"right",children:[(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,children:(0,w.__)("Back")}),(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",isBusy:r,"aria-disabled":r,children:(0,w.__)("Create")})]})]})})};const{useHistory:KP}=ne(Lt.privateApis),XP=["front-page","home","single","page","index","archive","author","category","date","tag","search","404"],QP={"front-page":fP,home:mP,single:gP,page:Ba,archive:vP,search:Yt,404:yP,index:xP,category:zw,author:WE,taxonomy:bP,date:wP,tag:_P,attachment:jP};function JP({title:e,direction:t,className:n,description:s,icon:i,onClick:r,children:o}){return(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,className:n,onClick:r,label:s,showTooltip:!!s,children:(0,a.jsxs)(b.Flex,{as:"span",spacing:2,align:"center",justify:"center",style:{width:"100%"},direction:t,children:[(0,a.jsx)("div",{className:"edit-site-add-new-template__template-icon",children:(0,a.jsx)(b.Icon,{icon:i})}),(0,a.jsxs)(b.__experimentalVStack,{className:"edit-site-add-new-template__template-name",alignment:"center",spacing:0,children:[(0,a.jsx)(b.__experimentalText,{align:"center",weight:500,lineHeight:1.53846153846,children:e}),o]})]})})}const $P=1,eI=2,tI=3;function nI({onClose:e}){const[t,n]=(0,h.useState)($P),[s,i]=(0,h.useState)({}),[r,o]=(0,h.useState)(!1),l=function(e,t){const n=PP(),s=IP(),i=(n||[]).map((({slug:e})=>e)),r=(s||[]).filter((e=>XP.includes(e.slug)&&!i.includes(e.slug))),a=n=>{t?.(),e(n)},o=[...r],{defaultTaxonomiesMenuItems:l,taxonomiesMenuItems:c}=TP(a),{defaultPostTypesMenuItems:u,postTypesMenuItems:d}=(e=>{const t=VP(),n=PP(),s=IP(),i=(0,h.useMemo)((()=>t?.reduce(((e,{labels:t})=>{const n=(t.template_name||t.singular_name).toLowerCase();return e[n]=(e[n]||0)+1,e}),{})),[t]),r=(0,h.useCallback)((({labels:e,slug:t})=>{const n=(e.template_name||e.singular_name).toLowerCase();return i[n]>1&&n!==t}),[i]),a=(0,h.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let n=t;return"page"!==t&&(n=`single-${n}`),e[t]=n,e}),{})),[t]),o=MP("postType",a),l=(n||[]).map((({slug:e})=>e)),c=(t||[]).reduce(((t,n)=>{const{slug:i,labels:c,icon:u}=n,d=a[i],h=s?.find((({slug:e})=>e===d)),p=l?.includes(d),f=r(n);let m=c.template_name||(0,w.sprintf)((0,w.__)("Single item: %s"),c.singular_name);f&&(m=c.template_name?(0,w.sprintf)((0,w._x)("%1$s (%2$s)","post type menu label"),c.template_name,i):(0,w.sprintf)((0,w._x)("Single item: %1$s (%2$s)","post type menu label"),c.singular_name,i));const g=h?{...h,templatePrefix:a[i]}:{slug:d,title:m,description:(0,w.sprintf)((0,w.__)("Displays a single item: %s."),c.singular_name),icon:"string"==typeof u&&u.startsWith("dashicons-")?u.slice(10):SP,templatePrefix:a[i]},v=o?.[i]?.hasEntities;return v&&(g.onClick=t=>{e({type:"postType",slug:i,config:{recordNamePath:"title.rendered",queryArgs:({search:e})=>({_fields:"id,title,slug,link",orderBy:e?"relevance":"modified",exclude:o[i].existingEntitiesIds}),getSpecificTemplate:e=>{const t=EP(a[i],e.slug);return{title:t,slug:t,templatePrefix:a[i]}}},labels:c,hasGeneralTemplate:p,template:t})}),p&&!v||t.push(g),t}),[]),u=(0,h.useMemo)((()=>c.reduce(((e,t)=>{const{slug:n}=t;let s="postTypesMenuItems";return"page"===n&&(s="defaultPostTypesMenuItems"),e[s].push(t),e}),{defaultPostTypesMenuItems:[],postTypesMenuItems:[]})),[c]);return u})(a),p=function(e){const t=PP(),n=IP(),s=MP("root",AP,NP);let i=n?.find((({slug:e})=>"author"===e));i||(i={description:(0,w.__)("Displays latest posts written by a single author."),slug:"author",title:"Author"});const r=!!t?.find((({slug:e})=>"author"===e));if(s.user?.hasEntities&&(i={...i,templatePrefix:"author"},i.onClick=t=>{e({type:"root",slug:"user",config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"registered_date",exclude:s.user.existingEntitiesIds,who:"authors"}),getSpecificTemplate:e=>{const t=EP("author",e.slug);return{title:t,slug:t,templatePrefix:"author"}}},labels:{singular_name:(0,w.__)("Author"),search_items:(0,w.__)("Search Authors"),not_found:(0,w.__)("No authors found."),all_items:(0,w.__)("All Authors")},hasGeneralTemplate:r,template:t})}),!r||s.user?.hasEntities)return i}(a);[...l,...u,p].forEach((e=>{if(!e)return;const t=o.findIndex((t=>t.slug===e.slug));t>-1?o[t]=e:o.push(e)})),o?.sort(((e,t)=>XP.indexOf(e.slug)-XP.indexOf(t.slug)));const f=[...o,...OP(),...d,...c];return f}(i,(()=>n(eI))),u=KP(),{saveEntityRecord:d}=(0,c.useDispatch)(j.store),{createErrorNotice:p,createSuccessNotice:f}=(0,c.useDispatch)(_.store),m=(0,h.useRef)(null),g=(0,y.useViewportMatch)("medium","<"),v=(0,c.useSelect)((e=>e(j.store).getEntityRecord("root","__unstableBase")?.home),[]),x={"front-page":v,date:(0,w.sprintf)((0,w.__)("E.g. %s"),v+"/"+(new Date).getFullYear())};async function S(e,t=!0){if(!r){o(!0);try{const{title:n,description:s,slug:i}=e,r=await d("postType",Se,{description:s,slug:i.toString(),status:"publish",title:n,is_wp_suggestion:t},{throwOnError:!0});u.navigate(`/${Se}/${r.id}?canvas=edit`),f((0,w.sprintf)((0,w.__)('"%s" successfully created.'),(0,qt.decodeEntities)(r.title?.rendered||n)||(0,w.__)("(no title)")),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,w.__)("An error occurred while creating the template.");p(t,{type:"snackbar"})}finally{o(!1)}}}(0,h.useEffect)((()=>{if(m.current&&t===$P){const[e]=en.focus.focusable.find(m.current);e?.focus()}}),[t]);let C=(0,w.__)("Add template");return t===eI?C=(0,w.sprintf)((0,w.__)("Add template: %s"),s.labels.singular_name):t===tI&&(C=(0,w.__)("Create custom template")),(0,a.jsxs)(b.Modal,{title:C,className:Ht("edit-site-add-new-template__modal",{"edit-site-add-new-template__modal_template_list":t===$P,"edit-site-custom-template-modal":t===eI}),onRequestClose:()=>{e(),n($P)},overlayClassName:t===tI?"edit-site-custom-generic-template__modal":void 0,ref:m,children:[t===$P&&(0,a.jsxs)(b.__experimentalGrid,{columns:g?2:3,gap:4,align:"flex-start",justify:"center",className:"edit-site-add-new-template__template-list__contents",children:[(0,a.jsx)(b.Flex,{className:"edit-site-add-new-template__template-list__prompt",children:(0,w.__)("Select what the new template should apply to:")}),l.map((e=>{const{title:t,slug:n,onClick:s}=e;return(0,a.jsx)(JP,{title:t,direction:"column",className:"edit-site-add-new-template__template-button",description:x[n],icon:QP[n]||Da,onClick:()=>s?s(e):S(e)},n)})),(0,a.jsx)(JP,{title:(0,w.__)("Custom template"),direction:"row",className:"edit-site-add-new-template__custom-template-button",icon:RE,onClick:()=>n(tI),children:(0,a.jsx)(b.__experimentalText,{lineHeight:1.53846153846,children:(0,w.__)("A custom template can be manually applied to any post or page.")})})]}),t===eI&&(0,a.jsx)(zP,{onSelect:S,entityForSuggestions:s,onBack:()=>n($P),containerRef:m}),t===tI&&(0,a.jsx)(YP,{createTemplate:S,onBack:()=>n($P)})]})}var sI=(0,h.memo)((function(){const[e,t]=(0,h.useState)(!1),{postType:n}=(0,c.useSelect)((e=>{const{getPostType:t}=e(j.store);return{postType:t(Se)}}),[]);return n?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.Button,{variant:"primary",onClick:()=>t(!0),label:n.labels.add_new_item,__next40pxDefaultSize:!0,children:n.labels.add_new_item}),e&&(0,a.jsx)(nI,{onClose:()=>t(!1)})]}):null}));const{useGlobalStyle:iI}=ne(x.privateApis);const rI={label:(0,w.__)("Preview"),id:"preview",render:function({item:e}){const t=SE(),[n="white"]=iI("color.background"),s=(0,h.useMemo)((()=>(0,o.parse)(e.content.raw)),[e.content.raw]),i=!s?.length;return(0,a.jsx)(f.EditorProvider,{post:e,settings:t,children:(0,a.jsxs)("div",{className:"page-templates-preview-field",style:{backgroundColor:n},children:[i&&(0,w.__)("Empty template"),!i&&(0,a.jsx)(x.BlockPreview.Async,{children:(0,a.jsx)(x.BlockPreview,{blocks:s})})]})})},enableSorting:!1},aI={label:(0,w.__)("Description"),id:"description",render:({item:e})=>e.description&&(0,qt.decodeEntities)(e.description),enableSorting:!1,enableGlobalSearch:!0};const oI={label:(0,w.__)("Author"),id:"author",getValue:({item:e})=>e.author_text,render:function({item:e}){const[t,n]=(0,h.useState)(!1),{text:s,icon:i,imageUrl:r}=UE(e.type,e.id);return(0,a.jsxs)(b.__experimentalHStack,{alignment:"left",spacing:0,children:[r&&(0,a.jsx)("div",{className:Ht("page-templates-author-field__avatar",{"is-loaded":t}),children:(0,a.jsx)("img",{onLoad:()=>n(!0),alt:"",src:r})}),!r&&(0,a.jsx)("div",{className:"page-templates-author-field__icon",children:(0,a.jsx)(b.Icon,{icon:i})}),(0,a.jsx)("span",{className:"page-templates-author-field__name",children:s})]})}},lI={table:{showMedia:!1},grid:{showMedia:!0},list:{showMedia:!1}},cI={type:"grid",perPage:20,sort:{field:"title",direction:"asc"},titleField:"title",descriptionField:"description",mediaField:"preview",fields:["author","active","slug"],filters:[],...lI.grid};function uI(e){return{...cI,filters:["active","user"].includes(e)?[]:[{field:"author",operator:"isAny",value:[e]}]}}const{usePostActions:dI,templateTitleField:hI}=ne(f.privateApis),{useHistory:pI,useLocation:fI}=ne(Lt.privateApis),{useEntityRecordsWithPermissions:mI}=ne(j.privateApis);function gI(){const{path:e,query:t}=fI(),{activeView:n="active",postId:s}=t,[i,r]=(0,h.useState)([s]),o=(0,h.useMemo)((()=>uI(n)),[n]),{view:l,updateView:c,isModified:u,resetToDefault:d}=(0,jE.useView)({kind:"postType",name:Se,slug:n,defaultView:o,queryParams:{page:t.pageNumber,search:t.search},onChangeQueryParams:n=>{m.navigate((0,Qt.addQueryArgs)(e,{...t,pageNumber:n.page,search:n.search||void 0}))}}),{records:p,isResolving:f}=mI("postType",Se,{per_page:-1}),m=pI(),g=(0,h.useCallback)((t=>{r(t),"list"===l?.type&&m.navigate((0,Qt.addQueryArgs)(e,{postId:1===t.length?t[0]:void 0}))}),[m,e,l?.type]),v=(0,h.useMemo)((()=>{if(!p)return[];const e=new Set;return p.forEach((t=>{e.add(t.author_text)})),Array.from(e).map((e=>({value:e,label:e})))}),[p]),x=(0,h.useMemo)((()=>[rI,hI,aI,{...oI,elements:v}]),[v]),{data:_,paginationInfo:j}=(0,h.useMemo)((()=>Bw(p,l,x)),[p,l,x]),S=dI({postType:Se,context:"list"}),C=zE(),k=(0,h.useMemo)((()=>[C,...S]),[S,C]),E=(0,y.useEvent)((e=>{e.type!==l.type&&m.invalidate(),c(e)}));return(0,a.jsx)(Wm,{className:"edit-site-page-templates",title:(0,w.__)("Templates"),actions:(0,a.jsxs)(a.Fragment,{children:[u&&(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,onClick:()=>{d(),m.invalidate()},children:(0,w.__)("Reset view")}),(0,a.jsx)(sI,{})]}),children:(0,a.jsx)(_E,{paginationInfo:j,fields:x,actions:k,data:_,isLoading:f,view:l,onChangeView:E,onChangeSelection:g,isItemClickable:()=>!0,onClickItem:({id:e})=>{m.navigate(`/wp_template/${e}?canvas=edit`)},selection:i,defaultLayouts:lI},n)})}async function vI(e){const{activeView:t="active"}=e;return"list"===(await(0,jE.loadView)({kind:"postType",name:"wp_template",slug:t,defaultView:uI(t)})).type}const yI={name:"templates",path:"/template",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(pP,{backPath:"/"}):(0,a.jsx)(uo,{})},content({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(gI,{}):void 0},async preview({query:e,siteData:t}){const n=t.currentTheme?.is_block_theme;if(!n)return;return await vI(e)?(0,a.jsx)(wv,{}):void 0},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(gI,{}):(0,a.jsx)(uo,{})}},widths:{content:async({query:e})=>await vI(e)?380:void 0}},xI={name:"template-item",path:"/wp_template/*postId",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(pP,{backPath:"/"}):(0,a.jsx)(uo,{})},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(wv,{}):(0,a.jsx)(uo,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(wv,{}):(0,a.jsx)(uo,{})}}},{useLocation:bI}=ne(Lt.privateApis);function wI({title:e,slug:t,type:n,icon:s,isActive:i,suffix:r}){const{path:o}=bI(),l=s||z_.find((e=>e.type===n)).icon;return"all"===t&&(t=void 0),(0,a.jsxs)(b.__experimentalHStack,{justify:"flex-start",className:Ht("edit-site-sidebar-dataviews-dataview-item",{"is-selected":i}),children:[(0,a.jsx)(Qa,{icon:l,to:(0,Qt.addQueryArgs)(o,{activeView:t}),"aria-current":i?"true":void 0,children:e}),r]})}var _I=(0,a.jsxs)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,a.jsx)(Zt.Path,{d:"M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z"}),(0,a.jsx)(Zt.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"}),(0,a.jsx)(Zt.Path,{d:"M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z"})]}),jI=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})}),SI=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})}),CI=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})}),kI=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})}),EI=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})}),PI=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})});const II={table:{},grid:{},list:{}},VI={type:"list",filters:[],perPage:20,sort:{field:"title",direction:"asc"},showLevels:!0,titleField:"title",mediaField:"featured_media",fields:["author","status"],...II.list};function OI(e){return[{title:e?.labels?.all_items||(0,w.__)("All items"),slug:"all",icon:_I,view:VI},{title:(0,w.__)("Published"),slug:"published",icon:jI,view:{...VI,filters:[{field:"status",operator:De,value:"publish",isLocked:!0}]}},{title:(0,w.__)("Scheduled"),slug:"future",icon:SI,view:{...VI,filters:[{field:"status",operator:De,value:"future",isLocked:!0}]}},{title:(0,w.__)("Drafts"),slug:"drafts",icon:CI,view:{...VI,filters:[{field:"status",operator:De,value:"draft",isLocked:!0}]}},{title:(0,w.__)("Pending"),slug:"pending",icon:kI,view:{...VI,filters:[{field:"status",operator:De,value:"pending",isLocked:!0}]}},{title:(0,w.__)("Private"),slug:"private",icon:EI,view:{...VI,filters:[{field:"status",operator:De,value:"private",isLocked:!0}]}},{title:(0,w.__)("Trash"),slug:"trash",icon:PI,view:{...VI,type:"table",layout:II.table.layout,filters:[{field:"status",operator:De,value:"trash",isLocked:!0}]}}]}const TI=(e,t)=>OI(e).find((({slug:e})=>e===t))?.view,{useLocation:AI}=ne(Lt.privateApis);function NI({postType:e}){const{query:{activeView:t="all"}}=AI(),n=(0,c.useSelect)((t=>{const{getPostType:n}=t(j.store);return n(e)}),[e]),s=(0,h.useMemo)((()=>OI(n)),[n]);return e?(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(b.__experimentalItemGroup,{className:"edit-site-sidebar-dataviews",children:s.map((e=>(0,a.jsx)(wI,{slug:e.slug,title:e.title,icon:e.icon,type:e.view.type,isActive:e.slug===t},e.slug)))})}):null}var FI=(0,a.jsx)(Zt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Zt.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})});function MI({postType:e,onSave:t,onClose:n}){const s=(0,c.useSelect)((t=>t(j.store).getPostType(e)?.labels),[e]),[i,r]=(0,h.useState)(!1),[l,u]=(0,h.useState)(""),{saveEntityRecord:d}=(0,c.useDispatch)(j.store),{createErrorNotice:p,createSuccessNotice:f}=(0,c.useDispatch)(_.store),{resolveSelect:m}=(0,c.useRegistry)();return(0,a.jsx)(b.Modal,{title:(0,w.sprintf)((0,w.__)("Draft new: %s"),s?.singular_name),onRequestClose:n,focusOnMount:"firstContentElement",size:"small",children:(0,a.jsx)("form",{onSubmit:async function(n){if(n.preventDefault(),!i){r(!0);try{const n=await m(j.store).getPostType(e),s=await d("postType",e,{status:"draft",title:l,slug:l??void 0,content:n.template&&n.template.length?(0,o.serialize)((0,o.synchronizeBlocksWithTemplate)([],n.template)):void 0},{throwOnError:!0});t(s),f((0,w.sprintf)((0,w.__)('"%s" successfully created.'),(0,qt.decodeEntities)(s.title?.rendered||l)||(0,w.__)("(no title)")),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,w.__)("An error occurred while creating the item.");p(t,{type:"snackbar"})}finally{r(!1)}}},children:(0,a.jsxs)(b.__experimentalVStack,{spacing:4,children:[(0,a.jsx)(b.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,w.__)("Title"),onChange:u,placeholder:(0,w.__)("No title"),value:l}),(0,a.jsxs)(b.__experimentalHStack,{spacing:2,justify:"end",children:[(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:n,children:(0,w.__)("Cancel")}),(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",isBusy:i,"aria-disabled":i,children:(0,w.__)("Create draft")})]})]})})})}const{usePostActions:BI,usePostFields:DI}=ne(f.privateApis),{useLocation:RI,useHistory:LI}=ne(Lt.privateApis),{useEntityRecordsWithPermissions:zI}=ne(j.privateApis),HI=[];function GI(e){return e.id.toString()}function WI(e){return e.level}function UI({postType:e}){const{path:t,query:n}=RI(),{activeView:s="all",postId:i,quickEdit:r=!1}=n,o=LI(),l=(0,c.useSelect)((t=>{const{getPostType:n}=t(j.store);return n(e)}),[e]),{view:u,updateView:d,isModified:p,resetToDefault:f}=(0,jE.useView)({kind:"postType",name:e,slug:s,queryParams:{page:n.pageNumber,search:n.search},onChangeQueryParams:e=>{o.navigate((0,Qt.addQueryArgs)(t,{...n,pageNumber:e.page,search:e.search||void 0}))},defaultView:TI(l,s)}),m=(0,y.useEvent)((e=>{e.type!==u.type&&o.invalidate(),d(e)})),[g,v]=(0,h.useState)(i?.split(",")??[]),x=(0,h.useCallback)((e=>{v(e),o.navigate((0,Qt.addQueryArgs)(t,{postId:e.join(",")}))}),[t,o]),_=DI({postType:e}),S=(0,h.useMemo)((()=>{const e={};return u.filters?.forEach((t=>{"status"===t.field&&t.operator===De&&(e.status=t.value),"author"===t.field&&t.operator===De?e.author=t.value:"author"===t.field&&"isNone"===t.operator&&(e.author_exclude=t.value)})),e.status&&""!==e.status||(e.status="draft,future,pending,private,publish"),{per_page:u.perPage,page:u.page,_embed:"author,wp:featuredmedia",order:u.sort?.direction,orderby:u.sort?.field,orderby_hierarchy:!!u.showLevels,search:u.search,...e}}),[u]),{records:C,isResolving:k,totalItems:E,totalPages:P}=zI("postType",e,S),I=(0,h.useMemo)((()=>"author"===u?.sort?.field?Bw(C,{sort:{...u.sort}},_).data:C),[C,_,u?.sort]),V=I?.map((e=>GI(e)))??[],O=((0,y.usePrevious)(V)??[]).filter((e=>!V.includes(e))).includes(i);(0,h.useEffect)((()=>{O&&o.navigate((0,Qt.addQueryArgs)(t,{postId:void 0}))}),[o,O,t]);const T=(0,h.useMemo)((()=>({totalItems:E,totalPages:P})),[E,P]),{labels:A,canCreateRecord:N}=(0,c.useSelect)((t=>{const{getPostType:n,canUser:s}=t(j.store);return{labels:n(e)?.labels,canCreateRecord:s("create",{kind:"postType",name:e})}}),[e]),F=BI({postType:e,context:"list"}),M=zE(),B=(0,h.useMemo)((()=>[M,...F]),[F,M]),[D,R]=(0,h.useState)(!1),L=()=>R(!1);return(0,a.jsx)(Wm,{title:A?.name,actions:(0,a.jsxs)(a.Fragment,{children:[p&&(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,onClick:()=>{f(),o.invalidate()},children:(0,w.__)("Reset view")}),A?.add_new_item&&N&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.Button,{variant:"primary",onClick:()=>R(!0),__next40pxDefaultSize:!0,children:A.add_new_item}),D&&(0,a.jsx)(MI,{postType:e,onSave:({type:e,id:t})=>{o.navigate(`/${e}/${t}?canvas=edit`),L()},onClose:L})]})]}),children:(0,a.jsx)(_E,{paginationInfo:T,fields:_,actions:B,data:I||HI,isLoading:k,view:u,onChangeView:m,selection:g,onChangeSelection:x,isItemClickable:e=>"trash"!==e.status,onClickItem:({id:t})=>{o.navigate(`/${e}/${t}?canvas=edit`)},getItemId:GI,getItemLevel:WI,defaultLayouts:II,header:window.__experimentalQuickEditDataViews&&"list"!==u.type&&"page"===e&&(0,a.jsx)(b.Button,{size:"compact",isPressed:r,icon:FI,label:(0,w.__)("Details"),onClick:()=>{o.navigate((0,Qt.addQueryArgs)(t,{quickEdit:!r||void 0}))}})},s)})}const qI=(0,h.createContext)({fields:[]});function ZI({fields:e,children:t}){return(0,a.jsx)(qI.Provider,{value:{fields:e},children:t})}qI.displayName="DataFormContext";var YI=qI;function KI(e){return void 0!==e.children}const XI={type:"regular",labelPosition:"top"};function QI(e){let t=XI;if("regular"===e?.type)t={type:"regular",labelPosition:e?.labelPosition??"top"};else if("panel"===e?.type){const n=e.summary??[],s=Array.isArray(n)?n:[n];t={type:"panel",labelPosition:e?.labelPosition??"side",openAs:e?.openAs??"dropdown",summary:s}}else if("card"===e?.type)if(!1===e.withHeader)t={type:"card",withHeader:!1,isOpened:!0,summary:[]};else{const s=e.summary??[];t={type:"card",withHeader:!0,isOpened:"boolean"!=typeof e.isOpened||e.isOpened,summary:(n=s,"string"==typeof n?[{id:n,visibility:"when-collapsed"}]:n.map((e=>"string"==typeof e?{id:e,visibility:"when-collapsed"}:{id:e.id,visibility:e.visibility})))}}else"row"===e?.type&&(t={type:"row",alignment:e?.alignment??"center",styles:e?.styles??{}});var n;return t}function JI(e){const t=QI(e?.layout);return(e.fields??[]).map((e=>{if("string"==typeof e)return{id:e,layout:t};const n=e.layout?QI(e.layout):t;return{...e,layout:n}}))}function $I({title:e}){return(0,a.jsx)(b.__experimentalVStack,{className:"dataforms-layouts-regular__header",spacing:4,children:(0,a.jsxs)(b.__experimentalHStack,{alignment:"center",children:[(0,a.jsx)(b.__experimentalHeading,{level:2,size:13,children:e}),(0,a.jsx)(b.__experimentalSpacer,{})]})})}var eV=function({summaryFields:e,data:t,labelPosition:n,fieldLabel:s,disabled:i,onClick:r,"aria-expanded":o}){return(0,a.jsx)(b.Button,{className:"dataforms-layouts-panel__summary-button",size:"compact",variant:["none","top"].includes(n)?"link":"tertiary","aria-expanded":o,"aria-label":(0,w.sprintf)((0,w._x)("Edit %s","field"),s||""),onClick:r,disabled:i,accessibleWhenDisabled:!0,style:e.length>1?{minHeight:"auto",height:"auto",alignItems:"flex-start"}:void 0,children:e.length>1?(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:"2px"},children:e.map((e=>(0,a.jsx)("div",{style:{width:"100%"},children:(0,a.jsx)(e.render,{item:t,field:e})},e.id)))}):e.map((e=>(0,a.jsx)(e.render,{item:t,field:e},e.id)))})};function tV({title:e,onClose:t}){return(0,a.jsx)(b.__experimentalVStack,{className:"dataforms-layouts-panel__dropdown-header",spacing:4,children:(0,a.jsxs)(b.__experimentalHStack,{alignment:"center",children:[e&&(0,a.jsx)(b.__experimentalHeading,{level:2,size:13,children:e}),(0,a.jsx)(b.__experimentalSpacer,{}),t&&(0,a.jsx)(b.Button,{label:(0,w.__)("Close"),icon:Ea,onClick:t,size:"small"})]})})}var nV=function({data:e,field:t,onChange:n,validity:s,labelPosition:i="side",summaryFields:r,fieldDefinition:o,popoverAnchor:l}){const c=KI(t)?t.label:o?.label,u=(0,h.useMemo)((()=>({layout:XI,fields:KI(t)?t.children:[{id:t.id}]})),[t]),d=(0,h.useMemo)((()=>{if(void 0!==s)return KI(t)?s?.children:{[t.id]:s}}),[s,t]),p=(0,h.useMemo)((()=>({anchor:l,placement:"left-start",offset:36,shift:!0})),[l]);return(0,a.jsx)(b.Dropdown,{contentClassName:"dataforms-layouts-panel__field-dropdown",popoverProps:p,focusOnMount:!0,toggleProps:{size:"compact",variant:"tertiary",tooltipPosition:"middle left"},renderToggle:({isOpen:t,onToggle:n})=>(0,a.jsx)(eV,{summaryFields:r,data:e,labelPosition:i,fieldLabel:c,disabled:!0===o.readOnly,onClick:n,"aria-expanded":t}),renderContent:({onClose:t})=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tV,{title:c,onClose:t}),(0,a.jsx)(xV,{data:e,form:u,onChange:n,validity:d,children:(t,s,i)=>(0,a.jsx)(t,{data:e,field:s,onChange:n,hideLabelFromVision:(u?.fields??[]).length<2,validity:i},s.id)})]})})},sV=i(66),iV=i.n(sV);const rV=e=>[void 0,"",null].includes(e);function aV(e,t){return!!(void 0===e&&rV(t)||"text"===e&&rV(t)||"email"===e&&rV(t)||"url"===e&&rV(t)||"telephone"===e&&rV(t)||"password"===e&&rV(t)||"integer"===e&&rV(t)||"number"===e&&rV(t)||"array"===e&&(e=>!Array.isArray(e)||0===e.length||e.every((e=>rV(e))))(t)||"boolean"===e&&!0!==t)}function oV(e){return!e||Object.values(e).every((e=>Object.entries(e).every((([e,t])=>"children"===e&&t&&"object"==typeof t?oV(t):"valid"===t.type))))}function lV(e,t,n,s){e(t?e=>({...e,[t]:{...e?.[t],children:{...e?.[t]?.children,[n]:{...s}}}}):e=>({...e,[n]:{...s}}))}var cV=function(e,t,n){const[s,i]=(0,h.useState)(),r=(0,h.useRef)({}),a=(0,h.useRef)({}),o=(0,h.useRef)({}),l=(0,h.useCallback)((()=>{const{fields:s,fieldToParent:l}=function(e,t){const n=JI(t);if(0===n.length)return{fields:[],fieldToParent:new Map};const s=new Map,i=[];return n.forEach((e=>{e.children?e.children.forEach((t=>{const n="string"==typeof t?t:t.id;i.push(n),s.set(n,e.id)})):i.push(e.id)})),{fields:Aw(e.filter((e=>i.includes(e.id)))),fieldToParent:s}}(t,n);0!==s.length?s.forEach((t=>{const n=t.getValue({item:e});if(r.current.hasOwnProperty(t.id)&&n===r.current[t.id])return;r.current[t.id]=n;const s=l.get(t.id);if(t.isValid.required&&aV(t.type,n))return void lV(i,s,t.id,{required:{type:"invalid"}});if(t.isValid.elements&&t.hasElements&&!t.getElements&&Array.isArray(t.elements)){const e=t.elements.map((e=>e.value));if("array"!==t.type&&!e.includes(n))return void lV(i,s,t.id,{elements:{type:"invalid",message:"Value must be one of the elements."}});if("array"===t.type&&!Array.isArray(n))return void lV(i,s,t.id,{elements:{type:"invalid",message:"Value must be an array."}});if("array"===t.type&&n.some((t=>!e.includes(t))))return void lV(i,s,t.id,{elements:{type:"invalid",message:"Value must be one of the elements."}})}if(t.isValid.elements&&t.hasElements&&"function"==typeof t.getElements){const e=(o.current[t.id]||0)+1;o.current[t.id]=e,lV(i,s,t.id,{elements:{type:"validating",message:"Validating..."}}),t.getElements().then((r=>{if(o.current[t.id]!==e)return;if(!Array.isArray(r))return void lV(i,s,t.id,{elements:{type:"invalid",message:"Could not validate elements."}});const a=r.map((e=>e.value));"array"===t.type||a.includes(n)?"array"!==t.type||Array.isArray(n)?"array"===t.type&&n.some((e=>!a.includes(e)))&&lV(i,s,t.id,{elements:{type:"invalid",message:"Value must be one of the elements."}}):lV(i,s,t.id,{elements:{type:"invalid",message:"Value must be an array."}}):lV(i,s,t.id,{elements:{type:"invalid",message:"Value must be one of the elements."}})})).catch((n=>{o.current[t.id]===e&&lV(i,s,t.id,{elements:{type:"invalid",message:n.message}})}))}let c;try{c=t.isValid?.custom?.(iV()(e,t.setValue({item:e,value:n})),t)}catch(e){let n;n=e instanceof Error?e.message:String(e)||(0,w.__)("Unknown error when running custom validation."),lV(i,s,t.id,{custom:{type:"invalid",message:n}})}if("string"!=typeof c){if(c instanceof Promise){const e=(a.current[t.id]||0)+1;return a.current[t.id]=e,lV(i,s,t.id,{custom:{type:"validating",message:"Validating..."}}),void c.then((n=>{a.current[t.id]===e&&(null!==n?"string"==typeof n&&lV(i,s,t.id,{custom:{type:"invalid",message:n}}):lV(i,s,t.id,{custom:{type:"valid",message:"Valid"}}))})).catch((n=>{a.current[t.id]===e&&lV(i,s,t.id,{custom:{type:"invalid",message:n.message}})}))}i((e=>{if(!e)return e;if(s){const n=e[s];if(!n?.children)return e;const{[t.id]:i,...r}=n.children;if(0===Object.keys(r).length){const{children:t,...i}=n;if(0===Object.keys(i).length){const{[s]:t,...n}=e;return 0===Object.keys(n).length?void 0:n}return{...e,[s]:i}}return{...e,[s]:{...n,children:r}}}if(!e[t.id])return e;const{[t.id]:n,...i}=e;return 0!==Object.keys(i).length?i:void 0}))}else lV(i,s,t.id,{custom:{type:"invalid",message:c}})})):i(void 0)}),[e,t,n]);return(0,h.useEffect)((()=>{l()}),[l]),{validity:s,isValid:oV(s)}};function uV({data:e,field:t,onChange:n,fieldLabel:s,onClose:i}){const{fields:r}=(0,h.useContext)(YI),[o,l]=(0,h.useState)({}),c=(0,h.useMemo)((()=>iV()(e,o)),[e,o]),u=(0,h.useMemo)((()=>({layout:XI,fields:KI(t)?t.children:[{id:t.id}]})),[t]),{validity:d}=cV(c,r,u),p=e=>{l((t=>iV()(t,e)))};return(0,a.jsxs)(b.Modal,{className:"dataforms-layouts-panel__modal",onRequestClose:i,isFullScreen:!1,title:s,size:"medium",children:[(0,a.jsx)(xV,{data:c,form:u,onChange:p,validity:d,children:(e,t,n)=>(0,a.jsx)(e,{data:c,field:t,onChange:p,hideLabelFromVision:(u?.fields??[]).length<2,validity:n},t.id)}),(0,a.jsxs)(b.__experimentalHStack,{className:"dataforms-layouts-panel__modal-footer",spacing:3,children:[(0,a.jsx)(b.__experimentalSpacer,{}),(0,a.jsx)(b.Button,{variant:"tertiary",onClick:i,__next40pxDefaultSize:!0,children:(0,w.__)("Cancel")}),(0,a.jsx)(b.Button,{variant:"primary",onClick:()=>{n(o),i()},__next40pxDefaultSize:!0,children:(0,w.__)("Apply")})]})]})}var dV=function({data:e,field:t,onChange:n,labelPosition:s,summaryFields:i,fieldDefinition:r}){const[o,l]=(0,h.useState)(!1),c=KI(t)?t.label:r?.label;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eV,{summaryFields:i,data:e,labelPosition:s,fieldLabel:c,disabled:!0===r.readOnly,onClick:()=>l(!0),"aria-expanded":o}),o&&(0,a.jsx)(uV,{data:e,field:t,onChange:n,fieldLabel:c??"",onClose:()=>l(!1)})]})};const hV=(e,t)=>{if(Array.isArray(e)&&e.length>0){return(n=e,Array.isArray(n)?n.map((e=>"string"==typeof e?e:e.id)):[]).map((e=>t.find((t=>t.id===e)))).filter((e=>void 0!==e))}var n;return[]},pV=(e,t,n)=>{const s=hV(e.summary,n),i=((e,t)=>{const n=t.find((t=>t.id===e.id));return n||t.find((t=>{if(KI(e)){const n=e.children.filter((e=>"string"==typeof e||!KI(e)));if(0===n.length)return!1;const s="string"==typeof n[0]?n[0]:n[0].id;return t.id===s}return t.id===e.id}))})(t,n);return 0===s.length?{summaryFields:i?[i]:[],fieldDefinition:i}:{summaryFields:s,fieldDefinition:i}};function fV({title:e}){return(0,a.jsx)(b.__experimentalVStack,{className:"dataforms-layouts-row__header",spacing:4,children:(0,a.jsxs)(b.__experimentalHStack,{alignment:"center",children:[(0,a.jsx)(b.__experimentalHeading,{level:2,size:13,children:e}),(0,a.jsx)(b.__experimentalSpacer,{})]})})}const mV=({children:e})=>(0,a.jsx)(a.Fragment,{children:e});const gV=[{type:"regular",component:function({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){const{fields:r}=(0,h.useContext)(YI),o=(0,h.useMemo)((()=>({layout:XI,fields:KI(t)?t.children:[]})),[t]);if(KI(t))return(0,a.jsxs)(a.Fragment,{children:[!s&&t.label&&(0,a.jsx)($I,{title:t.label}),(0,a.jsx)(xV,{data:e,form:o,onChange:n,validity:i?.children})]});const l=QI({...t.layout,type:"regular"}).labelPosition,c=r.find((e=>e.id===t.id));return c&&c.Edit?"side"===l?(0,a.jsxs)(b.__experimentalHStack,{className:"dataforms-layouts-regular__field",children:[(0,a.jsx)("div",{className:Ht("dataforms-layouts-regular__field-label",`dataforms-layouts-regular__field-label--label-position-${l}`),children:c.label}),(0,a.jsx)("div",{className:"dataforms-layouts-regular__field-control",children:!0===c.readOnly?(0,a.jsx)(c.render,{item:e,field:c}):(0,a.jsx)(c.Edit,{data:e,field:c,onChange:n,hideLabelFromVision:!0,validity:i},c.id)})]}):(0,a.jsx)("div",{className:"dataforms-layouts-regular__field",children:!0===c.readOnly?(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(a.Fragment,{children:[!s&&"none"!==l&&(0,a.jsx)(b.BaseControl.VisualLabel,{children:c.label}),(0,a.jsx)(c.render,{item:e,field:c})]})}):(0,a.jsx)(c.Edit,{data:e,field:c,onChange:n,hideLabelFromVision:"none"===l||s,validity:i})}):null},wrapper:({children:e})=>(0,a.jsx)(b.__experimentalVStack,{className:"dataforms-layouts__wrapper",spacing:4,children:e})},{type:"panel",component:function({data:e,field:t,onChange:n,validity:s}){const{fields:i}=(0,h.useContext)(YI),r=QI({...t.layout,type:"panel"}),[o,l]=(0,h.useState)(null),{fieldDefinition:c,summaryFields:u}=pV(r,t,i);if(!c)return null;const d=r.labelPosition,p=Ht("dataforms-layouts-panel__field-label",`dataforms-layouts-panel__field-label--label-position-${d}`),f=KI(t)?t.label:c?.label,m="modal"===r.openAs?(0,a.jsx)(dV,{data:e,field:t,onChange:n,labelPosition:d,summaryFields:u,fieldDefinition:c}):(0,a.jsx)(nV,{data:e,field:t,onChange:n,validity:s,labelPosition:d,summaryFields:u,fieldDefinition:c,popoverAnchor:o});return"top"===d?(0,a.jsxs)(b.__experimentalVStack,{className:"dataforms-layouts-panel__field",spacing:0,children:[(0,a.jsx)("div",{className:p,style:{paddingBottom:0},children:f}),(0,a.jsx)("div",{className:"dataforms-layouts-panel__field-control",children:m})]}):"none"===d?(0,a.jsx)("div",{className:"dataforms-layouts-panel__field",children:m}):(0,a.jsxs)(b.__experimentalHStack,{ref:l,className:"dataforms-layouts-panel__field",children:[(0,a.jsx)("div",{className:p,children:f}),(0,a.jsx)("div",{className:"dataforms-layouts-panel__field-control",children:m})]})},wrapper:({children:e})=>(0,a.jsx)(b.__experimentalVStack,{className:"dataforms-layouts__wrapper",spacing:2,children:e})},{type:"card",component:function({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){const{fields:r}=(0,h.useContext)(YI),o=QI({...t.layout,type:"card"}),l=(0,h.useMemo)((()=>({layout:XI,fields:KI(t)?t.children:[]})),[t]),{isOpen:c,CollapsibleCardHeader:u}=function(e=!0){const[t,n]=(0,h.useState)(e),s=(0,h.useCallback)((()=>{n((e=>!e))}),[]),i=(0,h.useCallback)((({children:e,...n})=>(0,a.jsxs)(b.CardHeader,{...n,onClick:s,style:{cursor:"pointer",...n.style},children:[(0,a.jsx)("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:e}),(0,a.jsx)(b.Button,{__next40pxDefaultSize:!0,variant:"tertiary",icon:t?Av:Nv,"aria-expanded":t,"aria-label":t?"Collapse":"Expand"})]})),[s,t]);return{isOpen:t,CollapsibleCardHeader:i}}(o.isOpened),d=hV(o.summary,r).filter((e=>function(e,t,n){if(!t||Array.isArray(t)&&0===t.length)return!1;const s=(Array.isArray(t)?t:[t]).find((t=>"string"==typeof t?t===e.id:"object"==typeof t&&"id"in t&&t.id===e.id));return!!s&&("string"==typeof s||"object"!=typeof s||!("visibility"in s)||"always"===s.visibility||"when-collapsed"===s.visibility&&!n)}(e,o.summary,c)));if(KI(t)){const s=!!t.label&&o.withHeader;return(0,a.jsxs)(b.Card,{className:"dataforms-layouts-card__field",children:[s&&(0,a.jsxs)(u,{className:"dataforms-layouts-card__field-header",children:[(0,a.jsx)("span",{className:"dataforms-layouts-card__field-header-label",children:t.label}),d.length>0&&o.withHeader&&(0,a.jsx)("div",{className:"dataforms-layouts-card__field-summary",children:d.map((t=>(0,a.jsx)(t.render,{item:e,field:t},t.id)))})]}),(c||!s)&&(0,a.jsxs)(b.CardBody,{className:"dataforms-layouts-card__field-control",children:[t.description&&(0,a.jsx)("div",{className:"dataforms-layouts-card__field-description",children:t.description}),(0,a.jsx)(xV,{data:e,form:l,onChange:n,validity:i?.children})]})]})}const p=r.find((e=>e.id===t.id));if(!p||!p.Edit)return null;const f=vV("regular")?.component;if(!f)return null;const m=!!p.label&&o.withHeader;return(0,a.jsxs)(b.Card,{className:"dataforms-layouts-card__field",children:[m&&(0,a.jsxs)(u,{className:"dataforms-layouts-card__field-header",children:[(0,a.jsx)("span",{className:"dataforms-layouts-card__field-header-label",children:p.label}),d.length>0&&o.withHeader&&(0,a.jsx)("div",{className:"dataforms-layouts-card__field-summary",children:d.map((t=>(0,a.jsx)(t.render,{item:e,field:t},t.id)))})]}),(c||!m)&&(0,a.jsx)(b.CardBody,{className:"dataforms-layouts-card__field-control",children:(0,a.jsx)(f,{data:e,field:t,onChange:n,hideLabelFromVision:s||m,validity:i})})]})},wrapper:({children:e})=>(0,a.jsx)(b.__experimentalVStack,{className:"dataforms-layouts__wrapper",spacing:6,children:e})},{type:"row",component:function({data:e,field:t,onChange:n,hideLabelFromVision:s,validity:i}){const{fields:r}=(0,h.useContext)(YI),o=QI({...t.layout,type:"row"});if(KI(t)){const r={fields:t.children.map((e=>"string"==typeof e?{id:e}:e))};return(0,a.jsxs)("div",{className:"dataforms-layouts-row__field",children:[!s&&t.label&&(0,a.jsx)(fV,{title:t.label}),(0,a.jsx)(b.__experimentalHStack,{alignment:o.alignment,spacing:4,children:(0,a.jsx)(xV,{data:e,form:r,onChange:n,validity:i?.children,as:mV,children:(t,i,r)=>(0,a.jsx)("div",{className:"dataforms-layouts-row__field-control",style:o.styles[i.id],children:(0,a.jsx)(t,{data:e,field:i,onChange:n,hideLabelFromVision:s,validity:r})},i.id)})})]})}const l=r.find((e=>e.id===t.id));if(!l||!l.Edit)return null;const c=vV("regular")?.component;return c?(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{className:"dataforms-layouts-row__field-control",children:(0,a.jsx)(c,{data:e,field:l,onChange:n,validity:i})})}):null},wrapper:({children:e,layout:t})=>(0,a.jsx)(b.__experimentalVStack,{className:"dataforms-layouts__wrapper",spacing:4,children:(0,a.jsx)("div",{className:"dataforms-layouts-row__field",children:(0,a.jsx)(b.__experimentalHStack,{spacing:4,alignment:t.alignment,children:e})})})}];function vV(e){return gV.find((t=>t.type===e))}const yV=({children:e})=>(0,a.jsx)(b.__experimentalVStack,{className:"dataforms-layouts__wrapper",spacing:4,children:e});function xV({data:e,form:t,onChange:n,validity:s,children:i,as:r}){const{fields:o}=(0,h.useContext)(YI);const l=(0,h.useMemo)((()=>JI(t)),[t]),c=QI(t.layout),u=r??vV(c.type)?.wrapper??yV;return(0,a.jsx)(u,{layout:c,children:l.map((t=>{const r=vV(t.layout.type)?.component;if(!r)return null;const l=KI(t)?void 0:function(e){const t="string"==typeof e?e:e.id;return o.find((e=>e.id===t))}(t);return l&&l.isVisible&&!l.isVisible(e)?null:i?i(r,t,s?.[t.id]):(0,a.jsx)(r,{data:e,field:t,onChange:n,validity:s?.[t.id]},t.id)}))})}function bV({data:e,form:t,fields:n,onChange:s,validity:i}){const r=(0,h.useMemo)((()=>Aw(n)),[n]);return t.fields?(0,a.jsx)(ZI,{fields:r,children:(0,a.jsx)(xV,{data:e,form:t,onChange:s,validity:i})}):null}const{usePostFields:wV,PostCardPanel:_V}=ne(f.privateApis),jV=["title","status","date","author","discussion"];function SV({postType:e,postId:t}){const n=(0,h.useMemo)((()=>t.split(",")),[t]),{record:s,hasFinishedResolution:i}=(0,c.useSelect)((t=>{const s=["postType",e,n[0]],{getEditedEntityRecord:i,hasFinishedResolution:r}=t(j.store);return{record:1===n.length?i(...s):null,hasFinishedResolution:r("getEditedEntityRecord",s)}}),[e,n]),[r,o]=(0,h.useState)({}),{editEntityRecord:l}=(0,c.useDispatch)(j.store),u=wV({postType:e}),d=(0,h.useMemo)((()=>u?.map((e=>"status"===e.id?{...e,elements:e.elements.filter((e=>"trash"!==e.value))}:e))),[u]),p=(0,h.useMemo)((()=>({layout:{type:"panel"},fields:[{id:"featured_media",layout:{type:"regular"}},{id:"status",label:(0,w.__)("Status & Visibility"),children:["status","password"]},"author","date","slug","parent",{id:"discussion",label:(0,w.__)("Discussion"),children:["comment_status","ping_status"]},{label:(0,w.__)("Template"),id:"template",layout:{type:"regular",labelPosition:"side"}}].filter((e=>1===n.length||jV.includes("string"==typeof e?e:e.id)))})),[n]);(0,h.useEffect)((()=>{o({})}),[n]);const{ExperimentalBlockEditorProvider:f}=ne(x.privateApis),m=SE(),g=(0,h.useMemo)((()=>d.map((e=>"template"===e.id?{...e,Edit:t=>(0,a.jsx)(f,{settings:m,children:(0,a.jsx)(e.Edit,{...t})})}:e))),[d,m]);return(0,a.jsxs)(b.__experimentalVStack,{spacing:4,children:[(0,a.jsx)(_V,{postType:e,postId:n}),i&&(0,a.jsx)(bV,{data:1===n.length?s:r,fields:g,form:p,onChange:t=>{for(const i of n)t.status&&"future"!==t.status&&"future"===s?.status&&new Date(s.date)>new Date&&(t.date=null),t.status&&"private"===t.status&&s.password&&(t.password=""),l("postType",e,i,t),n.length>1&&o((e=>({...e,...t})))}})]})}function CV({postType:e,postId:t}){return(0,a.jsxs)(Wm,{className:Ht("edit-site-post-edit",{"is-empty":!t}),label:(0,w.__)("Post Edit"),children:[t&&(0,a.jsx)(SV,{postType:e,postId:t}),!t&&(0,a.jsx)("p",{children:(0,w.__)("Select a page to edit")})]})}const{useLocation:kV}=ne(Lt.privateApis);async function EV(e){const{activeView:t="all"}=e,n=await(0,c.resolveSelect)(j.store).getPostType("page");return"list"===(await(0,jE.loadView)({kind:"postType",name:"page",slug:t,defaultView:TI(n,t)})).type}function PV(){const{query:e={}}=kV(),{canvas:t="view"}=e;return"edit"===t?(0,a.jsx)(wv,{}):(0,a.jsx)(UI,{postType:"page"})}const IV={name:"pages",path:"/page",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(Ua,{title:(0,w.__)("Pages"),backPath:"/",content:(0,a.jsx)(NI,{postType:"page"})}):(0,a.jsx)(uo,{})},content({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(UI,{postType:"page"}):void 0},async preview({query:e,siteData:t}){const n=t.currentTheme?.is_block_theme;if(!n)return;return await EV(e)?(0,a.jsx)(wv,{}):void 0},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(PV,{}):(0,a.jsx)(uo,{})},edit:async({query:e})=>!await EV(e)&&!!e.quickEdit?(0,a.jsx)(CV,{postType:"page",postId:e.postId}):void 0},widths:{content:async({query:e})=>await EV(e)?380:void 0,edit:async({query:e})=>!await EV(e)&&!!e.quickEdit?380:void 0}};function VV(){return(0,a.jsx)(b.Notice,{status:"error",isDismissible:!1,children:(0,w.__)("The requested page could not be found. Please check the URL.")})}const OV=[{name:"page-item",path:"/page/:postId",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(Ua,{title:(0,w.__)("Pages"),backPath:"/",content:(0,a.jsx)(NI,{postType:"page"})}):(0,a.jsx)(uo,{})},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(wv,{}):(0,a.jsx)(uo,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,a.jsx)(wv,{}):(0,a.jsx)(uo,{})}}},IV,xI,yI,lP,oP,aP,cy,ay,kv,jv,{name:"stylebook",path:"/stylebook",areas:{sidebar:({siteData:e})=>_v(e)?(0,a.jsx)(Ua,{title:(0,w.__)("Styles"),backPath:"/",description:(0,w.__)("Preview your website's visual identity: colors, typography, and blocks.")}):(0,a.jsx)(uo,{}),preview:({siteData:e})=>_v(e)?(0,a.jsx)(lg,{isStatic:!0}):void 0,mobile:({siteData:e})=>_v(e)?(0,a.jsx)(lg,{isStatic:!0}):void 0}},{name:"notfound",path:"*",areas:{sidebar:(0,a.jsx)(co,{}),mobile:(0,a.jsx)(co,{customDescription:(0,a.jsx)(VV,{})}),content:(0,a.jsx)(b.__experimentalSpacer,{padding:2,children:(0,a.jsx)(VV,{})})}}];const{RouterProvider:TV}=ne(Lt.privateApis);function AV(){return(0,Kt.useCommandLoader)({name:"core/edit-site/toggle-styles-welcome-guide",hook:Sa()}),(0,Kt.useCommandLoader)({name:"core/edit-site/reset-global-styles",hook:Ca()}),(0,Kt.useCommandLoader)({name:"core/edit-site/open-styles-revisions",hook:ka()}),function(){const{query:e={}}=Na(),{canvas:t="view"}=e;let n="site-editor";"edit"===t&&(n="entity-edit"),(0,c.useSelect)((e=>e(x.store).getBlockSelectionStart()),[])&&(n="block-selection-edit"),Oa()&&(n=""),Aa(n)}(),(0,a.jsx)(ga,{})}function NV(){!function(){const e=(0,c.useRegistry)(),{registerRoute:t}=ne((0,c.useDispatch)(Rt));(0,h.useEffect)((()=>{e.batch((()=>{OV.forEach(t)}))}),[e,t])}();const{routes:e,currentTheme:t,editorSettings:n}=(0,c.useSelect)((e=>({routes:ne(e(Rt)).getRoutes(),currentTheme:e(j.store).getCurrentTheme(),editorSettings:e(Rt).getSettings()})),[]),s=(0,h.useCallback)((({path:e,query:t})=>Qr()?{path:e,query:{...t,wp_theme_preview:"wp_theme_preview"in t?t.wp_theme_preview:Jr()}}:{path:e,query:t}),[]),i=(0,h.useMemo)((()=>({siteData:{currentTheme:t,editorSettings:n}})),[t,n]);return(0,a.jsx)(TV,{routes:e,pathArg:"p",beforeNavigate:s,matchResolverArgs:i,children:(0,a.jsx)(AV,{})})}const FV=(0,Qt.getPath)(window.location.href)?.includes("site-editor.php"),MV=e=>{d()(`wp.editPost.${e}`,{since:"6.6",alternative:`wp.editor.${e}`})};function BV(e){return FV?(MV("PluginMoreMenuItem"),(0,a.jsx)(f.PluginMoreMenuItem,{...e})):null}function DV(e){return FV?(MV("PluginSidebar"),(0,a.jsx)(f.PluginSidebar,{...e})):null}function RV(e){return FV?(MV("PluginSidebarMoreMenuItem"),(0,a.jsx)(f.PluginSidebarMoreMenuItem,{...e})):null}const{useLocation:LV}=ne(Lt.privateApis);async function zV(e){const{activeView:t="all"}=e,n=await(0,c.resolveSelect)(j.store).getPostType("post");return"list"===(await(0,jE.loadView)({kind:"postType",name:"post",slug:t,defaultView:TI(n,t)})).type}function HV(){const{query:e={}}=LV(),{canvas:t="view"}=e;return"edit"===t?(0,a.jsx)(wv,{}):(0,a.jsx)(UI,{postType:"post"})}const GV={name:"posts",path:"/",areas:{sidebar:(0,a.jsx)(Ua,{title:(0,w.__)("Posts"),isRoot:!0,content:(0,a.jsx)(NI,{postType:"post"})}),content:(0,a.jsx)(UI,{postType:"post"}),preview:async({query:e})=>await zV(e)?(0,a.jsx)(wv,{isPostsList:!0}):void 0,mobile:(0,a.jsx)(HV,{}),edit:async({query:e})=>!await zV(e)&&!!e.quickEdit?(0,a.jsx)(CV,{postType:"post",postId:e.postId}):void 0},widths:{content:async({query:e})=>await zV(e)?380:void 0,edit:async({query:e})=>!await zV(e)&&!!e.quickEdit?380:void 0}};(0,w.__)("Posts");const{RouterProvider:WV}=ne(Lt.privateApis);function UV(e,t){}const{registerCoreBlockBindingsSources:qV}=ne(f.privateApis);function ZV(e,t){const n=document.getElementById(e),s=(0,h.createRoot)(n);(0,c.dispatch)(o.store).reapplyBlockTypeFilters();const i=(0,l.__experimentalGetCoreBlocks)().filter((({name:e})=>"core/freeform"!==e));return(0,l.registerCoreBlocks)(i),qV(),(0,c.dispatch)(o.store).setFreeformFallbackBlockName("core/html"),(0,g.registerLegacyWidgetBlock)({inserter:!1}),(0,g.registerWidgetGroupBlock)({inserter:!1}),(0,c.dispatch)(m.store).setDefaults("core/edit-site",{welcomeGuide:!0,welcomeGuideStyles:!0,welcomeGuidePage:!0,welcomeGuideTemplate:!0}),(0,c.dispatch)(m.store).setDefaults("core",{allowRightClickOverrides:!0,distractionFree:!1,editorMode:"visual",editorTool:"edit",fixedToolbar:!1,focusMode:!1,inactivePanels:[],keepCaretInsideBlock:!1,openPanels:["post-status"],showBlockBreadcrumbs:!0,showListViewByDefault:!1,enableChoosePatternModal:!0}),window.__experimentalMediaProcessing&&(0,c.dispatch)(m.store).setDefaults("core/media",{requireApproval:!0,optimizeOnUpload:!0}),(0,c.dispatch)(Rt).updateSettings(t),window.addEventListener("dragover",(e=>e.preventDefault()),!1),window.addEventListener("drop",(e=>e.preventDefault()),!1),s.render((0,a.jsx)(h.StrictMode,{children:(0,a.jsx)(NV,{})})),s}function YV(){d()("wp.editSite.reinitializeEditor",{since:"6.2",version:"6.3"})}})(),(window.wp=window.wp||{}).editSite=r})(); customize-widgets.min.js 0000644 00000104342 15151622574 0011366 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={7734:e=>{e.exports=function e(t,s){if(t===s)return!0;if(t&&s&&"object"==typeof t&&"object"==typeof s){if(t.constructor!==s.constructor)return!1;var i,r,o;if(Array.isArray(t)){if((i=t.length)!=s.length)return!1;for(r=i;0!=r--;)if(!e(t[r],s[r]))return!1;return!0}if(t instanceof Map&&s instanceof Map){if(t.size!==s.size)return!1;for(r of t.entries())if(!s.has(r[0]))return!1;for(r of t.entries())if(!e(r[1],s.get(r[0])))return!1;return!0}if(t instanceof Set&&s instanceof Set){if(t.size!==s.size)return!1;for(r of t.entries())if(!s.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(s)){if((i=t.length)!=s.length)return!1;for(r=i;0!=r--;)if(t[r]!==s[r])return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if((i=(o=Object.keys(t)).length)!==Object.keys(s).length)return!1;for(r=i;0!=r--;)if(!Object.prototype.hasOwnProperty.call(s,o[r]))return!1;for(r=i;0!=r--;){var n=o[r];if(!e(t[n],s[n]))return!1}return!0}return t!=t&&s!=s}}},t={};function s(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i](o,o.exports,s),o.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var i in t)s.o(t,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};s.r(i),s.d(i,{initialize:()=>Fe,store:()=>N});var r={};s.r(r),s.d(r,{__experimentalGetInsertionPoint:()=>O,isInserterOpened:()=>M});var o={};s.r(o),s.d(o,{setIsInserterOpened:()=>T});const n=window.ReactJSXRuntime,c=window.wp.element,a=window.wp.blockLibrary,d=window.wp.widgets,l=window.wp.blocks,u=window.wp.data,h=window.wp.preferences,p=window.wp.components,m=window.wp.i18n,g=window.wp.blockEditor,b=window.wp.compose,w=window.wp.hooks;function f({text:e,children:t}){const s=(0,b.useCopyToClipboard)(e);return(0,n.jsx)(p.Button,{size:"compact",variant:"secondary",ref:s,children:t})}class _ extends c.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){this.setState({error:e}),(0,w.doAction)("editor.ErrorBoundary.errorLogged",e)}render(){const{error:e}=this.state;return e?(0,n.jsx)(g.Warning,{className:"customize-widgets-error-boundary",actions:[(0,n.jsx)(f,{text:e.stack,children:(0,m.__)("Copy Error")},"copy-error")],children:(0,m.__)("The editor has encountered an unexpected error.")}):this.props.children}}const y=window.wp.coreData,x=window.wp.mediaUtils;var v=function({inspector:e,closeMenu:t,...s}){const i=(0,u.useSelect)((e=>e(g.store).getSelectedBlockClientId()),[]),r=(0,c.useMemo)((()=>document.getElementById(`block-${i}`)),[i]);return(0,n.jsx)(p.MenuItem,{onClick:()=>{e.open({returnFocusWhenClose:r}),t()},...s,children:(0,m.__)("Show more settings")})};function k(e){var t,s,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(s=k(e[t]))&&(i&&(i+=" "),i+=s)}else for(s in e)e[s]&&(i&&(i+=" "),i+=s);return i}const C=function(){for(var e,t,s=0,i="",r=arguments.length;s<r;s++)(e=arguments[s])&&(t=k(e))&&(i&&(i+=" "),i+=t);return i},S=window.wp.keycodes,j=window.wp.primitives;var I=(0,n.jsx)(j.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(j.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"})}),z=(0,n.jsx)(j.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(j.Path,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"})}),W=(0,n.jsx)(j.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(j.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),B=(0,n.jsx)(j.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(j.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"})});var E=(0,u.combineReducers)({blockInserterPanel:function(e=!1,t){return"SET_IS_INSERTER_OPENED"===t.type?t.value:e}});const A={rootClientId:void 0,insertionIndex:void 0};function M(e){return!!e.blockInserterPanel}function O(e){return"boolean"==typeof e.blockInserterPanel?A:e.blockInserterPanel}function T(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}const P={reducer:E,selectors:r,actions:o},N=(0,u.createReduxStore)("core/customize-widgets",P);(0,u.register)(N);var F=function e({setIsOpened:t}){const s=(0,b.useInstanceId)(e,"customize-widget-layout__inserter-panel-title"),i=(0,u.useSelect)((e=>e(N).__experimentalGetInsertionPoint()),[]);return(0,n.jsxs)("div",{className:"customize-widgets-layout__inserter-panel","aria-labelledby":s,children:[(0,n.jsxs)("div",{className:"customize-widgets-layout__inserter-panel-header",children:[(0,n.jsx)("h2",{id:s,className:"customize-widgets-layout__inserter-panel-header-title",children:(0,m.__)("Add a block")}),(0,n.jsx)(p.Button,{size:"small",icon:B,onClick:()=>t(!1),"aria-label":(0,m.__)("Close inserter")})]}),(0,n.jsx)("div",{className:"customize-widgets-layout__inserter-panel-content",children:(0,n.jsx)(g.__experimentalLibrary,{rootClientId:i.rootClientId,__experimentalInsertionIndex:i.insertionIndex,showInserterHelpPanel:!0,onSelect:()=>t(!1)})})]})},L=(0,n.jsx)(j.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(j.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})}),D=(0,n.jsx)(j.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(j.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})});const H=window.wp.keyboardShortcuts,R=[{keyCombination:{modifier:"primary",character:"b"},description:(0,m.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,m.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,m.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,m.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,m.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,m.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,m.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,m.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},aliases:[{modifier:"access",character:"7"}],description:(0,m.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,m.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")},{keyCombination:{modifier:"primaryShift",character:"SPACE"},description:(0,m.__)("Add non breaking space.")}];function G({keyCombination:e,forceAriaLabel:t}){const s=e.modifier?S.displayShortcutList[e.modifier](e.character):e.character,i=e.modifier?S.shortcutAriaLabel[e.modifier](e.character):e.character;return(0,n.jsx)("kbd",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||i,children:(Array.isArray(s)?s:[s]).map(((e,t)=>"+"===e?(0,n.jsx)(c.Fragment,{children:e},t):(0,n.jsx)("kbd",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-key",children:e},t)))})}var V=function({description:e,keyCombination:t,aliases:s=[],ariaLabel:i}){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-description",children:e}),(0,n.jsxs)("div",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-term",children:[(0,n.jsx)(G,{keyCombination:t,forceAriaLabel:i}),s.map(((e,t)=>(0,n.jsx)(G,{keyCombination:e,forceAriaLabel:i},t)))]})]})};var U=function({name:e}){const{keyCombination:t,description:s,aliases:i}=(0,u.useSelect)((t=>{const{getShortcutKeyCombination:s,getShortcutDescription:i,getShortcutAliases:r}=t(H.store);return{keyCombination:s(e),aliases:r(e),description:i(e)}}),[e]);return t?(0,n.jsx)(V,{keyCombination:t,description:s,aliases:i}):null};const $=({shortcuts:e})=>(0,n.jsx)("ul",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-list",role:"list",children:e.map(((e,t)=>(0,n.jsx)("li",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut",children:"string"==typeof e?(0,n.jsx)(U,{name:e}):(0,n.jsx)(V,{...e})},t)))}),q=({title:e,shortcuts:t,className:s})=>(0,n.jsxs)("section",{className:C("customize-widgets-keyboard-shortcut-help-modal__section",s),children:[!!e&&(0,n.jsx)("h2",{className:"customize-widgets-keyboard-shortcut-help-modal__section-title",children:e}),(0,n.jsx)($,{shortcuts:t})]}),K=({title:e,categoryName:t,additionalShortcuts:s=[]})=>{const i=(0,u.useSelect)((e=>e(H.store).getCategoryShortcuts(t)),[t]);return(0,n.jsx)(q,{title:e,shortcuts:i.concat(s)})};function Z({isModalActive:e,toggleModal:t}){const{registerShortcut:s}=(0,u.useDispatch)(H.store);return(0,c.useEffect)((()=>{s({name:"core/customize-widgets/keyboard-shortcuts",category:"main",description:(0,m.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}})}),[s]),(0,H.useShortcut)("core/customize-widgets/keyboard-shortcuts",t),e?(0,n.jsxs)(p.Modal,{className:"customize-widgets-keyboard-shortcut-help-modal",title:(0,m.__)("Keyboard shortcuts"),onRequestClose:t,children:[(0,n.jsx)(q,{className:"customize-widgets-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/customize-widgets/keyboard-shortcuts"]}),(0,n.jsx)(K,{title:(0,m.__)("Global shortcuts"),categoryName:"global"}),(0,n.jsx)(K,{title:(0,m.__)("Selection shortcuts"),categoryName:"selection"}),(0,n.jsx)(K,{title:(0,m.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,m.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,m.__)("Forward-slash")}]}),(0,n.jsx)(q,{title:(0,m.__)("Text formatting"),shortcuts:R})]}):null}function Y(){const[e,t]=(0,c.useState)(!1),s=()=>t(!e);return(0,H.useShortcut)("core/customize-widgets/keyboard-shortcuts",s),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(p.ToolbarDropdownMenu,{icon:L,label:(0,m.__)("Options"),popoverProps:{placement:"bottom-end",className:"more-menu-dropdown__content"},toggleProps:{tooltipPosition:"bottom",size:"compact"},children:()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(p.MenuGroup,{label:(0,m._x)("View","noun"),children:(0,n.jsx)(h.PreferenceToggleMenuItem,{scope:"core/customize-widgets",name:"fixedToolbar",label:(0,m.__)("Top toolbar"),info:(0,m.__)("Access all block and document tools in a single place"),messageActivated:(0,m.__)("Top toolbar activated"),messageDeactivated:(0,m.__)("Top toolbar deactivated")})}),(0,n.jsxs)(p.MenuGroup,{label:(0,m.__)("Tools"),children:[(0,n.jsx)(p.MenuItem,{onClick:()=>{t(!0)},shortcut:S.displayShortcut.access("h"),children:(0,m.__)("Keyboard shortcuts")}),(0,n.jsx)(h.PreferenceToggleMenuItem,{scope:"core/customize-widgets",name:"welcomeGuide",label:(0,m.__)("Welcome Guide")}),(0,n.jsxs)(p.MenuItem,{role:"menuitem",icon:D,href:(0,m.__)("https://wordpress.org/documentation/article/block-based-widgets-editor/"),target:"_blank",rel:"noopener noreferrer",children:[(0,m.__)("Help"),(0,n.jsx)(p.VisuallyHidden,{as:"span",children:(0,m.__)("(opens in a new tab)")})]})]}),(0,n.jsx)(p.MenuGroup,{label:(0,m.__)("Preferences"),children:(0,n.jsx)(h.PreferenceToggleMenuItem,{scope:"core/customize-widgets",name:"keepCaretInsideBlock",label:(0,m.__)("Contain text cursor inside block"),info:(0,m.__)("Aids screen readers by stopping text caret from leaving blocks."),messageActivated:(0,m.__)("Contain text cursor inside block activated"),messageDeactivated:(0,m.__)("Contain text cursor inside block deactivated")})})]})}),(0,n.jsx)(Z,{isModalActive:e,toggleModal:s})]})}var J=function({sidebar:e,inserter:t,isInserterOpened:s,setIsInserterOpened:i,isFixedToolbarActive:r}){const[[o,a],d]=(0,c.useState)([e.hasUndo(),e.hasRedo()]),l=(0,S.isAppleOS)()?S.displayShortcut.primaryShift("z"):S.displayShortcut.primary("y");return(0,c.useEffect)((()=>e.subscribeHistory((()=>{d([e.hasUndo(),e.hasRedo()])}))),[e]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:C("customize-widgets-header",{"is-fixed-toolbar-active":r}),children:(0,n.jsxs)(g.NavigableToolbar,{className:"customize-widgets-header-toolbar","aria-label":(0,m.__)("Document tools"),children:[(0,n.jsx)(p.ToolbarButton,{icon:(0,m.isRTL)()?z:I,label:(0,m.__)("Undo"),shortcut:S.displayShortcut.primary("z"),disabled:!o,onClick:e.undo,className:"customize-widgets-editor-history-button undo-button"}),(0,n.jsx)(p.ToolbarButton,{icon:(0,m.isRTL)()?I:z,label:(0,m.__)("Redo"),shortcut:l,disabled:!a,onClick:e.redo,className:"customize-widgets-editor-history-button redo-button"}),(0,n.jsx)(p.ToolbarButton,{className:"customize-widgets-header-toolbar__inserter-toggle",isPressed:s,variant:"primary",icon:W,label:(0,m._x)("Add block","Generic label for block inserter button"),onClick:()=>{i((e=>!e))}}),(0,n.jsx)(Y,{})]})}),(0,c.createPortal)((0,n.jsx)(F,{setIsOpened:i}),t.contentContainer[0])]})};var X=s(7734),Q=s.n(X);const ee=window.wp.isShallowEqual;var te=s.n(ee);function se(e){const t=e.match(/^widget_(.+)(?:\[(\d+)\])$/);if(t){return`${t[1]}-${parseInt(t[2],10)}`}return e}function ie(e,t=null){let s;if("core/legacy-widget"===e.name&&(e.attributes.id||e.attributes.instance))if(e.attributes.id)s={id:e.attributes.id};else{const{encoded:i,hash:r,raw:o,...n}=e.attributes.instance;s={idBase:e.attributes.idBase,instance:{...t?.instance,is_widget_customizer_js_value:!0,encoded_serialized_instance:i,instance_hash_key:r,raw_instance:o,...n}}}else{s={idBase:"block",widgetClass:"WP_Widget_Block",instance:{raw_instance:{content:(0,l.serialize)(e)}}}}const{form:i,rendered:r,...o}=t||{};return{...o,...s}}function re({id:e,idBase:t,number:s,instance:i}){let r;const{encoded_serialized_instance:o,instance_hash_key:n,raw_instance:c,...a}=i;if("block"===t){const e=(0,l.parse)(c.content??"",{__unstableSkipAutop:!0});r=e.length?e[0]:(0,l.createBlock)("core/paragraph",{})}else r=s?(0,l.createBlock)("core/legacy-widget",{idBase:t,instance:{encoded:o,hash:n,raw:c,...a}}):(0,l.createBlock)("core/legacy-widget",{id:e});return(0,d.addWidgetIdToBlock)(r,e)}function oe(e){const[t,s]=(0,c.useState)((()=>e.getWidgets().map((e=>re(e)))));(0,c.useEffect)((()=>e.subscribe(((e,t)=>{s((s=>{const i=new Map(e.map((e=>[e.id,e]))),r=new Map(s.map((e=>[(0,d.getWidgetIdFromBlock)(e),e]))),o=t.map((e=>{const t=i.get(e.id);return t&&t===e?r.get(e.id):re(e)}));return te()(s,o)?s:o}))}))),[e]);const i=(0,c.useCallback)((t=>{s((s=>{if(te()(s,t))return s;const i=new Map(s.map((e=>[(0,d.getWidgetIdFromBlock)(e),e]))),r=t.map((t=>{const s=(0,d.getWidgetIdFromBlock)(t);if(s&&i.has(s)){const r=i.get(s),o=e.getWidget(s);return Q()(t,r)&&o?o:ie(t,o)}return ie(t)}));if(te()(e.getWidgets(),r))return s;const o=e.setWidgets(r);return t.reduce(((e,s,i)=>{const r=o[i];return null!==r&&(e===t&&(e=t.slice()),e[i]=(0,d.addWidgetIdToBlock)(s,r)),e}),t)}))}),[e]);return[t,i,i]}const ne=(0,c.createContext)();function ce({api:e,sidebarControls:t,children:s}){const[i,r]=(0,c.useState)({current:null}),o=(0,c.useCallback)((e=>{for(const s of t){if(s.setting.get().includes(e)){s.sectionInstance.expand({completeCallback(){r({current:e})}});break}}}),[t]);(0,c.useEffect)((()=>{function t(e){const t=se(e);o(t)}let s=!1;function i(){e.previewer.preview.bind("focus-control-for-setting",t),s=!0}return e.previewer.bind("ready",i),()=>{e.previewer.unbind("ready",i),s&&e.previewer.preview.unbind("focus-control-for-setting",t)}}),[e,o]);const a=(0,c.useMemo)((()=>[i,o]),[i,o]);return(0,n.jsx)(ne.Provider,{value:a,children:s})}ne.displayName="FocusControlContext";const ae=()=>(0,c.useContext)(ne);const de=window.wp.privateApis,{lock:le,unlock:ue}=(0,de.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/customize-widgets"),{ExperimentalBlockEditorProvider:he}=ue(g.privateApis);function pe({sidebar:e,settings:t,children:s}){const[i,r,o]=oe(e);return function(e){const{selectBlock:t}=(0,u.useDispatch)(g.store),[s]=ae(),i=(0,c.useRef)(e);(0,c.useEffect)((()=>{i.current=e}),[e]),(0,c.useEffect)((()=>{if(s.current){const e=i.current.find((e=>(0,d.getWidgetIdFromBlock)(e)===s.current));if(e){t(e.clientId);const s=document.querySelector(`[data-block="${e.clientId}"]`);s?.focus()}}}),[s,t])}(i),(0,n.jsx)(he,{value:i,onInput:r,onChange:o,settings:t,useSubRegistry:!1,children:s})}function me({sidebar:e}){const{toggle:t}=(0,u.useDispatch)(h.store),s=e.getWidgets().every((e=>e.id.startsWith("block-")));return(0,n.jsxs)("div",{className:"customize-widgets-welcome-guide",children:[(0,n.jsx)("div",{className:"customize-widgets-welcome-guide__image__wrapper",children:(0,n.jsxs)("picture",{children:[(0,n.jsx)("source",{srcSet:"https://s.w.org/images/block-editor/welcome-editor.svg",media:"(prefers-reduced-motion: reduce)"}),(0,n.jsx)("img",{className:"customize-widgets-welcome-guide__image",src:"https://s.w.org/images/block-editor/welcome-editor.gif",width:"312",height:"240",alt:""})]})}),(0,n.jsx)("h1",{className:"customize-widgets-welcome-guide__heading",children:(0,m.__)("Welcome to block Widgets")}),(0,n.jsx)("p",{className:"customize-widgets-welcome-guide__text",children:s?(0,m.__)("Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site."):(0,m.__)("You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.")}),(0,n.jsx)(p.Button,{size:"compact",variant:"primary",onClick:()=>t("core/customize-widgets","welcomeGuide"),children:(0,m.__)("Got it")}),(0,n.jsx)("hr",{className:"customize-widgets-welcome-guide__separator"}),!s&&(0,n.jsxs)("p",{className:"customize-widgets-welcome-guide__more-info",children:[(0,m.__)("Want to stick with the old widgets?"),(0,n.jsx)("br",{}),(0,n.jsx)(p.ExternalLink,{href:(0,m.__)("https://wordpress.org/plugins/classic-widgets/"),children:(0,m.__)("Get the Classic Widgets plugin.")})]}),(0,n.jsxs)("p",{className:"customize-widgets-welcome-guide__more-info",children:[(0,m.__)("New to the block editor?"),(0,n.jsx)("br",{}),(0,n.jsx)(p.ExternalLink,{href:(0,m.__)("https://wordpress.org/documentation/article/wordpress-block-editor/"),children:(0,m.__)("Here's a detailed guide.")})]})]})}function ge({undo:e,redo:t,save:s}){return(0,H.useShortcut)("core/customize-widgets/undo",(t=>{e(),t.preventDefault()})),(0,H.useShortcut)("core/customize-widgets/redo",(e=>{t(),e.preventDefault()})),(0,H.useShortcut)("core/customize-widgets/save",(e=>{e.preventDefault(),s()})),null}ge.Register=function(){const{registerShortcut:e,unregisterShortcut:t}=(0,u.useDispatch)(H.store);return(0,c.useEffect)((()=>(e({name:"core/customize-widgets/undo",category:"global",description:(0,m.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/customize-widgets/redo",category:"global",description:(0,m.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"},aliases:(0,S.isAppleOS)()?[]:[{modifier:"primary",character:"y"}]}),e({name:"core/customize-widgets/save",category:"global",description:(0,m.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),()=>{t("core/customize-widgets/undo"),t("core/customize-widgets/redo"),t("core/customize-widgets/save")})),[e]),null};var be=ge;function we(e){const t=(0,c.useRef)(),s=(0,u.useSelect)((e=>0===e(g.store).getBlockCount()));return(0,c.useEffect)((()=>{if(s&&t.current){const{ownerDocument:e}=t.current;e.activeElement&&e.activeElement!==e.body||t.current.focus()}}),[s]),(0,n.jsx)(g.ButtonBlockAppender,{...e,ref:t})}const{ExperimentalBlockCanvas:fe}=ue(g.privateApis),{BlockKeyboardShortcuts:_e}=ue(a.privateApis);function ye({blockEditorSettings:e,sidebar:t,inserter:s,inspector:i}){const[r,o]=function(e){const t=(0,u.useSelect)((e=>e(N).isInserterOpened()),[]),{setIsInserterOpened:s}=(0,u.useDispatch)(N);return(0,c.useEffect)((()=>{t?e.open():e.close()}),[e,t]),[t,(0,c.useCallback)((e=>{let t=e;"function"==typeof e&&(t=e((0,u.select)(N).isInserterOpened())),s(t)}),[s])]}(s),a=(0,b.useViewportMatch)("small"),{hasUploadPermissions:d,isFixedToolbarActive:l,keepCaretInsideBlock:p,isWelcomeGuideActive:m}=(0,u.useSelect)((e=>{const{get:t}=e(h.store);return{hasUploadPermissions:e(y.store).canUser("create",{kind:"postType",name:"attachment"})??!0,isFixedToolbarActive:!!t("core/customize-widgets","fixedToolbar"),keepCaretInsideBlock:!!t("core/customize-widgets","keepCaretInsideBlock"),isWelcomeGuideActive:!!t("core/customize-widgets","welcomeGuide")}}),[]),w=(0,c.useMemo)((()=>{let t;return d&&(t=({onError:t,...s})=>{(0,x.uploadMedia)({wpAllowedMimeTypes:e.allowedMimeTypes,onError:({message:e})=>t(e),...s})}),{...e,__experimentalSetIsInserterOpened:o,mediaUpload:t,hasFixedToolbar:l||!a,keepCaretInsideBlock:p,editorTool:"edit",__unstableHasCustomAppender:!0}}),[d,e,l,a,p,o]);return m?(0,n.jsx)(me,{sidebar:t}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(be.Register,{}),(0,n.jsx)(_e,{}),(0,n.jsxs)(pe,{sidebar:t,settings:w,children:[(0,n.jsx)(be,{undo:t.undo,redo:t.redo,save:t.save}),(0,n.jsx)(J,{sidebar:t,inserter:s,isInserterOpened:r,setIsInserterOpened:o,isFixedToolbarActive:l||!a}),(l||!a)&&(0,n.jsx)(g.BlockToolbar,{hideDragHandle:!0}),(0,n.jsx)(fe,{shouldIframe:!1,styles:w.defaultEditorStyles,height:"100%",children:(0,n.jsx)(g.BlockList,{renderAppender:we})}),(0,c.createPortal)((0,n.jsx)("form",{onSubmit:e=>e.preventDefault(),children:(0,n.jsx)(g.BlockInspector,{})}),i.contentContainer[0])]}),(0,n.jsx)(g.__unstableBlockSettingsMenuFirstItem,{children:({onClose:e})=>(0,n.jsx)(v,{inspector:i,closeMenu:e})})]})}const xe=(0,c.createContext)();function ve({sidebarControls:e,activeSidebarControl:t,children:s}){const i=(0,c.useMemo)((()=>({sidebarControls:e,activeSidebarControl:t})),[e,t]);return(0,n.jsx)(xe.Provider,{value:i,children:s})}function ke({api:e,sidebarControls:t,blockEditorSettings:s}){const[i,r]=(0,c.useState)(null),o=document.getElementById("customize-theme-controls"),a=(0,c.useRef)();!function(e,t){const{hasSelectedBlock:s,hasMultiSelection:i}=(0,u.useSelect)(g.store),{clearSelectedBlock:r}=(0,u.useDispatch)(g.store);(0,c.useEffect)((()=>{if(t.current&&e){let o=function(e){!s()&&!i()||!e||!l.contains(e)||d.contains(e)||t.current.contains(e)||e.closest('[role="dialog"]')||a.expanded()||r()},n=function(e){o(e.target)},c=function(){o(l.activeElement)};const a=e.inspector,d=e.container[0],l=d.ownerDocument,u=l.defaultView;return l.addEventListener("mousedown",n),u.addEventListener("blur",c),()=>{l.removeEventListener("mousedown",n),u.removeEventListener("blur",c)}}}),[t,e,s,i,r])}(i,a),(0,c.useEffect)((()=>{const e=t.map((e=>e.subscribe((t=>{t&&r(e)}))));return()=>{e.forEach((e=>e()))}}),[t]);const d=i&&(0,c.createPortal)((0,n.jsx)(_,{children:(0,n.jsx)(ye,{blockEditorSettings:s,sidebar:i.sidebarAdapter,inserter:i.inserter,inspector:i.inspector},i.id)}),i.container[0]),l=o&&(0,c.createPortal)((0,n.jsx)("div",{className:"customize-widgets-popover",ref:a,children:(0,n.jsx)(p.Popover.Slot,{})}),o);return(0,n.jsx)(p.SlotFillProvider,{children:(0,n.jsx)(ve,{sidebarControls:t,activeSidebarControl:i,children:(0,n.jsxs)(ce,{api:e,sidebarControls:t,children:[d,l]})})})}xe.displayName="SidebarControlsContext";const Ce=e=>`widgets-inspector-${e}`;function Se(){const{wp:{customize:e}}=window,t=window.matchMedia("(prefers-reduced-motion: reduce)");let s=t.matches;return t.addEventListener("change",(e=>{s=e.matches})),class extends e.Section{ready(){const t=function(){const{wp:{customize:e}}=window;return class extends e.Section{constructor(e,t){super(e,t),this.parentSection=t.parentSection,this.returnFocusWhenClose=null,this._isOpen=!1}get isOpen(){return this._isOpen}set isOpen(e){this._isOpen=e,this.triggerActiveCallbacks()}ready(){this.contentContainer[0].classList.add("customize-widgets-layout__inspector")}isContextuallyActive(){return this.isOpen}onChangeExpanded(e,t){super.onChangeExpanded(e,t),this.parentSection&&!t.unchanged&&(e?this.parentSection.collapse({manualTransition:!0}):this.parentSection.expand({manualTransition:!0,completeCallback:()=>{this.returnFocusWhenClose&&!this.contentContainer[0].contains(this.returnFocusWhenClose)&&this.returnFocusWhenClose.focus()}}))}open({returnFocusWhenClose:e}={}){this.isOpen=!0,this.returnFocusWhenClose=e,this.expand({allowMultiple:!0})}close(){this.collapse({allowMultiple:!0})}collapse(e){this.isOpen=!1,super.collapse(e)}triggerActiveCallbacks(){this.active.callbacks.fireWith(this.active,[!1,!0])}}}();this.inspector=new t(Ce(this.id),{title:(0,m.__)("Block Settings"),parentSection:this,customizeAction:[(0,m.__)("Customizing"),(0,m.__)("Widgets"),this.params.title].join(" ▸ ")}),e.section.add(this.inspector),this.contentContainer[0].classList.add("customize-widgets__sidebar-section")}hasSubSectionOpened(){return this.inspector.expanded()}onChangeExpanded(e,t){const i=this.controls(),r={...t,completeCallback(){i.forEach((t=>{t.onChangeSectionExpanded?.(e,r)})),t.completeCallback?.()}};if(r.manualTransition){e?(this.contentContainer.addClass(["busy","open"]),this.contentContainer.removeClass("is-sub-section-open"),this.contentContainer.closest(".wp-full-overlay").addClass("section-open")):(this.contentContainer.addClass(["busy","is-sub-section-open"]),this.contentContainer.closest(".wp-full-overlay").addClass("section-open"),this.contentContainer.removeClass("open"));const t=()=>{this.contentContainer.removeClass("busy"),r.completeCallback()};s?t():this.contentContainer.one("transitionend",t)}else super.onChangeExpanded(e,r)}}}const{wp:je}=window;function Ie(e){const t=e.match(/^(.+)-(\d+)$/);return t?{idBase:t[1],number:parseInt(t[2],10)}:{idBase:e}}function ze(e){const{idBase:t,number:s}=Ie(e);return s?`widget_${t}[${s}]`:`widget_${t}`}class We{constructor(e,t){this.setting=e,this.api=t,this.locked=!1,this.widgetsCache=new WeakMap,this.subscribers=new Set,this.history=[this._getWidgetIds().map((e=>this.getWidget(e)))],this.historyIndex=0,this.historySubscribers=new Set,this._debounceSetHistory=function(e,t,s){let i,r=!1;function o(...o){const n=(r?t:e).apply(this,o);return r=!0,clearTimeout(i),i=setTimeout((()=>{r=!1}),s),n}return o.cancel=()=>{r=!1,clearTimeout(i)},o}(this._pushHistory,this._replaceHistory,1e3),this.setting.bind(this._handleSettingChange.bind(this)),this.api.bind("change",this._handleAllSettingsChange.bind(this)),this.undo=this.undo.bind(this),this.redo=this.redo.bind(this),this.save=this.save.bind(this)}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}getWidgets(){return this.history[this.historyIndex]}_emit(...e){for(const t of this.subscribers)t(...e)}_getWidgetIds(){return this.setting.get()}_pushHistory(){this.history=[...this.history.slice(0,this.historyIndex+1),this._getWidgetIds().map((e=>this.getWidget(e)))],this.historyIndex+=1,this.historySubscribers.forEach((e=>e()))}_replaceHistory(){this.history[this.historyIndex]=this._getWidgetIds().map((e=>this.getWidget(e)))}_handleSettingChange(){if(this.locked)return;const e=this.getWidgets();this._pushHistory(),this._emit(e,this.getWidgets())}_handleAllSettingsChange(e){if(this.locked)return;if(!e.id.startsWith("widget_"))return;const t=se(e.id);if(!this.setting.get().includes(t))return;const s=this.getWidgets();this._pushHistory(),this._emit(s,this.getWidgets())}_createWidget(e){const t=je.customize.Widgets.availableWidgets.findWhere({id_base:e.idBase});let s=e.number;t.get("is_multi")&&!s&&(t.set("multi_number",t.get("multi_number")+1),s=t.get("multi_number"));const i=s?`widget_${e.idBase}[${s}]`:`widget_${e.idBase}`,r={transport:je.customize.Widgets.data.selectiveRefreshableWidgets[t.get("id_base")]?"postMessage":"refresh",previewer:this.setting.previewer};this.api.create(i,i,"",r).set(e.instance);return se(i)}_removeWidget(e){const t=ze(e.id),s=this.api(t);if(s){const e=s.get();this.widgetsCache.delete(e)}this.api.remove(t)}_updateWidget(e){const t=this.getWidget(e.id);if(t===e)return e.id;if(t.idBase&&e.idBase&&t.idBase===e.idBase){const t=ze(e.id);return this.api(t).set(e.instance),e.id}return this._removeWidget(e),this._createWidget(e)}getWidget(e){if(!e)return null;const{idBase:t,number:s}=Ie(e),i=ze(e),r=this.api(i);if(!r)return null;const o=r.get();if(this.widgetsCache.has(o))return this.widgetsCache.get(o);const n={id:e,idBase:t,number:s,instance:o};return this.widgetsCache.set(o,n),n}_updateWidgets(e){this.locked=!0;const t=[],s=e.map((e=>{if(e.id&&this.getWidget(e.id))return t.push(null),this._updateWidget(e);const s=this._createWidget(e);return t.push(s),s}));return this.getWidgets().filter((e=>!s.includes(e.id))).forEach((e=>this._removeWidget(e))),this.setting.set(s),this.locked=!1,t}setWidgets(e){const t=this._updateWidgets(e);return this._debounceSetHistory(),t}hasUndo(){return this.historyIndex>0}hasRedo(){return this.historyIndex<this.history.length-1}_seek(e){const t=this.getWidgets();this.historyIndex=e;const s=this.history[this.historyIndex];this._updateWidgets(s),this._emit(t,this.getWidgets()),this.historySubscribers.forEach((e=>e())),this._debounceSetHistory.cancel()}undo(){this.hasUndo()&&this._seek(this.historyIndex-1)}redo(){this.hasRedo()&&this._seek(this.historyIndex+1)}subscribeHistory(e){return this.historySubscribers.add(e),()=>{this.historySubscribers.delete(e)}}save(){this.api.previewer.save()}}const Be=window.wp.dom;const Ee=e=>`widgets-inserter-${e}`;function Ae(){const{wp:{customize:e}}=window;return class extends e.Control{constructor(...e){super(...e),this.subscribers=new Set}ready(){const t=function(){const{wp:{customize:e}}=window,t=e.OuterSection;return e.OuterSection=class extends t{onChangeExpanded(t,s){return t&&e.section.each((e=>{"outer"===e.params.type&&e.id!==this.id&&e.expanded()&&e.collapse()})),super.onChangeExpanded(t,s)}},e.sectionConstructor.outer=e.OuterSection,class extends e.OuterSection{constructor(...e){super(...e),this.params.type="outer",this.activeElementBeforeExpanded=null,this.contentContainer[0].ownerDocument.defaultView.addEventListener("keydown",(e=>{!this.expanded()||e.keyCode!==S.ESCAPE&&"Escape"!==e.code||e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),(0,u.dispatch)(N).setIsInserterOpened(!1))}),!0),this.contentContainer.addClass("widgets-inserter"),this.isFromInternalAction=!1,this.expanded.bind((()=>{this.isFromInternalAction||(0,u.dispatch)(N).setIsInserterOpened(this.expanded()),this.isFromInternalAction=!1}))}open(){if(!this.expanded()){const e=this.contentContainer[0];this.activeElementBeforeExpanded=e.ownerDocument.activeElement,this.isFromInternalAction=!0,this.expand({completeCallback(){const t=Be.focus.tabbable.find(e)[1];t&&t.focus()}})}}close(){if(this.expanded()){const e=this.contentContainer[0],t=e.ownerDocument.activeElement;this.isFromInternalAction=!0,this.collapse({completeCallback(){e.contains(t)&&this.activeElementBeforeExpanded&&this.activeElementBeforeExpanded.focus()}})}}}}();this.inserter=new t(Ee(this.id),{}),e.section.add(this.inserter),this.sectionInstance=e.section(this.section()),this.inspector=this.sectionInstance.inspector,this.sidebarAdapter=new We(this.setting,e)}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}onChangeSectionExpanded(e,t){t.unchanged||(e||(0,u.dispatch)(N).setIsInserterOpened(!1),this.subscribers.forEach((s=>s(e,t))))}}}const Me=(0,b.createHigherOrderComponent)((e=>t=>{let s=(0,d.getWidgetIdFromBlock)(t);const i=function(){const{sidebarControls:e}=(0,c.useContext)(xe);return e}(),r=function(){const{activeSidebarControl:e}=(0,c.useContext)(xe);return e}(),o=i?.length>1,a=t.name,l=t.clientId,h=(0,u.useSelect)((e=>e(g.store).canInsertBlockType(a,"")),[a]),p=(0,u.useSelect)((e=>e(g.store).getBlock(l)),[l]),{removeBlock:m}=(0,u.useDispatch)(g.store),[,b]=ae();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e,{...t},"edit"),o&&h&&(0,n.jsx)(g.BlockControls,{children:(0,n.jsx)(d.MoveToWidgetArea,{widgetAreas:i.map((e=>({id:e.id,name:e.params.label,description:e.params.description}))),currentWidgetAreaId:r?.id,onSelect:function(e){const t=i.find((t=>t.id===e));if(s){const e=r.setting,i=t.setting;e(e().filter((e=>e!==s))),i([...i(),s])}else{const e=t.sidebarAdapter;m(l);const i=e.setWidgets([...e.getWidgets(),ie(p)]);s=i.reverse().find((e=>!!e))}b(s)}})})]})}),"withMoveToSidebarToolbarItem");(0,w.addFilter)("editor.BlockEdit","core/customize-widgets/block-edit",Me);(0,w.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",(()=>x.MediaUpload));const{wp:Oe}=window,Te=(0,b.createHigherOrderComponent)((e=>t=>{const{idBase:s}=t.attributes,i=Oe.customize.Widgets.data.availableWidgets.find((e=>e.id_base===s))?.is_wide??!1;return(0,n.jsx)(e,{...t,isWide:i},"edit")}),"withWideWidgetDisplay");(0,w.addFilter)("editor.BlockEdit","core/customize-widgets/wide-widget-display",Te);const{wp:Pe}=window,Ne=["core/more","core/block","core/freeform","core/template-part"];function Fe(e,t){(0,u.dispatch)(h.store).setDefaults("core/customize-widgets",{fixedToolbar:!1,welcomeGuide:!0}),(0,u.dispatch)(l.store).reapplyBlockTypeFilters();const s=(0,a.__experimentalGetCoreBlocks)().filter((e=>!(Ne.includes(e.name)||e.name.startsWith("core/post")||e.name.startsWith("core/query")||e.name.startsWith("core/site")||e.name.startsWith("core/navigation"))));(0,a.registerCoreBlocks)(s),(0,d.registerLegacyWidgetBlock)(),(0,d.registerLegacyWidgetVariations)(t),(0,d.registerWidgetGroupBlock)(),(0,l.setFreeformContentHandlerName)("core/html");const i=Ae();Pe.customize.sectionConstructor.sidebar=Se(),Pe.customize.controlConstructor.sidebar_block_editor=i;const r=document.createElement("div");document.body.appendChild(r),Pe.customize.bind("ready",(()=>{const e=[];Pe.customize.control.each((t=>{t instanceof i&&e.push(t)})),(0,c.createRoot)(r).render((0,n.jsx)(c.StrictMode,{children:(0,n.jsx)(ke,{api:Pe.customize,sidebarControls:e,blockEditorSettings:t})}))}))}(window.wp=window.wp||{}).customizeWidgets=i})(); a11y.min.js 0000644 00000004244 15151622574 0006453 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{setup:()=>s,speak:()=>d});const n=window.wp.domReady;var o=e.n(n);function i(e="polite"){const t=document.createElement("div");t.id=`a11y-speak-${e}`,t.className="a11y-speak-region",t.setAttribute("style","position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;"),t.setAttribute("aria-live",e),t.setAttribute("aria-relevant","additions text"),t.setAttribute("aria-atomic","true");const{body:n}=document;return n&&n.appendChild(t),t}const a=window.wp.i18n;let r="";function d(e,t){!function(){const e=document.getElementsByClassName("a11y-speak-region"),t=document.getElementById("a11y-speak-intro-text");for(let t=0;t<e.length;t++)e[t].textContent="";t&&t.setAttribute("hidden","hidden")}(),e=function(e){return e=e.replace(/<[^<>]+>/g," "),r===e&&(e+=" "),r=e,e}(e);const n=document.getElementById("a11y-speak-intro-text"),o=document.getElementById("a11y-speak-assertive"),i=document.getElementById("a11y-speak-polite");o&&"assertive"===t?o.textContent=e:i&&(i.textContent=e),n&&n.removeAttribute("hidden")}function s(){const e=document.getElementById("a11y-speak-intro-text"),t=document.getElementById("a11y-speak-assertive"),n=document.getElementById("a11y-speak-polite");null===e&&function(){const e=document.createElement("p");e.id="a11y-speak-intro-text",e.className="a11y-speak-intro-text",e.textContent=(0,a.__)("Notifications"),e.setAttribute("style","position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;"),e.setAttribute("hidden","");const{body:t}=document;t&&t.appendChild(e)}(),null===t&&i("assertive"),null===n&&i("polite")}o()(s),(window.wp=window.wp||{}).a11y=t})(); edit-widgets.min.js 0000644 00000163163 15151622574 0010277 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{initialize:()=>Cr,initializeEditor:()=>Ir,reinitializeEditor:()=>Nr,store:()=>dt});var r={};e.r(r),e.d(r,{closeModal:()=>$,disableComplementaryArea:()=>V,enableComplementaryArea:()=>M,openModal:()=>U,pinItem:()=>D,setDefaultComplementaryArea:()=>O,setFeatureDefaults:()=>H,setFeatureValue:()=>z,toggleFeature:()=>G,unpinItem:()=>F});var i={};e.r(i),e.d(i,{getActiveComplementaryArea:()=>Y,isComplementaryAreaLoading:()=>K,isFeatureActive:()=>q,isItemPinned:()=>Z,isModalActive:()=>J});var s={};e.r(s),e.d(s,{closeGeneralSidebar:()=>Pe,lockWidgetSaving:()=>Ve,moveBlockToWidgetArea:()=>Oe,persistStubPost:()=>Ee,saveEditedWidgetAreas:()=>Ae,saveWidgetArea:()=>Ce,saveWidgetAreas:()=>Ie,setIsInserterOpened:()=>We,setIsListViewOpened:()=>Re,setIsWidgetAreaOpen:()=>Le,setWidgetAreasOpenState:()=>Te,setWidgetIdForClientId:()=>Be,unlockWidgetSaving:()=>Me});var o={};e.r(o),e.d(o,{getWidgetAreas:()=>De,getWidgets:()=>Fe});var n={};e.r(n),e.d(n,{__experimentalGetInsertionPoint:()=>Xe,canInsertBlockInWidgetArea:()=>et,getEditedWidgetAreas:()=>Ke,getIsWidgetAreaOpen:()=>Je,getParentWidgetAreaBlock:()=>Ye,getReferenceWidgetBlocks:()=>Ze,getWidget:()=>He,getWidgetAreaForWidgetId:()=>$e,getWidgetAreas:()=>Ue,getWidgets:()=>ze,isInserterOpened:()=>Qe,isListViewOpened:()=>tt,isSavingWidgetAreas:()=>qe,isWidgetSavingLocked:()=>rt});var a={};e.r(a),e.d(a,{getInserterSidebarToggleRef:()=>st,getListViewToggleRef:()=>it});var c={};e.r(c),e.d(c,{metadata:()=>pt,name:()=>wt,settings:()=>bt});const d=window.ReactJSXRuntime,l=window.wp.blocks,u=window.wp.data,g=window.wp.deprecated;var p=e.n(g);const h=window.wp.element,m=window.wp.blockLibrary,_=window.wp.coreData,w=window.wp.widgets,b=window.wp.preferences,f=window.wp.apiFetch;var v=e.n(f);var y=(0,u.combineReducers)({blockInserterPanel:function(e=!1,t){switch(t.type){case"SET_IS_LIST_VIEW_OPENED":return!t.isOpen&&e;case"SET_IS_INSERTER_OPENED":return t.value}return e},inserterSidebarToggleRef:function(e={current:null}){return e},listViewPanel:function(e=!1,t){switch(t.type){case"SET_IS_INSERTER_OPENED":return!t.value&&e;case"SET_IS_LIST_VIEW_OPENED":return t.isOpen}return e},listViewToggleRef:function(e={current:null}){return e},widgetAreasOpenState:function(e={},t){const{type:r}=t;switch(r){case"SET_WIDGET_AREAS_OPEN_STATE":return t.widgetAreasOpenState;case"SET_IS_WIDGET_AREA_OPEN":{const{clientId:r,isOpen:i}=t;return{...e,[r]:i}}default:return e}},widgetSavingLock:function(e={},t){switch(t.type){case"LOCK_WIDGET_SAVING":return{...e,[t.lockName]:!0};case"UNLOCK_WIDGET_SAVING":{const{[t.lockName]:r,...i}=e;return i}}return e}});const x=window.wp.i18n,k=window.wp.notices;function j(e){var t,r,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=j(e[t]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}const S=function(){for(var e,t,r=0,i="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=j(e))&&(i&&(i+=" "),i+=t);return i},E=window.wp.components,A=window.wp.primitives;var I=(0,d.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,d.jsx)(A.Path,{d:"M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z"})}),C=(0,d.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,d.jsx)(A.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"})}),N=(0,d.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,d.jsx)(A.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"})});const B=window.wp.viewport,T=window.wp.compose,L=window.wp.plugins;var W=(0,d.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,d.jsx)(A.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"})});function R(e){return["core/edit-post","core/edit-site"].includes(e)?(p()(`${e} interface scope`,{alternative:"core interface scope",hint:"core/edit-post and core/edit-site are merging.",version:"6.6"}),"core"):e}function P(e,t){return"core"===e&&"edit-site/template"===t?(p()("edit-site/template sidebar",{alternative:"edit-post/document",version:"6.6"}),"edit-post/document"):"core"===e&&"edit-site/block-inspector"===t?(p()("edit-site/block-inspector sidebar",{alternative:"edit-post/block",version:"6.6"}),"edit-post/block"):t}const O=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e=R(e),area:t=P(e,t)}),M=(e,t)=>({registry:r,dispatch:i})=>{if(!t)return;e=R(e),t=P(e,t);r.select(b.store).get(e,"isComplementaryAreaVisible")||r.dispatch(b.store).set(e,"isComplementaryAreaVisible",!0),i({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},V=e=>({registry:t})=>{e=R(e);t.select(b.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(b.store).set(e,"isComplementaryAreaVisible",!1)},D=(e,t)=>({registry:r})=>{if(!t)return;e=R(e),t=P(e,t);const i=r.select(b.store).get(e,"pinnedItems");!0!==i?.[t]&&r.dispatch(b.store).set(e,"pinnedItems",{...i,[t]:!0})},F=(e,t)=>({registry:r})=>{if(!t)return;e=R(e),t=P(e,t);const i=r.select(b.store).get(e,"pinnedItems");r.dispatch(b.store).set(e,"pinnedItems",{...i,[t]:!1})};function G(e,t){return function({registry:r}){p()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),r.dispatch(b.store).toggle(e,t)}}function z(e,t,r){return function({registry:i}){p()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),i.dispatch(b.store).set(e,t,!!r)}}function H(e,t){return function({registry:r}){p()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),r.dispatch(b.store).setDefaults(e,t)}}function U(e){return{type:"OPEN_MODAL",name:e}}function $(){return{type:"CLOSE_MODAL"}}const Y=(0,u.createRegistrySelector)((e=>(t,r)=>{r=R(r);const i=e(b.store).get(r,"isComplementaryAreaVisible");if(void 0!==i)return!1===i?null:t?.complementaryAreas?.[r]})),K=(0,u.createRegistrySelector)((e=>(t,r)=>{r=R(r);const i=e(b.store).get(r,"isComplementaryAreaVisible"),s=t?.complementaryAreas?.[r];return i&&void 0===s})),Z=(0,u.createRegistrySelector)((e=>(t,r,i)=>{i=P(r=R(r),i);const s=e(b.store).get(r,"pinnedItems");return s?.[i]??!0})),q=(0,u.createRegistrySelector)((e=>(t,r,i)=>(p()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(b.store).get(r,i))));function J(e,t){return e.activeModal===t}var Q=(0,u.combineReducers)({complementaryAreas:function(e={},t){switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:r,area:i}=t;return e[r]?e:{...e,[r]:i}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:r,area:i}=t;return{...e,[r]:i}}}return e},activeModal:function(e=null,t){switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e}});const X=(0,u.createReduxStore)("core/interface",{reducer:Q,actions:r,selectors:i});function ee({as:e=E.Button,scope:t,identifier:r,icon:i,selectedIcon:s,name:o,shortcut:n,...a}){const c=e,l=(0,L.usePluginContext)(),g=i||l.icon,p=r||`${l.name}/${o}`,h=(0,u.useSelect)((e=>e(X).getActiveComplementaryArea(t)===p),[p,t]),{enableComplementaryArea:m,disableComplementaryArea:_}=(0,u.useDispatch)(X);return(0,d.jsx)(c,{icon:s&&h?s:g,"aria-controls":p.replace("/",":"),"aria-checked":(w=a.role,["checkbox","option","radio","switch","menuitemcheckbox","menuitemradio","treeitem"].includes(w)?h:void 0),onClick:()=>{h?_(t):m(t,p)},shortcut:n,...a});var w}(0,u.register)(X);var te=({children:e,className:t,toggleButtonProps:r})=>{const i=(0,d.jsx)(ee,{icon:W,...r});return(0,d.jsxs)("div",{className:S("components-panel__header","interface-complementary-area-header",t),tabIndex:-1,children:[e,i]})};const re=()=>{};function ie({name:e,as:t=E.Button,onClick:r,...i}){return(0,d.jsx)(E.Fill,{name:e,children:({onClick:e})=>(0,d.jsx)(t,{onClick:r||e?(...t)=>{(r||re)(...t),(e||re)(...t)}:void 0,...i})})}ie.Slot=function({name:e,as:t=E.MenuGroup,fillProps:r={},bubblesVirtually:i,...s}){return(0,d.jsx)(E.Slot,{name:e,bubblesVirtually:i,fillProps:r,children:e=>{if(!h.Children.toArray(e).length)return null;const r=[];h.Children.forEach(e,(({props:{__unstableExplicitMenuItem:e,__unstableTarget:t}})=>{t&&e&&r.push(t)}));const i=h.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&r.includes(e.props.__unstableTarget)?null:e));return(0,d.jsx)(t,{...s,children:i})}})};var se=ie;const oe=({__unstableExplicitMenuItem:e,__unstableTarget:t,...r})=>(0,d.jsx)(E.MenuItem,{...r});function ne({scope:e,target:t,__unstableExplicitMenuItem:r,...i}){return(0,d.jsx)(ee,{as:i=>(0,d.jsx)(se,{__unstableExplicitMenuItem:r,__unstableTarget:`${e}/${t}`,as:oe,name:`${e}/plugin-more-menu`,...i}),role:"menuitemcheckbox",selectedIcon:I,name:t,scope:e,...i})}function ae({scope:e,...t}){return(0,d.jsx)(E.Fill,{name:`PinnedItems/${e}`,...t})}ae.Slot=function({scope:e,className:t,...r}){return(0,d.jsx)(E.Slot,{name:`PinnedItems/${e}`,...r,children:e=>e?.length>0&&(0,d.jsx)("div",{className:S(t,"interface-pinned-items"),children:e})})};var ce=ae;const de={open:{width:280},closed:{width:0},mobileOpen:{width:"100vw"}};function le({activeArea:e,isActive:t,scope:r,children:i,className:s,id:o}){const n=(0,T.useReducedMotion)(),a=(0,T.useViewportMatch)("medium","<"),c=(0,T.usePrevious)(e),l=(0,T.usePrevious)(t),[,u]=(0,h.useState)({});(0,h.useEffect)((()=>{u({})}),[t]);const g={type:"tween",duration:n||a||c&&e&&e!==c?0:.3,ease:[.6,0,.4,1]};return(0,d.jsx)(E.Fill,{name:`ComplementaryArea/${r}`,children:(0,d.jsx)(E.__unstableAnimatePresence,{initial:!1,children:(l||t)&&(0,d.jsx)(E.__unstableMotion.div,{variants:de,initial:"closed",animate:a?"mobileOpen":"open",exit:"closed",transition:g,className:"interface-complementary-area__fill",children:(0,d.jsx)("div",{id:o,className:s,style:{width:a?"100vw":280},children:i})})})})}function ue({children:e,className:t,closeLabel:r=(0,x.__)("Close plugin"),identifier:i,header:s,headerClassName:o,icon:n,isPinnable:a=!0,panelClassName:c,scope:l,name:g,title:p,toggleShortcut:m,isActiveByDefault:_}){const w=(0,L.usePluginContext)(),f=n||w.icon,v=i||`${w.name}/${g}`,[y,k]=(0,h.useState)(!1),{isLoading:j,isActive:A,isPinned:W,activeArea:R,isSmall:P,isLarge:O,showIconLabels:M}=(0,u.useSelect)((e=>{const{getActiveComplementaryArea:t,isComplementaryAreaLoading:r,isItemPinned:i}=e(X),{get:s}=e(b.store),o=t(l);return{isLoading:r(l),isActive:o===v,isPinned:i(l,v),activeArea:o,isSmall:e(B.store).isViewportMatch("< medium"),isLarge:e(B.store).isViewportMatch("large"),showIconLabels:s("core","showIconLabels")}}),[v,l]),V=(0,T.useViewportMatch)("medium","<");!function(e,t,r,i,s){const o=(0,h.useRef)(!1),n=(0,h.useRef)(!1),{enableComplementaryArea:a,disableComplementaryArea:c}=(0,u.useDispatch)(X);(0,h.useEffect)((()=>{i&&s&&!o.current?(c(e),n.current=!0):n.current&&!s&&o.current?(n.current=!1,a(e,t)):n.current&&r&&r!==t&&(n.current=!1),s!==o.current&&(o.current=s)}),[i,s,e,t,r,c,a])}(l,v,R,A,P);const{enableComplementaryArea:D,disableComplementaryArea:F,pinItem:G,unpinItem:z}=(0,u.useDispatch)(X);if((0,h.useEffect)((()=>{_&&void 0===R&&!P?D(l,v):void 0===R&&P&&F(l,v),k(!0)}),[R,_,l,v,P,D,F]),y)return(0,d.jsxs)(d.Fragment,{children:[a&&(0,d.jsx)(ce,{scope:l,children:W&&(0,d.jsx)(ee,{scope:l,identifier:v,isPressed:A&&(!M||O),"aria-expanded":A,"aria-disabled":j,label:p,icon:M?I:f,showTooltip:!M,variant:M?"tertiary":void 0,size:"compact",shortcut:m})}),g&&a&&(0,d.jsx)(ne,{target:g,scope:l,icon:f,identifier:v,children:p}),(0,d.jsxs)(le,{activeArea:R,isActive:A,className:S("interface-complementary-area",t),scope:l,id:v.replace("/",":"),children:[(0,d.jsx)(te,{className:o,closeLabel:r,onClose:()=>F(l),toggleButtonProps:{label:r,size:"compact",shortcut:m,scope:l,identifier:v},children:s||(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{className:"interface-complementary-area-header__title",children:p}),a&&!V&&(0,d.jsx)(E.Button,{className:"interface-complementary-area__pin-unpin-item",icon:W?C:N,label:W?(0,x.__)("Unpin from toolbar"):(0,x.__)("Pin to toolbar"),onClick:()=>(W?z:G)(l,v),isPressed:W,"aria-expanded":W,size:"compact"})]})}),(0,d.jsx)(E.Panel,{className:c,children:e})]})]})}ue.Slot=function({scope:e,...t}){return(0,d.jsx)(E.Slot,{name:`ComplementaryArea/${e}`,...t})};var ge=ue;const pe=(0,h.forwardRef)((({children:e,className:t,ariaLabel:r,as:i="div",...s},o)=>(0,d.jsx)(i,{ref:o,className:S("admin-ui-navigable-region",t),"aria-label":r,role:"region",tabIndex:"-1",...s,children:e})));pe.displayName="NavigableRegion";var he=pe;const me={type:"tween",duration:.25,ease:[.6,0,.4,1]};const _e={hidden:{opacity:1,marginTop:-60},visible:{opacity:1,marginTop:0},distractionFreeHover:{opacity:1,marginTop:0,transition:{...me,delay:.2,delayChildren:.2}},distractionFreeHidden:{opacity:0,marginTop:-60},distractionFreeDisabled:{opacity:0,marginTop:0,transition:{...me,delay:.8,delayChildren:.8}}};var we=(0,h.forwardRef)((function({isDistractionFree:e,footer:t,header:r,editorNotices:i,sidebar:s,secondarySidebar:o,content:n,actions:a,labels:c,className:l},u){const[g,p]=(0,T.useResizeObserver)(),m=(0,T.useViewportMatch)("medium","<"),_={type:"tween",duration:(0,T.useReducedMotion)()?0:.25,ease:[.6,0,.4,1]};!function(e){(0,h.useEffect)((()=>{const t=document&&document.querySelector(`html:not(.${e})`);if(t)return t.classList.toggle(e),()=>{t.classList.toggle(e)}}),[e])}("interface-interface-skeleton__html-container");const w={...{header:(0,x._x)("Header","header landmark area"),body:(0,x.__)("Content"),secondarySidebar:(0,x.__)("Block Library"),sidebar:(0,x._x)("Settings","settings landmark area"),actions:(0,x.__)("Publish"),footer:(0,x.__)("Footer")},...c};return(0,d.jsxs)("div",{ref:u,className:S(l,"interface-interface-skeleton",!!t&&"has-footer"),children:[(0,d.jsxs)("div",{className:"interface-interface-skeleton__editor",children:[(0,d.jsx)(E.__unstableAnimatePresence,{initial:!1,children:!!r&&(0,d.jsx)(he,{as:E.__unstableMotion.div,className:"interface-interface-skeleton__header","aria-label":w.header,initial:e&&!m?"distractionFreeHidden":"hidden",whileHover:e&&!m?"distractionFreeHover":"visible",animate:e&&!m?"distractionFreeDisabled":"visible",exit:e&&!m?"distractionFreeHidden":"hidden",variants:_e,transition:_,children:r})}),e&&(0,d.jsx)("div",{className:"interface-interface-skeleton__header",children:i}),(0,d.jsxs)("div",{className:"interface-interface-skeleton__body",children:[(0,d.jsx)(E.__unstableAnimatePresence,{initial:!1,children:!!o&&(0,d.jsx)(he,{className:"interface-interface-skeleton__secondary-sidebar",ariaLabel:w.secondarySidebar,as:E.__unstableMotion.div,initial:"closed",animate:"open",exit:"closed",variants:{open:{width:p.width},closed:{width:0}},transition:_,children:(0,d.jsxs)(E.__unstableMotion.div,{style:{position:"absolute",width:m?"100vw":"fit-content",height:"100%",left:0},variants:{open:{x:0},closed:{x:"-100%"}},transition:_,children:[g,o]})})}),(0,d.jsx)(he,{className:"interface-interface-skeleton__content",ariaLabel:w.body,children:n}),!!s&&(0,d.jsx)(he,{className:"interface-interface-skeleton__sidebar",ariaLabel:w.sidebar,children:s}),!!a&&(0,d.jsx)(he,{className:"interface-interface-skeleton__actions",ariaLabel:w.actions,children:a})]})]}),!!t&&(0,d.jsx)(he,{className:"interface-interface-skeleton__footer",ariaLabel:w.footer,children:t})]})}));const be=window.wp.blockEditor;function fe(e){if("block"===e.id_base){const t=(0,l.parse)(e.instance.raw.content,{__unstableSkipAutop:!0});return t.length?(0,w.addWidgetIdToBlock)(t[0],e.id):(0,w.addWidgetIdToBlock)((0,l.createBlock)("core/paragraph",{},[]),e.id)}let t;return t=e._embedded.about[0].is_multi?{idBase:e.id_base,instance:e.instance}:{id:e.id},(0,w.addWidgetIdToBlock)((0,l.createBlock)("core/legacy-widget",t,[]),e.id)}function ve(e,t={}){let r;return r="core/legacy-widget"===e.name&&(e.attributes.id||e.attributes.instance)?{...t,id:e.attributes.id??t.id,id_base:e.attributes.idBase??t.id_base,instance:e.attributes.instance??t.instance}:{...t,id_base:"block",instance:{raw:{content:(0,l.serialize)(e)}}},delete r.rendered,delete r.rendered_form,r}const ye="root",xe="sidebar",ke="postType",je=e=>`widget-area-${e}`;const Se="core/edit-widgets",Ee=(e,t)=>({registry:r})=>{const i=((e,t)=>({id:e,slug:e,status:"draft",type:"page",blocks:t,meta:{widgetAreaId:e}}))(e,t);return r.dispatch(_.store).receiveEntityRecords(ye,ke,i,{id:i.id},!1),i},Ae=()=>async({select:e,dispatch:t,registry:r})=>{const i=e.getEditedWidgetAreas();if(i?.length)try{await t.saveWidgetAreas(i),r.dispatch(k.store).createSuccessNotice((0,x.__)("Widgets saved."),{type:"snackbar"})}catch(e){r.dispatch(k.store).createErrorNotice((0,x.sprintf)((0,x.__)("There was an error. %s"),e.message),{type:"snackbar"})}},Ie=e=>async({dispatch:t,registry:r})=>{try{for(const r of e)await t.saveWidgetArea(r.id)}finally{await r.dispatch(_.store).finishResolution("getEntityRecord",ye,xe,{per_page:-1})}},Ce=e=>async({dispatch:t,select:r,registry:i})=>{const s=r.getWidgets(),o=i.select(_.store).getEditedEntityRecord(ye,ke,je(e)),n=Object.values(s).filter((({sidebar:t})=>t===e)),a=[],c=o.blocks.filter((e=>{const{id:t}=e.attributes;if("core/legacy-widget"===e.name&&t){if(a.includes(t))return!1;a.push(t)}return!0})),d=[];for(const e of n){r.getWidgetAreaForWidgetId(e.id)||d.push(e)}const l=[],u=[],g=[];for(let t=0;t<c.length;t++){const r=c[t],o=(0,w.getWidgetIdFromBlock)(r),n=s[o],a=ve(r,n);if(g.push(o),n){i.dispatch(_.store).editEntityRecord("root","widget",o,{...a,sidebar:e},{undoIgnore:!0});if(!i.select(_.store).hasEditsForEntityRecord("root","widget",o))continue;u.push((({saveEditedEntityRecord:e})=>e("root","widget",o)))}else u.push((({saveEntityRecord:t})=>t("root","widget",{...a,sidebar:e})));l.push({block:r,position:t,clientId:r.clientId})}for(const e of d)u.push((({deleteEntityRecord:t})=>t("root","widget",e.id,{force:!0})));const p=(await i.dispatch(_.store).__experimentalBatch(u)).filter((e=>!e.hasOwnProperty("deleted"))),h=[];for(let e=0;e<p.length;e++){const t=p[e],{block:r,position:s}=l[e];o.blocks[s].attributes.__internalWidgetId=t.id;i.select(_.store).getLastEntitySaveError("root","widget",t.id)&&h.push(r.attributes?.name||r?.name),g[s]||(g[s]=t.id)}if(h.length)throw new Error((0,x.sprintf)((0,x.__)("Could not save the following widgets: %s."),h.join(", ")));i.dispatch(_.store).editEntityRecord(ye,xe,e,{widgets:g},{undoIgnore:!0}),t(Ne(e)),i.dispatch(_.store).receiveEntityRecords(ye,ke,o,void 0)},Ne=e=>({registry:t})=>{t.dispatch(_.store).saveEditedEntityRecord(ye,xe,e,{throwOnError:!0})};function Be(e,t){return{type:"SET_WIDGET_ID_FOR_CLIENT_ID",clientId:e,widgetId:t}}function Te(e){return{type:"SET_WIDGET_AREAS_OPEN_STATE",widgetAreasOpenState:e}}function Le(e,t){return{type:"SET_IS_WIDGET_AREA_OPEN",clientId:e,isOpen:t}}function We(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}function Re(e){return{type:"SET_IS_LIST_VIEW_OPENED",isOpen:e}}const Pe=()=>({registry:e})=>{e.dispatch(X).disableComplementaryArea(Se)},Oe=(e,t)=>async({dispatch:r,select:i,registry:s})=>{const o=s.select(be.store).getBlockRootClientId(e),n=s.select(be.store).getBlocks().find((({attributes:e})=>e.id===t)).clientId,a=s.select(be.store).getBlockOrder(n).length;i.getIsWidgetAreaOpen(n)||r.setIsWidgetAreaOpen(n,!0),s.dispatch(be.store).moveBlocksToPosition([e],o,n,a)};function Me(e){return{type:"UNLOCK_WIDGET_SAVING",lockName:e}}function Ve(e){return{type:"LOCK_WIDGET_SAVING",lockName:e}}const De=()=>async({dispatch:e,registry:t})=>{const r={per_page:-1},i=[],s=(await t.resolveSelect(_.store).getEntityRecords(ye,xe,r)).sort(((e,t)=>"wp_inactive_widgets"===e.id?1:"wp_inactive_widgets"===t.id?-1:0));for(const t of s)i.push((0,l.createBlock)("core/widget-area",{id:t.id,name:t.name})),t.widgets.length||e(Ee(je(t.id),[]));const o={};i.forEach(((e,t)=>{o[e.clientId]=0===t})),e(Te(o)),e(Ee("widget-areas",i))},Fe=()=>async({dispatch:e,registry:t})=>{const r={per_page:-1,_embed:"about"},i=await t.resolveSelect(_.store).getEntityRecords("root","widget",r),s={};for(const e of i){const t=fe(e);s[e.sidebar]=s[e.sidebar]||[],s[e.sidebar].push(t)}for(const t in s)s.hasOwnProperty(t)&&e(Ee(je(t),s[t]))},Ge={rootClientId:void 0,insertionIndex:void 0},ze=(0,u.createRegistrySelector)((e=>(0,u.createSelector)((()=>{const t=e(_.store).getEntityRecords("root","widget",{per_page:-1,_embed:"about"});return t?.reduce(((e,t)=>({...e,[t.id]:t})),{})??{}}),(()=>[e(_.store).getEntityRecords("root","widget",{per_page:-1,_embed:"about"})])))),He=(0,u.createRegistrySelector)((e=>(t,r)=>e(Se).getWidgets()[r])),Ue=(0,u.createRegistrySelector)((e=>()=>{const t={per_page:-1};return e(_.store).getEntityRecords(ye,xe,t)})),$e=(0,u.createRegistrySelector)((e=>(t,r)=>e(Se).getWidgetAreas().find((t=>e(_.store).getEditedEntityRecord(ye,ke,je(t.id)).blocks.map((e=>(0,w.getWidgetIdFromBlock)(e))).includes(r))))),Ye=(0,u.createRegistrySelector)((e=>(t,r)=>{const{getBlock:i,getBlockName:s,getBlockParents:o}=e(be.store);return i(o(r).find((e=>"core/widget-area"===s(e))))})),Ke=(0,u.createRegistrySelector)((e=>(t,r)=>{let i=e(Se).getWidgetAreas();return i?(r&&(i=i.filter((({id:e})=>r.includes(e)))),i.filter((({id:t})=>e(_.store).hasEditsForEntityRecord(ye,ke,je(t)))).map((({id:t})=>e(_.store).getEditedEntityRecord(ye,xe,t)))):[]})),Ze=(0,u.createRegistrySelector)((e=>(t,r=null)=>{const i=[],s=e(Se).getWidgetAreas();for(const t of s){const s=e(_.store).getEditedEntityRecord(ye,ke,je(t.id));for(const e of s.blocks)"core/legacy-widget"!==e.name||r&&e.attributes?.referenceWidgetName!==r||i.push(e)}return i})),qe=(0,u.createRegistrySelector)((e=>()=>{const t=e(Se).getWidgetAreas()?.map((({id:e})=>e));if(!t)return!1;for(const r of t){if(e(_.store).isSavingEntityRecord(ye,xe,r))return!0}const r=[...Object.keys(e(Se).getWidgets()),void 0];for(const t of r){if(e(_.store).isSavingEntityRecord("root","widget",t))return!0}return!1})),Je=(e,t)=>{const{widgetAreasOpenState:r}=e;return!!r[t]};function Qe(e){return!!e.blockInserterPanel}function Xe(e){return"boolean"==typeof e.blockInserterPanel?Ge:e.blockInserterPanel}const et=(0,u.createRegistrySelector)((e=>(t,r)=>{const i=e(be.store).getBlocks(),[s]=i;return e(be.store).canInsertBlockType(r,s.clientId)}));function tt(e){return e.listViewPanel}function rt(e){return Object.keys(e.widgetSavingLock).length>0}function it(e){return e.listViewToggleRef}function st(e){return e.inserterSidebarToggleRef}const ot=window.wp.privateApis,{lock:nt,unlock:at}=(0,ot.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/edit-widgets"),ct={reducer:y,selectors:n,resolvers:o,actions:s},dt=(0,u.createReduxStore)(Se,ct);(0,u.register)(dt),v().use((function(e,t){return 0===e.path?.indexOf("/wp/v2/types/widget-area")?Promise.resolve({}):t(e)})),at(dt).registerPrivateSelectors(a);const lt=window.wp.hooks,ut=(0,T.createHigherOrderComponent)((e=>t=>{const{clientId:r,name:i}=t,{widgetAreas:s,currentWidgetAreaId:o,canInsertBlockInWidgetArea:n}=(0,u.useSelect)((e=>{if("core/widget-area"===i)return{};const t=e(dt),s=t.getParentWidgetAreaBlock(r);return{widgetAreas:t.getWidgetAreas(),currentWidgetAreaId:s?.attributes?.id,canInsertBlockInWidgetArea:t.canInsertBlockInWidgetArea(i)}}),[r,i]),{moveBlockToWidgetArea:a}=(0,u.useDispatch)(dt),c="core/widget-area"!==i&&s?.length>1&&n;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(e,{...t},"edit"),c&&(0,d.jsx)(be.BlockControls,{children:(0,d.jsx)(w.MoveToWidgetArea,{widgetAreas:s,currentWidgetAreaId:o,onSelect:e=>{a(t.clientId,e)}})})]})}),"withMoveToWidgetAreaToolbarItem");(0,lt.addFilter)("editor.BlockEdit","core/edit-widgets/block-edit",ut);const gt=window.wp.mediaUtils;(0,lt.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",(()=>gt.MediaUpload));const pt=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"core/widget-area","title":"Widget Area","category":"widgets","attributes":{"id":{"type":"string"},"name":{"type":"string"}},"supports":{"html":false,"inserter":false,"customClassName":false,"reusable":false,"__experimentalToolbar":false,"__experimentalParentSelector":false,"__experimentalDisableBlockOverlay":true},"editorStyle":"wp-block-widget-area-editor","style":"wp-block-widget-area"}');var ht=e=>{const[t,r]=(0,h.useState)(!1);return(0,h.useEffect)((()=>{const{ownerDocument:t}=e.current;function i(e){o(e)}function s(){r(!1)}function o(t){e.current.contains(t.target)?r(!0):r(!1)}return t.addEventListener("dragstart",i),t.addEventListener("dragend",s),t.addEventListener("dragenter",o),()=>{t.removeEventListener("dragstart",i),t.removeEventListener("dragend",s),t.removeEventListener("dragenter",o)}}),[]),t};function mt({id:e}){const[t,r,i]=(0,_.useEntityBlockEditor)("root","postType"),s=(0,h.useRef)(),o=ht(s),n=(0,be.useInnerBlocksProps)({ref:s},{value:t,onInput:r,onChange:i,templateLock:!1,renderAppender:be.InnerBlocks.ButtonBlockAppender});return(0,d.jsx)("div",{"data-widget-area-id":e,className:S("wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper",{"wp-block-widget-area__highlight-drop-zone":o}),children:(0,d.jsx)("div",{...n})})}const _t=e=>{const[t,r]=(0,h.useState)(!1);return(0,h.useEffect)((()=>{const{ownerDocument:t}=e.current;function i(){r(!0)}function s(){r(!1)}return t.addEventListener("dragstart",i),t.addEventListener("dragend",s),()=>{t.removeEventListener("dragstart",i),t.removeEventListener("dragend",s)}}),[]),t},{name:wt}=pt,bt={title:(0,x.__)("Widget Area"),description:(0,x.__)("A widget area container."),__experimentalLabel:({name:e})=>e,edit:function({clientId:e,attributes:{id:t,name:r}}){const i=(0,u.useSelect)((t=>t(dt).getIsWidgetAreaOpen(e)),[e]),{setIsWidgetAreaOpen:s}=(0,u.useDispatch)(dt),o=(0,h.useRef)(),n=(0,h.useCallback)((t=>s(e,t)),[e]),a=_t(o),c=ht(o),[l,g]=(0,h.useState)(!1);(0,h.useEffect)((()=>{a?c&&!i?(n(!0),g(!0)):!c&&i&&l&&n(!1):g(!1)}),[i,a,c,l]);const p=(0,be.useBlockProps)();return(0,d.jsx)("div",{...p,children:(0,d.jsx)(E.Panel,{ref:o,children:(0,d.jsx)(E.PanelBody,{title:r,opened:i,onToggle:()=>{s(e,!i)},scrollAfterOpen:!a,children:({opened:e})=>(0,d.jsx)(E.__unstableDisclosureContent,{className:"wp-block-widget-area__panel-body-content",visible:e,children:(0,d.jsx)(_.EntityProvider,{kind:"root",type:"postType",id:`widget-area-${t}`,children:(0,d.jsx)(mt,{id:t})})})})})})}};function ft({text:e,children:t}){const r=(0,T.useCopyToClipboard)(e);return(0,d.jsx)(E.Button,{__next40pxDefaultSize:!0,variant:"secondary",ref:r,children:t})}function vt({message:e,error:t}){const r=[(0,d.jsx)(ft,{text:t.stack,children:(0,x.__)("Copy Error")},"copy-error")];return(0,d.jsx)(be.Warning,{className:"edit-widgets-error-boundary",actions:r,children:e})}class yt extends h.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){(0,lt.doAction)("editor.ErrorBoundary.errorLogged",e)}static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,d.jsx)(vt,{message:(0,x.__)("The editor has encountered an unexpected error."),error:this.state.error}):this.props.children}}const xt=window.wp.patterns,kt=window.wp.keyboardShortcuts,jt=window.wp.keycodes;function St(){const{redo:e,undo:t}=(0,u.useDispatch)(_.store),{saveEditedWidgetAreas:r}=(0,u.useDispatch)(dt);return(0,kt.useShortcut)("core/edit-widgets/undo",(e=>{t(),e.preventDefault()})),(0,kt.useShortcut)("core/edit-widgets/redo",(t=>{e(),t.preventDefault()})),(0,kt.useShortcut)("core/edit-widgets/save",(e=>{e.preventDefault(),r()})),null}St.Register=function(){const{registerShortcut:e}=(0,u.useDispatch)(kt.store);return(0,h.useEffect)((()=>{e({name:"core/edit-widgets/undo",category:"global",description:(0,x.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/edit-widgets/redo",category:"global",description:(0,x.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"},aliases:(0,jt.isAppleOS)()?[]:[{modifier:"primary",character:"y"}]}),e({name:"core/edit-widgets/save",category:"global",description:(0,x.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/edit-widgets/keyboard-shortcuts",category:"main",description:(0,x.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/edit-widgets/next-region",category:"global",description:(0,x.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),e({name:"core/edit-widgets/previous-region",category:"global",description:(0,x.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"},{modifier:"ctrlShift",character:"~"}]})}),[e]),null};var Et=St;var At=()=>(0,u.useSelect)((e=>{const{getBlockSelectionEnd:t,getBlockName:r}=e(be.store),i=t();if("core/widget-area"===r(i))return i;const{getParentWidgetAreaBlock:s}=e(dt),o=s(i),n=o?.clientId;if(n)return n;const{getEntityRecord:a}=e(_.store),c=a(ye,ke,"widget-areas");return c?.blocks[0]?.clientId}),[]);const{ExperimentalBlockEditorProvider:It}=at(be.privateApis),{PatternsMenuItems:Ct}=at(xt.privateApis),{BlockKeyboardShortcuts:Nt}=at(m.privateApis),Bt=[];function Tt({blockEditorSettings:e,children:t,...r}){const i=(0,T.useViewportMatch)("medium"),{hasUploadPermissions:s,reusableBlocks:o,isFixedToolbarActive:n,keepCaretInsideBlock:a,pageOnFront:c,pageForPosts:l}=(0,u.useSelect)((e=>{const{canUser:t,getEntityRecord:r,getEntityRecords:i}=e(_.store),s=t("read",{kind:"root",name:"site"})?r("root","site"):void 0;return{hasUploadPermissions:t("create",{kind:"postType",name:"attachment"})??!0,reusableBlocks:Bt,isFixedToolbarActive:!!e(b.store).get("core/edit-widgets","fixedToolbar"),keepCaretInsideBlock:!!e(b.store).get("core/edit-widgets","keepCaretInsideBlock"),pageOnFront:s?.page_on_front,pageForPosts:s?.page_for_posts}}),[]),{setIsInserterOpened:g}=(0,u.useDispatch)(dt),p=(0,h.useMemo)((()=>{let t;return s&&(t=({onError:t,...r})=>{(0,gt.uploadMedia)({wpAllowedMimeTypes:e.allowedMimeTypes,onError:({message:e})=>t(e),...r})}),{...e,__experimentalReusableBlocks:o,hasFixedToolbar:n||!i,keepCaretInsideBlock:a,mediaUpload:t,templateLock:"all",__experimentalSetIsInserterOpened:g,pageOnFront:c,pageForPosts:l,editorTool:"edit"}}),[s,e,n,i,a,o,g,c,l]),m=At(),[w,f,v]=(0,_.useEntityBlockEditor)(ye,ke,{id:"widget-areas"});return(0,d.jsxs)(E.SlotFillProvider,{children:[(0,d.jsx)(Et.Register,{}),(0,d.jsx)(Nt,{}),(0,d.jsxs)(It,{value:w,onInput:f,onChange:v,settings:p,useSubRegistry:!1,...r,children:[t,(0,d.jsx)(Ct,{rootClientId:m})]})]})}var Lt=(0,d.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,d.jsx)(A.Path,{fillRule:"evenodd",clipRule:"evenodd",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-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z"})}),Wt=(0,d.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,d.jsx)(A.Path,{fillRule:"evenodd",clipRule:"evenodd",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"})}),Rt=(0,d.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,d.jsx)(A.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"})});const Pt=window.wp.url,Ot=window.wp.dom;function Mt({selectedWidgetAreaId:e}){const t=(0,u.useSelect)((e=>e(dt).getWidgetAreas()),[]),r=(0,h.useMemo)((()=>e&&t?.find((t=>t.id===e))),[e,t]);let i;return i=r?"wp_inactive_widgets"===e?(0,x.__)("Blocks in this Widget Area will not be displayed in your site."):r.description:(0,x.__)("Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer."),(0,d.jsx)("div",{className:"edit-widgets-widget-areas",children:(0,d.jsxs)("div",{className:"edit-widgets-widget-areas__top-container",children:[(0,d.jsx)(be.BlockIcon,{icon:Rt}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{dangerouslySetInnerHTML:{__html:(0,Ot.safeHTML)(i)}}),0===t?.length&&(0,d.jsx)("p",{children:(0,x.__)("Your theme does not contain any Widget Areas.")}),!r&&(0,d.jsx)(E.Button,{__next40pxDefaultSize:!0,href:(0,Pt.addQueryArgs)("customize.php",{"autofocus[panel]":"widgets",return:window.location.pathname}),variant:"tertiary",children:(0,x.__)("Manage with live preview")})]})]})})}const Vt=h.Platform.select({web:!0,native:!1}),Dt="edit-widgets/block-inspector",Ft="edit-widgets/block-areas",{Tabs:Gt}=at(E.privateApis);function zt({selectedWidgetAreaBlock:e}){return(0,d.jsxs)(Gt.TabList,{children:[(0,d.jsx)(Gt.Tab,{tabId:Ft,children:e?e.attributes.name:(0,x.__)("Widget Areas")}),(0,d.jsx)(Gt.Tab,{tabId:Dt,children:(0,x.__)("Block")})]})}function Ht({hasSelectedNonAreaBlock:e,currentArea:t,isGeneralSidebarOpen:r,selectedWidgetAreaBlock:i}){const{enableComplementaryArea:s}=(0,u.useDispatch)(X);(0,h.useEffect)((()=>{e&&t===Ft&&r&&s("core/edit-widgets",Dt),!e&&t===Dt&&r&&s("core/edit-widgets",Ft)}),[e,s]);const o=(0,h.useContext)(Gt.Context);return(0,d.jsx)(ge,{className:"edit-widgets-sidebar",header:(0,d.jsx)(Gt.Context.Provider,{value:o,children:(0,d.jsx)(zt,{selectedWidgetAreaBlock:i})}),headerClassName:"edit-widgets-sidebar__panel-tabs",title:(0,x.__)("Settings"),closeLabel:(0,x.__)("Close Settings"),scope:"core/edit-widgets",identifier:t,icon:(0,x.isRTL)()?Lt:Wt,isActiveByDefault:Vt,children:(0,d.jsxs)(Gt.Context.Provider,{value:o,children:[(0,d.jsx)(Gt.TabPanel,{tabId:Ft,focusable:!1,children:(0,d.jsx)(Mt,{selectedWidgetAreaId:i?.attributes.id})}),(0,d.jsx)(Gt.TabPanel,{tabId:Dt,focusable:!1,children:e?(0,d.jsx)(be.BlockInspector,{}):(0,d.jsx)("span",{className:"block-editor-block-inspector__no-blocks",children:(0,x.__)("No block selected.")})})]})})}function Ut(){const{currentArea:e,hasSelectedNonAreaBlock:t,isGeneralSidebarOpen:r,selectedWidgetAreaBlock:i}=(0,u.useSelect)((e=>{const{getSelectedBlock:t,getBlock:r,getBlockParentsByBlockName:i}=e(be.store),{getActiveComplementaryArea:s}=e(X),o=t(),n=s(dt.name);let a,c=n;return c||(c=o?Dt:Ft),o&&(a="core/widget-area"===o.name?o:r(i(o.clientId,"core/widget-area")[0])),{currentArea:c,hasSelectedNonAreaBlock:!(!o||"core/widget-area"===o.name),isGeneralSidebarOpen:!!n,selectedWidgetAreaBlock:a}}),[]),{enableComplementaryArea:s}=(0,u.useDispatch)(X),o=(0,h.useCallback)((e=>{e&&s(dt.name,e)}),[s]);return(0,d.jsx)(Gt,{selectedTabId:r?e:null,onSelect:o,selectOnMove:!1,children:(0,d.jsx)(Ht,{hasSelectedNonAreaBlock:t,currentArea:e,isGeneralSidebarOpen:r,selectedWidgetAreaBlock:i})})}var $t=(0,d.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,d.jsx)(A.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),Yt=(0,d.jsx)(A.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,d.jsx)(A.Path,{d:"M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"})}),Kt=(0,d.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,d.jsx)(A.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"})}),Zt=(0,d.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,d.jsx)(A.Path,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"})});var qt=(0,h.forwardRef)((function(e,t){const r=(0,u.useSelect)((e=>e(_.store).hasUndo()),[]),{undo:i}=(0,u.useDispatch)(_.store);return(0,d.jsx)(E.Button,{...e,ref:t,icon:(0,x.isRTL)()?Zt:Kt,label:(0,x.__)("Undo"),shortcut:jt.displayShortcut.primary("z"),"aria-disabled":!r,onClick:r?i:void 0,size:"compact"})}));var Jt=(0,h.forwardRef)((function(e,t){const r=(0,jt.isAppleOS)()?jt.displayShortcut.primaryShift("z"):jt.displayShortcut.primary("y"),i=(0,u.useSelect)((e=>e(_.store).hasRedo()),[]),{redo:s}=(0,u.useDispatch)(_.store);return(0,d.jsx)(E.Button,{...e,ref:t,icon:(0,x.isRTL)()?Kt:Zt,label:(0,x.__)("Redo"),shortcut:r,"aria-disabled":!i,onClick:i?s:void 0,size:"compact"})}));var Qt=function(){const e=(0,T.useViewportMatch)("medium"),{isInserterOpen:t,isListViewOpen:r,inserterSidebarToggleRef:i,listViewToggleRef:s}=(0,u.useSelect)((e=>{const{isInserterOpened:t,getInserterSidebarToggleRef:r,isListViewOpened:i,getListViewToggleRef:s}=at(e(dt));return{isInserterOpen:t(),isListViewOpen:i(),inserterSidebarToggleRef:r(),listViewToggleRef:s()}}),[]),{setIsInserterOpened:o,setIsListViewOpened:n}=(0,u.useDispatch)(dt),a=(0,h.useCallback)((()=>n(!r)),[n,r]),c=(0,h.useCallback)((()=>o(!t)),[o,t]);return(0,d.jsxs)(be.NavigableToolbar,{className:"edit-widgets-header-toolbar","aria-label":(0,x.__)("Document tools"),variant:"unstyled",children:[(0,d.jsx)(E.ToolbarItem,{ref:i,as:E.Button,className:"edit-widgets-header-toolbar__inserter-toggle",variant:"primary",isPressed:t,onMouseDown:e=>{e.preventDefault()},onClick:c,icon:$t,label:(0,x._x)("Block Inserter","Generic label for block inserter button"),size:"compact"}),e&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(E.ToolbarItem,{as:qt}),(0,d.jsx)(E.ToolbarItem,{as:Jt}),(0,d.jsx)(E.ToolbarItem,{as:E.Button,className:"edit-widgets-header-toolbar__list-view-toggle",icon:Yt,isPressed:r,label:(0,x.__)("List View"),onClick:a,ref:s,size:"compact"})]})]})};var Xt=function(){const{hasEditedWidgetAreaIds:e,isSaving:t,isWidgetSaveLocked:r}=(0,u.useSelect)((e=>{const{getEditedWidgetAreas:t,isSavingWidgetAreas:r,isWidgetSavingLocked:i}=e(dt);return{hasEditedWidgetAreaIds:t()?.length>0,isSaving:r(),isWidgetSaveLocked:i()}}),[]),{saveEditedWidgetAreas:i}=(0,u.useDispatch)(dt),s=r||t||!e;return(0,d.jsx)(E.Button,{variant:"primary",isBusy:t,"aria-disabled":s,onClick:s?void 0:i,size:"compact",children:t?(0,x.__)("Saving…"):(0,x.__)("Update")})},er=(0,d.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,d.jsx)(A.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})}),tr=(0,d.jsx)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,d.jsx)(A.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})});const rr=[{keyCombination:{modifier:"primary",character:"b"},description:(0,x.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,x.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,x.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,x.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,x.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,x.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,x.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,x.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},aliases:[{modifier:"access",character:"7"}],description:(0,x.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,x.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")},{keyCombination:{modifier:"primaryShift",character:"SPACE"},description:(0,x.__)("Add non breaking space.")}];function ir({keyCombination:e,forceAriaLabel:t}){const r=e.modifier?jt.displayShortcutList[e.modifier](e.character):e.character,i=e.modifier?jt.shortcutAriaLabel[e.modifier](e.character):e.character,s=Array.isArray(r)?r:[r];return(0,d.jsx)("kbd",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||i,children:s.map(((e,t)=>"+"===e?(0,d.jsx)(h.Fragment,{children:e},t):(0,d.jsx)("kbd",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-key",children:e},t)))})}var sr=function({description:e,keyCombination:t,aliases:r=[],ariaLabel:i}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-description",children:e}),(0,d.jsxs)("div",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-term",children:[(0,d.jsx)(ir,{keyCombination:t,forceAriaLabel:i}),r.map(((e,t)=>(0,d.jsx)(ir,{keyCombination:e,forceAriaLabel:i},t)))]})]})};var or=function({name:e}){const{keyCombination:t,description:r,aliases:i}=(0,u.useSelect)((t=>{const{getShortcutKeyCombination:r,getShortcutDescription:i,getShortcutAliases:s}=t(kt.store);return{keyCombination:r(e),aliases:s(e),description:i(e)}}),[e]);return t?(0,d.jsx)(sr,{keyCombination:t,description:r,aliases:i}):null};const nr=({shortcuts:e})=>(0,d.jsx)("ul",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut-list",role:"list",children:e.map(((e,t)=>(0,d.jsx)("li",{className:"edit-widgets-keyboard-shortcut-help-modal__shortcut",children:"string"==typeof e?(0,d.jsx)(or,{name:e}):(0,d.jsx)(sr,{...e})},t)))}),ar=({title:e,shortcuts:t,className:r})=>(0,d.jsxs)("section",{className:S("edit-widgets-keyboard-shortcut-help-modal__section",r),children:[!!e&&(0,d.jsx)("h2",{className:"edit-widgets-keyboard-shortcut-help-modal__section-title",children:e}),(0,d.jsx)(nr,{shortcuts:t})]}),cr=({title:e,categoryName:t,additionalShortcuts:r=[]})=>{const i=(0,u.useSelect)((e=>e(kt.store).getCategoryShortcuts(t)),[t]);return(0,d.jsx)(ar,{title:e,shortcuts:i.concat(r)})};function dr({isModalActive:e,toggleModal:t}){return(0,kt.useShortcut)("core/edit-widgets/keyboard-shortcuts",t,{bindGlobal:!0}),e?(0,d.jsxs)(E.Modal,{className:"edit-widgets-keyboard-shortcut-help-modal",title:(0,x.__)("Keyboard shortcuts"),onRequestClose:t,children:[(0,d.jsx)(ar,{className:"edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-widgets/keyboard-shortcuts"]}),(0,d.jsx)(cr,{title:(0,x.__)("Global shortcuts"),categoryName:"global"}),(0,d.jsx)(cr,{title:(0,x.__)("Selection shortcuts"),categoryName:"selection"}),(0,d.jsx)(cr,{title:(0,x.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,x.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,x.__)("Forward-slash")}]}),(0,d.jsx)(ar,{title:(0,x.__)("Text formatting"),shortcuts:rr}),(0,d.jsx)(cr,{title:(0,x.__)("List View shortcuts"),categoryName:"list-view"})]}):null}const{Fill:lr,Slot:ur}=(0,E.createSlotFill)("EditWidgetsToolsMoreMenuGroup");lr.Slot=({fillProps:e})=>(0,d.jsx)(ur,{fillProps:e,children:e=>e.length>0&&e});var gr=lr;function pr(){const[e,t]=(0,h.useState)(!1),r=()=>t(!e);(0,kt.useShortcut)("core/edit-widgets/keyboard-shortcuts",r);const i=(0,T.useViewportMatch)("medium");return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(E.DropdownMenu,{icon:er,label:(0,x.__)("Options"),popoverProps:{placement:"bottom-end",className:"more-menu-dropdown__content"},toggleProps:{tooltipPosition:"bottom",size:"compact"},children:e=>(0,d.jsxs)(d.Fragment,{children:[i&&(0,d.jsx)(E.MenuGroup,{label:(0,x._x)("View","noun"),children:(0,d.jsx)(b.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"fixedToolbar",label:(0,x.__)("Top toolbar"),info:(0,x.__)("Access all block and document tools in a single place"),messageActivated:(0,x.__)("Top toolbar activated"),messageDeactivated:(0,x.__)("Top toolbar deactivated")})}),(0,d.jsxs)(E.MenuGroup,{label:(0,x.__)("Tools"),children:[(0,d.jsx)(E.MenuItem,{onClick:()=>{t(!0)},shortcut:jt.displayShortcut.access("h"),children:(0,x.__)("Keyboard shortcuts")}),(0,d.jsx)(b.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"welcomeGuide",label:(0,x.__)("Welcome Guide")}),(0,d.jsxs)(E.MenuItem,{role:"menuitem",icon:tr,href:(0,x.__)("https://wordpress.org/documentation/article/block-based-widgets-editor/"),target:"_blank",rel:"noopener noreferrer",children:[(0,x.__)("Help"),(0,d.jsx)(E.VisuallyHidden,{as:"span",children:(0,x.__)("(opens in a new tab)")})]}),(0,d.jsx)(gr.Slot,{fillProps:{onClose:e}})]}),(0,d.jsxs)(E.MenuGroup,{label:(0,x.__)("Preferences"),children:[(0,d.jsx)(b.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"keepCaretInsideBlock",label:(0,x.__)("Contain text cursor inside block"),info:(0,x.__)("Aids screen readers by stopping text caret from leaving blocks."),messageActivated:(0,x.__)("Contain text cursor inside block activated"),messageDeactivated:(0,x.__)("Contain text cursor inside block deactivated")}),(0,d.jsx)(b.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"themeStyles",info:(0,x.__)("Make the editor look like your theme."),label:(0,x.__)("Use theme styles")}),i&&(0,d.jsx)(b.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"showBlockBreadcrumbs",label:(0,x.__)("Display block breadcrumbs"),info:(0,x.__)("Shows block breadcrumbs at the bottom of the editor."),messageActivated:(0,x.__)("Display block breadcrumbs activated"),messageDeactivated:(0,x.__)("Display block breadcrumbs deactivated")})]})]})}),(0,d.jsx)(dr,{isModalActive:e,toggleModal:r})]})}var hr=function(){const e=(0,T.useViewportMatch)("medium"),t=(0,h.useRef)(),{hasFixedToolbar:r}=(0,u.useSelect)((e=>({hasFixedToolbar:!!e(b.store).get("core/edit-widgets","fixedToolbar")})),[]);return(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)("div",{className:"edit-widgets-header",children:[(0,d.jsxs)("div",{className:"edit-widgets-header__navigable-toolbar-wrapper",children:[e&&(0,d.jsx)("h1",{className:"edit-widgets-header__title",children:(0,x.__)("Widgets")}),!e&&(0,d.jsx)(E.VisuallyHidden,{as:"h1",className:"edit-widgets-header__title",children:(0,x.__)("Widgets")}),(0,d.jsx)(Qt,{}),r&&e&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"selected-block-tools-wrapper",children:(0,d.jsx)(be.BlockToolbar,{hideDragHandle:!0})}),(0,d.jsx)(E.Popover.Slot,{ref:t,name:"block-toolbar"})]})]}),(0,d.jsxs)("div",{className:"edit-widgets-header__actions",children:[(0,d.jsx)(ce.Slot,{scope:"core/edit-widgets"}),(0,d.jsx)(Xt,{}),(0,d.jsx)(pr,{})]})]})})};var mr=function(){const{removeNotice:e}=(0,u.useDispatch)(k.store),{notices:t}=(0,u.useSelect)((e=>({notices:e(k.store).getNotices()})),[]),r=t.filter((({isDismissible:e,type:t})=>e&&"default"===t)),i=t.filter((({isDismissible:e,type:t})=>!e&&"default"===t)),s=t.filter((({type:e})=>"snackbar"===e)).slice(-3);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(E.NoticeList,{notices:i,className:"edit-widgets-notices__pinned"}),(0,d.jsx)(E.NoticeList,{notices:r,className:"edit-widgets-notices__dismissible",onRemove:e}),(0,d.jsx)(E.SnackbarList,{notices:s,className:"edit-widgets-notices__snackbar",onRemove:e})]})};function _r({blockEditorSettings:e}){const t=(0,u.useSelect)((e=>!!e(b.store).get("core/edit-widgets","themeStyles")),[]),r=(0,T.useViewportMatch)("medium"),i=(0,h.useMemo)((()=>t?e.styles:[]),[e,t]);return(0,d.jsxs)("div",{className:"edit-widgets-block-editor",children:[(0,d.jsx)(mr,{}),!r&&(0,d.jsx)(be.BlockToolbar,{hideDragHandle:!0}),(0,d.jsxs)(be.BlockTools,{children:[(0,d.jsx)(Et,{}),(0,d.jsx)(be.__unstableEditorStyles,{styles:i,scope:":where(.editor-styles-wrapper)"}),(0,d.jsx)(be.BlockSelectionClearer,{children:(0,d.jsx)(be.WritingFlow,{children:(0,d.jsx)(be.BlockList,{className:"edit-widgets-main-block-list"})})})]})]})}var wr=()=>{const e=(0,u.useSelect)((e=>{const{getEntityRecord:t}=e(_.store),r=t(ye,ke,"widget-areas");return r?.blocks[0]?.clientId}),[]);return(0,u.useSelect)((t=>{const{getBlockRootClientId:r,getBlockSelectionEnd:i,getBlockOrder:s,getBlockIndex:o}=t(be.store),n=t(dt).__experimentalGetInsertionPoint();if(n.rootClientId)return n;const a=i()||e,c=r(a);return a&&""===c?{rootClientId:a,insertionIndex:s(a).length}:{rootClientId:c,insertionIndex:o(a)+1}}),[e])};function br(){const e=(0,T.useViewportMatch)("medium","<"),{rootClientId:t,insertionIndex:r}=wr(),{setIsInserterOpened:i}=(0,u.useDispatch)(dt),s=(0,h.useCallback)((()=>i(!1)),[i]),o=(0,h.useRef)();return(0,d.jsx)("div",{className:"edit-widgets-layout__inserter-panel",children:(0,d.jsx)("div",{className:"edit-widgets-layout__inserter-panel-content",children:(0,d.jsx)(be.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:e,rootClientId:t,__experimentalInsertionIndex:r,ref:o,onClose:s})})})}function fr(){const{setIsListViewOpened:e}=(0,u.useDispatch)(dt),{getListViewToggleRef:t}=at((0,u.useSelect)(dt)),[r,i]=(0,h.useState)(null),s=(0,T.useFocusOnMount)("firstElement"),o=(0,h.useCallback)((()=>{e(!1),t().current?.focus()}),[t,e]),n=(0,h.useCallback)((e=>{e.keyCode!==jt.ESCAPE||e.defaultPrevented||(e.preventDefault(),o())}),[o]);return(0,d.jsxs)("div",{className:"edit-widgets-editor__list-view-panel",onKeyDown:n,children:[(0,d.jsxs)("div",{className:"edit-widgets-editor__list-view-panel-header",children:[(0,d.jsx)("strong",{children:(0,x.__)("List View")}),(0,d.jsx)(E.Button,{icon:W,label:(0,x.__)("Close"),onClick:o,size:"compact"})]}),(0,d.jsx)("div",{className:"edit-widgets-editor__list-view-panel-content",ref:(0,T.useMergeRefs)([s,i]),children:(0,d.jsx)(be.__experimentalListView,{dropZoneElement:r})})]})}function vr(){const{isInserterOpen:e,isListViewOpen:t}=(0,u.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r}=e(dt);return{isInserterOpen:t(),isListViewOpen:r()}}),[]);return e?(0,d.jsx)(br,{}):t?(0,d.jsx)(fr,{}):null}const yr={header:(0,x.__)("Widgets top bar"),body:(0,x.__)("Widgets and blocks"),sidebar:(0,x.__)("Widgets settings"),footer:(0,x.__)("Widgets footer")};var xr=function({blockEditorSettings:e}){const t=(0,T.useViewportMatch)("medium","<"),r=(0,T.useViewportMatch)("huge",">="),{setIsInserterOpened:i,setIsListViewOpened:s,closeGeneralSidebar:o}=(0,u.useDispatch)(dt),{hasBlockBreadCrumbsEnabled:n,hasSidebarEnabled:a,isInserterOpened:c,isListViewOpened:l}=(0,u.useSelect)((e=>({hasSidebarEnabled:!!e(X).getActiveComplementaryArea(dt.name),isInserterOpened:!!e(dt).isInserterOpened(),isListViewOpened:!!e(dt).isListViewOpened(),hasBlockBreadCrumbsEnabled:!!e(b.store).get("core/edit-widgets","showBlockBreadcrumbs")})),[]);(0,h.useEffect)((()=>{a&&!r&&(i(!1),s(!1))}),[a,r]),(0,h.useEffect)((()=>{!c&&!l||r||o()}),[c,l,r]);const g=l?(0,x.__)("List View"):(0,x.__)("Block Library"),p=l||c;return(0,d.jsx)(we,{labels:{...yr,secondarySidebar:g},header:(0,d.jsx)(hr,{}),secondarySidebar:p&&(0,d.jsx)(vr,{}),sidebar:(0,d.jsx)(ge.Slot,{scope:"core/edit-widgets"}),content:(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(_r,{blockEditorSettings:e})}),footer:n&&!t&&(0,d.jsx)("div",{className:"edit-widgets-layout__footer",children:(0,d.jsx)(be.BlockBreadcrumb,{rootLabelText:(0,x.__)("Widgets")})})})};function kr(){const e=(0,u.useSelect)((e=>{const{getEditedWidgetAreas:t}=e(dt),r=t();return r?.length>0}),[]);return(0,h.useEffect)((()=>{const t=t=>{if(e)return t.returnValue=(0,x.__)("You have unsaved changes. If you proceed, they will be lost."),t.returnValue};return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}}),[e]),null}function jr(){const e=(0,u.useSelect)((e=>!!e(b.store).get("core/edit-widgets","welcomeGuide")),[]),{toggle:t}=(0,u.useDispatch)(b.store),r=(0,u.useSelect)((e=>e(dt).getWidgetAreas({per_page:-1})),[]);if(!e)return null;const i=r?.every((e=>"wp_inactive_widgets"===e.id||e.widgets.every((e=>e.startsWith("block-"))))),s=r?.filter((e=>"wp_inactive_widgets"!==e.id)).length??0;return(0,d.jsx)(E.Guide,{className:"edit-widgets-welcome-guide",contentLabel:(0,x.__)("Welcome to block Widgets"),finishButtonText:(0,x.__)("Get started"),onFinish:()=>t("core/edit-widgets","welcomeGuide"),pages:[{image:(0,d.jsx)(Sr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.gif"}),content:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h1",{className:"edit-widgets-welcome-guide__heading",children:(0,x.__)("Welcome to block Widgets")}),i?(0,d.jsx)(d.Fragment,{children:(0,d.jsx)("p",{className:"edit-widgets-welcome-guide__text",children:(0,x.sprintf)((0,x._n)("Your theme provides %s “block” area for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.","Your theme provides %s different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.",s),s)})}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"edit-widgets-welcome-guide__text",children:(0,x.__)("You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.")}),(0,d.jsxs)("p",{className:"edit-widgets-welcome-guide__text",children:[(0,d.jsx)("strong",{children:(0,x.__)("Want to stick with the old widgets?")})," ",(0,d.jsx)(E.ExternalLink,{href:(0,x.__)("https://wordpress.org/plugins/classic-widgets/"),children:(0,x.__)("Get the Classic Widgets plugin.")})]})]})]})},{image:(0,d.jsx)(Sr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-editor.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-editor.gif"}),content:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h1",{className:"edit-widgets-welcome-guide__heading",children:(0,x.__)("Customize each block")}),(0,d.jsx)("p",{className:"edit-widgets-welcome-guide__text",children:(0,x.__)("Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.")})]})},{image:(0,d.jsx)(Sr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-library.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-library.gif"}),content:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h1",{className:"edit-widgets-welcome-guide__heading",children:(0,x.__)("Explore all blocks")}),(0,d.jsx)("p",{className:"edit-widgets-welcome-guide__text",children:(0,h.createInterpolateElement)((0,x.__)("All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon."),{InserterIconImage:(0,d.jsx)("img",{className:"edit-widgets-welcome-guide__inserter-icon",alt:(0,x.__)("inserter"),src:"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"})})})]})},{image:(0,d.jsx)(Sr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h1",{className:"edit-widgets-welcome-guide__heading",children:(0,x.__)("Learn more")}),(0,d.jsx)("p",{className:"edit-widgets-welcome-guide__text",children:(0,h.createInterpolateElement)((0,x.__)("New to the block editor? Want to learn more about using it? <a>Here's a detailed guide.</a>"),{a:(0,d.jsx)(E.ExternalLink,{href:(0,x.__)("https://wordpress.org/documentation/article/wordpress-block-editor/")})})})]})}]})}function Sr({nonAnimatedSrc:e,animatedSrc:t}){return(0,d.jsxs)("picture",{className:"edit-widgets-welcome-guide__image",children:[(0,d.jsx)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,d.jsx)("img",{src:t,width:"312",height:"240",alt:""})]})}var Er=function({blockEditorSettings:e}){const{createErrorNotice:t}=(0,u.useDispatch)(k.store),r=(0,E.__unstableUseNavigateRegions)();return(0,d.jsx)(yt,{children:(0,d.jsx)("div",{className:r.className,...r,ref:r.ref,children:(0,d.jsxs)(Tt,{blockEditorSettings:e,children:[(0,d.jsx)(xr,{blockEditorSettings:e}),(0,d.jsx)(Ut,{}),(0,d.jsx)(L.PluginArea,{onError:function(e){t((0,x.sprintf)((0,x.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}}),(0,d.jsx)(kr,{}),(0,d.jsx)(jr,{})]})})})};const Ar=["core/more","core/freeform","core/template-part","core/block"];function Ir(e,t){const r=document.getElementById(e),i=(0,h.createRoot)(r),s=(0,m.__experimentalGetCoreBlocks)().filter((e=>!(Ar.includes(e.name)||e.name.startsWith("core/post")||e.name.startsWith("core/query")||e.name.startsWith("core/site")||e.name.startsWith("core/navigation"))));return(0,u.dispatch)(b.store).setDefaults("core/edit-widgets",{fixedToolbar:!1,welcomeGuide:!0,showBlockBreadcrumbs:!0,themeStyles:!0}),(0,u.dispatch)(l.store).reapplyBlockTypeFilters(),(0,m.registerCoreBlocks)(s),(0,w.registerLegacyWidgetBlock)(),(0,w.registerLegacyWidgetVariations)(t),Br(c),(0,w.registerWidgetGroupBlock)(),t.__experimentalFetchLinkSuggestions=(e,r)=>(0,_.__experimentalFetchLinkSuggestions)(e,r,t),(0,l.setFreeformContentHandlerName)("core/html"),i.render((0,d.jsx)(h.StrictMode,{children:(0,d.jsx)(Er,{blockEditorSettings:t})})),i}const Cr=Ir;function Nr(){p()("wp.editWidgets.reinitializeEditor",{since:"6.2",version:"6.3"})}const Br=e=>{if(!e)return;const{metadata:t,settings:r,name:i}=e;t&&(0,l.unstable__bootstrapServerSideBlockDefinitions)({[i]:t}),(0,l.registerBlockType)(i,r)};(window.wp=window.wp||{}).editWidgets=t})(); block-directory.min.js 0000644 00000050274 15151622574 0011000 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={n:t=>{var l=t&&t.__esModule?()=>t.default:()=>t;return e.d(l,{a:l}),l},d:(t,l)=>{for(var s in l)e.o(l,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:l[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{store:()=>G});var l={};e.r(l),e.d(l,{getDownloadableBlocks:()=>m,getErrorNoticeForBlock:()=>v,getErrorNotices:()=>y,getInstalledBlockTypes:()=>g,getNewBlockTypes:()=>_,getUnusedBlockTypes:()=>w,isInstalling:()=>f,isRequestingDownloadableBlocks:()=>h});var s={};e.r(s),e.d(s,{addInstalledBlockType:()=>D,clearErrorNotice:()=>M,fetchDownloadableBlocks:()=>S,installBlockType:()=>C,receiveDownloadableBlocks:()=>L,removeInstalledBlockType:()=>A,setErrorNotice:()=>P,setIsInstalling:()=>R,uninstallBlockType:()=>O});var n={};e.r(n),e.d(n,{getDownloadableBlocks:()=>q});const o=window.ReactJSXRuntime,r=window.wp.plugins,i=window.wp.hooks,a=window.wp.blocks,c=window.wp.data,d=window.wp.element,u=window.wp.editor;var p=(0,c.combineReducers)({downloadableBlocks:(e={},t)=>{switch(t.type){case"FETCH_DOWNLOADABLE_BLOCKS":return{...e,[t.filterValue]:{isRequesting:!0}};case"RECEIVE_DOWNLOADABLE_BLOCKS":return{...e,[t.filterValue]:{results:t.downloadableBlocks,isRequesting:!1}}}return e},blockManagement:(e={installedBlockTypes:[],isInstalling:{}},t)=>{switch(t.type){case"ADD_INSTALLED_BLOCK_TYPE":return{...e,installedBlockTypes:[...e.installedBlockTypes,t.item]};case"REMOVE_INSTALLED_BLOCK_TYPE":return{...e,installedBlockTypes:e.installedBlockTypes.filter((e=>e.name!==t.item.name))};case"SET_INSTALLING_BLOCK":return{...e,isInstalling:{...e.isInstalling,[t.blockId]:t.isInstalling}}}return e},errorNotices:(e={},t)=>{switch(t.type){case"SET_ERROR_NOTICE":return{...e,[t.blockId]:{message:t.message,isFatal:t.isFatal}};case"CLEAR_ERROR_NOTICE":const{[t.blockId]:l,...s}=e;return s}return e}});const b=window.wp.blockEditor,k=[];function h(e,t){return e.downloadableBlocks[t]?.isRequesting??!1}function m(e,t){return e.downloadableBlocks[t]?.results??k}function g(e){return e.blockManagement.installedBlockTypes}const _=(0,c.createRegistrySelector)((e=>(0,c.createSelector)((t=>{const l=g(t);if(!l.length)return k;const{getBlockName:s,getClientIdsWithDescendants:n}=e(b.store),o=l.map((e=>e.name)),r=n().flatMap((e=>{const t=s(e);return o.includes(t)?t:[]})),i=l.filter((e=>r.includes(e.name)));return i.length>0?i:k}),(t=>[g(t),e(b.store).getClientIdsWithDescendants()])))),w=(0,c.createRegistrySelector)((e=>(0,c.createSelector)((t=>{const l=g(t);if(!l.length)return k;const{getBlockName:s,getClientIdsWithDescendants:n}=e(b.store),o=l.map((e=>e.name)),r=n().flatMap((e=>{const t=s(e);return o.includes(t)?t:[]})),i=l.filter((e=>!r.includes(e.name)));return i.length>0?i:k}),(t=>[g(t),e(b.store).getClientIdsWithDescendants()]))));function f(e,t){return e.blockManagement.isInstalling[t]||!1}function y(e){return e.errorNotices}function v(e,t){return e.errorNotices[t]}const x=window.wp.i18n,j=window.wp.apiFetch;var B=e.n(j);const E=window.wp.notices,N=window.wp.url,I=e=>new Promise(((t,l)=>{const s=document.createElement(e.nodeName);["id","rel","src","href","type"].forEach((t=>{e[t]&&(s[t]=e[t])})),e.innerHTML&&s.appendChild(document.createTextNode(e.innerHTML)),s.onload=()=>t(!0),s.onerror=()=>l(new Error("Error loading asset.")),document.body.appendChild(s),("link"===s.nodeName.toLowerCase()||"script"===s.nodeName.toLowerCase()&&!s.src)&&t()}));function T(e){if(!e)return!1;const t=e.links["wp:plugin"]||e.links.self;return!(!t||!t.length)&&t[0].href}function S(e){return{type:"FETCH_DOWNLOADABLE_BLOCKS",filterValue:e}}function L(e,t){return{type:"RECEIVE_DOWNLOADABLE_BLOCKS",downloadableBlocks:e,filterValue:t}}const C=e=>async({registry:t,dispatch:l})=>{const{id:s,name:n}=e;let o=!1;l.clearErrorNotice(s);try{l.setIsInstalling(s,!0);const r=T(e);let i={};if(r)await B()({method:"PUT",url:r,data:{status:"active"}});else{i=(await B()({method:"POST",path:"wp/v2/plugins",data:{slug:s,status:"active"}}))._links}l.addInstalledBlockType({...e,links:{...e.links,...i}});const c=["api_version","title","category","parent","ancestor","icon","description","keywords","attributes","provides_context","uses_context","selectors","supports","styles","example","variations","allowed_blocks","block_hooks"];await B()({path:(0,N.addQueryArgs)(`/wp/v2/block-types/${n}`,{_fields:c})}).catch((()=>{})).then((e=>{e&&(0,a.unstable__bootstrapServerSideBlockDefinitions)({[n]:Object.fromEntries(Object.entries(e).filter((([e])=>c.includes(e))))})})),await async function(){const e=await B()({url:document.location.href,parse:!1}),t=await e.text(),l=(new window.DOMParser).parseFromString(t,"text/html"),s=Array.from(l.querySelectorAll('link[rel="stylesheet"],script')).filter((e=>e.id&&!document.getElementById(e.id)));for(const e of s)await I(e)}();if(!t.select(a.store).getBlockTypes().some((e=>e.name===n)))throw new Error((0,x.__)("Error registering block. Try reloading the page."));t.dispatch(E.store).createInfoNotice((0,x.sprintf)((0,x.__)("Block %s installed and added."),e.title),{speak:!0,type:"snackbar"}),o=!0}catch(e){let n=e.message||(0,x.__)("An error occurred."),o=e instanceof Error;const r={folder_exists:(0,x.__)("This block is already installed. Try reloading the page."),unable_to_connect_to_filesystem:(0,x.__)("Error installing block. You can reload the page and try again.")};r[e.code]&&(o=!0,n=r[e.code]),l.setErrorNotice(s,n,o),t.dispatch(E.store).createErrorNotice(n,{speak:!0,isDismissible:!0})}return l.setIsInstalling(s,!1),o},O=e=>async({registry:t,dispatch:l})=>{try{const t=T(e);await B()({method:"PUT",url:t,data:{status:"inactive"}}),await B()({method:"DELETE",url:t}),l.removeInstalledBlockType(e)}catch(e){t.dispatch(E.store).createErrorNotice(e.message||(0,x.__)("An error occurred."))}};function D(e){return{type:"ADD_INSTALLED_BLOCK_TYPE",item:e}}function A(e){return{type:"REMOVE_INSTALLED_BLOCK_TYPE",item:e}}function R(e,t){return{type:"SET_INSTALLING_BLOCK",blockId:e,isInstalling:t}}function P(e,t,l=!1){return{type:"SET_ERROR_NOTICE",blockId:e,message:t,isFatal:l}}function M(e){return{type:"CLEAR_ERROR_NOTICE",blockId:e}}var F=function(){return F=Object.assign||function(e){for(var t,l=1,s=arguments.length;l<s;l++)for(var n in t=arguments[l])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},F.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function $(e){return e.toLowerCase()}var V=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],H=/[^A-Z0-9]+/gi;function z(e,t,l){return t instanceof RegExp?e.replace(t,l):t.reduce((function(e,t){return e.replace(t,l)}),e)}function K(e,t){var l=e.charAt(0),s=e.substr(1).toLowerCase();return t>0&&l>="0"&&l<="9"?"_"+l+s:""+l.toUpperCase()+s}function W(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var l=t.splitRegexp,s=void 0===l?V:l,n=t.stripRegexp,o=void 0===n?H:n,r=t.transform,i=void 0===r?$:r,a=t.delimiter,c=void 0===a?" ":a,d=z(z(e,s,"$1\0$2"),o,"\0"),u=0,p=d.length;"\0"===d.charAt(u);)u++;for(;"\0"===d.charAt(p-1);)p--;return d.slice(u,p).split("\0").map(i).join(c)}(e,F({delimiter:"",transform:K},t))}function Y(e,t){return 0===t?e.toLowerCase():K(e,t)}const q=e=>async({dispatch:t})=>{if(e)try{t(S(e));const l=await B()({path:`wp/v2/block-directory/search?term=${e}`});t(L(l.map((e=>Object.fromEntries(Object.entries(e).map((([e,t])=>{return[(l=e,void 0===s&&(s={}),W(l,F({transform:Y},s))),t];var l,s}))))),e))}catch{t(L([],e))}},U={reducer:p,selectors:l,actions:s,resolvers:n},G=(0,c.createReduxStore)("core/block-directory",U);function Z(){const{uninstallBlockType:e}=(0,c.useDispatch)(G),t=(0,c.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:l}=e(u.store);return l()&&!t()}),[]),l=(0,c.useSelect)((e=>e(G).getUnusedBlockTypes()),[]);return(0,d.useEffect)((()=>{t&&l.length&&l.forEach((t=>{e(t),(0,a.unregisterBlockType)(t.name)}))}),[t]),null}(0,c.register)(G);const J=window.wp.compose,Q=window.wp.components,X=window.wp.coreData;function ee(e){var t,l,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(l=ee(e[t]))&&(s&&(s+=" "),s+=l)}else for(l in e)e[l]&&(s&&(s+=" "),s+=l);return s}const te=function(){for(var e,t,l=0,s="",n=arguments.length;l<n;l++)(e=arguments[l])&&(t=ee(e))&&(s&&(s+=" "),s+=t);return s},le=window.wp.htmlEntities;var se=(0,d.forwardRef)((({icon:e,size:t=24,...l},s)=>(0,d.cloneElement)(e,{width:t,height:t,...l,ref:s})));const ne=window.wp.primitives;var oe=(0,o.jsx)(ne.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(ne.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"})}),re=(0,o.jsx)(ne.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(ne.Path,{d:"M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39v7.143z"})}),ie=(0,o.jsx)(ne.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(ne.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"})});var ae=function({rating:e}){const t=.5*Math.round(e/.5),l=Math.floor(e),s=Math.ceil(e-l),n=5-(l+s);return(0,o.jsxs)("span",{"aria-label":(0,x.sprintf)((0,x.__)("%s out of 5 stars"),t),children:[Array.from({length:l}).map(((e,t)=>(0,o.jsx)(se,{className:"block-directory-block-ratings__star-full",icon:oe,size:16},`full_stars_${t}`))),Array.from({length:s}).map(((e,t)=>(0,o.jsx)(se,{className:"block-directory-block-ratings__star-half-full",icon:re,size:16},`half_stars_${t}`))),Array.from({length:n}).map(((e,t)=>(0,o.jsx)(se,{className:"block-directory-block-ratings__star-empty",icon:ie,size:16},`empty_stars_${t}`)))]})};var ce=({rating:e})=>(0,o.jsx)("span",{className:"block-directory-block-ratings",children:(0,o.jsx)(ae,{rating:e})});var de=function({icon:e}){const t="block-directory-downloadable-block-icon";return null!==e.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/)?(0,o.jsx)("img",{className:t,src:e,alt:""}):(0,o.jsx)(b.BlockIcon,{className:t,icon:e,showColors:!0})};var ue=({block:e})=>{const t=(0,c.useSelect)((t=>t(G).getErrorNoticeForBlock(e.id)),[e]);return t?(0,o.jsx)("div",{className:"block-directory-downloadable-block-notice",children:(0,o.jsxs)("div",{className:"block-directory-downloadable-block-notice__content",children:[t.message,t.isFatal?" "+(0,x.__)("Try reloading the page."):null]})}):null};var pe=function({item:e,onClick:t}){const{author:l,description:s,icon:n,rating:r,title:i}=e,u=!!(0,a.getBlockType)(e.name),{hasNotice:p,isInstalling:b,isInstallable:k}=(0,c.useSelect)((t=>{const{getErrorNoticeForBlock:l,isInstalling:s}=t(G),n=l(e.id),o=n&&n.isFatal;return{hasNotice:!!n,isInstalling:s(e.id),isInstallable:!o}}),[e]);let h="";u?h=(0,x.__)("Installed!"):b&&(h=(0,x.__)("Installing…"));const m=function({title:e,rating:t,ratingCount:l},{hasNotice:s,isInstalled:n,isInstalling:o}){const r=.5*Math.round(t/.5);return!n&&s?(0,x.sprintf)("Retry installing %s.",(0,le.decodeEntities)(e)):n?(0,x.sprintf)("Add %s.",(0,le.decodeEntities)(e)):o?(0,x.sprintf)("Installing %s.",(0,le.decodeEntities)(e)):l<1?(0,x.sprintf)("Install %s.",(0,le.decodeEntities)(e)):(0,x.sprintf)((0,x._n)("Install %1$s. %2$s stars with %3$s review.","Install %1$s. %2$s stars with %3$s reviews.",l),(0,le.decodeEntities)(e),r,l)}(e,{hasNotice:p,isInstalled:u,isInstalling:b});return(0,o.jsx)(Q.Tooltip,{placement:"top",text:m,children:(0,o.jsxs)(Q.Composite.Item,{className:te("block-directory-downloadable-block-list-item",b&&"is-installing"),accessibleWhenDisabled:!0,disabled:b||!k,onClick:e=>{e.preventDefault(),t()},"aria-label":m,type:"button",role:"option",children:[(0,o.jsxs)("div",{className:"block-directory-downloadable-block-list-item__icon",children:[(0,o.jsx)(de,{icon:n,title:i}),b?(0,o.jsx)("span",{className:"block-directory-downloadable-block-list-item__spinner",children:(0,o.jsx)(Q.Spinner,{})}):(0,o.jsx)(ce,{rating:r})]}),(0,o.jsxs)("span",{className:"block-directory-downloadable-block-list-item__details",children:[(0,o.jsx)("span",{className:"block-directory-downloadable-block-list-item__title",children:(0,d.createInterpolateElement)((0,x.sprintf)((0,x.__)("%1$s <span>by %2$s</span>"),(0,le.decodeEntities)(i),l),{span:(0,o.jsx)("span",{className:"block-directory-downloadable-block-list-item__author"})})}),p?(0,o.jsx)(ue,{block:e}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"block-directory-downloadable-block-list-item__desc",children:h||(0,le.decodeEntities)(s)}),k&&!(u||b)&&(0,o.jsx)(Q.VisuallyHidden,{children:(0,x.__)("Install block")})]})]})]})})};const be=()=>{};var ke=function({items:e,onHover:t=be,onSelect:l}){const{installBlockType:s}=(0,c.useDispatch)(G);return e.length?(0,o.jsx)(Q.Composite,{role:"listbox",className:"block-directory-downloadable-blocks-list","aria-label":(0,x.__)("Blocks available for install"),children:e.map((e=>(0,o.jsx)(pe,{onClick:()=>{(0,a.getBlockType)(e.name)?l(e):s(e).then((t=>{t&&l(e)})),t(null)},onHover:t,item:e},e.id)))}):null};const he=window.wp.a11y;var me=function({children:e,downloadableItems:t,hasLocalBlocks:l}){const s=t.length;return(0,d.useEffect)((()=>{(0,he.speak)((0,x.sprintf)((0,x._n)("%d additional block is available to install.","%d additional blocks are available to install.",s),s))}),[s]),(0,o.jsxs)(o.Fragment,{children:[!l&&(0,o.jsx)("p",{className:"block-directory-downloadable-blocks-panel__no-local",children:(0,x.__)("No results available from your installed blocks.")}),(0,o.jsx)("div",{className:"block-editor-inserter__quick-inserter-separator"}),(0,o.jsxs)("div",{className:"block-directory-downloadable-blocks-panel",children:[(0,o.jsxs)("div",{className:"block-directory-downloadable-blocks-panel__header",children:[(0,o.jsx)("h2",{className:"block-directory-downloadable-blocks-panel__title",children:(0,x.__)("Available to install")}),(0,o.jsx)("p",{className:"block-directory-downloadable-blocks-panel__description",children:(0,x.__)("Select a block to install and add it to your post.")})]}),e]})]})};var ge=function(){return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"block-editor-inserter__no-results",children:(0,o.jsx)("p",{children:(0,x.__)("No results found.")})}),(0,o.jsx)("div",{className:"block-editor-inserter__tips",children:(0,o.jsxs)(Q.Tip,{children:[(0,x.__)("Interested in creating your own block?"),(0,o.jsx)("br",{}),(0,o.jsxs)(Q.ExternalLink,{href:"https://developer.wordpress.org/block-editor/",children:[(0,x.__)("Get started here"),"."]})]})})]})};const _e=[];function we({onSelect:e,onHover:t,hasLocalBlocks:l,isTyping:s,filterValue:n}){const{hasPermission:r,downloadableBlocks:i,isLoading:d}=(e=>(0,c.useSelect)((t=>{const{getDownloadableBlocks:l,isRequestingDownloadableBlocks:s,getInstalledBlockTypes:n}=t(G),o=t(X.store).canUser("read","block-directory/search");let r=_e;if(o){r=l(e);const t=n(),s=r.filter((({name:e})=>{const l=t.some((t=>t.name===e)),s=(0,a.getBlockType)(e);return l||!s}));s.length!==r.length&&(r=s),0===r.length&&(r=_e)}return{hasPermission:o,downloadableBlocks:r,isLoading:s(e)}}),[e]))(n);return void 0===r||d||s?(0,o.jsxs)(o.Fragment,{children:[r&&!l&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"block-directory-downloadable-blocks-panel__no-local",children:(0,x.__)("No results available from your installed blocks.")}),(0,o.jsx)("div",{className:"block-editor-inserter__quick-inserter-separator"})]}),(0,o.jsx)("div",{className:"block-directory-downloadable-blocks-panel has-blocks-loading",children:(0,o.jsx)(Q.Spinner,{})})]}):!1===r||0===i.length?l?null:(0,o.jsx)(ge,{}):(0,o.jsx)(me,{downloadableItems:i,hasLocalBlocks:l,children:(0,o.jsx)(ke,{items:i,onSelect:e,onHover:t})})}var fe=function(){const[e,t]=(0,d.useState)(""),l=(0,J.debounce)(t,400);return(0,o.jsx)(b.__unstableInserterMenuExtension,{children:({onSelect:t,onHover:s,filterValue:n,hasItems:r})=>(e!==n&&l(n),e?(0,o.jsx)(we,{onSelect:t,onHover:s,filterValue:e,hasLocalBlocks:r,isTyping:n!==e}):null)})};function ye({items:e}){return e.length?(0,o.jsx)("ul",{className:"block-directory-compact-list",children:e.map((({icon:e,id:t,title:l,author:s})=>(0,o.jsxs)("li",{className:"block-directory-compact-list__item",children:[(0,o.jsx)(de,{icon:e,title:l}),(0,o.jsxs)("div",{className:"block-directory-compact-list__item-details",children:[(0,o.jsx)("div",{className:"block-directory-compact-list__item-title",children:l}),(0,o.jsx)("div",{className:"block-directory-compact-list__item-author",children:(0,x.sprintf)((0,x.__)("By %s"),s)})]})]},t)))}):null}function ve(){const e=(0,c.useSelect)((e=>e(G).getNewBlockTypes()),[]);return e.length?(0,o.jsxs)(u.PluginPrePublishPanel,{title:(0,x.sprintf)((0,x._n)("Added: %d block","Added: %d blocks",e.length),e.length),initialOpen:!0,children:[(0,o.jsx)("p",{className:"installed-blocks-pre-publish-panel__copy",children:(0,x._n)("The following block has been added to your site.","The following blocks have been added to your site.",e.length)}),(0,o.jsx)(ye,{items:e})]}):null}function xe({attributes:e,block:t,clientId:l}){const s=(0,c.useSelect)((e=>e(G).isInstalling(t.id)),[t.id]),{installBlockType:n}=(0,c.useDispatch)(G),{replaceBlock:r}=(0,c.useDispatch)(b.store);return(0,o.jsx)(Q.Button,{__next40pxDefaultSize:!0,onClick:()=>n(t).then((s=>{if(s){const s=(0,a.getBlockType)(t.name),[n]=(0,a.parse)(e.originalContent);n&&s&&r(l,(0,a.createBlock)(s.name,n.attributes,n.innerBlocks))}})),accessibleWhenDisabled:!0,disabled:s,isBusy:s,variant:"primary",children:(0,x.sprintf)((0,x.__)("Install %s"),t.title)})}const je=({originalBlock:e,...t})=>{const{originalName:l,originalUndelimitedContent:s,clientId:n}=t.attributes,{replaceBlock:r}=(0,c.useDispatch)(b.store),i=()=>{r(t.clientId,(0,a.createBlock)("core/html",{content:s}))},u=!!s,p=(0,c.useSelect)((e=>{const{canInsertBlockType:t,getBlockRootClientId:l}=e(b.store);return t("core/html",l(n))}),[n]);let k=(0,x.sprintf)((0,x.__)("Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely."),e.title||l);const h=[(0,o.jsx)(xe,{block:e,attributes:t.attributes,clientId:t.clientId},"install")];return u&&p&&(k=(0,x.sprintf)((0,x.__)("Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."),e.title||l),h.push((0,o.jsx)(Q.Button,{__next40pxDefaultSize:!0,onClick:i,variant:"tertiary",children:(0,x.__)("Keep as HTML")},"convert"))),(0,o.jsxs)("div",{...(0,b.useBlockProps)(),children:[(0,o.jsx)(b.Warning,{actions:h,children:k}),(0,o.jsx)(d.RawHTML,{children:s})]})};var Be=e=>t=>{const{originalName:l}=t.attributes,{block:s,hasPermission:n}=(0,c.useSelect)((e=>{const{getDownloadableBlocks:t}=e(G),s=t("block:"+l).filter((({name:e})=>l===e));return{hasPermission:e(X.store).canUser("read","block-directory/search"),block:s.length&&s[0]}}),[l]);return n&&s?(0,o.jsx)(je,{...t,originalBlock:s}):(0,o.jsx)(e,{...t})};(0,r.registerPlugin)("block-directory",{icon:void 0,render:()=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Z,{}),(0,o.jsx)(fe,{}),(0,o.jsx)(ve,{})]})}),(0,i.addFilter)("blocks.registerBlockType","block-directory/fallback",((e,t)=>("core/missing"!==t||(e.edit=Be(e.edit)),e))),(window.wp=window.wp||{}).blockDirectory=t})(); format-library.min.js 0000644 00000065415 15151622574 0010641 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e,t,n={3533:e=>{e.exports=window.wp.latexToMathml}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return n[e](r,r.exports,a),r.exports}t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(n,o){if(1&o&&(n=this(n)),8&o)return n;if("object"==typeof n&&n){if(4&o&&n.__esModule)return n;if(16&o&&"function"==typeof n.then)return n}var r=Object.create(null);a.r(r);var s={};e=e||[null,t({}),t([]),t(t)];for(var i=2&o&&n;"object"==typeof i&&!~e.indexOf(i);i=t(i))Object.getOwnPropertyNames(i).forEach((e=>s[e]=()=>n[e]));return s.default=()=>n,a.d(r,s),r},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};const r=window.wp.richText,s=window.ReactJSXRuntime,i=window.wp.i18n,l=window.wp.blockEditor,c=window.wp.primitives;var u=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.Path,{d:"M14.7 11.3c1-.6 1.5-1.6 1.5-3 0-2.3-1.3-3.4-4-3.4H7v14h5.8c1.4 0 2.5-.3 3.3-1 .8-.7 1.2-1.7 1.2-2.9.1-1.9-.8-3.1-2.6-3.7zm-5.1-4h2.3c.6 0 1.1.1 1.4.4.3.3.5.7.5 1.2s-.2 1-.5 1.2c-.3.3-.8.4-1.4.4H9.6V7.3zm4.6 9c-.4.3-1 .4-1.7.4H9.6v-3.9h2.9c.7 0 1.3.2 1.7.5.4.3.6.8.6 1.5s-.2 1.2-.6 1.5z"})});const h="core/bold",p=(0,i.__)("Bold"),m={name:h,title:p,tagName:"strong",className:null,edit({isActive:e,value:t,onChange:n,onFocus:o}){function a(){n((0,r.toggleFormat)(t,{type:h,title:p}))}return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextShortcut,{type:"primary",character:"b",onUse:a}),(0,s.jsx)(l.RichTextToolbarButton,{name:"bold",icon:u,title:p,onClick:function(){n((0,r.toggleFormat)(t,{type:h})),o()},isActive:e,shortcutType:"primary",shortcutCharacter:"b"}),(0,s.jsx)(l.__unstableRichTextInputEvent,{inputType:"formatBold",onInput:a})]})}};var d=(0,s.jsx)(c.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(c.Path,{d:"M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"})});const g="core/code",x=(0,i.__)("Inline code"),v={name:g,title:x,tagName:"code",className:null,__unstableInputRule(e){const{start:t,text:n}=e;if("`"!==n[t-1])return e;if(t-2<0)return e;const o=n.lastIndexOf("`",t-2);if(-1===o)return e;const a=o,s=t-2;return a===s?e:(e=(0,r.remove)(e,a,a+1),e=(0,r.remove)(e,s,s+1),e=(0,r.applyFormat)(e,{type:g},a,s))},edit({value:e,onChange:t,onFocus:n,isActive:o}){function a(){t((0,r.toggleFormat)(e,{type:g,title:x})),n()}return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextShortcut,{type:"access",character:"x",onUse:a}),(0,s.jsx)(l.RichTextToolbarButton,{icon:d,title:x,onClick:a,isActive:o,role:"menuitemcheckbox"})]})}},f=window.wp.components,b=window.wp.element,_=["image"],w="core/image",y=(0,i.__)("Inline image");function j(e){if(!e?.className)return;const[,t]=e.className.match(/wp-image-(\d+)/)??[];return t?parseInt(t,10):void 0}const C={name:w,title:y,keywords:[(0,i.__)("photo"),(0,i.__)("media")],object:!0,tagName:"img",className:null,attributes:{className:"class",style:"style",url:"src",alt:"alt"},edit:function({value:e,onChange:t,onFocus:n,isObjectActive:o,activeObjectAttributes:a,contentRef:c}){return(0,s.jsxs)(l.MediaUploadCheck,{children:[(0,s.jsx)(l.MediaUpload,{allowedTypes:_,value:j(a),onSelect:({id:o,url:a,alt:s,width:i})=>{t((0,r.insertObject)(e,{type:w,attributes:{className:`wp-image-${o}`,style:`width: ${Math.min(i,150)}px;`,url:a,alt:s}})),n()},render:({open:e})=>(0,s.jsx)(l.RichTextToolbarButton,{icon:(0,s.jsx)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(f.Path,{d:"M4 18.5h16V17H4v1.5zM16 13v1.5h4V13h-4zM5.1 15h7.8c.6 0 1.1-.5 1.1-1.1V6.1c0-.6-.5-1.1-1.1-1.1H5.1C4.5 5 4 5.5 4 6.1v7.8c0 .6.5 1.1 1.1 1.1zm.4-8.5h7V10l-1-1c-.3-.3-.8-.3-1 0l-1.6 1.5-1.2-.7c-.3-.2-.6-.2-.9 0l-1.3 1V6.5zm0 6.1l1.8-1.3 1.3.8c.3.2.7.2.9-.1l1.5-1.4 1.5 1.4v1.5h-7v-.9z"})}),title:o?(0,i.__)("Replace image"):y,onClick:e,isActive:o})}),o&&(0,s.jsx)(k,{value:e,onChange:t,activeObjectAttributes:a,contentRef:c})]})}};function k({value:e,onChange:t,activeObjectAttributes:n,contentRef:o}){const{style:a,alt:l}=n,c=a?.replace(/\D/g,""),[u,h]=(0,b.useState)(c),[p,m]=(0,b.useState)(l),d=u!==c||p!==l,g=(0,r.useAnchor)({editableContentElement:o.current,settings:C});return(0,s.jsx)(f.Popover,{placement:"bottom",focusOnMount:!1,anchor:g,className:"block-editor-format-toolbar__image-popover",children:(0,s.jsx)("form",{className:"block-editor-format-toolbar__image-container-content",onSubmit:o=>{const a=e.replacements.slice();a[e.start]={type:w,attributes:{...n,style:u?`width: ${u}px;`:"",alt:p}},t({...e,replacements:a}),o.preventDefault()},children:(0,s.jsxs)(f.__experimentalVStack,{spacing:4,children:[(0,s.jsx)(f.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,i.__)("Width"),value:u,min:1,onChange:e=>{h(e)}}),(0,s.jsx)(f.TextareaControl,{label:(0,i.__)("Alternative text"),__nextHasNoMarginBottom:!0,value:p,onChange:e=>{m(e)},help:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.ExternalLink,{href:(0,i.__)("https://www.w3.org/WAI/tutorials/images/decision-tree/"),children:(0,i.__)("Describe the purpose of the image.")}),(0,s.jsx)("br",{}),(0,i.__)("Leave empty if decorative.")]})}),(0,s.jsx)(f.__experimentalHStack,{justify:"right",children:(0,s.jsx)(f.Button,{disabled:!d,accessibleWhenDisabled:!0,variant:"primary",type:"submit",size:"compact",children:(0,i.__)("Apply")})})]})})})}var S=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.Path,{d:"M12.5 5L10 19h1.9l2.5-14z"})});const T="core/italic",A=(0,i.__)("Italic"),N={name:T,title:A,tagName:"em",className:null,edit({isActive:e,value:t,onChange:n,onFocus:o}){function a(){n((0,r.toggleFormat)(t,{type:T,title:A}))}return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextShortcut,{type:"primary",character:"i",onUse:a}),(0,s.jsx)(l.RichTextToolbarButton,{name:"italic",icon:S,title:A,onClick:function(){n((0,r.toggleFormat)(t,{type:T})),o()},isActive:e,shortcutType:"primary",shortcutCharacter:"i"}),(0,s.jsx)(l.__unstableRichTextInputEvent,{inputType:"formatItalic",onInput:a})]})}},F=window.wp.url,M=window.wp.htmlEntities;var R=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.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"})});const V=window.wp.a11y,P=window.wp.data;function B(e){if(!e)return!1;const t=e.trim();if(!t)return!1;if(/^\S+:/.test(t)){const e=(0,F.getProtocol)(t);if(!(0,F.isValidProtocol)(e))return!1;if(e.startsWith("http")&&!/^https?:\/\/[^\/\s]/i.test(t))return!1;const n=(0,F.getAuthority)(t);if(!(0,F.isValidAuthority)(n))return!1;const o=(0,F.getPath)(t);if(o&&!(0,F.isValidPath)(o))return!1;const a=(0,F.getQueryString)(t);if(a&&!(0,F.isValidQueryString)(a))return!1;const r=(0,F.getFragment)(t);if(r&&!(0,F.isValidFragment)(r))return!1}return!(t.startsWith("#")&&!(0,F.isValidFragment)(t))}function L(e,t,n=e.start,o=e.end){const a={start:null,end:null},{formats:r}=e;let s,i;if(!r?.length)return a;const l=r.slice(),c=l[n]?.find((({type:e})=>e===t.type)),u=l[o]?.find((({type:e})=>e===t.type)),h=l[o-1]?.find((({type:e})=>e===t.type));if(c)s=c,i=n;else if(u)s=u,i=o;else{if(!h)return a;s=h,i=o-1}const p=l[i].indexOf(s),m=[l,i,s,p];return{start:n=(n=H(...m))<0?0:n,end:o=z(...m)}}function O(e,t,n,o,a){let r=t;const s={forwards:1,backwards:-1}[a]||1,i=-1*s;for(;e[r]&&e[r][o]===n;)r+=s;return r+=i,r}const I=(e,...t)=>(...n)=>e(...n,...t),H=I(O,"backwards"),z=I(O,"forwards"),E=window.wp.compose,U=({setting:e,value:t,onChange:n})=>{const o=!!t&&t?.cssClasses?.length>0,[a,r]=(0,b.useState)(o),l=`css-classes-setting-${(0,E.useInstanceId)(U)}`,c=o=>{const a="string"==typeof o?o.replace(/,/g," ").replace(/\s+/g," ").trim():o;n({...t,[e.id]:a})};return(0,s.jsxs)("fieldset",{children:[(0,s.jsx)(f.VisuallyHidden,{as:"legend",children:e.title}),(0,s.jsxs)(f.__experimentalVStack,{spacing:3,children:[(0,s.jsx)(f.CheckboxControl,{__nextHasNoMarginBottom:!0,label:e.title,onChange:()=>{a?(o&&c(""),r(!1)):r(!0)},checked:a||o,"aria-expanded":a,"aria-controls":a?l:void 0}),a&&(0,s.jsx)("div",{id:l,children:(0,s.jsx)(f.__experimentalInputControl,{label:(0,i.__)("CSS classes"),value:t?.cssClasses,onChange:c,help:(0,i.__)("Separate multiple classes with spaces."),__unstableInputWidth:"100%",__next40pxDefaultSize:!0})})]})]})};var D=U;const G=[...l.LinkControl.DEFAULT_LINK_SETTINGS,{id:"nofollow",title:(0,i.__)("Mark as nofollow")},{id:"cssClasses",title:(0,i.__)("Additional CSS class(es)"),render:(e,t,n)=>(0,s.jsx)(D,{setting:e,value:t,onChange:n})}];var W=function({isActive:e,activeAttributes:t,value:n,onChange:o,onFocusOutside:a,stopAddingLink:c,contentRef:u,focusOnMount:h}){const p=function(e,t){let n=e.start,o=e.end;if(t){const t=L(e,{type:"core/link"});n=t.start,o=t.end+1}return(0,r.slice)(e,n,o)}(n,e).text,{selectionChange:m}=(0,P.useDispatch)(l.store),{createPageEntity:d,userCanCreatePages:g,selectionStart:x}=(0,P.useSelect)((e=>{const{getSettings:t,getSelectionStart:n}=e(l.store),o=t();return{createPageEntity:o.__experimentalCreatePageEntity,userCanCreatePages:o.__experimentalUserCanCreatePages,selectionStart:n()}}),[]),v=(0,b.useMemo)((()=>({url:t.url,type:t.type,id:t.id,opensInNewTab:"_blank"===t.target,nofollow:t.rel?.includes("nofollow"),title:p,cssClasses:t.class})),[t.class,t.id,t.rel,t.target,t.type,t.url,p]),_=(0,r.useAnchor)({editableContentElement:u.current,settings:{...K,isActive:e}});return(0,s.jsx)(f.Popover,{anchor:_,animate:!1,onClose:c,onFocusOutside:a,placement:"bottom",offset:8,shift:!0,focusOnMount:h,constrainTabbing:!0,children:(0,s.jsx)(l.LinkControl,{value:v,onChange:function(t){const a=v?.url,s=!a;t={...v,...t};const l=(0,F.prependHTTP)(t.url),u=function({url:e,type:t,id:n,opensInNewWindow:o,nofollow:a,cssClasses:r}){const s={type:"core/link",attributes:{url:e}};t&&(s.attributes.type=t),n&&(s.attributes.id=n),o&&(s.attributes.target="_blank",s.attributes.rel=s.attributes.rel?s.attributes.rel+" noreferrer noopener":"noreferrer noopener"),a&&(s.attributes.rel=s.attributes.rel?s.attributes.rel+" nofollow":"nofollow");const i=r?.trim();return i?.length&&(s.attributes.class=i),s}({url:l,type:t.type,id:void 0!==t.id&&null!==t.id?String(t.id):void 0,opensInNewWindow:t.opensInNewTab,nofollow:t.nofollow,cssClasses:t.cssClasses}),h=t.title||l;let d;if((0,r.isCollapsed)(n)&&!e){const e=(0,r.insert)(n,h);return d=(0,r.applyFormat)(e,u,n.start,n.start+h.length),o(d),c(),void m({clientId:x.clientId,identifier:x.attributeKey,start:n.start+h.length+1})}if(h===p)d=(0,r.applyFormat)(n,u);else{d=(0,r.create)({text:h}),d=(0,r.applyFormat)(d,u,0,h.length);const e=L(n,{type:"core/link"}),[t,o]=(0,r.split)(n,e.start,e.start),a=(0,r.replace)(o,p,d);d=(0,r.concat)(t,a)}o(d),s||c(),B(l)?e?(0,V.speak)((0,i.__)("Link edited."),"assertive"):(0,V.speak)((0,i.__)("Link inserted."),"assertive"):(0,V.speak)((0,i.__)("Warning: the link has been inserted but may have errors. Please test it."),"assertive")},onRemove:function(){const e=(0,r.removeFormat)(n,"core/link");o(e),c(),(0,V.speak)((0,i.__)("Link removed."),"assertive")},hasRichPreviews:!0,createSuggestion:d&&async function(e){const t=await d({title:e,status:"draft"});return{id:t.id,type:t.type,title:t.title.rendered,url:t.link,kind:"post-type"}},withCreateSuggestion:g,createSuggestionButtonText:function(e){return(0,b.createInterpolateElement)((0,i.sprintf)((0,i.__)("Create page: <mark>%s</mark>"),e),{mark:(0,s.jsx)("mark",{})})},hasTextControl:!0,settings:G,showInitialSuggestions:!0,suggestionsQuery:{initialSuggestionsSearchOptions:{type:"post",subtype:"page",perPage:20}}})})};const Z="core/link",$=(0,i.__)("Link");const K={name:Z,title:$,tagName:"a",className:null,attributes:{url:"href",type:"data-type",id:"data-id",_id:"id",target:"target",rel:"rel",class:"class"},__unstablePasteRule(e,{html:t,plainText:n}){const o=(t||n).replace(/<[^>]+>/g,"").trim();if(!(0,F.isURL)(o)||!/^https?:/.test(o))return e;window.console.log("Created link:\n\n",o);const a={type:Z,attributes:{url:(0,M.decodeEntities)(o)}};return(0,r.isCollapsed)(e)?(0,r.insert)(e,(0,r.applyFormat)((0,r.create)({text:n}),a,0,n.length)):(0,r.applyFormat)(e,a)},edit:function({isActive:e,activeAttributes:t,value:n,onChange:o,onFocus:a,contentRef:c}){const[u,h]=(0,b.useState)(!1),[p,m]=(0,b.useState)(null);function d(t){const a=(0,r.getTextContent)((0,r.slice)(n));!e&&a&&(0,F.isURL)(a)&&B(a)?o((0,r.applyFormat)(n,{type:Z,attributes:{url:a}})):!e&&a&&(0,F.isEmail)(a)?o((0,r.applyFormat)(n,{type:Z,attributes:{url:`mailto:${a}`}})):!e&&a&&(0,F.isPhoneNumber)(a)?o((0,r.applyFormat)(n,{type:Z,attributes:{url:`tel:${a.replace(/\D/g,"")}`}})):(t&&m({el:t,action:null}),h(!0))}(0,b.useEffect)((()=>{e||h(!1)}),[e]),(0,b.useLayoutEffect)((()=>{const t=c.current;if(t)return t.addEventListener("click",n),()=>{t.removeEventListener("click",n)};function n(t){const n=t.target.closest("[contenteditable] a");n&&e&&(h(!0),m({el:n,action:"click"}))}}),[c,e]);const g=!("A"===p?.el?.tagName&&"click"===p?.action),x=!(0,r.isCollapsed)(n);return(0,s.jsxs)(s.Fragment,{children:[x&&(0,s.jsx)(l.RichTextShortcut,{type:"primary",character:"k",onUse:d}),(0,s.jsx)(l.RichTextShortcut,{type:"primaryShift",character:"k",onUse:function(){o((0,r.removeFormat)(n,Z)),(0,V.speak)((0,i.__)("Link removed."),"assertive")}}),(0,s.jsx)(l.RichTextToolbarButton,{name:"link",icon:R,title:e?(0,i.__)("Link"):$,onClick:e=>{d(e.currentTarget)},isActive:e||u,shortcutType:"primary",shortcutCharacter:"k","aria-haspopup":"true","aria-expanded":u}),u&&(0,s.jsx)(W,{stopAddingLink:function(){h(!1),"BUTTON"===p?.el?.tagName?p.el.focus():a(),m(null)},onFocusOutside:function(){h(!1),m(null)},isActive:e,activeAttributes:t,value:n,onChange:o,contentRef:c,focusOnMount:!!g&&"firstElement"})]})}};var Q=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.Path,{d:"M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z"})});const X="core/strikethrough",J=(0,i.__)("Strikethrough"),q={name:X,title:J,tagName:"s",className:null,edit({isActive:e,value:t,onChange:n,onFocus:o}){function a(){n((0,r.toggleFormat)(t,{type:X,title:J})),o()}return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextShortcut,{type:"access",character:"d",onUse:a}),(0,s.jsx)(l.RichTextToolbarButton,{icon:Q,title:J,onClick:a,isActive:e,role:"menuitemcheckbox"})]})}},Y="core/underline",ee=(0,i.__)("Underline"),te={name:Y,title:ee,tagName:"span",className:null,attributes:{style:"style"},edit({value:e,onChange:t}){const n=()=>{t((0,r.toggleFormat)(e,{type:Y,attributes:{style:"text-decoration: underline;"},title:ee}))};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextShortcut,{type:"primary",character:"u",onUse:n}),(0,s.jsx)(l.__unstableRichTextInputEvent,{inputType:"formatUnderline",onInput:n})]})}};var ne=(0,b.forwardRef)((({icon:e,size:t=24,...n},o)=>(0,b.cloneElement)(e,{width:t,height:t,...n,ref:o}))),oe=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.Path,{d:"M12.9 6h-2l-4 11h1.9l1.1-3h4.2l1.1 3h1.9L12.9 6zm-2.5 6.5l1.5-4.9 1.7 4.9h-3.2z"})}),ae=(0,s.jsx)(c.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(c.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"})});const re=window.wp.privateApis,{lock:se,unlock:ie}=(0,re.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/format-library"),{Tabs:le}=ie(f.privateApis),ce=[{name:"color",title:(0,i.__)("Text")},{name:"backgroundColor",title:(0,i.__)("Background")}];function ue(e=""){return e.split(";").reduce(((e,t)=>{if(t){const[n,o]=t.split(":");"color"===n&&(e.color=o),"background-color"===n&&o!==ge&&(e.backgroundColor=o)}return e}),{})}function he(e="",t){return e.split(" ").reduce(((e,n)=>{if(n.startsWith("has-")&&n.endsWith("-color")){const o=n.replace(/^has-/,"").replace(/-color$/,""),a=(0,l.getColorObjectByAttributeValues)(t,o);e.color=a.color}return e}),{})}function pe(e,t,n){const o=(0,r.getActiveFormat)(e,t);return o?{...ue(o.attributes.style),...he(o.attributes.class,n)}:{}}function me({name:e,property:t,value:n,onChange:o}){const a=(0,P.useSelect)((e=>{const{getSettings:t}=e(l.store);return t().colors??[]}),[]),i=(0,b.useMemo)((()=>pe(n,e,a)),[e,n,a]);return(0,s.jsx)(l.ColorPalette,{value:i[t],onChange:s=>{o(function(e,t,n,o){const{color:a,backgroundColor:s}={...pe(e,t,n),...o};if(!a&&!s)return(0,r.removeFormat)(e,t);const i=[],c=[],u={};if(s?i.push(["background-color",s].join(":")):i.push(["background-color",ge].join(":")),a){const e=(0,l.getColorObjectByColorValue)(n,a);e?c.push((0,l.getColorClassName)("color",e.slug)):i.push(["color",a].join(":"))}return i.length&&(u.style=i.join(";")),c.length&&(u.class=c.join(" ")),(0,r.applyFormat)(e,{type:t,attributes:u})}(n,e,a,{[t]:s}))},enableAlpha:!0,__experimentalIsRenderedInSidebar:!0})}function de({name:e,value:t,onChange:n,onClose:o,contentRef:a,isActive:i}){const l=(0,r.useAnchor)({editableContentElement:a.current,settings:{..._e,isActive:i}});return(0,s.jsx)(f.Popover,{onClose:o,className:"format-library__inline-color-popover",anchor:l,children:(0,s.jsxs)(le,{children:[(0,s.jsx)(le.TabList,{children:ce.map((e=>(0,s.jsx)(le.Tab,{tabId:e.name,children:e.title},e.name)))}),ce.map((o=>(0,s.jsx)(le.TabPanel,{tabId:o.name,focusable:!1,children:(0,s.jsx)(me,{name:e,property:o.name,value:t,onChange:n})},o.name)))]})})}const ge="rgba(0, 0, 0, 0)",xe="core/text-color",ve=(0,i.__)("Highlight"),fe=[];function be(e,t){const{ownerDocument:n}=e,{defaultView:o}=n,a=o.getComputedStyle(e).getPropertyValue(t);return"background-color"===t&&a===ge&&e.parentElement?be(e.parentElement,t):a}const _e={name:xe,title:ve,tagName:"mark",className:"has-inline-color",attributes:{style:"style",class:"class"},edit:function({value:e,onChange:t,isActive:n,activeAttributes:o,contentRef:a}){const[i,c=fe]=(0,l.useSettings)("color.custom","color.palette"),[u,h]=(0,b.useState)(!1),p=(0,b.useMemo)((()=>function(e,{color:t,backgroundColor:n}){if(t||n)return{color:t||be(e,"color"),backgroundColor:n===ge?be(e,"background-color"):n}}(a.current,pe(e,xe,c))),[a,e,c]),m=!!c.length||i;return m||n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextToolbarButton,{className:"format-library-text-color-button",isActive:n,icon:(0,s.jsx)(ne,{icon:Object.keys(o).length?oe:ae,style:p}),title:ve,onClick:m?()=>h(!0):()=>t((0,r.removeFormat)(e,xe)),role:"menuitemcheckbox"}),u&&(0,s.jsx)(de,{name:xe,onClose:()=>h(!1),activeAttributes:o,value:e,onChange:t,contentRef:a,isActive:n})]}):null}};var we=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.Path,{d:"M16.9 18.3l.8-1.2c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.1-.3-.4-.5-.6-.7-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.2 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3L15 19.4h4.3v-1.2h-2.4zM14.1 7.2h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"})});const ye="core/subscript",je=(0,i.__)("Subscript"),Ce={name:ye,title:je,tagName:"sub",className:null,edit:({isActive:e,value:t,onChange:n,onFocus:o})=>(0,s.jsx)(l.RichTextToolbarButton,{icon:we,title:je,onClick:function(){n((0,r.toggleFormat)(t,{type:ye,title:je})),o()},isActive:e,role:"menuitemcheckbox"})};var ke=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.Path,{d:"M16.9 10.3l.8-1.3c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.2-.2-.4-.4-.7-.6-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.1 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3l-1.8 2.8h4.3v-1.2h-2.2zm-2.8-3.1h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"})});const Se="core/superscript",Te=(0,i.__)("Superscript"),Ae={name:Se,title:Te,tagName:"sup",className:null,edit:({isActive:e,value:t,onChange:n,onFocus:o})=>(0,s.jsx)(l.RichTextToolbarButton,{icon:ke,title:Te,onClick:function(){n((0,r.toggleFormat)(t,{type:Se,title:Te})),o()},isActive:e,role:"menuitemcheckbox"})};var Ne=(0,s.jsx)(c.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(c.Path,{d:"M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z"})});const Fe="core/keyboard",Me=(0,i.__)("Keyboard input"),Re={name:Fe,title:Me,tagName:"kbd",className:null,edit:({isActive:e,value:t,onChange:n,onFocus:o})=>(0,s.jsx)(l.RichTextToolbarButton,{icon:Ne,title:Me,onClick:function(){n((0,r.toggleFormat)(t,{type:Fe,title:Me})),o()},isActive:e,role:"menuitemcheckbox"})};var Ve=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.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"})});const Pe="core/unknown",Be=(0,i.__)("Clear Unknown Formatting");const Le={name:Pe,title:Be,tagName:"*",className:null,edit({isActive:e,value:t,onChange:n,onFocus:o}){if(!e&&!function(e){return!(0,r.isCollapsed)(e)&&(0,r.slice)(e).formats.some((e=>e.some((e=>e.type===Pe))))}(t))return null;return(0,s.jsx)(l.RichTextToolbarButton,{name:"unknown",icon:Ve,title:Be,onClick:function(){n((0,r.removeFormat)(t,Pe)),o()},isActive:!0})}};var Oe=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.Path,{d:"M17.5 10h-1.7l-3.7 10.5h1.7l.9-2.6h3.9l.9 2.6h1.7L17.5 10zm-2.2 6.3 1.4-4 1.4 4h-2.8zm-4.8-3.8c1.6-1.8 2.9-3.6 3.7-5.7H16V5.2h-5.8V3H8.8v2.2H3v1.5h9.6c-.7 1.6-1.8 3.1-3.1 4.6C8.6 10.2 7.8 9 7.2 8H5.6c.6 1.4 1.7 2.9 2.9 4.4l-2.4 2.4c-.3.4-.7.8-1.1 1.2l1 1 1.2-1.2c.8-.8 1.6-1.5 2.3-2.3.8.9 1.7 1.7 2.5 2.5l.6-1.5c-.7-.6-1.4-1.3-2.1-2z"})});const Ie="core/language",He=(0,i.__)("Language"),ze={name:Ie,tagName:"bdo",className:null,edit:function({isActive:e,value:t,onChange:n,contentRef:o}){const[a,i]=(0,b.useState)(!1),c=()=>{i((e=>!e))};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextToolbarButton,{icon:Oe,label:He,title:He,onClick:()=>{e?n((0,r.removeFormat)(t,Ie)):c()},isActive:e,role:"menuitemcheckbox"}),a&&(0,s.jsx)(Ee,{value:t,onChange:n,onClose:c,contentRef:o})]})},title:He};function Ee({value:e,contentRef:t,onChange:n,onClose:o}){const a=(0,r.useAnchor)({editableContentElement:t.current,settings:ze}),[l,c]=(0,b.useState)(""),[u,h]=(0,b.useState)("ltr");return(0,s.jsx)(f.Popover,{className:"block-editor-format-toolbar__language-popover",anchor:a,onClose:o,children:(0,s.jsxs)(f.__experimentalVStack,{as:"form",spacing:4,className:"block-editor-format-toolbar__language-container-content",onSubmit:t=>{t.preventDefault(),n((0,r.applyFormat)(e,{type:Ie,attributes:{lang:l,dir:u}})),o()},children:[(0,s.jsx)(f.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:He,value:l,onChange:e=>c(e),help:(0,i.__)('A valid language attribute, like "en" or "fr".')}),(0,s.jsx)(f.SelectControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,i.__)("Text direction"),value:u,options:[{label:(0,i.__)("Left to right"),value:"ltr"},{label:(0,i.__)("Right to left"),value:"rtl"}],onChange:e=>h(e)}),(0,s.jsx)(f.__experimentalHStack,{alignment:"right",children:(0,s.jsx)(f.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",text:(0,i.__)("Apply")})})]})})}var Ue=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.Path,{d:"M11.2 6.8c-.7 0-1.4.5-1.6 1.1l-2.8 7.5-1.2-1.8c-.1-.2-.4-.3-.6-.3H3v1.5h1.6l1.2 1.8c.6.9 1.9.7 2.2-.3l2.9-7.9s.1-.2.2-.2h7.8V6.7h-7.8Zm5.3 3.4-1.9 1.9-1.9-1.9-1.1 1.1 1.9 1.9-1.9 1.9 1.1 1.1 1.9-1.9 1.9 1.9 1.1-1.1-1.9-1.9 1.9-1.9-1.1-1.1Z"})});const{Badge:De}=ie(f.privateApis),Ge="core/math",We=(0,i.__)("Math");function Ze({value:e,onChange:t,activeAttributes:n,contentRef:o,latexToMathML:a}){const[l,c]=(0,b.useState)(n?.["data-latex"]||""),[u,h]=(0,b.useState)(null),p=(0,r.useAnchor)({editableContentElement:o.current,settings:$e});return(0,s.jsx)(f.Popover,{placement:"bottom-start",offset:8,focusOnMount:!1,anchor:p,className:"block-editor-format-toolbar__math-popover",children:(0,s.jsx)("div",{style:{minWidth:"300px",padding:"4px"},children:(0,s.jsxs)(f.__experimentalVStack,{spacing:1,children:[(0,s.jsx)(f.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,hideLabelFromVision:!0,label:(0,i.__)("LaTeX math syntax"),value:l,onChange:n=>{let o="";if(c(n),n)try{o=a(n,{displayMode:!1}),h(null)}catch(e){return h(e.message),void(0,V.speak)(e.message)}const r=e.replacements.slice();r[e.start]={type:Ge,attributes:{"data-latex":n},innerHTML:o},t({...e,replacements:r})},placeholder:(0,i.__)("e.g., x^2, \\frac{a}{b}"),autoComplete:"off",className:"block-editor-format-toolbar__math-input"}),u&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(De,{intent:"error",className:"wp-block-math__error",children:u}),(0,s.jsx)("style",{children:".wp-block-math__error .components-badge__content{white-space:normal}"})]})]})})})}const $e={name:Ge,title:We,tagName:"math",className:null,attributes:{"data-latex":"data-latex"},contentEditable:!1,edit:function({value:e,onChange:t,onFocus:n,isObjectActive:o,activeObjectAttributes:i,contentRef:c}){const[u,h]=(0,b.useState)();return(0,b.useEffect)((()=>{Promise.resolve().then(a.t.bind(a,3533,23)).then((e=>{h((()=>e.default))}))}),[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextToolbarButton,{icon:Ue,title:We,onClick:()=>{const o=(0,r.insertObject)(e,{type:Ge,attributes:{"data-latex":""},innerHTML:""});o.start=o.end-1,t(o),n()},isActive:o}),o&&(0,s.jsx)(Ze,{value:e,onChange:t,activeAttributes:i,contentRef:c,latexToMathML:u})]})}},Ke=(0,i.__)("Non breaking space");[m,v,C,N,K,q,te,_e,Ce,Ae,Re,Le,ze,$e,{name:"core/non-breaking-space",title:Ke,tagName:"nbsp",className:null,edit:({value:e,onChange:t})=>(0,s.jsx)(l.RichTextShortcut,{type:"primaryShift",character:" ",onUse:function(){t((0,r.insert)(e," "))}})}].forEach((({name:e,...t})=>(0,r.registerFormatType)(e,t))),(window.wp=window.wp||{}).formatLibrary={}})(); style-engine.js 0000644 00000106176 15151622574 0007530 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { compileCSS: () => (/* binding */ compileCSS), getCSSRules: () => (/* binding */ getCSSRules), getCSSValueFromRawStyle: () => (/* reexport */ getCSSValueFromRawStyle) }); ;// ./node_modules/tslib/tslib.es6.mjs /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { 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); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { 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; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 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]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 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; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; 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); 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); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 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"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 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"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* harmony default export */ const tslib_es6 = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); ;// ./node_modules/lower-case/dist.es2015/index.js /** * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt */ var SUPPORTED_LOCALE = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, az: { regexp: /\u0130/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, lt: { regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, map: { I: "\u0069\u0307", J: "\u006A\u0307", Į: "\u012F\u0307", Ì: "\u0069\u0307\u0300", Í: "\u0069\u0307\u0301", Ĩ: "\u0069\u0307\u0303", }, }, }; /** * Localized lower case. */ function localeLowerCase(str, locale) { var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; if (lang) return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); return lowerCase(str); } /** * Lower case as a function. */ function lowerCase(str) { return str.toLowerCase(); } ;// ./node_modules/no-case/dist.es2015/index.js // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; /** * Normalize the string into something other libraries can manipulate easier. */ function noCase(input, options) { if (options === void 0) { options = {}; } 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; var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; // Trim the delimiter from around the output string. while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; // Transform each token independently. return result.slice(start, end).split("\0").map(transform).join(delimiter); } /** * Replace `re` in the input string with the replacement value. */ function replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } ;// ./node_modules/dot-case/dist.es2015/index.js function dotCase(input, options) { if (options === void 0) { options = {}; } return noCase(input, __assign({ delimiter: "." }, options)); } ;// ./node_modules/param-case/dist.es2015/index.js function paramCase(input, options) { if (options === void 0) { options = {}; } return dotCase(input, __assign({ delimiter: "-" }, options)); } ;// ./node_modules/@wordpress/style-engine/build-module/styles/constants.js const VARIABLE_REFERENCE_PREFIX = "var:"; const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = "|"; const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = "--"; ;// ./node_modules/@wordpress/style-engine/build-module/styles/utils.js const getStyleValueByPath = (object, path) => { let value = object; path.forEach((fieldName) => { value = value?.[fieldName]; }); return value; }; function generateRule(style, options, path, ruleKey) { const styleValue = getStyleValueByPath(style, path); return styleValue ? [ { selector: options?.selector, key: ruleKey, value: getCSSValueFromRawStyle(styleValue) } ] : []; } function generateBoxRules(style, options, path, ruleKeys, individualProperties = ["top", "right", "bottom", "left"]) { const boxStyle = getStyleValueByPath( style, path ); if (!boxStyle) { return []; } const rules = []; if (typeof boxStyle === "string") { rules.push({ selector: options?.selector, key: ruleKeys.default, value: getCSSValueFromRawStyle(boxStyle) }); } else { const sideRules = individualProperties.reduce( (acc, side) => { const value = getCSSValueFromRawStyle( getStyleValueByPath(boxStyle, [side]) ); if (value) { acc.push({ selector: options?.selector, key: ruleKeys?.individual.replace( "%s", upperFirst(side) ), value }); } return acc; }, [] ); rules.push(...sideRules); } return rules; } function getCSSValueFromRawStyle(styleValue) { if (typeof styleValue === "string" && styleValue.startsWith(VARIABLE_REFERENCE_PREFIX)) { const variable = styleValue.slice(VARIABLE_REFERENCE_PREFIX.length).split(VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).map( (presetVariable) => paramCase(presetVariable, { splitRegexp: [ /([a-z0-9])([A-Z])/g, // fooBar => foo-bar, 3Bar => 3-bar /([0-9])([a-z])/g, // 3bar => 3-bar /([A-Za-z])([0-9])/g, // Foo3 => foo-3, foo3 => foo-3 /([A-Z])([A-Z][a-z])/g // FOOBar => foo-bar ] }) ).join(VARIABLE_PATH_SEPARATOR_TOKEN_STYLE); return `var(--wp--${variable})`; } return styleValue; } function upperFirst(string) { const [firstLetter, ...rest] = string; return firstLetter.toUpperCase() + rest.join(""); } function camelCaseJoin(strings) { const [firstItem, ...rest] = strings; return firstItem.toLowerCase() + rest.map(upperFirst).join(""); } function safeDecodeURI(uri) { try { return decodeURI(uri); } catch (uriError) { return uri; } } ;// ./node_modules/@wordpress/style-engine/build-module/styles/border/index.js function createBorderGenerateFunction(path) { return (style, options) => generateRule(style, options, path, camelCaseJoin(path)); } function createBorderEdgeGenerateFunction(edge) { return (style, options) => { return ["color", "style", "width"].flatMap((key) => { const path = ["border", edge, key]; return createBorderGenerateFunction(path)(style, options); }); }; } const color = { name: "color", generate: createBorderGenerateFunction(["border", "color"]) }; const radius = { name: "radius", generate: (style, options) => { return generateBoxRules( style, options, ["border", "radius"], { default: "borderRadius", individual: "border%sRadius" }, ["topLeft", "topRight", "bottomLeft", "bottomRight"] ); } }; const borderStyle = { name: "style", generate: createBorderGenerateFunction(["border", "style"]) }; const width = { name: "width", generate: createBorderGenerateFunction(["border", "width"]) }; const borderTop = { name: "borderTop", generate: createBorderEdgeGenerateFunction("top") }; const borderRight = { name: "borderRight", generate: createBorderEdgeGenerateFunction("right") }; const borderBottom = { name: "borderBottom", generate: createBorderEdgeGenerateFunction("bottom") }; const borderLeft = { name: "borderLeft", generate: createBorderEdgeGenerateFunction("left") }; var border_default = [ color, borderStyle, width, radius, borderTop, borderRight, borderBottom, borderLeft ]; ;// ./node_modules/@wordpress/style-engine/build-module/styles/color/background.js const background = { name: "background", generate: (style, options) => { return generateRule( style, options, ["color", "background"], "backgroundColor" ); } }; var background_default = background; ;// ./node_modules/@wordpress/style-engine/build-module/styles/color/gradient.js const gradient = { name: "gradient", generate: (style, options) => { return generateRule( style, options, ["color", "gradient"], "background" ); } }; var gradient_default = gradient; ;// ./node_modules/@wordpress/style-engine/build-module/styles/color/text.js const text_text = { name: "text", generate: (style, options) => { return generateRule(style, options, ["color", "text"], "color"); } }; var text_default = text_text; ;// ./node_modules/@wordpress/style-engine/build-module/styles/color/index.js var color_default = [text_default, gradient_default, background_default]; ;// ./node_modules/@wordpress/style-engine/build-module/styles/dimensions/index.js const minHeight = { name: "minHeight", generate: (style, options) => { return generateRule( style, options, ["dimensions", "minHeight"], "minHeight" ); } }; const aspectRatio = { name: "aspectRatio", generate: (style, options) => { return generateRule( style, options, ["dimensions", "aspectRatio"], "aspectRatio" ); } }; var dimensions_default = [minHeight, aspectRatio]; ;// ./node_modules/@wordpress/style-engine/build-module/styles/background/index.js const backgroundImage = { name: "backgroundImage", generate: (style, options) => { const _backgroundImage = style?.background?.backgroundImage; if (typeof _backgroundImage === "object" && _backgroundImage?.url) { return [ { selector: options.selector, key: "backgroundImage", // Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string. value: `url( '${encodeURI( safeDecodeURI(_backgroundImage.url) )}' )` } ]; } return generateRule( style, options, ["background", "backgroundImage"], "backgroundImage" ); } }; const backgroundPosition = { name: "backgroundPosition", generate: (style, options) => { return generateRule( style, options, ["background", "backgroundPosition"], "backgroundPosition" ); } }; const backgroundRepeat = { name: "backgroundRepeat", generate: (style, options) => { return generateRule( style, options, ["background", "backgroundRepeat"], "backgroundRepeat" ); } }; const backgroundSize = { name: "backgroundSize", generate: (style, options) => { return generateRule( style, options, ["background", "backgroundSize"], "backgroundSize" ); } }; const backgroundAttachment = { name: "backgroundAttachment", generate: (style, options) => { return generateRule( style, options, ["background", "backgroundAttachment"], "backgroundAttachment" ); } }; var background_background_default = [ backgroundImage, backgroundPosition, backgroundRepeat, backgroundSize, backgroundAttachment ]; ;// ./node_modules/@wordpress/style-engine/build-module/styles/shadow/index.js const shadow = { name: "shadow", generate: (style, options) => { return generateRule(style, options, ["shadow"], "boxShadow"); } }; var shadow_default = [shadow]; ;// ./node_modules/@wordpress/style-engine/build-module/styles/outline/index.js const outline_color = { name: "color", generate: (style, options, path = ["outline", "color"], ruleKey = "outlineColor") => { return generateRule(style, options, path, ruleKey); } }; const offset = { name: "offset", generate: (style, options, path = ["outline", "offset"], ruleKey = "outlineOffset") => { return generateRule(style, options, path, ruleKey); } }; const outlineStyle = { name: "style", generate: (style, options, path = ["outline", "style"], ruleKey = "outlineStyle") => { return generateRule(style, options, path, ruleKey); } }; const outline_width = { name: "width", generate: (style, options, path = ["outline", "width"], ruleKey = "outlineWidth") => { return generateRule(style, options, path, ruleKey); } }; var outline_default = [outline_color, outlineStyle, offset, outline_width]; ;// ./node_modules/@wordpress/style-engine/build-module/styles/spacing/padding.js const padding = { name: "padding", generate: (style, options) => { return generateBoxRules(style, options, ["spacing", "padding"], { default: "padding", individual: "padding%s" }); } }; var padding_default = padding; ;// ./node_modules/@wordpress/style-engine/build-module/styles/spacing/margin.js const margin = { name: "margin", generate: (style, options) => { return generateBoxRules(style, options, ["spacing", "margin"], { default: "margin", individual: "margin%s" }); } }; var margin_default = margin; ;// ./node_modules/@wordpress/style-engine/build-module/styles/spacing/index.js var spacing_default = [margin_default, padding_default]; ;// ./node_modules/@wordpress/style-engine/build-module/styles/typography/index.js const fontSize = { name: "fontSize", generate: (style, options) => { return generateRule( style, options, ["typography", "fontSize"], "fontSize" ); } }; const fontStyle = { name: "fontStyle", generate: (style, options) => { return generateRule( style, options, ["typography", "fontStyle"], "fontStyle" ); } }; const fontWeight = { name: "fontWeight", generate: (style, options) => { return generateRule( style, options, ["typography", "fontWeight"], "fontWeight" ); } }; const fontFamily = { name: "fontFamily", generate: (style, options) => { return generateRule( style, options, ["typography", "fontFamily"], "fontFamily" ); } }; const letterSpacing = { name: "letterSpacing", generate: (style, options) => { return generateRule( style, options, ["typography", "letterSpacing"], "letterSpacing" ); } }; const lineHeight = { name: "lineHeight", generate: (style, options) => { return generateRule( style, options, ["typography", "lineHeight"], "lineHeight" ); } }; const textColumns = { name: "textColumns", generate: (style, options) => { return generateRule( style, options, ["typography", "textColumns"], "columnCount" ); } }; const textDecoration = { name: "textDecoration", generate: (style, options) => { return generateRule( style, options, ["typography", "textDecoration"], "textDecoration" ); } }; const textTransform = { name: "textTransform", generate: (style, options) => { return generateRule( style, options, ["typography", "textTransform"], "textTransform" ); } }; const writingMode = { name: "writingMode", generate: (style, options) => { return generateRule( style, options, ["typography", "writingMode"], "writingMode" ); } }; var typography_default = [ fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textColumns, textDecoration, textTransform, writingMode ]; ;// ./node_modules/@wordpress/style-engine/build-module/styles/index.js const styleDefinitions = [ ...border_default, ...color_default, ...dimensions_default, ...outline_default, ...spacing_default, ...typography_default, ...shadow_default, ...background_background_default ]; ;// ./node_modules/@wordpress/style-engine/build-module/index.js function compileCSS(style, options = {}) { const rules = getCSSRules(style, options); if (!options?.selector) { const inlineRules = []; rules.forEach((rule) => { inlineRules.push(`${paramCase(rule.key)}: ${rule.value};`); }); return inlineRules.join(" "); } const groupedRules = rules.reduce( (acc, rule) => { const { selector } = rule; if (!selector) { return acc; } if (!acc[selector]) { acc[selector] = []; } acc[selector].push(rule); return acc; }, {} ); const selectorRules = Object.keys(groupedRules).reduce( (acc, subSelector) => { acc.push( `${subSelector} { ${groupedRules[subSelector].map( (rule) => `${paramCase(rule.key)}: ${rule.value};` ).join(" ")} }` ); return acc; }, [] ); return selectorRules.join("\n"); } function getCSSRules(style, options = {}) { const rules = []; styleDefinitions.forEach((definition) => { if (typeof definition.generate === "function") { rules.push(...definition.generate(style, options)); } }); return rules; } (window.wp = window.wp || {}).styleEngine = __webpack_exports__; /******/ })() ; preferences.js 0000644 00000050421 15151622574 0007415 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { PreferenceToggleMenuItem: () => (/* reexport */ PreferenceToggleMenuItem), privateApis: () => (/* reexport */ privateApis), store: () => (/* reexport */ store) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/preferences/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { set: () => (set), setDefaults: () => (setDefaults), setPersistenceLayer: () => (setPersistenceLayer), toggle: () => (toggle) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/preferences/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { get: () => (get) }); ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// ./node_modules/@wordpress/icons/build-module/library/check.js var check_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) }); ;// external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// ./node_modules/@wordpress/preferences/build-module/store/reducer.js function defaults(state = {}, action) { if (action.type === "SET_PREFERENCE_DEFAULTS") { const { scope, defaults: values } = action; return { ...state, [scope]: { ...state[scope], ...values } }; } return state; } function withPersistenceLayer(reducer) { let persistenceLayer; return (state, action) => { if (action.type === "SET_PERSISTENCE_LAYER") { const { persistenceLayer: persistence, persistedData } = action; persistenceLayer = persistence; return persistedData; } const nextState = reducer(state, action); if (action.type === "SET_PREFERENCE_VALUE") { persistenceLayer?.set(nextState); } return nextState; }; } const preferences = withPersistenceLayer((state = {}, action) => { if (action.type === "SET_PREFERENCE_VALUE") { const { scope, name, value } = action; return { ...state, [scope]: { ...state[scope], [name]: value } }; } return state; }); var reducer_default = (0,external_wp_data_namespaceObject.combineReducers)({ defaults, preferences }); ;// ./node_modules/@wordpress/preferences/build-module/store/actions.js function toggle(scope, name) { return function({ select, dispatch }) { const currentValue = select.get(scope, name); dispatch.set(scope, name, !currentValue); }; } function set(scope, name, value) { return { type: "SET_PREFERENCE_VALUE", scope, name, value }; } function setDefaults(scope, defaults) { return { type: "SET_PREFERENCE_DEFAULTS", scope, defaults }; } async function setPersistenceLayer(persistenceLayer) { const persistedData = await persistenceLayer.get(); return { type: "SET_PERSISTENCE_LAYER", persistenceLayer, persistedData }; } ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); ;// ./node_modules/@wordpress/preferences/build-module/store/selectors.js const withDeprecatedKeys = (originalGet) => (state, scope, name) => { const settingsToMoveToCore = [ "allowRightClickOverrides", "distractionFree", "editorMode", "fixedToolbar", "focusMode", "hiddenBlockTypes", "inactivePanels", "keepCaretInsideBlock", "mostUsedBlocks", "openPanels", "showBlockBreadcrumbs", "showIconLabels", "showListViewByDefault", "isPublishSidebarEnabled", "isComplementaryAreaVisible", "pinnedItems" ]; if (settingsToMoveToCore.includes(name) && ["core/edit-post", "core/edit-site"].includes(scope)) { external_wp_deprecated_default()( `wp.data.select( 'core/preferences' ).get( '${scope}', '${name}' )`, { since: "6.5", alternative: `wp.data.select( 'core/preferences' ).get( 'core', '${name}' )` } ); return originalGet(state, "core", name); } return originalGet(state, scope, name); }; const get = withDeprecatedKeys((state, scope, name) => { const value = state.preferences[scope]?.[name]; return value !== void 0 ? value : state.defaults[scope]?.[name]; }); ;// ./node_modules/@wordpress/preferences/build-module/store/constants.js const STORE_NAME = "core/preferences"; ;// ./node_modules/@wordpress/preferences/build-module/store/index.js const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { reducer: reducer_default, actions: actions_namespaceObject, selectors: selectors_namespaceObject }); (0,external_wp_data_namespaceObject.register)(store); ;// ./node_modules/@wordpress/preferences/build-module/components/preference-toggle-menu-item/index.js function PreferenceToggleMenuItem({ scope, name, label, info, messageActivated, messageDeactivated, shortcut, handleToggling = true, onToggle = () => null, disabled = false }) { const isActive = (0,external_wp_data_namespaceObject.useSelect)( (select) => !!select(store).get(scope, name), [scope, name] ); const { toggle } = (0,external_wp_data_namespaceObject.useDispatch)(store); const speakMessage = () => { if (isActive) { const message = messageDeactivated || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: preference name, e.g. 'Fullscreen mode' */ (0,external_wp_i18n_namespaceObject.__)("Preference deactivated - %s"), label ); (0,external_wp_a11y_namespaceObject.speak)(message); } else { const message = messageActivated || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: preference name, e.g. 'Fullscreen mode' */ (0,external_wp_i18n_namespaceObject.__)("Preference activated - %s"), label ); (0,external_wp_a11y_namespaceObject.speak)(message); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: isActive && check_default, isSelected: isActive, onClick: () => { onToggle(); if (handleToggling) { toggle(scope, name); } speakMessage(); }, role: "menuitemcheckbox", info, shortcut, disabled, children: label } ); } ;// ./node_modules/@wordpress/preferences/build-module/components/index.js ;// ./node_modules/@wordpress/preferences/build-module/components/preference-base-option/index.js function BaseOption({ help, label, isChecked, onChange, children }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "preference-base-option", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, help, label, checked: isChecked, onChange } ), children ] }); } var preference_base_option_default = BaseOption; ;// ./node_modules/@wordpress/preferences/build-module/components/preference-toggle-control/index.js function PreferenceToggleControl(props) { const { scope, featureName, onToggle = () => { }, ...remainingProps } = props; const isChecked = (0,external_wp_data_namespaceObject.useSelect)( (select) => !!select(store).get(scope, featureName), [scope, featureName] ); const { toggle } = (0,external_wp_data_namespaceObject.useDispatch)(store); const onChange = () => { onToggle(); toggle(scope, featureName); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( preference_base_option_default, { onChange, isChecked, ...remainingProps } ); } var preference_toggle_control_default = PreferenceToggleControl; ;// ./node_modules/@wordpress/preferences/build-module/components/preferences-modal/index.js function PreferencesModal({ closeModal, children }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { className: "preferences-modal", title: (0,external_wp_i18n_namespaceObject.__)("Preferences"), onRequestClose: closeModal, children } ); } ;// ./node_modules/@wordpress/preferences/build-module/components/preferences-modal-section/index.js const Section = ({ description, title, children }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "preferences-modal__section", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("legend", { className: "preferences-modal__section-legend", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "preferences-modal__section-title", children: title }), description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "preferences-modal__section-description", children: description }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "preferences-modal__section-content", children }) ] }); var preferences_modal_section_default = Section; ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// ./node_modules/@wordpress/icons/build-module/icon/index.js var icon_default = (0,external_wp_element_namespaceObject.forwardRef)( ({ icon, size = 24, ...props }, ref) => { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { width: size, height: size, ...props, ref }); } ); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left.js var chevron_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right.js var chevron_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/preferences/build-module/lock-unlock.js const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/preferences" ); ;// ./node_modules/@wordpress/preferences/build-module/components/preferences-modal-tabs/index.js const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis); const PREFERENCES_MENU = "preferences-menu"; function PreferencesModalTabs({ sections }) { const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); const [activeMenu, setActiveMenu] = (0,external_wp_element_namespaceObject.useState)(PREFERENCES_MENU); const { tabs, sectionsContentMap } = (0,external_wp_element_namespaceObject.useMemo)(() => { let mappedTabs = { tabs: [], sectionsContentMap: {} }; if (sections.length) { mappedTabs = sections.reduce( (accumulator, { name, tabLabel: title, content }) => { accumulator.tabs.push({ name, title }); accumulator.sectionsContentMap[name] = content; return accumulator; }, { tabs: [], sectionsContentMap: {} } ); } return mappedTabs; }, [sections]); let modalContent; if (isLargeViewport) { modalContent = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "preferences__tabs", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( Tabs, { defaultTabId: activeMenu !== PREFERENCES_MENU ? activeMenu : void 0, onSelect: setActiveMenu, orientation: "vertical", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabList, { className: "preferences__tabs-tablist", children: tabs.map((tab) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Tabs.Tab, { tabId: tab.name, className: "preferences__tabs-tab", children: tab.title }, tab.name )) }), tabs.map((tab) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Tabs.TabPanel, { tabId: tab.name, className: "preferences__tabs-tabpanel", focusable: false, children: sectionsContentMap[tab.name] || null }, tab.name )) ] } ) }); } else { modalContent = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator, { initialPath: "/", className: "preferences__provider", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { isBorderless: true, size: "small", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: tabs.map((tab) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Navigator.Button, { path: `/${tab.name}`, as: external_wp_components_namespaceObject.__experimentalItem, isAction: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { children: tab.title }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default } ) }) ] }) }, tab.name ); }) }) }) }) }), sections.length && sections.map((section) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Navigator.Screen, { path: `/${section.name}`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Card, { isBorderless: true, size: "large", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.CardHeader, { isBorderless: false, justify: "left", size: "small", gap: "6", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Navigator.BackButton, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, label: (0,external_wp_i18n_namespaceObject.__)("Back") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { size: "16", children: section.tabLabel }) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { children: section.content }) ] }) }, `${section.name}-menu` ); }) ] }); } return modalContent; } ;// ./node_modules/@wordpress/preferences/build-module/private-apis.js const privateApis = {}; lock(privateApis, { PreferenceBaseOption: preference_base_option_default, PreferenceToggleControl: preference_toggle_control_default, PreferencesModal: PreferencesModal, PreferencesModalSection: preferences_modal_section_default, PreferencesModalTabs: PreferencesModalTabs }); ;// ./node_modules/@wordpress/preferences/build-module/index.js (window.wp = window.wp || {}).preferences = __webpack_exports__; /******/ })() ; blob.min.js 0000604 00000002124 15151622574 0006605 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={d:(o,t)=>{for(var n in t)e.o(t,n)&&!e.o(o,n)&&Object.defineProperty(o,n,{enumerable:!0,get:t[n]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{createBlobURL:()=>n,downloadBlob:()=>c,getBlobByURL:()=>r,getBlobTypeByURL:()=>d,isBlobURL:()=>l,revokeBlobURL:()=>i});const t={};function n(e){const o=window.URL.createObjectURL(e);return t[o]=e,o}function r(e){return t[e]}function d(e){return r(e)?.type.split("/")[0]}function i(e){t[e]&&window.URL.revokeObjectURL(e),delete t[e]}function l(e){return!(!e||!e.indexOf)&&0===e.indexOf("blob:")}function c(e,o,t=""){if(!e||!o)return;const n=new window.Blob([o],{type:t}),r=window.URL.createObjectURL(n),d=document.createElement("a");d.href=r,d.download=e,d.style.display="none",document.body.appendChild(d),d.click(),document.body.removeChild(d),window.URL.revokeObjectURL(r)}(window.wp=window.wp||{}).blob=o})(); patterns.js 0000644 00000170500 15151622574 0006755 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { privateApis: () => (/* reexport */ privateApis), store: () => (/* reexport */ store) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/patterns/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { convertSyncedPatternToStatic: () => (convertSyncedPatternToStatic), createPattern: () => (createPattern), createPatternFromFile: () => (createPatternFromFile), setEditingPattern: () => (setEditingPattern) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/patterns/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { isEditingPattern: () => (selectors_isEditingPattern) }); ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// ./node_modules/@wordpress/patterns/build-module/store/reducer.js function isEditingPattern(state = {}, action) { if (action?.type === "SET_EDITING_PATTERN") { return { ...state, [action.clientId]: action.isEditing }; } return state; } var reducer_default = (0,external_wp_data_namespaceObject.combineReducers)({ isEditingPattern }); ;// external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// external ["wp","coreData"] const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; ;// external ["wp","blockEditor"] const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; ;// ./node_modules/@wordpress/patterns/build-module/constants.js const PATTERN_TYPES = { theme: "pattern", user: "wp_block" }; const PATTERN_DEFAULT_CATEGORY = "all-patterns"; const PATTERN_USER_CATEGORY = "my-patterns"; const EXCLUDED_PATTERN_SOURCES = [ "core", "pattern-directory/core", "pattern-directory/featured" ]; const PATTERN_SYNC_TYPES = { full: "fully", unsynced: "unsynced" }; const PARTIAL_SYNCING_SUPPORTED_BLOCKS = { "core/paragraph": ["content"], "core/heading": ["content"], "core/button": ["text", "url", "linkTarget", "rel"], "core/image": ["id", "url", "title", "alt", "caption"] }; const PATTERN_OVERRIDES_BINDING_SOURCE = "core/pattern-overrides"; ;// ./node_modules/@wordpress/patterns/build-module/store/actions.js const createPattern = (title, syncType, content, categories) => async ({ registry }) => { const meta = syncType === PATTERN_SYNC_TYPES.unsynced ? { wp_pattern_sync_status: syncType } : void 0; const reusableBlock = { title, content, status: "publish", meta, wp_pattern_category: categories }; const updatedRecord = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord("postType", "wp_block", reusableBlock); return updatedRecord; }; const createPatternFromFile = (file, categories) => async ({ dispatch }) => { const fileContent = await file.text(); let parsedContent; try { parsedContent = JSON.parse(fileContent); } catch (e) { throw new Error("Invalid JSON file"); } if (parsedContent.__file !== "wp_block" || !parsedContent.title || !parsedContent.content || typeof parsedContent.title !== "string" || typeof parsedContent.content !== "string" || parsedContent.syncStatus && typeof parsedContent.syncStatus !== "string") { throw new Error("Invalid pattern JSON file"); } const pattern = await dispatch.createPattern( parsedContent.title, parsedContent.syncStatus, parsedContent.content, categories ); return pattern; }; const convertSyncedPatternToStatic = (clientId) => ({ registry }) => { const patternBlock = registry.select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId); const existingOverrides = patternBlock.attributes?.content; function cloneBlocksAndRemoveBindings(blocks) { return blocks.map((block) => { let metadata = block.attributes.metadata; if (metadata) { metadata = { ...metadata }; delete metadata.id; delete metadata.bindings; if (existingOverrides?.[metadata.name]) { for (const [attributeName, value] of Object.entries( existingOverrides[metadata.name] )) { if (!(0,external_wp_blocks_namespaceObject.getBlockType)(block.name)?.attributes[attributeName]) { continue; } block.attributes[attributeName] = value; } } } return (0,external_wp_blocks_namespaceObject.cloneBlock)( block, { metadata: metadata && Object.keys(metadata).length > 0 ? metadata : void 0 }, cloneBlocksAndRemoveBindings(block.innerBlocks) ); }); } const patternInnerBlocks = registry.select(external_wp_blockEditor_namespaceObject.store).getBlocks(patternBlock.clientId); registry.dispatch(external_wp_blockEditor_namespaceObject.store).replaceBlocks( patternBlock.clientId, cloneBlocksAndRemoveBindings(patternInnerBlocks) ); }; function setEditingPattern(clientId, isEditing) { return { type: "SET_EDITING_PATTERN", clientId, isEditing }; } ;// ./node_modules/@wordpress/patterns/build-module/store/constants.js const STORE_NAME = "core/patterns"; ;// ./node_modules/@wordpress/patterns/build-module/store/selectors.js function selectors_isEditingPattern(state, clientId) { return state.isEditingPattern[clientId]; } ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/patterns/build-module/lock-unlock.js const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/patterns" ); ;// ./node_modules/@wordpress/patterns/build-module/store/index.js const storeConfig = { reducer: reducer_default }; const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { ...storeConfig }); (0,external_wp_data_namespaceObject.register)(store); unlock(store).registerPrivateActions(actions_namespaceObject); unlock(store).registerPrivateSelectors(selectors_namespaceObject); ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// ./node_modules/@wordpress/patterns/build-module/api/index.js function isOverridableBlock(block) { return Object.keys(PARTIAL_SYNCING_SUPPORTED_BLOCKS).includes( block.name ) && !!block.attributes.metadata?.name && !!block.attributes.metadata?.bindings && Object.values(block.attributes.metadata.bindings).some( (binding) => binding.source === "core/pattern-overrides" ); } function hasOverridableBlocks(blocks) { return blocks.some((block) => { if (isOverridableBlock(block)) { return true; } return hasOverridableBlocks(block.innerBlocks); }); } ;// ./node_modules/@wordpress/patterns/build-module/components/overrides-panel.js const { BlockQuickNavigation } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function OverridesPanel() { const allClientIds = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_blockEditor_namespaceObject.store).getClientIdsWithDescendants(), [] ); const { getBlock } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const clientIdsWithOverrides = (0,external_wp_element_namespaceObject.useMemo)( () => allClientIds.filter((clientId) => { const block = getBlock(clientId); return isOverridableBlock(block); }), [allClientIds, getBlock] ); if (!clientIdsWithOverrides?.length) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Overrides"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockQuickNavigation, { clientIds: clientIdsWithOverrides }) }); } ;// external ["wp","notices"] const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","htmlEntities"] const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; ;// ./node_modules/@wordpress/patterns/build-module/components/category-selector.js const unescapeString = (arg) => { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(arg); }; const CATEGORY_SLUG = "wp_pattern_category"; function CategorySelector({ categoryTerms, onChange, categoryMap }) { const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(""); const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 500); const suggestions = (0,external_wp_element_namespaceObject.useMemo)(() => { return Array.from(categoryMap.values()).map((category) => unescapeString(category.label)).filter((category) => { if (search !== "") { return category.toLowerCase().includes(search.toLowerCase()); } return true; }).sort((a, b) => a.localeCompare(b)); }, [search, categoryMap]); function handleChange(termNames) { const uniqueTerms = termNames.reduce((terms, newTerm) => { if (!terms.some( (term) => term.toLowerCase() === newTerm.toLowerCase() )) { terms.push(newTerm); } return terms; }, []); onChange(uniqueTerms); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FormTokenField, { className: "patterns-menu-items__convert-modal-categories", value: categoryTerms, suggestions, onChange: handleChange, onInputChange: debouncedSearch, label: (0,external_wp_i18n_namespaceObject.__)("Categories"), tokenizeOnBlur: true, __experimentalExpandOnFocus: true, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true } ); } ;// ./node_modules/@wordpress/patterns/build-module/private-hooks.js function useAddPatternCategory() { const { saveEntityRecord, invalidateResolution } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { corePatternCategories, userPatternCategories } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getUserPatternCategories, getBlockPatternCategories } = select(external_wp_coreData_namespaceObject.store); return { corePatternCategories: getBlockPatternCategories(), userPatternCategories: getUserPatternCategories() }; }, [] ); const categoryMap = (0,external_wp_element_namespaceObject.useMemo)(() => { const uniqueCategories = /* @__PURE__ */ new Map(); userPatternCategories.forEach((category) => { uniqueCategories.set(category.label.toLowerCase(), { label: category.label, name: category.name, id: category.id }); }); corePatternCategories.forEach((category) => { if (!uniqueCategories.has(category.label.toLowerCase()) && // There are two core categories with `Post` label so explicitly remove the one with // the `query` slug to avoid any confusion. category.name !== "query") { uniqueCategories.set(category.label.toLowerCase(), { label: category.label, name: category.name }); } }); return uniqueCategories; }, [userPatternCategories, corePatternCategories]); async function findOrCreateTerm(term) { try { const existingTerm = categoryMap.get(term.toLowerCase()); if (existingTerm?.id) { return existingTerm.id; } const termData = existingTerm ? { name: existingTerm.label, slug: existingTerm.name } : { name: term }; const newTerm = await saveEntityRecord( "taxonomy", CATEGORY_SLUG, termData, { throwOnError: true } ); invalidateResolution("getUserPatternCategories"); return newTerm.id; } catch (error) { if (error.code !== "term_exists") { throw error; } return error.data.term_id; } } return { categoryMap, findOrCreateTerm }; } ;// ./node_modules/@wordpress/patterns/build-module/components/create-pattern-modal.js function CreatePatternModal({ className = "patterns-menu-items__convert-modal", modalTitle, ...restProps }) { const defaultModalTitle = (0,external_wp_data_namespaceObject.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getPostType(PATTERN_TYPES.user)?.labels?.add_new_item, [] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: modalTitle || defaultModalTitle, onRequestClose: restProps.onClose, overlayClassName: className, focusOnMount: "firstContentElement", size: "small", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CreatePatternModalContents, { ...restProps }) } ); } function CreatePatternModalContents({ confirmLabel = (0,external_wp_i18n_namespaceObject.__)("Add"), defaultCategories = [], content, onClose, onError, onSuccess, defaultSyncType = PATTERN_SYNC_TYPES.full, defaultTitle = "" }) { const [syncType, setSyncType] = (0,external_wp_element_namespaceObject.useState)(defaultSyncType); const [categoryTerms, setCategoryTerms] = (0,external_wp_element_namespaceObject.useState)(defaultCategories); const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(defaultTitle); const [isSaving, setIsSaving] = (0,external_wp_element_namespaceObject.useState)(false); const { createPattern } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { categoryMap, findOrCreateTerm } = useAddPatternCategory(); async function onCreate(patternTitle, sync) { if (!title || isSaving) { return; } try { setIsSaving(true); const categories = await Promise.all( categoryTerms.map( (termName) => findOrCreateTerm(termName) ) ); const newPattern = await createPattern( patternTitle, sync, typeof content === "function" ? content() : content, categories ); onSuccess({ pattern: newPattern, categoryId: PATTERN_DEFAULT_CATEGORY }); } catch (error) { createErrorNotice(error.message, { type: "snackbar", id: "pattern-create" }); onError?.(); } finally { setIsSaving(false); setCategoryTerms([]); setTitle(""); } } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "form", { onSubmit: (event) => { event.preventDefault(); onCreate(title, syncType); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { label: (0,external_wp_i18n_namespaceObject.__)("Name"), value: title, onChange: setTitle, placeholder: (0,external_wp_i18n_namespaceObject.__)("My pattern"), className: "patterns-create-modal__name-input", __nextHasNoMarginBottom: true, __next40pxDefaultSize: true } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CategorySelector, { categoryTerms, onChange: setCategoryTerms, categoryMap } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject._x)("Synced", "pattern (singular)"), help: (0,external_wp_i18n_namespaceObject.__)( "Sync this pattern across multiple locations." ), checked: syncType === PATTERN_SYNC_TYPES.full, onChange: () => { setSyncType( syncType === PATTERN_SYNC_TYPES.full ? PATTERN_SYNC_TYPES.unsynced : PATTERN_SYNC_TYPES.full ); } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => { onClose(); setTitle(""); }, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", "aria-disabled": !title || isSaving, isBusy: isSaving, children: confirmLabel } ) ] }) ] }) } ); } ;// ./node_modules/@wordpress/patterns/build-module/components/duplicate-pattern-modal.js function getTermLabels(pattern, categories) { if (pattern.type !== PATTERN_TYPES.user) { return categories.core?.filter( (category) => pattern.categories?.includes(category.name) ).map((category) => category.label); } return categories.user?.filter( (category) => pattern.wp_pattern_category?.includes(category.id) ).map((category) => category.label); } function useDuplicatePatternProps({ pattern, onSuccess }) { const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const categories = (0,external_wp_data_namespaceObject.useSelect)((select) => { const { getUserPatternCategories, getBlockPatternCategories } = select(external_wp_coreData_namespaceObject.store); return { core: getBlockPatternCategories(), user: getUserPatternCategories() }; }); if (!pattern) { return null; } return { content: pattern.content, defaultCategories: getTermLabels(pattern, categories), defaultSyncType: pattern.type !== PATTERN_TYPES.user ? PATTERN_SYNC_TYPES.unsynced : pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full, defaultTitle: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Existing pattern title */ (0,external_wp_i18n_namespaceObject._x)("%s (Copy)", "pattern"), typeof pattern.title === "string" ? pattern.title : pattern.title.raw ), onSuccess: ({ pattern: newPattern }) => { createSuccessNotice( (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The new pattern's title e.g. 'Call to action (copy)'. (0,external_wp_i18n_namespaceObject._x)('"%s" duplicated.', "pattern"), newPattern.title.raw ), { type: "snackbar", id: "patterns-create" } ); onSuccess?.({ pattern: newPattern }); } }; } function DuplicatePatternModal({ pattern, onClose, onSuccess }) { const duplicatedProps = useDuplicatePatternProps({ pattern, onSuccess }); if (!pattern) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CreatePatternModal, { modalTitle: (0,external_wp_i18n_namespaceObject.__)("Duplicate pattern"), confirmLabel: (0,external_wp_i18n_namespaceObject.__)("Duplicate"), onClose, onError: onClose, ...duplicatedProps } ); } ;// ./node_modules/@wordpress/patterns/build-module/components/rename-pattern-modal.js function RenamePatternModal({ onClose, onError, onSuccess, pattern, ...props }) { const originalName = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(pattern.title); const [name, setName] = (0,external_wp_element_namespaceObject.useState)(originalName); const [isSaving, setIsSaving] = (0,external_wp_element_namespaceObject.useState)(false); const { editEntityRecord, __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const onRename = async (event) => { event.preventDefault(); if (!name || name === pattern.title || isSaving) { return; } try { await editEntityRecord("postType", pattern.type, pattern.id, { title: name }); setIsSaving(true); setName(""); onClose?.(); const savedRecord = await saveSpecifiedEntityEdits( "postType", pattern.type, pattern.id, ["title"], { throwOnError: true } ); onSuccess?.(savedRecord); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Pattern renamed"), { type: "snackbar", id: "pattern-update" }); } catch (error) { onError?.(); const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while renaming the pattern."); createErrorNotice(errorMessage, { type: "snackbar", id: "pattern-update" }); } finally { setIsSaving(false); setName(""); } }; const onRequestClose = () => { onClose?.(); setName(""); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Rename"), ...props, onRequestClose: onClose, focusOnMount: "firstContentElement", size: "small", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onRename, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Name"), value: name, onChange: setName, required: true } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: onRequestClose, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", children: (0,external_wp_i18n_namespaceObject.__)("Save") } ) ] }) ] }) }) } ); } ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js var symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); ;// ./node_modules/@wordpress/patterns/build-module/components/pattern-convert-button.js function PatternConvertButton({ clientIds, rootClientId, closeBlockSettingsMenu }) { const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { replaceBlocks, updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { setEditingPattern } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); const { getBlockAttributes } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const canConvert = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { canUser } = select(external_wp_coreData_namespaceObject.store); const { getBlocksByClientId: getBlocksByClientId2, canInsertBlockType, getBlockRootClientId } = select(external_wp_blockEditor_namespaceObject.store); const rootId = rootClientId || (clientIds.length > 0 ? getBlockRootClientId(clientIds[0]) : void 0); const blocks = getBlocksByClientId2(clientIds) ?? []; const hasReusableBlockSupport = (blockName) => { const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); const hasParent = blockType && "parent" in blockType; return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "reusable", !hasParent); }; const isSyncedPattern = blocks.length === 1 && blocks[0] && (0,external_wp_blocks_namespaceObject.isReusableBlock)(blocks[0]) && !!select(external_wp_coreData_namespaceObject.store).getEntityRecord( "postType", "wp_block", blocks[0].attributes.ref ); const isUnsyncedPattern = window?.__experimentalContentOnlyPatternInsertion && blocks.length === 1 && blocks?.[0]?.attributes?.metadata?.patternName; const _canConvert = ( // Hide when this is already a pattern. !isUnsyncedPattern && !isSyncedPattern && // Hide when patterns are disabled. canInsertBlockType("core/block", rootId) && blocks.every( (block) => ( // Guard against the case where a regular block has *just* been converted. !!block && // Hide on invalid blocks. block.isValid && // Hide when block doesn't support being made into a pattern. hasReusableBlockSupport(block.name) ) ) && // Hide when current doesn't have permission to do that. // Blocks refers to the wp_block post type, this checks the ability to create a post of that type. !!canUser("create", { kind: "postType", name: "wp_block" }) ); return _canConvert; }, [clientIds, rootClientId] ); const { getBlocksByClientId } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const getContent = (0,external_wp_element_namespaceObject.useCallback)( () => (0,external_wp_blocks_namespaceObject.serialize)(getBlocksByClientId(clientIds)), [getBlocksByClientId, clientIds] ); if (!canConvert) { return null; } const handleSuccess = ({ pattern }) => { if (pattern.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced) { if (clientIds?.length === 1) { const existingAttributes = getBlockAttributes(clientIds[0]); updateBlockAttributes(clientIds[0], { metadata: { ...existingAttributes?.metadata ? existingAttributes.metadata : {}, patternName: `core/block/${pattern.id}`, name: pattern.title.raw } }); } } else { const newBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/block", { ref: pattern.id }); replaceBlocks(clientIds, newBlock); setEditingPattern(newBlock.clientId, true); closeBlockSettingsMenu(); } createSuccessNotice( pattern.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name the user has given to the pattern. (0,external_wp_i18n_namespaceObject.__)("Unsynced pattern created: %s"), pattern.title.raw ) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name the user has given to the pattern. (0,external_wp_i18n_namespaceObject.__)("Synced pattern created: %s"), pattern.title.raw ), { type: "snackbar", id: "convert-to-pattern-success" } ); setIsModalOpen(false); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: symbol_default, onClick: () => setIsModalOpen(true), "aria-expanded": isModalOpen, "aria-haspopup": "dialog", children: (0,external_wp_i18n_namespaceObject.__)("Create pattern") } ), isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CreatePatternModal, { content: getContent, onSuccess: (pattern) => { handleSuccess(pattern); }, onError: () => { setIsModalOpen(false); }, onClose: () => { setIsModalOpen(false); } } ) ] }); } ;// external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; ;// ./node_modules/@wordpress/patterns/build-module/components/patterns-manage-button.js function PatternsManageButton({ clientId }) { const { attributes, canDetach, isVisible, managePatternsUrl, isSyncedPattern, isUnsyncedPattern } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { canRemoveBlock, getBlock } = select(external_wp_blockEditor_namespaceObject.store); const { canUser } = select(external_wp_coreData_namespaceObject.store); const block = getBlock(clientId); const _isUnsyncedPattern = window?.__experimentalContentOnlyPatternInsertion && !!block?.attributes?.metadata?.patternName; const _isSyncedPattern = !!block && (0,external_wp_blocks_namespaceObject.isReusableBlock)(block) && !!canUser("update", { kind: "postType", name: "wp_block", id: block.attributes.ref }); return { attributes: block.attributes, // For unsynced patterns, detaching is simply removing the `patternName` attribute. // For synced patterns, the `core:block` block is replaced with its inner blocks, // so checking whether `canRemoveBlock` is possible is required. canDetach: _isUnsyncedPattern || _isSyncedPattern && canRemoveBlock(clientId), isUnsyncedPattern: _isUnsyncedPattern, isSyncedPattern: _isSyncedPattern, isVisible: _isUnsyncedPattern || _isSyncedPattern, // The site editor and templates both check whether the user // has edit_theme_options capabilities. We can leverage that here // and omit the manage patterns link if the user can't access it. managePatternsUrl: canUser("create", { kind: "postType", name: "wp_template" }) ? (0,external_wp_url_namespaceObject.addQueryArgs)("site-editor.php", { p: "/pattern" }) : (0,external_wp_url_namespaceObject.addQueryArgs)("edit.php", { post_type: "wp_block" }) }; }, [clientId] ); const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { convertSyncedPatternToStatic } = unlock( (0,external_wp_data_namespaceObject.useDispatch)(store) ); if (!isVisible) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ canDetach && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { if (isSyncedPattern) { convertSyncedPatternToStatic(clientId); } if (isUnsyncedPattern) { const { patternName, ...attributesWithoutPatternName } = attributes?.metadata ?? {}; updateBlockAttributes(clientId, { metadata: attributesWithoutPatternName }); } }, children: (0,external_wp_i18n_namespaceObject.__)("Detach") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { href: managePatternsUrl, children: (0,external_wp_i18n_namespaceObject.__)("Manage patterns") }) ] }); } var patterns_manage_button_default = PatternsManageButton; ;// ./node_modules/@wordpress/patterns/build-module/components/index.js function PatternsMenuItems({ rootClientId }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PatternConvertButton, { clientIds: selectedClientIds, rootClientId, closeBlockSettingsMenu: onClose } ), selectedClientIds.length === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( patterns_manage_button_default, { clientId: selectedClientIds[0] } ) ] }) }); } ;// external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// ./node_modules/@wordpress/patterns/build-module/components/rename-pattern-category-modal.js function RenamePatternCategoryModal({ category, existingCategories, onClose, onError, onSuccess, ...props }) { const id = (0,external_wp_element_namespaceObject.useId)(); const textControlRef = (0,external_wp_element_namespaceObject.useRef)(); const [name, setName] = (0,external_wp_element_namespaceObject.useState)((0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.name)); const [isSaving, setIsSaving] = (0,external_wp_element_namespaceObject.useState)(false); const [validationMessage, setValidationMessage] = (0,external_wp_element_namespaceObject.useState)(false); const validationMessageId = validationMessage ? `patterns-rename-pattern-category-modal__validation-message-${id}` : void 0; const { saveEntityRecord, invalidateResolution } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const onChange = (newName) => { if (validationMessage) { setValidationMessage(void 0); } setName(newName); }; const onSave = async (event) => { event.preventDefault(); if (isSaving) { return; } if (!name || name === category.name) { const message = (0,external_wp_i18n_namespaceObject.__)("Please enter a new name for this category."); (0,external_wp_a11y_namespaceObject.speak)(message, "assertive"); setValidationMessage(message); textControlRef.current?.focus(); return; } if (existingCategories.patternCategories.find((existingCategory) => { return existingCategory.id !== category.id && existingCategory.label.toLowerCase() === name.toLowerCase(); })) { const message = (0,external_wp_i18n_namespaceObject.__)( "This category already exists. Please use a different name." ); (0,external_wp_a11y_namespaceObject.speak)(message, "assertive"); setValidationMessage(message); textControlRef.current?.focus(); return; } try { setIsSaving(true); const savedRecord = await saveEntityRecord( "taxonomy", CATEGORY_SLUG, { id: category.id, slug: category.slug, name } ); invalidateResolution("getUserPatternCategories"); onSuccess?.(savedRecord); onClose(); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Pattern category renamed."), { type: "snackbar", id: "pattern-category-update" }); } catch (error) { onError?.(); createErrorNotice(error.message, { type: "snackbar", id: "pattern-category-update" }); } finally { setIsSaving(false); setName(""); } }; const onRequestClose = () => { onClose(); setName(""); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Rename"), onRequestClose, ...props, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onSave, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "2", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { ref: textControlRef, __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Name"), value: name, onChange, "aria-describedby": validationMessageId, required: true } ), validationMessage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "span", { className: "patterns-rename-pattern-category-modal__validation-message", id: validationMessageId, children: validationMessage } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: onRequestClose, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", "aria-disabled": !name || name === category.name || isSaving, isBusy: isSaving, children: (0,external_wp_i18n_namespaceObject.__)("Save") } ) ] }) ] }) }) } ); } ;// ./node_modules/@wordpress/patterns/build-module/components/allow-overrides-modal.js function AllowOverridesModal({ placeholder, initialName = "", onClose, onSave }) { const [editedBlockName, setEditedBlockName] = (0,external_wp_element_namespaceObject.useState)(initialName); const descriptionId = (0,external_wp_element_namespaceObject.useId)(); const isNameValid = !!editedBlockName.trim(); const handleSubmit = () => { if (editedBlockName !== initialName) { const message = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: new name/label for the block */ (0,external_wp_i18n_namespaceObject.__)('Block name changed to: "%s".'), editedBlockName ); (0,external_wp_a11y_namespaceObject.speak)(message, "assertive"); } onSave(editedBlockName); onClose(); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Enable overrides"), onRequestClose: onClose, focusOnMount: "firstContentElement", aria: { describedby: descriptionId }, size: "small", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "form", { onSubmit: (event) => { event.preventDefault(); if (!isNameValid) { return; } handleSubmit(); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "6", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { id: descriptionId, children: (0,external_wp_i18n_namespaceObject.__)( "Overrides are changes you make to a block within a synced pattern instance. Use overrides to customize a synced pattern instance to suit its new context. Name this block to specify an override." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, value: editedBlockName, label: (0,external_wp_i18n_namespaceObject.__)("Name"), help: (0,external_wp_i18n_namespaceObject.__)( 'For example, if you are creating a recipe pattern, you use "Recipe Title", "Recipe Description", etc.' ), placeholder, onChange: setEditedBlockName } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: onClose, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, "aria-disabled": !isNameValid, variant: "primary", type: "submit", children: (0,external_wp_i18n_namespaceObject.__)("Enable") } ) ] }) ] }) } ) } ); } function DisallowOverridesModal({ onClose, onSave }) { const descriptionId = (0,external_wp_element_namespaceObject.useId)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Disable overrides"), onRequestClose: onClose, aria: { describedby: descriptionId }, size: "small", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "form", { onSubmit: (event) => { event.preventDefault(); onSave(); onClose(); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "6", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { id: descriptionId, children: (0,external_wp_i18n_namespaceObject.__)( "Are you sure you want to disable overrides? Disabling overrides will revert all applied overrides for this block throughout instances of this pattern." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: onClose, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", children: (0,external_wp_i18n_namespaceObject.__)("Disable") } ) ] }) ] }) } ) } ); } ;// ./node_modules/@wordpress/patterns/build-module/components/pattern-overrides-controls.js function PatternOverridesControls({ attributes, setAttributes, name: blockName }) { const controlId = (0,external_wp_element_namespaceObject.useId)(); const [showAllowOverridesModal, setShowAllowOverridesModal] = (0,external_wp_element_namespaceObject.useState)(false); const [showDisallowOverridesModal, setShowDisallowOverridesModal] = (0,external_wp_element_namespaceObject.useState)(false); const hasName = !!attributes.metadata?.name; const defaultBindings = attributes.metadata?.bindings?.__default; const hasOverrides = hasName && defaultBindings?.source === PATTERN_OVERRIDES_BINDING_SOURCE; const isConnectedToOtherSources = defaultBindings?.source && defaultBindings.source !== PATTERN_OVERRIDES_BINDING_SOURCE; const { updateBlockBindings } = (0,external_wp_blockEditor_namespaceObject.useBlockBindingsUtils)(); function updateBindings(isChecked, customName) { if (customName) { setAttributes({ metadata: { ...attributes.metadata, name: customName } }); } updateBlockBindings({ __default: isChecked ? { source: PATTERN_OVERRIDES_BINDING_SOURCE } : void 0 }); } if (isConnectedToOtherSources) { return null; } const hasUnsupportedImageAttributes = blockName === "core/image" && !!attributes.href?.length; const helpText = !hasOverrides && hasUnsupportedImageAttributes ? (0,external_wp_i18n_namespaceObject.__)( `Overrides currently don't support image links. Remove the link first before enabling overrides.` ) : (0,external_wp_i18n_namespaceObject.__)( "Allow changes to this block throughout instances of this pattern." ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { group: "advanced", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, id: controlId, label: (0,external_wp_i18n_namespaceObject.__)("Overrides"), help: helpText, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "pattern-overrides-control__allow-overrides-button", variant: "secondary", "aria-haspopup": "dialog", onClick: () => { if (hasOverrides) { setShowDisallowOverridesModal(true); } else { setShowAllowOverridesModal(true); } }, disabled: !hasOverrides && hasUnsupportedImageAttributes, accessibleWhenDisabled: true, children: hasOverrides ? (0,external_wp_i18n_namespaceObject.__)("Disable overrides") : (0,external_wp_i18n_namespaceObject.__)("Enable overrides") } ) } ) }), showAllowOverridesModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AllowOverridesModal, { initialName: attributes.metadata?.name, onClose: () => setShowAllowOverridesModal(false), onSave: (newName) => { updateBindings(true, newName); } } ), showDisallowOverridesModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( DisallowOverridesModal, { onClose: () => setShowDisallowOverridesModal(false), onSave: () => updateBindings(false) } ) ] }); } var pattern_overrides_controls_default = PatternOverridesControls; ;// ./node_modules/@wordpress/patterns/build-module/components/reset-overrides-control.js const CONTENT = "content"; function ResetOverridesControl(props) { const name = props.attributes.metadata?.name; const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const isOverridden = (0,external_wp_data_namespaceObject.useSelect)( (select) => { if (!name) { return; } const { getBlockAttributes, getBlockParentsByBlockName } = select(external_wp_blockEditor_namespaceObject.store); const [patternClientId] = getBlockParentsByBlockName( props.clientId, "core/block", true ); if (!patternClientId) { return; } const overrides = getBlockAttributes(patternClientId)[CONTENT]; if (!overrides) { return; } return overrides.hasOwnProperty(name); }, [props.clientId, name] ); function onClick() { const { getBlockAttributes, getBlockParentsByBlockName } = registry.select(external_wp_blockEditor_namespaceObject.store); const [patternClientId] = getBlockParentsByBlockName( props.clientId, "core/block", true ); if (!patternClientId) { return; } const overrides = getBlockAttributes(patternClientId)[CONTENT]; if (!overrides.hasOwnProperty(name)) { return; } const { updateBlockAttributes, __unstableMarkLastChangeAsPersistent } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); __unstableMarkLastChangeAsPersistent(); let newOverrides = { ...overrides }; delete newOverrides[name]; if (!Object.keys(newOverrides).length) { newOverrides = void 0; } updateBlockAttributes(patternClientId, { [CONTENT]: newOverrides }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockToolbarLastItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick, disabled: !isOverridden, children: (0,external_wp_i18n_namespaceObject.__)("Reset") }) }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/copy.js var copy_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, { fillRule: "evenodd", clipRule: "evenodd", d: "M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z" } ) }); ;// ./node_modules/@wordpress/patterns/build-module/components/pattern-overrides-block-controls.js const { useBlockDisplayTitle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function PatternOverridesToolbarIndicator({ clientIds }) { const isSingleBlockSelected = clientIds.length === 1; const { icon, firstBlockName } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockAttributes, getBlockNamesByClientId } = select(external_wp_blockEditor_namespaceObject.store); const { getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); const blockTypeNames = getBlockNamesByClientId(clientIds); const _firstBlockTypeName = blockTypeNames[0]; const firstBlockType = getBlockType(_firstBlockTypeName); let _icon; if (isSingleBlockSelected) { const match = getActiveBlockVariation( _firstBlockTypeName, getBlockAttributes(clientIds[0]) ); _icon = match?.icon || firstBlockType.icon; } else { const isSelectionOfSameType = new Set(blockTypeNames).size === 1; _icon = isSelectionOfSameType ? firstBlockType.icon : copy_default; } return { icon: _icon, firstBlockName: getBlockAttributes(clientIds[0]).metadata.name }; }, [clientIds, isSingleBlockSelected] ); const firstBlockTitle = useBlockDisplayTitle({ clientId: clientIds[0], maximumLength: 35 }); const blockDescription = isSingleBlockSelected ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: The block type's name. 2: The block's user-provided name (the same as the override name). */ (0,external_wp_i18n_namespaceObject.__)('This %1$s is editable using the "%2$s" override.'), firstBlockTitle.toLowerCase(), firstBlockName ) : (0,external_wp_i18n_namespaceObject.__)("These blocks are editable using overrides."); const descriptionId = (0,external_wp_element_namespaceObject.useId)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { className: "patterns-pattern-overrides-toolbar-indicator", label: firstBlockTitle, popoverProps: { placement: "bottom-start", className: "patterns-pattern-overrides-toolbar-indicator__popover" }, icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.BlockIcon, { icon, className: "patterns-pattern-overrides-toolbar-indicator-icon", showColors: true } ) }), toggleProps: { description: blockDescription, ...toggleProps }, menuProps: { orientation: "both", "aria-describedby": descriptionId }, children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { id: descriptionId, children: blockDescription }) } ) }); } function PatternOverridesBlockControls() { const { clientIds, hasPatternOverrides, hasParentPattern } = (0,external_wp_data_namespaceObject.useSelect)( (select) => { const { getBlockAttributes, getSelectedBlockClientIds, getBlockParentsByBlockName } = select(external_wp_blockEditor_namespaceObject.store); const selectedClientIds = getSelectedBlockClientIds(); const _hasPatternOverrides = selectedClientIds.every( (clientId) => Object.values( getBlockAttributes(clientId)?.metadata?.bindings ?? {} ).some( (binding) => binding?.source === PATTERN_OVERRIDES_BINDING_SOURCE ) ); const _hasParentPattern = selectedClientIds.every( (clientId) => getBlockParentsByBlockName(clientId, "core/block", true).length > 0 ); return { clientIds: selectedClientIds, hasPatternOverrides: _hasPatternOverrides, hasParentPattern: _hasParentPattern }; }, [] ); return hasPatternOverrides && hasParentPattern ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { group: "parent", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesToolbarIndicator, { clientIds }) }) : null; } ;// ./node_modules/@wordpress/patterns/build-module/private-apis.js const privateApis = {}; lock(privateApis, { OverridesPanel: OverridesPanel, CreatePatternModal: CreatePatternModal, CreatePatternModalContents: CreatePatternModalContents, DuplicatePatternModal: DuplicatePatternModal, isOverridableBlock: isOverridableBlock, hasOverridableBlocks: hasOverridableBlocks, useDuplicatePatternProps: useDuplicatePatternProps, RenamePatternModal: RenamePatternModal, PatternsMenuItems: PatternsMenuItems, RenamePatternCategoryModal: RenamePatternCategoryModal, PatternOverridesControls: pattern_overrides_controls_default, ResetOverridesControl: ResetOverridesControl, PatternOverridesBlockControls: PatternOverridesBlockControls, useAddPatternCategory: useAddPatternCategory, PATTERN_TYPES: PATTERN_TYPES, PATTERN_DEFAULT_CATEGORY: PATTERN_DEFAULT_CATEGORY, PATTERN_USER_CATEGORY: PATTERN_USER_CATEGORY, EXCLUDED_PATTERN_SOURCES: EXCLUDED_PATTERN_SOURCES, PATTERN_SYNC_TYPES: PATTERN_SYNC_TYPES, PARTIAL_SYNCING_SUPPORTED_BLOCKS: PARTIAL_SYNCING_SUPPORTED_BLOCKS }); ;// ./node_modules/@wordpress/patterns/build-module/index.js (window.wp = window.wp || {}).patterns = __webpack_exports__; /******/ })() ; autop.min.js 0000604 00000012756 15151622574 0007033 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={d:(p,n)=>{for(var r in n)e.o(n,r)&&!e.o(p,r)&&Object.defineProperty(p,r,{enumerable:!0,get:n[r]})},o:(e,p)=>Object.prototype.hasOwnProperty.call(e,p),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},p={};e.r(p),e.d(p,{autop:()=>t,removep:()=>c});const n=new RegExp("(<((?=!--|!\\[CDATA\\[)((?=!-)!(?:-(?!->)[^\\-]*)*(?:--\x3e)?|!\\[CDATA\\[[^\\]]*(?:](?!]>)[^\\]]*)*?(?:]]>)?)|[^>]*>?))");function r(e,p){const r=function(e){const p=[];let r,t=e;for(;r=t.match(n);){const e=r.index;p.push(t.slice(0,e)),p.push(r[0]),t=t.slice(e+r[0].length)}return t.length&&p.push(t),p}(e);let t=!1;const c=Object.keys(p);for(let e=1;e<r.length;e+=2)for(let n=0;n<c.length;n++){const l=c[n];if(-1!==r[e].indexOf(l)){r[e]=r[e].replace(new RegExp(l,"g"),p[l]),t=!0;break}}return t&&(e=r.join("")),e}function t(e,p=!0){const n=[];if(""===e.trim())return"";if(-1!==(e+="\n").indexOf("<pre")){const p=e.split("</pre>"),r=p.pop();e="";for(let r=0;r<p.length;r++){const t=p[r],c=t.indexOf("<pre");if(-1===c){e+=t;continue}const l="<pre wp-pre-tag-"+r+"></pre>";n.push([l,t.substr(c)+"</pre>"]),e+=t.substr(0,c)+l}e+=r}const t="(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)";-1!==(e=r(e=(e=(e=(e=e.replace(/<br\s*\/?>\s*<br\s*\/?>/g,"\n\n")).replace(new RegExp("(<"+t+"[\\s/>])","g"),"\n\n$1")).replace(new RegExp("(</"+t+">)","g"),"$1\n\n")).replace(/\r\n|\r/g,"\n"),{"\n":" \x3c!-- wpnl --\x3e "})).indexOf("<option")&&(e=(e=e.replace(/\s*<option/g,"<option")).replace(/<\/option>\s*/g,"</option>")),-1!==e.indexOf("</object>")&&(e=(e=(e=e.replace(/(<object[^>]*>)\s*/g,"$1")).replace(/\s*<\/object>/g,"</object>")).replace(/\s*(<\/?(?:param|embed)[^>]*>)\s*/g,"$1")),-1===e.indexOf("<source")&&-1===e.indexOf("<track")||(e=(e=(e=e.replace(/([<\[](?:audio|video)[^>\]]*[>\]])\s*/g,"$1")).replace(/\s*([<\[]\/(?:audio|video)[>\]])/g,"$1")).replace(/\s*(<(?:source|track)[^>]*>)\s*/g,"$1")),-1!==e.indexOf("<figcaption")&&(e=(e=e.replace(/\s*(<figcaption[^>]*>)/,"$1")).replace(/<\/figcaption>\s*/,"</figcaption>"));const c=(e=e.replace(/\n\n+/g,"\n\n")).split(/\n\s*\n/).filter(Boolean);return e="",c.forEach((p=>{e+="<p>"+p.replace(/^\n*|\n*$/g,"")+"</p>\n"})),e=(e=(e=(e=(e=(e=(e=(e=e.replace(/<p>\s*<\/p>/g,"")).replace(/<p>([^<]+)<\/(div|address|form)>/g,"<p>$1</p></$2>")).replace(new RegExp("<p>\\s*(</?"+t+"[^>]*>)\\s*</p>","g"),"$1")).replace(/<p>(<li.+?)<\/p>/g,"$1")).replace(/<p><blockquote([^>]*)>/gi,"<blockquote$1><p>")).replace(/<\/blockquote><\/p>/g,"</p></blockquote>")).replace(new RegExp("<p>\\s*(</?"+t+"[^>]*>)","g"),"$1")).replace(new RegExp("(</?"+t+"[^>]*>)\\s*</p>","g"),"$1"),p&&(e=(e=(e=(e=e.replace(/<(script|style).*?<\/\\1>/g,(e=>e[0].replace(/\n/g,"<WPPreserveNewline />")))).replace(/<br>|<br\/>/g,"<br />")).replace(/(<br \/>)?\s*\n/g,((e,p)=>p?e:"<br />\n"))).replace(/<WPPreserveNewline \/>/g,"\n")),e=(e=(e=e.replace(new RegExp("(</?"+t+"[^>]*>)\\s*<br />","g"),"$1")).replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g,"$1")).replace(/\n<\/p>$/g,"</p>"),n.forEach((p=>{const[n,r]=p;e=e.replace(n,r)})),-1!==e.indexOf("\x3c!-- wpnl --\x3e")&&(e=e.replace(/\s?<!-- wpnl -->\s?/g,"\n")),e}function c(e){const p="blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure",n=p+"|div|p",r=p+"|pre",t=[];let c=!1,l=!1;return e?(-1===e.indexOf("<script")&&-1===e.indexOf("<style")||(e=e.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/g,(e=>(t.push(e),"<wp-preserve>")))),-1!==e.indexOf("<pre")&&(c=!0,e=e.replace(/<pre[^>]*>[\s\S]+?<\/pre>/g,(e=>(e=(e=e.replace(/<br ?\/?>(\r\n|\n)?/g,"<wp-line-break>")).replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,"<wp-line-break>")).replace(/\r?\n/g,"<wp-line-break>")))),-1!==e.indexOf("[caption")&&(l=!0,e=e.replace(/\[caption[\s\S]+?\[\/caption\]/g,(e=>e.replace(/<br([^>]*)>/g,"<wp-temp-br$1>").replace(/[\r\n\t]+/,"")))),-1!==(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(new RegExp("\\s*</("+n+")>\\s*","g"),"</$1>\n")).replace(new RegExp("\\s*<((?:"+n+")(?: [^>]*)?)>","g"),"\n<$1>")).replace(/(<p [^>]+>[\s\S]*?)<\/p>/g,"$1</p#>")).replace(/<div( [^>]*)?>\s*<p>/gi,"<div$1>\n\n")).replace(/\s*<p>/gi,"")).replace(/\s*<\/p>\s*/gi,"\n\n")).replace(/\n[\s\u00a0]+\n/g,"\n\n")).replace(/(\s*)<br ?\/?>\s*/gi,((e,p)=>p&&-1!==p.indexOf("\n")?"\n\n":"\n"))).replace(/\s*<div/g,"\n<div")).replace(/<\/div>\s*/g,"</div>\n")).replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n")).replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption")).replace(new RegExp("\\s*<((?:"+r+")(?: [^>]*)?)\\s*>","g"),"\n<$1>")).replace(new RegExp("\\s*</("+r+")>\\s*","g"),"</$1>\n")).replace(/<((li|dt|dd)[^>]*)>/g," \t<$1>")).indexOf("<option")&&(e=(e=e.replace(/\s*<option/g,"\n<option")).replace(/\s*<\/select>/g,"\n</select>")),-1!==e.indexOf("<hr")&&(e=e.replace(/\s*<hr( [^>]*)?>\s*/g,"\n\n<hr$1>\n\n")),-1!==e.indexOf("<object")&&(e=e.replace(/<object[\s\S]+?<\/object>/g,(e=>e.replace(/[\r\n]+/g,"")))),e=(e=(e=(e=e.replace(/<\/p#>/g,"</p>\n")).replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g,"\n$1")).replace(/^\s+/,"")).replace(/[\s\u00a0]+$/,""),c&&(e=e.replace(/<wp-line-break>/g,"\n")),l&&(e=e.replace(/<wp-temp-br([^>]*)>/g,"<br$1>")),t.length&&(e=e.replace(/<wp-preserve>/g,(()=>t.shift()))),e):""}(window.wp=window.wp||{}).autop=p})(); block-serialization-default-parser.min.js 0000604 00000004540 15151622574 0014554 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var n={d:(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o:(n,e)=>Object.prototype.hasOwnProperty.call(n,e),r:n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})}},e={};let t,r,o,s;n.r(e),n.d(e,{parse:()=>i});const l=/<!--\s+(\/)?wp:([a-z][a-z0-9_-]*\/)?([a-z][a-z0-9_-]*)\s+({(?:(?=([^}]+|}+(?=})|(?!}\s+\/?-->)[^])*)\5|[^]*?)}\s+)?(\/)?-->/g;function u(n,e,t,r,o){return{blockName:n,attrs:e,innerBlocks:t,innerHTML:r,innerContent:o}}function c(n){return u(null,{},[],n,[n])}const i=n=>{t=n,r=0,o=[],s=[],l.lastIndex=0;do{}while(f());return o};function f(){const n=s.length,e=function(){const n=l.exec(t);if(null===n)return["no-more-tokens","",null,0,0];const e=n.index,[r,o,s,u,c,,i]=n,f=r.length,p=!!o,a=!!i,b=(s||"core/")+u,k=!!c,h=k?function(n){try{return JSON.parse(n)}catch(n){return null}}(c):{};if(a)return["void-block",b,h,e,f];if(p)return["block-closer",b,null,e,f];return["block-opener",b,h,e,f]}(),[i,f,k,h,d]=e,g=h>r?r:null;switch(i){case"no-more-tokens":if(0===n)return p(),!1;if(1===n)return b(),!1;for(;0<s.length;)b();return!1;case"void-block":return 0===n?(null!==g&&o.push(c(t.substr(g,h-g))),o.push(u(f,k,[],"",[])),r=h+d,!0):(a(u(f,k,[],"",[]),h,d),r=h+d,!0);case"block-opener":return s.push(function(n,e,t,r,o){return{block:n,tokenStart:e,tokenLength:t,prevOffset:r||e+t,leadingHtmlStart:o}}(u(f,k,[],"",[]),h,d,h+d,g)),r=h+d,!0;case"block-closer":if(0===n)return p(),!1;if(1===n)return b(h),r=h+d,!0;const e=s.pop(),l=t.substr(e.prevOffset,h-e.prevOffset);return e.block.innerHTML+=l,e.block.innerContent.push(l),e.prevOffset=h+d,a(e.block,e.tokenStart,e.tokenLength,h+d),r=h+d,!0;default:return p(),!1}}function p(n){const e=n||t.length-r;0!==e&&o.push(c(t.substr(r,e)))}function a(n,e,r,o){const l=s[s.length-1];l.block.innerBlocks.push(n);const u=t.substr(l.prevOffset,e-l.prevOffset);u&&(l.block.innerHTML+=u,l.block.innerContent.push(u)),l.block.innerContent.push(null),l.prevOffset=o||e+r}function b(n){const{block:e,leadingHtmlStart:r,prevOffset:l,tokenStart:u}=s.pop(),i=n?t.substr(l,n-l):t.substr(l);i&&(e.innerHTML+=i,e.innerContent.push(i)),null!==r&&o.push(c(t.substr(r,u-r))),o.push(e)}(window.wp=window.wp||{}).blockSerializationDefaultParser=e})(); style-engine.min.js 0000644 00000013653 15151622574 0010307 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{compileCSS:()=>w,getCSSRules:()=>R,getCSSValueFromRawStyle:()=>f});var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function r(e){return e.toLowerCase()}var o=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],a=/[^A-Z0-9]+/gi;function i(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}function g(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,g=void 0===n?o:n,c=t.stripRegexp,u=void 0===c?a:c,d=t.transform,l=void 0===d?r:d,s=t.delimiter,p=void 0===s?" ":s,m=i(i(e,g,"$1\0$2"),u,"\0"),f=0,y=m.length;"\0"===m.charAt(f);)f++;for(;"\0"===m.charAt(y-1);)y--;return m.slice(f,y).split("\0").map(l).join(p)}(e,n({delimiter:"."},t))}function c(e,t){return void 0===t&&(t={}),g(e,n({delimiter:"-"},t))}const u="var:",d="|",l="--",s=(e,t)=>{let n=e;return t.forEach((e=>{n=n?.[e]})),n};function p(e,t,n,r){const o=s(e,n);return o?[{selector:t?.selector,key:r,value:f(o)}]:[]}function m(e,t,n,r,o=["top","right","bottom","left"]){const a=s(e,n);if(!a)return[];const i=[];if("string"==typeof a)i.push({selector:t?.selector,key:r.default,value:f(a)});else{const e=o.reduce(((e,n)=>{const o=f(s(a,[n]));return o&&e.push({selector:t?.selector,key:r?.individual.replace("%s",y(n)),value:o}),e}),[]);i.push(...e)}return i}function f(e){if("string"==typeof e&&e.startsWith(u)){return`var(--wp--${e.slice(u.length).split(d).map((e=>c(e,{splitRegexp:[/([a-z0-9])([A-Z])/g,/([0-9])([a-z])/g,/([A-Za-z])([0-9])/g,/([A-Z])([A-Z][a-z])/g]}))).join(l)})`}return e}function y(e){const[t,...n]=e;return t.toUpperCase()+n.join("")}function b(e){try{return decodeURI(e)}catch(t){return e}}function h(e){return(t,n)=>p(t,n,e,function(e){const[t,...n]=e;return t.toLowerCase()+n.map(y).join("")}(e))}function k(e){return(t,n)=>["color","style","width"].flatMap((r=>h(["border",e,r])(t,n)))}const v={name:"radius",generate:(e,t)=>m(e,t,["border","radius"],{default:"borderRadius",individual:"border%sRadius"},["topLeft","topRight","bottomLeft","bottomRight"])};const S=[...[{name:"color",generate:h(["border","color"])},{name:"style",generate:h(["border","style"])},{name:"width",generate:h(["border","width"])},v,{name:"borderTop",generate:k("top")},{name:"borderRight",generate:k("right")},{name:"borderBottom",generate:k("bottom")},{name:"borderLeft",generate:k("left")}],...[{name:"text",generate:(e,t)=>p(e,t,["color","text"],"color")},{name:"gradient",generate:(e,t)=>p(e,t,["color","gradient"],"background")},{name:"background",generate:(e,t)=>p(e,t,["color","background"],"backgroundColor")}],...[{name:"minHeight",generate:(e,t)=>p(e,t,["dimensions","minHeight"],"minHeight")},{name:"aspectRatio",generate:(e,t)=>p(e,t,["dimensions","aspectRatio"],"aspectRatio")}],...[{name:"color",generate:(e,t,n=["outline","color"],r="outlineColor")=>p(e,t,n,r)},{name:"style",generate:(e,t,n=["outline","style"],r="outlineStyle")=>p(e,t,n,r)},{name:"offset",generate:(e,t,n=["outline","offset"],r="outlineOffset")=>p(e,t,n,r)},{name:"width",generate:(e,t,n=["outline","width"],r="outlineWidth")=>p(e,t,n,r)}],...[{name:"margin",generate:(e,t)=>m(e,t,["spacing","margin"],{default:"margin",individual:"margin%s"})},{name:"padding",generate:(e,t)=>m(e,t,["spacing","padding"],{default:"padding",individual:"padding%s"})}],...[{name:"fontFamily",generate:(e,t)=>p(e,t,["typography","fontFamily"],"fontFamily")},{name:"fontSize",generate:(e,t)=>p(e,t,["typography","fontSize"],"fontSize")},{name:"fontStyle",generate:(e,t)=>p(e,t,["typography","fontStyle"],"fontStyle")},{name:"fontWeight",generate:(e,t)=>p(e,t,["typography","fontWeight"],"fontWeight")},{name:"letterSpacing",generate:(e,t)=>p(e,t,["typography","letterSpacing"],"letterSpacing")},{name:"lineHeight",generate:(e,t)=>p(e,t,["typography","lineHeight"],"lineHeight")},{name:"textColumns",generate:(e,t)=>p(e,t,["typography","textColumns"],"columnCount")},{name:"textDecoration",generate:(e,t)=>p(e,t,["typography","textDecoration"],"textDecoration")},{name:"textTransform",generate:(e,t)=>p(e,t,["typography","textTransform"],"textTransform")},{name:"writingMode",generate:(e,t)=>p(e,t,["typography","writingMode"],"writingMode")}],...[{name:"shadow",generate:(e,t)=>p(e,t,["shadow"],"boxShadow")}],...[{name:"backgroundImage",generate:(e,t)=>{const n=e?.background?.backgroundImage;return"object"==typeof n&&n?.url?[{selector:t.selector,key:"backgroundImage",value:`url( '${encodeURI(b(n.url))}' )`}]:p(e,t,["background","backgroundImage"],"backgroundImage")}},{name:"backgroundPosition",generate:(e,t)=>p(e,t,["background","backgroundPosition"],"backgroundPosition")},{name:"backgroundRepeat",generate:(e,t)=>p(e,t,["background","backgroundRepeat"],"backgroundRepeat")},{name:"backgroundSize",generate:(e,t)=>p(e,t,["background","backgroundSize"],"backgroundSize")},{name:"backgroundAttachment",generate:(e,t)=>p(e,t,["background","backgroundAttachment"],"backgroundAttachment")}]];function w(e,t={}){const n=R(e,t);if(!t?.selector){const e=[];return n.forEach((t=>{e.push(`${c(t.key)}: ${t.value};`)})),e.join(" ")}const r=n.reduce(((e,t)=>{const{selector:n}=t;return n?(e[n]||(e[n]=[]),e[n].push(t),e):e}),{});return Object.keys(r).reduce(((e,t)=>(e.push(`${t} { ${r[t].map((e=>`${c(e.key)}: ${e.value};`)).join(" ")} }`),e)),[]).join("\n")}function R(e,t={}){const n=[];return S.forEach((r=>{"function"==typeof r.generate&&n.push(...r.generate(e,t))})),n}(window.wp=window.wp||{}).styleEngine=t})(); rich-text.js 0000644 00000247027 15151622574 0007035 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { RichTextData: () => (/* reexport */ RichTextData), __experimentalRichText: () => (/* reexport */ __experimentalRichText), __unstableCreateElement: () => (/* reexport */ createElement), __unstableToDom: () => (/* reexport */ toDom), __unstableUseRichText: () => (/* reexport */ useRichText), applyFormat: () => (/* reexport */ applyFormat), concat: () => (/* reexport */ concat), create: () => (/* reexport */ create), getActiveFormat: () => (/* reexport */ getActiveFormat), getActiveFormats: () => (/* reexport */ getActiveFormats), getActiveObject: () => (/* reexport */ getActiveObject), getTextContent: () => (/* reexport */ getTextContent), insert: () => (/* reexport */ insert), insertObject: () => (/* reexport */ insertObject), isCollapsed: () => (/* reexport */ isCollapsed), isEmpty: () => (/* reexport */ isEmpty), join: () => (/* reexport */ join), registerFormatType: () => (/* reexport */ registerFormatType), remove: () => (/* reexport */ remove_remove), removeFormat: () => (/* reexport */ removeFormat), replace: () => (/* reexport */ replace_replace), slice: () => (/* reexport */ slice), split: () => (/* reexport */ split), store: () => (/* reexport */ store), toHTMLString: () => (/* reexport */ toHTMLString), toggleFormat: () => (/* reexport */ toggleFormat), unregisterFormatType: () => (/* reexport */ unregisterFormatType), useAnchor: () => (/* reexport */ useAnchor), useAnchorRef: () => (/* reexport */ useAnchorRef) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/rich-text/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { getFormatType: () => (getFormatType), getFormatTypeForBareElement: () => (getFormatTypeForBareElement), getFormatTypeForClassName: () => (getFormatTypeForClassName), getFormatTypes: () => (getFormatTypes) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/rich-text/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { addFormatTypes: () => (addFormatTypes), removeFormatTypes: () => (removeFormatTypes) }); ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// ./node_modules/@wordpress/rich-text/build-module/store/reducer.js function formatTypes(state = {}, action) { switch (action.type) { case "ADD_FORMAT_TYPES": return { ...state, // Key format types by their name. ...action.formatTypes.reduce( (newFormatTypes, type) => ({ ...newFormatTypes, [type.name]: type }), {} ) }; case "REMOVE_FORMAT_TYPES": return Object.fromEntries( Object.entries(state).filter( ([key]) => !action.names.includes(key) ) ); } return state; } var reducer_default = (0,external_wp_data_namespaceObject.combineReducers)({ formatTypes }); ;// ./node_modules/@wordpress/rich-text/build-module/store/selectors.js const getFormatTypes = (0,external_wp_data_namespaceObject.createSelector)( (state) => Object.values(state.formatTypes), (state) => [state.formatTypes] ); function getFormatType(state, name) { return state.formatTypes[name]; } function getFormatTypeForBareElement(state, bareElementTagName) { const formatTypes = getFormatTypes(state); return formatTypes.find(({ className, tagName }) => { return className === null && bareElementTagName === tagName; }) || formatTypes.find(({ className, tagName }) => { return className === null && "*" === tagName; }); } function getFormatTypeForClassName(state, elementClassName) { return getFormatTypes(state).find(({ className }) => { if (className === null) { return false; } return ` ${elementClassName} `.indexOf(` ${className} `) >= 0; }); } ;// ./node_modules/@wordpress/rich-text/build-module/store/actions.js function addFormatTypes(formatTypes) { return { type: "ADD_FORMAT_TYPES", formatTypes: Array.isArray(formatTypes) ? formatTypes : [formatTypes] }; } function removeFormatTypes(names) { return { type: "REMOVE_FORMAT_TYPES", names: Array.isArray(names) ? names : [names] }; } ;// ./node_modules/@wordpress/rich-text/build-module/store/index.js const STORE_NAME = "core/rich-text"; const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { reducer: reducer_default, selectors: selectors_namespaceObject, actions: actions_namespaceObject }); (0,external_wp_data_namespaceObject.register)(store); ;// ./node_modules/@wordpress/rich-text/build-module/is-format-equal.js function isFormatEqual(format1, format2) { if (format1 === format2) { return true; } if (!format1 || !format2) { return false; } if (format1.type !== format2.type) { return false; } const attributes1 = format1.attributes; const attributes2 = format2.attributes; if (attributes1 === attributes2) { return true; } if (!attributes1 || !attributes2) { return false; } const keys1 = Object.keys(attributes1); const keys2 = Object.keys(attributes2); if (keys1.length !== keys2.length) { return false; } const length = keys1.length; for (let i = 0; i < length; i++) { const name = keys1[i]; if (attributes1[name] !== attributes2[name]) { return false; } } return true; } ;// ./node_modules/@wordpress/rich-text/build-module/normalise-formats.js function normaliseFormats(value) { const newFormats = value.formats.slice(); newFormats.forEach((formatsAtIndex, index) => { const formatsAtPreviousIndex = newFormats[index - 1]; if (formatsAtPreviousIndex) { const newFormatsAtIndex = formatsAtIndex.slice(); newFormatsAtIndex.forEach((format, formatIndex) => { const previousFormat = formatsAtPreviousIndex[formatIndex]; if (isFormatEqual(format, previousFormat)) { newFormatsAtIndex[formatIndex] = previousFormat; } }); newFormats[index] = newFormatsAtIndex; } }); return { ...value, formats: newFormats }; } ;// ./node_modules/@wordpress/rich-text/build-module/apply-format.js function replace(array, index, value) { array = array.slice(); array[index] = value; return array; } function applyFormat(value, format, startIndex = value.start, endIndex = value.end) { const { formats, activeFormats } = value; const newFormats = formats.slice(); if (startIndex === endIndex) { const startFormat = newFormats[startIndex]?.find( ({ type }) => type === format.type ); if (startFormat) { const index = newFormats[startIndex].indexOf(startFormat); while (newFormats[startIndex] && newFormats[startIndex][index] === startFormat) { newFormats[startIndex] = replace( newFormats[startIndex], index, format ); startIndex--; } endIndex++; while (newFormats[endIndex] && newFormats[endIndex][index] === startFormat) { newFormats[endIndex] = replace( newFormats[endIndex], index, format ); endIndex++; } } } else { let position = Infinity; for (let index = startIndex; index < endIndex; index++) { if (newFormats[index]) { newFormats[index] = newFormats[index].filter( ({ type }) => type !== format.type ); const length = newFormats[index].length; if (length < position) { position = length; } } else { newFormats[index] = []; position = 0; } } for (let index = startIndex; index < endIndex; index++) { newFormats[index].splice(position, 0, format); } } return normaliseFormats({ ...value, formats: newFormats, // Always revise active formats. This serves as a placeholder for new // inputs with the format so new input appears with the format applied, // and ensures a format of the same type uses the latest values. activeFormats: [ ...activeFormats?.filter( ({ type }) => type !== format.type ) || [], format ] }); } ;// ./node_modules/@wordpress/rich-text/build-module/create-element.js function createElement({ implementation }, html) { if (!createElement.body) { createElement.body = implementation.createHTMLDocument("").body; } createElement.body.innerHTML = html; return createElement.body; } ;// ./node_modules/@wordpress/rich-text/build-module/special-characters.js const OBJECT_REPLACEMENT_CHARACTER = "\uFFFC"; const ZWNBSP = "\uFEFF"; ;// external ["wp","escapeHtml"] const external_wp_escapeHtml_namespaceObject = window["wp"]["escapeHtml"]; ;// ./node_modules/@wordpress/rich-text/build-module/get-active-formats.js function getActiveFormats(value, EMPTY_ACTIVE_FORMATS = []) { const { formats, start, end, activeFormats } = value; if (start === void 0) { return EMPTY_ACTIVE_FORMATS; } if (start === end) { if (activeFormats) { return activeFormats; } const formatsBefore = formats[start - 1] || EMPTY_ACTIVE_FORMATS; const formatsAfter = formats[start] || EMPTY_ACTIVE_FORMATS; if (formatsBefore.length < formatsAfter.length) { return formatsBefore; } return formatsAfter; } if (!formats[start]) { return EMPTY_ACTIVE_FORMATS; } const selectedFormats = formats.slice(start, end); const _activeFormats = [...selectedFormats[0]]; let i = selectedFormats.length; while (i--) { const formatsAtIndex = selectedFormats[i]; if (!formatsAtIndex) { return EMPTY_ACTIVE_FORMATS; } let ii = _activeFormats.length; while (ii--) { const format = _activeFormats[ii]; if (!formatsAtIndex.find( (_format) => isFormatEqual(format, _format) )) { _activeFormats.splice(ii, 1); } } if (_activeFormats.length === 0) { return EMPTY_ACTIVE_FORMATS; } } return _activeFormats || EMPTY_ACTIVE_FORMATS; } ;// ./node_modules/@wordpress/rich-text/build-module/get-format-type.js function get_format_type_getFormatType(name) { return (0,external_wp_data_namespaceObject.select)(store).getFormatType(name); } ;// ./node_modules/@wordpress/rich-text/build-module/to-tree.js function restoreOnAttributes(attributes, isEditableTree) { if (isEditableTree) { return attributes; } const newAttributes = {}; for (const key in attributes) { let newKey = key; if (key.startsWith("data-disable-rich-text-")) { newKey = key.slice("data-disable-rich-text-".length); } newAttributes[newKey] = attributes[key]; } return newAttributes; } function fromFormat({ type, tagName, attributes, unregisteredAttributes, object, boundaryClass, isEditableTree }) { const formatType = get_format_type_getFormatType(type); let elementAttributes = {}; if (boundaryClass && isEditableTree) { elementAttributes["data-rich-text-format-boundary"] = "true"; } if (!formatType) { if (attributes) { elementAttributes = { ...attributes, ...elementAttributes }; } return { type, attributes: restoreOnAttributes( elementAttributes, isEditableTree ), object }; } elementAttributes = { ...unregisteredAttributes, ...elementAttributes }; for (const name in attributes) { const key = formatType.attributes ? formatType.attributes[name] : false; if (key) { elementAttributes[key] = attributes[name]; } else { elementAttributes[name] = attributes[name]; } } if (formatType.className) { if (elementAttributes.class) { elementAttributes.class = `${formatType.className} ${elementAttributes.class}`; } else { elementAttributes.class = formatType.className; } } return { type: tagName || formatType.tagName, object: formatType.object, attributes: restoreOnAttributes(elementAttributes, isEditableTree) }; } function isEqualUntil(a, b, index) { do { if (a[index] !== b[index]) { return false; } } while (index--); return true; } function toTree({ value, preserveWhiteSpace, createEmpty, append, getLastChild, getParent, isText, getText, remove, appendText, onStartIndex, onEndIndex, isEditableTree, placeholder }) { const { formats, replacements, text, start, end } = value; const formatsLength = formats.length + 1; const tree = createEmpty(); const activeFormats = getActiveFormats(value); const deepestActiveFormat = activeFormats[activeFormats.length - 1]; let lastCharacterFormats; let lastCharacter; append(tree, ""); for (let i = 0; i < formatsLength; i++) { const character = text.charAt(i); const shouldInsertPadding = isEditableTree && // Pad the line if the line is empty. (!lastCharacter || // Pad the line if the previous character is a line break, otherwise // the line break won't be visible. lastCharacter === "\n"); const characterFormats = formats[i]; let pointer = getLastChild(tree); if (characterFormats) { characterFormats.forEach((format, formatIndex) => { if (pointer && lastCharacterFormats && // Reuse the last element if all formats remain the same. isEqualUntil( characterFormats, lastCharacterFormats, formatIndex )) { pointer = getLastChild(pointer); return; } const { type, tagName, attributes, unregisteredAttributes } = format; const boundaryClass = isEditableTree && format === deepestActiveFormat; const parent = getParent(pointer); const newNode = append( parent, fromFormat({ type, tagName, attributes, unregisteredAttributes, boundaryClass, isEditableTree }) ); if (isText(pointer) && getText(pointer).length === 0) { remove(pointer); } pointer = append(newNode, ""); }); } if (i === 0) { if (onStartIndex && start === 0) { onStartIndex(tree, pointer); } if (onEndIndex && end === 0) { onEndIndex(tree, pointer); } } if (character === OBJECT_REPLACEMENT_CHARACTER) { const replacement = replacements[i]; if (!replacement) { continue; } const { type, attributes, innerHTML } = replacement; const formatType = get_format_type_getFormatType(type); if (isEditableTree && type === "#comment") { pointer = append(getParent(pointer), { type: "span", attributes: { contenteditable: "false", "data-rich-text-comment": attributes["data-rich-text-comment"] } }); append( append(pointer, { type: "span" }), attributes["data-rich-text-comment"].trim() ); } else if (!isEditableTree && type === "script") { pointer = append( getParent(pointer), fromFormat({ type: "script", isEditableTree }) ); append(pointer, { html: decodeURIComponent( attributes["data-rich-text-script"] ) }); } else if (formatType?.contentEditable === false) { if (innerHTML || isEditableTree) { pointer = getParent(pointer); if (isEditableTree) { const attrs = { contenteditable: "false", "data-rich-text-bogus": true }; if (start === i && end === i + 1) { attrs["data-rich-text-format-boundary"] = true; } pointer = append(pointer, { type: "span", attributes: attrs }); if (isEditableTree && i + 1 === text.length) { append(getParent(pointer), ZWNBSP); } } pointer = append( pointer, fromFormat({ ...replacement, isEditableTree }) ); if (innerHTML) { append(pointer, { html: innerHTML }); } } } else { pointer = append( getParent(pointer), fromFormat({ ...replacement, object: true, isEditableTree }) ); } pointer = append(getParent(pointer), ""); } else if (!preserveWhiteSpace && character === "\n") { pointer = append(getParent(pointer), { type: "br", attributes: isEditableTree ? { "data-rich-text-line-break": "true" } : void 0, object: true }); pointer = append(getParent(pointer), ""); } else if (!isText(pointer)) { pointer = append(getParent(pointer), character); } else { appendText(pointer, character); } if (onStartIndex && start === i + 1) { onStartIndex(tree, pointer); } if (onEndIndex && end === i + 1) { onEndIndex(tree, pointer); } if (shouldInsertPadding && i === text.length) { append(getParent(pointer), ZWNBSP); if (placeholder && text.length === 0) { append(getParent(pointer), { type: "span", attributes: { "data-rich-text-placeholder": placeholder, // Necessary to prevent the placeholder from catching // selection and being editable. style: "pointer-events:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;" } }); } } lastCharacterFormats = characterFormats; lastCharacter = character; } return tree; } ;// ./node_modules/@wordpress/rich-text/build-module/to-html-string.js function toHTMLString({ value, preserveWhiteSpace }) { const tree = toTree({ value, preserveWhiteSpace, createEmpty, append, getLastChild, getParent, isText, getText, remove, appendText }); return createChildrenHTML(tree.children); } function createEmpty() { return {}; } function getLastChild({ children }) { return children && children[children.length - 1]; } function append(parent, object) { if (typeof object === "string") { object = { text: object }; } object.parent = parent; parent.children = parent.children || []; parent.children.push(object); return object; } function appendText(object, text) { object.text += text; } function getParent({ parent }) { return parent; } function isText({ text }) { return typeof text === "string"; } function getText({ text }) { return text; } function remove(object) { const index = object.parent.children.indexOf(object); if (index !== -1) { object.parent.children.splice(index, 1); } return object; } function createElementHTML({ type, attributes, object, children }) { if (type === "#comment") { return `<!--${attributes["data-rich-text-comment"]}-->`; } let attributeString = ""; for (const key in attributes) { if (!(0,external_wp_escapeHtml_namespaceObject.isValidAttributeName)(key)) { continue; } attributeString += ` ${key}="${(0,external_wp_escapeHtml_namespaceObject.escapeAttribute)( attributes[key] )}"`; } if (object) { return `<${type}${attributeString}>`; } return `<${type}${attributeString}>${createChildrenHTML( children )}</${type}>`; } function createChildrenHTML(children = []) { return children.map((child) => { if (child.html !== void 0) { return child.html; } return child.text === void 0 ? createElementHTML(child) : (0,external_wp_escapeHtml_namespaceObject.escapeEditableHTML)(child.text); }).join(""); } ;// ./node_modules/@wordpress/rich-text/build-module/get-text-content.js function getTextContent({ text }) { return text.replace(OBJECT_REPLACEMENT_CHARACTER, ""); } ;// ./node_modules/@wordpress/rich-text/build-module/create.js function createEmptyValue() { return { formats: [], replacements: [], text: "" }; } function toFormat({ tagName, attributes }) { let formatType; if (attributes && attributes.class) { formatType = (0,external_wp_data_namespaceObject.select)(store).getFormatTypeForClassName( attributes.class ); if (formatType) { attributes.class = ` ${attributes.class} `.replace(` ${formatType.className} `, " ").trim(); if (!attributes.class) { delete attributes.class; } } } if (!formatType) { formatType = (0,external_wp_data_namespaceObject.select)(store).getFormatTypeForBareElement(tagName); } if (!formatType) { return attributes ? { type: tagName, attributes } : { type: tagName }; } if (formatType.__experimentalCreatePrepareEditableTree && !formatType.__experimentalCreateOnChangeEditableValue) { return null; } if (!attributes) { return { formatType, type: formatType.name, tagName }; } const registeredAttributes = {}; const unregisteredAttributes = {}; const _attributes = { ...attributes }; for (const key in formatType.attributes) { const name = formatType.attributes[key]; registeredAttributes[key] = _attributes[name]; delete _attributes[name]; if (typeof registeredAttributes[key] === "undefined") { delete registeredAttributes[key]; } } for (const name in _attributes) { unregisteredAttributes[name] = attributes[name]; } if (formatType.contentEditable === false) { delete unregisteredAttributes.contenteditable; } return { formatType, type: formatType.name, tagName, attributes: registeredAttributes, unregisteredAttributes }; } class RichTextData { #value; static empty() { return new RichTextData(); } static fromPlainText(text) { return new RichTextData(create({ text })); } static fromHTMLString(html) { return new RichTextData(create({ html })); } /** * Create a RichTextData instance from an HTML element. * * @param {HTMLElement} htmlElement The HTML element to create the instance from. * @param {{preserveWhiteSpace?: boolean}} options Options. * @return {RichTextData} The RichTextData instance. */ static fromHTMLElement(htmlElement, options = {}) { const { preserveWhiteSpace = false } = options; const element = preserveWhiteSpace ? htmlElement : collapseWhiteSpace(htmlElement); const richTextData = new RichTextData(create({ element })); Object.defineProperty(richTextData, "originalHTML", { value: htmlElement.innerHTML }); return richTextData; } constructor(init = createEmptyValue()) { this.#value = init; } toPlainText() { return getTextContent(this.#value); } // We could expose `toHTMLElement` at some point as well, but we'd only use // it internally. /** * Convert the rich text value to an HTML string. * * @param {{preserveWhiteSpace?: boolean}} options Options. * @return {string} The HTML string. */ toHTMLString({ preserveWhiteSpace } = {}) { return this.originalHTML || toHTMLString({ value: this.#value, preserveWhiteSpace }); } valueOf() { return this.toHTMLString(); } toString() { return this.toHTMLString(); } toJSON() { return this.toHTMLString(); } get length() { return this.text.length; } get formats() { return this.#value.formats; } get replacements() { return this.#value.replacements; } get text() { return this.#value.text; } } for (const name of Object.getOwnPropertyNames(String.prototype)) { if (RichTextData.prototype.hasOwnProperty(name)) { continue; } Object.defineProperty(RichTextData.prototype, name, { value(...args) { return this.toHTMLString()[name](...args); } }); } function create({ element, text, html, range, __unstableIsEditableTree: isEditableTree } = {}) { if (html instanceof RichTextData) { return { text: html.text, formats: html.formats, replacements: html.replacements }; } if (typeof text === "string" && text.length > 0) { return { formats: Array(text.length), replacements: Array(text.length), text }; } if (typeof html === "string" && html.length > 0) { element = createElement(document, html); } if (typeof element !== "object") { return createEmptyValue(); } return createFromElement({ element, range, isEditableTree }); } function accumulateSelection(accumulator, node, range, value) { if (!range) { return; } const { parentNode } = node; const { startContainer, startOffset, endContainer, endOffset } = range; const currentLength = accumulator.text.length; if (value.start !== void 0) { accumulator.start = currentLength + value.start; } else if (node === startContainer && node.nodeType === node.TEXT_NODE) { accumulator.start = currentLength + startOffset; } else if (parentNode === startContainer && node === startContainer.childNodes[startOffset]) { accumulator.start = currentLength; } else if (parentNode === startContainer && node === startContainer.childNodes[startOffset - 1]) { accumulator.start = currentLength + value.text.length; } else if (node === startContainer) { accumulator.start = currentLength; } if (value.end !== void 0) { accumulator.end = currentLength + value.end; } else if (node === endContainer && node.nodeType === node.TEXT_NODE) { accumulator.end = currentLength + endOffset; } else if (parentNode === endContainer && node === endContainer.childNodes[endOffset - 1]) { accumulator.end = currentLength + value.text.length; } else if (parentNode === endContainer && node === endContainer.childNodes[endOffset]) { accumulator.end = currentLength; } else if (node === endContainer) { accumulator.end = currentLength + endOffset; } } function filterRange(node, range, filter) { if (!range) { return; } const { startContainer, endContainer } = range; let { startOffset, endOffset } = range; if (node === startContainer) { startOffset = filter(node.nodeValue.slice(0, startOffset)).length; } if (node === endContainer) { endOffset = filter(node.nodeValue.slice(0, endOffset)).length; } return { startContainer, startOffset, endContainer, endOffset }; } function collapseWhiteSpace(element, isRoot = true) { const clone = element.cloneNode(true); clone.normalize(); Array.from(clone.childNodes).forEach((node, i, nodes) => { if (node.nodeType === node.TEXT_NODE) { let newNodeValue = node.nodeValue; if (/[\n\t\r\f]/.test(newNodeValue)) { newNodeValue = newNodeValue.replace(/[\n\t\r\f]+/g, " "); } if (newNodeValue.indexOf(" ") !== -1) { newNodeValue = newNodeValue.replace(/ {2,}/g, " "); } if (i === 0 && newNodeValue.startsWith(" ")) { newNodeValue = newNodeValue.slice(1); } else if (isRoot && i === nodes.length - 1 && newNodeValue.endsWith(" ")) { newNodeValue = newNodeValue.slice(0, -1); } node.nodeValue = newNodeValue; } else if (node.nodeType === node.ELEMENT_NODE) { node.replaceWith(collapseWhiteSpace(node, false)); } }); return clone; } const CARRIAGE_RETURN = "\r"; function removeReservedCharacters(string) { return string.replace( new RegExp( `[${ZWNBSP}${OBJECT_REPLACEMENT_CHARACTER}${CARRIAGE_RETURN}]`, "gu" ), "" ); } function createFromElement({ element, range, isEditableTree }) { const accumulator = createEmptyValue(); if (!element) { return accumulator; } if (!element.hasChildNodes()) { accumulateSelection(accumulator, element, range, createEmptyValue()); return accumulator; } const length = element.childNodes.length; for (let index = 0; index < length; index++) { const node = element.childNodes[index]; const tagName = node.nodeName.toLowerCase(); if (node.nodeType === node.TEXT_NODE) { const text = removeReservedCharacters(node.nodeValue); range = filterRange(node, range, removeReservedCharacters); accumulateSelection(accumulator, node, range, { text }); accumulator.formats.length += text.length; accumulator.replacements.length += text.length; accumulator.text += text; continue; } if (node.nodeType === node.COMMENT_NODE || node.nodeType === node.ELEMENT_NODE && node.tagName === "SPAN" && node.hasAttribute("data-rich-text-comment")) { const value2 = { formats: [,], replacements: [ { type: "#comment", attributes: { "data-rich-text-comment": node.nodeType === node.COMMENT_NODE ? node.nodeValue : node.getAttribute( "data-rich-text-comment" ) } } ], text: OBJECT_REPLACEMENT_CHARACTER }; accumulateSelection(accumulator, node, range, value2); mergePair(accumulator, value2); continue; } if (node.nodeType !== node.ELEMENT_NODE) { continue; } if (isEditableTree && // Ignore any line breaks that are not inserted by us. tagName === "br" && !node.getAttribute("data-rich-text-line-break")) { accumulateSelection(accumulator, node, range, createEmptyValue()); continue; } if (tagName === "script") { const value2 = { formats: [,], replacements: [ { type: tagName, attributes: { "data-rich-text-script": node.getAttribute("data-rich-text-script") || encodeURIComponent(node.innerHTML) } } ], text: OBJECT_REPLACEMENT_CHARACTER }; accumulateSelection(accumulator, node, range, value2); mergePair(accumulator, value2); continue; } if (tagName === "br") { accumulateSelection(accumulator, node, range, createEmptyValue()); mergePair(accumulator, create({ text: "\n" })); continue; } const format = toFormat({ tagName, attributes: getAttributes({ element: node }) }); if (format?.formatType?.contentEditable === false) { delete format.formatType; accumulateSelection(accumulator, node, range, createEmptyValue()); mergePair(accumulator, { formats: [,], replacements: [ { ...format, innerHTML: node.innerHTML } ], text: OBJECT_REPLACEMENT_CHARACTER }); continue; } if (format) { delete format.formatType; } const value = createFromElement({ element: node, range, isEditableTree }); accumulateSelection(accumulator, node, range, value); if (!format || node.getAttribute("data-rich-text-placeholder") || node.getAttribute("data-rich-text-bogus")) { mergePair(accumulator, value); } else if (value.text.length === 0) { if (format.attributes) { mergePair(accumulator, { formats: [,], replacements: [format], text: OBJECT_REPLACEMENT_CHARACTER }); } } else { let mergeFormats2 = function(formats) { if (mergeFormats2.formats === formats) { return mergeFormats2.newFormats; } const newFormats = formats ? [format, ...formats] : [format]; mergeFormats2.formats = formats; mergeFormats2.newFormats = newFormats; return newFormats; }; var mergeFormats = mergeFormats2; mergeFormats2.newFormats = [format]; mergePair(accumulator, { ...value, formats: Array.from(value.formats, mergeFormats2) }); } } return accumulator; } function getAttributes({ element }) { if (!element.hasAttributes()) { return; } const length = element.attributes.length; let accumulator; for (let i = 0; i < length; i++) { const { name, value } = element.attributes[i]; if (name.indexOf("data-rich-text-") === 0) { continue; } const safeName = /^on/i.test(name) ? "data-disable-rich-text-" + name : name; accumulator = accumulator || {}; accumulator[safeName] = value; } return accumulator; } ;// ./node_modules/@wordpress/rich-text/build-module/concat.js function mergePair(a, b) { a.formats = a.formats.concat(b.formats); a.replacements = a.replacements.concat(b.replacements); a.text += b.text; return a; } function concat(...values) { return normaliseFormats(values.reduce(mergePair, create())); } ;// ./node_modules/@wordpress/rich-text/build-module/get-active-format.js function getActiveFormat(value, formatType) { return getActiveFormats(value).find( ({ type }) => type === formatType ); } ;// ./node_modules/@wordpress/rich-text/build-module/get-active-object.js function getActiveObject({ start, end, replacements, text }) { if (start + 1 !== end || text[start] !== OBJECT_REPLACEMENT_CHARACTER) { return; } return replacements[start]; } ;// ./node_modules/@wordpress/rich-text/build-module/is-collapsed.js function isCollapsed({ start, end }) { if (start === void 0 || end === void 0) { return; } return start === end; } ;// ./node_modules/@wordpress/rich-text/build-module/is-empty.js function isEmpty({ text }) { return text.length === 0; } ;// ./node_modules/@wordpress/rich-text/build-module/join.js function join(values, separator = "") { if (typeof separator === "string") { separator = create({ text: separator }); } return normaliseFormats( values.reduce((accumulator, { formats, replacements, text }) => ({ formats: accumulator.formats.concat(separator.formats, formats), replacements: accumulator.replacements.concat( separator.replacements, replacements ), text: accumulator.text + separator.text + text })) ); } ;// ./node_modules/@wordpress/rich-text/build-module/register-format-type.js function registerFormatType(name, settings) { settings = { name, ...settings }; if (typeof settings.name !== "string") { window.console.error("Format names must be strings."); return; } if (!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(settings.name)) { window.console.error( "Format names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-format" ); return; } if ((0,external_wp_data_namespaceObject.select)(store).getFormatType(settings.name)) { window.console.error( 'Format "' + settings.name + '" is already registered.' ); return; } if (typeof settings.tagName !== "string" || settings.tagName === "") { window.console.error("Format tag names must be a string."); return; } if ((typeof settings.className !== "string" || settings.className === "") && settings.className !== null) { window.console.error( "Format class names must be a string, or null to handle bare elements." ); return; } if (!/^[_a-zA-Z]+[a-zA-Z0-9_-]*$/.test(settings.className)) { window.console.error( "A class name must begin with a letter, followed by any number of hyphens, underscores, letters, or numbers." ); return; } if (settings.className === null) { const formatTypeForBareElement = (0,external_wp_data_namespaceObject.select)( store ).getFormatTypeForBareElement(settings.tagName); if (formatTypeForBareElement && formatTypeForBareElement.name !== "core/unknown") { window.console.error( `Format "${formatTypeForBareElement.name}" is already registered to handle bare tag name "${settings.tagName}".` ); return; } } else { const formatTypeForClassName = (0,external_wp_data_namespaceObject.select)( store ).getFormatTypeForClassName(settings.className); if (formatTypeForClassName) { window.console.error( `Format "${formatTypeForClassName.name}" is already registered to handle class name "${settings.className}".` ); return; } } if (!("title" in settings) || settings.title === "") { window.console.error( 'The format "' + settings.name + '" must have a title.' ); return; } if ("keywords" in settings && settings.keywords.length > 3) { window.console.error( 'The format "' + settings.name + '" can have a maximum of 3 keywords.' ); return; } if (typeof settings.title !== "string") { window.console.error("Format titles must be strings."); return; } (0,external_wp_data_namespaceObject.dispatch)(store).addFormatTypes(settings); return settings; } ;// ./node_modules/@wordpress/rich-text/build-module/remove-format.js function removeFormat(value, formatType, startIndex = value.start, endIndex = value.end) { const { formats, activeFormats } = value; const newFormats = formats.slice(); if (startIndex === endIndex) { const format = newFormats[startIndex]?.find( ({ type }) => type === formatType ); if (format) { while (newFormats[startIndex]?.find( (newFormat) => newFormat === format )) { filterFormats(newFormats, startIndex, formatType); startIndex--; } endIndex++; while (newFormats[endIndex]?.find( (newFormat) => newFormat === format )) { filterFormats(newFormats, endIndex, formatType); endIndex++; } } } else { for (let i = startIndex; i < endIndex; i++) { if (newFormats[i]) { filterFormats(newFormats, i, formatType); } } } return normaliseFormats({ ...value, formats: newFormats, activeFormats: activeFormats?.filter(({ type }) => type !== formatType) || [] }); } function filterFormats(formats, index, formatType) { const newFormats = formats[index].filter( ({ type }) => type !== formatType ); if (newFormats.length) { formats[index] = newFormats; } else { delete formats[index]; } } ;// ./node_modules/@wordpress/rich-text/build-module/insert.js function insert(value, valueToInsert, startIndex = value.start, endIndex = value.end) { const { formats, replacements, text } = value; if (typeof valueToInsert === "string") { valueToInsert = create({ text: valueToInsert }); } const index = startIndex + valueToInsert.text.length; return normaliseFormats({ formats: formats.slice(0, startIndex).concat(valueToInsert.formats, formats.slice(endIndex)), replacements: replacements.slice(0, startIndex).concat( valueToInsert.replacements, replacements.slice(endIndex) ), text: text.slice(0, startIndex) + valueToInsert.text + text.slice(endIndex), start: index, end: index }); } ;// ./node_modules/@wordpress/rich-text/build-module/remove.js function remove_remove(value, startIndex, endIndex) { return insert(value, create(), startIndex, endIndex); } ;// ./node_modules/@wordpress/rich-text/build-module/replace.js function replace_replace({ formats, replacements, text, start, end }, pattern, replacement) { text = text.replace(pattern, (match, ...rest) => { const offset = rest[rest.length - 2]; let newText = replacement; let newFormats; let newReplacements; if (typeof newText === "function") { newText = replacement(match, ...rest); } if (typeof newText === "object") { newFormats = newText.formats; newReplacements = newText.replacements; newText = newText.text; } else { newFormats = Array(newText.length); newReplacements = Array(newText.length); if (formats[offset]) { newFormats = newFormats.fill(formats[offset]); } } formats = formats.slice(0, offset).concat(newFormats, formats.slice(offset + match.length)); replacements = replacements.slice(0, offset).concat( newReplacements, replacements.slice(offset + match.length) ); if (start) { start = end = offset + newText.length; } return newText; }); return normaliseFormats({ formats, replacements, text, start, end }); } ;// ./node_modules/@wordpress/rich-text/build-module/insert-object.js function insertObject(value, formatToInsert, startIndex, endIndex) { const valueToInsert = { formats: [,], replacements: [formatToInsert], text: OBJECT_REPLACEMENT_CHARACTER }; return insert(value, valueToInsert, startIndex, endIndex); } ;// ./node_modules/@wordpress/rich-text/build-module/slice.js function slice(value, startIndex = value.start, endIndex = value.end) { const { formats, replacements, text } = value; if (startIndex === void 0 || endIndex === void 0) { return { ...value }; } return { formats: formats.slice(startIndex, endIndex), replacements: replacements.slice(startIndex, endIndex), text: text.slice(startIndex, endIndex) }; } ;// ./node_modules/@wordpress/rich-text/build-module/split.js function split({ formats, replacements, text, start, end }, string) { if (typeof string !== "string") { return splitAtSelection(...arguments); } let nextStart = 0; return text.split(string).map((substring) => { const startIndex = nextStart; const value = { formats: formats.slice(startIndex, startIndex + substring.length), replacements: replacements.slice( startIndex, startIndex + substring.length ), text: substring }; nextStart += string.length + substring.length; if (start !== void 0 && end !== void 0) { if (start >= startIndex && start < nextStart) { value.start = start - startIndex; } else if (start < startIndex && end > startIndex) { value.start = 0; } if (end >= startIndex && end < nextStart) { value.end = end - startIndex; } else if (start < nextStart && end > nextStart) { value.end = substring.length; } } return value; }); } function splitAtSelection({ formats, replacements, text, start, end }, startIndex = start, endIndex = end) { if (start === void 0 || end === void 0) { return; } const before = { formats: formats.slice(0, startIndex), replacements: replacements.slice(0, startIndex), text: text.slice(0, startIndex) }; const after = { formats: formats.slice(endIndex), replacements: replacements.slice(endIndex), text: text.slice(endIndex), start: 0, end: 0 }; return [before, after]; } ;// ./node_modules/@wordpress/rich-text/build-module/is-range-equal.js function isRangeEqual(a, b) { return a === b || a && b && a.startContainer === b.startContainer && a.startOffset === b.startOffset && a.endContainer === b.endContainer && a.endOffset === b.endOffset; } ;// ./node_modules/@wordpress/rich-text/build-module/to-dom.js const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML"; function createPathToNode(node, rootNode, path) { const parentNode = node.parentNode; let i = 0; while (node = node.previousSibling) { i++; } path = [i, ...path]; if (parentNode !== rootNode) { path = createPathToNode(parentNode, rootNode, path); } return path; } function getNodeByPath(node, path) { path = [...path]; while (node && path.length > 1) { node = node.childNodes[path.shift()]; } return { node, offset: path[0] }; } function to_dom_append(element, child) { if (child.html !== void 0) { return element.innerHTML += child.html; } if (typeof child === "string") { child = element.ownerDocument.createTextNode(child); } const { type, attributes } = child; if (type) { if (type === "#comment") { child = element.ownerDocument.createComment( attributes["data-rich-text-comment"] ); } else { const parentNamespace = element.namespaceURI; if (type === "math") { child = element.ownerDocument.createElementNS( MATHML_NAMESPACE, type ); } else if (parentNamespace === MATHML_NAMESPACE) { if (element.tagName === "MTEXT") { child = element.ownerDocument.createElement(type); } else { child = element.ownerDocument.createElementNS( MATHML_NAMESPACE, type ); } } else { child = element.ownerDocument.createElement(type); } for (const key in attributes) { child.setAttribute(key, attributes[key]); } } } return element.appendChild(child); } function to_dom_appendText(node, text) { node.appendData(text); } function to_dom_getLastChild({ lastChild }) { return lastChild; } function to_dom_getParent({ parentNode }) { return parentNode; } function to_dom_isText(node) { return node.nodeType === node.TEXT_NODE; } function to_dom_getText({ nodeValue }) { return nodeValue; } function to_dom_remove(node) { return node.parentNode.removeChild(node); } function toDom({ value, prepareEditableTree, isEditableTree = true, placeholder, doc = document }) { let startPath = []; let endPath = []; if (prepareEditableTree) { value = { ...value, formats: prepareEditableTree(value) }; } const createEmpty = () => createElement(doc, ""); const tree = toTree({ value, createEmpty, append: to_dom_append, getLastChild: to_dom_getLastChild, getParent: to_dom_getParent, isText: to_dom_isText, getText: to_dom_getText, remove: to_dom_remove, appendText: to_dom_appendText, onStartIndex(body, pointer) { startPath = createPathToNode(pointer, body, [ pointer.nodeValue.length ]); }, onEndIndex(body, pointer) { endPath = createPathToNode(pointer, body, [ pointer.nodeValue.length ]); }, isEditableTree, placeholder }); return { body: tree, selection: { startPath, endPath } }; } function apply({ value, current, prepareEditableTree, __unstableDomOnly, placeholder }) { const { body, selection } = toDom({ value, prepareEditableTree, placeholder, doc: current.ownerDocument }); applyValue(body, current); if (value.start !== void 0 && !__unstableDomOnly) { applySelection(selection, current); } } function applyValue(future, current) { let i = 0; let futureChild; while (futureChild = future.firstChild) { const currentChild = current.childNodes[i]; if (!currentChild) { current.appendChild(futureChild); } else if (!currentChild.isEqualNode(futureChild)) { if (currentChild.nodeName !== futureChild.nodeName || currentChild.nodeType === currentChild.TEXT_NODE && currentChild.data !== futureChild.data) { current.replaceChild(futureChild, currentChild); } else { const currentAttributes = currentChild.attributes; const futureAttributes = futureChild.attributes; if (currentAttributes) { let ii = currentAttributes.length; while (ii--) { const { name } = currentAttributes[ii]; if (!futureChild.getAttribute(name)) { currentChild.removeAttribute(name); } } } if (futureAttributes) { for (let ii = 0; ii < futureAttributes.length; ii++) { const { name, value } = futureAttributes[ii]; if (currentChild.getAttribute(name) !== value) { currentChild.setAttribute(name, value); } } } applyValue(futureChild, currentChild); future.removeChild(futureChild); } } else { future.removeChild(futureChild); } i++; } while (current.childNodes[i]) { current.removeChild(current.childNodes[i]); } } function applySelection({ startPath, endPath }, current) { const { node: startContainer, offset: startOffset } = getNodeByPath( current, startPath ); const { node: endContainer, offset: endOffset } = getNodeByPath( current, endPath ); const { ownerDocument } = current; const { defaultView } = ownerDocument; const selection = defaultView.getSelection(); const range = ownerDocument.createRange(); range.setStart(startContainer, startOffset); range.setEnd(endContainer, endOffset); const { activeElement } = ownerDocument; if (selection.rangeCount > 0) { if (isRangeEqual(range, selection.getRangeAt(0))) { return; } selection.removeAllRanges(); } selection.addRange(range); if (activeElement !== ownerDocument.activeElement) { if (activeElement instanceof defaultView.HTMLElement) { activeElement.focus(); } } } ;// external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// ./node_modules/@wordpress/rich-text/build-module/toggle-format.js function toggleFormat(value, format) { if (getActiveFormat(value, format.type)) { if (format.title) { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("%s removed."), format.title), "assertive"); } return removeFormat(value, format.type); } if (format.title) { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("%s applied."), format.title), "assertive"); } return applyFormat(value, format); } ;// ./node_modules/@wordpress/rich-text/build-module/unregister-format-type.js function unregisterFormatType(name) { const oldFormat = (0,external_wp_data_namespaceObject.select)(store).getFormatType(name); if (!oldFormat) { window.console.error(`Format ${name} is not registered.`); return; } (0,external_wp_data_namespaceObject.dispatch)(store).removeFormatTypes(name); return oldFormat; } ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); ;// ./node_modules/@wordpress/rich-text/build-module/component/use-anchor-ref.js function useAnchorRef({ ref, value, settings = {} }) { external_wp_deprecated_default()("`useAnchorRef` hook", { since: "6.1", alternative: "`useAnchor` hook" }); const { tagName, className, name } = settings; const activeFormat = name ? getActiveFormat(value, name) : void 0; return (0,external_wp_element_namespaceObject.useMemo)(() => { if (!ref.current) { return; } const { ownerDocument: { defaultView } } = ref.current; const selection = defaultView.getSelection(); if (!selection.rangeCount) { return; } const range = selection.getRangeAt(0); if (!activeFormat) { return range; } let element = range.startContainer; element = element.nextElementSibling || element; while (element.nodeType !== element.ELEMENT_NODE) { element = element.parentNode; } return element.closest( tagName + (className ? "." + className : "") ); }, [activeFormat, value.start, value.end, tagName, className]); } ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// ./node_modules/@wordpress/rich-text/build-module/component/use-anchor.js function getFormatElement(range, editableContentElement, tagName, className) { let element = range.startContainer; if (element.nodeType === element.TEXT_NODE && range.startOffset === element.length && element.nextSibling) { element = element.nextSibling; while (element.firstChild) { element = element.firstChild; } } if (element.nodeType !== element.ELEMENT_NODE) { element = element.parentElement; } if (!element) { return; } if (element === editableContentElement) { return; } if (!editableContentElement.contains(element)) { return; } const selector = tagName + (className ? "." + className : ""); while (element !== editableContentElement) { if (element.matches(selector)) { return element; } element = element.parentElement; } } function createVirtualAnchorElement(range, editableContentElement) { return { contextElement: editableContentElement, getBoundingClientRect() { return editableContentElement.contains(range.startContainer) ? range.getBoundingClientRect() : editableContentElement.getBoundingClientRect(); } }; } function getAnchor(editableContentElement, tagName, className) { if (!editableContentElement) { return; } const { ownerDocument } = editableContentElement; const { defaultView } = ownerDocument; const selection = defaultView.getSelection(); if (!selection) { return; } if (!selection.rangeCount) { return; } const range = selection.getRangeAt(0); if (!range || !range.startContainer) { return; } const formatElement = getFormatElement( range, editableContentElement, tagName, className ); if (formatElement) { return formatElement; } return createVirtualAnchorElement(range, editableContentElement); } function useAnchor({ editableContentElement, settings = {} }) { const { tagName, className, isActive } = settings; const [anchor, setAnchor] = (0,external_wp_element_namespaceObject.useState)( () => getAnchor(editableContentElement, tagName, className) ); const wasActive = (0,external_wp_compose_namespaceObject.usePrevious)(isActive); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!editableContentElement) { return; } function callback() { setAnchor( getAnchor(editableContentElement, tagName, className) ); } function attach() { ownerDocument.addEventListener("selectionchange", callback); } function detach() { ownerDocument.removeEventListener("selectionchange", callback); } const { ownerDocument } = editableContentElement; if (editableContentElement === ownerDocument.activeElement || // When a link is created, we need to attach the popover to the newly created anchor. !wasActive && isActive || // Sometimes we're _removing_ an active anchor, such as the inline color popover. // When we add the color, it switches from a virtual anchor to a `<mark>` element. // When we _remove_ the color, it switches from a `<mark>` element to a virtual anchor. wasActive && !isActive) { setAnchor( getAnchor(editableContentElement, tagName, className) ); attach(); } editableContentElement.addEventListener("focusin", attach); editableContentElement.addEventListener("focusout", detach); return () => { detach(); editableContentElement.removeEventListener("focusin", attach); editableContentElement.removeEventListener("focusout", detach); }; }, [editableContentElement, tagName, className, isActive, wasActive]); return anchor; } ;// ./node_modules/@wordpress/rich-text/build-module/component/use-default-style.js const whiteSpace = "pre-wrap"; const minWidth = "1px"; function useDefaultStyle() { return (0,external_wp_element_namespaceObject.useCallback)((element) => { if (!element) { return; } element.style.whiteSpace = whiteSpace; element.style.minWidth = minWidth; }, []); } ;// ./node_modules/colord/index.mjs var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,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)||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}},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 j?r:new j(r)},S=(/* unused pure expression or super */ null && ([])),k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})}; ;// ./node_modules/@wordpress/rich-text/build-module/component/use-boundary-style.js function useBoundaryStyle({ record }) { const ref = (0,external_wp_element_namespaceObject.useRef)(); const { activeFormats = [], replacements, start } = record.current; const activeReplacement = replacements[start]; (0,external_wp_element_namespaceObject.useEffect)(() => { if ((!activeFormats || !activeFormats.length) && !activeReplacement) { return; } const boundarySelector = "*[data-rich-text-format-boundary]"; const element = ref.current.querySelector(boundarySelector); if (!element) { return; } const { ownerDocument } = element; const { defaultView } = ownerDocument; const computedStyle = defaultView.getComputedStyle(element); const newColor = w(computedStyle.color).alpha(0.2).toRgbString(); const selector = `.rich-text:focus ${boundarySelector}`; const rule = `background-color: ${newColor}`; const style = `${selector} {${rule}}`; const globalStyleId = "rich-text-boundary-style"; let globalStyle = ownerDocument.getElementById(globalStyleId); if (!globalStyle) { globalStyle = ownerDocument.createElement("style"); globalStyle.id = globalStyleId; ownerDocument.head.appendChild(globalStyle); } if (globalStyle.innerHTML !== style) { globalStyle.innerHTML = style; } }, [activeFormats, activeReplacement]); return ref; } ;// ./node_modules/@wordpress/rich-text/build-module/component/event-listeners/copy-handler.js var copy_handler_default = (props) => (element) => { function onCopy(event) { const { record } = props.current; const { ownerDocument } = element; if (isCollapsed(record.current) || !element.contains(ownerDocument.activeElement)) { return; } const selectedRecord = slice(record.current); const plainText = getTextContent(selectedRecord); const html = toHTMLString({ value: selectedRecord }); event.clipboardData.setData("text/plain", plainText); event.clipboardData.setData("text/html", html); event.clipboardData.setData("rich-text", "true"); event.preventDefault(); if (event.type === "cut") { ownerDocument.execCommand("delete"); } } const { defaultView } = element.ownerDocument; defaultView.addEventListener("copy", onCopy); defaultView.addEventListener("cut", onCopy); return () => { defaultView.removeEventListener("copy", onCopy); defaultView.removeEventListener("cut", onCopy); }; }; ;// ./node_modules/@wordpress/rich-text/build-module/component/event-listeners/select-object.js var select_object_default = () => (element) => { function onClick(event) { const { target } = event; if (target === element || target.textContent && target.isContentEditable) { return; } const { ownerDocument } = target; const { defaultView } = ownerDocument; const selection = defaultView.getSelection(); if (selection.containsNode(target)) { return; } const range = ownerDocument.createRange(); const nodeToSelect = target.isContentEditable ? target : target.closest("[contenteditable]"); range.selectNode(nodeToSelect); selection.removeAllRanges(); selection.addRange(range); event.preventDefault(); } function onFocusIn(event) { if (event.relatedTarget && !element.contains(event.relatedTarget) && event.relatedTarget.tagName === "A") { onClick(event); } } element.addEventListener("click", onClick); element.addEventListener("focusin", onFocusIn); return () => { element.removeEventListener("click", onClick); element.removeEventListener("focusin", onFocusIn); }; }; ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// ./node_modules/@wordpress/rich-text/build-module/component/event-listeners/format-boundaries.js const EMPTY_ACTIVE_FORMATS = []; var format_boundaries_default = (props) => (element) => { function onKeyDown(event) { const { keyCode, shiftKey, altKey, metaKey, ctrlKey } = event; if ( // Only override left and right keys without modifiers pressed. shiftKey || altKey || metaKey || ctrlKey || keyCode !== external_wp_keycodes_namespaceObject.LEFT && keyCode !== external_wp_keycodes_namespaceObject.RIGHT ) { return; } const { record, applyRecord, forceRender } = props.current; const { text, formats, start, end, activeFormats: currentActiveFormats = [] } = record.current; const collapsed = isCollapsed(record.current); const { ownerDocument } = element; const { defaultView } = ownerDocument; const { direction } = defaultView.getComputedStyle(element); const reverseKey = direction === "rtl" ? external_wp_keycodes_namespaceObject.RIGHT : external_wp_keycodes_namespaceObject.LEFT; const isReverse = event.keyCode === reverseKey; if (collapsed && currentActiveFormats.length === 0) { if (start === 0 && isReverse) { return; } if (end === text.length && !isReverse) { return; } } if (!collapsed) { return; } const formatsBefore = formats[start - 1] || EMPTY_ACTIVE_FORMATS; const formatsAfter = formats[start] || EMPTY_ACTIVE_FORMATS; const destination = isReverse ? formatsBefore : formatsAfter; const isIncreasing = currentActiveFormats.every( (format, index) => format === destination[index] ); let newActiveFormatsLength = currentActiveFormats.length; if (!isIncreasing) { newActiveFormatsLength--; } else if (newActiveFormatsLength < destination.length) { newActiveFormatsLength++; } if (newActiveFormatsLength === currentActiveFormats.length) { record.current._newActiveFormats = destination; return; } event.preventDefault(); const origin = isReverse ? formatsAfter : formatsBefore; const source = isIncreasing ? destination : origin; const newActiveFormats = source.slice(0, newActiveFormatsLength); const newValue = { ...record.current, activeFormats: newActiveFormats }; record.current = newValue; applyRecord(newValue); forceRender(); } element.addEventListener("keydown", onKeyDown); return () => { element.removeEventListener("keydown", onKeyDown); }; }; ;// ./node_modules/@wordpress/rich-text/build-module/component/event-listeners/delete.js var delete_default = (props) => (element) => { function onKeyDown(event) { const { keyCode } = event; const { createRecord, handleChange } = props.current; if (event.defaultPrevented) { return; } if (keyCode !== external_wp_keycodes_namespaceObject.DELETE && keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE) { return; } const currentValue = createRecord(); const { start, end, text } = currentValue; if (start === 0 && end !== 0 && end === text.length) { handleChange(remove_remove(currentValue)); event.preventDefault(); } } element.addEventListener("keydown", onKeyDown); return () => { element.removeEventListener("keydown", onKeyDown); }; }; ;// ./node_modules/@wordpress/rich-text/build-module/update-formats.js function updateFormats({ value, start, end, formats }) { const min = Math.min(start, end); const max = Math.max(start, end); const formatsBefore = value.formats[min - 1] || []; const formatsAfter = value.formats[max] || []; value.activeFormats = formats.map((format, index) => { if (formatsBefore[index]) { if (isFormatEqual(format, formatsBefore[index])) { return formatsBefore[index]; } } else if (formatsAfter[index]) { if (isFormatEqual(format, formatsAfter[index])) { return formatsAfter[index]; } } return format; }); while (--end >= start) { if (value.activeFormats.length > 0) { value.formats[end] = value.activeFormats; } else { delete value.formats[end]; } } return value; } ;// ./node_modules/@wordpress/rich-text/build-module/component/event-listeners/input-and-selection.js const INSERTION_INPUT_TYPES_TO_IGNORE = /* @__PURE__ */ new Set([ "insertParagraph", "insertOrderedList", "insertUnorderedList", "insertHorizontalRule", "insertLink" ]); const input_and_selection_EMPTY_ACTIVE_FORMATS = []; const PLACEHOLDER_ATTR_NAME = "data-rich-text-placeholder"; function fixPlaceholderSelection(defaultView) { const selection = defaultView.getSelection(); const { anchorNode, anchorOffset } = selection; if (anchorNode.nodeType !== anchorNode.ELEMENT_NODE) { return; } const targetNode = anchorNode.childNodes[anchorOffset]; if (!targetNode || targetNode.nodeType !== targetNode.ELEMENT_NODE || !targetNode.hasAttribute(PLACEHOLDER_ATTR_NAME)) { return; } selection.collapseToStart(); } var input_and_selection_default = (props) => (element) => { const { ownerDocument } = element; const { defaultView } = ownerDocument; let isComposing = false; function onInput(event) { if (isComposing) { return; } let inputType; if (event) { inputType = event.inputType; } const { record, applyRecord, createRecord, handleChange } = props.current; if (inputType && (inputType.indexOf("format") === 0 || INSERTION_INPUT_TYPES_TO_IGNORE.has(inputType))) { applyRecord(record.current); return; } const currentValue = createRecord(); const { start, activeFormats: oldActiveFormats = [] } = record.current; const change = updateFormats({ value: currentValue, start, end: currentValue.start, formats: oldActiveFormats }); handleChange(change); } function handleSelectionChange() { const { record, applyRecord, createRecord, onSelectionChange } = props.current; if (element.contentEditable !== "true") { return; } if (ownerDocument.activeElement !== element) { ownerDocument.removeEventListener( "selectionchange", handleSelectionChange ); return; } if (isComposing) { return; } const { start, end, text } = createRecord(); const oldRecord = record.current; if (text !== oldRecord.text) { onInput(); return; } if (start === oldRecord.start && end === oldRecord.end) { if (oldRecord.text.length === 0 && start === 0) { fixPlaceholderSelection(defaultView); } return; } const newValue = { ...oldRecord, start, end, // _newActiveFormats may be set on arrow key navigation to control // the right boundary position. If undefined, getActiveFormats will // give the active formats according to the browser. activeFormats: oldRecord._newActiveFormats, _newActiveFormats: void 0 }; const newActiveFormats = getActiveFormats( newValue, input_and_selection_EMPTY_ACTIVE_FORMATS ); newValue.activeFormats = newActiveFormats; record.current = newValue; applyRecord(newValue, { domOnly: true }); onSelectionChange(start, end); } function onCompositionStart() { isComposing = true; ownerDocument.removeEventListener( "selectionchange", handleSelectionChange ); element.querySelector(`[${PLACEHOLDER_ATTR_NAME}]`)?.remove(); } function onCompositionEnd() { isComposing = false; onInput({ inputType: "insertText" }); ownerDocument.addEventListener( "selectionchange", handleSelectionChange ); } function onFocus() { const { record, isSelected, onSelectionChange, applyRecord } = props.current; if (element.parentElement.closest('[contenteditable="true"]')) { return; } if (!isSelected) { const index = void 0; record.current = { ...record.current, start: index, end: index, activeFormats: input_and_selection_EMPTY_ACTIVE_FORMATS }; } else { applyRecord(record.current, { domOnly: true }); } onSelectionChange(record.current.start, record.current.end); window.queueMicrotask(handleSelectionChange); ownerDocument.addEventListener( "selectionchange", handleSelectionChange ); } element.addEventListener("input", onInput); element.addEventListener("compositionstart", onCompositionStart); element.addEventListener("compositionend", onCompositionEnd); element.addEventListener("focus", onFocus); return () => { element.removeEventListener("input", onInput); element.removeEventListener("compositionstart", onCompositionStart); element.removeEventListener("compositionend", onCompositionEnd); element.removeEventListener("focus", onFocus); }; }; ;// ./node_modules/@wordpress/rich-text/build-module/component/event-listeners/selection-change-compat.js var selection_change_compat_default = () => (element) => { const { ownerDocument } = element; const { defaultView } = ownerDocument; const selection = defaultView?.getSelection(); let range; function getRange() { return selection.rangeCount ? selection.getRangeAt(0) : null; } function onDown(event) { const type = event.type === "keydown" ? "keyup" : "pointerup"; function onCancel() { ownerDocument.removeEventListener(type, onUp); ownerDocument.removeEventListener("selectionchange", onCancel); ownerDocument.removeEventListener("input", onCancel); } function onUp() { onCancel(); if (isRangeEqual(range, getRange())) { return; } ownerDocument.dispatchEvent(new Event("selectionchange")); } ownerDocument.addEventListener(type, onUp); ownerDocument.addEventListener("selectionchange", onCancel); ownerDocument.addEventListener("input", onCancel); range = getRange(); } element.addEventListener("pointerdown", onDown); element.addEventListener("keydown", onDown); return () => { element.removeEventListener("pointerdown", onDown); element.removeEventListener("keydown", onDown); }; }; ;// ./node_modules/@wordpress/rich-text/build-module/component/event-listeners/prevent-focus-capture.js function preventFocusCapture() { return (element) => { const { ownerDocument } = element; const { defaultView } = ownerDocument; let value = null; function onPointerDown(event) { if (event.defaultPrevented) { return; } if (event.target === element) { return; } if (!event.target.contains(element)) { return; } value = element.getAttribute("contenteditable"); element.setAttribute("contenteditable", "false"); defaultView.getSelection().removeAllRanges(); } function onPointerUp() { if (value !== null) { element.setAttribute("contenteditable", value); value = null; } } defaultView.addEventListener("pointerdown", onPointerDown); defaultView.addEventListener("pointerup", onPointerUp); return () => { defaultView.removeEventListener("pointerdown", onPointerDown); defaultView.removeEventListener("pointerup", onPointerUp); }; }; } ;// ./node_modules/@wordpress/rich-text/build-module/component/event-listeners/index.js const allEventListeners = [ copy_handler_default, select_object_default, format_boundaries_default, delete_default, input_and_selection_default, selection_change_compat_default, preventFocusCapture ]; function useEventListeners(props) { const propsRef = (0,external_wp_element_namespaceObject.useRef)(props); (0,external_wp_element_namespaceObject.useInsertionEffect)(() => { propsRef.current = props; }); const refEffects = (0,external_wp_element_namespaceObject.useMemo)( () => allEventListeners.map((refEffect) => refEffect(propsRef)), [propsRef] ); return (0,external_wp_compose_namespaceObject.useRefEffect)( (element) => { const cleanups = refEffects.map((effect) => effect(element)); return () => { cleanups.forEach((cleanup) => cleanup()); }; }, [refEffects] ); } ;// ./node_modules/@wordpress/rich-text/build-module/component/index.js function useRichText({ value = "", selectionStart, selectionEnd, placeholder, onSelectionChange, preserveWhiteSpace, onChange, __unstableDisableFormats: disableFormats, __unstableIsSelected: isSelected, __unstableDependencies = [], __unstableAfterParse, __unstableBeforeSerialize, __unstableAddInvisibleFormats }) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const [, forceRender] = (0,external_wp_element_namespaceObject.useReducer)(() => ({})); const ref = (0,external_wp_element_namespaceObject.useRef)(); function createRecord() { const { ownerDocument: { defaultView } } = ref.current; const selection = defaultView.getSelection(); const range = selection.rangeCount > 0 ? selection.getRangeAt(0) : null; return create({ element: ref.current, range, __unstableIsEditableTree: true }); } function applyRecord(newRecord, { domOnly } = {}) { apply({ value: newRecord, current: ref.current, prepareEditableTree: __unstableAddInvisibleFormats, __unstableDomOnly: domOnly, placeholder }); } const _valueRef = (0,external_wp_element_namespaceObject.useRef)(value); const recordRef = (0,external_wp_element_namespaceObject.useRef)(); function setRecordFromProps() { _valueRef.current = value; recordRef.current = value; if (!(value instanceof RichTextData)) { recordRef.current = value ? RichTextData.fromHTMLString(value, { preserveWhiteSpace }) : RichTextData.empty(); } recordRef.current = { text: recordRef.current.text, formats: recordRef.current.formats, replacements: recordRef.current.replacements }; if (disableFormats) { recordRef.current.formats = Array(value.length); recordRef.current.replacements = Array(value.length); } if (__unstableAfterParse) { recordRef.current.formats = __unstableAfterParse( recordRef.current ); } recordRef.current.start = selectionStart; recordRef.current.end = selectionEnd; } const hadSelectionUpdateRef = (0,external_wp_element_namespaceObject.useRef)(false); if (!recordRef.current) { hadSelectionUpdateRef.current = isSelected; setRecordFromProps(); } else if (selectionStart !== recordRef.current.start || selectionEnd !== recordRef.current.end) { hadSelectionUpdateRef.current = isSelected; recordRef.current = { ...recordRef.current, start: selectionStart, end: selectionEnd, activeFormats: void 0 }; } function handleChange(newRecord) { recordRef.current = newRecord; applyRecord(newRecord); if (disableFormats) { _valueRef.current = newRecord.text; } else { const newFormats = __unstableBeforeSerialize ? __unstableBeforeSerialize(newRecord) : newRecord.formats; newRecord = { ...newRecord, formats: newFormats }; if (typeof value === "string") { _valueRef.current = toHTMLString({ value: newRecord, preserveWhiteSpace }); } else { _valueRef.current = new RichTextData(newRecord); } } const { start, end, formats, text } = recordRef.current; registry.batch(() => { onSelectionChange(start, end); onChange(_valueRef.current, { __unstableFormats: formats, __unstableText: text }); }); forceRender(); } function applyFromProps() { const previousValue = _valueRef.current; setRecordFromProps(); const contentLengthChanged = previousValue && typeof previousValue === "string" && typeof value === "string" && previousValue.length !== value.length; const hasFocus = ref.current?.contains( ref.current.ownerDocument.activeElement ); const skipSelection = contentLengthChanged && !hasFocus; applyRecord(recordRef.current, { domOnly: skipSelection }); } const didMountRef = (0,external_wp_element_namespaceObject.useRef)(false); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (didMountRef.current && value !== _valueRef.current) { applyFromProps(); forceRender(); } }, [value]); (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { if (!hadSelectionUpdateRef.current) { return; } if (ref.current.ownerDocument.activeElement !== ref.current) { ref.current.focus(); } applyRecord(recordRef.current); hadSelectionUpdateRef.current = false; }, [hadSelectionUpdateRef.current]); const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([ ref, useDefaultStyle(), useBoundaryStyle({ record: recordRef }), useEventListeners({ record: recordRef, handleChange, applyRecord, createRecord, isSelected, onSelectionChange, forceRender }), (0,external_wp_compose_namespaceObject.useRefEffect)(() => { applyFromProps(); didMountRef.current = true; }, [placeholder, ...__unstableDependencies]) ]); return { value: recordRef.current, // A function to get the most recent value so event handlers in // useRichText implementations have access to it. For example when // listening to input events, we internally update the state, but this // state is not yet available to the input event handler because React // may re-render asynchronously. getValue: () => recordRef.current, onChange: handleChange, ref: mergedRefs }; } function __experimentalRichText() { } ;// ./node_modules/@wordpress/rich-text/build-module/index.js (window.wp = window.wp || {}).richText = __webpack_exports__; /******/ })() ; priority-queue.min.js 0000644 00000006466 15151622574 0010713 0 ustar 00 /*! This file is auto-generated */ (()=>{var e={5033:(e,t,n)=>{var o,r,i;r=[],void 0===(i="function"==typeof(o=function(){"use strict";var e,t,o,r,i="undefined"!=typeof window?window:null!=typeof n.g?n.g:this||{},u=i.cancelRequestAnimationFrame&&i.requestAnimationFrame||setTimeout,a=i.cancelRequestAnimationFrame||clearTimeout,c=[],l=0,s=!1,d=7,f=35,m=125,b=0,p=0,v=0,w={get didTimeout(){return!1},timeRemaining:function(){var e=d-(Date.now()-p);return e<0?0:e}},y=g((function(){d=22,m=66,f=0}));function g(e){var t,n,o=99,r=function(){var i=Date.now()-n;i<o?t=setTimeout(r,o-i):(t=null,e())};return function(){n=Date.now(),t||(t=setTimeout(r,o))}}function h(){s&&(r&&a(r),o&&clearTimeout(o),s=!1)}function k(){125!=m&&(d=7,m=125,f=35,s&&(h(),C())),y()}function T(){r=null,o=setTimeout(D,0)}function q(){o=null,u(T)}function C(){s||(t=m-(Date.now()-p),e=Date.now(),s=!0,f&&t<f&&(t=f),t>9?o=setTimeout(q,t):(t=0,q()))}function D(){var n,r,i,u=d>9?9:1;if(p=Date.now(),s=!1,o=null,l>2||p-t-50<e)for(r=0,i=c.length;r<i&&w.timeRemaining()>u;r++)n=c.shift(),v++,n&&n(w);c.length?C():l=0}function I(e){return b++,c.push(e),C(),b}function O(e){var t=e-1-v;c[t]&&(c[t]=null)}if(i.requestIdleCallback&&i.cancelIdleCallback)try{i.requestIdleCallback((function(){}),{timeout:0})}catch(e){!function(e){var t,n;if(i.requestIdleCallback=function(t,n){return n&&"number"==typeof n.timeout?e(t,n.timeout):e(t)},i.IdleCallbackDeadline&&(t=IdleCallbackDeadline.prototype)){if(!(n=Object.getOwnPropertyDescriptor(t,"timeRemaining"))||!n.configurable||!n.get)return;Object.defineProperty(t,"timeRemaining",{value:function(){return n.get.call(this)},enumerable:!0,configurable:!0})}}(i.requestIdleCallback)}else i.requestIdleCallback=I,i.cancelIdleCallback=O,i.document&&document.addEventListener&&(i.addEventListener("scroll",k,!0),i.addEventListener("resize",k),document.addEventListener("focus",k,!0),document.addEventListener("mouseover",k,!0),["click","keypress","touchstart","mousedown"].forEach((function(e){document.addEventListener(e,k,{capture:!0,passive:!0})})),i.MutationObserver&&new MutationObserver(k).observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}));return{request:I,cancel:O}})?o.apply(t,r):o)||(e.exports=i)}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";n.r(o),n.d(o,{createQueue:()=>t});n(5033);var e="undefined"==typeof window?e=>{setTimeout((()=>e(Date.now())),0)}:window.requestIdleCallback;const t=()=>{const t=new Map;let n=!1;const o=r=>{for(const[e,n]of t)if(t.delete(e),n(),"number"==typeof r||r.timeRemaining()<=0)break;0!==t.size?e(o):n=!1};return{add:(r,i)=>{t.set(r,i),n||(n=!0,e(o))},flush:e=>{const n=t.get(e);return void 0!==n&&(t.delete(e),n(),!0)},cancel:e=>t.delete(e),reset:()=>{t.clear(),n=!1}}}})(),(window.wp=window.wp||{}).priorityQueue=o})(); edit-site.js 0000644 00007034713 15151622574 0007020 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 66: /***/ ((module) => { "use strict"; var isMergeableObject = function isMergeableObject(value) { return isNonNullObject(value) && !isSpecial(value) }; function isNonNullObject(value) { return !!value && typeof value === 'object' } function isSpecial(value) { var stringValue = Object.prototype.toString.call(value); return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value) } // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 var canUseSymbol = typeof Symbol === 'function' && Symbol.for; var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; function isReactElement(value) { return value.$$typeof === REACT_ELEMENT_TYPE } function emptyTarget(val) { return Array.isArray(val) ? [] : {} } function cloneUnlessOtherwiseSpecified(value, options) { return (options.clone !== false && options.isMergeableObject(value)) ? deepmerge(emptyTarget(value), value, options) : value } function defaultArrayMerge(target, source, options) { return target.concat(source).map(function(element) { return cloneUnlessOtherwiseSpecified(element, options) }) } function getMergeFunction(key, options) { if (!options.customMerge) { return deepmerge } var customMerge = options.customMerge(key); return typeof customMerge === 'function' ? customMerge : deepmerge } function getEnumerableOwnPropertySymbols(target) { return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) { return Object.propertyIsEnumerable.call(target, symbol) }) : [] } function getKeys(target) { return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) } function propertyIsOnObject(object, property) { try { return property in object } catch(_) { return false } } // Protects from prototype poisoning and unexpected merging up the prototype chain. function propertyIsUnsafe(target, key) { return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. } function mergeObject(target, source, options) { var destination = {}; if (options.isMergeableObject(target)) { getKeys(target).forEach(function(key) { destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); }); } getKeys(source).forEach(function(key) { if (propertyIsUnsafe(target, key)) { return } if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { destination[key] = getMergeFunction(key, options)(target[key], source[key], options); } else { destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); } }); return destination } function deepmerge(target, source, options) { options = options || {}; options.arrayMerge = options.arrayMerge || defaultArrayMerge; options.isMergeableObject = options.isMergeableObject || isMergeableObject; // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() // implementations can use it. The caller may not replace it. options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; var sourceIsArray = Array.isArray(source); var targetIsArray = Array.isArray(target); var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; if (!sourceAndTargetTypesMatch) { return cloneUnlessOtherwiseSpecified(source, options) } else if (sourceIsArray) { return options.arrayMerge(target, source, options) } else { return mergeObject(target, source, options) } } deepmerge.all = function deepmergeAll(array, options) { if (!Array.isArray(array)) { throw new Error('first argument should be an array') } return array.reduce(function(prev, next) { return deepmerge(prev, next, options) }, {}) }; var deepmerge_1 = deepmerge; module.exports = deepmerge_1; /***/ }), /***/ 83: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; /** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var React = __webpack_require__(1609); function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); } var objectIs = "function" === typeof Object.is ? Object.is : is, useState = React.useState, useEffect = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue; function useSyncExternalStore$2(subscribe, getSnapshot) { var value = getSnapshot(), _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1]; useLayoutEffect( function () { inst.value = value; inst.getSnapshot = getSnapshot; checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); }, [subscribe, value, getSnapshot] ); useEffect( function () { checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); return subscribe(function () { checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst }); }); }, [subscribe] ); useDebugValue(value); return value; } function checkIfSnapshotChanged(inst) { var latestGetSnapshot = inst.getSnapshot; inst = inst.value; try { var nextValue = latestGetSnapshot(); return !objectIs(inst, nextValue); } catch (error) { return !0; } } function useSyncExternalStore$1(subscribe, getSnapshot) { return getSnapshot(); } var shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; exports.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim; /***/ }), /***/ 422: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; if (true) { module.exports = __webpack_require__(83); } else {} /***/ }), /***/ 1233: /***/ ((module) => { "use strict"; module.exports = window["wp"]["preferences"]; /***/ }), /***/ 1609: /***/ ((module) => { "use strict"; module.exports = window["React"]; /***/ }), /***/ 4660: /***/ ((module) => { /** * Credits: * * lib-font * https://github.com/Pomax/lib-font * https://github.com/Pomax/lib-font/blob/master/lib/inflate.js * * The MIT License (MIT) * * Copyright (c) 2020 pomax@nihongoresources.com * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* eslint eslint-comments/no-unlimited-disable: 0 */ /* eslint-disable */ /* 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){ 'use strict'; var TYPED_OK = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Int32Array !== 'undefined'); function _has(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } exports.assign = function (obj /*from1, from2, from3, ...*/) { var sources = Array.prototype.slice.call(arguments, 1); while (sources.length) { var source = sources.shift(); if (!source) { continue; } if (typeof source !== 'object') { throw new TypeError(source + 'must be non-object'); } for (var p in source) { if (_has(source, p)) { obj[p] = source[p]; } } } return obj; }; // reduce buffer size, avoiding mem copy exports.shrinkBuf = function (buf, size) { if (buf.length === size) { return buf; } if (buf.subarray) { return buf.subarray(0, size); } buf.length = size; return buf; }; var fnTyped = { arraySet: function (dest, src, src_offs, len, dest_offs) { if (src.subarray && dest.subarray) { dest.set(src.subarray(src_offs, src_offs + len), dest_offs); return; } // Fallback to ordinary array for (var i = 0; i < len; i++) { dest[dest_offs + i] = src[src_offs + i]; } }, // Join array of chunks to single array. flattenChunks: function (chunks) { var i, l, len, pos, chunk, result; // calculate data length len = 0; for (i = 0, l = chunks.length; i < l; i++) { len += chunks[i].length; } // join chunks result = new Uint8Array(len); pos = 0; for (i = 0, l = chunks.length; i < l; i++) { chunk = chunks[i]; result.set(chunk, pos); pos += chunk.length; } return result; } }; var fnUntyped = { arraySet: function (dest, src, src_offs, len, dest_offs) { for (var i = 0; i < len; i++) { dest[dest_offs + i] = src[src_offs + i]; } }, // Join array of chunks to single array. flattenChunks: function (chunks) { return [].concat.apply([], chunks); } }; // Enable/Disable typed arrays use, for testing // exports.setTyped = function (on) { if (on) { exports.Buf8 = Uint8Array; exports.Buf16 = Uint16Array; exports.Buf32 = Int32Array; exports.assign(exports, fnTyped); } else { exports.Buf8 = Array; exports.Buf16 = Array; exports.Buf32 = Array; exports.assign(exports, fnUntyped); } }; exports.setTyped(TYPED_OK); },{}],2:[function(require,module,exports){ // String encode/decode helpers 'use strict'; var utils = require('./common'); // Quick check if we can use fast array to bin string conversion // // - apply(Array) can fail on Android 2.2 // - apply(Uint8Array) can fail on iOS 5.1 Safari // var STR_APPLY_OK = true; var STR_APPLY_UIA_OK = true; try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } // Table with utf8 lengths (calculated by first byte of sequence) // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, // because max possible codepoint is 0x10ffff var _utf8len = new utils.Buf8(256); for (var q = 0; q < 256; q++) { _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); } _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start // convert string to array (typed, when possible) exports.string2buf = function (str) { var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; // count binary size for (m_pos = 0; m_pos < str_len; m_pos++) { c = str.charCodeAt(m_pos); if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { c2 = str.charCodeAt(m_pos + 1); if ((c2 & 0xfc00) === 0xdc00) { c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); m_pos++; } } buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; } // allocate buffer buf = new utils.Buf8(buf_len); // convert for (i = 0, m_pos = 0; i < buf_len; m_pos++) { c = str.charCodeAt(m_pos); if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { c2 = str.charCodeAt(m_pos + 1); if ((c2 & 0xfc00) === 0xdc00) { c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); m_pos++; } } if (c < 0x80) { /* one byte */ buf[i++] = c; } else if (c < 0x800) { /* two bytes */ buf[i++] = 0xC0 | (c >>> 6); buf[i++] = 0x80 | (c & 0x3f); } else if (c < 0x10000) { /* three bytes */ buf[i++] = 0xE0 | (c >>> 12); buf[i++] = 0x80 | (c >>> 6 & 0x3f); buf[i++] = 0x80 | (c & 0x3f); } else { /* four bytes */ buf[i++] = 0xf0 | (c >>> 18); buf[i++] = 0x80 | (c >>> 12 & 0x3f); buf[i++] = 0x80 | (c >>> 6 & 0x3f); buf[i++] = 0x80 | (c & 0x3f); } } return buf; }; // Helper (used in 2 places) function buf2binstring(buf, len) { // On Chrome, the arguments in a function call that are allowed is `65534`. // If the length of the buffer is smaller than that, we can use this optimization, // otherwise we will take a slower path. if (len < 65534) { if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); } } var result = ''; for (var i = 0; i < len; i++) { result += String.fromCharCode(buf[i]); } return result; } // Convert byte array to binary string exports.buf2binstring = function (buf) { return buf2binstring(buf, buf.length); }; // Convert binary string (typed, when possible) exports.binstring2buf = function (str) { var buf = new utils.Buf8(str.length); for (var i = 0, len = buf.length; i < len; i++) { buf[i] = str.charCodeAt(i); } return buf; }; // convert array to string exports.buf2string = function (buf, max) { var i, out, c, c_len; var len = max || buf.length; // Reserve max possible length (2 words per char) // NB: by unknown reasons, Array is significantly faster for // String.fromCharCode.apply than Uint16Array. var utf16buf = new Array(len * 2); for (out = 0, i = 0; i < len;) { c = buf[i++]; // quick process ascii if (c < 0x80) { utf16buf[out++] = c; continue; } c_len = _utf8len[c]; // skip 5 & 6 byte codes if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } // apply mask on first byte c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; // join the rest while (c_len > 1 && i < len) { c = (c << 6) | (buf[i++] & 0x3f); c_len--; } // terminated by end of string? if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } if (c < 0x10000) { utf16buf[out++] = c; } else { c -= 0x10000; utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); utf16buf[out++] = 0xdc00 | (c & 0x3ff); } } return buf2binstring(utf16buf, out); }; // Calculate max possible position in utf8 buffer, // that will not break sequence. If that's not possible // - (very small limits) return max size as is. // // buf[] - utf8 bytes array // max - length limit (mandatory); exports.utf8border = function (buf, max) { var pos; max = max || buf.length; if (max > buf.length) { max = buf.length; } // go back from last position, until start of sequence found pos = max - 1; while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } // Very small and broken sequence, // return max, because we should return something anyway. if (pos < 0) { return max; } // If we came to start of buffer - that means buffer is too small, // return max too. if (pos === 0) { return max; } return (pos + _utf8len[buf[pos]] > max) ? pos : max; }; },{"./common":1}],3:[function(require,module,exports){ 'use strict'; // Note: adler32 takes 12% for level 0 and 2% for level 6. // It isn't worth it to make additional optimizations as in original. // Small size is preferable. // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. function adler32(adler, buf, len, pos) { var s1 = (adler & 0xffff) |0, s2 = ((adler >>> 16) & 0xffff) |0, n = 0; while (len !== 0) { // Set limit ~ twice less than 5552, to keep // s2 in 31-bits, because we force signed ints. // in other case %= will fail. n = len > 2000 ? 2000 : len; len -= n; do { s1 = (s1 + buf[pos++]) |0; s2 = (s2 + s1) |0; } while (--n); s1 %= 65521; s2 %= 65521; } return (s1 | (s2 << 16)) |0; } module.exports = adler32; },{}],4:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. module.exports = { /* Allowed flush values; see deflate() and inflate() below for details */ Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, //Z_MEM_ERROR: -4, Z_BUF_ERROR: -5, //Z_VERSION_ERROR: -6, /* compression levels */ Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, /* Possible values of the data_type field (though see inflate()) */ Z_BINARY: 0, Z_TEXT: 1, //Z_ASCII: 1, // = Z_TEXT (deprecated) Z_UNKNOWN: 2, /* The deflate compression method */ Z_DEFLATED: 8 //Z_NULL: null // Use -1 or null inline, depending on var type }; },{}],5:[function(require,module,exports){ 'use strict'; // Note: we can't get significant speed boost here. // So write code to minimize size - no pregenerated tables // and array tools dependencies. // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // Use ordinary array, since untyped makes no boost here function makeTable() { var c, table = []; for (var n = 0; n < 256; n++) { c = n; for (var k = 0; k < 8; k++) { c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); } table[n] = c; } return table; } // Create table on load. Just 255 signed longs. Not a problem. var crcTable = makeTable(); function crc32(crc, buf, len, pos) { var t = crcTable, end = pos + len; crc ^= -1; for (var i = pos; i < end; i++) { crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; } return (crc ^ (-1)); // >>> 0; } module.exports = crc32; },{}],6:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. function GZheader() { /* true if compressed data believed to be text */ this.text = 0; /* modification time */ this.time = 0; /* extra flags (not used when writing a gzip file) */ this.xflags = 0; /* operating system */ this.os = 0; /* pointer to extra field or Z_NULL if none */ this.extra = null; /* extra field length (valid if extra != Z_NULL) */ this.extra_len = 0; // Actually, we don't need it in JS, // but leave for few code modifications // // Setup limits is not necessary because in js we should not preallocate memory // for inflate use constant limit in 65536 bytes // /* space at extra (only when reading header) */ // this.extra_max = 0; /* pointer to zero-terminated file name or Z_NULL */ this.name = ''; /* space at name (only when reading header) */ // this.name_max = 0; /* pointer to zero-terminated comment or Z_NULL */ this.comment = ''; /* space at comment (only when reading header) */ // this.comm_max = 0; /* true if there was or will be a header crc */ this.hcrc = 0; /* true when done reading gzip header (not used when writing a gzip file) */ this.done = false; } module.exports = GZheader; },{}],7:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // See state defs from inflate.js var BAD = 30; /* got a data error -- remain here until reset */ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ /* Decode literal, length, and distance codes and write out the resulting literal and match bytes until either not enough input or output is available, an end-of-block is encountered, or a data error is encountered. When large enough input and output buffers are supplied to inflate(), for example, a 16K input buffer and a 64K output buffer, more than 95% of the inflate execution time is spent in this routine. Entry assumptions: state.mode === LEN strm.avail_in >= 6 strm.avail_out >= 258 start >= strm.avail_out state.bits < 8 On return, state.mode is one of: LEN -- ran out of enough output space or enough available input TYPE -- reached end of block code, inflate() to interpret next block BAD -- error in block data Notes: - The maximum input bits used by a length/distance pair is 15 bits for the length code, 5 bits for the length extra, 15 bits for the distance code, and 13 bits for the distance extra. This totals 48 bits, or six bytes. Therefore if strm.avail_in >= 6, then there is enough input to avoid checking for available input while decoding. - The maximum bytes that a single length/distance pair can output is 258 bytes, which is the maximum length that can be coded. inflate_fast() requires strm.avail_out >= 258 for each loop to avoid checking for output space. */ module.exports = function inflate_fast(strm, start) { var state; var _in; /* local strm.input */ var last; /* have enough input while in < last */ var _out; /* local strm.output */ var beg; /* inflate()'s initial strm.output */ var end; /* while out < end, enough space available */ //#ifdef INFLATE_STRICT var dmax; /* maximum distance from zlib header */ //#endif var wsize; /* window size or zero if not using window */ var whave; /* valid bytes in the window */ var wnext; /* window write index */ // Use `s_window` instead `window`, avoid conflict with instrumentation tools var s_window; /* allocated sliding window, if wsize != 0 */ var hold; /* local strm.hold */ var bits; /* local strm.bits */ var lcode; /* local strm.lencode */ var dcode; /* local strm.distcode */ var lmask; /* mask for first level of length codes */ var dmask; /* mask for first level of distance codes */ var here; /* retrieved table entry */ var op; /* code bits, operation, extra bits, or */ /* window position, window bytes to copy */ var len; /* match length, unused bytes */ var dist; /* match distance */ var from; /* where to copy match from */ var from_source; var input, output; // JS specific, because we have no pointers /* copy state to local variables */ state = strm.state; //here = state.here; _in = strm.next_in; input = strm.input; last = _in + (strm.avail_in - 5); _out = strm.next_out; output = strm.output; beg = _out - (start - strm.avail_out); end = _out + (strm.avail_out - 257); //#ifdef INFLATE_STRICT dmax = state.dmax; //#endif wsize = state.wsize; whave = state.whave; wnext = state.wnext; s_window = state.window; hold = state.hold; bits = state.bits; lcode = state.lencode; dcode = state.distcode; lmask = (1 << state.lenbits) - 1; dmask = (1 << state.distbits) - 1; /* decode literals and length/distances until end-of-block or not enough input data or output space */ top: do { if (bits < 15) { hold += input[_in++] << bits; bits += 8; hold += input[_in++] << bits; bits += 8; } here = lcode[hold & lmask]; dolen: for (;;) { // Goto emulation op = here >>> 24/*here.bits*/; hold >>>= op; bits -= op; op = (here >>> 16) & 0xff/*here.op*/; if (op === 0) { /* literal */ //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? // "inflate: literal '%c'\n" : // "inflate: literal 0x%02x\n", here.val)); output[_out++] = here & 0xffff/*here.val*/; } else if (op & 16) { /* length base */ len = here & 0xffff/*here.val*/; op &= 15; /* number of extra bits */ if (op) { if (bits < op) { hold += input[_in++] << bits; bits += 8; } len += hold & ((1 << op) - 1); hold >>>= op; bits -= op; } //Tracevv((stderr, "inflate: length %u\n", len)); if (bits < 15) { hold += input[_in++] << bits; bits += 8; hold += input[_in++] << bits; bits += 8; } here = dcode[hold & dmask]; dodist: for (;;) { // goto emulation op = here >>> 24/*here.bits*/; hold >>>= op; bits -= op; op = (here >>> 16) & 0xff/*here.op*/; if (op & 16) { /* distance base */ dist = here & 0xffff/*here.val*/; op &= 15; /* number of extra bits */ if (bits < op) { hold += input[_in++] << bits; bits += 8; if (bits < op) { hold += input[_in++] << bits; bits += 8; } } dist += hold & ((1 << op) - 1); //#ifdef INFLATE_STRICT if (dist > dmax) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break top; } //#endif hold >>>= op; bits -= op; //Tracevv((stderr, "inflate: distance %u\n", dist)); op = _out - beg; /* max distance in output */ if (dist > op) { /* see if copy from window */ op = dist - op; /* distance back in window */ if (op > whave) { if (state.sane) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break top; } // (!) This block is disabled in zlib defaults, // don't enable it for binary compatibility //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR // if (len <= op - whave) { // do { // output[_out++] = 0; // } while (--len); // continue top; // } // len -= op - whave; // do { // output[_out++] = 0; // } while (--op > whave); // if (op === 0) { // from = _out - dist; // do { // output[_out++] = output[from++]; // } while (--len); // continue top; // } //#endif } from = 0; // window index from_source = s_window; if (wnext === 0) { /* very common case */ from += wsize - op; if (op < len) { /* some from window */ len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } else if (wnext < op) { /* wrap around window */ from += wsize + wnext - op; op -= wnext; if (op < len) { /* some from end of window */ len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = 0; if (wnext < len) { /* some from start of window */ op = wnext; len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } } else { /* contiguous in window */ from += wnext - op; if (op < len) { /* some from window */ len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } while (len > 2) { output[_out++] = from_source[from++]; output[_out++] = from_source[from++]; output[_out++] = from_source[from++]; len -= 3; } if (len) { output[_out++] = from_source[from++]; if (len > 1) { output[_out++] = from_source[from++]; } } } else { from = _out - dist; /* copy direct from output */ do { /* minimum length is three */ output[_out++] = output[from++]; output[_out++] = output[from++]; output[_out++] = output[from++]; len -= 3; } while (len > 2); if (len) { output[_out++] = output[from++]; if (len > 1) { output[_out++] = output[from++]; } } } } else if ((op & 64) === 0) { /* 2nd level distance code */ here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; continue dodist; } else { strm.msg = 'invalid distance code'; state.mode = BAD; break top; } break; // need to emulate goto via "continue" } } else if ((op & 64) === 0) { /* 2nd level length code */ here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; continue dolen; } else if (op & 32) { /* end-of-block */ //Tracevv((stderr, "inflate: end of block\n")); state.mode = TYPE; break top; } else { strm.msg = 'invalid literal/length code'; state.mode = BAD; break top; } break; // need to emulate goto via "continue" } } while (_in < last && _out < end); /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ len = bits >> 3; _in -= len; bits -= len << 3; hold &= (1 << bits) - 1; /* update state and return */ strm.next_in = _in; strm.next_out = _out; strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); state.hold = hold; state.bits = bits; return; }; },{}],8:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. var utils = require('../utils/common'); var adler32 = require('./adler32'); var crc32 = require('./crc32'); var inflate_fast = require('./inffast'); var inflate_table = require('./inftrees'); var CODES = 0; var LENS = 1; var DISTS = 2; /* Public constants ==========================================================*/ /* ===========================================================================*/ /* Allowed flush values; see deflate() and inflate() below for details */ //var Z_NO_FLUSH = 0; //var Z_PARTIAL_FLUSH = 1; //var Z_SYNC_FLUSH = 2; //var Z_FULL_FLUSH = 3; var Z_FINISH = 4; var Z_BLOCK = 5; var Z_TREES = 6; /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ var Z_OK = 0; var Z_STREAM_END = 1; var Z_NEED_DICT = 2; //var Z_ERRNO = -1; var Z_STREAM_ERROR = -2; var Z_DATA_ERROR = -3; var Z_MEM_ERROR = -4; var Z_BUF_ERROR = -5; //var Z_VERSION_ERROR = -6; /* The deflate compression method */ var Z_DEFLATED = 8; /* STATES ====================================================================*/ /* ===========================================================================*/ var HEAD = 1; /* i: waiting for magic header */ var FLAGS = 2; /* i: waiting for method and flags (gzip) */ var TIME = 3; /* i: waiting for modification time (gzip) */ var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ var EXLEN = 5; /* i: waiting for extra length (gzip) */ var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ var NAME = 7; /* i: waiting for end of file name (gzip) */ var COMMENT = 8; /* i: waiting for end of comment (gzip) */ var HCRC = 9; /* i: waiting for header crc (gzip) */ var DICTID = 10; /* i: waiting for dictionary check value */ var DICT = 11; /* waiting for inflateSetDictionary() call */ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ var STORED = 14; /* i: waiting for stored size (length and complement) */ var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ var COPY = 16; /* i/o: waiting for input or output to copy stored block */ var TABLE = 17; /* i: waiting for dynamic block table lengths */ var LENLENS = 18; /* i: waiting for code length code lengths */ var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ var LEN_ = 20; /* i: same as LEN below, but only first time in */ var LEN = 21; /* i: waiting for length/lit/eob code */ var LENEXT = 22; /* i: waiting for length extra bits */ var DIST = 23; /* i: waiting for distance code */ var DISTEXT = 24; /* i: waiting for distance extra bits */ var MATCH = 25; /* o: waiting for output space to copy string */ var LIT = 26; /* o: waiting for output space to write literal */ var CHECK = 27; /* i: waiting for 32-bit check value */ var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ var DONE = 29; /* finished check, done -- remain here until reset */ var BAD = 30; /* got a data error -- remain here until reset */ var MEM = 31; /* got an inflate() memory error -- remain here until reset */ var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ /* ===========================================================================*/ var ENOUGH_LENS = 852; var ENOUGH_DISTS = 592; //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); var MAX_WBITS = 15; /* 32K LZ77 window */ var DEF_WBITS = MAX_WBITS; function zswap32(q) { return (((q >>> 24) & 0xff) + ((q >>> 8) & 0xff00) + ((q & 0xff00) << 8) + ((q & 0xff) << 24)); } function InflateState() { this.mode = 0; /* current inflate mode */ this.last = false; /* true if processing last block */ this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ this.havedict = false; /* true if dictionary provided */ this.flags = 0; /* gzip header method and flags (0 if zlib) */ this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ this.check = 0; /* protected copy of check value */ this.total = 0; /* protected copy of output count */ // TODO: may be {} this.head = null; /* where to save gzip header information */ /* sliding window */ this.wbits = 0; /* log base 2 of requested window size */ this.wsize = 0; /* window size or zero if not using window */ this.whave = 0; /* valid bytes in the window */ this.wnext = 0; /* window write index */ this.window = null; /* allocated sliding window, if needed */ /* bit accumulator */ this.hold = 0; /* input bit accumulator */ this.bits = 0; /* number of bits in "in" */ /* for string and stored block copying */ this.length = 0; /* literal or length of data to copy */ this.offset = 0; /* distance back to copy string from */ /* for table and code decoding */ this.extra = 0; /* extra bits needed */ /* fixed and dynamic code tables */ this.lencode = null; /* starting table for length/literal codes */ this.distcode = null; /* starting table for distance codes */ this.lenbits = 0; /* index bits for lencode */ this.distbits = 0; /* index bits for distcode */ /* dynamic table building */ this.ncode = 0; /* number of code length code lengths */ this.nlen = 0; /* number of length code lengths */ this.ndist = 0; /* number of distance code lengths */ this.have = 0; /* number of code lengths in lens[] */ this.next = null; /* next available space in codes[] */ this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ this.work = new utils.Buf16(288); /* work area for code table building */ /* because we don't have pointers in js, we use lencode and distcode directly as buffers so we don't need codes */ //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ this.distdyn = null; /* dynamic table for distance codes (JS specific) */ this.sane = 0; /* if false, allow invalid distance too far */ this.back = 0; /* bits back of last unprocessed length/lit */ this.was = 0; /* initial length of match */ } function inflateResetKeep(strm) { var state; if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; strm.total_in = strm.total_out = state.total = 0; strm.msg = ''; /*Z_NULL*/ if (state.wrap) { /* to support ill-conceived Java test suite */ strm.adler = state.wrap & 1; } state.mode = HEAD; state.last = 0; state.havedict = 0; state.dmax = 32768; state.head = null/*Z_NULL*/; state.hold = 0; state.bits = 0; //state.lencode = state.distcode = state.next = state.codes; state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); state.sane = 1; state.back = -1; //Tracev((stderr, "inflate: reset\n")); return Z_OK; } function inflateReset(strm) { var state; if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; state.wsize = 0; state.whave = 0; state.wnext = 0; return inflateResetKeep(strm); } function inflateReset2(strm, windowBits) { var wrap; var state; /* get the state */ if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; /* extract wrap request from windowBits parameter */ if (windowBits < 0) { wrap = 0; windowBits = -windowBits; } else { wrap = (windowBits >> 4) + 1; if (windowBits < 48) { windowBits &= 15; } } /* set number of window bits, free window if different */ if (windowBits && (windowBits < 8 || windowBits > 15)) { return Z_STREAM_ERROR; } if (state.window !== null && state.wbits !== windowBits) { state.window = null; } /* update state and reset the rest of it */ state.wrap = wrap; state.wbits = windowBits; return inflateReset(strm); } function inflateInit2(strm, windowBits) { var ret; var state; if (!strm) { return Z_STREAM_ERROR; } //strm.msg = Z_NULL; /* in case we return an error */ state = new InflateState(); //if (state === Z_NULL) return Z_MEM_ERROR; //Tracev((stderr, "inflate: allocated\n")); strm.state = state; state.window = null/*Z_NULL*/; ret = inflateReset2(strm, windowBits); if (ret !== Z_OK) { strm.state = null/*Z_NULL*/; } return ret; } function inflateInit(strm) { return inflateInit2(strm, DEF_WBITS); } /* Return state with length and distance decoding tables and index sizes set to fixed code decoding. Normally this returns fixed tables from inffixed.h. If BUILDFIXED is defined, then instead this routine builds the tables the first time it's called, and returns those tables the first time and thereafter. This reduces the size of the code by about 2K bytes, in exchange for a little execution time. However, BUILDFIXED should not be used for threaded applications, since the rewriting of the tables and virgin may not be thread-safe. */ var virgin = true; var lenfix, distfix; // We have no pointers in JS, so keep tables separate function fixedtables(state) { /* build fixed huffman tables if first call (may not be thread safe) */ if (virgin) { var sym; lenfix = new utils.Buf32(512); distfix = new utils.Buf32(32); /* literal/length table */ sym = 0; while (sym < 144) { state.lens[sym++] = 8; } while (sym < 256) { state.lens[sym++] = 9; } while (sym < 280) { state.lens[sym++] = 7; } while (sym < 288) { state.lens[sym++] = 8; } inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); /* distance table */ sym = 0; while (sym < 32) { state.lens[sym++] = 5; } inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); /* do this just once */ virgin = false; } state.lencode = lenfix; state.lenbits = 9; state.distcode = distfix; state.distbits = 5; } /* Update the window with the last wsize (normally 32K) bytes written before returning. If window does not exist yet, create it. This is only called when a window is already in use, or when output has been written during this inflate call, but the end of the deflate stream has not been reached yet. It is also called to create a window for dictionary data when a dictionary is loaded. Providing output buffers larger than 32K to inflate() should provide a speed advantage, since only the last 32K of output is copied to the sliding window upon return from inflate(), and since all distances after the first 32K of output will fall in the output data, making match copies simpler and faster. The advantage may be dependent on the size of the processor's data caches. */ function updatewindow(strm, src, end, copy) { var dist; var state = strm.state; /* if it hasn't been done already, allocate space for the window */ if (state.window === null) { state.wsize = 1 << state.wbits; state.wnext = 0; state.whave = 0; state.window = new utils.Buf8(state.wsize); } /* copy state->wsize or less output bytes into the circular window */ if (copy >= state.wsize) { utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); state.wnext = 0; state.whave = state.wsize; } else { dist = state.wsize - state.wnext; if (dist > copy) { dist = copy; } //zmemcpy(state->window + state->wnext, end - copy, dist); utils.arraySet(state.window, src, end - copy, dist, state.wnext); copy -= dist; if (copy) { //zmemcpy(state->window, end - copy, copy); utils.arraySet(state.window, src, end - copy, copy, 0); state.wnext = copy; state.whave = state.wsize; } else { state.wnext += dist; if (state.wnext === state.wsize) { state.wnext = 0; } if (state.whave < state.wsize) { state.whave += dist; } } } return 0; } function inflate(strm, flush) { var state; var input, output; // input/output buffers var next; /* next input INDEX */ var put; /* next output INDEX */ var have, left; /* available input and output */ var hold; /* bit buffer */ var bits; /* bits in bit buffer */ var _in, _out; /* save starting available input and output */ var copy; /* number of stored or match bytes to copy */ var from; /* where to copy match bytes from */ var from_source; var here = 0; /* current decoding table entry */ var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) //var last; /* parent table entry */ var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) var len; /* length to copy for repeats, bits to drop */ var ret; /* return code */ var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ var opts; var n; // temporary var for NEED_BITS var order = /* permutation of code lengths */ [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; if (!strm || !strm.state || !strm.output || (!strm.input && strm.avail_in !== 0)) { return Z_STREAM_ERROR; } state = strm.state; if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ //--- LOAD() --- put = strm.next_out; output = strm.output; left = strm.avail_out; next = strm.next_in; input = strm.input; have = strm.avail_in; hold = state.hold; bits = state.bits; //--- _in = have; _out = left; ret = Z_OK; inf_leave: // goto emulation for (;;) { switch (state.mode) { case HEAD: if (state.wrap === 0) { state.mode = TYPEDO; break; } //=== NEEDBITS(16); while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ state.check = 0/*crc32(0L, Z_NULL, 0)*/; //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = FLAGS; break; } state.flags = 0; /* expect zlib header */ if (state.head) { state.head.done = false; } if (!(state.wrap & 1) || /* check if zlib header allowed */ (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { strm.msg = 'incorrect header check'; state.mode = BAD; break; } if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { strm.msg = 'unknown compression method'; state.mode = BAD; break; } //--- DROPBITS(4) ---// hold >>>= 4; bits -= 4; //---// len = (hold & 0x0f)/*BITS(4)*/ + 8; if (state.wbits === 0) { state.wbits = len; } else if (len > state.wbits) { strm.msg = 'invalid window size'; state.mode = BAD; break; } state.dmax = 1 << len; //Tracev((stderr, "inflate: zlib header ok\n")); strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; state.mode = hold & 0x200 ? DICTID : TYPE; //=== INITBITS(); hold = 0; bits = 0; //===// break; case FLAGS: //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.flags = hold; if ((state.flags & 0xff) !== Z_DEFLATED) { strm.msg = 'unknown compression method'; state.mode = BAD; break; } if (state.flags & 0xe000) { strm.msg = 'unknown header flags set'; state.mode = BAD; break; } if (state.head) { state.head.text = ((hold >> 8) & 1); } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = TIME; /* falls through */ case TIME: //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (state.head) { state.head.time = hold; } if (state.flags & 0x0200) { //=== CRC4(state.check, hold) hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; hbuf[2] = (hold >>> 16) & 0xff; hbuf[3] = (hold >>> 24) & 0xff; state.check = crc32(state.check, hbuf, 4, 0); //=== } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = OS; /* falls through */ case OS: //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (state.head) { state.head.xflags = (hold & 0xff); state.head.os = (hold >> 8); } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = EXLEN; /* falls through */ case EXLEN: if (state.flags & 0x0400) { //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.length = hold; if (state.head) { state.head.extra_len = hold; } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// } else if (state.head) { state.head.extra = null/*Z_NULL*/; } state.mode = EXTRA; /* falls through */ case EXTRA: if (state.flags & 0x0400) { copy = state.length; if (copy > have) { copy = have; } if (copy) { if (state.head) { len = state.head.extra_len - state.length; if (!state.head.extra) { // Use untyped array for more convenient processing later state.head.extra = new Array(state.head.extra_len); } utils.arraySet( state.head.extra, input, next, // extra field is limited to 65536 bytes // - no need for additional size check copy, /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ len ); //zmemcpy(state.head.extra + len, next, // len + copy > state.head.extra_max ? // state.head.extra_max - len : copy); } if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; state.length -= copy; } if (state.length) { break inf_leave; } } state.length = 0; state.mode = NAME; /* falls through */ case NAME: if (state.flags & 0x0800) { if (have === 0) { break inf_leave; } copy = 0; do { // TODO: 2 or 1 bytes? len = input[next + copy++]; /* use constant limit because in js we should not preallocate memory */ if (state.head && len && (state.length < 65536 /*state.head.name_max*/)) { state.head.name += String.fromCharCode(len); } } while (len && copy < have); if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; if (len) { break inf_leave; } } else if (state.head) { state.head.name = null; } state.length = 0; state.mode = COMMENT; /* falls through */ case COMMENT: if (state.flags & 0x1000) { if (have === 0) { break inf_leave; } copy = 0; do { len = input[next + copy++]; /* use constant limit because in js we should not preallocate memory */ if (state.head && len && (state.length < 65536 /*state.head.comm_max*/)) { state.head.comment += String.fromCharCode(len); } } while (len && copy < have); if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; if (len) { break inf_leave; } } else if (state.head) { state.head.comment = null; } state.mode = HCRC; /* falls through */ case HCRC: if (state.flags & 0x0200) { //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (hold !== (state.check & 0xffff)) { strm.msg = 'header crc mismatch'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// } if (state.head) { state.head.hcrc = ((state.flags >> 9) & 1); state.head.done = true; } strm.adler = state.check = 0; state.mode = TYPE; break; case DICTID: //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// strm.adler = state.check = zswap32(hold); //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = DICT; /* falls through */ case DICT: if (state.havedict === 0) { //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- return Z_NEED_DICT; } strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; state.mode = TYPE; /* falls through */ case TYPE: if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } /* falls through */ case TYPEDO: if (state.last) { //--- BYTEBITS() ---// hold >>>= bits & 7; bits -= bits & 7; //---// state.mode = CHECK; break; } //=== NEEDBITS(3); */ while (bits < 3) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.last = (hold & 0x01)/*BITS(1)*/; //--- DROPBITS(1) ---// hold >>>= 1; bits -= 1; //---// switch ((hold & 0x03)/*BITS(2)*/) { case 0: /* stored block */ //Tracev((stderr, "inflate: stored block%s\n", // state.last ? " (last)" : "")); state.mode = STORED; break; case 1: /* fixed block */ fixedtables(state); //Tracev((stderr, "inflate: fixed codes block%s\n", // state.last ? " (last)" : "")); state.mode = LEN_; /* decode codes */ if (flush === Z_TREES) { //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// break inf_leave; } break; case 2: /* dynamic block */ //Tracev((stderr, "inflate: dynamic codes block%s\n", // state.last ? " (last)" : "")); state.mode = TABLE; break; case 3: strm.msg = 'invalid block type'; state.mode = BAD; } //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// break; case STORED: //--- BYTEBITS() ---// /* go to byte boundary */ hold >>>= bits & 7; bits -= bits & 7; //---// //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { strm.msg = 'invalid stored block lengths'; state.mode = BAD; break; } state.length = hold & 0xffff; //Tracev((stderr, "inflate: stored length %u\n", // state.length)); //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = COPY_; if (flush === Z_TREES) { break inf_leave; } /* falls through */ case COPY_: state.mode = COPY; /* falls through */ case COPY: copy = state.length; if (copy) { if (copy > have) { copy = have; } if (copy > left) { copy = left; } if (copy === 0) { break inf_leave; } //--- zmemcpy(put, next, copy); --- utils.arraySet(output, input, next, copy, put); //---// have -= copy; next += copy; left -= copy; put += copy; state.length -= copy; break; } //Tracev((stderr, "inflate: stored end\n")); state.mode = TYPE; break; case TABLE: //=== NEEDBITS(14); */ while (bits < 14) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; //--- DROPBITS(5) ---// hold >>>= 5; bits -= 5; //---// state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; //--- DROPBITS(5) ---// hold >>>= 5; bits -= 5; //---// state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; //--- DROPBITS(4) ---// hold >>>= 4; bits -= 4; //---// //#ifndef PKZIP_BUG_WORKAROUND if (state.nlen > 286 || state.ndist > 30) { strm.msg = 'too many length or distance symbols'; state.mode = BAD; break; } //#endif //Tracev((stderr, "inflate: table sizes ok\n")); state.have = 0; state.mode = LENLENS; /* falls through */ case LENLENS: while (state.have < state.ncode) { //=== NEEDBITS(3); while (bits < 3) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); //--- DROPBITS(3) ---// hold >>>= 3; bits -= 3; //---// } while (state.have < 19) { state.lens[order[state.have++]] = 0; } // We have separate tables & no pointers. 2 commented lines below not needed. //state.next = state.codes; //state.lencode = state.next; // Switch to use dynamic table state.lencode = state.lendyn; state.lenbits = 7; opts = { bits: state.lenbits }; ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); state.lenbits = opts.bits; if (ret) { strm.msg = 'invalid code lengths set'; state.mode = BAD; break; } //Tracev((stderr, "inflate: code lengths ok\n")); state.have = 0; state.mode = CODELENS; /* falls through */ case CODELENS: while (state.have < state.nlen + state.ndist) { for (;;) { here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if (here_val < 16) { //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.lens[state.have++] = here_val; } else { if (here_val === 16) { //=== NEEDBITS(here.bits + 2); n = here_bits + 2; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// if (state.have === 0) { strm.msg = 'invalid bit length repeat'; state.mode = BAD; break; } len = state.lens[state.have - 1]; copy = 3 + (hold & 0x03);//BITS(2); //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// } else if (here_val === 17) { //=== NEEDBITS(here.bits + 3); n = here_bits + 3; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// len = 0; copy = 3 + (hold & 0x07);//BITS(3); //--- DROPBITS(3) ---// hold >>>= 3; bits -= 3; //---// } else { //=== NEEDBITS(here.bits + 7); n = here_bits + 7; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// len = 0; copy = 11 + (hold & 0x7f);//BITS(7); //--- DROPBITS(7) ---// hold >>>= 7; bits -= 7; //---// } if (state.have + copy > state.nlen + state.ndist) { strm.msg = 'invalid bit length repeat'; state.mode = BAD; break; } while (copy--) { state.lens[state.have++] = len; } } } /* handle error breaks in while */ if (state.mode === BAD) { break; } /* check for end-of-block code (better have one) */ if (state.lens[256] === 0) { strm.msg = 'invalid code -- missing end-of-block'; state.mode = BAD; break; } /* build code tables -- note: do not change the lenbits or distbits values here (9 and 6) without reading the comments in inftrees.h concerning the ENOUGH constants, which depend on those values */ state.lenbits = 9; opts = { bits: state.lenbits }; ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed. // state.next_index = opts.table_index; state.lenbits = opts.bits; // state.lencode = state.next; if (ret) { strm.msg = 'invalid literal/lengths set'; state.mode = BAD; break; } state.distbits = 6; //state.distcode.copy(state.codes); // Switch to use dynamic table state.distcode = state.distdyn; opts = { bits: state.distbits }; ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed. // state.next_index = opts.table_index; state.distbits = opts.bits; // state.distcode = state.next; if (ret) { strm.msg = 'invalid distances set'; state.mode = BAD; break; } //Tracev((stderr, 'inflate: codes ok\n')); state.mode = LEN_; if (flush === Z_TREES) { break inf_leave; } /* falls through */ case LEN_: state.mode = LEN; /* falls through */ case LEN: if (have >= 6 && left >= 258) { //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- inflate_fast(strm, _out); //--- LOAD() --- put = strm.next_out; output = strm.output; left = strm.avail_out; next = strm.next_in; input = strm.input; have = strm.avail_in; hold = state.hold; bits = state.bits; //--- if (state.mode === TYPE) { state.back = -1; } break; } state.back = 0; for (;;) { here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if (here_bits <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if (here_op && (here_op & 0xf0) === 0) { last_bits = here_bits; last_op = here_op; last_val = here_val; for (;;) { here = state.lencode[last_val + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((last_bits + here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } //--- DROPBITS(last.bits) ---// hold >>>= last_bits; bits -= last_bits; //---// state.back += last_bits; } //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.back += here_bits; state.length = here_val; if (here_op === 0) { //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? // "inflate: literal '%c'\n" : // "inflate: literal 0x%02x\n", here.val)); state.mode = LIT; break; } if (here_op & 32) { //Tracevv((stderr, "inflate: end of block\n")); state.back = -1; state.mode = TYPE; break; } if (here_op & 64) { strm.msg = 'invalid literal/length code'; state.mode = BAD; break; } state.extra = here_op & 15; state.mode = LENEXT; /* falls through */ case LENEXT: if (state.extra) { //=== NEEDBITS(state.extra); n = state.extra; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; //--- DROPBITS(state.extra) ---// hold >>>= state.extra; bits -= state.extra; //---// state.back += state.extra; } //Tracevv((stderr, "inflate: length %u\n", state.length)); state.was = state.length; state.mode = DIST; /* falls through */ case DIST: for (;;) { here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if ((here_op & 0xf0) === 0) { last_bits = here_bits; last_op = here_op; last_val = here_val; for (;;) { here = state.distcode[last_val + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((last_bits + here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } //--- DROPBITS(last.bits) ---// hold >>>= last_bits; bits -= last_bits; //---// state.back += last_bits; } //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.back += here_bits; if (here_op & 64) { strm.msg = 'invalid distance code'; state.mode = BAD; break; } state.offset = here_val; state.extra = (here_op) & 15; state.mode = DISTEXT; /* falls through */ case DISTEXT: if (state.extra) { //=== NEEDBITS(state.extra); n = state.extra; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; //--- DROPBITS(state.extra) ---// hold >>>= state.extra; bits -= state.extra; //---// state.back += state.extra; } //#ifdef INFLATE_STRICT if (state.offset > state.dmax) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break; } //#endif //Tracevv((stderr, "inflate: distance %u\n", state.offset)); state.mode = MATCH; /* falls through */ case MATCH: if (left === 0) { break inf_leave; } copy = _out - left; if (state.offset > copy) { /* copy from window */ copy = state.offset - copy; if (copy > state.whave) { if (state.sane) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break; } // (!) This block is disabled in zlib defaults, // don't enable it for binary compatibility //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR // Trace((stderr, "inflate.c too far\n")); // copy -= state.whave; // if (copy > state.length) { copy = state.length; } // if (copy > left) { copy = left; } // left -= copy; // state.length -= copy; // do { // output[put++] = 0; // } while (--copy); // if (state.length === 0) { state.mode = LEN; } // break; //#endif } if (copy > state.wnext) { copy -= state.wnext; from = state.wsize - copy; } else { from = state.wnext - copy; } if (copy > state.length) { copy = state.length; } from_source = state.window; } else { /* copy from output */ from_source = output; from = put - state.offset; copy = state.length; } if (copy > left) { copy = left; } left -= copy; state.length -= copy; do { output[put++] = from_source[from++]; } while (--copy); if (state.length === 0) { state.mode = LEN; } break; case LIT: if (left === 0) { break inf_leave; } output[put++] = state.length; left--; state.mode = LEN; break; case CHECK: if (state.wrap) { //=== NEEDBITS(32); while (bits < 32) { if (have === 0) { break inf_leave; } have--; // Use '|' instead of '+' to make sure that result is signed hold |= input[next++] << bits; bits += 8; } //===// _out -= left; strm.total_out += _out; state.total += _out; if (_out) { strm.adler = state.check = /*UPDATE(state.check, put - _out, _out);*/ (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); } _out = left; // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too if ((state.flags ? hold : zswap32(hold)) !== state.check) { strm.msg = 'incorrect data check'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// //Tracev((stderr, "inflate: check matches trailer\n")); } state.mode = LENGTH; /* falls through */ case LENGTH: if (state.wrap && state.flags) { //=== NEEDBITS(32); while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (hold !== (state.total & 0xffffffff)) { strm.msg = 'incorrect length check'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// //Tracev((stderr, "inflate: length matches trailer\n")); } state.mode = DONE; /* falls through */ case DONE: ret = Z_STREAM_END; break inf_leave; case BAD: ret = Z_DATA_ERROR; break inf_leave; case MEM: return Z_MEM_ERROR; case SYNC: /* falls through */ default: return Z_STREAM_ERROR; } } // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" /* Return from inflate(), updating the total counts and the check value. If there was no progress during the inflate() call, return a buffer error. Call updatewindow() to create and/or update the window state. Note: a memory error from inflate() is non-recoverable. */ //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH))) { if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { state.mode = MEM; return Z_MEM_ERROR; } } _in -= strm.avail_in; _out -= strm.avail_out; strm.total_in += _in; strm.total_out += _out; state.total += _out; if (state.wrap && _out) { strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); } strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { ret = Z_BUF_ERROR; } return ret; } function inflateEnd(strm) { if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { return Z_STREAM_ERROR; } var state = strm.state; if (state.window) { state.window = null; } strm.state = null; return Z_OK; } function inflateGetHeader(strm, head) { var state; /* check state */ if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } /* save header structure */ state.head = head; head.done = false; return Z_OK; } function inflateSetDictionary(strm, dictionary) { var dictLength = dictionary.length; var state; var dictid; var ret; /* check state */ if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } state = strm.state; if (state.wrap !== 0 && state.mode !== DICT) { return Z_STREAM_ERROR; } /* check for correct dictionary identifier */ if (state.mode === DICT) { dictid = 1; /* adler32(0, null, 0)*/ /* dictid = adler32(dictid, dictionary, dictLength); */ dictid = adler32(dictid, dictionary, dictLength, 0); if (dictid !== state.check) { return Z_DATA_ERROR; } } /* copy dictionary to window using updatewindow(), which will amend the existing dictionary if appropriate */ ret = updatewindow(strm, dictionary, dictLength, dictLength); if (ret) { state.mode = MEM; return Z_MEM_ERROR; } state.havedict = 1; // Tracev((stderr, "inflate: dictionary set\n")); return Z_OK; } exports.inflateReset = inflateReset; exports.inflateReset2 = inflateReset2; exports.inflateResetKeep = inflateResetKeep; exports.inflateInit = inflateInit; exports.inflateInit2 = inflateInit2; exports.inflate = inflate; exports.inflateEnd = inflateEnd; exports.inflateGetHeader = inflateGetHeader; exports.inflateSetDictionary = inflateSetDictionary; exports.inflateInfo = 'pako inflate (from Nodeca project)'; /* Not implemented exports.inflateCopy = inflateCopy; exports.inflateGetDictionary = inflateGetDictionary; exports.inflateMark = inflateMark; exports.inflatePrime = inflatePrime; exports.inflateSync = inflateSync; exports.inflateSyncPoint = inflateSyncPoint; exports.inflateUndermine = inflateUndermine; */ },{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. var utils = require('../utils/common'); var MAXBITS = 15; var ENOUGH_LENS = 852; var ENOUGH_DISTS = 592; //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); var CODES = 0; var LENS = 1; var DISTS = 2; var lbase = [ /* Length codes 257..285 base */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 ]; var lext = [ /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 ]; var dbase = [ /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0 ]; var dext = [ /* Distance codes 0..29 extra */ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64 ]; module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) { var bits = opts.bits; //here = opts.here; /* table entry for duplication */ var len = 0; /* a code's length in bits */ var sym = 0; /* index of code symbols */ var min = 0, max = 0; /* minimum and maximum code lengths */ var root = 0; /* number of index bits for root table */ var curr = 0; /* number of index bits for current table */ var drop = 0; /* code bits to drop for sub-table */ var left = 0; /* number of prefix codes available */ var used = 0; /* code entries in table used */ var huff = 0; /* Huffman code */ var incr; /* for incrementing code, index */ var fill; /* index for replicating entries */ var low; /* low bits for current root entry */ var mask; /* mask for low root bits */ var next; /* next available space in table */ var base = null; /* base value table to use */ var base_index = 0; // var shoextra; /* extra bits table to use */ var end; /* use base and extra for symbol > end */ var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ var extra = null; var extra_index = 0; var here_bits, here_op, here_val; /* Process a set of code lengths to create a canonical Huffman code. The code lengths are lens[0..codes-1]. Each length corresponds to the symbols 0..codes-1. The Huffman code is generated by first sorting the symbols by length from short to long, and retaining the symbol order for codes with equal lengths. Then the code starts with all zero bits for the first code of the shortest length, and the codes are integer increments for the same length, and zeros are appended as the length increases. For the deflate format, these bits are stored backwards from their more natural integer increment ordering, and so when the decoding tables are built in the large loop below, the integer codes are incremented backwards. This routine assumes, but does not check, that all of the entries in lens[] are in the range 0..MAXBITS. The caller must assure this. 1..MAXBITS is interpreted as that code length. zero means that that symbol does not occur in this code. The codes are sorted by computing a count of codes for each length, creating from that a table of starting indices for each length in the sorted table, and then entering the symbols in order in the sorted table. The sorted table is work[], with that space being provided by the caller. The length counts are used for other purposes as well, i.e. finding the minimum and maximum length codes, determining if there are any codes at all, checking for a valid set of lengths, and looking ahead at length counts to determine sub-table sizes when building the decoding tables. */ /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ for (len = 0; len <= MAXBITS; len++) { count[len] = 0; } for (sym = 0; sym < codes; sym++) { count[lens[lens_index + sym]]++; } /* bound code lengths, force root to be within code lengths */ root = bits; for (max = MAXBITS; max >= 1; max--) { if (count[max] !== 0) { break; } } if (root > max) { root = max; } if (max === 0) { /* no symbols to code at all */ //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ //table.bits[opts.table_index] = 1; //here.bits = (var char)1; //table.val[opts.table_index++] = 0; //here.val = (var short)0; table[table_index++] = (1 << 24) | (64 << 16) | 0; //table.op[opts.table_index] = 64; //table.bits[opts.table_index] = 1; //table.val[opts.table_index++] = 0; table[table_index++] = (1 << 24) | (64 << 16) | 0; opts.bits = 1; return 0; /* no symbols, but wait for decoding to report error */ } for (min = 1; min < max; min++) { if (count[min] !== 0) { break; } } if (root < min) { root = min; } /* check for an over-subscribed or incomplete set of lengths */ left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= count[len]; if (left < 0) { return -1; } /* over-subscribed */ } if (left > 0 && (type === CODES || max !== 1)) { return -1; /* incomplete set */ } /* generate offsets into symbol table for each length for sorting */ offs[1] = 0; for (len = 1; len < MAXBITS; len++) { offs[len + 1] = offs[len] + count[len]; } /* sort symbols by length, by symbol order within each length */ for (sym = 0; sym < codes; sym++) { if (lens[lens_index + sym] !== 0) { work[offs[lens[lens_index + sym]]++] = sym; } } /* Create and fill in decoding tables. In this loop, the table being filled is at next and has curr index bits. The code being used is huff with length len. That code is converted to an index by dropping drop bits off of the bottom. For codes where len is less than drop + curr, those top drop + curr - len bits are incremented through all values to fill the table with replicated entries. root is the number of index bits for the root table. When len exceeds root, sub-tables are created pointed to by the root entry with an index of the low root bits of huff. This is saved in low to check for when a new sub-table should be started. drop is zero when the root table is being filled, and drop is root when sub-tables are being filled. When a new sub-table is needed, it is necessary to look ahead in the code lengths to determine what size sub-table is needed. The length counts are used for this, and so count[] is decremented as codes are entered in the tables. used keeps track of how many table entries have been allocated from the provided *table space. It is checked for LENS and DIST tables against the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in the initial root table size constants. See the comments in inftrees.h for more information. sym increments through all symbols, and the loop terminates when all codes of length max, i.e. all codes, have been processed. This routine permits incomplete codes, so another loop after this one fills in the rest of the decoding tables with invalid code markers. */ /* set up for code type */ // poor man optimization - use if-else instead of switch, // to avoid deopts in old v8 if (type === CODES) { base = extra = work; /* dummy value--not used */ end = 19; } else if (type === LENS) { base = lbase; base_index -= 257; extra = lext; extra_index -= 257; end = 256; } else { /* DISTS */ base = dbase; extra = dext; end = -1; } /* initialize opts for loop */ huff = 0; /* starting code */ sym = 0; /* starting code symbol */ len = min; /* starting code length */ next = table_index; /* current table to fill in */ curr = root; /* current table index bits */ drop = 0; /* current bits to drop from code for index */ low = -1; /* trigger new sub-table when len > root */ used = 1 << root; /* use root table entries */ mask = used - 1; /* mask for comparing low */ /* check available table space */ if ((type === LENS && used > ENOUGH_LENS) || (type === DISTS && used > ENOUGH_DISTS)) { return 1; } /* process all codes and make table entries */ for (;;) { /* create table entry */ here_bits = len - drop; if (work[sym] < end) { here_op = 0; here_val = work[sym]; } else if (work[sym] > end) { here_op = extra[extra_index + work[sym]]; here_val = base[base_index + work[sym]]; } else { here_op = 32 + 64; /* end of block */ here_val = 0; } /* replicate for those indices with low len bits equal to huff */ incr = 1 << (len - drop); fill = 1 << curr; min = fill; /* save offset to next table */ do { fill -= incr; table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; } while (fill !== 0); /* backwards increment the len-bit code huff */ incr = 1 << (len - 1); while (huff & incr) { incr >>= 1; } if (incr !== 0) { huff &= incr - 1; huff += incr; } else { huff = 0; } /* go to next symbol, update count, len */ sym++; if (--count[len] === 0) { if (len === max) { break; } len = lens[lens_index + work[sym]]; } /* create new sub-table if needed */ if (len > root && (huff & mask) !== low) { /* if first time, transition to sub-tables */ if (drop === 0) { drop = root; } /* increment past last table */ next += min; /* here min is 1 << curr */ /* determine length of next table */ curr = len - drop; left = 1 << curr; while (curr + drop < max) { left -= count[curr + drop]; if (left <= 0) { break; } curr++; left <<= 1; } /* check for enough space */ used += 1 << curr; if ((type === LENS && used > ENOUGH_LENS) || (type === DISTS && used > ENOUGH_DISTS)) { return 1; } /* point entry in root table to sub-table */ low = huff & mask; /*table.op[low] = curr; table.bits[low] = root; table.val[low] = next - opts.table_index;*/ table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; } } /* fill in remaining table entry if code is incomplete (guaranteed to have at most one remaining entry, since if the code is incomplete, the maximum code length that was allowed to get this far is one bit) */ if (huff !== 0) { //table.op[next + huff] = 64; /* invalid code marker */ //table.bits[next + huff] = len - drop; //table.val[next + huff] = 0; table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; } /* set return parameters */ //opts.table_index += used; opts.bits = root; return 0; }; },{"../utils/common":1}],10:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. module.exports = { 2: 'need dictionary', /* Z_NEED_DICT 2 */ 1: 'stream end', /* Z_STREAM_END 1 */ 0: '', /* Z_OK 0 */ '-1': 'file error', /* Z_ERRNO (-1) */ '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ '-3': 'data error', /* Z_DATA_ERROR (-3) */ '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ }; },{}],11:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. function ZStream() { /* next input byte */ this.input = null; // JS specific, because we have no pointers this.next_in = 0; /* number of bytes available at input */ this.avail_in = 0; /* total number of input bytes read so far */ this.total_in = 0; /* next output byte should be put there */ this.output = null; // JS specific, because we have no pointers this.next_out = 0; /* remaining free space at output */ this.avail_out = 0; /* total number of bytes output so far */ this.total_out = 0; /* last error message, NULL if no error */ this.msg = ''/*Z_NULL*/; /* not visible by applications */ this.state = null; /* best guess about the data type: binary or text */ this.data_type = 2/*Z_UNKNOWN*/; /* adler32 value of the uncompressed data */ this.adler = 0; } module.exports = ZStream; },{}],"/lib/inflate.js":[function(require,module,exports){ 'use strict'; var zlib_inflate = require('./zlib/inflate'); var utils = require('./utils/common'); var strings = require('./utils/strings'); var c = require('./zlib/constants'); var msg = require('./zlib/messages'); var ZStream = require('./zlib/zstream'); var GZheader = require('./zlib/gzheader'); var toString = Object.prototype.toString; /** * class Inflate * * Generic JS-style wrapper for zlib calls. If you don't need * streaming behaviour - use more simple functions: [[inflate]] * and [[inflateRaw]]. **/ /* internal * inflate.chunks -> Array * * Chunks of output data, if [[Inflate#onData]] not overridden. **/ /** * Inflate.result -> Uint8Array|Array|String * * Uncompressed result, generated by default [[Inflate#onData]] * and [[Inflate#onEnd]] handlers. Filled after you push last chunk * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you * push a chunk with explicit flush (call [[Inflate#push]] with * `Z_SYNC_FLUSH` param). **/ /** * Inflate.err -> Number * * Error code after inflate finished. 0 (Z_OK) on success. * Should be checked if broken data possible. **/ /** * Inflate.msg -> String * * Error message, if [[Inflate.err]] != 0 **/ /** * new Inflate(options) * - options (Object): zlib inflate options. * * Creates new inflator instance with specified params. Throws exception * on bad params. Supported options: * * - `windowBits` * - `dictionary` * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information on these. * * Additional options, for internal needs: * * - `chunkSize` - size of generated data chunks (16K by default) * - `raw` (Boolean) - do raw inflate * - `to` (String) - if equal to 'string', then result will be converted * from utf8 to utf16 (javascript) string. When string output requested, * chunk length can differ from `chunkSize`, depending on content. * * By default, when no options set, autodetect deflate/gzip data format via * wrapper header. * * ##### Example: * * ```javascript * var pako = require('pako') * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); * * var inflate = new pako.Inflate({ level: 3}); * * inflate.push(chunk1, false); * inflate.push(chunk2, true); // true -> last chunk * * if (inflate.err) { throw new Error(inflate.err); } * * console.log(inflate.result); * ``` **/ function Inflate(options) { if (!(this instanceof Inflate)) return new Inflate(options); this.options = utils.assign({ chunkSize: 16384, windowBits: 0, to: '' }, options || {}); var opt = this.options; // Force window size for `raw` data, if not set directly, // because we have no header for autodetect. if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { opt.windowBits = -opt.windowBits; if (opt.windowBits === 0) { opt.windowBits = -15; } } // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate if ((opt.windowBits >= 0) && (opt.windowBits < 16) && !(options && options.windowBits)) { opt.windowBits += 32; } // Gzip header has no info about windows size, we can do autodetect only // for deflate. So, if window size not set, force it to max when gzip possible if ((opt.windowBits > 15) && (opt.windowBits < 48)) { // bit 3 (16) -> gzipped data // bit 4 (32) -> autodetect gzip/deflate if ((opt.windowBits & 15) === 0) { opt.windowBits |= 15; } } this.err = 0; // error code, if happens (0 = Z_OK) this.msg = ''; // error message this.ended = false; // used to avoid multiple onEnd() calls this.chunks = []; // chunks of compressed data this.strm = new ZStream(); this.strm.avail_out = 0; var status = zlib_inflate.inflateInit2( this.strm, opt.windowBits ); if (status !== c.Z_OK) { throw new Error(msg[status]); } this.header = new GZheader(); zlib_inflate.inflateGetHeader(this.strm, this.header); // Setup dictionary if (opt.dictionary) { // Convert data if needed if (typeof opt.dictionary === 'string') { opt.dictionary = strings.string2buf(opt.dictionary); } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { opt.dictionary = new Uint8Array(opt.dictionary); } if (opt.raw) { //In raw mode we need to set the dictionary early status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary); if (status !== c.Z_OK) { throw new Error(msg[status]); } } } } /** * Inflate#push(data[, mode]) -> Boolean * - data (Uint8Array|Array|ArrayBuffer|String): input data * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. * * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with * new output chunks. Returns `true` on success. The last data block must have * mode Z_FINISH (or `true`). That will flush internal pending buffers and call * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you * can use mode Z_SYNC_FLUSH, keeping the decompression context. * * On fail call [[Inflate#onEnd]] with error code and return false. * * We strongly recommend to use `Uint8Array` on input for best speed (output * format is detected automatically). Also, don't skip last param and always * use the same type in your code (boolean or number). That will improve JS speed. * * For regular `Array`-s make sure all elements are [0..255]. * * ##### Example * * ```javascript * push(chunk, false); // push one of data chunks * ... * push(chunk, true); // push last chunk * ``` **/ Inflate.prototype.push = function (data, mode) { var strm = this.strm; var chunkSize = this.options.chunkSize; var dictionary = this.options.dictionary; var status, _mode; var next_out_utf8, tail, utf8str; // Flag to properly process Z_BUF_ERROR on testing inflate call // when we check that all output data was flushed. var allowBufError = false; if (this.ended) { return false; } _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); // Convert data if needed if (typeof data === 'string') { // Only binary strings can be decompressed on practice strm.input = strings.binstring2buf(data); } else if (toString.call(data) === '[object ArrayBuffer]') { strm.input = new Uint8Array(data); } else { strm.input = data; } strm.next_in = 0; strm.avail_in = strm.input.length; do { if (strm.avail_out === 0) { strm.output = new utils.Buf8(chunkSize); strm.next_out = 0; strm.avail_out = chunkSize; } status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ if (status === c.Z_NEED_DICT && dictionary) { status = zlib_inflate.inflateSetDictionary(this.strm, dictionary); } if (status === c.Z_BUF_ERROR && allowBufError === true) { status = c.Z_OK; allowBufError = false; } if (status !== c.Z_STREAM_END && status !== c.Z_OK) { this.onEnd(status); this.ended = true; return false; } if (strm.next_out) { if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) { if (this.options.to === 'string') { next_out_utf8 = strings.utf8border(strm.output, strm.next_out); tail = strm.next_out - next_out_utf8; utf8str = strings.buf2string(strm.output, next_out_utf8); // move tail strm.next_out = tail; strm.avail_out = chunkSize - tail; if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } this.onData(utf8str); } else { this.onData(utils.shrinkBuf(strm.output, strm.next_out)); } } } // When no more input data, we should check that internal inflate buffers // are flushed. The only way to do it when avail_out = 0 - run one more // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR. // Here we set flag to process this error properly. // // NOTE. Deflate does not return error in this case and does not needs such // logic. if (strm.avail_in === 0 && strm.avail_out === 0) { allowBufError = true; } } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END); if (status === c.Z_STREAM_END) { _mode = c.Z_FINISH; } // Finalize on the last chunk. if (_mode === c.Z_FINISH) { status = zlib_inflate.inflateEnd(this.strm); this.onEnd(status); this.ended = true; return status === c.Z_OK; } // callback interim results if Z_SYNC_FLUSH. if (_mode === c.Z_SYNC_FLUSH) { this.onEnd(c.Z_OK); strm.avail_out = 0; return true; } return true; }; /** * Inflate#onData(chunk) -> Void * - chunk (Uint8Array|Array|String): output data. Type of array depends * on js engine support. When string output requested, each chunk * will be string. * * By default, stores data blocks in `chunks[]` property and glue * those in `onEnd`. Override this handler, if you need another behaviour. **/ Inflate.prototype.onData = function (chunk) { this.chunks.push(chunk); }; /** * Inflate#onEnd(status) -> Void * - status (Number): inflate status. 0 (Z_OK) on success, * other if not. * * Called either after you tell inflate that the input stream is * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) * or if an error happened. By default - join collected chunks, * free memory and fill `results` / `err` properties. **/ Inflate.prototype.onEnd = function (status) { // On success - join if (status === c.Z_OK) { if (this.options.to === 'string') { // Glue & convert here, until we teach pako to send // utf8 aligned strings to onData this.result = this.chunks.join(''); } else { this.result = utils.flattenChunks(this.chunks); } } this.chunks = []; this.err = status; this.msg = this.strm.msg; }; /** * inflate(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * Decompress `data` with inflate/ungzip and `options`. Autodetect * format via wrapper header by default. That's why we don't provide * separate `ungzip` method. * * Supported options are: * * - windowBits * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information. * * Sugar (options): * * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify * negative windowBits implicitly. * - `to` (String) - if equal to 'string', then result will be converted * from utf8 to utf16 (javascript) string. When string output requested, * chunk length can differ from `chunkSize`, depending on content. * * * ##### Example: * * ```javascript * var pako = require('pako') * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) * , output; * * try { * output = pako.inflate(input); * } catch (err) * console.log(err); * } * ``` **/ function inflate(input, options) { var inflator = new Inflate(options); inflator.push(input, true); // That will never happens, if you don't cheat with options :) if (inflator.err) { throw inflator.msg || msg[inflator.err]; } return inflator.result; } /** * inflateRaw(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * The same as [[inflate]], but creates raw data, without wrapper * (header and adler32 crc). **/ function inflateRaw(input, options) { options = options || {}; options.raw = true; return inflate(input, options); } /** * ungzip(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * Just shortcut to [[inflate]], because it autodetects format * by header.content. Done for convenience. **/ exports.Inflate = Inflate; exports.inflate = inflate; exports.inflateRaw = inflateRaw; exports.ungzip = inflate; },{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js") }); /* eslint-enable */ /***/ }), /***/ 6087: /***/ ((module) => { "use strict"; module.exports = window["wp"]["element"]; /***/ }), /***/ 7143: /***/ ((module) => { "use strict"; module.exports = window["wp"]["data"]; /***/ }), /***/ 7734: /***/ ((module) => { "use strict"; // do not edit .js files directly - edit src/index.jst var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; module.exports = function equal(a, b) { if (a === b) return true; if (a && b && typeof a == 'object' && typeof b == 'object') { if (a.constructor !== b.constructor) return false; var length, i, keys; if (Array.isArray(a)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false; return true; } if ((a instanceof Map) && (b instanceof Map)) { if (a.size !== b.size) return false; for (i of a.entries()) if (!b.has(i[0])) return false; for (i of a.entries()) if (!equal(i[1], b.get(i[0]))) return false; return true; } if ((a instanceof Set) && (b instanceof Set)) { if (a.size !== b.size) return false; for (i of a.entries()) if (!b.has(i[0])) return false; return true; } if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false; return true; } if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; for (i = length; i-- !== 0;) { var key = keys[i]; if (!equal(a[key], b[key])) return false; } return true; } // true if both NaN, false otherwise return a!==a && b!==b; }; /***/ }), /***/ 7951: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { loadView: () => (/* reexport */ loadView), useView: () => (/* reexport */ useView) }); ;// ./node_modules/dequal/dist/index.mjs var has = Object.prototype.hasOwnProperty; function find(iter, tar, key) { for (key of iter.keys()) { if (dequal(key, tar)) return key; } } function dequal(foo, bar) { var ctor, len, tmp; if (foo === bar) return true; if (foo && bar && (ctor=foo.constructor) === bar.constructor) { if (ctor === Date) return foo.getTime() === bar.getTime(); if (ctor === RegExp) return foo.toString() === bar.toString(); if (ctor === Array) { if ((len=foo.length) === bar.length) { while (len-- && dequal(foo[len], bar[len])); } return len === -1; } if (ctor === Set) { if (foo.size !== bar.size) { return false; } for (len of foo) { tmp = len; if (tmp && typeof tmp === 'object') { tmp = find(bar, tmp); if (!tmp) return false; } if (!bar.has(tmp)) return false; } return true; } if (ctor === Map) { if (foo.size !== bar.size) { return false; } for (len of foo) { tmp = len[0]; if (tmp && typeof tmp === 'object') { tmp = find(bar, tmp); if (!tmp) return false; } if (!dequal(len[1], bar.get(tmp))) { return false; } } return true; } if (ctor === ArrayBuffer) { foo = new Uint8Array(foo); bar = new Uint8Array(bar); } else if (ctor === DataView) { if ((len=foo.byteLength) === bar.byteLength) { while (len-- && foo.getInt8(len) === bar.getInt8(len)); } return len === -1; } if (ArrayBuffer.isView(foo)) { if ((len=foo.byteLength) === bar.byteLength) { while (len-- && foo[len] === bar[len]); } return len === -1; } if (!ctor || typeof foo === 'object') { len = 0; for (ctor in foo) { if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false; if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false; } return Object.keys(bar).length === len; } } return foo !== foo && bar !== bar; } ;// ./node_modules/@wordpress/views/build-module/preference-keys.js function generatePreferenceKey(kind, name, slug) { return `dataviews-${kind}-${name}-${slug}`; } // EXTERNAL MODULE: external ["wp","element"] var external_wp_element_ = __webpack_require__(6087); // EXTERNAL MODULE: external ["wp","data"] var external_wp_data_ = __webpack_require__(7143); // EXTERNAL MODULE: external ["wp","preferences"] var external_wp_preferences_ = __webpack_require__(1233); ;// ./node_modules/@wordpress/views/build-module/use-view.js function omit(obj, keys) { const result = { ...obj }; for (const key of keys) { delete result[key]; } return result; } function useView(config) { const { kind, name, slug, defaultView, queryParams, onChangeQueryParams } = config; const preferenceKey = generatePreferenceKey(kind, name, slug); const persistedView = (0,external_wp_data_.useSelect)( (select) => { return select(external_wp_preferences_.store).get( "core/views", preferenceKey ); }, [preferenceKey] ); const { set } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); const baseView = persistedView ?? defaultView; const page = Number(queryParams?.page ?? baseView.page ?? 1); const search = queryParams?.search ?? baseView.search ?? ""; const view = (0,external_wp_element_.useMemo)(() => { return { ...baseView, page, search }; }, [baseView, page, search]); const isModified = !!persistedView; const updateView = (0,external_wp_element_.useCallback)( (newView) => { const urlParams = { page: newView?.page, search: newView?.search }; const preferenceView = omit(newView, ["page", "search"]); if (onChangeQueryParams && !dequal(urlParams, { page, search })) { onChangeQueryParams(urlParams); } if (!dequal(baseView, preferenceView)) { if (dequal(preferenceView, defaultView)) { set("core/views", preferenceKey, void 0); } else { set("core/views", preferenceKey, preferenceView); } } }, [ onChangeQueryParams, page, search, baseView, defaultView, set, preferenceKey ] ); const resetToDefault = (0,external_wp_element_.useCallback)(() => { set("core/views", preferenceKey, void 0); }, [preferenceKey, set]); return { view, isModified, updateView, resetToDefault }; } ;// ./node_modules/@wordpress/views/build-module/load-view.js async function loadView(config) { const { kind, name, slug, defaultView, queryParams } = config; const preferenceKey = generatePreferenceKey(kind, name, slug); const persistedView = (0,external_wp_data_.select)(external_wp_preferences_.store).get( "core/views", preferenceKey ); const baseView = persistedView ?? defaultView; const page = queryParams?.page ?? 1; const search = queryParams?.search ?? ""; return { ...baseView, page, search }; } ;// ./node_modules/@wordpress/views/build-module/index.js /***/ }), /***/ 8572: /***/ ((module) => { /** * Credits: * * lib-font * https://github.com/Pomax/lib-font * https://github.com/Pomax/lib-font/blob/master/lib/unbrotli.js * * The MIT License (MIT) * * Copyright (c) 2020 pomax@nihongoresources.com * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* eslint eslint-comments/no-unlimited-disable: 0 */ /* eslint-disable */ (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){ /* Copyright 2013 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Bit reading helpers */ var BROTLI_READ_SIZE = 4096; var BROTLI_IBUF_SIZE = (2 * BROTLI_READ_SIZE + 32); var BROTLI_IBUF_MASK = (2 * BROTLI_READ_SIZE - 1); var kBitMask = new Uint32Array([ 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215 ]); /* Input byte buffer, consist of a ringbuffer and a "slack" region where */ /* bytes from the start of the ringbuffer are copied. */ function BrotliBitReader(input) { this.buf_ = new Uint8Array(BROTLI_IBUF_SIZE); this.input_ = input; /* input callback */ this.reset(); } BrotliBitReader.READ_SIZE = BROTLI_READ_SIZE; BrotliBitReader.IBUF_MASK = BROTLI_IBUF_MASK; BrotliBitReader.prototype.reset = function() { this.buf_ptr_ = 0; /* next input will write here */ this.val_ = 0; /* pre-fetched bits */ this.pos_ = 0; /* byte position in stream */ this.bit_pos_ = 0; /* current bit-reading position in val_ */ this.bit_end_pos_ = 0; /* bit-reading end position from LSB of val_ */ this.eos_ = 0; /* input stream is finished */ this.readMoreInput(); for (var i = 0; i < 4; i++) { this.val_ |= this.buf_[this.pos_] << (8 * i); ++this.pos_; } return this.bit_end_pos_ > 0; }; /* Fills up the input ringbuffer by calling the input callback. Does nothing if there are at least 32 bytes present after current position. Returns 0 if either: - the input callback returned an error, or - there is no more input and the position is past the end of the stream. After encountering the end of the input stream, 32 additional zero bytes are copied to the ringbuffer, therefore it is safe to call this function after every 32 bytes of input is read. */ BrotliBitReader.prototype.readMoreInput = function() { if (this.bit_end_pos_ > 256) { return; } else if (this.eos_) { if (this.bit_pos_ > this.bit_end_pos_) throw new Error('Unexpected end of input ' + this.bit_pos_ + ' ' + this.bit_end_pos_); } else { var dst = this.buf_ptr_; var bytes_read = this.input_.read(this.buf_, dst, BROTLI_READ_SIZE); if (bytes_read < 0) { throw new Error('Unexpected end of input'); } if (bytes_read < BROTLI_READ_SIZE) { this.eos_ = 1; /* Store 32 bytes of zero after the stream end. */ for (var p = 0; p < 32; p++) this.buf_[dst + bytes_read + p] = 0; } if (dst === 0) { /* Copy the head of the ringbuffer to the slack region. */ for (var p = 0; p < 32; p++) this.buf_[(BROTLI_READ_SIZE << 1) + p] = this.buf_[p]; this.buf_ptr_ = BROTLI_READ_SIZE; } else { this.buf_ptr_ = 0; } this.bit_end_pos_ += bytes_read << 3; } }; /* Guarantees that there are at least 24 bits in the buffer. */ BrotliBitReader.prototype.fillBitWindow = function() { while (this.bit_pos_ >= 8) { this.val_ >>>= 8; this.val_ |= this.buf_[this.pos_ & BROTLI_IBUF_MASK] << 24; ++this.pos_; this.bit_pos_ = this.bit_pos_ - 8 >>> 0; this.bit_end_pos_ = this.bit_end_pos_ - 8 >>> 0; } }; /* Reads the specified number of bits from Read Buffer. */ BrotliBitReader.prototype.readBits = function(n_bits) { if (32 - this.bit_pos_ < n_bits) { this.fillBitWindow(); } var val = ((this.val_ >>> this.bit_pos_) & kBitMask[n_bits]); this.bit_pos_ += n_bits; return val; }; module.exports = BrotliBitReader; },{}],2:[function(require,module,exports){ /* Copyright 2013 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Lookup table to map the previous two bytes to a context id. There are four different context modeling modes defined here: CONTEXT_LSB6: context id is the least significant 6 bits of the last byte, CONTEXT_MSB6: context id is the most significant 6 bits of the last byte, CONTEXT_UTF8: second-order context model tuned for UTF8-encoded text, CONTEXT_SIGNED: second-order context model tuned for signed integers. The context id for the UTF8 context model is calculated as follows. If p1 and p2 are the previous two bytes, we calcualte the context as context = kContextLookup[p1] | kContextLookup[p2 + 256]. If the previous two bytes are ASCII characters (i.e. < 128), this will be equivalent to context = 4 * context1(p1) + context2(p2), where context1 is based on the previous byte in the following way: 0 : non-ASCII control 1 : \t, \n, \r 2 : space 3 : other punctuation 4 : " ' 5 : % 6 : ( < [ { 7 : ) > ] } 8 : , ; : 9 : . 10 : = 11 : number 12 : upper-case vowel 13 : upper-case consonant 14 : lower-case vowel 15 : lower-case consonant and context2 is based on the second last byte: 0 : control, space 1 : punctuation 2 : upper-case letter, number 3 : lower-case letter If the last byte is ASCII, and the second last byte is not (in a valid UTF8 stream it will be a continuation byte, value between 128 and 191), the context is the same as if the second last byte was an ASCII control or space. If the last byte is a UTF8 lead byte (value >= 192), then the next byte will be a continuation byte and the context id is 2 or 3 depending on the LSB of the last byte and to a lesser extent on the second last byte if it is ASCII. If the last byte is a UTF8 continuation byte, the second last byte can be: - continuation byte: the next byte is probably ASCII or lead byte (assuming 4-byte UTF8 characters are rare) and the context id is 0 or 1. - lead byte (192 - 207): next byte is ASCII or lead byte, context is 0 or 1 - lead byte (208 - 255): next byte is continuation byte, context is 2 or 3 The possible value combinations of the previous two bytes, the range of context ids and the type of the next byte is summarized in the table below: |--------\-----------------------------------------------------------------| | \ Last byte | | Second \---------------------------------------------------------------| | last byte \ ASCII | cont. byte | lead byte | | \ (0-127) | (128-191) | (192-) | |=============|===================|=====================|==================| | ASCII | next: ASCII/lead | not valid | next: cont. | | (0-127) | context: 4 - 63 | | context: 2 - 3 | |-------------|-------------------|---------------------|------------------| | cont. byte | next: ASCII/lead | next: ASCII/lead | next: cont. | | (128-191) | context: 4 - 63 | context: 0 - 1 | context: 2 - 3 | |-------------|-------------------|---------------------|------------------| | lead byte | not valid | next: ASCII/lead | not valid | | (192-207) | | context: 0 - 1 | | |-------------|-------------------|---------------------|------------------| | lead byte | not valid | next: cont. | not valid | | (208-) | | context: 2 - 3 | | |-------------|-------------------|---------------------|------------------| The context id for the signed context mode is calculated as: context = (kContextLookup[512 + p1] << 3) | kContextLookup[512 + p2]. For any context modeling modes, the context ids can be calculated by |-ing together two lookups from one table using context model dependent offsets: context = kContextLookup[offset1 + p1] | kContextLookup[offset2 + p2]. where offset1 and offset2 are dependent on the context mode. */ var CONTEXT_LSB6 = 0; var CONTEXT_MSB6 = 1; var CONTEXT_UTF8 = 2; var CONTEXT_SIGNED = 3; /* Common context lookup table for all context modes. */ exports.lookup = new Uint8Array([ /* CONTEXT_UTF8, last byte. */ /* ASCII range. */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 12, 16, 12, 12, 20, 12, 16, 24, 28, 12, 12, 32, 12, 36, 12, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 32, 32, 24, 40, 28, 12, 12, 48, 52, 52, 52, 48, 52, 52, 52, 48, 52, 52, 52, 52, 52, 48, 52, 52, 52, 52, 52, 48, 52, 52, 52, 52, 52, 24, 12, 28, 12, 12, 12, 56, 60, 60, 60, 56, 60, 60, 60, 56, 60, 60, 60, 60, 60, 56, 60, 60, 60, 60, 60, 56, 60, 60, 60, 60, 60, 24, 12, 28, 12, 0, /* UTF8 continuation byte range. */ 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, /* UTF8 lead byte range. */ 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, /* CONTEXT_UTF8 second last byte. */ /* ASCII range. */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0, /* UTF8 continuation byte range. */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* UTF8 lead byte range. */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* CONTEXT_SIGNED, second last byte. */ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, /* CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits. */ 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 56, /* CONTEXT_LSB6, last byte. */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, /* CONTEXT_MSB6, last byte. */ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63, /* CONTEXT_{M,L}SB6, second last byte, */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]); exports.lookupOffsets = new Uint16Array([ /* CONTEXT_LSB6 */ 1024, 1536, /* CONTEXT_MSB6 */ 1280, 1536, /* CONTEXT_UTF8 */ 0, 256, /* CONTEXT_SIGNED */ 768, 512, ]); },{}],3:[function(require,module,exports){ /* Copyright 2013 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var BrotliInput = require('./streams').BrotliInput; var BrotliOutput = require('./streams').BrotliOutput; var BrotliBitReader = require('./bit_reader'); var BrotliDictionary = require('./dictionary'); var HuffmanCode = require('./huffman').HuffmanCode; var BrotliBuildHuffmanTable = require('./huffman').BrotliBuildHuffmanTable; var Context = require('./context'); var Prefix = require('./prefix'); var Transform = require('./transform'); var kDefaultCodeLength = 8; var kCodeLengthRepeatCode = 16; var kNumLiteralCodes = 256; var kNumInsertAndCopyCodes = 704; var kNumBlockLengthCodes = 26; var kLiteralContextBits = 6; var kDistanceContextBits = 2; var HUFFMAN_TABLE_BITS = 8; var HUFFMAN_TABLE_MASK = 0xff; /* Maximum possible Huffman table size for an alphabet size of 704, max code * length 15 and root table bits 8. */ var HUFFMAN_MAX_TABLE_SIZE = 1080; var CODE_LENGTH_CODES = 18; var kCodeLengthCodeOrder = new Uint8Array([ 1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15, ]); var NUM_DISTANCE_SHORT_CODES = 16; var kDistanceShortCodeIndexOffset = new Uint8Array([ 3, 2, 1, 0, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 ]); var kDistanceShortCodeValueOffset = new Int8Array([ 0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3 ]); var kMaxHuffmanTableSize = new Uint16Array([ 256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822, 854, 886, 920, 952, 984, 1016, 1048, 1080 ]); function DecodeWindowBits(br) { var n; if (br.readBits(1) === 0) { return 16; } n = br.readBits(3); if (n > 0) { return 17 + n; } n = br.readBits(3); if (n > 0) { return 8 + n; } return 17; } /* Decodes a number in the range [0..255], by reading 1 - 11 bits. */ function DecodeVarLenUint8(br) { if (br.readBits(1)) { var nbits = br.readBits(3); if (nbits === 0) { return 1; } else { return br.readBits(nbits) + (1 << nbits); } } return 0; } function MetaBlockLength() { this.meta_block_length = 0; this.input_end = 0; this.is_uncompressed = 0; this.is_metadata = false; } function DecodeMetaBlockLength(br) { var out = new MetaBlockLength; var size_nibbles; var size_bytes; var i; out.input_end = br.readBits(1); if (out.input_end && br.readBits(1)) { return out; } size_nibbles = br.readBits(2) + 4; if (size_nibbles === 7) { out.is_metadata = true; if (br.readBits(1) !== 0) throw new Error('Invalid reserved bit'); size_bytes = br.readBits(2); if (size_bytes === 0) return out; for (i = 0; i < size_bytes; i++) { var next_byte = br.readBits(8); if (i + 1 === size_bytes && size_bytes > 1 && next_byte === 0) throw new Error('Invalid size byte'); out.meta_block_length |= next_byte << (i * 8); } } else { for (i = 0; i < size_nibbles; ++i) { var next_nibble = br.readBits(4); if (i + 1 === size_nibbles && size_nibbles > 4 && next_nibble === 0) throw new Error('Invalid size nibble'); out.meta_block_length |= next_nibble << (i * 4); } } ++out.meta_block_length; if (!out.input_end && !out.is_metadata) { out.is_uncompressed = br.readBits(1); } return out; } /* Decodes the next Huffman code from bit-stream. */ function ReadSymbol(table, index, br) { var start_index = index; var nbits; br.fillBitWindow(); index += (br.val_ >>> br.bit_pos_) & HUFFMAN_TABLE_MASK; nbits = table[index].bits - HUFFMAN_TABLE_BITS; if (nbits > 0) { br.bit_pos_ += HUFFMAN_TABLE_BITS; index += table[index].value; index += (br.val_ >>> br.bit_pos_) & ((1 << nbits) - 1); } br.bit_pos_ += table[index].bits; return table[index].value; } function ReadHuffmanCodeLengths(code_length_code_lengths, num_symbols, code_lengths, br) { var symbol = 0; var prev_code_len = kDefaultCodeLength; var repeat = 0; var repeat_code_len = 0; var space = 32768; var table = []; for (var i = 0; i < 32; i++) table.push(new HuffmanCode(0, 0)); BrotliBuildHuffmanTable(table, 0, 5, code_length_code_lengths, CODE_LENGTH_CODES); while (symbol < num_symbols && space > 0) { var p = 0; var code_len; br.readMoreInput(); br.fillBitWindow(); p += (br.val_ >>> br.bit_pos_) & 31; br.bit_pos_ += table[p].bits; code_len = table[p].value & 0xff; if (code_len < kCodeLengthRepeatCode) { repeat = 0; code_lengths[symbol++] = code_len; if (code_len !== 0) { prev_code_len = code_len; space -= 32768 >> code_len; } } else { var extra_bits = code_len - 14; var old_repeat; var repeat_delta; var new_len = 0; if (code_len === kCodeLengthRepeatCode) { new_len = prev_code_len; } if (repeat_code_len !== new_len) { repeat = 0; repeat_code_len = new_len; } old_repeat = repeat; if (repeat > 0) { repeat -= 2; repeat <<= extra_bits; } repeat += br.readBits(extra_bits) + 3; repeat_delta = repeat - old_repeat; if (symbol + repeat_delta > num_symbols) { throw new Error('[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols'); } for (var x = 0; x < repeat_delta; x++) code_lengths[symbol + x] = repeat_code_len; symbol += repeat_delta; if (repeat_code_len !== 0) { space -= repeat_delta << (15 - repeat_code_len); } } } if (space !== 0) { throw new Error("[ReadHuffmanCodeLengths] space = " + space); } for (; symbol < num_symbols; symbol++) code_lengths[symbol] = 0; } function ReadHuffmanCode(alphabet_size, tables, table, br) { var table_size = 0; var simple_code_or_skip; var code_lengths = new Uint8Array(alphabet_size); br.readMoreInput(); /* simple_code_or_skip is used as follows: 1 for simple code; 0 for no skipping, 2 skips 2 code lengths, 3 skips 3 code lengths */ simple_code_or_skip = br.readBits(2); if (simple_code_or_skip === 1) { /* Read symbols, codes & code lengths directly. */ var i; var max_bits_counter = alphabet_size - 1; var max_bits = 0; var symbols = new Int32Array(4); var num_symbols = br.readBits(2) + 1; while (max_bits_counter) { max_bits_counter >>= 1; ++max_bits; } for (i = 0; i < num_symbols; ++i) { symbols[i] = br.readBits(max_bits) % alphabet_size; code_lengths[symbols[i]] = 2; } code_lengths[symbols[0]] = 1; switch (num_symbols) { case 1: break; case 3: if ((symbols[0] === symbols[1]) || (symbols[0] === symbols[2]) || (symbols[1] === symbols[2])) { throw new Error('[ReadHuffmanCode] invalid symbols'); } break; case 2: if (symbols[0] === symbols[1]) { throw new Error('[ReadHuffmanCode] invalid symbols'); } code_lengths[symbols[1]] = 1; break; case 4: if ((symbols[0] === symbols[1]) || (symbols[0] === symbols[2]) || (symbols[0] === symbols[3]) || (symbols[1] === symbols[2]) || (symbols[1] === symbols[3]) || (symbols[2] === symbols[3])) { throw new Error('[ReadHuffmanCode] invalid symbols'); } if (br.readBits(1)) { code_lengths[symbols[2]] = 3; code_lengths[symbols[3]] = 3; } else { code_lengths[symbols[0]] = 2; } break; } } else { /* Decode Huffman-coded code lengths. */ var i; var code_length_code_lengths = new Uint8Array(CODE_LENGTH_CODES); var space = 32; var num_codes = 0; /* Static Huffman code for the code length code lengths */ var huff = [ new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2), new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 1), new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2), new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 5) ]; for (i = simple_code_or_skip; i < CODE_LENGTH_CODES && space > 0; ++i) { var code_len_idx = kCodeLengthCodeOrder[i]; var p = 0; var v; br.fillBitWindow(); p += (br.val_ >>> br.bit_pos_) & 15; br.bit_pos_ += huff[p].bits; v = huff[p].value; code_length_code_lengths[code_len_idx] = v; if (v !== 0) { space -= (32 >> v); ++num_codes; } } if (!(num_codes === 1 || space === 0)) throw new Error('[ReadHuffmanCode] invalid num_codes or space'); ReadHuffmanCodeLengths(code_length_code_lengths, alphabet_size, code_lengths, br); } table_size = BrotliBuildHuffmanTable(tables, table, HUFFMAN_TABLE_BITS, code_lengths, alphabet_size); if (table_size === 0) { throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: "); } return table_size; } function ReadBlockLength(table, index, br) { var code; var nbits; code = ReadSymbol(table, index, br); nbits = Prefix.kBlockLengthPrefixCode[code].nbits; return Prefix.kBlockLengthPrefixCode[code].offset + br.readBits(nbits); } function TranslateShortCodes(code, ringbuffer, index) { var val; if (code < NUM_DISTANCE_SHORT_CODES) { index += kDistanceShortCodeIndexOffset[code]; index &= 3; val = ringbuffer[index] + kDistanceShortCodeValueOffset[code]; } else { val = code - NUM_DISTANCE_SHORT_CODES + 1; } return val; } function MoveToFront(v, index) { var value = v[index]; var i = index; for (; i; --i) v[i] = v[i - 1]; v[0] = value; } function InverseMoveToFrontTransform(v, v_len) { var mtf = new Uint8Array(256); var i; for (i = 0; i < 256; ++i) { mtf[i] = i; } for (i = 0; i < v_len; ++i) { var index = v[i]; v[i] = mtf[index]; if (index) MoveToFront(mtf, index); } } /* Contains a collection of huffman trees with the same alphabet size. */ function HuffmanTreeGroup(alphabet_size, num_htrees) { this.alphabet_size = alphabet_size; this.num_htrees = num_htrees; this.codes = new Array(num_htrees + num_htrees * kMaxHuffmanTableSize[(alphabet_size + 31) >>> 5]); this.htrees = new Uint32Array(num_htrees); } HuffmanTreeGroup.prototype.decode = function(br) { var i; var table_size; var next = 0; for (i = 0; i < this.num_htrees; ++i) { this.htrees[i] = next; table_size = ReadHuffmanCode(this.alphabet_size, this.codes, next, br); next += table_size; } }; function DecodeContextMap(context_map_size, br) { var out = { num_htrees: null, context_map: null }; var use_rle_for_zeros; var max_run_length_prefix = 0; var table; var i; br.readMoreInput(); var num_htrees = out.num_htrees = DecodeVarLenUint8(br) + 1; var context_map = out.context_map = new Uint8Array(context_map_size); if (num_htrees <= 1) { return out; } use_rle_for_zeros = br.readBits(1); if (use_rle_for_zeros) { max_run_length_prefix = br.readBits(4) + 1; } table = []; for (i = 0; i < HUFFMAN_MAX_TABLE_SIZE; i++) { table[i] = new HuffmanCode(0, 0); } ReadHuffmanCode(num_htrees + max_run_length_prefix, table, 0, br); for (i = 0; i < context_map_size;) { var code; br.readMoreInput(); code = ReadSymbol(table, 0, br); if (code === 0) { context_map[i] = 0; ++i; } else if (code <= max_run_length_prefix) { var reps = 1 + (1 << code) + br.readBits(code); while (--reps) { if (i >= context_map_size) { throw new Error("[DecodeContextMap] i >= context_map_size"); } context_map[i] = 0; ++i; } } else { context_map[i] = code - max_run_length_prefix; ++i; } } if (br.readBits(1)) { InverseMoveToFrontTransform(context_map, context_map_size); } return out; } function DecodeBlockType(max_block_type, trees, tree_type, block_types, ringbuffers, indexes, br) { var ringbuffer = tree_type * 2; var index = tree_type; var type_code = ReadSymbol(trees, tree_type * HUFFMAN_MAX_TABLE_SIZE, br); var block_type; if (type_code === 0) { block_type = ringbuffers[ringbuffer + (indexes[index] & 1)]; } else if (type_code === 1) { block_type = ringbuffers[ringbuffer + ((indexes[index] - 1) & 1)] + 1; } else { block_type = type_code - 2; } if (block_type >= max_block_type) { block_type -= max_block_type; } block_types[tree_type] = block_type; ringbuffers[ringbuffer + (indexes[index] & 1)] = block_type; ++indexes[index]; } function CopyUncompressedBlockToOutput(output, len, pos, ringbuffer, ringbuffer_mask, br) { var rb_size = ringbuffer_mask + 1; var rb_pos = pos & ringbuffer_mask; var br_pos = br.pos_ & BrotliBitReader.IBUF_MASK; var nbytes; /* For short lengths copy byte-by-byte */ if (len < 8 || br.bit_pos_ + (len << 3) < br.bit_end_pos_) { while (len-- > 0) { br.readMoreInput(); ringbuffer[rb_pos++] = br.readBits(8); if (rb_pos === rb_size) { output.write(ringbuffer, rb_size); rb_pos = 0; } } return; } if (br.bit_end_pos_ < 32) { throw new Error('[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32'); } /* Copy remaining 0-4 bytes from br.val_ to ringbuffer. */ while (br.bit_pos_ < 32) { ringbuffer[rb_pos] = (br.val_ >>> br.bit_pos_); br.bit_pos_ += 8; ++rb_pos; --len; } /* Copy remaining bytes from br.buf_ to ringbuffer. */ nbytes = (br.bit_end_pos_ - br.bit_pos_) >> 3; if (br_pos + nbytes > BrotliBitReader.IBUF_MASK) { var tail = BrotliBitReader.IBUF_MASK + 1 - br_pos; for (var x = 0; x < tail; x++) ringbuffer[rb_pos + x] = br.buf_[br_pos + x]; nbytes -= tail; rb_pos += tail; len -= tail; br_pos = 0; } for (var x = 0; x < nbytes; x++) ringbuffer[rb_pos + x] = br.buf_[br_pos + x]; rb_pos += nbytes; len -= nbytes; /* If we wrote past the logical end of the ringbuffer, copy the tail of the ringbuffer to its beginning and flush the ringbuffer to the output. */ if (rb_pos >= rb_size) { output.write(ringbuffer, rb_size); rb_pos -= rb_size; for (var x = 0; x < rb_pos; x++) ringbuffer[x] = ringbuffer[rb_size + x]; } /* If we have more to copy than the remaining size of the ringbuffer, then we first fill the ringbuffer from the input and then flush the ringbuffer to the output */ while (rb_pos + len >= rb_size) { nbytes = rb_size - rb_pos; if (br.input_.read(ringbuffer, rb_pos, nbytes) < nbytes) { throw new Error('[CopyUncompressedBlockToOutput] not enough bytes'); } output.write(ringbuffer, rb_size); len -= nbytes; rb_pos = 0; } /* Copy straight from the input onto the ringbuffer. The ringbuffer will be flushed to the output at a later time. */ if (br.input_.read(ringbuffer, rb_pos, len) < len) { throw new Error('[CopyUncompressedBlockToOutput] not enough bytes'); } /* Restore the state of the bit reader. */ br.reset(); } /* Advances the bit reader position to the next byte boundary and verifies that any skipped bits are set to zero. */ function JumpToByteBoundary(br) { var new_bit_pos = (br.bit_pos_ + 7) & ~7; var pad_bits = br.readBits(new_bit_pos - br.bit_pos_); return pad_bits == 0; } function BrotliDecompressedSize(buffer) { var input = new BrotliInput(buffer); var br = new BrotliBitReader(input); DecodeWindowBits(br); var out = DecodeMetaBlockLength(br); return out.meta_block_length; } exports.BrotliDecompressedSize = BrotliDecompressedSize; function BrotliDecompressBuffer(buffer, output_size) { var input = new BrotliInput(buffer); if (output_size == null) { output_size = BrotliDecompressedSize(buffer); } var output_buffer = new Uint8Array(output_size); var output = new BrotliOutput(output_buffer); BrotliDecompress(input, output); if (output.pos < output.buffer.length) { output.buffer = output.buffer.subarray(0, output.pos); } return output.buffer; } exports.BrotliDecompressBuffer = BrotliDecompressBuffer; function BrotliDecompress(input, output) { var i; var pos = 0; var input_end = 0; var window_bits = 0; var max_backward_distance; var max_distance = 0; var ringbuffer_size; var ringbuffer_mask; var ringbuffer; var ringbuffer_end; /* This ring buffer holds a few past copy distances that will be used by */ /* some special distance codes. */ var dist_rb = [ 16, 15, 11, 4 ]; var dist_rb_idx = 0; /* The previous 2 bytes used for context. */ var prev_byte1 = 0; var prev_byte2 = 0; var hgroup = [new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0)]; var block_type_trees; var block_len_trees; var br; /* We need the slack region for the following reasons: - always doing two 8-byte copies for fast backward copying - transforms - flushing the input ringbuffer when decoding uncompressed blocks */ var kRingBufferWriteAheadSlack = 128 + BrotliBitReader.READ_SIZE; br = new BrotliBitReader(input); /* Decode window size. */ window_bits = DecodeWindowBits(br); max_backward_distance = (1 << window_bits) - 16; ringbuffer_size = 1 << window_bits; ringbuffer_mask = ringbuffer_size - 1; ringbuffer = new Uint8Array(ringbuffer_size + kRingBufferWriteAheadSlack + BrotliDictionary.maxDictionaryWordLength); ringbuffer_end = ringbuffer_size; block_type_trees = []; block_len_trees = []; for (var x = 0; x < 3 * HUFFMAN_MAX_TABLE_SIZE; x++) { block_type_trees[x] = new HuffmanCode(0, 0); block_len_trees[x] = new HuffmanCode(0, 0); } while (!input_end) { var meta_block_remaining_len = 0; var is_uncompressed; var block_length = [ 1 << 28, 1 << 28, 1 << 28 ]; var block_type = [ 0 ]; var num_block_types = [ 1, 1, 1 ]; var block_type_rb = [ 0, 1, 0, 1, 0, 1 ]; var block_type_rb_index = [ 0 ]; var distance_postfix_bits; var num_direct_distance_codes; var distance_postfix_mask; var num_distance_codes; var context_map = null; var context_modes = null; var num_literal_htrees; var dist_context_map = null; var num_dist_htrees; var context_offset = 0; var context_map_slice = null; var literal_htree_index = 0; var dist_context_offset = 0; var dist_context_map_slice = null; var dist_htree_index = 0; var context_lookup_offset1 = 0; var context_lookup_offset2 = 0; var context_mode; var htree_command; for (i = 0; i < 3; ++i) { hgroup[i].codes = null; hgroup[i].htrees = null; } br.readMoreInput(); var _out = DecodeMetaBlockLength(br); meta_block_remaining_len = _out.meta_block_length; if (pos + meta_block_remaining_len > output.buffer.length) { /* We need to grow the output buffer to fit the additional data. */ var tmp = new Uint8Array( pos + meta_block_remaining_len ); tmp.set( output.buffer ); output.buffer = tmp; } input_end = _out.input_end; is_uncompressed = _out.is_uncompressed; if (_out.is_metadata) { JumpToByteBoundary(br); for (; meta_block_remaining_len > 0; --meta_block_remaining_len) { br.readMoreInput(); /* Read one byte and ignore it. */ br.readBits(8); } continue; } if (meta_block_remaining_len === 0) { continue; } if (is_uncompressed) { br.bit_pos_ = (br.bit_pos_ + 7) & ~7; CopyUncompressedBlockToOutput(output, meta_block_remaining_len, pos, ringbuffer, ringbuffer_mask, br); pos += meta_block_remaining_len; continue; } for (i = 0; i < 3; ++i) { num_block_types[i] = DecodeVarLenUint8(br) + 1; if (num_block_types[i] >= 2) { ReadHuffmanCode(num_block_types[i] + 2, block_type_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); ReadHuffmanCode(kNumBlockLengthCodes, block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); block_length[i] = ReadBlockLength(block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br); block_type_rb_index[i] = 1; } } br.readMoreInput(); distance_postfix_bits = br.readBits(2); num_direct_distance_codes = NUM_DISTANCE_SHORT_CODES + (br.readBits(4) << distance_postfix_bits); distance_postfix_mask = (1 << distance_postfix_bits) - 1; num_distance_codes = (num_direct_distance_codes + (48 << distance_postfix_bits)); context_modes = new Uint8Array(num_block_types[0]); for (i = 0; i < num_block_types[0]; ++i) { br.readMoreInput(); context_modes[i] = (br.readBits(2) << 1); } var _o1 = DecodeContextMap(num_block_types[0] << kLiteralContextBits, br); num_literal_htrees = _o1.num_htrees; context_map = _o1.context_map; var _o2 = DecodeContextMap(num_block_types[2] << kDistanceContextBits, br); num_dist_htrees = _o2.num_htrees; dist_context_map = _o2.context_map; hgroup[0] = new HuffmanTreeGroup(kNumLiteralCodes, num_literal_htrees); hgroup[1] = new HuffmanTreeGroup(kNumInsertAndCopyCodes, num_block_types[1]); hgroup[2] = new HuffmanTreeGroup(num_distance_codes, num_dist_htrees); for (i = 0; i < 3; ++i) { hgroup[i].decode(br); } context_map_slice = 0; dist_context_map_slice = 0; context_mode = context_modes[block_type[0]]; context_lookup_offset1 = Context.lookupOffsets[context_mode]; context_lookup_offset2 = Context.lookupOffsets[context_mode + 1]; htree_command = hgroup[1].htrees[0]; while (meta_block_remaining_len > 0) { var cmd_code; var range_idx; var insert_code; var copy_code; var insert_length; var copy_length; var distance_code; var distance; var context; var j; var copy_dst; br.readMoreInput(); if (block_length[1] === 0) { DecodeBlockType(num_block_types[1], block_type_trees, 1, block_type, block_type_rb, block_type_rb_index, br); block_length[1] = ReadBlockLength(block_len_trees, HUFFMAN_MAX_TABLE_SIZE, br); htree_command = hgroup[1].htrees[block_type[1]]; } --block_length[1]; cmd_code = ReadSymbol(hgroup[1].codes, htree_command, br); range_idx = cmd_code >> 6; if (range_idx >= 2) { range_idx -= 2; distance_code = -1; } else { distance_code = 0; } insert_code = Prefix.kInsertRangeLut[range_idx] + ((cmd_code >> 3) & 7); copy_code = Prefix.kCopyRangeLut[range_idx] + (cmd_code & 7); insert_length = Prefix.kInsertLengthPrefixCode[insert_code].offset + br.readBits(Prefix.kInsertLengthPrefixCode[insert_code].nbits); copy_length = Prefix.kCopyLengthPrefixCode[copy_code].offset + br.readBits(Prefix.kCopyLengthPrefixCode[copy_code].nbits); prev_byte1 = ringbuffer[pos-1 & ringbuffer_mask]; prev_byte2 = ringbuffer[pos-2 & ringbuffer_mask]; for (j = 0; j < insert_length; ++j) { br.readMoreInput(); if (block_length[0] === 0) { DecodeBlockType(num_block_types[0], block_type_trees, 0, block_type, block_type_rb, block_type_rb_index, br); block_length[0] = ReadBlockLength(block_len_trees, 0, br); context_offset = block_type[0] << kLiteralContextBits; context_map_slice = context_offset; context_mode = context_modes[block_type[0]]; context_lookup_offset1 = Context.lookupOffsets[context_mode]; context_lookup_offset2 = Context.lookupOffsets[context_mode + 1]; } context = (Context.lookup[context_lookup_offset1 + prev_byte1] | Context.lookup[context_lookup_offset2 + prev_byte2]); literal_htree_index = context_map[context_map_slice + context]; --block_length[0]; prev_byte2 = prev_byte1; prev_byte1 = ReadSymbol(hgroup[0].codes, hgroup[0].htrees[literal_htree_index], br); ringbuffer[pos & ringbuffer_mask] = prev_byte1; if ((pos & ringbuffer_mask) === ringbuffer_mask) { output.write(ringbuffer, ringbuffer_size); } ++pos; } meta_block_remaining_len -= insert_length; if (meta_block_remaining_len <= 0) break; if (distance_code < 0) { var context; br.readMoreInput(); if (block_length[2] === 0) { DecodeBlockType(num_block_types[2], block_type_trees, 2, block_type, block_type_rb, block_type_rb_index, br); block_length[2] = ReadBlockLength(block_len_trees, 2 * HUFFMAN_MAX_TABLE_SIZE, br); dist_context_offset = block_type[2] << kDistanceContextBits; dist_context_map_slice = dist_context_offset; } --block_length[2]; context = (copy_length > 4 ? 3 : copy_length - 2) & 0xff; dist_htree_index = dist_context_map[dist_context_map_slice + context]; distance_code = ReadSymbol(hgroup[2].codes, hgroup[2].htrees[dist_htree_index], br); if (distance_code >= num_direct_distance_codes) { var nbits; var postfix; var offset; distance_code -= num_direct_distance_codes; postfix = distance_code & distance_postfix_mask; distance_code >>= distance_postfix_bits; nbits = (distance_code >> 1) + 1; offset = ((2 + (distance_code & 1)) << nbits) - 4; distance_code = num_direct_distance_codes + ((offset + br.readBits(nbits)) << distance_postfix_bits) + postfix; } } /* Convert the distance code to the actual distance by possibly looking */ /* up past distnaces from the ringbuffer. */ distance = TranslateShortCodes(distance_code, dist_rb, dist_rb_idx); if (distance < 0) { throw new Error('[BrotliDecompress] invalid distance'); } if (pos < max_backward_distance && max_distance !== max_backward_distance) { max_distance = pos; } else { max_distance = max_backward_distance; } copy_dst = pos & ringbuffer_mask; if (distance > max_distance) { if (copy_length >= BrotliDictionary.minDictionaryWordLength && copy_length <= BrotliDictionary.maxDictionaryWordLength) { var offset = BrotliDictionary.offsetsByLength[copy_length]; var word_id = distance - max_distance - 1; var shift = BrotliDictionary.sizeBitsByLength[copy_length]; var mask = (1 << shift) - 1; var word_idx = word_id & mask; var transform_idx = word_id >> shift; offset += word_idx * copy_length; if (transform_idx < Transform.kNumTransforms) { var len = Transform.transformDictionaryWord(ringbuffer, copy_dst, offset, copy_length, transform_idx); copy_dst += len; pos += len; meta_block_remaining_len -= len; if (copy_dst >= ringbuffer_end) { output.write(ringbuffer, ringbuffer_size); for (var _x = 0; _x < (copy_dst - ringbuffer_end); _x++) ringbuffer[_x] = ringbuffer[ringbuffer_end + _x]; } } else { throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len); } } else { throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len); } } else { if (distance_code > 0) { dist_rb[dist_rb_idx & 3] = distance; ++dist_rb_idx; } if (copy_length > meta_block_remaining_len) { throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len); } for (j = 0; j < copy_length; ++j) { ringbuffer[pos & ringbuffer_mask] = ringbuffer[(pos - distance) & ringbuffer_mask]; if ((pos & ringbuffer_mask) === ringbuffer_mask) { output.write(ringbuffer, ringbuffer_size); } ++pos; --meta_block_remaining_len; } } /* When we get here, we must have inserted at least one literal and */ /* made a copy of at least length two, therefore accessing the last 2 */ /* bytes is valid. */ prev_byte1 = ringbuffer[(pos - 1) & ringbuffer_mask]; prev_byte2 = ringbuffer[(pos - 2) & ringbuffer_mask]; } /* Protect pos from overflow, wrap it around at every GB of input data */ pos &= 0x3fffffff; } output.write(ringbuffer, pos & ringbuffer_mask); } exports.BrotliDecompress = BrotliDecompress; BrotliDictionary.init(); },{"./bit_reader":1,"./context":2,"./dictionary":6,"./huffman":7,"./prefix":9,"./streams":10,"./transform":11}],4:[function(require,module,exports){ var base64 = require('base64-js'); //var fs = require('fs'); /** * The normal dictionary-data.js is quite large, which makes it * unsuitable for browser usage. In order to make it smaller, * we read dictionary.bin, which is a compressed version of * the dictionary, and on initial load, Brotli decompresses * it's own dictionary. 😜 */ exports.init = function() { var BrotliDecompressBuffer = require('./decode').BrotliDecompressBuffer; var compressed = base64.toByteArray(require('./dictionary.bin.js')); return BrotliDecompressBuffer(compressed); }; },{"./decode":3,"./dictionary.bin.js":5,"base64-js":8}],5:[function(require,module,exports){ module.exports="W5/fcQLn5gKf2XUbAiQ1XULX+TZz6ADToDsgqk6qVfeC0e4m6OO2wcQ1J76ZBVRV1fRkEsdu//62zQsFEZWSTCnMhcsQKlS2qOhuVYYMGCkV0fXWEoMFbESXrKEZ9wdUEsyw9g4bJlEt1Y6oVMxMRTEVbCIwZzJzboK5j8m4YH02qgXYhv1V+PM435sLVxyHJihaJREEhZGqL03txGFQLm76caGO/ovxKvzCby/3vMTtX/459f0igi7WutnKiMQ6wODSoRh/8Lx1V3Q99MvKtwB6bHdERYRY0hStJoMjNeTsNX7bn+Y7e4EQ3bf8xBc7L0BsyfFPK43dGSXpL6clYC/I328h54/VYrQ5i0648FgbGtl837svJ35L3Mot/+nPlNpWgKx1gGXQYqX6n+bbZ7wuyCHKcUok12Xjqub7NXZGzqBx0SD+uziNf87t7ve42jxSKQoW3nyxVrWIGlFShhCKxjpZZ5MeGna0+lBkk+kaN8F9qFBAFgEogyMBdcX/T1W/WnMOi/7ycWUQloEBKGeC48MkiwqJkJO+12eQiOFHMmck6q/IjWW3RZlany23TBm+cNr/84/oi5GGmGBZWrZ6j+zykVozz5fT/QH/Da6WTbZYYPynVNO7kxzuNN2kxKKWche5WveitPKAecB8YcAHz/+zXLjcLzkdDSktNIDwZE9J9X+tto43oJy65wApM3mDzYtCwX9lM+N5VR3kXYo0Z3t0TtXfgBFg7gU8oN0Dgl7fZlUbhNll+0uuohRVKjrEd8egrSndy5/Tgd2gqjA4CAVuC7ESUmL3DZoGnfhQV8uwnpi8EGvAVVsowNRxPudck7+oqAUDkwZopWqFnW1riss0t1z6iCISVKreYGNvQcXv+1L9+jbP8cd/dPUiqBso2q+7ZyFBvENCkkVr44iyPbtOoOoCecWsiuqMSML5lv+vN5MzUr+Dnh73G7Q1YnRYJVYXHRJaNAOByiaK6CusgFdBPE40r0rvqXV7tksKO2DrHYXBTv8P5ysqxEx8VDXUDDqkPH6NNOV/a2WH8zlkXRELSa8P+heNyJBBP7PgsG1EtWtNef6/i+lcayzQwQCsduidpbKfhWUDgAEmyhGu/zVTacI6RS0zTABrOYueemnVa19u9fT23N/Ta6RvTpof5DWygqreCqrDAgM4LID1+1T/taU6yTFVLqXOv+/MuQOFnaF8vLMKD7tKWDoBdALgxF33zQccCcdHx8fKIVdW69O7qHtXpeGr9jbbpFA+qRMWr5hp0s67FPc7HAiLV0g0/peZlW7hJPYEhZyhpSwahnf93/tZgfqZWXFdmdXBzqxGHLrQKxoAY6fRoBhgCRPmmGueYZ5JexTVDKUIXzkG/fqp/0U3hAgQdJ9zumutK6nqWbaqvm1pgu03IYR+G+8s0jDBBz8cApZFSBeuWasyqo2OMDKAZCozS+GWSvL/HsE9rHxooe17U3s/lTE+VZAk4j3dp6uIGaC0JMiqR5CUsabPyM0dOYDR7Ea7ip4USZlya38YfPtvrX/tBlhHilj55nZ1nfN24AOAi9BVtz/Mbn8AEDJCqJgsVUa6nQnSxv2Fs7l/NlCzpfYEjmPrNyib/+t0ei2eEMjvNhLkHCZlci4WhBe7ePZTmzYqlY9+1pxtS4GB+5lM1BHT9tS270EWUDYFq1I0yY/fNiAk4bk9yBgmef/f2k6AlYQZHsNFnW8wBQxCd68iWv7/35bXfz3JZmfGligWAKRjIs3IpzxQ27vAglHSiOzCYzJ9L9A1CdiyFvyR66ucA4jKifu5ehwER26yV7HjKqn5Mfozo7Coxxt8LWWPT47BeMxX8p0Pjb7hZn+6bw7z3Lw+7653j5sI8CLu5kThpMlj1m4c2ch3jGcP1FsT13vuK3qjecKTZk2kHcOZY40UX+qdaxstZqsqQqgXz+QGF99ZJLqr3VYu4aecl1Ab5GmqS8k/GV5b95zxQ5d4EfXUJ6kTS/CXF/aiqKDOT1T7Jz5z0PwDUcwr9clLN1OJGCiKfqvah+h3XzrBOiLOW8wvn8gW6qE8vPxi+Efv+UH55T7PQFVMh6cZ1pZQlzJpKZ7P7uWvwPGJ6DTlR6wbyj3Iv2HyefnRo/dv7dNx+qaa0N38iBsR++Uil7Wd4afwDNsrzDAK4fXZwvEY/jdKuIKXlfrQd2C39dW7ntnRbIp9OtGy9pPBn/V2ASoi/2UJZfS+xuGLH8bnLuPlzdTNS6zdyk8Dt/h6sfOW5myxh1f+zf3zZ3MX/mO9cQPp5pOx967ZA6/pqHvclNfnUFF+rq+Vd7alKr6KWPcIDhpn6v2K6NlUu6LrKo8b/pYpU/Gazfvtwhn7tEOUuXht5rUJdSf6sLjYf0VTYDgwJ81yaqKTUYej/tbHckSRb/HZicwGJqh1mAHB/IuNs9dc9yuvF3D5Xocm3elWFdq5oEy70dYFit79yaLiNjPj5UUcVmZUVhQEhW5V2Z6Cm4HVH/R8qlamRYwBileuh07CbEce3TXa2JmXWBf+ozt319psboobeZhVnwhMZzOeQJzhpTDbP71Tv8HuZxxUI/+ma3XW6DFDDs4+qmpERwHGBd2edxwUKlODRdUWZ/g0GOezrbzOZauFMai4QU6GVHV6aPNBiBndHSsV4IzpvUiiYyg6OyyrL4Dj5q/Lw3N5kAwftEVl9rNd7Jk5PDij2hTH6wIXnsyXkKePxbmHYgC8A6an5Fob/KH5GtC0l4eFso+VpxedtJHdHpNm+Bvy4C79yVOkrZsLrQ3OHCeB0Ra+kBIRldUGlDCEmq2RwXnfyh6Dz+alk6eftI2n6sastRrGwbwszBeDRS/Fa/KwRJkCzTsLr/JCs5hOPE/MPLYdZ1F1fv7D+VmysX6NpOC8aU9F4Qs6HvDyUy9PvFGDKZ/P5101TYHFl8pjj6wm/qyS75etZhhfg0UEL4OYmHk6m6dO192AzoIyPSV9QedDA4Ml23rRbqxMPMxf7FJnDc5FTElVS/PyqgePzmwVZ26NWhRDQ+oaT7ly7ell4s3DypS1s0g+tOr7XHrrkZj9+x/mJBttrLx98lFIaRZzHz4aC7r52/JQ4VjHahY2/YVXZn/QC2ztQb/sY3uRlyc5vQS8nLPGT/n27495i8HPA152z7Fh5aFpyn1GPJKHuPL8Iw94DuW3KjkURAWZXn4EQy89xiKEHN1mk/tkM4gYDBxwNoYvRfE6LFqsxWJtPrDGbsnLMap3Ka3MUoytW0cvieozOmdERmhcqzG+3HmZv2yZeiIeQTKGdRT4HHNxekm1tY+/n06rGmFleqLscSERzctTKM6G9P0Pc1RmVvrascIxaO1CQCiYPE15bD7c3xSeW7gXxYjgxcrUlcbIvO0r+Yplhx0kTt3qafDOmFyMjgGxXu73rddMHpV1wMubyAGcf/v5dLr5P72Ta9lBF+fzMJrMycwv+9vnU3ANIl1cH9tfW7af8u0/HG0vV47jNFXzFTtaha1xvze/s8KMtCYucXc1nzfd/MQydUXn/b72RBt5wO/3jRcMH9BdhC/yctKBIveRYPrNpDWqBsO8VMmP+WvRaOcA4zRMR1PvSoO92rS7pYEv+fZfEfTMzEdM+6X5tLlyxExhqLRkms5EuLovLfx66de5fL2/yX02H52FPVwahrPqmN/E0oVXnsCKhbi/yRxX83nRbUKWhzYceXOntfuXn51NszJ6MO73pQf5Pl4in3ec4JU8hF7ppV34+mm9r1LY0ee/i1O1wpd8+zfLztE0cqBxggiBi5Bu95v9l3r9r/U5hweLn+TbfxowrWDqdJauKd8+q/dH8sbPkc9ttuyO94f7/XK/nHX46MPFLEb5qQlNPvhJ50/59t9ft3LXu7uVaWaO2bDrDCnRSzZyWvFKxO1+vT8MwwunR3bX0CkfPjqb4K9O19tn5X50PvmYpEwHtiW9WtzuV/s76B1zvLLNkViNd8ySxIl/3orfqP90TyTGaf7/rx8jQzeHJXdmh/N6YDvbvmTBwCdxfEQ1NcL6wNMdSIXNq7b1EUzRy1/Axsyk5p22GMG1b+GxFgbHErZh92wuvco0AuOLXct9hvw2nw/LqIcDRRmJmmZzcgUa7JpM/WV/S9IUfbF56TL2orzqwebdRD8nIYNJ41D/hz37Fo11p2Y21wzPcn713qVGhqtevStYfGH4n69OEJtPvbbLYWvscDqc3Hgnu166+tAyLnxrX0Y5zoYjV++1sI7t5kMr02KT/+uwtkc+rZLOf/qn/s3nYCf13Dg8/sB2diJgjGqjQ+TLhxbzyue2Ob7X6/9lUwW7a+lbznHzOYy8LKW1C/uRPbQY3KW/0gO9LXunHLvPL97afba9bFtc9hmz7GAttjVYlCvQAiOwAk/gC5+hkLEs6tr3AZKxLJtOEwk2dLxTYWsIB/j/ToWtIWzo906FrSG8iaqqqqqqiIiIiAgzMzMzNz+AyK+01/zi8n8S+Y1MjoRaQ80WU/G8MBlO+53VPXANrWm4wzGUVZUjjBJZVdhpcfkjsmcWaO+UEldXi1e+zq+HOsCpknYshuh8pOLISJun7TN0EIGW2xTnlOImeecnoGW4raxe2G1T3HEvfYUYMhG+gAFOAwh5nK8mZhwJMmN7r224QVsNFvZ87Z0qatvknklyPDK3Hy45PgVKXji52Wen4d4PlFVVYGnNap+fSpFbK90rYnhUc6n91Q3AY9E0tJOFrcfZtm/491XbcG/jsViUPPX76qmeuiz+qY1Hk7/1VPM405zWVuoheLUimpWYdVzCmUdKHebMdzgrYrb8mL2eeLSnRWHdonfZa8RsOU9F37w+591l5FLYHiOqWeHtE/lWrBHcRKp3uhtr8yXm8LU/5ms+NM6ZKsqu90cFZ4o58+k4rdrtB97NADFbwmEG7lXqvirhOTOqU14xuUF2myIjURcPHrPOQ4lmM3PeMg7bUuk0nnZi67bXsU6H8lhqIo8TaOrEafCO1ARK9PjC0QOoq2BxmMdgYB9G/lIb9++fqNJ2s7BHGFyBNmZAR8J3KCo012ikaSP8BCrf6VI0X5xdnbhHIO+B5rbOyB54zXkzfObyJ4ecwxfqBJMLFc7m59rNcw7hoHnFZ0b00zee+gTqvjm61Pb4xn0kcDX4jvHM0rBXZypG3DCKnD/Waa/ZtHmtFPgO5eETx+k7RrVg3aSwm2YoNXnCs3XPQDhNn+Fia6IlOOuIG6VJH7TP6ava26ehKHQa2T4N0tcZ9dPCGo3ZdnNltsHQbeYt5vPnJezV/cAeNypdml1vCHI8M81nSRP5Qi2+mI8v/sxiZru9187nRtp3f/42NemcONa+4eVC3PCZzc88aZh851CqSsshe70uPxeN/dmYwlwb3trwMrN1Gq8jbnApcVDx/yDPeYs5/7r62tsQ6lLg+DiFXTEhzR9dHqv0iT4tgj825W+H3XiRUNUZT2kR9Ri0+lp+UM3iQtS8uOE23Ly4KYtvqH13jghUntJRAewuzNLDXp8RxdcaA3cMY6TO2IeSFRXezeWIjCqyhsUdMYuCgYTZSKpBype1zRfq8FshvfBPc6BAQWl7/QxIDp3VGo1J3vn42OEs3qznws+YLRXbymyB19a9XBx6n/owcyxlEYyFWCi+kG9F+EyD/4yn80+agaZ9P7ay2Dny99aK2o91FkfEOY8hBwyfi5uwx2y5SaHmG+oq/zl1FX/8irOf8Y3vAcX/6uLP6A6nvMO24edSGPjQc827Rw2atX+z2bKq0CmW9mOtYnr5/AfDa1ZfPaXnKtlWborup7QYx+Or2uWb+N3N//2+yDcXMqIJdf55xl7/vsj4WoPPlxLxtVrkJ4w/tTe3mLdATOOYwxcq52w5Wxz5MbPdVs5O8/lhfE7dPj0bIiPQ3QV0iqm4m3YX8hRfc6jQ3fWepevMqUDJd86Z4vwM40CWHnn+WphsGHfieF02D3tmZvpWD+kBpNCFcLnZhcmmrhpGzzbdA+sQ1ar18OJD87IOKOFoRNznaHPNHUfUNhvY1iU+uhvEvpKHaUn3qK3exVVyX4joipp3um7FmYJWmA+WbIDshRpbVRx5/nqstCgy87FGbfVB8yDGCqS+2qCsnRwnSAN6zgzxfdB2nBT/vZ4/6uxb6oH8b4VBRxiIB93wLa47hG3w2SL/2Z27yOXJFwZpSJaBYyvajA7vRRYNKqljXKpt/CFD/tSMr18DKKbwB0xggBePatl1nki0yvqW5zchlyZmJ0OTxJ3D+fsYJs/mxYN5+Le5oagtcl+YsVvy8kSjI2YGvGjvmpkRS9W2dtXqWnVuxUhURm1lKtou/hdEq19VBp9OjGvHEQSmrpuf2R24mXGheil8KeiANY8fW1VERUfBImb64j12caBZmRViZHbeVMjCrPDg9A90IXrtnsYCuZtRQ0PyrKDjBNOsPfKsg1pA02gHlVr0OXiFhtp6nJqXVzcbfM0KnzC3ggOENPE9VBdmHKN6LYaijb4wXxJn5A0FSDF5j+h1ooZx885Jt3ZKzO5n7Z5WfNEOtyyPqQEnn7WLv5Fis3PdgMshjF1FRydbNyeBbyKI1oN1TRVrVK7kgsb/zjX4NDPIRMctVeaxVB38Vh1x5KbeJbU138AM5KzmZu3uny0ErygxiJF7GVXUrPzFxrlx1uFdAaZFDN9cvIb74qD9tzBMo7L7WIEYK+sla1DVMHpF0F7b3+Y6S+zjvLeDMCpapmJo1weBWuxKF3rOocih1gun4BoJh1kWnV/Jmiq6uOhK3VfKxEHEkafjLgK3oujaPzY6SXg8phhL4TNR1xvJd1Wa0aYFfPUMLrNBDCh4AuGRTbtKMc6Z1Udj8evY/ZpCuMAUefdo69DZUngoqE1P9A3PJfOf7WixCEj+Y6t7fYeHbbxUAoFV3M89cCKfma3fc1+jKRe7MFWEbQqEfyzO2x/wrO2VYH7iYdQ9BkPyI8/3kXBpLaCpU7eC0Yv/am/tEDu7HZpqg0EvHo0nf/R/gRzUWy33/HXMJQeu1GylKmOkXzlCfGFruAcPPhaGqZOtu19zsJ1SO2Jz4Ztth5cBX6mRQwWmDwryG9FUMlZzNckMdK+IoMJv1rOWnBamS2w2KHiaPMPLC15hCZm4KTpoZyj4E2TqC/P6r7/EhnDMhKicZZ1ZwxuC7DPzDGs53q8gXaI9kFTK+2LTq7bhwsTbrMV8Rsfua5lMS0FwbTitUVnVa1yTb5IX51mmYnUcP9wPr8Ji1tiYJeJV9GZTrQhF7vvdU2OTU42ogJ9FDwhmycI2LIg++03C6scYhUyUuMV5tkw6kGUoL+mjNC38+wMdWNljn6tGPpRES7veqrSn5TRuv+dh6JVL/iDHU1db4c9WK3++OrH3PqziF916UMUKn8G67nN60GfWiHrXYhUG3yVWmyYak59NHj8t1smG4UDiWz2rPHNrKnN4Zo1LBbr2/eF9YZ0n0blx2nG4X+EKFxvS3W28JESD+FWk61VCD3z/URGHiJl++7TdBwkCj6tGOH3qDb0QqcOF9Kzpj0HUb/KyFW3Yhj2VMKJqGZleFBH7vqvf7WqLC3XMuHV8q8a4sTFuxUtkD/6JIBvKaVjv96ndgruKZ1k/BHzqf2K9fLk7HGXANyLDd1vxkK/i055pnzl+zw6zLnwXlVYVtfmacJgEpRP1hbGgrYPVN6v2lG+idQNGmwcKXu/8xEj/P6qe/sB2WmwNp6pp8jaISMkwdleFXYK55NHWLTTbutSUqjBfDGWo/Yg918qQ+8BRZSAHZbfuNZz2O0sov1Ue4CWlVg3rFhM3Kljj9ksGd/NUhk4nH+a5UN2+1i8+NM3vRNp7uQ6sqexSCukEVlVZriHNqFi5rLm9TMWa4qm3idJqppQACol2l4VSuvWLfta4JcXy3bROPNbXOgdOhG47LC0CwW/dMlSx4Jf17aEU3yA1x9p+Yc0jupXgcMuYNku64iYOkGToVDuJvlbEKlJqsmiHbvNrIVZEH+yFdF8DbleZ6iNiWwMqvtMp/mSpwx5KxRrT9p3MAPTHGtMbfvdFhyj9vhaKcn3At8Lc16Ai+vBcSp1ztXi7rCJZx/ql7TXcclq6Q76UeKWDy9boS0WHIjUuWhPG8LBmW5y2rhuTpM5vsLt+HOLh1Yf0DqXa9tsfC+kaKt2htA0ai/L2i7RKoNjEwztkmRU0GfgW1TxUvPFhg0V7DdfWJk5gfrccpYv+MA9M0dkGTLECeYwUixRzjRFdmjG7zdZIl3XKB9YliNKI31lfa7i2JG5C8Ss+rHe0D7Z696/V3DEAOWHnQ9yNahMUl5kENWS6pHKKp2D1BaSrrHdE1w2qNxIztpXgUIrF0bm15YML4b6V1k+GpNysTahKMVrrS85lTVo9OGJ96I47eAy5rYWpRf/mIzeoYU1DKaQCTUVwrhHeyNoDqHel+lLxr9WKzhSYw7vrR6+V5q0pfi2k3L1zqkubY6rrd9ZLvSuWNf0uqnkY+FpTvFzSW9Fp0b9l8JA7THV9eCi/PY/SCZIUYx3BU2alj7Cm3VV6eYpios4b6WuNOJdYXUK3zTqj5CVG2FqYM4Z7CuIU0qO05XR0d71FHM0YhZmJmTRfLlXEumN82BGtzdX0S19t1e+bUieK8zRmqpa4Qc5TSjifmaQsY2ETLjhI36gMR1+7qpjdXXHiceUekfBaucHShAOiFXmv3sNmGQyU5iVgnoocuonQXEPTFwslHtS8R+A47StI9wj0iSrtbi5rMysczFiImsQ+bdFClnFjjpXXwMy6O7qfjOr8Fb0a7ODItisjnn3EQO16+ypd1cwyaAW5Yzxz5QknfMO7643fXW/I9y3U2xH27Oapqr56Z/tEzglj6IbT6HEHjopiXqeRbe5mQQvxtcbDOVverN0ZgMdzqRYRjaXtMRd56Q4cZSmdPvZJdSrhJ1D9zNXPqAEqPIavPdfubt5oke2kmv0dztIszSv2VYuoyf1UuopbsYb+uX9h6WpwjpgtZ6fNNawNJ4q8O3CFoSbioAaOSZMx2GYaPYB+rEb6qjQiNRFQ76TvwNFVKD+BhH9VhcKGsXzmMI7BptU/CNWolM7YzROvpFAntsiWJp6eR2d3GarcYShVYSUqhmYOWj5E96NK2WvmYNTeY7Zs4RUEdv9h9QT4EseKt6LzLrqEOs3hxAY1MaNWpSa6zZx8F3YOVeCYMS88W+CYHDuWe4yoc6YK+djDuEOrBR5lvh0r+Q9uM88lrjx9x9AtgpQVNE8r+3O6Gvw59D+kBF/UMXyhliYUtPjmvXGY6Dk3x+kEOW+GtdMVC4EZTqoS/jmR0P0LS75DOc/w2vnri97M4SdbZ8qeU7gg8DVbERkU5geaMQO3mYrSYyAngeUQqrN0C0/vsFmcgWNXNeidsTAj7/4MncJR0caaBUpbLK1yBCBNRjEv6KvuVSdpPnEMJdsRRtqJ+U8tN1gXA4ePHc6ZT0eviI73UOJF0fEZ8YaneAQqQdGphNvwM4nIqPnXxV0xA0fnCT+oAhJuyw/q8jO0y8CjSteZExwBpIN6SvNp6A5G/abi6egeND/1GTguhuNjaUbbnSbGd4L8937Ezm34Eyi6n1maeOBxh3PI0jzJDf5mh/BsLD7F2GOKvlA/5gtvxI3/eV4sLfKW5Wy+oio+es/u6T8UU+nsofy57Icb/JlZHPFtCgd/x+bwt3ZT+xXTtTtTrGAb4QehC6X9G+8YT+ozcLxDsdCjsuOqwPFnrdLYaFc92Ui0m4fr39lYmlCaqTit7G6O/3kWDkgtXjNH4BiEm/+jegQnihOtfffn33WxsFjhfMd48HT+f6o6X65j7XR8WLSHMFkxbvOYsrRsF1bowDuSQ18Mkxk4qz2zoGPL5fu9h2Hqmt1asl3Q3Yu3szOc+spiCmX4AETBM3pLoTYSp3sVxahyhL8eC4mPN9k2x3o0xkiixIzM3CZFzf5oR4mecQ5+ax2wCah3/crmnHoqR0+KMaOPxRif1oEFRFOO/kTPPmtww+NfMXxEK6gn6iU32U6fFruIz8Q4WgljtnaCVTBgWx7diUdshC9ZEa5yKpRBBeW12r/iNc/+EgNqmhswNB8SBoihHXeDF7rrWDLcmt3V8GYYN7pXRy4DZjj4DJuUBL5iC3DQAaoo4vkftqVTYRGLS3mHZ7gdmdTTqbgNN/PTdTCOTgXolc88MhXAEUMdX0iy1JMuk5wLsgeu0QUYlz2S4skTWwJz6pOm/8ihrmgGfFgri+ZWUK2gAPHgbWa8jaocdSuM4FJYoKicYX/ZSENkg9Q1ZzJfwScfVnR2DegOGwCvmogaWJCLQepv9WNlU6QgsmOwICquU28Mlk3d9W5E81lU/5Ez0LcX6lwKMWDNluNKfBDUy/phJgBcMnfkh9iRxrdOzgs08JdPB85Lwo+GUSb4t3nC+0byqMZtO2fQJ4U2zGIr49t/28qmmGv2RanDD7a3FEcdtutkW8twwwlUSpb8QalodddbBfNHKDQ828BdE7OBgFdiKYohLawFYqpybQoxATZrheLhdI7+0Zlu9Q1myRcd15r9UIm8K2LGJxqTegntqNVMKnf1a8zQiyUR1rxoqjiFxeHxqFcYUTHfDu7rhbWng6qOxOsI+5A1p9mRyEPdVkTlE24vY54W7bWc6jMgZvNXdfC9/9q7408KDsbdL7Utz7QFSDetz2picArzrdpL8OaCHC9V26RroemtDZ5yNM/KGkWMyTmfnInEvwtSD23UcFcjhaE3VKzkoaEMKGBft4XbIO6forTY1lmGQwVmKicBCiArDzE+1oIxE08fWeviIOD5TznqH+OoHadvoOP20drMPe5Irg3XBQziW2XDuHYzjqQQ4wySssjXUs5H+t3FWYMHppUnBHMx/nYIT5d7OmjDbgD9F6na3m4l7KdkeSO3kTEPXafiWinogag7b52taiZhL1TSvBFmEZafFq2H8khQaZXuitCewT5FBgVtPK0j4xUHPfUz3Q28eac1Z139DAP23dgki94EC8vbDPTQC97HPPSWjUNG5tWKMsaxAEMKC0665Xvo1Ntd07wCLNf8Q56mrEPVpCxlIMVlQlWRxM3oAfpgIc+8KC3rEXUog5g06vt7zgXY8grH7hhwVSaeuvC06YYRAwpbyk/Unzj9hLEZNs2oxPQB9yc+GnL6zTgq7rI++KDJwX2SP8Sd6YzTuw5lV/kU6eQxRD12omfQAW6caTR4LikYkBB1CMOrvgRr/VY75+NSB40Cni6bADAtaK+vyxVWpf9NeKJxN2KYQ8Q2xPB3K1s7fuhvWbr2XpgW044VD6DRs0qXoqKf1NFsaGvKJc47leUV3pppP/5VTKFhaGuol4Esfjf5zyCyUHmHthChcYh4hYLQF+AFWsuq4t0wJyWgdwQVOZiV0efRHPoK5+E1vjz9wTJmVkITC9oEstAsyZSgE/dbicwKr89YUxKZI+owD205Tm5lnnmDRuP/JnzxX3gMtlrcX0UesZdxyQqYQuEW4R51vmQ5xOZteUd8SJruMlTUzhtVw/Nq7eUBcqN2/HVotgfngif60yKEtoUx3WYOZlVJuJOh8u59fzSDPFYtQgqDUAGyGhQOAvKroXMcOYY0qjnStJR/G3aP+Jt1sLVlGV8POwr/6OGsqetnyF3TmTqZjENfnXh51oxe9qVUw2M78EzAJ+IM8lZ1MBPQ9ZWSVc4J3mWSrLKrMHReA5qdGoz0ODRsaA+vwxXA2cAM4qlfzBJA6581m4hzxItQw5dxrrBL3Y6kCbUcFxo1S8jyV44q//+7ASNNudZ6xeaNOSIUffqMn4A9lIjFctYn2gpEPAb3f7p3iIBN8H14FUGQ9ct2hPsL+cEsTgUrR47uJVN4n4wt/wgfwwHuOnLd4yobkofy8JvxSQTA7rMpDIc608SlZFJfZYcmbT0tAHpPE8MrtQ42siTUNWxqvWZOmvu9f0JPoQmg+6l7sZWwyfi6PXkxJnwBraUG0MYG4zYHQz3igy/XsFkx5tNQxw43qvI9dU3f0DdhOUlHKjmi1VAr2Kiy0HZwD8VeEbhh0OiDdMYspolQsYdSwjCcjeowIXNZVUPmL2wwIkYhmXKhGozdCJ4lRKbsf4NBh/XnQoS92NJEWOVOFs2YhN8c5QZFeK0pRdAG40hqvLbmoSA8xQmzOOEc7wLcme9JOsjPCEgpCwUs9E2DohMHRhUeyGIN6TFvrbny8nDuilsDpzrH5mS76APoIEJmItS67sQJ+nfwddzmjPxcBEBBCw0kWDwd0EZCkNeOD7NNQhtBm7KHL9mRxj6U1yWU2puzlIDtpYxdH4ZPeXBJkTGAJfUr/oTCz/iypY6uXaR2V1doPxJYlrw2ghH0D5gbrhFcIxzYwi4a/4hqVdf2DdxBp6vGYDjavxMAAoy+1+3aiO6S3W/QAKNVXagDtvsNtx7Ks+HKgo6U21B+QSZgIogV5Bt+BnXisdVfy9VyXV+2P5fMuvdpAjM1o/K9Z+XnE4EOCrue+kcdYHqAQ0/Y/OmNlQ6OI33jH/uD1RalPaHpJAm2av0/xtpqdXVKNDrc9F2izo23Wu7firgbURFDNX9eGGeYBhiypyXZft2j3hTvzE6PMWKsod//rEILDkzBXfi7xh0eFkfb3/1zzPK/PI5Nk3FbZyTl4mq5BfBoVoqiPHO4Q4QKZAlrQ3MdNfi3oxIjvsM3kAFv3fdufurqYR3PSwX/mpGy/GFI/B2MNPiNdOppWVbs/gjF3YH+QA9jMhlAbhvasAHstB0IJew09iAkmXHl1/TEj+jvHOpOGrPRQXbPADM+Ig2/OEcUcpgPTItMtW4DdqgfYVI/+4hAFWYjUGpOP/UwNuB7+BbKOcALbjobdgzeBQfjgNSp2GOpxzGLj70Vvq5cw2AoYENwKLUtJUX8sGRox4dVa/TN4xKwaKcl9XawQR/uNus700Hf17pyNnezrUgaY9e4MADhEDBpsJT6y1gDJs1q6wlwGhuUzGR7C8kgpjPyHWwsvrf3yn1zJEIRa5eSxoLAZOCR9xbuztxFRJW9ZmMYfCFJ0evm9F2fVnuje92Rc4Pl6A8bluN8MZyyJGZ0+sNSb//DvAFxC2BqlEsFwccWeAl6CyBcQV1bx4mQMBP1Jxqk1EUADNLeieS2dUFbQ/c/kvwItbZ7tx0st16viqd53WsRmPTKv2AD8CUnhtPWg5aUegNpsYgasaw2+EVooeNKmrW3MFtj76bYHJm5K9gpAXZXsE5U8DM8XmVOSJ1F1WnLy6nQup+jx52bAb+rCq6y9WXl2B2oZDhfDkW7H3oYfT/4xx5VncBuxMXP2lNfhUVQjSSzSRbuZFE4vFawlzveXxaYKVs8LpvAb8IRYF3ZHiRnm0ADeNPWocwxSzNseG7NrSEVZoHdKWqaGEBz1N8Pt7kFbqh3LYmAbm9i1IChIpLpM5AS6mr6OAPHMwwznVy61YpBYX8xZDN/a+lt7n+x5j4bNOVteZ8lj3hpAHSx1VR8vZHec4AHO9XFCdjZ9eRkSV65ljMmZVzaej2qFn/qt1lvWzNZEfHxK3qOJrHL6crr0CRzMox5f2e8ALBB4UGFZKA3tN6F6IXd32GTJXGQ7DTi9j/dNcLF9jCbDcWGKxoKTYblIwbLDReL00LRcDPMcQuXLMh5YzgtfjkFK1DP1iDzzYYVZz5M/kWYRlRpig1htVRjVCknm+h1M5LiEDXOyHREhvzCGpFZjHS0RsK27o2avgdilrJkalWqPW3D9gmwV37HKmfM3F8YZj2ar+vHFvf3B8CRoH4kDHIK9mrAg+owiEwNjjd9V+FsQKYR8czJrUkf7Qoi2YaW6EVDZp5zYlqiYtuXOTHk4fAcZ7qBbdLDiJq0WNV1l2+Hntk1mMWvxrYmc8kIx8G3rW36J6Ra4lLrTOCgiOihmow+YnzUT19jbV2B3RWqSHyxkhmgsBqMYWvOcUom1jDQ436+fcbu3xf2bbeqU/ca+C4DOKE+e3qvmeMqW3AxejfzBRFVcwVYPq4L0APSWWoJu+5UYX4qg5U6YTioqQGPG9XrnuZ/BkxuYpe6Li87+18EskyQW/uA+uk2rpHpr6hut2TlVbKgWkFpx+AZffweiw2+VittkEyf/ifinS/0ItRL2Jq3tQOcxPaWO2xrG68GdFoUpZgFXaP2wYVtRc6xYCfI1CaBqyWpg4bx8OHBQwsV4XWMibZZ0LYjWEy2IxQ1mZrf1/UNbYCJplWu3nZ4WpodIGVA05d+RWSS+ET9tH3RfGGmNI1cIY7evZZq7o+a0bjjygpmR3mVfalkT/SZGT27Q8QGalwGlDOS9VHCyFAIL0a1Q7JiW3saz9gqY8lqKynFrPCzxkU4SIfLc9VfCI5edgRhDXs0edO992nhTKHriREP1NJC6SROMgQ0xO5kNNZOhMOIT99AUElbxqeZF8A3xrfDJsWtDnUenAHdYWSwAbYjFqQZ+D5gi3hNK8CSxU9i6f6ClL9IGlj1OPMQAsr84YG6ijsJpCaGWj75c3yOZKBB9mNpQNPUKkK0D6wgLH8MGoyRxTX6Y05Q4AnYNXMZwXM4eij/9WpsM/9CoRnFQXGR6MEaY+FXvXEO3RO0JaStk6OXuHVATHJE+1W+TU3bSZ2ksMtqjO0zfSJCdBv7y2d8DMx6TfVme3q0ZpTKMMu4YL/t7ciTNtdDkwPogh3Cnjx7qk08SHwf+dksZ7M2vCOlfsF0hQ6J4ehPCaHTNrM/zBSOqD83dBEBCW/F/LEmeh0nOHd7oVl3/Qo/9GUDkkbj7yz+9cvvu+dDAtx8NzCDTP4iKdZvk9MWiizvtILLepysflSvTLFBZ37RLwiriqyRxYv/zrgFd/9XVHh/OmzBvDX4mitMR/lUavs2Vx6cR94lzAkplm3IRNy4TFfu47tuYs9EQPIPVta4P64tV+sZ7n3ued3cgEx2YK+QL5+xms6osk8qQbTyuKVGdaX9FQqk6qfDnT5ykxk0VK7KZ62b6DNDUfQlqGHxSMKv1P0XN5BqMeKG1P4Wp5QfZDUCEldppoX0U6ss2jIko2XpURKCIhfaOqLPfShdtS37ZrT+jFRSH2xYVV1rmT/MBtRQhxiO4MQ3iAGlaZi+9PWBEIXOVnu9jN1f921lWLZky9bqbM3J2MAAI9jmuAx3gyoEUa6P2ivs0EeNv/OR+AX6q5SW6l5HaoFuS6jr6yg9limu+P0KYKzfMXWcQSfTXzpOzKEKpwI3YGXZpSSy2LTlMgfmFA3CF6R5c9xWEtRuCg2ZPUQ2Nb6dRFTNd4TfGHrnEWSKHPuRyiJSDAZ+KX0VxmSHjGPbQTLVpqixia2uyhQ394gBMt7C3ZAmxn/DJS+l1fBsAo2Eir/C0jG9csd4+/tp12pPc/BVJGaK9mfvr7M/CeztrmCO5qY06Edi4xAGtiEhnWAbzLy2VEyazE1J5nPmgU4RpW4Sa0TnOT6w5lgt3/tMpROigHHmexBGAMY0mdcDbDxWIz41NgdD6oxgHsJRgr5RnT6wZAkTOcStU4NMOQNemSO7gxGahdEsC+NRVGxMUhQmmM0llWRbbmFGHzEqLM4Iw0H7577Kyo+Zf+2cUFIOw93gEY171vQaM0HLwpjpdRR6Jz7V0ckE7XzYJ0TmY9znLdzkva0vNrAGGT5SUZ5uaHDkcGvI0ySpwkasEgZPMseYcu85w8HPdSNi+4T6A83iAwDbxgeFcB1ZM2iGXzFcEOUlYVrEckaOyodfvaYSQ7GuB4ISE0nYJc15X/1ciDTPbPCgYJK55VkEor4LvzL9S2WDy4xj+6FOqVyTAC2ZNowheeeSI5hA/02l8UYkv4nk9iaVn+kCVEUstgk5Hyq+gJm6R9vG3rhuM904he/hFmNQaUIATB1y3vw+OmxP4X5Yi6A5I5jJufHCjF9+AGNwnEllZjUco6XhsO5T5+R3yxz5yLVOnAn0zuS+6zdj0nTJbEZCbXJdtpfYZfCeCOqJHoE2vPPFS6eRLjIJlG69X93nfR0mxSFXzp1Zc0lt/VafDaImhUMtbnqWVb9M4nGNQLN68BHP7AR8Il9dkcxzmBv8PCZlw9guY0lurbBsmNYlwJZsA/B15/HfkbjbwPddaVecls/elmDHNW2r4crAx43feNkfRwsaNq/yyJ0d/p5hZ6AZajz7DBfUok0ZU62gCzz7x8eVfJTKA8IWn45vINLSM1q+HF9CV9qF3zP6Ml21kPPL3CXzkuYUlnSqT+Ij4tI/od5KwIs+tDajDs64owN7tOAd6eucGz+KfO26iNcBFpbWA5732bBNWO4kHNpr9D955L61bvHCF/mwSrz6eQaDjfDEANqGMkFc+NGxpKZzCD2sj/JrHd+zlPQ8Iz7Q+2JVIiVCuCKoK/hlAEHzvk/Piq3mRL1rT/fEh9hoT5GJmeYswg1otiKydizJ/fS2SeKHVu6Z3JEHjiW8NaTQgP5xdBli8nC57XiN9hrquBu99hn9zqwo92+PM2JXtpeVZS0PdqR5mDyDreMMtEws+CpwaRyyzoYtfcvt9PJIW0fJVNNi/FFyRsea7peLvJrL+5b4GOXJ8tAr+ATk9f8KmiIsRhqRy0vFzwRV3Z5dZ3QqIU8JQ/uQpkJbjMUMFj2F9sCFeaBjI4+fL/oN3+LQgjI4zuAfQ+3IPIPFQBccf0clJpsfpnBxD84atwtupkGqKvrH7cGNl/QcWcSi6wcVDML6ljOgYbo+2BOAWNNjlUBPiyitUAwbnhFvLbnqw42kR3Yp2kv2dMeDdcGOX5kT4S6M44KHEB/SpCfl7xgsUvs+JNY9G3O2X/6FEt9FyAn57lrbiu+tl83sCymSvq9eZbe9mchL7MTf/Ta78e80zSf0hYY5eUU7+ff14jv7Xy8qjzfzzzvaJnrIdvFb5BLWKcWGy5/w7+vV2cvIfwHqdTB+RuJK5oj9mbt0Hy94AmjMjjwYNZlNS6uiyxNnwNyt3gdreLb64p/3+08nXkb92LTkkRgFOwk1oGEVllcOj5lv1hfAZywDows0944U8vUFw+A/nuVq/UCygsrmWIBnHyU01d0XJPwriEOvx/ISK6Pk4y2w0gmojZs7lU8TtakBAdne4v/aNxmMpK4VcGMp7si0yqsiolXRuOi1Z1P7SqD3Zmp0CWcyK4Ubmp2SXiXuI5nGLCieFHKHNRIlcY3Pys2dwMTYCaqlyWSITwr2oGXvyU3h1Pf8eQ3w1bnD7ilocVjYDkcXR3Oo1BXgMLTUjNw2xMVwjtp99NhSVc5aIWrDQT5DHPKtCtheBP4zHcw4dz2eRdTMamhlHhtfgqJJHI7NGDUw1XL8vsSeSHyKqDtqoAmrQqsYwvwi7HW3ojWyhIa5oz5xJTaq14NAzFLjVLR12rRNUQ6xohDnrWFb5bG9yf8aCD8d5phoackcNJp+Dw3Due3RM+5Rid7EuIgsnwgpX0rUWh/nqPtByMhMZZ69NpgvRTKZ62ViZ+Q7Dp5r4K0d7EfJuiy06KuIYauRh5Ecrhdt2QpTS1k1AscEHvapNbU3HL1F2TFyR33Wxb5MvH5iZsrn3SDcsxlnnshO8PLwmdGN+paWnQuORtZGX37uhFT64SeuPsx8UOokY6ON85WdQ1dki5zErsJGazcBOddWJEKqNPiJpsMD1GrVLrVY+AOdPWQneTyyP1hRX/lMM4ZogGGOhYuAdr7F/DOiAoc++cn5vlf0zkMUJ40Z1rlgv9BelPqVOpxKeOpzKdF8maK+1Vv23MO9k/8+qpLoxrIGH2EDQlnGmH8CD31G8QqlyQIcpmR5bwmSVw9/Ns6IHgulCRehvZ/+VrM60Cu/r3AontFfrljew74skYe2uyn7JKQtFQBQRJ9ryGic/zQOsbS4scUBctA8cPToQ3x6ZBQu6DPu5m1bnCtP8TllLYA0UTQNVqza5nfew3Mopy1GPUwG5jsl0OVXniPmAcmLqO5HG8Hv3nSLecE9oOjPDXcsTxoCBxYyzBdj4wmnyEV4kvFDunipS8SSkvdaMnTBN9brHUR8xdmmEAp/Pdqk9uextp1t+JrtXwpN/MG2w/qhRMpSNxQ1uhg/kKO30eQ/FyHUDkWHT8V6gGRU4DhDMxZu7xXij9Ui6jlpWmQCqJg3FkOTq3WKneCRYZxBXMNAVLQgHXSCGSqNdjebY94oyIpVjMYehAiFx/tqzBXFHZaL5PeeD74rW5OysFoUXY8sebUZleFTUa/+zBKVTFDopTReXNuZq47QjkWnxjirCommO4L/GrFtVV21EpMyw8wyThL5Y59d88xtlx1g1ttSICDwnof6lt/6zliPzgVUL8jWBjC0o2D6Kg+jNuThkAlaDJsq/AG2aKA//A76avw2KNqtv223P+Wq3StRDDNKFFgtsFukYt1GFDWooFVXitaNhb3RCyJi4cMeNjROiPEDb4k+G3+hD8tsg+5hhmSc/8t2JTSwYoCzAI75doq8QTHe+E/Tw0RQSUDlU+6uBeNN3h6jJGX/mH8oj0i3caCNsjvTnoh73BtyZpsflHLq6AfwJNCDX4S98h4+pCOhGKDhV3rtkKHMa3EG4J9y8zFWI4UsfNzC/Rl5midNn7gwoN9j23HGCQQ+OAZpTTPMdiVow740gIyuEtd0qVxMyNXhHcnuXRKdw5wDUSL358ktjMXmAkvIB73BLa1vfF9BAUZInPYJiwxqFWQQBVk7gQH4ojfUQ/KEjn+A/WR6EEe4CtbpoLe1mzHkajgTIoE0SLDHVauKhrq12zrAXBGbPPWKCt4DGedq3JyGRbmPFW32bE7T20+73BatV/qQhhBWfWBFHfhYWXjALts38FemnoT+9bn1jDBMcUMmYgSc0e7GQjv2MUBwLU8ionCpgV+Qrhg7iUIfUY6JFxR0Y+ZTCPM+rVuq0GNLyJXX6nrUTt8HzFBRY1E/FIm2EeVA9NcXrj7S6YYIChVQCWr/m2fYUjC4j0XLkzZ8GCSLfmkW3PB/xq+nlXsKVBOj7vTvqKCOMq7Ztqr3cQ+N8gBnPaAps+oGwWOkbuxnRYj/x/WjiDclVrs22xMK4qArE1Ztk1456kiJriw6abkNeRHogaPRBgbgF9Z8i/tbzWELN4CvbqtrqV9TtGSnmPS2F9kqOIBaazHYaJ9bi3AoDBvlZasMluxt0BDXfhp02Jn411aVt6S4TUB8ZgFDkI6TP6gwPY85w+oUQSsjIeXVminrwIdK2ZAawb8Se6XOJbOaliQxHSrnAeONDLuCnFejIbp4YDtBcQCwMsYiRZfHefuEJqJcwKTTJ8sx5hjHmJI1sPFHOr6W9AhZ2NAod38mnLQk1gOz2LCAohoQbgMbUK9RMEA3LkiF7Sr9tLZp6lkciIGhE2V546w3Mam53VtVkGbB9w0Yk2XiRnCmbpxmHr2k4eSC0RuNbjNsUfDIfc8DZvRvgUDe1IlKdZTzcT4ZGEb53dp8VtsoZlyXzLHOdAbsp1LPTVaHvLA0GYDFMbAW/WUBfUAdHwqLFAV+3uHvYWrCfhUOR2i89qvCBoOb48usAGdcF2M4aKn79k/43WzBZ+xR1L0uZfia70XP9soQReeuhZiUnXFDG1T8/OXNmssTSnYO+3kVLAgeiY719uDwL9FQycgLPessNihMZbAKG7qwPZyG11G1+ZA3jAX2yddpYfmaKBlmfcK/V0mwIRUDC0nJSOPUl2KB8h13F4dlVZiRhdGY5farwN+f9hEb1cRi41ZcGDn6Xe9MMSTOY81ULJyXIHSWFIQHstVYLiJEiUjktlHiGjntN5/btB8Fu+vp28zl2fZXN+dJDyN6EXhS+0yzqpl/LSJNEUVxmu7BsNdjAY0jVsAhkNuuY0E1G48ej25mSt+00yPbQ4SRCVkIwb6ISvYtmJRPz9Zt5dk76blf+lJwAPH5KDF+vHAmACLoCdG2Adii6dOHnNJnTmZtoOGO8Q1jy1veMw6gbLFToQmfJa7nT7Al89mRbRkZZQxJTKgK5Kc9INzmTJFp0tpAPzNmyL/F08bX3nhCumM/cR/2RPn9emZ3VljokttZD1zVWXlUIqEU7SLk5I0lFRU0AcENXBYazNaVzsVHA/sD3o9hm42wbHIRb/BBQTKzAi8s3+bMtpOOZgLdQzCYPfX3UUxKd1WYVkGH7lh/RBBgMZZwXzU9+GYxdBqlGs0LP+DZ5g2BWNh6FAcR944B+K/JTWI3t9YyVyRhlP4CCoUk/mmF7+r2pilVBjxXBHFaBfBtr9hbVn2zDuI0kEOG3kBx8CGdPOjX1ph1POOZJUO1JEGG0jzUy2tK4X0CgVNYhmkqqQysRNtKuPdCJqK3WW57kaV17vXgiyPrl4KEEWgiGF1euI4QkSFHFf0TDroQiLNKJiLbdhH0YBhriRNCHPxSqJmNNoketaioohqMglh6wLtEGWSM1EZbQg72h0UJAIPVFCAJOThpQGGdKfFovcwEeiBuZHN2Ob4uVM7+gwZLz1D9E7ta4RmMZ24OBBAg7Eh6dLXGofZ4U2TFOCQMKjwhVckjrydRS+YaqCw1kYt6UexuzbNEDyYLTZnrY1PzsHZJT4U+awO2xlqTSYu6n/U29O2wPXgGOEKDMSq+zTUtyc8+6iLp0ivav4FKx+xxVy4FxhIF/pucVDqpsVe2jFOfdZhTzLz2QjtzvsTCvDPU7bzDH2eXVKUV9TZ+qFtaSSxnYgYdXKwVreIgvWhT9eGDB2OvnWyPLfIIIfNnfIxU8nW7MbcH05nhlsYtaW9EZRsxWcKdEqInq1DiZPKCz7iGmAU9/ccnnQud2pNgIGFYOTAWjhIrd63aPDgfj8/sdlD4l+UTlcxTI9jbaMqqN0gQxSHs60IAcW3cH4p3V1aSciTKB29L1tz2eUQhRiTgTvmqc+sGtBNh4ky0mQJGsdycBREP+fAaSs1EREDVo5gvgi5+aCN7NECw30owbCc1mSpjiahyNVwJd1jiGgzSwfTpzf2c5XJvG/g1n0fH88KHNnf+u7ZiRMlXueSIsloJBUtW9ezvsx9grfsX/FNxnbxU1Lvg0hLxixypHKGFAaPu0xCD8oDTeFSyfRT6s8109GMUZL8m2xXp8X2dpPCWWdX84iga4BrTlOfqox4shqEgh/Ht4qRst52cA1xOIUuOxgfUivp6v5f8IVyaryEdpVk72ERAwdT4aoY1usBgmP+0m06Q216H/nubtNYxHaOIYjcach3A8Ez/zc0KcShhel0HCYjFsA0FjYqyJ5ZUH1aZw3+zWC0hLpM6GDfcAdn9fq2orPmZbW6XXrf+Krc9RtvII5jeD3dFoT1KwZJwxfUMvc5KLfn8rROW23Jw89sJ2a5dpB3qWDUBWF2iX8OCuKprHosJ2mflBR+Wqs86VvgI/XMnsqb97+VlKdPVysczPj8Jhzf+WCvGBHijAqYlavbF60soMWlHbvKT+ScvhprgeTln51xX0sF+Eadc/l2s2a5BgkVbHYyz0E85p0LstqH+gEGiR84nBRRFIn8hLSZrGwqjZ3E29cuGi+5Z5bp7EM8MWFa9ssS/vy4VrDfECSv7DSU84DaP0sXI3Ap4lWznQ65nQoTKRWU30gd7Nn8ZowUvGIx4aqyXGwmA/PB4qN8msJUODezUHEl0VP9uo+cZ8vPFodSIB4C7lQYjEFj8yu49C2KIV3qxMFYTevG8KqAr0TPlkbzHHnTpDpvpzziAiNFh8xiT7C/TiyH0EguUw4vxAgpnE27WIypV+uFN2zW7xniF/n75trs9IJ5amB1zXXZ1LFkJ6GbS/dFokzl4cc2mamVwhL4XU0Av5gDWAl+aEWhAP7t2VIwU+EpvfOPDcLASX7H7lZpXA2XQfbSlD4qU18NffNPoAKMNSccBfO9YVVgmlW4RydBqfHAV7+hrZ84WJGho6bNT0YMhxxLdOx/dwGj0oyak9aAkNJ8lRJzUuA8sR+fPyiyTgUHio5+Pp+YaKlHrhR41jY5NESPS3x+zTMe0S2HnLOKCOQPpdxKyviBvdHrCDRqO+l96HhhNBLXWv4yEMuEUYo8kXnYJM8oIgVM4XJ+xXOev4YbWeqsvgq0lmw4/PiYr9sYLt+W5EAuYSFnJEan8CwJwbtASBfLBBpJZiRPor/aCJBZsM+MhvS7ZepyHvU8m5WSmaZnxuLts8ojl6KkS8oSAHkq5GWlCB/NgJ5W3rO2Cj1MK7ahxsCrbTT3a0V/QQH+sErxV4XUWDHx0kkFy25bPmBMBQ6BU3HoHhhYcJB9JhP6NXUWKxnE0raXHB6U9KHpWdQCQI72qevp5fMzcm+AvC85rsynVQhruDA9fp9COe7N56cg1UKGSas89vrN+WlGLYTwi5W+0xYdKEGtGCeNJwXKDU0XqU5uQYnWsMwTENLGtbQMvoGjIFIEMzCRal4rnBAg7D/CSn8MsCvS+FDJJAzoiioJEhZJgAp9n2+1Yznr7H+6eT4YkJ9Mpj60ImcW4i4iHDLn9RydB8dx3QYm3rsX6n4VRrZDsYK6DCGwkwd5n3/INFEpk16fYpP6JtMQpqEMzcOfQGAHXBTEGzuLJ03GYQL9bmV2/7ExDlRf+Uvf1sM2frRtCWmal12pMgtonvSCtR4n1CLUZRdTHDHP1Otwqd+rcdlavnKjUB/OYXQHUJzpNyFoKpQK+2OgrEKpGyIgIBgn2y9QHnTJihZOpEvOKIoHAMGAXHmj21Lym39Mbiow4IF+77xNuewziNVBxr6KD5e+9HzZSBIlUa/AmsDFJFXeyrQakR3FwowTGcADJHcEfhGkXYNGSYo4dh4bxwLM+28xjiqkdn0/3R4UEkvcBrBfn/SzBc1XhKM2VPlJgKSorjDac96V2UnQYXl1/yZPT4DVelgO+soMjexXwYO58VLl5xInQUZI8jc3H2CPnCNb9X05nOxIy4MlecasTqGK6s2az4RjpF2cQP2G28R+7wDPsZDZC/kWtjdoHC7SpdPmqQrUAhMwKVuxCmYTiD9q/O7GHtZvPSN0CAUQN/rymXZNniYLlJDE70bsk6Xxsh4kDOdxe7A2wo7P9F5YvqqRDI6brf79yPCSp4I0jVoO4YnLYtX5nzspR5WB4AKOYtR1ujXbOQpPyYDvfRE3FN5zw0i7reehdi7yV0YDRKRllGCGRk5Yz+Uv1fYl2ZwrnGsqsjgAVo0xEUba8ohjaNMJNwTwZA/wBDWFSCpg1eUH8MYL2zdioxRTqgGQrDZxQyNzyBJPXZF0+oxITJAbj7oNC5JwgDMUJaM5GqlGCWc//KCIrI+aclEe4IA0uzv7cuj6GCdaJONpi13O544vbtIHBF+A+JeDFUQNy61Gki3rtyQ4aUywn6ru314/dkGiP8Iwjo0J/2Txs49ZkwEl4mx+iYUUO55I6pJzU4P+7RRs+DXZkyKUYZqVWrPF4I94m4Wx1tXeE74o9GuX977yvJ/jkdak8+AmoHVjI15V+WwBdARFV2IPirJgVMdsg1Pez2VNHqa7EHWdTkl3XTcyjG9BiueWFvQfXI8aWSkuuRmqi/HUuzqyvLJfNfs0txMqldYYflWB1BS31WkuPJGGwXUCpjiQSktkuBMWwHjSkQxeehqw1Kgz0Trzm7QbtgxiEPDVmWCNCAeCfROTphd1ZNOhzLy6XfJyG6Xgd5MCAZw4xie0Sj5AnY1/akDgNS9YFl3Y06vd6FAsg2gVQJtzG7LVq1OH2frbXNHWH/NY89NNZ4QUSJqL2yEcGADbT38X0bGdukqYlSoliKOcsSTuqhcaemUeYLLoI8+MZor2RxXTRThF1LrHfqf/5LcLAjdl4EERgUysYS2geE+yFdasU91UgUDsc2cSQ1ZoT9+uLOwdgAmifwQqF028INc2IQEDfTmUw3eZxvz7Ud1z3xc1PQfeCvfKsB9jOhRj7rFyb9XcDWLcYj0bByosychMezMLVkFiYcdBBQtvI6K0KRuOZQH2kBsYHJaXTkup8F0eIhO1/GcIwWKpr2mouB7g5TUDJNvORXPXa/mU8bh27TAZYBe2sKx4NSv5OjnHIWD2RuysCzBlUfeNXhDd2jxnHoUlheJ3jBApzURy0fwm2FwwsSU0caQGl0Kv8hopRQE211NnvtLRsmCNrhhpEDoNiZEzD2QdJWKbRRWnaFedXHAELSN0t0bfsCsMf0ktfBoXBoNA+nZN9+pSlmuzspFevmsqqcMllzzvkyXrzoA+Ryo1ePXpdGOoJvhyru+EBRsmOp7MXZ0vNUMUqHLUoKglg1p73sWeZmPc+KAw0pE2zIsFFE5H4192KwDvDxdxEYoDBDNZjbg2bmADTeUKK57IPD4fTYF4c6EnXx/teYMORBDtIhPJneiZny7Nv/zG+YmekIKCoxr6kauE2bZtBLufetNG0BtBY7f+/ImUypMBvdWu/Q7vTMRzw5aQGZWuc1V0HEsItFYMIBnoKGZ0xcarba/TYZq50kCaflFysYjA4EDKHqGdpYWdKYmm+a7TADmW35yfnOYpZYrkpVEtiqF0EujI00aeplNs2k+qyFZNeE3CDPL9P6b4PQ/kataHkVpLSEVGK7EX6rAa7IVNrvZtFvOA6okKvBgMtFDAGZOx88MeBcJ8AR3AgUUeIznAN6tjCUipGDZONm1FjWJp4A3QIzSaIOmZ7DvF/ysYYbM/fFDOV0jntAjRdapxJxL0eThpEhKOjCDDq2ks+3GrwxqIFKLe1WdOzII8XIOPGnwy6LKXVfpSDOTEfaRsGujhpS4hBIsMOqHbl16PJxc4EkaVu9wpEYlF/84NSv5Zum4drMfp9yXbzzAOJqqS4YkI4cBrFrC7bMPiCfgI3nNZAqkk3QOZqR+yyqx+nDQKBBBZ7QKrfGMCL+XpqFaBJU0wpkBdAhbR4hJsmT5aynlvkouoxm/NjD5oe6BzVIO9uktM+/5dEC5P7vZvarmuO/lKXz4sBabVPIATuKTrwbJP8XUkdM6uEctHKXICUJGjaZIWRbZp8czquQYfY6ynBUCfIU+gG6wqSIBmYIm9pZpXdaL121V7q0VjDjmQnXvMe7ysoEZnZL15B0SpxS1jjd83uNIOKZwu5MPzg2NhOx3xMOPYwEn2CUzbSrwAs5OAtrz3GAaUkJOU74XwjaYUmGJdZBS1NJVkGYrToINLKDjxcuIlyfVsKQSG/G4DyiO2SlQvJ0d0Ot1uOG5IFSAkq+PRVMgVMDvOIJMdqjeCFKUGRWBW9wigYvcbU7CQL/7meF2KZAaWl+4y9uhowAX7elogAvItAAxo2+SFxGRsHGEW9BnhlTuWigYxRcnVUBRQHV41LV+Fr5CJYV7sHfeywswx4XMtUx6EkBhR+q8AXXUA8uPJ73Pb49i9KG9fOljvXeyFj9ixgbo6CcbAJ7WHWqKHy/h+YjBwp6VcN7M89FGzQ04qbrQtgrOFybg3gQRTYG5xn73ArkfQWjCJROwy3J38Dx/D7jOa6BBNsitEw1wGq780EEioOeD+ZGp2J66ADiVGMayiHYucMk8nTK2zzT9CnEraAk95kQjy4k0GRElLL5YAKLQErJ5rp1eay9O4Fb6yJGm9U4FaMwPGxtKD6odIIHKoWnhKo1U8KIpFC+MVn59ZXmc7ZTBZfsg6FQ8W10YfTr4u0nYrpHZbZ1jXiLmooF0cOm0+mPnJBXQtepc7n0BqOipNCqI6yyloTeRShNKH04FIo0gcMk0H/xThyN4pPAWjDDkEp3lNNPRNVfpMI44CWRlRgViP64eK0JSRp0WUvCWYumlW/c58Vcz/yMwVcW5oYb9+26TEhwvbxiNg48hl1VI1UXTU//Eta+BMKnGUivctfL5wINDD0giQL1ipt6U7C9cd4+lgqY2lMUZ02Uv6Prs+ZEZer7ZfWBXVghlfOOrClwsoOFKzWEfz6RZu1eCs+K8fLvkts5+BX0gyrFYve0C3qHrn5U/Oh6D/CihmWIrY7HUZRhJaxde+tldu6adYJ+LeXupQw0XExC36RETdNFxcq9glMu4cNQSX9cqR/GQYp+IxUkIcNGWVU7ZtGa6P3XAyodRt0XeS3Tp01AnCh0ZbUh4VrSZeV9RWfSoWyxnY3hzcZ30G/InDq4wxRrEejreBxnhIQbkxenxkaxl+k7eLUQkUR6vKJ2iDFNGX3WmVA1yaOH+mvhBd+sE6vacQzFobwY5BqEAFmejwW5ne7HtVNolOUgJc8CsUxmc/LBi8N5mu9VsIA5HyErnS6zeCz7VLI9+n/hbT6hTokMXTVyXJRKSG2hd2labXTbtmK4fNH3IZBPreSA4FMeVouVN3zG5x9CiGpLw/3pceo4qGqp+rVp+z+7yQ98oEf+nyH4F3+J9IheDBa94Wi63zJbLBCIZm7P0asHGpIJt3PzE3m0S4YIWyXBCVXGikj8MudDPB/6Nm2v4IxJ5gU0ii0guy5SUHqGUYzTP0jIJU5E82RHUXtX4lDdrihBLdP1YaG1AGUC12rQKuIaGvCpMjZC9bWSCYnjDlvpWbkdXMTNeBHLKiuoozMGIvkczmP0aRJSJ8PYnLCVNhKHXBNckH79e8Z8Kc2wUej4sQZoH8qDRGkg86maW/ZQWGNnLcXmq3FlXM6ssR/3P6E/bHMvm6HLrv1yRixit25JsH3/IOr2UV4BWJhxXW5BJ6Xdr07n9kF3ZNAk6/Xpc5MSFmYJ2R7bdL8Kk7q1OU9Elg/tCxJ8giT27wSTySF0GOxg4PbYJdi/Nyia9Nn89CGDulfJemm1aiEr/eleGSN+5MRrVJ4K6lgyTTIW3i9cQ0dAi6FHt0YMbH3wDSAtGLSAccezzxHitt1QdhW36CQgPcA8vIIBh3/JNjf/Obmc2yzpk8edSlS4lVdwgW5vzbYEyFoF4GCBBby1keVNueHAH+evi+H7oOVfS3XuPQSNTXOONAbzJeSb5stwdQHl1ZjrGoE49I8+A9j3t+ahhQj74FCSWpZrj7wRSFJJnnwi1T9HL5qrCFW/JZq6P62XkMWTb+u4lGpKfmmwiJWx178GOG7KbrZGqyWwmuyKWPkNswkZ1q8uptUlviIi+AXh2bOOTOLsrtNkfqbQJeh24reebkINLkjut5r4d9GR/r8CBa9SU0UQhsnZp5cP+RqWCixRm7i4YRFbtZ4EAkhtNa6jHb6gPYQv7MKqkPLRmX3dFsK8XsRLVZ6IEVrCbmNDc8o5mqsogjAQfoC9Bc7R6gfw03m+lQpv6kTfhxscDIX6s0w+fBxtkhjXAXr10UouWCx3C/p/FYwJRS/AXRKkjOb5CLmK4XRe0+xeDDwVkJPZau52bzLEDHCqV0f44pPgKOkYKgTZJ33fmk3Tu8SdxJ02SHM8Fem5SMsWqRyi2F1ynfRJszcFKykdWlNqgDA/L9lKYBmc7Zu/q9ii1FPF47VJkqhirUob53zoiJtVVRVwMR34gV9iqcBaHbRu9kkvqk3yMpfRFG49pKKjIiq7h/VpRwPGTHoY4cg05X5028iHsLvUW/uz+kjPyIEhhcKUwCkJAwbR9pIEGOn8z6svAO8i89sJ3dL5qDWFYbS+HGPRMxYwJItFQN86YESeJQhn2urGiLRffQeLptDl8dAgb+Tp47UQPxWOw17OeChLN1WnzlkPL1T5O+O3Menpn4C3IY5LEepHpnPeZHbvuWfeVtPlkH4LZjPbBrkJT3NoRJzBt86CO0Xq59oQ+8dsm0ymRcmQyn8w71mhmcuEI5byuF+C88VPYly2sEzjlzAQ3vdn/1+Hzguw6qFNNbqenhZGbdiG6RwZaTG7jTA2X9RdXjDN9yj1uQpyO4Lx8KRAcZcbZMafp4wPOd5MdXoFY52V1A8M9hi3sso93+uprE0qYNMjkE22CvK4HuUxqN7oIz5pWuETq1lQAjqlSlqdD2Rnr/ggp/TVkQYjn9lMfYelk2sH5HPdopYo7MHwlV1or9Bxf+QCyLzm92vzG2wjiIjC/ZHEJzeroJl6bdFPTpZho5MV2U86fLQqxNlGIMqCGy+9WYhJ8ob1r0+Whxde9L2PdysETv97O+xVw+VNN1TZSQN5I6l9m5Ip6pLIqLm4a1B1ffH6gHyqT9p82NOjntRWGIofO3bJz5GhkvSWbsXueTAMaJDou99kGLqDlhwBZNEQ4mKPuDvVwSK4WmLluHyhA97pZiVe8g+JxmnJF8IkV/tCs4Jq/HgOoAEGR9tCDsDbDmi3OviUQpG5D8XmKcSAUaFLRXb2lmJTNYdhtYyfjBYZQmN5qT5CNuaD3BVnlkCk7bsMW3AtXkNMMTuW4HjUERSJnVQ0vsBGa1wo3Qh7115XGeTF3NTz8w0440AgU7c3bSXO/KMINaIWXd0oLpoq/0/QJxCQSJ9XnYy1W7TYLBJpHsVWD1ahsA7FjNvRd6mxCiHsm8g6Z0pnzqIpF1dHUtP2ITU5Z1hZHbu+L3BEEStBbL9XYvGfEakv1bmf+bOZGnoiuHEdlBnaChxYKNzB23b8sw8YyT7Ajxfk49eJIAvdbVkdFCe2J0gMefhQ0bIZxhx3fzMIysQNiN8PgOUKxOMur10LduigREDRMZyP4oGWrP1GFY4t6groASsZ421os48wAdnrbovNhLt7ScNULkwZ5AIZJTrbaKYTLjA1oJ3sIuN/aYocm/9uoQHEIlacF1s/TM1fLcPTL38O9fOsjMEIwoPKfvt7opuI9G2Hf/PR4aCLDQ7wNmIdEuXJ/QNL72k5q4NejAldPfe3UVVqzkys8YZ/jYOGOp6c+YzRCrCuq0M11y7TiN6qk7YXRMn/gukxrEimbMQjr3jwRM6dKVZ4RUfWQr8noPXLJq6yh5R3EH1IVOHESst/LItbG2D2vRsZRkAObzvQAAD3mb3/G4NzopI0FAiHfbpq0X72adg6SRj+8OHMShtFxxLZlf/nLgRLbClwl5WmaYSs+yEjkq48tY7Z2bE0N91mJwt+ua0NlRJIDh0HikF4UvSVorFj2YVu9YeS5tfvlVjPSoNu/Zu6dEUfBOT555hahBdN3Sa5Xuj2Rvau1lQNIaC944y0RWj9UiNDskAK1WoL+EfXcC6IbBXFRyVfX/WKXxPAwUyIAGW8ggZ08hcijKTt1YKnUO6QPvcrmDVAb0FCLIXn5id4fD/Jx4tw/gbXs7WF9b2RgXtPhLBG9vF5FEkdHAKrQHZAJC/HWvk7nvzzDzIXZlfFTJoC3JpGgLPBY7SQTjGlUvG577yNutZ1hTfs9/1nkSXK9zzKLRZ3VODeKUovJe0WCq1zVMYxCJMenmNzPIU2S8TA4E7wWmbNkxq9rI2dd6v0VpcAPVMxnDsvWTWFayyqvKZO7Z08a62i/oH2/jxf8rpmfO64in3FLiL1GX8IGtVE9M23yGsIqJbxDTy+LtaMWDaPqkymb5VrQdzOvqldeU0SUi6IirG8UZ3jcpRbwHa1C0Dww9G/SFX3gPvTJQE+kyz+g1BeMILKKO+olcHzctOWgzxYHnOD7dpCRtuZEXACjgqesZMasoPgnuDC4nUviAAxDc5pngjoAITIkvhKwg5d608pdrZcA+qn5TMT6Uo/QzBaOxBCLTJX3Mgk85rMfsnWx86oLxf7p2PX5ONqieTa/qM3tPw4ZXvlAp83NSD8F7+ZgctK1TpoYwtiU2h02HCGioH5tkVCqNVTMH5p00sRy2JU1qyDBP2CII/Dg4WDsIl+zgeX7589srx6YORRQMBfKbodbB743Tl4WLKOEnwWUVBsm94SOlCracU72MSyj068wdpYjyz1FwC2bjQnxnB6Mp/pZ+yyZXtguEaYB+kqhjQ6UUmwSFazOb+rhYjLaoiM+aN9/8KKn0zaCTFpN9eKwWy7/u4EHzO46TdFSNjMfn2iPSJwDPCFHc0I1+vjdAZw5ZjqR/uzi9Zn20oAa5JnLEk/EA3VRWE7J/XrupfFJPtCUuqHPpnlL7ISJtRpSVcB8qsZCm2QEkWoROtCKKxUh3yEcMbWYJwk6DlEBG0bZP6eg06FL3v6RPb7odGuwm7FN8fG4woqtB8e7M5klPpo97GoObNwt+ludTAmxyC5hmcFx+dIvEZKI6igFKHqLH01iY1o7903VzG9QGetyVx5RNmBYUU+zIuSva/yIcECUi4pRmE3VkF2avqulQEUY4yZ/wmNboBzPmAPey3+dSYtBZUjeWWT0pPwCz4Vozxp9xeClIU60qvEFMQCaPvPaA70WlOP9f/ey39macvpGCVa+zfa8gO44wbxpJUlC8GN/pRMTQtzY8Z8/hiNrU+Zq64ZfFGIkdj7m7abcK1EBtws1X4J/hnqvasPvvDSDYWN+QcQVGMqXalkDtTad5rYY0TIR1Eqox3czwPMjKPvF5sFv17Thujr1IZ1Ytl4VX1J0vjXKmLY4lmXipRAro0qVGEcXxEVMMEl54jQMd4J7RjgomU0j1ptjyxY+cLiSyXPfiEcIS2lWDK3ISAy6UZ3Hb5vnPncA94411jcy75ay6B6DSTzK6UTCZR9uDANtPBrvIDgjsfarMiwoax2OlLxaSoYn4iRgkpEGqEkwox5tyI8aKkLlfZ12lO11TxsqRMY89j5JaO55XfPJPDL1LGSnC88Re9Ai+Nu5bZjtwRrvFITUFHPR4ZmxGslQMecgbZO7nHk32qHxYkdvWpup07ojcMCaVrpFAyFZJJbNvBpZfdf39Hdo2kPtT7v0/f8R/B5Nz4f1t9/3zNM/7n6SUHfcWk5dfQFJvcJMgPolGCpOFb/WC0FGWU2asuQyT+rm88ZKZ78Cei/CAh939CH0JYbpZIPtxc2ufXqjS3pHH9lnWK4iJ7OjR/EESpCo2R3MYKyE7rHfhTvWho4cL1QdN4jFTyR6syMwFm124TVDDRXMNveI1Dp/ntwdz8k8kxw7iFSx6+Yx6O+1LzMVrN0BBzziZi9kneZSzgollBnVwBh6oSOPHXrglrOj+QmR/AESrhDpKrWT+8/AiMDxS/5wwRNuGQPLlJ9ovomhJWn8sMLVItQ8N/7IXvtD8kdOoHaw+vBSbFImQsv/OCAIui99E+YSIOMlMvBXkAt+NAZK8wB9Jf8CPtB+TOUOR+z71d/AFXpPBT6+A5FLjxMjLIEoJzrQfquvxEIi+WoUzGR1IzQFNvbYOnxb2PyQ0kGdyXKzW2axQL8lNAXPk6NEjqrRD1oZtKLlFoofrXw0dCNWASHzy+7PSzOUJ3XtaPZsxLDjr+o41fKuKWNmjiZtfkOzItvlV2MDGSheGF0ma04qE3TUEfqJMrXFm7DpK+27DSvCUVf7rbNoljPhha5W7KBqVq0ShUSTbRmuqPtQreVWH4JET5yMhuqMoSd4r/N8sDmeQiQQvi1tcZv7Moc7dT5X5AtCD6kNEGZOzVcNYlpX4AbTsLgSYYliiPyVoniuYYySxsBy5cgb3pD+EK0Gpb0wJg031dPgaL8JZt6sIvzNPEHfVPOjXmaXj4bd4voXzpZ5GApMhILgMbCEWZ2zwgdeQgjNHLbPIt+KqxRwWPLTN6HwZ0Ouijj4UF+Sg0Au8XuIKW0WxlexdrFrDcZJ8Shauat3X0XmHygqgL1nAu2hrJFb4wZXkcS+i36KMyU1yFvYv23bQUJi/3yQpqr/naUOoiEWOxckyq/gq43dFou1DVDaYMZK9tho7+IXXokBCs5GRfOcBK7g3A+jXQ39K4YA8PBRW4m5+yR0ZAxWJncjRVbITvIAPHYRt1EJ3YLiUbqIvoKHtzHKtUy1ddRUQ0AUO41vonZDUOW+mrszw+SW/6Q/IUgNpcXFjkM7F4CSSQ2ExZg85otsMs7kqsQD4OxYeBNDcSpifjMoLb7GEbGWTwasVObmB/bfPcUlq0wYhXCYEDWRW02TP5bBrYsKTGWjnWDDJ1F7zWai0zW/2XsCuvBQjPFcTYaQX3tSXRSm8hsAoDdjArK/OFp6vcWYOE7lizP0Yc+8p16i7/NiXIiiQTp7c7Xus925VEtlKAjUdFhyaiLT7VxDagprMFwix4wZ05u0qj7cDWFd0W9OYHIu3JbJKMXRJ1aYNovugg+QqRN7fNHSi26VSgBpn+JfMuPo3aeqPWik/wI5Rz3BWarPQX4i5+dM0npwVOsX+KsOhC7vDg+OJsz4Q5zlnIeflUWL6QYMbf9WDfLmosLF4Qev3mJiOuHjoor/dMeBpA9iKDkMjYBNbRo414HCxjsHrB4EXNbHzNMDHCLuNBG6Sf+J4MZ/ElVsDSLxjIiGsTPhw8BPjxbfQtskj+dyNMKOOcUYIRBEIqbazz3lmjlRQhplxq673VklMMY6597vu+d89ec/zq7Mi4gQvh87ehYbpOuZEXj5g/Q7S7BFDAAB9DzG35SC853xtWVcnZQoH54jeOqYLR9NDuwxsVthTV7V99n/B7HSbAytbEyVTz/5NhJ8gGIjG0E5j3griULUd5Rg7tQR+90hJgNQKQH2btbSfPcaTOfIexc1db1BxUOhM1vWCpLaYuKr3FdNTt/T3PWCpEUWDKEtzYrjpzlL/wri3MITKsFvtF8QVV/NhVo97aKIBgdliNc10dWdXVDpVtsNn+2UIolrgqdWA4EY8so0YvB4a+aLzMXiMAuOHQrXY0tr+CL10JbvZzgjJJuB1cRkdT7DUqTvnswVUp5kkUSFVtIIFYK05+tQxT6992HHNWVhWxUsD1PkceIrlXuUVRogwmfdhyrf6zzaL8+c0L7GXMZOteAhAVQVwdJh+7nrX7x4LaIIfz2F2v7Dg/uDfz2Fa+4gFm2zHAor8UqimJG3VTJtZEoFXhnDYXvxMJFc6ku2bhbCxzij2z5UNuK0jmp1mnvkVNUfR+SEmj1Lr94Lym75PO7Fs0MIr3GdsWXRXSfgLTVY0FLqba97u1In8NAcY7IC6TjWLigwKEIm43NxTdaVTv9mcKkzuzBkKd8x/xt1p/9BbP7Wyb4bpo1K1gnOpbLvKz58pWl3B55RJ/Z5mRDLPtNQg14jdOEs9+h/V5UVpwrAI8kGbX8KPVPDIMfIqKDjJD9UyDOPhjZ3vFAyecwyq4akUE9mDOtJEK1hpDyi6Ae87sWAClXGTiwPwN7PXWwjxaR79ArHRIPeYKTunVW24sPr/3HPz2IwH8oKH4OlWEmt4BLM6W5g4kMcYbLwj2usodD1088stZA7VOsUSpEVl4w7NMb1EUHMRxAxLF0CIV+0L3iZb+ekB1vSDSFjAZ3hfLJf7gFaXrOKn+mhR+rWw/eTXIcAgl4HvFuBg1LOmOAwJH3eoVEjjwheKA4icbrQCmvAtpQ0mXG0agYp5mj4Rb6mdQ+RV4QBPbxMqh9C7o8nP0Wko2ocnCHeRGhN1XVyT2b9ACsL+6ylUy+yC3QEnaKRIJK91YtaoSrcWZMMwxuM0E9J68Z+YyjA0g8p1PfHAAIROy6Sa04VXOuT6A351FOWhKfTGsFJ3RTJGWYPoLk5FVK4OaYR9hkJvezwF9vQN1126r6isMGXWTqFW+3HL3I/jurlIdDWIVvYY+s6yq7lrFSPAGRdnU7PVwY/SvWbZGpXzy3BQ2LmAJlrONUsZs4oGkly0V267xbD5KMY8woNNsmWG1VVgLCra8aQBBcI4DP2BlNwxhiCtHlaz6OWFoCW0vMR3ErrG7JyMjTSCnvRcsEHgmPnwA6iNpJ2DrFb4gLlhKJyZGaWkA97H6FFdwEcLT6DRQQL++fOkVC4cYGW1TG/3iK5dShRSuiBulmihqgjR45Vi03o2RbQbP3sxt90VxQ6vzdlGfkXmmKmjOi080JSHkLntjvsBJnv7gKscOaTOkEaRQqAnCA4HWtB4XnMtOhpRmH2FH8tTXrIjAGNWEmudQLCkcVlGTQ965Kh0H6ixXbgImQP6b42B49sO5C8pc7iRlgyvSYvcnH9FgQ3azLbQG2cUW96SDojTQStxkOJyOuDGTHAnnWkz29aEwN9FT8EJ4yhXOg+jLTrCPKeEoJ9a7lDXOjEr8AgX4BmnMQ668oW0zYPyQiVMPxKRHtpfnEEyaKhdzNVThlxxDQNdrHeZiUFb6NoY2KwvSb7BnRcpJy+/g/zAYx3fYSN5QEaVD2Y1VsNWxB0BSO12MRsRY8JLfAezRMz5lURuLUnG1ToKk6Q30FughqWN6gBNcFxP/nY/iv+iaUQOa+2Nuym46wtI/DvSfzSp1jEi4SdYBE7YhTiVV5cX9gwboVDMVgZp5YBQlHOQvaDNfcCoCJuYhf5kz5kwiIKPjzgpcRJHPbOhJajeoeRL53cuMahhV8Z7IRr6M4hW0JzT7mzaMUzQpm866zwM7Cs07fJYXuWvjAMkbe5O6V4bu71sOG6JQ4oL8zIeXHheFVavzxmlIyBkgc9IZlEDplMPr8xlcyss4pVUdwK1e7CK2kTsSdq7g5SHRAl3pYUB9Ko4fsh4qleOyJv1z3KFSTSvwEcRO/Ew8ozEDYZSqpfoVW9uhJfYrNAXR0Z3VmeoAD+rVWtwP/13sE/3ICX3HhDG3CMc476dEEC0K3umSAD4j+ZQLVdFOsWL2C1TH5+4KiSWH+lMibo+B55hR3Gq40G1n25sGcN0mEcoU2wN9FCVyQLBhYOu9aHVLWjEKx2JIUZi5ySoHUAI9b8hGzaLMxCZDMLhv8MkcpTqEwz9KFDpCpqQhVmsGQN8m24wyB82FAKNmjgfKRsXRmsSESovAwXjBIoMKSG51p6Um8b3i7GISs7kjTq/PZoioCfJzfKdJTN0Q45kQEQuh9H88M3yEs3DbtRTKALraM0YC8laiMiOOe6ADmTcCiREeAWZelBaEXRaSuj2lx0xHaRYqF65O0Lo5OCFU18A8cMDE4MLYm9w2QSr9NgQAIcRxZsNpA7UJR0e71JL+VU+ISWFk5I97lra8uGg7GlQYhGd4Gc6rxsLFRiIeGO4abP4S4ekQ1fiqDCy87GZHd52fn5aaDGuvOmIofrzpVwMvtbreZ/855OaXTRcNiNE0wzGZSxbjg26v8ko8L537v/XCCWP2MFaArJpvnkep0pA+O86MWjRAZPQRfznZiSIaTppy6m3p6HrNSsY7fDtz7Cl4V/DJAjQDoyiL2uwf1UHVd2AIrzBUSlJaTj4k6NL97a/GqhWKU9RUmjnYKpm2r+JYUcrkCuZKvcYvrg8pDoUKQywY9GDWg03DUFSirlUXBS5SWn/KAntnf0IdHGL/7mwXqDG+LZYjbEdQmqUqq4y54TNmWUP7IgcAw5816YBzwiNIJiE9M4lPCzeI/FGBeYy3p6IAmH4AjXXmvQ4Iy0Y82NTobcAggT2Cdqz6Mx4TdGoq9fn2etrWKUNFyatAHydQTVUQ2S5OWVUlugcNvoUrlA8cJJz9MqOa/W3iVno4zDHfE7zhoY5f5lRTVZDhrQbR8LS4eRLz8iPMyBL6o4PiLlp89FjdokQLaSBmKHUwWp0na5fE3v9zny2YcDXG/jfI9sctulHRbdkI5a4GOPJx4oAJQzVZ/yYAado8KNZUdEFs9ZPiBsausotXMNebEgr0dyopuqfScFJ3ODNPHgclACPdccwv0YJGQdsN2lhoV4HVGBxcEUeUX/alr4nqpcc1CCR3vR7g40zteQg/JvWmFlUE4mAiTpHlYGrB7w+U2KdSwQz2QJKBe/5eiixWipmfP15AFWrK8Sh1GBBYLgzki1wTMhGQmagXqJ2+FuqJ8f0XzXCVJFHQdMAw8xco11HhM347alrAu+wmX3pDFABOvkC+WPX0Uhg1Z5MVHKNROxaR84YV3s12UcM+70cJ460SzEaKLyh472vOMD3XnaK7zxZcXlWqenEvcjmgGNR2OKbI1s8U+iwiW+HotHalp3e1MGDy6BMVIvajnAzkFHbeVsgjmJUkrP9OAwnEHYXVBqYx3q7LvXjoVR0mY8h+ZaOnh053pdsGkmbqhyryN01eVHySr+CkDYkSMeZ1xjPNVM+gVLTDKu2VGsMUJqWO4TwPDP0VOg2/8ITbAUaMGb4LjL7L+Pi11lEVMXTYIlAZ/QHmTENjyx3kDkBdfcvvQt6tKk6jYFM4EG5UXDTaF5+1ZjRz6W7MdJPC+wTkbDUim4p5QQH3b9kGk2Bkilyeur8Bc20wm5uJSBO95GfYDI1EZipoRaH7uVveneqz43tlTZGRQ4a7CNmMHgXyOQQOL6WQkgMUTQDT8vh21aSdz7ERiZT1jK9F+v6wgFvuEmGngSvIUR2CJkc5tx1QygfZnAruONobB1idCLB1FCfO7N1ZdRocT8/Wye+EnDiO9pzqIpnLDl4bkaRKW+ekBVwHn46Shw1X0tclt/0ROijuUB4kIInrVJU4buWf4YITJtjOJ6iKdr1u+flgQeFH70GxKjhdgt/MrwfB4K/sXczQ+9zYcrD4dhY6qZhZ010rrxggWA8JaZyg2pYij8ieYEg1aZJkZK9O1Re7sB0iouf60rK0Gd+AYlp7soqCBCDGwfKeUQhCBn0E0o0GS6PdmjLi0TtCYZeqazqwN+yNINIA8Lk3iPDnWUiIPLGNcHmZDxfeK0iAdxm/T7LnN+gemRL61hHIc0NCAZaiYJR+OHnLWSe8sLrK905B5eEJHNlWq4RmEXIaFTmo49f8w61+NwfEUyuJAwVqZCLFcyHBKAcIVj3sNzfEOXzVKIndxHw+AR93owhbCxUZf6Gs8cz6/1VdrFEPrv330+9s6BtMVPJ3zl/Uf9rUi0Z/opexfdL3ykF76e999GPfVv8fJv/Y/+/5hEMon1tqNFyVRevV9y9/uIvsG3dbB8GRRrgaEXfhx+2xeOFt+cEn3RZanNxdEe2+B6MHpNbrRE53PlDifPvFcp4kO78ILR0T4xyW/WGPyBsqGdoA7zJJCu1TKbGfhnqgnRbxbB2B3UZoeQ2bz2sTVnUwokTcTU21RxN1PYPS3Sar7T0eRIsyCNowr9amwoMU/od9s2APtiKNL6ENOlyKADstAEWKA+sdKDhrJ6BOhRJmZ+QJbAaZ3/5Fq0/lumCgEzGEbu3yi0Y4I4EgVAjqxh4HbuQn0GrRhOWyAfsglQJAVL1y/6yezS2k8RE2MstJLh92NOB3GCYgFXznF4d25qiP4ZCyI4RYGesut6FXK6GwPpKK8WHEkhYui0AyEmr5Ml3uBFtPFdnioI8RiCooa7Z1G1WuyIi3nSNglutc+xY8BkeW3JJXPK6jd2VIMpaSxpVtFq+R+ySK9J6WG5Qvt+C+QH1hyYUOVK7857nFmyDBYgZ/o+AnibzNVqyYCJQvyDXDTK+iXdkA71bY7TL3bvuLxLBQ8kbTvTEY9aqkQ3+MiLWbEgjLzOH+lXgco1ERgzd80rDCymlpaRQbOYnKG/ODoFl46lzT0cjM5FYVvv0qLUbD5lyJtMUaC1pFlTkNONx6lliaX9o0i/1vws5bNKn5OuENQEKmLlcP4o2ZmJjD4zzd3Fk32uQ4uRWkPSUqb4LBe3EXHdORNB2BWsws5daRnMfNVX7isPSb1hMQdAJi1/qmDMfRUlCU74pmnzjbXfL8PVG8NsW6IQM2Ne23iCPIpryJjYbVnm5hCvKpMa7HLViNiNc+xTfDIaKm3jctViD8A1M9YPJNk003VVr4Zo2MuGW8vil8SLaGpPXqG7I4DLdtl8a4Rbx1Lt4w5Huqaa1XzZBtj208EJVGcmKYEuaeN27zT9EE6a09JerXdEbpaNgNqYJdhP1NdqiPKsbDRUi86XvvNC7rME5mrSQtrzAZVndtSjCMqd8BmaeGR4l4YFULGRBeXIV9Y4yxLFdyoUNpiy2IhePSWzBofYPP0eIa2q5JP4j9G8at/AqoSsLAUuRXtvgsqX/zYwsE+of6oSDbUOo4RMJw+DOUTJq+hnqwKim9Yy/napyZNTc2rCq6V9jHtJbxGPDwlzWj/Sk3zF/BHOlT/fSjSq7FqlPI1q6J+ru8Aku008SFINXZfOfnZNOvGPMtEmn2gLPt+H4QLA+/SYe4j398auzhKIp2Pok3mPC5q1IN1HgR+mnEfc4NeeHYwd2/kpszR3cBn7ni9NbIqhtSWFW8xbUJuUPVOeeXu3j0IGZmFNiwaNZ6rH4/zQ2ODz6tFxRLsUYZu1bfd1uIvfQDt4YD/efKYv8VF8bHGDgK22w2Wqwpi43vNCOXFJZCGMqWiPbL8mil6tsmOTXAWCyMCw73e2rADZj2IK6rqksM3EXF2cbLb4vjB14wa/yXK5vwU+05MzERJ5nXsXsW21o7M+gO0js2OyKciP5uF2iXyb2DiptwQeHeqygkrNsqVCSlldxBMpwHi1vfc8RKpP/4L3Lmpq6DZcvhDDfxTCE3splacTcOtXdK2g303dIWBVe2wD/Gvja1cClFQ67gw0t1ZUttsUgQ1Veky8oOpS6ksYEc4bqseCbZy766SvL3FodmnahlWJRgVCNjPxhL/fk2wyvlKhITH/VQCipOI0dNcRa5B1M5HmOBjTLeZQJy237e2mobwmDyJNHePhdDmiknvLKaDbShL+Is1XTCJuLQd2wmdJL7+mKvs294whXQD+vtd88KKk0DXP8B1Xu9J+xo69VOuFgexgTrcvI6SyltuLix9OPuE6/iRJYoBMEXxU4shQMf4Fjqwf1PtnJ/wWSZd29rhZjRmTGgiGTAUQqRz+nCdjeMfYhsBD5Lv60KILWEvNEHfmsDs2L0A252351eUoYxAysVaCJVLdH9QFWAmqJDCODUcdoo12+gd6bW2boY0pBVHWL6LQDK5bYWh1V8vFvi0cRpfwv7cJiMX3AZNJuTddHehTIdU0YQ/sQ1dLoF2xQPcCuHKiuCWOY30DHe1OwcClLAhqAKyqlnIbH/8u9ScJpcS4kgp6HKDUdiOgRaRGSiUCRBjzI5gSksMZKqy7Sd51aeg0tgJ+x0TH9YH2Mgsap9N7ENZdEB0bey2DMTrBA1hn56SErNHf3tKtqyL9b6yXEP97/rc+jgD2N1LNUH6RM9AzP3kSipr06RkKOolR7HO768jjWiH1X92jA7dkg7gcNcjqsZCgfqWw0tPXdLg20cF6vnQypg7gLtkazrHAodyYfENPQZsdfnjMZiNu4nJO97D1/sQE+3vNFzrSDOKw+keLECYf7RJwVHeP/j79833oZ0egonYB2FlFE5qj02B/LVOMJQlsB8uNg3Leg4qtZwntsOSNidR0abbZmAK4sCzvt8Yiuz2yrNCJoH5O8XvX/vLeR/BBYTWj0sOPYM/jyxRd5+/JziKAABaPcw/34UA3aj/gLZxZgRCWN6m4m3demanNgsx0P237/Q+Ew5VYnJPkyCY0cIVHoFn2Ay/e7U4P19APbPFXEHX94N6KhEMPG7iwB3+I+O1jd5n6VSgHegxgaSawO6iQCYFgDsPSMsNOcUj4q3sF6KzGaH/0u5PQoAj/8zq6Uc9MoNrGqhYeb2jQo0WlGlXjxtanZLS24/OIN5Gx/2g684BPDQpwlqnkFcxpmP/osnOXrFuu4PqifouQH0eF5qCkvITQbJw/Zvy5mAHWC9oU+cTiYhJmSfKsCyt1cGVxisKu+NymEQIAyaCgud/V09qT3nk/9s/SWsYtha7yNpzBIMM40rCSGaJ9u6lEkl00vXBiEt7p9P5IBCiavynEOv7FgLqPdeqxRiCwuFVMolSIUBcoyfUC2e2FJSAUgYdVGFf0b0Kn2EZlK97yyxrT2MVgvtRikfdaAW8RwEEfN+B7/eK8bBdp7URpbqn1xcrC6d2UjdsKbzCjBFqkKkoZt7Mrhg6YagE7spkqj0jOrWM+UGQ0MUlG2evP1uE1p2xSv4dMK0dna6ENcNUF+xkaJ7B764NdxLCpuvhblltVRAf7vK5qPttJ/9RYFUUSGcLdibnz6mf7WkPO3MkUUhR2mAOuGv8IWw5XG1ZvoVMnjSAZe6T7WYA99GENxoHkMiKxHlCuK5Gd0INrISImHQrQmv6F4mqU/TTQ8nHMDzCRivKySQ8dqkpQgnUMnwIkaAuc6/FGq1hw3b2Sba398BhUwUZSAIO8XZvnuLdY2n6hOXws+gq9BHUKcKFA6kz6FDnpxLPICa3qGhnc97bo1FT/XJk48LrkHJ2CAtBv0RtN97N21plfpXHvZ8gMJb7Zc4cfI6MbPwsW7AilCSXMFIEUEmir8XLEklA0ztYbGpTTGqttp5hpFTTIqUyaAIqvMT9A/x+Ji5ejA4Bhxb/cl1pUdOD6epd3yilIdO6j297xInoiBPuEDW2/UfslDyhGkQs7Wy253bVnlT+SWg89zYIK/9KXFl5fe+jow2rd5FXv8zDPrmfMXiUPt9QBO/iK4QGbX5j/7Rx1c1vzsY8ONbP3lVIaPrhL4+1QrECTN3nyKavGG0gBBtHvTKhGoBHgMXHStFowN+HKrPriYu+OZ05Frn8okQrPaaxoKP1ULCS/cmKFN3gcH7HQlVjraCeQmtjg1pSQxeuqXiSKgLpxc/1OiZsU4+n4lz4hpahGyWBURLi4642n1gn9qz9bIsaCeEPJ0uJmenMWp2tJmIwLQ6VSgDYErOeBCfSj9P4G/vI7oIF+l/n5fp956QgxGvur77ynawAu3G9MdFbJbu49NZnWnnFcQHjxRuhUYvg1U/e84N4JTecciDAKb/KYIFXzloyuE1eYXf54MmhjTq7B/yBToDzzpx3tJCTo3HCmVPYfmtBRe3mPYEE/6RlTIxbf4fSOcaKFGk4gbaUWe44hVk9SZzhW80yfW5QWBHxmtUzvMhfVQli4gZTktIOZd9mjJ5hsbmzttaHQB29Am3dZkmx3g/qvYocyhZ2PXAWsNQiIaf+Q8W/MWPIK7/TjvCx5q2XRp4lVWydMc2wIQkhadDB0xsnw/kSEyGjLKjI4coVIwtubTF3E7MJ6LS6UOsJKj82XVAVPJJcepfewbzE91ivXZvOvYfsmMevwtPpfMzGmC7WJlyW2j0jh7AF1JLmwEJSKYwIvu6DHc3YnyLH9ZdIBnQ+nOVDRiP+REpqv++typYHIvoJyICGA40d8bR7HR2k7do6UQTHF4oriYeIQbxKe4Th6+/l1BjUtS9hqORh3MbgvYrStXTfSwaBOmAVQZzpYNqsAmQyjY56MUqty3c/xH6GuhNvNaG9vGbG6cPtBM8UA3e8r51D0AR9kozKuGGSMgLz3nAHxDNnc7GTwpLj7/6HeWp1iksDeTjwCLpxejuMtpMnGJgsiku1sOACwQ9ukzESiDRN77YNESxR5LphOlcASXA5uIts1LnBIcn1J7BLWs49DMALSnuz95gdOrTZr0u1SeYHinno/pE58xYoXbVO/S+FEMMs5qyWkMnp8Q3ClyTlZP52Y9nq7b8fITPuVXUk9ohG5EFHw4gAEcjFxfKb3xuAsEjx2z1wxNbSZMcgS9GKyW3R6KwJONgtA64LTyxWm8Bvudp0M1FdJPEGopM4Fvg7G/hsptkhCfHFegv4ENwxPeXmYhxwZy7js+BeM27t9ODBMynVCLJ7RWcBMteZJtvjOYHb5lOnCLYWNEMKC59BA7covu1cANa2PXL05iGdufOzkgFqqHBOrgQVUmLEc+Mkz4Rq8O6WkNr7atNkH4M8d+SD1t/tSzt3oFql+neVs+AwEI5JaBJaxARtY2Z4mKoUqxds4UpZ0sv3zIbNoo0J4fihldQTX3XNcuNcZmcrB5LTWMdzeRuAtBk3cZHYQF6gTi3PNuDJ0nmR+4LPLoHvxQIxRgJ9iNNXqf2SYJhcvCtJiVWo85TsyFOuq7EyBPJrAdhEgE0cTq16FQXhYPJFqSfiVn0IQnPOy0LbU4BeG94QjdYNB0CiQ3QaxQqD2ebSMiNjaVaw8WaM4Z5WnzcVDsr4eGweSLa2DE3BWViaxhZFIcSTjgxNCAfelg+hznVOYoe5VqTYs1g7WtfTm3e4/WduC6p+qqAM8H4ZyrJCGpewThTDPe6H7CzX/zQ8Tm+r65HeZn+MsmxUciEWPlAVaK/VBaQBWfoG/aRL/jSZIQfep/89GjasWmbaWzeEZ2R1FOjvyJT37O9B8046SRSKVEnXWlBqbkb5XCS3qFeuE9xb9+frEknxWB5h1D/hruz2iVDEAS7+qkEz5Ot5agHJc7WCdY94Ws61sURcX5nG8UELGBAHZ3i+3VulAyT0nKNNz4K2LBHBWJcTBX1wzf+//u/j/9+//v87+9/l9Lbh/L/uyNYiTsWV2LwsjaA6MxTuzFMqmxW8Jw/+IppdX8t/Clgi1rI1SN0UC/r6tX/4lUc2VV1OQReSeCsjUpKZchw4XUcjHfw6ryCV3R8s6VXm67vp4n+lcPV9gJwmbKQEsmrJi9c2vkwrm8HFbVYNTaRGq8D91t9n5+U+aD/hNtN3HjC/nC/vUoGFSCkXP+NlRcmLUqLbiUBl4LYf1U/CCvwtd3ryCH8gUmGITAxiH1O5rnGTz7y1LuFjmnFGQ1UWuM7HwfXtWl2fPFKklYwNUpF2IL/TmaRETjQiM5SJacI+3Gv5MBU8lP5Io6gWkawpyzNEVGqOdx4YlO1dCvjbWFZWbCmeiFKPSlMKtKcMFLs/KQxtgAHi7NZNCQ32bBAW2mbHflVZ8wXKi1JKVHkW20bnYnl3dKWJeWJOiX3oKPBD6Zbi0ZvSIuWktUHB8qDR8DMMh1ZfkBL9FS9x5r0hBGLJ8pUCJv3NYH+Ae8p40mZWd5m5fhobFjQeQvqTT4VKWIYfRL0tfaXKiVl75hHReuTJEcqVlug+eOIIc4bdIydtn2K0iNZPsYWQvQio2qbO3OqAlPHDDOB7DfjGEfVF51FqqNacd6QmgFKJpMfLp5DHTv4wXlONKVXF9zTJpDV4m1sYZqJPhotcsliZM8yksKkCkzpiXt+EcRQvSQqmBS9WdWkxMTJXPSw94jqI3varCjQxTazjlMH8jTS8ilaW8014/vwA/LNa+YiFoyyx3s/KswP3O8QW1jtq45yTM/DX9a8M4voTVaO2ebvw1EooDw/yg6Y1faY+WwrdVs5Yt0hQ5EwRfYXSFxray1YvSM+kYmlpLG2/9mm1MfmbKHXr44Ih8nVKb1M537ZANUkCtdsPZ80JVKVKabVHCadaLXg+IV8i5GSwpZti0h6diTaKs9sdpUKEpd7jDUpYmHtiX33SKiO3tuydkaxA7pEc9XIQEOfWJlszj5YpL5bKeQyT7aZSBOamvSHl8xsWvgo26IP/bqk+0EJUz+gkkcvlUlyPp2kdKFtt7y5aCdks9ZJJcFp5ZWeaWKgtnXMN3ORwGLBE0PtkEIek5FY2aVssUZHtsWIvnljMVJtuVIjpZup/5VL1yPOHWWHkOMc6YySWMckczD5jUj2mlLVquFaMU8leGVaqeXis+aRRL8zm4WuBk6cyWfGMxgtr8useQEx7k/PvRoZyd9nde1GUCV84gMX8Ogu/BWezYPSR27llzQnA97oo0pYyxobYUJfsj+ysTm9zJ+S4pk0TGo9VTG0KjqYhTmALfoDZVKla2b5yhv241PxFaLJs3i05K0AAIdcGxCJZmT3ZdT7CliR7q+kur7WdQjygYtOWRL9B8E4s4LI8KpAj7bE0dg7DLOaX+MGeAi0hMMSSWZEz+RudXbZCsGYS0QqiXjH9XQbd8sCB+nIVTq7/T/FDS+zWY9q7Z2fdq1tdLb6v3hKKVDAw5gjj6o9r1wHFROdHc18MJp4SJ2Ucvu+iQ9EgkekW8VCM+psM6y+/2SBy8tNN4a3L1MzP+OLsyvESo5gS7IQOnIqMmviJBVc6zbVG1n8eXiA3j46kmvvtJlewwNDrxk4SbJOtP/TV/lIVK9ueShNbbMHfwnLTLLhbZuO79ec5XvfgRwLFK+w1r5ZWW15rVFZrE+wKqNRv5KqsLNfpGgnoUU6Y71NxEmN7MyqwqAQqoIULOw/LbuUB2+uE75gJt+kq1qY4LoxV+qR/zalupea3D5+WMeaRIn0sAI6DDWDh158fqUb4YhAxhREbUN0qyyJYkBU4V2KARXDT65gW3gRsiv7xSPYEKLwzgriWcWgPr0sbZnv7m1XHNFW6xPdGNZUdxFiUYlmXNjDVWuu7LCkX/nVkrXaJhiYktBISC2xgBXQnNEP+cptWl1eG62a7CPXrnrkTQ5BQASbEqUZWMDiZUisKyHDeLFOaJILUo5f6iDt4ZO8MlqaKLto0AmTHVVbkGuyPa1R/ywZsWRoRDoRdNMMHwYTsklMVnlAd2S0282bgMI8fiJpDh69OSL6K3qbo20KfpNMurnYGQSr/stFqZ7hYsxKlLnKAKhsmB8AIpEQ4bd/NrTLTXefsE6ChRmKWjXKVgpGoPs8GAicgKVw4K0qgDgy1A6hFq1WRat3fHF+FkU+b6H4NWpOU3KXTxrIb2qSHAb+qhm8hiSROi/9ofapjxhyKxxntPpge6KL5Z4+WBMYkAcE6+0Hd3Yh2zBsK2MV3iW0Y6cvOCroXlRb2MMJtdWx+3dkFzGh2Pe3DZ9QpSqpaR/rE1ImOrHqYYyccpiLC22amJIjRWVAherTfpQLmo6/K2pna85GrDuQPlH1Tsar8isAJbXLafSwOof4gg9RkAGm/oYpBQQiPUoyDk2BCQ1k+KILq48ErFo4WSRhHLq/y7mgw3+L85PpP6xWr6cgp9sOjYjKagOrxF148uhuaWtjet953fh1IQiEzgC+d2IgBCcUZqgTAICm2bR8oCjDLBsmg+ThyhfD+zBalsKBY1Ce54Y/t9cwfbLu9SFwEgphfopNA3yNxgyDafUM3mYTovZNgPGdd4ZFFOj1vtfFW3u7N+iHEN1HkeesDMXKPyoCDCGVMo4GCCD6PBhQ3dRZIHy0Y/3MaE5zU9mTCrwwnZojtE+qNpMSkJSpmGe0EzLyFelMJqhfFQ7a50uXxZ8pCc2wxtAKWgHoeamR2O7R+bq7IbPYItO0esdRgoTaY38hZLJ5y02oIVwoPokGIzxAMDuanQ1vn2WDQ00Rh6o5QOaCRu99fwDbQcN0XAuqkFpxT/cfz3slGRVokrNU0iqiMAJFEbKScZdmSkTUznC0U+MfwFOGdLgsewRyPKwBZYSmy6U325iUhBQNxbAC3FLKDV9VSOuQpOOukJ/GAmu/tyEbX9DgEp6dv1zoU0IqzpG6gssSjIYRVPGgU1QAQYRgIT8gEV0EXr1sqeh2I6rXjtmoCYyEDCe/PkFEi/Q48FuT29p557iN+LCwk5CK/CZ2WdAdfQZh2Z9QGrzPLSNRj5igUWzl9Vi0rCqH8G1Kp4QMLkuwMCAypdviDXyOIk0AHTM8HBYKh3b0/F+DxoNj4ZdoZfCpQVdnZarqoMaHWnMLNVcyevytGsrXQEoIbubqWYNo7NRHzdc0zvT21fWVirj7g36iy6pxogfvgHp1xH1Turbz8QyyHnXeBJicpYUctbzApwzZ1HT+FPEXMAgUZetgeGMwt4G+DHiDT2Lu+PT21fjJCAfV16a/Wu1PqOkUHSTKYhWW6PhhHUlNtWzFnA7MbY+r64vkwdpfNB2JfWgWXAvkzd42K4lN9x7Wrg4kIKgXCb4mcW595MCPJ/cTfPAMQMFWwnqwde4w8HZYJFpQwcSMhjVz4B8p6ncSCN1X4klxoIH4BN2J6taBMj6lHkAOs8JJAmXq5xsQtrPIPIIp/HG6i21xMGcFgqDXSRF0xQg14d2uy6HgKE13LSvQe52oShF5Jx1R6avyL4thhXQZHfC94oZzuPUBKFYf1VvDaxIrtV6dNGSx7DO0i1p6CzBkuAmEqyWceQY7F9+U0ObYDzoa1iKao/cOD/v6Q9gHrrr1uCeOk8fST9MG23Ul0KmM3r+Wn6Hi6WAcL7gEeaykicvgjzkjSwFsAXIR81Zx4QJ6oosVyJkCcT+4xAldCcihqvTf94HHUPXYp3REIaR4dhpQF6+FK1H0i9i7Pvh8owu3lO4PT1iuqu+DkL2Bj9+kdfGAg2TXw03iNHyobxofLE2ibjsYDPgeEQlRMR7afXbSGQcnPjI2D+sdtmuQ771dbASUsDndU7t58jrrNGRzISvwioAlHs5FA+cBE5Ccznkd8NMV6BR6ksnKLPZnMUawRDU1MZ/ib3xCdkTblHKu4blNiylH5n213yM0zubEie0o4JhzcfAy3H5qh2l17uLooBNLaO+gzonTH2uF8PQu9EyH+pjGsACTMy4cHzsPdymUSXYJOMP3yTkXqvO/lpvt0cX5ekDEu9PUfBeZODkFuAjXCaGdi6ew4qxJ8PmFfwmPpkgQjQlWqomFY6UkjmcnAtJG75EVR+NpzGpP1Ef5qUUbfowrC3zcSLX3BxgWEgEx/v9cP8H8u1Mvt9/rMDYf6sjwU1xSOPBgzFEeJLMRVFtKo5QHsUYT8ZRLCah27599EuqoC9PYjYO6aoAMHB8X1OHwEAYouHfHB3nyb2B+SnZxM/vw/bCtORjLMSy5aZoEpvgdGvlJfNPFUu/p7Z4VVK1hiI0/UTuB3ZPq4ohEbm7Mntgc1evEtknaosgZSwnDC2BdMmibpeg48X8Ixl+/8+xXdbshQXUPPvx8jT3fkELivHSmqbhblfNFShWAyQnJ3WBU6SMYSIpTDmHjdLVAdlADdz9gCplZw6mTiHqDwIsxbm9ErGusiVpg2w8Q3khKV/R9Oj8PFeF43hmW/nSd99nZzhyjCX3QOZkkB6BsH4H866WGyv9E0hVAzPYah2tkRfQZMmP2rinfOeQalge0ovhduBjJs9a1GBwReerceify49ctOh5/65ATYuMsAkVltmvTLBk4oHpdl6i+p8DoNj4Fb2vhdFYer2JSEilEwPd5n5zNoGBXEjreg/wh2NFnNRaIUHSOXa4eJRwygZoX6vnWnqVdCRT1ARxeFrNBJ+tsdooMwqnYhE7zIxnD8pZH+P0Nu1wWxCPTADfNWmqx626IBJJq6NeapcGeOmbtXvl0TeWG0Y7OGGV4+EHTtNBIT5Wd0Bujl7inXgZgfXTM5efD3qDTJ54O9v3Bkv+tdIRlq1kXcVD0BEMirmFxglNPt5pedb1AnxuCYMChUykwsTIWqT23XDpvTiKEru1cTcEMeniB+HQDehxPXNmkotFdwUPnilB/u4Nx5Xc6l8J9jH1EgKZUUt8t8cyoZleDBEt8oibDmJRAoMKJ5Oe9CSWS5ZMEJvacsGVdXDWjp/Ype5x0p9PXB2PAwt2LRD3d+ftNgpuyvxlP8pB84oB1i73vAVpwyrmXW72hfW6Dzn9Jkj4++0VQ4d0KSx1AsDA4OtXXDo63/w+GD+zC7w5SJaxsmnlYRQ4dgdjA7tTl2KNLnpJ+mvkoDxtt1a4oPaX3EVqj96o9sRKBQqU7ZOiupeAIyLMD+Y3YwHx30XWHB5CQiw7q3mj1EDlP2eBsZbz79ayUMbyHQ7s8gu4Lgip1LiGJj7NQj905/+rgUYKAA5qdrlHKIknWmqfuR+PB8RdBkDg/NgnlT89G72h2NvySnj7UyBwD+mi/IWs1xWbxuVwUIVXun5cMqBtFbrccI+DILjsVQg6eeq0itiRfedn89CvyFtpkxaauEvSANuZmB1p8FGPbU94J9medwsZ9HkUYjmI7OH5HuxendLbxTaYrPuIfE2ffXFKhoNBUp33HsFAXmCV/Vxpq5AYgFoRr5Ay93ZLRlgaIPjhZjXZZChT+aE5iWAXMX0oSFQEtwjiuhQQItTQX5IYrKfKB+queTNplR1Hoflo5/I6aPPmACwQCE2jTOYo5Dz1cs7Sod0KTG/3kEDGk3kUaUCON19xSJCab3kNpWZhSWkO8l+SpW70Wn3g0ciOIJO5JXma6dbos6jyisuxXwUUhj2+1uGhcvuliKtWwsUTw4gi1c/diEEpZHoKoxTBeMDmhPhKTx7TXWRakV8imJR355DcIHkR9IREHxohP4TbyR5LtFU24umRPRmEYHbpe1LghyxPx7YgUHjNbbQFRQhh4KeU1EabXx8FS3JAxp2rwRDoeWkJgWRUSKw6gGP5U2PuO9V4ZuiKXGGzFQuRuf+tkSSsbBtRJKhCi3ENuLlXhPbjTKD4djXVnfXFds6Zb+1XiUrRfyayGxJq1+SYBEfbKlgjiSmk0orgTqzSS+DZ5rTqsJbttiNtp+KMqGE2AHGFw6jQqM5vD6vMptmXV9OAjq49Uf/Lx9Opam+Hn5O9p8qoBBAQixzQZ4eNVkO9sPzJAMyR1y4/RCQQ1s0pV5KAU5sKLw3tkcFbI/JqrjCsK4Mw+W8aod4lioYuawUiCyVWBE/qPaFi5bnkgpfu/ae47174rI1fqQoTbW0HrU6FAejq7ByM0V4zkZTg02/YJK2N7hUQRCeZ4BIgSEqgD8XsjzG6LIsSbuHoIdz/LhFzbNn1clci1NHWJ0/6/O8HJMdIpEZbqi1RrrFfoo/rI/7ufm2MPG5lUI0IYJ4MAiHRTSOFJ2oTverFHYXThkYFIoyFx6rMYFgaOKM4xNWdlOnIcKb/suptptgTOTdVIf4YgdaAjJnIAm4qNNHNQqqAzvi53GkyRCEoseUBrHohZsjUbkR8gfKtc/+Oa72lwxJ8Mq6HDfDATbfbJhzeIuFQJSiw1uZprHlzUf90WgqG76zO0eCB1WdPv1IT6sNxxh91GEL2YpgC97ikFHyoaH92ndwduqZ6IYjkg20DX33MWdoZk7QkcKUCgisIYslOaaLyvIIqRKWQj16jE1DlQWJJaPopWTJjXfixEjRJJo8g4++wuQjbq+WVYjsqCuNIQW3YjnxKe2M5ZKEqq+cX7ZVgnkbsU3RWIyXA1rxv4kGersYJjD//auldXGmcEbcfTeF16Y1708FB1HIfmWv6dSFi6oD4E+RIjCsEZ+kY7dKnwReJJw3xCjKvi3kGN42rvyhUlIz0Bp+fNSV5xwFiuBzG296e5s/oHoFtUyUplmPulIPl+e1CQIQVtjlzLzzzbV+D/OVQtYzo5ixtMi5BmHuG4N/uKfJk5UIREp7+12oZlKtPBomXSzAY0KgtbPzzZoHQxujnREUgBU+O/jKKhgxVhRPtbqyHiUaRwRpHv7pgRPyUrnE7fYkVblGmfTY28tFCvlILC04Tz3ivkNWVazA+OsYrxvRM/hiNn8Fc4bQBeUZABGx5S/xFf9Lbbmk298X7iFg2yeimvsQqqJ+hYbt6uq+Zf9jC+Jcwiccd61NKQtFvGWrgJiHB5lwi6fR8KzYS7EaEHf/ka9EC7H8D+WEa3TEACHBkNSj/cXxFeq4RllC+fUFm2xtstYLL2nos1DfzsC9vqDDdRVcPA3Ho95aEQHvExVThXPqym65llkKlfRXbPTRiDepdylHjmV9YTWAEjlD9DdQnCem7Aj/ml58On366392214B5zrmQz/9ySG2mFqEwjq5sFl5tYJPw5hNz8lyZPUTsr5E0F2C9VMPnZckWP7+mbwp/BiN7f4kf7vtGnZF2JGvjK/sDX1RtcFY5oPQnE4lIAYV49U3C9SP0LCY/9i/WIFK9ORjzM9kG/KGrAuwFmgdEpdLaiqQNpCTGZVuAO65afkY1h33hrqyLjZy92JK3/twdj9pafFcwfXONmPQWldPlMe7jlP24Js0v9m8bIJ9TgS2IuRvE9ZVRaCwSJYOtAfL5H/YS4FfzKWKbek+GFulheyKtDNlBtrdmr+KU+ibHTdalzFUmMfxw3f36x+3cQbJLItSilW9cuvZEMjKw987jykZRlsH/UI+HlKfo2tLwemBEeBFtmxF2xmItA/dAIfQ+rXnm88dqvXa+GapOYVt/2waFimXFx3TC2MUiOi5/Ml+3rj/YU6Ihx2hXgiDXFsUeQkRAD6wF3SCPi2flk7XwKAA4zboqynuELD312EJ88lmDEVOMa1W/K/a8tGylZRMrMoILyoMQzzbDJHNZrhH77L9qSC42HVmKiZ5S0016UTp83gOhCwz9XItK9fgXfK3F5d7nZCBUekoLxrutQaPHa16Rjsa0gTrzyjqTnmcIcrxg6X6dkKiucudc0DD5W4pJPf0vuDW8r5/uw24YfMuxFRpD2ovT2mFX79xH6Jf+MVdv2TYqR6/955QgVPe3JCD/WjAYcLA9tpXgFiEjge2J5ljeI/iUzg91KQuHkII4mmHZxC3XQORLAC6G7uFn5LOmlnXkjFdoO976moNTxElS8HdxWoPAkjjocDR136m2l+f5t6xaaNgdodOvTu0rievnhNAB79WNrVs6EsPgkgfahF9gSFzzAd+rJSraw5Mllit7vUP5YxA843lUpu6/5jAR0RvH4rRXkSg3nE+O5GFyfe+L0s5r3k05FyghSFnKo4TTgs07qj4nTLqOYj6qaW9knJTDkF5OFMYbmCP+8H16Ty482OjvERV6OFyw043L9w3hoJi408sR+SGo1WviXUu8d7qS+ehKjpKwxeCthsm2LBFSFeetx0x4AaKPxtp3CxdWqCsLrB1s/j5TAhc1jNZsXWl6tjo/WDoewxzg8T8NnhZ1niUwL/nhfygLanCnRwaFGDyLw+sfZhyZ1UtYTp8TYB6dE7R3VsKKH95CUxJ8u8N+9u2/9HUNKHW3x3w5GQrfOPafk2w5qZq8MaHT0ebeY3wIsp3rN9lrpIsW9c1ws3VNV+JwNz0Lo9+V7zZr6GD56We6gWVIvtmam5GPPkVAbr74r6SwhuL+TRXtW/0pgyX16VNl4/EAD50TnUPuwrW6OcUO2VlWXS0inq872kk7GUlW6o/ozFKq+Sip6LcTtSDfDrPTcCHhx75H8BeRon+KG2wRwzfDgWhALmiWOMO6h3pm1UCZEPEjScyk7tdLx6WrdA2N1QTPENvNnhCQjW6kl057/qv7IwRryHrZBCwVSbLLnFRiHdTwk8mlYixFt1slEcPD7FVht13HyqVeyD55HOXrh2ElAxJyinGeoFzwKA91zfrdLvDxJSjzmImfvTisreI25EDcVfGsmxLVbfU8PGe/7NmWWKjXcdTJ11jAlVIY/Bv/mcxg/Q10vCHwKG1GW/XbJq5nxDhyLqiorn7Wd7VEVL8UgVzpHMjQ+Z8DUgSukiVwWAKkeTlVVeZ7t1DGnCgJVIdBPZAEK5f8CDyDNo7tK4/5DBjdD5MPV86TaEhGsLVFPQSI68KlBYy84FievdU9gWh6XZrugvtCZmi9vfd6db6V7FmoEcRHnG36VZH8N4aZaldq9zZawt1uBFgxYYx+Gs/qW1jwANeFy+LCoymyM6zgG7j8bGzUyLhvrbJkTYAEdICEb4kMKusKT9V3eIwMLsjdUdgijMc+7iKrr+TxrVWG0U+W95SGrxnxGrE4eaJFfgvAjUM4SAy8UaRwE9j6ZQH5qYAWGtXByvDiLSDfOD0yFA3UCMKSyQ30fyy1mIRg4ZcgZHLNHWl+c9SeijOvbOJxoQy7lTN2r3Y8p6ovxvUY74aOYbuVezryqXA6U+fcp6wSV9X5/OZKP18tB56Ua0gMyxJI7XyNT7IrqN8GsB9rL/kP5KMrjXxgqKLDa+V5OCH6a5hmOWemMUsea9vQl9t5Oce76PrTyTv50ExOqngE3PHPfSL//AItPdB7kGnyTRhVUUFNdJJ2z7RtktZwgmQzhBG/G7QsjZmJfCE7k75EmdIKH7xlnmDrNM/XbTT6FzldcH/rcRGxlPrv4qDScqE7JSmQABJWqRT/TUcJSwoQM+1jvDigvrjjH8oeK2in1S+/yO1j8xAws/T5u0VnIvAPqaE1atNuN0cuRliLcH2j0nTL4JpcR7w9Qya0JoaHgsOiALLCCzRkl1UUESz+ze/gIXHGtDwgYrK6pCFKJ1webSDog4zTlPkgXZqxlQDiYMjhDpwTtBW2WxthWbov9dt2X9XFLFmcF+eEc1UaQ74gqZiZsdj63pH1qcv3Vy8JYciogIVKsJ8Yy3J9w/GhjWVSQAmrS0BPOWK+RKV+0lWqXgYMnIFwpcZVD7zPSp547i9HlflB8gVnSTGmmq1ClO081OW/UH11pEQMfkEdDFzjLC1Cdo/BdL3s7cXb8J++Hzz1rhOUVZFIPehRiZ8VYu6+7Er7j5PSZu9g/GBdmNzJmyCD9wiswj9BZw+T3iBrg81re36ihMLjoVLoWc+62a1U/7qVX5CpvTVF7rocSAKwv4cBVqZm7lLDS/qoXs4fMs/VQi6BtVbNA3uSzKpQfjH1o3x4LrvkOn40zhm6hjduDglzJUwA0POabgdXIndp9fzhOo23Pe+Rk9GSLX0d71Poqry8NQDTzNlsa+JTNG9+UrEf+ngxCjGEsDCc0bz+udVRyHQI1jmEO3S+IOQycEq7XwB6z3wfMfa73m8PVRp+iOgtZfeSBl01xn03vMaQJkyj7vnhGCklsCWVRUl4y+5oNUzQ63B2dbjDF3vikd/3RUMifPYnX5Glfuk2FsV/7RqjI9yKTbE8wJY+74p7qXO8+dIYgjtLD/N8TJtRh04N9tXJA4H59IkMmLElgvr0Q5OCeVfdAt+5hkh4pQgfRMHpL74XatLQpPiOyHRs/OdmHtBf8nOZcxVKzdGclIN16lE7kJ+pVMjspOI+5+TqLRO6m0ZpNXJoZRv9MPDRcAfJUtNZHyig/s2wwReakFgPPJwCQmu1I30/tcBbji+Na53i1W1N+BqoY7Zxo+U/M9XyJ4Ok2SSkBtoOrwuhAY3a03Eu6l8wFdIG1cN+e8hopTkiKF093KuH/BcB39rMiGDLn6XVhGKEaaT/vqb/lufuAdpGExevF1+J9itkFhCfymWr9vGb3BTK4j598zRH7+e+MU9maruZqb0pkGxRDRE1CD4Z8LV4vhgPidk5w2Bq816g3nHw1//j3JStz7NR9HIWELO8TMn3QrP/zZp//+Dv9p429/ogv+GATR+n/UdF+ns9xNkXZQJXY4t9jMkJNUFygAtzndXwjss+yWH9HAnLQQfhAskdZS2l01HLWv7L7us5uTH409pqitvfSOQg/c+Zt7k879P3K9+WV68n7+3cZfuRd/dDPP/03rn+d+/nBvWfgDlt8+LzjqJ/vx3CnNOwiXhho778C96iD+1TBvRZYeP+EH81LE0vVwOOrmCLB3iKzI1x+vJEsrPH4uF0UB4TJ4X3uDfOCo3PYpYe0MF4bouh0DQ/l43fxUF7Y+dpWuvTSffB0yO2UQUETI/LwCZE3BvnevJ7c9zUlY3H58xzke6DNFDQG8n0WtDN4LAYN4nogKav1ezOfK/z+t6tsCTp+dhx4ymjWuCJk1dEUifDP+HyS4iP/Vg9B2jTo9L4NbiBuDS4nuuHW6H+JDQn2JtqRKGkEQPEYE7uzazXIkcxIAqUq1esasZBETlEZY7y7Jo+RoV/IsjY9eIMkUvr42Hc0xqtsavZvhz1OLwSxMOTuqzlhb0WbdOwBH9EYiyBjatz40bUxTHbiWxqJ0uma19qhPruvcWJlbiSSH48OLDDpaHPszvyct41ZfTu10+vjox6kOqK6v0K/gEPphEvMl/vwSv+A4Hhm36JSP9IXTyCZDm4kKsqD5ay8b1Sad/vaiyO5N/sDfEV6Z4q95E+yfjxpqBoBETW2C7xl4pIO2bDODDFurUPwE7EWC2Uplq+AHmBHvir2PSgkR12/Ry65O0aZtQPeXi9mTlF/Wj5GQ+vFkYyhXsLTjrBSP9hwk4GPqDP5rBn5/l8b0mLRAvRSzXHc293bs3s8EsdE3m2exxidWVB4joHR+S+dz5/W+v00K3TqN14CDBth8eWcsTbiwXPsygHdGid0PEdy6HHm2v/IUuV5RVapYmzGsX90mpnIdNGcOOq64Dbc5GUbYpD9M7S+6cLY//QmjxFLP5cuTFRm3vA5rkFZroFnO3bjHF35uU3s8mvL7Tp9nyTc4mymTJ5sLIp7umSnGkO23faehtz3mmTS7fbVx5rP7x3HXIjRNeq/A3xCs9JNB08c9S9BF2O3bOur0ItslFxXgRPdaapBIi4dRpKGxVz7ir69t/bc9qTxjvtOyGOfiLGDhR4fYywHv1WdOplxIV87TpLBy3Wc0QP0P9s4G7FBNOdITS/tep3o3h1TEa5XDDii7fWtqRzUEReP2fbxz7bHWWJdbIOxOUJZtItNZpTFRfj6vm9sYjRxQVO+WTdiOhdPeTJ+8YirPvoeL88l5iLYOHd3b/Imkq+1ZN1El3UikhftuteEYxf1Wujof8Pr4ICTu5ezZyZ4tHQMxlzUHLYO2VMOoNMGL/20S5i2o2obfk+8qqdR7xzbRDbgU0lnuIgz4LelQ5XS7xbLuSQtNS95v3ZUOdaUx/Qd8qxCt6xf2E62yb/HukLO6RyorV8KgYl5YNc75y+KvefrxY+lc/64y9kvWP0a0bDz/rojq+RWjO06WeruWqNFU7r3HPIcLWRql8ICZsz2Ls/qOm/CLn6++X+Qf7mGspYCrZod/lpl6Rw4xN/yuq8gqV4B6aHk1hVE1SfILxWu5gvXqbfARYQpspcxKp1F/c8XOPzkZvmoSw+vEqBLdrq1fr3wAPv5NnM9i8F+jdAuxkP5Z71c6uhK3enlnGymr7UsWZKC12qgUiG8XXGQ9mxnqz4GSIlybF9eXmbqj2sHX+a1jf0gRoONHRdRSrIq03Ty89eQ1GbV/Bk+du4+V15zls+vvERvZ4E7ZbnxWTVjDjb4o/k8jlw44pTIrUGxxuJvBeO+heuhOjpFsO6lVJ/aXnJDa/bM0Ql1cLbXE/Pbv3EZ3vj3iVrB5irjupZTzlnv677NrI9UNYNqbPgp/HZXS+lJmk87wec+7YOxTDo2aw2l3NfDr34VNlvqWJBknuK7oSlZ6/T10zuOoPZOeoIk81N+sL843WJ2Q4Z0fZ3scsqC/JV2fuhWi1jGURSKZV637lf53Xnnx16/vKEXY89aVJ0fv91jGdfG+G4+sniwHes4hS+udOr4RfhFhG/F5gUG35QaU+McuLmclb5ZWmR+sG5V6nf+PxYzlrnFGxpZaK8eqqVo0NfmAWoGfXDiT/FnUbWvzGDOTr8aktOZWg4BYvz5YH12ZbfCcGtNk+dDAZNGWvHov+PIOnY9Prjg8h/wLRrT69suaMVZ5bNuK00lSVpnqSX1NON/81FoP92rYndionwgOiA8WMf4vc8l15KqEEG4yAm2+WAN5Brfu1sq9suWYqgoajgOYt/JCk1gC8wPkK+XKCtRX6TAtgvrnuBgNRmn6I8lVDipOVB9kX6Oxkp4ZKyd1M6Gj8/v2U7k+YQBL95Kb9PQENucJb0JlW3b5tObN7m/Z1j1ev388d7o15zgXsI9CikAGAViR6lkJv7nb4Ak40M2G8TJ447kN+pvfHiOFjSUSP6PM+QfbAywKJCBaxSVxpizHseZUyUBhq59vFwrkyGoRiHbo0apweEZeSLuNiQ+HAekOnarFg00dZNXaPeoHPTRR0FmEyqYExOVaaaO8c0uFUh7U4e/UxdBmthlBDgg257Q33j1hA7HTxSeTTSuVnPZbgW1nodwmG16aKBDKxEetv7D9OjO0JhrbJTnoe+kcGoDJazFSO8/fUN9Jy/g4XK5PUkw2dgPDGpJqBfhe7GA+cjzfE/EGsMM+FV9nj9IAhrSfT/J3QE5TEIYyk5UjsI6ZZcCPr6A8FZUF4g9nnpVmjX90MLSQysIPD0nFzqwCcSJmIb5mYv2Cmk+C1MDFkZQyCBq4c/Yai9LJ6xYkGS/x2s5/frIW2vmG2Wrv0APpCdgCA9snFvfpe8uc0OwdRs4G9973PGEBnQB5qKrCQ6m6X/H7NInZ7y/1674/ZXOVp7OeuCRk8JFS516VHrnH1HkIUIlTIljjHaQtEtkJtosYul77cVwjk3gW1Ajaa6zWeyHGLlpk3VHE2VFzT2yI/EvlGUSz2H9zYE1s4nsKMtMqNyKNtL/59CpFJki5Fou6VXGm8vWATEPwrUVOLvoA8jLuwOzVBCgHB2Cr5V6OwEWtJEKokJkfc87h+sNHTvMb0KVTp5284QTPupoWvQVUwUeogZR3kBMESYo0mfukewRVPKh5+rzLQb7HKjFFIgWhj1w3yN/qCNoPI8XFiUgBNT1hCHBsAz8L7Oyt8wQWUFj92ONn/APyJFg8hzueqoJdNj57ROrFbffuS/XxrSXLTRgj5uxZjpgQYceeMc2wJrahReSKpm3QjHfqExTLAB2ipVumE8pqcZv8LYXQiPHHsgb5BMW8zM5pvQit+mQx8XGaVDcfVbLyMTlY8xcfmm/RSAT/H09UQol5gIz7rESDmnrQ4bURIB4iRXMDQwxgex1GgtDxKp2HayIkR+E/aDmCttNm2C6lytWdfOVzD6X2SpDWjQDlMRvAp1symWv4my1bPCD+E1EmGnMGWhNwmycJnDV2WrQNxO45ukEb08AAffizYKVULp15I4vbNK5DzWwCSUADfmKhfGSUqii1L2UsE8rB7mLuHuUJZOx4+WiizHBJ/hwboaBzhpNOVvgFTf5cJsHef7L1HCI9dOUUbb+YxUJWn6dYOLz+THi91kzY5dtO5c+grX7v0jEbsuoOGnoIreDIg/sFMyG+TyCLIcAWd1IZ1UNFxE8Uie13ucm40U2fcxC0u3WLvLOxwu+F7MWUsHsdtFQZ7W+nlfCASiAKyh8rnP3EyDByvtJb6Kax6/HkLzT9SyEyTMVM1zPtM0MJY14DmsWh4MgD15Ea9Hd00AdkTZ0EiG5NAGuIBzQJJ0JR0na+OB7lQA6UKxMfihIQ7GCCnVz694QvykWXTxpS2soDu+smru1UdIxSvAszBFD1c8c6ZOobA8bJiJIvuycgIXBQIXWwhyTgZDQxJTRXgEwRNAawGSXO0a1DKjdihLVNp/taE/xYhsgwe+VpKEEB4LlraQyE84gEihxCnbfoyOuJIEXy2FIYw+JjRusybKlU2g/vhTSGTydvCvXhYBdtAXtS2v7LkHtmXh/8fly1do8FI/D0f8UbzVb5h+KRhMGSAmR2mhi0YG/uj7wgxcfzCrMvdjitUIpXDX8ae2JcF/36qUWIMwN6JsjaRGNj+jEteGDcFyTUb8X/NHSucKMJp7pduxtD6KuxVlyxxwaeiC1FbGBESO84lbyrAugYxdl+2N8/6AgWpo/IeoAOcsG35IA/b3AuSyoa55L7llBLlaWlEWvuCFd8f8NfcTUgzJv6CbB+6ohWwodlk9nGWFpBAOaz5uEW5xBvmjnHFeDsb0mXwayj3mdYq5gxxNf3H3/tnCgHwjSrpSgVxLmiTtuszdRUFIsn6LiMPjL808vL1uQhDbM7aA43mISXReqjSskynIRcHCJ9qeFopJfx9tqyUoGbSwJex/0aDE3plBPGtNBYgWbdLom3+Q/bjdizR2/AS/c/dH/d3G7pyl1qDXgtOFtEqidwLqxPYtrNEveasWq3vPUUtqTeu8gpov4bdOQRI2kneFvRNMrShyVeEupK1PoLDPMSfWMIJcs267mGB8X9CehQCF0gIyhpP10mbyM7lwW1e6TGvHBV1sg/UyTghHPGRqMyaebC6pbB1WKNCQtlai1GGvmq9zUKaUzLaXsXEBYtHxmFbEZ2kJhR164LhWW2Tlp1dhsGE7ZgIWRBOx3Zcu2DxgH+G83WTPceKG0TgQKKiiNNOlWgvqNEbnrk6fVD+AqRam2OguZb0YWSTX88N+i/ELSxbaUUpPx4vJUzYg/WonSeA8xUK6u7DPHgpqWpEe6D4cXg5uK9FIYVba47V/nb+wyOtk+zG8RrS4EA0ouwa04iByRLSvoJA2FzaobbZtXnq8GdbfqEp5I2dpfpj59TCVif6+E75p665faiX8gS213RqBxTZqfHP46nF6NSenOneuT+vgbLUbdTH2/t0REFXZJOEB6DHvx6N6g9956CYrY/AYcm9gELJXYkrSi+0F0geKDZgOCIYkLU/+GOW5aGj8mvLFgtFH5+XC8hvAE3CvHRfl4ofM/Qwk4x2A+R+nyc9gNu/9Tem7XW4XRnyRymf52z09cTOdr+PG6+P/Vb4QiXlwauc5WB1z3o+IJjlbxI8MyWtSzT+k4sKVbhF3xa+vDts3NxXa87iiu+xRH9cAprnOL2h6vV54iQRXuOAj1s8nLFK8gZ70ThIQcWdF19/2xaJmT0efrkNDkWbpAQPdo92Z8+Hn/aLjbOzB9AI/k12fPs9HhUNDJ1u6ax2VxD3R6PywN7BrLJ26z6s3QoMp76qzzwetrDABKSGkfW5PwS1GvYNUbK6uRqxfyVGNyFB0E+OugMM8kKwmJmupuRWO8XkXXXQECyRVw9UyIrtCtcc4oNqXqr7AURBmKn6Khz3eBN96LwIJrAGP9mr/59uTOSx631suyT+QujDd4beUFpZ0kJEEnjlP+X/Kr2kCKhnENTg4BsMTOmMqlj2WMFLRUlVG0fzdCBgUta9odrJfpVdFomTi6ak0tFjXTcdqqvWBAzjY6hVrH9sbt3Z9gn+AVDpTcQImefbB4edirjzrsNievve4ZT4EUZWV3TxEsIW+9MT/RJoKfZZYSRGfC1CwPG/9rdMOM8qR/LUYvw5f/emUSoD7YSFuOoqchdUg2UePd1eCtFSKgxLSZ764oy4lvRCIH6bowPxZWwxNFctksLeil47pfevcBipkkBIc4ngZG+kxGZ71a72KQ7VaZ6MZOZkQJZXM6kb/Ac0/XkJx8dvyfJcWbI3zONEaEPIW8GbkYjsZcwy+eMoKrYjDmvEEixHzkCSCRPRzhOfJZuLdcbx19EL23MA8rnjTZZ787FGMnkqnpuzB5/90w1gtUSRaWcb0eta8198VEeZMUSfIhyuc4/nywFQ9uqn7jdqXh+5wwv+RK9XouNPbYdoEelNGo34KyySwigsrfCe0v/PlWPvQvQg8R0KgHO18mTVThhQrlbEQ0Kp/JxPdjHyR7E1QPw/ut0r+HDDG7BwZFm9IqEUZRpv2WpzlMkOemeLcAt5CsrzskLGaVOAxyySzZV/D2EY7ydNZMf8e8VhHcKGHAWNszf1EOq8fNstijMY4JXyATwTdncFFqcNDfDo+mWFvxJJpc4sEZtjXyBdoFcxbUmniCoKq5jydUHNjYJxMqN1KzYV62MugcELVhS3Bnd+TLLOh7dws/zSXWzxEb4Nj4aFun5x4kDWLK5TUF/yCXB/cZYvI9kPgVsG2jShtXkxfgT+xzjJofXqPEnIXIQ1lnIdmVzBOM90EXvJUW6a0nZ/7XjJGl8ToO3H/fdxnxmTNKBZxnkpXLVgLXCZywGT3YyS75w/PAH5I/jMuRspej8xZObU9kREbRA+kqjmKRFaKGWAmFQspC+QLbKPf0RaK3OXvBSWqo46p70ws/eZpu6jCtZUgQy6r4tHMPUdAgWGGUYNbuv/1a6K+MVFsd3T183+T8capSo6m0+Sh57fEeG/95dykGJBQMj09DSW2bY0mUonDy9a8trLnnL5B5LW3Nl8rJZNysO8Zb+80zXxqUGFpud3Qzwb7bf+8mq6x0TAnJU9pDQR9YQmZhlna2xuxJt0aCO/f1SU8gblOrbIyMsxTlVUW69VJPzYU2HlRXcqE2lLLxnObZuz2tT9CivfTAUYfmzJlt/lOPgsR6VN64/xQd4Jlk/RV7UKVv2Gx/AWsmTAuCWKhdwC+4HmKEKYZh2Xis4KsUR1BeObs1c13wqFRnocdmuheaTV30gvVXZcouzHKK5zwrN52jXJEuX6dGx3BCpV/++4f3hyaW/cQJLFKqasjsMuO3B3WlMq2gyYfdK1e7L2pO/tRye2mwzwZPfdUMrl5wdLqdd2Kv/wVtnpyWYhd49L6rsOV+8HXPrWH2Kup89l2tz6bf80iYSd+V4LROSOHeamvexR524q4r43rTmtFzQvArpvWfLYFZrbFspBsXNUqqenjxNNsFXatZvlIhk7teUPfK+YL32F8McTnjv0BZNppb+vshoCrtLXjIWq3EJXpVXIlG6ZNL0dh6qEm2WMwDjD3LfOfkGh1/czYc/0qhiD2ozNnH4882MVVt3JbVFkbwowNCO3KL5IoYW5wlVeGCViOuv1svZx7FbzxKzA4zGqBlRRaRWCobXaVq4yYCWbZf8eiJwt3OY+MFiSJengcFP2t0JMfzOiJ7cECvpx7neg1Rc5x+7myPJOXt2FohVRyXtD+/rDoTOyGYInJelZMjolecVHUhUNqvdZWg2J2t0jPmiLFeRD/8fOT4o+NGILb+TufCo9ceBBm3JLVn+MO2675n7qiEX/6W+188cYg3Zn5NSTjgOKfWFSAANa6raCxSoVU851oJLY11WIoYK0du0ec5E4tCnAPoKh71riTsjVIp3gKvBbEYQiNYrmH22oLQWA2AdwMnID6PX9b58dR2QKo4qag1D1Z+L/FwEKTR7osOZPWECPJIHQqPUsM5i/CH5YupVPfFA5pHUBcsesh8eO5YhyWnaVRPZn/BmdXVumZWPxMP5e28zm2uqHgFoT9CymHYNNrzrrjlXZM06HnzDxYNlI5b/QosxLmmrqDFqmogQdqk0WLkUceoAvQxHgkIyvWU69BPFr24VB6+lx75Rna6dGtrmOxDnvBojvi1/4dHjVeg8owofPe1cOnxU1ioh016s/Vudv9mhV9f35At+Sh28h1bpp8xhr09+vf47Elx3Ms6hyp6QvB3t0vnLbOhwo660cp7K0vvepabK7YJfxEWWfrC2YzJfYOjygPwfwd/1amTqa0hZ5ueebhWYVMubRTwIjj+0Oq0ohU3zfRfuL8gt59XsHdwKtxTQQ4Y2qz6gisxnm2UdlmpEkgOsZz7iEk6QOt8BuPwr+NR01LTqXmJo1C76o1N274twJvl+I069TiLpenK/miRxhyY8jvYV6W1WuSwhH9q7kuwnJMtm7IWcqs7HsnyHSqWXLSpYtZGaR1V3t0gauninFPZGtWskF65rtti48UV9uV9KM8kfDYs0pgB00S+TlzTXV6P8mxq15b9En8sz3jWSszcifZa/NuufPNnNTb031pptt0+sRSH/7UG8pzbsgtt3OG3ut7B9JzDMt2mTZuyRNIV8D54TuTrpNcHtgmMlYJeiY9XS83NYJicjRjtJSf9BZLsQv629QdDsKQhTK5CnXhpk7vMNkHzPhm0ExW/VCGApHfPyBagtZQTQmPHx7g5IXXsrQDPzIVhv2LB6Ih138iSDww1JNHrDvzUxvp73MsQBVhW8EbrReaVUcLB1R3PUXyaYG4HpJUcLVxMgDxcPkVRQpL7VTAGabDzbKcvg12t5P8TSGQkrj/gOrpnbiDHwluA73xbXts/L7u468cRWSWRtgTwlQnA47EKg0OiZDgFxAKQQUcsbGomITgeXUAAyKe03eA7Mp4gnyKQmm0LXJtEk6ddksMJCuxDmmHzmVhO+XaN2A54MIh3niw5CF7PwiXFZrnA8wOdeHLvvhdoqIDG9PDI7UnWWHq526T8y6ixJPhkuVKZnoUruOpUgOOp3iIKBjk+yi1vHo5cItHXb1PIKzGaZlRS0g5d3MV2pD8FQdGYLZ73aae/eEIUePMc4NFz8pIUfLCrrF4jVWH5gQneN3S8vANBmUXrEcKGn6hIUN95y1vpsvLwbGpzV9L0ZKTan6TDXM05236uLJcIEMKVAxKNT0K8WljuwNny3BNQRfzovA85beI9zr1AGNYnYCVkR1aGngWURUrgqR+gRrQhxW81l3CHevjvGEPzPMTxdsIfB9dfGRbZU0cg/1mcubtECX4tvaedmNAvTxCJtc2QaoUalGfENCGK7IS/O8CRpdOVca8EWCRwv2sSWE8CJPW5PCugjCXPd3h6U60cPD+bdhtXZuYB6stcoveE7Sm5MM2yvfUHXFSW7KzLmi7/EeEWL0wqcOH9MOSKjhCHHmw+JGLcYE/7SBZQCRggox0ZZTAxrlzNNXYXL5fNIjkdT4YMqVUz6p8YDt049v4OXGdg3qTrtLBUXOZf7ahPlZAY/O+7Sp0bvGSHdyQ8B1LOsplqMb9Se8VAE7gIdSZvxbRSrfl+Lk5Qaqi5QJceqjitdErcHXg/3MryljPSIAMaaloFm1cVwBJ8DNmkDqoGROSHFetrgjQ5CahuKkdH5pRPigMrgTtlFI8ufJPJSUlGgTjbBSvpRc0zypiUn6U5KZqcRoyrtzhmJ7/caeZkmVRwJQeLOG8LY6vP5ChpKhc8Js0El+n6FXqbx9ItdtLtYP92kKfaTLtCi8StLZdENJa9Ex1nOoz1kQ7qxoiZFKRyLf4O4CHRT0T/0W9F8epNKVoeyxUXhy3sQMMsJjQJEyMOjmOhMFgOmmlscV4eFi1CldU92yjwleirEKPW3bPAuEhRZV7JsKV3Lr5cETAiFuX5Nw5UlF7d2HZ96Bh0sgFIL5KGaKSoVYVlvdKpZJVP5+NZ7xDEkQhmDgsDKciazJCXJ6ZN2B3FY2f6VZyGl/t4aunGIAk/BHaS+i+SpdRfnB/OktOvyjinWNfM9Ksr6WwtCa1hCmeRI6icpFM4o8quCLsikU0tMoZI/9EqXRMpKGaWzofl4nQuVQm17d5fU5qXCQeCDqVaL9XJ9qJ08n3G3EFZS28SHEb3cdRBdtO0YcTzil3QknNKEe/smQ1fTb0XbpyNB5xAeuIlf+5KWlEY0DqJbsnzJlQxJPOVyHiKMx5Xu9FcEv1Fbg6Fhm4t+Jyy5JC1W3YO8dYLsO0PXPbxodBgttTbH3rt9Cp1lJIk2r3O1Zqu94eRbnIz2f50lWolYzuKsj4PMok4abHLO8NAC884hiXx5Fy5pWKO0bWL7uEGXaJCtznhP67SlQ4xjWIfgq6EpZ28QMtuZK7JC0RGbl9nA4XtFLug/NLMoH1pGt9IonAJqcEDLyH6TDROcbsmGPaGIxMo41IUAnQVPMPGByp4mOmh9ZQMkBAcksUK55LsZj7E5z5XuZoyWCKu6nHmDq22xI/9Z8YdxJy4kWpD16jLVrpwGLWfyOD0Wd+cBzFBxVaGv7S5k9qwh/5t/LQEXsRqI3Q9Rm3QIoaZW9GlsDaKOUyykyWuhNOprSEi0s1G4rgoiX1V743EELti+pJu5og6X0g6oTynUqlhH9k6ezyRi05NGZHz0nvp3HOJr7ebrAUFrDjbkFBObEvdQWkkUbL0pEvMU46X58vF9j9F3j6kpyetNUBItrEubW9ZvMPM4qNqLlsSBJqOH3XbNwv/cXDXNxN8iFLzUhteisYY+RlHYOuP29/Cb+L+xv+35Rv7xudnZ6ohK4cMPfCG8KI7dNmjNk/H4e84pOxn/sZHK9psfvj8ncA8qJz7O8xqbxESDivGJOZzF7o5PJLQ7g34qAWoyuA+x3btU98LT6ZyGyceIXjrqob2CAVql4VOTQPUQYvHV/g4zAuCZGvYQBtf0wmd5lilrvuEn1BXLny01B4h4SMDlYsnNpm9d7m9h578ufpef9Z4WplqWQvqo52fyUA7J24eZD5av6SyGIV9kpmHNqyvdfzcpEMw97BvknV2fq+MFHun9BT3Lsf8pbzvisWiIQvYkng+8Vxk1V+dli1u56kY50LRjaPdotvT5BwqtwyF+emo/z9J3yVUVGfKrxQtJMOAQWoQii/4dp9wgybSa5mkucmRLtEQZ/pz0tL/NVcgWAd95nEQ3Tg6tNbuyn3Iepz65L3huMUUBntllWuu4DbtOFSMSbpILV4fy6wlM0SOvi6CpLh81c1LreIvKd61uEWBcDw1lUBUW1I0Z+m/PaRlX+PQ/oxg0Ye6KUiIiTF4ADNk59Ydpt5/rkxmq9tV5Kcp/eQLUVVmBzQNVuytQCP6Ezd0G8eLxWyHpmZWJ3bAzkWTtg4lZlw42SQezEmiUPaJUuR/qklVA/87S4ArFCpALdY3QRdUw3G3XbWUp6aq9z0zUizcPa7351p9JXOZyfdZBFnqt90VzQndXB/mwf8LC9STj5kenVpNuqOQQP3mIRJj7eV21FxG8VAxKrEn3c+XfmZ800EPb9/5lIlijscUbB6da0RQaMook0zug1G0tKi/JBC4rw7/D3m4ARzAkzMcVrDcT2SyFtUdWAsFlsPDFqV3N+EjyXaoEePwroaZCiLqEzb8MW+PNE9TmTC01EzWli51PzZvUqkmyuROU+V6ik+Le/9qT6nwzUzf9tP68tYei0YaDGx6kAd7jn1cKqOCuYbiELH9zYqcc4MnRJjkeGiqaGwLImhyeKs+xKJMBlOJ05ow9gGCKZ1VpnMKoSCTbMS+X+23y042zOb5MtcY/6oBeAo1Vy89OTyhpavFP78jXCcFH0t7Gx24hMEOm2gsEfGabVpQgvFqbQKMsknFRRmuPHcZu0Su/WMFphZvB2r/EGbG72rpGGho3h+Msz0uGzJ7hNK2uqQiE1qmn0zgacKYYZBCqsxV+sjbpoVdSilW/b94n2xNb648VmNIoizqEWhBnsen+d0kbCPmRItfWqSBeOd9Wne3c6bcd6uvXOJ6WdiSsuXq0ndhqrQ4QoWUjCjYtZ0EAhnSOP1m44xkf0O7jXghrzSJWxP4a/t72jU29Vu2rvu4n7HfHkkmQOMGSS+NPeLGO5I73mC2B7+lMiBQQZRM9/9liLIfowupUFAbPBbR+lxDM6M8Ptgh1paJq5Rvs7yEuLQv/7d1oU2woFSb3FMPWQOKMuCuJ7pDDjpIclus5TeEoMBy2YdVB4fxmesaCeMNsEgTHKS5WDSGyNUOoEpcC2OFWtIRf0w27ck34/DjxRTVIcc9+kqZE6iMSiVDsiKdP/Xz5XfEhm/sBhO50p1rvJDlkyyxuJ9SPgs7YeUJBjXdeAkE+P9OQJm6SZnn1svcduI78dYmbkE2mtziPrcjVisXG78spLvbZaSFx/Rks9zP4LKn0Cdz/3JsetkT06A8f/yCgMO6Mb1Hme0JJ7b2wZz1qleqTuKBGokhPVUZ0dVu+tnQYNEY1fmkZSz6+EGZ5EzL7657mreZGR3jUfaEk458PDniBzsSmBKhDRzfXameryJv9/D5m6HIqZ0R+ouCE54Dzp4IJuuD1e4Dc5i+PpSORJfG23uVgqixAMDvchMR0nZdH5brclYwRoJRWv/rlxGRI5ffD5NPGmIDt7vDE1434pYdVZIFh89Bs94HGGJbTwrN8T6lh1HZFTOB4lWzWj6EVqxSMvC0/ljWBQ3F2kc/mO2b6tWonT2JEqEwFts8rz2h+oWNds9ceR2cb7zZvJTDppHaEhK5avWqsseWa2Dt5BBhabdWSktS80oMQrL4TvAM9b5HMmyDnO+OkkbMXfUJG7eXqTIG6lqSOEbqVR+qYdP7uWb57WEJqzyh411GAVsDinPs7KvUeXItlcMdOUWzXBH6zscymV1LLVCtc8IePojzXHF9m5b5zGwBRdzcyUJkiu938ApmAayRdJrX1PmVguWUvt2ThQ62czItTyWJMW2An/hdDfMK7SiFQlGIdAbltHz3ycoh7j9V7GxNWBpbtcSdqm4XxRwTawc3cbZ+xfSv9qQfEkDKfZTwCkqWGI/ur250ItXlMlh6vUNWEYIg9A3GzbgmbqvTN8js2YMo87CU5y6nZ4dbJLDQJj9fc7yM7tZzJDZFtqOcU8+mZjYlq4VmifI23iHb1ZoT9E+kT2dolnP1AfiOkt7PQCSykBiXy5mv637IegWSKj9IKrYZf4Lu9+I7ub+mkRdlvYzehh/jaJ9n7HUH5b2IbgeNdkY7wx1yVzxS7pbvky6+nmVUtRllEFfweUQ0/nG017WoUYSxs+j2B4FV/F62EtHlMWZXYrjGHpthnNb1x66LKZ0Qe92INWHdfR/vqp02wMS8r1G4dJqHok8KmQ7947G13a4YXbsGgHcBvRuVu1eAi4/A5+ZixmdSXM73LupB/LH7O9yxLTVXJTyBbI1S49TIROrfVCOb/czZ9pM4JsZx8kUz8dQGv7gUWKxXvTH7QM/3J2OuXXgciUhqY+cgtaOliQQVOYthBLV3xpESZT3rmfEYNZxmpBbb24CRao86prn+i9TNOh8VxRJGXJfXHATJHs1T5txgc/opYrY8XjlGQQbRcoxIBcnVsMjmU1ymmIUL4dviJXndMAJ0Yet+c7O52/p98ytlmAsGBaTAmMhimAnvp1TWNGM9BpuitGj+t810CU2UhorrjPKGtThVC8WaXw04WFnT5fTjqmPyrQ0tN3CkLsctVy2xr0ZWgiWVZ1OrlFjjxJYsOiZv2cAoOvE+7sY0I/TwWcZqMoyIKNOftwP7w++Rfg67ljfovKYa50if3fzE/8aPYVey/Nq35+nH2sLPh/fP5TsylSKGOZ4k69d2PnH43+kq++sRXHQqGArWdwhx+hpwQC6JgT2uxehYU4Zbw7oNb6/HLikPyJROGK2ouyr+vzseESp9G50T4AyFrSqOQ0rroCYP4sMDFBrHn342EyZTMlSyk47rHSq89Y9/nI3zG5lX16Z5lxphguLOcZUndL8wNcrkyjH82jqg8Bo8OYkynrxZvbFno5lUS3OPr8Ko3mX9NoRPdYOKKjD07bvgFgpZ/RF+YzkWvJ/Hs/tUbfeGzGWLxNAjfDzHHMVSDwB5SabQLsIZHiBp43FjGkaienYoDd18hu2BGwOK7U3o70K/WY/kuuKdmdrykIBUdG2mvE91L1JtTbh20mOLbk1vCAamu7utlXeGU2ooVikbU/actcgmsC1FKk2qmj3GWeIWbj4tGIxE7BLcBWUvvcnd/lYxsMV4F917fWeFB/XbINN3qGvIyTpCalz1lVewdIGqeAS/gB8Mi+sA+BqDiX3VGD2eUunTRbSY+AuDy4E3Qx3hAhwnSXX+B0zuj3eQ1miS8Vux2z/l6/BkWtjKGU72aJkOCWhGcSf3+kFkkB15vGOsQrSdFr6qTj0gBYiOlnBO41170gOWHSUoBVRU2JjwppYdhIFDfu7tIRHccSNM5KZOFDPz0TGMAjzzEpeLwTWp+kn201kU6NjbiMQJx83+LX1e1tZ10kuChJZ/XBUQ1dwaBHjTDJDqOympEk8X2M3VtVw21JksChA8w1tTefO3RJ1FMbqZ01bHHkudDB/OhLfe7P5GOHaI28ZXKTMuqo0hLWQ4HabBsGG7NbP1RiXtETz074er6w/OerJWEqjmkq2y51q1BVI+JUudnVa3ogBpzdhFE7fC7kybrAt2Z6RqDjATAUEYeYK45WMupBKQRtQlU+uNsjnzj6ZmGrezA+ASrWxQ6LMkHRXqXwNq7ftv28dUx/ZSJciDXP2SWJsWaN0FjPX9Yko6LobZ7aYW/IdUktI9apTLyHS8DyWPyuoZyxN1TK/vtfxk3HwWh6JczZC8Ftn0bIJay2g+n5wd7lm9rEsKO+svqVmi+c1j88hSCxbzrg4+HEP0Nt1/B6YW1XVm09T1CpAKjc9n18hjqsaFGdfyva1ZG0Xu3ip6N6JGpyTSqY5h4BOlpLPaOnyw45PdXTN+DtAKg7DLrLFTnWusoSBHk3s0d7YouJHq85/R09Tfc37ENXZF48eAYLnq9GLioNcwDZrC6FW6godB8JnqYUPvn0pWLfQz0lM0Yy8Mybgn84Ds3Q9bDP10bLyOV+qzxa4Rd9Dhu7cju8mMaONXK3UqmBQ9qIg7etIwEqM/kECk/Dzja4Bs1xR+Q/tCbc8IKrSGsTdJJ0vge7IG20W687uVmK6icWQ6cD3lwFzgNMGtFvO5qyJeKflGLAAcQZOrkxVwy3cWvqlGpvjmf9Qe6Ap20MPbV92DPV0OhFM4kz8Yr0ffC2zLWSQ1kqY6QdQrttR3kh1YLtQd1kCEv5hVoPIRWl5ERcUTttBIrWp6Xs5Ehh5OUUwI5aEBvuiDmUoENmnVw1FohCrbRp1A1E+XSlWVOTi7ADW+5Ohb9z1vK4qx5R5lPdGCPBJZ00mC+Ssp8VUbgpGAvXWMuWQQRbCqI6Rr2jtxZxtfP7W/8onz+yz0Gs76LaT5HX9ecyiZCB/ZR/gFtMxPsDwohoeCRtiuLxE1GM1vUEUgBv86+eehL58/P56QFGQ/MqOe/vC76L63jzmeax4exd/OKTUvkXg+fOJUHych9xt/9goJMrapSgvXrj8+8vk/N80f22Sewj6cyGqt1B6mztoeklVHHraouhvHJaG/OuBz6DHKMpFmQULU1bRWlyYE0RPXYYkUycIemN7TLtgNCJX6BqdyxDKkegO7nJK5xQ7OVYDZTMf9bVHidtk6DQX9Et+V9M7esgbsYBdEeUpsB0Xvw2kd9+rI7V+m47u+O/tq7mw7262HU1WlS9uFzsV6JxIHNmUCy0QS9e077JGRFbG65z3/dOKB/Zk+yDdKpUmdXjn/aS3N5nv4fK7bMHHmPlHd4E2+iTbV5rpzScRnxk6KARuDTJ8Q1LpK2mP8gj1EbuJ9RIyY+EWK4hCiIDBAS1Tm2IEXAFfgKPgdL9O6mAa06wjCcUAL6EsxPQWO9VNegBPm/0GgkZbDxCynxujX/92vmGcjZRMAY45puak2sFLCLSwXpEsyy5fnF0jGJBhm+fNSHKKUUfy+276A7/feLOFxxUuHRNJI2Osenxyvf8DAGObT60pfTTlhEg9u/KKkhJqm5U1/+BEcSkpFDA5XeCqxwXmPac1jcuZ3JWQ+p0NdWzb/5v1ZvF8GtMTFFEdQjpLO0bwPb0BHNWnip3liDXI2fXf05jjvfJ0NpjLCUgfTh9CMFYVFKEd4Z/OG/2C+N435mnK+9t1gvCiVcaaH7rK4+PjCvpVNiz+t2QyqH1O8x3JKZVl6Q+Lp/XK8wMjVMslOq9FdSw5FtUs/CptXH9PW+wbWHgrV17R5jTVOtGtKFu3nb80T+E0tv9QkzW3J2dbaw/8ddAKZ0pxIaEqLjlPrji3VgJ3GvdFvlqD8075woxh4fVt0JZE0KVFsAvqhe0dqN9b35jtSpnYMXkU+vZq+IAHad3IHc2s/LYrnD1anfG46IFiMIr9oNbZDWvwthqYNqOigaKd/XlLU4XHfk/PXIjPsLy/9/kAtQ+/wKH+hI/IROWj5FPvTZAT9f7j4ZXQyG4M0TujMAFXYkKvEHv1xhySekgXGGqNxWeWKlf8dDAlLuB1cb/qOD+rk7cmwt+1yKpk9cudqBanTi6zTbXRtV8qylNtjyOVKy1HTz0GW9rjt6sSjAZcT5R+KdtyYb0zyqG9pSLuCw5WBwAn7fjBjKLLoxLXMI+52L9cLwIR2B6OllJZLHJ8vDxmWdtF+QJnmt1rsHPIWY20lftk8fYePkAIg6Hgn532QoIpegMxiWgAOfe5/U44APR8Ac0NeZrVh3gEhs12W+tVSiWiUQekf/YBECUy5fdYbA08dd7VzPAP9aiVcIB9k6tY7WdJ1wNV+bHeydNtmC6G5ICtFC1ZwmJU/j8hf0I8TRVKSiz5oYIa93EpUI78X8GYIAZabx47/n8LDAAJ0nNtP1rpROprqKMBRecShca6qXuTSI3jZBLOB3Vp381B5rCGhjSvh/NSVkYp2qIdP/Bg="; },{}],6:[function(require,module,exports){ /* Copyright 2013 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Collection of static dictionary words. */ var data = require('./dictionary-browser'); exports.init = function() { exports.dictionary = data.init(); }; exports.offsetsByLength = new Uint32Array([ 0, 0, 0, 0, 0, 4096, 9216, 21504, 35840, 44032, 53248, 63488, 74752, 87040, 93696, 100864, 104704, 106752, 108928, 113536, 115968, 118528, 119872, 121280, 122016, ]); exports.sizeBitsByLength = new Uint8Array([ 0, 0, 0, 0, 10, 10, 11, 11, 10, 10, 10, 10, 10, 9, 9, 8, 7, 7, 8, 7, 7, 6, 6, 5, 5, ]); exports.minDictionaryWordLength = 4; exports.maxDictionaryWordLength = 24; },{"./dictionary-browser":4}],7:[function(require,module,exports){ function HuffmanCode(bits, value) { this.bits = bits; /* number of bits used for this symbol */ this.value = value; /* symbol value or table offset */ } exports.HuffmanCode = HuffmanCode; var MAX_LENGTH = 15; /* Returns reverse(reverse(key, len) + 1, len), where reverse(key, len) is the bit-wise reversal of the len least significant bits of key. */ function GetNextKey(key, len) { var step = 1 << (len - 1); while (key & step) { step >>= 1; } return (key & (step - 1)) + step; } /* Stores code in table[0], table[step], table[2*step], ..., table[end] */ /* Assumes that end is an integer multiple of step */ function ReplicateValue(table, i, step, end, code) { do { end -= step; table[i + end] = new HuffmanCode(code.bits, code.value); } while (end > 0); } /* Returns the table width of the next 2nd level table. count is the histogram of bit lengths for the remaining symbols, len is the code length of the next processed symbol */ function NextTableBitSize(count, len, root_bits) { var left = 1 << (len - root_bits); while (len < MAX_LENGTH) { left -= count[len]; if (left <= 0) break; ++len; left <<= 1; } return len - root_bits; } exports.BrotliBuildHuffmanTable = function(root_table, table, root_bits, code_lengths, code_lengths_size) { var start_table = table; var code; /* current table entry */ var len; /* current code length */ var symbol; /* symbol index in original or sorted table */ var key; /* reversed prefix code */ var step; /* step size to replicate values in current table */ var low; /* low bits for current root entry */ var mask; /* mask for low bits */ var table_bits; /* key length of current table */ var table_size; /* size of current table */ var total_size; /* sum of root table size and 2nd level table sizes */ var sorted; /* symbols sorted by code length */ var count = new Int32Array(MAX_LENGTH + 1); /* number of codes of each length */ var offset = new Int32Array(MAX_LENGTH + 1); /* offsets in sorted table for each length */ sorted = new Int32Array(code_lengths_size); /* build histogram of code lengths */ for (symbol = 0; symbol < code_lengths_size; symbol++) { count[code_lengths[symbol]]++; } /* generate offsets into sorted symbol table by code length */ offset[1] = 0; for (len = 1; len < MAX_LENGTH; len++) { offset[len + 1] = offset[len] + count[len]; } /* sort symbols by length, by symbol order within each length */ for (symbol = 0; symbol < code_lengths_size; symbol++) { if (code_lengths[symbol] !== 0) { sorted[offset[code_lengths[symbol]]++] = symbol; } } table_bits = root_bits; table_size = 1 << table_bits; total_size = table_size; /* special case code with only one value */ if (offset[MAX_LENGTH] === 1) { for (key = 0; key < total_size; ++key) { root_table[table + key] = new HuffmanCode(0, sorted[0] & 0xffff); } return total_size; } /* fill in root table */ key = 0; symbol = 0; for (len = 1, step = 2; len <= root_bits; ++len, step <<= 1) { for (; count[len] > 0; --count[len]) { code = new HuffmanCode(len & 0xff, sorted[symbol++] & 0xffff); ReplicateValue(root_table, table + key, step, table_size, code); key = GetNextKey(key, len); } } /* fill in 2nd level tables and add pointers to root table */ mask = total_size - 1; low = -1; for (len = root_bits + 1, step = 2; len <= MAX_LENGTH; ++len, step <<= 1) { for (; count[len] > 0; --count[len]) { if ((key & mask) !== low) { table += table_size; table_bits = NextTableBitSize(count, len, root_bits); table_size = 1 << table_bits; total_size += table_size; low = key & mask; root_table[start_table + low] = new HuffmanCode((table_bits + root_bits) & 0xff, ((table - start_table) - low) & 0xffff); } code = new HuffmanCode((len - root_bits) & 0xff, sorted[symbol++] & 0xffff); ReplicateValue(root_table, table + (key >> root_bits), step, table_size, code); key = GetNextKey(key, len); } } return total_size; } },{}],8:[function(require,module,exports){ 'use strict' exports.byteLength = byteLength exports.toByteArray = toByteArray exports.fromByteArray = fromByteArray var lookup = [] var revLookup = [] var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' for (var i = 0, len = code.length; i < len; ++i) { lookup[i] = code[i] revLookup[code.charCodeAt(i)] = i } // Support decoding URL-safe base64 strings, as Node.js does. // See: https://en.wikipedia.org/wiki/Base64#URL_applications revLookup['-'.charCodeAt(0)] = 62 revLookup['_'.charCodeAt(0)] = 63 function getLens (b64) { var len = b64.length if (len % 4 > 0) { throw new Error('Invalid string. Length must be a multiple of 4') } // Trim off extra bytes after placeholder bytes are found // See: https://github.com/beatgammit/base64-js/issues/42 var validLen = b64.indexOf('=') if (validLen === -1) validLen = len var placeHoldersLen = validLen === len ? 0 : 4 - (validLen % 4) return [validLen, placeHoldersLen] } // base64 is 4/3 + up to two characters of the original data function byteLength (b64) { var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function _byteLength (b64, validLen, placeHoldersLen) { return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function toByteArray (b64) { var tmp var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) var curByte = 0 // if there are placeholders, only get up to the last complete 4 chars var len = placeHoldersLen > 0 ? validLen - 4 : validLen for (var i = 0; i < len; i += 4) { tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] arr[curByte++] = (tmp >> 16) & 0xFF arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 2) { tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 1) { tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } return arr } function tripletToBase64 (num) { return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] } function encodeChunk (uint8, start, end) { var tmp var output = [] for (var i = start; i < end; i += 3) { tmp = ((uint8[i] << 16) & 0xFF0000) + ((uint8[i + 1] << 8) & 0xFF00) + (uint8[i + 2] & 0xFF) output.push(tripletToBase64(tmp)) } return output.join('') } function fromByteArray (uint8) { var tmp var len = uint8.length var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes var parts = [] var maxChunkLength = 16383 // must be multiple of 3 // go through the array every three bytes, we'll deal with trailing stuff later for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { parts.push(encodeChunk( uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) )) } // pad the end with zeros, but make sure to not forget the extra bytes if (extraBytes === 1) { tmp = uint8[len - 1] parts.push( lookup[tmp >> 2] + lookup[(tmp << 4) & 0x3F] + '==' ) } else if (extraBytes === 2) { tmp = (uint8[len - 2] << 8) + uint8[len - 1] parts.push( lookup[tmp >> 10] + lookup[(tmp >> 4) & 0x3F] + lookup[(tmp << 2) & 0x3F] + '=' ) } return parts.join('') } },{}],9:[function(require,module,exports){ /* Copyright 2013 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Lookup tables to map prefix codes to value ranges. This is used during decoding of the block lengths, literal insertion lengths and copy lengths. */ /* Represents the range of values belonging to a prefix code: */ /* [offset, offset + 2^nbits) */ function PrefixCodeRange(offset, nbits) { this.offset = offset; this.nbits = nbits; } exports.kBlockLengthPrefixCode = [ new PrefixCodeRange(1, 2), new PrefixCodeRange(5, 2), new PrefixCodeRange(9, 2), new PrefixCodeRange(13, 2), new PrefixCodeRange(17, 3), new PrefixCodeRange(25, 3), new PrefixCodeRange(33, 3), new PrefixCodeRange(41, 3), new PrefixCodeRange(49, 4), new PrefixCodeRange(65, 4), new PrefixCodeRange(81, 4), new PrefixCodeRange(97, 4), new PrefixCodeRange(113, 5), new PrefixCodeRange(145, 5), new PrefixCodeRange(177, 5), new PrefixCodeRange(209, 5), new PrefixCodeRange(241, 6), new PrefixCodeRange(305, 6), new PrefixCodeRange(369, 7), new PrefixCodeRange(497, 8), new PrefixCodeRange(753, 9), new PrefixCodeRange(1265, 10), new PrefixCodeRange(2289, 11), new PrefixCodeRange(4337, 12), new PrefixCodeRange(8433, 13), new PrefixCodeRange(16625, 24) ]; exports.kInsertLengthPrefixCode = [ new PrefixCodeRange(0, 0), new PrefixCodeRange(1, 0), new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0), new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0), new PrefixCodeRange(6, 1), new PrefixCodeRange(8, 1), new PrefixCodeRange(10, 2), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 3), new PrefixCodeRange(26, 3), new PrefixCodeRange(34, 4), new PrefixCodeRange(50, 4), new PrefixCodeRange(66, 5), new PrefixCodeRange(98, 5), new PrefixCodeRange(130, 6), new PrefixCodeRange(194, 7), new PrefixCodeRange(322, 8), new PrefixCodeRange(578, 9), new PrefixCodeRange(1090, 10), new PrefixCodeRange(2114, 12), new PrefixCodeRange(6210, 14), new PrefixCodeRange(22594, 24), ]; exports.kCopyLengthPrefixCode = [ new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0), new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0), new PrefixCodeRange(6, 0), new PrefixCodeRange(7, 0), new PrefixCodeRange(8, 0), new PrefixCodeRange(9, 0), new PrefixCodeRange(10, 1), new PrefixCodeRange(12, 1), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 2), new PrefixCodeRange(22, 3), new PrefixCodeRange(30, 3), new PrefixCodeRange(38, 4), new PrefixCodeRange(54, 4), new PrefixCodeRange(70, 5), new PrefixCodeRange(102, 5), new PrefixCodeRange(134, 6), new PrefixCodeRange(198, 7), new PrefixCodeRange(326, 8), new PrefixCodeRange(582, 9), new PrefixCodeRange(1094, 10), new PrefixCodeRange(2118, 24), ]; exports.kInsertRangeLut = [ 0, 0, 8, 8, 0, 16, 8, 16, 16, ]; exports.kCopyRangeLut = [ 0, 8, 0, 8, 16, 0, 16, 8, 16, ]; },{}],10:[function(require,module,exports){ function BrotliInput(buffer) { this.buffer = buffer; this.pos = 0; } BrotliInput.prototype.read = function(buf, i, count) { if (this.pos + count > this.buffer.length) { count = this.buffer.length - this.pos; } for (var p = 0; p < count; p++) buf[i + p] = this.buffer[this.pos + p]; this.pos += count; return count; } exports.BrotliInput = BrotliInput; function BrotliOutput(buf) { this.buffer = buf; this.pos = 0; } BrotliOutput.prototype.write = function(buf, count) { if (this.pos + count > this.buffer.length) throw new Error('Output buffer is not large enough'); this.buffer.set(buf.subarray(0, count), this.pos); this.pos += count; return count; }; exports.BrotliOutput = BrotliOutput; },{}],11:[function(require,module,exports){ /* Copyright 2013 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Transformations on dictionary words. */ var BrotliDictionary = require('./dictionary'); var kIdentity = 0; var kOmitLast1 = 1; var kOmitLast2 = 2; var kOmitLast3 = 3; var kOmitLast4 = 4; var kOmitLast5 = 5; var kOmitLast6 = 6; var kOmitLast7 = 7; var kOmitLast8 = 8; var kOmitLast9 = 9; var kUppercaseFirst = 10; var kUppercaseAll = 11; var kOmitFirst1 = 12; var kOmitFirst2 = 13; var kOmitFirst3 = 14; var kOmitFirst4 = 15; var kOmitFirst5 = 16; var kOmitFirst6 = 17; var kOmitFirst7 = 18; var kOmitFirst8 = 19; var kOmitFirst9 = 20; function Transform(prefix, transform, suffix) { this.prefix = new Uint8Array(prefix.length); this.transform = transform; this.suffix = new Uint8Array(suffix.length); for (var i = 0; i < prefix.length; i++) this.prefix[i] = prefix.charCodeAt(i); for (var i = 0; i < suffix.length; i++) this.suffix[i] = suffix.charCodeAt(i); } var kTransforms = [ new Transform( "", kIdentity, "" ), new Transform( "", kIdentity, " " ), new Transform( " ", kIdentity, " " ), new Transform( "", kOmitFirst1, "" ), new Transform( "", kUppercaseFirst, " " ), new Transform( "", kIdentity, " the " ), new Transform( " ", kIdentity, "" ), new Transform( "s ", kIdentity, " " ), new Transform( "", kIdentity, " of " ), new Transform( "", kUppercaseFirst, "" ), new Transform( "", kIdentity, " and " ), new Transform( "", kOmitFirst2, "" ), new Transform( "", kOmitLast1, "" ), new Transform( ", ", kIdentity, " " ), new Transform( "", kIdentity, ", " ), new Transform( " ", kUppercaseFirst, " " ), new Transform( "", kIdentity, " in " ), new Transform( "", kIdentity, " to " ), new Transform( "e ", kIdentity, " " ), new Transform( "", kIdentity, "\"" ), new Transform( "", kIdentity, "." ), new Transform( "", kIdentity, "\">" ), new Transform( "", kIdentity, "\n" ), new Transform( "", kOmitLast3, "" ), new Transform( "", kIdentity, "]" ), new Transform( "", kIdentity, " for " ), new Transform( "", kOmitFirst3, "" ), new Transform( "", kOmitLast2, "" ), new Transform( "", kIdentity, " a " ), new Transform( "", kIdentity, " that " ), new Transform( " ", kUppercaseFirst, "" ), new Transform( "", kIdentity, ". " ), new Transform( ".", kIdentity, "" ), new Transform( " ", kIdentity, ", " ), new Transform( "", kOmitFirst4, "" ), new Transform( "", kIdentity, " with " ), new Transform( "", kIdentity, "'" ), new Transform( "", kIdentity, " from " ), new Transform( "", kIdentity, " by " ), new Transform( "", kOmitFirst5, "" ), new Transform( "", kOmitFirst6, "" ), new Transform( " the ", kIdentity, "" ), new Transform( "", kOmitLast4, "" ), new Transform( "", kIdentity, ". The " ), new Transform( "", kUppercaseAll, "" ), new Transform( "", kIdentity, " on " ), new Transform( "", kIdentity, " as " ), new Transform( "", kIdentity, " is " ), new Transform( "", kOmitLast7, "" ), new Transform( "", kOmitLast1, "ing " ), new Transform( "", kIdentity, "\n\t" ), new Transform( "", kIdentity, ":" ), new Transform( " ", kIdentity, ". " ), new Transform( "", kIdentity, "ed " ), new Transform( "", kOmitFirst9, "" ), new Transform( "", kOmitFirst7, "" ), new Transform( "", kOmitLast6, "" ), new Transform( "", kIdentity, "(" ), new Transform( "", kUppercaseFirst, ", " ), new Transform( "", kOmitLast8, "" ), new Transform( "", kIdentity, " at " ), new Transform( "", kIdentity, "ly " ), new Transform( " the ", kIdentity, " of " ), new Transform( "", kOmitLast5, "" ), new Transform( "", kOmitLast9, "" ), new Transform( " ", kUppercaseFirst, ", " ), new Transform( "", kUppercaseFirst, "\"" ), new Transform( ".", kIdentity, "(" ), new Transform( "", kUppercaseAll, " " ), new Transform( "", kUppercaseFirst, "\">" ), new Transform( "", kIdentity, "=\"" ), new Transform( " ", kIdentity, "." ), new Transform( ".com/", kIdentity, "" ), new Transform( " the ", kIdentity, " of the " ), new Transform( "", kUppercaseFirst, "'" ), new Transform( "", kIdentity, ". This " ), new Transform( "", kIdentity, "," ), new Transform( ".", kIdentity, " " ), new Transform( "", kUppercaseFirst, "(" ), new Transform( "", kUppercaseFirst, "." ), new Transform( "", kIdentity, " not " ), new Transform( " ", kIdentity, "=\"" ), new Transform( "", kIdentity, "er " ), new Transform( " ", kUppercaseAll, " " ), new Transform( "", kIdentity, "al " ), new Transform( " ", kUppercaseAll, "" ), new Transform( "", kIdentity, "='" ), new Transform( "", kUppercaseAll, "\"" ), new Transform( "", kUppercaseFirst, ". " ), new Transform( " ", kIdentity, "(" ), new Transform( "", kIdentity, "ful " ), new Transform( " ", kUppercaseFirst, ". " ), new Transform( "", kIdentity, "ive " ), new Transform( "", kIdentity, "less " ), new Transform( "", kUppercaseAll, "'" ), new Transform( "", kIdentity, "est " ), new Transform( " ", kUppercaseFirst, "." ), new Transform( "", kUppercaseAll, "\">" ), new Transform( " ", kIdentity, "='" ), new Transform( "", kUppercaseFirst, "," ), new Transform( "", kIdentity, "ize " ), new Transform( "", kUppercaseAll, "." ), new Transform( "\xc2\xa0", kIdentity, "" ), new Transform( " ", kIdentity, "," ), new Transform( "", kUppercaseFirst, "=\"" ), new Transform( "", kUppercaseAll, "=\"" ), new Transform( "", kIdentity, "ous " ), new Transform( "", kUppercaseAll, ", " ), new Transform( "", kUppercaseFirst, "='" ), new Transform( " ", kUppercaseFirst, "," ), new Transform( " ", kUppercaseAll, "=\"" ), new Transform( " ", kUppercaseAll, ", " ), new Transform( "", kUppercaseAll, "," ), new Transform( "", kUppercaseAll, "(" ), new Transform( "", kUppercaseAll, ". " ), new Transform( " ", kUppercaseAll, "." ), new Transform( "", kUppercaseAll, "='" ), new Transform( " ", kUppercaseAll, ". " ), new Transform( " ", kUppercaseFirst, "=\"" ), new Transform( " ", kUppercaseAll, "='" ), new Transform( " ", kUppercaseFirst, "='" ) ]; exports.kTransforms = kTransforms; exports.kNumTransforms = kTransforms.length; function ToUpperCase(p, i) { if (p[i] < 0xc0) { if (p[i] >= 97 && p[i] <= 122) { p[i] ^= 32; } return 1; } /* An overly simplified uppercasing model for utf-8. */ if (p[i] < 0xe0) { p[i + 1] ^= 32; return 2; } /* An arbitrary transform for three byte characters. */ p[i + 2] ^= 5; return 3; } exports.transformDictionaryWord = function(dst, idx, word, len, transform) { var prefix = kTransforms[transform].prefix; var suffix = kTransforms[transform].suffix; var t = kTransforms[transform].transform; var skip = t < kOmitFirst1 ? 0 : t - (kOmitFirst1 - 1); var i = 0; var start_idx = idx; var uppercase; if (skip > len) { skip = len; } var prefix_pos = 0; while (prefix_pos < prefix.length) { dst[idx++] = prefix[prefix_pos++]; } word += skip; len -= skip; if (t <= kOmitLast9) { len -= t; } for (i = 0; i < len; i++) { dst[idx++] = BrotliDictionary.dictionary[word + i]; } uppercase = idx - len; if (t === kUppercaseFirst) { ToUpperCase(dst, uppercase); } else if (t === kUppercaseAll) { while (len > 0) { var step = ToUpperCase(dst, uppercase); uppercase += step; len -= step; } } var suffix_pos = 0; while (suffix_pos < suffix.length) { dst[idx++] = suffix[suffix_pos++]; } return idx - start_idx; } },{"./dictionary":6}],12:[function(require,module,exports){ module.exports = require('./dec/decode').BrotliDecompressBuffer; },{"./dec/decode":3}]},{},[12])(12) }); /* eslint-enable */ /***/ }), /***/ 9681: /***/ ((module) => { var characterMap = { "À": "A", "Á": "A", "Â": "A", "Ã": "A", "Ä": "A", "Å": "A", "Ấ": "A", "Ắ": "A", "Ẳ": "A", "Ẵ": "A", "Ặ": "A", "Æ": "AE", "Ầ": "A", "Ằ": "A", "Ȃ": "A", "Ả": "A", "Ạ": "A", "Ẩ": "A", "Ẫ": "A", "Ậ": "A", "Ç": "C", "Ḉ": "C", "È": "E", "É": "E", "Ê": "E", "Ë": "E", "Ế": "E", "Ḗ": "E", "Ề": "E", "Ḕ": "E", "Ḝ": "E", "Ȇ": "E", "Ẻ": "E", "Ẽ": "E", "Ẹ": "E", "Ể": "E", "Ễ": "E", "Ệ": "E", "Ì": "I", "Í": "I", "Î": "I", "Ï": "I", "Ḯ": "I", "Ȋ": "I", "Ỉ": "I", "Ị": "I", "Ð": "D", "Ñ": "N", "Ò": "O", "Ó": "O", "Ô": "O", "Õ": "O", "Ö": "O", "Ø": "O", "Ố": "O", "Ṍ": "O", "Ṓ": "O", "Ȏ": "O", "Ỏ": "O", "Ọ": "O", "Ổ": "O", "Ỗ": "O", "Ộ": "O", "Ờ": "O", "Ở": "O", "Ỡ": "O", "Ớ": "O", "Ợ": "O", "Ù": "U", "Ú": "U", "Û": "U", "Ü": "U", "Ủ": "U", "Ụ": "U", "Ử": "U", "Ữ": "U", "Ự": "U", "Ý": "Y", "à": "a", "á": "a", "â": "a", "ã": "a", "ä": "a", "å": "a", "ấ": "a", "ắ": "a", "ẳ": "a", "ẵ": "a", "ặ": "a", "æ": "ae", "ầ": "a", "ằ": "a", "ȃ": "a", "ả": "a", "ạ": "a", "ẩ": "a", "ẫ": "a", "ậ": "a", "ç": "c", "ḉ": "c", "è": "e", "é": "e", "ê": "e", "ë": "e", "ế": "e", "ḗ": "e", "ề": "e", "ḕ": "e", "ḝ": "e", "ȇ": "e", "ẻ": "e", "ẽ": "e", "ẹ": "e", "ể": "e", "ễ": "e", "ệ": "e", "ì": "i", "í": "i", "î": "i", "ï": "i", "ḯ": "i", "ȋ": "i", "ỉ": "i", "ị": "i", "ð": "d", "ñ": "n", "ò": "o", "ó": "o", "ô": "o", "õ": "o", "ö": "o", "ø": "o", "ố": "o", "ṍ": "o", "ṓ": "o", "ȏ": "o", "ỏ": "o", "ọ": "o", "ổ": "o", "ỗ": "o", "ộ": "o", "ờ": "o", "ở": "o", "ỡ": "o", "ớ": "o", "ợ": "o", "ù": "u", "ú": "u", "û": "u", "ü": "u", "ủ": "u", "ụ": "u", "ử": "u", "ữ": "u", "ự": "u", "ý": "y", "ÿ": "y", "Ā": "A", "ā": "a", "Ă": "A", "ă": "a", "Ą": "A", "ą": "a", "Ć": "C", "ć": "c", "Ĉ": "C", "ĉ": "c", "Ċ": "C", "ċ": "c", "Č": "C", "č": "c", "C̆": "C", "c̆": "c", "Ď": "D", "ď": "d", "Đ": "D", "đ": "d", "Ē": "E", "ē": "e", "Ĕ": "E", "ĕ": "e", "Ė": "E", "ė": "e", "Ę": "E", "ę": "e", "Ě": "E", "ě": "e", "Ĝ": "G", "Ǵ": "G", "ĝ": "g", "ǵ": "g", "Ğ": "G", "ğ": "g", "Ġ": "G", "ġ": "g", "Ģ": "G", "ģ": "g", "Ĥ": "H", "ĥ": "h", "Ħ": "H", "ħ": "h", "Ḫ": "H", "ḫ": "h", "Ĩ": "I", "ĩ": "i", "Ī": "I", "ī": "i", "Ĭ": "I", "ĭ": "i", "Į": "I", "į": "i", "İ": "I", "ı": "i", "IJ": "IJ", "ij": "ij", "Ĵ": "J", "ĵ": "j", "Ķ": "K", "ķ": "k", "Ḱ": "K", "ḱ": "k", "K̆": "K", "k̆": "k", "Ĺ": "L", "ĺ": "l", "Ļ": "L", "ļ": "l", "Ľ": "L", "ľ": "l", "Ŀ": "L", "ŀ": "l", "Ł": "l", "ł": "l", "Ḿ": "M", "ḿ": "m", "M̆": "M", "m̆": "m", "Ń": "N", "ń": "n", "Ņ": "N", "ņ": "n", "Ň": "N", "ň": "n", "ʼn": "n", "N̆": "N", "n̆": "n", "Ō": "O", "ō": "o", "Ŏ": "O", "ŏ": "o", "Ő": "O", "ő": "o", "Œ": "OE", "œ": "oe", "P̆": "P", "p̆": "p", "Ŕ": "R", "ŕ": "r", "Ŗ": "R", "ŗ": "r", "Ř": "R", "ř": "r", "R̆": "R", "r̆": "r", "Ȓ": "R", "ȓ": "r", "Ś": "S", "ś": "s", "Ŝ": "S", "ŝ": "s", "Ş": "S", "Ș": "S", "ș": "s", "ş": "s", "Š": "S", "š": "s", "Ţ": "T", "ţ": "t", "ț": "t", "Ț": "T", "Ť": "T", "ť": "t", "Ŧ": "T", "ŧ": "t", "T̆": "T", "t̆": "t", "Ũ": "U", "ũ": "u", "Ū": "U", "ū": "u", "Ŭ": "U", "ŭ": "u", "Ů": "U", "ů": "u", "Ű": "U", "ű": "u", "Ų": "U", "ų": "u", "Ȗ": "U", "ȗ": "u", "V̆": "V", "v̆": "v", "Ŵ": "W", "ŵ": "w", "Ẃ": "W", "ẃ": "w", "X̆": "X", "x̆": "x", "Ŷ": "Y", "ŷ": "y", "Ÿ": "Y", "Y̆": "Y", "y̆": "y", "Ź": "Z", "ź": "z", "Ż": "Z", "ż": "z", "Ž": "Z", "ž": "z", "ſ": "s", "ƒ": "f", "Ơ": "O", "ơ": "o", "Ư": "U", "ư": "u", "Ǎ": "A", "ǎ": "a", "Ǐ": "I", "ǐ": "i", "Ǒ": "O", "ǒ": "o", "Ǔ": "U", "ǔ": "u", "Ǖ": "U", "ǖ": "u", "Ǘ": "U", "ǘ": "u", "Ǚ": "U", "ǚ": "u", "Ǜ": "U", "ǜ": "u", "Ứ": "U", "ứ": "u", "Ṹ": "U", "ṹ": "u", "Ǻ": "A", "ǻ": "a", "Ǽ": "AE", "ǽ": "ae", "Ǿ": "O", "ǿ": "o", "Þ": "TH", "þ": "th", "Ṕ": "P", "ṕ": "p", "Ṥ": "S", "ṥ": "s", "X́": "X", "x́": "x", "Ѓ": "Г", "ѓ": "г", "Ќ": "К", "ќ": "к", "A̋": "A", "a̋": "a", "E̋": "E", "e̋": "e", "I̋": "I", "i̋": "i", "Ǹ": "N", "ǹ": "n", "Ồ": "O", "ồ": "o", "Ṑ": "O", "ṑ": "o", "Ừ": "U", "ừ": "u", "Ẁ": "W", "ẁ": "w", "Ỳ": "Y", "ỳ": "y", "Ȁ": "A", "ȁ": "a", "Ȅ": "E", "ȅ": "e", "Ȉ": "I", "ȉ": "i", "Ȍ": "O", "ȍ": "o", "Ȑ": "R", "ȑ": "r", "Ȕ": "U", "ȕ": "u", "B̌": "B", "b̌": "b", "Č̣": "C", "č̣": "c", "Ê̌": "E", "ê̌": "e", "F̌": "F", "f̌": "f", "Ǧ": "G", "ǧ": "g", "Ȟ": "H", "ȟ": "h", "J̌": "J", "ǰ": "j", "Ǩ": "K", "ǩ": "k", "M̌": "M", "m̌": "m", "P̌": "P", "p̌": "p", "Q̌": "Q", "q̌": "q", "Ř̩": "R", "ř̩": "r", "Ṧ": "S", "ṧ": "s", "V̌": "V", "v̌": "v", "W̌": "W", "w̌": "w", "X̌": "X", "x̌": "x", "Y̌": "Y", "y̌": "y", "A̧": "A", "a̧": "a", "B̧": "B", "b̧": "b", "Ḑ": "D", "ḑ": "d", "Ȩ": "E", "ȩ": "e", "Ɛ̧": "E", "ɛ̧": "e", "Ḩ": "H", "ḩ": "h", "I̧": "I", "i̧": "i", "Ɨ̧": "I", "ɨ̧": "i", "M̧": "M", "m̧": "m", "O̧": "O", "o̧": "o", "Q̧": "Q", "q̧": "q", "U̧": "U", "u̧": "u", "X̧": "X", "x̧": "x", "Z̧": "Z", "z̧": "z", "й":"и", "Й":"И", "ё":"е", "Ё":"Е", }; var chars = Object.keys(characterMap).join('|'); var allAccents = new RegExp(chars, 'g'); var firstAccent = new RegExp(chars, ''); function matcher(match) { return characterMap[match]; } var removeAccents = function(string) { return string.replace(allAccents, matcher); }; var hasAccents = function(string) { return !!string.match(firstAccent); }; module.exports = removeAccents; module.exports.has = hasAccents; module.exports.remove = removeAccents; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/create fake namespace object */ /******/ (() => { /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__); /******/ var leafPrototypes; /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 16: return value when it's Promise-like /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = this(value); /******/ if(mode & 8) return value; /******/ if(typeof value === 'object' && value) { /******/ if((mode & 4) && value.__esModule) return value; /******/ if((mode & 16) && typeof value.then === 'function') return value; /******/ } /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ var def = {}; /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); /******/ } /******/ def['default'] = () => (value); /******/ __webpack_require__.d(ns, def); /******/ return ns; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. (() => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem), PluginSidebar: () => (/* reexport */ PluginSidebar), PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), PluginTemplateSettingPanel: () => (/* reexport */ plugin_template_setting_panel_default), initializeEditor: () => (/* binding */ initializeEditor), initializePostsDashboard: () => (/* reexport */ initializePostsDashboard), reinitializeEditor: () => (/* binding */ reinitializeEditor), store: () => (/* reexport */ store) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { __experimentalSetPreviewDeviceType: () => (__experimentalSetPreviewDeviceType), addTemplate: () => (addTemplate), closeGeneralSidebar: () => (closeGeneralSidebar), openGeneralSidebar: () => (openGeneralSidebar), openNavigationPanelToMenu: () => (openNavigationPanelToMenu), removeTemplate: () => (removeTemplate), revertTemplate: () => (revertTemplate), setEditedEntity: () => (setEditedEntity), setEditedPostContext: () => (setEditedPostContext), setHasPageContentFocus: () => (setHasPageContentFocus), setHomeTemplateId: () => (setHomeTemplateId), setIsInserterOpened: () => (setIsInserterOpened), setIsListViewOpened: () => (setIsListViewOpened), setIsNavigationPanelOpened: () => (setIsNavigationPanelOpened), setIsSaveViewOpened: () => (setIsSaveViewOpened), setNavigationMenu: () => (setNavigationMenu), setNavigationPanelActiveMenu: () => (setNavigationPanelActiveMenu), setPage: () => (setPage), setTemplate: () => (setTemplate), setTemplatePart: () => (setTemplatePart), switchEditorMode: () => (switchEditorMode), toggleDistractionFree: () => (toggleDistractionFree), toggleFeature: () => (toggleFeature), updateSettings: () => (updateSettings) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js var private_actions_namespaceObject = {}; __webpack_require__.r(private_actions_namespaceObject); __webpack_require__.d(private_actions_namespaceObject, { registerRoute: () => (registerRoute), setEditorCanvasContainerView: () => (setEditorCanvasContainerView), unregisterRoute: () => (unregisterRoute) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint), __experimentalGetPreviewDeviceType: () => (__experimentalGetPreviewDeviceType), getCanUserCreateMedia: () => (getCanUserCreateMedia), getCurrentTemplateNavigationPanelSubMenu: () => (getCurrentTemplateNavigationPanelSubMenu), getCurrentTemplateTemplateParts: () => (getCurrentTemplateTemplateParts), getEditedPostContext: () => (getEditedPostContext), getEditedPostId: () => (getEditedPostId), getEditedPostType: () => (getEditedPostType), getEditorMode: () => (getEditorMode), getHomeTemplateId: () => (getHomeTemplateId), getNavigationPanelActiveMenu: () => (getNavigationPanelActiveMenu), getPage: () => (getPage), getReusableBlocks: () => (getReusableBlocks), getSettings: () => (getSettings), hasPageContentFocus: () => (hasPageContentFocus), isFeatureActive: () => (isFeatureActive), isInserterOpened: () => (isInserterOpened), isListViewOpened: () => (isListViewOpened), isNavigationOpened: () => (isNavigationOpened), isPage: () => (isPage), isSaveViewOpened: () => (isSaveViewOpened) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js var private_selectors_namespaceObject = {}; __webpack_require__.r(private_selectors_namespaceObject); __webpack_require__.d(private_selectors_namespaceObject, { getEditorCanvasContainerView: () => (getEditorCanvasContainerView), getRoutes: () => (getRoutes) }); ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// external ["wp","blockLibrary"] const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; // EXTERNAL MODULE: external ["wp","data"] var external_wp_data_ = __webpack_require__(7143); ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); // EXTERNAL MODULE: external ["wp","element"] var external_wp_element_ = __webpack_require__(6087); ;// external ["wp","editor"] const external_wp_editor_namespaceObject = window["wp"]["editor"]; // EXTERNAL MODULE: external ["wp","preferences"] var external_wp_preferences_ = __webpack_require__(1233); ;// external ["wp","widgets"] const external_wp_widgets_namespaceObject = window["wp"]["widgets"]; ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","blockEditor"] const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// external ["wp","notices"] const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// external ["wp","coreData"] const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; ;// ./node_modules/colord/index.mjs var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,colord_p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||colord_p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},colord_j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof colord_j?r:new colord_j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(colord_j,y),S.push(r))})},E=function(){return new colord_j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})}; ;// ./node_modules/colord/plugins/a11y.mjs var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}} ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/edit-site/build-module/lock-unlock.js const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/edit-site" ); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/hooks.js const { useGlobalSetting, useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); k([a11y]); function useColorRandomizer(name) { const [themeColors, setThemeColors] = useGlobalSetting( "color.palette.theme", name ); function randomizeColors() { const randomRotationValue = Math.floor(Math.random() * 225); const newColors = themeColors.map((colorObject) => { const { color } = colorObject; const newColor = w(color).rotate(randomRotationValue).toHex(); return { ...colorObject, color: newColor }; }); setThemeColors(newColors); } return window.__experimentalEnableColorRandomizer ? [randomizeColors] : []; } function useStylesPreviewColors() { const [textColor = "black"] = useGlobalStyle("color.text"); const [backgroundColor = "white"] = useGlobalStyle("color.background"); const [headingColor = textColor] = useGlobalStyle( "elements.h1.color.text" ); const [linkColor = headingColor] = useGlobalStyle( "elements.link.color.text" ); const [buttonBackgroundColor = linkColor] = useGlobalStyle( "elements.button.color.background" ); const [coreColors] = useGlobalSetting("color.palette.core"); const [themeColors] = useGlobalSetting("color.palette.theme"); const [customColors] = useGlobalSetting("color.palette.custom"); const paletteColors = (themeColors ?? []).concat(customColors ?? []).concat(coreColors ?? []); const textColorObject = paletteColors.filter( ({ color }) => color === textColor ); const buttonBackgroundColorObject = paletteColors.filter( ({ color }) => color === buttonBackgroundColor ); const highlightedColors = textColorObject.concat(buttonBackgroundColorObject).concat(paletteColors).filter( // we exclude these background color because it is already visible in the preview. ({ color }) => color !== backgroundColor ).slice(0, 2); return { paletteColors, highlightedColors }; } function useSupportedStyles(name, element) { const { supportedPanels } = (0,external_wp_data_.useSelect)( (select) => { return { supportedPanels: unlock( select(external_wp_blocks_namespaceObject.store) ).getSupportedStyles(name, element) }; }, [name, element] ); return supportedPanels; } ;// ./node_modules/@wordpress/edit-site/build-module/utils/set-nested-value.js function setNestedValue(object, path, value) { if (!object || typeof object !== "object") { return object; } path.reduce((acc, key, idx) => { if (acc[key] === void 0) { if (Number.isInteger(path[idx + 1])) { acc[key] = []; } else { acc[key] = {}; } } if (idx === path.length - 1) { acc[key] = value; } return acc[key]; }, object); return object; } ;// ./node_modules/@wordpress/edit-site/build-module/hooks/push-changes-to-global-styles/index.js const { cleanEmptyObject, GlobalStylesContext } = unlock( external_wp_blockEditor_namespaceObject.privateApis ); const STYLE_PROPERTY = { ...external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY, blockGap: { value: ["spacing", "blockGap"] } }; const STYLE_PATH_TO_CSS_VAR_INFIX = { "border.color": "color", "color.background": "color", "color.text": "color", "elements.link.color.text": "color", "elements.link.:hover.color.text": "color", "elements.link.typography.fontFamily": "font-family", "elements.link.typography.fontSize": "font-size", "elements.button.color.text": "color", "elements.button.color.background": "color", "elements.button.typography.fontFamily": "font-family", "elements.button.typography.fontSize": "font-size", "elements.caption.color.text": "color", "elements.heading.color": "color", "elements.heading.color.background": "color", "elements.heading.typography.fontFamily": "font-family", "elements.heading.gradient": "gradient", "elements.heading.color.gradient": "gradient", "elements.h1.color": "color", "elements.h1.color.background": "color", "elements.h1.typography.fontFamily": "font-family", "elements.h1.color.gradient": "gradient", "elements.h2.color": "color", "elements.h2.color.background": "color", "elements.h2.typography.fontFamily": "font-family", "elements.h2.color.gradient": "gradient", "elements.h3.color": "color", "elements.h3.color.background": "color", "elements.h3.typography.fontFamily": "font-family", "elements.h3.color.gradient": "gradient", "elements.h4.color": "color", "elements.h4.color.background": "color", "elements.h4.typography.fontFamily": "font-family", "elements.h4.color.gradient": "gradient", "elements.h5.color": "color", "elements.h5.color.background": "color", "elements.h5.typography.fontFamily": "font-family", "elements.h5.color.gradient": "gradient", "elements.h6.color": "color", "elements.h6.color.background": "color", "elements.h6.typography.fontFamily": "font-family", "elements.h6.color.gradient": "gradient", "color.gradient": "gradient", blockGap: "spacing", "typography.fontSize": "font-size", "typography.fontFamily": "font-family" }; const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = { "border.color": "borderColor", "color.background": "backgroundColor", "color.text": "textColor", "color.gradient": "gradient", "typography.fontSize": "fontSize", "typography.fontFamily": "fontFamily" }; const SUPPORTED_STYLES = ["border", "color", "spacing", "typography"]; const getValueFromObjectPath = (object, path) => { let value = object; path.forEach((fieldName) => { value = value?.[fieldName]; }); return value; }; const flatBorderProperties = ["borderColor", "borderWidth", "borderStyle"]; const sides = ["top", "right", "bottom", "left"]; function getBorderStyleChanges(border, presetColor, userStyle) { if (!border && !presetColor) { return []; } const changes = [ ...getFallbackBorderStyleChange("top", border, userStyle), ...getFallbackBorderStyleChange("right", border, userStyle), ...getFallbackBorderStyleChange("bottom", border, userStyle), ...getFallbackBorderStyleChange("left", border, userStyle) ]; const { color: customColor, style, width } = border || {}; const hasColorOrWidth = presetColor || customColor || width; if (hasColorOrWidth && !style) { sides.forEach((side) => { if (!userStyle?.[side]?.style) { changes.push({ path: ["border", side, "style"], value: "solid" }); } }); } return changes; } function getFallbackBorderStyleChange(side, border, globalBorderStyle) { if (!border?.[side] || globalBorderStyle?.[side]?.style) { return []; } const { color, style, width } = border[side]; const hasColorOrWidth = color || width; if (!hasColorOrWidth || style) { return []; } return [{ path: ["border", side, "style"], value: "solid" }]; } function useChangesToPush(name, attributes, userConfig) { const supports = useSupportedStyles(name); const blockUserConfig = userConfig?.styles?.blocks?.[name]; return (0,external_wp_element_.useMemo)(() => { const changes = supports.flatMap((key) => { if (!STYLE_PROPERTY[key]) { return []; } const { value: path } = STYLE_PROPERTY[key]; const presetAttributeKey = path.join("."); const presetAttributeValue = attributes[STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[presetAttributeKey]]; const value = presetAttributeValue ? `var:preset|${STYLE_PATH_TO_CSS_VAR_INFIX[presetAttributeKey]}|${presetAttributeValue}` : getValueFromObjectPath(attributes.style, path); if (key === "linkColor") { const linkChanges = value ? [{ path, value }] : []; const hoverPath = [ "elements", "link", ":hover", "color", "text" ]; const hoverValue = getValueFromObjectPath( attributes.style, hoverPath ); if (hoverValue) { linkChanges.push({ path: hoverPath, value: hoverValue }); } return linkChanges; } if (flatBorderProperties.includes(key) && value) { const borderChanges = [{ path, value }]; sides.forEach((side) => { const currentPath = [...path]; currentPath.splice(-1, 0, side); borderChanges.push({ path: currentPath, value }); }); return borderChanges; } return value ? [{ path, value }] : []; }); getBorderStyleChanges( attributes.style?.border, attributes.borderColor, blockUserConfig?.border ).forEach((change) => changes.push(change)); return changes; }, [supports, attributes, blockUserConfig]); } function PushChangesToGlobalStylesControl({ name, attributes, setAttributes }) { const { user: userConfig, setUserConfig } = (0,external_wp_element_.useContext)(GlobalStylesContext); const changes = useChangesToPush(name, attributes, userConfig); const { __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); const pushChanges = (0,external_wp_element_.useCallback)(() => { if (changes.length === 0) { return; } if (changes.length > 0) { const { style: blockStyles } = attributes; const newBlockStyles = structuredClone(blockStyles); const newUserConfig = structuredClone(userConfig); for (const { path, value } of changes) { setNestedValue(newBlockStyles, path, void 0); setNestedValue( newUserConfig, ["styles", "blocks", name, ...path], value ); } const newBlockAttributes = { borderColor: void 0, backgroundColor: void 0, textColor: void 0, gradient: void 0, fontSize: void 0, fontFamily: void 0, style: cleanEmptyObject(newBlockStyles) }; __unstableMarkNextChangeAsNotPersistent(); setAttributes(newBlockAttributes); setUserConfig(newUserConfig, { undoIgnore: true }); createSuccessNotice( (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Title of the block e.g. 'Heading'. (0,external_wp_i18n_namespaceObject.__)("%s styles applied."), (0,external_wp_blocks_namespaceObject.getBlockType)(name).title ), { type: "snackbar", actions: [ { label: (0,external_wp_i18n_namespaceObject.__)("Undo"), onClick() { __unstableMarkNextChangeAsNotPersistent(); setAttributes(attributes); setUserConfig(userConfig, { undoIgnore: true }); } } ] } ); } }, [ __unstableMarkNextChangeAsNotPersistent, attributes, changes, createSuccessNotice, name, setAttributes, setUserConfig, userConfig ]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, className: "edit-site-push-changes-to-global-styles-control", help: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Title of the block e.g. 'Heading'. (0,external_wp_i18n_namespaceObject.__)( "Apply this block\u2019s typography, spacing, dimensions, and color styles to all %s blocks." ), (0,external_wp_blocks_namespaceObject.getBlockType)(name).title ), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Styles") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", accessibleWhenDisabled: true, disabled: changes.length === 0, onClick: pushChanges, children: (0,external_wp_i18n_namespaceObject.__)("Apply globally") } ) ] } ); } function PushChangesToGlobalStyles(props) { const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); const isBlockBasedTheme = (0,external_wp_data_.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, [] ); const supportsStyles = SUPPORTED_STYLES.some( (feature) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(props.name, feature) ); const isDisplayed = blockEditingMode === "default" && supportsStyles && isBlockBasedTheme; if (!isDisplayed) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStylesControl, { ...props }) }); } const withPushChangesToGlobalStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( (BlockEdit) => (props) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"), props.isSelected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStyles, { ...props }) ] }) ); (0,external_wp_hooks_namespaceObject.addFilter)( "editor.BlockEdit", "core/edit-site/push-changes-to-global-styles", withPushChangesToGlobalStyles ); ;// ./node_modules/@wordpress/edit-site/build-module/hooks/index.js ;// ./node_modules/@wordpress/edit-site/build-module/store/reducer.js function settings(state = {}, action) { switch (action.type) { case "UPDATE_SETTINGS": return { ...state, ...action.settings }; } return state; } function editedPost(state = {}, action) { switch (action.type) { case "SET_EDITED_POST": return { postType: action.postType, id: action.id, context: action.context }; case "SET_EDITED_POST_CONTEXT": return { ...state, context: action.context }; } return state; } function saveViewPanel(state = false, action) { switch (action.type) { case "SET_IS_SAVE_VIEW_OPENED": return action.isOpen; } return state; } function editorCanvasContainerView(state = void 0, action) { switch (action.type) { case "SET_EDITOR_CANVAS_CONTAINER_VIEW": return action.view; } return state; } function routes(state = [], action) { switch (action.type) { case "REGISTER_ROUTE": return [...state, action.route]; case "UNREGISTER_ROUTE": return state.filter((route) => route.name !== action.name); } return state; } var reducer_default = (0,external_wp_data_.combineReducers)({ settings, editedPost, saveViewPanel, editorCanvasContainerView, routes }); ;// external ["wp","patterns"] const external_wp_patterns_namespaceObject = window["wp"]["patterns"]; ;// ./node_modules/@wordpress/edit-site/build-module/utils/constants.js const NAVIGATION_POST_TYPE = "wp_navigation"; const TEMPLATE_POST_TYPE = "wp_template"; const TEMPLATE_PART_POST_TYPE = "wp_template_part"; const TEMPLATE_ORIGINS = { custom: "custom", theme: "theme", plugin: "plugin" }; const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = "uncategorized"; const TEMPLATE_PART_ALL_AREAS_CATEGORY = "all-parts"; const { PATTERN_TYPES, PATTERN_DEFAULT_CATEGORY, PATTERN_USER_CATEGORY, EXCLUDED_PATTERN_SOURCES, PATTERN_SYNC_TYPES } = unlock(external_wp_patterns_namespaceObject.privateApis); const FOCUSABLE_ENTITIES = [ TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user ]; const POST_TYPE_LABELS = { [TEMPLATE_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)("Template"), [TEMPLATE_PART_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)("Template part"), [PATTERN_TYPES.user]: (0,external_wp_i18n_namespaceObject.__)("Pattern"), [NAVIGATION_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)("Navigation") }; const LAYOUT_GRID = "grid"; const LAYOUT_TABLE = "table"; const LAYOUT_LIST = "list"; const OPERATOR_IS = "is"; const OPERATOR_IS_NOT = "isNot"; const OPERATOR_IS_ANY = "isAny"; const OPERATOR_IS_NONE = "isNone"; ;// ./node_modules/@wordpress/edit-site/build-module/store/actions.js const { interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis); function toggleFeature(featureName) { return function({ registry }) { external_wp_deprecated_default()( "dispatch( 'core/edit-site' ).toggleFeature( featureName )", { since: "6.0", alternative: "dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )" } ); registry.dispatch(external_wp_preferences_.store).toggle("core/edit-site", featureName); }; } const __experimentalSetPreviewDeviceType = (deviceType) => ({ registry }) => { external_wp_deprecated_default()( "dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType", { since: "6.5", version: "6.7", hint: "registry.dispatch( editorStore ).setDeviceType" } ); registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType(deviceType); }; function setTemplate() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplate", { since: "6.5", version: "6.8", hint: "The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically." }); return { type: "NOTHING" }; } const addTemplate = (template) => async ({ dispatch, registry }) => { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).addTemplate", { since: "6.5", version: "6.8", hint: "use saveEntityRecord directly" }); const newTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord("postType", TEMPLATE_POST_TYPE, template); if (template.content) { registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord( "postType", TEMPLATE_POST_TYPE, newTemplate.id, { blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content) }, { undoIgnore: true } ); } dispatch({ type: "SET_EDITED_POST", postType: TEMPLATE_POST_TYPE, id: newTemplate.id }); }; const removeTemplate = (template) => ({ registry }) => { return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).removeTemplates([ template ]); }; function setTemplatePart(templatePartId) { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplatePart", { since: "6.8" }); return { type: "SET_EDITED_POST", postType: TEMPLATE_PART_POST_TYPE, id: templatePartId }; } function setNavigationMenu(navigationMenuId) { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationMenu", { since: "6.8" }); return { type: "SET_EDITED_POST", postType: NAVIGATION_POST_TYPE, id: navigationMenuId }; } function setEditedEntity(postType, postId, context) { return { type: "SET_EDITED_POST", postType, id: postId, context }; } function setHomeTemplateId() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setHomeTemplateId", { since: "6.2", version: "6.4" }); return { type: "NOTHING" }; } function setEditedPostContext(context) { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setEditedPostContext", { since: "6.8" }); return { type: "SET_EDITED_POST_CONTEXT", context }; } function setPage() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setPage", { since: "6.5", version: "6.8", hint: "The setPage is not needed anymore, the correct entity is resolved from the URL automatically." }); return { type: "NOTHING" }; } function setNavigationPanelActiveMenu() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu", { since: "6.2", version: "6.4" }); return { type: "NOTHING" }; } function openNavigationPanelToMenu() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu", { since: "6.2", version: "6.4" }); return { type: "NOTHING" }; } function setIsNavigationPanelOpened() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened", { since: "6.2", version: "6.4" }); return { type: "NOTHING" }; } const setIsInserterOpened = (value) => ({ registry }) => { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsInserterOpened", { since: "6.5", alternative: "dispatch( 'core/editor').setIsInserterOpened" }); registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(value); }; const setIsListViewOpened = (isOpen) => ({ registry }) => { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsListViewOpened", { since: "6.5", alternative: "dispatch( 'core/editor').setIsListViewOpened" }); registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(isOpen); }; function updateSettings(settings) { return { type: "UPDATE_SETTINGS", settings }; } function setIsSaveViewOpened(isOpen) { return { type: "SET_IS_SAVE_VIEW_OPENED", isOpen }; } const revertTemplate = (template, options) => ({ registry }) => { return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).revertTemplate( template, options ); }; const openGeneralSidebar = (name) => ({ registry }) => { registry.dispatch(interfaceStore).enableComplementaryArea("core", name); }; const closeGeneralSidebar = () => ({ registry }) => { registry.dispatch(interfaceStore).disableComplementaryArea("core"); }; const switchEditorMode = (mode) => ({ registry }) => { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).switchEditorMode", { since: "6.6", alternative: "dispatch( 'core/editor').switchEditorMode" }); registry.dispatch(external_wp_editor_namespaceObject.store).switchEditorMode(mode); }; const setHasPageContentFocus = (hasPageContentFocus) => ({ dispatch, registry }) => { external_wp_deprecated_default()(`dispatch( 'core/edit-site' ).setHasPageContentFocus`, { since: "6.5" }); if (hasPageContentFocus) { registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); } dispatch({ type: "SET_HAS_PAGE_CONTENT_FOCUS", hasPageContentFocus }); }; const toggleDistractionFree = () => ({ registry }) => { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).toggleDistractionFree", { since: "6.6", alternative: "dispatch( 'core/editor').toggleDistractionFree" }); registry.dispatch(external_wp_editor_namespaceObject.store).toggleDistractionFree(); }; ;// ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js const setEditorCanvasContainerView = (view) => ({ dispatch }) => { dispatch({ type: "SET_EDITOR_CANVAS_CONTAINER_VIEW", view }); }; function registerRoute(route) { return { type: "REGISTER_ROUTE", route }; } function unregisterRoute(name) { return { type: "UNREGISTER_ROUTE", name }; } ;// ./node_modules/@wordpress/edit-site/build-module/utils/get-filtered-template-parts.js const EMPTY_ARRAY = []; function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) { const templatePartsById = templateParts ? ( // Key template parts by their ID. templateParts.reduce( (newTemplateParts, part) => ({ ...newTemplateParts, [part.id]: part }), {} ) ) : {}; const result = []; const stack = [...blocks]; while (stack.length) { const { innerBlocks, ...block } = stack.shift(); stack.unshift(...innerBlocks); if ((0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) { const { attributes: { theme, slug } } = block; const templatePartId = `${theme}//${slug}`; const templatePart = templatePartsById[templatePartId]; if (templatePart) { result.push({ templatePart, block }); } } } return result; } ;// ./node_modules/@wordpress/edit-site/build-module/store/selectors.js const isFeatureActive = (0,external_wp_data_.createRegistrySelector)( (select) => (_, featureName) => { external_wp_deprecated_default()(`select( 'core/edit-site' ).isFeatureActive`, { since: "6.0", alternative: `select( 'core/preferences' ).get` }); return !!select(external_wp_preferences_.store).get( "core/edit-site", featureName ); } ); const __experimentalGetPreviewDeviceType = (0,external_wp_data_.createRegistrySelector)( (select) => () => { external_wp_deprecated_default()( `select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, { since: "6.5", version: "6.7", alternative: `select( 'core/editor' ).getDeviceType` } ); return select(external_wp_editor_namespaceObject.store).getDeviceType(); } ); const getCanUserCreateMedia = (0,external_wp_data_.createRegistrySelector)( (select) => () => { external_wp_deprecated_default()( `wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`, { since: "6.7", alternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'postType', type: 'attachment' } )` } ); return select(external_wp_coreData_namespaceObject.store).canUser("create", "media"); } ); const getReusableBlocks = (0,external_wp_data_.createRegistrySelector)((select) => () => { external_wp_deprecated_default()(`select( 'core/edit-site' ).getReusableBlocks()`, { since: "6.5", version: "6.8", alternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )` }); const isWeb = external_wp_element_.Platform.OS === "web"; return isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords("postType", "wp_block", { per_page: -1 }) : []; }); function getSettings(state) { return state.settings; } function getHomeTemplateId() { external_wp_deprecated_default()("select( 'core/edit-site' ).getHomeTemplateId", { since: "6.2", version: "6.4" }); } function getEditedPostType(state) { external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostType", { since: "6.8", alternative: "select( 'core/editor' ).getCurrentPostType" }); return state.editedPost.postType; } function getEditedPostId(state) { external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostId", { since: "6.8", alternative: "select( 'core/editor' ).getCurrentPostId" }); return state.editedPost.id; } function getEditedPostContext(state) { external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostContext", { since: "6.8" }); return state.editedPost.context; } function getPage(state) { external_wp_deprecated_default()("select( 'core/edit-site' ).getPage", { since: "6.8" }); return { context: state.editedPost.context }; } const isInserterOpened = (0,external_wp_data_.createRegistrySelector)((select) => () => { external_wp_deprecated_default()(`select( 'core/edit-site' ).isInserterOpened`, { since: "6.5", alternative: `select( 'core/editor' ).isInserterOpened` }); return select(external_wp_editor_namespaceObject.store).isInserterOpened(); }); const __experimentalGetInsertionPoint = (0,external_wp_data_.createRegistrySelector)( (select) => () => { external_wp_deprecated_default()( `select( 'core/edit-site' ).__experimentalGetInsertionPoint`, { since: "6.5", version: "6.7" } ); return unlock(select(external_wp_editor_namespaceObject.store)).getInserter(); } ); const isListViewOpened = (0,external_wp_data_.createRegistrySelector)((select) => () => { external_wp_deprecated_default()(`select( 'core/edit-site' ).isListViewOpened`, { since: "6.5", alternative: `select( 'core/editor' ).isListViewOpened` }); return select(external_wp_editor_namespaceObject.store).isListViewOpened(); }); function isSaveViewOpened(state) { return state.saveViewPanel; } function getBlocksAndTemplateParts(select) { const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords( "postType", TEMPLATE_PART_POST_TYPE, { per_page: -1 } ); const { getBlocksByName, getBlocksByClientId } = select(external_wp_blockEditor_namespaceObject.store); const clientIds = getBlocksByName("core/template-part"); const blocks = getBlocksByClientId(clientIds); return [blocks, templateParts]; } const getCurrentTemplateTemplateParts = (0,external_wp_data_.createRegistrySelector)( (select) => (0,external_wp_data_.createSelector)( () => { external_wp_deprecated_default()( `select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`, { since: "6.7", version: "6.9", alternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )` } ); return getFilteredTemplatePartBlocks( ...getBlocksAndTemplateParts(select) ); }, () => getBlocksAndTemplateParts(select) ) ); const getEditorMode = (0,external_wp_data_.createRegistrySelector)((select) => () => { return select(external_wp_preferences_.store).get("core", "editorMode"); }); function getCurrentTemplateNavigationPanelSubMenu() { external_wp_deprecated_default()( "dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu", { since: "6.2", version: "6.4" } ); } function getNavigationPanelActiveMenu() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu", { since: "6.2", version: "6.4" }); } function isNavigationOpened() { external_wp_deprecated_default()("dispatch( 'core/edit-site' ).isNavigationOpened", { since: "6.2", version: "6.4" }); } function isPage(state) { external_wp_deprecated_default()("select( 'core/edit-site' ).isPage", { since: "6.8", alternative: "select( 'core/editor' ).getCurrentPostType" }); return !!state.editedPost.context?.postId; } function hasPageContentFocus() { external_wp_deprecated_default()(`select( 'core/edit-site' ).hasPageContentFocus`, { since: "6.5" }); return false; } ;// ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js function getEditorCanvasContainerView(state) { return state.editorCanvasContainerView; } function getRoutes(state) { return state.routes; } ;// ./node_modules/@wordpress/edit-site/build-module/store/constants.js const STORE_NAME = "core/edit-site"; ;// ./node_modules/@wordpress/edit-site/build-module/store/index.js const storeConfig = { reducer: reducer_default, actions: actions_namespaceObject, selectors: selectors_namespaceObject }; const store = (0,external_wp_data_.createReduxStore)(STORE_NAME, storeConfig); (0,external_wp_data_.register)(store); unlock(store).registerPrivateSelectors(private_selectors_namespaceObject); unlock(store).registerPrivateActions(private_actions_namespaceObject); ;// external ["wp","router"] const external_wp_router_namespaceObject = window["wp"]["router"]; ;// ./node_modules/clsx/dist/clsx.mjs function clsx_r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=clsx_r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=clsx_r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); ;// ./node_modules/@wordpress/admin-ui/build-module/navigable-region/index.js const NavigableRegion = (0,external_wp_element_.forwardRef)( ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Tag, { ref, className: dist_clsx("admin-ui-navigable-region", className), "aria-label": ariaLabel, role: "region", tabIndex: "-1", ...props, children } ); } ); NavigableRegion.displayName = "NavigableRegion"; var navigable_region_default = NavigableRegion; ;// external ["wp","plugins"] const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; ;// external ["wp","htmlEntities"] const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// ./node_modules/@wordpress/icons/build-module/library/search.js var search_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) }); ;// external ["wp","commands"] const external_wp_commands_namespaceObject = window["wp"]["commands"]; ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; ;// ./node_modules/@wordpress/icons/build-module/library/wordpress.js var wordpress_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" }) }); ;// ./node_modules/@wordpress/edit-site/build-module/components/site-icon/index.js function SiteIcon({ className }) { const { isRequestingSite, siteIconUrl } = (0,external_wp_data_.useSelect)((select) => { const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteData = getEntityRecord("root", "__unstableBase", void 0); return { isRequestingSite: !siteData, siteIconUrl: siteData?.site_icon_url }; }, []); if (isRequestingSite && !siteIconUrl) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-icon__image" }); } const icon = siteIconUrl ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { className: "edit-site-site-icon__image", alt: (0,external_wp_i18n_namespaceObject.__)("Site Icon"), src: siteIconUrl } ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Icon, { className: "edit-site-site-icon__icon", icon: wordpress_default, size: 48 } ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx(className, "edit-site-site-icon"), children: icon }); } var site_icon_default = SiteIcon; ;// external ["wp","dom"] const external_wp_dom_namespaceObject = window["wp"]["dom"]; ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar/index.js const SidebarNavigationContext = (0,external_wp_element_.createContext)(() => { }); SidebarNavigationContext.displayName = "SidebarNavigationContext"; function focusSidebarElement(el, direction, focusSelector) { let elementToFocus; if (direction === "back" && focusSelector) { elementToFocus = el.querySelector(focusSelector); } if (direction !== null && !elementToFocus) { const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(el); elementToFocus = firstTabbable ?? el; } elementToFocus?.focus(); } function createNavState() { let state = { direction: null, focusSelector: null }; return { get() { return state; }, navigate(direction, focusSelector = null) { state = { direction, focusSelector: direction === "forward" && focusSelector ? focusSelector : state.focusSelector }; } }; } function SidebarContentWrapper({ children, shouldAnimate }) { const navState = (0,external_wp_element_.useContext)(SidebarNavigationContext); const wrapperRef = (0,external_wp_element_.useRef)(); const [navAnimation, setNavAnimation] = (0,external_wp_element_.useState)(null); (0,external_wp_element_.useLayoutEffect)(() => { const { direction, focusSelector } = navState.get(); focusSidebarElement(wrapperRef.current, direction, focusSelector); setNavAnimation(direction); }, [navState]); const wrapperCls = dist_clsx( "edit-site-sidebar__screen-wrapper", /* * Some panes do not have sub-panes and therefore * should not animate when clicked on. */ shouldAnimate ? { "slide-from-left": navAnimation === "back", "slide-from-right": navAnimation === "forward" } : {} ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: wrapperRef, className: wrapperCls, children }); } function SidebarNavigationProvider({ children }) { const [navState] = (0,external_wp_element_.useState)(createNavState); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationContext.Provider, { value: navState, children }); } function SidebarContent({ routeKey, shouldAnimate, children }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar__content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarContentWrapper, { shouldAnimate, children }, routeKey ) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/site-hub/index.js const { useLocation, useHistory } = unlock(external_wp_router_namespaceObject.privateApis); const SiteHub = (0,external_wp_element_.memo)( (0,external_wp_element_.forwardRef)(({ isTransparent }, ref) => { const { dashboardLink, homeUrl, siteTitle } = (0,external_wp_data_.useSelect)((select) => { const { getSettings } = unlock(select(store)); const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const _site = getEntityRecord("root", "site"); return { dashboardLink: getSettings().__experimentalDashboardLink, homeUrl: getEntityRecord("root", "__unstableBase")?.home, siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title }; }, []); const { open: openCommandCenter } = (0,external_wp_data_.useDispatch)(external_wp_commands_namespaceObject.store); 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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx( "edit-site-site-hub__view-mode-toggle-container", { "has-transparent-background": isTransparent } ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ref, href: dashboardLink, label: (0,external_wp_i18n_namespaceObject.__)("Go to the Dashboard"), className: "edit-site-layout__view-mode-toggle", style: { transform: "scale(0.5333) translateX(-4px)", // Offset to position the icon 12px from viewport edge borderRadius: 4 }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon_default, { className: "edit-site-layout__view-mode-toggle-icon" }) } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub__title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", href: homeUrl, target: "_blank", children: [ (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", /* translators: accessibility text */ children: (0,external_wp_i18n_namespaceObject.__)("(opens in a new tab)") }) ] } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHStack, { spacing: 0, expanded: false, className: "edit-site-site-hub__actions", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", className: "edit-site-site-hub_toggle-command-center", icon: search_default, onClick: () => openCommandCenter(), label: (0,external_wp_i18n_namespaceObject.__)("Open command palette"), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary("k") } ) } ) ] }) ] }) }); }) ); var site_hub_default = SiteHub; const SiteHubMobile = (0,external_wp_element_.memo)( (0,external_wp_element_.forwardRef)(({ isTransparent }, ref) => { const { path } = useLocation(); const history = useHistory(); const { navigate } = (0,external_wp_element_.useContext)(SidebarNavigationContext); const { dashboardLink, homeUrl, siteTitle, isBlockTheme, isClassicThemeWithStyleBookSupport } = (0,external_wp_data_.useSelect)((select) => { const { getSettings } = unlock(select(store)); const { getEntityRecord, getCurrentTheme } = select(external_wp_coreData_namespaceObject.store); const _site = getEntityRecord("root", "site"); const currentTheme = getCurrentTheme(); const settings = getSettings(); const supportsEditorStyles = currentTheme.theme_supports["editor-styles"]; const hasThemeJson = settings.supportsLayout; return { dashboardLink: settings.__experimentalDashboardLink, homeUrl: getEntityRecord("root", "__unstableBase")?.home, siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title, isBlockTheme: currentTheme?.is_block_theme, isClassicThemeWithStyleBookSupport: !currentTheme?.is_block_theme && (supportsEditorStyles || hasThemeJson) }; }, []); const { open: openCommandCenter } = (0,external_wp_data_.useDispatch)(external_wp_commands_namespaceObject.store); let backPath; if (path !== "/") { if (isBlockTheme || isClassicThemeWithStyleBookSupport) { backPath = "/"; } else if (path !== "/pattern") { backPath = "/pattern"; } } const backButtonProps = { href: !!backPath ? void 0 : dashboardLink, label: !!backPath ? (0,external_wp_i18n_namespaceObject.__)("Go to Site Editor") : (0,external_wp_i18n_namespaceObject.__)("Go to the Dashboard"), onClick: !!backPath ? () => { history.navigate(backPath); navigate("back"); } : void 0 }; 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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx( "edit-site-site-hub__view-mode-toggle-container", { "has-transparent-background": isTransparent } ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ref, className: "edit-site-layout__view-mode-toggle", style: { transform: "scale(0.5)", borderRadius: 4 }, ...backButtonProps, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon_default, { className: "edit-site-layout__view-mode-toggle-icon" }) } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub__title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "link", href: homeUrl, target: "_blank", label: (0,external_wp_i18n_namespaceObject.__)("View site (opens in a new tab)"), children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHStack, { spacing: 0, expanded: false, className: "edit-site-site-hub__actions", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "edit-site-site-hub_toggle-command-center", icon: search_default, onClick: () => openCommandCenter(), label: (0,external_wp_i18n_namespaceObject.__)("Open command palette"), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary("k") } ) } ) ] }) ] }) }); }) ); ;// ./node_modules/@wordpress/edit-site/build-module/components/resizable-frame/index.js const { useLocation: resizable_frame_useLocation, useHistory: resizable_frame_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); const HANDLE_STYLES_OVERRIDE = { position: void 0, userSelect: void 0, cursor: void 0, width: void 0, height: void 0, top: void 0, right: void 0, bottom: void 0, left: void 0 }; const FRAME_MIN_WIDTH = 320; const FRAME_REFERENCE_WIDTH = 1300; const FRAME_TARGET_ASPECT_RATIO = 9 / 19.5; const SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200; const INITIAL_FRAME_SIZE = { width: "100%", height: "100%" }; function calculateNewHeight(width, initialAspectRatio) { const lerp = (a, b, amount) => { return a + (b - a) * amount; }; const lerpFactor = 1 - Math.max( 0, Math.min( 1, (width - FRAME_MIN_WIDTH) / (FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH) ) ); const intermediateAspectRatio = lerp( initialAspectRatio, FRAME_TARGET_ASPECT_RATIO, lerpFactor ); return width / intermediateAspectRatio; } function ResizableFrame({ isFullWidth, isOversized, setIsOversized, isReady, children, /** The default (unresized) width/height of the frame, based on the space available in the viewport. */ defaultSize, innerContentStyle }) { const history = resizable_frame_useHistory(); const { path, query } = resizable_frame_useLocation(); const { canvas = "view" } = query; const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const [frameSize, setFrameSize] = (0,external_wp_element_.useState)(INITIAL_FRAME_SIZE); const [startingWidth, setStartingWidth] = (0,external_wp_element_.useState)(); const [isResizing, setIsResizing] = (0,external_wp_element_.useState)(false); const [shouldShowHandle, setShouldShowHandle] = (0,external_wp_element_.useState)(false); const [resizeRatio, setResizeRatio] = (0,external_wp_element_.useState)(1); const FRAME_TRANSITION = { type: "tween", duration: isResizing ? 0 : 0.5 }; const frameRef = (0,external_wp_element_.useRef)(null); const resizableHandleHelpId = (0,external_wp_compose_namespaceObject.useInstanceId)( ResizableFrame, "edit-site-resizable-frame-handle-help" ); const defaultAspectRatio = defaultSize.width / defaultSize.height; const isBlockTheme = (0,external_wp_data_.useSelect)((select) => { const { getCurrentTheme } = select(external_wp_coreData_namespaceObject.store); return getCurrentTheme()?.is_block_theme; }, []); const handleResizeStart = (_event, _direction, ref) => { setStartingWidth(ref.offsetWidth); setIsResizing(true); }; const handleResize = (_event, _direction, _ref, delta) => { const normalizedDelta = delta.width / resizeRatio; const deltaAbs = Math.abs(normalizedDelta); const maxDoubledDelta = delta.width < 0 ? deltaAbs : (defaultSize.width - startingWidth) / 2; const deltaToDouble = Math.min(deltaAbs, maxDoubledDelta); const doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs; const singleSegment = 1 - doubleSegment; setResizeRatio(singleSegment + doubleSegment * 2); const updatedWidth = startingWidth + delta.width; setIsOversized(updatedWidth > defaultSize.width); setFrameSize({ height: isOversized ? "100%" : calculateNewHeight(updatedWidth, defaultAspectRatio) }); }; const handleResizeStop = (_event, _direction, ref) => { setIsResizing(false); if (!isOversized) { return; } setIsOversized(false); const remainingWidth = ref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth; if (remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD || !isBlockTheme) { setFrameSize(INITIAL_FRAME_SIZE); } else { history.navigate( (0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: "edit" }), { transition: "canvas-mode-edit-transition" } ); } }; const handleResizableHandleKeyDown = (event) => { if (!["ArrowLeft", "ArrowRight"].includes(event.key)) { return; } event.preventDefault(); const step = 20 * (event.shiftKey ? 5 : 1); const delta = step * (event.key === "ArrowLeft" ? 1 : -1) * ((0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1); const newWidth = Math.min( Math.max( FRAME_MIN_WIDTH, frameRef.current.resizable.offsetWidth + delta ), defaultSize.width ); setFrameSize({ width: newWidth, height: calculateNewHeight(newWidth, defaultAspectRatio) }); }; const frameAnimationVariants = { default: { flexGrow: 0, height: frameSize.height }, fullWidth: { flexGrow: 1, height: frameSize.height } }; const resizeHandleVariants = { hidden: { opacity: 0, ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: 0 } : { left: 0 } }, visible: { opacity: 1, // Account for the handle's width. ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: -14 } : { left: -14 } }, active: { opacity: 1, // Account for the handle's width. ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: -14 } : { left: -14 }, scaleY: 1.3 } }; const currentResizeHandleVariant = (() => { if (isResizing) { return "active"; } return shouldShowHandle ? "visible" : "hidden"; })(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ResizableBox, { as: external_wp_components_namespaceObject.__unstableMotion.div, ref: frameRef, initial: false, variants: frameAnimationVariants, animate: isFullWidth ? "fullWidth" : "default", onAnimationComplete: (definition) => { if (definition === "fullWidth") { setFrameSize({ width: "100%", height: "100%" }); } }, whileHover: canvas === "view" && isBlockTheme ? { scale: 1.005, transition: { duration: disableMotion ? 0 : 0.5, ease: "easeOut" } } : {}, transition: FRAME_TRANSITION, size: frameSize, enable: { top: false, bottom: false, // Resizing will be disabled until the editor content is loaded. ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: isReady, left: false } : { left: isReady, right: false }, topRight: false, bottomRight: false, bottomLeft: false, topLeft: false }, resizeRatio, handleClasses: void 0, handleStyles: { left: HANDLE_STYLES_OVERRIDE, right: HANDLE_STYLES_OVERRIDE }, minWidth: FRAME_MIN_WIDTH, maxWidth: isFullWidth ? "100%" : "150%", maxHeight: "100%", onFocus: () => setShouldShowHandle(true), onBlur: () => setShouldShowHandle(false), onMouseOver: () => setShouldShowHandle(true), onMouseOut: () => setShouldShowHandle(false), handleComponent: { [(0,external_wp_i18n_namespaceObject.isRTL)() ? "right" : "left"]: canvas === "view" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__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)( external_wp_components_namespaceObject.__unstableMotion.button, { role: "separator", "aria-orientation": "vertical", className: dist_clsx( "edit-site-resizable-frame__handle", { "is-resizing": isResizing } ), variants: resizeHandleVariants, animate: currentResizeHandleVariant, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Drag to resize"), "aria-describedby": resizableHandleHelpId, "aria-valuenow": frameRef.current?.resizable?.offsetWidth || void 0, "aria-valuemin": FRAME_MIN_WIDTH, "aria-valuemax": defaultSize.width, onKeyDown: handleResizableHandleKeyDown, initial: "hidden", exit: "hidden", whileFocus: "active", whileHover: "active" }, "handle" ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { hidden: true, id: resizableHandleHelpId, children: (0,external_wp_i18n_namespaceObject.__)( "Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments." ) }) ] }) }, onResizeStart: handleResizeStart, onResize: handleResize, onResizeStop: handleResizeStop, className: dist_clsx("edit-site-resizable-frame__inner", { "is-resizing": isResizing }), showHandle: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "edit-site-resizable-frame__inner-content", style: innerContentStyle, children } ) } ); } var resizable_frame_default = ResizableFrame; ;// external ["wp","keyboardShortcuts"] const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; ;// ./node_modules/@wordpress/edit-site/build-module/components/save-keyboard-shortcut/index.js const shortcutName = "core/edit-site/save"; function SaveKeyboardShortcut() { const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = (0,external_wp_data_.useSelect)(external_wp_coreData_namespaceObject.store); const { hasNonPostEntityChanges, isPostSavingLocked } = (0,external_wp_data_.useSelect)(external_wp_editor_namespaceObject.store); const { savePost } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store); const { setIsSaveViewOpened } = (0,external_wp_data_.useDispatch)(store); const { registerShortcut, unregisterShortcut } = (0,external_wp_data_.useDispatch)( external_wp_keyboardShortcuts_namespaceObject.store ); (0,external_wp_element_.useEffect)(() => { registerShortcut({ name: shortcutName, category: "global", description: (0,external_wp_i18n_namespaceObject.__)("Save your changes."), keyCombination: { modifier: "primary", character: "s" } }); return () => { unregisterShortcut(shortcutName); }; }, [registerShortcut, unregisterShortcut]); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/edit-site/save", (event) => { event.preventDefault(); const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); const hasDirtyEntities = !!dirtyEntityRecords.length; const isSaving = dirtyEntityRecords.some( (record) => isSavingEntityRecord(record.kind, record.name, record.key) ); if (!hasDirtyEntities || isSaving) { return; } if (hasNonPostEntityChanges()) { setIsSaveViewOpened(true); } else if (!isPostSavingLocked()) { savePost(); } }); return null; } ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/hooks.js const MAX_LOADING_TIME = 1e4; function useIsSiteEditorLoading() { const [loaded, setLoaded] = (0,external_wp_element_.useState)(false); const inLoadingPause = (0,external_wp_data_.useSelect)( (select) => { const hasResolvingSelectors = select(external_wp_coreData_namespaceObject.store).hasResolvingSelectors(); return !loaded && !hasResolvingSelectors; }, [loaded] ); (0,external_wp_element_.useEffect)(() => { let timeout; if (!loaded) { timeout = setTimeout(() => { setLoaded(true); }, MAX_LOADING_TIME); } return () => { clearTimeout(timeout); }; }, [loaded]); (0,external_wp_element_.useEffect)(() => { if (inLoadingPause) { const ARTIFICIAL_DELAY = 100; const timeout = setTimeout(() => { setLoaded(true); }, ARTIFICIAL_DELAY); return () => { clearTimeout(timeout); }; } }, [inLoadingPause]); return !loaded; } ;// ./node_modules/@react-spring/rafz/dist/esm/index.js var esm_f=esm_l(),esm_n=e=>esm_c(e,esm_f),esm_m=esm_l();esm_n.write=e=>esm_c(e,esm_m);var esm_d=esm_l();esm_n.onStart=e=>esm_c(e,esm_d);var esm_h=esm_l();esm_n.onFrame=e=>esm_c(e,esm_h);var esm_p=esm_l();esm_n.onFinish=e=>esm_c(e,esm_p);var esm_i=[];esm_n.setTimeout=(e,t)=>{let a=esm_n.now()+t,o=()=>{let F=esm_i.findIndex(z=>z.cancel==o);~F&&esm_i.splice(F,1),esm_u-=~F?1:0},s={time:a,handler:e,cancel:o};return esm_i.splice(esm_w(a),0,s),esm_u+=1,esm_v(),s};var esm_w=e=>~(~esm_i.findIndex(t=>t.time>e)||~esm_i.length);esm_n.cancel=e=>{esm_d.delete(e),esm_h.delete(e),esm_p.delete(e),esm_f.delete(e),esm_m.delete(e)};esm_n.sync=e=>{T=!0,esm_n.batchedUpdates(e),T=!1};esm_n.throttle=e=>{let t;function a(){try{e(...t)}finally{t=null}}function o(...s){t=s,esm_n.onStart(a)}return o.handler=e,o.cancel=()=>{esm_d.delete(a),t=null},o};var esm_y=typeof window<"u"?window.requestAnimationFrame:()=>{};esm_n.use=e=>esm_y=e;esm_n.now=typeof performance<"u"?()=>performance.now():Date.now;esm_n.batchedUpdates=e=>e();esm_n.catch=console.error;esm_n.frameLoop="always";esm_n.advance=()=>{esm_n.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):esm_x()};var esm_r=-1,esm_u=0,T=!1;function esm_c(e,t){T?(t.delete(e),e(0)):(t.add(e),esm_v())}function esm_v(){esm_r<0&&(esm_r=0,esm_n.frameLoop!=="demand"&&esm_y(esm_b))}function esm_R(){esm_r=-1}function esm_b(){~esm_r&&(esm_y(esm_b),esm_n.batchedUpdates(esm_x))}function esm_x(){let e=esm_r;esm_r=esm_n.now();let t=esm_w(esm_r);if(t&&(Q(esm_i.splice(0,t),a=>a.handler()),esm_u-=t),!esm_u){esm_R();return}esm_d.flush(),esm_f.flush(e?Math.min(64,esm_r-e):16.667),esm_h.flush(),esm_m.flush(),esm_p.flush()}function esm_l(){let e=new Set,t=e;return{add(a){esm_u+=t==e&&!e.has(a)?1:0,e.add(a)},delete(a){return esm_u-=t==e&&e.has(a)?1:0,e.delete(a)},flush(a){t.size&&(e=new Set,esm_u-=t.size,Q(t,o=>o(a)&&e.add(o)),esm_u+=e.size,t=e)}}}function Q(e,t){e.forEach(a=>{try{t(a)}catch(o){esm_n.catch(o)}})}var esm_S={count(){return esm_u},isRunning(){return esm_r>=0},clear(){esm_r=-1,esm_i=[],esm_d=esm_l(),esm_f=esm_l(),esm_h=esm_l(),esm_m=esm_l(),esm_p=esm_l(),esm_u=0}}; // EXTERNAL MODULE: external "React" var external_React_ = __webpack_require__(1609); var external_React_namespaceObject = /*#__PURE__*/__webpack_require__.t(external_React_, 2); ;// ./node_modules/@react-spring/shared/dist/esm/index.js var ze=Object.defineProperty;var Le=(e,t)=>{for(var r in t)ze(e,r,{get:t[r],enumerable:!0})};var dist_esm_p={};Le(dist_esm_p,{assign:()=>U,colors:()=>dist_esm_c,createStringInterpolator:()=>esm_k,skipAnimation:()=>ee,to:()=>J,willAdvance:()=>dist_esm_S});function Y(){}var mt=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0}),dist_esm_l={arr:Array.isArray,obj:e=>!!e&&e.constructor.name==="Object",fun:e=>typeof e=="function",str:e=>typeof e=="string",num:e=>typeof e=="number",und:e=>e===void 0};function bt(e,t){if(dist_esm_l.arr(e)){if(!dist_esm_l.arr(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return e===t}var esm_Ve=(e,t)=>e.forEach(t);function xt(e,t,r){if(dist_esm_l.arr(e)){for(let n=0;n<e.length;n++)t.call(r,e[n],`${n}`);return}for(let n in e)e.hasOwnProperty(n)&&t.call(r,e[n],n)}var ht=e=>dist_esm_l.und(e)?[]:dist_esm_l.arr(e)?e:[e];function Pe(e,t){if(e.size){let r=Array.from(e);e.clear(),esm_Ve(r,t)}}var yt=(e,...t)=>Pe(e,r=>r(...t)),dist_esm_h=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);var esm_k,J,dist_esm_c=null,ee=!1,dist_esm_S=Y,U=e=>{e.to&&(J=e.to),e.now&&(esm_n.now=e.now),e.colors!==void 0&&(dist_esm_c=e.colors),e.skipAnimation!=null&&(ee=e.skipAnimation),e.createStringInterpolator&&(esm_k=e.createStringInterpolator),e.requestAnimationFrame&&esm_n.use(e.requestAnimationFrame),e.batchedUpdates&&(esm_n.batchedUpdates=e.batchedUpdates),e.willAdvance&&(dist_esm_S=e.willAdvance),e.frameLoop&&(esm_n.frameLoop=e.frameLoop)};var esm_E=new Set,dist_esm_u=[],esm_H=[],A=0,qe={get idle(){return!esm_E.size&&!dist_esm_u.length},start(e){A>e.priority?(esm_E.add(e),esm_n.onStart($e)):(te(e),esm_n(B))},advance:B,sort(e){if(A)esm_n.onFrame(()=>qe.sort(e));else{let t=dist_esm_u.indexOf(e);~t&&(dist_esm_u.splice(t,1),re(e))}},clear(){dist_esm_u=[],esm_E.clear()}};function $e(){esm_E.forEach(te),esm_E.clear(),esm_n(B)}function te(e){dist_esm_u.includes(e)||re(e)}function re(e){dist_esm_u.splice(Ge(dist_esm_u,t=>t.priority>e.priority),0,e)}function B(e){let t=esm_H;for(let r=0;r<dist_esm_u.length;r++){let n=dist_esm_u[r];A=n.priority,n.idle||(dist_esm_S(n),n.advance(e),n.idle||t.push(n))}return A=0,esm_H=dist_esm_u,esm_H.length=0,dist_esm_u=t,dist_esm_u.length>0}function Ge(e,t){let r=e.findIndex(t);return r<0?e.length:r}var ne=(e,t,r)=>Math.min(Math.max(r,e),t);var It={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};var dist_esm_d="[-+]?\\d*\\.?\\d+",esm_M=dist_esm_d+"%";function C(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var oe=new RegExp("rgb"+C(dist_esm_d,dist_esm_d,dist_esm_d)),fe=new RegExp("rgba"+C(dist_esm_d,dist_esm_d,dist_esm_d,dist_esm_d)),ae=new RegExp("hsl"+C(dist_esm_d,esm_M,esm_M)),ie=new RegExp("hsla"+C(dist_esm_d,esm_M,esm_M,dist_esm_d)),se=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ue=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,le=/^#([0-9a-fA-F]{6})$/,esm_ce=/^#([0-9a-fA-F]{8})$/;function be(e){let t;return typeof e=="number"?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=le.exec(e))?parseInt(t[1]+"ff",16)>>>0:dist_esm_c&&dist_esm_c[e]!==void 0?dist_esm_c[e]:(t=oe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|255)>>>0:(t=fe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|me(t[4]))>>>0:(t=se.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=esm_ce.exec(e))?parseInt(t[1],16)>>>0:(t=ue.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=ae.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|255)>>>0:(t=ie.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|me(t[4]))>>>0:null}function esm_j(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function de(e,t,r){let n=r<.5?r*(1+t):r+t-r*t,f=2*r-n,o=esm_j(f,n,e+1/3),i=esm_j(f,n,e),s=esm_j(f,n,e-1/3);return Math.round(o*255)<<24|Math.round(i*255)<<16|Math.round(s*255)<<8}function dist_esm_y(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function esm_pe(e){return(parseFloat(e)%360+360)%360/360}function me(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function esm_z(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function D(e){let t=be(e);if(t===null)return e;t=t||0;let r=(t&4278190080)>>>24,n=(t&16711680)>>>16,f=(t&65280)>>>8,o=(t&255)/255;return`rgba(${r}, ${n}, ${f}, ${o})`}var W=(e,t,r)=>{if(dist_esm_l.fun(e))return e;if(dist_esm_l.arr(e))return W({range:e,output:t,extrapolate:r});if(dist_esm_l.str(e.output[0]))return esm_k(e);let n=e,f=n.output,o=n.range||[0,1],i=n.extrapolateLeft||n.extrapolate||"extend",s=n.extrapolateRight||n.extrapolate||"extend",x=n.easing||(a=>a);return a=>{let F=He(a,o);return Ue(a,o[F],o[F+1],f[F],f[F+1],x,i,s,n.map)}};function Ue(e,t,r,n,f,o,i,s,x){let a=x?x(e):e;if(a<t){if(i==="identity")return a;i==="clamp"&&(a=t)}if(a>r){if(s==="identity")return a;s==="clamp"&&(a=r)}return n===f?n:t===r?e<=t?n:f:(t===-1/0?a=-a:r===1/0?a=a-t:a=(a-t)/(r-t),a=o(a),n===-1/0?a=-a:f===1/0?a=a+n:a=a*(f-n)+n,a)}function He(e,t){for(var r=1;r<t.length-1&&!(t[r]>=e);++r);return r-1}var Be=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);let n=r*e,f=t==="end"?Math.floor(n):Math.ceil(n);return ne(0,1,f/e)},P=1.70158,L=P*1.525,xe=P+1,he=2*Math.PI/3,ye=2*Math.PI/4.5,V=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Lt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:Math.pow(2,10*e-10),easeOutExpo:e=>e===1?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>xe*e*e*e-P*e*e,easeOutBack:e=>1+xe*Math.pow(e-1,3)+P*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*((L+1)*2*e-L)/2:(Math.pow(2*e-2,2)*((L+1)*(e*2-2)+L)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*he),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*he)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*ye))/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*ye)/2+1,easeInBounce:e=>1-V(1-e),easeOutBounce:V,easeInOutBounce:e=>e<.5?(1-V(1-2*e))/2:(1+V(2*e-1))/2,steps:Be};var esm_g=Symbol.for("FluidValue.get"),dist_esm_m=Symbol.for("FluidValue.observers");var Pt=e=>Boolean(e&&e[esm_g]),ve=e=>e&&e[esm_g]?e[esm_g]():e,esm_qt=e=>e[dist_esm_m]||null;function je(e,t){e.eventObserved?e.eventObserved(t):e(t)}function $t(e,t){let r=e[dist_esm_m];r&&r.forEach(n=>{je(n,t)})}var esm_ge=class{[esm_g];[dist_esm_m];constructor(t){if(!t&&!(t=this.get))throw Error("Unknown getter");De(this,t)}},De=(e,t)=>Ee(e,esm_g,t);function Gt(e,t){if(e[esm_g]){let r=e[dist_esm_m];r||Ee(e,dist_esm_m,r=new Set),r.has(t)||(r.add(t),e.observerAdded&&e.observerAdded(r.size,t))}return t}function Qt(e,t){let r=e[dist_esm_m];if(r&&r.has(t)){let n=r.size-1;n?r.delete(t):e[dist_esm_m]=null,e.observerRemoved&&e.observerRemoved(n,t)}}var Ee=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0});var O=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,esm_Oe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,K=new RegExp(`(${O.source})(%|[a-z]+)`,"i"),we=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,dist_esm_b=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;var esm_N=e=>{let[t,r]=We(e);if(!t||dist_esm_h())return e;let n=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(n)return n.trim();if(r&&r.startsWith("--")){let f=window.getComputedStyle(document.documentElement).getPropertyValue(r);return f||e}else{if(r&&dist_esm_b.test(r))return esm_N(r);if(r)return r}return e},We=e=>{let t=dist_esm_b.exec(e);if(!t)return[,];let[,r,n]=t;return[r,n]};var _,esm_Ke=(e,t,r,n,f)=>`rgba(${Math.round(t)}, ${Math.round(r)}, ${Math.round(n)}, ${f})`,Xt=e=>{_||(_=dist_esm_c?new RegExp(`(${Object.keys(dist_esm_c).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map(o=>ve(o).replace(dist_esm_b,esm_N).replace(esm_Oe,D).replace(_,D)),r=t.map(o=>o.match(O).map(Number)),f=r[0].map((o,i)=>r.map(s=>{if(!(i in s))throw Error('The arity of each "output" value must be equal');return s[i]})).map(o=>W({...e,output:o}));return o=>{let i=!K.test(t[0])&&t.find(x=>K.test(x))?.replace(O,""),s=0;return t[0].replace(O,()=>`${f[s++](o)}${i||""}`).replace(we,esm_Ke)}};var Z="react-spring: ",Te=e=>{let t=e,r=!1;if(typeof t!="function")throw new TypeError(`${Z}once requires a function parameter`);return(...n)=>{r||(t(...n),r=!0)}},Ne=Te(console.warn);function Jt(){Ne(`${Z}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var _e=Te(console.warn);function er(){_e(`${Z}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function esm_or(e){return dist_esm_l.str(e)&&(e[0]=="#"||/\d/.test(e)||!dist_esm_h()&&dist_esm_b.test(e)||e in(dist_esm_c||{}))}var dist_esm_v,q=new WeakMap,Ze=e=>e.forEach(({target:t,contentRect:r})=>q.get(t)?.forEach(n=>n(r)));function Fe(e,t){dist_esm_v||typeof ResizeObserver<"u"&&(dist_esm_v=new ResizeObserver(Ze));let r=q.get(t);return r||(r=new Set,q.set(t,r)),r.add(e),dist_esm_v&&dist_esm_v.observe(t),()=>{let n=q.get(t);!n||(n.delete(e),!n.size&&dist_esm_v&&dist_esm_v.unobserve(t))}}var esm_$=new Set,dist_esm_w,esm_Xe=()=>{let e=()=>{esm_$.forEach(t=>t({width:window.innerWidth,height:window.innerHeight}))};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},Ie=e=>(esm_$.add(e),dist_esm_w||(dist_esm_w=esm_Xe()),()=>{esm_$.delete(e),!esm_$.size&&dist_esm_w&&(dist_esm_w(),dist_esm_w=void 0)});var ke=(e,{container:t=document.documentElement}={})=>t===document.documentElement?Ie(e):Fe(e,t);var Se=(e,t,r)=>t-e===0?1:(r-e)/(t-e);var esm_Ye={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}},esm_G=class{callback;container;info;constructor(t,r){this.callback=t,this.container=r,this.info={time:0,x:this.createAxis(),y:this.createAxis()}}createAxis=()=>({current:0,progress:0,scrollLength:0});updateAxis=t=>{let r=this.info[t],{length:n,position:f}=esm_Ye[t];r.current=this.container[`scroll${f}`],r.scrollLength=this.container["scroll"+n]-this.container["client"+n],r.progress=Se(0,r.scrollLength,r.current)};update=()=>{this.updateAxis("x"),this.updateAxis("y")};sendEvent=()=>{this.callback(this.info)};advance=()=>{this.update(),this.sendEvent()}};var esm_T=new WeakMap,Ae=new WeakMap,X=new WeakMap,Me=e=>e===document.documentElement?window:e,yr=(e,{container:t=document.documentElement}={})=>{let r=X.get(t);r||(r=new Set,X.set(t,r));let n=new esm_G(e,t);if(r.add(n),!esm_T.has(t)){let o=()=>(r?.forEach(s=>s.advance()),!0);esm_T.set(t,o);let i=Me(t);window.addEventListener("resize",o,{passive:!0}),t!==document.documentElement&&Ae.set(t,ke(o,{container:t})),i.addEventListener("scroll",o,{passive:!0})}let f=esm_T.get(t);return Re(f),()=>{Re.cancel(f);let o=X.get(t);if(!o||(o.delete(n),o.size))return;let i=esm_T.get(t);esm_T.delete(t),i&&(Me(t).removeEventListener("scroll",i),window.removeEventListener("resize",i),Ae.get(t)?.())}};function Er(e){let t=Je(null);return t.current===null&&(t.current=e()),t.current}var esm_Q=dist_esm_h()?external_React_.useEffect:external_React_.useLayoutEffect;var Ce=()=>{let e=(0,external_React_.useRef)(!1);return esm_Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function Mr(){let e=(0,external_React_.useState)()[1],t=Ce();return()=>{t.current&&e(Math.random())}}function Lr(e,t){let[r]=(0,external_React_.useState)(()=>({inputs:t,result:e()})),n=(0,external_React_.useRef)(),f=n.current,o=f;return o?Boolean(t&&o.inputs&&it(t,o.inputs))||(o={inputs:t,result:e()}):o=r,(0,external_React_.useEffect)(()=>{n.current=o,f==r&&(r.inputs=r.result=void 0)},[o]),o.result}function it(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var $r=e=>(0,external_React_.useEffect)(e,ut),ut=[];function Ur(e){let t=ct();return lt(()=>{t.current=e}),t.current}var Wr=()=>{let[e,t]=dt(null);return esm_Q(()=>{let r=window.matchMedia("(prefers-reduced-motion)"),n=f=>{t(f.matches),U({skipAnimation:f.matches})};return n(r),r.addEventListener("change",n),()=>{r.removeEventListener("change",n)}},[]),e}; ;// ./node_modules/@react-spring/animated/dist/esm/index.js var animated_dist_esm_h=Symbol.for("Animated:node"),animated_dist_esm_v=e=>!!e&&e[animated_dist_esm_h]===e,dist_esm_k=e=>e&&e[animated_dist_esm_h],esm_D=(e,t)=>mt(e,animated_dist_esm_h,t),F=e=>e&&e[animated_dist_esm_h]&&e[animated_dist_esm_h].getPayload(),animated_dist_esm_c=class{payload;constructor(){esm_D(this,this)}getPayload(){return this.payload||[]}};var animated_dist_esm_l=class extends animated_dist_esm_c{constructor(r){super();this._value=r;dist_esm_l.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(r){return new animated_dist_esm_l(r)}getPayload(){return[this]}getValue(){return this._value}setValue(r,n){return dist_esm_l.num(r)&&(this.lastPosition=r,n&&(r=Math.round(r/n)*n,this.done&&(this.lastPosition=r))),this._value===r?!1:(this._value=r,!0)}reset(){let{done:r}=this;this.done=!1,dist_esm_l.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,r&&(this.lastVelocity=null),this.v0=null)}};var animated_dist_esm_d=class extends animated_dist_esm_l{_string=null;_toString;constructor(t){super(0),this._toString=W({output:[t,t]})}static create(t){return new animated_dist_esm_d(t)}getValue(){let t=this._string;return t??(this._string=this._toString(this._value))}setValue(t){if(dist_esm_l.str(t)){if(t==this._string)return!1;this._string=t,this._value=1}else if(super.setValue(t))this._string=null;else return!1;return!0}reset(t){t&&(this._toString=W({output:[this.getValue(),t]})),this._value=0,super.reset()}};var dist_esm_f={dependencies:null};var animated_dist_esm_u=class extends animated_dist_esm_c{constructor(r){super();this.source=r;this.setValue(r)}getValue(r){let n={};return xt(this.source,(a,i)=>{animated_dist_esm_v(a)?n[i]=a.getValue(r):Pt(a)?n[i]=ve(a):r||(n[i]=a)}),n}setValue(r){this.source=r,this.payload=this._makePayload(r)}reset(){this.payload&&esm_Ve(this.payload,r=>r.reset())}_makePayload(r){if(r){let n=new Set;return xt(r,this._addToPayload,n),Array.from(n)}}_addToPayload(r){dist_esm_f.dependencies&&Pt(r)&&dist_esm_f.dependencies.add(r);let n=F(r);n&&esm_Ve(n,a=>this.add(a))}};var animated_dist_esm_y=class extends animated_dist_esm_u{constructor(t){super(t)}static create(t){return new animated_dist_esm_y(t)}getValue(){return this.source.map(t=>t.getValue())}setValue(t){let r=this.getPayload();return t.length==r.length?r.map((n,a)=>n.setValue(t[a])).some(Boolean):(super.setValue(t.map(dist_esm_z)),!0)}};function dist_esm_z(e){return(esm_or(e)?animated_dist_esm_d:animated_dist_esm_l).create(e)}function esm_Le(e){let t=dist_esm_k(e);return t?t.constructor:dist_esm_l.arr(e)?animated_dist_esm_y:esm_or(e)?animated_dist_esm_d:animated_dist_esm_l}var dist_esm_x=(e,t)=>{let r=!dist_esm_l.fun(e)||e.prototype&&e.prototype.isReactComponent;return (0,external_React_.forwardRef)((n,a)=>{let i=(0,external_React_.useRef)(null),o=r&&(0,external_React_.useCallback)(s=>{i.current=esm_ae(a,s)},[a]),[m,T]=esm_ne(n,t),W=Mr(),P=()=>{let s=i.current;if(r&&!s)return;(s?t.applyAnimatedValues(s,m.getValue(!0)):!1)===!1&&W()},_=new animated_dist_esm_b(P,T),p=(0,external_React_.useRef)();esm_Q(()=>(p.current=_,esm_Ve(T,s=>Gt(s,_)),()=>{p.current&&(esm_Ve(p.current.deps,s=>Qt(s,p.current)),esm_n.cancel(p.current.update))})),(0,external_React_.useEffect)(P,[]),$r(()=>()=>{let s=p.current;esm_Ve(s.deps,S=>Qt(S,s))});let $=t.getComponentProps(m.getValue());return external_React_.createElement(e,{...$,ref:o})})},animated_dist_esm_b=class{constructor(t,r){this.update=t;this.deps=r}eventObserved(t){t.type=="change"&&esm_n.write(this.update)}};function esm_ne(e,t){let r=new Set;return dist_esm_f.dependencies=r,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new animated_dist_esm_u(e),dist_esm_f.dependencies=null,[e,r]}function esm_ae(e,t){return e&&(dist_esm_l.fun(e)?e(t):e.current=t),t}var dist_esm_j=Symbol.for("AnimatedComponent"),dist_esm_Ke=(e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:r=a=>new animated_dist_esm_u(a),getComponentProps:n=a=>a}={})=>{let a={applyAnimatedValues:t,createAnimatedStyle:r,getComponentProps:n},i=o=>{let m=esm_I(o)||"Anonymous";return dist_esm_l.str(o)?o=i[o]||(i[o]=dist_esm_x(o,a)):o=o[dist_esm_j]||(o[dist_esm_j]=dist_esm_x(o,a)),o.displayName=`Animated(${m})`,o};return xt(e,(o,m)=>{dist_esm_l.arr(e)&&(m=esm_I(o)),i[m]=i(o)}),{animated:i}},esm_I=e=>dist_esm_l.str(e)?e:e&&dist_esm_l.str(e.displayName)?e.displayName:dist_esm_l.fun(e)&&e.name||null; ;// ./node_modules/@react-spring/core/dist/esm/index.js function dist_esm_I(t,...e){return dist_esm_l.fun(t)?t(...e):t}var esm_te=(t,e)=>t===!0||!!(e&&t&&(dist_esm_l.fun(t)?t(e):ht(t).includes(e))),et=(t,e)=>dist_esm_l.obj(t)?e&&t[e]:t;var esm_ke=(t,e)=>t.default===!0?t[e]:t.default?t.default[e]:void 0,nn=t=>t,dist_esm_ne=(t,e=nn)=>{let n=rn;t.default&&t.default!==!0&&(t=t.default,n=Object.keys(t));let r={};for(let o of n){let s=e(t[o],o);dist_esm_l.und(s)||(r[o]=s)}return r},rn=["config","onProps","onStart","onChange","onPause","onResume","onRest"],on={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function sn(t){let e={},n=0;if(xt(t,(r,o)=>{on[o]||(e[o]=r,n++)}),n)return e}function esm_de(t){let e=sn(t);if(e){let n={to:e};return xt(t,(r,o)=>o in e||(n[o]=r)),n}return{...t}}function esm_me(t){return t=ve(t),dist_esm_l.arr(t)?t.map(esm_me):esm_or(t)?dist_esm_p.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function esm_Ue(t){for(let e in t)return!0;return!1}function esm_Ee(t){return dist_esm_l.fun(t)||dist_esm_l.arr(t)&&dist_esm_l.obj(t[0])}function esm_xe(t,e){t.ref?.delete(t),e?.delete(t)}function esm_he(t,e){e&&t.ref!==e&&(t.ref?.delete(t),e.add(t),t.ref=e)}function wr(t,e,n=1e3){an(()=>{if(e){let r=0;ge(t,(o,s)=>{let a=o.current;if(a.length){let i=n*e[s];isNaN(i)?i=r:r=i,ge(a,u=>{ge(u.queue,p=>{let f=p.delay;p.delay=d=>i+dist_esm_I(f||0,d)})}),o.start()}})}else{let r=Promise.resolve();ge(t,o=>{let s=o.current;if(s.length){let a=s.map(i=>{let u=i.queue;return i.queue=[],u});r=r.then(()=>(ge(s,(i,u)=>ge(a[u]||[],p=>i.queue.push(p))),Promise.all(o.start())))}})}})}var esm_mt={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}};var tt={...esm_mt.default,mass:1,damping:1,easing:Lt.linear,clamp:!1},esm_we=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,tt)}};function gt(t,e,n){n&&(n={...n},esm_ht(n,e),e={...n,...e}),esm_ht(t,e),Object.assign(t,e);for(let a in tt)t[a]==null&&(t[a]=tt[a]);let{mass:r,frequency:o,damping:s}=t;return dist_esm_l.und(o)||(o<.01&&(o=.01),s<0&&(s=0),t.tension=Math.pow(2*Math.PI/o,2)*r,t.friction=4*Math.PI*s*r/o),t}function esm_ht(t,e){if(!dist_esm_l.und(e.decay))t.duration=void 0;else{let n=!dist_esm_l.und(e.tension)||!dist_esm_l.und(e.friction);(n||!dist_esm_l.und(e.frequency)||!dist_esm_l.und(e.damping)||!dist_esm_l.und(e.mass))&&(t.duration=void 0,t.decay=void 0),n&&(t.frequency=void 0)}}var esm_yt=[],dist_esm_Le=class{changed=!1;values=esm_yt;toValues=null;fromValues=esm_yt;to;from;config=new esm_we;immediate=!1};function esm_Me(t,{key:e,props:n,defaultProps:r,state:o,actions:s}){return new Promise((a,i)=>{let u,p,f=esm_te(n.cancel??r?.cancel,e);if(f)b();else{dist_esm_l.und(n.pause)||(o.paused=esm_te(n.pause,e));let c=r?.pause;c!==!0&&(c=o.paused||esm_te(c,e)),u=dist_esm_I(n.delay||0,e),c?(o.resumeQueue.add(m),s.pause()):(s.resume(),m())}function d(){o.resumeQueue.add(m),o.timeouts.delete(p),p.cancel(),u=p.time-esm_n.now()}function m(){u>0&&!dist_esm_p.skipAnimation?(o.delayed=!0,p=esm_n.setTimeout(b,u),o.pauseQueue.add(d),o.timeouts.add(p)):b()}function b(){o.delayed&&(o.delayed=!1),o.pauseQueue.delete(d),o.timeouts.delete(p),t<=(o.cancelId||0)&&(f=!0);try{s.start({...n,callId:t,cancel:f},a)}catch(c){i(c)}}})}var esm_be=(t,e)=>e.length==1?e[0]:e.some(n=>n.cancelled)?esm_q(t.get()):e.every(n=>n.noop)?nt(t.get()):dist_esm_E(t.get(),e.every(n=>n.finished)),nt=t=>({value:t,noop:!0,finished:!0,cancelled:!1}),dist_esm_E=(t,e,n=!1)=>({value:t,finished:e,cancelled:n}),esm_q=t=>({value:t,cancelled:!0,finished:!1});function esm_De(t,e,n,r){let{callId:o,parentId:s,onRest:a}=e,{asyncTo:i,promise:u}=n;return!s&&t===i&&!e.reset?u:n.promise=(async()=>{n.asyncId=o,n.asyncTo=t;let p=dist_esm_ne(e,(l,h)=>h==="onRest"?void 0:l),f,d,m=new Promise((l,h)=>(f=l,d=h)),b=l=>{let h=o<=(n.cancelId||0)&&esm_q(r)||o!==n.asyncId&&dist_esm_E(r,!1);if(h)throw l.result=h,d(l),l},c=(l,h)=>{let g=new esm_Ae,x=new esm_Ne;return(async()=>{if(dist_esm_p.skipAnimation)throw esm_oe(n),x.result=dist_esm_E(r,!1),d(x),x;b(g);let S=dist_esm_l.obj(l)?{...l}:{...h,to:l};S.parentId=o,xt(p,(V,_)=>{dist_esm_l.und(S[_])&&(S[_]=V)});let A=await r.start(S);return b(g),n.paused&&await new Promise(V=>{n.resumeQueue.add(V)}),A})()},P;if(dist_esm_p.skipAnimation)return esm_oe(n),dist_esm_E(r,!1);try{let l;dist_esm_l.arr(t)?l=(async h=>{for(let g of h)await c(g)})(t):l=Promise.resolve(t(c,r.stop.bind(r))),await Promise.all([l.then(f),m]),P=dist_esm_E(r.get(),!0,!1)}catch(l){if(l instanceof esm_Ae)P=l.result;else if(l instanceof esm_Ne)P=l.result;else throw l}finally{o==n.asyncId&&(n.asyncId=s,n.asyncTo=s?i:void 0,n.promise=s?u:void 0)}return dist_esm_l.fun(a)&&esm_n.batchedUpdates(()=>{a(P,r,r.item)}),P})()}function esm_oe(t,e){Pe(t.timeouts,n=>n.cancel()),t.pauseQueue.clear(),t.resumeQueue.clear(),t.asyncId=t.asyncTo=t.promise=void 0,e&&(t.cancelId=e)}var esm_Ae=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},esm_Ne=class extends Error{result;constructor(){super("SkipAnimationSignal")}};var esm_Re=t=>t instanceof esm_X,Sn=1,esm_X=class extends esm_ge{id=Sn++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=dist_esm_k(this);return e&&e.getValue()}to(...e){return dist_esm_p.to(this,e)}interpolate(...e){return Jt(),dist_esm_p.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,n=!1){$t(this,{type:"change",parent:this,value:e,idle:n})}_onPriorityChange(e){this.idle||qe.sort(this),$t(this,{type:"priority",parent:this,priority:e})}};var esm_se=Symbol.for("SpringPhase"),esm_bt=1,rt=2,ot=4,esm_qe=t=>(t[esm_se]&esm_bt)>0,dist_esm_Q=t=>(t[esm_se]&rt)>0,esm_ye=t=>(t[esm_se]&ot)>0,st=(t,e)=>e?t[esm_se]|=rt|esm_bt:t[esm_se]&=~rt,esm_it=(t,e)=>e?t[esm_se]|=ot:t[esm_se]&=~ot;var esm_ue=class extends esm_X{key;animation=new dist_esm_Le;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,n){if(super(),!dist_esm_l.und(e)||!dist_esm_l.und(n)){let r=dist_esm_l.obj(e)?{...e}:{...n,from:e};dist_esm_l.und(r.default)&&(r.default=!0),this.start(r)}}get idle(){return!(dist_esm_Q(this)||this._state.asyncTo)||esm_ye(this)}get goal(){return ve(this.animation.to)}get velocity(){let e=dist_esm_k(this);return e instanceof animated_dist_esm_l?e.lastVelocity||0:e.getPayload().map(n=>n.lastVelocity||0)}get hasAnimated(){return esm_qe(this)}get isAnimating(){return dist_esm_Q(this)}get isPaused(){return esm_ye(this)}get isDelayed(){return this._state.delayed}advance(e){let n=!0,r=!1,o=this.animation,{config:s,toValues:a}=o,i=F(o.to);!i&&Pt(o.to)&&(a=ht(ve(o.to))),o.values.forEach((f,d)=>{if(f.done)return;let m=f.constructor==animated_dist_esm_d?1:i?i[d].lastPosition:a[d],b=o.immediate,c=m;if(!b){if(c=f.lastPosition,s.tension<=0){f.done=!0;return}let P=f.elapsedTime+=e,l=o.fromValues[d],h=f.v0!=null?f.v0:f.v0=dist_esm_l.arr(s.velocity)?s.velocity[d]:s.velocity,g,x=s.precision||(l==m?.005:Math.min(1,Math.abs(m-l)*.001));if(dist_esm_l.und(s.duration))if(s.decay){let S=s.decay===!0?.998:s.decay,A=Math.exp(-(1-S)*P);c=l+h/(1-S)*(1-A),b=Math.abs(f.lastPosition-c)<=x,g=h*A}else{g=f.lastVelocity==null?h:f.lastVelocity;let S=s.restVelocity||x/10,A=s.clamp?0:s.bounce,V=!dist_esm_l.und(A),_=l==m?f.v0>0:l<m,v,w=!1,C=1,$=Math.ceil(e/C);for(let L=0;L<$&&(v=Math.abs(g)>S,!(!v&&(b=Math.abs(m-c)<=x,b)));++L){V&&(w=c==m||c>m==_,w&&(g=-g*A,c=m));let N=-s.tension*1e-6*(c-m),y=-s.friction*.001*g,T=(N+y)/s.mass;g=g+T*C,c=c+g*C}}else{let S=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,f.durationProgress>0&&(f.elapsedTime=s.duration*f.durationProgress,P=f.elapsedTime+=e)),S=(s.progress||0)+P/this._memoizedDuration,S=S>1?1:S<0?0:S,f.durationProgress=S),c=l+s.easing(S)*(m-l),g=(c-f.lastPosition)/e,b=S==1}f.lastVelocity=g,Number.isNaN(c)&&(console.warn("Got NaN while animating:",this),b=!0)}i&&!i[d].done&&(b=!1),b?f.done=!0:n=!1,f.setValue(c,s.round)&&(r=!0)});let u=dist_esm_k(this),p=u.getValue();if(n){let f=ve(o.to);(p!==f||r)&&!s.decay?(u.setValue(f),this._onChange(f)):r&&s.decay&&this._onChange(p),this._stop()}else r&&this._onChange(p)}set(e){return esm_n.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(dist_esm_Q(this)){let{to:e,config:n}=this.animation;esm_n.batchedUpdates(()=>{this._onStart(),n.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,n){let r;return dist_esm_l.und(e)?(r=this.queue||[],this.queue=[]):r=[dist_esm_l.obj(e)?e:{...n,to:e}],Promise.all(r.map(o=>this._update(o))).then(o=>esm_be(this,o))}stop(e){let{to:n}=this.animation;return this._focus(this.get()),esm_oe(this._state,e&&this._lastCallId),esm_n.batchedUpdates(()=>this._stop(n,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){let n=this.key||"",{to:r,from:o}=e;r=dist_esm_l.obj(r)?r[n]:r,(r==null||esm_Ee(r))&&(r=void 0),o=dist_esm_l.obj(o)?o[n]:o,o==null&&(o=void 0);let s={to:r,from:o};return esm_qe(this)||(e.reverse&&([r,o]=[o,r]),o=ve(o),dist_esm_l.und(o)?dist_esm_k(this)||this._set(r):this._set(o)),s}_update({...e},n){let{key:r,defaultProps:o}=this;e.default&&Object.assign(o,dist_esm_ne(e,(i,u)=>/^on/.test(u)?et(i,r):i)),_t(this,e,"onProps"),esm_Ie(this,"onProps",e,this);let s=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let a=this._state;return esm_Me(++this._lastCallId,{key:r,props:e,defaultProps:o,state:a,actions:{pause:()=>{esm_ye(this)||(esm_it(this,!0),yt(a.pauseQueue),esm_Ie(this,"onPause",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},resume:()=>{esm_ye(this)&&(esm_it(this,!1),dist_esm_Q(this)&&this._resume(),yt(a.resumeQueue),esm_Ie(this,"onResume",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},start:this._merge.bind(this,s)}}).then(i=>{if(e.loop&&i.finished&&!(n&&i.noop)){let u=at(e);if(u)return this._update(u,!0)}return i})}_merge(e,n,r){if(n.cancel)return this.stop(!0),r(esm_q(this));let o=!dist_esm_l.und(e.to),s=!dist_esm_l.und(e.from);if(o||s)if(n.callId>this._lastToId)this._lastToId=n.callId;else return r(esm_q(this));let{key:a,defaultProps:i,animation:u}=this,{to:p,from:f}=u,{to:d=p,from:m=f}=e;s&&!o&&(!n.default||dist_esm_l.und(d))&&(d=m),n.reverse&&([d,m]=[m,d]);let b=!bt(m,f);b&&(u.from=m),m=ve(m);let c=!bt(d,p);c&&this._focus(d);let P=esm_Ee(n.to),{config:l}=u,{decay:h,velocity:g}=l;(o||s)&&(l.velocity=0),n.config&&!P&>(l,dist_esm_I(n.config,a),n.config!==i.config?dist_esm_I(i.config,a):void 0);let x=dist_esm_k(this);if(!x||dist_esm_l.und(d))return r(dist_esm_E(this,!0));let S=dist_esm_l.und(n.reset)?s&&!n.default:!dist_esm_l.und(m)&&esm_te(n.reset,a),A=S?m:this.get(),V=esm_me(d),_=dist_esm_l.num(V)||dist_esm_l.arr(V)||esm_or(V),v=!P&&(!_||esm_te(i.immediate||n.immediate,a));if(c){let L=esm_Le(d);if(L!==x.constructor)if(v)x=this._set(V);else throw Error(`Cannot animate between ${x.constructor.name} and ${L.name}, as the "to" prop suggests`)}let w=x.constructor,C=Pt(d),$=!1;if(!C){let L=S||!esm_qe(this)&&b;(c||L)&&($=bt(esm_me(A),V),C=!$),(!bt(u.immediate,v)&&!v||!bt(l.decay,h)||!bt(l.velocity,g))&&(C=!0)}if($&&dist_esm_Q(this)&&(u.changed&&!S?C=!0:C||this._stop(p)),!P&&((C||Pt(p))&&(u.values=x.getPayload(),u.toValues=Pt(d)?null:w==animated_dist_esm_d?[1]:ht(V)),u.immediate!=v&&(u.immediate=v,!v&&!S&&this._set(p)),C)){let{onRest:L}=u;esm_Ve(dist_esm_n,y=>_t(this,n,y));let N=dist_esm_E(this,esm_Ce(this,p));yt(this._pendingCalls,N),this._pendingCalls.add(r),u.changed&&esm_n.batchedUpdates(()=>{u.changed=!S,L?.(N,this),S?dist_esm_I(i.onRest,N):u.onStart?.(N,this)})}S&&this._set(A),P?r(esm_De(n.to,n,this._state,this)):C?this._start():dist_esm_Q(this)&&!c?this._pendingCalls.add(r):r(nt(A))}_focus(e){let n=this.animation;e!==n.to&&(esm_qt(this)&&this._detach(),n.to=e,esm_qt(this)&&this._attach())}_attach(){let e=0,{to:n}=this.animation;Pt(n)&&(Gt(n,this),esm_Re(n)&&(e=n.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;Pt(e)&&Qt(e,this)}_set(e,n=!0){let r=ve(e);if(!dist_esm_l.und(r)){let o=dist_esm_k(this);if(!o||!bt(r,o.getValue())){let s=esm_Le(r);!o||o.constructor!=s?esm_D(this,s.create(r)):o.setValue(r),o&&esm_n.batchedUpdates(()=>{this._onChange(r,n)})}}return dist_esm_k(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,esm_Ie(this,"onStart",dist_esm_E(this,esm_Ce(this,e.to)),this))}_onChange(e,n){n||(this._onStart(),dist_esm_I(this.animation.onChange,e,this)),dist_esm_I(this.defaultProps.onChange,e,this),super._onChange(e,n)}_start(){let e=this.animation;dist_esm_k(this).reset(ve(e.to)),e.immediate||(e.fromValues=e.values.map(n=>n.lastPosition)),dist_esm_Q(this)||(st(this,!0),esm_ye(this)||this._resume())}_resume(){dist_esm_p.skipAnimation?this.finish():qe.start(this)}_stop(e,n){if(dist_esm_Q(this)){st(this,!1);let r=this.animation;esm_Ve(r.values,s=>{s.done=!0}),r.toValues&&(r.onChange=r.onPause=r.onResume=void 0),$t(this,{type:"idle",parent:this});let o=n?esm_q(this.get()):dist_esm_E(this.get(),esm_Ce(this,e??r.to));yt(this._pendingCalls,o),r.changed&&(r.changed=!1,esm_Ie(this,"onRest",o,this))}}};function esm_Ce(t,e){let n=esm_me(e),r=esm_me(t.get());return bt(r,n)}function at(t,e=t.loop,n=t.to){let r=dist_esm_I(e);if(r){let o=r!==!0&&esm_de(r),s=(o||t).reverse,a=!o||o.reset;return esm_Pe({...t,loop:e,default:!1,pause:void 0,to:!s||esm_Ee(n)?n:void 0,from:a?t.from:void 0,reset:a,...o})}}function esm_Pe(t){let{to:e,from:n}=t=esm_de(t),r=new Set;return dist_esm_l.obj(e)&&Vt(e,r),dist_esm_l.obj(n)&&Vt(n,r),t.keys=r.size?Array.from(r):null,t}function Ot(t){let e=esm_Pe(t);return R.und(e.default)&&(e.default=dist_esm_ne(e)),e}function Vt(t,e){xt(t,(n,r)=>n!=null&&e.add(r))}var dist_esm_n=["onStart","onRest","onChange","onPause","onResume"];function _t(t,e,n){t.animation[n]=e[n]!==esm_ke(e,n)?et(e[n],t.key):void 0}function esm_Ie(t,e,...n){t.animation[e]?.(...n),t.defaultProps[e]?.(...n)}var Fn=["onStart","onChange","onRest"],kn=1,esm_le=class{id=kn++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,n){this._onFrame=this._onFrame.bind(this),n&&(this._flush=n),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each((n,r)=>e[r]=n.get()),e}set(e){for(let n in e){let r=e[n];dist_esm_l.und(r)||this.springs[n].set(r)}}update(e){return e&&this.queue.push(esm_Pe(e)),this}start(e){let{queue:n}=this;return e?n=ht(e).map(esm_Pe):this.queue=[],this._flush?this._flush(this,n):(jt(this,n),esm_ze(this,n))}stop(e,n){if(e!==!!e&&(n=e),n){let r=this.springs;esm_Ve(ht(n),o=>r[o].stop(!!e))}else esm_oe(this._state,this._lastAsyncId),this.each(r=>r.stop(!!e));return this}pause(e){if(dist_esm_l.und(e))this.start({pause:!0});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].pause())}return this}resume(e){if(dist_esm_l.und(e))this.start({pause:!1});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].resume())}return this}each(e){xt(this.springs,e)}_onFrame(){let{onStart:e,onChange:n,onRest:r}=this._events,o=this._active.size>0,s=this._changed.size>0;(o&&!this._started||s&&!this._started)&&(this._started=!0,Pe(e,([u,p])=>{p.value=this.get(),u(p,this,this._item)}));let a=!o&&this._started,i=s||a&&r.size?this.get():null;s&&n.size&&Pe(n,([u,p])=>{p.value=i,u(p,this,this._item)}),a&&(this._started=!1,Pe(r,([u,p])=>{p.value=i,u(p,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;esm_n.onFrame(this._onFrame)}};function esm_ze(t,e){return Promise.all(e.map(n=>wt(t,n))).then(n=>esm_be(t,n))}async function wt(t,e,n){let{keys:r,to:o,from:s,loop:a,onRest:i,onResolve:u}=e,p=dist_esm_l.obj(e.default)&&e.default;a&&(e.loop=!1),o===!1&&(e.to=null),s===!1&&(e.from=null);let f=dist_esm_l.arr(o)||dist_esm_l.fun(o)?o:void 0;f?(e.to=void 0,e.onRest=void 0,p&&(p.onRest=void 0)):esm_Ve(Fn,P=>{let l=e[P];if(dist_esm_l.fun(l)){let h=t._events[P];e[P]=({finished:g,cancelled:x})=>{let S=h.get(l);S?(g||(S.finished=!1),x&&(S.cancelled=!0)):h.set(l,{value:null,finished:g||!1,cancelled:x||!1})},p&&(p[P]=e[P])}});let d=t._state;e.pause===!d.paused?(d.paused=e.pause,yt(e.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(e.pause=!0);let m=(r||Object.keys(t.springs)).map(P=>t.springs[P].start(e)),b=e.cancel===!0||esm_ke(e,"cancel")===!0;(f||b&&d.asyncId)&&m.push(esm_Me(++t._lastAsyncId,{props:e,state:d,actions:{pause:Y,resume:Y,start(P,l){b?(esm_oe(d,t._lastAsyncId),l(esm_q(t))):(P.onRest=i,l(esm_De(f,P,d,t)))}}})),d.paused&&await new Promise(P=>{d.resumeQueue.add(P)});let c=esm_be(t,await Promise.all(m));if(a&&c.finished&&!(n&&c.noop)){let P=at(e,a,o);if(P)return jt(t,[P]),wt(t,P,!0)}return u&&esm_n.batchedUpdates(()=>u(c,t,t.item)),c}function esm_e(t,e){let n={...t.springs};return e&&pe(Ve(e),r=>{z.und(r.keys)&&(r=esm_Pe(r)),z.obj(r.to)||(r={...r,to:void 0}),Mt(n,r,o=>esm_Lt(o))}),pt(t,n),n}function pt(t,e){Ut(e,(n,r)=>{t.springs[r]||(t.springs[r]=n,Et(n,t))})}function esm_Lt(t,e){let n=new esm_ue;return n.key=t,e&&Gt(n,e),n}function Mt(t,e,n){e.keys&&esm_Ve(e.keys,r=>{(t[r]||(t[r]=n(r)))._prepareNode(e)})}function jt(t,e){esm_Ve(e,n=>{Mt(t.springs,n,r=>esm_Lt(r,t))})}var dist_esm_H=({children:t,...e})=>{let n=(0,external_React_.useContext)(esm_Ge),r=e.pause||!!n.pause,o=e.immediate||!!n.immediate;e=Lr(()=>({pause:r,immediate:o}),[r,o]);let{Provider:s}=esm_Ge;return external_React_.createElement(s,{value:e},t)},esm_Ge=wn(dist_esm_H,{});dist_esm_H.Provider=esm_Ge.Provider;dist_esm_H.Consumer=esm_Ge.Consumer;function wn(t,e){return Object.assign(t,external_React_.createContext(e)),t.Provider._context=t,t.Consumer._context=t,t}var esm_fe=()=>{let t=[],e=function(r){Ln();let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=n(r,s,a);i&&o.push(s.start(i))}}),o};e.current=t,e.add=function(r){t.includes(r)||t.push(r)},e.delete=function(r){let o=t.indexOf(r);~o&&t.splice(o,1)},e.pause=function(){return ce(t,r=>r.pause(...arguments)),this},e.resume=function(){return ce(t,r=>r.resume(...arguments)),this},e.set=function(r){ce(t,(o,s)=>{let a=Ke.fun(r)?r(s,o):r;a&&o.set(a)})},e.start=function(r){let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=this._getProps(r,s,a);i&&o.push(s.start(i))}}),o},e.stop=function(){return ce(t,r=>r.stop(...arguments)),this},e.update=function(r){return ce(t,(o,s)=>o.update(this._getProps(r,o,s))),this};let n=function(r,o,s){return Ke.fun(r)?r(s,o):r};return e._getProps=n,e};function esm_He(t,e,n){let r=jn.fun(e)&&e;r&&!n&&(n=[]);let o=Xe(()=>r||arguments.length==3?esm_fe():void 0,[]),s=Nt(0),a=Dn(),i=Xe(()=>({ctrls:[],queue:[],flush(h,g){let x=esm_e(h,g);return s.current>0&&!i.queue.length&&!Object.keys(x).some(A=>!h.springs[A])?esm_ze(h,g):new Promise(A=>{pt(h,x),i.queue.push(()=>{A(esm_ze(h,g))}),a()})}}),[]),u=Nt([...i.ctrls]),p=[],f=Dt(t)||0;Xe(()=>{Ye(u.current.slice(t,f),h=>{esm_xe(h,o),h.stop(!0)}),u.current.length=t,d(f,t)},[t]),Xe(()=>{d(0,Math.min(f,t))},n);function d(h,g){for(let x=h;x<g;x++){let S=u.current[x]||(u.current[x]=new esm_le(null,i.flush)),A=r?r(x,S):e[x];A&&(p[x]=Ot(A))}}let m=u.current.map((h,g)=>esm_e(h,p[g])),b=Mn(dist_esm_H),c=Dt(b),P=b!==c&&esm_Ue(b);qn(()=>{s.current++,i.ctrls=u.current;let{queue:h}=i;h.length&&(i.queue=[],Ye(h,g=>g())),Ye(u.current,(g,x)=>{o?.add(g),P&&g.start({default:b});let S=p[x];S&&(esm_he(g,S.ref),g.ref?g.queue.push(S):g.start(S))})}),Nn(()=>()=>{Ye(i.ctrls,h=>h.stop(!0))});let l=m.map(h=>({...h}));return o?[l,o]:l}function esm_J(t,e){let n=Qn.fun(t),[[r],o]=esm_He(1,n?t:[t],n?e||[]:e);return n||arguments.length==2?[r,o]:r}var Gn=()=>esm_fe(),Xo=()=>zn(Gn)[0];var Wo=(t,e)=>{let n=Bn(()=>new esm_ue(t,e));return Kn(()=>()=>{n.stop()}),n};function esm_Qt(t,e,n){let r=qt.fun(e)&&e;r&&!n&&(n=[]);let o=!0,s,a=esm_He(t,(i,u)=>{let p=r?r(i,u):e;return s=p.ref,o=o&&p.reverse,p},n||[{}]);if(Yn(()=>{Xn(a[1].current,(i,u)=>{let p=a[1].current[u+(o?1:-1)];if(esm_he(i,s),i.ref){p&&i.update({to:p.springs});return}p?i.start({to:p.springs}):i.start()})},n),r||arguments.length==3){let i=s??a[1];return i._getProps=(u,p,f)=>{let d=qt.fun(u)?u(f,p):u;if(d){let m=i.current[f+(d.reverse?1:-1)];return m&&(d.to=m.springs),d}},a}return a[0]}function esm_Gt(t,e,n){let r=G.fun(e)&&e,{reset:o,sort:s,trail:a=0,expires:i=!0,exitBeforeEnter:u=!1,onDestroyed:p,ref:f,config:d}=r?r():e,m=Jn(()=>r||arguments.length==3?esm_fe():void 0,[]),b=zt(t),c=[],P=lt(null),l=o?null:P.current;Je(()=>{P.current=c}),$n(()=>(j(c,y=>{m?.add(y.ctrl),y.ctrl.ref=m}),()=>{j(P.current,y=>{y.expired&&clearTimeout(y.expirationId),esm_xe(y.ctrl,m),y.ctrl.stop(!0)})}));let h=tr(b,r?r():e,l),g=o&&P.current||[];Je(()=>j(g,({ctrl:y,item:T,key:F})=>{esm_xe(y,m),dist_esm_I(p,T,F)}));let x=[];if(l&&j(l,(y,T)=>{y.expired?(clearTimeout(y.expirationId),g.push(y)):(T=x[T]=h.indexOf(y.key),~T&&(c[T]=y))}),j(b,(y,T)=>{c[T]||(c[T]={key:h[T],item:y,phase:"mount",ctrl:new esm_le},c[T].ctrl.item=y)}),x.length){let y=-1,{leave:T}=r?r():e;j(x,(F,k)=>{let O=l[k];~F?(y=c.indexOf(O),c[y]={...O,item:b[F]}):T&&c.splice(++y,0,O)})}G.fun(s)&&c.sort((y,T)=>s(y.item,T.item));let S=-a,A=Wn(),V=dist_esm_ne(e),_=new Map,v=lt(new Map),w=lt(!1);j(c,(y,T)=>{let F=y.key,k=y.phase,O=r?r():e,U,D,Jt=dist_esm_I(O.delay||0,F);if(k=="mount")U=O.enter,D="enter";else{let M=h.indexOf(F)<0;if(k!="leave")if(M)U=O.leave,D="leave";else if(U=O.update)D="update";else return;else if(!M)U=O.enter,D="enter";else return}if(U=dist_esm_I(U,y.item,T),U=G.obj(U)?esm_de(U):{to:U},!U.config){let M=d||V.config;U.config=dist_esm_I(M,y.item,T,D)}S+=a;let Z={...V,delay:Jt+S,ref:f,immediate:O.immediate,reset:!1,...U};if(D=="enter"&&G.und(Z.from)){let M=r?r():e,Te=G.und(M.initial)||l?M.from:M.initial;Z.from=dist_esm_I(Te,y.item,T)}let{onResolve:Wt}=Z;Z.onResolve=M=>{dist_esm_I(Wt,M);let Te=P.current,B=Te.find(Fe=>Fe.key===F);if(!!B&&!(M.cancelled&&B.phase!="update")&&B.ctrl.idle){let Fe=Te.every(ee=>ee.ctrl.idle);if(B.phase=="leave"){let ee=dist_esm_I(i,B.item);if(ee!==!1){let Ze=ee===!0?0:ee;if(B.expired=!0,!Fe&&Ze>0){Ze<=2147483647&&(B.expirationId=setTimeout(A,Ze));return}}}Fe&&Te.some(ee=>ee.expired)&&(v.current.delete(B),u&&(w.current=!0),A())}};let ft=esm_e(y.ctrl,Z);D==="leave"&&u?v.current.set(y,{phase:D,springs:ft,payload:Z}):_.set(y,{phase:D,springs:ft,payload:Z})});let C=Hn(dist_esm_H),$=Zn(C),L=C!==$&&esm_Ue(C);Je(()=>{L&&j(c,y=>{y.ctrl.start({default:C})})},[C]),j(_,(y,T)=>{if(v.current.size){let F=c.findIndex(k=>k.key===T.key);c.splice(F,1)}}),Je(()=>{j(v.current.size?v.current:_,({phase:y,payload:T},F)=>{let{ctrl:k}=F;F.phase=y,m?.add(k),L&&y=="enter"&&k.start({default:C}),T&&(esm_he(k,T.ref),(k.ref||m)&&!w.current?k.update(T):(k.start(T),w.current&&(w.current=!1)))})},o?void 0:n);let N=y=>Oe.createElement(Oe.Fragment,null,c.map((T,F)=>{let{springs:k}=_.get(T)||T.ctrl,O=y({...k},T.item,T,F);return O&&O.type?Oe.createElement(O.type,{...O.props,key:G.str(T.key)||G.num(T.key)?T.key:T.ctrl.id,ref:O.ref}):O}));return m?[N,m]:N}var esm_er=1;function tr(t,{key:e,keys:n=e},r){if(n===null){let o=new Set;return t.map(s=>{let a=r&&r.find(i=>i.item===s&&i.phase!=="leave"&&!o.has(i));return a?(o.add(a),a.key):esm_er++})}return G.und(n)?t:G.fun(n)?t.map(n):zt(n)}var hs=({container:t,...e}={})=>{let[n,r]=esm_J(()=>({scrollX:0,scrollY:0,scrollXProgress:0,scrollYProgress:0,...e}),[]);return or(()=>{let o=rr(({x:s,y:a})=>{r.start({scrollX:s.current,scrollXProgress:s.progress,scrollY:a.current,scrollYProgress:a.progress})},{container:t?.current||void 0});return()=>{nr(Object.values(n),s=>s.stop()),o()}},[]),n};var Ps=({container:t,...e})=>{let[n,r]=esm_J(()=>({width:0,height:0,...e}),[]);return ar(()=>{let o=sr(({width:s,height:a})=>{r.start({width:s,height:a,immediate:n.width.get()===0||n.height.get()===0})},{container:t?.current||void 0});return()=>{ir(Object.values(n),s=>s.stop()),o()}},[]),n};var cr={any:0,all:1};function Cs(t,e){let[n,r]=pr(!1),o=ur(),s=Bt.fun(t)&&t,a=s?s():{},{to:i={},from:u={},...p}=a,f=s?e:t,[d,m]=esm_J(()=>({from:u,...p}),[]);return lr(()=>{let b=o.current,{root:c,once:P,amount:l="any",...h}=f??{};if(!b||P&&n||typeof IntersectionObserver>"u")return;let g=new WeakMap,x=()=>(i&&m.start(i),r(!0),P?void 0:()=>{u&&m.start(u),r(!1)}),S=V=>{V.forEach(_=>{let v=g.get(_.target);if(_.isIntersecting!==Boolean(v))if(_.isIntersecting){let w=x();Bt.fun(w)?g.set(_.target,w):A.unobserve(_.target)}else v&&(v(),g.delete(_.target))})},A=new IntersectionObserver(S,{root:c&&c.current||void 0,threshold:typeof l=="number"||Array.isArray(l)?l:cr[l],...h});return A.observe(b),()=>A.unobserve(b)},[f]),s?[o,d]:[o,n]}function qs({children:t,...e}){return t(esm_J(e))}function Bs({items:t,children:e,...n}){let r=esm_Qt(t.length,n);return t.map((o,s)=>{let a=e(o,s);return fr.fun(a)?a(r[s]):a})}function Ys({items:t,children:e,...n}){return esm_Gt(t,n)(e)}var esm_W=class extends esm_X{constructor(n,r){super();this.source=n;this.calc=W(...r);let o=this._get(),s=esm_Le(o);esm_D(this,s.create(o))}key;idle=!0;calc;_active=new Set;advance(n){let r=this._get(),o=this.get();bt(r,o)||(dist_esm_k(this).setValue(r),this._onChange(r,this.idle)),!this.idle&&Yt(this._active)&&esm_ct(this)}_get(){let n=dist_esm_l.arr(this.source)?this.source.map(ve):ht(ve(this.source));return this.calc(...n)}_start(){this.idle&&!Yt(this._active)&&(this.idle=!1,esm_Ve(F(this),n=>{n.done=!1}),dist_esm_p.skipAnimation?(esm_n.batchedUpdates(()=>this.advance()),esm_ct(this)):qe.start(this))}_attach(){let n=1;esm_Ve(ht(this.source),r=>{Pt(r)&&Gt(r,this),esm_Re(r)&&(r.idle||this._active.add(r),n=Math.max(n,r.priority+1))}),this.priority=n,this._start()}_detach(){esm_Ve(ht(this.source),n=>{Pt(n)&&Qt(n,this)}),this._active.clear(),esm_ct(this)}eventObserved(n){n.type=="change"?n.idle?this.advance():(this._active.add(n.parent),this._start()):n.type=="idle"?this._active.delete(n.parent):n.type=="priority"&&(this.priority=ht(this.source).reduce((r,o)=>Math.max(r,(esm_Re(o)?o.priority:0)+1),0))}};function vr(t){return t.idle!==!1}function Yt(t){return!t.size||Array.from(t).every(vr)}function esm_ct(t){t.idle||(t.idle=!0,esm_Ve(F(t),e=>{e.done=!0}),$t(t,{type:"idle",parent:t}))}var ui=(t,...e)=>new esm_W(t,e),pi=(t,...e)=>(Cr(),new esm_W(t,e));dist_esm_p.assign({createStringInterpolator:Xt,to:(t,e)=>new esm_W(t,e)});var di=qe.advance; ;// external "ReactDOM" const external_ReactDOM_namespaceObject = window["ReactDOM"]; ;// ./node_modules/@react-spring/web/dist/esm/index.js var web_dist_esm_k=/^--/;function web_dist_esm_I(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!web_dist_esm_k.test(t)&&!(web_dist_esm_c.hasOwnProperty(t)&&web_dist_esm_c[t])?e+"px":(""+e).trim()}var web_dist_esm_v={};function esm_V(t,e){if(!t.nodeType||!t.setAttribute)return!1;let r=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{style:i,children:s,scrollTop:u,scrollLeft:l,viewBox:a,...n}=e,d=Object.values(n),m=Object.keys(n).map(o=>r||t.hasAttribute(o)?o:web_dist_esm_v[o]||(web_dist_esm_v[o]=o.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(let o in i)if(i.hasOwnProperty(o)){let p=web_dist_esm_I(o,i[o]);web_dist_esm_k.test(o)?t.style.setProperty(o,p):t.style[o]=p}m.forEach((o,p)=>{t.setAttribute(o,d[p])}),u!==void 0&&(t.scrollTop=u),l!==void 0&&(t.scrollLeft=l),a!==void 0&&t.setAttribute("viewBox",a)}var web_dist_esm_c={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},esm_F=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),esm_L=["Webkit","Ms","Moz","O"];web_dist_esm_c=Object.keys(web_dist_esm_c).reduce((t,e)=>(esm_L.forEach(r=>t[esm_F(r,e)]=t[e]),t),web_dist_esm_c);var esm_=/^(matrix|translate|scale|rotate|skew)/,dist_esm_$=/^(translate)/,dist_esm_G=/^(rotate|skew)/,web_dist_esm_y=(t,e)=>dist_esm_l.num(t)&&t!==0?t+e:t,web_dist_esm_h=(t,e)=>dist_esm_l.arr(t)?t.every(r=>web_dist_esm_h(r,e)):dist_esm_l.num(t)?t===e:parseFloat(t)===e,dist_esm_g=class extends animated_dist_esm_u{constructor({x:e,y:r,z:i,...s}){let u=[],l=[];(e||r||i)&&(u.push([e||0,r||0,i||0]),l.push(a=>[`translate3d(${a.map(n=>web_dist_esm_y(n,"px")).join(",")})`,web_dist_esm_h(a,0)])),xt(s,(a,n)=>{if(n==="transform")u.push([a||""]),l.push(d=>[d,d===""]);else if(esm_.test(n)){if(delete s[n],dist_esm_l.und(a))return;let d=dist_esm_$.test(n)?"px":dist_esm_G.test(n)?"deg":"";u.push(ht(a)),l.push(n==="rotate3d"?([m,o,p,O])=>[`rotate3d(${m},${o},${p},${web_dist_esm_y(O,d)})`,web_dist_esm_h(O,0)]:m=>[`${n}(${m.map(o=>web_dist_esm_y(o,d)).join(",")})`,web_dist_esm_h(m,n.startsWith("scale")?1:0)])}}),u.length&&(s.transform=new web_dist_esm_x(u,l)),super(s)}},web_dist_esm_x=class extends esm_ge{constructor(r,i){super();this.inputs=r;this.transforms=i}_value=null;get(){return this._value||(this._value=this._get())}_get(){let r="",i=!0;return esm_Ve(this.inputs,(s,u)=>{let l=ve(s[0]),[a,n]=this.transforms[u](dist_esm_l.arr(l)?l:s.map(ve));r+=" "+a,i=i&&n}),i?"none":r}observerAdded(r){r==1&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Gt(s,this)))}observerRemoved(r){r==0&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Qt(s,this)))}eventObserved(r){r.type=="change"&&(this._value=null),$t(this,r)}};var esm_C=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];dist_esm_p.assign({batchedUpdates:external_ReactDOM_namespaceObject.unstable_batchedUpdates,createStringInterpolator:Xt,colors:It});var dist_esm_q=dist_esm_Ke(esm_C,{applyAnimatedValues:esm_V,createAnimatedStyle:t=>new dist_esm_g(t),getComponentProps:({scrollTop:t,scrollLeft:e,...r})=>r}),dist_esm_it=dist_esm_q.animated; ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/animation.js function getAbsolutePosition(element) { return { top: element.offsetTop, left: element.offsetLeft }; } const ANIMATION_DURATION = 400; function useMovingAnimation({ triggerAnimationOnChange }) { const ref = (0,external_wp_element_.useRef)(); const { previous, prevRect } = (0,external_wp_element_.useMemo)( () => ({ previous: ref.current && getAbsolutePosition(ref.current), prevRect: ref.current && ref.current.getBoundingClientRect() }), [triggerAnimationOnChange] ); (0,external_wp_element_.useLayoutEffect)(() => { if (!previous || !ref.current) { return; } const disableAnimation = window.matchMedia( "(prefers-reduced-motion: reduce)" ).matches; if (disableAnimation) { return; } const controller = new esm_le({ x: 0, y: 0, width: prevRect.width, height: prevRect.height, config: { duration: ANIMATION_DURATION, easing: Lt.easeInOutQuint }, onChange({ value }) { if (!ref.current) { return; } let { x: x2, y: y2, width: width2, height: height2 } = value; x2 = Math.round(x2); y2 = Math.round(y2); width2 = Math.round(width2); height2 = Math.round(height2); const finishedMoving = x2 === 0 && y2 === 0; ref.current.style.transformOrigin = "center center"; ref.current.style.transform = finishedMoving ? null : `translate3d(${x2}px,${y2}px,0)`; ref.current.style.width = finishedMoving ? null : `${width2}px`; ref.current.style.height = finishedMoving ? null : `${height2}px`; } }); ref.current.style.transform = void 0; const destination = ref.current.getBoundingClientRect(); const x = Math.round(prevRect.left - destination.left); const y = Math.round(prevRect.top - destination.top); const width = destination.width; const height = destination.height; controller.start({ x: 0, y: 0, width, height, from: { x, y, width: prevRect.width, height: prevRect.height } }); return () => { controller.stop(); controller.set({ x: 0, y: 0, width: prevRect.width, height: prevRect.height }); }; }, [previous, prevRect]); return ref; } var animation_default = useMovingAnimation; ;// ./node_modules/@wordpress/icons/build-module/library/check.js var check_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) }); ;// ./node_modules/@wordpress/edit-site/build-module/utils/is-previewing-theme.js function isPreviewingTheme() { return !!(0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, "wp_theme_preview"); } function currentlyPreviewingTheme() { if (isPreviewingTheme()) { return (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, "wp_theme_preview"); } return null; } ;// ./node_modules/@wordpress/edit-site/build-module/components/save-button/index.js const { useLocation: save_button_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function SaveButton({ className = "edit-site-save-button__button", variant = "primary", showTooltip = true, showReviewMessage, icon, size, __next40pxDefaultSize = false }) { const { params } = save_button_useLocation(); const { setIsSaveViewOpened } = (0,external_wp_data_.useDispatch)(store); const { saveDirtyEntities } = unlock((0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store)); const { dirtyEntityRecords } = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)(); const { isSaving, isSaveViewOpen, previewingThemeName } = (0,external_wp_data_.useSelect)( (select) => { const { isSavingEntityRecord, isResolving } = select(external_wp_coreData_namespaceObject.store); const { isSaveViewOpened } = select(store); const isActivatingTheme = isResolving("activateTheme"); const currentlyPreviewingThemeId = currentlyPreviewingTheme(); return { isSaving: dirtyEntityRecords.some( (record) => isSavingEntityRecord( record.kind, record.name, record.key ) ) || isActivatingTheme, isSaveViewOpen: isSaveViewOpened(), // Do not call `getTheme` with null, it will cause a request to // the server. previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : void 0 }; }, [dirtyEntityRecords] ); const hasDirtyEntities = !!dirtyEntityRecords.length; let isOnlyCurrentEntityDirty; if (dirtyEntityRecords.length === 1) { if (params.postId) { isOnlyCurrentEntityDirty = `${dirtyEntityRecords[0].key}` === params.postId && dirtyEntityRecords[0].name === params.postType; } else if (params.path?.includes("wp_global_styles")) { isOnlyCurrentEntityDirty = dirtyEntityRecords[0].name === "globalStyles"; } } const disabled = isSaving || !hasDirtyEntities && !isPreviewingTheme(); const getLabel = () => { if (isPreviewingTheme()) { if (isSaving) { return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The name of theme to be activated. */ (0,external_wp_i18n_namespaceObject.__)("Activating %s"), previewingThemeName ); } else if (disabled) { return (0,external_wp_i18n_namespaceObject.__)("Saved"); } else if (hasDirtyEntities) { return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The name of theme to be activated. */ (0,external_wp_i18n_namespaceObject.__)("Activate %s & Save"), previewingThemeName ); } return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The name of theme to be activated. */ (0,external_wp_i18n_namespaceObject.__)("Activate %s"), previewingThemeName ); } if (isSaving) { return (0,external_wp_i18n_namespaceObject.__)("Saving"); } if (disabled) { return (0,external_wp_i18n_namespaceObject.__)("Saved"); } if (!isOnlyCurrentEntityDirty && showReviewMessage) { return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: number of unsaved changes (number). (0,external_wp_i18n_namespaceObject._n)( "Review %d change\u2026", "Review %d changes\u2026", dirtyEntityRecords.length ), dirtyEntityRecords.length ); } return (0,external_wp_i18n_namespaceObject.__)("Save"); }; const label = getLabel(); const onClick = isOnlyCurrentEntityDirty ? () => saveDirtyEntities({ dirtyEntityRecords }) : () => setIsSaveViewOpened(true); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant, className, "aria-disabled": disabled, "aria-expanded": isSaveViewOpen, isBusy: isSaving, onClick: disabled ? void 0 : onClick, label, shortcut: disabled ? void 0 : external_wp_keycodes_namespaceObject.displayShortcut.primary("s"), showTooltip, icon, __next40pxDefaultSize, size, children: label } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/save-hub/index.js function SaveHub() { const { isDisabled, isSaving } = (0,external_wp_data_.useSelect)((select) => { const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = select(external_wp_coreData_namespaceObject.store); const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); const _isSaving = dirtyEntityRecords.some( (record) => isSavingEntityRecord(record.kind, record.name, record.key) ); return { isSaving: _isSaving, isDisabled: _isSaving || !dirtyEntityRecords.length && !isPreviewingTheme() }; }, []); 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)( SaveButton, { className: "edit-site-save-hub__button", variant: isDisabled ? null : "primary", showTooltip: false, icon: isDisabled && !isSaving ? check_default : null, showReviewMessage: true, __next40pxDefaultSize: true } ) }); } ;// ./node_modules/@wordpress/edit-site/build-module/utils/use-activate-theme.js const { useHistory: use_activate_theme_useHistory, useLocation: use_activate_theme_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function useActivateTheme() { const history = use_activate_theme_useHistory(); const { path } = use_activate_theme_useLocation(); const { startResolution, finishResolution } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); return async () => { if (isPreviewingTheme()) { const activationURL = "themes.php?action=activate&stylesheet=" + currentlyPreviewingTheme() + "&_wpnonce=" + window.WP_BLOCK_THEME_ACTIVATE_NONCE; startResolution("activateTheme"); await window.fetch(activationURL); finishResolution("activateTheme"); history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { wp_theme_preview: "" })); } }; } ;// external ["wp","apiFetch"] const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// ./node_modules/@wordpress/edit-site/build-module/utils/use-actual-current-theme.js const ACTIVE_THEMES_URL = "/wp/v2/themes?status=active"; function useActualCurrentTheme() { const [currentTheme, setCurrentTheme] = (0,external_wp_element_.useState)(); (0,external_wp_element_.useEffect)(() => { const path = (0,external_wp_url_namespaceObject.addQueryArgs)(ACTIVE_THEMES_URL, { context: "edit", wp_theme_preview: "" }); external_wp_apiFetch_default()({ path }).then((activeThemes) => setCurrentTheme(activeThemes[0])).catch(() => { }); }, []); return currentTheme; } ;// ./node_modules/@wordpress/edit-site/build-module/components/save-panel/index.js const { EntitiesSavedStatesExtensible } = unlock(external_wp_editor_namespaceObject.privateApis); const { useLocation: save_panel_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const EntitiesSavedStatesForPreview = ({ onClose, renderDialog, variant }) => { const isDirtyProps = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)(); let activateSaveLabel; if (isDirtyProps.isDirty) { activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)("Activate & Save"); } else { activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)("Activate"); } const currentTheme = useActualCurrentTheme(); const previewingTheme = (0,external_wp_data_.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme(), [] ); const additionalPrompt = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: The name of active theme, 2: The name of theme to be activated. */ (0,external_wp_i18n_namespaceObject.__)( "Saving your changes will change your active theme from %1$s to %2$s." ), currentTheme?.name?.rendered ?? "...", previewingTheme?.name?.rendered ?? "..." ) }); const activateTheme = useActivateTheme(); const onSave = async (values) => { await activateTheme(); return values; }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EntitiesSavedStatesExtensible, { ...{ ...isDirtyProps, additionalPrompt, close: onClose, onSave, saveEnabled: true, saveLabel: activateSaveLabel, renderDialog, variant } } ); }; const _EntitiesSavedStates = ({ onClose, renderDialog, variant }) => { if (isPreviewingTheme()) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( EntitiesSavedStatesForPreview, { onClose, renderDialog, variant } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_editor_namespaceObject.EntitiesSavedStates, { close: onClose, renderDialog, variant } ); }; function SavePanel() { const { query } = save_panel_useLocation(); const { canvas = "view" } = query; const { isSaveViewOpen, isDirty, isSaving } = (0,external_wp_data_.useSelect)((select) => { const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord, isResolving } = select(external_wp_coreData_namespaceObject.store); const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); const isActivatingTheme = isResolving("activateTheme"); const { isSaveViewOpened } = unlock(select(store)); return { isSaveViewOpen: isSaveViewOpened(), isDirty: dirtyEntityRecords.length > 0, isSaving: dirtyEntityRecords.some( (record) => isSavingEntityRecord(record.kind, record.name, record.key) ) || isActivatingTheme }; }, []); const { setIsSaveViewOpened } = (0,external_wp_data_.useDispatch)(store); const onClose = () => setIsSaveViewOpened(false); (0,external_wp_element_.useEffect)(() => { setIsSaveViewOpened(false); }, [canvas, setIsSaveViewOpened]); if (canvas === "view") { return isSaveViewOpen ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { className: "edit-site-save-panel__modal", onRequestClose: onClose, title: (0,external_wp_i18n_namespaceObject.__)("Review changes"), size: "small", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { onClose, variant: "inline" }) } ) : null; } const activateSaveEnabled = isPreviewingTheme() || isDirty; const disabled = isSaving || !activateSaveEnabled; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( navigable_region_default, { className: dist_clsx("edit-site-layout__actions", { "is-entity-save-view-open": isSaveViewOpen }), ariaLabel: (0,external_wp_i18n_namespaceObject.__)("Save panel"), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx("edit-site-editor__toggle-save-panel", { "screen-reader-text": isSaveViewOpen }), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", className: "edit-site-editor__toggle-save-panel-button", onClick: () => setIsSaveViewOpened(true), "aria-haspopup": "dialog", disabled, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)("Open save panel") } ) } ), isSaveViewOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { onClose, renderDialog: true }) ] } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/layout/index.js const { useGlobalStyle: layout_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { GlobalStylesProvider } = unlock(external_wp_editor_namespaceObject.privateApis); const { useLocation: layout_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const layout_ANIMATION_DURATION = 0.3; function Layout() { const { query, name: routeKey, areas, widths } = layout_useLocation(); const { canvas = "view" } = query; const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const toggleRef = (0,external_wp_element_.useRef)(); const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(); const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const [canvasResizer, canvasSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const isEditorLoading = useIsSiteEditorLoading(); const [isResizableFrameOversized, setIsResizableFrameOversized] = (0,external_wp_element_.useState)(false); const animationRef = animation_default({ triggerAnimationOnChange: routeKey + "-" + canvas }); const { showIconLabels } = (0,external_wp_data_.useSelect)((select) => { return { showIconLabels: select(external_wp_preferences_.store).get( "core", "showIconLabels" ) }; }); const [backgroundColor] = layout_useGlobalStyle("color.background"); const [gradientValue] = layout_useGlobalStyle("color.gradient"); const previousCanvaMode = (0,external_wp_compose_namespaceObject.usePrevious)(canvas); (0,external_wp_element_.useEffect)(() => { if (previousCanvaMode === "edit") { toggleRef.current?.focus(); } }, [canvas]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.UnsavedChangesWarning, {}), canvas === "view" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveKeyboardShortcut, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { ...navigateRegionsProps, ref: navigateRegionsProps.ref, className: dist_clsx( "edit-site-layout", navigateRegionsProps.className, { "is-full-canvas": canvas === "edit", "show-icon-labels": showIconLabels } ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-layout__content", children: [ (!isMobileViewport || !areas.mobile) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( navigable_region_default, { ariaLabel: (0,external_wp_i18n_namespaceObject.__)("Navigation"), className: "edit-site-layout__sidebar-region", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { children: canvas === "view" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__unstableMotion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { type: "tween", duration: ( // Disable transition in mobile to emulate a full page transition. disableMotion || isMobileViewport ? 0 : layout_ANIMATION_DURATION ), ease: "easeOut" }, className: "edit-site-layout__sidebar", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( site_hub_default, { ref: toggleRef, isTransparent: isResizableFrameOversized } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationProvider, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarContent, { shouldAnimate: routeKey !== "styles", routeKey, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.sidebar }) } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {}) ] } ) }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorSnackbars, {}), 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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SiteHubMobile, { ref: toggleRef, isTransparent: isResizableFrameOversized } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { routeKey, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.mobile }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {}) ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.mobile }) }) }), !isMobileViewport && areas.content && canvas !== "edit" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "edit-site-layout__area", style: { maxWidth: widths?.content }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.content }) } ), !isMobileViewport && areas.edit && canvas !== "edit" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "edit-site-layout__area", style: { maxWidth: widths?.edit }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.edit }) } ), !isMobileViewport && areas.preview && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-layout__canvas-container", children: [ canvasResizer, !!canvasSize.width && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx( "edit-site-layout__canvas", { "is-right-aligned": isResizableFrameOversized } ), ref: animationRef, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( resizable_frame_default, { isReady: !isEditorLoading, isFullWidth: canvas === "edit", defaultSize: { width: canvasSize.width - 24, height: canvasSize.height }, isOversized: isResizableFrameOversized, setIsOversized: setIsResizableFrameOversized, innerContentStyle: { background: gradientValue ?? backgroundColor }, children: areas.preview } ) }) } ) ] }) ] }) } ) ] }); } function LayoutWithGlobalStylesProvider(props) { const { createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); function onPluginAreaError(name) { createErrorNotice( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: plugin name */ (0,external_wp_i18n_namespaceObject.__)( 'The "%s" plugin has encountered an error and cannot be rendered.' ), name ) ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SlotFillProvider, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(GlobalStylesProvider, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_plugins_namespaceObject.PluginArea, { onError: onPluginAreaError }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Layout, { ...props }) ] }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/help.js var help_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4a8 8 0 1 1 .001 16.001A8 8 0 0 1 12 4Zm0 1.5a6.5 6.5 0 1 0-.001 13.001A6.5 6.5 0 0 0 12 5.5Zm.75 11h-1.5V15h1.5v1.5Zm-.445-9.234a3 3 0 0 1 .445 5.89V14h-1.5v-1.25c0-.57.452-.958.917-1.01A1.5 1.5 0 0 0 12 8.75a1.5 1.5 0 0 0-1.5 1.5H9a3 3 0 0 1 3.305-2.984Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js var rotate_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/rotate-left.js var rotate_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/backup.js var backup_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" }) }); ;// ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-common-commands.js const { useGlobalStylesReset } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { useHistory: use_common_commands_useHistory, useLocation: use_common_commands_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const getGlobalStylesToggleWelcomeGuideCommands = () => function useGlobalStylesToggleWelcomeGuideCommands() { const { openGeneralSidebar } = unlock((0,external_wp_data_.useDispatch)(store)); const { params } = use_common_commands_useLocation(); const { canvas = "view" } = params; const { set } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); const history = use_common_commands_useHistory(); const isBlockBasedTheme = (0,external_wp_data_.useSelect)((select) => { return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme; }, []); const commands = (0,external_wp_element_.useMemo)(() => { if (!isBlockBasedTheme) { return []; } return [ { name: "core/edit-site/toggle-styles-welcome-guide", label: (0,external_wp_i18n_namespaceObject.__)("Learn about styles"), callback: ({ close }) => { close(); if (canvas !== "edit") { history.navigate("/styles?canvas=edit", { transition: "canvas-mode-edit-transition" }); } openGeneralSidebar("edit-site/global-styles"); set("core/edit-site", "welcomeGuideStyles", true); setTimeout(() => { set("core/edit-site", "welcomeGuideStyles", true); }, 500); }, icon: help_default } ]; }, [history, openGeneralSidebar, canvas, isBlockBasedTheme, set]); return { isLoading: false, commands }; }; const getGlobalStylesResetCommands = () => function useGlobalStylesResetCommands() { const [canReset, onReset] = useGlobalStylesReset(); const commands = (0,external_wp_element_.useMemo)(() => { if (!canReset) { return []; } return [ { name: "core/edit-site/reset-global-styles", label: (0,external_wp_i18n_namespaceObject.__)("Reset styles"), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? rotate_right_default : rotate_left_default, callback: ({ close }) => { close(); onReset(); } } ]; }, [canReset, onReset]); return { isLoading: false, commands }; }; const getGlobalStylesOpenRevisionsCommands = () => function useGlobalStylesOpenRevisionsCommands() { const { openGeneralSidebar, setEditorCanvasContainerView } = unlock( (0,external_wp_data_.useDispatch)(store) ); const { params } = use_common_commands_useLocation(); const { canvas = "view" } = params; const history = use_common_commands_useHistory(); const hasRevisions = (0,external_wp_data_.useSelect)((select) => { const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); const globalStylesId = __experimentalGetCurrentGlobalStylesId(); const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0; return !!globalStyles?._links?.["version-history"]?.[0]?.count; }, []); const commands = (0,external_wp_element_.useMemo)(() => { if (!hasRevisions) { return []; } return [ { name: "core/edit-site/open-styles-revisions", label: (0,external_wp_i18n_namespaceObject.__)("Open style revisions"), icon: backup_default, callback: ({ close }) => { close(); if (canvas !== "edit") { history.navigate("/styles?canvas=edit", { transition: "canvas-mode-edit-transition" }); } openGeneralSidebar("edit-site/global-styles"); setEditorCanvasContainerView( "global-styles-revisions" ); } } ]; }, [ history, openGeneralSidebar, setEditorCanvasContainerView, hasRevisions, canvas ]); return { isLoading: false, commands }; }; function useCommonCommands() { (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: "core/edit-site/toggle-styles-welcome-guide", hook: getGlobalStylesToggleWelcomeGuideCommands() }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: "core/edit-site/reset-global-styles", hook: getGlobalStylesResetCommands() }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: "core/edit-site/open-styles-revisions", hook: getGlobalStylesOpenRevisionsCommands() }); } ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js var close_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); ;// ./node_modules/@wordpress/edit-site/build-module/components/editor-canvas-container/index.js const { EditorContentSlotFill, ResizableEditor } = unlock(external_wp_editor_namespaceObject.privateApis); function getEditorCanvasContainerTitle(view) { switch (view) { case "style-book": return (0,external_wp_i18n_namespaceObject.__)("Style Book"); case "global-styles-revisions": case "global-styles-revisions:style-book": return (0,external_wp_i18n_namespaceObject.__)("Style Revisions"); default: return ""; } } function EditorCanvasContainer({ children, closeButtonLabel, onClose, enableResizing = false }) { const { editorCanvasContainerView, showListViewByDefault } = (0,external_wp_data_.useSelect)( (select) => { const _editorCanvasContainerView = unlock( select(store) ).getEditorCanvasContainerView(); const _showListViewByDefault = select(external_wp_preferences_.store).get( "core", "showListViewByDefault" ); return { editorCanvasContainerView: _editorCanvasContainerView, showListViewByDefault: _showListViewByDefault }; }, [] ); const [isClosed, setIsClosed] = (0,external_wp_element_.useState)(false); const { setEditorCanvasContainerView } = unlock( (0,external_wp_data_.useDispatch)(store) ); const { setIsListViewOpened } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store); const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)("firstElement"); const sectionFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); function onCloseContainer() { setIsListViewOpened(showListViewByDefault); setEditorCanvasContainerView(void 0); setIsClosed(true); if (typeof onClose === "function") { onClose(); } } function closeOnEscape(event) { if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { event.preventDefault(); onCloseContainer(); } } const childrenWithProps = Array.isArray(children) ? external_wp_element_.Children.map( children, (child, index) => index === 0 ? (0,external_wp_element_.cloneElement)(child, { ref: sectionFocusReturnRef }) : child ) : (0,external_wp_element_.cloneElement)(children, { ref: sectionFocusReturnRef }); if (isClosed) { return null; } const title = getEditorCanvasContainerTitle(editorCanvasContainerView); const shouldShowCloseButton = onClose || closeButtonLabel; 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)( "section", { className: "edit-site-editor-canvas-container__section", ref: shouldShowCloseButton ? focusOnMountRef : null, onKeyDown: closeOnEscape, "aria-label": title, children: [ shouldShowCloseButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", className: "edit-site-editor-canvas-container__close-button", icon: close_small_default, label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)("Close"), onClick: onCloseContainer } ), childrenWithProps ] } ) }) }) }); } function useHasEditorCanvasContainer() { const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(EditorContentSlotFill.name); return !!fills?.length; } var editor_canvas_container_default = EditorCanvasContainer; ;// ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-set-command-context.js const { useCommandContext } = unlock(external_wp_commands_namespaceObject.privateApis); const { useLocation: use_set_command_context_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function useSetCommandContext() { const { query = {} } = use_set_command_context_useLocation(); const { canvas = "view" } = query; const hasBlockSelected = (0,external_wp_data_.useSelect)((select) => { return select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(); }, []); const hasEditorCanvasContainer = useHasEditorCanvasContainer(); let commandContext = "site-editor"; if (canvas === "edit") { commandContext = "entity-edit"; } if (hasBlockSelected) { commandContext = "block-selection-edit"; } if (hasEditorCanvasContainer) { commandContext = ""; } useCommandContext(commandContext); } ;// ./node_modules/@wordpress/icons/build-module/library/styles.js var styles_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/navigation.js var navigation_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/page.js var page_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ /* @__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" }), /* @__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" }) ] }); ;// ./node_modules/@wordpress/icons/build-module/library/layout.js var layout_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js var symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right.js var chevron_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left.js var chevron_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-button/index.js function SidebarButton(props) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", ...props, className: dist_clsx("edit-site-sidebar-button", props.className) } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen/index.js const { useHistory: sidebar_navigation_screen_useHistory, useLocation: sidebar_navigation_screen_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function SidebarNavigationScreen({ isRoot, title, actions, content, footer, description, backPath: backPathProp }) { const { dashboardLink, dashboardLinkText, previewingThemeName } = (0,external_wp_data_.useSelect)( (select) => { const { getSettings } = unlock(select(store)); const currentlyPreviewingThemeId = currentlyPreviewingTheme(); return { dashboardLink: getSettings().__experimentalDashboardLink, dashboardLinkText: getSettings().__experimentalDashboardLinkText, // Do not call `getTheme` with null, it will cause a request to // the server. previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : void 0 }; }, [] ); const location = sidebar_navigation_screen_useLocation(); const history = sidebar_navigation_screen_useHistory(); const { navigate } = (0,external_wp_element_.useContext)(SidebarNavigationContext); const backPath = backPathProp ?? location.state?.backPath; const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { className: dist_clsx("edit-site-sidebar-navigation-screen__main", { "has-footer": !!footer }), spacing: 0, justify: "flex-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, alignment: "flex-start", className: "edit-site-sidebar-navigation-screen__title-icon", children: [ !isRoot && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarButton, { onClick: () => { history.navigate(backPath); navigate("back"); }, icon, label: (0,external_wp_i18n_namespaceObject.__)("Back"), showTooltip: false } ), isRoot && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarButton, { icon, label: dashboardLinkText || (0,external_wp_i18n_namespaceObject.__)("Go to the Dashboard"), href: dashboardLink } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHeading, { className: "edit-site-sidebar-navigation-screen__title", color: "#e0e0e0", level: 1, size: 20, children: !isPreviewingTheme() ? title : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: theme name. 2: title */ (0,external_wp_i18n_namespaceObject.__)("Previewing %1$s: %2$s"), previewingThemeName, title ) } ), actions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen__actions", children: actions }) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-sidebar-navigation-screen__content", children: [ description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen__description", children: description }), content ] }) ] } ), footer && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("footer", { className: "edit-site-sidebar-navigation-screen__footer", children: footer }) ] }); } ;// ./node_modules/@wordpress/icons/build-module/icon/index.js var icon_default = (0,external_wp_element_.forwardRef)( ({ icon, size = 24, ...props }, ref) => { return (0,external_wp_element_.cloneElement)(icon, { width: size, height: size, ...props, ref }); } ); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js var chevron_left_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js var chevron_right_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) }); ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-item/index.js const { useHistory: sidebar_navigation_item_useHistory, useLink } = unlock(external_wp_router_namespaceObject.privateApis); function SidebarNavigationItem({ className, icon, withChevron = false, suffix, uid, to, onClick, children, ...props }) { const history = sidebar_navigation_item_useHistory(); const { navigate } = (0,external_wp_element_.useContext)(SidebarNavigationContext); function handleClick(e) { if (onClick) { onClick(e); navigate("forward"); } else if (to) { e.preventDefault(); history.navigate(to); navigate("forward", `[id="${uid}"]`); } } const linkProps = useLink(to); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalItem, { className: dist_clsx( "edit-site-sidebar-navigation-item", { "with-suffix": !withChevron && suffix }, className ), id: uid, onClick: handleClick, href: to ? linkProps.href : void 0, ...props, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( icon_default, { style: { fill: "currentcolor" }, icon, size: 24 } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children }), withChevron && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small_default : chevron_right_small_default, className: "edit-site-sidebar-navigation-item__drilldown-indicator", size: 24 } ), !withChevron && suffix ] }) } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js const SITE_EDITOR_AUTHORS_QUERY = { per_page: -1, _fields: "id,name,avatar_urls", context: "view", capabilities: ["edit_theme_options"] }; const DEFAULT_QUERY = { per_page: 100, page: 1 }; const use_global_styles_revisions_EMPTY_ARRAY = []; const { GlobalStylesContext: use_global_styles_revisions_GlobalStylesContext } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function useGlobalStylesRevisions({ query } = {}) { const { user: userConfig } = (0,external_wp_element_.useContext)(use_global_styles_revisions_GlobalStylesContext); const _query = { ...DEFAULT_QUERY, ...query }; const { authors, currentUser, isDirty, revisions, isLoadingGlobalStylesRevisions, revisionsCount } = (0,external_wp_data_.useSelect)( (select) => { const { __experimentalGetDirtyEntityRecords, getCurrentUser, getUsers, getRevisions, __experimentalGetCurrentGlobalStylesId, getEntityRecord, isResolving } = select(external_wp_coreData_namespaceObject.store); const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); const _currentUser = getCurrentUser(); const _isDirty = dirtyEntityRecords.length > 0; const globalStylesId = __experimentalGetCurrentGlobalStylesId(); const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0; const _revisionsCount = globalStyles?._links?.["version-history"]?.[0]?.count ?? 0; const globalStylesRevisions = getRevisions( "root", "globalStyles", globalStylesId, _query ) || use_global_styles_revisions_EMPTY_ARRAY; const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY) || use_global_styles_revisions_EMPTY_ARRAY; const _isResolving = isResolving("getRevisions", [ "root", "globalStyles", globalStylesId, _query ]); return { authors: _authors, currentUser: _currentUser, isDirty: _isDirty, revisions: globalStylesRevisions, isLoadingGlobalStylesRevisions: _isResolving, revisionsCount: _revisionsCount }; }, [query] ); return (0,external_wp_element_.useMemo)(() => { if (!authors.length || isLoadingGlobalStylesRevisions) { return { revisions: use_global_styles_revisions_EMPTY_ARRAY, hasUnsavedChanges: isDirty, isLoading: true, revisionsCount }; } const _modifiedRevisions = revisions.map((revision) => { return { ...revision, author: authors.find( (author) => author.id === revision.author ) }; }); const fetchedRevisionsCount = revisions.length; if (fetchedRevisionsCount) { if (_modifiedRevisions[0].id !== "unsaved" && _query.page === 1) { _modifiedRevisions[0].isLatest = true; } if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser && _query.page === 1) { const unsavedRevision = { id: "unsaved", styles: userConfig?.styles, settings: userConfig?.settings, _links: userConfig?._links, author: { name: currentUser?.name, avatar_urls: currentUser?.avatar_urls }, modified: /* @__PURE__ */ new Date() }; _modifiedRevisions.unshift(unsavedRevision); } if (_query.page === Math.ceil(revisionsCount / _query.per_page)) { _modifiedRevisions.push({ id: "parent", styles: {}, settings: {} }); } } return { revisions: _modifiedRevisions, hasUnsavedChanges: isDirty, isLoading: false, revisionsCount }; }, [ isDirty, revisions, currentUser, authors, userConfig, isLoadingGlobalStylesRevisions ]); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-footer/index.js function SidebarNavigationScreenDetailsFooter({ record, revisionsCount, ...otherProps }) { const hrefProps = {}; const lastRevisionId = record?._links?.["predecessor-version"]?.[0]?.id ?? null; revisionsCount = revisionsCount || record?._links?.["version-history"]?.[0]?.count || 0; if (lastRevisionId && revisionsCount > 1) { hrefProps.href = (0,external_wp_url_namespaceObject.addQueryArgs)("revision.php", { revision: record?._links["predecessor-version"][0].id }); hrefProps.as = "a"; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalItemGroup, { size: "large", className: "edit-site-sidebar-navigation-screen-details-footer", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationItem, { icon: backup_default, ...hrefProps, ...otherProps, children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: Number of Styles revisions. */ (0,external_wp_i18n_namespaceObject._n)("%d Revision", "%d Revisions", revisionsCount), revisionsCount ) } ) } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.js const { useLocation: sidebar_navigation_screen_global_styles_useLocation, useHistory: sidebar_navigation_screen_global_styles_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); function SidebarNavigationItemGlobalStyles(props) { const { name } = sidebar_navigation_screen_global_styles_useLocation(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationItem, { ...props, "aria-current": name === "styles" } ); } function SidebarNavigationScreenGlobalStyles() { const history = sidebar_navigation_screen_global_styles_useHistory(); const { path } = sidebar_navigation_screen_global_styles_useLocation(); const { revisions, isLoading: isLoadingRevisions, revisionsCount } = useGlobalStylesRevisions(); const { openGeneralSidebar } = (0,external_wp_data_.useDispatch)(store); const { setEditorCanvasContainerView } = unlock( (0,external_wp_data_.useDispatch)(store) ); const { set: setPreference } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); const openGlobalStyles = (0,external_wp_element_.useCallback)(async () => { history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: "edit" }), { transition: "canvas-mode-edit-transition" }); return Promise.all([ setPreference("core", "distractionFree", false), openGeneralSidebar("edit-site/global-styles") ]); }, [path, history, openGeneralSidebar, setPreference]); const openRevisions = (0,external_wp_element_.useCallback)(async () => { await openGlobalStyles(); setEditorCanvasContainerView("global-styles-revisions"); }, [openGlobalStyles, setEditorCanvasContainerView]); const shouldShowGlobalStylesFooter = !!revisionsCount && !isLoadingRevisions; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationScreen, { title: (0,external_wp_i18n_namespaceObject.__)("Design"), isRoot: true, description: (0,external_wp_i18n_namespaceObject.__)( "Customize the appearance of your website using the block editor." ), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MainSidebarNavigationContent, { activeItem: "styles-navigation-item" }), footer: shouldShowGlobalStylesFooter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationScreenDetailsFooter, { record: revisions?.[0], revisionsCount, onClick: openRevisions } ) } ) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-main/index.js function MainSidebarNavigationContent({ isBlockBasedTheme = true }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-main", children: [ isBlockBasedTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationItemGlobalStyles, { to: "/styles", uid: "global-styles-navigation-item", icon: styles_default, children: (0,external_wp_i18n_namespaceObject.__)("Styles") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationItem, { uid: "navigation-navigation-item", to: "/navigation", withChevron: true, icon: navigation_default, children: (0,external_wp_i18n_namespaceObject.__)("Navigation") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationItem, { uid: "page-navigation-item", to: "/page", withChevron: true, icon: page_default, children: (0,external_wp_i18n_namespaceObject.__)("Pages") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationItem, { uid: "template-navigation-item", to: "/template", withChevron: true, icon: layout_default, children: (0,external_wp_i18n_namespaceObject.__)("Templates") } ) ] }), !isBlockBasedTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationItem, { uid: "stylebook-navigation-item", to: "/stylebook", withChevron: true, icon: styles_default, children: (0,external_wp_i18n_namespaceObject.__)("Styles") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationItem, { uid: "patterns-navigation-item", to: "/pattern", withChevron: true, icon: symbol_default, children: (0,external_wp_i18n_namespaceObject.__)("Patterns") } ) ] }); } function SidebarNavigationScreenMain({ customDescription }) { const isBlockBasedTheme = (0,external_wp_data_.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, [] ); const { setEditorCanvasContainerView } = unlock( (0,external_wp_data_.useDispatch)(store) ); (0,external_wp_element_.useEffect)(() => { setEditorCanvasContainerView(void 0); }, [setEditorCanvasContainerView]); let description; if (customDescription) { description = customDescription; } else if (isBlockBasedTheme) { description = (0,external_wp_i18n_namespaceObject.__)( "Customize the appearance of your website using the block editor." ); } else { description = (0,external_wp_i18n_namespaceObject.__)( "Explore block styles and patterns to refine your site." ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationScreen, { isRoot: true, title: (0,external_wp_i18n_namespaceObject.__)("Design"), description, content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( MainSidebarNavigationContent, { isBlockBasedTheme } ) } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-unsupported/index.js function SidebarNavigationScreenUnsupported() { 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.__)( "The theme you are currently using does not support this screen." ) }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/arrow-up-left.js var arrow_up_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z" }) }); ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/image.js function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("picture", { className: "edit-site-welcome-guide__image", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "source", { srcSet: nonAnimatedSrc, media: "(prefers-reduced-motion: reduce)" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" }) ] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/editor.js function WelcomeGuideEditor() { const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); const { isActive, isBlockBasedTheme } = (0,external_wp_data_.useSelect)((select) => { return { isActive: !!select(external_wp_preferences_.store).get( "core/edit-site", "welcomeGuide" ), isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme }; }, []); if (!isActive || !isBlockBasedTheme) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Guide, { className: "edit-site-welcome-guide guide-editor", contentLabel: (0,external_wp_i18n_namespaceObject.__)("Welcome to the site editor"), finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Get started"), onFinish: () => toggle("core/edit-site", "welcomeGuide"), pages: [ { image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1", animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1" } ), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Edit your site") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( "Design everything on your site \u2014 from the header right down to the footer \u2014 using blocks." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_element_.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.__)( "Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors." ), { StylesIconImage: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { alt: (0,external_wp_i18n_namespaceObject.__)("styles"), 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" } ) } ) }) ] }) } ] } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/styles.js const { interfaceStore: styles_interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis); function WelcomeGuideStyles() { const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); const { isActive, isStylesOpen } = (0,external_wp_data_.useSelect)((select) => { const sidebar = select(styles_interfaceStore).getActiveComplementaryArea("core"); return { isActive: !!select(external_wp_preferences_.store).get( "core/edit-site", "welcomeGuideStyles" ), isStylesOpen: sidebar === "edit-site/global-styles" }; }, []); if (!isActive || !isStylesOpen) { return null; } const welcomeLabel = (0,external_wp_i18n_namespaceObject.__)("Welcome to Styles"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Guide, { className: "edit-site-welcome-guide guide-styles", contentLabel: welcomeLabel, finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Get started"), onFinish: () => toggle("core/edit-site", "welcomeGuideStyles"), pages: [ { image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1", animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1" } ), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: welcomeLabel }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( "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." ) }) ] }) }, { image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1", animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1" } ), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Set the design") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( "You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle!" ) }) ] }) }, { image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1", animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1" } ), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Personalize blocks") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( "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." ) }) ] }) }, { image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" } ), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Learn more") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { className: "edit-site-welcome-guide__text", children: [ (0,external_wp_i18n_namespaceObject.__)( "New to block themes and styling your site?" ), " ", /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)( "https://wordpress.org/documentation/article/styles-overview/" ), children: (0,external_wp_i18n_namespaceObject.__)( "Here\u2019s a detailed guide to learn how to make the most of it." ) } ) ] }) ] }) } ] } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/page.js function WelcomeGuidePage() { const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); const isVisible = (0,external_wp_data_.useSelect)((select) => { const isPageActive = !!select(external_wp_preferences_.store).get( "core/edit-site", "welcomeGuidePage" ); const isEditorActive = !!select(external_wp_preferences_.store).get( "core/edit-site", "welcomeGuide" ); return isPageActive && !isEditorActive; }, []); if (!isVisible) { return null; } const heading = (0,external_wp_i18n_namespaceObject.__)("Editing a page"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Guide, { className: "edit-site-welcome-guide guide-page", contentLabel: heading, finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Continue"), onFinish: () => toggle("core/edit-site", "welcomeGuidePage"), pages: [ { image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "video", { className: "edit-site-welcome-guide__video", autoPlay: true, loop: true, muted: true, width: "312", height: "240", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "source", { src: "https://s.w.org/images/block-editor/editing-your-page.mp4", type: "video/mp4" } ) } ), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: heading }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts "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." ) }) ] }) } ] } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/template.js function WelcomeGuideTemplate() { const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); const { isActive, hasPreviousEntity } = (0,external_wp_data_.useSelect)((select) => { const { getEditorSettings } = select(external_wp_editor_namespaceObject.store); const { get } = select(external_wp_preferences_.store); return { isActive: get("core/edit-site", "welcomeGuideTemplate"), hasPreviousEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord }; }, []); const isVisible = isActive && hasPreviousEntity; if (!isVisible) { return null; } const heading = (0,external_wp_i18n_namespaceObject.__)("Editing a template"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Guide, { className: "edit-site-welcome-guide guide-template", contentLabel: heading, finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Continue"), onFinish: () => toggle("core/edit-site", "welcomeGuideTemplate"), pages: [ { image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "video", { className: "edit-site-welcome-guide__video", autoPlay: true, loop: true, muted: true, width: "312", height: "240", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "source", { src: "https://s.w.org/images/block-editor/editing-your-template.mp4", type: "video/mp4" } ) } ), content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: heading }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)( "Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the \u2018Back\u2019 button in the toolbar." ) }) ] }) } ] } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/index.js function WelcomeGuide({ postType }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideEditor, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideStyles, {}), postType === "page" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuidePage, {}), postType === "wp_template" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideTemplate, {}) ] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-renderer/index.js const { useGlobalStylesOutput } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function useGlobalStylesRenderer(disableRootPadding) { const [styles, settings] = useGlobalStylesOutput(disableRootPadding); const { getSettings } = (0,external_wp_data_.useSelect)(store); const { updateSettings } = (0,external_wp_data_.useDispatch)(store); (0,external_wp_element_.useEffect)(() => { if (!styles || !settings) { return; } const currentStoreSettings = getSettings(); const nonGlobalStyles = Object.values( currentStoreSettings.styles ?? [] ).filter((style) => !style.isGlobalStyles); updateSettings({ ...currentStoreSettings, styles: [...nonGlobalStyles, ...styles], __experimentalFeatures: settings }); }, [styles, settings, updateSettings, getSettings]); } function GlobalStylesRenderer({ disableRootPadding }) { useGlobalStylesRenderer(disableRootPadding); return null; } ;// ./node_modules/@wordpress/edit-site/build-module/components/canvas-loader/index.js const { Theme } = unlock(external_wp_components_namespaceObject.privateApis); const { useGlobalStyle: canvas_loader_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function CanvasLoader({ id }) { const [fallbackIndicatorColor] = canvas_loader_useGlobalStyle("color.text"); const [backgroundColor] = canvas_loader_useGlobalStyle("color.background"); const { highlightedColors } = useStylesPreviewColors(); const indicatorColor = highlightedColors[0]?.color ?? fallbackIndicatorColor; const { elapsed, total } = (0,external_wp_data_.useSelect)((select) => { const selectorsByStatus = select(external_wp_coreData_namespaceObject.store).countSelectorsByStatus(); const resolving = selectorsByStatus.resolving ?? 0; const finished = selectorsByStatus.finished ?? 0; return { elapsed: finished, total: finished + resolving }; }, []); 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 }) }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-navigate-to-entity-record.js const { useHistory: use_navigate_to_entity_record_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); function useNavigateToEntityRecord() { const history = use_navigate_to_entity_record_useHistory(); const onNavigateToEntityRecord = (0,external_wp_element_.useCallback)( (params) => { history.navigate( `/${params.postType}/${params.postId}?canvas=edit&focusMode=true` ); }, [history] ); return onNavigateToEntityRecord; } ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-site-editor-settings.js const { useLocation: use_site_editor_settings_useLocation, useHistory: use_site_editor_settings_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); function useNavigateToPreviousEntityRecord() { const location = use_site_editor_settings_useLocation(); const previousLocation = (0,external_wp_compose_namespaceObject.usePrevious)(location); const history = use_site_editor_settings_useHistory(); const goBack = (0,external_wp_element_.useMemo)(() => { const isFocusMode = location.query.focusMode || location?.params?.postId && FOCUSABLE_ENTITIES.includes(location?.params?.postType); const didComeFromEditorCanvas = previousLocation?.query.canvas === "edit"; const showBackButton = isFocusMode && didComeFromEditorCanvas; return showBackButton ? () => history.back() : void 0; }, [location, history]); return goBack; } function useSpecificEditorSettings() { const { query } = use_site_editor_settings_useLocation(); const { canvas = "view" } = query; const onNavigateToEntityRecord = useNavigateToEntityRecord(); const { settings } = (0,external_wp_data_.useSelect)((select) => { const { getSettings } = select(store); return { settings: getSettings() }; }, []); const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord(); const defaultEditorSettings = (0,external_wp_element_.useMemo)(() => { return { ...settings, richEditingEnabled: true, supportsTemplateMode: true, focusMode: canvas !== "view", onNavigateToEntityRecord, onNavigateToPreviousEntityRecord, isPreviewMode: canvas === "view" }; }, [ settings, canvas, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord ]); return defaultEditorSettings; } ;// ./node_modules/@wordpress/edit-site/build-module/components/plugin-template-setting-panel/index.js const { Fill, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("PluginTemplateSettingPanel"); const PluginTemplateSettingPanel = ({ children }) => { external_wp_deprecated_default()("wp.editSite.PluginTemplateSettingPanel", { since: "6.6", version: "6.8", alternative: "wp.editor.PluginDocumentSettingPanel" }); const isCurrentEntityTemplate = (0,external_wp_data_.useSelect)( (select) => select(external_wp_editor_namespaceObject.store).getCurrentPostType() === "wp_template", [] ); if (!isCurrentEntityTemplate) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children }); }; PluginTemplateSettingPanel.Slot = Slot; var plugin_template_setting_panel_default = PluginTemplateSettingPanel; ;// ./node_modules/@wordpress/icons/build-module/library/seen.js var seen_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js var more_vertical_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/icon-with-current-color.js function IconWithCurrentColor({ className, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Icon, { className: dist_clsx( className, "edit-site-global-styles-icon-with-current-color" ), ...props } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/navigation-button.js function GenericNavigationButton({ icon, children, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItem, { ...props, children: [ icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { icon, size: 24 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children }) ] }), !icon && children ] }); } function NavigationButtonAsItem(props) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Button, { as: GenericNavigationButton, ...props }); } function NavigationBackButtonAsItem(props) { return /* @__PURE__ */ jsx(Navigator.BackButton, { as: GenericNavigationButton, ...props }); } ;// ./node_modules/@wordpress/icons/build-module/library/typography.js var typography_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m8.6 7 3.9 10.8h-1.7l-1-2.8H5.7l-1 2.8H3L6.9 7h1.7Zm-2.4 6.6h3L7.7 9.3l-1.5 4.3ZM17.691 8.879c.473 0 .88.055 1.221.165.352.1.643.264.875.495.274.253.456.572.544.957.088.374.132.83.132 1.37v4.554c0 .274.033.472.099.593.077.11.198.166.363.166.11 0 .215-.028.313-.083.11-.055.237-.137.38-.247l.165.28a3.304 3.304 0 0 1-.71.446c-.23.11-.527.165-.89.165-.352 0-.639-.055-.858-.165-.22-.11-.386-.27-.495-.479-.1-.209-.149-.468-.149-.775-.286.462-.627.814-1.023 1.056-.396.242-.858.363-1.386.363-.462 0-.858-.088-1.188-.264a1.752 1.752 0 0 1-.742-.726 2.201 2.201 0 0 1-.248-1.056c0-.484.11-.875.33-1.172.22-.308.5-.556.841-.742.352-.187.721-.341 1.106-.462.396-.132.765-.253 1.106-.363.351-.121.637-.259.857-.413.232-.154.347-.357.347-.61V10.81c0-.396-.066-.71-.198-.941a1.05 1.05 0 0 0-.511-.511 1.763 1.763 0 0 0-.76-.149c-.253 0-.522.039-.808.116a1.165 1.165 0 0 0-.677.412 1.1 1.1 0 0 1 .595.396c.165.187.247.424.247.71 0 .307-.104.55-.313.726-.198.176-.451.263-.76.263-.34 0-.594-.104-.758-.313a1.231 1.231 0 0 1-.248-.759c0-.297.072-.539.214-.726.154-.187.352-.363.595-.528.264-.176.6-.324 1.006-.445.418-.121.88-.182 1.386-.182Zm.99 3.729a1.57 1.57 0 0 1-.528.462c-.231.121-.479.248-.742.38a5.377 5.377 0 0 0-.76.462c-.23.165-.423.38-.577.643-.154.264-.231.6-.231 1.007 0 .429.11.77.33 1.023.22.242.517.363.891.363.308 0 .594-.088.858-.264.275-.176.528-.44.759-.792v-3.284Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/color.js var color_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/background.js var background_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/shadow.js var shadow_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z" }) }); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/root-menu.js const { useHasDimensionsPanel, useHasTypographyPanel, useHasColorPanel, useGlobalSetting: root_menu_useGlobalSetting, useSettingsForBlockElement, useHasBackgroundPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function RootMenu() { const [rawSettings] = root_menu_useGlobalSetting(""); const settings = useSettingsForBlockElement(rawSettings); const hasBackgroundPanel = useHasBackgroundPanel(rawSettings); const hasTypographyPanel = useHasTypographyPanel(settings); const hasColorPanel = useHasColorPanel(settings); const hasShadowPanel = true; const hasDimensionsPanel = useHasDimensionsPanel(settings); const hasLayoutPanel = hasDimensionsPanel; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: [ hasTypographyPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( NavigationButtonAsItem, { icon: typography_default, path: "/typography", children: (0,external_wp_i18n_namespaceObject.__)("Typography") } ), hasColorPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: color_default, path: "/colors", children: (0,external_wp_i18n_namespaceObject.__)("Colors") }), hasBackgroundPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( NavigationButtonAsItem, { icon: background_default, path: "/background", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Background styles"), children: (0,external_wp_i18n_namespaceObject.__)("Background") } ), hasShadowPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: shadow_default, path: "/shadows", children: (0,external_wp_i18n_namespaceObject.__)("Shadows") }), hasLayoutPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: layout_default, path: "/layout", children: (0,external_wp_i18n_namespaceObject.__)("Layout") }) ] }) }); } var root_menu_default = RootMenu; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/preview-styles.js function findNearest(input, numbers) { if (numbers.length === 0) { return null; } numbers.sort((a, b) => Math.abs(input - a) - Math.abs(input - b)); return numbers[0]; } function extractFontWeights(fontFaces) { const result = []; fontFaces.forEach((face) => { const weights = String(face.fontWeight).split(" "); if (weights.length === 2) { const start = parseInt(weights[0]); const end = parseInt(weights[1]); for (let i = start; i <= end; i += 100) { result.push(i); } } else if (weights.length === 1) { result.push(parseInt(weights[0])); } }); return result; } function formatFontFamily(input) { const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/; const output = input.trim(); const formatItem = (item) => { item = item.trim(); if (item.match(regex)) { item = item.replace(/^["']|["']$/g, ""); return `"${item}"`; } return item; }; if (output.includes(",")) { return output.split(",").map(formatItem).filter((item) => item !== "").join(", "); } return formatItem(output); } function formatFontFaceName(input) { if (!input) { return ""; } let output = input.trim(); if (output.includes(",")) { output = output.split(",").find((item) => item.trim() !== "").trim(); } output = output.replace(/^["']|["']$/g, ""); if (window.navigator.userAgent.toLowerCase().includes("firefox")) { output = `"${output}"`; } return output; } function getFamilyPreviewStyle(family) { const style = { fontFamily: formatFontFamily(family.fontFamily) }; if (!Array.isArray(family.fontFace)) { style.fontWeight = "400"; style.fontStyle = "normal"; return style; } if (family.fontFace) { const normalFaces = family.fontFace.filter( (face) => face?.fontStyle && face.fontStyle.toLowerCase() === "normal" ); if (normalFaces.length > 0) { style.fontStyle = "normal"; const normalWeights = extractFontWeights(normalFaces); const nearestWeight = findNearest(400, normalWeights); style.fontWeight = String(nearestWeight) || "400"; } else { style.fontStyle = family.fontFace.length && family.fontFace[0].fontStyle || "normal"; style.fontWeight = family.fontFace.length && String(family.fontFace[0].fontWeight) || "400"; } } return style; } function getFacePreviewStyle(face) { return { fontFamily: formatFontFamily(face.fontFamily), fontStyle: face.fontStyle || "normal", fontWeight: face.fontWeight || "400" }; } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/utils.js function getVariationClassName(variation) { if (!variation) { return ""; } return `is-style-${variation}`; } function getNewIndexFromPresets(presets, slugPrefix) { const nameRegex = new RegExp(`^${slugPrefix}([\\d]+)$`); const highestPresetValue = presets.reduce((currentHighest, preset) => { if (typeof preset?.slug === "string") { const matches = preset?.slug.match(nameRegex); if (matches) { const id = parseInt(matches[1], 10); if (id > currentHighest) { return id; } } } return currentHighest; }, 0); return highestPresetValue + 1; } function getFontFamilyFromSetting(fontFamilies, setting) { if (!Array.isArray(fontFamilies) || !setting) { return null; } const fontFamilyVariable = setting.replace("var(", "").replace(")", ""); const fontFamilySlug = fontFamilyVariable?.split("--").slice(-1)[0]; return fontFamilies.find( (fontFamily) => fontFamily.slug === fontFamilySlug ); } function getFontFamilies(themeJson) { const themeFontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme; const customFontFamilies = themeJson?.settings?.typography?.fontFamilies?.custom; let fontFamilies = []; if (themeFontFamilies && customFontFamilies) { fontFamilies = [...themeFontFamilies, ...customFontFamilies]; } else if (themeFontFamilies) { fontFamilies = themeFontFamilies; } else if (customFontFamilies) { fontFamilies = customFontFamilies; } const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily; const bodyFontFamily = getFontFamilyFromSetting( fontFamilies, bodyFontFamilySetting ); const headingFontFamilySetting = themeJson?.styles?.elements?.heading?.typography?.fontFamily; let headingFontFamily; if (!headingFontFamilySetting) { headingFontFamily = bodyFontFamily; } else { headingFontFamily = getFontFamilyFromSetting( fontFamilies, themeJson?.styles?.elements?.heading?.typography?.fontFamily ); } return [bodyFontFamily, headingFontFamily]; } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-example.js const { useGlobalStyle: typography_example_useGlobalStyle, GlobalStylesContext: typography_example_GlobalStylesContext } = unlock( external_wp_blockEditor_namespaceObject.privateApis ); const { mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); function PreviewTypography({ fontSize, variation }) { const { base } = (0,external_wp_element_.useContext)(typography_example_GlobalStylesContext); let config = base; if (variation) { config = mergeBaseAndUserConfigs(base, variation); } const [textColor] = typography_example_useGlobalStyle("color.text"); const [bodyFontFamilies, headingFontFamilies] = getFontFamilies(config); const bodyPreviewStyle = bodyFontFamilies ? getFamilyPreviewStyle(bodyFontFamilies) : {}; const headingPreviewStyle = headingFontFamilies ? getFamilyPreviewStyle(headingFontFamilies) : {}; if (textColor) { bodyPreviewStyle.color = textColor; headingPreviewStyle.color = textColor; } if (fontSize) { bodyPreviewStyle.fontSize = fontSize; headingPreviewStyle.fontSize = fontSize; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__unstableMotion.div, { animate: { scale: 1, opacity: 1 }, initial: { scale: 0.1, opacity: 0 }, transition: { delay: 0.3, type: "tween" }, style: { textAlign: "center", lineHeight: 1 }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { style: headingPreviewStyle, children: (0,external_wp_i18n_namespaceObject._x)("A", "Uppercase letter A") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { style: bodyPreviewStyle, children: (0,external_wp_i18n_namespaceObject._x)("a", "Lowercase letter A") }) ] } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/highlighted-colors.js function HighlightedColors({ normalizedColorSwatchSize, ratio }) { const { highlightedColors } = useStylesPreviewColors(); const scaledSwatchSize = normalizedColorSwatchSize * ratio; return highlightedColors.map(({ slug, color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { style: { height: scaledSwatchSize, width: scaledSwatchSize, background: color, borderRadius: scaledSwatchSize / 2 }, animate: { scale: 1, opacity: 1 }, initial: { scale: 0.1, opacity: 0 }, transition: { delay: index === 1 ? 0.2 : 0.1 } }, `${slug}-${index}` )); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-wrapper.js const { useGlobalStyle: preview_wrapper_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const normalizedWidth = 248; const normalizedHeight = 152; const THROTTLE_OPTIONS = { leading: true, trailing: true }; function PreviewWrapper({ children, label, isFocused, withHoverView }) { const [backgroundColor = "white"] = preview_wrapper_useGlobalStyle("color.background"); const [gradientValue] = preview_wrapper_useGlobalStyle("color.gradient"); const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const [isHovered, setIsHovered] = (0,external_wp_element_.useState)(false); const [containerResizeListener, { width }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const [throttledWidth, setThrottledWidthState] = (0,external_wp_element_.useState)(width); const [ratioState, setRatioState] = (0,external_wp_element_.useState)(); const setThrottledWidth = (0,external_wp_compose_namespaceObject.useThrottle)( setThrottledWidthState, 250, THROTTLE_OPTIONS ); (0,external_wp_element_.useLayoutEffect)(() => { if (width) { setThrottledWidth(width); } }, [width, setThrottledWidth]); (0,external_wp_element_.useLayoutEffect)(() => { const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1; const ratioDiff = newRatio - (ratioState || 0); const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1; if (isRatioDiffBigEnough || !ratioState) { setRatioState(newRatio); } }, [throttledWidth, ratioState]); const fallbackRatio = width ? width / normalizedWidth : 1; const ratio = ratioState ? ratioState : fallbackRatio; const isReady = !!width; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { position: "relative" }, children: containerResizeListener }), isReady && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "edit-site-global-styles-preview__wrapper", style: { height: normalizedHeight * ratio }, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), tabIndex: -1, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { style: { height: normalizedHeight * ratio, width: "100%", background: gradientValue ?? backgroundColor, cursor: withHoverView ? "pointer" : void 0 }, initial: "start", animate: (isHovered || isFocused) && !disableMotion && label ? "hover" : "start", children: [].concat(children).map((child, key) => child({ ratio, key })) } ) } ) ] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-styles.js const { useGlobalStyle: preview_styles_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const firstFrameVariants = { start: { scale: 1, opacity: 1 }, hover: { scale: 0, opacity: 0 } }; const midFrameVariants = { hover: { opacity: 1 }, start: { opacity: 0.5 } }; const secondFrameVariants = { hover: { scale: 1, opacity: 1 }, start: { scale: 0, opacity: 0 } }; const PreviewStyles = ({ label, isFocused, withHoverView, variation }) => { const [fontWeight] = preview_styles_useGlobalStyle("typography.fontWeight"); const [fontFamily = "serif"] = preview_styles_useGlobalStyle("typography.fontFamily"); const [headingFontFamily = fontFamily] = preview_styles_useGlobalStyle( "elements.h1.typography.fontFamily" ); const [headingFontWeight = fontWeight] = preview_styles_useGlobalStyle( "elements.h1.typography.fontWeight" ); const [textColor = "black"] = preview_styles_useGlobalStyle("color.text"); const [headingColor = textColor] = preview_styles_useGlobalStyle( "elements.h1.color.text" ); const { paletteColors } = useStylesPreviewColors(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( PreviewWrapper, { label, isFocused, withHoverView, children: [ ({ ratio, key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { variants: firstFrameVariants, style: { height: "100%", overflow: "hidden" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { spacing: 10 * ratio, justify: "center", style: { height: "100%", overflow: "hidden" }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreviewTypography, { fontSize: 65 * ratio, variation } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4 * ratio, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( HighlightedColors, { normalizedColorSwatchSize: 32, ratio } ) }) ] } ) }, key ), ({ key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { variants: withHoverView && midFrameVariants, style: { height: "100%", width: "100%", position: "absolute", top: 0, overflow: "hidden", filter: "blur(60px)", opacity: 0.1 }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHStack, { spacing: 0, justify: "flex-start", style: { height: "100%", overflow: "hidden" }, children: paletteColors.slice(0, 4).map(({ color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { style: { height: "100%", background: color, flexGrow: 1 } }, index )) } ) }, key ), ({ ratio, key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { variants: secondFrameVariants, style: { height: "100%", width: "100%", overflow: "hidden", position: "absolute", top: 0 }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3 * ratio, justify: "center", style: { height: "100%", overflow: "hidden", padding: 10 * ratio, boxSizing: "border-box" }, children: label && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { style: { fontSize: 40 * ratio, fontFamily: headingFontFamily, color: headingColor, fontWeight: headingFontWeight, lineHeight: "1em", textAlign: "center" }, children: label } ) } ) }, key ) ] } ); }; var preview_styles_default = PreviewStyles; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-root.js function ScreenRoot() { const hasVariations = (0,external_wp_data_.useSelect)((select) => { const { __experimentalGetCurrentThemeGlobalStylesVariations } = select(external_wp_coreData_namespaceObject.store); return !!__experimentalGetCurrentThemeGlobalStylesVariations()?.length; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Card, { size: "small", isBorderless: true, className: "edit-site-global-styles-screen-root", isRounded: false, children: [ /* @__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: [ /* @__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, {}) }) }), 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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Browse styles") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( IconWithCurrentColor, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default } ) ] }) }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(root_menu_default, {}) ] }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardDivider, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalSpacer, { as: "p", paddingTop: 2, paddingX: "13px", marginBottom: 2, children: (0,external_wp_i18n_namespaceObject.__)( "Customize the appearance of specific blocks for the whole site." ) } ), /* @__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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Blocks") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( IconWithCurrentColor, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default } ) ] }) }) }) ] }) ] } ); } var screen_root_default = ScreenRoot; ;// external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-panel.js const { useGlobalStyle: variations_panel_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function getFilteredBlockStyles(blockStyles, variations) { return blockStyles?.filter( (style) => style.source === "block" || variations.includes(style.name) ); } function useBlockVariations(name) { const blockStyles = (0,external_wp_data_.useSelect)( (select) => { const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store); return getBlockStyles(name); }, [name] ); const [variations] = variations_panel_useGlobalStyle("variations", name); const variationNames = Object.keys(variations ?? {}); return getFilteredBlockStyles(blockStyles, variationNames); } function VariationsPanel({ name }) { const coreBlockStyles = useBlockVariations(name); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: coreBlockStyles.map((style, index) => { if (style?.isDefault) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( NavigationButtonAsItem, { path: "/blocks/" + encodeURIComponent(name) + "/variations/" + encodeURIComponent(style.name), children: style.label }, index ); }) }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/header.js function ScreenHeader({ title, description, onBack }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: [ /* @__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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Navigator.BackButton, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, size: "small", label: (0,external_wp_i18n_namespaceObject.__)("Back"), onClick: onBack } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHeading, { className: "edit-site-global-styles-header", level: 2, size: 13, children: title } ) }) ] }) }) }), description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-global-styles-header__description", children: description }) ] }); } var header_default = ScreenHeader; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block-list.js const { useHasDimensionsPanel: screen_block_list_useHasDimensionsPanel, useHasTypographyPanel: screen_block_list_useHasTypographyPanel, useHasBorderPanel, useGlobalSetting: screen_block_list_useGlobalSetting, useSettingsForBlockElement: screen_block_list_useSettingsForBlockElement, useHasColorPanel: screen_block_list_useHasColorPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function useSortedBlockTypes() { const blockItems = (0,external_wp_data_.useSelect)( (select) => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), [] ); const groupByType = (blocks, block) => { const { core, noncore } = blocks; const type = block.name.startsWith("core/") ? core : noncore; type.push(block); return blocks; }; const { core: coreItems, noncore: nonCoreItems } = blockItems.reduce( groupByType, { core: [], noncore: [] } ); return [...coreItems, ...nonCoreItems]; } function useBlockHasGlobalStyles(blockName) { const [rawSettings] = screen_block_list_useGlobalSetting("", blockName); const settings = screen_block_list_useSettingsForBlockElement(rawSettings, blockName); const hasTypographyPanel = screen_block_list_useHasTypographyPanel(settings); const hasColorPanel = screen_block_list_useHasColorPanel(settings); const hasBorderPanel = useHasBorderPanel(settings); const hasDimensionsPanel = screen_block_list_useHasDimensionsPanel(settings); const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel; const hasVariationsPanel = !!useBlockVariations(blockName)?.length; const hasGlobalStyles = hasTypographyPanel || hasColorPanel || hasLayoutPanel || hasVariationsPanel; return hasGlobalStyles; } function BlockMenuItem({ block }) { const hasBlockMenuItem = useBlockHasGlobalStyles(block.name); if (!hasBlockMenuItem) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( NavigationButtonAsItem, { path: "/blocks/" + encodeURIComponent(block.name), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: block.icon }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: block.title }) ] }) } ); } function BlockList({ filterValue }) { const sortedBlockTypes = useSortedBlockTypes(); const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); const { isMatchingSearchTerm } = (0,external_wp_data_.useSelect)(external_wp_blocks_namespaceObject.store); const filteredBlockTypes = !filterValue ? sortedBlockTypes : sortedBlockTypes.filter( (blockType) => isMatchingSearchTerm(blockType, filterValue) ); const blockTypesListRef = (0,external_wp_element_.useRef)(); (0,external_wp_element_.useEffect)(() => { if (!filterValue) { return; } const count = blockTypesListRef.current.childElementCount; const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of results. */ (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", count), count ); debouncedSpeak(resultsFoundMessage, count); }, [filterValue, debouncedSpeak]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { ref: blockTypesListRef, className: "edit-site-block-types-item-list", role: "list", 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)( BlockMenuItem, { block }, "menu-itemblock-" + block.name )) } ); } const MemoizedBlockList = (0,external_wp_element_.memo)(BlockList); function ScreenBlockList() { const [filterValue, setFilterValue] = (0,external_wp_element_.useState)(""); const deferredFilterValue = (0,external_wp_element_.useDeferredValue)(filterValue); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( header_default, { title: (0,external_wp_i18n_namespaceObject.__)("Blocks"), description: (0,external_wp_i18n_namespaceObject.__)( "Customize the appearance of specific blocks and for the whole site." ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SearchControl, { __nextHasNoMarginBottom: true, className: "edit-site-block-types-search", onChange: setFilterValue, value: filterValue, label: (0,external_wp_i18n_namespaceObject.__)("Search"), placeholder: (0,external_wp_i18n_namespaceObject.__)("Search") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, { filterValue: deferredFilterValue }) ] }); } var screen_block_list_default = ScreenBlockList; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/block-preview-panel.js const BlockPreviewPanel = ({ name, variation = "" }) => { const blockExample = (0,external_wp_blocks_namespaceObject.getBlockType)(name)?.example; const blocks = (0,external_wp_element_.useMemo)(() => { if (!blockExample) { return null; } const example = { ...blockExample, attributes: { ...blockExample.attributes, style: void 0, className: variation ? getVariationClassName(variation) : blockExample.attributes?.className } }; return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, example); }, [name, blockExample, variation]); const viewportWidth = blockExample?.viewportWidth ?? 500; const previewHeight = 144; const sidebarWidth = 235; const scale = sidebarWidth / viewportWidth; const minHeight = scale !== 0 && scale < 1 && previewHeight ? previewHeight / scale : previewHeight; if (!blockExample) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, marginBottom: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "edit-site-global-styles__block-preview-panel", style: { maxHeight: previewHeight, boxSizing: "initial" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.BlockPreview, { blocks, viewportWidth, minHeight: previewHeight, additionalStyles: ( //We want this CSS to be in sync with the one in InserterPreviewPanel. [ { css: ` body{ padding: 24px; min-height:${Math.round(minHeight)}px; display:flex; align-items:center; } .is-root-container { width: 100%; } ` } ] ) } ) } ) }); }; var block_preview_panel_default = BlockPreviewPanel; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/subtitle.js function Subtitle({ children, level }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHeading, { className: "edit-site-global-styles-subtitle", level: level ?? 2, children } ); } var subtitle_default = Subtitle; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block.js const BACKGROUND_BLOCK_DEFAULT_VALUES = { backgroundSize: "cover", backgroundPosition: "50% 50%" // used only when backgroundSize is 'contain'. }; function applyFallbackStyle(border) { if (!border) { return border; } const hasColorOrWidth = border.color || border.width; if (!border.style && hasColorOrWidth) { return { ...border, style: "solid" }; } if (border.style && !hasColorOrWidth) { return void 0; } return border; } function applyAllFallbackStyles(border) { if (!border) { return border; } if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border)) { return { top: applyFallbackStyle(border.top), right: applyFallbackStyle(border.right), bottom: applyFallbackStyle(border.bottom), left: applyFallbackStyle(border.left) }; } return applyFallbackStyle(border); } const { useHasDimensionsPanel: screen_block_useHasDimensionsPanel, useHasTypographyPanel: screen_block_useHasTypographyPanel, useHasBorderPanel: screen_block_useHasBorderPanel, useGlobalSetting: screen_block_useGlobalSetting, useSettingsForBlockElement: screen_block_useSettingsForBlockElement, useHasColorPanel: screen_block_useHasColorPanel, useHasFiltersPanel, useHasImageSettingsPanel, useGlobalStyle: screen_block_useGlobalStyle, useHasBackgroundPanel: screen_block_useHasBackgroundPanel, BackgroundPanel: StylesBackgroundPanel, BorderPanel: StylesBorderPanel, ColorPanel: StylesColorPanel, TypographyPanel: StylesTypographyPanel, DimensionsPanel: StylesDimensionsPanel, FiltersPanel: StylesFiltersPanel, ImageSettingsPanel, AdvancedPanel: StylesAdvancedPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ScreenBlock({ name, variation }) { let prefixParts = []; if (variation) { prefixParts = ["variations", variation].concat(prefixParts); } const prefix = prefixParts.join("."); const [style] = screen_block_useGlobalStyle(prefix, name, "user", { shouldDecodeEncode: false }); const [inheritedStyle, setStyle] = screen_block_useGlobalStyle(prefix, name, "all", { shouldDecodeEncode: false }); const [userSettings] = screen_block_useGlobalSetting("", name, "user"); const [rawSettings, setSettings] = screen_block_useGlobalSetting("", name); const settingsForBlockElement = screen_block_useSettingsForBlockElement( rawSettings, name ); const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); let disableBlockGap = false; if (settingsForBlockElement?.spacing?.blockGap && blockType?.supports?.spacing?.blockGap && (blockType?.supports?.spacing?.__experimentalSkipSerialization === true || blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.( (spacingType) => spacingType === "blockGap" ))) { disableBlockGap = true; } let disableAspectRatio = false; if (settingsForBlockElement?.dimensions?.aspectRatio && name === "core/group") { disableAspectRatio = true; } const settings = (0,external_wp_element_.useMemo)(() => { const updatedSettings = structuredClone(settingsForBlockElement); if (disableBlockGap) { updatedSettings.spacing.blockGap = false; } if (disableAspectRatio) { updatedSettings.dimensions.aspectRatio = false; } return updatedSettings; }, [settingsForBlockElement, disableBlockGap, disableAspectRatio]); const blockVariations = useBlockVariations(name); const hasBackgroundPanel = screen_block_useHasBackgroundPanel(settings); const hasTypographyPanel = screen_block_useHasTypographyPanel(settings); const hasColorPanel = screen_block_useHasColorPanel(settings); const hasBorderPanel = screen_block_useHasBorderPanel(settings); const hasDimensionsPanel = screen_block_useHasDimensionsPanel(settings); const hasFiltersPanel = useHasFiltersPanel(settings); const hasImageSettingsPanel = useHasImageSettingsPanel( name, userSettings, settings ); const hasVariationsPanel = !!blockVariations?.length && !variation; const { canEditCSS } = (0,external_wp_data_.useSelect)((select) => { const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); const globalStylesId = __experimentalGetCurrentGlobalStylesId(); const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0; return { canEditCSS: !!globalStyles?._links?.["wp:action-edit-css"] }; }, []); const currentBlockStyle = variation ? blockVariations.find((s) => s.name === variation) : null; const inheritedStyleWithLayout = (0,external_wp_element_.useMemo)(() => { return { ...inheritedStyle, layout: settings.layout }; }, [inheritedStyle, settings.layout]); const styleWithLayout = (0,external_wp_element_.useMemo)(() => { return { ...style, layout: userSettings.layout }; }, [style, userSettings.layout]); const onChangeDimensions = (newStyle) => { const updatedStyle = { ...newStyle }; delete updatedStyle.layout; setStyle(updatedStyle); if (newStyle.layout !== userSettings.layout) { setSettings({ ...userSettings, layout: newStyle.layout }); } }; const onChangeLightbox = (newSetting) => { if (newSetting === void 0) { setSettings({ ...rawSettings, lightbox: void 0 }); } else { setSettings({ ...rawSettings, lightbox: { ...rawSettings.lightbox, ...newSetting } }); } }; const onChangeBorders = (newStyle) => { if (!newStyle?.border) { setStyle(newStyle); return; } const { radius, ...newBorder } = newStyle.border; const border = applyAllFallbackStyles(newBorder); const updatedBorder = !(0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border) ? { top: border, right: border, bottom: border, left: border } : { color: null, style: null, width: null, ...border }; setStyle({ ...newStyle, border: { ...updatedBorder, radius } }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( header_default, { title: variation ? currentBlockStyle?.label : blockType.title } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_panel_default, { name, variation }), 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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { children: (0,external_wp_i18n_namespaceObject.__)("Style Variations") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(VariationsPanel, { name }) ] }) }), hasColorPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( StylesColorPanel, { inheritedValue: inheritedStyle, value: style, onChange: setStyle, settings } ), hasBackgroundPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( StylesBackgroundPanel, { inheritedValue: inheritedStyle, value: style, onChange: setStyle, settings, defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES } ), hasTypographyPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( StylesTypographyPanel, { inheritedValue: inheritedStyle, value: style, onChange: setStyle, settings } ), hasDimensionsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( StylesDimensionsPanel, { inheritedValue: inheritedStyleWithLayout, value: styleWithLayout, onChange: onChangeDimensions, settings, includeLayoutControls: true } ), hasBorderPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( StylesBorderPanel, { inheritedValue: inheritedStyle, value: style, onChange: onChangeBorders, settings } ), hasFiltersPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( StylesFiltersPanel, { inheritedValue: inheritedStyleWithLayout, value: styleWithLayout, onChange: setStyle, settings, includeLayoutControls: true } ), hasImageSettingsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ImageSettingsPanel, { onChange: onChangeLightbox, value: userSettings, inheritedValue: settings } ), canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Advanced"), initialOpen: false, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: is the name of a block e.g., 'Image' or 'Table'. (0,external_wp_i18n_namespaceObject.__)( "Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value." ), blockType?.title ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( StylesAdvancedPanel, { value: style, onChange: setStyle, inheritedValue: inheritedStyle } ) ] }) ] }); } var screen_block_default = ScreenBlock; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-elements.js const { useGlobalStyle: typography_elements_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ElementItem({ parentMenu, element, label }) { const prefix = element === "text" || !element ? "" : `elements.${element}.`; const extraStyles = element === "link" ? { textDecoration: "underline" } : {}; const [fontFamily] = typography_elements_useGlobalStyle(prefix + "typography.fontFamily"); const [fontStyle] = typography_elements_useGlobalStyle(prefix + "typography.fontStyle"); const [fontWeight] = typography_elements_useGlobalStyle(prefix + "typography.fontWeight"); const [backgroundColor] = typography_elements_useGlobalStyle(prefix + "color.background"); const [fallbackBackgroundColor] = typography_elements_useGlobalStyle("color.background"); const [gradientValue] = typography_elements_useGlobalStyle(prefix + "color.gradient"); const [color] = typography_elements_useGlobalStyle(prefix + "color.text"); 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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles-screen-typography__indicator", style: { fontFamily: fontFamily ?? "serif", background: gradientValue ?? backgroundColor ?? fallbackBackgroundColor, color, fontStyle, fontWeight, ...extraStyles }, "aria-hidden": "true", children: (0,external_wp_i18n_namespaceObject.__)("Aa") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: label }) ] }) }); } function TypographyElements() { const parentMenu = ""; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Elements") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ElementItem, { parentMenu, element: "text", label: (0,external_wp_i18n_namespaceObject.__)("Text") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ElementItem, { parentMenu, element: "link", label: (0,external_wp_i18n_namespaceObject.__)("Links") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ElementItem, { parentMenu, element: "heading", label: (0,external_wp_i18n_namespaceObject.__)("Headings") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ElementItem, { parentMenu, element: "caption", label: (0,external_wp_i18n_namespaceObject.__)("Captions") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ElementItem, { parentMenu, element: "button", label: (0,external_wp_i18n_namespaceObject.__)("Buttons") } ) ] }) ] }); } var typography_elements_default = TypographyElements; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-typography.js const StylesPreviewTypography = ({ variation, isFocused, withHoverView }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreviewWrapper, { label: variation.title, isFocused, withHoverView, children: ({ ratio, key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHStack, { spacing: 10 * ratio, justify: "center", style: { height: "100%", overflow: "hidden" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreviewTypography, { variation, fontSize: 85 * ratio } ) }, key ) } ); }; var preview_typography_default = StylesPreviewTypography; ;// ./node_modules/@wordpress/edit-site/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js const use_theme_style_variations_by_property_EMPTY_ARRAY = []; const { GlobalStylesContext: use_theme_style_variations_by_property_GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock( external_wp_blockEditor_namespaceObject.privateApis ); const { mergeBaseAndUserConfigs: use_theme_style_variations_by_property_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); function removePropertiesFromObject(object, properties) { if (!properties?.length) { return object; } if (typeof object !== "object" || !object || !Object.keys(object).length) { return object; } for (const key in object) { if (properties.includes(key)) { delete object[key]; } else if (typeof object[key] === "object") { removePropertiesFromObject(object[key], properties); } } return object; } function hasThemeVariation({ title, settings, styles }) { return title === (0,external_wp_i18n_namespaceObject.__)("Default") || // Always preserve the default variation. Object.keys(settings).length > 0 || Object.keys(styles).length > 0; } function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) { const { variationsFromTheme } = (0,external_wp_data_.useSelect)((select) => { const _variationsFromTheme = select( external_wp_coreData_namespaceObject.store ).__experimentalGetCurrentThemeGlobalStylesVariations(); return { variationsFromTheme: _variationsFromTheme || use_theme_style_variations_by_property_EMPTY_ARRAY }; }, []); const { user: userVariation } = (0,external_wp_element_.useContext)(use_theme_style_variations_by_property_GlobalStylesContext); const propertiesAsString = properties.toString(); return (0,external_wp_element_.useMemo)(() => { const clonedUserVariation = structuredClone(userVariation); const userVariationWithoutProperties = removePropertiesFromObject( clonedUserVariation, properties ); userVariationWithoutProperties.title = (0,external_wp_i18n_namespaceObject.__)("Default"); const variationsWithPropertiesAndBase = variationsFromTheme.filter((variation) => { return isVariationWithProperties(variation, properties); }).map((variation) => { return use_theme_style_variations_by_property_mergeBaseAndUserConfigs( userVariationWithoutProperties, variation ); }); const variationsByProperties = [ userVariationWithoutProperties, ...variationsWithPropertiesAndBase ]; return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : []; }, [propertiesAsString, userVariation, variationsFromTheme]); } const filterObjectByProperties = (object, properties) => { if (!object || !properties?.length) { return {}; } const newObject = {}; Object.keys(object).forEach((key) => { if (properties.includes(key)) { newObject[key] = object[key]; } else if (typeof object[key] === "object") { const newFilter = filterObjectByProperties( object[key], properties ); if (Object.keys(newFilter).length) { newObject[key] = newFilter; } } }); return newObject; }; function isVariationWithProperties(variation, properties) { const variationWithProperties = filterObjectByProperties( structuredClone(variation), properties ); return areGlobalStyleConfigsEqual(variationWithProperties, variation); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variation.js const { mergeBaseAndUserConfigs: variation_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); const { GlobalStylesContext: variation_GlobalStylesContext, areGlobalStyleConfigsEqual: variation_areGlobalStyleConfigsEqual } = unlock( external_wp_blockEditor_namespaceObject.privateApis ); function Variation({ variation, children, isPill, properties, showTooltip }) { const [isFocused, setIsFocused] = (0,external_wp_element_.useState)(false); const { base, user, setUserConfig } = (0,external_wp_element_.useContext)(variation_GlobalStylesContext); const context = (0,external_wp_element_.useMemo)(() => { let merged = variation_mergeBaseAndUserConfigs(base, variation); if (properties) { merged = filterObjectByProperties(merged, properties); } return { user: variation, base, merged, setUserConfig: () => { } }; }, [variation, base, properties]); const selectVariation = () => setUserConfig(variation); const selectOnEnter = (event) => { if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { event.preventDefault(); selectVariation(); } }; const isActive = (0,external_wp_element_.useMemo)( () => variation_areGlobalStyleConfigsEqual(user, variation), [user, variation] ); let label = variation?.title; if (variation?.description) { label = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: variation title. 2: variation description. */ (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "variation label"), variation?.title, variation?.description ); } const content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx("edit-site-global-styles-variations_item", { "is-active": isActive }), role: "button", onClick: selectVariation, onKeyDown: selectOnEnter, tabIndex: "0", "aria-label": label, "aria-current": isActive, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx( "edit-site-global-styles-variations_item-preview", { "is-pill": isPill } ), children: children(isFocused) } ) } ); 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 }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-typography.js function TypographyVariations({ title, gap = 2 }) { const propertiesToFilter = ["typography"]; const typographyVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter); if (typographyVariations?.length <= 1) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: title }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalGrid, { columns: 3, gap, className: "edit-site-global-styles-style-variations-container", children: typographyVariations.map((variation, index) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Variation, { variation, properties: propertiesToFilter, showTooltip: true, children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( preview_typography_default, { variation } ) }, index ); }) } ) ] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes-count.js function FontSizes() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [ /* @__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") }) }), /* @__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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Font size presets") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default }) ] }) }) }) ] }); } var font_sizes_count_default = FontSizes; ;// ./node_modules/@wordpress/icons/build-module/library/settings.js var settings_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ /* @__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" }), /* @__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" }) ] }); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/resolvers.js const FONT_FAMILIES_URL = "/wp/v2/font-families"; const FONT_COLLECTIONS_URL = "/wp/v2/font-collections"; async function fetchInstallFontFamily(data) { const config = { path: FONT_FAMILIES_URL, method: "POST", body: data }; const response = await external_wp_apiFetch_default()(config); return { id: response.id, ...response.font_family_settings, fontFace: [] }; } async function fetchInstallFontFace(fontFamilyId, data) { const config = { path: `${FONT_FAMILIES_URL}/${fontFamilyId}/font-faces`, method: "POST", body: data }; const response = await external_wp_apiFetch_default()(config); return { id: response.id, ...response.font_face_settings }; } async function fetchGetFontFamilyBySlug(slug) { const config = { path: `${FONT_FAMILIES_URL}?slug=${slug}&_embed=true`, method: "GET" }; const response = await external_wp_apiFetch_default()(config); if (!response || response.length === 0) { return null; } const fontFamilyPost = response[0]; return { id: fontFamilyPost.id, ...fontFamilyPost.font_family_settings, fontFace: fontFamilyPost?._embedded?.font_faces.map( (face) => face.font_face_settings ) || [] }; } async function fetchUninstallFontFamily(fontFamilyId) { const config = { path: `${FONT_FAMILIES_URL}/${fontFamilyId}?force=true`, method: "DELETE" }; return await external_wp_apiFetch_default()(config); } async function fetchFontCollections() { const config = { path: `${FONT_COLLECTIONS_URL}?_fields=slug,name,description`, method: "GET" }; return await external_wp_apiFetch_default()(config); } async function fetchFontCollection(id) { const config = { path: `${FONT_COLLECTIONS_URL}/${id}`, method: "GET" }; return await external_wp_apiFetch_default()(config); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/constants.js const ALLOWED_FILE_EXTENSIONS = ["otf", "ttf", "woff", "woff2"]; const FONT_WEIGHTS = { 100: (0,external_wp_i18n_namespaceObject._x)("Thin", "font weight"), 200: (0,external_wp_i18n_namespaceObject._x)("Extra-light", "font weight"), 300: (0,external_wp_i18n_namespaceObject._x)("Light", "font weight"), 400: (0,external_wp_i18n_namespaceObject._x)("Normal", "font weight"), 500: (0,external_wp_i18n_namespaceObject._x)("Medium", "font weight"), 600: (0,external_wp_i18n_namespaceObject._x)("Semi-bold", "font weight"), 700: (0,external_wp_i18n_namespaceObject._x)("Bold", "font weight"), 800: (0,external_wp_i18n_namespaceObject._x)("Extra-bold", "font weight"), 900: (0,external_wp_i18n_namespaceObject._x)("Black", "font weight") }; const FONT_STYLES = { normal: (0,external_wp_i18n_namespaceObject._x)("Normal", "font style"), italic: (0,external_wp_i18n_namespaceObject._x)("Italic", "font style") }; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/index.js const { File } = window; const { kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); function setUIValuesNeeded(font, extraValues = {}) { if (!font.name && (font.fontFamily || font.slug)) { font.name = font.fontFamily || font.slug; } return { ...font, ...extraValues }; } function isUrlEncoded(url) { if (typeof url !== "string") { return false; } return url !== decodeURIComponent(url); } function getFontFaceVariantName(face) { const weightName = FONT_WEIGHTS[face.fontWeight] || face.fontWeight; const styleName = face.fontStyle === "normal" ? "" : FONT_STYLES[face.fontStyle] || face.fontStyle; return `${weightName} ${styleName}`; } function mergeFontFaces(existing = [], incoming = []) { const map = /* @__PURE__ */ new Map(); for (const face of existing) { map.set(`${face.fontWeight}${face.fontStyle}`, face); } for (const face of incoming) { map.set(`${face.fontWeight}${face.fontStyle}`, face); } return Array.from(map.values()); } function mergeFontFamilies(existing = [], incoming = []) { const map = /* @__PURE__ */ new Map(); for (const font of existing) { map.set(font.slug, { ...font }); } for (const font of incoming) { if (map.has(font.slug)) { const { fontFace: incomingFontFaces, ...restIncoming } = font; const existingFont = map.get(font.slug); const mergedFontFaces = mergeFontFaces( existingFont.fontFace, incomingFontFaces ); map.set(font.slug, { ...restIncoming, fontFace: mergedFontFaces }); } else { map.set(font.slug, { ...font }); } } return Array.from(map.values()); } async function loadFontFaceInBrowser(fontFace, source, addTo = "all") { let dataSource; if (typeof source === "string") { dataSource = `url(${source})`; } else if (source instanceof File) { dataSource = await source.arrayBuffer(); } else { return; } const newFont = new window.FontFace( formatFontFaceName(fontFace.fontFamily), dataSource, { style: fontFace.fontStyle, weight: fontFace.fontWeight } ); const loadedFace = await newFont.load(); if (addTo === "document" || addTo === "all") { document.fonts.add(loadedFace); } if (addTo === "iframe" || addTo === "all") { const iframeDocument = document.querySelector( 'iframe[name="editor-canvas"]' ).contentDocument; iframeDocument.fonts.add(loadedFace); } } function unloadFontFaceInBrowser(fontFace, removeFrom = "all") { const unloadFontFace = (fonts) => { fonts.forEach((f) => { if (f.family === formatFontFaceName(fontFace?.fontFamily) && f.weight === fontFace?.fontWeight && f.style === fontFace?.fontStyle) { fonts.delete(f); } }); }; if (removeFrom === "document" || removeFrom === "all") { unloadFontFace(document.fonts); } if (removeFrom === "iframe" || removeFrom === "all") { const iframeDocument = document.querySelector( 'iframe[name="editor-canvas"]' ).contentDocument; unloadFontFace(iframeDocument.fonts); } } function getDisplaySrcFromFontFace(input) { if (!input) { return; } let src; if (Array.isArray(input)) { src = input[0]; } else { src = input; } if (src.startsWith("file:.")) { return; } if (!isUrlEncoded(src)) { src = encodeURI(src); } return src; } function makeFontFamilyFormData(fontFamily) { const formData = new FormData(); const { fontFace, category, ...familyWithValidParameters } = fontFamily; const fontFamilySettings = { ...familyWithValidParameters, slug: kebabCase(fontFamily.slug) }; formData.append( "font_family_settings", JSON.stringify(fontFamilySettings) ); return formData; } function makeFontFacesFormData(font) { if (font?.fontFace) { const fontFacesFormData = font.fontFace.map((item, faceIndex) => { const face = { ...item }; const formData = new FormData(); if (face.file) { const files = Array.isArray(face.file) ? face.file : [face.file]; const src = []; files.forEach((file, key) => { const fileId = `file-${faceIndex}-${key}`; formData.append(fileId, file, file.name); src.push(fileId); }); face.src = src.length === 1 ? src[0] : src; delete face.file; formData.append("font_face_settings", JSON.stringify(face)); } else { formData.append("font_face_settings", JSON.stringify(face)); } return formData; }); return fontFacesFormData; } } async function batchInstallFontFaces(fontFamilyId, fontFacesData) { const responses = []; for (const faceData of fontFacesData) { try { const response = await fetchInstallFontFace( fontFamilyId, faceData ); responses.push({ status: "fulfilled", value: response }); } catch (error) { responses.push({ status: "rejected", reason: error }); } } const results = { errors: [], successes: [] }; responses.forEach((result, index) => { if (result.status === "fulfilled") { const response = result.value; if (response.id) { results.successes.push(response); } else { results.errors.push({ data: fontFacesData[index], message: `Error: ${response.message}` }); } } else { results.errors.push({ data: fontFacesData[index], message: result.reason.message }); } }); return results; } async function downloadFontFaceAssets(src) { src = Array.isArray(src) ? src : [src]; const files = await Promise.all( src.map(async (url) => { return fetch(new Request(url)).then((response) => { if (!response.ok) { throw new Error( `Error downloading font face asset from ${url}. Server responded with status: ${response.status}` ); } return response.blob(); }).then((blob) => { const filename = url.split("/").pop(); const file = new File([blob], filename, { type: blob.type }); return file; }); }) ); return files.length === 1 ? files[0] : files; } function checkFontFaceInstalled(fontFace, collection) { return -1 !== collection.findIndex((collectionFontFace) => { return collectionFontFace.fontWeight === fontFace.fontWeight && collectionFontFace.fontStyle === fontFace.fontStyle; }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/toggleFont.js function toggleFont(font, face, initialfonts) { const isFontActivated = (f) => f.slug === font.slug; const getActivatedFont = (fonts) => fonts.find(isFontActivated); const toggleEntireFontFamily = (activatedFont2) => { if (!activatedFont2) { return [...initialfonts, font]; } return initialfonts.filter((f) => !isFontActivated(f)); }; const toggleFontVariant = (activatedFont2) => { const isFaceActivated = (f) => f.fontWeight === face.fontWeight && f.fontStyle === face.fontStyle; if (!activatedFont2) { return [...initialfonts, { ...font, fontFace: [face] }]; } let newFontFaces = activatedFont2.fontFace || []; if (newFontFaces.find(isFaceActivated)) { newFontFaces = newFontFaces.filter( (f) => !isFaceActivated(f) ); } else { newFontFaces = [...newFontFaces, face]; } if (newFontFaces.length === 0) { return initialfonts.filter((f) => !isFontActivated(f)); } return initialfonts.map( (f) => isFontActivated(f) ? { ...f, fontFace: newFontFaces } : f ); }; const activatedFont = getActivatedFont(initialfonts); if (!face) { return toggleEntireFontFamily(activatedFont); } return toggleFontVariant(activatedFont); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/context.js const { useGlobalSetting: context_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const FontLibraryContext = (0,external_wp_element_.createContext)({}); FontLibraryContext.displayName = "FontLibraryContext"; function FontLibraryProvider({ children }) { const { saveEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); const { globalStylesId } = (0,external_wp_data_.useSelect)((select) => { const { __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); return { globalStylesId: __experimentalGetCurrentGlobalStylesId() }; }); const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)( "root", "globalStyles", globalStylesId ); const [isInstalling, setIsInstalling] = (0,external_wp_element_.useState)(false); const [refreshKey, setRefreshKey] = (0,external_wp_element_.useState)(0); const refreshLibrary = () => { setRefreshKey(Date.now()); }; const { records: libraryPosts = [], isResolving: isResolvingLibrary } = (0,external_wp_coreData_namespaceObject.useEntityRecords)("postType", "wp_font_family", { refreshKey, _embed: true }); const libraryFonts = (libraryPosts || []).map((fontFamilyPost) => { return { id: fontFamilyPost.id, ...fontFamilyPost.font_family_settings, fontFace: fontFamilyPost?._embedded?.font_faces.map( (face) => face.font_face_settings ) || [] }; }) || []; const [fontFamilies, setFontFamilies] = context_useGlobalSetting( "typography.fontFamilies" ); const saveFontFamilies = async (fonts) => { const updatedGlobalStyles = globalStyles.record; setNestedValue( updatedGlobalStyles, ["settings", "typography", "fontFamilies"], fonts ); await saveEntityRecord("root", "globalStyles", updatedGlobalStyles); }; const [modalTabOpen, setModalTabOpen] = (0,external_wp_element_.useState)(false); const [libraryFontSelected, setLibraryFontSelected] = (0,external_wp_element_.useState)(null); const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map((f) => setUIValuesNeeded(f, { source: "theme" })).sort((a, b) => a.name.localeCompare(b.name)) : []; const customFonts = fontFamilies?.custom ? fontFamilies.custom.map((f) => setUIValuesNeeded(f, { source: "custom" })).sort((a, b) => a.name.localeCompare(b.name)) : []; const baseCustomFonts = libraryFonts ? libraryFonts.map((f) => setUIValuesNeeded(f, { source: "custom" })).sort((a, b) => a.name.localeCompare(b.name)) : []; (0,external_wp_element_.useEffect)(() => { if (!modalTabOpen) { setLibraryFontSelected(null); } }, [modalTabOpen]); const handleSetLibraryFontSelected = (font) => { if (!font) { setLibraryFontSelected(null); return; } const fonts = font.source === "theme" ? themeFonts : baseCustomFonts; const fontSelected = fonts.find((f) => f.slug === font.slug); setLibraryFontSelected({ ...fontSelected || font, source: font.source }); }; const [loadedFontUrls] = (0,external_wp_element_.useState)(/* @__PURE__ */ new Set()); const getAvailableFontsOutline = (availableFontFamilies) => { const outline = availableFontFamilies.reduce((acc, font) => { const availableFontFaces = font?.fontFace && font.fontFace?.length > 0 ? font?.fontFace.map( (face) => `${face.fontStyle + face.fontWeight}` ) : ["normal400"]; acc[font.slug] = availableFontFaces; return acc; }, {}); return outline; }; const getActivatedFontsOutline = (source) => { switch (source) { case "theme": return getAvailableFontsOutline(themeFonts); case "custom": default: return getAvailableFontsOutline(customFonts); } }; const isFontActivated = (slug, style, weight, source) => { if (!style && !weight) { return !!getActivatedFontsOutline(source)[slug]; } return !!getActivatedFontsOutline(source)[slug]?.includes( style + weight ); }; const getFontFacesActivated = (slug, source) => { return getActivatedFontsOutline(source)[slug] || []; }; async function installFonts(fontFamiliesToInstall) { setIsInstalling(true); try { const fontFamiliesToActivate = []; let installationErrors = []; for (const fontFamilyToInstall of fontFamiliesToInstall) { let isANewFontFamily = false; let installedFontFamily = await fetchGetFontFamilyBySlug( fontFamilyToInstall.slug ); if (!installedFontFamily) { isANewFontFamily = true; installedFontFamily = await fetchInstallFontFamily( makeFontFamilyFormData(fontFamilyToInstall) ); } const alreadyInstalledFontFaces = installedFontFamily.fontFace && fontFamilyToInstall.fontFace ? installedFontFamily.fontFace.filter( (fontFaceToInstall) => checkFontFaceInstalled( fontFaceToInstall, fontFamilyToInstall.fontFace ) ) : []; if (installedFontFamily.fontFace && fontFamilyToInstall.fontFace) { fontFamilyToInstall.fontFace = fontFamilyToInstall.fontFace.filter( (fontFaceToInstall) => !checkFontFaceInstalled( fontFaceToInstall, installedFontFamily.fontFace ) ); } let successfullyInstalledFontFaces = []; let unsuccessfullyInstalledFontFaces = []; if (fontFamilyToInstall?.fontFace?.length > 0) { const response = await batchInstallFontFaces( installedFontFamily.id, makeFontFacesFormData(fontFamilyToInstall) ); successfullyInstalledFontFaces = response?.successes; unsuccessfullyInstalledFontFaces = response?.errors; } if (successfullyInstalledFontFaces?.length > 0 || alreadyInstalledFontFaces?.length > 0) { installedFontFamily.fontFace = [ ...successfullyInstalledFontFaces ]; fontFamiliesToActivate.push(installedFontFamily); } if (installedFontFamily && !fontFamilyToInstall?.fontFace?.length) { fontFamiliesToActivate.push(installedFontFamily); } if (isANewFontFamily && fontFamilyToInstall?.fontFace?.length > 0 && successfullyInstalledFontFaces?.length === 0) { await fetchUninstallFontFamily(installedFontFamily.id); } installationErrors = installationErrors.concat( unsuccessfullyInstalledFontFaces ); } installationErrors = installationErrors.reduce( (unique, item) => unique.includes(item.message) ? unique : [...unique, item.message], [] ); if (fontFamiliesToActivate.length > 0) { const activeFonts = activateCustomFontFamilies( fontFamiliesToActivate ); await saveFontFamilies(activeFonts); refreshLibrary(); } if (installationErrors.length > 0) { const installError = new Error( (0,external_wp_i18n_namespaceObject.__)("There was an error installing fonts.") ); installError.installationErrors = installationErrors; throw installError; } } finally { setIsInstalling(false); } } async function uninstallFontFamily(fontFamilyToUninstall) { try { const uninstalledFontFamily = await fetchUninstallFontFamily( fontFamilyToUninstall.id ); if (uninstalledFontFamily.deleted) { const activeFonts = deactivateFontFamily( fontFamilyToUninstall ); await saveFontFamilies(activeFonts); } refreshLibrary(); return uninstalledFontFamily; } catch (error) { console.error( `There was an error uninstalling the font family:`, error ); throw error; } } const deactivateFontFamily = (font) => { const initialCustomFonts = fontFamilies?.[font.source] ?? []; const newCustomFonts = initialCustomFonts.filter( (f) => f.slug !== font.slug ); const activeFonts = { ...fontFamilies, [font.source]: newCustomFonts }; setFontFamilies(activeFonts); if (font.fontFace) { font.fontFace.forEach((face) => { unloadFontFaceInBrowser(face, "all"); }); } return activeFonts; }; const activateCustomFontFamilies = (fontsToAdd) => { const fontsToActivate = cleanFontsForSave(fontsToAdd); const activeFonts = { ...fontFamilies, // Merge the existing custom fonts with the new fonts. custom: mergeFontFamilies(fontFamilies?.custom, fontsToActivate) }; setFontFamilies(activeFonts); loadFontsInBrowser(fontsToActivate); return activeFonts; }; const cleanFontsForSave = (fonts) => { return fonts.map(({ id: _familyDbId, fontFace, ...font }) => ({ ...font, ...fontFace && fontFace.length > 0 ? { fontFace: fontFace.map( ({ id: _faceDbId, ...face }) => face ) } : {} })); }; const loadFontsInBrowser = (fonts) => { fonts.forEach((font) => { if (font.fontFace) { font.fontFace.forEach((face) => { loadFontFaceInBrowser( face, getDisplaySrcFromFontFace(face.src), "all" ); }); } }); }; const toggleActivateFont = (font, face) => { const initialFonts = fontFamilies?.[font.source] ?? []; const newFonts = toggleFont(font, face, initialFonts); setFontFamilies({ ...fontFamilies, [font.source]: newFonts }); const isFaceActivated = isFontActivated( font.slug, face?.fontStyle, face?.fontWeight, font.source ); if (isFaceActivated) { unloadFontFaceInBrowser(face, "all"); } else { loadFontFaceInBrowser( face, getDisplaySrcFromFontFace(face?.src), "all" ); } }; const loadFontFaceAsset = async (fontFace) => { if (!fontFace.src) { return; } const src = getDisplaySrcFromFontFace(fontFace.src); if (!src || loadedFontUrls.has(src)) { return; } loadFontFaceInBrowser(fontFace, src, "document"); loadedFontUrls.add(src); }; const [collections, setFontCollections] = (0,external_wp_element_.useState)([]); const getFontCollections = async () => { const response = await fetchFontCollections(); setFontCollections(response); }; const getFontCollection = async (slug) => { try { const hasData = !!collections.find( (collection) => collection.slug === slug )?.font_families; if (hasData) { return; } const response = await fetchFontCollection(slug); const updatedCollections = collections.map( (collection) => collection.slug === slug ? { ...collection, ...response } : collection ); setFontCollections(updatedCollections); } catch (e) { console.error(e); throw e; } }; (0,external_wp_element_.useEffect)(() => { getFontCollections(); }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FontLibraryContext.Provider, { value: { libraryFontSelected, handleSetLibraryFontSelected, fontFamilies, baseCustomFonts, isFontActivated, getFontFacesActivated, loadFontFaceAsset, installFonts, uninstallFontFamily, toggleActivateFont, getAvailableFontsOutline, modalTabOpen, setModalTabOpen, refreshLibrary, saveFontFamilies, isResolvingLibrary, isInstalling, collections, getFontCollection }, children } ); } var context_default = FontLibraryProvider; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-demo.js function getPreviewUrl(fontFace) { if (fontFace.preview) { return fontFace.preview; } if (fontFace.src) { return Array.isArray(fontFace.src) ? fontFace.src[0] : fontFace.src; } } function getDisplayFontFace(font) { if (font.fontStyle || font.fontWeight) { return font; } if (font.fontFace && font.fontFace.length) { return font.fontFace.find( (face) => face.fontStyle === "normal" && face.fontWeight === "400" ) || font.fontFace[0]; } return { fontStyle: "normal", fontWeight: "400", fontFamily: font.fontFamily, fake: true }; } function FontDemo({ font, text }) { const ref = (0,external_wp_element_.useRef)(null); const fontFace = getDisplayFontFace(font); const style = getFamilyPreviewStyle(font); text = text || font.name; const customPreviewUrl = font.preview; const [isIntersecting, setIsIntersecting] = (0,external_wp_element_.useState)(false); const [isAssetLoaded, setIsAssetLoaded] = (0,external_wp_element_.useState)(false); const { loadFontFaceAsset } = (0,external_wp_element_.useContext)(FontLibraryContext); const previewUrl = customPreviewUrl ?? getPreviewUrl(fontFace); const isPreviewImage = previewUrl && previewUrl.match(/\.(png|jpg|jpeg|gif|svg)$/i); const faceStyles = getFacePreviewStyle(fontFace); const textDemoStyle = { fontSize: "18px", lineHeight: 1, opacity: isAssetLoaded ? "1" : "0", ...style, ...faceStyles }; (0,external_wp_element_.useEffect)(() => { const observer = new window.IntersectionObserver(([entry]) => { setIsIntersecting(entry.isIntersecting); }, {}); observer.observe(ref.current); return () => observer.disconnect(); }, [ref]); (0,external_wp_element_.useEffect)(() => { const loadAsset = async () => { if (isIntersecting) { if (!isPreviewImage && fontFace.src) { await loadFontFaceAsset(fontFace); } setIsAssetLoaded(true); } }; loadAsset(); }, [fontFace, isIntersecting, loadFontFaceAsset, isPreviewImage]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref, children: isPreviewImage ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { src: previewUrl, loading: "lazy", alt: text, className: "font-library-modal__font-variant_demo-image" } ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalText, { style: textDemoStyle, className: "font-library-modal__font-variant_demo-text", children: text } ) }); } var font_demo_default = FontDemo; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-card.js function FontCard({ font, onClick, variantsText, navigatorPath }) { const variantsCount = font.fontFace?.length || 1; const style = { cursor: !!onClick ? "pointer" : "default" }; const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, onClick: () => { onClick(); if (navigatorPath) { navigator.goTo(navigatorPath); } }, style, className: "font-library-modal__font-card", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "space-between", wrap: false, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo_default, { font }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-end", children: [ /* @__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)( /* translators: %d: Number of font variants. */ (0,external_wp_i18n_namespaceObject._n)( "%d variant", "%d variants", variantsCount ), variantsCount ) }) }), /* @__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 }) }) ] }) ] }) } ); } var font_card_default = FontCard; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/library-font-variant.js function LibraryFontVariant({ face, font }) { const { isFontActivated, toggleActivateFont } = (0,external_wp_element_.useContext)(FontLibraryContext); const isInstalled = font?.fontFace?.length > 0 ? isFontActivated( font.slug, face.fontStyle, face.fontWeight, font.source ) : isFontActivated(font.slug, null, null, font.source); const handleToggleActivation = () => { if (font?.fontFace?.length > 0) { toggleActivateFont(font, face); return; } toggleActivateFont(font); }; const displayName = font.name + " " + getFontFaceVariantName(face); const checkboxId = (0,external_wp_element_.useId)(); 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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { checked: isInstalled, onChange: handleToggleActivation, __nextHasNoMarginBottom: true, id: checkboxId } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { htmlFor: checkboxId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( font_demo_default, { font: face, text: displayName, onClick: handleToggleActivation } ) }) ] }) }); } var library_font_variant_default = LibraryFontVariant; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js function getNumericFontWeight(value) { switch (value) { case "normal": return 400; case "bold": return 700; case "bolder": return 500; case "lighter": return 300; default: return parseInt(value, 10); } } function sortFontFaces(faces) { return faces.sort((a, b) => { if (a.fontStyle === "normal" && b.fontStyle !== "normal") { return -1; } if (b.fontStyle === "normal" && a.fontStyle !== "normal") { return 1; } if (a.fontStyle === b.fontStyle) { return getNumericFontWeight(a.fontWeight) - getNumericFontWeight(b.fontWeight); } return a.fontStyle.localeCompare(b.fontStyle); }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/installed-fonts.js const { useGlobalSetting: installed_fonts_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function InstalledFonts() { const { baseCustomFonts, libraryFontSelected, handleSetLibraryFontSelected, refreshLibrary, uninstallFontFamily, isResolvingLibrary, isInstalling, saveFontFamilies, getFontFacesActivated } = (0,external_wp_element_.useContext)(FontLibraryContext); const [fontFamilies, setFontFamilies] = installed_fonts_useGlobalSetting( "typography.fontFamilies" ); const [isConfirmDeleteOpen, setIsConfirmDeleteOpen] = (0,external_wp_element_.useState)(false); const [notice, setNotice] = (0,external_wp_element_.useState)(false); const [baseFontFamilies] = installed_fonts_useGlobalSetting( "typography.fontFamilies", void 0, "base" ); const globalStylesId = (0,external_wp_data_.useSelect)((select) => { const { __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); return __experimentalGetCurrentGlobalStylesId(); }); const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)( "root", "globalStyles", globalStylesId ); const fontFamiliesHasChanges = !!globalStyles?.edits?.settings?.typography?.fontFamilies; const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map((f) => setUIValuesNeeded(f, { source: "theme" })).sort((a, b) => a.name.localeCompare(b.name)) : []; const themeFontsSlugs = new Set(themeFonts.map((f) => f.slug)); const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat( baseFontFamilies.theme.filter((f) => !themeFontsSlugs.has(f.slug)).map((f) => setUIValuesNeeded(f, { source: "theme" })).sort((a, b) => a.name.localeCompare(b.name)) ) : []; const customFontFamilyId = libraryFontSelected?.source === "custom" && libraryFontSelected?.id; const canUserDelete = (0,external_wp_data_.useSelect)( (select) => { const { canUser } = select(external_wp_coreData_namespaceObject.store); return customFontFamilyId && canUser("delete", { kind: "postType", name: "wp_font_family", id: customFontFamilyId }); }, [customFontFamilyId] ); const shouldDisplayDeleteButton = !!libraryFontSelected && libraryFontSelected?.source !== "theme" && canUserDelete; const handleUninstallClick = () => { setIsConfirmDeleteOpen(true); }; const handleUpdate = async () => { setNotice(null); try { await saveFontFamilies(fontFamilies); setNotice({ type: "success", message: (0,external_wp_i18n_namespaceObject.__)("Font family updated successfully.") }); } catch (error) { setNotice({ type: "error", message: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message */ (0,external_wp_i18n_namespaceObject.__)("There was an error updating the font family. %s"), error.message ) }); } }; const getFontFacesToDisplay = (font) => { if (!font) { return []; } if (!font.fontFace || !font.fontFace.length) { return [ { fontFamily: font.fontFamily, fontStyle: "normal", fontWeight: "400" } ]; } return sortFontFaces(font.fontFace); }; const getFontCardVariantsText = (font) => { const variantsInstalled = font?.fontFace?.length > 0 ? font.fontFace.length : 1; const variantsActive = getFontFacesActivated( font.slug, font.source ).length; return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Active font variants, 2: Total font variants. */ (0,external_wp_i18n_namespaceObject.__)("%1$s/%2$s variants active"), variantsActive, variantsInstalled ); }; (0,external_wp_element_.useEffect)(() => { handleSetLibraryFontSelected(libraryFontSelected); refreshLibrary(); }, []); const activeFontsCount = libraryFontSelected ? getFontFacesActivated( libraryFontSelected.slug, libraryFontSelected.source ).length : 0; const selectedFontsCount = libraryFontSelected?.fontFace?.length ?? (libraryFontSelected?.fontFamily ? 1 : 0); const isIndeterminate = activeFontsCount > 0 && activeFontsCount !== selectedFontsCount; const isSelectAllChecked = activeFontsCount === selectedFontsCount; const toggleSelectAll = () => { const initialFonts = fontFamilies?.[libraryFontSelected.source]?.filter( (f) => f.slug !== libraryFontSelected.slug ) ?? []; const newFonts = isSelectAllChecked ? initialFonts : [...initialFonts, libraryFontSelected]; setFontFamilies({ ...fontFamilies, [libraryFontSelected.source]: newFonts }); if (libraryFontSelected.fontFace) { libraryFontSelected.fontFace.forEach((face) => { if (isSelectAllChecked) { unloadFontFaceInBrowser(face, "all"); } else { loadFontFaceInBrowser( face, getDisplaySrcFromFontFace(face?.src), "all" ); } }); } }; const hasFonts = baseThemeFonts.length > 0 || baseCustomFonts.length > 0; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [ 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, {}) }), !isResolvingLibrary && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Navigator, { initialPath: libraryFontSelected ? "/fontFamily" : "/", children: [ /* @__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: [ notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Notice, { status: notice.type, onRemove: () => setNotice(null), children: notice.message } ), !hasFonts && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)("No fonts installed.") }), baseThemeFonts.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "font-library-modal__fonts-title", /* translators: Heading for a list of fonts provided by the theme. */ children: (0,external_wp_i18n_namespaceObject._x)("Theme", "font source") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "ul", { role: "list", className: "font-library-modal__fonts-list", children: baseThemeFonts.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "li", { className: "font-library-modal__fonts-list-item", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( font_card_default, { font, navigatorPath: "/fontFamily", variantsText: getFontCardVariantsText( font ), onClick: () => { setNotice(null); handleSetLibraryFontSelected( font ); } } ) }, font.slug )) } ) ] }), baseCustomFonts.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "font-library-modal__fonts-title", /* translators: Heading for a list of fonts installed by the user. */ children: (0,external_wp_i18n_namespaceObject._x)("Custom", "font source") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "ul", { role: "list", className: "font-library-modal__fonts-list", children: baseCustomFonts.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "li", { className: "font-library-modal__fonts-list-item", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( font_card_default, { font, navigatorPath: "/fontFamily", variantsText: getFontCardVariantsText( font ), onClick: () => { setNotice(null); handleSetLibraryFontSelected( font ); } } ) }, font.slug )) } ) ] }) ] }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/fontFamily", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ConfirmDeleteDialog, { font: libraryFontSelected, isOpen: isConfirmDeleteOpen, setIsOpen: setIsConfirmDeleteOpen, setNotice, uninstallFontFamily, handleSetLibraryFontSelected } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Navigator.BackButton, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, size: "small", onClick: () => { handleSetLibraryFontSelected(null); setNotice(null); }, label: (0,external_wp_i18n_namespaceObject.__)("Back") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, className: "edit-site-global-styles-header", children: libraryFontSelected?.name } ) ] }), notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Notice, { status: notice.type, onRemove: () => setNotice(null), children: notice.message } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)( "Choose font variants. Keep in mind that too many variants could make your site slower." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { className: "font-library-modal__select-all", label: (0,external_wp_i18n_namespaceObject.__)("Select all"), checked: isSelectAllChecked, onChange: toggleSelectAll, indeterminate: isIndeterminate, __nextHasNoMarginBottom: true } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 8 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "ul", { role: "list", className: "font-library-modal__fonts-list", children: getFontFacesToDisplay( libraryFontSelected ).map((face, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "li", { className: "font-library-modal__fonts-list-item", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( library_font_variant_default, { font: libraryFontSelected, face }, `face${i}` ) }, `face${i}` )) } ) ] }) ] }) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-end", className: "font-library-modal__footer", children: [ isInstalling && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}), shouldDisplayDeleteButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, isDestructive: true, variant: "tertiary", onClick: handleUninstallClick, children: (0,external_wp_i18n_namespaceObject.__)("Delete") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: handleUpdate, disabled: !fontFamiliesHasChanges, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)("Update") } ) ] } ) ] }) ] }); } function ConfirmDeleteDialog({ font, isOpen, setIsOpen, setNotice, uninstallFontFamily, handleSetLibraryFontSelected }) { const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); const handleConfirmUninstall = async () => { setNotice(null); setIsOpen(false); try { await uninstallFontFamily(font); navigator.goBack(); handleSetLibraryFontSelected(null); setNotice({ type: "success", message: (0,external_wp_i18n_namespaceObject.__)("Font family uninstalled successfully.") }); } catch (error) { setNotice({ type: "error", message: (0,external_wp_i18n_namespaceObject.__)("There was an error uninstalling the font family.") + error.message }); } }; const handleCancelUninstall = () => { setIsOpen(false); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen, cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"), confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"), onCancel: handleCancelUninstall, onConfirm: handleConfirmUninstall, size: "medium", children: font && (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the font. */ (0,external_wp_i18n_namespaceObject.__)( 'Are you sure you want to delete "%s" font and all its variants and assets?' ), font.name ) } ); } var installed_fonts_default = InstalledFonts; ;// ./node_modules/@wordpress/icons/build-module/library/next.js var next_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/previous.js var previous_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" }) }); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js function filterFonts(fonts, filters) { const { category, search } = filters; let filteredFonts = fonts || []; if (category && category !== "all") { filteredFonts = filteredFonts.filter( (font) => font.categories.indexOf(category) !== -1 ); } if (search) { filteredFonts = filteredFonts.filter( (font) => font.font_family_settings.name.toLowerCase().includes(search.toLowerCase()) ); } return filteredFonts; } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/fonts-outline.js function getFontsOutline(fonts) { return fonts.reduce( (acc, font) => ({ ...acc, [font.slug]: (font?.fontFace || []).reduce( (faces, face) => ({ ...faces, [`${face.fontStyle}-${face.fontWeight}`]: true }), {} ) }), {} ); } function isFontFontFaceInOutline(slug, face, outline) { if (!face) { return !!outline[slug]; } return !!outline[slug]?.[`${face.fontStyle}-${face.fontWeight}`]; } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js function GoogleFontsConfirmDialog() { const handleConfirm = () => { window.localStorage.setItem( "wp-font-library-google-fonts-permission", "true" ); window.dispatchEvent(new Event("storage")); }; 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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, children: (0,external_wp_i18n_namespaceObject.__)("Connect to Google Fonts") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 6 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)( "To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 3 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)( "You can alternatively upload files directly on the Upload tab." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 6 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: handleConfirm, children: (0,external_wp_i18n_namespaceObject.__)("Allow access to Google Fonts") } ) ] }) }) }); } var google_fonts_confirm_dialog_default = GoogleFontsConfirmDialog; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/collection-font-variant.js function CollectionFontVariant({ face, font, handleToggleVariant, selected }) { const handleToggleActivation = () => { if (font?.fontFace) { handleToggleVariant(font, face); return; } handleToggleVariant(font); }; const displayName = font.name + " " + getFontFaceVariantName(face); const checkboxId = (0,external_wp_element_.useId)(); 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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { checked: selected, onChange: handleToggleActivation, __nextHasNoMarginBottom: true, id: checkboxId } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { htmlFor: checkboxId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( font_demo_default, { font: face, text: displayName, onClick: handleToggleActivation } ) }) ] }) }); } var collection_font_variant_default = CollectionFontVariant; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-collection.js const DEFAULT_CATEGORY = { slug: "all", name: (0,external_wp_i18n_namespaceObject._x)("All", "font categories") }; const LOCAL_STORAGE_ITEM = "wp-font-library-google-fonts-permission"; const MIN_WINDOW_HEIGHT = 500; function FontCollection({ slug }) { const requiresPermission = slug === "google-fonts"; const getGoogleFontsPermissionFromStorage = () => { return window.localStorage.getItem(LOCAL_STORAGE_ITEM) === "true"; }; const [selectedFont, setSelectedFont] = (0,external_wp_element_.useState)(null); const [notice, setNotice] = (0,external_wp_element_.useState)(false); const [fontsToInstall, setFontsToInstall] = (0,external_wp_element_.useState)([]); const [page, setPage] = (0,external_wp_element_.useState)(1); const [filters, setFilters] = (0,external_wp_element_.useState)({}); const [renderConfirmDialog, setRenderConfirmDialog] = (0,external_wp_element_.useState)( requiresPermission && !getGoogleFontsPermissionFromStorage() ); const { collections, getFontCollection, installFonts, isInstalling } = (0,external_wp_element_.useContext)(FontLibraryContext); const selectedCollection = collections.find( (collection) => collection.slug === slug ); (0,external_wp_element_.useEffect)(() => { const handleStorage = () => { setRenderConfirmDialog( requiresPermission && !getGoogleFontsPermissionFromStorage() ); }; handleStorage(); window.addEventListener("storage", handleStorage); return () => window.removeEventListener("storage", handleStorage); }, [slug, requiresPermission]); const revokeAccess = () => { window.localStorage.setItem(LOCAL_STORAGE_ITEM, "false"); window.dispatchEvent(new Event("storage")); }; (0,external_wp_element_.useEffect)(() => { const fetchFontCollection = async () => { try { await getFontCollection(slug); resetFilters(); } catch (e) { if (!notice) { setNotice({ type: "error", message: e?.message }); } } }; fetchFontCollection(); }, [slug, getFontCollection, setNotice, notice]); (0,external_wp_element_.useEffect)(() => { setSelectedFont(null); }, [slug]); (0,external_wp_element_.useEffect)(() => { setFontsToInstall([]); }, [selectedFont]); const collectionFonts = (0,external_wp_element_.useMemo)( () => selectedCollection?.font_families ?? [], [selectedCollection] ); const collectionCategories = selectedCollection?.categories ?? []; const categories = [DEFAULT_CATEGORY, ...collectionCategories]; const fonts = (0,external_wp_element_.useMemo)( () => filterFonts(collectionFonts, filters), [collectionFonts, filters] ); const isLoading = !selectedCollection?.font_families && !notice; const windowHeight = Math.max(window.innerHeight, MIN_WINDOW_HEIGHT); const pageSize = Math.floor((windowHeight - 417) / 61); const totalPages = Math.ceil(fonts.length / pageSize); const itemsStart = (page - 1) * pageSize; const itemsLimit = page * pageSize; const items = fonts.slice(itemsStart, itemsLimit); const handleCategoryFilter = (category) => { setFilters({ ...filters, category }); setPage(1); }; const handleUpdateSearchInput = (value) => { setFilters({ ...filters, search: value }); setPage(1); }; const debouncedUpdateSearchInput = (0,external_wp_compose_namespaceObject.debounce)(handleUpdateSearchInput, 300); const resetFilters = () => { setFilters({}); setPage(1); }; const handleToggleVariant = (font, face) => { const newFontsToInstall = toggleFont(font, face, fontsToInstall); setFontsToInstall(newFontsToInstall); }; const fontToInstallOutline = getFontsOutline(fontsToInstall); const resetFontsToInstall = () => { setFontsToInstall([]); }; const selectFontCount = fontsToInstall.length > 0 ? fontsToInstall[0]?.fontFace?.length : 0; const isIndeterminate = selectFontCount > 0 && selectFontCount !== selectedFont?.fontFace?.length; const isSelectAllChecked = selectFontCount === selectedFont?.fontFace?.length; const toggleSelectAll = () => { const newFonts = isSelectAllChecked ? [] : [selectedFont]; setFontsToInstall(newFonts); }; const handleInstall = async () => { setNotice(null); const fontFamily = fontsToInstall[0]; try { if (fontFamily?.fontFace) { await Promise.all( fontFamily.fontFace.map(async (fontFace) => { if (fontFace.src) { fontFace.file = await downloadFontFaceAssets( fontFace.src ); } }) ); } } catch (error) { setNotice({ type: "error", message: (0,external_wp_i18n_namespaceObject.__)( "Error installing the fonts, could not be downloaded." ) }); return; } try { await installFonts([fontFamily]); setNotice({ type: "success", message: (0,external_wp_i18n_namespaceObject.__)("Fonts were installed successfully.") }); } catch (error) { setNotice({ type: "error", message: error.message }); } resetFontsToInstall(); }; const getSortedFontFaces = (fontFamily) => { if (!fontFamily) { return []; } if (!fontFamily.fontFace || !fontFamily.fontFace.length) { return [ { fontFamily: fontFamily.fontFamily, fontStyle: "normal", fontWeight: "400" } ]; } return sortFontFaces(fontFamily.fontFace); }; if (renderConfirmDialog) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(google_fonts_confirm_dialog_default, {}); } const ActionsComponent = () => { if (slug !== "google-fonts" || renderConfirmDialog || selectedFont) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("Actions"), popoverProps: { position: "bottom left" }, controls: [ { title: (0,external_wp_i18n_namespaceObject.__)("Revoke access to Google Fonts"), onClick: revokeAccess } ] } ); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [ 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, {}) }), !isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Navigator, { initialPath: "/", className: "font-library-modal__tabpanel-layout", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: selectedCollection.name }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: selectedCollection.description }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsComponent, {}) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SearchControl, { className: "font-library-modal__search", value: filters.search, placeholder: (0,external_wp_i18n_namespaceObject.__)("Font name\u2026"), label: (0,external_wp_i18n_namespaceObject.__)("Search"), onChange: debouncedUpdateSearchInput, __nextHasNoMarginBottom: true, hideLabelFromVision: false } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Category"), value: filters.category, onChange: handleCategoryFilter, children: categories && categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "option", { value: category.slug, children: category.name }, category.slug )) } ) }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), !!selectedCollection?.font_families?.length && !fonts.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)( "No fonts found. Try with a different search term." ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__fonts-grid__main", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "ul", { role: "list", className: "font-library-modal__fonts-list", children: items.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "li", { className: "font-library-modal__fonts-list-item", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( font_card_default, { font: font.font_family_settings, navigatorPath: "/fontFamily", onClick: () => { setSelectedFont( font.font_family_settings ); } } ) }, font.font_family_settings.slug )) } ) }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/fontFamily", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Navigator.BackButton, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, size: "small", onClick: () => { setSelectedFont(null); setNotice(null); }, label: (0,external_wp_i18n_namespaceObject.__)("Back") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, className: "edit-site-global-styles-header", children: selectedFont?.name } ) ] }), notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Notice, { status: notice.type, onRemove: () => setNotice(null), children: notice.message } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Select font variants to install.") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { className: "font-library-modal__select-all", label: (0,external_wp_i18n_namespaceObject.__)("Select all"), checked: isSelectAllChecked, onChange: toggleSelectAll, indeterminate: isIndeterminate, __nextHasNoMarginBottom: true } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "ul", { role: "list", className: "font-library-modal__fonts-list", children: getSortedFontFaces(selectedFont).map( (face, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "li", { className: "font-library-modal__fonts-list-item", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( collection_font_variant_default, { font: selectedFont, face, handleToggleVariant, selected: isFontFontFaceInOutline( selectedFont.slug, selectedFont.fontFace ? face : null, // If the font has no fontFace, we want to check if the font is in the outline fontToInstallOutline ) } ) }, `face${i}` ) ) } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 16 }) ] }) ] } ), selectedFont && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Flex, { justify: "flex-end", className: "font-library-modal__footer", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", onClick: handleInstall, isBusy: isInstalling, disabled: fontsToInstall.length === 0 || isInstalling, accessibleWhenDisabled: true, children: (0,external_wp_i18n_namespaceObject.__)("Install") } ) } ), !selectedFont && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, className: "font-library-modal__footer", justify: "end", spacing: 6, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", expanded: false, spacing: 1, className: "font-library-modal__page-selection", children: (0,external_wp_element_.createInterpolateElement)( (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Current page number, 2: Total number of pages. (0,external_wp_i18n_namespaceObject._x)( "<div>Page</div>%1$s<div>of %2$s</div>", "paging" ), "<CurrentPage />", totalPages ), { div: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-hidden": true }), CurrentPage: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SelectControl, { "aria-label": (0,external_wp_i18n_namespaceObject.__)( "Current page" ), value: page, options: [ ...Array(totalPages) ].map((e, i) => { return { label: i + 1, value: i + 1 }; }), onChange: (newPage) => setPage( parseInt(newPage) ), size: "small", __nextHasNoMarginBottom: true, variant: "minimal" } ) } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { onClick: () => setPage(page - 1), disabled: page === 1, accessibleWhenDisabled: true, label: (0,external_wp_i18n_namespaceObject.__)("Previous page"), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? next_default : previous_default, showTooltip: true, size: "compact", tooltipPosition: "top" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { onClick: () => setPage(page + 1), disabled: page === totalPages, accessibleWhenDisabled: true, label: (0,external_wp_i18n_namespaceObject.__)("Next page"), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? previous_default : next_default, showTooltip: true, size: "compact", tooltipPosition: "top" } ) ] }) ] } ) ] }) ] }); } var font_collection_default = FontCollection; // EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/unbrotli.js var unbrotli = __webpack_require__(8572); var unbrotli_default = /*#__PURE__*/__webpack_require__.n(unbrotli); // EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/inflate.js var inflate = __webpack_require__(4660); var inflate_default = /*#__PURE__*/__webpack_require__.n(inflate); ;// ./node_modules/@wordpress/edit-site/lib/lib-font.browser.js /** * Credits: * * lib-font * https://github.com/Pomax/lib-font * https://github.com/Pomax/lib-font/blob/master/lib-font.browser.js * * The MIT License (MIT) * * Copyright (c) 2020 pomax@nihongoresources.com * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* eslint eslint-comments/no-unlimited-disable: 0 */ /* eslint-disable */ // import pako from 'pako'; let fetchFunction = globalThis.fetch; // if ( ! fetchFunction ) { // let backlog = []; // fetchFunction = globalThis.fetch = ( ...args ) => // new Promise( ( resolve, reject ) => { // backlog.push( { args: args, resolve: resolve, reject: reject } ); // } ); // import( 'fs' ) // .then( ( fs ) => { // fetchFunction = globalThis.fetch = async function ( path ) { // return new Promise( ( resolve, reject ) => { // fs.readFile( path, ( err, data ) => { // if ( err ) return reject( err ); // resolve( { ok: true, arrayBuffer: () => data.buffer } ); // } ); // } ); // }; // while ( backlog.length ) { // let instruction = backlog.shift(); // fetchFunction( ...instruction.args ) // .then( ( data ) => instruction.resolve( data ) ) // .catch( ( err ) => instruction.reject( err ) ); // } // } ) // .catch( ( err ) => { // console.error( err ); // throw new Error( // `lib-font cannot run unless either the Fetch API or Node's filesystem module is available.` // ); // } ); // } class lib_font_browser_Event { constructor( type, detail = {}, msg ) { this.type = type; this.detail = detail; this.msg = msg; Object.defineProperty( this, `__mayPropagate`, { enumerable: false, writable: true, } ); this.__mayPropagate = true; } preventDefault() {} stopPropagation() { this.__mayPropagate = false; } valueOf() { return this; } toString() { return this.msg ? `[${ this.type } event]: ${ this.msg }` : `[${ this.type } event]`; } } class EventManager { constructor() { this.listeners = {}; } addEventListener( type, listener, useCapture ) { let bin = this.listeners[ type ] || []; if ( useCapture ) bin.unshift( listener ); else bin.push( listener ); this.listeners[ type ] = bin; } removeEventListener( type, listener ) { let bin = this.listeners[ type ] || []; let pos = bin.findIndex( ( e ) => e === listener ); if ( pos > -1 ) { bin.splice( pos, 1 ); this.listeners[ type ] = bin; } } dispatch( event ) { let bin = this.listeners[ event.type ]; if ( bin ) { for ( let l = 0, e = bin.length; l < e; l++ ) { if ( ! event.__mayPropagate ) break; bin[ l ]( event ); } } } } const startDate = new Date( `1904-01-01T00:00:00+0000` ).getTime(); function asText( data ) { return Array.from( data ) .map( ( v ) => String.fromCharCode( v ) ) .join( `` ); } class Parser { constructor( dict, dataview, name ) { this.name = ( name || dict.tag || `` ).trim(); this.length = dict.length; this.start = dict.offset; this.offset = 0; this.data = dataview; [ `getInt8`, `getUint8`, `getInt16`, `getUint16`, `getInt32`, `getUint32`, `getBigInt64`, `getBigUint64`, ].forEach( ( name ) => { let fn = name.replace( /get(Big)?/, '' ).toLowerCase(); let increment = parseInt( name.replace( /[^\d]/g, '' ) ) / 8; Object.defineProperty( this, fn, { get: () => this.getValue( name, increment ), } ); } ); } get currentPosition() { return this.start + this.offset; } set currentPosition( position ) { this.start = position; this.offset = 0; } skip( n = 0, bits = 8 ) { this.offset += ( n * bits ) / 8; } getValue( type, increment ) { let pos = this.start + this.offset; this.offset += increment; try { return this.data[ type ]( pos ); } catch ( e ) { console.error( `parser`, type, increment, this ); console.error( `parser`, this.start, this.offset ); throw e; } } flags( n ) { if ( n === 8 || n === 16 || n === 32 || n === 64 ) { return this[ `uint${ n }` ] .toString( 2 ) .padStart( n, 0 ) .split( `` ) .map( ( v ) => v === '1' ); } console.error( `Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long` ); console.trace(); } get tag() { const t = this.uint32; return asText( [ ( t >> 24 ) & 255, ( t >> 16 ) & 255, ( t >> 8 ) & 255, t & 255, ] ); } get fixed() { let major = this.int16; let minor = Math.round( ( 1e3 * this.uint16 ) / 65356 ); return major + minor / 1e3; } get legacyFixed() { let major = this.uint16; let minor = this.uint16.toString( 16 ).padStart( 4, 0 ); return parseFloat( `${ major }.${ minor }` ); } get uint24() { return ( this.uint8 << 16 ) + ( this.uint8 << 8 ) + this.uint8; } get uint128() { let value = 0; for ( let i = 0; i < 5; i++ ) { let byte = this.uint8; value = value * 128 + ( byte & 127 ); if ( byte < 128 ) break; } return value; } get longdatetime() { return new Date( startDate + 1e3 * parseInt( this.int64.toString() ) ); } get fword() { return this.int16; } get ufword() { return this.uint16; } get Offset16() { return this.uint16; } get Offset32() { return this.uint32; } get F2DOT14() { const bits = p.uint16; const integer = [ 0, 1, -2, -1 ][ bits >> 14 ]; const fraction = bits & 16383; return integer + fraction / 16384; } verifyLength() { if ( this.offset != this.length ) { console.error( `unexpected parsed table size (${ this.offset }) for "${ this.name }" (expected ${ this.length })` ); } } readBytes( n = 0, position = 0, bits = 8, signed = false ) { n = n || this.length; if ( n === 0 ) return []; if ( position ) this.currentPosition = position; const fn = `${ signed ? `` : `u` }int${ bits }`, slice = []; while ( n-- ) slice.push( this[ fn ] ); return slice; } } class ParsedData { constructor( parser ) { const pGetter = { enumerable: false, get: () => parser }; Object.defineProperty( this, `parser`, pGetter ); const start = parser.currentPosition; const startGetter = { enumerable: false, get: () => start }; Object.defineProperty( this, `start`, startGetter ); } load( struct ) { Object.keys( struct ).forEach( ( p ) => { let props = Object.getOwnPropertyDescriptor( struct, p ); if ( props.get ) { this[ p ] = props.get.bind( this ); } else if ( props.value !== undefined ) { this[ p ] = props.value; } } ); if ( this.parser.length ) { this.parser.verifyLength(); } } } class SimpleTable extends ParsedData { constructor( dict, dataview, name ) { const { parser: parser, start: start } = super( new Parser( dict, dataview, name ) ); const pGetter = { enumerable: false, get: () => parser }; Object.defineProperty( this, `p`, pGetter ); const startGetter = { enumerable: false, get: () => start }; Object.defineProperty( this, `tableStart`, startGetter ); } } function lazy$1( object, property, getter ) { let val; Object.defineProperty( object, property, { get: () => { if ( val ) return val; val = getter(); return val; }, enumerable: true, } ); } class SFNT extends SimpleTable { constructor( font, dataview, createTable ) { const { p: p } = super( { offset: 0, length: 12 }, dataview, `sfnt` ); this.version = p.uint32; this.numTables = p.uint16; this.searchRange = p.uint16; this.entrySelector = p.uint16; this.rangeShift = p.uint16; p.verifyLength(); this.directory = [ ...new Array( this.numTables ) ].map( ( _ ) => new TableRecord( p ) ); this.tables = {}; this.directory.forEach( ( entry ) => { const getter = () => createTable( this.tables, { tag: entry.tag, offset: entry.offset, length: entry.length, }, dataview ); lazy$1( this.tables, entry.tag.trim(), getter ); } ); } } class TableRecord { constructor( p ) { this.tag = p.tag; this.checksum = p.uint32; this.offset = p.uint32; this.length = p.uint32; } } const gzipDecode = (inflate_default()).inflate || undefined; let nativeGzipDecode = undefined; // if ( ! gzipDecode ) { // import( 'zlib' ).then( ( zlib ) => { // nativeGzipDecode = ( buffer ) => zlib.unzipSync( buffer ); // } ); // } class WOFF$1 extends SimpleTable { constructor( font, dataview, createTable ) { const { p: p } = super( { offset: 0, length: 44 }, dataview, `woff` ); this.signature = p.tag; this.flavor = p.uint32; this.length = p.uint32; this.numTables = p.uint16; p.uint16; this.totalSfntSize = p.uint32; this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.metaOffset = p.uint32; this.metaLength = p.uint32; this.metaOrigLength = p.uint32; this.privOffset = p.uint32; this.privLength = p.uint32; p.verifyLength(); this.directory = [ ...new Array( this.numTables ) ].map( ( _ ) => new WoffTableDirectoryEntry( p ) ); buildWoffLazyLookups( this, dataview, createTable ); } } class WoffTableDirectoryEntry { constructor( p ) { this.tag = p.tag; this.offset = p.uint32; this.compLength = p.uint32; this.origLength = p.uint32; this.origChecksum = p.uint32; } } function buildWoffLazyLookups( woff, dataview, createTable ) { woff.tables = {}; woff.directory.forEach( ( entry ) => { lazy$1( woff.tables, entry.tag.trim(), () => { let offset = 0; let view = dataview; if ( entry.compLength !== entry.origLength ) { const data = dataview.buffer.slice( entry.offset, entry.offset + entry.compLength ); let unpacked; if ( gzipDecode ) { unpacked = gzipDecode( new Uint8Array( data ) ); } else if ( nativeGzipDecode ) { unpacked = nativeGzipDecode( new Uint8Array( data ) ); } else { const msg = `no brotli decoder available to decode WOFF2 font`; if ( font.onerror ) font.onerror( msg ); throw new Error( msg ); } view = new DataView( unpacked.buffer ); } else { offset = entry.offset; } return createTable( woff.tables, { tag: entry.tag, offset: offset, length: entry.origLength }, view ); } ); } ); } const brotliDecode = (unbrotli_default()); let nativeBrotliDecode = undefined; // if ( ! brotliDecode ) { // import( 'zlib' ).then( ( zlib ) => { // nativeBrotliDecode = ( buffer ) => zlib.brotliDecompressSync( buffer ); // } ); // } class WOFF2$1 extends SimpleTable { constructor( font, dataview, createTable ) { const { p: p } = super( { offset: 0, length: 48 }, dataview, `woff2` ); this.signature = p.tag; this.flavor = p.uint32; this.length = p.uint32; this.numTables = p.uint16; p.uint16; this.totalSfntSize = p.uint32; this.totalCompressedSize = p.uint32; this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.metaOffset = p.uint32; this.metaLength = p.uint32; this.metaOrigLength = p.uint32; this.privOffset = p.uint32; this.privLength = p.uint32; p.verifyLength(); this.directory = [ ...new Array( this.numTables ) ].map( ( _ ) => new Woff2TableDirectoryEntry( p ) ); let dictOffset = p.currentPosition; this.directory[ 0 ].offset = 0; this.directory.forEach( ( e, i ) => { let next = this.directory[ i + 1 ]; if ( next ) { next.offset = e.offset + ( e.transformLength !== undefined ? e.transformLength : e.origLength ); } } ); let decoded; let buffer = dataview.buffer.slice( dictOffset ); if ( brotliDecode ) { decoded = brotliDecode( new Uint8Array( buffer ) ); } else if ( nativeBrotliDecode ) { decoded = new Uint8Array( nativeBrotliDecode( buffer ) ); } else { const msg = `no brotli decoder available to decode WOFF2 font`; if ( font.onerror ) font.onerror( msg ); throw new Error( msg ); } buildWoff2LazyLookups( this, decoded, createTable ); } } class Woff2TableDirectoryEntry { constructor( p ) { this.flags = p.uint8; const tagNumber = ( this.tagNumber = this.flags & 63 ); if ( tagNumber === 63 ) { this.tag = p.tag; } else { this.tag = getWOFF2Tag( tagNumber ); } const transformVersion = ( this.transformVersion = ( this.flags & 192 ) >> 6 ); let hasTransforms = transformVersion !== 0; if ( this.tag === `glyf` || this.tag === `loca` ) { hasTransforms = this.transformVersion !== 3; } this.origLength = p.uint128; if ( hasTransforms ) { this.transformLength = p.uint128; } } } function buildWoff2LazyLookups( woff2, decoded, createTable ) { woff2.tables = {}; woff2.directory.forEach( ( entry ) => { lazy$1( woff2.tables, entry.tag.trim(), () => { const start = entry.offset; const end = start + ( entry.transformLength ? entry.transformLength : entry.origLength ); const data = new DataView( decoded.slice( start, end ).buffer ); try { return createTable( woff2.tables, { tag: entry.tag, offset: 0, length: entry.origLength }, data ); } catch ( e ) { console.error( e ); } } ); } ); } function getWOFF2Tag( flag ) { return [ `cmap`, `head`, `hhea`, `hmtx`, `maxp`, `name`, `OS/2`, `post`, `cvt `, `fpgm`, `glyf`, `loca`, `prep`, `CFF `, `VORG`, `EBDT`, `EBLC`, `gasp`, `hdmx`, `kern`, `LTSH`, `PCLT`, `VDMX`, `vhea`, `vmtx`, `BASE`, `GDEF`, `GPOS`, `GSUB`, `EBSC`, `JSTF`, `MATH`, `CBDT`, `CBLC`, `COLR`, `CPAL`, `SVG `, `sbix`, `acnt`, `avar`, `bdat`, `bloc`, `bsln`, `cvar`, `fdsc`, `feat`, `fmtx`, `fvar`, `gvar`, `hsty`, `just`, `lcar`, `mort`, `morx`, `opbd`, `prop`, `trak`, `Zapf`, `Silf`, `Glat`, `Gloc`, `Feat`, `Sill`, ][ flag & 63 ]; } const tableClasses = {}; let tableClassesLoaded = false; Promise.all( [ Promise.resolve().then( function () { return cmap$1; } ), Promise.resolve().then( function () { return head$1; } ), Promise.resolve().then( function () { return hhea$1; } ), Promise.resolve().then( function () { return hmtx$1; } ), Promise.resolve().then( function () { return maxp$1; } ), Promise.resolve().then( function () { return name$1; } ), Promise.resolve().then( function () { return OS2$1; } ), Promise.resolve().then( function () { return post$1; } ), Promise.resolve().then( function () { return BASE$1; } ), Promise.resolve().then( function () { return GDEF$1; } ), Promise.resolve().then( function () { return GSUB$1; } ), Promise.resolve().then( function () { return GPOS$1; } ), Promise.resolve().then( function () { return SVG$1; } ), Promise.resolve().then( function () { return fvar$1; } ), Promise.resolve().then( function () { return cvt$1; } ), Promise.resolve().then( function () { return fpgm$1; } ), Promise.resolve().then( function () { return gasp$1; } ), Promise.resolve().then( function () { return glyf$1; } ), Promise.resolve().then( function () { return loca$1; } ), Promise.resolve().then( function () { return prep$1; } ), Promise.resolve().then( function () { return CFF$1; } ), Promise.resolve().then( function () { return CFF2$1; } ), Promise.resolve().then( function () { return VORG$1; } ), Promise.resolve().then( function () { return EBLC$1; } ), Promise.resolve().then( function () { return EBDT$1; } ), Promise.resolve().then( function () { return EBSC$1; } ), Promise.resolve().then( function () { return CBLC$1; } ), Promise.resolve().then( function () { return CBDT$1; } ), Promise.resolve().then( function () { return sbix$1; } ), Promise.resolve().then( function () { return COLR$1; } ), Promise.resolve().then( function () { return CPAL$1; } ), Promise.resolve().then( function () { return DSIG$1; } ), Promise.resolve().then( function () { return hdmx$1; } ), Promise.resolve().then( function () { return kern$1; } ), Promise.resolve().then( function () { return LTSH$1; } ), Promise.resolve().then( function () { return MERG$1; } ), Promise.resolve().then( function () { return meta$1; } ), Promise.resolve().then( function () { return PCLT$1; } ), Promise.resolve().then( function () { return VDMX$1; } ), Promise.resolve().then( function () { return vhea$1; } ), Promise.resolve().then( function () { return vmtx$1; } ), ] ).then( ( data ) => { data.forEach( ( e ) => { let name = Object.keys( e )[ 0 ]; tableClasses[ name ] = e[ name ]; } ); tableClassesLoaded = true; } ); function createTable( tables, dict, dataview ) { let name = dict.tag.replace( /[^\w\d]/g, `` ); let Type = tableClasses[ name ]; if ( Type ) return new Type( dict, dataview, tables ); console.warn( `lib-font has no definition for ${ name }. The table was skipped.` ); return {}; } function loadTableClasses() { let count = 0; function checkLoaded( resolve, reject ) { if ( ! tableClassesLoaded ) { if ( count > 10 ) { return reject( new Error( `loading took too long` ) ); } count++; return setTimeout( () => checkLoaded( resolve ), 250 ); } resolve( createTable ); } return new Promise( ( resolve, reject ) => checkLoaded( resolve ) ); } function getFontCSSFormat( path, errorOnStyle ) { let pos = path.lastIndexOf( `.` ); let ext = ( path.substring( pos + 1 ) || `` ).toLowerCase(); let format = { ttf: `truetype`, otf: `opentype`, woff: `woff`, woff2: `woff2`, }[ ext ]; if ( format ) return format; let msg = { 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.`, 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.`, fon: `The .fon format is not supported: this is an ancient Windows bitmap font format.`, ttc: `Based on the current CSS specification, font collections are not (yet?) supported.`, }[ ext ]; if ( ! msg ) msg = `${ path } is not a known webfont format.`; if ( errorOnStyle ) { throw new Error( msg ); } else { console.warn( `Could not load font: ${ msg }` ); } } async function setupFontFace( name, url, options = {} ) { if ( ! globalThis.document ) return; let format = getFontCSSFormat( url, options.errorOnStyle ); if ( ! format ) return; let style = document.createElement( `style` ); style.className = `injected-by-Font-js`; let rules = []; if ( options.styleRules ) { rules = Object.entries( options.styleRules ).map( ( [ key, value ] ) => `${ key }: ${ value };` ); } style.textContent = `\n@font-face {\n font-family: "${ name }";\n ${ rules.join( `\n\t` ) }\n src: url("${ url }") format("${ format }");\n}`; globalThis.document.head.appendChild( style ); return style; } const TTF = [ 0, 1, 0, 0 ]; const OTF = [ 79, 84, 84, 79 ]; const WOFF = [ 119, 79, 70, 70 ]; const WOFF2 = [ 119, 79, 70, 50 ]; function match( ar1, ar2 ) { if ( ar1.length !== ar2.length ) return; for ( let i = 0; i < ar1.length; i++ ) { if ( ar1[ i ] !== ar2[ i ] ) return; } return true; } function validFontFormat( dataview ) { const LEAD_BYTES = [ dataview.getUint8( 0 ), dataview.getUint8( 1 ), dataview.getUint8( 2 ), dataview.getUint8( 3 ), ]; if ( match( LEAD_BYTES, TTF ) || match( LEAD_BYTES, OTF ) ) return `SFNT`; if ( match( LEAD_BYTES, WOFF ) ) return `WOFF`; if ( match( LEAD_BYTES, WOFF2 ) ) return `WOFF2`; } function checkFetchResponseStatus( response ) { if ( ! response.ok ) { throw new Error( `HTTP ${ response.status } - ${ response.statusText }` ); } return response; } class Font extends EventManager { constructor( name, options = {} ) { super(); this.name = name; this.options = options; this.metrics = false; } get src() { return this.__src; } set src( src ) { this.__src = src; ( async () => { if ( globalThis.document && ! this.options.skipStyleSheet ) { await setupFontFace( this.name, src, this.options ); } this.loadFont( src ); } )(); } async loadFont( url, filename ) { fetch( url ) .then( ( response ) => checkFetchResponseStatus( response ) && response.arrayBuffer() ) .then( ( buffer ) => this.fromDataBuffer( buffer, filename || url ) ) .catch( ( err ) => { const evt = new lib_font_browser_Event( `error`, err, `Failed to load font at ${ filename || url }` ); this.dispatch( evt ); if ( this.onerror ) this.onerror( evt ); } ); } async fromDataBuffer( buffer, filenameOrUrL ) { this.fontData = new DataView( buffer ); let type = validFontFormat( this.fontData ); if ( ! type ) { throw new Error( `${ filenameOrUrL } is either an unsupported font format, or not a font at all.` ); } await this.parseBasicData( type ); const evt = new lib_font_browser_Event( 'load', { font: this } ); this.dispatch( evt ); if ( this.onload ) this.onload( evt ); } async parseBasicData( type ) { return loadTableClasses().then( ( createTable ) => { if ( type === `SFNT` ) { this.opentype = new SFNT( this, this.fontData, createTable ); } if ( type === `WOFF` ) { this.opentype = new WOFF$1( this, this.fontData, createTable ); } if ( type === `WOFF2` ) { this.opentype = new WOFF2$1( this, this.fontData, createTable ); } return this.opentype; } ); } getGlyphId( char ) { return this.opentype.tables.cmap.getGlyphId( char ); } reverse( glyphid ) { return this.opentype.tables.cmap.reverse( glyphid ); } supports( char ) { return this.getGlyphId( char ) !== 0; } supportsVariation( variation ) { return ( this.opentype.tables.cmap.supportsVariation( variation ) !== false ); } measureText( text, size = 16 ) { if ( this.__unloaded ) throw new Error( 'Cannot measure text: font was unloaded. Please reload before calling measureText()' ); let d = document.createElement( 'div' ); d.textContent = text; d.style.fontFamily = this.name; d.style.fontSize = `${ size }px`; d.style.color = `transparent`; d.style.background = `transparent`; d.style.top = `0`; d.style.left = `0`; d.style.position = `absolute`; document.body.appendChild( d ); let bbox = d.getBoundingClientRect(); document.body.removeChild( d ); const OS2 = this.opentype.tables[ 'OS/2' ]; bbox.fontSize = size; bbox.ascender = OS2.sTypoAscender; bbox.descender = OS2.sTypoDescender; return bbox; } unload() { if ( this.styleElement.parentNode ) { this.styleElement.parentNode.removeElement( this.styleElement ); const evt = new lib_font_browser_Event( 'unload', { font: this } ); this.dispatch( evt ); if ( this.onunload ) this.onunload( evt ); } this._unloaded = true; } load() { if ( this.__unloaded ) { delete this.__unloaded; document.head.appendChild( this.styleElement ); const evt = new lib_font_browser_Event( 'load', { font: this } ); this.dispatch( evt ); if ( this.onload ) this.onload( evt ); } } } globalThis.Font = Font; class Subtable extends ParsedData { constructor( p, plaformID, encodingID ) { super( p ); this.plaformID = plaformID; this.encodingID = encodingID; } } class Format0 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 0; this.length = p.uint16; this.language = p.uint16; this.glyphIdArray = [ ...new Array( 256 ) ].map( ( _ ) => p.uint8 ); } supports( charCode ) { if ( charCode.charCodeAt ) { charCode = -1; console.warn( `supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.` ); } return 0 <= charCode && charCode <= 255; } reverse( glyphID ) { console.warn( `reverse not implemented for cmap subtable format 0` ); return {}; } getSupportedCharCodes() { return [ { start: 1, end: 256 } ]; } } class Format2 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 2; this.length = p.uint16; this.language = p.uint16; this.subHeaderKeys = [ ...new Array( 256 ) ].map( ( _ ) => p.uint16 ); const subHeaderCount = Math.max( ...this.subHeaderKeys ); const subHeaderOffset = p.currentPosition; lazy$1( this, `subHeaders`, () => { p.currentPosition = subHeaderOffset; return [ ...new Array( subHeaderCount ) ].map( ( _ ) => new SubHeader( p ) ); } ); const glyphIndexOffset = subHeaderOffset + subHeaderCount * 8; lazy$1( this, `glyphIndexArray`, () => { p.currentPosition = glyphIndexOffset; return [ ...new Array( subHeaderCount ) ].map( ( _ ) => p.uint16 ); } ); } supports( charCode ) { if ( charCode.charCodeAt ) { charCode = -1; console.warn( `supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented.` ); } const low = charCode && 255; const high = charCode && 65280; const subHeaderKey = this.subHeaders[ high ]; const subheader = this.subHeaders[ subHeaderKey ]; const first = subheader.firstCode; const last = first + subheader.entryCount; return first <= low && low <= last; } reverse( glyphID ) { console.warn( `reverse not implemented for cmap subtable format 2` ); return {}; } getSupportedCharCodes( preservePropNames = false ) { if ( preservePropNames ) { return this.subHeaders.map( ( h ) => ( { firstCode: h.firstCode, lastCode: h.lastCode, } ) ); } return this.subHeaders.map( ( h ) => ( { start: h.firstCode, end: h.lastCode, } ) ); } } class SubHeader { constructor( p ) { this.firstCode = p.uint16; this.entryCount = p.uint16; this.lastCode = this.first + this.entryCount; this.idDelta = p.int16; this.idRangeOffset = p.uint16; } } class Format4 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 4; this.length = p.uint16; this.language = p.uint16; this.segCountX2 = p.uint16; this.segCount = this.segCountX2 / 2; this.searchRange = p.uint16; this.entrySelector = p.uint16; this.rangeShift = p.uint16; const endCodePosition = p.currentPosition; lazy$1( this, `endCode`, () => p.readBytes( this.segCount, endCodePosition, 16 ) ); const startCodePosition = endCodePosition + 2 + this.segCountX2; lazy$1( this, `startCode`, () => p.readBytes( this.segCount, startCodePosition, 16 ) ); const idDeltaPosition = startCodePosition + this.segCountX2; lazy$1( this, `idDelta`, () => p.readBytes( this.segCount, idDeltaPosition, 16, true ) ); const idRangePosition = idDeltaPosition + this.segCountX2; lazy$1( this, `idRangeOffset`, () => p.readBytes( this.segCount, idRangePosition, 16 ) ); const glyphIdArrayPosition = idRangePosition + this.segCountX2; const glyphIdArrayLength = this.length - ( glyphIdArrayPosition - this.tableStart ); lazy$1( this, `glyphIdArray`, () => p.readBytes( glyphIdArrayLength, glyphIdArrayPosition, 16 ) ); lazy$1( this, `segments`, () => this.buildSegments( idRangePosition, glyphIdArrayPosition, p ) ); } buildSegments( idRangePosition, glyphIdArrayPosition, p ) { const build = ( _, i ) => { let startCode = this.startCode[ i ], endCode = this.endCode[ i ], idDelta = this.idDelta[ i ], idRangeOffset = this.idRangeOffset[ i ], idRangeOffsetPointer = idRangePosition + 2 * i, glyphIDs = []; if ( idRangeOffset === 0 ) { for ( let i = startCode + idDelta, e = endCode + idDelta; i <= e; i++ ) { glyphIDs.push( i ); } } else { for ( let i = 0, e = endCode - startCode; i <= e; i++ ) { p.currentPosition = idRangeOffsetPointer + idRangeOffset + i * 2; glyphIDs.push( p.uint16 ); } } return { startCode: startCode, endCode: endCode, idDelta: idDelta, idRangeOffset: idRangeOffset, glyphIDs: glyphIDs, }; }; return [ ...new Array( this.segCount ) ].map( build ); } reverse( glyphID ) { let s = this.segments.find( ( v ) => v.glyphIDs.includes( glyphID ) ); if ( ! s ) return {}; const code = s.startCode + s.glyphIDs.indexOf( glyphID ); return { code: code, unicode: String.fromCodePoint( code ) }; } getGlyphId( charCode ) { if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); if ( 55296 <= charCode && charCode <= 57343 ) return 0; if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 ) return 0; let segment = this.segments.find( ( s ) => s.startCode <= charCode && charCode <= s.endCode ); if ( ! segment ) return 0; return segment.glyphIDs[ charCode - segment.startCode ]; } supports( charCode ) { return this.getGlyphId( charCode ) !== 0; } getSupportedCharCodes( preservePropNames = false ) { if ( preservePropNames ) return this.segments; return this.segments.map( ( v ) => ( { start: v.startCode, end: v.endCode, } ) ); } } class Format6 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 6; this.length = p.uint16; this.language = p.uint16; this.firstCode = p.uint16; this.entryCount = p.uint16; this.lastCode = this.firstCode + this.entryCount - 1; const getter = () => [ ...new Array( this.entryCount ) ].map( ( _ ) => p.uint16 ); lazy$1( this, `glyphIdArray`, getter ); } supports( charCode ) { if ( charCode.charCodeAt ) { charCode = -1; console.warn( `supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.` ); } if ( charCode < this.firstCode ) return {}; if ( charCode > this.firstCode + this.entryCount ) return {}; const code = charCode - this.firstCode; return { code: code, unicode: String.fromCodePoint( code ) }; } reverse( glyphID ) { let pos = this.glyphIdArray.indexOf( glyphID ); if ( pos > -1 ) return this.firstCode + pos; } getSupportedCharCodes( preservePropNames = false ) { if ( preservePropNames ) { return [ { firstCode: this.firstCode, lastCode: this.lastCode } ]; } return [ { start: this.firstCode, end: this.lastCode } ]; } } class Format8 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 8; p.uint16; this.length = p.uint32; this.language = p.uint32; this.is32 = [ ...new Array( 8192 ) ].map( ( _ ) => p.uint8 ); this.numGroups = p.uint32; const getter = () => [ ...new Array( this.numGroups ) ].map( ( _ ) => new SequentialMapGroup$1( p ) ); lazy$1( this, `groups`, getter ); } supports( charCode ) { if ( charCode.charCodeAt ) { charCode = -1; console.warn( `supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.` ); } return ( this.groups.findIndex( ( s ) => s.startcharCode <= charCode && charCode <= s.endcharCode ) !== -1 ); } reverse( glyphID ) { console.warn( `reverse not implemented for cmap subtable format 8` ); return {}; } getSupportedCharCodes( preservePropNames = false ) { if ( preservePropNames ) return this.groups; return this.groups.map( ( v ) => ( { start: v.startcharCode, end: v.endcharCode, } ) ); } } class SequentialMapGroup$1 { constructor( p ) { this.startcharCode = p.uint32; this.endcharCode = p.uint32; this.startGlyphID = p.uint32; } } class Format10 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 10; p.uint16; this.length = p.uint32; this.language = p.uint32; this.startCharCode = p.uint32; this.numChars = p.uint32; this.endCharCode = this.startCharCode + this.numChars; const getter = () => [ ...new Array( this.numChars ) ].map( ( _ ) => p.uint16 ); lazy$1( this, `glyphs`, getter ); } supports( charCode ) { if ( charCode.charCodeAt ) { charCode = -1; console.warn( `supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.` ); } if ( charCode < this.startCharCode ) return false; if ( charCode > this.startCharCode + this.numChars ) return false; return charCode - this.startCharCode; } reverse( glyphID ) { console.warn( `reverse not implemented for cmap subtable format 10` ); return {}; } getSupportedCharCodes( preservePropNames = false ) { if ( preservePropNames ) { return [ { startCharCode: this.startCharCode, endCharCode: this.endCharCode, }, ]; } return [ { start: this.startCharCode, end: this.endCharCode } ]; } } class Format12 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 12; p.uint16; this.length = p.uint32; this.language = p.uint32; this.numGroups = p.uint32; const getter = () => [ ...new Array( this.numGroups ) ].map( ( _ ) => new SequentialMapGroup( p ) ); lazy$1( this, `groups`, getter ); } supports( charCode ) { if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); if ( 55296 <= charCode && charCode <= 57343 ) return 0; if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 ) return 0; return ( this.groups.findIndex( ( s ) => s.startCharCode <= charCode && charCode <= s.endCharCode ) !== -1 ); } reverse( glyphID ) { for ( let group of this.groups ) { let start = group.startGlyphID; if ( start > glyphID ) continue; if ( start === glyphID ) return group.startCharCode; let end = start + ( group.endCharCode - group.startCharCode ); if ( end < glyphID ) continue; const code = group.startCharCode + ( glyphID - start ); return { code: code, unicode: String.fromCodePoint( code ) }; } return {}; } getSupportedCharCodes( preservePropNames = false ) { if ( preservePropNames ) return this.groups; return this.groups.map( ( v ) => ( { start: v.startCharCode, end: v.endCharCode, } ) ); } } class SequentialMapGroup { constructor( p ) { this.startCharCode = p.uint32; this.endCharCode = p.uint32; this.startGlyphID = p.uint32; } } class Format13 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.format = 13; p.uint16; this.length = p.uint32; this.language = p.uint32; this.numGroups = p.uint32; const getter = [ ...new Array( this.numGroups ) ].map( ( _ ) => new ConstantMapGroup( p ) ); lazy$1( this, `groups`, getter ); } supports( charCode ) { if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 ); return ( this.groups.findIndex( ( s ) => s.startCharCode <= charCode && charCode <= s.endCharCode ) !== -1 ); } reverse( glyphID ) { console.warn( `reverse not implemented for cmap subtable format 13` ); return {}; } getSupportedCharCodes( preservePropNames = false ) { if ( preservePropNames ) return this.groups; return this.groups.map( ( v ) => ( { start: v.startCharCode, end: v.endCharCode, } ) ); } } class ConstantMapGroup { constructor( p ) { this.startCharCode = p.uint32; this.endCharCode = p.uint32; this.glyphID = p.uint32; } } class Format14 extends Subtable { constructor( p, platformID, encodingID ) { super( p, platformID, encodingID ); this.subTableStart = p.currentPosition; this.format = 14; this.length = p.uint32; this.numVarSelectorRecords = p.uint32; lazy$1( this, `varSelectors`, () => [ ...new Array( this.numVarSelectorRecords ) ].map( ( _ ) => new VariationSelector( p ) ) ); } supports() { console.warn( `supports not implemented for cmap subtable format 14` ); return 0; } getSupportedCharCodes() { console.warn( `getSupportedCharCodes not implemented for cmap subtable format 14` ); return []; } reverse( glyphID ) { console.warn( `reverse not implemented for cmap subtable format 14` ); return {}; } supportsVariation( variation ) { let v = this.varSelector.find( ( uvs ) => uvs.varSelector === variation ); return v ? v : false; } getSupportedVariations() { return this.varSelectors.map( ( v ) => v.varSelector ); } } class VariationSelector { constructor( p ) { this.varSelector = p.uint24; this.defaultUVSOffset = p.Offset32; this.nonDefaultUVSOffset = p.Offset32; } } function createSubTable( parser, platformID, encodingID ) { const format = parser.uint16; if ( format === 0 ) return new Format0( parser, platformID, encodingID ); if ( format === 2 ) return new Format2( parser, platformID, encodingID ); if ( format === 4 ) return new Format4( parser, platformID, encodingID ); if ( format === 6 ) return new Format6( parser, platformID, encodingID ); if ( format === 8 ) return new Format8( parser, platformID, encodingID ); if ( format === 10 ) return new Format10( parser, platformID, encodingID ); if ( format === 12 ) return new Format12( parser, platformID, encodingID ); if ( format === 13 ) return new Format13( parser, platformID, encodingID ); if ( format === 14 ) return new Format14( parser, platformID, encodingID ); return {}; } class cmap extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.numTables = p.uint16; this.encodingRecords = [ ...new Array( this.numTables ) ].map( ( _ ) => new EncodingRecord( p, this.tableStart ) ); } getSubTable( tableID ) { return this.encodingRecords[ tableID ].table; } getSupportedEncodings() { return this.encodingRecords.map( ( r ) => ( { platformID: r.platformID, encodingId: r.encodingID, } ) ); } getSupportedCharCodes( platformID, encodingID ) { const recordID = this.encodingRecords.findIndex( ( r ) => r.platformID === platformID && r.encodingID === encodingID ); if ( recordID === -1 ) return false; const subtable = this.getSubTable( recordID ); return subtable.getSupportedCharCodes(); } reverse( glyphid ) { for ( let i = 0; i < this.numTables; i++ ) { let code = this.getSubTable( i ).reverse( glyphid ); if ( code ) return code; } } getGlyphId( char ) { let last = 0; this.encodingRecords.some( ( _, tableID ) => { let t = this.getSubTable( tableID ); if ( ! t.getGlyphId ) return false; last = t.getGlyphId( char ); return last !== 0; } ); return last; } supports( char ) { return this.encodingRecords.some( ( _, tableID ) => { const t = this.getSubTable( tableID ); return t.supports && t.supports( char ) !== false; } ); } supportsVariation( variation ) { return this.encodingRecords.some( ( _, tableID ) => { const t = this.getSubTable( tableID ); return ( t.supportsVariation && t.supportsVariation( variation ) !== false ); } ); } } class EncodingRecord { constructor( p, tableStart ) { const platformID = ( this.platformID = p.uint16 ); const encodingID = ( this.encodingID = p.uint16 ); const offset = ( this.offset = p.Offset32 ); lazy$1( this, `table`, () => { p.currentPosition = tableStart + offset; return createSubTable( p, platformID, encodingID ); } ); } } var cmap$1 = Object.freeze( { __proto__: null, cmap: cmap } ); class head extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.load( { majorVersion: p.uint16, minorVersion: p.uint16, fontRevision: p.fixed, checkSumAdjustment: p.uint32, magicNumber: p.uint32, flags: p.flags( 16 ), unitsPerEm: p.uint16, created: p.longdatetime, modified: p.longdatetime, xMin: p.int16, yMin: p.int16, xMax: p.int16, yMax: p.int16, macStyle: p.flags( 16 ), lowestRecPPEM: p.uint16, fontDirectionHint: p.uint16, indexToLocFormat: p.uint16, glyphDataFormat: p.uint16, } ); } } var head$1 = Object.freeze( { __proto__: null, head: head } ); class hhea extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.ascender = p.fword; this.descender = p.fword; this.lineGap = p.fword; this.advanceWidthMax = p.ufword; this.minLeftSideBearing = p.fword; this.minRightSideBearing = p.fword; this.xMaxExtent = p.fword; this.caretSlopeRise = p.int16; this.caretSlopeRun = p.int16; this.caretOffset = p.int16; p.int16; p.int16; p.int16; p.int16; this.metricDataFormat = p.int16; this.numberOfHMetrics = p.uint16; p.verifyLength(); } } var hhea$1 = Object.freeze( { __proto__: null, hhea: hhea } ); class hmtx extends SimpleTable { constructor( dict, dataview, tables ) { const { p: p } = super( dict, dataview ); const numberOfHMetrics = tables.hhea.numberOfHMetrics; const numGlyphs = tables.maxp.numGlyphs; const metricsStart = p.currentPosition; lazy$1( this, `hMetrics`, () => { p.currentPosition = metricsStart; return [ ...new Array( numberOfHMetrics ) ].map( ( _ ) => new LongHorMetric( p.uint16, p.int16 ) ); } ); if ( numberOfHMetrics < numGlyphs ) { const lsbStart = metricsStart + numberOfHMetrics * 4; lazy$1( this, `leftSideBearings`, () => { p.currentPosition = lsbStart; return [ ...new Array( numGlyphs - numberOfHMetrics ) ].map( ( _ ) => p.int16 ); } ); } } } class LongHorMetric { constructor( w, b ) { this.advanceWidth = w; this.lsb = b; } } var hmtx$1 = Object.freeze( { __proto__: null, hmtx: hmtx } ); class maxp extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.legacyFixed; this.numGlyphs = p.uint16; if ( this.version === 1 ) { this.maxPoints = p.uint16; this.maxContours = p.uint16; this.maxCompositePoints = p.uint16; this.maxCompositeContours = p.uint16; this.maxZones = p.uint16; this.maxTwilightPoints = p.uint16; this.maxStorage = p.uint16; this.maxFunctionDefs = p.uint16; this.maxInstructionDefs = p.uint16; this.maxStackElements = p.uint16; this.maxSizeOfInstructions = p.uint16; this.maxComponentElements = p.uint16; this.maxComponentDepth = p.uint16; } p.verifyLength(); } } var maxp$1 = Object.freeze( { __proto__: null, maxp: maxp } ); class lib_font_browser_name extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.format = p.uint16; this.count = p.uint16; this.stringOffset = p.Offset16; this.nameRecords = [ ...new Array( this.count ) ].map( ( _ ) => new NameRecord( p, this ) ); if ( this.format === 1 ) { this.langTagCount = p.uint16; this.langTagRecords = [ ...new Array( this.langTagCount ) ].map( ( _ ) => new LangTagRecord( p.uint16, p.Offset16 ) ); } this.stringStart = this.tableStart + this.stringOffset; } get( nameID ) { let record = this.nameRecords.find( ( record ) => record.nameID === nameID ); if ( record ) return record.string; } } class LangTagRecord { constructor( length, offset ) { this.length = length; this.offset = offset; } } class NameRecord { constructor( p, nameTable ) { this.platformID = p.uint16; this.encodingID = p.uint16; this.languageID = p.uint16; this.nameID = p.uint16; this.length = p.uint16; this.offset = p.Offset16; lazy$1( this, `string`, () => { p.currentPosition = nameTable.stringStart + this.offset; return decodeString( p, this ); } ); } } function decodeString( p, record ) { const { platformID: platformID, length: length } = record; if ( length === 0 ) return ``; if ( platformID === 0 || platformID === 3 ) { const str = []; for ( let i = 0, e = length / 2; i < e; i++ ) str[ i ] = String.fromCharCode( p.uint16 ); return str.join( `` ); } const bytes = p.readBytes( length ); const str = []; bytes.forEach( function ( b, i ) { str[ i ] = String.fromCharCode( b ); } ); return str.join( `` ); } var name$1 = Object.freeze( { __proto__: null, name: lib_font_browser_name } ); class OS2 extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.xAvgCharWidth = p.int16; this.usWeightClass = p.uint16; this.usWidthClass = p.uint16; this.fsType = p.uint16; this.ySubscriptXSize = p.int16; this.ySubscriptYSize = p.int16; this.ySubscriptXOffset = p.int16; this.ySubscriptYOffset = p.int16; this.ySuperscriptXSize = p.int16; this.ySuperscriptYSize = p.int16; this.ySuperscriptXOffset = p.int16; this.ySuperscriptYOffset = p.int16; this.yStrikeoutSize = p.int16; this.yStrikeoutPosition = p.int16; this.sFamilyClass = p.int16; this.panose = [ ...new Array( 10 ) ].map( ( _ ) => p.uint8 ); this.ulUnicodeRange1 = p.flags( 32 ); this.ulUnicodeRange2 = p.flags( 32 ); this.ulUnicodeRange3 = p.flags( 32 ); this.ulUnicodeRange4 = p.flags( 32 ); this.achVendID = p.tag; this.fsSelection = p.uint16; this.usFirstCharIndex = p.uint16; this.usLastCharIndex = p.uint16; this.sTypoAscender = p.int16; this.sTypoDescender = p.int16; this.sTypoLineGap = p.int16; this.usWinAscent = p.uint16; this.usWinDescent = p.uint16; if ( this.version === 0 ) return p.verifyLength(); this.ulCodePageRange1 = p.flags( 32 ); this.ulCodePageRange2 = p.flags( 32 ); if ( this.version === 1 ) return p.verifyLength(); this.sxHeight = p.int16; this.sCapHeight = p.int16; this.usDefaultChar = p.uint16; this.usBreakChar = p.uint16; this.usMaxContext = p.uint16; if ( this.version <= 4 ) return p.verifyLength(); this.usLowerOpticalPointSize = p.uint16; this.usUpperOpticalPointSize = p.uint16; if ( this.version === 5 ) return p.verifyLength(); } } var OS2$1 = Object.freeze( { __proto__: null, OS2: OS2 } ); class post extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.legacyFixed; this.italicAngle = p.fixed; this.underlinePosition = p.fword; this.underlineThickness = p.fword; this.isFixedPitch = p.uint32; this.minMemType42 = p.uint32; this.maxMemType42 = p.uint32; this.minMemType1 = p.uint32; this.maxMemType1 = p.uint32; if ( this.version === 1 || this.version === 3 ) return p.verifyLength(); this.numGlyphs = p.uint16; if ( this.version === 2 ) { this.glyphNameIndex = [ ...new Array( this.numGlyphs ) ].map( ( _ ) => p.uint16 ); this.namesOffset = p.currentPosition; this.glyphNameOffsets = [ 1 ]; for ( let i = 0; i < this.numGlyphs; i++ ) { let index = this.glyphNameIndex[ i ]; if ( index < macStrings.length ) { this.glyphNameOffsets.push( this.glyphNameOffsets[ i ] ); continue; } let bytelength = p.int8; p.skip( bytelength ); this.glyphNameOffsets.push( this.glyphNameOffsets[ i ] + bytelength + 1 ); } } if ( this.version === 2.5 ) { this.offset = [ ...new Array( this.numGlyphs ) ].map( ( _ ) => p.int8 ); } } getGlyphName( glyphid ) { if ( this.version !== 2 ) { console.warn( `post table version ${ this.version } does not support glyph name lookups` ); return ``; } let index = this.glyphNameIndex[ glyphid ]; if ( index < 258 ) return macStrings[ index ]; let offset = this.glyphNameOffsets[ glyphid ]; let next = this.glyphNameOffsets[ glyphid + 1 ]; let len = next - offset - 1; if ( len === 0 ) return `.notdef.`; this.parser.currentPosition = this.namesOffset + offset; const data = this.parser.readBytes( len, this.namesOffset + offset, 8, true ); return data.map( ( b ) => String.fromCharCode( b ) ).join( `` ); } } const macStrings = [ `.notdef`, `.null`, `nonmarkingreturn`, `space`, `exclam`, `quotedbl`, `numbersign`, `dollar`, `percent`, `ampersand`, `quotesingle`, `parenleft`, `parenright`, `asterisk`, `plus`, `comma`, `hyphen`, `period`, `slash`, `zero`, `one`, `two`, `three`, `four`, `five`, `six`, `seven`, `eight`, `nine`, `colon`, `semicolon`, `less`, `equal`, `greater`, `question`, `at`, `A`, `B`, `C`, `D`, `E`, `F`, `G`, `H`, `I`, `J`, `K`, `L`, `M`, `N`, `O`, `P`, `Q`, `R`, `S`, `T`, `U`, `V`, `W`, `X`, `Y`, `Z`, `bracketleft`, `backslash`, `bracketright`, `asciicircum`, `underscore`, `grave`, `a`, `b`, `c`, `d`, `e`, `f`, `g`, `h`, `i`, `j`, `k`, `l`, `m`, `n`, `o`, `p`, `q`, `r`, `s`, `t`, `u`, `v`, `w`, `x`, `y`, `z`, `braceleft`, `bar`, `braceright`, `asciitilde`, `Adieresis`, `Aring`, `Ccedilla`, `Eacute`, `Ntilde`, `Odieresis`, `Udieresis`, `aacute`, `agrave`, `acircumflex`, `adieresis`, `atilde`, `aring`, `ccedilla`, `eacute`, `egrave`, `ecircumflex`, `edieresis`, `iacute`, `igrave`, `icircumflex`, `idieresis`, `ntilde`, `oacute`, `ograve`, `ocircumflex`, `odieresis`, `otilde`, `uacute`, `ugrave`, `ucircumflex`, `udieresis`, `dagger`, `degree`, `cent`, `sterling`, `section`, `bullet`, `paragraph`, `germandbls`, `registered`, `copyright`, `trademark`, `acute`, `dieresis`, `notequal`, `AE`, `Oslash`, `infinity`, `plusminus`, `lessequal`, `greaterequal`, `yen`, `mu`, `partialdiff`, `summation`, `product`, `pi`, `integral`, `ordfeminine`, `ordmasculine`, `Omega`, `ae`, `oslash`, `questiondown`, `exclamdown`, `logicalnot`, `radical`, `florin`, `approxequal`, `Delta`, `guillemotleft`, `guillemotright`, `ellipsis`, `nonbreakingspace`, `Agrave`, `Atilde`, `Otilde`, `OE`, `oe`, `endash`, `emdash`, `quotedblleft`, `quotedblright`, `quoteleft`, `quoteright`, `divide`, `lozenge`, `ydieresis`, `Ydieresis`, `fraction`, `currency`, `guilsinglleft`, `guilsinglright`, `fi`, `fl`, `daggerdbl`, `periodcentered`, `quotesinglbase`, `quotedblbase`, `perthousand`, `Acircumflex`, `Ecircumflex`, `Aacute`, `Edieresis`, `Egrave`, `Iacute`, `Icircumflex`, `Idieresis`, `Igrave`, `Oacute`, `Ocircumflex`, `apple`, `Ograve`, `Uacute`, `Ucircumflex`, `Ugrave`, `dotlessi`, `circumflex`, `tilde`, `macron`, `breve`, `dotaccent`, `ring`, `cedilla`, `hungarumlaut`, `ogonek`, `caron`, `Lslash`, `lslash`, `Scaron`, `scaron`, `Zcaron`, `zcaron`, `brokenbar`, `Eth`, `eth`, `Yacute`, `yacute`, `Thorn`, `thorn`, `minus`, `multiply`, `onesuperior`, `twosuperior`, `threesuperior`, `onehalf`, `onequarter`, `threequarters`, `franc`, `Gbreve`, `gbreve`, `Idotaccent`, `Scedilla`, `scedilla`, `Cacute`, `cacute`, `Ccaron`, `ccaron`, `dcroat`, ]; var post$1 = Object.freeze( { __proto__: null, post: post } ); class BASE extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.horizAxisOffset = p.Offset16; this.vertAxisOffset = p.Offset16; lazy$1( this, `horizAxis`, () => new AxisTable( { offset: dict.offset + this.horizAxisOffset }, dataview ) ); lazy$1( this, `vertAxis`, () => new AxisTable( { offset: dict.offset + this.vertAxisOffset }, dataview ) ); if ( this.majorVersion === 1 && this.minorVersion === 1 ) { this.itemVarStoreOffset = p.Offset32; lazy$1( this, `itemVarStore`, () => new AxisTable( { offset: dict.offset + this.itemVarStoreOffset }, dataview ) ); } } } class AxisTable extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview, `AxisTable` ); this.baseTagListOffset = p.Offset16; this.baseScriptListOffset = p.Offset16; lazy$1( this, `baseTagList`, () => new BaseTagListTable( { offset: dict.offset + this.baseTagListOffset }, dataview ) ); lazy$1( this, `baseScriptList`, () => new BaseScriptListTable( { offset: dict.offset + this.baseScriptListOffset }, dataview ) ); } } class BaseTagListTable extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview, `BaseTagListTable` ); this.baseTagCount = p.uint16; this.baselineTags = [ ...new Array( this.baseTagCount ) ].map( ( _ ) => p.tag ); } } class BaseScriptListTable extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview, `BaseScriptListTable` ); this.baseScriptCount = p.uint16; const recordStart = p.currentPosition; lazy$1( this, `baseScriptRecords`, () => { p.currentPosition = recordStart; return [ ...new Array( this.baseScriptCount ) ].map( ( _ ) => new BaseScriptRecord( this.start, p ) ); } ); } } class BaseScriptRecord { constructor( baseScriptListTableStart, p ) { this.baseScriptTag = p.tag; this.baseScriptOffset = p.Offset16; lazy$1( this, `baseScriptTable`, () => { p.currentPosition = baseScriptListTableStart + this.baseScriptOffset; return new BaseScriptTable( p ); } ); } } class BaseScriptTable { constructor( p ) { this.start = p.currentPosition; this.baseValuesOffset = p.Offset16; this.defaultMinMaxOffset = p.Offset16; this.baseLangSysCount = p.uint16; this.baseLangSysRecords = [ ...new Array( this.baseLangSysCount ) ].map( ( _ ) => new BaseLangSysRecord( this.start, p ) ); lazy$1( this, `baseValues`, () => { p.currentPosition = this.start + this.baseValuesOffset; return new BaseValuesTable( p ); } ); lazy$1( this, `defaultMinMax`, () => { p.currentPosition = this.start + this.defaultMinMaxOffset; return new MinMaxTable( p ); } ); } } class BaseLangSysRecord { constructor( baseScriptTableStart, p ) { this.baseLangSysTag = p.tag; this.minMaxOffset = p.Offset16; lazy$1( this, `minMax`, () => { p.currentPosition = baseScriptTableStart + this.minMaxOffset; return new MinMaxTable( p ); } ); } } class BaseValuesTable { constructor( p ) { this.parser = p; this.start = p.currentPosition; this.defaultBaselineIndex = p.uint16; this.baseCoordCount = p.uint16; this.baseCoords = [ ...new Array( this.baseCoordCount ) ].map( ( _ ) => p.Offset16 ); } getTable( id ) { this.parser.currentPosition = this.start + this.baseCoords[ id ]; return new BaseCoordTable( this.parser ); } } class MinMaxTable { constructor( p ) { this.minCoord = p.Offset16; this.maxCoord = p.Offset16; this.featMinMaxCount = p.uint16; const recordStart = p.currentPosition; lazy$1( this, `featMinMaxRecords`, () => { p.currentPosition = recordStart; return [ ...new Array( this.featMinMaxCount ) ].map( ( _ ) => new FeatMinMaxRecord( p ) ); } ); } } class FeatMinMaxRecord { constructor( p ) { this.featureTableTag = p.tag; this.minCoord = p.Offset16; this.maxCoord = p.Offset16; } } class BaseCoordTable { constructor( p ) { this.baseCoordFormat = p.uint16; this.coordinate = p.int16; if ( this.baseCoordFormat === 2 ) { this.referenceGlyph = p.uint16; this.baseCoordPoint = p.uint16; } if ( this.baseCoordFormat === 3 ) { this.deviceTable = p.Offset16; } } } var BASE$1 = Object.freeze( { __proto__: null, BASE: BASE } ); class ClassDefinition { constructor( p ) { this.classFormat = p.uint16; if ( this.classFormat === 1 ) { this.startGlyphID = p.uint16; this.glyphCount = p.uint16; this.classValueArray = [ ...new Array( this.glyphCount ) ].map( ( _ ) => p.uint16 ); } if ( this.classFormat === 2 ) { this.classRangeCount = p.uint16; this.classRangeRecords = [ ...new Array( this.classRangeCount ), ].map( ( _ ) => new ClassRangeRecord( p ) ); } } } class ClassRangeRecord { constructor( p ) { this.startGlyphID = p.uint16; this.endGlyphID = p.uint16; this.class = p.uint16; } } class CoverageTable extends ParsedData { constructor( p ) { super( p ); this.coverageFormat = p.uint16; if ( this.coverageFormat === 1 ) { this.glyphCount = p.uint16; this.glyphArray = [ ...new Array( this.glyphCount ) ].map( ( _ ) => p.uint16 ); } if ( this.coverageFormat === 2 ) { this.rangeCount = p.uint16; this.rangeRecords = [ ...new Array( this.rangeCount ) ].map( ( _ ) => new CoverageRangeRecord( p ) ); } } } class CoverageRangeRecord { constructor( p ) { this.startGlyphID = p.uint16; this.endGlyphID = p.uint16; this.startCoverageIndex = p.uint16; } } class ItemVariationStoreTable { constructor( table, p ) { this.table = table; this.parser = p; this.start = p.currentPosition; this.format = p.uint16; this.variationRegionListOffset = p.Offset32; this.itemVariationDataCount = p.uint16; this.itemVariationDataOffsets = [ ...new Array( this.itemVariationDataCount ), ].map( ( _ ) => p.Offset32 ); } } class GDEF extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.glyphClassDefOffset = p.Offset16; lazy$1( this, `glyphClassDefs`, () => { if ( this.glyphClassDefOffset === 0 ) return undefined; p.currentPosition = this.tableStart + this.glyphClassDefOffset; return new ClassDefinition( p ); } ); this.attachListOffset = p.Offset16; lazy$1( this, `attachList`, () => { if ( this.attachListOffset === 0 ) return undefined; p.currentPosition = this.tableStart + this.attachListOffset; return new AttachList( p ); } ); this.ligCaretListOffset = p.Offset16; lazy$1( this, `ligCaretList`, () => { if ( this.ligCaretListOffset === 0 ) return undefined; p.currentPosition = this.tableStart + this.ligCaretListOffset; return new LigCaretList( p ); } ); this.markAttachClassDefOffset = p.Offset16; lazy$1( this, `markAttachClassDef`, () => { if ( this.markAttachClassDefOffset === 0 ) return undefined; p.currentPosition = this.tableStart + this.markAttachClassDefOffset; return new ClassDefinition( p ); } ); if ( this.minorVersion >= 2 ) { this.markGlyphSetsDefOffset = p.Offset16; lazy$1( this, `markGlyphSetsDef`, () => { if ( this.markGlyphSetsDefOffset === 0 ) return undefined; p.currentPosition = this.tableStart + this.markGlyphSetsDefOffset; return new MarkGlyphSetsTable( p ); } ); } if ( this.minorVersion === 3 ) { this.itemVarStoreOffset = p.Offset32; lazy$1( this, `itemVarStore`, () => { if ( this.itemVarStoreOffset === 0 ) return undefined; p.currentPosition = this.tableStart + this.itemVarStoreOffset; return new ItemVariationStoreTable( p ); } ); } } } class AttachList extends ParsedData { constructor( p ) { super( p ); this.coverageOffset = p.Offset16; this.glyphCount = p.uint16; this.attachPointOffsets = [ ...new Array( this.glyphCount ) ].map( ( _ ) => p.Offset16 ); } getPoint( pointID ) { this.parser.currentPosition = this.start + this.attachPointOffsets[ pointID ]; return new AttachPoint( this.parser ); } } class AttachPoint { constructor( p ) { this.pointCount = p.uint16; this.pointIndices = [ ...new Array( this.pointCount ) ].map( ( _ ) => p.uint16 ); } } class LigCaretList extends ParsedData { constructor( p ) { super( p ); this.coverageOffset = p.Offset16; lazy$1( this, `coverage`, () => { p.currentPosition = this.start + this.coverageOffset; return new CoverageTable( p ); } ); this.ligGlyphCount = p.uint16; this.ligGlyphOffsets = [ ...new Array( this.ligGlyphCount ) ].map( ( _ ) => p.Offset16 ); } getLigGlyph( ligGlyphID ) { this.parser.currentPosition = this.start + this.ligGlyphOffsets[ ligGlyphID ]; return new LigGlyph( this.parser ); } } class LigGlyph extends ParsedData { constructor( p ) { super( p ); this.caretCount = p.uint16; this.caretValueOffsets = [ ...new Array( this.caretCount ) ].map( ( _ ) => p.Offset16 ); } getCaretValue( caretID ) { this.parser.currentPosition = this.start + this.caretValueOffsets[ caretID ]; return new CaretValue( this.parser ); } } class CaretValue { constructor( p ) { this.caretValueFormat = p.uint16; if ( this.caretValueFormat === 1 ) { this.coordinate = p.int16; } if ( this.caretValueFormat === 2 ) { this.caretValuePointIndex = p.uint16; } if ( this.caretValueFormat === 3 ) { this.coordinate = p.int16; this.deviceOffset = p.Offset16; } } } class MarkGlyphSetsTable extends ParsedData { constructor( p ) { super( p ); this.markGlyphSetTableFormat = p.uint16; this.markGlyphSetCount = p.uint16; this.coverageOffsets = [ ...new Array( this.markGlyphSetCount ) ].map( ( _ ) => p.Offset32 ); } getMarkGlyphSet( markGlyphSetID ) { this.parser.currentPosition = this.start + this.coverageOffsets[ markGlyphSetID ]; return new CoverageTable( this.parser ); } } var GDEF$1 = Object.freeze( { __proto__: null, GDEF: GDEF } ); class ScriptList extends ParsedData { static EMPTY = { scriptCount: 0, scriptRecords: [] }; constructor( p ) { super( p ); this.scriptCount = p.uint16; this.scriptRecords = [ ...new Array( this.scriptCount ) ].map( ( _ ) => new ScriptRecord( p ) ); } } class ScriptRecord { constructor( p ) { this.scriptTag = p.tag; this.scriptOffset = p.Offset16; } } class ScriptTable extends ParsedData { constructor( p ) { super( p ); this.defaultLangSys = p.Offset16; this.langSysCount = p.uint16; this.langSysRecords = [ ...new Array( this.langSysCount ) ].map( ( _ ) => new LangSysRecord( p ) ); } } class LangSysRecord { constructor( p ) { this.langSysTag = p.tag; this.langSysOffset = p.Offset16; } } class LangSysTable { constructor( p ) { this.lookupOrder = p.Offset16; this.requiredFeatureIndex = p.uint16; this.featureIndexCount = p.uint16; this.featureIndices = [ ...new Array( this.featureIndexCount ) ].map( ( _ ) => p.uint16 ); } } class FeatureList extends ParsedData { static EMPTY = { featureCount: 0, featureRecords: [] }; constructor( p ) { super( p ); this.featureCount = p.uint16; this.featureRecords = [ ...new Array( this.featureCount ) ].map( ( _ ) => new FeatureRecord( p ) ); } } class FeatureRecord { constructor( p ) { this.featureTag = p.tag; this.featureOffset = p.Offset16; } } class FeatureTable extends ParsedData { constructor( p ) { super( p ); this.featureParams = p.Offset16; this.lookupIndexCount = p.uint16; this.lookupListIndices = [ ...new Array( this.lookupIndexCount ) ].map( ( _ ) => p.uint16 ); } getFeatureParams() { if ( this.featureParams > 0 ) { const p = this.parser; p.currentPosition = this.start + this.featureParams; const tag = this.featureTag; if ( tag === `size` ) return new Size( p ); if ( tag.startsWith( `cc` ) ) return new CharacterVariant( p ); if ( tag.startsWith( `ss` ) ) return new StylisticSet( p ); } } } class CharacterVariant { constructor( p ) { this.format = p.uint16; this.featUiLabelNameId = p.uint16; this.featUiTooltipTextNameId = p.uint16; this.sampleTextNameId = p.uint16; this.numNamedParameters = p.uint16; this.firstParamUiLabelNameId = p.uint16; this.charCount = p.uint16; this.character = [ ...new Array( this.charCount ) ].map( ( _ ) => p.uint24 ); } } class Size { constructor( p ) { this.designSize = p.uint16; this.subfamilyIdentifier = p.uint16; this.subfamilyNameID = p.uint16; this.smallEnd = p.uint16; this.largeEnd = p.uint16; } } class StylisticSet { constructor( p ) { this.version = p.uint16; this.UINameID = p.uint16; } } function undoCoverageOffsetParsing( instance ) { instance.parser.currentPosition -= 2; delete instance.coverageOffset; delete instance.getCoverageTable; } class LookupType$1 extends ParsedData { constructor( p ) { super( p ); this.substFormat = p.uint16; this.coverageOffset = p.Offset16; } getCoverageTable() { let p = this.parser; p.currentPosition = this.start + this.coverageOffset; return new CoverageTable( p ); } } class SubstLookupRecord { constructor( p ) { this.glyphSequenceIndex = p.uint16; this.lookupListIndex = p.uint16; } } class LookupType1$1 extends LookupType$1 { constructor( p ) { super( p ); this.deltaGlyphID = p.int16; } } class LookupType2$1 extends LookupType$1 { constructor( p ) { super( p ); this.sequenceCount = p.uint16; this.sequenceOffsets = [ ...new Array( this.sequenceCount ) ].map( ( _ ) => p.Offset16 ); } getSequence( index ) { let p = this.parser; p.currentPosition = this.start + this.sequenceOffsets[ index ]; return new SequenceTable( p ); } } class SequenceTable { constructor( p ) { this.glyphCount = p.uint16; this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map( ( _ ) => p.uint16 ); } } class LookupType3$1 extends LookupType$1 { constructor( p ) { super( p ); this.alternateSetCount = p.uint16; this.alternateSetOffsets = [ ...new Array( this.alternateSetCount ), ].map( ( _ ) => p.Offset16 ); } getAlternateSet( index ) { let p = this.parser; p.currentPosition = this.start + this.alternateSetOffsets[ index ]; return new AlternateSetTable( p ); } } class AlternateSetTable { constructor( p ) { this.glyphCount = p.uint16; this.alternateGlyphIDs = [ ...new Array( this.glyphCount ) ].map( ( _ ) => p.uint16 ); } } class LookupType4$1 extends LookupType$1 { constructor( p ) { super( p ); this.ligatureSetCount = p.uint16; this.ligatureSetOffsets = [ ...new Array( this.ligatureSetCount ) ].map( ( _ ) => p.Offset16 ); } getLigatureSet( index ) { let p = this.parser; p.currentPosition = this.start + this.ligatureSetOffsets[ index ]; return new LigatureSetTable( p ); } } class LigatureSetTable extends ParsedData { constructor( p ) { super( p ); this.ligatureCount = p.uint16; this.ligatureOffsets = [ ...new Array( this.ligatureCount ) ].map( ( _ ) => p.Offset16 ); } getLigature( index ) { let p = this.parser; p.currentPosition = this.start + this.ligatureOffsets[ index ]; return new LigatureTable( p ); } } class LigatureTable { constructor( p ) { this.ligatureGlyph = p.uint16; this.componentCount = p.uint16; this.componentGlyphIDs = [ ...new Array( this.componentCount - 1 ), ].map( ( _ ) => p.uint16 ); } } class LookupType5$1 extends LookupType$1 { constructor( p ) { super( p ); if ( this.substFormat === 1 ) { this.subRuleSetCount = p.uint16; this.subRuleSetOffsets = [ ...new Array( this.subRuleSetCount ), ].map( ( _ ) => p.Offset16 ); } if ( this.substFormat === 2 ) { this.classDefOffset = p.Offset16; this.subClassSetCount = p.uint16; this.subClassSetOffsets = [ ...new Array( this.subClassSetCount ), ].map( ( _ ) => p.Offset16 ); } if ( this.substFormat === 3 ) { undoCoverageOffsetParsing( this ); this.glyphCount = p.uint16; this.substitutionCount = p.uint16; this.coverageOffsets = [ ...new Array( this.glyphCount ) ].map( ( _ ) => p.Offset16 ); this.substLookupRecords = [ ...new Array( this.substitutionCount ), ].map( ( _ ) => new SubstLookupRecord( p ) ); } } getSubRuleSet( index ) { if ( this.substFormat !== 1 ) throw new Error( `lookup type 5.${ this.substFormat } has no subrule sets.` ); let p = this.parser; p.currentPosition = this.start + this.subRuleSetOffsets[ index ]; return new SubRuleSetTable( p ); } getSubClassSet( index ) { if ( this.substFormat !== 2 ) throw new Error( `lookup type 5.${ this.substFormat } has no subclass sets.` ); let p = this.parser; p.currentPosition = this.start + this.subClassSetOffsets[ index ]; return new SubClassSetTable( p ); } getCoverageTable( index ) { if ( this.substFormat !== 3 && ! index ) return super.getCoverageTable(); if ( ! index ) throw new Error( `lookup type 5.${ this.substFormat } requires an coverage table index.` ); let p = this.parser; p.currentPosition = this.start + this.coverageOffsets[ index ]; return new CoverageTable( p ); } } class SubRuleSetTable extends ParsedData { constructor( p ) { super( p ); this.subRuleCount = p.uint16; this.subRuleOffsets = [ ...new Array( this.subRuleCount ) ].map( ( _ ) => p.Offset16 ); } getSubRule( index ) { let p = this.parser; p.currentPosition = this.start + this.subRuleOffsets[ index ]; return new SubRuleTable( p ); } } class SubRuleTable { constructor( p ) { this.glyphCount = p.uint16; this.substitutionCount = p.uint16; this.inputSequence = [ ...new Array( this.glyphCount - 1 ) ].map( ( _ ) => p.uint16 ); this.substLookupRecords = [ ...new Array( this.substitutionCount ), ].map( ( _ ) => new SubstLookupRecord( p ) ); } } class SubClassSetTable extends ParsedData { constructor( p ) { super( p ); this.subClassRuleCount = p.uint16; this.subClassRuleOffsets = [ ...new Array( this.subClassRuleCount ), ].map( ( _ ) => p.Offset16 ); } getSubClass( index ) { let p = this.parser; p.currentPosition = this.start + this.subClassRuleOffsets[ index ]; return new SubClassRuleTable( p ); } } class SubClassRuleTable extends SubRuleTable { constructor( p ) { super( p ); } } class LookupType6$1 extends LookupType$1 { constructor( p ) { super( p ); if ( this.substFormat === 1 ) { this.chainSubRuleSetCount = p.uint16; this.chainSubRuleSetOffsets = [ ...new Array( this.chainSubRuleSetCount ), ].map( ( _ ) => p.Offset16 ); } if ( this.substFormat === 2 ) { this.backtrackClassDefOffset = p.Offset16; this.inputClassDefOffset = p.Offset16; this.lookaheadClassDefOffset = p.Offset16; this.chainSubClassSetCount = p.uint16; this.chainSubClassSetOffsets = [ ...new Array( this.chainSubClassSetCount ), ].map( ( _ ) => p.Offset16 ); } if ( this.substFormat === 3 ) { undoCoverageOffsetParsing( this ); this.backtrackGlyphCount = p.uint16; this.backtrackCoverageOffsets = [ ...new Array( this.backtrackGlyphCount ), ].map( ( _ ) => p.Offset16 ); this.inputGlyphCount = p.uint16; this.inputCoverageOffsets = [ ...new Array( this.inputGlyphCount ), ].map( ( _ ) => p.Offset16 ); this.lookaheadGlyphCount = p.uint16; this.lookaheadCoverageOffsets = [ ...new Array( this.lookaheadGlyphCount ), ].map( ( _ ) => p.Offset16 ); this.seqLookupCount = p.uint16; this.seqLookupRecords = [ ...new Array( this.substitutionCount ), ].map( ( _ ) => new SequenceLookupRecord( p ) ); } } getChainSubRuleSet( index ) { if ( this.substFormat !== 1 ) throw new Error( `lookup type 6.${ this.substFormat } has no chainsubrule sets.` ); let p = this.parser; p.currentPosition = this.start + this.chainSubRuleSetOffsets[ index ]; return new ChainSubRuleSetTable( p ); } getChainSubClassSet( index ) { if ( this.substFormat !== 2 ) throw new Error( `lookup type 6.${ this.substFormat } has no chainsubclass sets.` ); let p = this.parser; p.currentPosition = this.start + this.chainSubClassSetOffsets[ index ]; return new ChainSubClassSetTable( p ); } getCoverageFromOffset( offset ) { if ( this.substFormat !== 3 ) throw new Error( `lookup type 6.${ this.substFormat } does not use contextual coverage offsets.` ); let p = this.parser; p.currentPosition = this.start + offset; return new CoverageTable( p ); } } class ChainSubRuleSetTable extends ParsedData { constructor( p ) { super( p ); this.chainSubRuleCount = p.uint16; this.chainSubRuleOffsets = [ ...new Array( this.chainSubRuleCount ), ].map( ( _ ) => p.Offset16 ); } getSubRule( index ) { let p = this.parser; p.currentPosition = this.start + this.chainSubRuleOffsets[ index ]; return new ChainSubRuleTable( p ); } } class ChainSubRuleTable { constructor( p ) { this.backtrackGlyphCount = p.uint16; this.backtrackSequence = [ ...new Array( this.backtrackGlyphCount ), ].map( ( _ ) => p.uint16 ); this.inputGlyphCount = p.uint16; this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map( ( _ ) => p.uint16 ); this.lookaheadGlyphCount = p.uint16; this.lookAheadSequence = [ ...new Array( this.lookAheadGlyphCount ), ].map( ( _ ) => p.uint16 ); this.substitutionCount = p.uint16; this.substLookupRecords = [ ...new Array( this.SubstCount ) ].map( ( _ ) => new SubstLookupRecord( p ) ); } } class ChainSubClassSetTable extends ParsedData { constructor( p ) { super( p ); this.chainSubClassRuleCount = p.uint16; this.chainSubClassRuleOffsets = [ ...new Array( this.chainSubClassRuleCount ), ].map( ( _ ) => p.Offset16 ); } getSubClass( index ) { let p = this.parser; p.currentPosition = this.start + this.chainSubRuleOffsets[ index ]; return new ChainSubClassRuleTable( p ); } } class ChainSubClassRuleTable { constructor( p ) { this.backtrackGlyphCount = p.uint16; this.backtrackSequence = [ ...new Array( this.backtrackGlyphCount ), ].map( ( _ ) => p.uint16 ); this.inputGlyphCount = p.uint16; this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map( ( _ ) => p.uint16 ); this.lookaheadGlyphCount = p.uint16; this.lookAheadSequence = [ ...new Array( this.lookAheadGlyphCount ), ].map( ( _ ) => p.uint16 ); this.substitutionCount = p.uint16; this.substLookupRecords = [ ...new Array( this.substitutionCount ), ].map( ( _ ) => new SequenceLookupRecord( p ) ); } } class SequenceLookupRecord extends ParsedData { constructor( p ) { super( p ); this.sequenceIndex = p.uint16; this.lookupListIndex = p.uint16; } } class LookupType7$1 extends ParsedData { constructor( p ) { super( p ); this.substFormat = p.uint16; this.extensionLookupType = p.uint16; this.extensionOffset = p.Offset32; } } class LookupType8$1 extends LookupType$1 { constructor( p ) { super( p ); this.backtrackGlyphCount = p.uint16; this.backtrackCoverageOffsets = [ ...new Array( this.backtrackGlyphCount ), ].map( ( _ ) => p.Offset16 ); this.lookaheadGlyphCount = p.uint16; this.lookaheadCoverageOffsets = [ new Array( this.lookaheadGlyphCount ), ].map( ( _ ) => p.Offset16 ); this.glyphCount = p.uint16; this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map( ( _ ) => p.uint16 ); } } var GSUBtables = { buildSubtable: function ( type, p ) { const subtable = new [ undefined, LookupType1$1, LookupType2$1, LookupType3$1, LookupType4$1, LookupType5$1, LookupType6$1, LookupType7$1, LookupType8$1, ][ type ]( p ); subtable.type = type; return subtable; }, }; class LookupType extends ParsedData { constructor( p ) { super( p ); } } class LookupType1 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 1` ); } } class LookupType2 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 2` ); } } class LookupType3 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 3` ); } } class LookupType4 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 4` ); } } class LookupType5 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 5` ); } } class LookupType6 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 6` ); } } class LookupType7 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 7` ); } } class LookupType8 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 8` ); } } class LookupType9 extends LookupType { constructor( p ) { super( p ); console.log( `lookup type 9` ); } } var GPOStables = { buildSubtable: function ( type, p ) { const subtable = new [ undefined, LookupType1, LookupType2, LookupType3, LookupType4, LookupType5, LookupType6, LookupType7, LookupType8, LookupType9, ][ type ]( p ); subtable.type = type; return subtable; }, }; class LookupList extends ParsedData { static EMPTY = { lookupCount: 0, lookups: [] }; constructor( p ) { super( p ); this.lookupCount = p.uint16; this.lookups = [ ...new Array( this.lookupCount ) ].map( ( _ ) => p.Offset16 ); } } class LookupTable extends ParsedData { constructor( p, type ) { super( p ); this.ctType = type; this.lookupType = p.uint16; this.lookupFlag = p.uint16; this.subTableCount = p.uint16; this.subtableOffsets = [ ...new Array( this.subTableCount ) ].map( ( _ ) => p.Offset16 ); this.markFilteringSet = p.uint16; } get rightToLeft() { return this.lookupFlag & ( 1 === 1 ); } get ignoreBaseGlyphs() { return this.lookupFlag & ( 2 === 2 ); } get ignoreLigatures() { return this.lookupFlag & ( 4 === 4 ); } get ignoreMarks() { return this.lookupFlag & ( 8 === 8 ); } get useMarkFilteringSet() { return this.lookupFlag & ( 16 === 16 ); } get markAttachmentType() { return this.lookupFlag & ( 65280 === 65280 ); } getSubTable( index ) { const builder = this.ctType === `GSUB` ? GSUBtables : GPOStables; this.parser.currentPosition = this.start + this.subtableOffsets[ index ]; return builder.buildSubtable( this.lookupType, this.parser ); } } class CommonLayoutTable extends SimpleTable { constructor( dict, dataview, name ) { const { p: p, tableStart: tableStart } = super( dict, dataview, name ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.scriptListOffset = p.Offset16; this.featureListOffset = p.Offset16; this.lookupListOffset = p.Offset16; if ( this.majorVersion === 1 && this.minorVersion === 1 ) { this.featureVariationsOffset = p.Offset32; } const no_content = ! ( this.scriptListOffset || this.featureListOffset || this.lookupListOffset ); lazy$1( this, `scriptList`, () => { if ( no_content ) return ScriptList.EMPTY; p.currentPosition = tableStart + this.scriptListOffset; return new ScriptList( p ); } ); lazy$1( this, `featureList`, () => { if ( no_content ) return FeatureList.EMPTY; p.currentPosition = tableStart + this.featureListOffset; return new FeatureList( p ); } ); lazy$1( this, `lookupList`, () => { if ( no_content ) return LookupList.EMPTY; p.currentPosition = tableStart + this.lookupListOffset; return new LookupList( p ); } ); if ( this.featureVariationsOffset ) { lazy$1( this, `featureVariations`, () => { if ( no_content ) return FeatureVariations.EMPTY; p.currentPosition = tableStart + this.featureVariationsOffset; return new FeatureVariations( p ); } ); } } getSupportedScripts() { return this.scriptList.scriptRecords.map( ( r ) => r.scriptTag ); } getScriptTable( scriptTag ) { let record = this.scriptList.scriptRecords.find( ( r ) => r.scriptTag === scriptTag ); this.parser.currentPosition = this.scriptList.start + record.scriptOffset; let table = new ScriptTable( this.parser ); table.scriptTag = scriptTag; return table; } ensureScriptTable( arg ) { if ( typeof arg === 'string' ) { return this.getScriptTable( arg ); } return arg; } getSupportedLangSys( scriptTable ) { scriptTable = this.ensureScriptTable( scriptTable ); const hasDefault = scriptTable.defaultLangSys !== 0; const supported = scriptTable.langSysRecords.map( ( l ) => l.langSysTag ); if ( hasDefault ) supported.unshift( `dflt` ); return supported; } getDefaultLangSysTable( scriptTable ) { scriptTable = this.ensureScriptTable( scriptTable ); let offset = scriptTable.defaultLangSys; if ( offset !== 0 ) { this.parser.currentPosition = scriptTable.start + offset; let table = new LangSysTable( this.parser ); table.langSysTag = ``; table.defaultForScript = scriptTable.scriptTag; return table; } } getLangSysTable( scriptTable, langSysTag = `dflt` ) { if ( langSysTag === `dflt` ) return this.getDefaultLangSysTable( scriptTable ); scriptTable = this.ensureScriptTable( scriptTable ); let record = scriptTable.langSysRecords.find( ( l ) => l.langSysTag === langSysTag ); this.parser.currentPosition = scriptTable.start + record.langSysOffset; let table = new LangSysTable( this.parser ); table.langSysTag = langSysTag; return table; } getFeatures( langSysTable ) { return langSysTable.featureIndices.map( ( index ) => this.getFeature( index ) ); } getFeature( indexOrTag ) { let record; if ( parseInt( indexOrTag ) == indexOrTag ) { record = this.featureList.featureRecords[ indexOrTag ]; } else { record = this.featureList.featureRecords.find( ( f ) => f.featureTag === indexOrTag ); } if ( ! record ) return; this.parser.currentPosition = this.featureList.start + record.featureOffset; let table = new FeatureTable( this.parser ); table.featureTag = record.featureTag; return table; } getLookups( featureTable ) { return featureTable.lookupListIndices.map( ( index ) => this.getLookup( index ) ); } getLookup( lookupIndex, type ) { let lookupOffset = this.lookupList.lookups[ lookupIndex ]; this.parser.currentPosition = this.lookupList.start + lookupOffset; return new LookupTable( this.parser, type ); } } class GSUB extends CommonLayoutTable { constructor( dict, dataview ) { super( dict, dataview, `GSUB` ); } getLookup( lookupIndex ) { return super.getLookup( lookupIndex, `GSUB` ); } } var GSUB$1 = Object.freeze( { __proto__: null, GSUB: GSUB } ); class GPOS extends CommonLayoutTable { constructor( dict, dataview ) { super( dict, dataview, `GPOS` ); } getLookup( lookupIndex ) { return super.getLookup( lookupIndex, `GPOS` ); } } var GPOS$1 = Object.freeze( { __proto__: null, GPOS: GPOS } ); class SVG extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.offsetToSVGDocumentList = p.Offset32; p.currentPosition = this.tableStart + this.offsetToSVGDocumentList; this.documentList = new SVGDocumentList( p ); } } class SVGDocumentList extends ParsedData { constructor( p ) { super( p ); this.numEntries = p.uint16; this.documentRecords = [ ...new Array( this.numEntries ) ].map( ( _ ) => new SVGDocumentRecord( p ) ); } getDocument( documentID ) { let record = this.documentRecords[ documentID ]; if ( ! record ) return ''; let offset = this.start + record.svgDocOffset; this.parser.currentPosition = offset; return this.parser.readBytes( record.svgDocLength ); } getDocumentForGlyph( glyphID ) { let id = this.documentRecords.findIndex( ( d ) => d.startGlyphID <= glyphID && glyphID <= d.endGlyphID ); if ( id === -1 ) return ''; return this.getDocument( id ); } } class SVGDocumentRecord { constructor( p ) { this.startGlyphID = p.uint16; this.endGlyphID = p.uint16; this.svgDocOffset = p.Offset32; this.svgDocLength = p.uint32; } } var SVG$1 = Object.freeze( { __proto__: null, SVG: SVG } ); class fvar extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.axesArrayOffset = p.Offset16; p.uint16; this.axisCount = p.uint16; this.axisSize = p.uint16; this.instanceCount = p.uint16; this.instanceSize = p.uint16; const axisStart = this.tableStart + this.axesArrayOffset; lazy$1( this, `axes`, () => { p.currentPosition = axisStart; return [ ...new Array( this.axisCount ) ].map( ( _ ) => new VariationAxisRecord( p ) ); } ); const instanceStart = axisStart + this.axisCount * this.axisSize; lazy$1( this, `instances`, () => { let instances = []; for ( let i = 0; i < this.instanceCount; i++ ) { p.currentPosition = instanceStart + i * this.instanceSize; instances.push( new InstanceRecord( p, this.axisCount, this.instanceSize ) ); } return instances; } ); } getSupportedAxes() { return this.axes.map( ( a ) => a.tag ); } getAxis( name ) { return this.axes.find( ( a ) => a.tag === name ); } } class VariationAxisRecord { constructor( p ) { this.tag = p.tag; this.minValue = p.fixed; this.defaultValue = p.fixed; this.maxValue = p.fixed; this.flags = p.flags( 16 ); this.axisNameID = p.uint16; } } class InstanceRecord { constructor( p, axisCount, size ) { let start = p.currentPosition; this.subfamilyNameID = p.uint16; p.uint16; this.coordinates = [ ...new Array( axisCount ) ].map( ( _ ) => p.fixed ); if ( p.currentPosition - start < size ) { this.postScriptNameID = p.uint16; } } } var fvar$1 = Object.freeze( { __proto__: null, fvar: fvar } ); class cvt extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); const n = dict.length / 2; lazy$1( this, `items`, () => [ ...new Array( n ) ].map( ( _ ) => p.fword ) ); } } var cvt$1 = Object.freeze( { __proto__: null, cvt: cvt } ); class fpgm extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); lazy$1( this, `instructions`, () => [ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 ) ); } } var fpgm$1 = Object.freeze( { __proto__: null, fpgm: fpgm } ); class gasp extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.numRanges = p.uint16; const getter = () => [ ...new Array( this.numRanges ) ].map( ( _ ) => new GASPRange( p ) ); lazy$1( this, `gaspRanges`, getter ); } } class GASPRange { constructor( p ) { this.rangeMaxPPEM = p.uint16; this.rangeGaspBehavior = p.uint16; } } var gasp$1 = Object.freeze( { __proto__: null, gasp: gasp } ); class glyf extends SimpleTable { constructor( dict, dataview ) { super( dict, dataview ); } getGlyphData( offset, length ) { this.parser.currentPosition = this.tableStart + offset; return this.parser.readBytes( length ); } } var glyf$1 = Object.freeze( { __proto__: null, glyf: glyf } ); class loca extends SimpleTable { constructor( dict, dataview, tables ) { const { p: p } = super( dict, dataview ); const n = tables.maxp.numGlyphs + 1; if ( tables.head.indexToLocFormat === 0 ) { this.x2 = true; lazy$1( this, `offsets`, () => [ ...new Array( n ) ].map( ( _ ) => p.Offset16 ) ); } else { lazy$1( this, `offsets`, () => [ ...new Array( n ) ].map( ( _ ) => p.Offset32 ) ); } } getGlyphDataOffsetAndLength( glyphID ) { let offset = this.offsets[ glyphID ] * this.x2 ? 2 : 1; let nextOffset = this.offsets[ glyphID + 1 ] * this.x2 ? 2 : 1; return { offset: offset, length: nextOffset - offset }; } } var loca$1 = Object.freeze( { __proto__: null, loca: loca } ); class prep extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); lazy$1( this, `instructions`, () => [ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 ) ); } } var prep$1 = Object.freeze( { __proto__: null, prep: prep } ); class CFF extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); lazy$1( this, `data`, () => p.readBytes() ); } } var CFF$1 = Object.freeze( { __proto__: null, CFF: CFF } ); class CFF2 extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); lazy$1( this, `data`, () => p.readBytes() ); } } var CFF2$1 = Object.freeze( { __proto__: null, CFF2: CFF2 } ); class VORG extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.defaultVertOriginY = p.int16; this.numVertOriginYMetrics = p.uint16; lazy$1( this, `vertORiginYMetrics`, () => [ ...new Array( this.numVertOriginYMetrics ) ].map( ( _ ) => new VertOriginYMetric( p ) ) ); } } class VertOriginYMetric { constructor( p ) { this.glyphIndex = p.uint16; this.vertOriginY = p.int16; } } var VORG$1 = Object.freeze( { __proto__: null, VORG: VORG } ); class BitmapSize { constructor( p ) { this.indexSubTableArrayOffset = p.Offset32; this.indexTablesSize = p.uint32; this.numberofIndexSubTables = p.uint32; this.colorRef = p.uint32; this.hori = new SbitLineMetrics( p ); this.vert = new SbitLineMetrics( p ); this.startGlyphIndex = p.uint16; this.endGlyphIndex = p.uint16; this.ppemX = p.uint8; this.ppemY = p.uint8; this.bitDepth = p.uint8; this.flags = p.int8; } } class BitmapScale { constructor( p ) { this.hori = new SbitLineMetrics( p ); this.vert = new SbitLineMetrics( p ); this.ppemX = p.uint8; this.ppemY = p.uint8; this.substitutePpemX = p.uint8; this.substitutePpemY = p.uint8; } } class SbitLineMetrics { constructor( p ) { this.ascender = p.int8; this.descender = p.int8; this.widthMax = p.uint8; this.caretSlopeNumerator = p.int8; this.caretSlopeDenominator = p.int8; this.caretOffset = p.int8; this.minOriginSB = p.int8; this.minAdvanceSB = p.int8; this.maxBeforeBL = p.int8; this.minAfterBL = p.int8; this.pad1 = p.int8; this.pad2 = p.int8; } } class EBLC extends SimpleTable { constructor( dict, dataview, name ) { const { p: p } = super( dict, dataview, name ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.numSizes = p.uint32; lazy$1( this, `bitMapSizes`, () => [ ...new Array( this.numSizes ) ].map( ( _ ) => new BitmapSize( p ) ) ); } } var EBLC$1 = Object.freeze( { __proto__: null, EBLC: EBLC } ); class EBDT extends SimpleTable { constructor( dict, dataview, name ) { const { p: p } = super( dict, dataview, name ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; } } var EBDT$1 = Object.freeze( { __proto__: null, EBDT: EBDT } ); class EBSC extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.majorVersion = p.uint16; this.minorVersion = p.uint16; this.numSizes = p.uint32; lazy$1( this, `bitmapScales`, () => [ ...new Array( this.numSizes ) ].map( ( _ ) => new BitmapScale( p ) ) ); } } var EBSC$1 = Object.freeze( { __proto__: null, EBSC: EBSC } ); class CBLC extends EBLC { constructor( dict, dataview ) { super( dict, dataview, `CBLC` ); } } var CBLC$1 = Object.freeze( { __proto__: null, CBLC: CBLC } ); class CBDT extends EBDT { constructor( dict, dataview ) { super( dict, dataview, `CBDT` ); } } var CBDT$1 = Object.freeze( { __proto__: null, CBDT: CBDT } ); class sbix extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.flags = p.flags( 16 ); this.numStrikes = p.uint32; lazy$1( this, `strikeOffsets`, () => [ ...new Array( this.numStrikes ) ].map( ( _ ) => p.Offset32 ) ); } } var sbix$1 = Object.freeze( { __proto__: null, sbix: sbix } ); class COLR extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.numBaseGlyphRecords = p.uint16; this.baseGlyphRecordsOffset = p.Offset32; this.layerRecordsOffset = p.Offset32; this.numLayerRecords = p.uint16; } getBaseGlyphRecord( glyphID ) { let start = this.tableStart + this.baseGlyphRecordsOffset; this.parser.currentPosition = start; let first = new BaseGlyphRecord( this.parser ); let firstID = first.gID; let end = this.tableStart + this.layerRecordsOffset - 6; this.parser.currentPosition = end; let last = new BaseGlyphRecord( this.parser ); let lastID = last.gID; if ( firstID === glyphID ) return first; if ( lastID === glyphID ) return last; while ( true ) { if ( start === end ) break; let mid = start + ( end - start ) / 12; this.parser.currentPosition = mid; let middle = new BaseGlyphRecord( this.parser ); let midID = middle.gID; if ( midID === glyphID ) return middle; else if ( midID > glyphID ) { end = mid; } else if ( midID < glyphID ) { start = mid; } } return false; } getLayers( glyphID ) { let record = this.getBaseGlyphRecord( glyphID ); this.parser.currentPosition = this.tableStart + this.layerRecordsOffset + 4 * record.firstLayerIndex; return [ ...new Array( record.numLayers ) ].map( ( _ ) => new LayerRecord( p ) ); } } class BaseGlyphRecord { constructor( p ) { this.gID = p.uint16; this.firstLayerIndex = p.uint16; this.numLayers = p.uint16; } } class LayerRecord { constructor( p ) { this.gID = p.uint16; this.paletteIndex = p.uint16; } } var COLR$1 = Object.freeze( { __proto__: null, COLR: COLR } ); class CPAL extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.numPaletteEntries = p.uint16; const numPalettes = ( this.numPalettes = p.uint16 ); this.numColorRecords = p.uint16; this.offsetFirstColorRecord = p.Offset32; this.colorRecordIndices = [ ...new Array( this.numPalettes ) ].map( ( _ ) => p.uint16 ); lazy$1( this, `colorRecords`, () => { p.currentPosition = this.tableStart + this.offsetFirstColorRecord; return [ ...new Array( this.numColorRecords ) ].map( ( _ ) => new ColorRecord( p ) ); } ); if ( this.version === 1 ) { this.offsetPaletteTypeArray = p.Offset32; this.offsetPaletteLabelArray = p.Offset32; this.offsetPaletteEntryLabelArray = p.Offset32; lazy$1( this, `paletteTypeArray`, () => { p.currentPosition = this.tableStart + this.offsetPaletteTypeArray; return new PaletteTypeArray( p, numPalettes ); } ); lazy$1( this, `paletteLabelArray`, () => { p.currentPosition = this.tableStart + this.offsetPaletteLabelArray; return new PaletteLabelsArray( p, numPalettes ); } ); lazy$1( this, `paletteEntryLabelArray`, () => { p.currentPosition = this.tableStart + this.offsetPaletteEntryLabelArray; return new PaletteEntryLabelArray( p, numPalettes ); } ); } } } class ColorRecord { constructor( p ) { this.blue = p.uint8; this.green = p.uint8; this.red = p.uint8; this.alpha = p.uint8; } } class PaletteTypeArray { constructor( p, numPalettes ) { this.paletteTypes = [ ...new Array( numPalettes ) ].map( ( _ ) => p.uint32 ); } } class PaletteLabelsArray { constructor( p, numPalettes ) { this.paletteLabels = [ ...new Array( numPalettes ) ].map( ( _ ) => p.uint16 ); } } class PaletteEntryLabelArray { constructor( p, numPalettes ) { this.paletteEntryLabels = [ ...new Array( numPalettes ) ].map( ( _ ) => p.uint16 ); } } var CPAL$1 = Object.freeze( { __proto__: null, CPAL: CPAL } ); class DSIG extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint32; this.numSignatures = p.uint16; this.flags = p.uint16; this.signatureRecords = [ ...new Array( this.numSignatures ) ].map( ( _ ) => new SignatureRecord( p ) ); } getData( signatureID ) { const record = this.signatureRecords[ signatureID ]; this.parser.currentPosition = this.tableStart + record.offset; return new SignatureBlockFormat1( this.parser ); } } class SignatureRecord { constructor( p ) { this.format = p.uint32; this.length = p.uint32; this.offset = p.Offset32; } } class SignatureBlockFormat1 { constructor( p ) { p.uint16; p.uint16; this.signatureLength = p.uint32; this.signature = p.readBytes( this.signatureLength ); } } var DSIG$1 = Object.freeze( { __proto__: null, DSIG: DSIG } ); class hdmx extends SimpleTable { constructor( dict, dataview, tables ) { const { p: p } = super( dict, dataview ); const numGlyphs = tables.hmtx.numGlyphs; this.version = p.uint16; this.numRecords = p.int16; this.sizeDeviceRecord = p.int32; this.records = [ ...new Array( numRecords ) ].map( ( _ ) => new DeviceRecord( p, numGlyphs ) ); } } class DeviceRecord { constructor( p, numGlyphs ) { this.pixelSize = p.uint8; this.maxWidth = p.uint8; this.widths = p.readBytes( numGlyphs ); } } var hdmx$1 = Object.freeze( { __proto__: null, hdmx: hdmx } ); class kern extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.nTables = p.uint16; lazy$1( this, `tables`, () => { let offset = this.tableStart + 4; const tables = []; for ( let i = 0; i < this.nTables; i++ ) { p.currentPosition = offset; let subtable = new KernSubTable( p ); tables.push( subtable ); offset += subtable; } return tables; } ); } } class KernSubTable { constructor( p ) { this.version = p.uint16; this.length = p.uint16; this.coverage = p.flags( 8 ); this.format = p.uint8; if ( this.format === 0 ) { this.nPairs = p.uint16; this.searchRange = p.uint16; this.entrySelector = p.uint16; this.rangeShift = p.uint16; lazy$1( this, `pairs`, () => [ ...new Array( this.nPairs ) ].map( ( _ ) => new Pair( p ) ) ); } if ( this.format === 2 ) { console.warn( `Kern subtable format 2 is not supported: this parser currently only parses universal table data.` ); } } get horizontal() { return this.coverage[ 0 ]; } get minimum() { return this.coverage[ 1 ]; } get crossstream() { return this.coverage[ 2 ]; } get override() { return this.coverage[ 3 ]; } } class Pair { constructor( p ) { this.left = p.uint16; this.right = p.uint16; this.value = p.fword; } } var kern$1 = Object.freeze( { __proto__: null, kern: kern } ); class LTSH extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.numGlyphs = p.uint16; this.yPels = p.readBytes( this.numGlyphs ); } } var LTSH$1 = Object.freeze( { __proto__: null, LTSH: LTSH } ); class MERG extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.mergeClassCount = p.uint16; this.mergeDataOffset = p.Offset16; this.classDefCount = p.uint16; this.offsetToClassDefOffsets = p.Offset16; lazy$1( this, `mergeEntryMatrix`, () => [ ...new Array( this.mergeClassCount ) ].map( ( _ ) => p.readBytes( this.mergeClassCount ) ) ); console.warn( `Full MERG parsing is currently not supported.` ); console.warn( `If you need this table parsed, please file an issue, or better yet, a PR.` ); } } var MERG$1 = Object.freeze( { __proto__: null, MERG: MERG } ); class meta extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint32; this.flags = p.uint32; p.uint32; this.dataMapsCount = p.uint32; this.dataMaps = [ ...new Array( this.dataMapsCount ) ].map( ( _ ) => new DataMap( this.tableStart, p ) ); } } class DataMap { constructor( tableStart, p ) { this.tableStart = tableStart; this.parser = p; this.tag = p.tag; this.dataOffset = p.Offset32; this.dataLength = p.uint32; } getData() { this.parser.currentField = this.tableStart + this.dataOffset; return this.parser.readBytes( this.dataLength ); } } var meta$1 = Object.freeze( { __proto__: null, meta: meta } ); class PCLT extends SimpleTable { constructor( dict, dataview ) { super( dict, dataview ); console.warn( `This font uses a PCLT table, which is currently not supported by this parser.` ); console.warn( `If you need this table parsed, please file an issue, or better yet, a PR.` ); } } var PCLT$1 = Object.freeze( { __proto__: null, PCLT: PCLT } ); class VDMX extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.uint16; this.numRecs = p.uint16; this.numRatios = p.uint16; this.ratRanges = [ ...new Array( this.numRatios ) ].map( ( _ ) => new RatioRange( p ) ); this.offsets = [ ...new Array( this.numRatios ) ].map( ( _ ) => p.Offset16 ); this.VDMXGroups = [ ...new Array( this.numRecs ) ].map( ( _ ) => new VDMXGroup( p ) ); } } class RatioRange { constructor( p ) { this.bCharSet = p.uint8; this.xRatio = p.uint8; this.yStartRatio = p.uint8; this.yEndRatio = p.uint8; } } class VDMXGroup { constructor( p ) { this.recs = p.uint16; this.startsz = p.uint8; this.endsz = p.uint8; this.records = [ ...new Array( this.recs ) ].map( ( _ ) => new vTable( p ) ); } } class vTable { constructor( p ) { this.yPelHeight = p.uint16; this.yMax = p.int16; this.yMin = p.int16; } } var VDMX$1 = Object.freeze( { __proto__: null, VDMX: VDMX } ); class vhea extends SimpleTable { constructor( dict, dataview ) { const { p: p } = super( dict, dataview ); this.version = p.fixed; this.ascent = this.vertTypoAscender = p.int16; this.descent = this.vertTypoDescender = p.int16; this.lineGap = this.vertTypoLineGap = p.int16; this.advanceHeightMax = p.int16; this.minTopSideBearing = p.int16; this.minBottomSideBearing = p.int16; this.yMaxExtent = p.int16; this.caretSlopeRise = p.int16; this.caretSlopeRun = p.int16; this.caretOffset = p.int16; this.reserved = p.int16; this.reserved = p.int16; this.reserved = p.int16; this.reserved = p.int16; this.metricDataFormat = p.int16; this.numOfLongVerMetrics = p.uint16; p.verifyLength(); } } var vhea$1 = Object.freeze( { __proto__: null, vhea: vhea } ); class vmtx extends SimpleTable { constructor( dict, dataview, tables ) { super( dict, dataview ); const numOfLongVerMetrics = tables.vhea.numOfLongVerMetrics; const numGlyphs = tables.maxp.numGlyphs; const metricsStart = p.currentPosition; lazy( this, `vMetrics`, () => { p.currentPosition = metricsStart; return [ ...new Array( numOfLongVerMetrics ) ].map( ( _ ) => new LongVertMetric( p.uint16, p.int16 ) ); } ); if ( numOfLongVerMetrics < numGlyphs ) { const tsbStart = metricsStart + numOfLongVerMetrics * 4; lazy( this, `topSideBearings`, () => { p.currentPosition = tsbStart; return [ ...new Array( numGlyphs - numOfLongVerMetrics ) ].map( ( _ ) => p.int16 ); } ); } } } class LongVertMetric { constructor( h, b ) { this.advanceHeight = h; this.topSideBearing = b; } } var vmtx$1 = Object.freeze( { __proto__: null, vmtx: vmtx } ); /* eslint-enable */ ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js const { kebabCase: make_families_from_faces_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); function makeFamiliesFromFaces(fontFaces) { const fontFamiliesObject = fontFaces.reduce((acc, item) => { if (!acc[item.fontFamily]) { acc[item.fontFamily] = { name: item.fontFamily, fontFamily: item.fontFamily, slug: make_families_from_faces_kebabCase(item.fontFamily.toLowerCase()), fontFace: [] }; } acc[item.fontFamily].fontFace.push(item); return acc; }, {}); return Object.values(fontFamiliesObject); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/upload-fonts.js function UploadFonts() { const { installFonts } = (0,external_wp_element_.useContext)(FontLibraryContext); const [isUploading, setIsUploading] = (0,external_wp_element_.useState)(false); const [notice, setNotice] = (0,external_wp_element_.useState)(false); const handleDropZone = (files) => { handleFilesUpload(files); }; const onFilesUpload = (event) => { handleFilesUpload(event.target.files); }; const handleFilesUpload = async (files) => { setNotice(null); setIsUploading(true); const uniqueFilenames = /* @__PURE__ */ new Set(); const selectedFiles = [...files]; let hasInvalidFiles = false; const checkFilesPromises = selectedFiles.map(async (file) => { const isFont = await isFontFile(file); if (!isFont) { hasInvalidFiles = true; return null; } if (uniqueFilenames.has(file.name)) { return null; } const fileExtension = file.name.split(".").pop().toLowerCase(); if (ALLOWED_FILE_EXTENSIONS.includes(fileExtension)) { uniqueFilenames.add(file.name); return file; } return null; }); const allowedFiles = (await Promise.all(checkFilesPromises)).filter( (file) => null !== file ); if (allowedFiles.length > 0) { loadFiles(allowedFiles); } else { 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."); setNotice({ type: "error", message }); setIsUploading(false); } }; const loadFiles = async (files) => { const fontFacesLoaded = await Promise.all( files.map(async (fontFile) => { const fontFaceData = await getFontFaceMetadata(fontFile); await loadFontFaceInBrowser( fontFaceData, fontFaceData.file, "all" ); return fontFaceData; }) ); handleInstall(fontFacesLoaded); }; async function isFontFile(file) { const font = new Font("Uploaded Font"); try { const buffer = await readFileAsArrayBuffer(file); await font.fromDataBuffer(buffer, "font"); return true; } catch (error) { return false; } } async function readFileAsArrayBuffer(file) { return new Promise((resolve, reject) => { const reader = new window.FileReader(); reader.readAsArrayBuffer(file); reader.onload = () => resolve(reader.result); reader.onerror = reject; }); } const getFontFaceMetadata = async (fontFile) => { const buffer = await readFileAsArrayBuffer(fontFile); const fontObj = new Font("Uploaded Font"); fontObj.fromDataBuffer(buffer, fontFile.name); const onloadEvent = await new Promise( (resolve) => fontObj.onload = resolve ); const font = onloadEvent.detail.font; const { name } = font.opentype.tables; const fontName = name.get(16) || name.get(1); const isItalic = name.get(2).toLowerCase().includes("italic"); const fontWeight = font.opentype.tables["OS/2"].usWeightClass || "normal"; const isVariable = !!font.opentype.tables.fvar; const weightAxis = isVariable && font.opentype.tables.fvar.axes.find( ({ tag }) => tag === "wght" ); const weightRange = weightAxis ? `${weightAxis.minValue} ${weightAxis.maxValue}` : null; return { file: fontFile, fontFamily: fontName, fontStyle: isItalic ? "italic" : "normal", fontWeight: weightRange || fontWeight }; }; const handleInstall = async (fontFaces) => { const fontFamilies = makeFamiliesFromFaces(fontFaces); try { await installFonts(fontFamilies); setNotice({ type: "success", message: (0,external_wp_i18n_namespaceObject.__)("Fonts were installed successfully.") }); } catch (error) { setNotice({ type: "error", message: error.message, errors: error?.installationErrors }); } setIsUploading(false); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { onFilesDrop: handleDropZone }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "font-library-modal__local-fonts", children: [ notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Notice, { status: notice.type, __unstableHTML: true, onRemove: () => setNotice(null), children: [ notice.message, 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)) }) ] } ), 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, {}) }) }), !isUploading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FormFileUpload, { accept: ALLOWED_FILE_EXTENSIONS.map( (ext) => `.${ext}` ).join(","), multiple: true, onChange: onFilesUpload, render: ({ openFileDialog }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, className: "font-library-modal__upload-area", onClick: openFileDialog, children: (0,external_wp_i18n_namespaceObject.__)("Upload font") } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 2 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "font-library-modal__upload-area__text", children: (0,external_wp_i18n_namespaceObject.__)( "Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2." ) }) ] }) ] }); } var upload_fonts_default = UploadFonts; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/index.js const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis); const DEFAULT_TAB = { id: "installed-fonts", title: (0,external_wp_i18n_namespaceObject._x)("Library", "Font library") }; const UPLOAD_TAB = { id: "upload-fonts", title: (0,external_wp_i18n_namespaceObject._x)("Upload", "noun") }; const tabsFromCollections = (collections) => collections.map(({ slug, name }) => ({ id: slug, title: collections.length === 1 && slug === "google-fonts" ? (0,external_wp_i18n_namespaceObject.__)("Install Fonts") : name })); function FontLibraryModal({ onRequestClose, defaultTabId = "installed-fonts" }) { const { collections } = (0,external_wp_element_.useContext)(FontLibraryContext); const canUserCreate = (0,external_wp_data_.useSelect)((select) => { return select(external_wp_coreData_namespaceObject.store).canUser("create", { kind: "postType", name: "wp_font_family" }); }, []); const tabs = [DEFAULT_TAB]; if (canUserCreate) { tabs.push(UPLOAD_TAB); tabs.push(...tabsFromCollections(collections || [])); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Fonts"), onRequestClose, isFullScreen: true, className: "font-library-modal", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, { defaultTabId, children: [ /* @__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)) }) }), tabs.map(({ id }) => { let contents; switch (id) { case "upload-fonts": contents = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(upload_fonts_default, {}); break; case "installed-fonts": contents = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(installed_fonts_default, {}); break; default: contents = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_collection_default, { slug: id }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Tabs.TabPanel, { tabId: id, focusable: false, children: contents }, id ); }) ] }) } ); } var font_library_modal_default = FontLibraryModal; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-family-item.js function FontFamilyItem({ font }) { const { handleSetLibraryFontSelected, setModalTabOpen } = (0,external_wp_element_.useContext)(FontLibraryContext); const variantsCount = font?.fontFace?.length || 1; const handleClick = () => { handleSetLibraryFontSelected(font); setModalTabOpen("installed-fonts"); }; const previewStyle = getFamilyPreviewStyle(font); 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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: previewStyle, children: font.name }), /* @__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)( /* translators: %d: Number of font variants. */ (0,external_wp_i18n_namespaceObject._n)("%d variant", "%d variants", variantsCount), variantsCount ) }) ] }) }); } var font_family_item_default = FontFamilyItem; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-families.js const { useGlobalSetting: font_families_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function mapFontsWithSource(fonts, source) { return fonts ? fonts.map((f) => setUIValuesNeeded(f, { source })) : []; } function FontFamilies() { const { baseCustomFonts, modalTabOpen, setModalTabOpen } = (0,external_wp_element_.useContext)(FontLibraryContext); const [fontFamilies] = font_families_useGlobalSetting("typography.fontFamilies"); const [baseFontFamilies] = font_families_useGlobalSetting( "typography.fontFamilies", void 0, "base" ); const themeFonts = mapFontsWithSource(fontFamilies?.theme, "theme"); const customFonts = mapFontsWithSource(fontFamilies?.custom, "custom"); const activeFonts = [...themeFonts, ...customFonts].sort( (a, b) => a.name.localeCompare(b.name) ); const hasFonts = 0 < activeFonts.length; const hasInstalledFonts = hasFonts || baseFontFamilies?.theme?.length > 0 || baseCustomFonts?.length > 0; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ !!modalTabOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( font_library_modal_default, { onRequestClose: () => setModalTabOpen(null), defaultTabId: modalTabOpen } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(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.__)("Fonts") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { onClick: () => setModalTabOpen("installed-fonts"), label: (0,external_wp_i18n_namespaceObject.__)("Manage fonts"), icon: settings_default, size: "small" } ) ] }), 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)( font_family_item_default, { font }, font.slug )) }) }), !hasFonts && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__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.") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { className: "edit-site-global-styles-font-families__manage-fonts", variant: "secondary", __next40pxDefaultSize: true, onClick: () => { setModalTabOpen( hasInstalledFonts ? "installed-fonts" : "upload-fonts" ); }, children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)("Manage fonts") : (0,external_wp_i18n_namespaceObject.__)("Add fonts") } ) ] }) ] }) ] }); } var font_families_default = ({ ...props }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FontFamilies, { ...props }) }); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography.js function ScreenTypography() { const fontLibraryEnabled = (0,external_wp_data_.useSelect)( (select) => select(external_wp_editor_namespaceObject.store).getEditorSettings().fontLibraryEnabled, [] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( header_default, { title: (0,external_wp_i18n_namespaceObject.__)("Typography"), description: (0,external_wp_i18n_namespaceObject.__)( "Available fonts, typographic styles, and the application of those styles." ) } ), /* @__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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Typesets") }), fontLibraryEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_families_default, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_elements_default, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_count_default, {}) ] }) }) ] }); } var screen_typography_default = ScreenTypography; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-panel.js const { useGlobalStyle: typography_panel_useGlobalStyle, useGlobalSetting: typography_panel_useGlobalSetting, useSettingsForBlockElement: typography_panel_useSettingsForBlockElement, TypographyPanel: typography_panel_StylesTypographyPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function TypographyPanel({ element, headingLevel }) { let prefixParts = []; if (element === "heading") { prefixParts = prefixParts.concat(["elements", headingLevel]); } else if (element && element !== "text") { prefixParts = prefixParts.concat(["elements", element]); } const prefix = prefixParts.join("."); const [style] = typography_panel_useGlobalStyle(prefix, void 0, "user", { shouldDecodeEncode: false }); const [inheritedStyle, setStyle] = typography_panel_useGlobalStyle( prefix, void 0, "all", { shouldDecodeEncode: false } ); const [rawSettings] = typography_panel_useGlobalSetting(""); const usedElement = element === "heading" ? headingLevel : element; const settings = typography_panel_useSettingsForBlockElement( rawSettings, void 0, usedElement ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( typography_panel_StylesTypographyPanel, { inheritedValue: inheritedStyle, value: style, onChange: setStyle, settings } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-preview.js const { useGlobalStyle: typography_preview_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function TypographyPreview({ name, element, headingLevel }) { let prefix = ""; if (element === "heading") { prefix = `elements.${headingLevel}.`; } else if (element && element !== "text") { prefix = `elements.${element}.`; } const [fontFamily] = typography_preview_useGlobalStyle( prefix + "typography.fontFamily", name ); const [gradientValue] = typography_preview_useGlobalStyle(prefix + "color.gradient", name); const [backgroundColor] = typography_preview_useGlobalStyle( prefix + "color.background", name ); const [fallbackBackgroundColor] = typography_preview_useGlobalStyle("color.background"); const [color] = typography_preview_useGlobalStyle(prefix + "color.text", name); const [fontSize] = typography_preview_useGlobalStyle(prefix + "typography.fontSize", name); const [fontStyle] = typography_preview_useGlobalStyle( prefix + "typography.fontStyle", name ); const [fontWeight] = typography_preview_useGlobalStyle( prefix + "typography.fontWeight", name ); const [letterSpacing] = typography_preview_useGlobalStyle( prefix + "typography.letterSpacing", name ); const extraStyles = element === "link" ? { textDecoration: "underline" } : {}; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "edit-site-typography-preview", style: { fontFamily: fontFamily ?? "serif", background: gradientValue ?? backgroundColor ?? fallbackBackgroundColor, color, fontSize, fontStyle, fontWeight, letterSpacing, ...extraStyles }, children: "Aa" } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography-element.js const screen_typography_element_elements = { text: { description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts used on the site."), title: (0,external_wp_i18n_namespaceObject.__)("Text") }, link: { description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on the links."), title: (0,external_wp_i18n_namespaceObject.__)("Links") }, heading: { description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on headings."), title: (0,external_wp_i18n_namespaceObject.__)("Headings") }, caption: { description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on captions."), title: (0,external_wp_i18n_namespaceObject.__)("Captions") }, button: { description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on buttons."), title: (0,external_wp_i18n_namespaceObject.__)("Buttons") } }; function ScreenTypographyElement({ element }) { const [headingLevel, setHeadingLevel] = (0,external_wp_element_.useState)("heading"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( header_default, { title: screen_typography_element_elements[element].title, description: screen_typography_element_elements[element].description } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TypographyPreview, { element, headingLevel } ) }), element === "heading" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, marginBottom: "1em", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { label: (0,external_wp_i18n_namespaceObject.__)("Select heading level"), hideLabelFromVision: true, value: headingLevel, onChange: setHeadingLevel, isBlock: true, size: "__unstable-large", __nextHasNoMarginBottom: true, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "heading", showTooltip: true, "aria-label": (0,external_wp_i18n_namespaceObject.__)("All headings"), label: (0,external_wp_i18n_namespaceObject._x)("All", "heading levels") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "h1", showTooltip: true, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 1"), label: (0,external_wp_i18n_namespaceObject.__)("H1") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "h2", showTooltip: true, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 2"), label: (0,external_wp_i18n_namespaceObject.__)("H2") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "h3", showTooltip: true, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 3"), label: (0,external_wp_i18n_namespaceObject.__)("H3") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "h4", showTooltip: true, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 4"), label: (0,external_wp_i18n_namespaceObject.__)("H4") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "h5", showTooltip: true, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 5"), label: (0,external_wp_i18n_namespaceObject.__)("H5") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "h6", showTooltip: true, "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 6"), label: (0,external_wp_i18n_namespaceObject.__)("H6") } ) ] } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TypographyPanel, { element, headingLevel } ) ] }); } var screen_typography_element_default = ScreenTypographyElement; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size-preview.js const { useGlobalStyle: font_size_preview_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function FontSizePreview({ fontSize }) { const [font] = font_size_preview_useGlobalStyle("typography"); const input = fontSize?.fluid?.min && fontSize?.fluid?.max ? { minimumFontSize: fontSize.fluid.min, maximumFontSize: fontSize.fluid.max } : { fontSize: fontSize.size }; const computedFontSize = (0,external_wp_blockEditor_namespaceObject.getComputedFluidTypographyValue)(input); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "edit-site-typography-preview", style: { fontSize: computedFontSize, fontFamily: font?.fontFamily ?? "serif" }, children: (0,external_wp_i18n_namespaceObject.__)("Aa") } ); } var font_size_preview_default = FontSizePreview; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js function ConfirmDeleteFontSizeDialog({ fontSize, isOpen, toggleOpen, handleRemoveFontSize }) { const handleConfirm = async () => { toggleOpen(); handleRemoveFontSize(fontSize); }; const handleCancel = () => { toggleOpen(); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen, cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"), confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"), onCancel: handleCancel, onConfirm: handleConfirm, size: "medium", children: fontSize && (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the font size preset. */ (0,external_wp_i18n_namespaceObject.__)( 'Are you sure you want to delete "%s" font size preset?' ), fontSize.name ) } ); } var confirm_delete_font_size_dialog_default = ConfirmDeleteFontSizeDialog; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js function RenameFontSizeDialog({ fontSize, toggleOpen, handleRename }) { const [newName, setNewName] = (0,external_wp_element_.useState)(fontSize.name); const handleConfirm = () => { if (newName.trim()) { handleRename(newName); } toggleOpen(); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { onRequestClose: toggleOpen, focusOnMount: "firstContentElement", title: (0,external_wp_i18n_namespaceObject.__)("Rename"), size: "small", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "form", { onSubmit: (event) => { event.preventDefault(); handleConfirm(); toggleOpen(); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalInputControl, { __next40pxDefaultSize: true, autoComplete: "off", value: newName, onChange: setNewName, label: (0,external_wp_i18n_namespaceObject.__)("Name"), placeholder: (0,external_wp_i18n_namespaceObject.__)("Font size preset name") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: toggleOpen, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", children: (0,external_wp_i18n_namespaceObject.__)("Save") } ) ] }) ] }) } ) } ); } var rename_font_size_dialog_default = RenameFontSizeDialog; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/size-control/index.js const DEFAULT_UNITS = ["px", "em", "rem", "vw", "vh"]; function SizeControl({ // Do not allow manipulation of margin bottom __nextHasNoMarginBottom, ...props }) { const { baseControlProps } = (0,external_wp_components_namespaceObject.useBaseControlProps)(props); const { value, onChange, fallbackValue, disabled, label } = props; const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: DEFAULT_UNITS }); const [valueQuantity, valueUnit = "px"] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value, units); const isValueUnitRelative = !!valueUnit && ["em", "rem", "vw", "vh"].includes(valueUnit); const handleUnitControlChange = (newValue) => { onChange(newValue); }; const handleRangeControlChange = (newValue) => { onChange?.(newValue + valueUnit); }; 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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label, hideLabelFromVision: true, value, onChange: handleUnitControlChange, units, min: 0, disabled } ) }), /* @__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)( external_wp_components_namespaceObject.RangeControl, { __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label, hideLabelFromVision: true, value: valueQuantity, initialPosition: fallbackValue, withInputField: false, onChange: handleRangeControlChange, min: 0, max: isValueUnitRelative ? 10 : 100, step: isValueUnitRelative ? 0.1 : 1, disabled } ) }) }) ] }) }); } var size_control_default = SizeControl; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size.js const { Menu } = unlock(external_wp_components_namespaceObject.privateApis); const { useGlobalSetting: font_size_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function FontSize() { const [isDeleteConfirmOpen, setIsDeleteConfirmOpen] = (0,external_wp_element_.useState)(false); const [isRenameDialogOpen, setIsRenameDialogOpen] = (0,external_wp_element_.useState)(false); const { params: { origin, slug }, goBack } = (0,external_wp_components_namespaceObject.useNavigator)(); const [fontSizes, setFontSizes] = font_size_useGlobalSetting( "typography.fontSizes" ); const [globalFluid] = font_size_useGlobalSetting("typography.fluid"); const sizes = fontSizes[origin] ?? []; const fontSize = sizes.find((size) => size.slug === slug); (0,external_wp_element_.useEffect)(() => { if (!!slug && !fontSize) { goBack(); } }, [slug, fontSize, goBack]); if (!origin || !slug || !fontSize) { return null; } const isFluid = fontSize?.fluid !== void 0 ? !!fontSize.fluid : !!globalFluid; const isCustomFluid = typeof fontSize?.fluid === "object"; const handleNameChange = (value) => { updateFontSize("name", value); }; const handleFontSizeChange = (value) => { updateFontSize("size", value); }; const handleFluidChange = (value) => { updateFontSize("fluid", value); }; const handleCustomFluidValues = (value) => { if (value) { updateFontSize("fluid", { min: fontSize.size, max: fontSize.size }); } else { updateFontSize("fluid", true); } }; const handleMinChange = (value) => { updateFontSize("fluid", { ...fontSize.fluid, min: value }); }; const handleMaxChange = (value) => { updateFontSize("fluid", { ...fontSize.fluid, max: value }); }; const updateFontSize = (key, value) => { const newFontSizes = sizes.map((size) => { if (size.slug === slug) { return { ...size, [key]: value }; } return size; }); setFontSizes({ ...fontSizes, [origin]: newFontSizes }); }; const handleRemoveFontSize = () => { const newFontSizes = sizes.filter((size) => size.slug !== slug); setFontSizes({ ...fontSizes, [origin]: newFontSizes }); }; const toggleDeleteConfirm = () => { setIsDeleteConfirmOpen(!isDeleteConfirmOpen); }; const toggleRenameDialog = () => { setIsRenameDialogOpen(!isRenameDialogOpen); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( confirm_delete_font_size_dialog_default, { fontSize, isOpen: isDeleteConfirmOpen, toggleOpen: toggleDeleteConfirm, handleRemoveFontSize } ), isRenameDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( rename_font_size_dialog_default, { fontSize, toggleOpen: toggleRenameDialog, handleRename: handleNameChange } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", align: "flex-start", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( header_default, { title: fontSize.name, description: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: font size preset name. */ (0,external_wp_i18n_namespaceObject.__)("Manage the font size %s."), fontSize.name ) } ), origin === "custom" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalSpacer, { marginTop: 3, marginBottom: 0, paddingX: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Menu.TriggerButton, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)( "Font size options" ) } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu.Popover, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Menu.Item, { onClick: toggleRenameDialog, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Rename") }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Menu.Item, { onClick: toggleDeleteConfirm, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Delete") }) } ) ] }) ] }) } ) }) ] }), /* @__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, marginBottom: 0, paddingBottom: 6, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size_preview_default, { fontSize }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( size_control_default, { label: (0,external_wp_i18n_namespaceObject.__)("Size"), value: !isCustomFluid ? fontSize.size : "", onChange: handleFontSizeChange, disabled: isCustomFluid } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToggleControl, { label: (0,external_wp_i18n_namespaceObject.__)("Fluid typography"), help: (0,external_wp_i18n_namespaceObject.__)( "Scale the font size dynamically to fit the screen or viewport." ), checked: isFluid, onChange: handleFluidChange, __nextHasNoMarginBottom: true } ), isFluid && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ToggleControl, { label: (0,external_wp_i18n_namespaceObject.__)("Custom fluid values"), help: (0,external_wp_i18n_namespaceObject.__)( "Set custom min and max values for the fluid font size." ), checked: isCustomFluid, onChange: handleCustomFluidValues, __nextHasNoMarginBottom: true } ), isCustomFluid && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( size_control_default, { label: (0,external_wp_i18n_namespaceObject.__)("Minimum"), value: fontSize.fluid?.min, onChange: handleMinChange } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( size_control_default, { label: (0,external_wp_i18n_namespaceObject.__)("Maximum"), value: fontSize.fluid?.max, onChange: handleMaxChange } ) ] }) ] }) } ) }) ] }) ] }); } var font_size_default = FontSize; ;// ./node_modules/@wordpress/icons/build-module/library/plus.js var plus_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js function ConfirmResetFontSizesDialog({ text, confirmButtonText, isOpen, toggleOpen, onConfirm }) { const handleConfirm = async () => { toggleOpen(); onConfirm(); }; const handleCancel = () => { toggleOpen(); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen, cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"), confirmButtonText, onCancel: handleCancel, onConfirm: handleConfirm, size: "medium", children: text } ); } var confirm_reset_font_sizes_dialog_default = ConfirmResetFontSizesDialog; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes.js const { Menu: font_sizes_Menu } = unlock(external_wp_components_namespaceObject.privateApis); const { useGlobalSetting: font_sizes_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function FontSizeGroup({ label, origin, sizes, handleAddFontSize, handleResetFontSizes }) { const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_.useState)(false); const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen); const resetDialogText = origin === "custom" ? (0,external_wp_i18n_namespaceObject.__)( "Are you sure you want to remove all custom font size presets?" ) : (0,external_wp_i18n_namespaceObject.__)( "Are you sure you want to reset all font size presets to their default values?" ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ isResetDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( confirm_reset_font_sizes_dialog_default, { text: resetDialogText, confirmButtonText: origin === "custom" ? (0,external_wp_i18n_namespaceObject.__)("Remove") : (0,external_wp_i18n_namespaceObject.__)("Reset"), isOpen: isResetDialogOpen, toggleOpen: toggleResetDialog, onConfirm: handleResetFontSizes } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: label }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles__typography-panel__options-container", children: [ origin === "custom" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { label: (0,external_wp_i18n_namespaceObject.__)("Add font size"), icon: plus_default, size: "small", onClick: handleAddFontSize } ), !!handleResetFontSizes && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(font_sizes_Menu, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( font_sizes_Menu.TriggerButton, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)( "Font size presets options" ) } ) } ), /* @__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.__)( "Remove font size presets" ) : (0,external_wp_i18n_namespaceObject.__)( "Reset font size presets" ) }) }) }) ] }) ] }) ] }), !!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)( NavigationButtonAsItem, { path: `/typography/font-sizes/${origin}/${size.slug}`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-font-size__item", children: size.name }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { display: "flex", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default } ) }) ] }) }, size.slug )) }) ] }) ] }); } function font_sizes_FontSizes() { const [themeFontSizes, setThemeFontSizes] = font_sizes_useGlobalSetting( "typography.fontSizes.theme" ); const [baseThemeFontSizes] = font_sizes_useGlobalSetting( "typography.fontSizes.theme", null, "base" ); const [defaultFontSizes, setDefaultFontSizes] = font_sizes_useGlobalSetting( "typography.fontSizes.default" ); const [baseDefaultFontSizes] = font_sizes_useGlobalSetting( "typography.fontSizes.default", null, "base" ); const [customFontSizes = [], setCustomFontSizes] = font_sizes_useGlobalSetting( "typography.fontSizes.custom" ); const [defaultFontSizesEnabled] = font_sizes_useGlobalSetting( "typography.defaultFontSizes" ); const handleAddFontSize = () => { const index = getNewIndexFromPresets(customFontSizes, "custom-"); const newFontSize = { /* translators: %d: font size index */ name: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("New Font Size %d"), index), size: "16px", slug: `custom-${index}` }; setCustomFontSizes([...customFontSizes, newFontSize]); }; const hasSameSizeValues = (arr1, arr2) => arr1.map((item) => item.size).join("") === arr2.map((item) => item.size).join(""); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( header_default, { title: (0,external_wp_i18n_namespaceObject.__)("Font size presets"), description: (0,external_wp_i18n_namespaceObject.__)( "Create and edit the presets used for font sizes across the site." ) } ), /* @__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: [ !!themeFontSizes?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FontSizeGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Theme"), origin: "theme", sizes: themeFontSizes, baseSizes: baseThemeFontSizes, handleAddFontSize, handleResetFontSizes: hasSameSizeValues( themeFontSizes, baseThemeFontSizes ) ? null : () => setThemeFontSizes( baseThemeFontSizes ) } ), defaultFontSizesEnabled && !!defaultFontSizes?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FontSizeGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Default"), origin: "default", sizes: defaultFontSizes, baseSizes: baseDefaultFontSizes, handleAddFontSize, handleResetFontSizes: hasSameSizeValues( defaultFontSizes, baseDefaultFontSizes ) ? null : () => setDefaultFontSizes( baseDefaultFontSizes ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FontSizeGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Custom"), origin: "custom", sizes: customFontSizes, handleAddFontSize, handleResetFontSizes: customFontSizes.length > 0 ? () => setCustomFontSizes([]) : null } ) ] }) }) }) ] }); } var font_sizes_default = font_sizes_FontSizes; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-indicator-wrapper.js function ColorIndicatorWrapper({ className, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Flex, { className: dist_clsx( "edit-site-global-styles__color-indicator-wrapper", className ), ...props } ); } var color_indicator_wrapper_default = ColorIndicatorWrapper; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/palette.js const { useGlobalSetting: palette_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const EMPTY_COLORS = []; function Palette({ name }) { const [customColors] = palette_useGlobalSetting("color.palette.custom"); const [themeColors] = palette_useGlobalSetting("color.palette.theme"); const [defaultColors] = palette_useGlobalSetting("color.palette.default"); const [defaultPaletteEnabled] = palette_useGlobalSetting( "color.defaultPalette", name ); const colors = (0,external_wp_element_.useMemo)( () => [ ...customColors || EMPTY_COLORS, ...themeColors || EMPTY_COLORS, ...defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS ], [customColors, themeColors, defaultColors, defaultPaletteEnabled] ); const screenPath = !name ? "/colors/palette" : "/blocks/" + encodeURIComponent(name) + "/colors/palette"; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Palette") }), /* @__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: [ colors.length > 0 ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__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)( color_indicator_wrapper_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ColorIndicator, { colorValue: color } ) }, `${color}-${index}` )) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: (0,external_wp_i18n_namespaceObject.__)("Edit palette") }) ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Add colors") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default }) ] }) }) }) ] }); } var palette_default = Palette; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-colors.js const { useGlobalStyle: screen_colors_useGlobalStyle, useGlobalSetting: screen_colors_useGlobalSetting, useSettingsForBlockElement: screen_colors_useSettingsForBlockElement, ColorPanel: screen_colors_StylesColorPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ScreenColors() { const [style] = screen_colors_useGlobalStyle("", void 0, "user", { shouldDecodeEncode: false }); const [inheritedStyle, setStyle] = screen_colors_useGlobalStyle("", void 0, "all", { shouldDecodeEncode: false }); const [rawSettings] = screen_colors_useGlobalSetting(""); const settings = screen_colors_useSettingsForBlockElement(rawSettings); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( header_default, { title: (0,external_wp_i18n_namespaceObject.__)("Colors"), description: (0,external_wp_i18n_namespaceObject.__)( "Palette colors and the application of those colors on site elements." ) } ), /* @__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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(palette_default, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( screen_colors_StylesColorPanel, { inheritedValue: inheritedStyle, value: style, onChange: setStyle, settings } ) ] }) }) ] }); } var screen_colors_default = ScreenColors; ;// ./node_modules/@wordpress/icons/build-module/library/shuffle.js var shuffle_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/SVG", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z" }) }); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preset-colors.js function PresetColors() { const { paletteColors } = useStylesPreviewColors(); return paletteColors.slice(0, 4).map(({ slug, color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { style: { flexGrow: 1, height: "100%", background: color } }, `${slug}-${index}` )); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-colors.js const preview_colors_firstFrameVariants = { start: { scale: 1, opacity: 1 }, hover: { scale: 0, opacity: 0 } }; const StylesPreviewColors = ({ label, isFocused, withHoverView }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PreviewWrapper, { label, isFocused, withHoverView, children: ({ key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { variants: preview_colors_firstFrameVariants, style: { height: "100%", overflow: "hidden" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHStack, { spacing: 0, justify: "center", style: { height: "100%", overflow: "hidden" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PresetColors, {}) } ) }, key ) } ); }; var preview_colors_default = StylesPreviewColors; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-color.js function ColorVariations({ title, gap = 2 }) { const propertiesToFilter = ["color"]; const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter); if (colorVariations?.length <= 1) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: title }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { spacing: gap, children: colorVariations.map((variation, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Variation, { variation, isPill: true, properties: propertiesToFilter, showTooltip: true, children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_colors_default, {}) }, index )) }) ] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-palette-panel.js const { useGlobalSetting: color_palette_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const mobilePopoverProps = { placement: "bottom-start", offset: 8 }; function ColorPalettePanel({ name }) { const [themeColors, setThemeColors] = color_palette_panel_useGlobalSetting( "color.palette.theme", name ); const [baseThemeColors] = color_palette_panel_useGlobalSetting( "color.palette.theme", name, "base" ); const [defaultColors, setDefaultColors] = color_palette_panel_useGlobalSetting( "color.palette.default", name ); const [baseDefaultColors] = color_palette_panel_useGlobalSetting( "color.palette.default", name, "base" ); const [customColors, setCustomColors] = color_palette_panel_useGlobalSetting( "color.palette.custom", name ); const [defaultPaletteEnabled] = color_palette_panel_useGlobalSetting( "color.defaultPalette", name ); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("small", "<"); const popoverProps = isMobileViewport ? mobilePopoverProps : void 0; const [randomizeThemeColors] = useColorRandomizer(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { className: "edit-site-global-styles-color-palette-panel", spacing: 8, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ !!themeColors && !!themeColors.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalPaletteEdit, { canReset: themeColors !== baseThemeColors, canOnlyChangeValues: true, colors: themeColors, onChange: setThemeColors, paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Theme"), paletteLabelHeadingLevel: 3, popoverProps } ), window.__experimentalEnableColorRandomizer && themeColors?.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", icon: shuffle_default, onClick: randomizeThemeColors, children: (0,external_wp_i18n_namespaceObject.__)("Randomize colors") } ) ] }), !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalPaletteEdit, { canReset: defaultColors !== baseDefaultColors, canOnlyChangeValues: true, colors: defaultColors, onChange: setDefaultColors, paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Default"), paletteLabelHeadingLevel: 3, popoverProps } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalPaletteEdit, { colors: customColors, onChange: setCustomColors, paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Custom"), paletteLabelHeadingLevel: 3, slugPrefix: "custom-", popoverProps } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Palettes") }) ] } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/gradients-palette-panel.js const { useGlobalSetting: gradients_palette_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const gradients_palette_panel_mobilePopoverProps = { placement: "bottom-start", offset: 8 }; const noop = () => { }; function GradientPalettePanel({ name }) { const [themeGradients, setThemeGradients] = gradients_palette_panel_useGlobalSetting( "color.gradients.theme", name ); const [baseThemeGradients] = gradients_palette_panel_useGlobalSetting( "color.gradients.theme", name, "base" ); const [defaultGradients, setDefaultGradients] = gradients_palette_panel_useGlobalSetting( "color.gradients.default", name ); const [baseDefaultGradients] = gradients_palette_panel_useGlobalSetting( "color.gradients.default", name, "base" ); const [customGradients, setCustomGradients] = gradients_palette_panel_useGlobalSetting( "color.gradients.custom", name ); const [defaultPaletteEnabled] = gradients_palette_panel_useGlobalSetting( "color.defaultGradients", name ); const [customDuotone] = gradients_palette_panel_useGlobalSetting("color.duotone.custom") || []; const [defaultDuotone] = gradients_palette_panel_useGlobalSetting("color.duotone.default") || []; const [themeDuotone] = gradients_palette_panel_useGlobalSetting("color.duotone.theme") || []; const [defaultDuotoneEnabled] = gradients_palette_panel_useGlobalSetting( "color.defaultDuotone" ); const duotonePalette = [ ...customDuotone || [], ...themeDuotone || [], ...defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : [] ]; const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("small", "<"); const popoverProps = isMobileViewport ? gradients_palette_panel_mobilePopoverProps : void 0; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { className: "edit-site-global-styles-gradient-palette-panel", spacing: 8, children: [ !!themeGradients && !!themeGradients.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalPaletteEdit, { canReset: themeGradients !== baseThemeGradients, canOnlyChangeValues: true, gradients: themeGradients, onChange: setThemeGradients, paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Theme"), paletteLabelHeadingLevel: 3, popoverProps } ), !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalPaletteEdit, { canReset: defaultGradients !== baseDefaultGradients, canOnlyChangeValues: true, gradients: defaultGradients, onChange: setDefaultGradients, paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Default"), paletteLabelLevel: 3, popoverProps } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalPaletteEdit, { gradients: customGradients, onChange: setCustomGradients, paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Custom"), paletteLabelLevel: 3, slugPrefix: "custom-", popoverProps } ), !!duotonePalette && !!duotonePalette.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Duotone") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 3 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DuotonePicker, { duotonePalette, disableCustomDuotone: true, disableCustomColors: true, clearable: false, onChange: noop } ) ] }) ] } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-color-palette.js const { Tabs: screen_color_palette_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); function ScreenColorPalette({ name }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( header_default, { title: (0,external_wp_i18n_namespaceObject.__)("Edit palette"), description: (0,external_wp_i18n_namespaceObject.__)( "The combination of colors used across the site and in color pickers." ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs.TabList, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { tabId: "color", children: (0,external_wp_i18n_namespaceObject.__)("Color") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { tabId: "gradient", children: (0,external_wp_i18n_namespaceObject.__)("Gradient") }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { tabId: "color", focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPalettePanel, { name }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { tabId: "gradient", focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GradientPalettePanel, { name }) }) ] }) ] }); } var screen_color_palette_default = ScreenColorPalette; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/background-panel.js const BACKGROUND_DEFAULT_VALUES = { backgroundSize: "auto" }; const { useGlobalStyle: background_panel_useGlobalStyle, useGlobalSetting: background_panel_useGlobalSetting, BackgroundPanel: background_panel_StylesBackgroundPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function hasBackgroundImageValue(style) { return !!style?.background?.backgroundImage?.id || !!style?.background?.backgroundImage?.url || typeof style?.background?.backgroundImage === "string"; } function BackgroundPanel() { const [style] = background_panel_useGlobalStyle("", void 0, "user", { shouldDecodeEncode: false }); const [inheritedStyle, setStyle] = background_panel_useGlobalStyle("", void 0, "all", { shouldDecodeEncode: false }); const [settings] = background_panel_useGlobalSetting(""); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( background_panel_StylesBackgroundPanel, { inheritedValue: inheritedStyle, value: style, onChange: setStyle, settings, defaultValues: BACKGROUND_DEFAULT_VALUES } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-background.js const { useHasBackgroundPanel: screen_background_useHasBackgroundPanel, useGlobalSetting: screen_background_useGlobalSetting } = unlock( external_wp_blockEditor_namespaceObject.privateApis ); function ScreenBackground() { const [settings] = screen_background_useGlobalSetting(""); const hasBackgroundPanel = screen_background_useHasBackgroundPanel(settings); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( header_default, { title: (0,external_wp_i18n_namespaceObject.__)("Background"), 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.") }) } ), hasBackgroundPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundPanel, {}) ] }); } var screen_background_default = ScreenBackground; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/confirm-reset-shadow-dialog.js function ConfirmResetShadowDialog({ text, confirmButtonText, isOpen, toggleOpen, onConfirm }) { const handleConfirm = async () => { toggleOpen(); onConfirm(); }; const handleCancel = () => { toggleOpen(); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen, cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"), confirmButtonText, onCancel: handleCancel, onConfirm: handleConfirm, size: "medium", children: text } ); } var confirm_reset_shadow_dialog_default = ConfirmResetShadowDialog; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-panel.js const { useGlobalSetting: shadows_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { Menu: shadows_panel_Menu } = unlock(external_wp_components_namespaceObject.privateApis); const defaultShadow = "6px 6px 9px rgba(0, 0, 0, 0.2)"; function ShadowsPanel() { const [defaultShadows] = shadows_panel_useGlobalSetting("shadow.presets.default"); const [defaultShadowsEnabled] = shadows_panel_useGlobalSetting( "shadow.defaultPresets" ); const [themeShadows] = shadows_panel_useGlobalSetting("shadow.presets.theme"); const [customShadows, setCustomShadows] = shadows_panel_useGlobalSetting( "shadow.presets.custom" ); const onCreateShadow = (shadow) => { setCustomShadows([...customShadows || [], shadow]); }; const handleResetShadows = () => { setCustomShadows([]); }; const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_.useState)(false); const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ isResetDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( confirm_reset_shadow_dialog_default, { text: (0,external_wp_i18n_namespaceObject.__)( "Are you sure you want to remove all custom shadows?" ), confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Remove"), isOpen: isResetDialogOpen, toggleOpen: toggleResetDialog, onConfirm: handleResetShadows } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( header_default, { title: (0,external_wp_i18n_namespaceObject.__)("Shadows"), description: (0,external_wp_i18n_namespaceObject.__)( "Manage and create shadow styles for use across the site." ) } ), /* @__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, { className: "edit-site-global-styles__shadows-panel", spacing: 7, children: [ defaultShadowsEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShadowList, { label: (0,external_wp_i18n_namespaceObject.__)("Default"), shadows: defaultShadows || [], category: "default" } ), themeShadows && themeShadows.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShadowList, { label: (0,external_wp_i18n_namespaceObject.__)("Theme"), shadows: themeShadows || [], category: "theme" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShadowList, { label: (0,external_wp_i18n_namespaceObject.__)("Custom"), shadows: customShadows || [], category: "custom", canCreate: true, onCreate: onCreateShadow, onReset: toggleResetDialog } ) ] } ) }) ] }); } function ShadowList({ label, shadows, category, canCreate, onCreate, onReset }) { const handleAddShadow = () => { const newIndex = getNewIndexFromPresets(shadows, "shadow-"); onCreate({ name: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: is an index for a preset */ (0,external_wp_i18n_namespaceObject.__)("Shadow %s"), newIndex ), shadow: defaultShadow, slug: `shadow-${newIndex}` }); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: label }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles__shadows-panel__options-container", children: [ canCreate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", icon: plus_default, label: (0,external_wp_i18n_namespaceObject.__)("Add shadow"), onClick: () => { handleAddShadow(); } } ), !!shadows?.length && category === "custom" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(shadows_panel_Menu, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( shadows_panel_Menu.TriggerButton, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("Shadow options") } ) } ), /* @__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") }) }) }) ] }) ] }) ] }), 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)( ShadowItem, { shadow, category }, shadow.slug )) }) ] }); } function ShadowItem({ shadow, category }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( NavigationButtonAsItem, { path: `/shadows/edit/${category}/${shadow.slug}`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: shadow.name }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default }) ] }) } ); } ;// ./node_modules/@wordpress/icons/build-module/library/reset.js var reset_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 11.5h10V13H7z" }) }); ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadow-utils.js const CUSTOM_VALUE_SETTINGS = { px: { max: 20, step: 1 }, "%": { max: 100, step: 1 }, vw: { max: 100, step: 1 }, vh: { max: 100, step: 1 }, em: { max: 10, step: 0.1 }, rm: { max: 10, step: 0.1 }, svw: { max: 100, step: 1 }, lvw: { max: 100, step: 1 }, dvw: { max: 100, step: 1 }, svh: { max: 100, step: 1 }, lvh: { max: 100, step: 1 }, dvh: { max: 100, step: 1 }, vi: { max: 100, step: 1 }, svi: { max: 100, step: 1 }, lvi: { max: 100, step: 1 }, dvi: { max: 100, step: 1 }, vb: { max: 100, step: 1 }, svb: { max: 100, step: 1 }, lvb: { max: 100, step: 1 }, dvb: { max: 100, step: 1 }, vmin: { max: 100, step: 1 }, svmin: { max: 100, step: 1 }, lvmin: { max: 100, step: 1 }, dvmin: { max: 100, step: 1 }, vmax: { max: 100, step: 1 }, svmax: { max: 100, step: 1 }, lvmax: { max: 100, step: 1 }, dvmax: { max: 100, step: 1 } }; function getShadowParts(shadow) { const shadowValues = shadow.match(/(?:[^,(]|\([^)]*\))+/g) || []; return shadowValues.map((value) => value.trim()); } function shadowStringToObject(shadowValue) { const defaultShadow = { x: "0", y: "0", blur: "0", spread: "0", color: "#000", inset: false }; if (!shadowValue) { return defaultShadow; } if (shadowValue.includes("none")) { return defaultShadow; } const lengthsRegex = /((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g; const matches = shadowValue.match(lengthsRegex) || []; if (matches.length !== 1) { return defaultShadow; } const lengths = matches[0].split(" ").map((value) => value.trim()).filter((value) => value); if (lengths.length < 2) { return defaultShadow; } const insets = shadowValue.match(/inset/gi) || []; if (insets.length > 1) { return defaultShadow; } const hasInset = insets.length === 1; let colorString = shadowValue.replace(lengthsRegex, "").trim(); if (hasInset) { colorString = colorString.replace("inset", "").replace("INSET", "").trim(); } const colorRegex = /^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi; let colorMatches = (colorString.match(colorRegex) || []).map((value) => value?.trim()).filter((value) => value); if (colorMatches.length > 1) { return defaultShadow; } else if (colorMatches.length === 0) { colorMatches = colorString.trim().split(" ").filter((value) => value); if (colorMatches.length > 1) { return defaultShadow; } } const [x, y, blur, spread] = lengths; return { x, y, blur: blur || defaultShadow.blur, spread: spread || defaultShadow.spread, inset: hasInset, color: colorString || defaultShadow.color }; } function shadowObjectToString(shadowObj) { const shadowString = `${shadowObj.x || "0px"} ${shadowObj.y || "0px"} ${shadowObj.blur || "0px"} ${shadowObj.spread || "0px"}`; return `${shadowObj.inset ? "inset" : ""} ${shadowString} ${shadowObj.color || ""}`.trim(); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-edit-panel.js const { useGlobalSetting: shadows_edit_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { Menu: shadows_edit_panel_Menu } = unlock(external_wp_components_namespaceObject.privateApis); const customShadowMenuItems = [ { label: (0,external_wp_i18n_namespaceObject.__)("Rename"), action: "rename" }, { label: (0,external_wp_i18n_namespaceObject.__)("Delete"), action: "delete" } ]; const presetShadowMenuItems = [ { label: (0,external_wp_i18n_namespaceObject.__)("Reset"), action: "reset" } ]; function ShadowsEditPanel() { const { goBack, params: { category, slug } } = (0,external_wp_components_namespaceObject.useNavigator)(); const [shadows, setShadows] = shadows_edit_panel_useGlobalSetting( `shadow.presets.${category}` ); (0,external_wp_element_.useEffect)(() => { const hasCurrentShadow = shadows?.some( (shadow) => shadow.slug === slug ); if (!!slug && !hasCurrentShadow) { goBack(); } }, [shadows, slug, goBack]); const [baseShadows] = shadows_edit_panel_useGlobalSetting( `shadow.presets.${category}`, void 0, "base" ); const [selectedShadow, setSelectedShadow] = (0,external_wp_element_.useState)( () => (shadows || []).find((shadow) => shadow.slug === slug) ); const baseSelectedShadow = (0,external_wp_element_.useMemo)( () => (baseShadows || []).find((b) => b.slug === slug), [baseShadows, slug] ); const [isConfirmDialogVisible, setIsConfirmDialogVisible] = (0,external_wp_element_.useState)(false); const [isRenameModalVisible, setIsRenameModalVisible] = (0,external_wp_element_.useState)(false); const [shadowName, setShadowName] = (0,external_wp_element_.useState)(selectedShadow.name); if (!category || !slug) { return null; } const onShadowChange = (shadow) => { setSelectedShadow({ ...selectedShadow, shadow }); const updatedShadows = shadows.map( (s) => s.slug === slug ? { ...selectedShadow, shadow } : s ); setShadows(updatedShadows); }; const onMenuClick = (action) => { if (action === "reset") { const updatedShadows = shadows.map( (s) => s.slug === slug ? baseSelectedShadow : s ); setSelectedShadow(baseSelectedShadow); setShadows(updatedShadows); } else if (action === "delete") { setIsConfirmDialogVisible(true); } else if (action === "rename") { setIsRenameModalVisible(true); } }; const handleShadowDelete = () => { setShadows(shadows.filter((s) => s.slug !== slug)); }; const handleShadowRename = (newName) => { if (!newName) { return; } const updatedShadows = shadows.map( (s) => s.slug === slug ? { ...selectedShadow, name: newName } : s ); setSelectedShadow({ ...selectedShadow, name: newName }); setShadows(updatedShadows); }; return !selectedShadow ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(header_default, { title: "" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(header_default, { title: selectedShadow.name }), /* @__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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( shadows_edit_panel_Menu.TriggerButton, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("Menu") } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.Popover, { children: (category === "custom" ? customShadowMenuItems : presetShadowMenuItems).map((item) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( shadows_edit_panel_Menu.Item, { onClick: () => onMenuClick(item.action), disabled: item.action === "reset" && selectedShadow.shadow === baseSelectedShadow.shadow, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.ItemLabel, { children: item.label }) }, item.action )) }) ] }) }) }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-global-styles-screen", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPreview, { shadow: selectedShadow.shadow }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShadowEditor, { shadow: selectedShadow.shadow, onChange: onShadowChange } ) ] }), isConfirmDialogVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: true, onConfirm: () => { handleShadowDelete(); setIsConfirmDialogVisible(false); }, onCancel: () => { setIsConfirmDialogVisible(false); }, confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"), size: "medium", children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the shadow preset. */ (0,external_wp_i18n_namespaceObject.__)( 'Are you sure you want to delete "%s" shadow preset?' ), selectedShadow.name ) } ), isRenameModalVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Rename"), onRequestClose: () => setIsRenameModalVisible(false), size: "small", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "form", { onSubmit: (event) => { event.preventDefault(); handleShadowRename(shadowName); setIsRenameModalVisible(false); }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalInputControl, { __next40pxDefaultSize: true, autoComplete: "off", label: (0,external_wp_i18n_namespaceObject.__)("Name"), placeholder: (0,external_wp_i18n_namespaceObject.__)("Shadow name"), value: shadowName, onChange: (value) => setShadowName(value) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 6 }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Flex, { className: "block-editor-shadow-edit-modal__actions", justify: "flex-end", expanded: false, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: () => setIsRenameModalVisible(false), children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "primary", type: "submit", children: (0,external_wp_i18n_namespaceObject.__)("Save") } ) }) ] } ) ] } ) } ) ] }); } function ShadowsPreview({ shadow }) { const shadowStyle = { boxShadow: shadow }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 4, marginTop: -2, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHStack, { align: "center", justify: "center", className: "edit-site-global-styles__shadow-preview-panel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "edit-site-global-styles__shadow-preview-block", style: shadowStyle } ) } ) }); } function ShadowEditor({ shadow, onChange }) { const addShadowButtonRef = (0,external_wp_element_.useRef)(); const shadowParts = (0,external_wp_element_.useMemo)(() => getShadowParts(shadow), [shadow]); const onChangeShadowPart = (index, part) => { const newShadowParts = [...shadowParts]; newShadowParts[index] = part; onChange(newShadowParts.join(", ")); }; const onAddShadowPart = () => { onChange([...shadowParts, defaultShadow].join(", ")); }; const onRemoveShadowPart = (index) => { onChange(shadowParts.filter((p, i) => i !== index).join(", ")); addShadowButtonRef.current.focus(); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Shadows") }), /* @__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)( external_wp_components_namespaceObject.Button, { size: "small", icon: plus_default, label: (0,external_wp_i18n_namespaceObject.__)("Add shadow"), onClick: () => { onAddShadowPart(); }, ref: addShadowButtonRef } ) }) ] }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), /* @__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)( shadows_edit_panel_ShadowItem, { shadow: part, onChange: (value) => onChangeShadowPart(index, value), canRemove: shadowParts.length > 1, onRemove: () => onRemoveShadowPart(index) }, index )) }) ] }); } function shadows_edit_panel_ShadowItem({ shadow, onChange, canRemove, onRemove }) { const popoverProps = { placement: "left-start", offset: 36, shift: true }; const shadowObj = (0,external_wp_element_.useMemo)( () => shadowStringToObject(shadow), [shadow] ); const onShadowChange = (newShadow) => { onChange(shadowObjectToString(newShadow)); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { popoverProps, className: "edit-site-global-styles__shadow-editor__dropdown", renderToggle: ({ onToggle, isOpen }) => { const toggleProps = { onClick: onToggle, className: dist_clsx( "edit-site-global-styles__shadow-editor__dropdown-toggle", { "is-open": isOpen } ), "aria-expanded": isOpen }; const removeButtonProps = { onClick: () => { if (isOpen) { onToggle(); } onRemove(); }, className: dist_clsx( "edit-site-global-styles__shadow-editor__remove-button", { "is-open": isOpen } ), label: (0,external_wp_i18n_namespaceObject.__)("Remove shadow") }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, icon: shadow_default, ...toggleProps, children: shadowObj.inset ? (0,external_wp_i18n_namespaceObject.__)("Inner shadow") : (0,external_wp_i18n_namespaceObject.__)("Drop shadow") } ), canRemove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", icon: reset_default, ...removeButtonProps } ) ] }); }, renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "medium", className: "edit-site-global-styles__shadow-editor__dropdown-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShadowPopover, { shadowObj, onChange: onShadowChange } ) } ) } ); } function ShadowPopover({ shadowObj, onChange }) { const __experimentalIsRenderedInSidebar = true; const enableAlpha = true; const onShadowChange = (key, value) => { const newShadow = { ...shadowObj, [key]: value }; onChange(newShadow); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, className: "edit-site-global-styles__shadow-editor-panel", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ColorPalette, { clearable: false, enableAlpha, __experimentalIsRenderedInSidebar, value: shadowObj.color, onChange: (value) => onShadowChange("color", value) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, value: shadowObj.inset ? "inset" : "outset", isBlock: true, onChange: (value) => onShadowChange("inset", value === "inset"), hideLabelFromVision: true, __next40pxDefaultSize: true, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "outset", label: (0,external_wp_i18n_namespaceObject.__)("Outset") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "inset", label: (0,external_wp_i18n_namespaceObject.__)("Inset") } ) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 2, gap: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShadowInputControl, { label: (0,external_wp_i18n_namespaceObject.__)("X Position"), value: shadowObj.x, onChange: (value) => onShadowChange("x", value) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShadowInputControl, { label: (0,external_wp_i18n_namespaceObject.__)("Y Position"), value: shadowObj.y, onChange: (value) => onShadowChange("y", value) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShadowInputControl, { label: (0,external_wp_i18n_namespaceObject.__)("Blur"), value: shadowObj.blur, onChange: (value) => onShadowChange("blur", value) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ShadowInputControl, { label: (0,external_wp_i18n_namespaceObject.__)("Spread"), value: shadowObj.spread, onChange: (value) => onShadowChange("spread", value) } ) ] }) ] } ); } function ShadowInputControl({ label, value, onChange }) { const onValueChange = (next) => { const isNumeric = next !== void 0 && !isNaN(parseFloat(next)); const nextValue = isNumeric ? next : "0px"; onChange(nextValue); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalUnitControl, { label, __next40pxDefaultSize: true, value, onChange: onValueChange } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-shadows.js function ScreenShadows() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPanel, {}); } function ScreenShadowsEdit() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsEditPanel, {}); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/dimensions-panel.js const { useGlobalStyle: dimensions_panel_useGlobalStyle, useGlobalSetting: dimensions_panel_useGlobalSetting, useSettingsForBlockElement: dimensions_panel_useSettingsForBlockElement, DimensionsPanel: dimensions_panel_StylesDimensionsPanel } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const DEFAULT_CONTROLS = { contentSize: true, wideSize: true, padding: true, margin: true, blockGap: true, minHeight: true, childLayout: false }; function DimensionsPanel() { const [style] = dimensions_panel_useGlobalStyle("", void 0, "user", { shouldDecodeEncode: false }); const [inheritedStyle, setStyle] = dimensions_panel_useGlobalStyle("", void 0, "all", { shouldDecodeEncode: false }); const [userSettings] = dimensions_panel_useGlobalSetting("", void 0, "user"); const [rawSettings, setSettings] = dimensions_panel_useGlobalSetting(""); const settings = dimensions_panel_useSettingsForBlockElement(rawSettings); const inheritedStyleWithLayout = (0,external_wp_element_.useMemo)(() => { return { ...inheritedStyle, layout: settings.layout }; }, [inheritedStyle, settings.layout]); const styleWithLayout = (0,external_wp_element_.useMemo)(() => { return { ...style, layout: userSettings.layout }; }, [style, userSettings.layout]); const onChange = (newStyle) => { const updatedStyle = { ...newStyle }; delete updatedStyle.layout; setStyle(updatedStyle); if (newStyle.layout !== userSettings.layout) { const updatedSettings = { ...userSettings, layout: newStyle.layout }; if (updatedSettings.layout?.definitions) { delete updatedSettings.layout.definitions; } setSettings(updatedSettings); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( dimensions_panel_StylesDimensionsPanel, { inheritedValue: inheritedStyleWithLayout, value: styleWithLayout, onChange, settings, includeLayoutControls: true, defaultControls: DEFAULT_CONTROLS } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-layout.js const { useHasDimensionsPanel: screen_layout_useHasDimensionsPanel, useGlobalSetting: screen_layout_useGlobalSetting, useSettingsForBlockElement: screen_layout_useSettingsForBlockElement } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ScreenLayout() { const [rawSettings] = screen_layout_useGlobalSetting(""); const settings = screen_layout_useSettingsForBlockElement(rawSettings); const hasDimensionsPanel = screen_layout_useHasDimensionsPanel(settings); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(header_default, { title: (0,external_wp_i18n_namespaceObject.__)("Layout") }), hasDimensionsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DimensionsPanel, {}) ] }); } var screen_layout_default = ScreenLayout; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/style-variations-container.js const { GlobalStylesContext: style_variations_container_GlobalStylesContext } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function StyleVariationsContainer({ gap = 2 }) { const { user } = (0,external_wp_element_.useContext)(style_variations_container_GlobalStylesContext); const userStyles = user?.styles; const variations = (0,external_wp_data_.useSelect)((select) => { return select( external_wp_coreData_namespaceObject.store ).__experimentalGetCurrentThemeGlobalStylesVariations(); }, []); const fullStyleVariations = variations?.filter((variation) => { return !isVariationWithProperties(variation, ["color"]) && !isVariationWithProperties(variation, [ "typography", "spacing" ]); }); const themeVariations = (0,external_wp_element_.useMemo)(() => { const withEmptyVariation = [ { title: (0,external_wp_i18n_namespaceObject.__)("Default"), settings: {}, styles: {} }, ...fullStyleVariations ?? [] ]; return [ ...withEmptyVariation.map((variation) => { const blockStyles = { ...variation?.styles?.blocks }; if (userStyles?.blocks) { Object.keys(userStyles.blocks).forEach((blockName) => { if (userStyles.blocks[blockName].css) { const variationBlockStyles = blockStyles[blockName] || {}; const customCSS = { css: `${blockStyles[blockName]?.css || ""} ${userStyles.blocks[blockName].css.trim() || ""}` }; blockStyles[blockName] = { ...variationBlockStyles, ...customCSS }; } }); } const css = userStyles?.css || variation.styles?.css ? { css: `${variation.styles?.css || ""} ${userStyles?.css || ""}` } : {}; const blocks = Object.keys(blockStyles).length > 0 ? { blocks: blockStyles } : {}; const styles = { ...variation.styles, ...css, ...blocks }; return { ...variation, settings: variation.settings ?? {}, styles }; }) ]; }, [fullStyleVariations, userStyles?.blocks, userStyles?.css]); if (!fullStyleVariations || fullStyleVariations?.length < 1) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalGrid, { columns: 2, className: "edit-site-global-styles-style-variations-container", gap, children: themeVariations.map((variation, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { variation, children: (isFocused) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( preview_styles_default, { label: variation?.title, withHoverView: true, isFocused, variation } ) }, index)) } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/content.js function SidebarNavigationScreenGlobalStylesContent() { const gap = 3; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { spacing: 10, className: "edit-site-global-styles-variation-container", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleVariationsContainer, { gap }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Palettes"), gap }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Typography"), gap }) ] } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-style-variations.js const { useZoomOut } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ScreenStyleVariations() { const isPreviewMode = (0,external_wp_data_.useSelect)((select) => { return select(external_wp_blockEditor_namespaceObject.store).getSettings().isPreviewMode; }, []); useZoomOut(!isPreviewMode); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( header_default, { title: (0,external_wp_i18n_namespaceObject.__)("Browse styles"), description: (0,external_wp_i18n_namespaceObject.__)( "Choose a variation to change the look of the site." ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Card, { size: "small", isBorderless: true, className: "edit-site-global-styles-screen-style-variations", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStylesContent, {}) }) } ) ] }); } var screen_style_variations_default = ScreenStyleVariations; ;// external ["wp","mediaUtils"] const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/constants.js const STYLE_BOOK_COLOR_GROUPS = [ { slug: "theme-colors", title: (0,external_wp_i18n_namespaceObject.__)("Theme Colors"), origin: "theme", type: "colors" }, { slug: "theme-gradients", title: (0,external_wp_i18n_namespaceObject.__)("Theme Gradients"), origin: "theme", type: "gradients" }, { slug: "custom-colors", title: (0,external_wp_i18n_namespaceObject.__)("Custom Colors"), origin: "custom", type: "colors" }, { slug: "custom-gradients", title: (0,external_wp_i18n_namespaceObject.__)("Custom Gradients"), origin: "custom", // User. type: "gradients" }, { slug: "duotones", title: (0,external_wp_i18n_namespaceObject.__)("Duotones"), origin: "theme", type: "duotones" }, { slug: "default-colors", title: (0,external_wp_i18n_namespaceObject.__)("Default Colors"), origin: "default", type: "colors" }, { slug: "default-gradients", title: (0,external_wp_i18n_namespaceObject.__)("Default Gradients"), origin: "default", type: "gradients" } ]; const STYLE_BOOK_THEME_SUBCATEGORIES = [ { slug: "site-identity", title: (0,external_wp_i18n_namespaceObject.__)("Site Identity"), blocks: ["core/site-logo", "core/site-title", "core/site-tagline"] }, { slug: "design", title: (0,external_wp_i18n_namespaceObject.__)("Design"), blocks: ["core/navigation", "core/avatar", "core/post-time-to-read"], exclude: ["core/home-link", "core/navigation-link"] }, { slug: "posts", title: (0,external_wp_i18n_namespaceObject.__)("Posts"), blocks: [ "core/post-title", "core/post-excerpt", "core/post-author", "core/post-author-name", "core/post-author-biography", "core/post-date", "core/post-terms", "core/term-description", "core/query-title", "core/query-no-results", "core/query-pagination", "core/query-numbers" ] }, { slug: "comments", title: (0,external_wp_i18n_namespaceObject.__)("Comments"), blocks: [ "core/comments-title", "core/comments-pagination", "core/comments-pagination-numbers", "core/comments", "core/comments-author-name", "core/comment-content", "core/comment-date", "core/comment-edit-link", "core/comment-reply-link", "core/comment-template", "core/post-comments-count", "core/post-comments-link" ] } ]; const STYLE_BOOK_CATEGORIES = [ { slug: "overview", title: (0,external_wp_i18n_namespaceObject.__)("Overview"), blocks: [] }, { slug: "text", title: (0,external_wp_i18n_namespaceObject.__)("Text"), blocks: [ "core/post-content", "core/home-link", "core/navigation-link" ] }, { slug: "colors", title: (0,external_wp_i18n_namespaceObject.__)("Colors"), blocks: [] }, { slug: "theme", title: (0,external_wp_i18n_namespaceObject.__)("Theme"), subcategories: STYLE_BOOK_THEME_SUBCATEGORIES }, { slug: "media", title: (0,external_wp_i18n_namespaceObject.__)("Media"), blocks: ["core/post-featured-image"] }, { slug: "widgets", title: (0,external_wp_i18n_namespaceObject.__)("Widgets"), blocks: [] }, { slug: "embed", title: (0,external_wp_i18n_namespaceObject.__)("Embeds"), include: [] } ]; const STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES = [ ...STYLE_BOOK_THEME_SUBCATEGORIES, { slug: "media", title: (0,external_wp_i18n_namespaceObject.__)("Media"), blocks: ["core/post-featured-image"] }, { slug: "widgets", title: (0,external_wp_i18n_namespaceObject.__)("Widgets"), blocks: [] }, { slug: "embed", title: (0,external_wp_i18n_namespaceObject.__)("Embeds"), include: [] } ]; const STYLE_BOOK_PREVIEW_CATEGORIES = [ { slug: "overview", title: (0,external_wp_i18n_namespaceObject.__)("Overview"), blocks: [] }, { slug: "text", title: (0,external_wp_i18n_namespaceObject.__)("Text"), blocks: [ "core/post-content", "core/home-link", "core/navigation-link" ] }, { slug: "colors", title: (0,external_wp_i18n_namespaceObject.__)("Colors"), blocks: [] }, { slug: "blocks", title: (0,external_wp_i18n_namespaceObject.__)("All Blocks"), blocks: [], subcategories: STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES } ]; const ROOT_CONTAINER = ` .is-root-container { display: flow-root; } `; const STYLE_BOOK_IFRAME_STYLES = ` body { position: relative; padding: 32px !important; } ${ROOT_CONTAINER} .edit-site-style-book__examples { max-width: 1200px; margin: 0 auto; } .edit-site-style-book__example { max-width: 900px; border-radius: 2px; cursor: pointer; display: flex; flex-direction: column; gap: 40px; padding: 16px; width: 100%; box-sizing: border-box; scroll-margin-top: 32px; scroll-margin-bottom: 32px; margin: 0 auto 40px auto; } .edit-site-style-book__example.is-selected { box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba)); } .edit-site-style-book__example.is-disabled-example { pointer-events: none; } .edit-site-style-book__example:focus:not(:disabled) { box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba)); outline: 3px solid transparent; } .edit-site-style-book__duotone-example > div:first-child { display: flex; aspect-ratio: 16 / 9; grid-row: span 1; grid-column: span 2; } .edit-site-style-book__duotone-example img { width: 100%; height: 100%; object-fit: cover; } .edit-site-style-book__duotone-example > div:not(:first-child) { height: 20px; border: 1px solid color-mix( in srgb, currentColor 10%, transparent ); } .edit-site-style-book__color-example { border: 1px solid color-mix( in srgb, currentColor 10%, transparent ); } .edit-site-style-book__subcategory-title, .edit-site-style-book__example-title { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; font-size: 13px; font-weight: normal; line-height: normal; margin: 0; text-align: left; padding-top: 8px; border-top: 1px solid color-mix( in srgb, currentColor 10%, transparent ); color: color-mix( in srgb, currentColor 60%, transparent ); } .edit-site-style-book__subcategory-title { font-size: 16px; margin-bottom: 40px; padding-bottom: 8px; } .edit-site-style-book__example-preview { width: 100%; } .edit-site-style-book__example-preview .block-editor-block-list__insertion-point, .edit-site-style-book__example-preview .block-list-appender { display: none; } :where(.is-root-container > .wp-block:first-child) { margin-top: 0; } :where(.is-root-container > .wp-block:last-child) { margin-bottom: 0; } `; ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/categories.js function getExamplesByCategory(categoryDefinition, examples) { if (!categoryDefinition?.slug || !examples?.length) { return; } const categories = categoryDefinition?.subcategories ?? []; if (categories.length) { return categories.reduce( (acc, subcategoryDefinition) => { const subcategoryExamples = getExamplesByCategory( subcategoryDefinition, examples ); if (subcategoryExamples) { if (!acc.subcategories) { acc.subcategories = []; } acc.subcategories = [ ...acc.subcategories, subcategoryExamples ]; } return acc; }, { title: categoryDefinition.title, slug: categoryDefinition.slug } ); } const blocksToInclude = categoryDefinition?.blocks || []; const blocksToExclude = categoryDefinition?.exclude || []; const categoryExamples = examples.filter((example) => { return !blocksToExclude.includes(example.name) && (example.category === categoryDefinition.slug || blocksToInclude.includes(example.name)); }); if (!categoryExamples.length) { return; } return { title: categoryDefinition.title, slug: categoryDefinition.slug, examples: categoryExamples }; } function getTopLevelStyleBookCategories() { const reservedCategories = [ ...STYLE_BOOK_THEME_SUBCATEGORIES, ...STYLE_BOOK_CATEGORIES ].map(({ slug }) => slug); const extraCategories = (0,external_wp_blocks_namespaceObject.getCategories)(); const extraCategoriesFiltered = extraCategories.filter( ({ slug }) => !reservedCategories.includes(slug) ); return [...STYLE_BOOK_CATEGORIES, ...extraCategoriesFiltered]; } ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/color-examples.js const ColorExamples = ({ colors, type, templateColumns = "1fr 1fr", itemHeight = "52px" }) => { if (!colors) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { templateColumns, rowGap: 8, columnGap: 16, children: colors.map((color) => { const className = type === "gradients" ? (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(color.slug) : (0,external_wp_blockEditor_namespaceObject.getColorClassName)("background-color", color.slug); const classes = dist_clsx( "edit-site-style-book__color-example", className ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.View, { className: classes, style: { height: itemHeight } }, color.slug ); }) }); }; var color_examples_default = ColorExamples; ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/duotone-examples.js const DuotoneExamples = ({ duotones }) => { if (!duotones) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 2, rowGap: 16, columnGap: 16, children: duotones.map((duotone) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalGrid, { className: "edit-site-style-book__duotone-example", columns: 2, rowGap: 8, columnGap: 8, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { alt: `Duotone example: ${duotone.slug}`, src: "https://s.w.org/images/core/5.3/MtBlanc1.jpg", style: { filter: `url(#wp-duotone-${duotone.slug})` } } ) }), duotone.colors.map((color) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.View, { className: "edit-site-style-book__color-example", style: { backgroundColor: color } }, color ); }) ] }, duotone.slug ); }) }); }; var duotone_examples_default = DuotoneExamples; ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/examples.js function getColorExamples(colors) { if (!colors) { return []; } const examples = []; STYLE_BOOK_COLOR_GROUPS.forEach((group) => { const palette = colors[group.type]; const paletteFiltered = Array.isArray(palette) ? palette.find( (origin) => origin.slug === group.origin ) : void 0; if (paletteFiltered?.[group.type]) { const example = { name: group.slug, title: group.title, category: "colors" }; if (group.type === "duotones") { example.content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( duotone_examples_default, { duotones: paletteFiltered[group.type] } ); examples.push(example); } else { example.content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( color_examples_default, { colors: paletteFiltered[group.type], type: group.type } ); examples.push(example); } } }); return examples; } function getOverviewBlockExamples(colors) { const examples = []; const themePalette = Array.isArray(colors?.colors) ? colors.colors.find( (origin) => origin.slug === "theme" ) : void 0; if (themePalette) { const themeColorexample = { name: "theme-colors", title: (0,external_wp_i18n_namespaceObject.__)("Colors"), category: "overview", content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( color_examples_default, { colors: themePalette.colors, type: "colors", templateColumns: "repeat(auto-fill, minmax( 200px, 1fr ))", itemHeight: "32px" } ) }; examples.push(themeColorexample); } const typographyBlockExamples = []; if ((0,external_wp_blocks_namespaceObject.getBlockType)("core/heading")) { const headingBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/heading", { // translators: Typography example. Your local alphabet, numbers and some common special characters. content: (0,external_wp_i18n_namespaceObject.__)( `AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789X{(\u2026)},.-<>?!*&:/A@HELFO\u2122\xA9` ), level: 1 }); typographyBlockExamples.push(headingBlock); } if ((0,external_wp_blocks_namespaceObject.getBlockType)("core/paragraph")) { const firstParagraphBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/paragraph", { content: (0,external_wp_i18n_namespaceObject.__)( `A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.` ) }); const secondParagraphBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/paragraph", { content: (0,external_wp_i18n_namespaceObject.__)( `Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.` ) }); if ((0,external_wp_blocks_namespaceObject.getBlockType)("core/group")) { const groupBlock = (0,external_wp_blocks_namespaceObject.createBlock)( "core/group", { layout: { type: "grid", columnCount: 2, minimumColumnWidth: "12rem" }, style: { spacing: { blockGap: "1.5rem" } } }, [firstParagraphBlock, secondParagraphBlock] ); typographyBlockExamples.push(groupBlock); } else { typographyBlockExamples.push(firstParagraphBlock); } } if (!!typographyBlockExamples.length) { examples.push({ name: "typography", title: (0,external_wp_i18n_namespaceObject.__)("Typography"), category: "overview", blocks: typographyBlockExamples }); } const otherBlockExamples = [ "core/image", "core/separator", "core/buttons", "core/pullquote", "core/search" ]; otherBlockExamples.forEach((blockName) => { const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); if (blockType && blockType.example) { const blockExample = { name: blockName, title: blockType.title, category: "overview", /* * CSS generated from style attributes will take precedence over global styles CSS, * so remove the style attribute from the example to ensure the example * demonstrates changes to global styles. */ blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockName, { ...blockType.example, attributes: { ...blockType.example.attributes, style: void 0 } }) }; examples.push(blockExample); } }); return examples; } function getExamples(colors) { const nonHeadingBlockExamples = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter((blockType) => { const { name, example, supports } = blockType; return name !== "core/heading" && !!example && supports?.inserter !== false; }).map((blockType) => ({ name: blockType.name, title: blockType.title, category: blockType.category, /* * CSS generated from style attributes will take precedence over global styles CSS, * so remove the style attribute from the example to ensure the example * demonstrates changes to global styles. */ blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockType.name, { ...blockType.example, attributes: { ...blockType.example.attributes, style: void 0 } }) })); const isHeadingBlockRegistered = !!(0,external_wp_blocks_namespaceObject.getBlockType)("core/heading"); if (!isHeadingBlockRegistered) { return nonHeadingBlockExamples; } const headingsExample = { name: "core/heading", title: (0,external_wp_i18n_namespaceObject.__)("Headings"), category: "text", blocks: [1, 2, 3, 4, 5, 6].map((level) => { return (0,external_wp_blocks_namespaceObject.createBlock)("core/heading", { content: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: heading level e.g: "1", "2", "3" (0,external_wp_i18n_namespaceObject.__)("Heading %d"), level ), level }); }) }; const colorExamples = getColorExamples(colors); const overviewBlockExamples = getOverviewBlockExamples(colors); return [ headingsExample, ...colorExamples, ...nonHeadingBlockExamples, ...overviewBlockExamples ]; } ;// ./node_modules/@wordpress/admin-ui/build-module/page/header.js function Header({ breadcrumbs, badges, title, subTitle, actions }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "admin-ui-page__header", as: "header", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { className: "admin-ui-page__header-title", justify: "space-between", spacing: 2, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, children: [ title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { as: "h2", level: 3, weight: 500, truncate: true, children: title }), breadcrumbs, badges ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHStack, { style: { width: "auto", flexShrink: 0 }, spacing: 2, className: "admin-ui-page__header-actions", children: actions } ) ] } ), subTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "admin-ui-page__header-subtitle", children: subTitle }) ] }); } ;// ./node_modules/@wordpress/admin-ui/build-module/page/index.js function Page({ breadcrumbs, badges, title, subTitle, children, className, actions, hasPadding = false }) { const classes = dist_clsx("admin-ui-page", className); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(navigable_region_default, { className: classes, ariaLabel: title, children: [ (title || breadcrumbs || badges) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Header, { breadcrumbs, badges, title, subTitle, actions } ), hasPadding ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "admin-ui-page__content has-padding", children }) : children ] }); } var page_page_default = Page; ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-global-styles-wrapper/index.js const { useLocation: sidebar_global_styles_wrapper_useLocation, useHistory: sidebar_global_styles_wrapper_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); const GlobalStylesPageActions = ({ isStyleBookOpened, setIsStyleBookOpened, path }) => { const history = sidebar_global_styles_wrapper_useHistory(); const canEditCSS = (0,external_wp_data_.useSelect)((select) => { const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); const globalStylesId = __experimentalGetCurrentGlobalStylesId(); const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0; return !!globalStyles?._links?.["wp:action-edit-css"]; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { isPressed: isStyleBookOpened, icon: seen_default, label: (0,external_wp_i18n_namespaceObject.__)("Style Book"), onClick: () => { setIsStyleBookOpened(!isStyleBookOpened); const updatedPath = !isStyleBookOpened ? (0,external_wp_url_namespaceObject.addQueryArgs)(path, { preview: "stylebook" }) : (0,external_wp_url_namespaceObject.removeQueryArgs)(path, "preview"); history.navigate(updatedPath); }, size: "compact" } ), canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("More"), toggleProps: { size: "compact" }, children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { onClose(); history.navigate( (0,external_wp_url_namespaceObject.addQueryArgs)(path, { section: "/css" }) ); }, children: (0,external_wp_i18n_namespaceObject.__)("Additional CSS") } ) }) } ) ] }); }; const useSection = () => { const { path, query } = sidebar_global_styles_wrapper_useLocation(); const history = sidebar_global_styles_wrapper_useHistory(); return (0,external_wp_element_.useMemo)(() => { return [ query.section ?? "/", (updatedSection) => { history.navigate( (0,external_wp_url_namespaceObject.addQueryArgs)(path, { section: updatedSection }) ); } ]; }, [path, query.section, history]); }; function GlobalStylesUIWrapper() { const { path } = sidebar_global_styles_wrapper_useLocation(); const [isStyleBookOpened, setIsStyleBookOpened] = (0,external_wp_element_.useState)( path.includes("preview=stylebook") ); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const [section, onChangeSection] = useSection(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( page_page_default, { actions: !isMobileViewport ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GlobalStylesPageActions, { isStyleBookOpened, setIsStyleBookOpened, path } ) : null, className: "edit-site-styles", title: (0,external_wp_i18n_namespaceObject.__)("Styles"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_default, { path: section, onPathChange: onChangeSection }) } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/index.js const { ExperimentalBlockEditorProvider, useGlobalStyle: style_book_useGlobalStyle, GlobalStylesContext: style_book_GlobalStylesContext, useGlobalStylesOutputWithConfig } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { mergeBaseAndUserConfigs: style_book_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); const { Tabs: style_book_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); function isObjectEmpty(object) { return !object || Object.keys(object).length === 0; } const scrollToSection = (anchorId, iframe) => { if (!anchorId || !iframe || !iframe?.contentDocument) { return; } const element = anchorId === "top" ? iframe.contentDocument.body : iframe.contentDocument.getElementById(anchorId); if (element) { element.scrollIntoView({ behavior: "smooth" }); } }; const getStyleBookNavigationFromPath = (path) => { if (path && typeof path === "string") { if (path === "/" || path.startsWith("/typography") || path.startsWith("/colors") || path.startsWith("/blocks")) { return { top: true }; } } return null; }; function useMultiOriginPalettes() { const { colors, gradients } = (0,external_wp_blockEditor_namespaceObject.__experimentalUseMultipleOriginColorsAndGradients)(); const [ shouldDisplayDefaultDuotones, customDuotones, themeDuotones, defaultDuotones ] = (0,external_wp_blockEditor_namespaceObject.useSettings)( "color.defaultDuotone", "color.duotone.custom", "color.duotone.theme", "color.duotone.default" ); const palettes = (0,external_wp_element_.useMemo)(() => { const result = { colors, gradients, duotones: [] }; if (themeDuotones && themeDuotones.length) { result.duotones.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Theme", "Indicates these duotone filters come from the theme." ), slug: "theme", duotones: themeDuotones }); } if (shouldDisplayDefaultDuotones && defaultDuotones && defaultDuotones.length) { result.duotones.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Default", "Indicates these duotone filters come from WordPress." ), slug: "default", duotones: defaultDuotones }); } if (customDuotones && customDuotones.length) { result.duotones.push({ name: (0,external_wp_i18n_namespaceObject._x)( "Custom", "Indicates these doutone filters are created by the user." ), slug: "custom", duotones: customDuotones }); } return result; }, [ colors, gradients, customDuotones, themeDuotones, defaultDuotones, shouldDisplayDefaultDuotones ]); return palettes; } function getExamplesForSinglePageUse(examples) { const examplesForSinglePageUse = []; const overviewCategoryExamples = getExamplesByCategory( { slug: "overview" }, examples ); examplesForSinglePageUse.push(...overviewCategoryExamples.examples); const otherExamples = examples.filter((example) => { return example.category !== "overview" && !overviewCategoryExamples.examples.find( (overviewExample) => overviewExample.name === example.name ); }); examplesForSinglePageUse.push(...otherExamples); return examplesForSinglePageUse; } function applyBlockVariationsToExamples(examples, variation) { if (!variation) { return examples; } return examples.map((example) => { return { ...example, variation, blocks: Array.isArray(example.blocks) ? example.blocks.map((block) => ({ ...block, attributes: { ...block.attributes, style: void 0, className: getVariationClassName(variation) } })) : { ...example.blocks, attributes: { ...example.blocks.attributes, style: void 0, className: getVariationClassName(variation) } } }; }); } function StyleBook({ enableResizing = true, isSelected, onClick, onSelect, showCloseButton = true, onClose, showTabs = true, userConfig = {}, path = "" }) { const [textColor] = style_book_useGlobalStyle("color.text"); const [backgroundColor] = style_book_useGlobalStyle("color.background"); const colors = useMultiOriginPalettes(); const examples = (0,external_wp_element_.useMemo)(() => getExamples(colors), [colors]); const tabs = (0,external_wp_element_.useMemo)( () => getTopLevelStyleBookCategories().filter( (category) => examples.some( (example) => example.category === category.slug ) ), [examples] ); const examplesForSinglePageUse = getExamplesForSinglePageUse(examples); const { base: baseConfig } = (0,external_wp_element_.useContext)(style_book_GlobalStylesContext); const goTo = getStyleBookNavigationFromPath(path); const mergedConfig = (0,external_wp_element_.useMemo)(() => { if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) { return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig); } return {}; }, [baseConfig, userConfig]); const originalSettings = (0,external_wp_data_.useSelect)( (select) => select(external_wp_blockEditor_namespaceObject.store).getSettings(), [] ); const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig); const settings = (0,external_wp_element_.useMemo)( () => ({ ...originalSettings, styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : originalSettings.styles, isPreviewMode: true }), [globalStyles, originalSettings, userConfig] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( editor_canvas_container_default, { onClose, enableResizing, closeButtonLabel: showCloseButton ? (0,external_wp_i18n_namespaceObject.__)("Close") : null, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx("edit-site-style-book", { "is-button": !!onClick }), style: { color: textColor, background: backgroundColor }, children: showTabs ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(style_book_Tabs, { children: [ /* @__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)( style_book_Tabs.Tab, { tabId: tab.slug, children: tab.title }, tab.slug )) }) }), tabs.map((tab) => { const categoryDefinition = tab.slug ? getTopLevelStyleBookCategories().find( (_category) => _category.slug === tab.slug ) : null; const filteredExamples = categoryDefinition ? getExamplesByCategory( categoryDefinition, examples ) : { examples }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( style_book_Tabs.TabPanel, { tabId: tab.slug, focusable: false, className: "edit-site-style-book__tabpanel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( StyleBookBody, { category: tab.slug, examples: filteredExamples, isSelected, onSelect, settings, title: tab.title, goTo } ) }, tab.slug ); }) ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( StyleBookBody, { examples: { examples: examplesForSinglePageUse }, isSelected, onClick, onSelect, settings, goTo } ) } ) } ); } const StyleBookPreview = ({ userConfig = {}, isStatic = false }) => { const siteEditorSettings = (0,external_wp_data_.useSelect)( (select) => select(store).getSettings(), [] ); const canUserUploadMedia = (0,external_wp_data_.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).canUser("create", { kind: "postType", name: "attachment" }), [] ); (0,external_wp_element_.useEffect)(() => { (0,external_wp_data_.dispatch)(external_wp_blockEditor_namespaceObject.store).updateSettings({ ...siteEditorSettings, mediaUpload: canUserUploadMedia ? external_wp_mediaUtils_namespaceObject.uploadMedia : void 0 }); }, [siteEditorSettings, canUserUploadMedia]); const [section, onChangeSection] = useSection(); const isSelected = (blockName) => { return section === `/blocks/${encodeURIComponent(blockName)}` || section.startsWith( `/blocks/${encodeURIComponent(blockName)}/` ); }; const onSelect = (blockName, isBlockVariation = false) => { if (STYLE_BOOK_COLOR_GROUPS.find( (group) => group.slug === blockName )) { onChangeSection("/colors/palette"); return; } if (blockName === "typography") { onChangeSection("/typography"); return; } if (isBlockVariation) { return; } onChangeSection(`/blocks/${encodeURIComponent(blockName)}`); }; const colors = useMultiOriginPalettes(); const examples = getExamples(colors); const examplesForSinglePageUse = getExamplesForSinglePageUse(examples); let previewCategory = null; let blockVariation = null; if (section.includes("/colors")) { previewCategory = "colors"; } else if (section.includes("/typography")) { previewCategory = "text"; } else if (section.includes("/blocks")) { previewCategory = "blocks"; let blockName = decodeURIComponent(section).split("/blocks/")[1]; if (blockName?.includes("/variations")) { [blockName, blockVariation] = blockName.split("/variations/"); } if (blockName && examples.find((example) => example.name === blockName)) { previewCategory = blockName; } } else if (!isStatic) { previewCategory = "overview"; } const categoryDefinition = STYLE_BOOK_PREVIEW_CATEGORIES.find( (category) => category.slug === previewCategory ); const filteredExamples = (0,external_wp_element_.useMemo)(() => { if (!categoryDefinition) { return { examples: [ examples.find( (example) => example.name === previewCategory ) ] }; } return getExamplesByCategory(categoryDefinition, examples); }, [categoryDefinition, examples, previewCategory]); const displayedExamples = (0,external_wp_element_.useMemo)(() => { if (!previewCategory) { return { examples: examplesForSinglePageUse }; } if (blockVariation) { return { examples: applyBlockVariationsToExamples( filteredExamples.examples, blockVariation ) }; } return filteredExamples; }, [ previewCategory, examplesForSinglePageUse, blockVariation, filteredExamples ]); const { base: baseConfig } = (0,external_wp_element_.useContext)(style_book_GlobalStylesContext); const goTo = getStyleBookNavigationFromPath(section); const mergedConfig = (0,external_wp_element_.useMemo)(() => { if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) { return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig); } return {}; }, [baseConfig, userConfig]); const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig); const settings = (0,external_wp_element_.useMemo)( () => ({ ...siteEditorSettings, styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : siteEditorSettings.styles, isPreviewMode: true }), [globalStyles, siteEditorSettings, userConfig] ); 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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesRenderer, { disableRootPadding: true }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( StyleBookBody, { examples: displayedExamples, settings, goTo, isSelected: !isStatic ? isSelected : null, onSelect: !isStatic ? onSelect : null } ) ] }) }); }; const StyleBookBody = ({ examples, isSelected, onClick, onSelect, settings, title, goTo }) => { const [isFocused, setIsFocused] = (0,external_wp_element_.useState)(false); const [hasIframeLoaded, setHasIframeLoaded] = (0,external_wp_element_.useState)(false); const iframeRef = (0,external_wp_element_.useRef)(null); const buttonModeProps = { role: "button", onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), onKeyDown: (event) => { if (event.defaultPrevented) { return; } const { keyCode } = event; if (onClick && (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE)) { event.preventDefault(); onClick(event); } }, onClick: (event) => { if (event.defaultPrevented) { return; } if (onClick) { event.preventDefault(); onClick(event); } }, readonly: true }; const handleLoad = () => setHasIframeLoaded(true); (0,external_wp_element_.useLayoutEffect)(() => { if (hasIframeLoaded && iframeRef?.current) { if (goTo?.top) { scrollToSection("top", iframeRef?.current); } } }, [iframeRef?.current, goTo, scrollToSection, hasIframeLoaded]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_blockEditor_namespaceObject.__unstableIframe, { onLoad: handleLoad, ref: iframeRef, className: dist_clsx("edit-site-style-book__iframe", { "is-focused": isFocused && !!onClick, "is-button": !!onClick }), name: "style-book-canvas", tabIndex: 0, ...onClick ? buttonModeProps : {}, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { styles: settings.styles }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("style", { children: [ STYLE_BOOK_IFRAME_STYLES, !!onClick && "body { cursor: pointer; } body * { pointer-events: none; }" ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Examples, { className: "edit-site-style-book__examples", filteredExamples: examples, label: title ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Category of blocks, e.g. Text. (0,external_wp_i18n_namespaceObject.__)("Examples of blocks in the %s category"), title ) : (0,external_wp_i18n_namespaceObject.__)("Examples of blocks"), isSelected, onSelect }, title ) ] } ); }; const Examples = (0,external_wp_element_.memo)( ({ className, filteredExamples, label, isSelected, onSelect }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Composite, { orientation: "vertical", className, "aria-label": label, role: "grid", children: [ !!filteredExamples?.examples?.length && filteredExamples.examples.map((example) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Example, { id: `example-${example.name}`, title: example.title, content: example.content, blocks: example.blocks, isSelected: isSelected?.(example.name), onClick: !!onSelect ? () => onSelect( example.name, !!example.variation ) : null }, example.name )), !!filteredExamples?.subcategories?.length && filteredExamples.subcategories.map((subcategory) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Composite.Group, { className: "edit-site-style-book__subcategory", children: [ /* @__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 }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Subcategory, { examples: subcategory.examples, isSelected, onSelect } ) ] }, `subcategory-${subcategory.slug}` )) ] } ); } ); const Subcategory = ({ examples, isSelected, onSelect }) => { return !!examples?.length && examples.map((example) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Example, { id: `example-${example.name}`, title: example.title, content: example.content, blocks: example.blocks, isSelected: isSelected?.(example.name), onClick: !!onSelect ? () => onSelect(example.name) : null }, example.name )); }; const disabledExamples = ["example-duotones"]; const Example = ({ id, title, blocks, isSelected, onClick, content }) => { const originalSettings = (0,external_wp_data_.useSelect)( (select) => select(external_wp_blockEditor_namespaceObject.store).getSettings(), [] ); const settings = (0,external_wp_element_.useMemo)( () => ({ ...originalSettings, focusMode: false, // Disable "Spotlight mode". isPreviewMode: true }), [originalSettings] ); const renderedBlocks = (0,external_wp_element_.useMemo)( () => Array.isArray(blocks) ? blocks : [blocks], [blocks] ); const disabledProps = disabledExamples.includes(id) || !onClick ? { disabled: true, accessibleWhenDisabled: !!onClick } : {}; 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)( external_wp_components_namespaceObject.Composite.Item, { className: dist_clsx("edit-site-style-book__example", { "is-selected": isSelected, "is-disabled-example": !!disabledProps?.disabled }), id, "aria-label": !!onClick ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Title of a block, e.g. Heading. (0,external_wp_i18n_namespaceObject.__)("Open %s styles in Styles panel"), title ) : void 0, render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), role: !!onClick ? "button" : null, onClick, ...disabledProps, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-style-book__example-title", children: title }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "edit-site-style-book__example-preview", "aria-hidden": true, 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)( ExperimentalBlockEditorProvider, { value: renderedBlocks, settings, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { renderAppender: false }) ] } ) }) } ) ] } ) }) }); }; var style_book_default = StyleBook; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-css.js const { useGlobalStyle: screen_css_useGlobalStyle, AdvancedPanel: screen_css_StylesAdvancedPanel } = unlock( external_wp_blockEditor_namespaceObject.privateApis ); function ScreenCSS() { const [style] = screen_css_useGlobalStyle("", void 0, "user", { shouldDecodeEncode: false }); const [inheritedStyle, setStyle] = screen_css_useGlobalStyle("", void 0, "all", { shouldDecodeEncode: false }); const { setEditorCanvasContainerView } = unlock( (0,external_wp_data_.useDispatch)(store) ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( header_default, { title: (0,external_wp_i18n_namespaceObject.__)("Additional CSS"), description: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ (0,external_wp_i18n_namespaceObject.__)( "You can add custom CSS to further customize the appearance and layout of your site." ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)( "https://developer.wordpress.org/advanced-administration/wordpress/css/" ), className: "edit-site-global-styles-screen-css-help-link", children: (0,external_wp_i18n_namespaceObject.__)("Learn more about CSS") } ) ] }), onBack: () => { setEditorCanvasContainerView(void 0); } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen-css", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( screen_css_StylesAdvancedPanel, { value: style, onChange: setStyle, inheritedValue: inheritedStyle } ) }) ] }); } var screen_css_default = ScreenCSS; ;// ./node_modules/@wordpress/edit-site/build-module/components/revisions/index.js const { ExperimentalBlockEditorProvider: revisions_ExperimentalBlockEditorProvider, GlobalStylesContext: revisions_GlobalStylesContext, useGlobalStylesOutputWithConfig: revisions_useGlobalStylesOutputWithConfig, __unstableBlockStyleVariationOverridesWithConfig } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { mergeBaseAndUserConfigs: revisions_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis); function revisions_isObjectEmpty(object) { return !object || Object.keys(object).length === 0; } function Revisions({ userConfig, blocks }) { const { base: baseConfig } = (0,external_wp_element_.useContext)(revisions_GlobalStylesContext); const mergedConfig = (0,external_wp_element_.useMemo)(() => { if (!revisions_isObjectEmpty(userConfig) && !revisions_isObjectEmpty(baseConfig)) { return revisions_mergeBaseAndUserConfigs(baseConfig, userConfig); } return {}; }, [baseConfig, userConfig]); const renderedBlocksArray = (0,external_wp_element_.useMemo)( () => Array.isArray(blocks) ? blocks : [blocks], [blocks] ); const originalSettings = (0,external_wp_data_.useSelect)( (select) => select(external_wp_blockEditor_namespaceObject.store).getSettings(), [] ); const settings = (0,external_wp_element_.useMemo)( () => ({ ...originalSettings, isPreviewMode: true }), [originalSettings] ); const [globalStyles] = revisions_useGlobalStylesOutputWithConfig(mergedConfig); const editorStyles = !revisions_isObjectEmpty(globalStyles) && !revisions_isObjectEmpty(userConfig) ? globalStyles : settings.styles; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( editor_canvas_container_default, { title: (0,external_wp_i18n_namespaceObject.__)("Revisions"), closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close revisions"), enableResizing: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_blockEditor_namespaceObject.__unstableIframe, { className: "edit-site-revisions__iframe", name: "revisions", tabIndex: 0, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { // Forming a "block formatting context" to prevent margin collapsing. // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context children: `.is-root-container { display: flow-root; }` }), /* @__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)( revisions_ExperimentalBlockEditorProvider, { value: renderedBlocksArray, settings, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { renderAppender: false }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { styles: editorStyles }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( __unstableBlockStyleVariationOverridesWithConfig, { config: mergedConfig } ) ] } ) }) ] } ) } ); } var revisions_default = Revisions; ;// external ["wp","date"] const external_wp_date_namespaceObject = window["wp"]["date"]; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/revisions-buttons.js const DAY_IN_MILLISECONDS = 60 * 60 * 1e3 * 24; const { getGlobalStylesChanges } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function ChangesSummary({ revision, previousRevision }) { const changes = getGlobalStylesChanges(revision, previousRevision, { maxResults: 7 }); if (!changes.length) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "ul", { "data-testid": "global-styles-revision-changes", className: "edit-site-global-styles-screen-revisions__changes", children: changes.map((change) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: change }, change)) } ); } function getRevisionLabel(id, authorDisplayName, formattedModifiedDate, areStylesEqual) { if ("parent" === id) { return (0,external_wp_i18n_namespaceObject.__)("Reset the styles to the theme defaults"); } if ("unsaved" === id) { return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: author display name */ (0,external_wp_i18n_namespaceObject.__)("Unsaved changes by %s"), authorDisplayName ); } return areStylesEqual ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: author display name. 2: revision creation date. (0,external_wp_i18n_namespaceObject.__)( "Changes saved by %1$s on %2$s. This revision matches current editor styles." ), authorDisplayName, formattedModifiedDate ) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: author display name. 2: revision creation date. (0,external_wp_i18n_namespaceObject.__)("Changes saved by %1$s on %2$s"), authorDisplayName, formattedModifiedDate ); } function RevisionsButtons({ userRevisions, selectedRevisionId, onChange, canApplyRevision, onApplyRevision }) { const { currentThemeName, currentUser } = (0,external_wp_data_.useSelect)((select) => { const { getCurrentTheme, getCurrentUser } = select(external_wp_coreData_namespaceObject.store); const currentTheme = getCurrentTheme(); return { currentThemeName: currentTheme?.name?.rendered || currentTheme?.stylesheet, currentUser: getCurrentUser() }; }, []); const dateNowInMs = (0,external_wp_date_namespaceObject.getDate)().getTime(); const { datetimeAbbreviated } = (0,external_wp_date_namespaceObject.getSettings)().formats; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite, { orientation: "vertical", className: "edit-site-global-styles-screen-revisions__revisions-list", "aria-label": (0,external_wp_i18n_namespaceObject.__)("Global styles revisions list"), role: "listbox", children: userRevisions.map((revision, index) => { const { id, author, modified } = revision; const isUnsaved = "unsaved" === id; const revisionAuthor = isUnsaved ? currentUser : author; const authorDisplayName = revisionAuthor?.name || (0,external_wp_i18n_namespaceObject.__)("User"); const authorAvatar = revisionAuthor?.avatar_urls?.["48"]; const isFirstItem = index === 0; const isSelected = selectedRevisionId ? selectedRevisionId === id : isFirstItem; const areStylesEqual = !canApplyRevision && isSelected; const isReset = "parent" === id; const modifiedDate = (0,external_wp_date_namespaceObject.getDate)(modified); const displayDate = modified && dateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS ? (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate) : (0,external_wp_date_namespaceObject.humanTimeDiff)(modified); const revisionLabel = getRevisionLabel( id, authorDisplayName, (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate), areStylesEqual ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Composite.Item, { className: "edit-site-global-styles-screen-revisions__revision-item", "aria-current": isSelected, role: "option", onKeyDown: (event) => { const { keyCode } = event; if (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) { onChange(revision); } }, onClick: (event) => { event.preventDefault(); onChange(revision); }, "aria-selected": isSelected, "aria-label": revisionLabel, render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), children: [ /* @__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: [ (0,external_wp_i18n_namespaceObject.__)("Default styles"), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-global-styles-screen-revisions__meta", children: currentThemeName }) ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "edit-site-global-styles-screen-revisions__description", children: [ 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)( "time", { className: "edit-site-global-styles-screen-revisions__date", dateTime: modified, children: displayDate } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "edit-site-global-styles-screen-revisions__meta", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "img", { alt: authorDisplayName, src: authorAvatar } ), authorDisplayName ] }), isSelected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ChangesSummary, { revision, previousRevision: index < userRevisions.length ? userRevisions[index + 1] : {} } ) ] }) }), isSelected && (areStylesEqual ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-global-styles-screen-revisions__applied-text", children: (0,external_wp_i18n_namespaceObject.__)( "These styles are already applied to your site." ) }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", variant: "primary", className: "edit-site-global-styles-screen-revisions__apply-button", onClick: onApplyRevision, "aria-label": (0,external_wp_i18n_namespaceObject.__)( "Apply the selected revision to your site." ), children: isReset ? (0,external_wp_i18n_namespaceObject.__)("Reset to defaults") : (0,external_wp_i18n_namespaceObject.__)("Apply") } )) ] }, id ); }) } ); } var revisions_buttons_default = RevisionsButtons; ;// ./node_modules/@wordpress/edit-site/build-module/components/pagination/index.js function Pagination({ currentPage, numPages, changePage, totalItems, className, disabled = false, buttonVariant = "tertiary", label = (0,external_wp_i18n_namespaceObject.__)("Pagination") }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, as: "nav", "aria-label": label, spacing: 3, justify: "flex-start", className: dist_clsx("edit-site-pagination", className), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", className: "edit-site-pagination__total", // translators: %s: Total number of patterns. children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Total number of patterns. (0,external_wp_i18n_namespaceObject._n)("%s item", "%s items", totalItems), totalItems ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: buttonVariant, onClick: () => changePage(1), accessibleWhenDisabled: true, disabled: disabled || currentPage === 1, label: (0,external_wp_i18n_namespaceObject.__)("First page"), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? next_default : previous_default, size: "compact" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: buttonVariant, onClick: () => changePage(currentPage - 1), accessibleWhenDisabled: true, disabled: disabled || currentPage === 1, label: (0,external_wp_i18n_namespaceObject.__)("Previous page"), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, size: "compact" } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Current page number. 2: Total number of pages. (0,external_wp_i18n_namespaceObject._x)("%1$s of %2$s", "paging"), currentPage, numPages ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: buttonVariant, onClick: () => changePage(currentPage + 1), accessibleWhenDisabled: true, disabled: disabled || currentPage === numPages, label: (0,external_wp_i18n_namespaceObject.__)("Next page"), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default, size: "compact" } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { variant: buttonVariant, onClick: () => changePage(numPages), accessibleWhenDisabled: true, disabled: disabled || currentPage === numPages, label: (0,external_wp_i18n_namespaceObject.__)("Last page"), icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? previous_default : next_default, size: "compact" } ) ] }) ] } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/index.js const { GlobalStylesContext: screen_revisions_GlobalStylesContext, areGlobalStyleConfigsEqual: screen_revisions_areGlobalStyleConfigsEqual } = unlock( external_wp_blockEditor_namespaceObject.privateApis ); const PAGE_SIZE = 10; function ScreenRevisions() { const { user: currentEditorGlobalStyles, setUserConfig } = (0,external_wp_element_.useContext)(screen_revisions_GlobalStylesContext); const { blocks, editorCanvasContainerView } = (0,external_wp_data_.useSelect)( (select) => ({ editorCanvasContainerView: unlock( select(store) ).getEditorCanvasContainerView(), blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks() }), [] ); const [currentPage, setCurrentPage] = (0,external_wp_element_.useState)(1); const [currentRevisions, setCurrentRevisions] = (0,external_wp_element_.useState)([]); const { revisions, isLoading, hasUnsavedChanges, revisionsCount } = useGlobalStylesRevisions({ query: { per_page: PAGE_SIZE, page: currentPage } }); const numPages = Math.ceil(revisionsCount / PAGE_SIZE); const [currentlySelectedRevision, setCurrentlySelectedRevision] = (0,external_wp_element_.useState)(currentEditorGlobalStyles); const [ isLoadingRevisionWithUnsavedChanges, setIsLoadingRevisionWithUnsavedChanges ] = (0,external_wp_element_.useState)(false); const { setEditorCanvasContainerView } = unlock( (0,external_wp_data_.useDispatch)(store) ); const selectedRevisionMatchesEditorStyles = screen_revisions_areGlobalStyleConfigsEqual( currentlySelectedRevision, currentEditorGlobalStyles ); const onCloseRevisions = () => { const canvasContainerView = editorCanvasContainerView === "global-styles-revisions:style-book" ? "style-book" : void 0; setEditorCanvasContainerView(canvasContainerView); }; const restoreRevision = (revision) => { setUserConfig(() => revision); setIsLoadingRevisionWithUnsavedChanges(false); onCloseRevisions(); }; (0,external_wp_element_.useEffect)(() => { if (!isLoading && revisions.length) { setCurrentRevisions(revisions); } }, [revisions, isLoading]); const firstRevision = revisions[0]; const currentlySelectedRevisionId = currentlySelectedRevision?.id; const shouldSelectFirstItem = !!firstRevision?.id && !selectedRevisionMatchesEditorStyles && !currentlySelectedRevisionId; (0,external_wp_element_.useEffect)(() => { if (shouldSelectFirstItem) { setCurrentlySelectedRevision(firstRevision); } }, [shouldSelectFirstItem, firstRevision]); const isLoadButtonEnabled = !!currentlySelectedRevisionId && currentlySelectedRevisionId !== "unsaved" && !selectedRevisionMatchesEditorStyles; const hasRevisions = !!currentRevisions.length; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( header_default, { title: revisionsCount && // translators: %s: number of revisions. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Revisions (%s)"), revisionsCount), description: (0,external_wp_i18n_namespaceObject.__)( `Click on previously saved styles to preview them. To restore a selected version to the editor, hit "Apply." When you're ready, use the Save button to save your changes.` ), onBack: onCloseRevisions } ), !hasRevisions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "edit-site-global-styles-screen-revisions__loading" }), hasRevisions && (editorCanvasContainerView === "global-styles-revisions:style-book" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( style_book_default, { userConfig: currentlySelectedRevision, isSelected: () => { }, onClose: () => { setEditorCanvasContainerView( "global-styles-revisions" ); } } ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( revisions_default, { blocks, userConfig: currentlySelectedRevision, closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close revisions") } )), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( revisions_buttons_default, { onChange: setCurrentlySelectedRevision, selectedRevisionId: currentlySelectedRevisionId, userRevisions: currentRevisions, canApplyRevision: isLoadButtonEnabled, onApplyRevision: () => hasUnsavedChanges ? setIsLoadingRevisionWithUnsavedChanges(true) : restoreRevision(currentlySelectedRevision) } ), numPages > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen-revisions__footer", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Pagination, { className: "edit-site-global-styles-screen-revisions__pagination", currentPage, numPages, changePage: setCurrentPage, totalItems: revisionsCount, disabled: isLoading, label: (0,external_wp_i18n_namespaceObject.__)("Global Styles pagination") } ) }), isLoadingRevisionWithUnsavedChanges && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: isLoadingRevisionWithUnsavedChanges, confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Apply"), onConfirm: () => restoreRevision(currentlySelectedRevision), onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false), size: "medium", children: (0,external_wp_i18n_namespaceObject.__)( "Are you sure you want to apply this revision? Any unsaved changes will be lost." ) } ) ] }); } var screen_revisions_default = ScreenRevisions; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/ui.js const SLOT_FILL_NAME = "GlobalStylesMenu"; const { useGlobalStylesReset: ui_useGlobalStylesReset } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { Slot: GlobalStylesMenuSlot, Fill: GlobalStylesMenuFill } = (0,external_wp_components_namespaceObject.createSlotFill)(SLOT_FILL_NAME); function GlobalStylesActionMenu() { const [canReset, onReset] = ui_useGlobalStylesReset(); const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); const { canEditCSS } = (0,external_wp_data_.useSelect)((select) => { const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); const globalStylesId = __experimentalGetCurrentGlobalStylesId(); const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0; return { canEditCSS: !!globalStyles?._links?.["wp:action-edit-css"] }; }, []); const { setEditorCanvasContainerView } = unlock( (0,external_wp_data_.useDispatch)(store) ); const loadCustomCSS = () => { setEditorCanvasContainerView("global-styles-css"); }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuFill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("More"), toggleProps: { size: "compact" }, children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: loadCustomCSS, children: (0,external_wp_i18n_namespaceObject.__)("Additional CSS") }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { toggle( "core/edit-site", "welcomeGuideStyles" ); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)("Welcome Guide") } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { onReset(); onClose(); }, disabled: !canReset, children: (0,external_wp_i18n_namespaceObject.__)("Reset styles") } ) }) ] }) } ) }); } function GlobalStylesNavigationScreen({ className, ...props }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Navigator.Screen, { className: [ "edit-site-global-styles-sidebar__navigator-screen", className ].filter(Boolean).join(" "), ...props } ); } function BlockStylesNavigationScreens({ parentMenu, blockStyles, blockName }) { return blockStyles.map((style, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GlobalStylesNavigationScreen, { path: parentMenu + "/variations/" + style.name, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_default, { name: blockName, variation: style.name }) }, index )); } function ContextScreens({ name, parentMenu = "" }) { const blockStyleVariations = (0,external_wp_data_.useSelect)( (select) => { const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store); return getBlockStyles(name); }, [name] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GlobalStylesNavigationScreen, { path: parentMenu + "/colors/palette", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_default, { name }) } ), !!blockStyleVariations?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BlockStylesNavigationScreens, { parentMenu, blockStyles: blockStyleVariations, blockName: name } ) ] }); } function GlobalStylesStyleBook() { const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); const { path } = navigator.location; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( style_book_default, { isSelected: (blockName) => ( // Match '/blocks/core%2Fbutton' and // '/blocks/core%2Fbutton/typography', but not // '/blocks/core%2Fbuttons'. path === `/blocks/${encodeURIComponent(blockName)}` || path.startsWith( `/blocks/${encodeURIComponent(blockName)}/` ) ), onSelect: (blockName) => { if (STYLE_BOOK_COLOR_GROUPS.find( (group) => group.slug === blockName )) { navigator.goTo("/colors/palette"); return; } if (blockName === "typography") { navigator.goTo("/typography"); return; } navigator.goTo("/blocks/" + encodeURIComponent(blockName)); } } ); } function GlobalStylesBlockLink() { const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); const { selectedBlockName, selectedBlockClientId } = (0,external_wp_data_.useSelect)( (select) => { const { getSelectedBlockClientId, getBlockName } = select(external_wp_blockEditor_namespaceObject.store); const clientId = getSelectedBlockClientId(); return { selectedBlockName: getBlockName(clientId), selectedBlockClientId: clientId }; }, [] ); const blockHasGlobalStyles = useBlockHasGlobalStyles(selectedBlockName); (0,external_wp_element_.useEffect)(() => { if (!selectedBlockClientId || !blockHasGlobalStyles) { return; } const currentPath = navigator.location.path; if (currentPath !== "/blocks" && !currentPath.startsWith("/blocks/")) { return; } const newPath = "/blocks/" + encodeURIComponent(selectedBlockName); if (newPath !== currentPath) { navigator.goTo(newPath, { skipFocus: true }); } }, [selectedBlockClientId, selectedBlockName, blockHasGlobalStyles]); } function GlobalStylesEditorCanvasContainerLink() { const { goTo, location } = (0,external_wp_components_namespaceObject.useNavigator)(); const editorCanvasContainerView = (0,external_wp_data_.useSelect)( (select) => unlock(select(store)).getEditorCanvasContainerView(), [] ); const path = location?.path; const isRevisionsOpen = path === "/revisions"; (0,external_wp_element_.useEffect)(() => { switch (editorCanvasContainerView) { case "global-styles-revisions": case "global-styles-revisions:style-book": if (!isRevisionsOpen) { goTo("/revisions"); } break; case "global-styles-css": goTo("/css"); break; // The stand-alone style book is open // and the revisions panel is open, // close the revisions panel. // Otherwise keep the style book open while // browsing global styles panel. // // Falling through as it matches the default scenario. case "style-book": default: if (isRevisionsOpen) { goTo("/", { isBack: true }); } break; } }, [editorCanvasContainerView, isRevisionsOpen, goTo]); } function useNavigatorSync(parentPath, onPathChange) { const navigator = (0,external_wp_components_namespaceObject.useNavigator)(); const { path: childPath } = navigator.location; const previousParentPath = (0,external_wp_compose_namespaceObject.usePrevious)(parentPath); const previousChildPath = (0,external_wp_compose_namespaceObject.usePrevious)(childPath); (0,external_wp_element_.useEffect)(() => { if (parentPath !== childPath) { if (parentPath !== previousParentPath) { navigator.goTo(parentPath); } else if (childPath !== previousChildPath) { onPathChange(childPath); } } }, [ onPathChange, parentPath, previousChildPath, previousParentPath, childPath, navigator ]); } function NavigationSync({ path: parentPath, onPathChange, children }) { useNavigatorSync(parentPath, onPathChange); return children; } function GlobalStylesUI({ path, onPathChange }) { const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)(); const editorCanvasContainerView = (0,external_wp_data_.useSelect)( (select) => unlock(select(store)).getEditorCanvasContainerView(), [] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Navigator, { className: "edit-site-global-styles-sidebar__navigator-provider", initialPath: "/", children: [ path && onPathChange && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationSync, { path, onPathChange }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_root_default, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/variations", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_style_variations_default, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/blocks", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_list_default, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_default, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/font-sizes", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_default, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/font-sizes/:origin/:slug", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size_default, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/text", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "text" }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/link", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "link" }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/heading", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "heading" }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/caption", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "caption" }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/button", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "button" }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/colors", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors_default, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/shadows", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadows, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/shadows/edit/:category/:slug", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadowsEdit, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/layout", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_layout_default, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/css", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css_default, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/revisions", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_revisions_default, {}) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/background", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_background_default, {}) }), blocks.map((block) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GlobalStylesNavigationScreen, { path: "/blocks/" + encodeURIComponent(block.name), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_default, { name: block.name }) }, "menu-block-" + block.name )), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, {}), blocks.map((block) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ContextScreens, { name: block.name, parentMenu: "/blocks/" + encodeURIComponent(block.name) }, "screens-block-" + block.name )), "style-book" === editorCanvasContainerView && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesStyleBook, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesActionMenu, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesBlockLink, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesEditorCanvasContainerLink, {}) ] } ); } var ui_default = GlobalStylesUI; ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/index.js ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/default-sidebar.js const { ComplementaryArea, ComplementaryAreaMoreMenuItem } = unlock(external_wp_editor_namespaceObject.privateApis); function DefaultSidebar({ className, identifier, title, icon, children, closeLabel, header, headerClassName, panelClassName, isActiveByDefault }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ComplementaryArea, { className, scope: "core", identifier, title, icon, closeLabel, header, headerClassName, panelClassName, isActiveByDefault, children } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ComplementaryAreaMoreMenuItem, { scope: "core", identifier, icon, children: title } ) ] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/index.js const { interfaceStore: global_styles_sidebar_interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis); const { useLocation: global_styles_sidebar_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function GlobalStylesSidebar() { const { query } = global_styles_sidebar_useLocation(); const { canvas = "view", name } = query; const { shouldClearCanvasContainerView, isStyleBookOpened, showListViewByDefault, hasRevisions, isRevisionsOpened, isRevisionsStyleBookOpened } = (0,external_wp_data_.useSelect)( (select) => { const { getActiveComplementaryArea: getActiveComplementaryArea2 } = select(global_styles_sidebar_interfaceStore); const { getEditorCanvasContainerView } = unlock( select(store) ); const canvasContainerView = getEditorCanvasContainerView(); const _isVisualEditorMode = "visual" === select(external_wp_editor_namespaceObject.store).getEditorMode(); const _isEditCanvasMode = "edit" === canvas; const _showListViewByDefault = select(external_wp_preferences_.store).get( "core", "showListViewByDefault" ); const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store); const globalStylesId = __experimentalGetCurrentGlobalStylesId(); const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0; return { isStyleBookOpened: "style-book" === canvasContainerView, shouldClearCanvasContainerView: "edit-site/global-styles" !== getActiveComplementaryArea2("core") || !_isVisualEditorMode || !_isEditCanvasMode, showListViewByDefault: _showListViewByDefault, hasRevisions: !!globalStyles?._links?.["version-history"]?.[0]?.count, isRevisionsStyleBookOpened: "global-styles-revisions:style-book" === canvasContainerView, isRevisionsOpened: "global-styles-revisions" === canvasContainerView }; }, [canvas] ); const { setEditorCanvasContainerView } = unlock( (0,external_wp_data_.useDispatch)(store) ); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); (0,external_wp_element_.useEffect)(() => { if (shouldClearCanvasContainerView) { setEditorCanvasContainerView(void 0); } }, [shouldClearCanvasContainerView, setEditorCanvasContainerView]); const { setIsListViewOpened } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store); const toggleRevisions = () => { setIsListViewOpened(false); if (isRevisionsStyleBookOpened) { setEditorCanvasContainerView("style-book"); return; } if (isRevisionsOpened) { setEditorCanvasContainerView(void 0); return; } if (isStyleBookOpened) { setEditorCanvasContainerView( "global-styles-revisions:style-book" ); } else { setEditorCanvasContainerView("global-styles-revisions"); } }; const toggleStyleBook = () => { if (isRevisionsOpened) { setEditorCanvasContainerView( "global-styles-revisions:style-book" ); return; } if (isRevisionsStyleBookOpened) { setEditorCanvasContainerView("global-styles-revisions"); return; } setIsListViewOpened(isStyleBookOpened && showListViewByDefault); setEditorCanvasContainerView( isStyleBookOpened ? void 0 : "style-book" ); }; const { getActiveComplementaryArea } = (0,external_wp_data_.useSelect)(global_styles_sidebar_interfaceStore); const { enableComplementaryArea } = (0,external_wp_data_.useDispatch)(global_styles_sidebar_interfaceStore); const previousActiveAreaRef = (0,external_wp_element_.useRef)(null); (0,external_wp_element_.useEffect)(() => { if (name === "styles" && canvas === "edit") { previousActiveAreaRef.current = getActiveComplementaryArea("core"); enableComplementaryArea("core", "edit-site/global-styles"); } else if (previousActiveAreaRef.current) { enableComplementaryArea("core", previousActiveAreaRef.current); } }, [name, enableComplementaryArea, canvas, getActiveComplementaryArea]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( DefaultSidebar, { className: "edit-site-global-styles-sidebar", identifier: "edit-site/global-styles", title: (0,external_wp_i18n_namespaceObject.__)("Styles"), icon: styles_default, closeLabel: (0,external_wp_i18n_namespaceObject.__)("Close Styles"), panelClassName: "edit-site-global-styles-sidebar__panel", header: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Flex, { className: "edit-site-global-styles-sidebar__header", gap: 1, children: [ /* @__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") }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Flex, { justify: "flex-end", gap: 1, className: "edit-site-global-styles-sidebar__header-actions", children: [ !isMobileViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { icon: seen_default, label: (0,external_wp_i18n_namespaceObject.__)("Style Book"), isPressed: isStyleBookOpened || isRevisionsStyleBookOpened, accessibleWhenDisabled: true, disabled: shouldClearCanvasContainerView, onClick: toggleStyleBook, size: "compact" } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { label: (0,external_wp_i18n_namespaceObject.__)("Revisions"), icon: backup_default, onClick: toggleRevisions, accessibleWhenDisabled: true, disabled: !hasRevisions, isPressed: isRevisionsOpened || isRevisionsStyleBookOpened, size: "compact" } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuSlot, {}) ] } ) ] } ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_default, {}) } ); } ;// ./node_modules/@wordpress/icons/build-module/library/download.js var download_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" }) }); ;// external ["wp","blob"] const external_wp_blob_namespaceObject = window["wp"]["blob"]; ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/site-export.js function SiteExport() { const canExport = (0,external_wp_data_.useSelect)((select) => { const targetHints = select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?._links?.["wp:export-theme"]?.[0]?.targetHints ?? {}; return !!targetHints.allow?.includes("GET"); }, []); const { createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); if (!canExport) { return null; } async function handleExport() { try { const response = await external_wp_apiFetch_default()({ path: "/wp-block-editor/v1/export", parse: false, headers: { Accept: "application/zip" } }); const blob = await response.blob(); const contentDisposition = response.headers.get( "content-disposition" ); const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/); const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : "edit-site-export"; (0,external_wp_blob_namespaceObject.downloadBlob)(fileName + ".zip", blob, "application/zip"); } catch (errorResponse) { let error = {}; try { error = await errorResponse.json(); } catch (e) { } const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while creating the site export."); createErrorNotice(errorMessage, { type: "snackbar" }); } } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { role: "menuitem", icon: download_default, onClick: handleExport, info: (0,external_wp_i18n_namespaceObject.__)( "Download your theme with updated templates and styles." ), children: (0,external_wp_i18n_namespaceObject._x)("Export", "site exporter menu item") } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/welcome-guide-menu-item.js function WelcomeGuideMenuItem() { const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store); 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") }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/index.js const { ToolsMoreMenuGroup, PreferencesModal } = unlock(external_wp_editor_namespaceObject.privateApis); function MoreMenu() { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(ToolsMoreMenuGroup, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteExport, {}), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideMenuItem, {}) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, {}) ] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-editor-iframe-props.js const { useLocation: use_editor_iframe_props_useLocation, useHistory: use_editor_iframe_props_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); function useEditorIframeProps() { const { query, path } = use_editor_iframe_props_useLocation(); const history = use_editor_iframe_props_useHistory(); const { canvas = "view" } = query; const currentPostIsTrashed = (0,external_wp_data_.useSelect)((select) => { return select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute("status") === "trash"; }, []); const [isFocused, setIsFocused] = (0,external_wp_element_.useState)(false); (0,external_wp_element_.useEffect)(() => { if (canvas === "edit") { setIsFocused(false); } }, [canvas]); const viewModeIframeProps = { "aria-label": (0,external_wp_i18n_namespaceObject.__)("Edit"), "aria-disabled": currentPostIsTrashed, title: null, role: "button", tabIndex: 0, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), onKeyDown: (event) => { const { keyCode } = event; if ((keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) && !currentPostIsTrashed) { event.preventDefault(); history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: "edit" }), { transition: "canvas-mode-edit-transition" }); } }, onClick: () => history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: "edit" }), { transition: "canvas-mode-edit-transition" }), onClickCapture: (event) => { if (currentPostIsTrashed) { event.preventDefault(); event.stopPropagation(); } }, readonly: true }; return { className: dist_clsx("edit-site-visual-editor__editor-canvas", { "is-focused": isFocused && canvas === "view" }), ...canvas === "view" ? viewModeIframeProps : {} }; } ;// ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js const { useLocation: use_title_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function useTitle(title) { const location = use_title_useLocation(); const siteTitle = (0,external_wp_data_.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "site")?.title, [] ); const isInitialLocationRef = (0,external_wp_element_.useRef)(true); (0,external_wp_element_.useEffect)(() => { isInitialLocationRef.current = false; }, [location]); (0,external_wp_element_.useEffect)(() => { if (isInitialLocationRef.current) { return; } if (title && siteTitle) { const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */ (0,external_wp_i18n_namespaceObject.__)("%1$s \u2039 %2$s \u2039 Editor \u2014 WordPress"), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) ); document.title = formattedTitle; (0,external_wp_a11y_namespaceObject.speak)(title, "assertive"); } }, [title, siteTitle, location]); } ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-editor-title.js const { getTemplateInfo } = unlock(external_wp_editor_namespaceObject.privateApis); function useEditorTitle(postType, postId) { const { title, isLoaded } = (0,external_wp_data_.useSelect)( (select) => { const { getEditedEntityRecord, getCurrentTheme, hasFinishedResolution } = select(external_wp_coreData_namespaceObject.store); if (!postId) { return { isLoaded: false }; } const _record = getEditedEntityRecord( "postType", postType, postId ); const { default_template_types: templateTypes = [] } = getCurrentTheme() ?? {}; const templateInfo = getTemplateInfo({ template: _record, templateTypes }); const _isLoaded = hasFinishedResolution("getEditedEntityRecord", [ "postType", postType, postId ]); return { title: templateInfo.title, isLoaded: _isLoaded }; }, [postType, postId] ); let editorTitle; if (isLoaded) { editorTitle = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part). (0,external_wp_i18n_namespaceObject._x)("%1$s \u2039 %2$s", "breadcrumb trail"), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), POST_TYPE_LABELS[postType] ?? POST_TYPE_LABELS[TEMPLATE_POST_TYPE] ); } useTitle(isLoaded && editorTitle); } var use_editor_title_default = useEditorTitle; ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-adapt-editor-to-canvas.js function useAdaptEditorToCanvas(canvas) { const { clearSelectedBlock } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { setDeviceType, closePublishSidebar, setIsListViewOpened, setIsInserterOpened } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store); const { get: getPreference } = (0,external_wp_data_.useSelect)(external_wp_preferences_.store); const registry = (0,external_wp_data_.useRegistry)(); (0,external_wp_element_.useLayoutEffect)(() => { const isMediumOrBigger = window.matchMedia("(min-width: 782px)").matches; registry.batch(() => { clearSelectedBlock(); setDeviceType("Desktop"); closePublishSidebar(); setIsInserterOpened(false); if (isMediumOrBigger && canvas === "edit" && getPreference("core", "showListViewByDefault") && !getPreference("core", "distractionFree")) { setIsListViewOpened(true); } else { setIsListViewOpened(false); } }); }, [ canvas, registry, clearSelectedBlock, setDeviceType, closePublishSidebar, setIsInserterOpened, setIsListViewOpened, getPreference ]); } ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-resolve-edited-entity.js const { useLocation: use_resolve_edited_entity_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const postTypesWithoutParentTemplate = [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user ]; const authorizedPostTypes = ["page", "post"]; function useResolveEditedEntity() { const { name, params = {}, query } = use_resolve_edited_entity_useLocation(); const { postId = query?.postId } = params; let postType; if (name === "navigation-item") { postType = NAVIGATION_POST_TYPE; } else if (name === "pattern-item") { postType = PATTERN_TYPES.user; } else if (name === "template-part-item") { postType = TEMPLATE_PART_POST_TYPE; } else if (name === "template-item" || name === "templates") { postType = TEMPLATE_POST_TYPE; } else if (name === "page-item" || name === "pages") { postType = "page"; } else if (name === "post-item" || name === "posts") { postType = "post"; } const homePage = (0,external_wp_data_.useSelect)((select) => { const { getHomePage } = unlock(select(external_wp_coreData_namespaceObject.store)); return getHomePage(); }, []); const resolvedTemplateId = (0,external_wp_data_.useSelect)( (select) => { if (postTypesWithoutParentTemplate.includes(postType) && postId) { return; } if (postId && postId.includes(",")) { return; } const { getTemplateId } = unlock(select(external_wp_coreData_namespaceObject.store)); if (postType && postId && authorizedPostTypes.includes(postType)) { return getTemplateId(postType, postId); } if (homePage?.postType === "page") { return getTemplateId("page", homePage?.postId); } if (homePage?.postType === "wp_template") { return homePage?.postId; } }, [homePage, postId, postType] ); const context = (0,external_wp_element_.useMemo)(() => { if (postTypesWithoutParentTemplate.includes(postType) && postId) { return {}; } if (postType && postId && authorizedPostTypes.includes(postType)) { return { postType, postId }; } if (homePage?.postType === "page") { return { postType: "page", postId: homePage?.postId }; } return {}; }, [homePage, postType, postId]); if (postTypesWithoutParentTemplate.includes(postType) && postId) { return { isReady: true, postType, postId, context }; } if (!!homePage) { return { isReady: resolvedTemplateId !== void 0, postType: TEMPLATE_POST_TYPE, postId: resolvedTemplateId, context }; } return { isReady: false }; } function useSyncDeprecatedEntityIntoState({ postType, postId, context, isReady }) { const { setEditedEntity } = (0,external_wp_data_.useDispatch)(store); (0,external_wp_element_.useEffect)(() => { if (isReady) { setEditedEntity(postType, postId, context); } }, [isReady, postType, postId, context, setEditedEntity]); } ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/site-preview.js function SitePreview() { const siteUrl = (0,external_wp_data_.useSelect)((select) => { const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteData = getEntityRecord("root", "__unstableBase"); return siteData?.home; }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "iframe", { src: (0,external_wp_url_namespaceObject.addQueryArgs)(siteUrl, { // Parameter for hiding the admin bar. wp_site_preview: 1 }), title: (0,external_wp_i18n_namespaceObject.__)("Site Preview"), style: { display: "block", width: "100%", height: "100%", backgroundColor: "#fff" }, onLoad: (event) => { const document = event.target.contentDocument; const focusableElements = external_wp_dom_namespaceObject.focus.focusable.find(document); focusableElements.forEach((element) => { element.style.pointerEvents = "none"; element.tabIndex = -1; element.setAttribute("aria-hidden", "true"); }); } } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js const { Editor, BackButton } = unlock(external_wp_editor_namespaceObject.privateApis); const { useHistory: editor_useHistory, useLocation: editor_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const { BlockKeyboardShortcuts } = unlock(external_wp_blockLibrary_namespaceObject.privateApis); const toggleHomeIconVariants = { edit: { opacity: 0, scale: 0.2 }, hover: { opacity: 1, scale: 1, clipPath: "inset( 22% round 2px )" } }; const siteIconVariants = { edit: { clipPath: "inset(0% round 0px)" }, hover: { clipPath: "inset( 22% round 2px )" }, tap: { clipPath: "inset(0% round 0px)" } }; function getListPathForPostType(postType) { switch (postType) { case "navigation": return "/navigation"; case "wp_block": return "/pattern?postType=wp_block"; case "wp_template_part": return "/pattern?postType=wp_template_part"; case "wp_template": return "/template"; case "page": return "/page"; case "post": return "/"; } throw "Unknown post type"; } function getNavigationPath(location, postType) { const { path, name } = location; if ([ "pattern-item", "template-part-item", "page-item", "template-item", "post-item" ].includes(name)) { return getListPathForPostType(postType); } return (0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: void 0 }); } function EditSiteEditor({ isHomeRoute = false, isPostsList = false }) { const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const location = editor_useLocation(); const { canvas = "view" } = location.query; const isLoading = useIsSiteEditorLoading(); useAdaptEditorToCanvas(canvas); const entity = useResolveEditedEntity(); useSyncDeprecatedEntityIntoState(entity); const { postType, postId, context } = entity; const { isBlockBasedTheme, editorCanvasView, currentPostIsTrashed, hasSiteIcon } = (0,external_wp_data_.useSelect)((select) => { const { getEditorCanvasContainerView } = unlock( select(store) ); const { getCurrentTheme, getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const siteData = getEntityRecord("root", "__unstableBase", void 0); return { isBlockBasedTheme: getCurrentTheme()?.is_block_theme, editorCanvasView: getEditorCanvasContainerView(), currentPostIsTrashed: select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute("status") === "trash", hasSiteIcon: !!siteData?.site_icon_url }; }, []); const postWithTemplate = !!context?.postId; use_editor_title_default( postWithTemplate ? context.postType : postType, postWithTemplate ? context.postId : postId ); const _isPreviewingTheme = isPreviewingTheme(); const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer(); const iframeProps = useEditorIframeProps(); const isEditMode = canvas === "edit"; const loadingProgressId = (0,external_wp_compose_namespaceObject.useInstanceId)( CanvasLoader, "edit-site-editor__loading-progress" ); const settings = useSpecificEditorSettings(); const styles = (0,external_wp_element_.useMemo)( () => [ ...settings.styles, { // Forming a "block formatting context" to prevent margin collapsing. // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context css: canvas === "view" ? `body{min-height: 100vh; ${currentPostIsTrashed ? "" : "cursor: pointer;"}}` : void 0 } ], [settings.styles, canvas, currentPostIsTrashed] ); const { resetZoomLevel } = unlock((0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store)); const { createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); const history = editor_useHistory(); const onActionPerformed = (0,external_wp_element_.useCallback)( (actionId, items) => { switch (actionId) { case "move-to-trash": case "delete-post": { history.navigate( getListPathForPostType( postWithTemplate ? context.postType : postType ) ); } break; case "duplicate-post": { const newItem = items[0]; const _title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered; createSuccessNotice( (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Title of the created post or template, e.g: "Hello world". (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(_title) || (0,external_wp_i18n_namespaceObject.__)("(no title)") ), { type: "snackbar", id: "duplicate-post-action", actions: [ { label: (0,external_wp_i18n_namespaceObject.__)("Edit"), onClick: () => { history.navigate( `/${newItem.type}/${newItem.id}?canvas=edit` ); } } ] } ); } break; } }, [ postType, context?.postType, postWithTemplate, history, createSuccessNotice ] ); const title = getEditorCanvasContainerTitle(editorCanvasView); const isReady = !isLoading; const transition = { duration: disableMotion ? 0 : 0.2 }; return !isBlockBasedTheme && isHomeRoute ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SitePreview, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GlobalStylesRenderer, { disableRootPadding: postType !== TEMPLATE_POST_TYPE } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, {}), isEditMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockKeyboardShortcuts, {}), !isReady ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CanvasLoader, { id: loadingProgressId }) : null, isEditMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( WelcomeGuide, { postType: postWithTemplate ? context.postType : postType } ), isReady && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( Editor, { postType: postWithTemplate ? context.postType : postType, postId: postWithTemplate ? context.postId : postId, templateId: postWithTemplate ? postId : void 0, settings, className: "edit-site-editor__editor-interface", styles, customSaveButton: _isPreviewingTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, { size: "compact" }), customSavePanel: _isPreviewingTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {}), forceDisableBlockTools: !hasDefaultEditorCanvasView, title, iframeProps, onActionPerformed, extraSidebarPanels: !postWithTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_template_setting_panel_default.Slot, {}), children: [ isEditMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BackButton, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__unstableMotion.div, { className: "edit-site-editor__view-mode-toggle", transition, animate: "edit", initial: "edit", whileHover: "hover", whileTap: "tap", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)("Open Navigation"), showTooltip: true, tooltipPosition: "middle right", onClick: () => { resetZoomLevel(); if (isPostsList && location.query?.focusMode) { history.navigate("/", { transition: "canvas-mode-view-transition" }); } else { history.navigate( getNavigationPath( location, postWithTemplate ? context.postType : postType ), { transition: "canvas-mode-view-transition" } ); } }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { variants: siteIconVariants, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon_default, { className: "edit-site-editor__view-mode-toggle-icon" }) } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__unstableMotion.div, { className: dist_clsx( "edit-site-editor__back-icon", { "has-site-icon": hasSiteIcon } ), variants: toggleHomeIconVariants, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: arrow_up_left_default }) } ) ] } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {}), isBlockBasedTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesSidebar, {}) ] } ) ] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/utils.js function isClassicThemeWithStyleBookSupport(siteData) { const isBlockTheme = siteData.currentTheme?.is_block_theme; const supportsEditorStyles = siteData.currentTheme?.theme_supports["editor-styles"]; const hasThemeJson = siteData.editorSettings?.supportsLayout; return !isBlockTheme && (supportsEditorStyles || hasThemeJson); } ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/home.js const homeRoute = { name: "home", path: "/", areas: { sidebar({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, preview({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isHomeRoute: true }) : void 0; }, mobile({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); } } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/styles.js const { useLocation: styles_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function MobileGlobalStylesUI() { const { query = {} } = styles_useLocation(); const { canvas } = query; if (canvas === "edit") { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesUIWrapper, {}); } const stylesRoute = { name: "styles", path: "/styles", areas: { content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesUIWrapper, {}), sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStyles, { backPath: "/" }), preview({ query }) { const isStylebook = query.preview === "stylebook"; return isStylebook ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}); }, mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileGlobalStylesUI, {}) }, widths: { content: 380 } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js const PRELOADED_NAVIGATION_MENUS_QUERY = { per_page: 100, status: ["publish", "draft"], order: "desc", orderby: "date" }; ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js const notEmptyString = (testString) => testString?.trim()?.length > 0; function RenameModal({ menuTitle, onClose, onSave }) { const [editedMenuTitle, setEditedMenuTitle] = (0,external_wp_element_.useState)(menuTitle); const titleHasChanged = editedMenuTitle !== menuTitle; const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)("Rename"), onRequestClose: onClose, focusOnMount: "firstContentElement", size: "small", 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: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, value: editedMenuTitle, placeholder: (0,external_wp_i18n_namespaceObject.__)("Navigation title"), onChange: setEditedMenuTitle, label: (0,external_wp_i18n_namespaceObject.__)("Name") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", onClick: onClose, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, accessibleWhenDisabled: true, disabled: !isEditedMenuTitleValid, variant: "primary", type: "submit", onClick: (e) => { e.preventDefault(); if (!isEditedMenuTitleValid) { return; } onSave({ title: editedMenuTitle }); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)("Save") } ) ] }) ] }) }) } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js function DeleteConfirmDialog({ onClose, onConfirm }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: true, onConfirm: () => { onConfirm(); onClose(); }, onCancel: onClose, confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"), size: "medium", children: (0,external_wp_i18n_namespaceObject.__)("Are you sure you want to delete this Navigation Menu?") } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js const { useHistory: more_menu_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); const POPOVER_PROPS = { position: "bottom right" }; function ScreenNavigationMoreMenu(props) { const { onDelete, onSave, onDuplicate, menuTitle, menuId } = props; const [renameModalOpen, setRenameModalOpen] = (0,external_wp_element_.useState)(false); const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = (0,external_wp_element_.useState)(false); const history = more_menu_useHistory(); const closeModals = () => { setRenameModalOpen(false); setDeleteConfirmDialogOpen(false); }; const openRenameModal = () => setRenameModalOpen(true); const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { className: "sidebar-navigation__more-menu", label: (0,external_wp_i18n_namespaceObject.__)("Actions"), icon: more_vertical_default, popoverProps: POPOVER_PROPS, children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { openRenameModal(); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)("Rename") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { history.navigate( `/wp_navigation/${menuId}?canvas=edit` ); }, children: (0,external_wp_i18n_namespaceObject.__)("Edit") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { onDuplicate(); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)("Duplicate") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { isDestructive: true, onClick: () => { openDeleteConfirmDialog(); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)("Delete") } ) ] }) } ), deleteConfirmDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( DeleteConfirmDialog, { onClose: closeModals, onConfirm: onDelete } ), renameModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( RenameModal, { onClose: closeModals, menuTitle, onSave } ) ] }); } ;// ./node_modules/@wordpress/icons/build-module/library/chevron-up.js var chevron_up_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/chevron-down.js var chevron_down_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js const leaf_more_menu_POPOVER_PROPS = { className: "block-editor-block-settings-menu__popover", placement: "bottom-start" }; const { useHistory: leaf_more_menu_useHistory, useLocation: leaf_more_menu_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function LeafMoreMenu(props) { const history = leaf_more_menu_useHistory(); const { path } = leaf_more_menu_useLocation(); const { block } = props; const { clientId } = block; const { moveBlocksDown, moveBlocksUp, removeBlocks } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store); const removeLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ (0,external_wp_i18n_namespaceObject.__)("Remove %s"), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ clientId, maximumLength: 25 }) ); const goToLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ (0,external_wp_i18n_namespaceObject.__)("Go to %s"), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ clientId, maximumLength: 25 }) ); const rootClientId = (0,external_wp_data_.useSelect)( (select) => { const { getBlockRootClientId } = select(external_wp_blockEditor_namespaceObject.store); return getBlockRootClientId(clientId); }, [clientId] ); const onGoToPage = (0,external_wp_element_.useCallback)( (selectedBlock) => { const { attributes, name } = selectedBlock; if (attributes.kind === "post-type" && attributes.id && attributes.type && history) { history.navigate( `/${attributes.type}/${attributes.id}?canvas=edit`, { state: { backPath: path } } ); } if (name === "core/page-list-item" && attributes.id && history) { history.navigate(`/page/${attributes.id}?canvas=edit`, { state: { backPath: path } }); } }, [path, history] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("Options"), className: "block-editor-block-settings-menu", popoverProps: leaf_more_menu_POPOVER_PROPS, noIcons: true, ...props, children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: chevron_up_default, onClick: () => { moveBlocksUp([clientId], rootClientId); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)("Move up") } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { icon: chevron_down_default, onClick: () => { moveBlocksDown([clientId], rootClientId); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)("Move down") } ), block.attributes?.type === "page" && block.attributes?.id && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { onGoToPage(block); onClose(); }, children: goToLabel } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.MenuItem, { onClick: () => { removeBlocks([clientId], false); onClose(); }, children: removeLabel } ) }) ] }) } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js const { PrivateListView } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const MAX_PAGE_COUNT = 100; const PAGES_QUERY = [ "postType", "page", { per_page: MAX_PAGE_COUNT, _fields: ["id", "link", "menu_order", "parent", "title", "type"], // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent // sort. orderby: "menu_order", order: "asc" } ]; function NavigationMenuContent({ rootClientId }) { const { listViewRootClientId, isLoading } = (0,external_wp_data_.useSelect)( (select) => { const { areInnerBlocksControlled, getBlockName, getBlockCount, getBlockOrder } = select(external_wp_blockEditor_namespaceObject.store); const { isResolving } = select(external_wp_coreData_namespaceObject.store); const blockClientIds = getBlockOrder(rootClientId); const hasOnlyPageListBlock = blockClientIds.length === 1 && getBlockName(blockClientIds[0]) === "core/page-list"; const pageListHasBlocks = hasOnlyPageListBlock && getBlockCount(blockClientIds[0]) > 0; const isLoadingPages = isResolving( "getEntityRecords", PAGES_QUERY ); return { listViewRootClientId: pageListHasBlocks ? blockClientIds[0] : rootClientId, // This is a small hack to wait for the navigation block // to actually load its inner blocks. isLoading: !areInnerBlocksControlled(rootClientId) || isLoadingPages }; }, [rootClientId] ); const { replaceBlock, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store); const offCanvasOnselect = (0,external_wp_element_.useCallback)( (block) => { if (block.name === "core/navigation-link" && !block.attributes.url) { __unstableMarkNextChangeAsNotPersistent(); replaceBlock( block.clientId, (0,external_wp_blocks_namespaceObject.createBlock)("core/navigation-link", block.attributes) ); } }, [__unstableMarkNextChangeAsNotPersistent, replaceBlock] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ !isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrivateListView, { rootClientId: listViewRootClientId, onSelect: offCanvasOnselect, blockSettingsMenu: LeafMoreMenu, showAppender: false, isExpanded: true } ), /* @__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, {}) }) ] }); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js const navigation_menu_editor_noop = () => { }; function NavigationMenuEditor({ navigationMenuId }) { const { storedSettings } = (0,external_wp_data_.useSelect)((select) => { const { getSettings } = unlock(select(store)); return { storedSettings: getSettings() }; }, []); const blocks = (0,external_wp_element_.useMemo)(() => { if (!navigationMenuId) { return []; } return [(0,external_wp_blocks_namespaceObject.createBlock)("core/navigation", { ref: navigationMenuId })]; }, [navigationMenuId]); if (!navigationMenuId || !blocks?.length) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_blockEditor_namespaceObject.BlockEditorProvider, { settings: storedSettings, value: blocks, onChange: navigation_menu_editor_noop, onInput: navigation_menu_editor_noop, 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 }) }) } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js function buildNavigationLabel(title, id, status) { if (!title?.rendered) { return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("(no title %s)"), id); } if (status === "publish") { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered); } return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "menu label"), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered), status ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js function SingleNavigationMenu({ navigationMenu, backPath, handleDelete, handleDuplicate, handleSave }) { const menuTitle = navigationMenu?.title?.rendered; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationScreenWrapper, { actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ScreenNavigationMoreMenu, { menuId: navigationMenu?.id, menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle), onDelete: handleDelete, onSave: handleSave, onDuplicate: handleDuplicate } ) }), backPath, title: buildNavigationLabel( navigationMenu?.title, navigationMenu?.id, navigationMenu?.status ), description: (0,external_wp_i18n_namespaceObject.__)( "Navigation Menus are a curated collection of blocks that allow visitors to get around your site." ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuEditor, { navigationMenuId: navigationMenu?.id }) } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/index.js const { useLocation: sidebar_navigation_screen_navigation_menu_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); const postType = `wp_navigation`; function SidebarNavigationScreenNavigationMenu({ backPath }) { const { params: { postId } } = sidebar_navigation_screen_navigation_menu_useLocation(); const { record: navigationMenu, isResolving } = (0,external_wp_coreData_namespaceObject.useEntityRecord)( "postType", postType, postId ); const { isSaving, isDeleting } = (0,external_wp_data_.useSelect)( (select) => { const { isSavingEntityRecord, isDeletingEntityRecord } = select(external_wp_coreData_namespaceObject.store); return { isSaving: isSavingEntityRecord("postType", postType, postId), isDeleting: isDeletingEntityRecord( "postType", postType, postId ) }; }, [postId] ); const isLoading = isResolving || isSaving || isDeleting; const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; const { handleSave, handleDelete, handleDuplicate } = useNavigationMenuHandlers(); const _handleDelete = () => handleDelete(navigationMenu); const _handleSave = (edits) => handleSave(navigationMenu, edits); const _handleDuplicate = () => handleDuplicate(navigationMenu); if (isLoading) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationScreenWrapper, { description: (0,external_wp_i18n_namespaceObject.__)( "Navigation Menus are a curated collection of blocks that allow visitors to get around your site." ), backPath, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" }) } ); } if (!isLoading && !navigationMenu) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationScreenWrapper, { description: (0,external_wp_i18n_namespaceObject.__)("Navigation Menu missing."), backPath } ); } if (!navigationMenu?.content?.raw) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationScreenWrapper, { actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ScreenNavigationMoreMenu, { menuId: navigationMenu?.id, menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle), onDelete: _handleDelete, onSave: _handleSave, onDuplicate: _handleDuplicate } ), backPath, title: buildNavigationLabel( navigationMenu?.title, navigationMenu?.id, navigationMenu?.status ), description: (0,external_wp_i18n_namespaceObject.__)("This Navigation Menu is empty.") } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SingleNavigationMenu, { navigationMenu, backPath, handleDelete: _handleDelete, handleSave: _handleSave, handleDuplicate: _handleDuplicate } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js const { useHistory: use_navigation_menu_handlers_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); function useDeleteNavigationMenu() { const { deleteEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); const history = use_navigation_menu_handlers_useHistory(); const handleDelete = async (navigationMenu) => { const postId = navigationMenu?.id; try { await deleteEntityRecord( "postType", postType, postId, { force: true }, { throwOnError: true } ); createSuccessNotice( (0,external_wp_i18n_namespaceObject.__)("Navigation Menu successfully deleted."), { type: "snackbar" } ); history.navigate("/navigation"); } catch (error) { createErrorNotice( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be deleted. */ (0,external_wp_i18n_namespaceObject.__)(`Unable to delete Navigation Menu (%s).`), error?.message ), { type: "snackbar" } ); } }; return handleDelete; } function useSaveNavigationMenu() { const { getEditedEntityRecord } = (0,external_wp_data_.useSelect)((select) => { const { getEditedEntityRecord: getEditedEntityRecordSelector } = select(external_wp_coreData_namespaceObject.store); return { getEditedEntityRecord: getEditedEntityRecordSelector }; }, []); const { editEntityRecord, __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); const handleSave = async (navigationMenu, edits) => { if (!edits) { return; } const postId = navigationMenu?.id; const originalRecord = getEditedEntityRecord( "postType", NAVIGATION_POST_TYPE, postId ); editEntityRecord("postType", postType, postId, edits); const recordPropertiesToSave = Object.keys(edits); try { await saveSpecifiedEntityEdits( "postType", postType, postId, recordPropertiesToSave, { throwOnError: true } ); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Renamed Navigation Menu"), { type: "snackbar" }); } catch (error) { editEntityRecord("postType", postType, postId, originalRecord); createErrorNotice( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be renamed. */ (0,external_wp_i18n_namespaceObject.__)(`Unable to rename Navigation Menu (%s).`), error?.message ), { type: "snackbar" } ); } }; return handleSave; } function useDuplicateNavigationMenu() { const history = use_navigation_menu_handlers_useHistory(); const { saveEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store); const handleDuplicate = async (navigationMenu) => { const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; try { const savedRecord = await saveEntityRecord( "postType", postType, { title: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Navigation menu title */ (0,external_wp_i18n_namespaceObject._x)("%s (Copy)", "navigation menu"), menuTitle ), content: navigationMenu?.content?.raw, status: "publish" }, { throwOnError: true } ); if (savedRecord) { createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Duplicated Navigation Menu"), { type: "snackbar" }); history.navigate(`/wp_navigation/${savedRecord.id}`); } } catch (error) { createErrorNotice( (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: error message describing why the navigation menu could not be deleted. */ (0,external_wp_i18n_namespaceObject.__)(`Unable to duplicate Navigation Menu (%s).`), error?.message ), { type: "snackbar" } ); } }; return handleDuplicate; } function useNavigationMenuHandlers() { return { handleDelete: useDeleteNavigationMenu(), handleSave: useSaveNavigationMenu(), handleDuplicate: useDuplicateNavigationMenu() }; } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.js function buildMenuLabel(title, id, status) { if (!title) { return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("(no title %s)"), id); } if (status === "publish") { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title); } return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "menu label"), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), status ); } function SidebarNavigationScreenNavigationMenus({ backPath }) { const { records: navigationMenus, isResolving: isResolvingNavigationMenus, hasResolved: hasResolvedNavigationMenus } = (0,external_wp_coreData_namespaceObject.useEntityRecords)( "postType", NAVIGATION_POST_TYPE, PRELOADED_NAVIGATION_MENUS_QUERY ); const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus; const { getNavigationFallbackId } = unlock((0,external_wp_data_.useSelect)(external_wp_coreData_namespaceObject.store)); const isCreatingNavigationFallback = (0,external_wp_data_.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).isResolving("getNavigationFallbackId"), [] ); const firstNavigationMenu = navigationMenus?.[0]; if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && // Ensure a fallback navigation is created only once !isCreatingNavigationFallback) { getNavigationFallbackId(); } const { handleSave, handleDelete, handleDuplicate } = useNavigationMenuHandlers(); const hasNavigationMenus = !!navigationMenus?.length; if (isLoading) { 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" }) }); } if (!isLoading && !hasNavigationMenus) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationScreenWrapper, { description: (0,external_wp_i18n_namespaceObject.__)("No Navigation Menus found."), backPath } ); } if (navigationMenus?.length === 1) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SingleNavigationMenu, { navigationMenu: firstNavigationMenu, backPath, handleDelete: () => handleDelete(firstNavigationMenu), handleDuplicate: () => handleDuplicate(firstNavigationMenu), handleSave: (edits) => handleSave(firstNavigationMenu, edits) } ); } 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)( NavMenuItem, { postId: id, withChevron: true, icon: navigation_default, children: buildMenuLabel(title?.rendered, index + 1, status) }, id )) }) }); } function SidebarNavigationScreenWrapper({ children, actions, title, description, backPath }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationScreen, { title: title || (0,external_wp_i18n_namespaceObject.__)("Navigation"), actions, description: description || (0,external_wp_i18n_namespaceObject.__)("Manage your Navigation Menus."), backPath, content: children } ); } const NavMenuItem = ({ postId, ...props }) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationItem, { to: `/wp_navigation/${postId}`, ...props } ); }; ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/navigation.js const { useLocation: navigation_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function MobileNavigationView() { const { query = {} } = navigation_useLocation(); const { canvas = "view" } = query; return canvas === "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { backPath: "/" }); } const navigationRoute = { name: "navigation", path: "/navigation", areas: { sidebar({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { backPath: "/" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, preview({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : void 0; }, mobile({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileNavigationView, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); } } }; ;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/navigation-item.js const { useLocation: navigation_item_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function MobileNavigationItemView() { const { query = {} } = navigation_item_useLocation(); const { canvas = "view" } = query; return canvas === "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { backPath: "/navigation" }); } const navigationItemRoute = { name: "navigation-item", path: "/wp_navigation/:postId", areas: { sidebar({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { backPath: "/navigation" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, preview({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); }, mobile({ siteData }) { const isBlockTheme = siteData.currentTheme?.is_block_theme; return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileNavigationItemView, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {}); } } }; ;// ./node_modules/@wordpress/icons/build-module/library/file.js var file_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.js function CategoryItem({ count, icon, id, isActive, label, type }) { if (!count) { return; } const queryArgs = [`postType=${type}`]; if (id) { queryArgs.push(`categoryId=${id}`); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationItem, { icon, suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: count }), "aria-current": isActive ? "true" : void 0, to: `/pattern?${queryArgs.join("&")}`, children: label } ); } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js function useDefaultPatternCategories() { const blockPatternCategories = (0,external_wp_data_.useSelect)((select) => { const { getSettings } = unlock(select(store)); const settings = getSettings(); return settings.__experimentalAdditionalBlockPatternCategories ?? settings.__experimentalBlockPatternCategories; }); const restBlockPatternCategories = (0,external_wp_data_.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories() ); return [ ...blockPatternCategories || [], ...restBlockPatternCategories || [] ]; } ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/utils.js const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex((item) => currentItem.name === item.name); ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js function useThemePatterns() { const blockPatterns = (0,external_wp_data_.useSelect)((select) => { const { getSettings } = unlock(select(store)); return getSettings().__experimentalAdditionalBlockPatterns ?? getSettings().__experimentalBlockPatterns; }); const restBlockPatterns = (0,external_wp_data_.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getBlockPatterns() ); const patterns = (0,external_wp_element_.useMemo)( () => [...blockPatterns || [], ...restBlockPatterns || []].filter( (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source) ).filter(filterOutDuplicatesByName).filter((pattern) => pattern.inserter !== false), [blockPatterns, restBlockPatterns] ); return patterns; } ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/search-items.js const { extractWords, getNormalizedSearchTerms, normalizeString } = unlock( external_wp_blockEditor_namespaceObject.privateApis ); const defaultGetName = (item) => { if (item.type === PATTERN_TYPES.user) { return item.slug; } if (item.type === TEMPLATE_PART_POST_TYPE) { return ""; } return item.name || ""; }; const defaultGetTitle = (item) => { if (typeof item.title === "string") { return item.title; } if (item.title && item.title.rendered) { return item.title.rendered; } if (item.title && item.title.raw) { return item.title.raw; } return ""; }; const defaultGetDescription = (item) => { if (item.type === PATTERN_TYPES.user) { return item.excerpt.raw; } return item.description || ""; }; const defaultGetKeywords = (item) => item.keywords || []; const defaultHasCategory = () => false; const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { return unmatchedTerms.filter( (term) => !getNormalizedSearchTerms(unprocessedTerms).some( (unprocessedTerm) => unprocessedTerm.includes(term) ) ); }; const searchItems = (items = [], searchInput = "", config = {}) => { const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); const onlyFilterByCategory = config.categoryId !== PATTERN_DEFAULT_CATEGORY && !normalizedSearchTerms.length; const searchRankConfig = { ...config, onlyFilterByCategory }; const threshold = onlyFilterByCategory ? 0 : 1; const rankedItems = items.map((item) => { return [ item, getItemSearchRank(item, searchInput, searchRankConfig) ]; }).filter(([, rank]) => rank > threshold); if (normalizedSearchTerms.length === 0) { return rankedItems.map(([item]) => item); } rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1); return rankedItems.map(([item]) => item); }; function getItemSearchRank(item, searchTerm, config) { const { categoryId, getName = defaultGetName, getTitle = defaultGetTitle, getDescription = defaultGetDescription, getKeywords = defaultGetKeywords, hasCategory = defaultHasCategory, onlyFilterByCategory } = config; 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; if (!rank || onlyFilterByCategory) { return rank; } const name = getName(item); const title = getTitle(item); const description = getDescription(item); const keywords = getKeywords(item); const normalizedSearchInput = normalizeString(searchTerm); const normalizedTitle = normalizeString(title); if (normalizedSearchInput === normalizedTitle) { rank += 30; } else if (normalizedTitle.startsWith(normalizedSearchInput)) { rank += 20; } else { const terms = [name, title, description, ...keywords].join(" "); const normalizedSearchTerms = extractWords(normalizedSearchInput); const unmatchedTerms = removeMatchingTerms( normalizedSearchTerms, terms ); if (unmatchedTerms.length === 0) { rank += 10; } } return rank; } ;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-patterns.js const EMPTY_PATTERN_LIST = []; const selectTemplateParts = (0,external_wp_data_.createSelector)( (select, categoryId, search = "") => { const { getEntityRecords, getCurrentTheme, isResolving: isResolvingSelector } = select(external_wp_coreData_namespaceObject.store); const query = { per_page: -1 }; const templateParts = getEntityRecords("postType", TEMPLATE_PART_POST_TYPE, query) ?? EMPTY_PATTERN_LIST; const knownAreas = getCurrentTheme()?.default_template_part_areas || []; const templatePartAreas = knownAreas.map((area) => area.area); const templatePartHasCategory = (item, category) => { if (category !== TEMPLATE_PART_AREA_DEFAULT_CATEGORY) { return item.area === category; } return item.area === category || !templatePartAreas.includes(item.area); }; const isResolving = isResolvingSelector("getEntityRecords", [ "postType", TEMPLATE_PART_POST_TYPE, query ]); const patterns = searchItems(templateParts, search, { categoryId, hasCategory: templatePartHasCategory }); return { patterns, isResolving }; }, (select) => [ select(external_wp_coreData_namespaceObject.store).getEntityRecords( "postType", TEMPLATE_PART_POST_TYPE, { per_page: -1 } ), select(external_wp_coreData_namespaceObject.store).isResolving("getEntityRecords", [ "postType", TEMPLATE_PART_POST_TYPE, { per_page: -1 } ]), select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas ] ); const selectThemePatterns = (0,external_wp_data_.createSelector)( (select) => { const { getSettings } = unlock(select(store)); const { isResolving: isResolvingSelector } = select(external_wp_coreData_namespaceObject.store); const settings = getSettings(); const blockPatterns = settings.__experimentalAdditionalBlockPatterns ?? settings.__experimentalBlockPatterns; const restBlockPatterns = select(external_wp_coreData_namespaceObject.store).getBlockPatterns(); const patterns = [ ...blockPatterns || [], ...restBlockPatterns || [] ].filter( (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source) ).filter(filterOutDuplicatesByName).filter((pattern) => pattern.inserter !== false).map((pattern) => ({ ...pattern, keywords: pattern.keywords || [], type: PATTERN_TYPES.theme, blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { __unstableSkipMigrationLogs: true }) })); return { patterns, isResolving: isResolvingSelector("getBlockPatterns") }; }, (select) => [ select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), select(external_wp_coreData_namespaceObject.store).isResolving("getBlockPatterns"), unlock(select(store)).getSettings() ] ); const selectPatterns = (0,external_wp_data_.createSelector)( (select, categoryId, syncStatus, search = "") => { const { patterns: themePatterns, isResolving: isResolvingThemePatterns } = selectThemePatterns(select); const { patterns: userPatterns, isResolving: isResolvingUserPatterns, categories: userPatternCategories } = selectUserPatterns(select); let patterns = [ ...themePatterns || [], ...userPatterns || [] ]; if (syncStatus) { patterns = patterns.filter((pattern) => { return pattern.type === PATTERN_TYPES.user ? (pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full) === syncStatus : syncStatus === PATTERN_SYNC_TYPES.unsynced; }); } if (categoryId) { patterns = searchItems(patterns, search, { categoryId, hasCategory: (item, currentCategory) => { if (item.type === PATTERN_TYPES.user) { return item.wp_pattern_category?.some( (catId) => userPatternCategories.find( (cat) => cat.id === catId )?.slug === currentCategory ); } return item.categories?.includes(currentCategory); } }); } else { patterns = searchItems(patterns, search, { hasCategory: (item) => { if (item.type === PATTERN_TYPES.user) { return userPatternCategories?.length && (!item.wp_pattern_category?.length || !item.wp_pattern_category?.some( (catId) => userPatternCategories.find( (cat) => cat.id === catId ) )); } return !item.hasOwnProperty("categories"); } }); } return { patterns, isResolving: isResolvingThemePatterns || isResolvingUserPatterns }; }, (select) => [ selectThemePatterns(select), selectUserPatterns(select) ] ); const selectUserPatterns = (0,external_wp_data_.createSelector)( (select, syncStatus, search = "") => { const { getEntityRecords, isResolving: isResolvingSelector, getUserPatternCategories } = select(external_wp_coreData_namespaceObject.store); const query = { per_page: -1 }; const patternPosts = getEntityRecords( "postType", PATTERN_TYPES.user, query ); const userPatternCategories = getUserPatternCategories(); const categories = /* @__PURE__ */ new Map(); userPatternCategories.forEach( (userCategory) => categories.set(userCategory.id, userCategory) ); let patterns = patternPosts ?? EMPTY_PATTERN_LIST; const isResolving = isResolvingSelector("getEntityRecords", [ "postType", PATTERN_TYPES.user, query ]); if (syncStatus) { patterns = patterns.filter( (pattern) => pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full === syncStatus ); } patterns = searchItems(patterns, search, { // We exit user pattern retrieval early if we aren't in the // catch-all category for user created patterns, so it has // to be in the category. hasCategory: () => true }); return { patterns, isResolving, categories: userPatternCategories }; }, (select) => [ select(external_wp_coreData_namespaceObject.store).getEntityRecords("postType", PATTERN_TYPES.user, { per_page: -1 }), select(external_wp_coreData_namespaceObject.store).isResolving("getEntityRecords", [ "postType", PATTERN_TYPES.user, { per_page: -1 } ]), select(external_wp_coreData_namespaceObject.store).getUserPatternCategories() ] ); function useAugmentPatternsWithPermissions(patterns) { const idsAndTypes = (0,external_wp_element_.useMemo)( () => patterns?.filter((record) => record.type !== PATTERN_TYPES.theme).map((record) => [record.type, record.id]) ?? [], [patterns] ); const permissions = (0,external_wp_data_.useSelect)( (select) => { const { getEntityRecordPermissions } = unlock( select(external_wp_coreData_namespaceObject.store) ); return idsAndTypes.reduce((acc, [type, id]) => { acc[id] = getEntityRecordPermissions("postType", type, id); return acc; }, {}); }, [idsAndTypes] ); return (0,external_wp_element_.useMemo)( () => patterns?.map((record) => ({ ...record, permissions: permissions?.[record.id] ?? {} })) ?? [], [patterns, permissions] ); } const usePatterns = (postType, categoryId, { search = "", syncStatus } = {}) => { return (0,external_wp_data_.useSelect)( (select) => { if (postType === TEMPLATE_PART_POST_TYPE) { return selectTemplateParts(select, categoryId, search); } else if (postType === PATTERN_TYPES.user && !!categoryId) { const appliedCategory = categoryId === "uncategorized" ? "" : categoryId; return selectPatterns( select, appliedCategory, syncStatus, search ); } else if (postType === PATTERN_TYPES.user) { return selectUserPatterns(select, syncStatus, search); } return { patterns: EMPTY_PATTERN_LIST, isResolving: false }; }, [categoryId, postType, search, syncStatus] ); }; var use_patterns_default = usePatterns; ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js function usePatternCategories() { const defaultCategories = useDefaultPatternCategories(); defaultCategories.push({ name: TEMPLATE_PART_AREA_DEFAULT_CATEGORY, label: (0,external_wp_i18n_namespaceObject.__)("Uncategorized") }); const themePatterns = useThemePatterns(); const { patterns: userPatterns, categories: userPatternCategories } = use_patterns_default(PATTERN_TYPES.user); const patternCategories = (0,external_wp_element_.useMemo)(() => { const categoryMap = {}; const categoriesWithCounts = []; defaultCategories.forEach((category) => { if (!categoryMap[category.name]) { categoryMap[category.name] = { ...category, count: 0 }; } }); userPatternCategories.forEach((category) => { if (!categoryMap[category.name]) { categoryMap[category.name] = { ...category, count: 0 }; } }); themePatterns.forEach((pattern) => { pattern.categories?.forEach((category) => { if (categoryMap[category]) { categoryMap[category].count += 1; } }); if (!pattern.categories?.length) { categoryMap.uncategorized.count += 1; } }); userPatterns.forEach((pattern) => { pattern.wp_pattern_category?.forEach((catId) => { const category = userPatternCategories.find( (cat) => cat.id === catId )?.name; if (categoryMap[category]) { categoryMap[category].count += 1; } }); if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category?.some( (catId) => userPatternCategories.find((cat) => cat.id === catId) )) { categoryMap.uncategorized.count += 1; } }); [...defaultCategories, ...userPatternCategories].forEach( (category) => { if (categoryMap[category.name].count && !categoriesWithCounts.find( (cat) => cat.name === category.name )) { categoriesWithCounts.push(categoryMap[category.name]); } } ); const sortedCategories = categoriesWithCounts.sort( (a, b) => a.label.localeCompare(b.label) ); sortedCategories.unshift({ name: PATTERN_USER_CATEGORY, label: (0,external_wp_i18n_namespaceObject.__)("My patterns"), count: userPatterns.length }); sortedCategories.unshift({ name: PATTERN_DEFAULT_CATEGORY, label: (0,external_wp_i18n_namespaceObject.__)("All patterns"), description: (0,external_wp_i18n_namespaceObject.__)("A list of all patterns from all sources."), count: themePatterns.length + userPatterns.length }); return sortedCategories; }, [ defaultCategories, themePatterns, userPatternCategories, userPatterns ]); return { patternCategories, hasPatterns: !!patternCategories.length }; } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js const useTemplatePartsGroupedByArea = (items) => { const allItems = items || []; const templatePartAreas = (0,external_wp_data_.useSelect)( (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || [], [] ); const knownAreas = { header: {}, footer: {}, sidebar: {}, uncategorized: {} }; templatePartAreas.forEach( (templatePartArea) => knownAreas[templatePartArea.area] = { ...templatePartArea, templateParts: [] } ); const groupedByArea = allItems.reduce((accumulator, item) => { const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY; accumulator[key]?.templateParts?.push(item); return accumulator; }, knownAreas); return groupedByArea; }; function useTemplatePartAreas() { const { records: templateParts, isResolving: isLoading } = (0,external_wp_coreData_namespaceObject.useEntityRecords)( "postType", TEMPLATE_PART_POST_TYPE, { per_page: -1 } ); return { hasTemplateParts: templateParts ? !!templateParts.length : false, isLoading, templatePartAreas: useTemplatePartsGroupedByArea(templateParts) }; } ;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.js const { useLocation: sidebar_navigation_screen_patterns_useLocation } = unlock(external_wp_router_namespaceObject.privateApis); function CategoriesGroup({ templatePartAreas, patternCategories, currentCategory, currentType }) { const [allPatterns, ...otherPatterns] = patternCategories; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-patterns__group", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CategoryItem, { count: Object.values(templatePartAreas).map(({ templateParts }) => templateParts?.length || 0).reduce((acc, val) => acc + val, 0), icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(), label: (0,external_wp_i18n_namespaceObject.__)("All template parts"), id: TEMPLATE_PART_ALL_AREAS_CATEGORY, type: TEMPLATE_PART_POST_TYPE, isActive: currentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY && currentType === TEMPLATE_PART_POST_TYPE }, "all" ), Object.entries(templatePartAreas).map( ([area, { label, templateParts }]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CategoryItem, { count: templateParts?.length, icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(area), label, id: area, type: TEMPLATE_PART_POST_TYPE, isActive: currentCategory === area && currentType === TEMPLATE_PART_POST_TYPE }, area ) ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen-patterns__divider" }), allPatterns && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CategoryItem, { count: allPatterns.count, label: allPatterns.label, icon: file_default, id: allPatterns.name, type: PATTERN_TYPES.user, isActive: currentCategory === `${allPatterns.name}` && currentType === PATTERN_TYPES.user }, allPatterns.name ), otherPatterns.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CategoryItem, { count: category.count, label: category.label, icon: file_default, id: category.name, type: PATTERN_TYPES.user, isActive: currentCategory === `${category.name}` && currentType === PATTERN_TYPES.user }, category.name )) ] }); } function SidebarNavigationScreenPatterns({ backPath }) { const { query: { postType = "wp_block", categoryId } } = sidebar_navigation_screen_patterns_useLocation(); const currentCategory = categoryId || (postType === PATTERN_TYPES.user ? PATTERN_DEFAULT_CATEGORY : TEMPLATE_PART_ALL_AREAS_CATEGORY); const { templatePartAreas, hasTemplateParts, isLoading } = useTemplatePartAreas(); const { patternCategories, hasPatterns } = usePatternCategories(); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( SidebarNavigationScreen, { title: (0,external_wp_i18n_namespaceObject.__)("Patterns"), description: (0,external_wp_i18n_namespaceObject.__)( "Manage what patterns are available when editing the site." ), isRoot: !backPath, backPath, content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ isLoading && (0,external_wp_i18n_namespaceObject.__)("Loading items\u2026"), !isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ !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") }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CategoriesGroup, { templatePartAreas, patternCategories, currentCategory, currentType: postType } ) ] }) ] }) } ); } // EXTERNAL MODULE: ./node_modules/remove-accents/index.js var remove_accents = __webpack_require__(9681); var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/constants.js /** * @module constants * @summary Useful constants * @description * Collection of useful date constants. * * The constants could be imported from `date-fns/constants`: * * ```ts * import { maxTime, minTime } from "./constants/date-fns/constants"; * * function isAllowedTime(time) { * return time <= maxTime && time >= minTime; * } * ``` */ /** * @constant * @name daysInWeek * @summary Days in 1 week. */ const daysInWeek = 7; /** * @constant * @name daysInYear * @summary Days in 1 year. * * @description * How many days in a year. * * One years equals 365.2425 days according to the formula: * * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400. * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days */ const daysInYear = 365.2425; /** * @constant * @name maxTime * @summary Maximum allowed time. * * @example * import { maxTime } from "./constants/date-fns/constants"; * * const isValid = 8640000000000001 <= maxTime; * //=> false * * new Date(8640000000000001); * //=> Invalid Date */ const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000; /** * @constant * @name minTime * @summary Minimum allowed time. * * @example * import { minTime } from "./constants/date-fns/constants"; * * const isValid = -8640000000000001 >= minTime; * //=> false * * new Date(-8640000000000001) * //=> Invalid Date */ const minTime = -maxTime; /** * @constant * @name millisecondsInWeek * @summary Milliseconds in 1 week. */ const millisecondsInWeek = 604800000; /** * @constant * @name millisecondsInDay * @summary Milliseconds in 1 day. */ const millisecondsInDay = 86400000; /** * @constant * @name millisecondsInMinute * @summary Milliseconds in 1 minute */ const millisecondsInMinute = 60000; /** * @constant * @name millisecondsInHour * @summary Milliseconds in 1 hour */ const millisecondsInHour = 3600000; /** * @constant * @name millisecondsInSecond * @summary Milliseconds in 1 second */ const millisecondsInSecond = 1000; /** * @constant * @name minutesInYear * @summary Minutes in 1 year. */ const minutesInYear = 525600; /** * @constant * @name minutesInMonth * @summary Minutes in 1 month. */ const minutesInMonth = 43200; /** * @constant * @name minutesInDay * @summary Minutes in 1 day. */ const minutesInDay = 1440; /** * @constant * @name minutesInHour * @summary Minutes in 1 hour. */ const minutesInHour = 60; /** * @constant * @name monthsInQuarter * @summary Months in 1 quarter. */ const monthsInQuarter = 3; /** * @constant * @name monthsInYear * @summary Months in 1 year. */ const monthsInYear = 12; /** * @constant * @name quartersInYear * @summary Quarters in 1 year */ const quartersInYear = 4; /** * @constant * @name secondsInHour * @summary Seconds in 1 hour. */ const secondsInHour = 3600; /** * @constant * @name secondsInMinute * @summary Seconds in 1 minute. */ const secondsInMinute = 60; /** * @constant * @name secondsInDay * @summary Seconds in 1 day. */ const secondsInDay = secondsInHour * 24; /** * @constant * @name secondsInWeek * @summary Seconds in 1 week. */ const secondsInWeek = secondsInDay * 7; /** * @constant * @name secondsInYear * @summary Seconds in 1 year. */ const secondsInYear = secondsInDay * daysInYear; /** * @constant * @name secondsInMonth * @summary Seconds in 1 month */ const secondsInMonth = secondsInYear / 12; /** * @constant * @name secondsInQuarter * @summary Seconds in 1 quarter. */ const secondsInQuarter = secondsInMonth * 3; /** * @constant * @name constructFromSymbol * @summary Symbol enabling Date extensions to inherit properties from the reference date. * * The symbol is used to enable the `constructFrom` function to construct a date * using a reference date and a value. It allows to transfer extra properties * from the reference date to the new date. It's useful for extensions like * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as * a constructor argument. */ const constructFromSymbol = Symbol.for("constructDateFrom"); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/constructFrom.js /** * @name constructFrom * @category Generic Helpers * @summary Constructs a date using the reference date and the value * * @description * The function constructs a new date using the constructor from the reference * date and the given value. It helps to build generic functions that accept * date extensions. * * It defaults to `Date` if the passed reference date is a number or a string. * * Starting from v3.7.0, it allows to construct a date using `[Symbol.for("constructDateFrom")]` * enabling to transfer extra properties from the reference date to the new date. * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz) * that accept a time zone as a constructor argument. * * @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). * * @param date - The reference date to take constructor from * @param value - The value to create the date * * @returns Date initialized using the given date and value * * @example * import { constructFrom } from "./constructFrom/date-fns"; * * // A function that clones a date preserving the original type * function cloneDate<DateType extends Date>(date: DateType): DateType { * return constructFrom( * date, // Use constructor from the given date * date.getTime() // Use the date value to create a new date * ); * } */ function constructFrom(date, value) { if (typeof date === "function") return date(value); if (date && typeof date === "object" && constructFromSymbol in date) return date[constructFromSymbol](value); if (date instanceof Date) return new date.constructor(value); return new Date(value); } // Fallback for modularized imports: /* harmony default export */ const date_fns_constructFrom = ((/* unused pure expression or super */ null && (constructFrom))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/toDate.js /** * @name toDate * @category Common Helpers * @summary Convert the given argument to an instance of Date. * * @description * Convert the given argument to an instance of Date. * * If the argument is an instance of Date, the function returns its clone. * * If the argument is a number, it is treated as a timestamp. * * If the argument is none of the above, the function returns Invalid Date. * * Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]` * enabling to transfer extra properties from the reference date to the new date. * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz) * that accept a time zone as a constructor argument. * * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`. * * @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). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param argument - The value to convert * * @returns The parsed date in the local time zone * * @example * // Clone the date: * const result = toDate(new Date(2014, 1, 11, 11, 30, 30)) * //=> Tue Feb 11 2014 11:30:30 * * @example * // Convert the timestamp to date: * const result = toDate(1392098430000) * //=> Tue Feb 11 2014 11:30:30 */ function toDate(argument, context) { // [TODO] Get rid of `toDate` or `constructFrom`? return constructFrom(context || argument, argument); } // Fallback for modularized imports: /* harmony default export */ const date_fns_toDate = ((/* unused pure expression or super */ null && (toDate))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addDays.js /** * The {@link addDays} function options. */ /** * @name addDays * @category Day Helpers * @summary Add the specified number of days to the given date. * * @description * Add the specified number of days to the given date. * * @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). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param date - The date to be changed * @param amount - The amount of days to be added. * @param options - An object with options * * @returns The new date with the days added * * @example * // Add 10 days to 1 September 2014: * const result = addDays(new Date(2014, 8, 1), 10) * //=> Thu Sep 11 2014 00:00:00 */ function addDays(date, amount, options) { const _date = toDate(date, options?.in); if (isNaN(amount)) return constructFrom(options?.in || date, NaN); // If 0 days, no-op to avoid changing times in the hour before end of DST if (!amount) return _date; _date.setDate(_date.getDate() + amount); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_addDays = ((/* unused pure expression or super */ null && (addDays))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subDays.js /** * The {@link subDays} function options. */ /** * @name subDays * @category Day Helpers * @summary Subtract the specified number of days from the given date. * * @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). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param date - The date to be changed * @param amount - The amount of days to be subtracted. * @param options - An object with options * * @returns The new date with the days subtracted * * @example * // Subtract 10 days from 1 September 2014: * const result = subDays(new Date(2014, 8, 1), 10) * //=> Fri Aug 22 2014 00:00:00 */ function subDays(date, amount, options) { return addDays(date, -amount, options); } // Fallback for modularized imports: /* harmony default export */ const date_fns_subDays = ((/* unused pure expression or super */ null && (subDays))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addWeeks.js /** * The {@link addWeeks} function options. */ /** * @name addWeeks * @category Week Helpers * @summary Add the specified number of weeks to the given date. * * @description * Add the specified number of weeks to the given date. * * @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). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param date - The date to be changed * @param amount - The amount of weeks to be added. * @param options - An object with options * * @returns The new date with the weeks added * * @example * // Add 4 weeks to 1 September 2014: * const result = addWeeks(new Date(2014, 8, 1), 4) * //=> Mon Sep 29 2014 00:00:00 */ function addWeeks(date, amount, options) { return addDays(date, amount * 7, options); } // Fallback for modularized imports: /* harmony default export */ const date_fns_addWeeks = ((/* unused pure expression or super */ null && (addWeeks))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subWeeks.js /** * The {@link subWeeks} function options. */ /** * @name subWeeks * @category Week Helpers * @summary Subtract the specified number of weeks from the given date. * * @description * Subtract the specified number of weeks from the given date. * * @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). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param date - The date to be changed * @param amount - The amount of weeks to be subtracted. * @param options - An object with options * * @returns The new date with the weeks subtracted * * @example * // Subtract 4 weeks from 1 September 2014: * const result = subWeeks(new Date(2014, 8, 1), 4) * //=> Mon Aug 04 2014 00:00:00 */ function subWeeks(date, amount, options) { return addWeeks(date, -amount, options); } // Fallback for modularized imports: /* harmony default export */ const date_fns_subWeeks = ((/* unused pure expression or super */ null && (subWeeks))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addMonths.js /** * The {@link addMonths} function options. */ /** * @name addMonths * @category Month Helpers * @summary Add the specified number of months to the given date. * * @description * Add the specified number of months to the given date. * * @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). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param date - The date to be changed * @param amount - The amount of months to be added. * @param options - The options object * * @returns The new date with the months added * * @example * // Add 5 months to 1 September 2014: * const result = addMonths(new Date(2014, 8, 1), 5) * //=> Sun Feb 01 2015 00:00:00 * * // Add one month to 30 January 2023: * const result = addMonths(new Date(2023, 0, 30), 1) * //=> Tue Feb 28 2023 00:00:00 */ function addMonths(date, amount, options) { const _date = toDate(date, options?.in); if (isNaN(amount)) return constructFrom(options?.in || date, NaN); if (!amount) { // If 0 months, no-op to avoid changing times in the hour before end of DST return _date; } const dayOfMonth = _date.getDate(); // The JS Date object supports date math by accepting out-of-bounds values for // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we // want except that dates will wrap around the end of a month, meaning that // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So // we'll default to the end of the desired month by adding 1 to the desired // month and using a date of 0 to back up one day to the end of the desired // month. const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime()); endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0); const daysInMonth = endOfDesiredMonth.getDate(); if (dayOfMonth >= daysInMonth) { // If we're already at the end of the month, then this is the correct date // and we're done. return endOfDesiredMonth; } else { // Otherwise, we now know that setting the original day-of-month value won't // cause an overflow, so set the desired day-of-month. Note that we can't // just set the date of `endOfDesiredMonth` because that object may have had // its time changed in the unusual case where where a DST transition was on // the last day of the month and its local time was in the hour skipped or // repeated next to a DST transition. So we use `date` instead which is // guaranteed to still have the original time. _date.setFullYear( endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth, ); return _date; } } // Fallback for modularized imports: /* harmony default export */ const date_fns_addMonths = ((/* unused pure expression or super */ null && (addMonths))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subMonths.js /** * The subMonths function options. */ /** * @name subMonths * @category Month Helpers * @summary Subtract the specified number of months from the given date. * * @description * Subtract the specified number of months from the given date. * * @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). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param date - The date to be changed * @param amount - The amount of months to be subtracted. * @param options - An object with options * * @returns The new date with the months subtracted * * @example * // Subtract 5 months from 1 February 2015: * const result = subMonths(new Date(2015, 1, 1), 5) * //=> Mon Sep 01 2014 00:00:00 */ function subMonths(date, amount, options) { return addMonths(date, -amount, options); } // Fallback for modularized imports: /* harmony default export */ const date_fns_subMonths = ((/* unused pure expression or super */ null && (subMonths))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addYears.js /** * The {@link addYears} function options. */ /** * @name addYears * @category Year Helpers * @summary Add the specified number of years to the given date. * * @description * Add the specified number of years to the given date. * * @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). * @typeParam ResultDate - The result `Date` type. * * @param date - The date to be changed * @param amount - The amount of years to be added. * @param options - The options * * @returns The new date with the years added * * @example * // Add 5 years to 1 September 2014: * const result = addYears(new Date(2014, 8, 1), 5) * //=> Sun Sep 01 2019 00:00:00 */ function addYears(date, amount, options) { return addMonths(date, amount * 12, options); } // Fallback for modularized imports: /* harmony default export */ const date_fns_addYears = ((/* unused pure expression or super */ null && (addYears))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subYears.js /** * The {@link subYears} function options. */ /** * @name subYears * @category Year Helpers * @summary Subtract the specified number of years from the given date. * * @description * Subtract the specified number of years from the given date. * * @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). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param date - The date to be changed * @param amount - The amount of years to be subtracted. * @param options - An object with options * * @returns The new date with the years subtracted * * @example * // Subtract 5 years from 1 September 2014: * const result = subYears(new Date(2014, 8, 1), 5) * //=> Tue Sep 01 2009 00:00:00 */ function subYears(date, amount, options) { return addYears(date, -amount, options); } // Fallback for modularized imports: /* harmony default export */ const date_fns_subYears = ((/* unused pure expression or super */ null && (subYears))); ;// ./node_modules/@wordpress/icons/build-module/library/arrow-up.js var arrow_up_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/arrow-down.js var arrow_down_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" }) }); ;// ./node_modules/@wordpress/dataviews/build-module/constants.js const constants_OPERATOR_IS = "is"; const constants_OPERATOR_IS_NOT = "isNot"; const constants_OPERATOR_IS_ANY = "isAny"; const constants_OPERATOR_IS_NONE = "isNone"; const OPERATOR_IS_ALL = "isAll"; const OPERATOR_IS_NOT_ALL = "isNotAll"; const OPERATOR_LESS_THAN = "lessThan"; const OPERATOR_GREATER_THAN = "greaterThan"; const OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual"; const OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual"; const OPERATOR_BEFORE = "before"; const OPERATOR_AFTER = "after"; const OPERATOR_BEFORE_INC = "beforeInc"; const OPERATOR_AFTER_INC = "afterInc"; const OPERATOR_CONTAINS = "contains"; const OPERATOR_NOT_CONTAINS = "notContains"; const OPERATOR_STARTS_WITH = "startsWith"; const OPERATOR_BETWEEN = "between"; const OPERATOR_ON = "on"; const OPERATOR_NOT_ON = "notOn"; const OPERATOR_IN_THE_PAST = "inThePast"; const OPERATOR_OVER = "over"; const ALL_OPERATORS = [ constants_OPERATOR_IS, constants_OPERATOR_IS_NOT, constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL, OPERATOR_LESS_THAN, OPERATOR_GREATER_THAN, OPERATOR_LESS_THAN_OR_EQUAL, OPERATOR_GREATER_THAN_OR_EQUAL, OPERATOR_BEFORE, OPERATOR_AFTER, OPERATOR_BEFORE_INC, OPERATOR_AFTER_INC, OPERATOR_CONTAINS, OPERATOR_NOT_CONTAINS, OPERATOR_STARTS_WITH, OPERATOR_BETWEEN, OPERATOR_ON, OPERATOR_NOT_ON, OPERATOR_IN_THE_PAST, OPERATOR_OVER ]; const SINGLE_SELECTION_OPERATORS = [ constants_OPERATOR_IS, constants_OPERATOR_IS_NOT, OPERATOR_LESS_THAN, OPERATOR_GREATER_THAN, OPERATOR_LESS_THAN_OR_EQUAL, OPERATOR_GREATER_THAN_OR_EQUAL, OPERATOR_BEFORE, OPERATOR_AFTER, OPERATOR_BEFORE_INC, OPERATOR_AFTER_INC, OPERATOR_CONTAINS, OPERATOR_NOT_CONTAINS, OPERATOR_STARTS_WITH, OPERATOR_ON, OPERATOR_NOT_ON ]; const OPERATORS = { [constants_OPERATOR_IS]: { key: "is-filter", label: (0,external_wp_i18n_namespaceObject.__)("Is") }, [constants_OPERATOR_IS_NOT]: { key: "is-not-filter", label: (0,external_wp_i18n_namespaceObject.__)("Is not") }, [constants_OPERATOR_IS_ANY]: { key: "is-any-filter", label: (0,external_wp_i18n_namespaceObject.__)("Is any") }, [constants_OPERATOR_IS_NONE]: { key: "is-none-filter", label: (0,external_wp_i18n_namespaceObject.__)("Is none") }, [OPERATOR_IS_ALL]: { key: "is-all-filter", label: (0,external_wp_i18n_namespaceObject.__)("Is all") }, [OPERATOR_IS_NOT_ALL]: { key: "is-not-all-filter", label: (0,external_wp_i18n_namespaceObject.__)("Is not all") }, [OPERATOR_LESS_THAN]: { key: "less-than-filter", label: (0,external_wp_i18n_namespaceObject.__)("Less than") }, [OPERATOR_GREATER_THAN]: { key: "greater-than-filter", label: (0,external_wp_i18n_namespaceObject.__)("Greater than") }, [OPERATOR_LESS_THAN_OR_EQUAL]: { key: "less-than-or-equal-filter", label: (0,external_wp_i18n_namespaceObject.__)("Less than or equal") }, [OPERATOR_GREATER_THAN_OR_EQUAL]: { key: "greater-than-or-equal-filter", label: (0,external_wp_i18n_namespaceObject.__)("Greater than or equal") }, [OPERATOR_BEFORE]: { key: "before-filter", label: (0,external_wp_i18n_namespaceObject.__)("Before") }, [OPERATOR_AFTER]: { key: "after-filter", label: (0,external_wp_i18n_namespaceObject.__)("After") }, [OPERATOR_BEFORE_INC]: { key: "before-inc-filter", label: (0,external_wp_i18n_namespaceObject.__)("Before (inc)") }, [OPERATOR_AFTER_INC]: { key: "after-inc-filter", label: (0,external_wp_i18n_namespaceObject.__)("After (inc)") }, [OPERATOR_CONTAINS]: { key: "contains-filter", label: (0,external_wp_i18n_namespaceObject.__)("Contains") }, [OPERATOR_NOT_CONTAINS]: { key: "not-contains-filter", label: (0,external_wp_i18n_namespaceObject.__)("Doesn't contain") }, [OPERATOR_STARTS_WITH]: { key: "starts-with-filter", label: (0,external_wp_i18n_namespaceObject.__)("Starts with") }, [OPERATOR_BETWEEN]: { key: "between-filter", label: (0,external_wp_i18n_namespaceObject.__)("Between (inc)") }, [OPERATOR_ON]: { key: "on-filter", label: (0,external_wp_i18n_namespaceObject.__)("On") }, [OPERATOR_NOT_ON]: { key: "not-on-filter", label: (0,external_wp_i18n_namespaceObject.__)("Not on") }, [OPERATOR_IN_THE_PAST]: { key: "in-the-past-filter", label: (0,external_wp_i18n_namespaceObject.__)("In the past") }, [OPERATOR_OVER]: { key: "over-filter", label: (0,external_wp_i18n_namespaceObject.__)("Over") } }; const SORTING_DIRECTIONS = ["asc", "desc"]; const sortArrows = { asc: "\u2191", desc: "\u2193" }; const sortValues = { asc: "ascending", desc: "descending" }; const sortLabels = { asc: (0,external_wp_i18n_namespaceObject.__)("Sort ascending"), desc: (0,external_wp_i18n_namespaceObject.__)("Sort descending") }; const sortIcons = { asc: arrow_up_default, desc: arrow_down_default }; const constants_LAYOUT_TABLE = "table"; const constants_LAYOUT_GRID = "grid"; const constants_LAYOUT_LIST = "list"; const LAYOUT_PICKER_GRID = "pickerGrid"; ;// ./node_modules/@wordpress/dataviews/build-module/hooks/use-elements.js const use_elements_EMPTY_ARRAY = []; function useElements({ elements, getElements }) { const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : use_elements_EMPTY_ARRAY; const [records, setRecords] = (0,external_wp_element_.useState)(staticElements); const [isLoading, setIsLoading] = (0,external_wp_element_.useState)(false); (0,external_wp_element_.useEffect)(() => { if (!getElements) { setRecords(staticElements); return; } let cancelled = false; setIsLoading(true); getElements().then((fetchedElements) => { if (!cancelled) { const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements; setRecords(dynamicElements); } }).catch(() => { if (!cancelled) { setRecords(staticElements); } }).finally(() => { if (!cancelled) { setIsLoading(false); } }); return () => { cancelled = true; }; }, [getElements, staticElements]); return { elements: records, isLoading }; } ;// ./node_modules/@wordpress/dataviews/build-module/field-types/utils/render-from-elements.js function RenderFromElements({ item, field }) { const { elements, isLoading } = useElements({ elements: field.elements, getElements: field.getElements }); const value = field.getValue({ item }); if (isLoading) { return value; } if (elements.length === 0) { return value; } return elements?.find((element) => element.value === value)?.label || field.getValue({ item }); } ;// ./node_modules/@wordpress/dataviews/build-module/field-types/email.js function sort(valueA, valueB, direction) { return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); } const emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; var email_default = { sort, isValid: { elements: true, custom: (item, field) => { const value = field.getValue({ item }); if (![void 0, "", null].includes(value) && !emailRegex.test(value)) { return (0,external_wp_i18n_namespaceObject.__)("Value must be a valid email address."); } return null; } }, Edit: "email", render: ({ item, field }) => { return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item }); }, enableSorting: true, filterBy: { defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE], validOperators: [ constants_OPERATOR_IS, constants_OPERATOR_IS_NOT, OPERATOR_CONTAINS, OPERATOR_NOT_CONTAINS, OPERATOR_STARTS_WITH, // Multiple selection constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL ] } }; ;// ./node_modules/@wordpress/dataviews/build-module/field-types/integer.js function integer_sort(a, b, direction) { return direction === "asc" ? a - b : b - a; } var integer_default = { sort: integer_sort, isValid: { elements: true, custom: (item, field) => { const value = field.getValue({ item }); if (![void 0, "", null].includes(value) && !Number.isInteger(value)) { return (0,external_wp_i18n_namespaceObject.__)("Value must be an integer."); } return null; } }, Edit: "integer", render: ({ item, field }) => { return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item }); }, enableSorting: true, filterBy: { defaultOperators: [ constants_OPERATOR_IS, constants_OPERATOR_IS_NOT, OPERATOR_LESS_THAN, OPERATOR_GREATER_THAN, OPERATOR_LESS_THAN_OR_EQUAL, OPERATOR_GREATER_THAN_OR_EQUAL, OPERATOR_BETWEEN ], validOperators: [ // Single-selection constants_OPERATOR_IS, constants_OPERATOR_IS_NOT, OPERATOR_LESS_THAN, OPERATOR_GREATER_THAN, OPERATOR_LESS_THAN_OR_EQUAL, OPERATOR_GREATER_THAN_OR_EQUAL, OPERATOR_BETWEEN, // Multiple-selection constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL ] } }; ;// ./node_modules/@wordpress/dataviews/build-module/field-types/number.js function number_sort(a, b, direction) { return direction === "asc" ? a - b : b - a; } function isEmpty(value) { return value === "" || value === void 0 || value === null; } var number_default = { sort: number_sort, isValid: { elements: true, custom: (item, field) => { const value = field.getValue({ item }); if (!isEmpty(value) && !Number.isFinite(value)) { return (0,external_wp_i18n_namespaceObject.__)("Value must be a number."); } return null; } }, Edit: "number", render: ({ item, field }) => { if (field.hasElements) { /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }); } const value = field.getValue({ item }); if (![null, void 0].includes(value)) { return Number(value).toFixed(2); } return null; }, enableSorting: true, filterBy: { defaultOperators: [ constants_OPERATOR_IS, constants_OPERATOR_IS_NOT, OPERATOR_LESS_THAN, OPERATOR_GREATER_THAN, OPERATOR_LESS_THAN_OR_EQUAL, OPERATOR_GREATER_THAN_OR_EQUAL, OPERATOR_BETWEEN ], validOperators: [ // Single-selection constants_OPERATOR_IS, constants_OPERATOR_IS_NOT, OPERATOR_LESS_THAN, OPERATOR_GREATER_THAN, OPERATOR_LESS_THAN_OR_EQUAL, OPERATOR_GREATER_THAN_OR_EQUAL, OPERATOR_BETWEEN, // Multiple-selection constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL ] } }; ;// ./node_modules/@wordpress/dataviews/build-module/field-types/text.js function text_sort(valueA, valueB, direction) { return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); } var text_default = { sort: text_sort, isValid: { elements: true, custom: () => null }, Edit: "text", render: ({ item, field }) => { return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item }); }, enableSorting: true, filterBy: { defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE], validOperators: [ // Single selection constants_OPERATOR_IS, constants_OPERATOR_IS_NOT, OPERATOR_CONTAINS, OPERATOR_NOT_CONTAINS, OPERATOR_STARTS_WITH, // Multiple selection constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL ] } }; ;// ./node_modules/@wordpress/dataviews/build-module/field-types/datetime.js function datetime_sort(a, b, direction) { const timeA = new Date(a).getTime(); const timeB = new Date(b).getTime(); return direction === "asc" ? timeA - timeB : timeB - timeA; } var datetime_default = { sort: datetime_sort, isValid: { elements: true, custom: () => null }, Edit: "datetime", render: ({ item, field }) => { return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item }); }, enableSorting: true, filterBy: { defaultOperators: [ OPERATOR_ON, OPERATOR_NOT_ON, OPERATOR_BEFORE, OPERATOR_AFTER, OPERATOR_BEFORE_INC, OPERATOR_AFTER_INC, OPERATOR_IN_THE_PAST, OPERATOR_OVER ], validOperators: [ OPERATOR_ON, OPERATOR_NOT_ON, OPERATOR_BEFORE, OPERATOR_AFTER, OPERATOR_BEFORE_INC, OPERATOR_AFTER_INC, OPERATOR_IN_THE_PAST, OPERATOR_OVER ] } }; ;// ./node_modules/@wordpress/dataviews/build-module/field-types/date.js const getFormattedDate = (dateToDisplay) => (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_date_namespaceObject.getSettings)().formats.date, (0,external_wp_date_namespaceObject.getDate)(dateToDisplay)); function date_sort(a, b, direction) { const timeA = new Date(a).getTime(); const timeB = new Date(b).getTime(); return direction === "asc" ? timeA - timeB : timeB - timeA; } var date_default = { sort: date_sort, Edit: "date", isValid: { elements: true, custom: () => null }, render: ({ item, field }) => { if (field.hasElements) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }); } const value = field.getValue({ item }); if (!value) { return ""; } return getFormattedDate(value); }, enableSorting: true, filterBy: { defaultOperators: [ OPERATOR_ON, OPERATOR_NOT_ON, OPERATOR_BEFORE, OPERATOR_AFTER, OPERATOR_BEFORE_INC, OPERATOR_AFTER_INC, OPERATOR_IN_THE_PAST, OPERATOR_OVER, OPERATOR_BETWEEN ], validOperators: [ OPERATOR_ON, OPERATOR_NOT_ON, OPERATOR_BEFORE, OPERATOR_AFTER, OPERATOR_BEFORE_INC, OPERATOR_AFTER_INC, OPERATOR_IN_THE_PAST, OPERATOR_OVER, OPERATOR_BETWEEN ] } }; ;// ./node_modules/@wordpress/dataviews/build-module/field-types/boolean.js function boolean_sort(a, b, direction) { const boolA = Boolean(a); const boolB = Boolean(b); if (boolA === boolB) { return 0; } if (direction === "asc") { return boolA ? 1 : -1; } return boolA ? -1 : 1; } var boolean_default = { sort: boolean_sort, isValid: { elements: true, custom: (item, field) => { const value = field.getValue({ item }); if (![void 0, "", null].includes(value) && ![true, false].includes(value)) { return (0,external_wp_i18n_namespaceObject.__)("Value must be true, false, or undefined"); } return null; } }, Edit: "checkbox", render: ({ item, field }) => { if (field.hasElements) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }); } if (field.getValue({ item }) === true) { return (0,external_wp_i18n_namespaceObject.__)("True"); } if (field.getValue({ item }) === false) { return (0,external_wp_i18n_namespaceObject.__)("False"); } return null; }, enableSorting: true, filterBy: { defaultOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT], validOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT] } }; ;// ./node_modules/@wordpress/dataviews/build-module/field-types/media.js function media_sort() { return 0; } var media_default = { sort: media_sort, isValid: { elements: true, custom: () => null }, Edit: null, render: () => null, enableSorting: false, filterBy: false }; ;// ./node_modules/@wordpress/dataviews/build-module/field-types/array.js function array_sort(valueA, valueB, direction) { const arrA = Array.isArray(valueA) ? valueA : []; const arrB = Array.isArray(valueB) ? valueB : []; if (arrA.length !== arrB.length) { return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length; } const joinedA = arrA.join(","); const joinedB = arrB.join(","); return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA); } function render({ item, field }) { const value = field.getValue({ item }) || []; return value.join(", "); } const arrayFieldType = { sort: array_sort, isValid: { elements: true, custom: (item, field) => { const value = field.getValue({ item }); if (![void 0, "", null].includes(value) && !Array.isArray(value)) { return (0,external_wp_i18n_namespaceObject.__)("Value must be an array."); } if (!value.every((v) => typeof v === "string")) { return (0,external_wp_i18n_namespaceObject.__)("Every value must be a string."); } return null; } }, Edit: "array", // Use array control render, enableSorting: true, filterBy: { defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE], validOperators: [ constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL ] } }; var array_default = arrayFieldType; ;// ./node_modules/@wordpress/dataviews/build-module/field-types/password.js function password_sort(valueA, valueB, direction) { return 0; } var password_default = { sort: password_sort, isValid: { elements: true, custom: () => null }, Edit: "password", render: ({ item, field }) => { return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"; }, enableSorting: false, filterBy: false }; ;// ./node_modules/@wordpress/dataviews/build-module/field-types/telephone.js function telephone_sort(valueA, valueB, direction) { return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); } var telephone_default = { sort: telephone_sort, isValid: { elements: true, custom: () => null }, Edit: "telephone", render: ({ item, field }) => { return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item }); }, enableSorting: true, filterBy: { defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE], validOperators: [ constants_OPERATOR_IS, constants_OPERATOR_IS_NOT, OPERATOR_CONTAINS, OPERATOR_NOT_CONTAINS, OPERATOR_STARTS_WITH, // Multiple selection constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL ] } }; ;// ./node_modules/@wordpress/dataviews/build-module/field-types/color.js function color_sort(valueA, valueB, direction) { const colorA = w(valueA); const colorB = w(valueB); if (!colorA.isValid() && !colorB.isValid()) { return 0; } if (!colorA.isValid()) { return direction === "asc" ? 1 : -1; } if (!colorB.isValid()) { return direction === "asc" ? -1 : 1; } const hslA = colorA.toHsl(); const hslB = colorB.toHsl(); if (hslA.h !== hslB.h) { return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h; } if (hslA.s !== hslB.s) { return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s; } return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l; } var color_color_default = { sort: color_sort, isValid: { elements: true, custom: (item, field) => { const value = field.getValue({ item }); if (![void 0, "", null].includes(value) && !w(value).isValid()) { return (0,external_wp_i18n_namespaceObject.__)("Value must be a valid color."); } return null; } }, Edit: "color", render: ({ item, field }) => { if (field.hasElements) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }); } const value = field.getValue({ item }); if (!value || !w(value).isValid()) { return value; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { style: { width: "16px", height: "16px", borderRadius: "50%", backgroundColor: value, border: "1px solid #ddd", flexShrink: 0 } } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: value }) ] } ); }, enableSorting: true, filterBy: { defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE], validOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT] } }; ;// ./node_modules/@wordpress/dataviews/build-module/field-types/url.js function url_sort(valueA, valueB, direction) { return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); } var url_default = { sort: url_sort, isValid: { elements: true, custom: () => null }, Edit: "url", render: ({ item, field }) => { return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item }); }, enableSorting: true, filterBy: { defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE], validOperators: [ constants_OPERATOR_IS, constants_OPERATOR_IS_NOT, OPERATOR_CONTAINS, OPERATOR_NOT_CONTAINS, OPERATOR_STARTS_WITH, // Multiple selection constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL ] } }; ;// ./node_modules/@wordpress/dataviews/build-module/field-types/index.js function getFieldTypeDefinition(type) { if ("email" === type) { return email_default; } if ("integer" === type) { return integer_default; } if ("number" === type) { return number_default; } if ("text" === type) { return text_default; } if ("datetime" === type) { return datetime_default; } if ("date" === type) { return date_default; } if ("boolean" === type) { return boolean_default; } if ("media" === type) { return media_default; } if ("array" === type) { return array_default; } if ("password" === type) { return password_default; } if ("telephone" === type) { return telephone_default; } if ("color" === type) { return color_color_default; } if ("url" === type) { return url_default; } return { sort: (a, b, direction) => { if (typeof a === "number" && typeof b === "number") { return direction === "asc" ? a - b : b - a; } return direction === "asc" ? a.localeCompare(b) : b.localeCompare(a); }, isValid: { elements: true, custom: () => null }, Edit: null, render: ({ item, field }) => { return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item }); }, enableSorting: true, filterBy: { defaultOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT], validOperators: ALL_OPERATORS } }; } ;// ./node_modules/@wordpress/dataviews/build-module/lock-unlock.js const { lock: lock_unlock_lock, unlock: lock_unlock_unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/dataviews" ); ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/get-custom-validity.js function getCustomValidity(isValid, validity) { let customValidity; if (isValid?.required && validity?.required) { customValidity = validity?.required?.message ? validity.required : void 0; } else if (isValid?.elements && validity?.elements) { customValidity = validity.elements; } else if (validity?.custom) { customValidity = validity.custom; } return customValidity; } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/checkbox.js const { ValidatedCheckboxControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function Checkbox({ field, onChange, data, hideLabelFromVision, validity }) { const { getValue, setValue, label, description, isValid } = field; const onChangeControl = (0,external_wp_element_.useCallback)(() => { onChange( setValue({ item: data, value: !getValue({ item: data }) }) ); }, [data, getValue, onChange, setValue]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedCheckboxControl, { required: !!field.isValid?.required, customValidity: getCustomValidity(isValid, validity), hidden: hideLabelFromVision, label, help: description, checked: getValue({ item: data }), onChange: onChangeControl } ); } ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/isDate.js /** * @name isDate * @category Common Helpers * @summary Is the given value a date? * * @description * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes. * * @param value - The value to check * * @returns True if the given value is a date * * @example * // For a valid date: * const result = isDate(new Date()) * //=> true * * @example * // For an invalid date: * const result = isDate(new Date(NaN)) * //=> true * * @example * // For some value: * const result = isDate('2014-02-31') * //=> false * * @example * // For an object: * const result = isDate({}) * //=> false */ function isDate(value) { return ( value instanceof Date || (typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]") ); } // Fallback for modularized imports: /* harmony default export */ const date_fns_isDate = ((/* unused pure expression or super */ null && (isDate))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/isValid.js /** * @name isValid * @category Common Helpers * @summary Is the given date valid? * * @description * Returns false if argument is Invalid Date and true otherwise. * Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate) * Invalid Date is a Date, whose time value is NaN. * * Time value of Date: http://es5.github.io/#x15.9.1.1 * * @param date - The date to check * * @returns The date is valid * * @example * // For the valid date: * const result = isValid(new Date(2014, 1, 31)) * //=> true * * @example * // For the value, convertible into a date: * const result = isValid(1393804800000) * //=> true * * @example * // For the invalid date: * const result = isValid(new Date('')) * //=> false */ function isValid(date) { return !((!isDate(date) && typeof date !== "number") || isNaN(+toDate(date))); } // Fallback for modularized imports: /* harmony default export */ const date_fns_isValid = ((/* unused pure expression or super */ null && (isValid))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/formatDistance.js const formatDistanceLocale = { lessThanXSeconds: { one: "less than a second", other: "less than {{count}} seconds", }, xSeconds: { one: "1 second", other: "{{count}} seconds", }, halfAMinute: "half a minute", lessThanXMinutes: { one: "less than a minute", other: "less than {{count}} minutes", }, xMinutes: { one: "1 minute", other: "{{count}} minutes", }, aboutXHours: { one: "about 1 hour", other: "about {{count}} hours", }, xHours: { one: "1 hour", other: "{{count}} hours", }, xDays: { one: "1 day", other: "{{count}} days", }, aboutXWeeks: { one: "about 1 week", other: "about {{count}} weeks", }, xWeeks: { one: "1 week", other: "{{count}} weeks", }, aboutXMonths: { one: "about 1 month", other: "about {{count}} months", }, xMonths: { one: "1 month", other: "{{count}} months", }, aboutXYears: { one: "about 1 year", other: "about {{count}} years", }, xYears: { one: "1 year", other: "{{count}} years", }, overXYears: { one: "over 1 year", other: "over {{count}} years", }, almostXYears: { one: "almost 1 year", other: "almost {{count}} years", }, }; const formatDistance = (token, count, options) => { let result; const tokenValue = formatDistanceLocale[token]; if (typeof tokenValue === "string") { result = tokenValue; } else if (count === 1) { result = tokenValue.one; } else { result = tokenValue.other.replace("{{count}}", count.toString()); } if (options?.addSuffix) { if (options.comparison && options.comparison > 0) { return "in " + result; } else { return result + " ago"; } } return result; }; ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildFormatLongFn.js function buildFormatLongFn(args) { return (options = {}) => { // TODO: Remove String() const width = options.width ? String(options.width) : args.defaultWidth; const format = args.formats[width] || args.formats[args.defaultWidth]; return format; }; } ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/formatLong.js const dateFormats = { full: "EEEE, MMMM do, y", long: "MMMM do, y", medium: "MMM d, y", short: "MM/dd/yyyy", }; const timeFormats = { full: "h:mm:ss a zzzz", long: "h:mm:ss a z", medium: "h:mm:ss a", short: "h:mm a", }; const dateTimeFormats = { full: "{{date}} 'at' {{time}}", long: "{{date}} 'at' {{time}}", medium: "{{date}}, {{time}}", short: "{{date}}, {{time}}", }; const formatLong = { date: buildFormatLongFn({ formats: dateFormats, defaultWidth: "full", }), time: buildFormatLongFn({ formats: timeFormats, defaultWidth: "full", }), dateTime: buildFormatLongFn({ formats: dateTimeFormats, defaultWidth: "full", }), }; ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/formatRelative.js const formatRelativeLocale = { lastWeek: "'last' eeee 'at' p", yesterday: "'yesterday at' p", today: "'today at' p", tomorrow: "'tomorrow at' p", nextWeek: "eeee 'at' p", other: "P", }; const formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token]; ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildLocalizeFn.js /** * The localize function argument callback which allows to convert raw value to * the actual type. * * @param value - The value to convert * * @returns The converted value */ /** * The map of localized values for each width. */ /** * The index type of the locale unit value. It types conversion of units of * values that don't start at 0 (i.e. quarters). */ /** * Converts the unit value to the tuple of values. */ /** * The tuple of localized era values. The first element represents BC, * the second element represents AD. */ /** * The tuple of localized quarter values. The first element represents Q1. */ /** * The tuple of localized day values. The first element represents Sunday. */ /** * The tuple of localized month values. The first element represents January. */ function buildLocalizeFn(args) { return (value, options) => { const context = options?.context ? String(options.context) : "standalone"; let valuesArray; if (context === "formatting" && args.formattingValues) { const defaultWidth = args.defaultFormattingWidth || args.defaultWidth; const width = options?.width ? String(options.width) : defaultWidth; valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; } else { const defaultWidth = args.defaultWidth; const width = options?.width ? String(options.width) : args.defaultWidth; valuesArray = args.values[width] || args.values[defaultWidth]; } const index = args.argumentCallback ? args.argumentCallback(value) : value; // @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! return valuesArray[index]; }; } ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/localize.js const eraValues = { narrow: ["B", "A"], abbreviated: ["BC", "AD"], wide: ["Before Christ", "Anno Domini"], }; const quarterValues = { narrow: ["1", "2", "3", "4"], abbreviated: ["Q1", "Q2", "Q3", "Q4"], wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"], }; // Note: in English, the names of days of the week and months are capitalized. // If you are making a new locale based on this one, check if the same is true for the language you're working on. // Generally, formatted dates should look like they are in the middle of a sentence, // e.g. in Spanish language the weekdays and months should be in the lowercase. const monthValues = { narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], abbreviated: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ], wide: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ], }; const dayValues = { narrow: ["S", "M", "T", "W", "T", "F", "S"], short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], wide: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", ], }; const dayPeriodValues = { narrow: { am: "a", pm: "p", midnight: "mi", noon: "n", morning: "morning", afternoon: "afternoon", evening: "evening", night: "night", }, abbreviated: { am: "AM", pm: "PM", midnight: "midnight", noon: "noon", morning: "morning", afternoon: "afternoon", evening: "evening", night: "night", }, wide: { am: "a.m.", pm: "p.m.", midnight: "midnight", noon: "noon", morning: "morning", afternoon: "afternoon", evening: "evening", night: "night", }, }; const formattingDayPeriodValues = { narrow: { am: "a", pm: "p", midnight: "mi", noon: "n", morning: "in the morning", afternoon: "in the afternoon", evening: "in the evening", night: "at night", }, abbreviated: { am: "AM", pm: "PM", midnight: "midnight", noon: "noon", morning: "in the morning", afternoon: "in the afternoon", evening: "in the evening", night: "at night", }, wide: { am: "a.m.", pm: "p.m.", midnight: "midnight", noon: "noon", morning: "in the morning", afternoon: "in the afternoon", evening: "in the evening", night: "at night", }, }; const ordinalNumber = (dirtyNumber, _options) => { const number = Number(dirtyNumber); // If ordinal numbers depend on context, for example, // if they are different for different grammatical genders, // use `options.unit`. // // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear', // 'day', 'hour', 'minute', 'second'. const rem100 = number % 100; if (rem100 > 20 || rem100 < 10) { switch (rem100 % 10) { case 1: return number + "st"; case 2: return number + "nd"; case 3: return number + "rd"; } } return number + "th"; }; const localize = { ordinalNumber, era: buildLocalizeFn({ values: eraValues, defaultWidth: "wide", }), quarter: buildLocalizeFn({ values: quarterValues, defaultWidth: "wide", argumentCallback: (quarter) => quarter - 1, }), month: buildLocalizeFn({ values: monthValues, defaultWidth: "wide", }), day: buildLocalizeFn({ values: dayValues, defaultWidth: "wide", }), dayPeriod: buildLocalizeFn({ values: dayPeriodValues, defaultWidth: "wide", formattingValues: formattingDayPeriodValues, defaultFormattingWidth: "wide", }), }; ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildMatchFn.js function buildMatchFn(args) { return (string, options = {}) => { const width = options.width; const matchPattern = (width && args.matchPatterns[width]) || args.matchPatterns[args.defaultMatchWidth]; const matchResult = string.match(matchPattern); if (!matchResult) { return null; } const matchedString = matchResult[0]; const parsePatterns = (width && args.parsePatterns[width]) || args.parsePatterns[args.defaultParseWidth]; const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : // [TODO] -- I challenge you to fix the type findKey(parsePatterns, (pattern) => pattern.test(matchedString)); let value; value = args.valueCallback ? args.valueCallback(key) : key; value = options.valueCallback ? // [TODO] -- I challenge you to fix the type options.valueCallback(value) : value; const rest = string.slice(matchedString.length); return { value, rest }; }; } function findKey(object, predicate) { for (const key in object) { if ( Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key]) ) { return key; } } return undefined; } function findIndex(array, predicate) { for (let key = 0; key < array.length; key++) { if (predicate(array[key])) { return key; } } return undefined; } ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js function buildMatchPatternFn(args) { return (string, options = {}) => { const matchResult = string.match(args.matchPattern); if (!matchResult) return null; const matchedString = matchResult[0]; const parseResult = string.match(args.parsePattern); if (!parseResult) return null; let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; // [TODO] I challenge you to fix the type value = options.valueCallback ? options.valueCallback(value) : value; const rest = string.slice(matchedString.length); return { value, rest }; }; } ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/match.js const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; const parseOrdinalNumberPattern = /\d+/i; const matchEraPatterns = { narrow: /^(b|a)/i, abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, wide: /^(before christ|before common era|anno domini|common era)/i, }; const parseEraPatterns = { any: [/^b/i, /^(a|c)/i], }; const matchQuarterPatterns = { narrow: /^[1234]/i, abbreviated: /^q[1234]/i, wide: /^[1234](th|st|nd|rd)? quarter/i, }; const parseQuarterPatterns = { any: [/1/i, /2/i, /3/i, /4/i], }; const matchMonthPatterns = { narrow: /^[jfmasond]/i, abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i, }; const parseMonthPatterns = { narrow: [ /^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i, ], any: [ /^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i, ], }; const matchDayPatterns = { narrow: /^[smtwf]/i, short: /^(su|mo|tu|we|th|fr|sa)/i, abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i, }; const parseDayPatterns = { narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i], }; const matchDayPeriodPatterns = { narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i, }; const parseDayPeriodPatterns = { any: { am: /^a/i, pm: /^p/i, midnight: /^mi/i, noon: /^no/i, morning: /morning/i, afternoon: /afternoon/i, evening: /evening/i, night: /night/i, }, }; const match_match = { ordinalNumber: buildMatchPatternFn({ matchPattern: matchOrdinalNumberPattern, parsePattern: parseOrdinalNumberPattern, valueCallback: (value) => parseInt(value, 10), }), era: buildMatchFn({ matchPatterns: matchEraPatterns, defaultMatchWidth: "wide", parsePatterns: parseEraPatterns, defaultParseWidth: "any", }), quarter: buildMatchFn({ matchPatterns: matchQuarterPatterns, defaultMatchWidth: "wide", parsePatterns: parseQuarterPatterns, defaultParseWidth: "any", valueCallback: (index) => index + 1, }), month: buildMatchFn({ matchPatterns: matchMonthPatterns, defaultMatchWidth: "wide", parsePatterns: parseMonthPatterns, defaultParseWidth: "any", }), day: buildMatchFn({ matchPatterns: matchDayPatterns, defaultMatchWidth: "wide", parsePatterns: parseDayPatterns, defaultParseWidth: "any", }), dayPeriod: buildMatchFn({ matchPatterns: matchDayPeriodPatterns, defaultMatchWidth: "any", parsePatterns: parseDayPeriodPatterns, defaultParseWidth: "any", }), }; ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US.js /** * @category Locales * @summary English locale (United States). * @language English * @iso-639-2 eng * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp) * @author Lesha Koss [@leshakoss](https://github.com/leshakoss) */ const enUS = { code: "en-US", formatDistance: formatDistance, formatLong: formatLong, formatRelative: formatRelative, localize: localize, match: match_match, options: { weekStartsOn: 0 /* Sunday */, firstWeekContainsDate: 1, }, }; // Fallback for modularized imports: /* harmony default export */ const en_US = ((/* unused pure expression or super */ null && (enUS))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/defaultOptions.js let defaultOptions = {}; function getDefaultOptions() { return defaultOptions; } function setDefaultOptions(newOptions) { defaultOptions = newOptions; } ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js /** * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds. * They usually appear for dates that denote time before the timezones were introduced * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891 * and GMT+01:00:00 after that date) * * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above, * which would lead to incorrect calculations. * * This function returns the timezone offset in milliseconds that takes seconds in account. */ function getTimezoneOffsetInMilliseconds(date) { const _date = toDate(date); const utcDate = new Date( Date.UTC( _date.getFullYear(), _date.getMonth(), _date.getDate(), _date.getHours(), _date.getMinutes(), _date.getSeconds(), _date.getMilliseconds(), ), ); utcDate.setUTCFullYear(_date.getFullYear()); return +date - +utcDate; } ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/normalizeDates.js function normalizeDates(context, ...dates) { const normalize = constructFrom.bind( null, context || dates.find((date) => typeof date === "object"), ); return dates.map(normalize); } ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfDay.js /** * The {@link startOfDay} function options. */ /** * @name startOfDay * @category Day Helpers * @summary Return the start of a day for the given date. * * @description * Return the start of a day for the given date. * The result will be in the local timezone. * * @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). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param date - The original date * @param options - The options * * @returns The start of a day * * @example * // The start of a day for 2 September 2014 11:55:00: * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0)) * //=> Tue Sep 02 2014 00:00:00 */ function startOfDay(date, options) { const _date = toDate(date, options?.in); _date.setHours(0, 0, 0, 0); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfDay = ((/* unused pure expression or super */ null && (startOfDay))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/differenceInCalendarDays.js /** * The {@link differenceInCalendarDays} function options. */ /** * @name differenceInCalendarDays * @category Day Helpers * @summary Get the number of calendar days between the given dates. * * @description * Get the number of calendar days between the given dates. This means that the times are removed * from the dates and then the difference in days is calculated. * * @param laterDate - The later date * @param earlierDate - The earlier date * @param options - The options object * * @returns The number of calendar days * * @example * // How many calendar days are between * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00? * const result = differenceInCalendarDays( * new Date(2012, 6, 2, 0, 0), * new Date(2011, 6, 2, 23, 0) * ) * //=> 366 * // How many calendar days are between * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00? * const result = differenceInCalendarDays( * new Date(2011, 6, 3, 0, 1), * new Date(2011, 6, 2, 23, 59) * ) * //=> 1 */ function differenceInCalendarDays(laterDate, earlierDate, options) { const [laterDate_, earlierDate_] = normalizeDates( options?.in, laterDate, earlierDate, ); const laterStartOfDay = startOfDay(laterDate_); const earlierStartOfDay = startOfDay(earlierDate_); const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay); const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay); // Round the number of days to the nearest integer because the number of // milliseconds in a day is not constant (e.g. it's different in the week of // the daylight saving time clock shift). return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay); } // Fallback for modularized imports: /* harmony default export */ const date_fns_differenceInCalendarDays = ((/* unused pure expression or super */ null && (differenceInCalendarDays))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfYear.js /** * The {@link startOfYear} function options. */ /** * @name startOfYear * @category Year Helpers * @summary Return the start of a year for the given date. * * @description * Return the start of a year for the given date. * The result will be in the local timezone. * * @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). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param date - The original date * @param options - The options * * @returns The start of a year * * @example * // The start of a year for 2 September 2014 11:55:00: * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00)) * //=> Wed Jan 01 2014 00:00:00 */ function startOfYear(date, options) { const date_ = toDate(date, options?.in); date_.setFullYear(date_.getFullYear(), 0, 1); date_.setHours(0, 0, 0, 0); return date_; } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfYear = ((/* unused pure expression or super */ null && (startOfYear))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getDayOfYear.js /** * The {@link getDayOfYear} function options. */ /** * @name getDayOfYear * @category Day Helpers * @summary Get the day of the year of the given date. * * @description * Get the day of the year of the given date. * * @param date - The given date * @param options - The options * * @returns The day of year * * @example * // Which day of the year is 2 July 2014? * const result = getDayOfYear(new Date(2014, 6, 2)) * //=> 183 */ function getDayOfYear(date, options) { const _date = toDate(date, options?.in); const diff = differenceInCalendarDays(_date, startOfYear(_date)); const dayOfYear = diff + 1; return dayOfYear; } // Fallback for modularized imports: /* harmony default export */ const date_fns_getDayOfYear = ((/* unused pure expression or super */ null && (getDayOfYear))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfWeek.js /** * The {@link startOfWeek} function options. */ /** * @name startOfWeek * @category Week Helpers * @summary Return the start of a week for the given date. * * @description * Return the start of a week for the given date. * The result will be in the local timezone. * * @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). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param date - The original date * @param options - An object with options * * @returns The start of a week * * @example * // The start of a week for 2 September 2014 11:55:00: * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0)) * //=> Sun Aug 31 2014 00:00:00 * * @example * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00: * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 }) * //=> Mon Sep 01 2014 00:00:00 */ function startOfWeek(date, options) { const defaultOptions = getDefaultOptions(); const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0; const _date = toDate(date, options?.in); const day = _date.getDay(); const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; _date.setDate(_date.getDate() - diff); _date.setHours(0, 0, 0, 0); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfWeek = ((/* unused pure expression or super */ null && (startOfWeek))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfISOWeek.js /** * The {@link startOfISOWeek} function options. */ /** * @name startOfISOWeek * @category ISO Week Helpers * @summary Return the start of an ISO week for the given date. * * @description * Return the start of an ISO week for the given date. * The result will be in the local timezone. * * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date * * @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). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param date - The original date * @param options - An object with options * * @returns The start of an ISO week * * @example * // The start of an ISO week for 2 September 2014 11:55:00: * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0)) * //=> Mon Sep 01 2014 00:00:00 */ function startOfISOWeek(date, options) { return startOfWeek(date, { ...options, weekStartsOn: 1 }); } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfISOWeek = ((/* unused pure expression or super */ null && (startOfISOWeek))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getISOWeekYear.js /** * The {@link getISOWeekYear} function options. */ /** * @name getISOWeekYear * @category ISO Week-Numbering Year Helpers * @summary Get the ISO week-numbering year of the given date. * * @description * Get the ISO week-numbering year of the given date, * which always starts 3 days before the year's first Thursday. * * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date * * @param date - The given date * * @returns The ISO week-numbering year * * @example * // Which ISO-week numbering year is 2 January 2005? * const result = getISOWeekYear(new Date(2005, 0, 2)) * //=> 2004 */ function getISOWeekYear(date, options) { const _date = toDate(date, options?.in); const year = _date.getFullYear(); const fourthOfJanuaryOfNextYear = constructFrom(_date, 0); fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear); const fourthOfJanuaryOfThisYear = constructFrom(_date, 0); fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear); if (_date.getTime() >= startOfNextYear.getTime()) { return year + 1; } else if (_date.getTime() >= startOfThisYear.getTime()) { return year; } else { return year - 1; } } // Fallback for modularized imports: /* harmony default export */ const date_fns_getISOWeekYear = ((/* unused pure expression or super */ null && (getISOWeekYear))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfISOWeekYear.js /** * The {@link startOfISOWeekYear} function options. */ /** * @name startOfISOWeekYear * @category ISO Week-Numbering Year Helpers * @summary Return the start of an ISO week-numbering year for the given date. * * @description * Return the start of an ISO week-numbering year, * which always starts 3 days before the year's first Thursday. * The result will be in the local timezone. * * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date * * @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). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param date - The original date * @param options - An object with options * * @returns The start of an ISO week-numbering year * * @example * // The start of an ISO week-numbering year for 2 July 2005: * const result = startOfISOWeekYear(new Date(2005, 6, 2)) * //=> Mon Jan 03 2005 00:00:00 */ function startOfISOWeekYear(date, options) { const year = getISOWeekYear(date, options); const fourthOfJanuary = constructFrom(options?.in || date, 0); fourthOfJanuary.setFullYear(year, 0, 4); fourthOfJanuary.setHours(0, 0, 0, 0); return startOfISOWeek(fourthOfJanuary); } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfISOWeekYear = ((/* unused pure expression or super */ null && (startOfISOWeekYear))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getISOWeek.js /** * The {@link getISOWeek} function options. */ /** * @name getISOWeek * @category ISO Week Helpers * @summary Get the ISO week of the given date. * * @description * Get the ISO week of the given date. * * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date * * @param date - The given date * @param options - The options * * @returns The ISO week * * @example * // Which week of the ISO-week numbering year is 2 January 2005? * const result = getISOWeek(new Date(2005, 0, 2)) * //=> 53 */ function getISOWeek(date, options) { const _date = toDate(date, options?.in); const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date); // Round the number of weeks to the nearest integer because the number of // milliseconds in a week is not constant (e.g. it's different in the week of // the daylight saving time clock shift). return Math.round(diff / millisecondsInWeek) + 1; } // Fallback for modularized imports: /* harmony default export */ const date_fns_getISOWeek = ((/* unused pure expression or super */ null && (getISOWeek))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getWeekYear.js /** * The {@link getWeekYear} function options. */ /** * @name getWeekYear * @category Week-Numbering Year Helpers * @summary Get the local week-numbering year of the given date. * * @description * Get the local week-numbering year of the given date. * The exact calculation depends on the values of * `options.weekStartsOn` (which is the index of the first day of the week) * and `options.firstWeekContainsDate` (which is the day of January, which is always in * the first week of the week-numbering year) * * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system * * @param date - The given date * @param options - An object with options. * * @returns The local week-numbering year * * @example * // Which week numbering year is 26 December 2004 with the default settings? * const result = getWeekYear(new Date(2004, 11, 26)) * //=> 2005 * * @example * // Which week numbering year is 26 December 2004 if week starts on Saturday? * const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 }) * //=> 2004 * * @example * // Which week numbering year is 26 December 2004 if the first week contains 4 January? * const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 }) * //=> 2004 */ function getWeekYear(date, options) { const _date = toDate(date, options?.in); const year = _date.getFullYear(); const defaultOptions = getDefaultOptions(); const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1; const firstWeekOfNextYear = constructFrom(options?.in || date, 0); firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate); firstWeekOfNextYear.setHours(0, 0, 0, 0); const startOfNextYear = startOfWeek(firstWeekOfNextYear, options); const firstWeekOfThisYear = constructFrom(options?.in || date, 0); firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate); firstWeekOfThisYear.setHours(0, 0, 0, 0); const startOfThisYear = startOfWeek(firstWeekOfThisYear, options); if (+_date >= +startOfNextYear) { return year + 1; } else if (+_date >= +startOfThisYear) { return year; } else { return year - 1; } } // Fallback for modularized imports: /* harmony default export */ const date_fns_getWeekYear = ((/* unused pure expression or super */ null && (getWeekYear))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfWeekYear.js /** * The {@link startOfWeekYear} function options. */ /** * @name startOfWeekYear * @category Week-Numbering Year Helpers * @summary Return the start of a local week-numbering year for the given date. * * @description * Return the start of a local week-numbering year. * The exact calculation depends on the values of * `options.weekStartsOn` (which is the index of the first day of the week) * and `options.firstWeekContainsDate` (which is the day of January, which is always in * the first week of the week-numbering year) * * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system * * @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). * @typeParam ResultDate - The result `Date` type. * * @param date - The original date * @param options - An object with options * * @returns The start of a week-numbering year * * @example * // The start of an a week-numbering year for 2 July 2005 with default settings: * const result = startOfWeekYear(new Date(2005, 6, 2)) * //=> Sun Dec 26 2004 00:00:00 * * @example * // The start of a week-numbering year for 2 July 2005 * // if Monday is the first day of week * // and 4 January is always in the first week of the year: * const result = startOfWeekYear(new Date(2005, 6, 2), { * weekStartsOn: 1, * firstWeekContainsDate: 4 * }) * //=> Mon Jan 03 2005 00:00:00 */ function startOfWeekYear(date, options) { const defaultOptions = getDefaultOptions(); const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1; const year = getWeekYear(date, options); const firstWeek = constructFrom(options?.in || date, 0); firstWeek.setFullYear(year, 0, firstWeekContainsDate); firstWeek.setHours(0, 0, 0, 0); const _date = startOfWeek(firstWeek, options); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfWeekYear = ((/* unused pure expression or super */ null && (startOfWeekYear))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getWeek.js /** * The {@link getWeek} function options. */ /** * @name getWeek * @category Week Helpers * @summary Get the local week index of the given date. * * @description * Get the local week index of the given date. * The exact calculation depends on the values of * `options.weekStartsOn` (which is the index of the first day of the week) * and `options.firstWeekContainsDate` (which is the day of January, which is always in * the first week of the week-numbering year) * * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system * * @param date - The given date * @param options - An object with options * * @returns The week * * @example * // Which week of the local week numbering year is 2 January 2005 with default options? * const result = getWeek(new Date(2005, 0, 2)) * //=> 2 * * @example * // Which week of the local week numbering year is 2 January 2005, * // if Monday is the first day of the week, * // and the first week of the year always contains 4 January? * const result = getWeek(new Date(2005, 0, 2), { * weekStartsOn: 1, * firstWeekContainsDate: 4 * }) * //=> 53 */ function getWeek(date, options) { const _date = toDate(date, options?.in); const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options); // Round the number of weeks to the nearest integer because the number of // milliseconds in a week is not constant (e.g. it's different in the week of // the daylight saving time clock shift). return Math.round(diff / millisecondsInWeek) + 1; } // Fallback for modularized imports: /* harmony default export */ const date_fns_getWeek = ((/* unused pure expression or super */ null && (getWeek))); ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/addLeadingZeros.js function addLeadingZeros(number, targetLength) { const sign = number < 0 ? "-" : ""; const output = Math.abs(number).toString().padStart(targetLength, "0"); return sign + output; } ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/format/lightFormatters.js /* * | | Unit | | Unit | * |-----|--------------------------------|-----|--------------------------------| * | a | AM, PM | A* | | * | d | Day of month | D | | * | h | Hour [1-12] | H | Hour [0-23] | * | m | Minute | M | Month | * | s | Second | S | Fraction of second | * | y | Year (abs) | Y | | * * Letters marked by * are not implemented but reserved by Unicode standard. */ const lightFormatters = { // Year y(date, token) { // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens // | Year | y | yy | yyy | yyyy | yyyyy | // |----------|-------|----|-------|-------|-------| // | AD 1 | 1 | 01 | 001 | 0001 | 00001 | // | AD 12 | 12 | 12 | 012 | 0012 | 00012 | // | AD 123 | 123 | 23 | 123 | 0123 | 00123 | // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 | // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 | const signedYear = date.getFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript) const year = signedYear > 0 ? signedYear : 1 - signedYear; return addLeadingZeros(token === "yy" ? year % 100 : year, token.length); }, // Month M(date, token) { const month = date.getMonth(); return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2); }, // Day of the month d(date, token) { return addLeadingZeros(date.getDate(), token.length); }, // AM or PM a(date, token) { const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am"; switch (token) { case "a": case "aa": return dayPeriodEnumValue.toUpperCase(); case "aaa": return dayPeriodEnumValue; case "aaaaa": return dayPeriodEnumValue[0]; case "aaaa": default: return dayPeriodEnumValue === "am" ? "a.m." : "p.m."; } }, // Hour [1-12] h(date, token) { return addLeadingZeros(date.getHours() % 12 || 12, token.length); }, // Hour [0-23] H(date, token) { return addLeadingZeros(date.getHours(), token.length); }, // Minute m(date, token) { return addLeadingZeros(date.getMinutes(), token.length); }, // Second s(date, token) { return addLeadingZeros(date.getSeconds(), token.length); }, // Fraction of second S(date, token) { const numberOfDigits = token.length; const milliseconds = date.getMilliseconds(); const fractionalSeconds = Math.trunc( milliseconds * Math.pow(10, numberOfDigits - 3), ); return addLeadingZeros(fractionalSeconds, token.length); }, }; ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/format/formatters.js const dayPeriodEnum = { am: "am", pm: "pm", midnight: "midnight", noon: "noon", morning: "morning", afternoon: "afternoon", evening: "evening", night: "night", }; /* * | | Unit | | Unit | * |-----|--------------------------------|-----|--------------------------------| * | a | AM, PM | A* | Milliseconds in day | * | b | AM, PM, noon, midnight | B | Flexible day period | * | c | Stand-alone local day of week | C* | Localized hour w/ day period | * | d | Day of month | D | Day of year | * | e | Local day of week | E | Day of week | * | f | | F* | Day of week in month | * | g* | Modified Julian day | G | Era | * | h | Hour [1-12] | H | Hour [0-23] | * | i! | ISO day of week | I! | ISO week of year | * | j* | Localized hour w/ day period | J* | Localized hour w/o day period | * | k | Hour [1-24] | K | Hour [0-11] | * | l* | (deprecated) | L | Stand-alone month | * | m | Minute | M | Month | * | n | | N | | * | o! | Ordinal number modifier | O | Timezone (GMT) | * | p! | Long localized time | P! | Long localized date | * | q | Stand-alone quarter | Q | Quarter | * | r* | Related Gregorian year | R! | ISO week-numbering year | * | s | Second | S | Fraction of second | * | t! | Seconds timestamp | T! | Milliseconds timestamp | * | u | Extended year | U* | Cyclic year | * | v* | Timezone (generic non-locat.) | V* | Timezone (location) | * | w | Local week of year | W* | Week of month | * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) | * | y | Year (abs) | Y | Local week-numbering year | * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) | * * Letters marked by * are not implemented but reserved by Unicode standard. * * Letters marked by ! are non-standard, but implemented by date-fns: * - `o` modifies the previous token to turn it into an ordinal (see `format` docs) * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days, * i.e. 7 for Sunday, 1 for Monday, etc. * - `I` is ISO week of year, as opposed to `w` which is local week of year. * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year. * `R` is supposed to be used in conjunction with `I` and `i` * for universal ISO week-numbering date, whereas * `Y` is supposed to be used in conjunction with `w` and `e` * for week-numbering date specific to the locale. * - `P` is long localized date format * - `p` is long localized time format */ const formatters = { // Era G: function (date, token, localize) { const era = date.getFullYear() > 0 ? 1 : 0; switch (token) { // AD, BC case "G": case "GG": case "GGG": return localize.era(era, { width: "abbreviated" }); // A, B case "GGGGG": return localize.era(era, { width: "narrow" }); // Anno Domini, Before Christ case "GGGG": default: return localize.era(era, { width: "wide" }); } }, // Year y: function (date, token, localize) { // Ordinal number if (token === "yo") { const signedYear = date.getFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript) const year = signedYear > 0 ? signedYear : 1 - signedYear; return localize.ordinalNumber(year, { unit: "year" }); } return lightFormatters.y(date, token); }, // Local week-numbering year Y: function (date, token, localize, options) { const signedWeekYear = getWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript) const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year if (token === "YY") { const twoDigitYear = weekYear % 100; return addLeadingZeros(twoDigitYear, 2); } // Ordinal number if (token === "Yo") { return localize.ordinalNumber(weekYear, { unit: "year" }); } // Padding return addLeadingZeros(weekYear, token.length); }, // ISO week-numbering year R: function (date, token) { const isoWeekYear = getISOWeekYear(date); // Padding return addLeadingZeros(isoWeekYear, token.length); }, // Extended year. This is a single number designating the year of this calendar system. // The main difference between `y` and `u` localizers are B.C. years: // | Year | `y` | `u` | // |------|-----|-----| // | AC 1 | 1 | 1 | // | BC 1 | 1 | 0 | // | BC 2 | 2 | -1 | // Also `yy` always returns the last two digits of a year, // while `uu` pads single digit years to 2 characters and returns other years unchanged. u: function (date, token) { const year = date.getFullYear(); return addLeadingZeros(year, token.length); }, // Quarter Q: function (date, token, localize) { const quarter = Math.ceil((date.getMonth() + 1) / 3); switch (token) { // 1, 2, 3, 4 case "Q": return String(quarter); // 01, 02, 03, 04 case "QQ": return addLeadingZeros(quarter, 2); // 1st, 2nd, 3rd, 4th case "Qo": return localize.ordinalNumber(quarter, { unit: "quarter" }); // Q1, Q2, Q3, Q4 case "QQQ": return localize.quarter(quarter, { width: "abbreviated", context: "formatting", }); // 1, 2, 3, 4 (narrow quarter; could be not numerical) case "QQQQQ": return localize.quarter(quarter, { width: "narrow", context: "formatting", }); // 1st quarter, 2nd quarter, ... case "QQQQ": default: return localize.quarter(quarter, { width: "wide", context: "formatting", }); } }, // Stand-alone quarter q: function (date, token, localize) { const quarter = Math.ceil((date.getMonth() + 1) / 3); switch (token) { // 1, 2, 3, 4 case "q": return String(quarter); // 01, 02, 03, 04 case "qq": return addLeadingZeros(quarter, 2); // 1st, 2nd, 3rd, 4th case "qo": return localize.ordinalNumber(quarter, { unit: "quarter" }); // Q1, Q2, Q3, Q4 case "qqq": return localize.quarter(quarter, { width: "abbreviated", context: "standalone", }); // 1, 2, 3, 4 (narrow quarter; could be not numerical) case "qqqqq": return localize.quarter(quarter, { width: "narrow", context: "standalone", }); // 1st quarter, 2nd quarter, ... case "qqqq": default: return localize.quarter(quarter, { width: "wide", context: "standalone", }); } }, // Month M: function (date, token, localize) { const month = date.getMonth(); switch (token) { case "M": case "MM": return lightFormatters.M(date, token); // 1st, 2nd, ..., 12th case "Mo": return localize.ordinalNumber(month + 1, { unit: "month" }); // Jan, Feb, ..., Dec case "MMM": return localize.month(month, { width: "abbreviated", context: "formatting", }); // J, F, ..., D case "MMMMM": return localize.month(month, { width: "narrow", context: "formatting", }); // January, February, ..., December case "MMMM": default: return localize.month(month, { width: "wide", context: "formatting" }); } }, // Stand-alone month L: function (date, token, localize) { const month = date.getMonth(); switch (token) { // 1, 2, ..., 12 case "L": return String(month + 1); // 01, 02, ..., 12 case "LL": return addLeadingZeros(month + 1, 2); // 1st, 2nd, ..., 12th case "Lo": return localize.ordinalNumber(month + 1, { unit: "month" }); // Jan, Feb, ..., Dec case "LLL": return localize.month(month, { width: "abbreviated", context: "standalone", }); // J, F, ..., D case "LLLLL": return localize.month(month, { width: "narrow", context: "standalone", }); // January, February, ..., December case "LLLL": default: return localize.month(month, { width: "wide", context: "standalone" }); } }, // Local week of year w: function (date, token, localize, options) { const week = getWeek(date, options); if (token === "wo") { return localize.ordinalNumber(week, { unit: "week" }); } return addLeadingZeros(week, token.length); }, // ISO week of year I: function (date, token, localize) { const isoWeek = getISOWeek(date); if (token === "Io") { return localize.ordinalNumber(isoWeek, { unit: "week" }); } return addLeadingZeros(isoWeek, token.length); }, // Day of the month d: function (date, token, localize) { if (token === "do") { return localize.ordinalNumber(date.getDate(), { unit: "date" }); } return lightFormatters.d(date, token); }, // Day of year D: function (date, token, localize) { const dayOfYear = getDayOfYear(date); if (token === "Do") { return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" }); } return addLeadingZeros(dayOfYear, token.length); }, // Day of week E: function (date, token, localize) { const dayOfWeek = date.getDay(); switch (token) { // Tue case "E": case "EE": case "EEE": return localize.day(dayOfWeek, { width: "abbreviated", context: "formatting", }); // T case "EEEEE": return localize.day(dayOfWeek, { width: "narrow", context: "formatting", }); // Tu case "EEEEEE": return localize.day(dayOfWeek, { width: "short", context: "formatting", }); // Tuesday case "EEEE": default: return localize.day(dayOfWeek, { width: "wide", context: "formatting", }); } }, // Local day of week e: function (date, token, localize, options) { const dayOfWeek = date.getDay(); const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; switch (token) { // Numerical value (Nth day of week with current locale or weekStartsOn) case "e": return String(localDayOfWeek); // Padded numerical value case "ee": return addLeadingZeros(localDayOfWeek, 2); // 1st, 2nd, ..., 7th case "eo": return localize.ordinalNumber(localDayOfWeek, { unit: "day" }); case "eee": return localize.day(dayOfWeek, { width: "abbreviated", context: "formatting", }); // T case "eeeee": return localize.day(dayOfWeek, { width: "narrow", context: "formatting", }); // Tu case "eeeeee": return localize.day(dayOfWeek, { width: "short", context: "formatting", }); // Tuesday case "eeee": default: return localize.day(dayOfWeek, { width: "wide", context: "formatting", }); } }, // Stand-alone local day of week c: function (date, token, localize, options) { const dayOfWeek = date.getDay(); const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; switch (token) { // Numerical value (same as in `e`) case "c": return String(localDayOfWeek); // Padded numerical value case "cc": return addLeadingZeros(localDayOfWeek, token.length); // 1st, 2nd, ..., 7th case "co": return localize.ordinalNumber(localDayOfWeek, { unit: "day" }); case "ccc": return localize.day(dayOfWeek, { width: "abbreviated", context: "standalone", }); // T case "ccccc": return localize.day(dayOfWeek, { width: "narrow", context: "standalone", }); // Tu case "cccccc": return localize.day(dayOfWeek, { width: "short", context: "standalone", }); // Tuesday case "cccc": default: return localize.day(dayOfWeek, { width: "wide", context: "standalone", }); } }, // ISO day of week i: function (date, token, localize) { const dayOfWeek = date.getDay(); const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; switch (token) { // 2 case "i": return String(isoDayOfWeek); // 02 case "ii": return addLeadingZeros(isoDayOfWeek, token.length); // 2nd case "io": return localize.ordinalNumber(isoDayOfWeek, { unit: "day" }); // Tue case "iii": return localize.day(dayOfWeek, { width: "abbreviated", context: "formatting", }); // T case "iiiii": return localize.day(dayOfWeek, { width: "narrow", context: "formatting", }); // Tu case "iiiiii": return localize.day(dayOfWeek, { width: "short", context: "formatting", }); // Tuesday case "iiii": default: return localize.day(dayOfWeek, { width: "wide", context: "formatting", }); } }, // AM or PM a: function (date, token, localize) { const hours = date.getHours(); const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; switch (token) { case "a": case "aa": return localize.dayPeriod(dayPeriodEnumValue, { width: "abbreviated", context: "formatting", }); case "aaa": return localize .dayPeriod(dayPeriodEnumValue, { width: "abbreviated", context: "formatting", }) .toLowerCase(); case "aaaaa": return localize.dayPeriod(dayPeriodEnumValue, { width: "narrow", context: "formatting", }); case "aaaa": default: return localize.dayPeriod(dayPeriodEnumValue, { width: "wide", context: "formatting", }); } }, // AM, PM, midnight, noon b: function (date, token, localize) { const hours = date.getHours(); let dayPeriodEnumValue; if (hours === 12) { dayPeriodEnumValue = dayPeriodEnum.noon; } else if (hours === 0) { dayPeriodEnumValue = dayPeriodEnum.midnight; } else { dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; } switch (token) { case "b": case "bb": return localize.dayPeriod(dayPeriodEnumValue, { width: "abbreviated", context: "formatting", }); case "bbb": return localize .dayPeriod(dayPeriodEnumValue, { width: "abbreviated", context: "formatting", }) .toLowerCase(); case "bbbbb": return localize.dayPeriod(dayPeriodEnumValue, { width: "narrow", context: "formatting", }); case "bbbb": default: return localize.dayPeriod(dayPeriodEnumValue, { width: "wide", context: "formatting", }); } }, // in the morning, in the afternoon, in the evening, at night B: function (date, token, localize) { const hours = date.getHours(); let dayPeriodEnumValue; if (hours >= 17) { dayPeriodEnumValue = dayPeriodEnum.evening; } else if (hours >= 12) { dayPeriodEnumValue = dayPeriodEnum.afternoon; } else if (hours >= 4) { dayPeriodEnumValue = dayPeriodEnum.morning; } else { dayPeriodEnumValue = dayPeriodEnum.night; } switch (token) { case "B": case "BB": case "BBB": return localize.dayPeriod(dayPeriodEnumValue, { width: "abbreviated", context: "formatting", }); case "BBBBB": return localize.dayPeriod(dayPeriodEnumValue, { width: "narrow", context: "formatting", }); case "BBBB": default: return localize.dayPeriod(dayPeriodEnumValue, { width: "wide", context: "formatting", }); } }, // Hour [1-12] h: function (date, token, localize) { if (token === "ho") { let hours = date.getHours() % 12; if (hours === 0) hours = 12; return localize.ordinalNumber(hours, { unit: "hour" }); } return lightFormatters.h(date, token); }, // Hour [0-23] H: function (date, token, localize) { if (token === "Ho") { return localize.ordinalNumber(date.getHours(), { unit: "hour" }); } return lightFormatters.H(date, token); }, // Hour [0-11] K: function (date, token, localize) { const hours = date.getHours() % 12; if (token === "Ko") { return localize.ordinalNumber(hours, { unit: "hour" }); } return addLeadingZeros(hours, token.length); }, // Hour [1-24] k: function (date, token, localize) { let hours = date.getHours(); if (hours === 0) hours = 24; if (token === "ko") { return localize.ordinalNumber(hours, { unit: "hour" }); } return addLeadingZeros(hours, token.length); }, // Minute m: function (date, token, localize) { if (token === "mo") { return localize.ordinalNumber(date.getMinutes(), { unit: "minute" }); } return lightFormatters.m(date, token); }, // Second s: function (date, token, localize) { if (token === "so") { return localize.ordinalNumber(date.getSeconds(), { unit: "second" }); } return lightFormatters.s(date, token); }, // Fraction of second S: function (date, token) { return lightFormatters.S(date, token); }, // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) X: function (date, token, _localize) { const timezoneOffset = date.getTimezoneOffset(); if (timezoneOffset === 0) { return "Z"; } switch (token) { // Hours and optional minutes case "X": return formatTimezoneWithOptionalMinutes(timezoneOffset); // Hours, minutes and optional seconds without `:` delimiter // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets // so this token always has the same output as `XX` case "XXXX": case "XX": // Hours and minutes without `:` delimiter return formatTimezone(timezoneOffset); // Hours, minutes and optional seconds with `:` delimiter // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets // so this token always has the same output as `XXX` case "XXXXX": case "XXX": // Hours and minutes with `:` delimiter default: return formatTimezone(timezoneOffset, ":"); } }, // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) x: function (date, token, _localize) { const timezoneOffset = date.getTimezoneOffset(); switch (token) { // Hours and optional minutes case "x": return formatTimezoneWithOptionalMinutes(timezoneOffset); // Hours, minutes and optional seconds without `:` delimiter // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets // so this token always has the same output as `xx` case "xxxx": case "xx": // Hours and minutes without `:` delimiter return formatTimezone(timezoneOffset); // Hours, minutes and optional seconds with `:` delimiter // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets // so this token always has the same output as `xxx` case "xxxxx": case "xxx": // Hours and minutes with `:` delimiter default: return formatTimezone(timezoneOffset, ":"); } }, // Timezone (GMT) O: function (date, token, _localize) { const timezoneOffset = date.getTimezoneOffset(); switch (token) { // Short case "O": case "OO": case "OOO": return "GMT" + formatTimezoneShort(timezoneOffset, ":"); // Long case "OOOO": default: return "GMT" + formatTimezone(timezoneOffset, ":"); } }, // Timezone (specific non-location) z: function (date, token, _localize) { const timezoneOffset = date.getTimezoneOffset(); switch (token) { // Short case "z": case "zz": case "zzz": return "GMT" + formatTimezoneShort(timezoneOffset, ":"); // Long case "zzzz": default: return "GMT" + formatTimezone(timezoneOffset, ":"); } }, // Seconds timestamp t: function (date, token, _localize) { const timestamp = Math.trunc(+date / 1000); return addLeadingZeros(timestamp, token.length); }, // Milliseconds timestamp T: function (date, token, _localize) { return addLeadingZeros(+date, token.length); }, }; function formatTimezoneShort(offset, delimiter = "") { const sign = offset > 0 ? "-" : "+"; const absOffset = Math.abs(offset); const hours = Math.trunc(absOffset / 60); const minutes = absOffset % 60; if (minutes === 0) { return sign + String(hours); } return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2); } function formatTimezoneWithOptionalMinutes(offset, delimiter) { if (offset % 60 === 0) { const sign = offset > 0 ? "-" : "+"; return sign + addLeadingZeros(Math.abs(offset) / 60, 2); } return formatTimezone(offset, delimiter); } function formatTimezone(offset, delimiter = "") { const sign = offset > 0 ? "-" : "+"; const absOffset = Math.abs(offset); const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2); const minutes = addLeadingZeros(absOffset % 60, 2); return sign + hours + delimiter + minutes; } ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/format/longFormatters.js const dateLongFormatter = (pattern, formatLong) => { switch (pattern) { case "P": return formatLong.date({ width: "short" }); case "PP": return formatLong.date({ width: "medium" }); case "PPP": return formatLong.date({ width: "long" }); case "PPPP": default: return formatLong.date({ width: "full" }); } }; const timeLongFormatter = (pattern, formatLong) => { switch (pattern) { case "p": return formatLong.time({ width: "short" }); case "pp": return formatLong.time({ width: "medium" }); case "ppp": return formatLong.time({ width: "long" }); case "pppp": default: return formatLong.time({ width: "full" }); } }; const dateTimeLongFormatter = (pattern, formatLong) => { const matchResult = pattern.match(/(P+)(p+)?/) || []; const datePattern = matchResult[1]; const timePattern = matchResult[2]; if (!timePattern) { return dateLongFormatter(pattern, formatLong); } let dateTimeFormat; switch (datePattern) { case "P": dateTimeFormat = formatLong.dateTime({ width: "short" }); break; case "PP": dateTimeFormat = formatLong.dateTime({ width: "medium" }); break; case "PPP": dateTimeFormat = formatLong.dateTime({ width: "long" }); break; case "PPPP": default: dateTimeFormat = formatLong.dateTime({ width: "full" }); break; } return dateTimeFormat .replace("{{date}}", dateLongFormatter(datePattern, formatLong)) .replace("{{time}}", timeLongFormatter(timePattern, formatLong)); }; const longFormatters = { p: timeLongFormatter, P: dateTimeLongFormatter, }; ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/protectedTokens.js const dayOfYearTokenRE = /^D+$/; const weekYearTokenRE = /^Y+$/; const throwTokens = ["D", "DD", "YY", "YYYY"]; function isProtectedDayOfYearToken(token) { return dayOfYearTokenRE.test(token); } function isProtectedWeekYearToken(token) { return weekYearTokenRE.test(token); } function warnOrThrowProtectedError(token, format, input) { const _message = message(token, format, input); console.warn(_message); if (throwTokens.includes(token)) throw new RangeError(_message); } function message(token, format, input) { const subject = token[0] === "Y" ? "years" : "days of the month"; 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`; } ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/format.js // Rexports of internal for libraries to use. // See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874 // This RegExp consists of three parts separated by `|`: // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token // (one of the certain letters followed by `o`) // - (\w)\1* matches any sequences of the same letter // - '' matches two quote characters in a row // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('), // except a single quote symbol, which ends the sequence. // Two quote characters do not end the sequence. // If there is no matching single quote // then the sequence will continue until the end of the string. // - . matches any single character unmatched by previous parts of the RegExps const formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also // sequences of symbols P, p, and the combinations like `PPPPPPPppppp` const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; const escapedStringRegExp = /^'([^]*?)'?$/; const doubleQuoteRegExp = /''/g; const unescapedLatinCharacterRegExp = /[a-zA-Z]/; /** * The {@link format} function options. */ /** * @name format * @alias formatDate * @category Common Helpers * @summary Format the date. * * @description * Return the formatted date string in the given format. The result may vary by locale. * * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries. * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md * * The characters wrapped between two single quotes characters (') are escaped. * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote. * (see the last example) * * Format of the string is based on Unicode Technical Standard #35: * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table * with a few additions (see note 7 below the table). * * Accepted patterns: * | Unit | Pattern | Result examples | Notes | * |---------------------------------|---------|-----------------------------------|-------| * | Era | G..GGG | AD, BC | | * | | GGGG | Anno Domini, Before Christ | 2 | * | | GGGGG | A, B | | * | Calendar year | y | 44, 1, 1900, 2017 | 5 | * | | yo | 44th, 1st, 0th, 17th | 5,7 | * | | yy | 44, 01, 00, 17 | 5 | * | | yyy | 044, 001, 1900, 2017 | 5 | * | | yyyy | 0044, 0001, 1900, 2017 | 5 | * | | yyyyy | ... | 3,5 | * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 | * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 | * | | YY | 44, 01, 00, 17 | 5,8 | * | | YYY | 044, 001, 1900, 2017 | 5 | * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 | * | | YYYYY | ... | 3,5 | * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 | * | | RR | -43, 00, 01, 1900, 2017 | 5,7 | * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 | * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 | * | | RRRRR | ... | 3,5,7 | * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 | * | | uu | -43, 01, 1900, 2017 | 5 | * | | uuu | -043, 001, 1900, 2017 | 5 | * | | uuuu | -0043, 0001, 1900, 2017 | 5 | * | | uuuuu | ... | 3,5 | * | Quarter (formatting) | Q | 1, 2, 3, 4 | | * | | Qo | 1st, 2nd, 3rd, 4th | 7 | * | | QQ | 01, 02, 03, 04 | | * | | QQQ | Q1, Q2, Q3, Q4 | | * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 | * | | QQQQQ | 1, 2, 3, 4 | 4 | * | Quarter (stand-alone) | q | 1, 2, 3, 4 | | * | | qo | 1st, 2nd, 3rd, 4th | 7 | * | | qq | 01, 02, 03, 04 | | * | | qqq | Q1, Q2, Q3, Q4 | | * | | qqqq | 1st quarter, 2nd quarter, ... | 2 | * | | qqqqq | 1, 2, 3, 4 | 4 | * | Month (formatting) | M | 1, 2, ..., 12 | | * | | Mo | 1st, 2nd, ..., 12th | 7 | * | | MM | 01, 02, ..., 12 | | * | | MMM | Jan, Feb, ..., Dec | | * | | MMMM | January, February, ..., December | 2 | * | | MMMMM | J, F, ..., D | | * | Month (stand-alone) | L | 1, 2, ..., 12 | | * | | Lo | 1st, 2nd, ..., 12th | 7 | * | | LL | 01, 02, ..., 12 | | * | | LLL | Jan, Feb, ..., Dec | | * | | LLLL | January, February, ..., December | 2 | * | | LLLLL | J, F, ..., D | | * | Local week of year | w | 1, 2, ..., 53 | | * | | wo | 1st, 2nd, ..., 53th | 7 | * | | ww | 01, 02, ..., 53 | | * | ISO week of year | I | 1, 2, ..., 53 | 7 | * | | Io | 1st, 2nd, ..., 53th | 7 | * | | II | 01, 02, ..., 53 | 7 | * | Day of month | d | 1, 2, ..., 31 | | * | | do | 1st, 2nd, ..., 31st | 7 | * | | dd | 01, 02, ..., 31 | | * | Day of year | D | 1, 2, ..., 365, 366 | 9 | * | | Do | 1st, 2nd, ..., 365th, 366th | 7 | * | | DD | 01, 02, ..., 365, 366 | 9 | * | | DDD | 001, 002, ..., 365, 366 | | * | | DDDD | ... | 3 | * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | | * | | EEEE | Monday, Tuesday, ..., Sunday | 2 | * | | EEEEE | M, T, W, T, F, S, S | | * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | | * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 | * | | io | 1st, 2nd, ..., 7th | 7 | * | | ii | 01, 02, ..., 07 | 7 | * | | iii | Mon, Tue, Wed, ..., Sun | 7 | * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 | * | | iiiii | M, T, W, T, F, S, S | 7 | * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 | * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | | * | | eo | 2nd, 3rd, ..., 1st | 7 | * | | ee | 02, 03, ..., 01 | | * | | eee | Mon, Tue, Wed, ..., Sun | | * | | eeee | Monday, Tuesday, ..., Sunday | 2 | * | | eeeee | M, T, W, T, F, S, S | | * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | | * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | | * | | co | 2nd, 3rd, ..., 1st | 7 | * | | cc | 02, 03, ..., 01 | | * | | ccc | Mon, Tue, Wed, ..., Sun | | * | | cccc | Monday, Tuesday, ..., Sunday | 2 | * | | ccccc | M, T, W, T, F, S, S | | * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | | * | AM, PM | a..aa | AM, PM | | * | | aaa | am, pm | | * | | aaaa | a.m., p.m. | 2 | * | | aaaaa | a, p | | * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | | * | | bbb | am, pm, noon, midnight | | * | | bbbb | a.m., p.m., noon, midnight | 2 | * | | bbbbb | a, p, n, mi | | * | Flexible day period | B..BBB | at night, in the morning, ... | | * | | BBBB | at night, in the morning, ... | 2 | * | | BBBBB | at night, in the morning, ... | | * | Hour [1-12] | h | 1, 2, ..., 11, 12 | | * | | ho | 1st, 2nd, ..., 11th, 12th | 7 | * | | hh | 01, 02, ..., 11, 12 | | * | Hour [0-23] | H | 0, 1, 2, ..., 23 | | * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 | * | | HH | 00, 01, 02, ..., 23 | | * | Hour [0-11] | K | 1, 2, ..., 11, 0 | | * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 | * | | KK | 01, 02, ..., 11, 00 | | * | Hour [1-24] | k | 24, 1, 2, ..., 23 | | * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 | * | | kk | 24, 01, 02, ..., 23 | | * | Minute | m | 0, 1, ..., 59 | | * | | mo | 0th, 1st, ..., 59th | 7 | * | | mm | 00, 01, ..., 59 | | * | Second | s | 0, 1, ..., 59 | | * | | so | 0th, 1st, ..., 59th | 7 | * | | ss | 00, 01, ..., 59 | | * | Fraction of second | S | 0, 1, ..., 9 | | * | | SS | 00, 01, ..., 99 | | * | | SSS | 000, 001, ..., 999 | | * | | SSSS | ... | 3 | * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | | * | | XX | -0800, +0530, Z | | * | | XXX | -08:00, +05:30, Z | | * | | XXXX | -0800, +0530, Z, +123456 | 2 | * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | | * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | | * | | xx | -0800, +0530, +0000 | | * | | xxx | -08:00, +05:30, +00:00 | 2 | * | | xxxx | -0800, +0530, +0000, +123456 | | * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | | * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | | * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 | * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 | * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 | * | Seconds timestamp | t | 512969520 | 7 | * | | tt | ... | 3,7 | * | Milliseconds timestamp | T | 512969520900 | 7 | * | | TT | ... | 3,7 | * | Long localized date | P | 04/29/1453 | 7 | * | | PP | Apr 29, 1453 | 7 | * | | PPP | April 29th, 1453 | 7 | * | | PPPP | Friday, April 29th, 1453 | 2,7 | * | Long localized time | p | 12:00 AM | 7 | * | | pp | 12:00:00 AM | 7 | * | | ppp | 12:00:00 AM GMT+2 | 7 | * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 | * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 | * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 | * | | PPPppp | April 29th, 1453 at ... | 7 | * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 | * Notes: * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale * are the same as "stand-alone" units, but are different in some languages. * "Formatting" units are declined according to the rules of the language * in the context of a date. "Stand-alone" units are always nominative singular: * * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'` * * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'` * * 2. Any sequence of the identical letters is a pattern, unless it is escaped by * the single quote characters (see below). * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`) * the output will be the same as default pattern for this unit, usually * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units * are marked with "2" in the last column of the table. * * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'` * * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'` * * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'` * * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'` * * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'` * * 3. Some patterns could be unlimited length (such as `yyyyyyyy`). * The output will be padded with zeros to match the length of the pattern. * * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'` * * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales. * These tokens represent the shortest form of the quarter. * * 5. The main difference between `y` and `u` patterns are B.C. years: * * | Year | `y` | `u` | * |------|-----|-----| * | AC 1 | 1 | 1 | * | BC 1 | 1 | 0 | * | BC 2 | 2 | -1 | * * Also `yy` always returns the last two digits of a year, * while `uu` pads single digit years to 2 characters and returns other years unchanged: * * | Year | `yy` | `uu` | * |------|------|------| * | 1 | 01 | 01 | * | 14 | 14 | 14 | * | 376 | 76 | 376 | * | 1453 | 53 | 1453 | * * The same difference is true for local and ISO week-numbering years (`Y` and `R`), * except local week-numbering years are dependent on `options.weekStartsOn` * and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear) * and [getWeekYear](https://date-fns.org/docs/getWeekYear)). * * 6. Specific non-location timezones are currently unavailable in `date-fns`, * so right now these tokens fall back to GMT timezones. * * 7. These patterns are not in the Unicode Technical Standard #35: * - `i`: ISO day of week * - `I`: ISO week of year * - `R`: ISO week-numbering year * - `t`: seconds timestamp * - `T`: milliseconds timestamp * - `o`: ordinal number modifier * - `P`: long localized date * - `p`: long localized time * * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years. * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md * * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month. * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md * * @param date - The original date * @param format - The string of tokens * @param options - An object with options * * @returns The formatted date string * * @throws `date` must not be Invalid Date * @throws `options.locale` must contain `localize` property * @throws `options.locale` must contain `formatLong` property * @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 * @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 * @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 * @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 * @throws format string contains an unescaped latin alphabet character * * @example * // Represent 11 February 2014 in middle-endian format: * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy') * //=> '02/11/2014' * * @example * // Represent 2 July 2014 in Esperanto: * import { eoLocale } from 'date-fns/locale/eo' * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", { * locale: eoLocale * }) * //=> '2-a de julio 2014' * * @example * // Escape string by single quote characters: * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'") * //=> "3 o'clock" */ function format(date, formatStr, options) { const defaultOptions = getDefaultOptions(); const locale = options?.locale ?? defaultOptions.locale ?? enUS; const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1; const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0; const originalDate = toDate(date, options?.in); if (!isValid(originalDate)) { throw new RangeError("Invalid time value"); } let parts = formatStr .match(longFormattingTokensRegExp) .map((substring) => { const firstCharacter = substring[0]; if (firstCharacter === "p" || firstCharacter === "P") { const longFormatter = longFormatters[firstCharacter]; return longFormatter(substring, locale.formatLong); } return substring; }) .join("") .match(formattingTokensRegExp) .map((substring) => { // Replace two single quote characters with one single quote character if (substring === "''") { return { isToken: false, value: "'" }; } const firstCharacter = substring[0]; if (firstCharacter === "'") { return { isToken: false, value: cleanEscapedString(substring) }; } if (formatters[firstCharacter]) { return { isToken: true, value: substring }; } if (firstCharacter.match(unescapedLatinCharacterRegExp)) { throw new RangeError( "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`", ); } return { isToken: false, value: substring }; }); // invoke localize preprocessor (only for french locales at the moment) if (locale.localize.preprocessor) { parts = locale.localize.preprocessor(originalDate, parts); } const formatterOptions = { firstWeekContainsDate, weekStartsOn, locale, }; return parts .map((part) => { if (!part.isToken) return part.value; const token = part.value; if ( (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token)) || (!options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) ) { warnOrThrowProtectedError(token, formatStr, String(date)); } const formatter = formatters[token[0]]; return formatter(originalDate, token, locale.localize, formatterOptions); }) .join(""); } function cleanEscapedString(input) { const matched = input.match(escapedStringRegExp); if (!matched) { return input; } return matched[1].replace(doubleQuoteRegExp, "'"); } // Fallback for modularized imports: /* harmony default export */ const date_fns_format = ((/* unused pure expression or super */ null && (format))); ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/relative-date-control.js const TIME_UNITS_OPTIONS = { [OPERATOR_IN_THE_PAST]: [ { value: "days", label: (0,external_wp_i18n_namespaceObject.__)("Days") }, { value: "weeks", label: (0,external_wp_i18n_namespaceObject.__)("Weeks") }, { value: "months", label: (0,external_wp_i18n_namespaceObject.__)("Months") }, { value: "years", label: (0,external_wp_i18n_namespaceObject.__)("Years") } ], [OPERATOR_OVER]: [ { value: "days", label: (0,external_wp_i18n_namespaceObject.__)("Days ago") }, { value: "weeks", label: (0,external_wp_i18n_namespaceObject.__)("Weeks ago") }, { value: "months", label: (0,external_wp_i18n_namespaceObject.__)("Months ago") }, { value: "years", label: (0,external_wp_i18n_namespaceObject.__)("Years ago") } ] }; function RelativeDateControl({ className, data, field, onChange, hideLabelFromVision, operator }) { const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"]; const { id, label, getValue, setValue } = field; const fieldValue = getValue({ item: data }); const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {}; const onChangeValue = (0,external_wp_element_.useCallback)( (newValue) => onChange( setValue({ item: data, value: { value: Number(newValue), unit } }) ), [onChange, setValue, data, unit] ); const onChangeUnit = (0,external_wp_element_.useCallback)( (newUnit) => onChange( setValue({ item: data, value: { value: relValue, unit: newUnit } }) ), [onChange, setValue, data, relValue] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.BaseControl, { id, __nextHasNoMarginBottom: true, className: dist_clsx(className, "dataviews-controls__relative-date"), label, hideLabelFromVision, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2.5, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalNumberControl, { __next40pxDefaultSize: true, className: "dataviews-controls__relative-date-number", spinControls: "none", min: 1, step: 1, value: relValue, onChange: onChangeValue } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.SelectControl, { className: "dataviews-controls__relative-date-unit", __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)("Unit"), value: unit, options, onChange: onChangeUnit, hideLabelFromVision: true } ) ] }) } ); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/datetime.js const { DateCalendar, ValidatedInputControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); const parseDateTime = (dateTimeString) => { if (!dateTimeString) { return null; } const parsed = (0,external_wp_date_namespaceObject.getDate)(dateTimeString); return parsed && isValid(parsed) ? parsed : null; }; const formatDateTime = (date) => { if (!date) { return ""; } if (typeof date === "string") { return date; } return format(date, "yyyy-MM-dd'T'HH:mm"); }; function CalendarDateTimeControl({ data, field, onChange, hideLabelFromVision, validity }) { const { id, label, description, setValue, getValue, isValid } = field; const fieldValue = getValue({ item: data }); const value = typeof fieldValue === "string" ? fieldValue : void 0; const [calendarMonth, setCalendarMonth] = (0,external_wp_element_.useState)(() => { const parsedDate = parseDateTime(value); return parsedDate || /* @__PURE__ */ new Date(); }); const inputControlRef = (0,external_wp_element_.useRef)(null); const validationTimeoutRef = (0,external_wp_element_.useRef)(); const previousFocusRef = (0,external_wp_element_.useRef)(null); const onChangeCallback = (0,external_wp_element_.useCallback)( (newValue) => onChange(setValue({ item: data, value: newValue })), [data, onChange, setValue] ); (0,external_wp_element_.useEffect)(() => { return () => { if (validationTimeoutRef.current) { clearTimeout(validationTimeoutRef.current); } }; }, []); const onSelectDate = (0,external_wp_element_.useCallback)( (newDate) => { let dateTimeValue; if (newDate) { let finalDateTime = newDate; if (value) { const currentDateTime = parseDateTime(value); if (currentDateTime) { finalDateTime = new Date(newDate); finalDateTime.setHours(currentDateTime.getHours()); finalDateTime.setMinutes( currentDateTime.getMinutes() ); } } dateTimeValue = finalDateTime.toISOString(); onChangeCallback(dateTimeValue); if (validationTimeoutRef.current) { clearTimeout(validationTimeoutRef.current); } } else { onChangeCallback(void 0); } previousFocusRef.current = inputControlRef.current && inputControlRef.current.ownerDocument.activeElement; validationTimeoutRef.current = setTimeout(() => { if (inputControlRef.current) { inputControlRef.current.focus(); inputControlRef.current.blur(); onChangeCallback(dateTimeValue); if (previousFocusRef.current && previousFocusRef.current instanceof HTMLElement) { previousFocusRef.current.focus(); } } }, 0); }, [onChangeCallback, value] ); const handleManualDateTimeChange = (0,external_wp_element_.useCallback)( (newValue) => { if (newValue) { const dateTime = new Date(newValue); onChangeCallback(dateTime.toISOString()); const parsedDate = parseDateTime(dateTime.toISOString()); if (parsedDate) { setCalendarMonth(parsedDate); } } else { onChangeCallback(void 0); } }, [onChangeCallback] ); const { timezone: { string: timezoneString }, l10n: { startOfWeek } } = (0,external_wp_date_namespaceObject.getSettings)(); const displayLabel = isValid?.required && !hideLabelFromVision ? `${label} (${(0,external_wp_i18n_namespaceObject.__)("Required")})` : label; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, id, label: displayLabel, help: description, hideLabelFromVision, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( DateCalendar, { style: { width: "100%" }, selected: value ? parseDateTime(value) || void 0 : void 0, onSelect: onSelectDate, month: calendarMonth, onMonthChange: setCalendarMonth, timeZone: timezoneString || void 0, weekStartsOn: startOfWeek } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedInputControl, { ref: inputControlRef, __next40pxDefaultSize: true, required: !!isValid?.required, customValidity: getCustomValidity(isValid, validity), type: "datetime-local", label: (0,external_wp_i18n_namespaceObject.__)("Date time"), hideLabelFromVision: true, value: value ? formatDateTime( parseDateTime(value) || void 0 ) : "", onChange: handleManualDateTimeChange } ) ] }) } ); } function DateTime({ data, field, onChange, hideLabelFromVision, operator, validity }) { if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( RelativeDateControl, { className: "dataviews-controls__datetime", data, field, onChange, hideLabelFromVision, operator } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CalendarDateTimeControl, { data, field, onChange, hideLabelFromVision, validity } ); } ;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfMonth.js /** * The {@link startOfMonth} function options. */ /** * @name startOfMonth * @category Month Helpers * @summary Return the start of a month for the given date. * * @description * Return the start of a month for the given date. The result will be in the local timezone. * * @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). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, * or inferred from the arguments. * * @param date - The original date * @param options - An object with options * * @returns The start of a month * * @example * // The start of a month for 2 September 2014 11:55:00: * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0)) * //=> Mon Sep 01 2014 00:00:00 */ function startOfMonth(date, options) { const _date = toDate(date, options?.in); _date.setDate(1); _date.setHours(0, 0, 0, 0); return _date; } // Fallback for modularized imports: /* harmony default export */ const date_fns_startOfMonth = ((/* unused pure expression or super */ null && (startOfMonth))); ;// ./node_modules/@wordpress/icons/build-module/library/error.js var error_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" } ) }); ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/date.js const { DateCalendar: date_DateCalendar, DateRangeCalendar } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); const DATE_PRESETS = [ { id: "today", label: (0,external_wp_i18n_namespaceObject.__)("Today"), getValue: () => (0,external_wp_date_namespaceObject.getDate)(null) }, { id: "yesterday", label: (0,external_wp_i18n_namespaceObject.__)("Yesterday"), getValue: () => { const today = (0,external_wp_date_namespaceObject.getDate)(null); return subDays(today, 1); } }, { id: "past-week", label: (0,external_wp_i18n_namespaceObject.__)("Past week"), getValue: () => { const today = (0,external_wp_date_namespaceObject.getDate)(null); return subDays(today, 7); } }, { id: "past-month", label: (0,external_wp_i18n_namespaceObject.__)("Past month"), getValue: () => { const today = (0,external_wp_date_namespaceObject.getDate)(null); return subMonths(today, 1); } } ]; const DATE_RANGE_PRESETS = [ { id: "last-7-days", label: (0,external_wp_i18n_namespaceObject.__)("Last 7 days"), getValue: () => { const today = (0,external_wp_date_namespaceObject.getDate)(null); return [subDays(today, 7), today]; } }, { id: "last-30-days", label: (0,external_wp_i18n_namespaceObject.__)("Last 30 days"), getValue: () => { const today = (0,external_wp_date_namespaceObject.getDate)(null); return [subDays(today, 30), today]; } }, { id: "month-to-date", label: (0,external_wp_i18n_namespaceObject.__)("Month to date"), getValue: () => { const today = (0,external_wp_date_namespaceObject.getDate)(null); return [startOfMonth(today), today]; } }, { id: "last-year", label: (0,external_wp_i18n_namespaceObject.__)("Last year"), getValue: () => { const today = (0,external_wp_date_namespaceObject.getDate)(null); return [subYears(today, 1), today]; } }, { id: "year-to-date", label: (0,external_wp_i18n_namespaceObject.__)("Year to date"), getValue: () => { const today = (0,external_wp_date_namespaceObject.getDate)(null); return [startOfYear(today), today]; } } ]; const parseDate = (dateString) => { if (!dateString) { return null; } const parsed = (0,external_wp_date_namespaceObject.getDate)(dateString); return parsed && isValid(parsed) ? parsed : null; }; const formatDate = (date) => { if (!date) { return ""; } return typeof date === "string" ? date : format(date, "yyyy-MM-dd"); }; function ValidatedDateControl({ field, validity, inputRefs, isTouched, setIsTouched, children }) { const { isValid } = field; const [customValidity, setCustomValidity] = (0,external_wp_element_.useState)(void 0); const validateRefs = (0,external_wp_element_.useCallback)(() => { const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; for (const ref of refs) { const input = ref.current; if (input && !input.validity.valid) { setCustomValidity({ type: "invalid", message: input.validationMessage }); return; } } setCustomValidity(void 0); }, [inputRefs]); (0,external_wp_element_.useEffect)(() => { if (isTouched) { const timeoutId = setTimeout(() => { if (validity) { setCustomValidity(getCustomValidity(isValid, validity)); } else { validateRefs(); } }, 0); return () => clearTimeout(timeoutId); } return void 0; }, [isTouched, isValid, validity, validateRefs]); const onBlur = (event) => { if (isTouched) { return; } if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) { setIsTouched(true); } }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { onBlur, children: [ children, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-live": "polite", children: customValidity && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "p", { className: dist_clsx( "components-validated-control__indicator", customValidity.type === "invalid" ? "is-invalid" : void 0, customValidity.type === "valid" ? "is-valid" : void 0 ), children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Icon, { className: "components-validated-control__indicator-icon", icon: error_default, size: 16, fill: "currentColor" } ), customValidity.message ] } ) }) ] }); } function CalendarDateControl({ data, field, onChange, hideLabelFromVision, validity }) { const { id, label, setValue, getValue, isValid } = field; const [selectedPresetId, setSelectedPresetId] = (0,external_wp_element_.useState)( null ); const fieldValue = getValue({ item: data }); const value = typeof fieldValue === "string" ? fieldValue : void 0; const [calendarMonth, setCalendarMonth] = (0,external_wp_element_.useState)(() => { const parsedDate = parseDate(value); return parsedDate || /* @__PURE__ */ new Date(); }); const [isTouched, setIsTouched] = (0,external_wp_element_.useState)(false); const validityTargetRef = (0,external_wp_element_.useRef)(null); const onChangeCallback = (0,external_wp_element_.useCallback)( (newValue) => onChange(setValue({ item: data, value: newValue })), [data, onChange, setValue] ); const onSelectDate = (0,external_wp_element_.useCallback)( (newDate) => { const dateValue = newDate ? format(newDate, "yyyy-MM-dd") : void 0; onChangeCallback(dateValue); setSelectedPresetId(null); setIsTouched(true); }, [onChangeCallback] ); const handlePresetClick = (0,external_wp_element_.useCallback)( (preset) => { const presetDate = preset.getValue(); const dateValue = formatDate(presetDate); setCalendarMonth(presetDate); onChangeCallback(dateValue); setSelectedPresetId(preset.id); setIsTouched(true); }, [onChangeCallback] ); const handleManualDateChange = (0,external_wp_element_.useCallback)( (newValue) => { onChangeCallback(newValue); if (newValue) { const parsedDate = parseDate(newValue); if (parsedDate) { setCalendarMonth(parsedDate); } } setSelectedPresetId(null); setIsTouched(true); }, [onChangeCallback] ); const { timezone: { string: timezoneString }, l10n: { startOfWeek } } = (0,external_wp_date_namespaceObject.getSettings)(); const displayLabel = isValid?.required ? `${label} (${(0,external_wp_i18n_namespaceObject.__)("Required")})` : label; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedDateControl, { field, validity, inputRefs: validityTargetRef, isTouched, setIsTouched, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, id, className: "dataviews-controls__date", label: displayLabel, hideLabelFromVision, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, wrap: true, justify: "flex-start", children: [ DATE_PRESETS.map((preset) => { const isSelected = selectedPresetId === preset.id; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { className: "dataviews-controls__date-preset", variant: "tertiary", isPressed: isSelected, size: "small", onClick: () => handlePresetClick(preset), children: preset.label }, preset.id ); }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { className: "dataviews-controls__date-preset", variant: "tertiary", isPressed: !selectedPresetId, size: "small", disabled: !!selectedPresetId, accessibleWhenDisabled: false, children: (0,external_wp_i18n_namespaceObject.__)("Custom") } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalInputControl, { __next40pxDefaultSize: true, ref: validityTargetRef, type: "date", label: (0,external_wp_i18n_namespaceObject.__)("Date"), hideLabelFromVision: true, value, onChange: handleManualDateChange, required: !!field.isValid?.required } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( date_DateCalendar, { style: { width: "100%" }, selected: value ? parseDate(value) || void 0 : void 0, onSelect: onSelectDate, month: calendarMonth, onMonthChange: setCalendarMonth, timeZone: timezoneString || void 0, weekStartsOn: startOfWeek } ) ] }) } ) } ); } function CalendarDateRangeControl({ data, field, onChange, hideLabelFromVision, validity }) { const { id, label, getValue, setValue } = field; let value; const fieldValue = getValue({ item: data }); if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) { value = fieldValue; } const onChangeCallback = (0,external_wp_element_.useCallback)( (newValue) => { onChange( setValue({ item: data, value: newValue }) ); }, [data, onChange, setValue] ); const [selectedPresetId, setSelectedPresetId] = (0,external_wp_element_.useState)( null ); const selectedRange = (0,external_wp_element_.useMemo)(() => { if (!value) { return { from: void 0, to: void 0 }; } const [from, to] = value; return { from: parseDate(from) || void 0, to: parseDate(to) || void 0 }; }, [value]); const [calendarMonth, setCalendarMonth] = (0,external_wp_element_.useState)(() => { return selectedRange.from || /* @__PURE__ */ new Date(); }); const [isTouched, setIsTouched] = (0,external_wp_element_.useState)(false); const fromInputRef = (0,external_wp_element_.useRef)(null); const toInputRef = (0,external_wp_element_.useRef)(null); const updateDateRange = (0,external_wp_element_.useCallback)( (fromDate, toDate) => { if (fromDate && toDate) { onChangeCallback([ formatDate(fromDate), formatDate(toDate) ]); } else if (!fromDate && !toDate) { onChangeCallback(void 0); } }, [onChangeCallback] ); const onSelectCalendarRange = (0,external_wp_element_.useCallback)( (newRange) => { updateDateRange(newRange?.from, newRange?.to); setSelectedPresetId(null); setIsTouched(true); }, [updateDateRange] ); const handlePresetClick = (0,external_wp_element_.useCallback)( (preset) => { const [startDate, endDate] = preset.getValue(); setCalendarMonth(startDate); updateDateRange(startDate, endDate); setSelectedPresetId(preset.id); setIsTouched(true); }, [updateDateRange] ); const handleManualDateChange = (0,external_wp_element_.useCallback)( (fromOrTo, newValue) => { const [currentFrom, currentTo] = value || [ void 0, void 0 ]; const updatedFrom = fromOrTo === "from" ? newValue : currentFrom; const updatedTo = fromOrTo === "to" ? newValue : currentTo; updateDateRange(updatedFrom, updatedTo); if (newValue) { const parsedDate = parseDate(newValue); if (parsedDate) { setCalendarMonth(parsedDate); } } setSelectedPresetId(null); setIsTouched(true); }, [value, updateDateRange] ); const { timezone, l10n } = (0,external_wp_date_namespaceObject.getSettings)(); const displayLabel = field.isValid?.required ? `${label} (${(0,external_wp_i18n_namespaceObject.__)("Required")})` : label; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedDateControl, { field, validity, inputRefs: [fromInputRef, toInputRef], isTouched, setIsTouched, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, id, className: "dataviews-controls__date", label: displayLabel, hideLabelFromVision, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, wrap: true, justify: "flex-start", children: [ DATE_RANGE_PRESETS.map((preset) => { const isSelected = selectedPresetId === preset.id; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { className: "dataviews-controls__date-preset", variant: "tertiary", isPressed: isSelected, size: "small", onClick: () => handlePresetClick(preset), children: preset.label }, preset.id ); }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { className: "dataviews-controls__date-preset", variant: "tertiary", isPressed: !selectedPresetId, size: "small", accessibleWhenDisabled: false, disabled: !!selectedPresetId, children: (0,external_wp_i18n_namespaceObject.__)("Custom") } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalInputControl, { __next40pxDefaultSize: true, ref: fromInputRef, type: "date", label: (0,external_wp_i18n_namespaceObject.__)("From"), hideLabelFromVision: true, value: value?.[0], onChange: (newValue) => handleManualDateChange("from", newValue), required: !!field.isValid?.required } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalInputControl, { __next40pxDefaultSize: true, ref: toInputRef, type: "date", label: (0,external_wp_i18n_namespaceObject.__)("To"), hideLabelFromVision: true, value: value?.[1], onChange: (newValue) => handleManualDateChange("to", newValue), required: !!field.isValid?.required } ) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( DateRangeCalendar, { style: { width: "100%" }, selected: selectedRange, onSelect: onSelectCalendarRange, month: calendarMonth, onMonthChange: setCalendarMonth, timeZone: timezone.string || void 0, weekStartsOn: l10n.startOfWeek } ) ] }) } ) } ); } function DateControl({ data, field, onChange, hideLabelFromVision, operator, validity }) { if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( RelativeDateControl, { className: "dataviews-controls__date", data, field, onChange, hideLabelFromVision, operator } ); } if (operator === OPERATOR_BETWEEN) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CalendarDateRangeControl, { data, field, onChange, hideLabelFromVision, validity } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CalendarDateControl, { data, field, onChange, hideLabelFromVision, validity } ); } ;// ./node_modules/@wordpress/icons/build-module/library/at-symbol.js var at_symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12.5939 21C14.1472 21 16.1269 20.5701 17.0711 20.1975L16.6447 18.879C16.0964 19.051 14.3299 19.6242 12.6548 19.6242C7.4467 19.6242 4.67513 16.8726 4.67513 12C4.67513 7.21338 7.50762 4.34713 12.2893 4.34713C17.132 4.34713 19.4162 7.55732 19.4162 10.7675C19.4162 14.035 19.0508 15.4968 17.4975 15.4968C16.5838 15.4968 16.0964 14.7803 16.0964 13.9777V7.5H14.4822V8.30255H14.3909C14.1777 7.67198 12.9898 7.12739 11.467 7.2707C9.18274 7.5 7.4467 9.27707 7.4467 11.8567C7.4467 14.5796 8.81726 16.672 11.467 16.758C13.203 16.8153 14.1168 16.0127 14.4822 15.1815H14.5736C14.7563 16.414 16.401 16.8439 17.467 16.8439C20.6954 16.8439 21 13.5764 21 10.7962C21 6.86943 18.0761 3 12.3807 3C6.50254 3 3 6.3535 3 11.9427C3 17.7325 6.38071 21 12.5939 21ZM11.7107 15.2962C9.73096 15.2962 9.03046 13.6051 9.03046 11.7707C9.03046 10.1083 10.0355 8.67516 11.7716 8.67516C13.599 8.67516 14.5736 9.36306 14.5736 11.7707C14.5736 14.1497 13.7513 15.2962 11.7107 15.2962Z" }) }); ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/validated-input.js const { ValidatedInputControl: validated_input_ValidatedInputControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function ValidatedText({ data, field, onChange, hideLabelFromVision, type, prefix, suffix, validity }) { const { label, placeholder, description, getValue, setValue, isValid } = field; const value = getValue({ item: data }); const onChangeControl = (0,external_wp_element_.useCallback)( (newValue) => onChange( setValue({ item: data, value: newValue }) ), [data, setValue, onChange] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( validated_input_ValidatedInputControl, { required: !!isValid?.required, customValidity: getCustomValidity(isValid, validity), label, placeholder, value: value ?? "", help: description, onChange: onChangeControl, hideLabelFromVision, type, prefix, suffix, __next40pxDefaultSize: true } ); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/email.js function Email({ data, field, onChange, hideLabelFromVision, validity }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedText, { ...{ data, field, onChange, hideLabelFromVision, validity, type: "email", 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 }) }) } } ); } ;// ./node_modules/@wordpress/icons/build-module/library/mobile.js var mobile_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z" }) }); ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/telephone.js function Telephone({ data, field, onChange, hideLabelFromVision, validity }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedText, { ...{ data, field, onChange, hideLabelFromVision, validity, type: "tel", 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 }) }) } } ); } ;// ./node_modules/@wordpress/icons/build-module/library/link.js var link_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) }); ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/url.js function Url({ data, field, onChange, hideLabelFromVision, validity }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedText, { ...{ data, field, onChange, hideLabelFromVision, validity, type: "url", 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 }) }) } } ); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/validated-number.js const { ValidatedNumberControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function toNumberOrEmpty(value) { if (value === "" || value === void 0) { return ""; } const number = Number(value); return Number.isFinite(number) ? number : ""; } function BetweenControls({ value, onChange, hideLabelFromVision, step }) { const [min = "", max = ""] = value; const onChangeMin = (0,external_wp_element_.useCallback)( (newValue) => onChange([toNumberOrEmpty(newValue), max]), [onChange, max] ); const onChangeMax = (0,external_wp_element_.useCallback)( (newValue) => onChange([min, toNumberOrEmpty(newValue)]), [onChange, min] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, help: (0,external_wp_i18n_namespaceObject.__)("The max. value must be greater than the min. value."), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { direction: "row", gap: 4, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalNumberControl, { label: (0,external_wp_i18n_namespaceObject.__)("Min."), value: min, max: max ? Number(max) - step : void 0, onChange: onChangeMin, __next40pxDefaultSize: true, hideLabelFromVision, step } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalNumberControl, { label: (0,external_wp_i18n_namespaceObject.__)("Max."), value: max, min: min ? Number(min) + step : void 0, onChange: onChangeMax, __next40pxDefaultSize: true, hideLabelFromVision, step } ) ] }) } ); } function ValidatedNumber({ data, field, onChange, hideLabelFromVision, operator, decimals, validity }) { const step = Math.pow(10, Math.abs(decimals) * -1); const { label, description, getValue, setValue, isValid } = field; const value = getValue({ item: data }) ?? ""; const onChangeControl = (0,external_wp_element_.useCallback)( (newValue) => { onChange( setValue({ item: data, // Do not convert an empty string or undefined to a number, // otherwise there's a mismatch between the UI control (empty) // and the data relied by onChange (0). value: ["", void 0].includes(newValue) ? void 0 : Number(newValue) }) ); }, [data, onChange, setValue] ); const onChangeBetweenControls = (0,external_wp_element_.useCallback)( (newValue) => { onChange( setValue({ item: data, value: newValue }) ); }, [data, onChange, setValue] ); if (operator === OPERATOR_BETWEEN) { let valueBetween = ["", ""]; if (Array.isArray(value) && value.length === 2 && value.every( (element) => typeof element === "number" || element === "" )) { valueBetween = value; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BetweenControls, { value: valueBetween, onChange: onChangeBetweenControls, hideLabelFromVision, step } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedNumberControl, { required: !!isValid?.required, customValidity: getCustomValidity(isValid, validity), label, help: description, value, onChange: onChangeControl, __next40pxDefaultSize: true, hideLabelFromVision, step } ); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/integer.js function integer_Number(props) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ValidatedNumber, { ...props, decimals: 0 }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/number.js function number_Number(props) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ValidatedNumber, { ...props, decimals: 2 }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/radio.js const { ValidatedRadioControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function Radio({ data, field, onChange, hideLabelFromVision, validity }) { const { label, description, getValue, setValue, isValid } = field; const { elements, isLoading } = useElements({ elements: field.elements, getElements: field.getElements }); const value = getValue({ item: data }); const onChangeControl = (0,external_wp_element_.useCallback)( (newValue) => onChange(setValue({ item: data, value: newValue })), [data, onChange, setValue] ); if (isLoading) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedRadioControl, { required: !!field.isValid?.required, customValidity: getCustomValidity(isValid, validity), label, help: description, onChange: onChangeControl, options: elements, selected: value, hideLabelFromVision } ); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/select.js const { ValidatedSelectControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function Select({ data, field, onChange, hideLabelFromVision, validity }) { const { type, label, description, getValue, setValue, isValid } = field; const isMultiple = type === "array"; const value = getValue({ item: data }) ?? (isMultiple ? [] : ""); const onChangeControl = (0,external_wp_element_.useCallback)( (newValue) => onChange(setValue({ item: data, value: newValue })), [data, onChange, setValue] ); const { elements, isLoading } = useElements({ elements: field.elements, getElements: field.getElements }); if (isLoading) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedSelectControl, { required: !!field.isValid?.required, customValidity: getCustomValidity(isValid, validity), label, value, help: description, options: elements, onChange: onChangeControl, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, hideLabelFromVision, multiple: isMultiple } ); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/text.js function Text({ data, field, onChange, hideLabelFromVision, config, validity }) { const { prefix, suffix } = config || {}; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedText, { ...{ data, field, onChange, hideLabelFromVision, validity, prefix: prefix ? (0,external_wp_element_.createElement)(prefix) : void 0, suffix: suffix ? (0,external_wp_element_.createElement)(suffix) : void 0 } } ); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/toggle.js const { ValidatedToggleControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function Toggle({ field, onChange, data, hideLabelFromVision, validity }) { const { label, description, getValue, setValue, isValid } = field; const onChangeControl = (0,external_wp_element_.useCallback)(() => { onChange( setValue({ item: data, value: !getValue({ item: data }) }) ); }, [onChange, setValue, data, getValue]); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedToggleControl, { required: !!isValid.required, customValidity: getCustomValidity(isValid, validity), hidden: hideLabelFromVision, __nextHasNoMarginBottom: true, label, help: description, checked: getValue({ item: data }), onChange: onChangeControl } ); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/textarea.js const { ValidatedTextareaControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function Textarea({ data, field, onChange, hideLabelFromVision, config, validity }) { const { rows = 4 } = config || {}; const { label, placeholder, description, setValue, isValid } = field; const value = field.getValue({ item: data }); const onChangeControl = (0,external_wp_element_.useCallback)( (newValue) => onChange(setValue({ item: data, value: newValue })), [data, onChange, setValue] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedTextareaControl, { required: !!isValid?.required, customValidity: getCustomValidity(isValid, validity), label, placeholder, value: value ?? "", help: description, onChange: onChangeControl, rows, __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, hideLabelFromVision } ); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/toggle-group.js const { ValidatedToggleGroupControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function ToggleGroup({ data, field, onChange, hideLabelFromVision, validity }) { const { getValue, setValue, isValid } = field; const value = getValue({ item: data }); const onChangeControl = (0,external_wp_element_.useCallback)( (newValue) => onChange(setValue({ item: data, value: newValue })), [data, onChange, setValue] ); const { elements, isLoading } = useElements({ elements: field.elements, getElements: field.getElements }); if (isLoading) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}); } if (elements.length === 0) { return null; } const selectedOption = elements.find((el) => el.value === value); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedToggleGroupControl, { required: !!field.isValid?.required, customValidity: getCustomValidity(isValid, validity), __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, isBlock: true, label: field.label, help: selectedOption?.description || field.description, onChange: onChangeControl, value, hideLabelFromVision, children: elements.map((el) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { label: el.label, value: el.value }, el.value )) } ); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/array.js const { ValidatedFormTokenField } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function ArrayControl({ data, field, onChange, hideLabelFromVision, validity }) { const { label, placeholder, getValue, setValue, isValid } = field; const value = getValue({ item: data }); const { elements, isLoading } = useElements({ elements: field.elements, getElements: field.getElements }); const arrayValueAsElements = (0,external_wp_element_.useMemo)( () => Array.isArray(value) ? value.map((token) => { const element = elements?.find( (suggestion) => suggestion.value === token ); return element || { value: token, label: token }; }) : [], [value, elements] ); const onChangeControl = (0,external_wp_element_.useCallback)( (tokens) => { const valueTokens = tokens.map((token) => { if (typeof token === "object" && "value" in token) { return token.value; } return token; }); onChange(setValue({ item: data, value: valueTokens })); }, [onChange, setValue, data] ); if (isLoading) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedFormTokenField, { required: !!isValid?.required, customValidity: getCustomValidity(isValid, validity), label: hideLabelFromVision ? void 0 : label, value: arrayValueAsElements, onChange: onChangeControl, placeholder, suggestions: elements?.map((element) => element.value), __experimentalValidateInput: (token) => { if (field.isValid?.elements && elements) { return elements.some( (element) => element.value === token || element.label === token ); } return true; }, __experimentalExpandOnFocus: elements && elements.length > 0, __experimentalShowHowTo: !field.isValid?.elements, displayTransform: (token) => { if (typeof token === "object" && "label" in token) { return token.label; } if (typeof token === "string" && elements) { const element = elements.find( (el) => el.value === token ); return element?.label || token; } return token; }, __experimentalRenderItem: ({ item }) => { if (typeof item === "string" && elements) { const element = elements.find( (el) => el.value === item ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: element?.label || item }); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: item }); } } ); } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/color.js const { ValidatedInputControl: color_ValidatedInputControl, Picker } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); const ColorPicker = ({ color, onColorChange }) => { const validColor = color && w(color).isValid() ? color : "#ffffff"; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Dropdown, { renderToggle: ({ onToggle, isOpen }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "button", { type: "button", onClick: onToggle, style: { width: "24px", height: "24px", borderRadius: "50%", backgroundColor: validColor, border: "1px solid #ddd", cursor: "pointer", outline: isOpen ? "2px solid #007cba" : "none", outlineOffset: "2px", display: "flex", alignItems: "center", justifyContent: "center", padding: 0, margin: 0 }, "aria-label": "Open color picker" } ) }), renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { padding: "16px" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Picker, { color: w(validColor), onChange: onColorChange, enableAlpha: true } ) }) } ); }; function Color({ data, field, onChange, hideLabelFromVision, validity }) { const { label, placeholder, description, setValue, isValid } = field; const value = field.getValue({ item: data }) || ""; const handleColorChange = (0,external_wp_element_.useCallback)( (colorObject) => { onChange(setValue({ item: data, value: colorObject.toHex() })); }, [data, onChange, setValue] ); const handleInputChange = (0,external_wp_element_.useCallback)( (newValue) => { onChange(setValue({ item: data, value: newValue || "" })); }, [data, onChange, setValue] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( color_ValidatedInputControl, { required: !!field.isValid?.required, customValidity: getCustomValidity(isValid, validity), label, placeholder, value, help: description, onChange: handleInputChange, hideLabelFromVision, type: "text", prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ColorPicker, { color: value, onColorChange: handleColorChange } ) } ); } ;// ./node_modules/@wordpress/icons/build-module/library/unseen.js var unseen_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z" }) }); ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/password.js function Password({ data, field, onChange, hideLabelFromVision, validity }) { const [isVisible, setIsVisible] = (0,external_wp_element_.useState)(false); const toggleVisibility = (0,external_wp_element_.useCallback)(() => { setIsVisible((prev) => !prev); }, []); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ValidatedText, { ...{ data, field, onChange, hideLabelFromVision, validity, type: isVisible ? "text" : "password", suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { icon: isVisible ? unseen_default : seen_default, onClick: toggleVisibility, size: "small", variant: "tertiary", "aria-label": isVisible ? (0,external_wp_i18n_namespaceObject.__)("Hide password") : (0,external_wp_i18n_namespaceObject.__)("Show password") } ) } } ); } ;// ./node_modules/@wordpress/dataviews/build-module/utils/has-elements.js function hasElements(field) { return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function"; } ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/index.js const FORM_CONTROLS = { array: ArrayControl, checkbox: Checkbox, color: Color, datetime: DateTime, date: DateControl, email: Email, telephone: Telephone, url: Url, integer: integer_Number, number: number_Number, password: Password, radio: Radio, select: Select, text: Text, toggle: Toggle, textarea: Textarea, toggleGroup: ToggleGroup }; function isEditConfig(value) { return value && typeof value === "object" && typeof value.control === "string"; } function createConfiguredControl(config) { const { control, ...controlConfig } = config; const BaseControlType = getControlByType(control); return function ConfiguredControl(props) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseControlType, { ...props, config: controlConfig }); }; } function getControl(field, fieldTypeDefinition) { if (typeof field.Edit === "function") { return field.Edit; } if (typeof field.Edit === "string") { return getControlByType(field.Edit); } if (isEditConfig(field.Edit)) { return createConfiguredControl(field.Edit); } if (hasElements(field) && field.type !== "array") { return getControlByType("select"); } if (typeof fieldTypeDefinition.Edit === "string") { return getControlByType(fieldTypeDefinition.Edit); } if (isEditConfig(fieldTypeDefinition.Edit)) { return createConfiguredControl(fieldTypeDefinition.Edit); } return fieldTypeDefinition.Edit; } function getControlByType(type) { if (Object.keys(FORM_CONTROLS).includes(type)) { return FORM_CONTROLS[type]; } throw "Control " + type + " not found"; } ;// ./node_modules/@wordpress/dataviews/build-module/utils/normalize-fields.js const getValueFromId = (id) => ({ item }) => { const path = id.split("."); let value = item; for (const segment of path) { if (value.hasOwnProperty(segment)) { value = value[segment]; } else { value = void 0; } } return value; }; const setValueFromId = (id) => ({ value }) => { const path = id.split("."); const result = {}; let current = result; for (const segment of path.slice(0, -1)) { current[segment] = {}; current = current[segment]; } current[path.at(-1)] = value; return result; }; function getFilterBy(field, fieldTypeDefinition) { if (field.filterBy === false) { return false; } if (typeof field.filterBy === "object") { let operators = field.filterBy.operators; if (!operators || !Array.isArray(operators)) { operators = !!fieldTypeDefinition.filterBy ? fieldTypeDefinition.filterBy.defaultOperators : []; } let validOperators = ALL_OPERATORS; if (typeof fieldTypeDefinition.filterBy === "object") { validOperators = fieldTypeDefinition.filterBy.validOperators; } operators = operators.filter( (operator) => validOperators.includes(operator) ); if (hasElements(field) && operators.includes(OPERATOR_BETWEEN)) { operators = operators.filter( (operator) => operator !== OPERATOR_BETWEEN ); } const hasSingleSelectionOperator = operators.some( (operator) => SINGLE_SELECTION_OPERATORS.includes(operator) ); if (hasSingleSelectionOperator) { operators = operators.filter( (operator) => ( // The 'Between' operator is unique as it can be combined with single selection operators. [...SINGLE_SELECTION_OPERATORS, OPERATOR_BETWEEN].includes( operator ) ) ); } if (operators.length === 0) { return false; } return { isPrimary: !!field.filterBy.isPrimary, operators }; } if (fieldTypeDefinition.filterBy === false) { return false; } let defaultOperators = fieldTypeDefinition.filterBy.defaultOperators; if (hasElements(field) && defaultOperators.includes(OPERATOR_BETWEEN)) { defaultOperators = defaultOperators.filter( (operator) => operator !== OPERATOR_BETWEEN ); } return { operators: defaultOperators }; } function normalizeFields(fields) { return fields.map((field) => { const fieldTypeDefinition = getFieldTypeDefinition( field.type ); const getValue = field.getValue || getValueFromId(field.id); const setValue = field.setValue || setValueFromId(field.id); const sort = field.sort ?? function sort2(a, b, direction) { return fieldTypeDefinition.sort( getValue({ item: a }), getValue({ item: b }), direction ); }; const isValid = { ...fieldTypeDefinition.isValid, ...field.isValid }; const Edit = getControl(field, fieldTypeDefinition); const render = field.render ?? function render2({ item, field: renderedField }) { return fieldTypeDefinition.render({ item, field: renderedField }); }; const filterBy = getFilterBy(field, fieldTypeDefinition); return { ...field, label: field.label || field.id, header: field.header || field.label || field.id, getValue, setValue, render, sort, isValid, Edit, hasElements: hasElements(field), enableHiding: field.enableHiding ?? true, enableSorting: field.enableSorting ?? fieldTypeDefinition.enableSorting ?? true, filterBy, readOnly: field.readOnly ?? fieldTypeDefinition.readOnly ?? false }; }); } ;// ./node_modules/@wordpress/dataviews/build-module/utils/filter-sort-and-paginate.js function normalizeSearchInput(input = "") { return remove_accents_default()(input.trim().toLowerCase()); } const filter_sort_and_paginate_EMPTY_ARRAY = []; function getRelativeDate(value, unit) { switch (unit) { case "days": return subDays(/* @__PURE__ */ new Date(), value); case "weeks": return subWeeks(/* @__PURE__ */ new Date(), value); case "months": return subMonths(/* @__PURE__ */ new Date(), value); case "years": return subYears(/* @__PURE__ */ new Date(), value); default: return /* @__PURE__ */ new Date(); } } function filterSortAndPaginate(data, view, fields) { if (!data) { return { data: filter_sort_and_paginate_EMPTY_ARRAY, paginationInfo: { totalItems: 0, totalPages: 0 } }; } const _fields = normalizeFields(fields); let filteredData = [...data]; if (view.search) { const normalizedSearch = normalizeSearchInput(view.search); filteredData = filteredData.filter((item) => { return _fields.filter((field) => field.enableGlobalSearch).some((field) => { const fieldValue = field.getValue({ item }); const values = Array.isArray(fieldValue) ? fieldValue : [fieldValue]; return values.some( (value) => normalizeSearchInput(String(value)).includes( normalizedSearch ) ); }); }); } if (view.filters && view.filters?.length > 0) { view.filters.forEach((filter) => { const field = _fields.find( (_field) => _field.id === filter.field ); if (field) { if (filter.operator === constants_OPERATOR_IS_ANY && filter?.value?.length > 0) { filteredData = filteredData.filter((item) => { const fieldValue = field.getValue({ item }); if (Array.isArray(fieldValue)) { return filter.value.some( (filterValue) => fieldValue.includes(filterValue) ); } else if (typeof fieldValue === "string") { return filter.value.includes(fieldValue); } return false; }); } else if (filter.operator === constants_OPERATOR_IS_NONE && filter?.value?.length > 0) { filteredData = filteredData.filter((item) => { const fieldValue = field.getValue({ item }); if (Array.isArray(fieldValue)) { return !filter.value.some( (filterValue) => fieldValue.includes(filterValue) ); } else if (typeof fieldValue === "string") { return !filter.value.includes(fieldValue); } return false; }); } else if (filter.operator === OPERATOR_IS_ALL && filter?.value?.length > 0) { filteredData = filteredData.filter((item) => { return filter.value.every((value) => { return field.getValue({ item })?.includes(value); }); }); } else if (filter.operator === OPERATOR_IS_NOT_ALL && filter?.value?.length > 0) { filteredData = filteredData.filter((item) => { return filter.value.every((value) => { return !field.getValue({ item })?.includes(value); }); }); } else if (filter.operator === constants_OPERATOR_IS) { filteredData = filteredData.filter((item) => { return filter.value === field.getValue({ item }) || filter.value === void 0; }); } else if (filter.operator === constants_OPERATOR_IS_NOT) { filteredData = filteredData.filter((item) => { return filter.value !== field.getValue({ item }); }); } else if (filter.operator === OPERATOR_ON && filter.value !== void 0) { const filterDate = (0,external_wp_date_namespaceObject.getDate)(filter.value); filteredData = filteredData.filter((item) => { const fieldDate = (0,external_wp_date_namespaceObject.getDate)(field.getValue({ item })); return filterDate.getTime() === fieldDate.getTime(); }); } else if (filter.operator === OPERATOR_NOT_ON && filter.value !== void 0) { const filterDate = (0,external_wp_date_namespaceObject.getDate)(filter.value); filteredData = filteredData.filter((item) => { const fieldDate = (0,external_wp_date_namespaceObject.getDate)(field.getValue({ item })); return filterDate.getTime() !== fieldDate.getTime(); }); } else if (filter.operator === OPERATOR_LESS_THAN && filter.value !== void 0) { filteredData = filteredData.filter((item) => { const fieldValue = field.getValue({ item }); return fieldValue < filter.value; }); } else if (filter.operator === OPERATOR_GREATER_THAN && filter.value !== void 0) { filteredData = filteredData.filter((item) => { const fieldValue = field.getValue({ item }); return fieldValue > filter.value; }); } else if (filter.operator === OPERATOR_LESS_THAN_OR_EQUAL && filter.value !== void 0) { filteredData = filteredData.filter((item) => { const fieldValue = field.getValue({ item }); return fieldValue <= filter.value; }); } else if (filter.operator === OPERATOR_GREATER_THAN_OR_EQUAL && filter.value !== void 0) { filteredData = filteredData.filter((item) => { const fieldValue = field.getValue({ item }); return fieldValue >= filter.value; }); } else if (filter.operator === OPERATOR_CONTAINS && filter?.value !== void 0) { filteredData = filteredData.filter((item) => { const fieldValue = field.getValue({ item }); return typeof fieldValue === "string" && filter.value && fieldValue.toLowerCase().includes( String(filter.value).toLowerCase() ); }); } else if (filter.operator === OPERATOR_NOT_CONTAINS && filter?.value !== void 0) { filteredData = filteredData.filter((item) => { const fieldValue = field.getValue({ item }); return typeof fieldValue === "string" && filter.value && !fieldValue.toLowerCase().includes( String(filter.value).toLowerCase() ); }); } else if (filter.operator === OPERATOR_STARTS_WITH && filter?.value !== void 0) { filteredData = filteredData.filter((item) => { const fieldValue = field.getValue({ item }); return typeof fieldValue === "string" && filter.value && fieldValue.toLowerCase().startsWith( String(filter.value).toLowerCase() ); }); } else if (filter.operator === OPERATOR_BEFORE && filter.value !== void 0) { const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value); filteredData = filteredData.filter((item) => { const fieldValue = (0,external_wp_date_namespaceObject.getDate)( field.getValue({ item }) ); return fieldValue < filterValue; }); } else if (filter.operator === OPERATOR_AFTER && filter.value !== void 0) { const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value); filteredData = filteredData.filter((item) => { const fieldValue = (0,external_wp_date_namespaceObject.getDate)( field.getValue({ item }) ); return fieldValue > filterValue; }); } else if (filter.operator === OPERATOR_BEFORE_INC && filter.value !== void 0) { const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value); filteredData = filteredData.filter((item) => { const fieldValue = (0,external_wp_date_namespaceObject.getDate)( field.getValue({ item }) ); return fieldValue <= filterValue; }); } else if (filter.operator === OPERATOR_AFTER_INC && filter.value !== void 0) { const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value); filteredData = filteredData.filter((item) => { const fieldValue = (0,external_wp_date_namespaceObject.getDate)( field.getValue({ item }) ); return fieldValue >= filterValue; }); } else if (filter.operator === OPERATOR_BETWEEN && Array.isArray(filter.value) && filter.value.length === 2 && filter.value[0] !== void 0 && filter.value[1] !== void 0) { filteredData = filteredData.filter((item) => { const fieldValue = field.getValue({ item }); if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") { return fieldValue >= filter.value[0] && fieldValue <= filter.value[1]; } return false; }); } else if (filter.operator === OPERATOR_IN_THE_PAST && filter.value?.value !== void 0 && filter.value?.unit !== void 0) { const targetDate = getRelativeDate( filter.value.value, filter.value.unit ); filteredData = filteredData.filter((item) => { const fieldValue = (0,external_wp_date_namespaceObject.getDate)( field.getValue({ item }) ); return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date(); }); } else if (filter.operator === OPERATOR_OVER && filter.value?.value !== void 0 && filter.value?.unit !== void 0) { const targetDate = getRelativeDate( filter.value.value, filter.value.unit ); filteredData = filteredData.filter((item) => { const fieldValue = (0,external_wp_date_namespaceObject.getDate)( field.getValue({ item }) ); return fieldValue < targetDate; }); } } }); } const sortByField = view.sort?.field ? _fields.find((field) => { return field.id === view.sort?.field; }) : null; const groupByField = view.groupByField ? _fields.find((field) => { return field.id === view.groupByField; }) : null; if (sortByField || groupByField) { filteredData.sort((a, b) => { if (groupByField) { const groupCompare = groupByField.sort(a, b, "asc"); if (groupCompare !== 0) { return groupCompare; } } if (sortByField) { return sortByField.sort(a, b, view.sort?.direction ?? "desc"); } return 0; }); } let totalItems = filteredData.length; let totalPages = 1; if (view.page !== void 0 && view.perPage !== void 0) { const start = (view.page - 1) * view.perPage; totalItems = filteredData?.length || 0; totalPages = Math.ceil(totalItems / view.perPage); filteredData = filteredData?.slice(start, start + view.perPage); } return { data: filteredData, paginationInfo: { totalItems, totalPages } }; } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-context/index.js const dataviews_context_DataViewsContext = (0,external_wp_element_.createContext)({ view: { type: constants_LAYOUT_TABLE }, onChangeView: () => { }, fields: [], data: [], paginationInfo: { totalItems: 0, totalPages: 0 }, selection: [], onChangeSelection: () => { }, setOpenedFilter: () => { }, openedFilter: null, getItemId: (item) => item.id, isItemClickable: () => true, renderItemLink: void 0, containerWidth: 0, containerRef: (0,external_wp_element_.createRef)(), resizeObserverRef: () => { }, defaultLayouts: { list: {}, grid: {}, table: {} }, filters: [], isShowingFilter: false, setIsShowingFilter: () => { }, hasInfiniteScrollHandler: false, config: { perPageSizes: [] } }); dataviews_context_DataViewsContext.displayName = "DataViewsContext"; var dataviews_context_default = dataviews_context_DataViewsContext; ;// ./node_modules/@wordpress/icons/build-module/library/block-table.js var block_table_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/category.js var category_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_primitives_namespaceObject.Path, { 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", fillRule: "evenodd", clipRule: "evenodd" } ) }); ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets-rtl.js var format_list_bullets_rtl_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js var format_list_bullets_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) }); ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-selection-checkbox/index.js function DataViewsSelectionCheckbox({ selection, onChangeSelection, item, getItemId, titleField, disabled, ...extraProps }) { const id = getItemId(item); const checked = !disabled && selection.includes(id); const selectionLabel = titleField?.getValue?.({ item }) || (0,external_wp_i18n_namespaceObject.__)("(no title)"); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { className: "dataviews-selection-checkbox", __nextHasNoMarginBottom: true, "aria-label": selectionLabel, "aria-disabled": disabled, checked, onChange: () => { if (disabled) { return; } onChangeSelection( selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id] ); }, ...extraProps } ); } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-item-actions/index.js const { Menu: dataviews_item_actions_Menu, kebabCase: dataviews_item_actions_kebabCase } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function ButtonTrigger({ action, onClick, items }) { const label = typeof action.label === "string" ? action.label : action.label(items); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { disabled: !!action.disabled, accessibleWhenDisabled: true, size: "compact", onClick, children: label } ); } function MenuItemTrigger({ action, onClick, items }) { const label = typeof action.label === "string" ? action.label : action.label(items); 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 }) }); } function ActionModal({ action, items, closeModal }) { const label = typeof action.label === "string" ? action.label : action.label(items); const modalHeader = typeof action.modalHeader === "function" ? action.modalHeader(items) : action.modalHeader; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Modal, { title: modalHeader || label, __experimentalHideHeader: !!action.hideModalHeader, onRequestClose: closeModal, focusOnMount: action.modalFocusOnMount ?? true, size: action.modalSize || "medium", overlayClassName: `dataviews-action-modal dataviews-action-modal__${dataviews_item_actions_kebabCase( action.id )}`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(action.RenderModal, { items, closeModal }) } ); } function ActionsMenuGroup({ actions, item, registry, setActiveModalAction }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Group, { children: actions.map((action) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( MenuItemTrigger, { action, onClick: () => { if ("RenderModal" in action) { setActiveModalAction(action); return; } action.callback([item], { registry }); }, items: [item] }, action.id )) }); } function ItemActions({ item, actions, isCompact }) { const registry = (0,external_wp_data_.useRegistry)(); const { primaryActions, eligibleActions } = (0,external_wp_element_.useMemo)(() => { const _eligibleActions = actions.filter( (action) => !action.isEligible || action.isEligible(item) ); const _primaryActions = _eligibleActions.filter( (action) => action.isPrimary ); return { primaryActions: _primaryActions, eligibleActions: _eligibleActions }; }, [actions, item]); if (isCompact) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CompactItemActions, { item, actions: eligibleActions, isSmall: true, registry } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { spacing: 0, justify: "flex-end", className: "dataviews-item-actions", style: { flexShrink: 0, width: "auto" }, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrimaryActions, { item, actions: primaryActions, registry } ), primaryActions.length < eligibleActions.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( CompactItemActions, { item, actions: eligibleActions, registry } ) ] } ); } function CompactItemActions({ item, actions, isSmall, registry }) { const [activeModalAction, setActiveModalAction] = (0,external_wp_element_.useState)( null ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_item_actions_Menu, { placement: "bottom-end", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( dataviews_item_actions_Menu.TriggerButton, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: isSmall ? "small" : "compact", icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("Actions"), accessibleWhenDisabled: true, disabled: !actions.length, className: "dataviews-all-actions-button" } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ActionsMenuGroup, { actions, item, registry, setActiveModalAction } ) }) ] }), !!activeModalAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ActionModal, { action: activeModalAction, items: [item], closeModal: () => setActiveModalAction(null) } ) ] }); } function PrimaryActions({ item, actions, registry }) { const [activeModalAction, setActiveModalAction] = (0,external_wp_element_.useState)(null); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); if (isMobileViewport) { return null; } if (!Array.isArray(actions) || actions.length === 0) { return null; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ actions.map((action) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ButtonTrigger, { action, onClick: () => { if ("RenderModal" in action) { setActiveModalAction(action); return; } action.callback([item], { registry }); }, items: [item] }, action.id )), !!activeModalAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ActionModal, { action: activeModalAction, items: [item], closeModal: () => setActiveModalAction(null) } ) ] }); } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-bulk-actions/index.js function ActionWithModal({ action, items, ActionTriggerComponent }) { const [isModalOpen, setIsModalOpen] = (0,external_wp_element_.useState)(false); const actionTriggerProps = { action, onClick: () => { setIsModalOpen(true); }, items }; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTriggerComponent, { ...actionTriggerProps }), isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ActionModal, { action, items, closeModal: () => setIsModalOpen(false) } ) ] }); } function useHasAPossibleBulkAction(actions, item) { return (0,external_wp_element_.useMemo)(() => { return actions.some((action) => { return action.supportsBulk && (!action.isEligible || action.isEligible(item)); }); }, [actions, item]); } function useSomeItemHasAPossibleBulkAction(actions, data) { return (0,external_wp_element_.useMemo)(() => { return data.some((item) => { return actions.some((action) => { return action.supportsBulk && (!action.isEligible || action.isEligible(item)); }); }); }, [actions, data]); } function BulkSelectionCheckbox({ selection, onChangeSelection, data, actions, getItemId }) { const selectableItems = (0,external_wp_element_.useMemo)(() => { return data.filter((item) => { return actions.some( (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item)) ); }); }, [data, actions]); const selectedItems = data.filter( (item) => selection.includes(getItemId(item)) && selectableItems.includes(item) ); const areAllSelected = selectedItems.length === selectableItems.length; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.CheckboxControl, { className: "dataviews-view-table-selection-checkbox", __nextHasNoMarginBottom: true, checked: areAllSelected, indeterminate: !areAllSelected && !!selectedItems.length, onChange: () => { if (areAllSelected) { onChangeSelection([]); } else { onChangeSelection( selectableItems.map((item) => getItemId(item)) ); } }, "aria-label": areAllSelected ? (0,external_wp_i18n_namespaceObject.__)("Deselect all") : (0,external_wp_i18n_namespaceObject.__)("Select all") } ); } function ActionTrigger({ action, onClick, isBusy, items }) { const label = typeof action.label === "string" ? action.label : action.label(items); const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); if (isMobile) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { disabled: isBusy, accessibleWhenDisabled: true, label, icon: action.icon, size: "compact", onClick, isBusy } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { disabled: isBusy, accessibleWhenDisabled: true, size: "compact", onClick, isBusy, children: label } ); } const dataviews_bulk_actions_EMPTY_ARRAY = []; function ActionButton({ action, selectedItems, actionInProgress, setActionInProgress }) { const registry = (0,external_wp_data_.useRegistry)(); const selectedEligibleItems = (0,external_wp_element_.useMemo)(() => { return selectedItems.filter((item) => { return !action.isEligible || action.isEligible(item); }); }, [action, selectedItems]); if ("RenderModal" in action) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ActionWithModal, { action, items: selectedEligibleItems, ActionTriggerComponent: ActionTrigger }, action.id ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ActionTrigger, { action, onClick: async () => { setActionInProgress(action.id); await action.callback(selectedItems, { registry }); setActionInProgress(null); }, items: selectedEligibleItems, isBusy: actionInProgress === action.id }, action.id ); } function renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection) { const message = selectedItems.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of items. */ (0,external_wp_i18n_namespaceObject._n)( "%d Item selected", "%d Items selected", selectedItems.length ), selectedItems.length ) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of items. */ (0,external_wp_i18n_namespaceObject._n)("%d Item", "%d Items", data.length), data.length ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, className: "dataviews-bulk-actions-footer__container", spacing: 3, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BulkSelectionCheckbox, { selection, onChangeSelection, data, actions, getItemId } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-bulk-actions-footer__item-count", children: message }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { className: "dataviews-bulk-actions-footer__action-buttons", expanded: false, spacing: 1, children: [ actionsToShow.map((action) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ActionButton, { action, selectedItems, actionInProgress, setActionInProgress }, action.id ); }), selectedItems.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { icon: close_small_default, showTooltip: true, tooltipPosition: "top", size: "compact", label: (0,external_wp_i18n_namespaceObject.__)("Cancel"), disabled: !!actionInProgress, accessibleWhenDisabled: false, onClick: () => { onChangeSelection(dataviews_bulk_actions_EMPTY_ARRAY); } } ) ] } ) ] } ); } function FooterContent({ selection, actions, onChangeSelection, data, getItemId }) { const [actionInProgress, setActionInProgress] = (0,external_wp_element_.useState)( null ); const footerContentRef = (0,external_wp_element_.useRef)(null); const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); const bulkActions = (0,external_wp_element_.useMemo)( () => actions.filter((action) => action.supportsBulk), [actions] ); const selectableItems = (0,external_wp_element_.useMemo)(() => { return data.filter((item) => { return bulkActions.some( (action) => !action.isEligible || action.isEligible(item) ); }); }, [data, bulkActions]); const selectedItems = (0,external_wp_element_.useMemo)(() => { return data.filter( (item) => selection.includes(getItemId(item)) && selectableItems.includes(item) ); }, [selection, data, getItemId, selectableItems]); const actionsToShow = (0,external_wp_element_.useMemo)( () => actions.filter((action) => { return action.supportsBulk && (!isMobile || action.icon) && selectedItems.some( (item) => !action.isEligible || action.isEligible(item) ); }), [actions, selectedItems, isMobile] ); if (!actionInProgress) { if (footerContentRef.current) { footerContentRef.current = null; } return renderFooterContent( data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection ); } else if (!footerContentRef.current) { footerContentRef.current = renderFooterContent( data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection ); } return footerContentRef.current; } function BulkActionsFooter() { const { data, selection, actions = dataviews_bulk_actions_EMPTY_ARRAY, onChangeSelection, getItemId } = (0,external_wp_element_.useContext)(dataviews_context_default); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FooterContent, { selection, onChangeSelection, data, actions, getItemId } ); } ;// ./node_modules/@wordpress/icons/build-module/library/funnel.js var funnel_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/arrow-left.js var arrow_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" }) }); ;// ./node_modules/@wordpress/icons/build-module/library/arrow-right.js var arrow_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) }); ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-header-menu.js const { Menu: column_header_menu_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function WithMenuSeparators({ children }) { return external_wp_element_.Children.toArray(children).filter(Boolean).map((child, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_.Fragment, { children: [ i > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Separator, {}), child ] }, i)); } const _HeaderMenu = (0,external_wp_element_.forwardRef)(function HeaderMenu({ fieldId, view, fields, onChangeView, onHide, setOpenedFilter, canMove = true }, ref) { const visibleFieldIds = view.fields ?? []; const index = visibleFieldIds?.indexOf(fieldId); const isSorted = view.sort?.field === fieldId; let isHidable = false; let isSortable = false; let canAddFilter = false; let operators = []; const field = fields.find((f) => f.id === fieldId); if (!field) { return null; } isHidable = field.enableHiding !== false; isSortable = field.enableSorting !== false; const header = field.header; operators = !!field.filterBy && field.filterBy?.operators || []; canAddFilter = !view.filters?.some((_filter) => fieldId === _filter.field) && !!(field.hasElements || field.Edit) && field.filterBy !== false && !field.filterBy?.isPrimary; if (!isSortable && !canMove && !isHidable && !canAddFilter) { return header; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( column_header_menu_Menu.TriggerButton, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "compact", className: "dataviews-view-table-header-button", ref, variant: "tertiary" } ), children: [ header, view.sort && isSorted && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "aria-hidden": "true", children: sortArrows[view.sort.direction] }) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Popover, { style: { minWidth: "240px" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(WithMenuSeparators, { children: [ isSortable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Group, { children: SORTING_DIRECTIONS.map( (direction) => { const isChecked = view.sort && isSorted && view.sort.direction === direction; const value = `${fieldId}-${direction}`; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( column_header_menu_Menu.RadioItem, { name: "view-table-sorting", value, checked: isChecked, onChange: () => { onChangeView({ ...view, sort: { field: fieldId, direction }, showLevels: false }); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: sortLabels[direction] }) }, value ); } ) }), canAddFilter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Group, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( column_header_menu_Menu.Item, { prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: funnel_default }), onClick: () => { setOpenedFilter(fieldId); onChangeView({ ...view, page: 1, filters: [ ...view.filters || [], { field: fieldId, value: void 0, operator: operators[0] } ] }); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Add filter") }) } ) }), (canMove || isHidable) && field && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu.Group, { children: [ canMove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( column_header_menu_Menu.Item, { prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: arrow_left_default }), disabled: index < 1, onClick: () => { onChangeView({ ...view, fields: [ ...visibleFieldIds.slice( 0, index - 1 ) ?? [], fieldId, visibleFieldIds[index - 1], ...visibleFieldIds.slice( index + 1 ) ] }); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Move left") }) } ), canMove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( column_header_menu_Menu.Item, { prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: arrow_right_default }), disabled: index >= visibleFieldIds.length - 1, onClick: () => { onChangeView({ ...view, fields: [ ...visibleFieldIds.slice( 0, index ) ?? [], visibleFieldIds[index + 1], fieldId, ...visibleFieldIds.slice( index + 2 ) ] }); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Move right") }) } ), isHidable && field && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( column_header_menu_Menu.Item, { prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: unseen_default }), onClick: () => { onHide(field); onChangeView({ ...view, fields: visibleFieldIds.filter( (id) => id !== fieldId ) }); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Hide column") }) } ) ] }) ] }) }) ] }); }); const ColumnHeaderMenu = _HeaderMenu; var column_header_menu_default = ColumnHeaderMenu; ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/item-click-wrapper.js function getClickableItemProps({ item, isItemClickable, onClickItem, className }) { if (!isItemClickable(item) || !onClickItem) { return { className }; } return { className: className ? `${className} ${className}--clickable` : void 0, role: "button", tabIndex: 0, onClick: (event) => { event.stopPropagation(); onClickItem(item); }, onKeyDown: (event) => { if (event.key === "Enter" || event.key === "" || event.key === " ") { event.stopPropagation(); onClickItem(item); } } }; } function ItemClickWrapper({ item, isItemClickable, onClickItem, renderItemLink, className, children, ...extraProps }) { if (!isItemClickable(item)) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className, ...extraProps, children }); } if (renderItemLink) { const renderedElement = renderItemLink({ item, className: `${className} ${className}--clickable`, ...extraProps, children }); return (0,external_wp_element_.cloneElement)(renderedElement, { onClick: (event) => { event.stopPropagation(); if (renderedElement.props.onClick) { renderedElement.props.onClick(event); } }, onKeyDown: (event) => { if (event.key === "Enter" || event.key === "" || event.key === " ") { event.stopPropagation(); if (renderedElement.props.onKeyDown) { renderedElement.props.onKeyDown(event); } } } }); } const clickProps = getClickableItemProps({ item, isItemClickable, onClickItem, className }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...clickProps, ...extraProps, children }); } ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-primary.js function ColumnPrimary({ item, level, titleField, mediaField, descriptionField, onClickItem, renderItemLink, isItemClickable }) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, justify: "flex-start", children: [ mediaField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ItemClickWrapper, { item, isItemClickable, onClickItem, renderItemLink, className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media", "aria-label": titleField ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s is the item title. (0,external_wp_i18n_namespaceObject.__)("Click item: %s"), titleField.getValue?.({ item }) ) : void 0, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( mediaField.render, { item, field: mediaField, config: { sizes: "32px" } } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, alignment: "flex-start", className: "dataviews-view-table__primary-column-content", children: [ titleField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( ItemClickWrapper, { item, isItemClickable, onClickItem, renderItemLink, className: "dataviews-view-table__cell-content-wrapper dataviews-title-field", children: [ level !== void 0 && level > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "dataviews-view-table__level", children: [ "\u2014".repeat(level), "\xA0" ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField }) ] } ), descriptionField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( descriptionField.render, { item, field: descriptionField } ) ] } ) ] }); } var column_primary_default = ColumnPrimary; ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/use-is-horizontal-scroll-end.js const isScrolledToEnd = (element) => { if ((0,external_wp_i18n_namespaceObject.isRTL)()) { const scrollLeft = Math.abs(element.scrollLeft); return scrollLeft <= 1; } return element.scrollLeft + element.clientWidth >= element.scrollWidth - 1; }; function useIsHorizontalScrollEnd({ scrollContainerRef, enabled = false }) { const [isHorizontalScrollEnd, setIsHorizontalScrollEnd] = (0,external_wp_element_.useState)(false); const handleIsHorizontalScrollEnd = (0,external_wp_compose_namespaceObject.useDebounce)( (0,external_wp_element_.useCallback)(() => { const scrollContainer = scrollContainerRef.current; if (scrollContainer) { setIsHorizontalScrollEnd(isScrolledToEnd(scrollContainer)); } }, [scrollContainerRef, setIsHorizontalScrollEnd]), 200 ); (0,external_wp_element_.useEffect)(() => { if (typeof window === "undefined" || !enabled || !scrollContainerRef.current) { return () => { }; } handleIsHorizontalScrollEnd(); scrollContainerRef.current.addEventListener( "scroll", handleIsHorizontalScrollEnd ); window.addEventListener("resize", handleIsHorizontalScrollEnd); return () => { scrollContainerRef.current?.removeEventListener( "scroll", handleIsHorizontalScrollEnd ); window.removeEventListener("resize", handleIsHorizontalScrollEnd); }; }, [scrollContainerRef, enabled]); return isHorizontalScrollEnd; } ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/get-data-by-group.js function getDataByGroup(data, groupByField) { return data.reduce((groups, item) => { const groupName = groupByField.getValue({ item }); if (!groups.has(groupName)) { groups.set(groupName, []); } groups.get(groupName)?.push(item); return groups; }, /* @__PURE__ */ new Map()); } ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/index.js function TableColumnField({ item, fields, column, align }) { const field = fields.find((f) => f.id === column); if (!field) { return null; } const className = dist_clsx("dataviews-view-table__cell-content-wrapper", { "dataviews-view-table__cell-align-end": align === "end", "dataviews-view-table__cell-align-center": align === "center" }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { item, field }) }); } function TableRow({ hasBulkActions, item, level, actions, fields, id, view, titleField, mediaField, descriptionField, selection, getItemId, isItemClickable, onClickItem, renderItemLink, onChangeSelection, isActionsColumnSticky, posinset }) { const { paginationInfo } = (0,external_wp_element_.useContext)(dataviews_context_default); const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item); const isSelected = hasPossibleBulkAction && selection.includes(id); const [isHovered, setIsHovered] = (0,external_wp_element_.useState)(false); const { showTitle = true, showMedia = true, showDescription = true, infiniteScrollEnabled } = view; const handleMouseEnter = () => { setIsHovered(true); }; const handleMouseLeave = () => { setIsHovered(false); }; const isTouchDeviceRef = (0,external_wp_element_.useRef)(false); const columns = view.fields ?? []; const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "tr", { className: dist_clsx("dataviews-view-table__row", { "is-selected": hasPossibleBulkAction && isSelected, "is-hovered": isHovered, "has-bulk-actions": hasPossibleBulkAction }), onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onTouchStart: () => { isTouchDeviceRef.current = true; }, "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0, "aria-posinset": posinset, role: infiniteScrollEnabled ? "article" : void 0, onClick: (event) => { if (!hasPossibleBulkAction) { return; } if (!isTouchDeviceRef.current && document.getSelection()?.type !== "Range") { if ((0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey) { onChangeSelection( selection.includes(id) ? selection.filter( (itemId) => id !== itemId ) : [...selection, id] ); } else { onChangeSelection( selection.includes(id) ? selection.filter( (itemId) => id !== itemId ) : [id] ); } } }, children: [ 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)( DataViewsSelectionCheckbox, { item, selection, onChangeSelection, getItemId, titleField, disabled: !hasPossibleBulkAction } ) }) }), hasPrimaryColumn && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( column_primary_default, { item, level, titleField: showTitle ? titleField : void 0, mediaField: showMedia ? mediaField : void 0, descriptionField: showDescription ? descriptionField : void 0, isItemClickable, onClickItem, renderItemLink } ) }), columns.map((column) => { const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "td", { style: { width, maxWidth, minWidth }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TableColumnField, { fields, item, column, align } ) }, column ); }), !!actions?.length && // Disable reason: we are not making the element interactive, // but preventing any click events from bubbling up to the // table row. This allows us to add a click handler to the row // itself (to toggle row selection) without erroneously // intercepting click events from ItemActions. /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "td", { className: dist_clsx("dataviews-view-table__actions-column", { "dataviews-view-table__actions-column--sticky": true, "dataviews-view-table__actions-column--stuck": isActionsColumnSticky }), onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { item, actions }) } ) ] } ); } function ViewTable({ actions, data, fields, getItemId, getItemLevel, isLoading = false, onChangeView, onChangeSelection, selection, setOpenedFilter, onClickItem, isItemClickable, renderItemLink, view, className, empty }) { const { containerRef } = (0,external_wp_element_.useContext)(dataviews_context_default); const headerMenuRefs = (0,external_wp_element_.useRef)(/* @__PURE__ */ new Map()); const headerMenuToFocusRef = (0,external_wp_element_.useRef)(); const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0,external_wp_element_.useState)(); const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); (0,external_wp_element_.useEffect)(() => { if (headerMenuToFocusRef.current) { headerMenuToFocusRef.current.focus(); headerMenuToFocusRef.current = void 0; } }); const tableNoticeId = (0,external_wp_element_.useId)(); const isHorizontalScrollEnd = useIsHorizontalScrollEnd({ scrollContainerRef: containerRef, enabled: !!actions?.length }); if (nextHeaderMenuToFocus) { headerMenuToFocusRef.current = nextHeaderMenuToFocus; setNextHeaderMenuToFocus(void 0); return; } const onHide = (field) => { const hidden = headerMenuRefs.current.get(field.id); const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0; setNextHeaderMenuToFocus(fallback?.node); }; const hasData = !!data?.length; const titleField = fields.find((field) => field.id === view.titleField); const mediaField = fields.find((field) => field.id === view.mediaField); const descriptionField = fields.find( (field) => field.id === view.descriptionField ); const groupField = view.groupByField ? fields.find((f) => f.id === view.groupByField) : null; const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; const { showTitle = true, showMedia = true, showDescription = true } = view; const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription; const columns = view.fields ?? []; const headerMenuRef = (column, index) => (node) => { if (node) { headerMenuRefs.current.set(column, { node, fallback: columns[index > 0 ? index - 1 : 1] }); } else { headerMenuRefs.current.delete(column); } }; const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "table", { className: dist_clsx("dataviews-view-table", className, { [`has-${view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( view.layout.density ) }), "aria-busy": isLoading, "aria-describedby": tableNoticeId, role: isInfiniteScroll ? "feed" : void 0, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("colgroup", { children: [ hasBulkActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("col", { className: "dataviews-view-table__col-checkbox" }), hasPrimaryColumn && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("col", { className: "dataviews-view-table__col-primary" }), columns.map((column) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "col", { className: `dataviews-view-table__col-${column}` }, `col-${column}` )), !!actions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("col", { className: "dataviews-view-table__col-actions" }) ] }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("thead", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", { className: "dataviews-view-table__row", children: [ hasBulkActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "th", { className: "dataviews-view-table__checkbox-column", scope: "col", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( BulkSelectionCheckbox, { selection, onChangeSelection, data, actions, getItemId } ) } ), hasPrimaryColumn && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { scope: "col", children: titleField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( column_header_menu_default, { ref: headerMenuRef( titleField.id, 0 ), fieldId: titleField.id, view, fields, onChangeView, onHide, setOpenedFilter, canMove: false } ) }), columns.map((column, index) => { const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "th", { style: { width, maxWidth, minWidth, textAlign: align }, "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0, scope: "col", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( column_header_menu_default, { ref: headerMenuRef(column, index), fieldId: column, view, fields, onChangeView, onHide, setOpenedFilter, canMove: view.layout?.enableMoving ?? true } ) }, column ); }), !!actions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "th", { className: dist_clsx( "dataviews-view-table__actions-column", { "dataviews-view-table__actions-column--sticky": true, "dataviews-view-table__actions-column--stuck": !isHorizontalScrollEnd } ), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-view-table-header", children: (0,external_wp_i18n_namespaceObject.__)("Actions") }) } ) ] }) }), hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map( ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("tbody", { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("tr", { className: "dataviews-view-table__group-header-row", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "td", { colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + (hasBulkActions ? 1 : 0) + (actions?.length ? 1 : 0), className: "dataviews-view-table__group-header-cell", children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"), groupField.label, groupName ) } ) }), groupItems.map((item, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TableRow, { item, level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0, hasBulkActions, actions, fields, id: getItemId(item) || index.toString(), view, titleField, mediaField, descriptionField, selection, getItemId, onChangeSelection, onClickItem, renderItemLink, isItemClickable, isActionsColumnSticky: !isHorizontalScrollEnd }, getItemId(item) )) ] }, `group-${groupName}`) ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("tbody", { children: hasData && data.map((item, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( TableRow, { item, level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0, hasBulkActions, actions, fields, id: getItemId(item) || index.toString(), view, titleField, mediaField, descriptionField, selection, getItemId, onChangeSelection, onClickItem, renderItemLink, isItemClickable, isActionsColumnSticky: !isHorizontalScrollEnd, posinset: isInfiniteScroll ? index + 1 : void 0 }, getItemId(item) )) }) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: dist_clsx({ "dataviews-loading": isLoading, "dataviews-no-results": !hasData && !isLoading }), id: tableNoticeId, children: [ !hasData && (isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty), 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, {}) }) ] } ) ] }); } var table_default = ViewTable; ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/grid-items.js const GridItems = (0,external_wp_element_.forwardRef)(({ className, previewSize, ...props }, ref) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { ref, className: dist_clsx("dataviews-view-grid-items", className), style: { gridTemplateColumns: previewSize && `repeat(auto-fill, minmax(${previewSize}px, 1fr))` }, ...props } ); }); ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/grid/index.js const { Badge } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function GridItem({ view, selection, onChangeSelection, onClickItem, isItemClickable, renderItemLink, getItemId, item, actions, mediaField, titleField, descriptionField, regularFields, badgeFields, hasBulkActions, config, posinset }) { const { showTitle = true, showMedia = true, showDescription = true, infiniteScrollEnabled } = view; const hasBulkAction = useHasAPossibleBulkAction(actions, item); const id = getItemId(item); const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(GridItem); const isSelected = selection.includes(id); const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( mediaField.render, { item, field: mediaField, config } ) : null; const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField }) : null; const shouldRenderMedia = showMedia && renderedMediaField; let mediaA11yProps; let titleA11yProps; if (isItemClickable(item) && onClickItem) { if (renderedTitleField) { mediaA11yProps = { "aria-labelledby": `dataviews-view-grid__title-field-${instanceId}` }; titleA11yProps = { id: `dataviews-view-grid__title-field-${instanceId}` }; } else { mediaA11yProps = { "aria-label": (0,external_wp_i18n_namespaceObject.__)("Navigate to item") }; } } const { paginationInfo } = (0,external_wp_element_.useContext)(dataviews_context_default); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, className: dist_clsx("dataviews-view-grid__card", { "is-selected": hasBulkAction && isSelected }), onClickCapture: (event) => { if ((0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey) { event.stopPropagation(); event.preventDefault(); if (!hasBulkAction) { return; } onChangeSelection( selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id] ); } }, role: infiniteScrollEnabled ? "article" : void 0, "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0, "aria-posinset": posinset, children: [ shouldRenderMedia && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ItemClickWrapper, { item, isItemClickable, onClickItem, renderItemLink, className: "dataviews-view-grid__media", ...mediaA11yProps, children: renderedMediaField } ), hasBulkActions && shouldRenderMedia && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( DataViewsSelectionCheckbox, { item, selection, onChangeSelection, getItemId, titleField, disabled: !hasBulkAction } ), !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 }) }), showTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", className: "dataviews-view-grid__title-actions", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ItemClickWrapper, { item, isItemClickable, onClickItem, renderItemLink, className: "dataviews-view-grid__title-field dataviews-title-field", ...titleA11yProps, children: renderedTitleField } ), !!actions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ItemActions, { item, actions, isCompact: true } ) ] } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [ showDescription && descriptionField?.render && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( descriptionField.render, { item, field: descriptionField } ), !!badgeFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHStack, { className: "dataviews-view-grid__badge-fields", spacing: 2, wrap: true, alignment: "top", justify: "flex-start", children: badgeFields.map((field) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( Badge, { className: "dataviews-view-grid__field-value", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( field.render, { item, field } ) }, field.id ); }) } ), !!regularFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-view-grid__fields", spacing: 1, children: regularFields.map((field) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Flex, { className: "dataviews-view-grid__field", gap: 1, justify: "flex-start", expanded: true, style: { height: "auto" }, direction: "row", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__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 }) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FlexItem, { className: "dataviews-view-grid__field-value", style: { maxHeight: "none" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( field.render, { item, field } ) } ) ] }) }, field.id ); }) } ) ] }) ] }, id ); } function ViewGrid({ actions, data, fields, getItemId, isLoading, onChangeSelection, onClickItem, isItemClickable, renderItemLink, selection, view, className, empty }) { const { resizeObserverRef } = (0,external_wp_element_.useContext)(dataviews_context_default); const titleField = fields.find( (field) => field.id === view?.titleField ); const mediaField = fields.find( (field) => field.id === view?.mediaField ); const descriptionField = fields.find( (field) => field.id === view?.descriptionField ); const otherFields = view.fields ?? []; const { regularFields, badgeFields } = otherFields.reduce( (accumulator, fieldId) => { const field = fields.find((f) => f.id === fieldId); if (!field) { return accumulator; } const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields"; accumulator[key].push(field); return accumulator; }, { regularFields: [], badgeFields: [] } ); const hasData = !!data?.length; const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); const usedPreviewSize = view.layout?.previewSize; const size = "900px"; const groupField = view.groupByField ? fields.find((f) => f.id === view.groupByField) : null; const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { // Render multiple groups. children: [ hasData && groupField && dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: Array.from(dataByGroup.entries()).map( ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { className: "dataviews-view-grid__group-header", children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"), groupField.label, groupName ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridItems, { className: dist_clsx( "dataviews-view-grid", className ), previewSize: usedPreviewSize, "aria-busy": isLoading, ref: resizeObserverRef, children: groupItems.map((item) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridItem, { view, selection, onChangeSelection, onClickItem, isItemClickable, renderItemLink, getItemId, item, actions, mediaField, titleField, descriptionField, regularFields, badgeFields, hasBulkActions, config: { sizes: size } }, getItemId(item) ); }) } ) ] }, groupName) ) }), // Render a single grid with all data. hasData && !dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridItems, { className: dist_clsx("dataviews-view-grid", className), previewSize: usedPreviewSize, "aria-busy": isLoading, ref: resizeObserverRef, role: isInfiniteScroll ? "feed" : void 0, children: data.map((item, index) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridItem, { view, selection, onChangeSelection, onClickItem, isItemClickable, renderItemLink, getItemId, item, actions, mediaField, titleField, descriptionField, regularFields, badgeFields, hasBulkActions, config: { sizes: size }, posinset: isInfiniteScroll ? index + 1 : void 0 }, getItemId(item) ); }) } ), // Render empty state. !hasData && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx({ "dataviews-loading": isLoading, "dataviews-no-results": !isLoading }), children: isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty } ), 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, {}) }) ] }); } var grid_default = ViewGrid; ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/list/index.js const { Menu: list_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function generateItemWrapperCompositeId(idPrefix) { return `${idPrefix}-item-wrapper`; } function generatePrimaryActionCompositeId(idPrefix, primaryActionId) { return `${idPrefix}-primary-action-${primaryActionId}`; } function generateDropdownTriggerCompositeId(idPrefix) { return `${idPrefix}-dropdown`; } function PrimaryActionGridCell({ idPrefix, primaryAction, item }) { const registry = (0,external_wp_data_.useRegistry)(); const [isModalOpen, setIsModalOpen] = (0,external_wp_element_.useState)(false); const compositeItemId = generatePrimaryActionCompositeId( idPrefix, primaryAction.id ); const label = typeof primaryAction.label === "string" ? primaryAction.label : primaryAction.label([item]); return "RenderModal" in primaryAction ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite.Item, { id: compositeItemId, render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { disabled: !!primaryAction.disabled, accessibleWhenDisabled: true, text: label, size: "small", onClick: () => setIsModalOpen(true) } ), children: isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ActionModal, { action: primaryAction, items: [item], closeModal: () => setIsModalOpen(false) } ) } ) }, primaryAction.id) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite.Item, { id: compositeItemId, render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { disabled: !!primaryAction.disabled, accessibleWhenDisabled: true, size: "small", onClick: () => { primaryAction.callback([item], { registry }); }, children: label } ) } ) }, primaryAction.id); } function ListItem({ view, actions, idPrefix, isSelected, item, titleField, mediaField, descriptionField, onSelect, otherFields, onDropdownTriggerKeyDown, posinset }) { const { showTitle = true, showMedia = true, showDescription = true, infiniteScrollEnabled } = view; const itemRef = (0,external_wp_element_.useRef)(null); const labelId = `${idPrefix}-label`; const descriptionId = `${idPrefix}-description`; const registry = (0,external_wp_data_.useRegistry)(); const [isHovered, setIsHovered] = (0,external_wp_element_.useState)(false); const [activeModalAction, setActiveModalAction] = (0,external_wp_element_.useState)( null ); const handleHover = ({ type }) => { const isHover = type === "mouseenter"; setIsHovered(isHover); }; const { paginationInfo } = (0,external_wp_element_.useContext)(dataviews_context_default); (0,external_wp_element_.useEffect)(() => { if (isSelected) { itemRef.current?.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" }); } }, [isSelected]); const { primaryAction, eligibleActions } = (0,external_wp_element_.useMemo)(() => { const _eligibleActions = actions.filter( (action) => !action.isEligible || action.isEligible(item) ); const _primaryActions = _eligibleActions.filter( (action) => action.isPrimary ); return { primaryAction: _primaryActions[0], eligibleActions: _eligibleActions }; }, [actions, item]); const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1; 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)( mediaField.render, { item, field: mediaField, config: { sizes: "52px" } } ) }) : null; const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField }) : null; 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: [ primaryAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PrimaryActionGridCell, { idPrefix, primaryAction, item } ), !hasOnlyOnePrimaryAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { role: "gridcell", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(list_Menu, { placement: "bottom-end", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( list_Menu.TriggerButton, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite.Item, { id: generateDropdownTriggerCompositeId( idPrefix ), render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { size: "small", icon: more_vertical_default, label: (0,external_wp_i18n_namespaceObject.__)("Actions"), accessibleWhenDisabled: true, disabled: !actions.length, onKeyDown: onDropdownTriggerKeyDown } ) } ) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(list_Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ActionsMenuGroup, { actions: eligibleActions, item, registry, setActiveModalAction } ) }) ] }), !!activeModalAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ActionModal, { action: activeModalAction, items: [item], closeModal: () => setActiveModalAction(null) } ) ] }) ] }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite.Row, { ref: itemRef, render: ( /* aria-posinset breaks Composite.Row if passed to it directly. */ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { "aria-posinset": posinset, "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0 } ) ), role: infiniteScrollEnabled ? "article" : "row", className: dist_clsx({ "is-selected": isSelected, "is-hovered": isHovered }), onMouseEnter: handleHover, onMouseLeave: handleHover, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "dataviews-view-list__item-wrapper", spacing: 0, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite.Item, { id: generateItemWrapperCompositeId(idPrefix), "aria-pressed": isSelected, "aria-labelledby": labelId, "aria-describedby": descriptionId, className: "dataviews-view-list__item", onClick: () => onSelect(item) } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, justify: "start", alignment: "flex-start", children: [ renderedMediaField, /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, className: "dataviews-view-list__field-wrapper", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 0, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "dataviews-title-field", id: labelId, children: renderedTitleField } ), usedActions ] }), showDescription && descriptionField?.render && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-list__field", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( descriptionField.render, { item, field: descriptionField } ) }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: "dataviews-view-list__fields", id: descriptionId, children: otherFields.map((field) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( "div", { className: "dataviews-view-list__field", children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.VisuallyHidden, { as: "span", className: "dataviews-view-list__field-label", children: field.label } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-view-list__field-value", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( field.render, { item, field } ) }) ] }, field.id )) } ) ] } ) ] }) ] }) } ); } function isDefined(item) { return !!item; } function ViewList(props) { const { actions, data, fields, getItemId, isLoading, onChangeSelection, selection, view, className, empty } = props; const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ViewList, "view-list"); const selectedItem = data?.findLast( (item) => selection.includes(getItemId(item)) ); const titleField = fields.find((field) => field.id === view.titleField); const mediaField = fields.find((field) => field.id === view.mediaField); const descriptionField = fields.find( (field) => field.id === view.descriptionField ); const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f) => fieldId === f.id)).filter(isDefined); const onSelect = (item) => onChangeSelection([getItemId(item)]); const generateCompositeItemIdPrefix = (0,external_wp_element_.useCallback)( (item) => `${baseId}-${getItemId(item)}`, [baseId, getItemId] ); const isActiveCompositeItem = (0,external_wp_element_.useCallback)( (item, idToCheck) => { return idToCheck.startsWith( generateCompositeItemIdPrefix(item) ); }, [generateCompositeItemIdPrefix] ); const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_.useState)(void 0); (0,external_wp_element_.useEffect)(() => { if (selectedItem) { setActiveCompositeId( generateItemWrapperCompositeId( generateCompositeItemIdPrefix(selectedItem) ) ); } }, [selectedItem, generateCompositeItemIdPrefix]); const activeItemIndex = data.findIndex( (item) => isActiveCompositeItem(item, activeCompositeId ?? "") ); const previousActiveItemIndex = (0,external_wp_compose_namespaceObject.usePrevious)(activeItemIndex); const isActiveIdInList = activeItemIndex !== -1; const selectCompositeItem = (0,external_wp_element_.useCallback)( (targetIndex, generateCompositeId) => { const clampedIndex = Math.min( data.length - 1, Math.max(0, targetIndex) ); if (!data[clampedIndex]) { return; } const itemIdPrefix = generateCompositeItemIdPrefix( data[clampedIndex] ); const targetCompositeItemId = generateCompositeId(itemIdPrefix); setActiveCompositeId(targetCompositeItemId); document.getElementById(targetCompositeItemId)?.focus(); }, [data, generateCompositeItemIdPrefix] ); (0,external_wp_element_.useEffect)(() => { const wasActiveIdInList = previousActiveItemIndex !== void 0 && previousActiveItemIndex !== -1; if (!isActiveIdInList && wasActiveIdInList) { selectCompositeItem( previousActiveItemIndex, generateItemWrapperCompositeId ); } }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]); const onDropdownTriggerKeyDown = (0,external_wp_element_.useCallback)( (event) => { if (event.key === "ArrowDown") { event.preventDefault(); selectCompositeItem( activeItemIndex + 1, generateDropdownTriggerCompositeId ); } if (event.key === "ArrowUp") { event.preventDefault(); selectCompositeItem( activeItemIndex - 1, generateDropdownTriggerCompositeId ); } }, [selectCompositeItem, activeItemIndex] ); const hasData = data?.length; if (!hasData) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx({ "dataviews-loading": isLoading, "dataviews-no-results": !hasData && !isLoading }), children: !hasData && (isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty) } ); } const groupField = view.groupByField ? fields.find((field) => field.id === view.groupByField) : null; const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; if (hasData && groupField && dataByGroup) { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite, { id: `${baseId}`, render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), className: "dataviews-view-list__group", role: "grid", activeId: activeCompositeId, setActiveId: setActiveCompositeId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, className: dist_clsx("dataviews-view-list", className), children: Array.from(dataByGroup.entries()).map( ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { className: "dataviews-view-list__group-header", children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"), groupField.label, groupName ) }), groupItems.map((item) => { const id = generateCompositeItemIdPrefix(item); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ListItem, { view, idPrefix: id, actions, item, isSelected: item === selectedItem, onSelect, mediaField, titleField, descriptionField, otherFields, onDropdownTriggerKeyDown }, id ); }) ] }, groupName) ) } ) } ); } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite, { id: baseId, render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}), className: dist_clsx("dataviews-view-list", className), role: view.infiniteScrollEnabled ? "feed" : "grid", activeId: activeCompositeId, setActiveId: setActiveCompositeId, children: data.map((item, index) => { const id = generateCompositeItemIdPrefix(item); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( ListItem, { view, idPrefix: id, actions, item, isSelected: item === selectedItem, onSelect, mediaField, titleField, descriptionField, otherFields, onDropdownTriggerKeyDown, posinset: view.infiniteScrollEnabled ? index + 1 : void 0 }, id ); }) } ), 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, {}) }) ] }); } ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-picker/footer.js const footer_EMPTY_ARRAY = (/* unused pure expression or super */ null && ([])); function useIsMultiselectPicker(actions) { return (0,external_wp_element_.useMemo)(() => { return actions?.every((action) => action.supportsBulk); }, [actions]); } function footer_BulkSelectionCheckbox({ selection, selectedItems, onChangeSelection, data, getItemId }) { const areAllSelected = selectedItems.length === data.length; return /* @__PURE__ */ jsx( CheckboxControl, { className: "dataviews-view-table-selection-checkbox", __nextHasNoMarginBottom: true, checked: areAllSelected, indeterminate: !areAllSelected && !!selectedItems.length, onChange: () => { if (areAllSelected) { onChangeSelection( selection.filter( (id) => !data.some( (item) => id === getItemId(item) ) ) ); } else { const selectionSet = /* @__PURE__ */ new Set([ ...selection, ...data.map((item) => getItemId(item)) ]); onChangeSelection(Array.from(selectionSet)); } }, "aria-label": areAllSelected ? __("Deselect all") : __("Select all") } ); } function ActionButtons({ actions, items, selection }) { const registry = useRegistry(); const [actionInProgress, setActionInProgress] = useState( null ); return /* @__PURE__ */ jsx(HStack, { expanded: false, spacing: 1, children: actions.map((action) => { if (!("callback" in action)) { return null; } const { id, label, icon, isPrimary, callback } = action; const _label = typeof label === "string" ? label : label(items); const variant = isPrimary ? "primary" : "tertiary"; const isInProgress = id === actionInProgress; return /* @__PURE__ */ jsx( Button, { accessibleWhenDisabled: true, icon, disabled: isInProgress || !selection?.length, isBusy: isInProgress, onClick: async () => { setActionInProgress(id); await callback(items, { registry }); setActionInProgress(null); }, size: "compact", variant, children: _label }, id ); }) }); } function DataViewsPickerFooter() { const { data, selection, onChangeSelection, getItemId, actions = footer_EMPTY_ARRAY } = useContext(DataViewsContext); const selectionCount = selection.length; const isMultiselect = useIsMultiselectPicker(actions); const message = selectionCount > 0 ? sprintf( /* translators: %d: number of items. */ _n( "%d Item selected", "%d Items selected", selectionCount ), selectionCount ) : sprintf( /* translators: %d: number of items. */ _n("%d Item", "%d Items", data.length), data.length ); const selectedItems = useMemo( () => data.filter((item) => selection.includes(getItemId(item))), [selection, getItemId, data] ); return /* @__PURE__ */ jsxs( HStack, { expanded: false, justify: "space-between", className: "dataviews-footer", children: [ /* @__PURE__ */ jsxs( HStack, { className: "dataviews-picker-footer__bulk-selection", expanded: false, spacing: 3, children: [ isMultiselect && /* @__PURE__ */ jsx( footer_BulkSelectionCheckbox, { selection, selectedItems, onChangeSelection, data, getItemId } ), /* @__PURE__ */ jsx("span", { className: "dataviews-bulk-actions-footer__item-count", children: message }) ] } ), /* @__PURE__ */ jsx(DataViewsPagination, {}), Boolean(actions?.length) && /* @__PURE__ */ jsx("div", { className: "dataviews-picker-footer__actions", children: /* @__PURE__ */ jsx( ActionButtons, { actions, items: selectedItems, selection } ) }) ] } ); } ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/picker-grid/index.js const { Badge: picker_grid_Badge } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function picker_grid_GridItem({ view, multiselect, selection, onChangeSelection, getItemId, item, mediaField, titleField, descriptionField, regularFields, badgeFields, config, posinset, setsize }) { const { showTitle = true, showMedia = true, showDescription = true } = view; const id = getItemId(item); const isSelected = selection.includes(id); const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( mediaField.render, { item, field: mediaField, config } ) : null; const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField }) : null; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.Composite.Item, { "aria-label": titleField ? titleField.getValue({ item }) || (0,external_wp_i18n_namespaceObject.__)("(no title)") : void 0, render: ({ children, ...props }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children, ...props }), role: "option", "aria-posinset": posinset, "aria-setsize": setsize, className: dist_clsx("dataviews-view-picker-grid__card", { "is-selected": isSelected }), "aria-selected": isSelected, onClick: () => { if (isSelected) { onChangeSelection( selection.filter((itemId) => id !== itemId) ); } else { const newSelection = multiselect ? [...selection, id] : [id]; onChangeSelection(newSelection); } }, children: [ showMedia && renderedMediaField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-picker-grid__media", children: renderedMediaField }), showMedia && renderedMediaField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( DataViewsSelectionCheckbox, { item, selection, onChangeSelection, getItemId, titleField, disabled: false, "aria-hidden": true, tabIndex: -1 } ), showTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", className: "dataviews-view-picker-grid__title-actions", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-picker-grid__title-field dataviews-title-field", children: renderedTitleField }) } ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [ showDescription && descriptionField?.render && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( descriptionField.render, { item, field: descriptionField } ), !!badgeFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalHStack, { className: "dataviews-view-picker-grid__badge-fields", spacing: 2, wrap: true, alignment: "top", justify: "flex-start", children: badgeFields.map((field) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( picker_grid_Badge, { className: "dataviews-view-picker-grid__field-value", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( field.render, { item, field } ) }, field.id ); }) } ), !!regularFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-view-picker-grid__fields", spacing: 1, children: regularFields.map((field) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Flex, { className: "dataviews-view-picker-grid__field", gap: 1, justify: "flex-start", expanded: true, style: { height: "auto" }, direction: "row", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "dataviews-view-picker-grid__field-name", children: field.header }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.FlexItem, { className: "dataviews-view-picker-grid__field-value", style: { maxHeight: "none" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( field.render, { item, field } ) } ) ] }) }, field.id ); }) } ) ] }) ] }, id ); } function GridGroup({ groupName, groupField, children }) { const headerId = (0,external_wp_compose_namespaceObject.useInstanceId)( GridGroup, "dataviews-view-picker-grid-group__header" ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, role: "group", "aria-labelledby": headerId, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "h3", { className: "dataviews-view-picker-grid-group__header", id: headerId, children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"), groupField.label, groupName ) } ), children ] }, groupName ); } function ViewPickerGrid({ actions, data, fields, getItemId, isLoading, onChangeSelection, selection, view, className, empty }) { const { resizeObserverRef, paginationInfo, itemListLabel } = (0,external_wp_element_.useContext)(dataviews_context_default); const titleField = fields.find( (field) => field.id === view?.titleField ); const mediaField = fields.find( (field) => field.id === view?.mediaField ); const descriptionField = fields.find( (field) => field.id === view?.descriptionField ); const otherFields = view.fields ?? []; const { regularFields, badgeFields } = otherFields.reduce( (accumulator, fieldId) => { const field = fields.find((f) => f.id === fieldId); if (!field) { return accumulator; } const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields"; accumulator[key].push(field); return accumulator; }, { regularFields: [], badgeFields: [] } ); const hasData = !!data?.length; const usedPreviewSize = view.layout?.previewSize; const isMultiselect = useIsMultiselectPicker(actions); const size = "900px"; const groupField = view.groupByField ? fields.find((f) => f.id === view.groupByField) : null; const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; const currentPage = view?.page ?? 1; const perPage = view?.perPage ?? 0; const setSize = isInfiniteScroll ? paginationInfo?.totalItems : void 0; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { // Render multiple groups. children: [ hasData && groupField && dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite, { virtualFocus: true, orientation: "horizontal", role: "listbox", "aria-multiselectable": isMultiselect, className: dist_clsx( "dataviews-view-picker-grid", className ), "aria-label": itemListLabel, render: ({ children, ...props }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children, ...props } ), children: Array.from(dataByGroup.entries()).map( ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridGroup, { groupName, groupField, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridItems, { previewSize: usedPreviewSize, style: { gridTemplateColumns: usedPreviewSize && `repeat(auto-fill, minmax(${usedPreviewSize}px, 1fr))` }, "aria-busy": isLoading, ref: resizeObserverRef, children: groupItems.map((item) => { const posInSet = (currentPage - 1) * perPage + data.indexOf(item) + 1; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( picker_grid_GridItem, { view, multiselect: isMultiselect, selection, onChangeSelection, getItemId, item, mediaField, titleField, descriptionField, regularFields, badgeFields, config: { sizes: size }, posinset: posInSet, setsize: setSize }, getItemId(item) ); }) } ) }, groupName ) ) } ), // Render a single grid with all data. hasData && !dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Composite, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( GridItems, { className: dist_clsx( "dataviews-view-picker-grid", className ), previewSize: usedPreviewSize, "aria-busy": isLoading, ref: resizeObserverRef } ), virtualFocus: true, orientation: "horizontal", role: "listbox", "aria-multiselectable": isMultiselect, "aria-label": itemListLabel, children: data.map((item, index) => { let posinset = isInfiniteScroll ? index + 1 : void 0; if (!isInfiniteScroll) { posinset = (currentPage - 1) * perPage + index + 1; } return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( picker_grid_GridItem, { view, multiselect: isMultiselect, selection, onChangeSelection, getItemId, item, mediaField, titleField, descriptionField, regularFields, badgeFields, config: { sizes: size }, posinset, setsize: setSize }, getItemId(item) ); }) } ), // Render empty state. !hasData && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( "div", { className: dist_clsx({ "dataviews-loading": isLoading, "dataviews-no-results": !isLoading }), children: isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty } ), 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, {}) }) ] }); } var picker_grid_default = ViewPickerGrid; ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/preview-size-picker.js const imageSizes = [ { value: 120, breakpoint: 1 }, { value: 170, breakpoint: 1 }, { value: 230, breakpoint: 1 }, { value: 290, breakpoint: 1112 // at minimum image width, 4 images display at this container size }, { value: 350, breakpoint: 1636 // at minimum image width, 6 images display at this container size }, { value: 430, breakpoint: 588 // at minimum image width, 2 images display at this container size } ]; function PreviewSizePicker() { const context = (0,external_wp_element_.useContext)(dataviews_context_default); const view = context.view; const breakValues = imageSizes.filter((size) => { return context.containerWidth >= size.breakpoint; }); const layoutPreviewSize = view.layout?.previewSize ?? 230; const previewSizeToUse = breakValues.map((size, index) => ({ ...size, index })).filter((size) => size.value <= layoutPreviewSize).sort((a, b) => b.value - a.value)[0]?.index ?? 0; const marks = breakValues.map((size, index) => { return { value: index }; }); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.RangeControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, showTooltip: false, label: (0,external_wp_i18n_namespaceObject.__)("Preview size"), value: previewSizeToUse, min: 0, max: breakValues.length - 1, withInputField: false, onChange: (value = 0) => { context.onChangeView({ ...view, layout: { ...view.layout, previewSize: breakValues[value].value } }); }, step: 1, marks } ); } ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/density-picker.js function DensityPicker() { const context = (0,external_wp_element_.useContext)(dataviews_context_default); const view = context.view; return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, size: "__unstable-large", label: (0,external_wp_i18n_namespaceObject.__)("Density"), value: view.layout?.density || "balanced", onChange: (value) => { context.onChangeView({ ...view, layout: { ...view.layout, density: value } }); }, isBlock: true, children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "comfortable", label: (0,external_wp_i18n_namespaceObject._x)( "Comfortable", "Density option for DataView layout" ) }, "comfortable" ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "balanced", label: (0,external_wp_i18n_namespaceObject._x)("Balanced", "Density option for DataView layout") }, "balanced" ), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "compact", label: (0,external_wp_i18n_namespaceObject._x)("Compact", "Density option for DataView layout") }, "compact" ) ] } ); } ;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/index.js const VIEW_LAYOUTS = [ { type: constants_LAYOUT_TABLE, label: (0,external_wp_i18n_namespaceObject.__)("Table"), component: table_default, icon: block_table_default, viewConfigOptions: DensityPicker }, { type: constants_LAYOUT_GRID, label: (0,external_wp_i18n_namespaceObject.__)("Grid"), component: grid_default, icon: category_default, viewConfigOptions: PreviewSizePicker }, { type: constants_LAYOUT_LIST, label: (0,external_wp_i18n_namespaceObject.__)("List"), component: ViewList, icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_bullets_rtl_default : format_list_bullets_default }, { type: LAYOUT_PICKER_GRID, label: (0,external_wp_i18n_namespaceObject.__)("Grid"), component: picker_grid_default, icon: category_default, viewConfigOptions: PreviewSizePicker, isPicker: true } ]; ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/add-filter.js const { Menu: add_filter_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); function AddFilterMenu({ filters, view, onChangeView, setOpenedFilter, triggerProps }) { const inactiveFilters = filters.filter((filter) => !filter.isVisible); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(add_filter_Menu, { children: [ /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.TriggerButton, { ...triggerProps }), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.Popover, { children: inactiveFilters.map((filter) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( add_filter_Menu.Item, { onClick: () => { setOpenedFilter(filter.field); onChangeView({ ...view, page: 1, filters: [ ...view.filters || [], { field: filter.field, value: void 0, operator: filter.operators[0] } ] }); }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.ItemLabel, { children: filter.name }) }, filter.field ); }) }) ] }); } function AddFilter({ filters, view, onChangeView, setOpenedFilter }, ref) { if (!filters.length || filters.every(({ isPrimary }) => isPrimary)) { return null; } const inactiveFilters = filters.filter((filter) => !filter.isVisible); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AddFilterMenu, { triggerProps: { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { accessibleWhenDisabled: true, size: "compact", className: "dataviews-filters-button", variant: "tertiary", disabled: !inactiveFilters.length, ref } ), children: (0,external_wp_i18n_namespaceObject.__)("Add filter") }, ...{ filters, view, onChangeView, setOpenedFilter } } ); } var add_filter_default = (0,external_wp_element_.forwardRef)(AddFilter); ;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/toggle.js function FiltersToggle() { const { filters, view, onChangeView, setOpenedFilter, isShowingFilter, setIsShowingFilter } = (0,external_wp_element_.useContext)(dataviews_context_default); const buttonRef = (0,external_wp_element_.useRef)(null); const onChangeViewWithFilterVisibility = (0,external_wp_element_.useCallback)( (_view) => { onChangeView(_view); setIsShowingFilter(true); }, [onChangeView, setIsShowingFilter] ); const visibleFilters = filters.filter((filter) => filter.isVisible); const hasVisibleFilters = !!visibleFilters.length; if (filters.length === 0) { return null; } const addFilterButtonProps = { label: (0,external_wp_i18n_namespaceObject.__)("Add filter"), "aria-expanded": false, isPressed: false }; const toggleFiltersButtonProps = { label: (0,external_wp_i18n_namespaceObject._x)("Filter", "verb"), "aria-expanded": isShowingFilter, isPressed: isShowingFilter, onClick: () => { if (!isShowingFilter) { setOpenedFilter(null); } setIsShowingFilter(!isShowingFilter); } }; const buttonComponent = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( external_wp_components_namespaceObject.Button, { ref: buttonRef, className: "dataviews-filters__visibility-toggle", size: "compact", icon: funnel_default, ...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps } ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__container-visibility-toggle", children: !hasVisibleFilters ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( AddFilterMenu, { filters, view, onChangeView: onChangeViewWithFilterVisibility, setOpenedFilter, triggerProps: { render: buttonComponent } } ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( FilterVisibilityToggle, { buttonRef, filtersCount: view.filters?.length, children: buttonComponent } ) }); } function FilterVisibilityToggle({ buttonRef, filtersCount, children }) { (0,external_wp_element_.useEffect)( () => () => { buttonRef.current?.focus(); }, [buttonRef] ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ children, !!filtersCount && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters-toggle__count", children: filtersCount }) ] }); } var toggle_default = FiltersToggle; ;// ./node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js "use client"; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var _3YLGPPWQ_spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var _3YLGPPWQ_spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); var __objRest = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols) for (var prop of __getOwnPropSymbols(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) target[prop] = source[prop]; } return target; }; ;// ./node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js "use client"; var _3YLGPPWQ_defProp = Object.defineProperty; var _3YLGPPWQ_defProps = Object.defineProperties; var _3YLGPPWQ_getOwnPropDescs = Object.getOwnPropertyDescriptors; var _3YLGPPWQ_getOwnPropSymbols = Object.getOwnPropertySymbols; var _3YLGPPWQ_hasOwnProp = Object.prototype.hasOwnProperty; var _3YLGPPWQ_propIsEnum = Object.prototype.propertyIsEnumerable; var _3YLGPPWQ_defNormalProp = (obj, key, value) => key in obj ? _3YLGPPWQ_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var _chunks_3YLGPPWQ_spreadValues = (a, b) => { for (var prop in b || (b = {})) if (_3YLGPPWQ_hasOwnProp.call(b, prop)) _3YLGPPWQ_defNormalProp(a, prop, b[prop]); if (_3YLGPPWQ_getOwnPropSymbols) for (var prop of _3YLGPPWQ_getOwnPropSymbols(b)) { if (_3YLGPPWQ_propIsEnum.call(b, prop)) _3YLGPPWQ_defNormalProp(a, prop, b[prop]); } return a; }; var _chunks_3YLGPPWQ_spreadProps = (a, b) => _3YLGPPWQ_defProps(a, _3YLGPPWQ_getOwnPropDescs(b)); var _3YLGPPWQ_objRest = (source, exclude) => { var target = {}; for (var prop in source) if (_3YLGPPWQ_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && _3YLGPPWQ_getOwnPropSymbols) for (var prop of _3YLGPPWQ_getOwnPropSymbols(source)) { if (exclude.indexOf(prop) < 0 && _3YLGPPWQ_propIsEnum.call(source, prop)) target[prop] = source[prop]; } return target; }; ;// ./node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js "use client"; // src/utils/misc.ts function PBFD2E7P_noop(..._) { } function shallowEqual(a, b) { if (a === b) return true; if (!a) return false; if (!b) return false; if (typeof a !== "object") return false; if (typeof b !== "object") return false; const aKeys = Object.keys(a); const bKeys = Object.keys(b); const { length } = aKeys; if (bKeys.length !== length) return false; for (const key of aKeys) { if (a[key] !== b[key]) { return false; } } return true; } function applyState(argument, currentValue) { if (isUpdater(argument)) { const value = isLazyValue(currentValue) ? currentValue() : currentValue; return argument(value); } return argument; } function isUpdater(argument) { return typeof argument === "function"; } function isLazyValue(value) { return typeof value === "function"; } function isObject(arg) { return typeof arg === "object" && arg != null; } function PBFD2E7P_isEmpty(arg) { if (Array.isArray(arg)) return !arg.length; if (isObject(arg)) return !Object.keys(arg).length; if (arg == null) return true; if (arg === "") return true; return false; } function isInteger(arg) { if (typeof arg === "number") { return Math.floor(arg) === arg; } return String(Math.floor(Number(arg))) === arg; } function PBFD2E7P_hasOwnProperty(object, prop) { if (typeof Object.hasOwn === "function") { return Object.hasOwn(object, prop); } return Object.prototype.hasOwnProperty.call(object, prop); } function chain(...fns) { return (...args) => { for (const fn of fns) { if (typeof fn === "function") { fn(...args); } } }; } function cx(...args) { return args.filter(Boolean).join(" ") || void 0; } function PBFD2E7P_normalizeString(str) { return str.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); } function omit(object, keys) { const result = _chunks_3YLGPPWQ_spreadValues({}, object); for (const key of keys) { if (PBFD2E7P_hasOwnProperty(result, key)) { delete result[key]; } } return result; } function pick(object, paths) { const result = {}; for (const key of paths) { if (PBFD2E7P_hasOwnProperty(object, key)) { result[key] = object[key]; } } return result; } function identity(value) { return value; } function beforePaint(cb = PBFD2E7P_noop) { const raf = requestAnimationFrame(cb); return () => cancelAnimationFrame(raf); } function afterPaint(cb = PBFD2E7P_noop) { let raf = requestAnimationFrame(() => { raf = requestAnimationFrame(cb); }); return () => cancelAnimationFrame(raf); } function invariant(condition, message) { if (condition) return; if (typeof message !== "string") throw new Error("Invariant failed"); throw new Error(message); } function getKeys(obj) { return Object.keys(obj); } function isFalsyBooleanCallback(booleanOrCallback, ...args) { const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback; if (result == null) return false; return !result; } function disabledFromProps(props) { return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true"; } function removeUndefinedValues(obj) { const result = {}; for (const key in obj) { if (obj[key] !== void 0) { result[key] = obj[key]; } } return result; } function defaultValue(...values) { for (const value of values) { if (value !== void 0) return value; } return void 0; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js "use client"; // src/utils/misc.ts function setRef(ref, value) { if (typeof ref === "function") { ref(value); } else if (ref) { ref.current = value; } } function isValidElementWithRef(element) { if (!element) return false; if (!(0,external_React_.isValidElement)(element)) return false; if ("ref" in element.props) return true; if ("ref" in element) return true; return false; } function getRefProperty(element) { if (!isValidElementWithRef(element)) return null; const props = _3YLGPPWQ_spreadValues({}, element.props); return props.ref || element.ref; } function mergeProps(base, overrides) { const props = _3YLGPPWQ_spreadValues({}, base); for (const key in overrides) { if (!PBFD2E7P_hasOwnProperty(overrides, key)) continue; if (key === "className") { const prop = "className"; props[prop] = base[prop] ? `${base[prop]} ${overrides[prop]}` : overrides[prop]; continue; } if (key === "style") { const prop = "style"; props[prop] = base[prop] ? _3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, base[prop]), overrides[prop]) : overrides[prop]; continue; } const overrideValue = overrides[key]; if (typeof overrideValue === "function" && key.startsWith("on")) { const baseValue = base[key]; if (typeof baseValue === "function") { props[key] = (...args) => { overrideValue(...args); baseValue(...args); }; continue; } } props[key] = overrideValue; } return props; } ;// ./node_modules/@ariakit/core/esm/__chunks/DTR5TSDJ.js "use client"; // src/utils/dom.ts var DTR5TSDJ_canUseDOM = checkIsBrowser(); function checkIsBrowser() { var _a; return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement); } function getDocument(node) { if (!node) return document; if ("self" in node) return node.document; return node.ownerDocument || document; } function getWindow(node) { if (!node) return self; if ("self" in node) return node.self; return getDocument(node).defaultView || window; } function DTR5TSDJ_getActiveElement(node, activeDescendant = false) { const { activeElement } = getDocument(node); if (!(activeElement == null ? void 0 : activeElement.nodeName)) { return null; } if (DTR5TSDJ_isFrame(activeElement) && activeElement.contentDocument) { return DTR5TSDJ_getActiveElement( activeElement.contentDocument.body, activeDescendant ); } if (activeDescendant) { const id = activeElement.getAttribute("aria-activedescendant"); if (id) { const element = getDocument(activeElement).getElementById(id); if (element) { return element; } } } return activeElement; } function contains(parent, child) { return parent === child || parent.contains(child); } function DTR5TSDJ_isFrame(element) { return element.tagName === "IFRAME"; } function isButton(element) { const tagName = element.tagName.toLowerCase(); if (tagName === "button") return true; if (tagName === "input" && element.type) { return buttonInputTypes.indexOf(element.type) !== -1; } return false; } var buttonInputTypes = [ "button", "color", "file", "image", "reset", "submit" ]; function isVisible(element) { if (typeof element.checkVisibility === "function") { return element.checkVisibility(); } const htmlElement = element; return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0; } function isTextField(element) { try { const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null; const isTextArea = element.tagName === "TEXTAREA"; return isTextInput || isTextArea || false; } catch (error) { return false; } } function isTextbox(element) { return element.isContentEditable || isTextField(element); } function getTextboxValue(element) { if (isTextField(element)) { return element.value; } if (element.isContentEditable) { const range = getDocument(element).createRange(); range.selectNodeContents(element); return range.toString(); } return ""; } function getTextboxSelection(element) { let start = 0; let end = 0; if (isTextField(element)) { start = element.selectionStart || 0; end = element.selectionEnd || 0; } else if (element.isContentEditable) { const selection = getDocument(element).getSelection(); if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) { const range = selection.getRangeAt(0); const nextRange = range.cloneRange(); nextRange.selectNodeContents(element); nextRange.setEnd(range.startContainer, range.startOffset); start = nextRange.toString().length; nextRange.setEnd(range.endContainer, range.endOffset); end = nextRange.toString().length; } } return { start, end }; } function getPopupRole(element, fallback) { const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"]; const role = element == null ? void 0 : element.getAttribute("role"); if (role && allowedPopupRoles.indexOf(role) !== -1) { return role; } return fallback; } function getPopupItemRole(element, fallback) { var _a; const itemRoleByPopupRole = { menu: "menuitem", listbox: "option", tree: "treeitem" }; const popupRole = getPopupRole(element); if (!popupRole) return fallback; const key = popupRole; return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback; } function scrollIntoViewIfNeeded(element, arg) { if (isPartiallyHidden(element) && "scrollIntoView" in element) { element.scrollIntoView(arg); } } function getScrollingElement(element) { if (!element) return null; const isScrollableOverflow = (overflow) => { if (overflow === "auto") return true; if (overflow === "scroll") return true; return false; }; if (element.clientHeight && element.scrollHeight > element.clientHeight) { const { overflowY } = getComputedStyle(element); if (isScrollableOverflow(overflowY)) return element; } else if (element.clientWidth && element.scrollWidth > element.clientWidth) { const { overflowX } = getComputedStyle(element); if (isScrollableOverflow(overflowX)) return element; } return getScrollingElement(element.parentElement) || document.scrollingElement || document.body; } function isPartiallyHidden(element) { const elementRect = element.getBoundingClientRect(); const scroller = getScrollingElement(element); if (!scroller) return false; const scrollerRect = scroller.getBoundingClientRect(); const isHTML = scroller.tagName === "HTML"; const scrollerTop = isHTML ? scrollerRect.top + scroller.scrollTop : scrollerRect.top; const scrollerBottom = isHTML ? scroller.clientHeight : scrollerRect.bottom; const scrollerLeft = isHTML ? scrollerRect.left + scroller.scrollLeft : scrollerRect.left; const scrollerRight = isHTML ? scroller.clientWidth : scrollerRect.right; const top = elementRect.top < scrollerTop; const left = elementRect.left < scrollerLeft; const bottom = elementRect.bottom > scrollerBottom; const right = elementRect.right > scrollerRight; return top || left || bottom || right; } function setSelectionRange(element, ...args) { if (/text|search|password|tel|url/i.test(element.type)) { element.setSelectionRange(...args); } } function sortBasedOnDOMPosition(items, getElement) { const pairs = items.map((item, index) => [index, item]); let isOrderDifferent = false; pairs.sort(([indexA, a], [indexB, b]) => { const elementA = getElement(a); const elementB = getElement(b); if (elementA === elementB) return 0; if (!elementA || !elementB) return 0; if (isElementPreceding(elementA, elementB)) { if (indexA > indexB) { isOrderDifferent = true; } return -1; } if (indexA < indexB) { isOrderDifferent = true; } return 1; }); if (isOrderDifferent) { return pairs.map(([_, item]) => item); } return items; } function isElementPreceding(a, b) { return Boolean( b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING ); } ;// ./node_modules/@ariakit/core/esm/__chunks/QAGXQEUG.js "use client"; // src/utils/platform.ts function isTouchDevice() { return DTR5TSDJ_canUseDOM && !!navigator.maxTouchPoints; } function isApple() { if (!DTR5TSDJ_canUseDOM) return false; return /mac|iphone|ipad|ipod/i.test(navigator.platform); } function isSafari() { return DTR5TSDJ_canUseDOM && isApple() && /apple/i.test(navigator.vendor); } function isFirefox() { return DTR5TSDJ_canUseDOM && /firefox\//i.test(navigator.userAgent); } function isMac() { return canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice(); } ;// ./node_modules/@ariakit/core/esm/utils/events.js "use client"; // src/utils/events.ts function isPortalEvent(event) { return Boolean( event.currentTarget && !contains(event.currentTarget, event.target) ); } function isSelfTarget(event) { return event.target === event.currentTarget; } function isOpeningInNewTab(event) { const element = event.currentTarget; if (!element) return false; const isAppleDevice = isApple(); if (isAppleDevice && !event.metaKey) return false; if (!isAppleDevice && !event.ctrlKey) return false; const tagName = element.tagName.toLowerCase(); if (tagName === "a") return true; if (tagName === "button" && element.type === "submit") return true; if (tagName === "input" && element.type === "submit") return true; return false; } function isDownloading(event) { const element = event.currentTarget; if (!element) return false; const tagName = element.tagName.toLowerCase(); if (!event.altKey) return false; if (tagName === "a") return true; if (tagName === "button" && element.type === "submit") return true; if (tagName === "input" && element.type === "submit") return true; return false; } function fireEvent(element, type, eventInit) { const event = new Event(type, eventInit); return element.dispatchEvent(event); } function fireBlurEvent(element, eventInit) { const event = new FocusEvent("blur", eventInit); const defaultAllowed = element.dispatchEvent(event); const bubbleInit = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, eventInit), { bubbles: true }); element.dispatchEvent(new FocusEvent("focusout", bubbleInit)); return defaultAllowed; } function fireFocusEvent(element, eventInit) { const event = new FocusEvent("focus", eventInit); const defaultAllowed = element.dispatchEvent(event); const bubbleInit = __spreadProps(__spreadValues({}, eventInit), { bubbles: true }); element.dispatchEvent(new FocusEvent("focusin", bubbleInit)); return defaultAllowed; } function fireKeyboardEvent(element, type, eventInit) { const event = new KeyboardEvent(type, eventInit); return element.dispatchEvent(event); } function fireClickEvent(element, eventInit) { const event = new MouseEvent("click", eventInit); return element.dispatchEvent(event); } function isFocusEventOutside(event, container) { const containerElement = container || event.currentTarget; const relatedTarget = event.relatedTarget; return !relatedTarget || !contains(containerElement, relatedTarget); } function getInputType(event) { const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event; if (!nativeEvent) return; if (!("inputType" in nativeEvent)) return; if (typeof nativeEvent.inputType !== "string") return; return nativeEvent.inputType; } function queueBeforeEvent(element, type, callback, timeout) { const createTimer = (callback2) => { if (timeout) { const timerId2 = setTimeout(callback2, timeout); return () => clearTimeout(timerId2); } const timerId = requestAnimationFrame(callback2); return () => cancelAnimationFrame(timerId); }; const cancelTimer = createTimer(() => { element.removeEventListener(type, callSync, true); callback(); }); const callSync = () => { cancelTimer(); callback(); }; element.addEventListener(type, callSync, { once: true, capture: true }); return cancelTimer; } function addGlobalEventListener(type, listener, options, scope = window) { const children = []; try { scope.document.addEventListener(type, listener, options); for (const frame of Array.from(scope.frames)) { children.push(addGlobalEventListener(type, listener, options, frame)); } } catch (e) { } const removeEventListener = () => { try { scope.document.removeEventListener(type, listener, options); } catch (e) { } for (const remove of children) { remove(); } }; return removeEventListener; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/ABQUS43J.js "use client"; // src/utils/hooks.ts var _React = _3YLGPPWQ_spreadValues({}, external_React_namespaceObject); var useReactId = _React.useId; var useReactDeferredValue = _React.useDeferredValue; var useReactInsertionEffect = _React.useInsertionEffect; var useSafeLayoutEffect = DTR5TSDJ_canUseDOM ? external_React_.useLayoutEffect : external_React_.useEffect; function useInitialValue(value) { const [initialValue] = (0,external_React_.useState)(value); return initialValue; } function useLazyValue(init) { const ref = useRef(); if (ref.current === void 0) { ref.current = init(); } return ref.current; } function useLiveRef(value) { const ref = (0,external_React_.useRef)(value); useSafeLayoutEffect(() => { ref.current = value; }); return ref; } function usePreviousValue(value) { const [previousValue, setPreviousValue] = useState(value); if (value !== previousValue) { setPreviousValue(value); } return previousValue; } function useEvent(callback) { const ref = (0,external_React_.useRef)(() => { throw new Error("Cannot call an event handler while rendering."); }); if (useReactInsertionEffect) { useReactInsertionEffect(() => { ref.current = callback; }); } else { ref.current = callback; } return (0,external_React_.useCallback)((...args) => { var _a; return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args); }, []); } function useTransactionState(callback) { const [state, setState] = (0,external_React_.useState)(null); useSafeLayoutEffect(() => { if (state == null) return; if (!callback) return; let prevState = null; callback((prev) => { prevState = prev; return state; }); return () => { callback(prevState); }; }, [state, callback]); return [state, setState]; } function useMergeRefs(...refs) { return (0,external_React_.useMemo)(() => { if (!refs.some(Boolean)) return; return (value) => { for (const ref of refs) { setRef(ref, value); } }; }, refs); } function useId(defaultId) { if (useReactId) { const reactId = useReactId(); if (defaultId) return defaultId; return reactId; } const [id, setId] = (0,external_React_.useState)(defaultId); useSafeLayoutEffect(() => { if (defaultId || id) return; const random = Math.random().toString(36).slice(2, 8); setId(`id-${random}`); }, [defaultId, id]); return defaultId || id; } function useDeferredValue(value) { if (useReactDeferredValue) { return useReactDeferredValue(value); } const [deferredValue, setDeferredValue] = useState(value); useEffect(() => { const raf = requestAnimationFrame(() => setDeferredValue(value)); return () => cancelAnimationFrame(raf); }, [value]); return deferredValue; } function useTagName(refOrElement, type) { const stringOrUndefined = (type2) => { if (typeof type2 !== "string") return; return type2; }; const [tagName, setTagName] = (0,external_React_.useState)(() => stringOrUndefined(type)); useSafeLayoutEffect(() => { const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type)); }, [refOrElement, type]); return tagName; } function useAttribute(refOrElement, attributeName, defaultValue) { const initialValue = useInitialValue(defaultValue); const [attribute, setAttribute] = (0,external_React_.useState)(initialValue); (0,external_React_.useEffect)(() => { const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; if (!element) return; const callback = () => { const value = element.getAttribute(attributeName); setAttribute(value == null ? initialValue : value); }; const observer = new MutationObserver(callback); observer.observe(element, { attributeFilter: [attributeName] }); callback(); return () => observer.disconnect(); }, [refOrElement, attributeName, initialValue]); return attribute; } function useUpdateEffect(effect, deps) { const mounted = (0,external_React_.useRef)(false); (0,external_React_.useEffect)(() => { if (mounted.current) { return effect(); } mounted.current = true; }, deps); (0,external_React_.useEffect)( () => () => { mounted.current = false; }, [] ); } function useUpdateLayoutEffect(effect, deps) { const mounted = (0,external_React_.useRef)(false); useSafeLayoutEffect(() => { if (mounted.current) { return effect(); } mounted.current = true; }, deps); useSafeLayoutEffect( () => () => { mounted.current = false; }, [] ); } function useForceUpdate() { return (0,external_React_.useReducer)(() => [], []); } function useBooleanEvent(booleanOrCallback) { return useEvent( typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback ); } function useWrapElement(props, callback, deps = []) { const wrapElement = (0,external_React_.useCallback)( (element) => { if (props.wrapElement) { element = props.wrapElement(element); } return callback(element); }, [...deps, props.wrapElement] ); return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { wrapElement }); } function usePortalRef(portalProp = false, portalRefProp) { const [portalNode, setPortalNode] = useState(null); const portalRef = useMergeRefs(setPortalNode, portalRefProp); const domReady = !portalProp || portalNode; return { portalRef, portalNode, domReady }; } function useMetadataProps(props, key, value) { const parent = props.onLoadedMetadataCapture; const onLoadedMetadataCapture = (0,external_React_.useMemo)(() => { return Object.assign(() => { }, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, parent), { [key]: value })); }, [parent, key, value]); return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }]; } function useIsMouseMoving() { (0,external_React_.useEffect)(() => { addGlobalEventListener("mousemove", setMouseMoving, true); addGlobalEventListener("mousedown", resetMouseMoving, true); addGlobalEventListener("mouseup", resetMouseMoving, true); addGlobalEventListener("keydown", resetMouseMoving, true); addGlobalEventListener("scroll", resetMouseMoving, true); }, []); const isMouseMoving = useEvent(() => mouseMoving); return isMouseMoving; } var mouseMoving = false; var previousScreenX = 0; var previousScreenY = 0; function hasMouseMovement(event) { const movementX = event.movementX || event.screenX - previousScreenX; const movementY = event.movementY || event.screenY - previousScreenY; previousScreenX = event.screenX; previousScreenY = event.screenY; return movementX || movementY || "production" === "test"; } function setMouseMoving(event) { if (!hasMouseMovement(event)) return; mouseMoving = true; } function resetMouseMoving() { mouseMoving = false; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/LMDWO4NN.js "use client"; // src/utils/system.tsx function forwardRef2(render) { const Role = external_React_.forwardRef((props, ref) => render(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref }))); Role.displayName = render.displayName || render.name; return Role; } function memo2(Component, propsAreEqual) { return external_React_.memo(Component, propsAreEqual); } function createElement(Type, props) { const _a = props, { wrapElement, render } = _a, rest = __objRest(_a, ["wrapElement", "render"]); const mergedRef = useMergeRefs(props.ref, getRefProperty(render)); let element; if (external_React_.isValidElement(render)) { const renderProps = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, render.props), { ref: mergedRef }); element = external_React_.cloneElement(render, mergeProps(rest, renderProps)); } else if (render) { element = render(rest); } else { element = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Type, _3YLGPPWQ_spreadValues({}, rest)); } if (wrapElement) { return wrapElement(element); } return element; } function createHook(useProps) { const useRole = (props = {}) => { return useProps(props); }; useRole.displayName = useProps.name; return useRole; } function createStoreContext(providers = [], scopedProviders = []) { const context = external_React_.createContext(void 0); const scopedContext = external_React_.createContext(void 0); const useContext2 = () => external_React_.useContext(context); const useScopedContext = (onlyScoped = false) => { const scoped = external_React_.useContext(scopedContext); const store = useContext2(); if (onlyScoped) return scoped; return scoped || store; }; const useProviderContext = () => { const scoped = external_React_.useContext(scopedContext); const store = useContext2(); if (scoped && scoped === store) return; return store; }; const ContextProvider = (props) => { return providers.reduceRight( (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context.Provider, _3YLGPPWQ_spreadValues({}, props)) ); }; const ScopedContextProvider = (props) => { return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextProvider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children: scopedProviders.reduceRight( (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })), /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(scopedContext.Provider, _3YLGPPWQ_spreadValues({}, props)) ) })); }; return { context, scopedContext, useContext: useContext2, useScopedContext, useProviderContext, ContextProvider, ScopedContextProvider }; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/VDHZ5F7K.js "use client"; // src/collection/collection-context.tsx var ctx = createStoreContext(); var useCollectionContext = ctx.useContext; var useCollectionScopedContext = ctx.useScopedContext; var useCollectionProviderContext = ctx.useProviderContext; var CollectionContextProvider = ctx.ContextProvider; var CollectionScopedContextProvider = ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/__chunks/P7GR5CS5.js "use client"; // src/composite/composite-context.tsx var P7GR5CS5_ctx = createStoreContext( [CollectionContextProvider], [CollectionScopedContextProvider] ); var useCompositeContext = P7GR5CS5_ctx.useContext; var useCompositeScopedContext = P7GR5CS5_ctx.useScopedContext; var useCompositeProviderContext = P7GR5CS5_ctx.useProviderContext; var CompositeContextProvider = P7GR5CS5_ctx.ContextProvider; var CompositeScopedContextProvider = P7GR5CS5_ctx.ScopedContextProvider; var CompositeItemContext = (0,external_React_.createContext)( void 0 ); var CompositeRowContext = (0,external_React_.createContext)( void 0 ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/3XAVFTCA.js "use client"; // src/tag/tag-context.tsx var TagValueContext = (0,external_React_.createContext)(null); var TagRemoveIdContext = (0,external_React_.createContext)( null ); var _3XAVFTCA_ctx = createStoreContext( [CompositeContextProvider], [CompositeScopedContextProvider] ); var useTagContext = _3XAVFTCA_ctx.useContext; var useTagScopedContext = _3XAVFTCA_ctx.useScopedContext; var useTagProviderContext = _3XAVFTCA_ctx.useProviderContext; var TagContextProvider = _3XAVFTCA_ctx.ContextProvider; var TagScopedContextProvider = _3XAVFTCA_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/core/esm/__chunks/BCALMBPZ.js "use client"; // src/utils/store.ts function getInternal(store, key) { const internals = store.__unstableInternals; invariant(internals, "Invalid store"); return internals[key]; } function createStore(initialState, ...stores) { let state = initialState; let prevStateBatch = state; let lastUpdate = Symbol(); let destroy = PBFD2E7P_noop; const instances = /* @__PURE__ */ new Set(); const updatedKeys = /* @__PURE__ */ new Set(); const setups = /* @__PURE__ */ new Set(); const listeners = /* @__PURE__ */ new Set(); const batchListeners = /* @__PURE__ */ new Set(); const disposables = /* @__PURE__ */ new WeakMap(); const listenerKeys = /* @__PURE__ */ new WeakMap(); const storeSetup = (callback) => { setups.add(callback); return () => setups.delete(callback); }; const storeInit = () => { const initialized = instances.size; const instance = Symbol(); instances.add(instance); const maybeDestroy = () => { instances.delete(instance); if (instances.size) return; destroy(); }; if (initialized) return maybeDestroy; const desyncs = getKeys(state).map( (key) => chain( ...stores.map((store) => { var _a; const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store); if (!storeState) return; if (!PBFD2E7P_hasOwnProperty(storeState, key)) return; return sync(store, [key], (state2) => { setState( key, state2[key], // @ts-expect-error - Not public API. This is just to prevent // infinite loops. true ); }); }) ) ); const teardowns = []; for (const setup2 of setups) { teardowns.push(setup2()); } const cleanups = stores.map(init); destroy = chain(...desyncs, ...teardowns, ...cleanups); return maybeDestroy; }; const sub = (keys, listener, set = listeners) => { set.add(listener); listenerKeys.set(listener, keys); return () => { var _a; (_a = disposables.get(listener)) == null ? void 0 : _a(); disposables.delete(listener); listenerKeys.delete(listener); set.delete(listener); }; }; const storeSubscribe = (keys, listener) => sub(keys, listener); const storeSync = (keys, listener) => { disposables.set(listener, listener(state, state)); return sub(keys, listener); }; const storeBatch = (keys, listener) => { disposables.set(listener, listener(state, prevStateBatch)); return sub(keys, listener, batchListeners); }; const storePick = (keys) => createStore(pick(state, keys), finalStore); const storeOmit = (keys) => createStore(omit(state, keys), finalStore); const getState = () => state; const setState = (key, value, fromStores = false) => { var _a; if (!PBFD2E7P_hasOwnProperty(state, key)) return; const nextValue = applyState(value, state[key]); if (nextValue === state[key]) return; if (!fromStores) { for (const store of stores) { (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue); } } const prevState = state; state = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, state), { [key]: nextValue }); const thisUpdate = Symbol(); lastUpdate = thisUpdate; updatedKeys.add(key); const run = (listener, prev, uKeys) => { var _a2; const keys = listenerKeys.get(listener); const updated = (k) => uKeys ? uKeys.has(k) : k === key; if (!keys || keys.some(updated)) { (_a2 = disposables.get(listener)) == null ? void 0 : _a2(); disposables.set(listener, listener(state, prev)); } }; for (const listener of listeners) { run(listener, prevState); } queueMicrotask(() => { if (lastUpdate !== thisUpdate) return; const snapshot = state; for (const listener of batchListeners) { run(listener, prevStateBatch, updatedKeys); } prevStateBatch = snapshot; updatedKeys.clear(); }); }; const finalStore = { getState, setState, __unstableInternals: { setup: storeSetup, init: storeInit, subscribe: storeSubscribe, sync: storeSync, batch: storeBatch, pick: storePick, omit: storeOmit } }; return finalStore; } function setup(store, ...args) { if (!store) return; return getInternal(store, "setup")(...args); } function init(store, ...args) { if (!store) return; return getInternal(store, "init")(...args); } function subscribe(store, ...args) { if (!store) return; return getInternal(store, "subscribe")(...args); } function sync(store, ...args) { if (!store) return; return getInternal(store, "sync")(...args); } function batch(store, ...args) { if (!store) return; return getInternal(store, "batch")(...args); } function omit2(store, ...args) { if (!store) return; return getInternal(store, "omit")(...args); } function pick2(store, ...args) { if (!store) return; return getInternal(store, "pick")(...args); } function mergeStore(...stores) { const initialState = stores.reduce((state, store2) => { var _a; const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2); if (!nextState) return state; return Object.assign(state, nextState); }, {}); const store = createStore(initialState, ...stores); return Object.assign({}, ...stores, store); } function throwOnConflictingProps(props, store) { if (true) return; if (!store) return; const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => { var _a; const stateKey = key.replace("default", ""); return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}${stateKey.slice(1)}`; }); if (!defaultKeys.length) return; const storeState = store.getState(); const conflictingProps = defaultKeys.filter( (key) => PBFD2E7P_hasOwnProperty(storeState, key) ); if (!conflictingProps.length) return; throw new Error( `Passing a store prop in conjunction with a default state is not supported. const store = useSelectStore(); <SelectProvider store={store} defaultValue="Apple" /> ^ ^ Instead, pass the default state to the topmost store: const store = useSelectStore({ defaultValue: "Apple" }); <SelectProvider store={store} /> See https://github.com/ariakit/ariakit/pull/2745 for more details. If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit ` ); } // EXTERNAL MODULE: ./node_modules/use-sync-external-store/shim/index.js var shim = __webpack_require__(422); ;// ./node_modules/@ariakit/react-core/esm/__chunks/YV4JVR4I.js "use client"; // src/utils/store.tsx var { useSyncExternalStore } = shim; var noopSubscribe = () => () => { }; function useStoreState(store, keyOrSelector = identity) { const storeSubscribe = external_React_.useCallback( (callback) => { if (!store) return noopSubscribe(); return subscribe(store, null, callback); }, [store] ); const getSnapshot = () => { const key = typeof keyOrSelector === "string" ? keyOrSelector : null; const selector = typeof keyOrSelector === "function" ? keyOrSelector : null; const state = store == null ? void 0 : store.getState(); if (selector) return selector(state); if (!state) return; if (!key) return; if (!PBFD2E7P_hasOwnProperty(state, key)) return; return state[key]; }; return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot); } function useStoreStateObject(store, object) { const objRef = external_React_.useRef( {} ); const storeSubscribe = external_React_.useCallback( (callback) => { if (!store) return noopSubscribe(); return subscribe(store, null, callback); }, [store] ); const getSnapshot = () => { const state = store == null ? void 0 : store.getState(); let updated = false; const obj = objRef.current; for (const prop in object) { const keyOrSelector = object[prop]; if (typeof keyOrSelector === "function") { const value = keyOrSelector(state); if (value !== obj[prop]) { obj[prop] = value; updated = true; } } if (typeof keyOrSelector === "string") { if (!state) continue; if (!PBFD2E7P_hasOwnProperty(state, keyOrSelector)) continue; const value = state[keyOrSelector]; if (value !== obj[prop]) { obj[prop] = value; updated = true; } } } if (updated) { objRef.current = _3YLGPPWQ_spreadValues({}, obj); } return objRef.current; }; return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot); } function useStoreProps(store, props, key, setKey) { const value = PBFD2E7P_hasOwnProperty(props, key) ? props[key] : void 0; const setValue = setKey ? props[setKey] : void 0; const propsRef = useLiveRef({ value, setValue }); useSafeLayoutEffect(() => { return sync(store, [key], (state, prev) => { const { value: value2, setValue: setValue2 } = propsRef.current; if (!setValue2) return; if (state[key] === prev[key]) return; if (state[key] === value2) return; setValue2(state[key]); }); }, [store, key]); useSafeLayoutEffect(() => { if (value === void 0) return; store.setState(key, value); return batch(store, [key], () => { if (value === void 0) return; store.setState(key, value); }); }); } function YV4JVR4I_useStore(createStore, props) { const [store, setStore] = external_React_.useState(() => createStore(props)); useSafeLayoutEffect(() => init(store), [store]); const useState2 = external_React_.useCallback( (keyOrSelector) => useStoreState(store, keyOrSelector), [store] ); const memoizedStore = external_React_.useMemo( () => _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, store), { useState: useState2 }), [store, useState2] ); const updateStore = useEvent(() => { setStore((store2) => createStore(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, props), store2.getState()))); }); return [memoizedStore, updateStore]; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/C3IKGW5T.js "use client"; // src/collection/collection-store.ts function useCollectionStoreProps(store, update, props) { useUpdateEffect(update, [props.store]); useStoreProps(store, props, "items", "setItems"); return store; } function useCollectionStore(props = {}) { const [store, update] = useStore(Core.createCollectionStore, props); return useCollectionStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/4CMBR7SL.js "use client"; // src/composite/composite-store.ts function useCompositeStoreOptions(props) { const id = useId(props.id); return _3YLGPPWQ_spreadValues({ id }, props); } function useCompositeStoreProps(store, update, props) { store = useCollectionStoreProps(store, update, props); useStoreProps(store, props, "activeId", "setActiveId"); useStoreProps(store, props, "includesBaseElement"); useStoreProps(store, props, "virtualFocus"); useStoreProps(store, props, "orientation"); useStoreProps(store, props, "rtl"); useStoreProps(store, props, "focusLoop"); useStoreProps(store, props, "focusWrap"); useStoreProps(store, props, "focusShift"); return store; } function useCompositeStore(props = {}) { props = useCompositeStoreOptions(props); const [store, update] = useStore(Core.createCompositeStore, props); return useCompositeStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/WYCIER3C.js "use client"; // src/disclosure/disclosure-store.ts function useDisclosureStoreProps(store, update, props) { useUpdateEffect(update, [props.store, props.disclosure]); useStoreProps(store, props, "open", "setOpen"); useStoreProps(store, props, "mounted", "setMounted"); useStoreProps(store, props, "animated"); return Object.assign(store, { disclosure: props.disclosure }); } function useDisclosureStore(props = {}) { const [store, update] = useStore(Core.createDisclosureStore, props); return useDisclosureStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/BM6PGYQY.js "use client"; // src/dialog/dialog-store.ts function useDialogStoreProps(store, update, props) { return useDisclosureStoreProps(store, update, props); } function useDialogStore(props = {}) { const [store, update] = useStore(Core.createDialogStore, props); return useDialogStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/O2PQ2652.js "use client"; // src/popover/popover-store.ts function usePopoverStoreProps(store, update, props) { useUpdateEffect(update, [props.popover]); useStoreProps(store, props, "placement"); return useDialogStoreProps(store, update, props); } function usePopoverStore(props = {}) { const [store, update] = useStore(Core.createPopoverStore, props); return usePopoverStoreProps(store, update, props); } ;// ./node_modules/@ariakit/core/esm/__chunks/CYQWQL4J.js "use client"; // src/collection/collection-store.ts function getCommonParent(items) { var _a; const firstItem = items.find((item) => !!item.element); const lastItem = [...items].reverse().find((item) => !!item.element); let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement; while (parentElement && (lastItem == null ? void 0 : lastItem.element)) { const parent = parentElement; if (lastItem && parent.contains(lastItem.element)) { return parentElement; } parentElement = parentElement.parentElement; } return getDocument(parentElement).body; } function getPrivateStore(store) { return store == null ? void 0 : store.__unstablePrivateStore; } function createCollectionStore(props = {}) { var _a; throwOnConflictingProps(props, props.store); const syncState = (_a = props.store) == null ? void 0 : _a.getState(); const items = defaultValue( props.items, syncState == null ? void 0 : syncState.items, props.defaultItems, [] ); const itemsMap = new Map(items.map((item) => [item.id, item])); const initialState = { items, renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, []) }; const syncPrivateStore = getPrivateStore(props.store); const privateStore = createStore( { items, renderedItems: initialState.renderedItems }, syncPrivateStore ); const collection = createStore(initialState, props.store); const sortItems = (renderedItems) => { const sortedItems = sortBasedOnDOMPosition(renderedItems, (i) => i.element); privateStore.setState("renderedItems", sortedItems); collection.setState("renderedItems", sortedItems); }; setup(collection, () => init(privateStore)); setup(privateStore, () => { return batch(privateStore, ["items"], (state) => { collection.setState("items", state.items); }); }); setup(privateStore, () => { return batch(privateStore, ["renderedItems"], (state) => { let firstRun = true; let raf = requestAnimationFrame(() => { const { renderedItems } = collection.getState(); if (state.renderedItems === renderedItems) return; sortItems(state.renderedItems); }); if (typeof IntersectionObserver !== "function") { return () => cancelAnimationFrame(raf); } const ioCallback = () => { if (firstRun) { firstRun = false; return; } cancelAnimationFrame(raf); raf = requestAnimationFrame(() => sortItems(state.renderedItems)); }; const root = getCommonParent(state.renderedItems); const observer = new IntersectionObserver(ioCallback, { root }); for (const item of state.renderedItems) { if (!item.element) continue; observer.observe(item.element); } return () => { cancelAnimationFrame(raf); observer.disconnect(); }; }); }); const mergeItem = (item, setItems, canDeleteFromMap = false) => { let prevItem; setItems((items2) => { const index = items2.findIndex(({ id }) => id === item.id); const nextItems = items2.slice(); if (index !== -1) { prevItem = items2[index]; const nextItem = _chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, prevItem), item); nextItems[index] = nextItem; itemsMap.set(item.id, nextItem); } else { nextItems.push(item); itemsMap.set(item.id, item); } return nextItems; }); const unmergeItem = () => { setItems((items2) => { if (!prevItem) { if (canDeleteFromMap) { itemsMap.delete(item.id); } return items2.filter(({ id }) => id !== item.id); } const index = items2.findIndex(({ id }) => id === item.id); if (index === -1) return items2; const nextItems = items2.slice(); nextItems[index] = prevItem; itemsMap.set(item.id, prevItem); return nextItems; }); }; return unmergeItem; }; const registerItem = (item) => mergeItem( item, (getItems) => privateStore.setState("items", getItems), true ); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection), { registerItem, renderItem: (item) => chain( registerItem(item), mergeItem( item, (getItems) => privateStore.setState("renderedItems", getItems) ) ), item: (id) => { if (!id) return null; let item = itemsMap.get(id); if (!item) { const { items: items2 } = privateStore.getState(); item = items2.find((item2) => item2.id === id); if (item) { itemsMap.set(id, item); } } return item || null; }, // @ts-expect-error Internal __unstablePrivateStore: privateStore }); } ;// ./node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js "use client"; // src/utils/array.ts function toArray(arg) { if (Array.isArray(arg)) { return arg; } return typeof arg !== "undefined" ? [arg] : []; } function addItemToArray(array, item, index = -1) { if (!(index in array)) { return [...array, item]; } return [...array.slice(0, index), item, ...array.slice(index)]; } function flatten2DArray(array) { const flattened = []; for (const row of array) { flattened.push(...row); } return flattened; } function reverseArray(array) { return array.slice().reverse(); } ;// ./node_modules/@ariakit/core/esm/__chunks/AJZ4BYF3.js "use client"; // src/composite/composite-store.ts var NULL_ITEM = { id: null }; function findFirstEnabledItem(items, excludeId) { return items.find((item) => { if (excludeId) { return !item.disabled && item.id !== excludeId; } return !item.disabled; }); } function getEnabledItems(items, excludeId) { return items.filter((item) => { if (excludeId) { return !item.disabled && item.id !== excludeId; } return !item.disabled; }); } function getItemsInRow(items, rowId) { return items.filter((item) => item.rowId === rowId); } function flipItems(items, activeId, shouldInsertNullItem = false) { const index = items.findIndex((item) => item.id === activeId); return [ ...items.slice(index + 1), ...shouldInsertNullItem ? [NULL_ITEM] : [], ...items.slice(0, index) ]; } function groupItemsByRows(items) { const rows = []; for (const item of items) { const row = rows.find((currentRow) => { var _a; return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; }); if (row) { row.push(item); } else { rows.push([item]); } } return rows; } function getMaxRowLength(array) { let maxLength = 0; for (const { length } of array) { if (length > maxLength) { maxLength = length; } } return maxLength; } function createEmptyItem(rowId) { return { id: "__EMPTY_ITEM__", disabled: true, rowId }; } function normalizeRows(rows, activeId, focusShift) { const maxLength = getMaxRowLength(rows); for (const row of rows) { for (let i = 0; i < maxLength; i += 1) { const item = row[i]; if (!item || focusShift && item.disabled) { const isFirst = i === 0; const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1]; row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId); } } } return rows; } function verticalizeItems(items) { const rows = groupItemsByRows(items); const maxLength = getMaxRowLength(rows); const verticalized = []; for (let i = 0; i < maxLength; i += 1) { for (const row of rows) { const item = row[i]; if (item) { verticalized.push(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, item), { // If there's no rowId, it means that it's not a grid composite, but // a single row instead. So, instead of verticalizing it, that is, // assigning a different rowId based on the column index, we keep it // undefined so they will be part of the same row. This is useful // when using up/down on one-dimensional composites. rowId: item.rowId ? `${i}` : void 0 })); } } } return verticalized; } function createCompositeStore(props = {}) { var _a; const syncState = (_a = props.store) == null ? void 0 : _a.getState(); const collection = createCollectionStore(props); const activeId = defaultValue( props.activeId, syncState == null ? void 0 : syncState.activeId, props.defaultActiveId ); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection.getState()), { id: defaultValue( props.id, syncState == null ? void 0 : syncState.id, `id-${Math.random().toString(36).slice(2, 8)}` ), activeId, baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null), includesBaseElement: defaultValue( props.includesBaseElement, syncState == null ? void 0 : syncState.includesBaseElement, activeId === null ), moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0), orientation: defaultValue( props.orientation, syncState == null ? void 0 : syncState.orientation, "both" ), rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false), virtualFocus: defaultValue( props.virtualFocus, syncState == null ? void 0 : syncState.virtualFocus, false ), focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false), focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false), focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false) }); const composite = createStore(initialState, collection, props.store); setup( composite, () => sync(composite, ["renderedItems", "activeId"], (state) => { composite.setState("activeId", (activeId2) => { var _a2; if (activeId2 !== void 0) return activeId2; return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id; }); }) ); const getNextId = (direction = "next", options = {}) => { var _a2, _b; const defaultState = composite.getState(); const { skip = 0, activeId: activeId2 = defaultState.activeId, focusShift = defaultState.focusShift, focusLoop = defaultState.focusLoop, focusWrap = defaultState.focusWrap, includesBaseElement = defaultState.includesBaseElement, renderedItems = defaultState.renderedItems, rtl = defaultState.rtl } = options; const isVerticalDirection = direction === "up" || direction === "down"; const isNextDirection = direction === "next" || direction === "down"; const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection; const canShift = focusShift && !skip; let items = !isVerticalDirection ? renderedItems : flatten2DArray( normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift) ); items = canReverse ? reverseArray(items) : items; items = isVerticalDirection ? verticalizeItems(items) : items; if (activeId2 == null) { return (_a2 = findFirstEnabledItem(items)) == null ? void 0 : _a2.id; } const activeItem = items.find((item) => item.id === activeId2); if (!activeItem) { return (_b = findFirstEnabledItem(items)) == null ? void 0 : _b.id; } const isGrid = items.some((item) => item.rowId); const activeIndex = items.indexOf(activeItem); const nextItems = items.slice(activeIndex + 1); const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId); if (skip) { const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2); const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one. nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1]; return nextItem2 == null ? void 0 : nextItem2.id; } const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical"); const canWrap = isGrid && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical"); const hasNullItem = isNextDirection ? (!isGrid || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false; if (canLoop) { const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId); const sortedItems = flipItems(loopItems, activeId2, hasNullItem); const nextItem2 = findFirstEnabledItem(sortedItems, activeId2); return nextItem2 == null ? void 0 : nextItem2.id; } if (canWrap) { const nextItem2 = findFirstEnabledItem( // We can use nextItems, which contains all the next items, including // items from other rows, to wrap between rows. However, if there is a // null item (the composite container), we'll only use the next items in // the row. So moving next from the last item will focus on the // composite container. On grid composites, horizontal navigation never // focuses on the composite container, only vertical. hasNullItem ? nextItemsInRow : nextItems, activeId2 ); const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id; return nextId; } const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2); if (!nextItem && hasNullItem) { return null; } return nextItem == null ? void 0 : nextItem.id; }; return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, collection), composite), { setBaseElement: (element) => composite.setState("baseElement", element), setActiveId: (id) => composite.setState("activeId", id), move: (id) => { if (id === void 0) return; composite.setState("activeId", id); composite.setState("moves", (moves) => moves + 1); }, first: () => { var _a2; return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id; }, last: () => { var _a2; return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id; }, next: (options) => { if (options !== void 0 && typeof options === "number") { options = { skip: options }; } return getNextId("next", options); }, previous: (options) => { if (options !== void 0 && typeof options === "number") { options = { skip: options }; } return getNextId("previous", options); }, down: (options) => { if (options !== void 0 && typeof options === "number") { options = { skip: options }; } return getNextId("down", options); }, up: (options) => { if (options !== void 0 && typeof options === "number") { options = { skip: options }; } return getNextId("up", options); } }); } ;// ./node_modules/@ariakit/core/esm/__chunks/RCQ5P4YE.js "use client"; // src/disclosure/disclosure-store.ts function createDisclosureStore(props = {}) { const store = mergeStore( props.store, omit2(props.disclosure, ["contentElement", "disclosureElement"]) ); throwOnConflictingProps(props, store); const syncState = store == null ? void 0 : store.getState(); const open = defaultValue( props.open, syncState == null ? void 0 : syncState.open, props.defaultOpen, false ); const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false); const initialState = { open, animated, animating: !!animated && open, mounted: open, contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null), disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null) }; const disclosure = createStore(initialState, store); setup( disclosure, () => sync(disclosure, ["animated", "animating"], (state) => { if (state.animated) return; disclosure.setState("animating", false); }) ); setup( disclosure, () => subscribe(disclosure, ["open"], () => { if (!disclosure.getState().animated) return; disclosure.setState("animating", true); }) ); setup( disclosure, () => sync(disclosure, ["open", "animating"], (state) => { disclosure.setState("mounted", state.open || state.animating); }) ); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, disclosure), { disclosure: props.disclosure, setOpen: (value) => disclosure.setState("open", value), show: () => disclosure.setState("open", true), hide: () => disclosure.setState("open", false), toggle: () => disclosure.setState("open", (open2) => !open2), stopAnimation: () => disclosure.setState("animating", false), setContentElement: (value) => disclosure.setState("contentElement", value), setDisclosureElement: (value) => disclosure.setState("disclosureElement", value) }); } ;// ./node_modules/@ariakit/core/esm/__chunks/FZZ2AVHF.js "use client"; // src/dialog/dialog-store.ts function createDialogStore(props = {}) { return createDisclosureStore(props); } ;// ./node_modules/@ariakit/core/esm/__chunks/ME2CUF3F.js "use client"; // src/popover/popover-store.ts function createPopoverStore(_a = {}) { var _b = _a, { popover: otherPopover } = _b, props = _3YLGPPWQ_objRest(_b, [ "popover" ]); const store = mergeStore( props.store, omit2(otherPopover, [ "arrowElement", "anchorElement", "contentElement", "popoverElement", "disclosureElement" ]) ); throwOnConflictingProps(props, store); const syncState = store == null ? void 0 : store.getState(); const dialog = createDialogStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store })); const placement = defaultValue( props.placement, syncState == null ? void 0 : syncState.placement, "bottom" ); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, dialog.getState()), { placement, currentPlacement: placement, anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null), popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null), arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null), rendered: Symbol("rendered") }); const popover = createStore(initialState, dialog, store); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, dialog), popover), { setAnchorElement: (element) => popover.setState("anchorElement", element), setPopoverElement: (element) => popover.setState("popoverElement", element), setArrowElement: (element) => popover.setState("arrowElement", element), render: () => popover.setState("rendered", Symbol("rendered")) }); } ;// ./node_modules/@ariakit/core/esm/combobox/combobox-store.js "use client"; // src/combobox/combobox-store.ts var isTouchSafari = isSafari() && isTouchDevice(); function createComboboxStore(_a = {}) { var _b = _a, { tag } = _b, props = _3YLGPPWQ_objRest(_b, [ "tag" ]); const store = mergeStore(props.store, pick2(tag, ["value", "rtl"])); throwOnConflictingProps(props, store); const tagState = tag == null ? void 0 : tag.getState(); const syncState = store == null ? void 0 : store.getState(); const activeId = defaultValue( props.activeId, syncState == null ? void 0 : syncState.activeId, props.defaultActiveId, null ); const composite = createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { activeId, includesBaseElement: defaultValue( props.includesBaseElement, syncState == null ? void 0 : syncState.includesBaseElement, true ), orientation: defaultValue( props.orientation, syncState == null ? void 0 : syncState.orientation, "vertical" ), focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true), focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true), virtualFocus: defaultValue( props.virtualFocus, syncState == null ? void 0 : syncState.virtualFocus, true ) })); const popover = createPopoverStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { placement: defaultValue( props.placement, syncState == null ? void 0 : syncState.placement, "bottom-start" ) })); const value = defaultValue( props.value, syncState == null ? void 0 : syncState.value, props.defaultValue, "" ); const selectedValue = defaultValue( props.selectedValue, syncState == null ? void 0 : syncState.selectedValue, tagState == null ? void 0 : tagState.values, props.defaultSelectedValue, "" ); const multiSelectable = Array.isArray(selectedValue); const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite.getState()), popover.getState()), { value, selectedValue, resetValueOnSelect: defaultValue( props.resetValueOnSelect, syncState == null ? void 0 : syncState.resetValueOnSelect, multiSelectable ), resetValueOnHide: defaultValue( props.resetValueOnHide, syncState == null ? void 0 : syncState.resetValueOnHide, multiSelectable && !tag ), activeValue: syncState == null ? void 0 : syncState.activeValue }); const combobox = createStore(initialState, composite, popover, store); if (isTouchSafari) { setup( combobox, () => sync(combobox, ["virtualFocus"], () => { combobox.setState("virtualFocus", false); }) ); } setup(combobox, () => { if (!tag) return; return chain( sync(combobox, ["selectedValue"], (state) => { if (!Array.isArray(state.selectedValue)) return; tag.setValues(state.selectedValue); }), sync(tag, ["values"], (state) => { combobox.setState("selectedValue", state.values); }) ); }); setup( combobox, () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => { if (!state.resetValueOnHide) return; if (state.mounted) return; combobox.setState("value", value); }) ); setup( combobox, () => sync(combobox, ["open"], (state) => { if (state.open) return; combobox.setState("activeId", activeId); combobox.setState("moves", 0); }) ); setup( combobox, () => sync(combobox, ["moves", "activeId"], (state, prevState) => { if (state.moves === prevState.moves) { combobox.setState("activeValue", void 0); } }) ); setup( combobox, () => batch(combobox, ["moves", "renderedItems"], (state, prev) => { if (state.moves === prev.moves) return; const { activeId: activeId2 } = combobox.getState(); const activeItem = composite.item(activeId2); combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value); }) ); return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, popover), composite), combobox), { tag, setValue: (value2) => combobox.setState("value", value2), resetValue: () => combobox.setState("value", initialState.value), setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2) }); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/FEOFMWBY.js "use client"; // src/combobox/combobox-store.ts function useComboboxStoreOptions(props) { const tag = useTagContext(); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { tag: props.tag !== void 0 ? props.tag : tag }); return useCompositeStoreOptions(props); } function useComboboxStoreProps(store, update, props) { useUpdateEffect(update, [props.tag]); useStoreProps(store, props, "value", "setValue"); useStoreProps(store, props, "selectedValue", "setSelectedValue"); useStoreProps(store, props, "resetValueOnHide"); useStoreProps(store, props, "resetValueOnSelect"); return Object.assign( useCompositeStoreProps( usePopoverStoreProps(store, update, props), update, props ), { tag: props.tag } ); } function useComboboxStore(props = {}) { props = useComboboxStoreOptions(props); const [store, update] = YV4JVR4I_useStore(createComboboxStore, props); return useComboboxStoreProps(store, update, props); } ;// ./node_modules/@ariakit/react-core/esm/__chunks/S6EF7IVO.js "use client"; // src/disclosure/disclosure-context.tsx var S6EF7IVO_ctx = createStoreContext(); var useDisclosureContext = S6EF7IVO_ctx.useContext; var useDisclosureScopedContext = S6EF7IVO_ctx.useScopedContext; var useDisclosureProviderContext = S6EF7IVO_ctx.useProviderContext; var DisclosureContextProvider = S6EF7IVO_ctx.ContextProvider; var DisclosureScopedContextProvider = S6EF7IVO_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/__chunks/RS7LB2H4.js "use client"; // src/dialog/dialog-context.tsx var RS7LB2H4_ctx = createStoreContext( [DisclosureContextProvider], [DisclosureScopedContextProvider] ); var useDialogContext = RS7LB2H4_ctx.useContext; var useDialogScopedContext = RS7LB2H4_ctx.useScopedContext; var useDialogProviderContext = RS7LB2H4_ctx.useProviderContext; var DialogContextProvider = RS7LB2H4_ctx.ContextProvider; var DialogScopedContextProvider = RS7LB2H4_ctx.ScopedContextProvider; var DialogHeadingContext = (0,external_React_.createContext)(void 0); var DialogDescriptionContext = (0,external_React_.createContext)(void 0); ;// ./node_modules/@ariakit/react-core/esm/__chunks/MTZPJQMC.js "use client"; // src/popover/popover-context.tsx var MTZPJQMC_ctx = createStoreContext( [DialogContextProvider], [DialogScopedContextProvider] ); var usePopoverContext = MTZPJQMC_ctx.useContext; var usePopoverScopedContext = MTZPJQMC_ctx.useScopedContext; var usePopoverProviderContext = MTZPJQMC_ctx.useProviderContext; var PopoverContextProvider = MTZPJQMC_ctx.ContextProvider; var PopoverScopedContextProvider = MTZPJQMC_ctx.ScopedContextProvider; ;// ./node_modules/@ariakit/react-core/esm/__chunks/VEVQD5MH.js "use client"; // src/combobox/combobox-context.tsx var ComboboxListRoleContext = (0,external_React_.createContext)( void 0 ); var VEVQD5MH_ctx = createStoreContext( [PopoverContextProvider, CompositeContextProvider], [PopoverScopedContextProvider, CompositeScopedContextProvider] ); var useComboboxContext = VEVQD5MH_ctx.useContext; var useComboboxScopedContext = VEVQD5MH_ctx.useScopedContext; var useComboboxProviderContext = VEVQD5MH_ctx.useProviderContext; var ComboboxContextProvider = VEVQD5MH_ctx.ContextProvider; var ComboboxScopedContextProvider = VEVQD5MH_ctx.ScopedContextProvider; var ComboboxItemValueContext = (0,external_React_.createContext)( void 0 ); var ComboboxItemCheckedContext = (0,external_React_.createContext)(false); ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js "use client"; // src/combobox/combobox-provider.tsx function ComboboxProvider(props = {}) { const store = useComboboxStore(props); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxContextProvider, { value: store, children: props.children }); } ;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-label.js "use client"; // src/combobox/combobox-label.tsx var TagName = "label"; var useComboboxLabel = createHook( function useComboboxLabel2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = useComboboxProviderContext(); store = store || context; invariant( store, false && 0 ); const comboboxId = store.useState((state) => { var _a2; return (_a2 = state.baseElement) == null ? void 0 : _a2.id; }); props = _3YLGPPWQ_spreadValues({ htmlFor: comboboxId }, props); return removeUndefinedValues(props); } ); var ComboboxLabel = memo2( forwardRef2(function ComboboxLabel2(props) { const htmlProps = useComboboxLabel(props); return createElement(TagName, htmlProps); }) ); ;// ./node_modules/@ariakit/react-core/esm/__chunks/OMU7RWRV.js "use client"; // src/popover/popover-anchor.tsx var OMU7RWRV_TagName = "div"; var usePopoverAnchor = createHook( function usePopoverAnchor2(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); const context = usePopoverProviderContext(); store = store || context; props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref: useMergeRefs(store == null ? void 0 : store.setAnchorElement, props.ref) }); return props; } ); var PopoverAnchor = forwardRef2(function PopoverAnchor2(props) { const htmlProps = usePopoverAnchor(props); return createElement(OMU7RWRV_TagName, htmlProps); }); ;// ./node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js "use client"; // src/composite/utils.ts var _5VQZOHHZ_NULL_ITEM = { id: null }; function _5VQZOHHZ_flipItems(items, activeId, shouldInsertNullItem = false) { const index = items.findIndex((item) => item.id === activeId); return [ ...items.slice(index + 1), ...shouldInsertNullItem ? [_5VQZOHHZ_NULL_ITEM] : [], ...items.slice(0, index) ]; } function _5VQZOHHZ_findFirstEnabledItem(items, excludeId) { return items.find((item) => { if (excludeId) { return !item.disabled && item.id !== excludeId; } return !item.disabled; }); } function getEnabledItem(store, id) { if (!id) return null; return store.item(id) || null; } function _5VQZOHHZ_groupItemsByRows(items) { const rows = []; for (const item of items) { const row = rows.find((currentRow) => { var _a; return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; }); if (row) { row.push(item); } else { rows.push([item]); } } return rows; } function selectTextField(element, collapseToEnd = false) { if (isTextField(element)) { element.setSelectionRange( collapseToEnd ? element.value.length : 0, element.value.length ); } else if (element.isContentEditable) { const selection = getDocument(element).getSelection(); selection == null ? void 0 : selection.selectAllChildren(element); if (collapseToEnd) { selection == null ? void 0 : selection.collapseToEnd(); } } } var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY"); function focusSilently(element) { element[FOCUS_SILENTLY] = true; element.focus({ preventScroll: true }); } function silentlyFocused(element) { const isSilentlyFocused = element[FOCUS_SILENTLY]; delete element[FOCUS_SILENTLY]; return isSilentlyFocused; } function isItem(store, element, exclude) { if (!element) return false; if (element === exclude) return false; const item = store.item(element.id); if (!item) return false; if (exclude && item.element === exclude) return false; return true; } ;// ./node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js "use client"; // src/focusable/focusable-context.tsx var FocusableContext = (0,external_React_.createContext)(true); ;// ./node_modules/@ariakit/core/esm/utils/focus.js "use client"; // src/utils/focus.ts var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])"; function hasNegativeTabIndex(element) { const tabIndex = Number.parseInt(element.getAttribute("tabindex") || "0", 10); return tabIndex < 0; } function isFocusable(element) { if (!element.matches(selector)) return false; if (!isVisible(element)) return false; if (element.closest("[inert]")) return false; return true; } function isTabbable(element) { if (!isFocusable(element)) return false; if (hasNegativeTabIndex(element)) return false; if (!("form" in element)) return true; if (!element.form) return true; if (element.checked) return true; if (element.type !== "radio") return true; const radioGroup = element.form.elements.namedItem(element.name); if (!radioGroup) return true; if (!("length" in radioGroup)) return true; const activeElement = getActiveElement(element); if (!activeElement) return true; if (activeElement === element) return true; if (!("form" in activeElement)) return true; if (activeElement.form !== element.form) return true; if (activeElement.name !== element.name) return true; return false; } function getAllFocusableIn(container, includeContainer) { const elements = Array.from( container.querySelectorAll(selector) ); if (includeContainer) { elements.unshift(container); } const focusableElements = elements.filter(isFocusable); focusableElements.forEach((element, i) => { if (isFrame(element) && element.contentDocument) { const frameBody = element.contentDocument.body; focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody)); } }); return focusableElements; } function getAllFocusable(includeBody) { return getAllFocusableIn(document.body, includeBody); } function getFirstFocusableIn(container, includeContainer) { const [first] = getAllFocusableIn(container, includeContainer); return first || null; } function getFirstFocusable(includeBody) { return getFirstFocusableIn(document.body, includeBody); } function getAllTabbableIn(container, includeContainer, fallbackToFocusable) { const elements = Array.from( container.querySelectorAll(selector) ); const tabbableElements = elements.filter(isTabbable); if (includeContainer && isTabbable(container)) { tabbableElements.unshift(container); } tabbableElements.forEach((element, i) => { if (isFrame(element) && element.contentDocument) { const frameBody = element.contentDocument.body; const allFrameTabbable = getAllTabbableIn( frameBody, false, fallbackToFocusable ); tabbableElements.splice(i, 1, ...allFrameTabbable); } }); if (!tabbableElements.length && fallbackToFocusable) { return elements; } return tabbableElements; } function getAllTabbable(fallbackToFocusable) { return getAllTabbableIn(document.body, false, fallbackToFocusable); } function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) { const [first] = getAllTabbableIn( container, includeContainer, fallbackToFocusable ); return first || null; } function getFirstTabbable(fallbackToFocusable) { return getFirstTabbableIn(document.body, false, fallbackToFocusable); } function getLastTabbableIn(container, includeContainer, fallbackToFocusable) { const allTabbable = getAllTabbableIn( container, includeContainer, fallbackToFocusable ); return allTabbable[allTabbable.length - 1] || null; } function getLastTabbable(fallbackToFocusable) { return getLastTabbableIn(document.body, false, fallbackToFocusable); } function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) { const activeElement = getActiveElement(container); const allFocusable = getAllFocusableIn(container, includeContainer); const activeIndex = allFocusable.indexOf(activeElement); const nextFocusableElements = allFocusable.slice(activeIndex + 1); return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null; } function getNextTabbable(fallbackToFirst, fallbackToFocusable) { return getNextTabbableIn( document.body, false, fallbackToFirst, fallbackToFocusable ); } function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) { const activeElement = getActiveElement(container); const allFocusable = getAllFocusableIn(container, includeContainer).reverse(); const activeIndex = allFocusable.indexOf(activeElement); const previousFocusableElements = allFocusable.slice(activeIndex + 1); return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null; } function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) { return getPreviousTabbableIn( document.body, false, fallbackToFirst, fallbackToFocusable ); } function getClosestFocusable(element) { while (element && !isFocusable(element)) { element = element.closest(selector); } return element || null; } function hasFocus(element) { const activeElement = DTR5TSDJ_getActiveElement(element); if (!activeElement) return false; if (activeElement === element) return true; const activeDescendant = activeElement.getAttribute("aria-activedescendant"); if (!activeDescendant) return false; return activeDescendant === element.id; } function hasFocusWithin(element) { const activeElement = DTR5TSDJ_getActiveElement(element); if (!activeElement) return false; if (contains(element, activeElement)) return true; const activeDescendant = activeElement.getAttribute("aria-activedescendant"); if (!activeDescendant) return false; if (!("id" in element)) return false; if (activeDescendant === element.id) return true; return !!element.querySelector(`#${CSS.escape(activeDescendant)}`); } function focusIfNeeded(element) { if (!hasFocusWithin(element) && isFocusable(element)) { element.focus(); } } function disableFocus(element) { var _a; const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : ""; element.setAttribute("data-tabindex", currentTabindex); element.setAttribute("tabindex", "-1"); } function disableFocusIn(container, includeContainer) { const tabbableElements = getAllTabbableIn(container, includeContainer); for (const element of tabbableElements) { disableFocus(element); } } function restoreFocusIn(container) { const elements = container.querySelectorAll("[data-tabindex]"); const restoreTabIndex = (element) => { const tabindex = element.getAttribute("data-tabindex"); element.removeAttribute("data-tabindex"); if (tabindex) { element.setAttribute("tabindex", tabindex); } else { element.removeAttribute("tabindex"); } }; if (container.hasAttribute("data-tabindex")) { restoreTabIndex(container); } for (const element of elements) { restoreTabIndex(element); } } function focusIntoView(element, options) { if (!("scrollIntoView" in element)) { element.focus(); } else { element.focus({ preventScroll: true }); element.scrollIntoView(_chunks_3YLGPPWQ_spreadValues({ block: "nearest", inline: "nearest" }, options)); } } ;// ./node_modules/@ariakit/react-core/esm/__chunks/LVA2YJMS.js "use client"; // src/focusable/focusable.tsx var LVA2YJMS_TagName = "div"; var isSafariBrowser = isSafari(); var alwaysFocusVisibleInputTypes = [ "text", "search", "url", "tel", "email", "password", "number", "date", "month", "week", "time", "datetime", "datetime-local" ]; var safariFocusAncestorSymbol = Symbol("safariFocusAncestor"); function isSafariFocusAncestor(element) { if (!element) return false; return !!element[safariFocusAncestorSymbol]; } function markSafariFocusAncestor(element, value) { if (!element) return; element[safariFocusAncestorSymbol] = value; } function isAlwaysFocusVisible(element) { const { tagName, readOnly, type } = element; if (tagName === "TEXTAREA" && !readOnly) return true; if (tagName === "SELECT" && !readOnly) return true; if (tagName === "INPUT" && !readOnly) { return alwaysFocusVisibleInputTypes.includes(type); } if (element.isContentEditable) return true; const role = element.getAttribute("role"); if (role === "combobox" && element.dataset.name) { return true; } return false; } function getLabels(element) { if ("labels" in element) { return element.labels; } return null; } function isNativeCheckboxOrRadio(element) { const tagName = element.tagName.toLowerCase(); if (tagName === "input" && element.type) { return element.type === "radio" || element.type === "checkbox"; } return false; } function isNativeTabbable(tagName) { if (!tagName) return true; return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a"; } function supportsDisabledAttribute(tagName) { if (!tagName) return true; return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea"; } function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) { if (!focusable) { return tabIndexProp; } if (trulyDisabled) { if (nativeTabbable && !supportsDisabled) { return -1; } return; } if (nativeTabbable) { return tabIndexProp; } return tabIndexProp || 0; } function useDisableEvent(onEvent, disabled) { return useEvent((event) => { onEvent == null ? void 0 : onEvent(event); if (event.defaultPrevented) return; if (disabled) { event.stopPropagation(); event.preventDefault(); } }); } var isKeyboardModality = true; function onGlobalMouseDown(event) { const target = event.target; if (target && "hasAttribute" in target) { if (!target.hasAttribute("data-focus-visible")) { isKeyboardModality = false; } } } function onGlobalKeyDown(event) { if (event.metaKey) return; if (event.ctrlKey) return; if (event.altKey) return; isKeyboardModality = true; } var useFocusable = createHook( function useFocusable2(_a) { var _b = _a, { focusable = true, accessibleWhenDisabled, autoFocus, onFocusVisible } = _b, props = __objRest(_b, [ "focusable", "accessibleWhenDisabled", "autoFocus", "onFocusVisible" ]); const ref = (0,external_React_.useRef)(null); (0,external_React_.useEffect)(() => { if (!focusable) return; addGlobalEventListener("mousedown", onGlobalMouseDown, true); addGlobalEventListener("keydown", onGlobalKeyDown, true); }, [focusable]); if (isSafariBrowser) { (0,external_React_.useEffect)(() => { if (!focusable) return; const element = ref.current; if (!element) return; if (!isNativeCheckboxOrRadio(element)) return; const labels = getLabels(element); if (!labels) return; const onMouseUp = () => queueMicrotask(() => element.focus()); for (const label of labels) { label.addEventListener("mouseup", onMouseUp); } return () => { for (const label of labels) { label.removeEventListener("mouseup", onMouseUp); } }; }, [focusable]); } const disabled = focusable && disabledFromProps(props); const trulyDisabled = !!disabled && !accessibleWhenDisabled; const [focusVisible, setFocusVisible] = (0,external_React_.useState)(false); (0,external_React_.useEffect)(() => { if (!focusable) return; if (trulyDisabled && focusVisible) { setFocusVisible(false); } }, [focusable, trulyDisabled, focusVisible]); (0,external_React_.useEffect)(() => { if (!focusable) return; if (!focusVisible) return; const element = ref.current; if (!element) return; if (typeof IntersectionObserver === "undefined") return; const observer = new IntersectionObserver(() => { if (!isFocusable(element)) { setFocusVisible(false); } }); observer.observe(element); return () => observer.disconnect(); }, [focusable, focusVisible]); const onKeyPressCapture = useDisableEvent( props.onKeyPressCapture, disabled ); const onMouseDownCapture = useDisableEvent( props.onMouseDownCapture, disabled ); const onClickCapture = useDisableEvent(props.onClickCapture, disabled); const onMouseDownProp = props.onMouseDown; const onMouseDown = useEvent((event) => { onMouseDownProp == null ? void 0 : onMouseDownProp(event); if (event.defaultPrevented) return; if (!focusable) return; const element = event.currentTarget; if (!isSafariBrowser) return; if (isPortalEvent(event)) return; if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return; let receivedFocus = false; const onFocus = () => { receivedFocus = true; }; const options = { capture: true, once: true }; element.addEventListener("focusin", onFocus, options); const focusableContainer = getClosestFocusable(element.parentElement); markSafariFocusAncestor(focusableContainer, true); queueBeforeEvent(element, "mouseup", () => { element.removeEventListener("focusin", onFocus, true); markSafariFocusAncestor(focusableContainer, false); if (receivedFocus) return; focusIfNeeded(element); }); }); const handleFocusVisible = (event, currentTarget) => { if (currentTarget) { event.currentTarget = currentTarget; } if (!focusable) return; const element = event.currentTarget; if (!element) return; if (!hasFocus(element)) return; onFocusVisible == null ? void 0 : onFocusVisible(event); if (event.defaultPrevented) return; element.dataset.focusVisible = "true"; setFocusVisible(true); }; const onKeyDownCaptureProp = props.onKeyDownCapture; const onKeyDownCapture = useEvent((event) => { onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event); if (event.defaultPrevented) return; if (!focusable) return; if (focusVisible) return; if (event.metaKey) return; if (event.altKey) return; if (event.ctrlKey) return; if (!isSelfTarget(event)) return; const element = event.currentTarget; const applyFocusVisible = () => handleFocusVisible(event, element); queueBeforeEvent(element, "focusout", applyFocusVisible); }); const onFocusCaptureProp = props.onFocusCapture; const onFocusCapture = useEvent((event) => { onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); if (event.defaultPrevented) return; if (!focusable) return; if (!isSelfTarget(event)) { setFocusVisible(false); return; } const element = event.currentTarget; const applyFocusVisible = () => handleFocusVisible(event, element); if (isKeyboardModality || isAlwaysFocusVisible(event.target)) { queueBeforeEvent(event.target, "focusout", applyFocusVisible); } else { setFocusVisible(false); } }); const onBlurProp = props.onBlur; const onBlur = useEvent((event) => { onBlurProp == null ? void 0 : onBlurProp(event); if (!focusable) return; if (!isFocusEventOutside(event)) return; setFocusVisible(false); }); const autoFocusOnShow = (0,external_React_.useContext)(FocusableContext); const autoFocusRef = useEvent((element) => { if (!focusable) return; if (!autoFocus) return; if (!element) return; if (!autoFocusOnShow) return; queueMicrotask(() => { if (hasFocus(element)) return; if (!isFocusable(element)) return; element.focus(); }); }); const tagName = useTagName(ref); const nativeTabbable = focusable && isNativeTabbable(tagName); const supportsDisabled = focusable && supportsDisabledAttribute(tagName); const styleProp = props.style; const style = (0,external_React_.useMemo)(() => { if (trulyDisabled) { return _3YLGPPWQ_spreadValues({ pointerEvents: "none" }, styleProp); } return styleProp; }, [trulyDisabled, styleProp]); props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({ "data-focus-visible": focusable && focusVisible || void 0, "data-autofocus": autoFocus || void 0, "aria-disabled"