qsdklsqkdmqskdmlqskd azoepqikdomlqskdjmlqs qpfklqjsfmklqsjdmqlsjdsqd home/broads13/public_html/modpromatl.com/wp-includes/js/dist/plugins.js000064400000033230152331277340022207 0ustar00/******/ (() => { // 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__, { PluginArea: () => (/* reexport */ plugin_area_default), getPlugin: () => (/* reexport */ getPlugin), getPlugins: () => (/* reexport */ getPlugins), registerPlugin: () => (/* reexport */ registerPlugin), unregisterPlugin: () => (/* reexport */ unregisterPlugin), usePluginContext: () => (/* reexport */ usePluginContext), withPluginContext: () => (/* reexport */ withPluginContext) }); ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./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) => ReturnType) & 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; } ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// external ["wp","isShallowEqual"] const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// 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/plugins/build-module/components/plugin-context/index.js const Context = (0,external_wp_element_namespaceObject.createContext)({ name: null, icon: null }); Context.displayName = "PluginContext"; const PluginContextProvider = Context.Provider; function usePluginContext() { return (0,external_wp_element_namespaceObject.useContext)(Context); } const withPluginContext = (mapContextToProps) => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)((OriginalComponent) => { external_wp_deprecated_default()("wp.plugins.withPluginContext", { since: "6.8.0", alternative: "wp.plugins.usePluginContext" }); return (props) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Context.Consumer, { children: (context) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( OriginalComponent, { ...props, ...mapContextToProps(context, props) } ) }); }, "withPluginContext"); ;// ./node_modules/@wordpress/plugins/build-module/components/plugin-error-boundary/index.js class PluginErrorBoundary extends external_wp_element_namespaceObject.Component { constructor(props) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError() { return { hasError: true }; } componentDidCatch(error) { const { name, onError } = this.props; if (onError) { onError(name, error); } } render() { if (!this.state.hasError) { return this.props.children; } return null; } } ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// ./node_modules/@wordpress/icons/build-module/library/plugins.js var plugins_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z" }) }); ;// ./node_modules/@wordpress/plugins/build-module/api/index.js const plugins = {}; function registerPlugin(name, settings) { if (typeof settings !== "object") { console.error("No settings object provided!"); return null; } if (typeof name !== "string") { console.error("Plugin name must be string."); return null; } if (!/^[a-z][a-z0-9-]*$/.test(name)) { console.error( 'Plugin name must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-plugin".' ); return null; } if (plugins[name]) { console.error(`Plugin "${name}" is already registered.`); } settings = (0,external_wp_hooks_namespaceObject.applyFilters)( "plugins.registerPlugin", settings, name ); const { render, scope } = settings; if (typeof render !== "function") { console.error( 'The "render" property must be specified and must be a valid function.' ); return null; } if (scope) { if (typeof scope !== "string") { console.error("Plugin scope must be string."); return null; } if (!/^[a-z][a-z0-9-]*$/.test(scope)) { console.error( 'Plugin scope must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-page".' ); return null; } } plugins[name] = { name, icon: plugins_default, ...settings }; (0,external_wp_hooks_namespaceObject.doAction)("plugins.pluginRegistered", settings, name); return settings; } function unregisterPlugin(name) { if (!plugins[name]) { console.error('Plugin "' + name + '" is not registered.'); return; } const oldPlugin = plugins[name]; delete plugins[name]; (0,external_wp_hooks_namespaceObject.doAction)("plugins.pluginUnregistered", oldPlugin, name); return oldPlugin; } function getPlugin(name) { return plugins[name]; } function getPlugins(scope) { return Object.values(plugins).filter( (plugin) => plugin.scope === scope ); } ;// ./node_modules/@wordpress/plugins/build-module/components/plugin-area/index.js const getPluginContext = memize( (icon, name) => ({ icon, name }) ); function PluginArea({ scope, onError }) { const store = (0,external_wp_element_namespaceObject.useMemo)(() => { let lastValue = []; return { subscribe(listener) { (0,external_wp_hooks_namespaceObject.addAction)( "plugins.pluginRegistered", "core/plugins/plugin-area/plugins-registered", listener ); (0,external_wp_hooks_namespaceObject.addAction)( "plugins.pluginUnregistered", "core/plugins/plugin-area/plugins-unregistered", listener ); return () => { (0,external_wp_hooks_namespaceObject.removeAction)( "plugins.pluginRegistered", "core/plugins/plugin-area/plugins-registered" ); (0,external_wp_hooks_namespaceObject.removeAction)( "plugins.pluginUnregistered", "core/plugins/plugin-area/plugins-unregistered" ); }; }, getValue() { const nextValue = getPlugins(scope); if (!external_wp_isShallowEqual_default()(lastValue, nextValue)) { lastValue = nextValue; } return lastValue; } }; }, [scope]); const plugins = (0,external_wp_element_namespaceObject.useSyncExternalStore)( store.subscribe, store.getValue, store.getValue ); return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { display: "none" }, children: plugins.map(({ icon, name, render: Plugin }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( PluginContextProvider, { value: getPluginContext(icon, name), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PluginErrorBoundary, { name, onError, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Plugin, {}) }) }, name )) }); } var plugin_area_default = PluginArea; ;// ./node_modules/@wordpress/plugins/build-module/components/index.js ;// ./node_modules/@wordpress/plugins/build-module/index.js (window.wp = window.wp || {}).plugins = __webpack_exports__; /******/ })() ;home/broads13/public_html/wp-includes/js/dist/plugins.js000066600000027257152331764300017271 0ustar00"use strict"; var wp; (wp ||= {}).plugins = (() => { var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // package-external:@wordpress/element var require_element = __commonJS({ "package-external:@wordpress/element"(exports, module) { module.exports = window.wp.element; } }); // package-external:@wordpress/hooks var require_hooks = __commonJS({ "package-external:@wordpress/hooks"(exports, module) { module.exports = window.wp.hooks; } }); // package-external:@wordpress/is-shallow-equal var require_is_shallow_equal = __commonJS({ "package-external:@wordpress/is-shallow-equal"(exports, module) { module.exports = window.wp.isShallowEqual; } }); // package-external:@wordpress/compose var require_compose = __commonJS({ "package-external:@wordpress/compose"(exports, module) { module.exports = window.wp.compose; } }); // package-external:@wordpress/deprecated var require_deprecated = __commonJS({ "package-external:@wordpress/deprecated"(exports, module) { module.exports = window.wp.deprecated; } }); // vendor-external:react/jsx-runtime var require_jsx_runtime = __commonJS({ "vendor-external:react/jsx-runtime"(exports, module) { module.exports = window.ReactJSXRuntime; } }); // package-external:@wordpress/primitives var require_primitives = __commonJS({ "package-external:@wordpress/primitives"(exports, module) { module.exports = window.wp.primitives; } }); // packages/plugins/build-module/index.mjs var index_exports = {}; __export(index_exports, { PluginArea: () => plugin_area_default, getPlugin: () => getPlugin, getPlugins: () => getPlugins, registerPlugin: () => registerPlugin, unregisterPlugin: () => unregisterPlugin, usePluginContext: () => usePluginContext, withPluginContext: () => withPluginContext }); // node_modules/memize/dist/index.js function memize(fn, options) { var size = 0; var head; var tail; options = options || {}; function memoized() { var node = head, len = arguments.length, args, i; searchCache: while (node) { if (node.args.length !== arguments.length) { node = node.next; continue; } for (i = 0; i < len; i++) { if (node.args[i] !== arguments[i]) { node = node.next; continue searchCache; } } if (node !== head) { if (node === tail) { tail = node.prev; } node.prev.next = node.next; if (node.next) { node.next.prev = node.prev; } node.next = head; node.prev = null; head.prev = node; head = node; } return node.val; } args = new Array(len); for (i = 0; i < len; i++) { args[i] = arguments[i]; } node = { args, // Generate the result from original function val: fn.apply(null, args) }; if (head) { head.prev = node; node.next = head; } else { tail = node; } if (size === /** @type {MemizeOptions} */ options.maxSize) { tail = /** @type {MemizeCacheNode} */ tail.prev; tail.next = null; } else { size++; } head = node; return node.val; } memoized.clear = function() { head = null; tail = null; size = 0; }; return memoized; } // packages/plugins/build-module/components/plugin-area/index.mjs var import_element3 = __toESM(require_element(), 1); var import_hooks2 = __toESM(require_hooks(), 1); var import_is_shallow_equal = __toESM(require_is_shallow_equal(), 1); // packages/plugins/build-module/components/plugin-context/index.mjs var import_element = __toESM(require_element(), 1); var import_compose = __toESM(require_compose(), 1); var import_deprecated = __toESM(require_deprecated(), 1); var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); var Context = (0, import_element.createContext)({ name: null, icon: null }); Context.displayName = "PluginContext"; var PluginContextProvider = Context.Provider; function usePluginContext() { return (0, import_element.useContext)(Context); } var withPluginContext = (mapContextToProps) => (0, import_compose.createHigherOrderComponent)((OriginalComponent) => { (0, import_deprecated.default)("wp.plugins.withPluginContext", { since: "6.8.0", alternative: "wp.plugins.usePluginContext" }); return (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Consumer, { children: (context) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)( OriginalComponent, { ...props, ...mapContextToProps(context, props) } ) }); }, "withPluginContext"); // packages/plugins/build-module/components/plugin-error-boundary/index.mjs var import_element2 = __toESM(require_element(), 1); var PluginErrorBoundary = class extends import_element2.Component { constructor(props) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError() { return { hasError: true }; } componentDidCatch(error) { const { name, onError } = this.props; if (onError) { onError(name, error); } } render() { if (!this.state.hasError) { return this.props.children; } return null; } }; // packages/plugins/build-module/api/index.mjs var import_hooks = __toESM(require_hooks(), 1); // packages/icons/build-module/library/plugins.mjs var import_primitives = __toESM(require_primitives(), 1); var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); var plugins_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.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" }) }); // packages/plugins/build-module/api/index.mjs var plugins = {}; function registerPlugin(name, settings) { if (typeof settings !== "object") { console.error("No settings object provided!"); return null; } if (typeof name !== "string") { console.error("Plugin name must be string."); return null; } if (!/^[a-z][a-z0-9-]*$/.test(name)) { console.error( 'Plugin name must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-plugin".' ); return null; } if (plugins[name]) { console.error(`Plugin "${name}" is already registered.`); } settings = (0, import_hooks.applyFilters)( "plugins.registerPlugin", settings, name ); const { render, scope } = settings; if (typeof render !== "function") { console.error( 'The "render" property must be specified and must be a valid function.' ); return null; } if (scope) { if (typeof scope !== "string") { console.error("Plugin scope must be string."); return null; } if (!/^[a-z][a-z0-9-]*$/.test(scope)) { console.error( 'Plugin scope must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-page".' ); return null; } } plugins[name] = { name, icon: plugins_default, ...settings }; (0, import_hooks.doAction)("plugins.pluginRegistered", settings, name); return settings; } function unregisterPlugin(name) { if (!plugins[name]) { console.error('Plugin "' + name + '" is not registered.'); return; } const oldPlugin = plugins[name]; delete plugins[name]; (0, import_hooks.doAction)("plugins.pluginUnregistered", oldPlugin, name); return oldPlugin; } function getPlugin(name) { return plugins[name]; } function getPlugins(scope) { return Object.values(plugins).filter( (plugin) => plugin.scope === scope ); } // packages/plugins/build-module/components/plugin-area/index.mjs var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); var getPluginContext = memize( (icon, name) => ({ icon, name }) ); function PluginArea({ scope, onError }) { const store = (0, import_element3.useMemo)(() => { let lastValue = []; return { subscribe(listener) { (0, import_hooks2.addAction)( "plugins.pluginRegistered", "core/plugins/plugin-area/plugins-registered", listener ); (0, import_hooks2.addAction)( "plugins.pluginUnregistered", "core/plugins/plugin-area/plugins-unregistered", listener ); return () => { (0, import_hooks2.removeAction)( "plugins.pluginRegistered", "core/plugins/plugin-area/plugins-registered" ); (0, import_hooks2.removeAction)( "plugins.pluginUnregistered", "core/plugins/plugin-area/plugins-unregistered" ); }; }, getValue() { const nextValue = getPlugins(scope); if (!(0, import_is_shallow_equal.isShallowEqual)(lastValue, nextValue)) { lastValue = nextValue; } return lastValue; } }; }, [scope]); const plugins2 = (0, import_element3.useSyncExternalStore)( store.subscribe, store.getValue, store.getValue ); return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { display: "none" }, children: plugins2.map(({ icon, name, render: Plugin }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( PluginContextProvider, { value: getPluginContext(icon, name), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PluginErrorBoundary, { name, onError, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Plugin, {}) }) }, name )) }); } var plugin_area_default = PluginArea; return __toCommonJS(index_exports); })(); home/broads13/public_html/carrafina.com/wp-includes/js/dist/plugins.js000066600000027257152332073040021767 0ustar00"use strict"; var wp; (wp ||= {}).plugins = (() => { var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // package-external:@wordpress/element var require_element = __commonJS({ "package-external:@wordpress/element"(exports, module) { module.exports = window.wp.element; } }); // package-external:@wordpress/hooks var require_hooks = __commonJS({ "package-external:@wordpress/hooks"(exports, module) { module.exports = window.wp.hooks; } }); // package-external:@wordpress/is-shallow-equal var require_is_shallow_equal = __commonJS({ "package-external:@wordpress/is-shallow-equal"(exports, module) { module.exports = window.wp.isShallowEqual; } }); // package-external:@wordpress/compose var require_compose = __commonJS({ "package-external:@wordpress/compose"(exports, module) { module.exports = window.wp.compose; } }); // package-external:@wordpress/deprecated var require_deprecated = __commonJS({ "package-external:@wordpress/deprecated"(exports, module) { module.exports = window.wp.deprecated; } }); // vendor-external:react/jsx-runtime var require_jsx_runtime = __commonJS({ "vendor-external:react/jsx-runtime"(exports, module) { module.exports = window.ReactJSXRuntime; } }); // package-external:@wordpress/primitives var require_primitives = __commonJS({ "package-external:@wordpress/primitives"(exports, module) { module.exports = window.wp.primitives; } }); // packages/plugins/build-module/index.mjs var index_exports = {}; __export(index_exports, { PluginArea: () => plugin_area_default, getPlugin: () => getPlugin, getPlugins: () => getPlugins, registerPlugin: () => registerPlugin, unregisterPlugin: () => unregisterPlugin, usePluginContext: () => usePluginContext, withPluginContext: () => withPluginContext }); // node_modules/memize/dist/index.js function memize(fn, options) { var size = 0; var head; var tail; options = options || {}; function memoized() { var node = head, len = arguments.length, args, i; searchCache: while (node) { if (node.args.length !== arguments.length) { node = node.next; continue; } for (i = 0; i < len; i++) { if (node.args[i] !== arguments[i]) { node = node.next; continue searchCache; } } if (node !== head) { if (node === tail) { tail = node.prev; } node.prev.next = node.next; if (node.next) { node.next.prev = node.prev; } node.next = head; node.prev = null; head.prev = node; head = node; } return node.val; } args = new Array(len); for (i = 0; i < len; i++) { args[i] = arguments[i]; } node = { args, // Generate the result from original function val: fn.apply(null, args) }; if (head) { head.prev = node; node.next = head; } else { tail = node; } if (size === /** @type {MemizeOptions} */ options.maxSize) { tail = /** @type {MemizeCacheNode} */ tail.prev; tail.next = null; } else { size++; } head = node; return node.val; } memoized.clear = function() { head = null; tail = null; size = 0; }; return memoized; } // packages/plugins/build-module/components/plugin-area/index.mjs var import_element3 = __toESM(require_element(), 1); var import_hooks2 = __toESM(require_hooks(), 1); var import_is_shallow_equal = __toESM(require_is_shallow_equal(), 1); // packages/plugins/build-module/components/plugin-context/index.mjs var import_element = __toESM(require_element(), 1); var import_compose = __toESM(require_compose(), 1); var import_deprecated = __toESM(require_deprecated(), 1); var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); var Context = (0, import_element.createContext)({ name: null, icon: null }); Context.displayName = "PluginContext"; var PluginContextProvider = Context.Provider; function usePluginContext() { return (0, import_element.useContext)(Context); } var withPluginContext = (mapContextToProps) => (0, import_compose.createHigherOrderComponent)((OriginalComponent) => { (0, import_deprecated.default)("wp.plugins.withPluginContext", { since: "6.8.0", alternative: "wp.plugins.usePluginContext" }); return (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Consumer, { children: (context) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)( OriginalComponent, { ...props, ...mapContextToProps(context, props) } ) }); }, "withPluginContext"); // packages/plugins/build-module/components/plugin-error-boundary/index.mjs var import_element2 = __toESM(require_element(), 1); var PluginErrorBoundary = class extends import_element2.Component { constructor(props) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError() { return { hasError: true }; } componentDidCatch(error) { const { name, onError } = this.props; if (onError) { onError(name, error); } } render() { if (!this.state.hasError) { return this.props.children; } return null; } }; // packages/plugins/build-module/api/index.mjs var import_hooks = __toESM(require_hooks(), 1); // packages/icons/build-module/library/plugins.mjs var import_primitives = __toESM(require_primitives(), 1); var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); var plugins_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.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" }) }); // packages/plugins/build-module/api/index.mjs var plugins = {}; function registerPlugin(name, settings) { if (typeof settings !== "object") { console.error("No settings object provided!"); return null; } if (typeof name !== "string") { console.error("Plugin name must be string."); return null; } if (!/^[a-z][a-z0-9-]*$/.test(name)) { console.error( 'Plugin name must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-plugin".' ); return null; } if (plugins[name]) { console.error(`Plugin "${name}" is already registered.`); } settings = (0, import_hooks.applyFilters)( "plugins.registerPlugin", settings, name ); const { render, scope } = settings; if (typeof render !== "function") { console.error( 'The "render" property must be specified and must be a valid function.' ); return null; } if (scope) { if (typeof scope !== "string") { console.error("Plugin scope must be string."); return null; } if (!/^[a-z][a-z0-9-]*$/.test(scope)) { console.error( 'Plugin scope must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-page".' ); return null; } } plugins[name] = { name, icon: plugins_default, ...settings }; (0, import_hooks.doAction)("plugins.pluginRegistered", settings, name); return settings; } function unregisterPlugin(name) { if (!plugins[name]) { console.error('Plugin "' + name + '" is not registered.'); return; } const oldPlugin = plugins[name]; delete plugins[name]; (0, import_hooks.doAction)("plugins.pluginUnregistered", oldPlugin, name); return oldPlugin; } function getPlugin(name) { return plugins[name]; } function getPlugins(scope) { return Object.values(plugins).filter( (plugin) => plugin.scope === scope ); } // packages/plugins/build-module/components/plugin-area/index.mjs var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); var getPluginContext = memize( (icon, name) => ({ icon, name }) ); function PluginArea({ scope, onError }) { const store = (0, import_element3.useMemo)(() => { let lastValue = []; return { subscribe(listener) { (0, import_hooks2.addAction)( "plugins.pluginRegistered", "core/plugins/plugin-area/plugins-registered", listener ); (0, import_hooks2.addAction)( "plugins.pluginUnregistered", "core/plugins/plugin-area/plugins-unregistered", listener ); return () => { (0, import_hooks2.removeAction)( "plugins.pluginRegistered", "core/plugins/plugin-area/plugins-registered" ); (0, import_hooks2.removeAction)( "plugins.pluginUnregistered", "core/plugins/plugin-area/plugins-unregistered" ); }; }, getValue() { const nextValue = getPlugins(scope); if (!(0, import_is_shallow_equal.isShallowEqual)(lastValue, nextValue)) { lastValue = nextValue; } return lastValue; } }; }, [scope]); const plugins2 = (0, import_element3.useSyncExternalStore)( store.subscribe, store.getValue, store.getValue ); return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { display: "none" }, children: plugins2.map(({ icon, name, render: Plugin }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( PluginContextProvider, { value: getPluginContext(icon, name), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PluginErrorBoundary, { name, onError, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Plugin, {}) }) }, name )) }); } var plugin_area_default = PluginArea; return __toCommonJS(index_exports); })();